diff --git a/.gitignore b/.gitignore
index 3cc71bcc6..454304255 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,7 +27,7 @@ Auto Run Docs/
src/ui/viewer.html
# Local MCP server config (for development only)
-.mcp.json
+/.mcp.json
.cursor/
# Prevent literal tilde directories (path validation bug artifacts)
@@ -39,3 +39,4 @@ https*/
# Ignore WebStorm project files (for dinosaur IDE users)
.idea/
+plugin/.cli-installed
diff --git a/.mcp.json b/.mcp.json
index da39e4ffa..16e39bb6f 100644
--- a/.mcp.json
+++ b/.mcp.json
@@ -1,3 +1,9 @@
{
- "mcpServers": {}
+ "mcpServers": {
+ "claude-mem": {
+ "type": "stdio",
+ "command": "node",
+ "args": ["plugin/scripts/mcp-server.cjs"]
+ }
+ }
}
diff --git a/.vscode/mcp.json b/.vscode/mcp.json
new file mode 100644
index 000000000..1f093a138
--- /dev/null
+++ b/.vscode/mcp.json
@@ -0,0 +1,9 @@
+{
+ "servers": {
+ "claude-mem": {
+ "type": "stdio",
+ "command": "node",
+ "args": ["${workspaceFolder}/plugin/scripts/mcp-server.cjs"]
+ }
+ }
+}
diff --git a/docs/public/docs.json b/docs/public/docs.json
index a1a36ad73..d11d05e8e 100644
--- a/docs/public/docs.json
+++ b/docs/public/docs.json
@@ -40,6 +40,7 @@
"usage/gemini-provider",
"usage/search-tools",
"usage/claude-desktop",
+ "usage/vscode-mcp",
"usage/private-tags",
"usage/export-import",
"usage/manual-recovery",
diff --git a/docs/public/usage/vscode-mcp.mdx b/docs/public/usage/vscode-mcp.mdx
new file mode 100644
index 000000000..e9d64567d
--- /dev/null
+++ b/docs/public/usage/vscode-mcp.mdx
@@ -0,0 +1,239 @@
+---
+title: VS Code MCP
+description: Use claude-mem memory and code intelligence in VS Code via MCP tools
+icon: code
+---
+
+
+**Tested on:** Windows with VS Code Insiders and the Claude partner agent.
+
+
+## Overview
+
+VS Code can access your claude-mem memory database and code intelligence tools through **MCP (Model Context Protocol)**. Combined with **hooks** that automatically capture observations, this gives you two layers of memory:
+
+- **Automatic capture** (hooks) — SessionStart, PostToolUse, and other lifecycle hooks run automatically, capturing observations to the database as you work
+- **Explicit read/write** (MCP tools) — the agent can search past memories, save new ones, and use AST-based code intelligence on demand
+
+## Prerequisites
+
+- **Node.js** 18.0.0 or higher
+- **Bun** runtime — install from [bun.sh](https://bun.sh) if you don't have it
+- **VS Code** with the Claude partner agent
+
+## Installation
+
+### Step 1: Install the npm Package
+
+```powershell
+npm install -g claude-mem
+```
+
+This installs the pre-built package globally. No compilation or repo cloning needed.
+
+Find the installed path:
+
+```powershell
+$CLAUDE_MEM_PATH = "$(npm root -g)\claude-mem"
+echo $CLAUDE_MEM_PATH
+# e.g. C:\Users\you\AppData\Roaming\npm\node_modules\claude-mem
+```
+
+### Step 2: Start the Worker
+
+The MCP server needs the worker running on localhost:37777. The worker **auto-starts** when the MCP server launches — in most cases you don't need to start it manually.
+
+To start or verify manually:
+
+```powershell
+# Start the worker
+node "$(npm root -g)\claude-mem\plugin\scripts\worker-cli.js" start
+
+# Verify it's running
+curl http://localhost:37777/api/health
+# Should return: {"status":"ok"}
+```
+
+
+The MCP server auto-starts the worker when it launches. If auto-start fails (e.g. Bun not installed), use the manual command above.
+
+
+### Step 3: Add MCP Config to Your Project
+
+The Claude partner agent reads **`.mcp.json`** in your project root (not `.vscode/mcp.json`). Create it with your absolute path:
+
+```json
+{
+ "mcpServers": {
+ "claude-mem": {
+ "type": "stdio",
+ "command": "node",
+ "args": ["C:/Users/YOU/AppData/Roaming/npm/node_modules/claude-mem/plugin/scripts/mcp-server.cjs"]
+ }
+ }
+}
+```
+
+
+**Use your actual absolute path.** Replace `C:/Users/YOU/...` with the output from `npm root -g`. The Claude partner agent does **not** resolve VS Code variables like `${workspaceFolder}` or `${userHome}`.
+
+
+### Step 4: Add Agent Instructions
+
+The Claude partner agent reads **`CLAUDE.md`** in your project root. Add the MCP tool instructions so the agent uses claude-mem tools:
+
+```powershell
+# Append instructions to your project's CLAUDE.md
+Get-Content "$(npm root -g)\claude-mem\plugin\templates\claude-mem.instructions.md" | Add-Content CLAUDE.md
+```
+
+Or manually add this to your `CLAUDE.md`:
+
+```markdown
+## MCP Tool Requirements (MANDATORY)
+
+When the `claude-mem` MCP is available, you MUST use these tools. This is NOT optional.
+
+### Code Exploration — use claude-mem tools INSTEAD of built-in tools:
+
+| Task | USE THIS | NOT THIS |
+|------|----------|----------|
+| Find symbols, functions, classes | `smart_search` | Grep, Glob |
+| Understand file structure | `smart_outline` | Read (full file) |
+| Read a specific function | `smart_unfold` | Read (full file) |
+| Recall past work / decisions | `search` → `timeline` → `get_observations` | Starting from scratch |
+
+### Memory — save as you work, NOT at the end:
+
+- **`save_memory`**: Use IMMEDIATELY when you discover something important
+- Do NOT batch memories at the end of a session. Save them inline as you work.
+- Before starting work, ALWAYS check memory first: `search` for relevant past observations
+```
+
+
+The Claude partner agent also supports **hooks** — lifecycle events (SessionStart, PostToolUse, etc.) that automatically capture observations to the claude-mem database. The MCP tools give the agent **explicit** read/write access on top of that automatic capture.
+
+
+
+The agent also maintains a **local memory file** at `~/.claude/projects//memory/MEMORY.md`. This is Claude's built-in memory — separate from the claude-mem database. Both work together: the local file gives fast session context, while claude-mem provides rich searchable history across all sessions.
+
+
+### Step 5: Reload VS Code
+
+Reload the VS Code window (`Ctrl+Shift+P` → "Developer: Reload Window") for the MCP server to connect.
+
+## Verify It Works
+
+Test the MCP connection in your VS Code agent chat:
+
+**1. Check tools are available** — ask the agent:
+```
+Do you have access to claude-mem MCP tools? List them.
+```
+The agent should list tools like `search`, `timeline`, `save_memory`, `smart_search`, etc.
+
+**2. Save a test memory:**
+```
+Use save_memory to save: "Testing claude-mem MCP integration"
+```
+You should see a success response with an observation ID.
+
+**3. Search for it:**
+```
+Search claude-mem for "testing"
+```
+The test memory should appear in results.
+
+**4. Try code intelligence:**
+```
+Use smart_outline on any source file in this project
+```
+
+
+If the agent doesn't see the tools, check [Troubleshooting](#troubleshooting) below.
+
+
+## Data Directory
+
+On first use, the worker creates `~/.claude-mem/` with:
+
+| Path | Description |
+|------|-------------|
+| `~/.claude-mem/claude-mem.db` | SQLite database (all observations and memories) |
+| `~/.claude-mem/settings.json` | Configuration (auto-created with defaults) |
+| `~/.claude-mem/logs/` | Worker logs |
+
+Override with: `set CLAUDE_MEM_DATA_DIR=C:\custom\path`
+
+## Available Tools
+
+### Memory Tools (3-Layer Workflow)
+
+| Tool | Description |
+|------|-------------|
+| `search` | Search memory index — returns compact results with IDs for filtering |
+| `timeline` | Get chronological context around a query or observation ID |
+| `get_observations` | Fetch full observation details by ID (use after filtering) |
+| `save_memory` | Persist discoveries, decisions, and patterns for future sessions |
+
+**Token-efficient workflow:**
+
+1. **Search** → Get index with IDs (~50-100 tokens/result)
+2. **Timeline** → Get context around interesting results
+3. **Get Observations** → Fetch full details ONLY for filtered IDs
+
+### Code Intelligence Tools
+
+| Tool | Description |
+|------|-------------|
+| `smart_search` | AST-based symbol search using tree-sitter — finds functions, classes, types |
+| `smart_outline` | Structural file outline with signatures (bodies folded) — cheaper than reading full files |
+| `smart_unfold` | Expand a specific symbol to see its full source code |
+
+## Usage
+
+Once installed, the agent will use claude-mem tools when prompted:
+
+```
+"What did we work on last session?"
+"Find the authentication middleware"
+"Show me the outline of worker-service.ts"
+"How did we implement the caching layer?"
+"Save this decision: we chose JWT over sessions for auth"
+```
+
+## Troubleshooting
+
+### MCP Server Not Connecting
+
+1. Verify the worker is running: `curl http://localhost:37777/api/health`
+2. Run `node \mcp-server.cjs` directly to test
+3. Ensure Node.js is on your PATH
+4. Check VS Code Output panel → select "MCP" from the dropdown for error logs
+
+### Agent Not Using MCP Tools
+
+1. Verify you have **`.mcp.json`** (not `.vscode/mcp.json`) in your project root with the `mcpServers` key
+2. Verify the path is an **absolute path** to `mcp-server.cjs`
+3. Check your `CLAUDE.md` has the MCP tool preferences section
+4. Reload VS Code window
+
+### Worker Not Starting
+
+1. Ensure **Bun** is installed: `bun --version`
+2. Check if another process is on port 37777
+3. Check worker logs in `~/.claude-mem/logs/`
+
+## Related
+
+
+
+ Set up MCP in Claude Desktop
+
+
+ Complete search API reference
+
+
+ Build custom integrations
+
+
diff --git a/plugin/scripts/mcp-server.cjs b/plugin/scripts/mcp-server.cjs
index 129cba56e..1ed6d4868 100755
--- a/plugin/scripts/mcp-server.cjs
+++ b/plugin/scripts/mcp-server.cjs
@@ -1,22 +1,22 @@
#!/usr/bin/env node
-"use strict";var f$=Object.create;var Ds=Object.defineProperty;var m$=Object.getOwnPropertyDescriptor;var h$=Object.getOwnPropertyNames;var g$=Object.getPrototypeOf,v$=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wn=(e,t)=>{for(var r in t)Ds(e,r,{get:t[r],enumerable:!0})},_$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of h$(t))!v$.call(e,o)&&o!==r&&Ds(e,o,{get:()=>t[o],enumerable:!(n=m$(t,o))||n.enumerable});return e};var hi=(e,t,r)=>(r=e!=null?f$(g$(e)):{},_$(t||!e||!e.__esModule?Ds(r,"default",{value:e,enumerable:!0}):r,e));var Co=S(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Ao=class{};te._CodeOrName=Ao;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var kr=class extends Ao{constructor(t){if(super(),!te.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};te.Name=kr;var it=class extends Ao{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof kr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};te._Code=it;te.nil=new it("");function Bg(e,...t){let r=[e[0]],n=0;for(;n{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ValueScope=Ve.ValueScopeName=Ve.Scope=Ve.varKinds=Ve.UsedValueState=void 0;var Fe=Co(),Od=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ua;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ua||(Ve.UsedValueState=Ua={}));Ve.varKinds={const:new Fe.Name("const"),let:new Fe.Name("let"),var:new Fe.Name("var")};var Za=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Fe.Name?t:this.name(t)}name(t){return new Fe.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Ve.Scope=Za;var La=class extends Fe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Fe._)`.${new Fe.Name(r)}[${n}]`}};Ve.ValueScopeName=La;var yw=(0,Fe._)`\n`,jd=class extends Za{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?yw:Fe.nil}}get(){return this._scope}name(t){return new La(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fe._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=Fe.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,Ua.Started);let l=r(u);if(l){let d=this.opts.es5?Ve.varKinds.var:Ve.varKinds.const;i=(0,Fe._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fe._)`${i}${l}${this.opts._n}`;else throw new Od(u);c.set(u,Ua.Completed)})}return i}};Ve.ValueScope=jd});var W=S(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.or=H.and=H.not=H.CodeGen=H.operators=H.varKinds=H.ValueScopeName=H.ValueScope=H.Scope=H.Name=H.regexpCode=H.stringify=H.getProperty=H.nil=H.strConcat=H.str=H._=void 0;var Q=Co(),pt=Nd(),ar=Co();Object.defineProperty(H,"_",{enumerable:!0,get:function(){return ar._}});Object.defineProperty(H,"str",{enumerable:!0,get:function(){return ar.str}});Object.defineProperty(H,"strConcat",{enumerable:!0,get:function(){return ar.strConcat}});Object.defineProperty(H,"nil",{enumerable:!0,get:function(){return ar.nil}});Object.defineProperty(H,"getProperty",{enumerable:!0,get:function(){return ar.getProperty}});Object.defineProperty(H,"stringify",{enumerable:!0,get:function(){return ar.stringify}});Object.defineProperty(H,"regexpCode",{enumerable:!0,get:function(){return ar.regexpCode}});Object.defineProperty(H,"Name",{enumerable:!0,get:function(){return ar.Name}});var Ja=Nd();Object.defineProperty(H,"Scope",{enumerable:!0,get:function(){return Ja.Scope}});Object.defineProperty(H,"ValueScope",{enumerable:!0,get:function(){return Ja.ValueScope}});Object.defineProperty(H,"ValueScopeName",{enumerable:!0,get:function(){return Ja.ValueScopeName}});Object.defineProperty(H,"varKinds",{enumerable:!0,get:function(){return Ja.varKinds}});H.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var Ut=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Dd=class extends Ut{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?pt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=cn(this.rhs,t,r)),this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},qa=class extends Ut{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Q.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=cn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Q.Name?{}:{...this.lhs.names};return Va(t,this.rhs)}},Rd=class extends qa{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ad=class extends Ut{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Md=class extends Ut{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Cd=class extends Ut{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Ud=class extends Ut{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=cn(this.code,t,r),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},Uo=class extends Ut{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(t,r)||($w(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>zr(t,r.names),{})}},Zt=class extends Uo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Zd=class extends Uo{},sn=class extends Zt{};sn.kind="else";var Sr=class e extends Zt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new sn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Yg(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=cn(this.condition,t,r),this}get names(){let t=super.names;return Va(t,this.condition),this.else&&zr(t,this.else.names),t}};Sr.kind="if";var wr=class extends Zt{};wr.kind="for";var Ld=class extends wr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=cn(this.iteration,t,r),this}get names(){return zr(super.names,this.iteration.names)}},qd=class extends wr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?pt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Va(super.names,this.from);return Va(t,this.to)}},Fa=class extends wr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=cn(this.iterable,t,r),this}get names(){return zr(super.names,this.iterable.names)}},Zo=class extends Zt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Zo.kind="func";var Lo=class extends Uo{render(t){return"return "+super.render(t)}};Lo.kind="return";var Fd=class extends Zt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&zr(t,this.catch.names),this.finally&&zr(t,this.finally.names),t}},qo=class extends Zt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};qo.kind="catch";var Fo=class extends Zt{render(t){return"finally"+super.render(t)}};Fo.kind="finally";var Vd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
-`:""},this._extScope=t,this._scope=new pt.Scope({parent:t}),this._nodes=[new Zd]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Dd(t,i,n)),i}const(t,r,n){return this._def(pt.varKinds.const,t,r,n)}let(t,r,n){return this._def(pt.varKinds.let,t,r,n)}var(t,r,n){return this._def(pt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new qa(t,r,n))}add(t,r){return this._leafNode(new Rd(t,H.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Q.nil&&this._leafNode(new Ud(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Q.addCodeArg)(r,o));return r.push("}"),new Q._Code(r)}if(t,r,n){if(this._blockNode(new Sr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Sr(t))}else(){return this._elseNode(new sn)}endIf(){return this._endBlockNode(Sr,sn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Ld(t),r)}forRange(t,r,n,o,i=this.opts.es5?pt.varKinds.var:pt.varKinds.let){let a=this._scope.toName(t);return this._for(new qd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=pt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof Q.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Q._)`${a}.length`,s=>{this.var(i,(0,Q._)`${a}[${s}]`),n(i)})}return this._for(new Fa("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?pt.varKinds.var:pt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Q._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Fa("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(wr)}label(t){return this._leafNode(new Ad(t))}break(t){return this._leafNode(new Md(t))}return(t){let r=new Lo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Lo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Fd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new qo(i),r(i)}return n&&(this._currNode=o.finally=new Fo,this.code(n)),this._endBlockNode(qo,Fo)}throw(t){return this._leafNode(new Cd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Q.nil,n,o){return this._blockNode(new Zo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Zo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Sr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};H.CodeGen=Vd;function zr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Va(e,t){return t instanceof Q._CodeOrName?zr(e,t.names):e}function cn(e,t,r){if(e instanceof Q.Name)return n(e);if(!o(e))return e;return new Q._Code(e._items.reduce((i,a)=>(a instanceof Q.Name&&(a=n(a)),a instanceof Q._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof Q._Code&&i._items.some(a=>a instanceof Q.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function $w(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Yg(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Q._)`!${Jd(e)}`}H.not=Yg;var bw=Qg(H.operators.AND);function xw(...e){return e.reduce(bw)}H.and=xw;var kw=Qg(H.operators.OR);function Sw(...e){return e.reduce(kw)}H.or=Sw;function Qg(e){return(t,r)=>t===Q.nil?r:r===Q.nil?t:(0,Q._)`${Jd(t)} ${e} ${Jd(r)}`}function Jd(e){return e instanceof Q.Name?e:(0,Q._)`(${e})`}});var re=S(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var le=W(),ww=Co();function zw(e){let t={};for(let r of e)t[r]=!0;return t}B.toHash=zw;function Iw(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(rv(e,t),!nv(t,e.self.RULES.all))}B.alwaysValidSchema=Iw;function rv(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||av(e,`unknown keyword: "${i}"`)}B.checkUnknownRules=rv;function nv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}B.schemaHasRules=nv;function Ew(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}B.schemaHasRulesButRef=Ew;function Tw({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,le._)`${r}`}return(0,le._)`${e}${t}${(0,le.getProperty)(n)}`}B.schemaRefOrVal=Tw;function Pw(e){return ov(decodeURIComponent(e))}B.unescapeFragment=Pw;function Ow(e){return encodeURIComponent(Kd(e))}B.escapeFragment=Ow;function Kd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=Kd;function ov(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=ov;function jw(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}B.eachItem=jw;function ev({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof le.Name?(i instanceof le.Name?e(o,i,a):t(o,i,a),a):i instanceof le.Name?(t(o,a,i),i):r(i,a);return s===le.Name&&!(c instanceof le.Name)?n(o,c):c}}B.mergeEvaluated={props:ev({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,le._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,le._)`${r} || {}`).code((0,le._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,le._)`${r} || {}`),Hd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:iv}),items:ev({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,le._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,le._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function iv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,le._)`{}`);return t!==void 0&&Hd(e,r,t),r}B.evaluatedPropsToName=iv;function Hd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,le._)`${t}${(0,le.getProperty)(n)}`,!0))}B.setEvaluated=Hd;var tv={};function Nw(e,t){return e.scopeValue("func",{ref:t,code:tv[t.code]||(tv[t.code]=new ww._Code(t.code))})}B.useFunc=Nw;var Wd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Wd||(B.Type=Wd={}));function Dw(e,t,r){if(e instanceof le.Name){let n=t===Wd.Num;return r?n?(0,le._)`"[" + ${e} + "]"`:(0,le._)`"['" + ${e} + "']"`:n?(0,le._)`"/" + ${e}`:(0,le._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,le.getProperty)(e).toString():"/"+Kd(e)}B.getErrorPath=Dw;function av(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}B.checkStrictMode=av});var Lt=S(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var Oe=W(),Rw={data:new Oe.Name("data"),valCxt:new Oe.Name("valCxt"),instancePath:new Oe.Name("instancePath"),parentData:new Oe.Name("parentData"),parentDataProperty:new Oe.Name("parentDataProperty"),rootData:new Oe.Name("rootData"),dynamicAnchors:new Oe.Name("dynamicAnchors"),vErrors:new Oe.Name("vErrors"),errors:new Oe.Name("errors"),this:new Oe.Name("this"),self:new Oe.Name("self"),scope:new Oe.Name("scope"),json:new Oe.Name("json"),jsonPos:new Oe.Name("jsonPos"),jsonLen:new Oe.Name("jsonLen"),jsonPart:new Oe.Name("jsonPart")};Gd.default=Rw});var Vo=S(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.extendErrors=je.resetErrorsCount=je.reportExtraError=je.reportError=je.keyword$DataError=je.keywordError=void 0;var ee=W(),Wa=re(),Ue=Lt();je.keywordError={message:({keyword:e})=>(0,ee.str)`must pass "${e}" keyword validation`};je.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ee.str)`"${e}" keyword must be ${t} ($data)`:(0,ee.str)`"${e}" keyword is invalid ($data)`};function Aw(e,t=je.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=uv(e,t,r);n??(a||s)?sv(i,c):cv(o,(0,ee._)`[${c}]`)}je.reportError=Aw;function Mw(e,t=je.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=uv(e,t,r);sv(o,s),i||a||cv(n,Ue.default.vErrors)}je.reportExtraError=Mw;function Cw(e,t){e.assign(Ue.default.errors,t),e.if((0,ee._)`${Ue.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ee._)`${Ue.default.vErrors}.length`,t),()=>e.assign(Ue.default.vErrors,null)))}je.resetErrorsCount=Cw;function Uw({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Ue.default.errors,s=>{e.const(a,(0,ee._)`${Ue.default.vErrors}[${s}]`),e.if((0,ee._)`${a}.instancePath === undefined`,()=>e.assign((0,ee._)`${a}.instancePath`,(0,ee.strConcat)(Ue.default.instancePath,i.errorPath))),e.assign((0,ee._)`${a}.schemaPath`,(0,ee.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,ee._)`${a}.schema`,r),e.assign((0,ee._)`${a}.data`,n))})}je.extendErrors=Uw;function sv(e,t){let r=e.const("err",t);e.if((0,ee._)`${Ue.default.vErrors} === null`,()=>e.assign(Ue.default.vErrors,(0,ee._)`[${r}]`),(0,ee._)`${Ue.default.vErrors}.push(${r})`),e.code((0,ee._)`${Ue.default.errors}++`)}function cv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,ee._)`new ${e.ValidationError}(${t})`):(r.assign((0,ee._)`${n}.errors`,t),r.return(!1))}var Ir={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function uv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ee._)`{}`:Zw(e,t,r)}function Zw(e,t,r={}){let{gen:n,it:o}=e,i=[Lw(o,r),qw(e,r)];return Fw(e,t,i),n.object(...i)}function Lw({errorPath:e},{instancePath:t}){let r=t?(0,ee.str)`${e}${(0,Wa.getErrorPath)(t,Wa.Type.Str)}`:e;return[Ue.default.instancePath,(0,ee.strConcat)(Ue.default.instancePath,r)]}function qw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,ee.str)`${t}/${e}`;return r&&(o=(0,ee.str)`${o}${(0,Wa.getErrorPath)(r,Wa.Type.Str)}`),[Ir.schemaPath,o]}function Fw(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Ir.keyword,o],[Ir.params,typeof t=="function"?t(e):t||(0,ee._)`{}`]),c.messages&&n.push([Ir.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Ir.schema,a],[Ir.parentSchema,(0,ee._)`${l}${d}`],[Ue.default.data,i]),u&&n.push([Ir.propertyName,u])}});var dv=S(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.boolOrEmptySchema=un.topBoolOrEmptySchema=void 0;var Vw=Vo(),Jw=W(),Ww=Lt(),Kw={message:"boolean schema is false"};function Hw(e){let{gen:t,schema:r,validateName:n}=e;r===!1?lv(e,!1):typeof r=="object"&&r.$async===!0?t.return(Ww.default.data):(t.assign((0,Jw._)`${n}.errors`,null),t.return(!0))}un.topBoolOrEmptySchema=Hw;function Gw(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),lv(e)):r.var(t,!0)}un.boolOrEmptySchema=Gw;function lv(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Vw.reportError)(o,Kw,void 0,t)}});var Bd=S(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.getRules=ln.isJSONType=void 0;var Bw=["string","number","integer","boolean","null","object","array"],Xw=new Set(Bw);function Yw(e){return typeof e=="string"&&Xw.has(e)}ln.isJSONType=Yw;function Qw(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ln.getRules=Qw});var Xd=S(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.shouldUseRule=sr.shouldUseGroup=sr.schemaHasRulesForType=void 0;function e0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&pv(e,n)}sr.schemaHasRulesForType=e0;function pv(e,t){return t.rules.some(r=>fv(e,r))}sr.shouldUseGroup=pv;function fv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}sr.shouldUseRule=fv});var Jo=S(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.reportTypeError=Ne.checkDataTypes=Ne.checkDataType=Ne.coerceAndCheckDataType=Ne.getJSONTypes=Ne.getSchemaTypes=Ne.DataType=void 0;var t0=Bd(),r0=Xd(),n0=Vo(),F=W(),mv=re(),dn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(dn||(Ne.DataType=dn={}));function o0(e){let t=hv(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ne.getSchemaTypes=o0;function hv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(t0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ne.getJSONTypes=hv;function i0(e,t){let{gen:r,data:n,opts:o}=e,i=a0(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,r0.schemaHasRulesForType)(e,t[0]));if(a){let s=Qd(t,n,o.strictNumbers,dn.Wrong);r.if(s,()=>{i.length?s0(e,t,i):ep(e)})}return a}Ne.coerceAndCheckDataType=i0;var gv=new Set(["string","number","integer","boolean","null"]);function a0(e,t){return t?e.filter(r=>gv.has(r)||t==="array"&&r==="array"):[]}function s0(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,F._)`typeof ${o}`),s=n.let("coerced",(0,F._)`undefined`);i.coerceTypes==="array"&&n.if((0,F._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,F._)`${o}[0]`).assign(a,(0,F._)`typeof ${o}`).if(Qd(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,F._)`${s} !== undefined`);for(let u of r)(gv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ep(e),n.endIf(),n.if((0,F._)`${s} !== undefined`,()=>{n.assign(o,s),c0(e,s)});function c(u){switch(u){case"string":n.elseIf((0,F._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,F._)`"" + ${o}`).elseIf((0,F._)`${o} === null`).assign(s,(0,F._)`""`);return;case"number":n.elseIf((0,F._)`${a} == "boolean" || ${o} === null
- || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,F._)`+${o}`);return;case"integer":n.elseIf((0,F._)`${a} === "boolean" || ${o} === null
- || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,F._)`+${o}`);return;case"boolean":n.elseIf((0,F._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,F._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,F._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,F._)`${a} === "string" || ${a} === "number"
- || ${a} === "boolean" || ${o} === null`).assign(s,(0,F._)`[${o}]`)}}}function c0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,F._)`${t} !== undefined`,()=>e.assign((0,F._)`${t}[${r}]`,n))}function Yd(e,t,r,n=dn.Correct){let o=n===dn.Correct?F.operators.EQ:F.operators.NEQ,i;switch(e){case"null":return(0,F._)`${t} ${o} null`;case"array":i=(0,F._)`Array.isArray(${t})`;break;case"object":i=(0,F._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,F._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,F._)`typeof ${t} ${o} ${e}`}return n===dn.Correct?i:(0,F.not)(i);function a(s=F.nil){return(0,F.and)((0,F._)`typeof ${t} == "number"`,s,r?(0,F._)`isFinite(${t})`:F.nil)}}Ne.checkDataType=Yd;function Qd(e,t,r,n){if(e.length===1)return Yd(e[0],t,r,n);let o,i=(0,mv.toHash)(e);if(i.array&&i.object){let a=(0,F._)`typeof ${t} != "object"`;o=i.null?a:(0,F._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=F.nil;i.number&&delete i.integer;for(let a in i)o=(0,F.and)(o,Yd(a,t,r,n));return o}Ne.checkDataTypes=Qd;var u0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,F._)`{type: ${e}}`:(0,F._)`{type: ${t}}`};function ep(e){let t=l0(e);(0,n0.reportError)(t,u0)}Ne.reportTypeError=ep;function l0(e){let{gen:t,data:r,schema:n}=e,o=(0,mv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var _v=S(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.assignDefaults=void 0;var pn=W(),d0=re();function p0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)vv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>vv(e,i,o.default))}Ka.assignDefaults=p0;function vv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,pn._)`${i}${(0,pn.getProperty)(t)}`;if(o){(0,d0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,pn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,pn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,pn._)`${s} = ${(0,pn.stringify)(r)}`)}});var at=S(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;var he=W(),tp=re(),cr=Lt(),f0=re();function m0(e,t){let{gen:r,data:n,it:o}=e;r.if(np(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,he._)`${t}`},!0),e.error()})}ae.checkReportMissingProp=m0;function h0({gen:e,data:t,it:{opts:r}},n,o){return(0,he.or)(...n.map(i=>(0,he.and)(np(e,t,i,r.ownProperties),(0,he._)`${o} = ${i}`)))}ae.checkMissingProp=h0;function g0(e,t){e.setParams({missingProperty:t},!0),e.error()}ae.reportMissingProp=g0;function yv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,he._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=yv;function rp(e,t,r){return(0,he._)`${yv(e)}.call(${t}, ${r})`}ae.isOwnProperty=rp;function v0(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} !== undefined`;return n?(0,he._)`${o} && ${rp(e,t,r)}`:o}ae.propertyInData=v0;function np(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} === undefined`;return n?(0,he.or)(o,(0,he.not)(rp(e,t,r))):o}ae.noPropertyInData=np;function $v(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ae.allSchemaProperties=$v;function _0(e,t){return $v(t).filter(r=>!(0,tp.alwaysValidSchema)(e,t[r]))}ae.schemaProperties=_0;function y0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,he._)`${e}, ${t}, ${n}${o}`:t,d=[[cr.default.instancePath,(0,he.strConcat)(cr.default.instancePath,i)],[cr.default.parentData,a.parentData],[cr.default.parentDataProperty,a.parentDataProperty],[cr.default.rootData,cr.default.rootData]];a.opts.dynamicRef&&d.push([cr.default.dynamicAnchors,cr.default.dynamicAnchors]);let m=(0,he._)`${l}, ${r.object(...d)}`;return c!==he.nil?(0,he._)`${s}.call(${c}, ${m})`:(0,he._)`${s}(${m})`}ae.callValidateCode=y0;var $0=(0,he._)`new RegExp`;function b0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,he._)`${o.code==="new RegExp"?$0:(0,f0.useFunc)(e,o)}(${r}, ${n})`})}ae.usePattern=b0;function x0(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,he._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:tp.Type.Num},i),t.if((0,he.not)(i),s)})}}ae.validateArray=x0;function k0(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,tp.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,he._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,he.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ae.validateUnion=k0});var kv=S($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.validateKeywordUsage=$t.validSchemaType=$t.funcKeywordCode=$t.macroKeywordCode=void 0;var Ze=W(),Er=Lt(),S0=at(),w0=Vo();function z0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=xv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ze.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}$t.macroKeywordCode=z0;function I0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;T0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=xv(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&bv(e),_(()=>e.error());else{let b=t.async?p():g();t.modifying&&bv(e),_(()=>E0(e,b))}}function p(){let b=n.let("ruleErrs",null);return n.try(()=>h((0,Ze._)`await `),E=>n.assign(d,!1).if((0,Ze._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Ze._)`${E}.errors`),()=>n.throw(E))),b}function g(){let b=(0,Ze._)`${l}.errors`;return n.assign(b,null),h(Ze.nil),b}function h(b=t.async?(0,Ze._)`await `:Ze.nil){let E=c.opts.passContext?Er.default.this:Er.default.self,I=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ze._)`${b}${(0,S0.callValidateCode)(e,l,E,I)}`,t.modifying)}function _(b){var E;n.if((0,Ze.not)((E=t.valid)!==null&&E!==void 0?E:d),b)}}$t.funcKeywordCode=I0;function bv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ze._)`${n.parentData}[${n.parentDataProperty}]`))}function E0(e,t){let{gen:r}=e;r.if((0,Ze._)`Array.isArray(${t})`,()=>{r.assign(Er.default.vErrors,(0,Ze._)`${Er.default.vErrors} === null ? ${t} : ${Er.default.vErrors}.concat(${t})`).assign(Er.default.errors,(0,Ze._)`${Er.default.vErrors}.length`),(0,w0.extendErrors)(e)},()=>e.error())}function T0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function xv(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ze.stringify)(r)})}function P0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}$t.validSchemaType=P0;function O0({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}$t.validateKeywordUsage=O0});var wv=S(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.extendSubschemaMode=ur.extendSubschemaData=ur.getSubschema=void 0;var bt=W(),Sv=re();function j0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}${(0,bt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Sv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}ur.getSubschema=j0;function N0(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=s.let("data",(0,bt._)`${t.data}${(0,bt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,bt.str)`${u}${(0,Sv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,bt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof bt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}ur.extendSubschemaData=N0;function D0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}ur.extendSubschemaMode=D0});var op=S((pC,zv)=>{"use strict";zv.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Ev=S((fC,Iv)=>{"use strict";var lr=Iv.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Ha(t,n,o,e,"",e)};lr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};lr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};lr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};lr.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 Ha(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in lr.arrayKeywords)for(var m=0;m{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.getSchemaRefs=Je.resolveUrl=Je.normalizeId=Je._getFullPath=Je.getFullPath=Je.inlineRef=void 0;var A0=re(),M0=op(),C0=Ev(),U0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Z0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ip(e):t?Tv(e)<=t:!1}Je.inlineRef=Z0;var L0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ip(e){for(let t in e){if(L0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ip)||typeof r=="object"&&ip(r))return!0}return!1}function Tv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!U0.has(r)&&(typeof e[r]=="object"&&(0,A0.eachItem)(e[r],n=>t+=Tv(n)),t===1/0))return 1/0}return t}function Pv(e,t="",r){r!==!1&&(t=fn(t));let n=e.parse(t);return Ov(e,n)}Je.getFullPath=Pv;function Ov(e,t){return e.serialize(t).split("#")[0]+"#"}Je._getFullPath=Ov;var q0=/#\/?$/;function fn(e){return e?e.replace(q0,""):""}Je.normalizeId=fn;function F0(e,t,r){return r=fn(r),e.resolve(t,r)}Je.resolveUrl=F0;var V0=/^[a-z_][-a-z0-9._]*$/i;function J0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=fn(e[r]||t),i={"":o},a=Pv(n,o,!1),s={},c=new Set;return C0(e,{allKeys:!0},(d,m,p,g)=>{if(g===void 0)return;let h=a+m,_=i[g];typeof d[r]=="string"&&(_=b.call(this,d[r])),E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),i[m]=_;function b(I){let A=this.opts.uriResolver.resolve;if(I=fn(_?A(_,I):I),c.has(I))throw l(I);c.add(I);let j=this.refs[I];return typeof j=="string"&&(j=this.refs[j]),typeof j=="object"?u(d,j.schema,I):I!==fn(h)&&(I[0]==="#"?(u(d,s[I],I),s[I]=d):this.refs[I]=h),I}function E(I){if(typeof I=="string"){if(!V0.test(I))throw new Error(`invalid anchor "${I}"`);b.call(this,`#${I}`)}}}),s;function u(d,m,p){if(m!==void 0&&!M0(d,m))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Je.getSchemaRefs=J0});var Go=S(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.getData=dr.KeywordCxt=dr.validateFunctionCode=void 0;var Av=dv(),jv=Jo(),sp=Xd(),Ga=Jo(),W0=_v(),Ho=kv(),ap=wv(),O=W(),U=Lt(),K0=Wo(),qt=re(),Ko=Vo();function H0(e){if(Uv(e)&&(Zv(e),Cv(e))){X0(e);return}Mv(e,()=>(0,Av.topBoolOrEmptySchema)(e))}dr.validateFunctionCode=H0;function Mv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,O._)`${U.default.data}, ${U.default.valCxt}`,n.$async,()=>{e.code((0,O._)`"use strict"; ${Nv(r,o)}`),B0(e,o),e.code(i)}):e.func(t,(0,O._)`${U.default.data}, ${G0(o)}`,n.$async,()=>e.code(Nv(r,o)).code(i))}function G0(e){return(0,O._)`{${U.default.instancePath}="", ${U.default.parentData}, ${U.default.parentDataProperty}, ${U.default.rootData}=${U.default.data}${e.dynamicRef?(0,O._)`, ${U.default.dynamicAnchors}={}`:O.nil}}={}`}function B0(e,t){e.if(U.default.valCxt,()=>{e.var(U.default.instancePath,(0,O._)`${U.default.valCxt}.${U.default.instancePath}`),e.var(U.default.parentData,(0,O._)`${U.default.valCxt}.${U.default.parentData}`),e.var(U.default.parentDataProperty,(0,O._)`${U.default.valCxt}.${U.default.parentDataProperty}`),e.var(U.default.rootData,(0,O._)`${U.default.valCxt}.${U.default.rootData}`),t.dynamicRef&&e.var(U.default.dynamicAnchors,(0,O._)`${U.default.valCxt}.${U.default.dynamicAnchors}`)},()=>{e.var(U.default.instancePath,(0,O._)`""`),e.var(U.default.parentData,(0,O._)`undefined`),e.var(U.default.parentDataProperty,(0,O._)`undefined`),e.var(U.default.rootData,U.default.data),t.dynamicRef&&e.var(U.default.dynamicAnchors,(0,O._)`{}`)})}function X0(e){let{schema:t,opts:r,gen:n}=e;Mv(e,()=>{r.$comment&&t.$comment&&qv(e),rz(e),n.let(U.default.vErrors,null),n.let(U.default.errors,0),r.unevaluated&&Y0(e),Lv(e),iz(e)})}function Y0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,O._)`${r}.evaluated`),t.if((0,O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,O._)`${e.evaluated}.props`,(0,O._)`undefined`)),t.if((0,O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,O._)`${e.evaluated}.items`,(0,O._)`undefined`))}function Nv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function Q0(e,t){if(Uv(e)&&(Zv(e),Cv(e))){ez(e,t);return}(0,Av.boolOrEmptySchema)(e,t)}function Cv({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Uv(e){return typeof e.schema!="boolean"}function ez(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&qv(e),nz(e),oz(e);let i=n.const("_errs",U.default.errors);Lv(e,i),n.var(t,(0,O._)`${i} === ${U.default.errors}`)}function Zv(e){(0,qt.checkUnknownRules)(e),tz(e)}function Lv(e,t){if(e.opts.jtd)return Dv(e,[],!1,t);let r=(0,jv.getSchemaTypes)(e.schema),n=(0,jv.coerceAndCheckDataType)(e,r);Dv(e,r,!n,t)}function tz(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,qt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function rz(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,qt.checkStrictMode)(e,"default is ignored in the schema root")}function nz(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,K0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function oz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function qv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,O._)`${U.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,O.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,O._)`${U.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function iz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,O._)`${U.default.errors} === 0`,()=>t.return(U.default.data),()=>t.throw((0,O._)`new ${o}(${U.default.vErrors})`)):(t.assign((0,O._)`${n}.errors`,U.default.vErrors),i.unevaluated&&az(e),t.return((0,O._)`${U.default.errors} === 0`))}function az({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0,O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0,O._)`${t}.items`,n)}function Dv(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,qt.schemaHasRulesButRef)(i,l))){o.block(()=>Vv(e,"$ref",l.all.$ref.definition));return}c.jtd||sz(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,sp.shouldUseGroup)(i,m)&&(m.type?(o.if((0,Ga.checkDataType)(m.type,a,c.strictNumbers)),Rv(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,Ga.reportTypeError)(e)),o.endIf()):Rv(e,m),s||o.if((0,O._)`${U.default.errors} === ${n||0}`))}}function Rv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,W0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,sp.shouldUseRule)(n,i)&&Vv(e,i.keyword,i.definition,t.type)})}function sz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(cz(e,t),e.opts.allowUnionTypes||uz(e,t),lz(e,e.dataTypes))}function cz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Fv(e.dataTypes,r)||cp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),pz(e,t)}}function uz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&cp(e,"use allowUnionTypes to allow union type keyword")}function lz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,sp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>dz(t,a))&&cp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function dz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Fv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function pz(e,t){let r=[];for(let n of e.dataTypes)Fv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function cp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,qt.checkStrictMode)(e,t,e.opts.strictTypes)}var Ba=class{constructor(t,r,n){if((0,Ho.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,qt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Jv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Ho.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",U.default.errors))}result(t,r,n){this.failResult((0,O.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,O.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,O._)`${r} !== undefined && (${(0,O.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Ko.reportExtraError:Ko.reportError)(this,this.def.error,r)}$dataError(){(0,Ko.reportError)(this,this.def.$dataError||Ko.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ko.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=O.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),t!==O.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,O.or)(a(),s());function a(){if(n.length){if(!(r instanceof O.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,O._)`${(0,Ga.checkDataTypes)(c,r,i.opts.strictNumbers,Ga.DataType.Wrong)}`}return O.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0,ap.getSubschema)(this.it,t);(0,ap.extendSubschemaData)(n,this.it,t),(0,ap.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return Q0(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=qt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=qt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,O.Name)),!0}};dr.KeywordCxt=Ba;function Vv(e,t,r,n){let o=new Ba(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Ho.funcKeywordCode)(o,r):"macro"in r?(0,Ho.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Ho.funcKeywordCode)(o,r)}var fz=/^\/(?:[^~]|~0|~1)*$/,mz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Jv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return U.default.rootData;if(e[0]==="/"){if(!fz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=U.default.rootData}else{let u=mz.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,O._)`${i}${(0,O.getProperty)((0,qt.unescapeJsonPointer)(u))}`,a=(0,O._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}dr.getData=Jv});var Xa=S(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var up=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};lp.default=up});var Bo=S(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var dp=Wo(),pp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,dp.resolveUrl)(t,r,n),this.missingSchema=(0,dp.normalizeId)((0,dp.getFullPath)(t,this.missingRef))}};fp.default=pp});var Qa=S(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.resolveSchema=st.getCompilingSchema=st.resolveRef=st.compileSchema=st.SchemaEnv=void 0;var ft=W(),hz=Xa(),Tr=Lt(),mt=Wo(),Wv=re(),gz=Go(),mn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,mt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};st.SchemaEnv=mn;function hp(e){let t=Kv.call(this,e);if(t)return t;let r=(0,mt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new ft.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:hz.default,code:(0,ft._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Tr.default.data,parentData:Tr.default.parentData,parentDataProperty:Tr.default.parentDataProperty,dataNames:[Tr.default.data],dataPathArr:[ft.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,ft.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ft.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ft._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,gz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Tr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${Tr.default.self}`,`${Tr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:h}=u;p.evaluated={props:g instanceof ft.Name?void 0:g,items:h instanceof ft.Name?void 0:h,dynamicProps:g instanceof ft.Name,dynamicItems:h instanceof ft.Name},p.source&&(p.source.evaluated=(0,ft.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}st.compileSchema=hp;function vz(e,t,r){var n;r=(0,mt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=$z.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new mn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=_z.call(this,i)}st.resolveRef=vz;function _z(e){return(0,mt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:hp.call(this,e)}function Kv(e){for(let t of this._compilations)if(yz(t,e))return t}st.getCompilingSchema=Kv;function yz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function $z(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Ya.call(this,e,t)}function Ya(e,t){let r=this.opts.uriResolver.parse(t),n=(0,mt._getFullPath)(this.opts.uriResolver,r),o=(0,mt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return mp.call(this,r,e);let i=(0,mt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Ya.call(this,e,a);return typeof s?.schema!="object"?void 0:mp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||hp.call(this,a),i===(0,mt.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,mt.resolveUrl)(this.opts.uriResolver,o,u)),new mn({schema:s,schemaId:c,root:e,baseId:o})}return mp.call(this,r,a)}}st.resolveSchema=Ya;var bz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function mp(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Wv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!bz.has(s)&&u&&(t=(0,mt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Wv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,mt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Ya.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new mn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var Hv=S((yC,xz)=>{xz.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var vp=S(($C,Yv)=>{"use strict";var kz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Bv=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function gp(e){let t="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Sz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Gv(e){return e.length=0,!0}function wz(e,t,r){if(e.length){let n=gp(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function zz(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=wz;for(let c=0;c7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=Gv}else{o.push(u);continue}}return o.length&&(s===Gv?r.zone=o.join(""):a?n.push(o.join("")):n.push(gp(o))),r.address=n.join(""),r}function Xv(e){if(Iz(e,":")<2)return{host:e,isIPV6:!1};let t=zz(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function Iz(e,t){let r=0;for(let n=0;n{"use strict";var{isUUID:Oz}=vp(),jz=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Nz=["http","https","ws","wss","urn","urn:uuid"];function Dz(e){return Nz.indexOf(e)!==-1}function _p(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Qv(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function e_(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Rz(e){return e.secure=_p(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Az(e){if((e.port===(_p(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Mz(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(jz);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=yp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Cz(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=yp(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function Uz(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Oz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Zz(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var t_={scheme:"http",domainHost:!0,parse:Qv,serialize:e_},Lz={scheme:"https",domainHost:t_.domainHost,parse:Qv,serialize:e_},es={scheme:"ws",domainHost:!0,parse:Rz,serialize:Az},qz={scheme:"wss",domainHost:es.domainHost,parse:es.parse,serialize:es.serialize},Fz={scheme:"urn",parse:Mz,serialize:Cz,skipNormalize:!0},Vz={scheme:"urn:uuid",parse:Uz,serialize:Zz,skipNormalize:!0},ts={http:t_,https:Lz,ws:es,wss:qz,urn:Fz,"urn:uuid":Vz};Object.setPrototypeOf(ts,null);function yp(e){return e&&(ts[e]||ts[e.toLowerCase()])||void 0}r_.exports={wsIsSecure:_p,SCHEMES:ts,isValidSchemeName:Dz,getSchemeHandler:yp}});var a_=S((xC,ns)=>{"use strict";var{normalizeIPv6:Jz,removeDotSegments:Xo,recomposeAuthority:Wz,normalizeComponentEncoding:rs,isIPv4:Kz,nonSimpleDomain:Hz}=vp(),{SCHEMES:Gz,getSchemeHandler:o_}=n_();function Bz(e,t){return typeof e=="string"?e=xt(Ft(e,t),t):typeof e=="object"&&(e=Ft(xt(e,t),t)),e}function Xz(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=i_(Ft(e,n),Ft(t,n),n,!0);return n.skipEscape=!0,xt(o,n)}function i_(e,t,r,n){let o={};return n||(e=Ft(xt(e,r),r),t=Ft(xt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Xo(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Xo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Xo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=Xo(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function Yz(e,t,r){return typeof e=="string"?(e=unescape(e),e=xt(rs(Ft(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=xt(rs(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=xt(rs(Ft(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=xt(rs(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function xt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],i=o_(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=Wz(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Xo(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var Qz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ft(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(Qz);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(Kz(n.host)===!1){let c=Jz(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=o_(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&Hz(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var $p={SCHEMES:Gz,normalize:Bz,resolve:Xz,resolveComponent:i_,equal:Yz,serialize:xt,parse:Ft};ns.exports=$p;ns.exports.default=$p;ns.exports.fastUri=$p});var c_=S(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var s_=a_();s_.code='require("ajv/dist/runtime/uri").default';bp.default=s_});var g_=S(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.CodeGen=ze.Name=ze.nil=ze.stringify=ze.str=ze._=ze.KeywordCxt=void 0;var eI=Go();Object.defineProperty(ze,"KeywordCxt",{enumerable:!0,get:function(){return eI.KeywordCxt}});var hn=W();Object.defineProperty(ze,"_",{enumerable:!0,get:function(){return hn._}});Object.defineProperty(ze,"str",{enumerable:!0,get:function(){return hn.str}});Object.defineProperty(ze,"stringify",{enumerable:!0,get:function(){return hn.stringify}});Object.defineProperty(ze,"nil",{enumerable:!0,get:function(){return hn.nil}});Object.defineProperty(ze,"Name",{enumerable:!0,get:function(){return hn.Name}});Object.defineProperty(ze,"CodeGen",{enumerable:!0,get:function(){return hn.CodeGen}});var tI=Xa(),f_=Bo(),rI=Bd(),Yo=Qa(),nI=W(),Qo=Wo(),os=Jo(),kp=re(),u_=Hv(),oI=c_(),m_=(e,t)=>new RegExp(e,t);m_.code="new RegExp";var iI=["removeAdditional","useDefaults","coerceTypes"],aI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),sI={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},cI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},l_=200;function uI(e){var t,r,n,o,i,a,s,c,u,l,d,m,p,g,h,_,b,E,I,A,j,Le,de,Kt,Qe;let Ht=e.strict,Ns=(t=e.code)===null||t===void 0?void 0:t.optimize,jf=Ns===!0||Ns===void 0?1:Ns||0,Nf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:m_,p$=(o=e.uriResolver)!==null&&o!==void 0?o:oI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Ht)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Ht)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ht)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:Ht)!==null&&m!==void 0?m:"log",strictRequired:(g=(p=e.strictRequired)!==null&&p!==void 0?p:Ht)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:jf,regExp:Nf}:{optimize:jf,regExp:Nf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:l_,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:l_,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(I=e.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(A=e.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(j=e.addUsedSchema)!==null&&j!==void 0?j:!0,validateSchema:(Le=e.validateSchema)!==null&&Le!==void 0?Le:!0,validateFormats:(de=e.validateFormats)!==null&&de!==void 0?de:!0,unicodeRegExp:(Kt=e.unicodeRegExp)!==null&&Kt!==void 0?Kt:!0,int32range:(Qe=e.int32range)!==null&&Qe!==void 0?Qe:!0,uriResolver:p$}}var ei=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...uI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new nI.ValueScope({scope:{},prefixes:aI,es5:r,lines:n}),this.logger=hI(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,rI.getRules)(),d_.call(this,sI,t,"NOT SUPPORTED"),d_.call(this,cI,t,"DEPRECATED","warn"),this._metaOpts=fI.call(this),t.formats&&dI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&pI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),lI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=u_;n==="id"&&(o={...u_},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let m=this._addSchema(l,d);return m.validate||a.call(this,m)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof f_.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,Qo.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=p_.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Yo.SchemaEnv({schema:{},schemaId:n});if(r=Yo.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=p_.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,Qo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(vI.call(this,n,r),!r)return(0,kp.eachItem)(n,i=>xp.call(this,i)),this;yI.call(this,r);let o={...r,type:(0,os.getJSONTypes)(r.type),schemaType:(0,os.getJSONTypes)(r.schemaType)};return(0,kp.eachItem)(n,o.type.length===0?i=>xp.call(this,i,o):i=>o.type.forEach(a=>xp.call(this,i,o,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=h_(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,Qo.normalizeId)(a||n);let u=Qo.getSchemaRefs.call(this,t,n);return c=new Yo.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Yo.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Yo.compileSchema.call(this,t)}finally{this.opts=r}}};ei.ValidationError=tI.default;ei.MissingRefError=f_.default;ze.default=ei;function d_(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function p_(e){return e=(0,Qo.normalizeId)(e),this.schemas[e]||this.refs[e]}function lI(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function dI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function pI(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function fI(){let e={...this.opts};for(let t of iI)delete e[t];return e}var mI={log(){},warn(){},error(){}};function hI(e){if(e===!1)return mI;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var gI=/^[a-z_$][a-z0-9_$:-]*$/i;function vI(e,t){let{RULES:r}=this;if((0,kp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!gI.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function xp(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,os.getJSONTypes)(t.type),schemaType:(0,os.getJSONTypes)(t.schemaType)}};t.before?_I.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function _I(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function yI(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=h_(t)),e.validateSchema=this.compile(t,!0))}var $I={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function h_(e){return{anyOf:[e,$I]}}});var v_=S(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var bI={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Sp.default=bI});var b_=S(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.callRef=Pr.getValidate=void 0;var xI=Bo(),__=at(),We=W(),gn=Lt(),y_=Qa(),is=re(),kI={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=y_.resolveRef.call(c,u,o,r);if(l===void 0)throw new xI.default(n.opts.uriResolver,o,r);if(l instanceof y_.SchemaEnv)return m(l);return p(l);function d(){if(i===u)return as(e,a,i,i.$async);let g=t.scopeValue("root",{ref:u});return as(e,(0,We._)`${g}.validate`,u,u.$async)}function m(g){let h=$_(e,g);as(e,h,g,g.$async)}function p(g){let h=t.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,We.stringify)(g)}:{ref:g}),_=t.name("valid"),b=e.subschema({schema:g,dataTypes:[],schemaPath:We.nil,topSchemaRef:h,errSchemaPath:r},_);e.mergeEvaluated(b),e.ok(_)}}};function $_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,We._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Pr.getValidate=$_;function as(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?gn.default.this:We.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,We._)`await ${(0,__.callValidateCode)(e,t,u)}`),p(t),a||o.assign(g,!0)},h=>{o.if((0,We._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),m(h),a||o.assign(g,!1)}),e.ok(g)}function d(){e.result((0,__.callValidateCode)(e,t,u),()=>p(t),()=>m(t))}function m(g){let h=(0,We._)`${g}.errors`;o.assign(gn.default.vErrors,(0,We._)`${gn.default.vErrors} === null ? ${h} : ${gn.default.vErrors}.concat(${h})`),o.assign(gn.default.errors,(0,We._)`${gn.default.vErrors}.length`)}function p(g){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=is.mergeEvaluated.props(o,_.props,i.props));else{let b=o.var("props",(0,We._)`${g}.evaluated.props`);i.props=is.mergeEvaluated.props(o,b,i.props,We.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=is.mergeEvaluated.items(o,_.items,i.items));else{let b=o.var("items",(0,We._)`${g}.evaluated.items`);i.items=is.mergeEvaluated.items(o,b,i.items,We.Name)}}}Pr.callRef=as;Pr.default=kI});var x_=S(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});var SI=v_(),wI=b_(),zI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",SI.default,wI.default];wp.default=zI});var k_=S(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var ss=W(),pr=ss.operators,cs={maximum:{okStr:"<=",ok:pr.LTE,fail:pr.GT},minimum:{okStr:">=",ok:pr.GTE,fail:pr.LT},exclusiveMaximum:{okStr:"<",ok:pr.LT,fail:pr.GTE},exclusiveMinimum:{okStr:">",ok:pr.GT,fail:pr.LTE}},II={message:({keyword:e,schemaCode:t})=>(0,ss.str)`must be ${cs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,ss._)`{comparison: ${cs[e].okStr}, limit: ${t}}`},EI={keyword:Object.keys(cs),type:"number",schemaType:"number",$data:!0,error:II,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,ss._)`${r} ${cs[t].fail} ${n} || isNaN(${r})`)}};zp.default=EI});var S_=S(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var ti=W(),TI={message:({schemaCode:e})=>(0,ti.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ti._)`{multipleOf: ${e}}`},PI={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:TI,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,ti._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,ti._)`${a} !== parseInt(${a})`;e.fail$data((0,ti._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Ip.default=PI});var z_=S(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});function w_(e){let t=e.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var Or=W(),OI=re(),jI=z_(),NI={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Or.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Or._)`{limit: ${e}}`},DI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:NI,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Or.operators.GT:Or.operators.LT,a=o.opts.unicode===!1?(0,Or._)`${r}.length`:(0,Or._)`${(0,OI.useFunc)(e.gen,jI.default)}(${r})`;e.fail$data((0,Or._)`${a} ${i} ${n}`)}};Tp.default=DI});var E_=S(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var RI=at(),us=W(),AI={message:({schemaCode:e})=>(0,us.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,us._)`{pattern: ${e}}`},MI={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:AI,code(e){let{data:t,$data:r,schema:n,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"",s=r?(0,us._)`(new RegExp(${o}, ${a}))`:(0,RI.usePattern)(e,n);e.fail$data((0,us._)`!${s}.test(${t})`)}};Pp.default=MI});var T_=S(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var ri=W(),CI={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ri.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ri._)`{limit: ${e}}`},UI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:CI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?ri.operators.GT:ri.operators.LT;e.fail$data((0,ri._)`Object.keys(${r}).length ${o} ${n}`)}};Op.default=UI});var P_=S(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var ni=at(),oi=W(),ZI=re(),LI={message:({params:{missingProperty:e}})=>(0,oi.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,oi._)`{missingProperty: ${e}}`},qI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:LI,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if(p?.[h]===void 0&&!g.has(h)){let _=a.schemaEnv.baseId+a.errSchemaPath,b=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,ZI.checkStrictMode)(a,b,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(oi.nil,d);else for(let p of r)(0,ni.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||i){let g=t.let("valid",!0);e.block$data(g,()=>m(p,g)),e.ok(g)}else t.if((0,ni.checkMissingProp)(e,r,p)),(0,ni.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,ni.noPropertyInData)(t,o,p,s.ownProperties),()=>e.error())})}function m(p,g){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(g,(0,ni.propertyInData)(t,o,p,s.ownProperties)),t.if((0,oi.not)(g),()=>{e.error(),t.break()})},oi.nil)}}};jp.default=qI});var O_=S(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var ii=W(),FI={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,ii.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,ii._)`{limit: ${e}}`},VI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:FI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?ii.operators.GT:ii.operators.LT;e.fail$data((0,ii._)`${r}.length ${o} ${n}`)}};Np.default=VI});var ls=S(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var j_=op();j_.code='require("ajv/dist/runtime/equal").default';Dp.default=j_});var N_=S(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var Rp=Jo(),Ie=W(),JI=re(),WI=ls(),KI={message:({params:{i:e,j:t}})=>(0,Ie.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ie._)`{i: ${e}, j: ${t}}`},HI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:KI,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Rp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Ie._)`${a} === false`),e.ok(c);function l(){let g=t.let("i",(0,Ie._)`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(c,!0),t.if((0,Ie._)`${g} > 1`,()=>(d()?m:p)(g,h))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,h){let _=t.name("item"),b=(0,Rp.checkDataTypes)(u,_,s.opts.strictNumbers,Rp.DataType.Wrong),E=t.const("indices",(0,Ie._)`{}`);t.for((0,Ie._)`;${g}--;`,()=>{t.let(_,(0,Ie._)`${r}[${g}]`),t.if(b,(0,Ie._)`continue`),u.length>1&&t.if((0,Ie._)`typeof ${_} == "string"`,(0,Ie._)`${_} += "_"`),t.if((0,Ie._)`typeof ${E}[${_}] == "number"`,()=>{t.assign(h,(0,Ie._)`${E}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,Ie._)`${E}[${_}] = ${g}`)})}function p(g,h){let _=(0,JI.useFunc)(t,WI.default),b=t.name("outer");t.label(b).for((0,Ie._)`;${g}--;`,()=>t.for((0,Ie._)`${h} = ${g}; ${h}--;`,()=>t.if((0,Ie._)`${_}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(b)})))}}};Ap.default=HI});var D_=S(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var Mp=W(),GI=re(),BI=ls(),XI={message:"must be equal to constant",params:({schemaCode:e})=>(0,Mp._)`{allowedValue: ${e}}`},YI={keyword:"const",$data:!0,error:XI,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Mp._)`!${(0,GI.useFunc)(t,BI.default)}(${r}, ${o})`):e.fail((0,Mp._)`${i} !== ${r}`)}};Cp.default=YI});var R_=S(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var ai=W(),QI=re(),eE=ls(),tE={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,ai._)`{allowedValues: ${e}}`},rE={keyword:"enum",schemaType:"array",$data:!0,error:tE,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,QI.useFunc)(t,eE.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=t.const("vSchema",i);l=(0,ai.or)(...o.map((g,h)=>m(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,p=>t.if((0,ai._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function m(p,g){let h=o[g];return typeof h=="object"&&h!==null?(0,ai._)`${u()}(${r}, ${p}[${g}])`:(0,ai._)`${r} === ${h}`}}};Up.default=rE});var A_=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var nE=k_(),oE=S_(),iE=I_(),aE=E_(),sE=T_(),cE=P_(),uE=O_(),lE=N_(),dE=D_(),pE=R_(),fE=[nE.default,oE.default,iE.default,aE.default,sE.default,cE.default,uE.default,lE.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},dE.default,pE.default];Zp.default=fE});var qp=S(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.validateAdditionalItems=void 0;var jr=W(),Lp=re(),mE={message:({params:{len:e}})=>(0,jr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,jr._)`{limit: ${e}}`},hE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:mE,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Lp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}M_(e,n)}};function M_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,jr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,jr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Lp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,jr._)`${s} <= ${t.length}`);r.if((0,jr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Lp.Type.Num},u),a.allErrors||r.if((0,jr.not)(u),()=>r.break())})}}si.validateAdditionalItems=M_;si.default=hE});var Fp=S(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.validateTuple=void 0;var C_=W(),ds=re(),gE=at(),vE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return U_(e,"additionalItems",t);r.items=!0,!(0,ds.alwaysValidSchema)(r,t)&&e.ok((0,gE.validateArray)(e))}};function U_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=ds.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,C_._)`${i}.length`);r.forEach((d,m)=>{(0,ds.alwaysValidSchema)(s,d)||(n.if((0,C_._)`${u} > ${m}`,()=>e.subschema({keyword:a,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:p}=s,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let _=`"${a}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,ds.checkStrictMode)(s,_,m.strictTuples)}}}ci.validateTuple=U_;ci.default=vE});var Z_=S(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var _E=Fp(),yE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,_E.validateTuple)(e,"items")};Vp.default=yE});var q_=S(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var L_=W(),$E=re(),bE=at(),xE=qp(),kE={message:({params:{len:e}})=>(0,L_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,L_._)`{limit: ${e}}`},SE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:kE,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,$E.alwaysValidSchema)(n,t)&&(o?(0,xE.validateAdditionalItems)(e,o):e.ok((0,bE.validateArray)(e)))}};Jp.default=SE});var F_=S(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var ct=W(),ps=re(),wE={message:({params:{min:e,max:t}})=>t===void 0?(0,ct.str)`must contain at least ${e} valid item(s)`:(0,ct.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ct._)`{minContains: ${e}}`:(0,ct._)`{minContains: ${e}, maxContains: ${t}}`},zE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:wE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,ct._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,ps.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,ps.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ps.alwaysValidSchema)(i,r)){let h=(0,ct._)`${l} >= ${a}`;s!==void 0&&(h=(0,ct._)`${h} && ${l} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,ct._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),_=t.let("count",0);p(h,()=>t.if(h,()=>g(_)))}function p(h,_){t.forRange("i",0,l,b=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:ps.Type.Num,compositeRule:!0},h),_()})}function g(h){t.code((0,ct._)`${h}++`),s===void 0?t.if((0,ct._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,ct._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,ct._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};Wp.default=zE});var W_=S(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.validateSchemaDeps=kt.validatePropertyDeps=kt.error=void 0;var Kp=W(),IE=re(),ui=at();kt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Kp.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Kp._)`{property: ${e},
+"use strict";var S$=Object.create;var As=Object.defineProperty;var w$=Object.getOwnPropertyDescriptor;var z$=Object.getOwnPropertyNames;var I$=Object.getPrototypeOf,E$=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),En=(e,t)=>{for(var r in t)As(e,r,{get:t[r],enumerable:!0})},T$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of z$(t))!E$.call(e,o)&&o!==r&&As(e,o,{get:()=>t[o],enumerable:!(n=w$(t,o))||n.enumerable});return e};var yi=(e,t,r)=>(r=e!=null?S$(I$(e)):{},T$(t||!e||!e.__esModule?As(r,"default",{value:e,enumerable:!0}):r,e));var qo=S(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.regexpCode=re.getEsmExportName=re.getProperty=re.safeStringify=re.stringify=re.strConcat=re.addCodeArg=re.str=re._=re.nil=re._Code=re.Name=re.IDENTIFIER=re._CodeOrName=void 0;var Zo=class{};re._CodeOrName=Zo;re.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Sr=class extends Zo{constructor(t){if(super(),!re.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};re.Name=Sr;var at=class extends Zo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Sr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};re._Code=at;re.nil=new at("");function iv(e,...t){let r=[e[0]],n=0;for(;n{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ValueScope=Ve.ValueScopeName=Ve.Scope=Ve.varKinds=Ve.UsedValueState=void 0;var Fe=qo(),Nd=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},qa;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(qa||(Ve.UsedValueState=qa={}));Ve.varKinds={const:new Fe.Name("const"),let:new Fe.Name("let"),var:new Fe.Name("var")};var Fa=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Fe.Name?t:this.name(t)}name(t){return new Fe.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Ve.Scope=Fa;var Va=class extends Fe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Fe._)`.${new Fe.Name(r)}[${n}]`}};Ve.ValueScopeName=Va;var Sw=(0,Fe._)`\n`,Dd=class extends Fa{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Sw:Fe.nil}}get(){return this._scope}name(t){return new Va(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fe._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=Fe.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,qa.Started);let l=r(u);if(l){let d=this.opts.es5?Ve.varKinds.var:Ve.varKinds.const;i=(0,Fe._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fe._)`${i}${l}${this.opts._n}`;else throw new Nd(u);c.set(u,qa.Completed)})}return i}};Ve.ValueScope=Dd});var W=S(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.or=H.and=H.not=H.CodeGen=H.operators=H.varKinds=H.ValueScopeName=H.ValueScope=H.Scope=H.Name=H.regexpCode=H.stringify=H.getProperty=H.nil=H.strConcat=H.str=H._=void 0;var Q=qo(),ft=Rd(),sr=qo();Object.defineProperty(H,"_",{enumerable:!0,get:function(){return sr._}});Object.defineProperty(H,"str",{enumerable:!0,get:function(){return sr.str}});Object.defineProperty(H,"strConcat",{enumerable:!0,get:function(){return sr.strConcat}});Object.defineProperty(H,"nil",{enumerable:!0,get:function(){return sr.nil}});Object.defineProperty(H,"getProperty",{enumerable:!0,get:function(){return sr.getProperty}});Object.defineProperty(H,"stringify",{enumerable:!0,get:function(){return sr.stringify}});Object.defineProperty(H,"regexpCode",{enumerable:!0,get:function(){return sr.regexpCode}});Object.defineProperty(H,"Name",{enumerable:!0,get:function(){return sr.Name}});var Ha=Rd();Object.defineProperty(H,"Scope",{enumerable:!0,get:function(){return Ha.Scope}});Object.defineProperty(H,"ValueScope",{enumerable:!0,get:function(){return Ha.ValueScope}});Object.defineProperty(H,"ValueScopeName",{enumerable:!0,get:function(){return Ha.ValueScopeName}});Object.defineProperty(H,"varKinds",{enumerable:!0,get:function(){return Ha.varKinds}});H.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var Zt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Ad=class extends Zt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?ft.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=ln(this.rhs,t,r)),this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},Ja=class extends Zt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Q.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=ln(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Q.Name?{}:{...this.lhs.names};return Ka(t,this.rhs)}},Cd=class extends Ja{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Md=class extends Zt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Ud=class extends Zt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Zd=class extends Zt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Ld=class extends Zt{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=ln(this.code,t,r),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},Fo=class extends Zt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(t,r)||(ww(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Ir(t,r.names),{})}},Lt=class extends Fo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},qd=class extends Fo{},un=class extends Lt{};un.kind="else";var wr=class e extends Lt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new un(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(sv(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=ln(this.condition,t,r),this}get names(){let t=super.names;return Ka(t,this.condition),this.else&&Ir(t,this.else.names),t}};wr.kind="if";var zr=class extends Lt{};zr.kind="for";var Fd=class extends zr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=ln(this.iteration,t,r),this}get names(){return Ir(super.names,this.iteration.names)}},Vd=class extends zr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?ft.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Ka(super.names,this.from);return Ka(t,this.to)}},Wa=class extends zr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=ln(this.iterable,t,r),this}get names(){return Ir(super.names,this.iterable.names)}},Vo=class extends Lt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Vo.kind="func";var Jo=class extends Fo{render(t){return"return "+super.render(t)}};Jo.kind="return";var Jd=class extends Lt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Ir(t,this.catch.names),this.finally&&Ir(t,this.finally.names),t}},Wo=class extends Lt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Wo.kind="catch";var Ko=class extends Lt{render(t){return"finally"+super.render(t)}};Ko.kind="finally";var Wd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
+`:""},this._extScope=t,this._scope=new ft.Scope({parent:t}),this._nodes=[new qd]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Ad(t,i,n)),i}const(t,r,n){return this._def(ft.varKinds.const,t,r,n)}let(t,r,n){return this._def(ft.varKinds.let,t,r,n)}var(t,r,n){return this._def(ft.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Ja(t,r,n))}add(t,r){return this._leafNode(new Cd(t,H.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Q.nil&&this._leafNode(new Ld(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Q.addCodeArg)(r,o));return r.push("}"),new Q._Code(r)}if(t,r,n){if(this._blockNode(new wr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new wr(t))}else(){return this._elseNode(new un)}endIf(){return this._endBlockNode(wr,un)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Fd(t),r)}forRange(t,r,n,o,i=this.opts.es5?ft.varKinds.var:ft.varKinds.let){let a=this._scope.toName(t);return this._for(new Vd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=ft.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof Q.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Q._)`${a}.length`,s=>{this.var(i,(0,Q._)`${a}[${s}]`),n(i)})}return this._for(new Wa("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?ft.varKinds.var:ft.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Q._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Wa("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(zr)}label(t){return this._leafNode(new Md(t))}break(t){return this._leafNode(new Ud(t))}return(t){let r=new Jo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Jd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Wo(i),r(i)}return n&&(this._currNode=o.finally=new Ko,this.code(n)),this._endBlockNode(Wo,Ko)}throw(t){return this._leafNode(new Zd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Q.nil,n,o){return this._blockNode(new Vo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Vo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof wr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};H.CodeGen=Wd;function Ir(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Ka(e,t){return t instanceof Q._CodeOrName?Ir(e,t.names):e}function ln(e,t,r){if(e instanceof Q.Name)return n(e);if(!o(e))return e;return new Q._Code(e._items.reduce((i,a)=>(a instanceof Q.Name&&(a=n(a)),a instanceof Q._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof Q._Code&&i._items.some(a=>a instanceof Q.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function ww(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function sv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Q._)`!${Kd(e)}`}H.not=sv;var zw=cv(H.operators.AND);function Iw(...e){return e.reduce(zw)}H.and=Iw;var Ew=cv(H.operators.OR);function Tw(...e){return e.reduce(Ew)}H.or=Tw;function cv(e){return(t,r)=>t===Q.nil?r:r===Q.nil?t:(0,Q._)`${Kd(t)} ${e} ${Kd(r)}`}function Kd(e){return e instanceof Q.Name?e:(0,Q._)`(${e})`}});var ee=S(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var le=W(),Pw=qo();function Ow(e){let t={};for(let r of e)t[r]=!0;return t}B.toHash=Ow;function jw(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(dv(e,t),!pv(t,e.self.RULES.all))}B.alwaysValidSchema=jw;function dv(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||hv(e,`unknown keyword: "${i}"`)}B.checkUnknownRules=dv;function pv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}B.schemaHasRules=pv;function Nw(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}B.schemaHasRulesButRef=Nw;function Dw({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,le._)`${r}`}return(0,le._)`${e}${t}${(0,le.getProperty)(n)}`}B.schemaRefOrVal=Dw;function Rw(e){return fv(decodeURIComponent(e))}B.unescapeFragment=Rw;function Aw(e){return encodeURIComponent(Gd(e))}B.escapeFragment=Aw;function Gd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=Gd;function fv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=fv;function Cw(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}B.eachItem=Cw;function uv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof le.Name?(i instanceof le.Name?e(o,i,a):t(o,i,a),a):i instanceof le.Name?(t(o,a,i),i):r(i,a);return s===le.Name&&!(c instanceof le.Name)?n(o,c):c}}B.mergeEvaluated={props:uv({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,le._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,le._)`${r} || {}`).code((0,le._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,le._)`${r} || {}`),Bd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:mv}),items:uv({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,le._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,le._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function mv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,le._)`{}`);return t!==void 0&&Bd(e,r,t),r}B.evaluatedPropsToName=mv;function Bd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,le._)`${t}${(0,le.getProperty)(n)}`,!0))}B.setEvaluated=Bd;var lv={};function Mw(e,t){return e.scopeValue("func",{ref:t,code:lv[t.code]||(lv[t.code]=new Pw._Code(t.code))})}B.useFunc=Mw;var Hd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Hd||(B.Type=Hd={}));function Uw(e,t,r){if(e instanceof le.Name){let n=t===Hd.Num;return r?n?(0,le._)`"[" + ${e} + "]"`:(0,le._)`"['" + ${e} + "']"`:n?(0,le._)`"/" + ${e}`:(0,le._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,le.getProperty)(e).toString():"/"+Gd(e)}B.getErrorPath=Uw;function hv(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}B.checkStrictMode=hv});var qt=S(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});var Oe=W(),Zw={data:new Oe.Name("data"),valCxt:new Oe.Name("valCxt"),instancePath:new Oe.Name("instancePath"),parentData:new Oe.Name("parentData"),parentDataProperty:new Oe.Name("parentDataProperty"),rootData:new Oe.Name("rootData"),dynamicAnchors:new Oe.Name("dynamicAnchors"),vErrors:new Oe.Name("vErrors"),errors:new Oe.Name("errors"),this:new Oe.Name("this"),self:new Oe.Name("self"),scope:new Oe.Name("scope"),json:new Oe.Name("json"),jsonPos:new Oe.Name("jsonPos"),jsonLen:new Oe.Name("jsonLen"),jsonPart:new Oe.Name("jsonPart")};Xd.default=Zw});var Ho=S(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.extendErrors=je.resetErrorsCount=je.reportExtraError=je.reportError=je.keyword$DataError=je.keywordError=void 0;var te=W(),Ga=ee(),Ue=qt();je.keywordError={message:({keyword:e})=>(0,te.str)`must pass "${e}" keyword validation`};je.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,te.str)`"${e}" keyword must be ${t} ($data)`:(0,te.str)`"${e}" keyword is invalid ($data)`};function Lw(e,t=je.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=_v(e,t,r);n??(a||s)?gv(i,c):vv(o,(0,te._)`[${c}]`)}je.reportError=Lw;function qw(e,t=je.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=_v(e,t,r);gv(o,s),i||a||vv(n,Ue.default.vErrors)}je.reportExtraError=qw;function Fw(e,t){e.assign(Ue.default.errors,t),e.if((0,te._)`${Ue.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,te._)`${Ue.default.vErrors}.length`,t),()=>e.assign(Ue.default.vErrors,null)))}je.resetErrorsCount=Fw;function Vw({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Ue.default.errors,s=>{e.const(a,(0,te._)`${Ue.default.vErrors}[${s}]`),e.if((0,te._)`${a}.instancePath === undefined`,()=>e.assign((0,te._)`${a}.instancePath`,(0,te.strConcat)(Ue.default.instancePath,i.errorPath))),e.assign((0,te._)`${a}.schemaPath`,(0,te.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,te._)`${a}.schema`,r),e.assign((0,te._)`${a}.data`,n))})}je.extendErrors=Vw;function gv(e,t){let r=e.const("err",t);e.if((0,te._)`${Ue.default.vErrors} === null`,()=>e.assign(Ue.default.vErrors,(0,te._)`[${r}]`),(0,te._)`${Ue.default.vErrors}.push(${r})`),e.code((0,te._)`${Ue.default.errors}++`)}function vv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,te._)`new ${e.ValidationError}(${t})`):(r.assign((0,te._)`${n}.errors`,t),r.return(!1))}var Er={keyword:new te.Name("keyword"),schemaPath:new te.Name("schemaPath"),params:new te.Name("params"),propertyName:new te.Name("propertyName"),message:new te.Name("message"),schema:new te.Name("schema"),parentSchema:new te.Name("parentSchema")};function _v(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,te._)`{}`:Jw(e,t,r)}function Jw(e,t,r={}){let{gen:n,it:o}=e,i=[Ww(o,r),Kw(e,r)];return Hw(e,t,i),n.object(...i)}function Ww({errorPath:e},{instancePath:t}){let r=t?(0,te.str)`${e}${(0,Ga.getErrorPath)(t,Ga.Type.Str)}`:e;return[Ue.default.instancePath,(0,te.strConcat)(Ue.default.instancePath,r)]}function Kw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,te.str)`${t}/${e}`;return r&&(o=(0,te.str)`${o}${(0,Ga.getErrorPath)(r,Ga.Type.Str)}`),[Er.schemaPath,o]}function Hw(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Er.keyword,o],[Er.params,typeof t=="function"?t(e):t||(0,te._)`{}`]),c.messages&&n.push([Er.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Er.schema,a],[Er.parentSchema,(0,te._)`${l}${d}`],[Ue.default.data,i]),u&&n.push([Er.propertyName,u])}});var $v=S(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.boolOrEmptySchema=dn.topBoolOrEmptySchema=void 0;var Gw=Ho(),Bw=W(),Xw=qt(),Yw={message:"boolean schema is false"};function Qw(e){let{gen:t,schema:r,validateName:n}=e;r===!1?yv(e,!1):typeof r=="object"&&r.$async===!0?t.return(Xw.default.data):(t.assign((0,Bw._)`${n}.errors`,null),t.return(!0))}dn.topBoolOrEmptySchema=Qw;function e0(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),yv(e)):r.var(t,!0)}dn.boolOrEmptySchema=e0;function yv(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Gw.reportError)(o,Yw,void 0,t)}});var Yd=S(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.getRules=pn.isJSONType=void 0;var t0=["string","number","integer","boolean","null","object","array"],r0=new Set(t0);function n0(e){return typeof e=="string"&&r0.has(e)}pn.isJSONType=n0;function o0(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}pn.getRules=o0});var Qd=S(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.shouldUseRule=cr.shouldUseGroup=cr.schemaHasRulesForType=void 0;function i0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&bv(e,n)}cr.schemaHasRulesForType=i0;function bv(e,t){return t.rules.some(r=>xv(e,r))}cr.shouldUseGroup=bv;function xv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}cr.shouldUseRule=xv});var Go=S(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.reportTypeError=Ne.checkDataTypes=Ne.checkDataType=Ne.coerceAndCheckDataType=Ne.getJSONTypes=Ne.getSchemaTypes=Ne.DataType=void 0;var a0=Yd(),s0=Qd(),c0=Ho(),J=W(),kv=ee(),fn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(fn||(Ne.DataType=fn={}));function u0(e){let t=Sv(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ne.getSchemaTypes=u0;function Sv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(a0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ne.getJSONTypes=Sv;function l0(e,t){let{gen:r,data:n,opts:o}=e,i=d0(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,s0.schemaHasRulesForType)(e,t[0]));if(a){let s=tp(t,n,o.strictNumbers,fn.Wrong);r.if(s,()=>{i.length?p0(e,t,i):rp(e)})}return a}Ne.coerceAndCheckDataType=l0;var wv=new Set(["string","number","integer","boolean","null"]);function d0(e,t){return t?e.filter(r=>wv.has(r)||t==="array"&&r==="array"):[]}function p0(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,J._)`typeof ${o}`),s=n.let("coerced",(0,J._)`undefined`);i.coerceTypes==="array"&&n.if((0,J._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,J._)`${o}[0]`).assign(a,(0,J._)`typeof ${o}`).if(tp(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,J._)`${s} !== undefined`);for(let u of r)(wv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),rp(e),n.endIf(),n.if((0,J._)`${s} !== undefined`,()=>{n.assign(o,s),f0(e,s)});function c(u){switch(u){case"string":n.elseIf((0,J._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,J._)`"" + ${o}`).elseIf((0,J._)`${o} === null`).assign(s,(0,J._)`""`);return;case"number":n.elseIf((0,J._)`${a} == "boolean" || ${o} === null
+ || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,J._)`+${o}`);return;case"integer":n.elseIf((0,J._)`${a} === "boolean" || ${o} === null
+ || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,J._)`+${o}`);return;case"boolean":n.elseIf((0,J._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,J._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,J._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,J._)`${a} === "string" || ${a} === "number"
+ || ${a} === "boolean" || ${o} === null`).assign(s,(0,J._)`[${o}]`)}}}function f0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,J._)`${t} !== undefined`,()=>e.assign((0,J._)`${t}[${r}]`,n))}function ep(e,t,r,n=fn.Correct){let o=n===fn.Correct?J.operators.EQ:J.operators.NEQ,i;switch(e){case"null":return(0,J._)`${t} ${o} null`;case"array":i=(0,J._)`Array.isArray(${t})`;break;case"object":i=(0,J._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,J._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,J._)`typeof ${t} ${o} ${e}`}return n===fn.Correct?i:(0,J.not)(i);function a(s=J.nil){return(0,J.and)((0,J._)`typeof ${t} == "number"`,s,r?(0,J._)`isFinite(${t})`:J.nil)}}Ne.checkDataType=ep;function tp(e,t,r,n){if(e.length===1)return ep(e[0],t,r,n);let o,i=(0,kv.toHash)(e);if(i.array&&i.object){let a=(0,J._)`typeof ${t} != "object"`;o=i.null?a:(0,J._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=J.nil;i.number&&delete i.integer;for(let a in i)o=(0,J.and)(o,ep(a,t,r,n));return o}Ne.checkDataTypes=tp;var m0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,J._)`{type: ${e}}`:(0,J._)`{type: ${t}}`};function rp(e){let t=h0(e);(0,c0.reportError)(t,m0)}Ne.reportTypeError=rp;function h0(e){let{gen:t,data:r,schema:n}=e,o=(0,kv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Iv=S(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.assignDefaults=void 0;var mn=W(),g0=ee();function v0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)zv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>zv(e,i,o.default))}Ba.assignDefaults=v0;function zv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,mn._)`${i}${(0,mn.getProperty)(t)}`;if(o){(0,g0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,mn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,mn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,mn._)`${s} = ${(0,mn.stringify)(r)}`)}});var st=S(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;var ge=W(),np=ee(),ur=qt(),_0=ee();function y0(e,t){let{gen:r,data:n,it:o}=e;r.if(ip(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ge._)`${t}`},!0),e.error()})}ae.checkReportMissingProp=y0;function $0({gen:e,data:t,it:{opts:r}},n,o){return(0,ge.or)(...n.map(i=>(0,ge.and)(ip(e,t,i,r.ownProperties),(0,ge._)`${o} = ${i}`)))}ae.checkMissingProp=$0;function b0(e,t){e.setParams({missingProperty:t},!0),e.error()}ae.reportMissingProp=b0;function Ev(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ge._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=Ev;function op(e,t,r){return(0,ge._)`${Ev(e)}.call(${t}, ${r})`}ae.isOwnProperty=op;function x0(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} !== undefined`;return n?(0,ge._)`${o} && ${op(e,t,r)}`:o}ae.propertyInData=x0;function ip(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} === undefined`;return n?(0,ge.or)(o,(0,ge.not)(op(e,t,r))):o}ae.noPropertyInData=ip;function Tv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ae.allSchemaProperties=Tv;function k0(e,t){return Tv(t).filter(r=>!(0,np.alwaysValidSchema)(e,t[r]))}ae.schemaProperties=k0;function S0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ge._)`${e}, ${t}, ${n}${o}`:t,d=[[ur.default.instancePath,(0,ge.strConcat)(ur.default.instancePath,i)],[ur.default.parentData,a.parentData],[ur.default.parentDataProperty,a.parentDataProperty],[ur.default.rootData,ur.default.rootData]];a.opts.dynamicRef&&d.push([ur.default.dynamicAnchors,ur.default.dynamicAnchors]);let p=(0,ge._)`${l}, ${r.object(...d)}`;return c!==ge.nil?(0,ge._)`${s}.call(${c}, ${p})`:(0,ge._)`${s}(${p})`}ae.callValidateCode=S0;var w0=(0,ge._)`new RegExp`;function z0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ge._)`${o.code==="new RegExp"?w0:(0,_0.useFunc)(e,o)}(${r}, ${n})`})}ae.usePattern=z0;function I0(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,ge._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:np.Type.Num},i),t.if((0,ge.not)(i),s)})}}ae.validateArray=I0;function E0(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,np.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ge._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ge.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ae.validateUnion=E0});var jv=S(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.validateKeywordUsage=bt.validSchemaType=bt.funcKeywordCode=bt.macroKeywordCode=void 0;var Ze=W(),Tr=qt(),T0=st(),P0=Ho();function O0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Ov(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ze.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}bt.macroKeywordCode=O0;function j0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;D0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Ov(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)h(),t.modifying&&Pv(e),_(()=>e.error());else{let b=t.async?f():g();t.modifying&&Pv(e),_(()=>N0(e,b))}}function f(){let b=n.let("ruleErrs",null);return n.try(()=>h((0,Ze._)`await `),E=>n.assign(d,!1).if((0,Ze._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Ze._)`${E}.errors`),()=>n.throw(E))),b}function g(){let b=(0,Ze._)`${l}.errors`;return n.assign(b,null),h(Ze.nil),b}function h(b=t.async?(0,Ze._)`await `:Ze.nil){let E=c.opts.passContext?Tr.default.this:Tr.default.self,I=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ze._)`${b}${(0,T0.callValidateCode)(e,l,E,I)}`,t.modifying)}function _(b){var E;n.if((0,Ze.not)((E=t.valid)!==null&&E!==void 0?E:d),b)}}bt.funcKeywordCode=j0;function Pv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ze._)`${n.parentData}[${n.parentDataProperty}]`))}function N0(e,t){let{gen:r}=e;r.if((0,Ze._)`Array.isArray(${t})`,()=>{r.assign(Tr.default.vErrors,(0,Ze._)`${Tr.default.vErrors} === null ? ${t} : ${Tr.default.vErrors}.concat(${t})`).assign(Tr.default.errors,(0,Ze._)`${Tr.default.vErrors}.length`),(0,P0.extendErrors)(e)},()=>e.error())}function D0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Ov(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ze.stringify)(r)})}function R0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}bt.validSchemaType=R0;function A0({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}bt.validateKeywordUsage=A0});var Dv=S(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.extendSubschemaMode=lr.extendSubschemaData=lr.getSubschema=void 0;var xt=W(),Nv=ee();function C0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,xt._)`${e.schemaPath}${(0,xt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,xt._)`${e.schemaPath}${(0,xt.getProperty)(t)}${(0,xt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Nv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}lr.getSubschema=C0;function M0(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,p=s.let("data",(0,xt._)`${t.data}${(0,xt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,xt.str)`${u}${(0,Nv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,xt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof xt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}lr.extendSubschemaData=M0;function U0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}lr.extendSubschemaMode=U0});var ap=S((mM,Rv)=>{"use strict";Rv.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Cv=S((hM,Av)=>{"use strict";var dr=Av.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Xa(t,n,o,e,"",e)};dr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};dr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};dr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};dr.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 Xa(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in dr.arrayKeywords)for(var p=0;p{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.getSchemaRefs=Je.resolveUrl=Je.normalizeId=Je._getFullPath=Je.getFullPath=Je.inlineRef=void 0;var L0=ee(),q0=ap(),F0=Cv(),V0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function J0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!sp(e):t?Mv(e)<=t:!1}Je.inlineRef=J0;var W0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function sp(e){for(let t in e){if(W0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(sp)||typeof r=="object"&&sp(r))return!0}return!1}function Mv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!V0.has(r)&&(typeof e[r]=="object"&&(0,L0.eachItem)(e[r],n=>t+=Mv(n)),t===1/0))return 1/0}return t}function Uv(e,t="",r){r!==!1&&(t=hn(t));let n=e.parse(t);return Zv(e,n)}Je.getFullPath=Uv;function Zv(e,t){return e.serialize(t).split("#")[0]+"#"}Je._getFullPath=Zv;var K0=/#\/?$/;function hn(e){return e?e.replace(K0,""):""}Je.normalizeId=hn;function H0(e,t,r){return r=hn(r),e.resolve(t,r)}Je.resolveUrl=H0;var G0=/^[a-z_][-a-z0-9._]*$/i;function B0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=hn(e[r]||t),i={"":o},a=Uv(n,o,!1),s={},c=new Set;return F0(e,{allKeys:!0},(d,p,f,g)=>{if(g===void 0)return;let h=a+p,_=i[g];typeof d[r]=="string"&&(_=b.call(this,d[r])),E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),i[p]=_;function b(I){let A=this.opts.uriResolver.resolve;if(I=hn(_?A(_,I):I),c.has(I))throw l(I);c.add(I);let j=this.refs[I];return typeof j=="string"&&(j=this.refs[j]),typeof j=="object"?u(d,j.schema,I):I!==hn(h)&&(I[0]==="#"?(u(d,s[I],I),s[I]=d):this.refs[I]=h),I}function E(I){if(typeof I=="string"){if(!G0.test(I))throw new Error(`invalid anchor "${I}"`);b.call(this,`#${I}`)}}}),s;function u(d,p,f){if(p!==void 0&&!q0(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Je.getSchemaRefs=B0});var Qo=S(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.getData=pr.KeywordCxt=pr.validateFunctionCode=void 0;var Jv=$v(),Lv=Go(),up=Qd(),Ya=Go(),X0=Iv(),Yo=jv(),cp=Dv(),O=W(),U=qt(),Y0=Bo(),Ft=ee(),Xo=Ho();function Q0(e){if(Hv(e)&&(Gv(e),Kv(e))){rz(e);return}Wv(e,()=>(0,Jv.topBoolOrEmptySchema)(e))}pr.validateFunctionCode=Q0;function Wv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,O._)`${U.default.data}, ${U.default.valCxt}`,n.$async,()=>{e.code((0,O._)`"use strict"; ${qv(r,o)}`),tz(e,o),e.code(i)}):e.func(t,(0,O._)`${U.default.data}, ${ez(o)}`,n.$async,()=>e.code(qv(r,o)).code(i))}function ez(e){return(0,O._)`{${U.default.instancePath}="", ${U.default.parentData}, ${U.default.parentDataProperty}, ${U.default.rootData}=${U.default.data}${e.dynamicRef?(0,O._)`, ${U.default.dynamicAnchors}={}`:O.nil}}={}`}function tz(e,t){e.if(U.default.valCxt,()=>{e.var(U.default.instancePath,(0,O._)`${U.default.valCxt}.${U.default.instancePath}`),e.var(U.default.parentData,(0,O._)`${U.default.valCxt}.${U.default.parentData}`),e.var(U.default.parentDataProperty,(0,O._)`${U.default.valCxt}.${U.default.parentDataProperty}`),e.var(U.default.rootData,(0,O._)`${U.default.valCxt}.${U.default.rootData}`),t.dynamicRef&&e.var(U.default.dynamicAnchors,(0,O._)`${U.default.valCxt}.${U.default.dynamicAnchors}`)},()=>{e.var(U.default.instancePath,(0,O._)`""`),e.var(U.default.parentData,(0,O._)`undefined`),e.var(U.default.parentDataProperty,(0,O._)`undefined`),e.var(U.default.rootData,U.default.data),t.dynamicRef&&e.var(U.default.dynamicAnchors,(0,O._)`{}`)})}function rz(e){let{schema:t,opts:r,gen:n}=e;Wv(e,()=>{r.$comment&&t.$comment&&Xv(e),sz(e),n.let(U.default.vErrors,null),n.let(U.default.errors,0),r.unevaluated&&nz(e),Bv(e),lz(e)})}function nz(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,O._)`${r}.evaluated`),t.if((0,O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,O._)`${e.evaluated}.props`,(0,O._)`undefined`)),t.if((0,O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,O._)`${e.evaluated}.items`,(0,O._)`undefined`))}function qv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function oz(e,t){if(Hv(e)&&(Gv(e),Kv(e))){iz(e,t);return}(0,Jv.boolOrEmptySchema)(e,t)}function Kv({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Hv(e){return typeof e.schema!="boolean"}function iz(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Xv(e),cz(e),uz(e);let i=n.const("_errs",U.default.errors);Bv(e,i),n.var(t,(0,O._)`${i} === ${U.default.errors}`)}function Gv(e){(0,Ft.checkUnknownRules)(e),az(e)}function Bv(e,t){if(e.opts.jtd)return Fv(e,[],!1,t);let r=(0,Lv.getSchemaTypes)(e.schema),n=(0,Lv.coerceAndCheckDataType)(e,r);Fv(e,r,!n,t)}function az(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ft.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function sz(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ft.checkStrictMode)(e,"default is ignored in the schema root")}function cz(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Y0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function uz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Xv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,O._)`${U.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,O.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,O._)`${U.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function lz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,O._)`${U.default.errors} === 0`,()=>t.return(U.default.data),()=>t.throw((0,O._)`new ${o}(${U.default.vErrors})`)):(t.assign((0,O._)`${n}.errors`,U.default.vErrors),i.unevaluated&&dz(e),t.return((0,O._)`${U.default.errors} === 0`))}function dz({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0,O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0,O._)`${t}.items`,n)}function Fv(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Ft.schemaHasRulesButRef)(i,l))){o.block(()=>Qv(e,"$ref",l.all.$ref.definition));return}c.jtd||pz(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,up.shouldUseGroup)(i,p)&&(p.type?(o.if((0,Ya.checkDataType)(p.type,a,c.strictNumbers)),Vv(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,Ya.reportTypeError)(e)),o.endIf()):Vv(e,p),s||o.if((0,O._)`${U.default.errors} === ${n||0}`))}}function Vv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,X0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,up.shouldUseRule)(n,i)&&Qv(e,i.keyword,i.definition,t.type)})}function pz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(fz(e,t),e.opts.allowUnionTypes||mz(e,t),hz(e,e.dataTypes))}function fz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Yv(e.dataTypes,r)||lp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),vz(e,t)}}function mz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&lp(e,"use allowUnionTypes to allow union type keyword")}function hz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,up.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>gz(t,a))&&lp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function gz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Yv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function vz(e,t){let r=[];for(let n of e.dataTypes)Yv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function lp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ft.checkStrictMode)(e,t,e.opts.strictTypes)}var Qa=class{constructor(t,r,n){if((0,Yo.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ft.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",e_(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Yo.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",U.default.errors))}result(t,r,n){this.failResult((0,O.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,O.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,O._)`${r} !== undefined && (${(0,O.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Xo.reportExtraError:Xo.reportError)(this,this.def.error,r)}$dataError(){(0,Xo.reportError)(this,this.def.$dataError||Xo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Xo.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=O.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),t!==O.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,O.or)(a(),s());function a(){if(n.length){if(!(r instanceof O.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,O._)`${(0,Ya.checkDataTypes)(c,r,i.opts.strictNumbers,Ya.DataType.Wrong)}`}return O.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0,cp.getSubschema)(this.it,t);(0,cp.extendSubschemaData)(n,this.it,t),(0,cp.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return oz(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ft.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ft.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,O.Name)),!0}};pr.KeywordCxt=Qa;function Qv(e,t,r,n){let o=new Qa(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Yo.funcKeywordCode)(o,r):"macro"in r?(0,Yo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Yo.funcKeywordCode)(o,r)}var _z=/^\/(?:[^~]|~0|~1)*$/,yz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function e_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return U.default.rootData;if(e[0]==="/"){if(!_z.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=U.default.rootData}else{let u=yz.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,O._)`${i}${(0,O.getProperty)((0,Ft.unescapeJsonPointer)(u))}`,a=(0,O._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}pr.getData=e_});var es=S(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var dp=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};pp.default=dp});var ei=S(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var fp=Bo(),mp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,fp.resolveUrl)(t,r,n),this.missingSchema=(0,fp.normalizeId)((0,fp.getFullPath)(t,this.missingRef))}};hp.default=mp});var rs=S(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.resolveSchema=ct.getCompilingSchema=ct.resolveRef=ct.compileSchema=ct.SchemaEnv=void 0;var mt=W(),$z=es(),Pr=qt(),ht=Bo(),t_=ee(),bz=Qo(),gn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,ht.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};ct.SchemaEnv=gn;function vp(e){let t=r_.call(this,e);if(t)return t;let r=(0,ht.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new mt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:$z.default,code:(0,mt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Pr.default.data,parentData:Pr.default.parentData,parentDataProperty:Pr.default.parentDataProperty,dataNames:[Pr.default.data],dataPathArr:[mt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,mt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:mt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,mt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,bz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Pr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Pr.default.self}`,`${Pr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:h}=u;f.evaluated={props:g instanceof mt.Name?void 0:g,items:h instanceof mt.Name?void 0:h,dynamicProps:g instanceof mt.Name,dynamicItems:h instanceof mt.Name},f.source&&(f.source.evaluated=(0,mt.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}ct.compileSchema=vp;function xz(e,t,r){var n;r=(0,ht.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=wz.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new gn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=kz.call(this,i)}ct.resolveRef=xz;function kz(e){return(0,ht.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:vp.call(this,e)}function r_(e){for(let t of this._compilations)if(Sz(t,e))return t}ct.getCompilingSchema=r_;function Sz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function wz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||ts.call(this,e,t)}function ts(e,t){let r=this.opts.uriResolver.parse(t),n=(0,ht._getFullPath)(this.opts.uriResolver,r),o=(0,ht.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return gp.call(this,r,e);let i=(0,ht.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=ts.call(this,e,a);return typeof s?.schema!="object"?void 0:gp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||vp.call(this,a),i===(0,ht.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,ht.resolveUrl)(this.opts.uriResolver,o,u)),new gn({schema:s,schemaId:c,root:e,baseId:o})}return gp.call(this,r,a)}}ct.resolveSchema=ts;var zz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function gp(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,t_.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!zz.has(s)&&u&&(t=(0,ht.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,t_.schemaHasRulesButRef)(r,this.RULES)){let s=(0,ht.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=ts.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new gn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var n_=S((bM,Iz)=>{Iz.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var yp=S((xM,s_)=>{"use strict";var Ez=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),i_=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function _p(e){let t="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Tz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o_(e){return e.length=0,!0}function Pz(e,t,r){if(e.length){let n=_p(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function Oz(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=Pz;for(let c=0;c7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=o_}else{o.push(u);continue}}return o.length&&(s===o_?r.zone=o.join(""):a?n.push(o.join("")):n.push(_p(o))),r.address=n.join(""),r}function a_(e){if(jz(e,":")<2)return{host:e,isIPV6:!1};let t=Oz(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function jz(e,t){let r=0;for(let n=0;n{"use strict";var{isUUID:Az}=yp(),Cz=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Mz=["http","https","ws","wss","urn","urn:uuid"];function Uz(e){return Mz.indexOf(e)!==-1}function $p(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function c_(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function u_(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Zz(e){return e.secure=$p(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Lz(e){if((e.port===($p(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function qz(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Cz);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=bp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Fz(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=bp(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function Vz(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Az(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Jz(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var l_={scheme:"http",domainHost:!0,parse:c_,serialize:u_},Wz={scheme:"https",domainHost:l_.domainHost,parse:c_,serialize:u_},ns={scheme:"ws",domainHost:!0,parse:Zz,serialize:Lz},Kz={scheme:"wss",domainHost:ns.domainHost,parse:ns.parse,serialize:ns.serialize},Hz={scheme:"urn",parse:qz,serialize:Fz,skipNormalize:!0},Gz={scheme:"urn:uuid",parse:Vz,serialize:Jz,skipNormalize:!0},os={http:l_,https:Wz,ws:ns,wss:Kz,urn:Hz,"urn:uuid":Gz};Object.setPrototypeOf(os,null);function bp(e){return e&&(os[e]||os[e.toLowerCase()])||void 0}d_.exports={wsIsSecure:$p,SCHEMES:os,isValidSchemeName:Uz,getSchemeHandler:bp}});var h_=S((SM,as)=>{"use strict";var{normalizeIPv6:Bz,removeDotSegments:ti,recomposeAuthority:Xz,normalizeComponentEncoding:is,isIPv4:Yz,nonSimpleDomain:Qz}=yp(),{SCHEMES:eI,getSchemeHandler:f_}=p_();function tI(e,t){return typeof e=="string"?e=kt(Vt(e,t),t):typeof e=="object"&&(e=Vt(kt(e,t),t)),e}function rI(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=m_(Vt(e,n),Vt(t,n),n,!0);return n.skipEscape=!0,kt(o,n)}function m_(e,t,r,n){let o={};return n||(e=Vt(kt(e,r),r),t=Vt(kt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ti(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ti(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=ti(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=ti(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function nI(e,t,r){return typeof e=="string"?(e=unescape(e),e=kt(is(Vt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=kt(is(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=kt(is(Vt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=kt(is(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function kt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],i=f_(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=Xz(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=ti(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var oI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Vt(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(oI);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(Yz(n.host)===!1){let c=Bz(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=f_(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&Qz(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var xp={SCHEMES:eI,normalize:tI,resolve:rI,resolveComponent:m_,equal:nI,serialize:kt,parse:Vt};as.exports=xp;as.exports.default=xp;as.exports.fastUri=xp});var v_=S(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var g_=h_();g_.code='require("ajv/dist/runtime/uri").default';kp.default=g_});var w_=S(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.CodeGen=ze.Name=ze.nil=ze.stringify=ze.str=ze._=ze.KeywordCxt=void 0;var iI=Qo();Object.defineProperty(ze,"KeywordCxt",{enumerable:!0,get:function(){return iI.KeywordCxt}});var vn=W();Object.defineProperty(ze,"_",{enumerable:!0,get:function(){return vn._}});Object.defineProperty(ze,"str",{enumerable:!0,get:function(){return vn.str}});Object.defineProperty(ze,"stringify",{enumerable:!0,get:function(){return vn.stringify}});Object.defineProperty(ze,"nil",{enumerable:!0,get:function(){return vn.nil}});Object.defineProperty(ze,"Name",{enumerable:!0,get:function(){return vn.Name}});Object.defineProperty(ze,"CodeGen",{enumerable:!0,get:function(){return vn.CodeGen}});var aI=es(),x_=ei(),sI=Yd(),ri=rs(),cI=W(),ni=Bo(),ss=Go(),wp=ee(),__=n_(),uI=v_(),k_=(e,t)=>new RegExp(e,t);k_.code="new RegExp";var lI=["removeAdditional","useDefaults","coerceTypes"],dI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),pI={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},fI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},y_=200;function mI(e){var t,r,n,o,i,a,s,c,u,l,d,p,f,g,h,_,b,E,I,A,j,Le,de,Ht,et;let Gt=e.strict,Rs=(t=e.code)===null||t===void 0?void 0:t.optimize,Af=Rs===!0||Rs===void 0?1:Rs||0,Cf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:k_,k$=(o=e.uriResolver)!==null&&o!==void 0?o:uI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Gt)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Gt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Gt)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:Gt)!==null&&p!==void 0?p:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:Gt)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Af,regExp:Cf}:{optimize:Af,regExp:Cf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:y_,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:y_,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(I=e.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(A=e.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(j=e.addUsedSchema)!==null&&j!==void 0?j:!0,validateSchema:(Le=e.validateSchema)!==null&&Le!==void 0?Le:!0,validateFormats:(de=e.validateFormats)!==null&&de!==void 0?de:!0,unicodeRegExp:(Ht=e.unicodeRegExp)!==null&&Ht!==void 0?Ht:!0,int32range:(et=e.int32range)!==null&&et!==void 0?et:!0,uriResolver:k$}}var oi=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...mI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new cI.ValueScope({scope:{},prefixes:dI,es5:r,lines:n}),this.logger=$I(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,sI.getRules)(),$_.call(this,pI,t,"NOT SUPPORTED"),$_.call(this,fI,t,"DEPRECATED","warn"),this._metaOpts=_I.call(this),t.formats&&gI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&vI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),hI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=__;n==="id"&&(o={...__},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof x_.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,ni.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=b_.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ri.SchemaEnv({schema:{},schemaId:n});if(r=ri.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=b_.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,ni.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(xI.call(this,n,r),!r)return(0,wp.eachItem)(n,i=>Sp.call(this,i)),this;SI.call(this,r);let o={...r,type:(0,ss.getJSONTypes)(r.type),schemaType:(0,ss.getJSONTypes)(r.schemaType)};return(0,wp.eachItem)(n,o.type.length===0?i=>Sp.call(this,i,o):i=>o.type.forEach(a=>Sp.call(this,i,o,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=S_(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,ni.normalizeId)(a||n);let u=ni.getSchemaRefs.call(this,t,n);return c=new ri.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):ri.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{ri.compileSchema.call(this,t)}finally{this.opts=r}}};oi.ValidationError=aI.default;oi.MissingRefError=x_.default;ze.default=oi;function $_(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function b_(e){return e=(0,ni.normalizeId)(e),this.schemas[e]||this.refs[e]}function hI(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function gI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function vI(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function _I(){let e={...this.opts};for(let t of lI)delete e[t];return e}var yI={log(){},warn(){},error(){}};function $I(e){if(e===!1)return yI;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var bI=/^[a-z_$][a-z0-9_$:-]*$/i;function xI(e,t){let{RULES:r}=this;if((0,wp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!bI.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Sp(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,ss.getJSONTypes)(t.type),schemaType:(0,ss.getJSONTypes)(t.schemaType)}};t.before?kI.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function kI(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function SI(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=S_(t)),e.validateSchema=this.compile(t,!0))}var wI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function S_(e){return{anyOf:[e,wI]}}});var z_=S(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var zI={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};zp.default=zI});var P_=S(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.callRef=Or.getValidate=void 0;var II=ei(),I_=st(),We=W(),_n=qt(),E_=rs(),cs=ee(),EI={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=E_.resolveRef.call(c,u,o,r);if(l===void 0)throw new II.default(n.opts.uriResolver,o,r);if(l instanceof E_.SchemaEnv)return p(l);return f(l);function d(){if(i===u)return us(e,a,i,i.$async);let g=t.scopeValue("root",{ref:u});return us(e,(0,We._)`${g}.validate`,u,u.$async)}function p(g){let h=T_(e,g);us(e,h,g,g.$async)}function f(g){let h=t.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,We.stringify)(g)}:{ref:g}),_=t.name("valid"),b=e.subschema({schema:g,dataTypes:[],schemaPath:We.nil,topSchemaRef:h,errSchemaPath:r},_);e.mergeEvaluated(b),e.ok(_)}}};function T_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,We._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Or.getValidate=T_;function us(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?_n.default.this:We.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,We._)`await ${(0,I_.callValidateCode)(e,t,u)}`),f(t),a||o.assign(g,!0)},h=>{o.if((0,We._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),p(h),a||o.assign(g,!1)}),e.ok(g)}function d(){e.result((0,I_.callValidateCode)(e,t,u),()=>f(t),()=>p(t))}function p(g){let h=(0,We._)`${g}.errors`;o.assign(_n.default.vErrors,(0,We._)`${_n.default.vErrors} === null ? ${h} : ${_n.default.vErrors}.concat(${h})`),o.assign(_n.default.errors,(0,We._)`${_n.default.vErrors}.length`)}function f(g){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=cs.mergeEvaluated.props(o,_.props,i.props));else{let b=o.var("props",(0,We._)`${g}.evaluated.props`);i.props=cs.mergeEvaluated.props(o,b,i.props,We.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=cs.mergeEvaluated.items(o,_.items,i.items));else{let b=o.var("items",(0,We._)`${g}.evaluated.items`);i.items=cs.mergeEvaluated.items(o,b,i.items,We.Name)}}}Or.callRef=us;Or.default=EI});var O_=S(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var TI=z_(),PI=P_(),OI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",TI.default,PI.default];Ip.default=OI});var j_=S(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});var ls=W(),fr=ls.operators,ds={maximum:{okStr:"<=",ok:fr.LTE,fail:fr.GT},minimum:{okStr:">=",ok:fr.GTE,fail:fr.LT},exclusiveMaximum:{okStr:"<",ok:fr.LT,fail:fr.GTE},exclusiveMinimum:{okStr:">",ok:fr.GT,fail:fr.LTE}},jI={message:({keyword:e,schemaCode:t})=>(0,ls.str)`must be ${ds[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,ls._)`{comparison: ${ds[e].okStr}, limit: ${t}}`},NI={keyword:Object.keys(ds),type:"number",schemaType:"number",$data:!0,error:jI,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,ls._)`${r} ${ds[t].fail} ${n} || isNaN(${r})`)}};Ep.default=NI});var N_=S(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var ii=W(),DI={message:({schemaCode:e})=>(0,ii.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ii._)`{multipleOf: ${e}}`},RI={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:DI,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,ii._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,ii._)`${a} !== parseInt(${a})`;e.fail$data((0,ii._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Tp.default=RI});var R_=S(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});function D_(e){let t=e.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var jr=W(),AI=ee(),CI=R_(),MI={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,jr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,jr._)`{limit: ${e}}`},UI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:MI,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?jr.operators.GT:jr.operators.LT,a=o.opts.unicode===!1?(0,jr._)`${r}.length`:(0,jr._)`${(0,AI.useFunc)(e.gen,CI.default)}(${r})`;e.fail$data((0,jr._)`${a} ${i} ${n}`)}};Op.default=UI});var C_=S(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var ZI=st(),LI=ee(),yn=W(),qI={message:({schemaCode:e})=>(0,yn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,yn._)`{pattern: ${e}}`},FI={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:qI,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,yn._)`new RegExp`:(0,LI.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,yn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,yn._)`!${l}`)}else{let c=(0,ZI.usePattern)(e,o);e.fail$data((0,yn._)`!${c}.test(${r})`)}}};jp.default=FI});var M_=S(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var ai=W(),VI={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ai.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ai._)`{limit: ${e}}`},JI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:VI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?ai.operators.GT:ai.operators.LT;e.fail$data((0,ai._)`Object.keys(${r}).length ${o} ${n}`)}};Np.default=JI});var U_=S(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var si=st(),ci=W(),WI=ee(),KI={message:({params:{missingProperty:e}})=>(0,ci.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,ci._)`{missingProperty: ${e}}`},HI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:KI,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if(f?.[h]===void 0&&!g.has(h)){let _=a.schemaEnv.baseId+a.errSchemaPath,b=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,WI.checkStrictMode)(a,b,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(ci.nil,d);else for(let f of r)(0,si.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||i){let g=t.let("valid",!0);e.block$data(g,()=>p(f,g)),e.ok(g)}else t.if((0,si.checkMissingProp)(e,r,f)),(0,si.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,si.noPropertyInData)(t,o,f,s.ownProperties),()=>e.error())})}function p(f,g){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(g,(0,si.propertyInData)(t,o,f,s.ownProperties)),t.if((0,ci.not)(g),()=>{e.error(),t.break()})},ci.nil)}}};Dp.default=HI});var Z_=S(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var ui=W(),GI={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,ui.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,ui._)`{limit: ${e}}`},BI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:GI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?ui.operators.GT:ui.operators.LT;e.fail$data((0,ui._)`${r}.length ${o} ${n}`)}};Rp.default=BI});var ps=S(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var L_=ap();L_.code='require("ajv/dist/runtime/equal").default';Ap.default=L_});var q_=S(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var Cp=Go(),Ie=W(),XI=ee(),YI=ps(),QI={message:({params:{i:e,j:t}})=>(0,Ie.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ie._)`{i: ${e}, j: ${t}}`},eE={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:QI,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Cp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Ie._)`${a} === false`),e.ok(c);function l(){let g=t.let("i",(0,Ie._)`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(c,!0),t.if((0,Ie._)`${g} > 1`,()=>(d()?p:f)(g,h))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function p(g,h){let _=t.name("item"),b=(0,Cp.checkDataTypes)(u,_,s.opts.strictNumbers,Cp.DataType.Wrong),E=t.const("indices",(0,Ie._)`{}`);t.for((0,Ie._)`;${g}--;`,()=>{t.let(_,(0,Ie._)`${r}[${g}]`),t.if(b,(0,Ie._)`continue`),u.length>1&&t.if((0,Ie._)`typeof ${_} == "string"`,(0,Ie._)`${_} += "_"`),t.if((0,Ie._)`typeof ${E}[${_}] == "number"`,()=>{t.assign(h,(0,Ie._)`${E}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,Ie._)`${E}[${_}] = ${g}`)})}function f(g,h){let _=(0,XI.useFunc)(t,YI.default),b=t.name("outer");t.label(b).for((0,Ie._)`;${g}--;`,()=>t.for((0,Ie._)`${h} = ${g}; ${h}--;`,()=>t.if((0,Ie._)`${_}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(b)})))}}};Mp.default=eE});var F_=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var Up=W(),tE=ee(),rE=ps(),nE={message:"must be equal to constant",params:({schemaCode:e})=>(0,Up._)`{allowedValue: ${e}}`},oE={keyword:"const",$data:!0,error:nE,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Up._)`!${(0,tE.useFunc)(t,rE.default)}(${r}, ${o})`):e.fail((0,Up._)`${i} !== ${r}`)}};Zp.default=oE});var V_=S(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var li=W(),iE=ee(),aE=ps(),sE={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,li._)`{allowedValues: ${e}}`},cE={keyword:"enum",schemaType:"array",$data:!0,error:sE,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,iE.useFunc)(t,aE.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",i);l=(0,li.or)(...o.map((g,h)=>p(f,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,f=>t.if((0,li._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,g){let h=o[g];return typeof h=="object"&&h!==null?(0,li._)`${u()}(${r}, ${f}[${g}])`:(0,li._)`${r} === ${h}`}}};Lp.default=cE});var J_=S(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var uE=j_(),lE=N_(),dE=A_(),pE=C_(),fE=M_(),mE=U_(),hE=Z_(),gE=q_(),vE=F_(),_E=V_(),yE=[uE.default,lE.default,dE.default,pE.default,fE.default,mE.default,hE.default,gE.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},vE.default,_E.default];qp.default=yE});var Vp=S(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.validateAdditionalItems=void 0;var Nr=W(),Fp=ee(),$E={message:({params:{len:e}})=>(0,Nr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Nr._)`{limit: ${e}}`},bE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:$E,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Fp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}W_(e,n)}};function W_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Nr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Nr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Fp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Nr._)`${s} <= ${t.length}`);r.if((0,Nr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Fp.Type.Num},u),a.allErrors||r.if((0,Nr.not)(u),()=>r.break())})}}di.validateAdditionalItems=W_;di.default=bE});var Jp=S(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.validateTuple=void 0;var K_=W(),fs=ee(),xE=st(),kE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return H_(e,"additionalItems",t);r.items=!0,!(0,fs.alwaysValidSchema)(r,t)&&e.ok((0,xE.validateArray)(e))}};function H_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=fs.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,K_._)`${i}.length`);r.forEach((d,p)=>{(0,fs.alwaysValidSchema)(s,d)||(n.if((0,K_._)`${u} > ${p}`,()=>e.subschema({keyword:a,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=s,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(p.strictTuples&&!h){let _=`"${a}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,fs.checkStrictMode)(s,_,p.strictTuples)}}}pi.validateTuple=H_;pi.default=kE});var G_=S(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var SE=Jp(),wE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,SE.validateTuple)(e,"items")};Wp.default=wE});var X_=S(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var B_=W(),zE=ee(),IE=st(),EE=Vp(),TE={message:({params:{len:e}})=>(0,B_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,B_._)`{limit: ${e}}`},PE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:TE,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,zE.alwaysValidSchema)(n,t)&&(o?(0,EE.validateAdditionalItems)(e,o):e.ok((0,IE.validateArray)(e)))}};Kp.default=PE});var Y_=S(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var ut=W(),ms=ee(),OE={message:({params:{min:e,max:t}})=>t===void 0?(0,ut.str)`must contain at least ${e} valid item(s)`:(0,ut.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ut._)`{minContains: ${e}}`:(0,ut._)`{minContains: ${e}, maxContains: ${t}}`},jE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:OE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,ut._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,ms.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,ms.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ms.alwaysValidSchema)(i,r)){let h=(0,ut._)`${l} >= ${a}`;s!==void 0&&(h=(0,ut._)`${h} && ${l} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?f(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,ut._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let h=t.name("_valid"),_=t.let("count",0);f(h,()=>t.if(h,()=>g(_)))}function f(h,_){t.forRange("i",0,l,b=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:ms.Type.Num,compositeRule:!0},h),_()})}function g(h){t.code((0,ut._)`${h}++`),s===void 0?t.if((0,ut._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,ut._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,ut._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};Hp.default=jE});var ty=S(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateSchemaDeps=St.validatePropertyDeps=St.error=void 0;var Gp=W(),NE=ee(),fi=st();St.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Gp.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Gp._)`{property: ${e},
missingProperty: ${n},
depsCount: ${t},
- deps: ${r}}`};var EE={keyword:"dependencies",type:"object",schemaType:"object",error:kt.error,code(e){let[t,r]=TE(e);V_(e,t),J_(e,r)}};function TE({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function V_(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,ui.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,ui.checkReportMissingProp)(e,u)}):(r.if((0,Kp._)`${c} && (${(0,ui.checkMissingProp)(e,s,i)})`),(0,ui.reportMissingProp)(e,i),r.else())}}kt.validatePropertyDeps=V_;function J_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,IE.alwaysValidSchema)(i,t[s])||(r.if((0,ui.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}kt.validateSchemaDeps=J_;kt.default=EE});var H_=S(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var K_=W(),PE=re(),OE={message:"property name must be valid",params:({params:e})=>(0,K_._)`{propertyName: ${e.propertyName}}`},jE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:OE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,PE.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,K_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Hp.default=jE});var Bp=S(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var fs=at(),ht=W(),NE=Lt(),ms=re(),DE={message:"must NOT have additional properties",params:({params:e})=>(0,ht._)`{additionalProperty: ${e.additionalProperty}}`},RE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:DE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,ms.alwaysValidSchema)(a,r))return;let u=(0,fs.allSchemaProperties)(n.properties),l=(0,fs.allSchemaProperties)(n.patternProperties);d(),e.ok((0,ht._)`${i} === ${NE.default.errors}`);function d(){t.forIn("key",o,_=>{!u.length&&!l.length?g(_):t.if(m(_),()=>g(_))})}function m(_){let b;if(u.length>8){let E=(0,ms.schemaRefOrVal)(a,n.properties,"properties");b=(0,fs.isOwnProperty)(t,E,_)}else u.length?b=(0,ht.or)(...u.map(E=>(0,ht._)`${_} === ${E}`)):b=ht.nil;return l.length&&(b=(0,ht.or)(b,...l.map(E=>(0,ht._)`${(0,fs.usePattern)(e,E)}.test(${_})`))),(0,ht.not)(b)}function p(_){t.code((0,ht._)`delete ${o}[${_}]`)}function g(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,ms.alwaysValidSchema)(a,r)){let b=t.name("valid");c.removeAdditional==="failing"?(h(_,b,!1),t.if((0,ht.not)(b),()=>{e.reset(),p(_)})):(h(_,b),s||t.if((0,ht.not)(b),()=>t.break()))}}function h(_,b,E){let I={keyword:"additionalProperties",dataProp:_,dataPropType:ms.Type.Str};E===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(I,b)}}};Gp.default=RE});var X_=S(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var AE=Go(),G_=at(),Xp=re(),B_=Bp(),ME={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&B_.default.code(new AE.KeywordCxt(i,B_.default,"additionalProperties"));let a=(0,G_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Xp.mergeEvaluated.props(t,(0,Xp.toHash)(a),i.props));let s=a.filter(d=>!(0,Xp.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,G_.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Yp.default=ME});var ty=S(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Y_=at(),hs=W(),Q_=re(),ey=re(),CE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,Y_.allSchemaProperties)(r),c=s.filter(h=>(0,Q_.alwaysValidSchema)(i,r[h]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof hs.Name)&&(i.props=(0,ey.evaluatedPropsToName)(t,i.props));let{props:d}=i;m();function m(){for(let h of s)u&&p(h),i.allErrors?g(h):(t.var(l,!0),g(h),t.if(l))}function p(h){for(let _ in u)new RegExp(h).test(_)&&(0,Q_.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",n,_=>{t.if((0,hs._)`${(0,Y_.usePattern)(e,h)}.test(${_})`,()=>{let b=c.includes(h);b||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:ey.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,hs._)`${d}[${_}]`,!0):!b&&!i.allErrors&&t.if((0,hs.not)(l),()=>t.break())})})}}};Qp.default=CE});var ry=S(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var UE=re(),ZE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,UE.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ef.default=ZE});var ny=S(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var LE=at(),qE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:LE.validateUnion,error:{message:"must match a schema in anyOf"}};tf.default=qE});var oy=S(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var gs=W(),FE=re(),VE={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,gs._)`{passingSchemas: ${e.passing}}`},JE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:VE,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let m;(0,FE.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,gs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,gs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),m&&e.mergeEvaluated(m,gs.Name)})})}}};rf.default=JE});var iy=S(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var WE=re(),KE={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,WE.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};nf.default=KE});var cy=S(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var vs=W(),sy=re(),HE={message:({params:e})=>(0,vs.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,vs._)`{failingKeyword: ${e.ifClause}}`},GE={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:HE,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,sy.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=ay(n,"then"),i=ay(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,vs.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(m,a),d?t.assign(d,(0,vs._)`${l}`):e.setParams({ifClause:l})}}}};function ay(e,t){let r=e.schema[t];return r!==void 0&&!(0,sy.alwaysValidSchema)(e,r)}of.default=GE});var uy=S(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var BE=re(),XE={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,BE.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};af.default=XE});var ly=S(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var YE=qp(),QE=Z_(),eT=Fp(),tT=q_(),rT=F_(),nT=W_(),oT=H_(),iT=Bp(),aT=X_(),sT=ty(),cT=ry(),uT=ny(),lT=oy(),dT=iy(),pT=cy(),fT=uy();function mT(e=!1){let t=[cT.default,uT.default,lT.default,dT.default,pT.default,fT.default,oT.default,iT.default,nT.default,aT.default,sT.default];return e?t.push(QE.default,tT.default):t.push(YE.default,eT.default),t.push(rT.default),t}sf.default=mT});var dy=S(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var _e=W(),hT={message:({schemaCode:e})=>(0,_e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,_e._)`{format: ${e}}`},gT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:hT,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?m():p();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,_e._)`${g}[${a}]`),_=r.let("fType"),b=r.let("format");r.if((0,_e._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,_e._)`${h}.type || "string"`).assign(b,(0,_e._)`${h}.validate`),()=>r.assign(_,(0,_e._)`"string"`).assign(b,h)),e.fail$data((0,_e.or)(E(),I()));function E(){return c.strictSchema===!1?_e.nil:(0,_e._)`${a} && !${b}`}function I(){let A=l.$async?(0,_e._)`(${h}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,_e._)`${b}(${n})`,j=(0,_e._)`(typeof ${b} == "function" ? ${A} : ${b}.test(${n}))`;return(0,_e._)`${b} && ${b} !== true && ${_} === ${t} && !${j}`}}function p(){let g=d.formats[i];if(!g){E();return}if(g===!0)return;let[h,_,b]=I(g);h===t&&e.pass(A());function E(){if(c.strictSchema===!1){d.logger.warn(j());return}throw new Error(j());function j(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function I(j){let Le=j instanceof RegExp?(0,_e.regexpCode)(j):c.code.formats?(0,_e._)`${c.code.formats}${(0,_e.getProperty)(i)}`:void 0,de=r.scopeValue("formats",{key:i,ref:j,code:Le});return typeof j=="object"&&!(j instanceof RegExp)?[j.type||"string",j.validate,(0,_e._)`${de}.validate`]:["string",j,de]}function A(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,_e._)`await ${b}(${n})`}return typeof _=="function"?(0,_e._)`${b}(${n})`:(0,_e._)`${b}.test(${n})`}}}};cf.default=gT});var py=S(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var vT=dy(),_T=[vT.default];uf.default=_T});var fy=S(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.contentVocabulary=vn.metadataVocabulary=void 0;vn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];vn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var hy=S(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var yT=x_(),$T=A_(),bT=ly(),xT=py(),my=fy(),kT=[yT.default,$T.default,(0,bT.default)(),xT.default,my.metadataVocabulary,my.contentVocabulary];lf.default=kT});var vy=S(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.DiscrError=void 0;var gy;(function(e){e.Tag="tag",e.Mapping="mapping"})(gy||(_s.DiscrError=gy={}))});var yy=S(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var _n=W(),df=vy(),_y=Qa(),ST=Bo(),wT=re(),zT={message:({params:{discrError:e,tagName:t}})=>e===df.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,_n._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},IT={keyword:"discriminator",type:"object",schemaType:"object",error:zT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,_n._)`${r}${(0,_n.getProperty)(s)}`);t.if((0,_n._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:df.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=m();t.if(!1);for(let g in p)t.elseIf((0,_n._)`${u} === ${g}`),t.assign(c,d(p[g]));t.else(),e.error(!1,{discrError:df.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},g);return e.mergeEvaluated(h,_n.Name),g}function m(){var p;let g={},h=b(o),_=!0;for(let A=0;A{ET.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}});var mf=S((ge,ff)=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.MissingRefError=ge.ValidationError=ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=ge.Ajv=void 0;var TT=g_(),PT=hy(),OT=yy(),by=$y(),jT=["/properties"],ys="http://json-schema.org/draft-07/schema",yn=class extends TT.default{_addVocabularies(){super._addVocabularies(),PT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(OT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(by,jT):by;this.addMetaSchema(t,ys,!1),this.refs["http://json-schema.org/schema"]=ys}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ys)?ys:void 0)}};ge.Ajv=yn;ff.exports=ge=yn;ff.exports.Ajv=yn;Object.defineProperty(ge,"__esModule",{value:!0});ge.default=yn;var NT=Go();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return NT.KeywordCxt}});var $n=W();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return $n._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return $n.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return $n.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return $n.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return $n.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return $n.CodeGen}});var DT=Xa();Object.defineProperty(ge,"ValidationError",{enumerable:!0,get:function(){return DT.default}});var RT=Bo();Object.defineProperty(ge,"MissingRefError",{enumerable:!0,get:function(){return RT.default}})});var Ty=S(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.formatNames=wt.fastFormats=wt.fullFormats=void 0;function St(e,t){return{validate:e,compare:t}}wt.fullFormats={date:St(wy,_f),time:St(gf(!0),yf),"date-time":St(xy(!0),Iy),"iso-time":St(gf(),zy),"iso-date-time":St(xy(),Ey),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:LT,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,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:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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}))|:)))$/i,regex:HT,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:qT,int32:{type:"number",validate:JT},int64:{type:"number",validate:WT},float:{type:"number",validate:Sy},double:{type:"number",validate:Sy},password:!0,binary:!0};wt.fastFormats={...wt.fullFormats,date:St(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,_f),time:St(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,yf),"date-time":St(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Iy),"iso-time":St(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,zy),"iso-date-time":St(/^\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,Ey),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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};wt.formatNames=Object.keys(wt.fullFormats);function AT(e){return e%4===0&&(e%100!==0||e%400===0)}var MT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,CT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function wy(e){let t=MT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&AT(r)?29:CT[n])}function _f(e,t){if(e&&t)return e>t?1:e23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&a<61}}function yf(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function zy(e,t){if(!(e&&t))return;let r=hf.exec(e),n=hf.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e=FT}function WT(e){return Number.isInteger(e)}function Sy(){return!0}var KT=/[^\\]\\Z/;function HT(e){if(KT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Py=S(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.formatLimitDefinition=void 0;var GT=mf(),gt=W(),fr=gt.operators,$s={formatMaximum:{okStr:"<=",ok:fr.LTE,fail:fr.GT},formatMinimum:{okStr:">=",ok:fr.GTE,fail:fr.LT},formatExclusiveMaximum:{okStr:"<",ok:fr.LT,fail:fr.GTE},formatExclusiveMinimum:{okStr:">",ok:fr.GT,fail:fr.LTE}},BT={message:({keyword:e,schemaCode:t})=>(0,gt.str)`should be ${$s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,gt._)`{comparison: ${$s[e].okStr}, limit: ${t}}`};bn.formatLimitDefinition={keyword:Object.keys($s),type:"string",schemaType:"string",$data:!0,error:BT,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new GT.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,gt._)`${m}[${c.schemaCode}]`);e.fail$data((0,gt.or)((0,gt._)`typeof ${p} != "object"`,(0,gt._)`${p} instanceof RegExp`,(0,gt._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let m=c.schema,p=s.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:p,code:a.code.formats?(0,gt._)`${a.code.formats}${(0,gt.getProperty)(m)}`:void 0});e.fail$data(d(g))}function d(m){return(0,gt._)`${m}.compare(${r}, ${n}) ${$s[o].fail} 0`}},dependencies:["format"]};var XT=e=>(e.addKeyword(bn.formatLimitDefinition),e);bn.default=XT});var Dy=S((li,Ny)=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var xn=Ty(),YT=Py(),$f=W(),Oy=new $f.Name("fullFormats"),QT=new $f.Name("fastFormats"),bf=(e,t={keywords:!0})=>{if(Array.isArray(t))return jy(e,t,xn.fullFormats,Oy),e;let[r,n]=t.mode==="fast"?[xn.fastFormats,QT]:[xn.fullFormats,Oy],o=t.formats||xn.formatNames;return jy(e,o,r,n),t.keywords&&(0,YT.default)(e),e};bf.get=(e,t="full")=>{let n=(t==="fast"?xn.fastFormats:xn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function jy(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,$f._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}Ny.exports=li=bf;Object.defineProperty(li,"__esModule",{value:!0});li.default=bf});var Et=require("fs"),zn=require("path"),Rf=require("os"),Rs=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(Rs||{}),Df=(0,zn.join)((0,Rf.homedir)(),".claude-mem"),As=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let t=(0,zn.join)(Df,"logs");(0,Et.existsSync)(t)||(0,Et.mkdirSync)(t,{recursive:!0});let r=new Date().toISOString().split("T")[0];this.logFilePath=(0,zn.join)(t,`claude-mem-${r}.log`)}catch(t){console.error("[LOGGER] Failed to initialize log file:",t),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let t=(0,zn.join)(Df,"settings.json");if((0,Et.existsSync)(t)){let r=(0,Et.readFileSync)(t,"utf-8"),o=(JSON.parse(r).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=Rs[o]??1}else this.level=1}catch{this.level=1}return this.level}correlationId(t,r){return`obs-${t}-${r}`}sessionId(t){return`session-${t}`}formatData(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="object"){if(t instanceof Error)return this.getLevel()===0?`${t.message}
-${t.stack}`:t.message;if(Array.isArray(t))return`[${t.length} items]`;let r=Object.keys(t);return r.length===0?"{}":r.length<=3?JSON.stringify(t):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(t)}formatTool(t,r){if(!r)return t;let n=r;if(typeof r=="string")try{n=JSON.parse(r)}catch{n=r}if(t==="Bash"&&n.command)return`${t}(${n.command})`;if(n.file_path)return`${t}(${n.file_path})`;if(n.notebook_path)return`${t}(${n.notebook_path})`;if(t==="Glob"&&n.pattern)return`${t}(${n.pattern})`;if(t==="Grep"&&n.pattern)return`${t}(${n.pattern})`;if(n.url)return`${t}(${n.url})`;if(n.query)return`${t}(${n.query})`;if(t==="Task"){if(n.subagent_type)return`${t}(${n.subagent_type})`;if(n.description)return`${t}(${n.description})`}return t==="Skill"&&n.skill?`${t}(${n.skill})`:t==="LSP"&&n.operation?`${t}(${n.operation})`:t}formatTimestamp(t){let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0"),c=String(t.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${o} ${i}:${a}:${s}.${c}`}log(t,r,n,o,i){if(t{for(let u of s)(0,fi.checkReportMissingProp)(e,u)}):(r.if((0,Gp._)`${c} && (${(0,fi.checkMissingProp)(e,s,i)})`),(0,fi.reportMissingProp)(e,i),r.else())}}St.validatePropertyDeps=Q_;function ey(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,NE.alwaysValidSchema)(i,t[s])||(r.if((0,fi.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}St.validateSchemaDeps=ey;St.default=DE});var ny=S(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var ry=W(),AE=ee(),CE={message:"property name must be valid",params:({params:e})=>(0,ry._)`{propertyName: ${e.propertyName}}`},ME={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:CE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,AE.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,ry.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Bp.default=ME});var Yp=S(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var hs=st(),gt=W(),UE=qt(),gs=ee(),ZE={message:"must NOT have additional properties",params:({params:e})=>(0,gt._)`{additionalProperty: ${e.additionalProperty}}`},LE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ZE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,gs.alwaysValidSchema)(a,r))return;let u=(0,hs.allSchemaProperties)(n.properties),l=(0,hs.allSchemaProperties)(n.patternProperties);d(),e.ok((0,gt._)`${i} === ${UE.default.errors}`);function d(){t.forIn("key",o,_=>{!u.length&&!l.length?g(_):t.if(p(_),()=>g(_))})}function p(_){let b;if(u.length>8){let E=(0,gs.schemaRefOrVal)(a,n.properties,"properties");b=(0,hs.isOwnProperty)(t,E,_)}else u.length?b=(0,gt.or)(...u.map(E=>(0,gt._)`${_} === ${E}`)):b=gt.nil;return l.length&&(b=(0,gt.or)(b,...l.map(E=>(0,gt._)`${(0,hs.usePattern)(e,E)}.test(${_})`))),(0,gt.not)(b)}function f(_){t.code((0,gt._)`delete ${o}[${_}]`)}function g(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,gs.alwaysValidSchema)(a,r)){let b=t.name("valid");c.removeAdditional==="failing"?(h(_,b,!1),t.if((0,gt.not)(b),()=>{e.reset(),f(_)})):(h(_,b),s||t.if((0,gt.not)(b),()=>t.break()))}}function h(_,b,E){let I={keyword:"additionalProperties",dataProp:_,dataPropType:gs.Type.Str};E===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(I,b)}}};Xp.default=LE});var ay=S(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var qE=Qo(),oy=st(),Qp=ee(),iy=Yp(),FE={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&iy.default.code(new qE.KeywordCxt(i,iy.default,"additionalProperties"));let a=(0,oy.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Qp.mergeEvaluated.props(t,(0,Qp.toHash)(a),i.props));let s=a.filter(d=>!(0,Qp.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,oy.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};ef.default=FE});var ly=S(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var sy=st(),vs=W(),cy=ee(),uy=ee(),VE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,sy.allSchemaProperties)(r),c=s.filter(h=>(0,cy.alwaysValidSchema)(i,r[h]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof vs.Name)&&(i.props=(0,uy.evaluatedPropsToName)(t,i.props));let{props:d}=i;p();function p(){for(let h of s)u&&f(h),i.allErrors?g(h):(t.var(l,!0),g(h),t.if(l))}function f(h){for(let _ in u)new RegExp(h).test(_)&&(0,cy.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",n,_=>{t.if((0,vs._)`${(0,sy.usePattern)(e,h)}.test(${_})`,()=>{let b=c.includes(h);b||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:uy.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,vs._)`${d}[${_}]`,!0):!b&&!i.allErrors&&t.if((0,vs.not)(l),()=>t.break())})})}}};tf.default=VE});var dy=S(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var JE=ee(),WE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,JE.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};rf.default=WE});var py=S(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var KE=st(),HE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:KE.validateUnion,error:{message:"must match a schema in anyOf"}};nf.default=HE});var fy=S(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var _s=W(),GE=ee(),BE={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,_s._)`{passingSchemas: ${e.passing}}`},XE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:BE,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let p;(0,GE.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,_s._)`${c} && ${a}`).assign(a,!1).assign(s,(0,_s._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),p&&e.mergeEvaluated(p,_s.Name)})})}}};of.default=XE});var my=S(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var YE=ee(),QE={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,YE.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};af.default=QE});var vy=S(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var ys=W(),gy=ee(),eT={message:({params:e})=>(0,ys.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,ys._)`{failingKeyword: ${e.ifClause}}`},tT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:eT,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,gy.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=hy(n,"then"),i=hy(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,ys.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let p=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(p,a),d?t.assign(d,(0,ys._)`${l}`):e.setParams({ifClause:l})}}}};function hy(e,t){let r=e.schema[t];return r!==void 0&&!(0,gy.alwaysValidSchema)(e,r)}sf.default=tT});var _y=S(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var rT=ee(),nT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,rT.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};cf.default=nT});var yy=S(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var oT=Vp(),iT=G_(),aT=Jp(),sT=X_(),cT=Y_(),uT=ty(),lT=ny(),dT=Yp(),pT=ay(),fT=ly(),mT=dy(),hT=py(),gT=fy(),vT=my(),_T=vy(),yT=_y();function $T(e=!1){let t=[mT.default,hT.default,gT.default,vT.default,_T.default,yT.default,lT.default,dT.default,uT.default,pT.default,fT.default];return e?t.push(iT.default,sT.default):t.push(oT.default,aT.default),t.push(cT.default),t}uf.default=$T});var $y=S(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var _e=W(),bT={message:({schemaCode:e})=>(0,_e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,_e._)`{format: ${e}}`},xT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:bT,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():f();function p(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,_e._)`${g}[${a}]`),_=r.let("fType"),b=r.let("format");r.if((0,_e._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,_e._)`${h}.type || "string"`).assign(b,(0,_e._)`${h}.validate`),()=>r.assign(_,(0,_e._)`"string"`).assign(b,h)),e.fail$data((0,_e.or)(E(),I()));function E(){return c.strictSchema===!1?_e.nil:(0,_e._)`${a} && !${b}`}function I(){let A=l.$async?(0,_e._)`(${h}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,_e._)`${b}(${n})`,j=(0,_e._)`(typeof ${b} == "function" ? ${A} : ${b}.test(${n}))`;return(0,_e._)`${b} && ${b} !== true && ${_} === ${t} && !${j}`}}function f(){let g=d.formats[i];if(!g){E();return}if(g===!0)return;let[h,_,b]=I(g);h===t&&e.pass(A());function E(){if(c.strictSchema===!1){d.logger.warn(j());return}throw new Error(j());function j(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function I(j){let Le=j instanceof RegExp?(0,_e.regexpCode)(j):c.code.formats?(0,_e._)`${c.code.formats}${(0,_e.getProperty)(i)}`:void 0,de=r.scopeValue("formats",{key:i,ref:j,code:Le});return typeof j=="object"&&!(j instanceof RegExp)?[j.type||"string",j.validate,(0,_e._)`${de}.validate`]:["string",j,de]}function A(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,_e._)`await ${b}(${n})`}return typeof _=="function"?(0,_e._)`${b}(${n})`:(0,_e._)`${b}.test(${n})`}}}};lf.default=xT});var by=S(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var kT=$y(),ST=[kT.default];df.default=ST});var xy=S($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.contentVocabulary=$n.metadataVocabulary=void 0;$n.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];$n.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Sy=S(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var wT=O_(),zT=J_(),IT=yy(),ET=by(),ky=xy(),TT=[wT.default,zT.default,(0,IT.default)(),ET.default,ky.metadataVocabulary,ky.contentVocabulary];pf.default=TT});var zy=S($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.DiscrError=void 0;var wy;(function(e){e.Tag="tag",e.Mapping="mapping"})(wy||($s.DiscrError=wy={}))});var Ey=S(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var bn=W(),ff=zy(),Iy=rs(),PT=ei(),OT=ee(),jT={message:({params:{discrError:e,tagName:t}})=>e===ff.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,bn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},NT={keyword:"discriminator",type:"object",schemaType:"object",error:jT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,bn._)`${r}${(0,bn.getProperty)(s)}`);t.if((0,bn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:ff.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let f=p();t.if(!1);for(let g in f)t.elseIf((0,bn._)`${u} === ${g}`),t.assign(c,d(f[g]));t.else(),e.error(!1,{discrError:ff.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(f){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(h,bn.Name),g}function p(){var f;let g={},h=b(o),_=!0;for(let A=0;A{DT.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}});var gf=S((ve,hf)=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.MissingRefError=ve.ValidationError=ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=ve.Ajv=void 0;var RT=w_(),AT=Sy(),CT=Ey(),Py=Ty(),MT=["/properties"],bs="http://json-schema.org/draft-07/schema",xn=class extends RT.default{_addVocabularies(){super._addVocabularies(),AT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(CT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Py,MT):Py;this.addMetaSchema(t,bs,!1),this.refs["http://json-schema.org/schema"]=bs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(bs)?bs:void 0)}};ve.Ajv=xn;hf.exports=ve=xn;hf.exports.Ajv=xn;Object.defineProperty(ve,"__esModule",{value:!0});ve.default=xn;var UT=Qo();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return UT.KeywordCxt}});var kn=W();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return kn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return kn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return kn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return kn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return kn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return kn.CodeGen}});var ZT=es();Object.defineProperty(ve,"ValidationError",{enumerable:!0,get:function(){return ZT.default}});var LT=ei();Object.defineProperty(ve,"MissingRefError",{enumerable:!0,get:function(){return LT.default}})});var My=S(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.formatNames=zt.fastFormats=zt.fullFormats=void 0;function wt(e,t){return{validate:e,compare:t}}zt.fullFormats={date:wt(Dy,$f),time:wt(_f(!0),bf),"date-time":wt(Oy(!0),Ay),"iso-time":wt(_f(),Ry),"iso-date-time":wt(Oy(),Cy),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:KT,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,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:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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}))|:)))$/i,regex:eP,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:HT,int32:{type:"number",validate:XT},int64:{type:"number",validate:YT},float:{type:"number",validate:Ny},double:{type:"number",validate:Ny},password:!0,binary:!0};zt.fastFormats={...zt.fullFormats,date:wt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$f),time:wt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,bf),"date-time":wt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ay),"iso-time":wt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Ry),"iso-date-time":wt(/^\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,Cy),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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};zt.formatNames=Object.keys(zt.fullFormats);function qT(e){return e%4===0&&(e%100!==0||e%400===0)}var FT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,VT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Dy(e){let t=FT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&qT(r)?29:VT[n])}function $f(e,t){if(e&&t)return e>t?1:e23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function bf(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function Ry(e,t){if(!(e&&t))return;let r=vf.exec(e),n=vf.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e=GT}function YT(e){return Number.isInteger(e)}function Ny(){return!0}var QT=/[^\\]\\Z/;function eP(e){if(QT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Uy=S(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.formatLimitDefinition=void 0;var tP=gf(),vt=W(),mr=vt.operators,xs={formatMaximum:{okStr:"<=",ok:mr.LTE,fail:mr.GT},formatMinimum:{okStr:">=",ok:mr.GTE,fail:mr.LT},formatExclusiveMaximum:{okStr:"<",ok:mr.LT,fail:mr.GTE},formatExclusiveMinimum:{okStr:">",ok:mr.GT,fail:mr.LTE}},rP={message:({keyword:e,schemaCode:t})=>(0,vt.str)`should be ${xs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,vt._)`{comparison: ${xs[e].okStr}, limit: ${t}}`};Sn.formatLimitDefinition={keyword:Object.keys(xs),type:"string",schemaType:"string",$data:!0,error:rP,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new tP.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=t.const("fmt",(0,vt._)`${p}[${c.schemaCode}]`);e.fail$data((0,vt.or)((0,vt._)`typeof ${f} != "object"`,(0,vt._)`${f} instanceof RegExp`,(0,vt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=s.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let g=t.scopeValue("formats",{key:p,ref:f,code:a.code.formats?(0,vt._)`${a.code.formats}${(0,vt.getProperty)(p)}`:void 0});e.fail$data(d(g))}function d(p){return(0,vt._)`${p}.compare(${r}, ${n}) ${xs[o].fail} 0`}},dependencies:["format"]};var nP=e=>(e.addKeyword(Sn.formatLimitDefinition),e);Sn.default=nP});var Fy=S((mi,qy)=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});var wn=My(),oP=Uy(),xf=W(),Zy=new xf.Name("fullFormats"),iP=new xf.Name("fastFormats"),kf=(e,t={keywords:!0})=>{if(Array.isArray(t))return Ly(e,t,wn.fullFormats,Zy),e;let[r,n]=t.mode==="fast"?[wn.fastFormats,iP]:[wn.fullFormats,Zy],o=t.formats||wn.formatNames;return Ly(e,o,r,n),t.keywords&&(0,oP.default)(e),e};kf.get=(e,t="full")=>{let n=(t==="fast"?wn.fastFormats:wn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function Ly(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,xf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}qy.exports=mi=kf;Object.defineProperty(mi,"__esModule",{value:!0});mi.default=kf});var Tt=require("fs"),Tn=require("path"),Uf=require("os"),Cs=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(Cs||{}),Mf=(0,Tn.join)((0,Uf.homedir)(),".claude-mem"),Ms=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let t=(0,Tn.join)(Mf,"logs");(0,Tt.existsSync)(t)||(0,Tt.mkdirSync)(t,{recursive:!0});let r=new Date().toISOString().split("T")[0];this.logFilePath=(0,Tn.join)(t,`claude-mem-${r}.log`)}catch(t){console.error("[LOGGER] Failed to initialize log file:",t),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let t=(0,Tn.join)(Mf,"settings.json");if((0,Tt.existsSync)(t)){let r=(0,Tt.readFileSync)(t,"utf-8"),o=(JSON.parse(r).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=Cs[o]??1}else this.level=1}catch{this.level=1}return this.level}correlationId(t,r){return`obs-${t}-${r}`}sessionId(t){return`session-${t}`}formatData(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="object"){if(t instanceof Error)return this.getLevel()===0?`${t.message}
+${t.stack}`:t.message;if(Array.isArray(t))return`[${t.length} items]`;let r=Object.keys(t);return r.length===0?"{}":r.length<=3?JSON.stringify(t):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(t)}formatTool(t,r){if(!r)return t;let n=r;if(typeof r=="string")try{n=JSON.parse(r)}catch{n=r}if(t==="Bash"&&n.command)return`${t}(${n.command})`;if(n.file_path)return`${t}(${n.file_path})`;if(n.notebook_path)return`${t}(${n.notebook_path})`;if(t==="Glob"&&n.pattern)return`${t}(${n.pattern})`;if(t==="Grep"&&n.pattern)return`${t}(${n.pattern})`;if(n.url)return`${t}(${n.url})`;if(n.query)return`${t}(${n.query})`;if(t==="Task"){if(n.subagent_type)return`${t}(${n.subagent_type})`;if(n.description)return`${t}(${n.description})`}return t==="Skill"&&n.skill?`${t}(${n.skill})`:t==="LSP"&&n.operation?`${t}(${n.operation})`:t}formatTimestamp(t){let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0"),c=String(t.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${o} ${i}:${a}:${s}.${c}`}log(t,r,n,o,i){if(t0&&(d=` {${Object.entries(_).map(([E,I])=>`${E}=${I}`).join(", ")}}`)}let m=`[${a}] [${s}] [${c}] ${u}${n}${d}${l}`;if(this.logFilePath)try{(0,Et.appendFileSync)(this.logFilePath,m+`
-`,"utf8")}catch(p){process.stderr.write(`[LOGGER] Failed to write to log file: ${p}
-`)}else process.stderr.write(m+`
+`+JSON.stringify(i,null,2):l=" "+this.formatData(i));let d="";if(o){let{sessionId:f,memorySessionId:g,correlationId:h,..._}=o;Object.keys(_).length>0&&(d=` {${Object.entries(_).map(([E,I])=>`${E}=${I}`).join(", ")}}`)}let p=`[${a}] [${s}] [${c}] ${u}${n}${d}${l}`;if(this.logFilePath)try{(0,Tt.appendFileSync)(this.logFilePath,p+`
+`,"utf8")}catch(f){process.stderr.write(`[LOGGER] Failed to write to log file: ${f}
+`)}else process.stderr.write(p+`
`)}debug(t,r,n,o){this.log(0,t,r,n,o)}info(t,r,n,o){this.log(1,t,r,n,o)}warn(t,r,n,o){this.log(2,t,r,n,o)}error(t,r,n,o){this.log(3,t,r,n,o)}dataIn(t,r,n,o){this.info(t,`\u2192 ${r}`,n,o)}dataOut(t,r,n,o){this.info(t,`\u2190 ${r}`,n,o)}success(t,r,n,o){this.info(t,`\u2713 ${r}`,n,o)}failure(t,r,n,o){this.error(t,`\u2717 ${r}`,n,o)}timing(t,r,n,o){this.info(t,`\u23F1 ${r}`,o,{duration:`${n}ms`})}happyPathError(t,r,n,o,i=""){let u=((new Error().stack||"").split(`
-`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=u?`${u[1].split("/").pop()}:${u[2]}`:"unknown",d={...n,location:l};return this.warn(t,`[HAPPY-PATH] ${r}`,d,o),i}},ve=new As;var X;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(X||(X={}));var Af;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Af||(Af={}));var w=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tt=e=>{switch(typeof e){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(e)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(e)?w.array:e===null?w.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?w.promise:typeof Map<"u"&&e instanceof Map?w.map:typeof Set<"u"&&e instanceof Set?w.set:typeof Date<"u"&&e instanceof Date?w.date:w.object;default:return w.unknown}};var y=X.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"]);var Ke=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ke.create=e=>new Ke(e);var y$=(e,t)=>{let r;switch(e.code){case y.invalid_type:e.received===w.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,X.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${X.joinValues(e.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${X.joinValues(e.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${X.joinValues(e.options)}, received '${e.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:X.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case y.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case y.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=t.defaultError,X.assertNever(e)}return{message:r}},Gt=y$;var $$=Gt;function In(){return $$}var gi=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function x(e,t){let r=In(),n=gi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Gt?void 0:Gt].filter(o=>!!o)});e.common.issues.push(n)}var Ee=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return M;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return M;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},M=Object.freeze({status:"aborted"}),Nr=e=>({status:"dirty",value:e}),De=e=>({status:"valid",value:e}),Ms=e=>e.status==="aborted",Cs=e=>e.status==="dirty",mr=e=>e.status==="valid",En=e=>typeof Promise<"u"&&e instanceof Promise;var T;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(T||(T={}));var et=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Mf=(e,t)=>{if(mr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ke(e.common.issues);return this._error=r,this._error}}};function L(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var K=class{get description(){return this._def.description}_getType(t){return Tt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ee,ctx:{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(En(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Mf(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return mr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>mr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(En(o)?o:Promise.resolve(o));return Mf(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:y.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new lt({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return ut.create(this,this._def)}nullable(){return jt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xt.create(this)}promise(){return hr.create(this,this._def)}or(t){return Cr.create([this,t],this._def)}and(t){return Ur.create(this,t,this._def)}transform(t){return new lt({...L(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Vr({...L(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new vi({typeName:N.ZodBranded,type:this,...L(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Jr({...L(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return _i.create(this,t)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},b$=/^c[^\s-]{8,}$/i,x$=/^[0-9a-z]+$/,k$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,S$=/^[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,w$=/^[a-z0-9_-]{21}$/i,z$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,I$=/^[-+]?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)?)??$/,E$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,T$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Us,P$=/^(?:(?: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])$/,O$=/^(?:(?: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])$/,j$=/^(([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]))$/,N$=/^(([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])$/,D$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,R$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cf="((\\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])))",A$=new RegExp(`^${Cf}$`);function Uf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function M$(e){return new RegExp(`^${Uf(e)}$`)}function C$(e){let t=`${Cf}T${Uf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function U$(e,t){return!!((t==="v4"||!t)&&P$.test(e)||(t==="v6"||!t)&&j$.test(e))}function Z$(e,t){if(!z$.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function L$(e,t){return!!((t==="v4"||!t)&&O$.test(e)||(t==="v6"||!t)&&N$.test(e))}var Rr=class e extends K{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==w.string){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.string,received:i.parsedType}),M}let n=new Ee,o;for(let i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.lengtht.test(o),{validation:r,code:y.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...T.errToObj(t)})}url(t){return this._addCheck({kind:"url",...T.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...T.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...T.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...T.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...T.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...T.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...T.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...T.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...T.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...T.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...T.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...T.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...T.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...T.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...T.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...T.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...T.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...T.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...T.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...T.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...T.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...T.errToObj(r)})}nonempty(t){return this.min(1,T.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew Rr({checks:[],typeName:N.ZodString,coerce:e?.coerce??!1,...L(e)});function q$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var Tn=class e extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==w.number){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.number,received:i.parsedType}),M}let n,o=new Ee;for(let i of this._def.checks)i.kind==="int"?X.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?q$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_finite,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:T.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:T.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&X.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew Tn({checks:[],typeName:N.ZodNumber,coerce:e?.coerce||!1,...L(e)});var Pn=class e extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==w.bigint)return this._getInvalidInput(t);let n,o=new Ee;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return x(r,{code:y.invalid_type,expected:w.bigint,received:r.parsedType}),M}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew Pn({checks:[],typeName:N.ZodBigInt,coerce:e?.coerce??!1,...L(e)});var On=class extends K{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==w.boolean){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.boolean,received:n.parsedType}),M}return De(t.data)}};On.create=e=>new On({typeName:N.ZodBoolean,coerce:e?.coerce||!1,...L(e)});var jn=class e extends K{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==w.date){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.date,received:i.parsedType}),M}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_date}),M}let n=new Ee,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):X.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:T.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:T.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew jn({checks:[],coerce:e?.coerce||!1,typeName:N.ZodDate,...L(e)});var Nn=class extends K{_parse(t){if(this._getType(t)!==w.symbol){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.symbol,received:n.parsedType}),M}return De(t.data)}};Nn.create=e=>new Nn({typeName:N.ZodSymbol,...L(e)});var Ar=class extends K{_parse(t){if(this._getType(t)!==w.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.undefined,received:n.parsedType}),M}return De(t.data)}};Ar.create=e=>new Ar({typeName:N.ZodUndefined,...L(e)});var Mr=class extends K{_parse(t){if(this._getType(t)!==w.null){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.null,received:n.parsedType}),M}return De(t.data)}};Mr.create=e=>new Mr({typeName:N.ZodNull,...L(e)});var Dn=class extends K{constructor(){super(...arguments),this._any=!0}_parse(t){return De(t.data)}};Dn.create=e=>new Dn({typeName:N.ZodAny,...L(e)});var Bt=class extends K{constructor(){super(...arguments),this._unknown=!0}_parse(t){return De(t.data)}};Bt.create=e=>new Bt({typeName:N.ZodUnknown,...L(e)});var vt=class extends K{_parse(t){let r=this._getOrReturnCtx(t);return x(r,{code:y.invalid_type,expected:w.never,received:r.parsedType}),M}};vt.create=e=>new vt({typeName:N.ZodNever,...L(e)});var Rn=class extends K{_parse(t){if(this._getType(t)!==w.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.void,received:n.parsedType}),M}return De(t.data)}};Rn.create=e=>new Rn({typeName:N.ZodVoid,...L(e)});var Xt=class e extends K{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==w.array)return x(r,{code:y.invalid_type,expected:w.array,received:r.parsedType}),M;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.lengtho.maxLength.value&&(x(r,{code:y.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new et(r,a,r.path,s)))).then(a=>Ee.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new et(r,a,r.path,s)));return Ee.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:T.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:T.toString(r)}})}nonempty(t){return this.min(1,t)}};Xt.create=(e,t)=>new Xt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...L(t)});function Dr(e){if(e instanceof He){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ut.create(Dr(n))}return new He({...e._def,shape:()=>t})}else return e instanceof Xt?new Xt({...e._def,type:Dr(e.element)}):e instanceof ut?ut.create(Dr(e.unwrap())):e instanceof jt?jt.create(Dr(e.unwrap())):e instanceof Ot?Ot.create(e.items.map(t=>Dr(t))):e}var He=class e extends K{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=X.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==w.object){let u=this._getOrReturnCtx(t);return x(u,{code:y.invalid_type,expected:w.object,received:u.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof vt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new et(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof vt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(x(o,{code:y.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new et(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,m=await l.value;u.push({key:d,value:m,alwaysSet:l.alwaysSet})}return u}).then(u=>Ee.mergeObjectSync(n,u)):Ee.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return T.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:N.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of X.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of X.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Dr(this)}partial(t){let r={};for(let n of X.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of X.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ut;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Zf(X.objectKeys(this.shape))}};He.create=(e,t)=>new He({shape:()=>e,unknownKeys:"strip",catchall:vt.create(),typeName:N.ZodObject,...L(t)});He.strictCreate=(e,t)=>new He({shape:()=>e,unknownKeys:"strict",catchall:vt.create(),typeName:N.ZodObject,...L(t)});He.lazycreate=(e,t)=>new He({shape:e,unknownKeys:"strip",catchall:vt.create(),typeName:N.ZodObject,...L(t)});var Cr=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Ke(s.ctx.common.issues));return x(r,{code:y.invalid_union,unionErrors:a}),M}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Ke(c));return x(r,{code:y.invalid_union,unionErrors:s}),M}}get options(){return this._def.options}};Cr.create=(e,t)=>new Cr({options:e,typeName:N.ZodUnion,...L(t)});var Pt=e=>e instanceof Zr?Pt(e.schema):e instanceof lt?Pt(e.innerType()):e instanceof Lr?[e.value]:e instanceof qr?e.options:e instanceof Fr?X.objectValues(e.enum):e instanceof Vr?Pt(e._def.innerType):e instanceof Ar?[void 0]:e instanceof Mr?[null]:e instanceof ut?[void 0,...Pt(e.unwrap())]:e instanceof jt?[null,...Pt(e.unwrap())]:e instanceof vi||e instanceof Wr?Pt(e.unwrap()):e instanceof Jr?Pt(e._def.innerType):[],Zs=class e extends K{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.object)return x(r,{code:y.invalid_type,expected:w.object,received:r.parsedType}),M;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(x(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=Pt(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:N.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...L(n)})}};function Ls(e,t){let r=Tt(e),n=Tt(t);if(e===t)return{valid:!0,data:e};if(r===w.object&&n===w.object){let o=X.objectKeys(t),i=X.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Ls(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===w.array&&n===w.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i{if(Ms(i)||Ms(a))return M;let s=Ls(i.value,a.value);return s.valid?((Cs(i)||Cs(a))&&r.dirty(),{status:r.value,value:s.data}):(x(n,{code:y.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ur.create=(e,t,r)=>new Ur({left:e,right:t,typeName:N.ZodIntersection,...L(r)});var Ot=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.array)return x(n,{code:y.invalid_type,expected:w.array,received:n.parsedType}),M;if(n.data.lengththis._def.items.length&&(x(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new et(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ee.mergeArray(r,a)):Ee.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ot.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ot({items:e,typeName:N.ZodTuple,rest:null,...L(t)})};var qs=class e extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.object)return x(n,{code:y.invalid_type,expected:w.object,received:n.parsedType}),M;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new et(n,s,n.path,s)),value:a._parse(new et(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ee.mergeObjectAsync(r,o):Ee.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof K?new e({keyType:t,valueType:r,typeName:N.ZodRecord,...L(n)}):new e({keyType:Rr.create(),valueType:t,typeName:N.ZodRecord,...L(r)})}},An=class extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.map)return x(n,{code:y.invalid_type,expected:w.map,received:n.parsedType}),M;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new et(n,s,n.path,[u,"key"])),value:i._parse(new et(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};An.create=(e,t,r)=>new An({valueType:t,keyType:e,typeName:N.ZodMap,...L(r)});var Mn=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.set)return x(n,{code:y.invalid_type,expected:w.set,received:n.parsedType}),M;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(x(n,{code:y.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return M;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new et(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:T.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Mn.create=(e,t)=>new Mn({valueType:e,minSize:null,maxSize:null,typeName:N.ZodSet,...L(t)});var Fs=class e extends K{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.function)return x(r,{code:y.invalid_type,expected:w.function,received:r.parsedType}),M;function n(s,c){return gi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,In(),Gt].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function o(s,c){return gi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,In(),Gt].filter(u=>!!u),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof hr){let s=this;return De(async function(...c){let u=new Ke([]),l=await s._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let s=this;return De(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Ke([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Ke([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ot.create(t).rest(Bt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Ot.create([]).rest(Bt.create()),returns:r||Bt.create(),typeName:N.ZodFunction,...L(n)})}},Zr=class extends K{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Zr.create=(e,t)=>new Zr({getter:e,typeName:N.ZodLazy,...L(t)});var Lr=class extends K{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return x(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:t.data}}get value(){return this._def.value}};Lr.create=(e,t)=>new Lr({value:e,typeName:N.ZodLiteral,...L(t)});function Zf(e,t){return new qr({values:e,typeName:N.ZodEnum,...L(t)})}var qr=class e extends K{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{expected:X.joinValues(n),received:r.parsedType,code:y.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{received:r.data,code:y.invalid_enum_value,options:n}),M}return De(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};qr.create=Zf;var Fr=class extends K{_parse(t){let r=X.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==w.string&&n.parsedType!==w.number){let o=X.objectValues(r);return x(n,{expected:X.joinValues(o),received:n.parsedType,code:y.invalid_type}),M}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=X.objectValues(r);return x(n,{received:n.data,code:y.invalid_enum_value,options:o}),M}return De(t.data)}get enum(){return this._def.values}};Fr.create=(e,t)=>new Fr({values:e,typeName:N.ZodNativeEnum,...L(t)});var hr=class extends K{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.promise&&r.common.async===!1)return x(r,{code:y.invalid_type,expected:w.promise,received:r.parsedType}),M;let n=r.parsedType===w.promise?r.data:Promise.resolve(r.data);return De(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};hr.create=(e,t)=>new hr({type:e,typeName:N.ZodPromise,...L(t)});var lt=class extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{x(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?Nr(c.value):r.value==="dirty"?Nr(c.value):c});{if(r.value==="aborted")return M;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?Nr(s.value):r.value==="dirty"?Nr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!mr(a))return M;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>mr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):M);X.assertNever(o)}};lt.create=(e,t,r)=>new lt({schema:e,typeName:N.ZodEffects,effect:t,...L(r)});lt.createWithPreprocess=(e,t,r)=>new lt({schema:t,effect:{type:"preprocess",transform:e},typeName:N.ZodEffects,...L(r)});var ut=class extends K{_parse(t){return this._getType(t)===w.undefined?De(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ut.create=(e,t)=>new ut({innerType:e,typeName:N.ZodOptional,...L(t)});var jt=class extends K{_parse(t){return this._getType(t)===w.null?De(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};jt.create=(e,t)=>new jt({innerType:e,typeName:N.ZodNullable,...L(t)});var Vr=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===w.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Vr.create=(e,t)=>new Vr({innerType:e,typeName:N.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...L(t)});var Jr=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return En(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ke(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ke(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:N.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...L(t)});var Cn=class extends K{_parse(t){if(this._getType(t)!==w.nan){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.nan,received:n.parsedType}),M}return{status:"valid",value:t.data}}};Cn.create=e=>new Cn({typeName:N.ZodNaN,...L(e)});var vi=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},_i=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?M:i.status==="dirty"?(r.dirty(),Nr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:N.ZodPipeline})}},Wr=class extends K{_parse(t){let r=this._def.innerType._parse(t),n=o=>(mr(o)&&(o.value=Object.freeze(o.value)),o);return En(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:N.ZodReadonly,...L(t)});var BP={object:He.lazycreate},N;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(N||(N={}));var XP=Rr.create,YP=Tn.create,QP=Cn.create,eO=Pn.create,tO=On.create,rO=jn.create,nO=Nn.create,oO=Ar.create,iO=Mr.create,aO=Dn.create,sO=Bt.create,cO=vt.create,uO=Rn.create,lO=Xt.create,F$=He.create,dO=He.strictCreate,pO=Cr.create,fO=Zs.create,mO=Ur.create,hO=Ot.create,gO=qs.create,vO=An.create,_O=Mn.create,yO=Fs.create,$O=Zr.create,bO=Lr.create,xO=qr.create,kO=Fr.create,SO=hr.create,wO=lt.create,zO=ut.create,IO=jt.create,EO=lt.createWithPreprocess,TO=_i.create;var Lf=Object.freeze({status:"aborted"});function f(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var _t=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},gr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},yi={};function $e(e){return e&&Object.assign(yi,e),yi}var $={};wn($,{BIGINT_FORMAT_RANGES:()=>Ys,Class:()=>Js,NUMBER_FORMAT_RANGES:()=>Xs,aborted:()=>tr,allowsEval:()=>Hs,assert:()=>B$,assertEqual:()=>W$,assertIs:()=>H$,assertNever:()=>G$,assertNotEqual:()=>K$,assignProp:()=>Qt,base64ToUint8Array:()=>Vf,base64urlToUint8Array:()=>fb,cached:()=>Hr,captureStackTrace:()=>bi,cleanEnum:()=>pb,cleanRegex:()=>Ln,clone:()=>Re,cloneDef:()=>Y$,createTransparentProxy:()=>ob,defineLazy:()=>V,esc:()=>$i,escapeRegex:()=>tt,extend:()=>sb,finalizeIssue:()=>qe,floatSafeRemainder:()=>Ws,getElementAtPath:()=>Q$,getEnumValues:()=>Zn,getLengthableOrigin:()=>Vn,getParsedType:()=>nb,getSizableOrigin:()=>Fn,hexToUint8Array:()=>hb,isObject:()=>vr,isPlainObject:()=>er,issue:()=>Gr,joinValues:()=>D,jsonStringifyReplacer:()=>Kr,merge:()=>ub,mergeDefs:()=>Nt,normalizeParams:()=>k,nullish:()=>Yt,numKeys:()=>rb,objectClone:()=>X$,omit:()=>ab,optionalKeys:()=>Bs,parsedType:()=>C,partial:()=>lb,pick:()=>ib,prefixIssues:()=>Ge,primitiveTypes:()=>Gs,promiseAllObject:()=>eb,propertyKeyTypes:()=>qn,randomString:()=>tb,required:()=>db,safeExtend:()=>cb,shallowClone:()=>Ff,slugify:()=>Ks,stringifyPrimitive:()=>R,uint8ArrayToBase64:()=>Jf,uint8ArrayToBase64url:()=>mb,uint8ArrayToHex:()=>gb,unwrapMessage:()=>Un});function W$(e){return e}function K$(e){return e}function H$(e){}function G$(e){throw new Error("Unexpected value in exhaustive check")}function B$(e){}function Zn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function D(e,t="|"){return e.map(r=>R(r)).join(t)}function Kr(e,t){return typeof t=="bigint"?t.toString():t}function Hr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Yt(e){return e==null}function Ln(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ws(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var qf=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==qf)return n===void 0&&(n=qf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function X$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Qt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Nt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Y$(e){return Nt(e._zod.def)}function Q$(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function eb(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function vr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Hs=Hr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function er(e){if(vr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(vr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ff(e){return er(e)?{...e}:Array.isArray(e)?[...e]:e}function rb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var nb=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},qn=new Set(["string","number","symbol"]),Gs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function tt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Re(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function k(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ob(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function R(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Bs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Xs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ys={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ib(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Nt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Qt(this,"shape",a),a},checks:[]});return Re(e,i)}function ab(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Nt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Qt(this,"shape",a),a},checks:[]});return Re(e,i)}function sb(e,t){if(!er(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Nt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Qt(this,"shape",i),i}});return Re(e,o)}function cb(e,t){if(!er(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Nt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Qt(this,"shape",n),n}});return Re(e,r)}function ub(e,t){let r=Nt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Qt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Re(e,r)}function lb(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Nt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Qt(this,"shape",c),c},checks:[]});return Re(t,a)}function db(e,t,r){let n=Nt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Qt(this,"shape",i),i}});return Re(t,n)}function tr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Un(e){return typeof e=="string"?e:e?.message}function qe(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Un(e.inst?._zod.def?.error?.(e))??Un(t?.error?.(e))??Un(r.customError?.(e))??Un(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Fn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Vn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function C(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Gr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function pb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Vf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;nt.toString(16).padStart(2,"0")).join("")}var Js=class{constructor(...t){}};var Wf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Kr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xi=f("$ZodError",Wf),Jn=f("$ZodError",Wf,{Parent:Error});function ki(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Si(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new _t;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>qe(c,i,$e())));throw bi(s,o?.callee),s}return a.value},Kn=Wn(Jn),Hn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>qe(c,i,$e())));throw bi(s,o?.callee),s}return a.value},Gn=Hn(Jn),Bn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new _t;return i.issues.length?{success:!1,error:new(e??xi)(i.issues.map(a=>qe(a,o,$e())))}:{success:!0,data:i.value}},Br=Bn(Jn),Xn=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>qe(a,o,$e())))}:{success:!0,data:i.value}},Yn=Xn(Jn),Kf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Wn(e)(t,r,o)};var Hf=e=>(t,r,n)=>Wn(e)(t,r,n);var Gf=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Hn(e)(t,r,o)};var Bf=e=>async(t,r,n)=>Hn(e)(t,r,n);var Xf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bn(e)(t,r,o)};var Yf=e=>(t,r,n)=>Bn(e)(t,r,n);var Qf=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,o)};var em=e=>async(t,r,n)=>Xn(e)(t,r,n);var rt={};wn(rt,{base64:()=>mc,base64url:()=>wi,bigint:()=>$c,boolean:()=>xc,browserEmail:()=>wb,cidrv4:()=>pc,cidrv6:()=>fc,cuid:()=>Qs,cuid2:()=>ec,date:()=>gc,datetime:()=>_c,domain:()=>Eb,duration:()=>ic,e164:()=>hc,email:()=>sc,emoji:()=>cc,extendedDuration:()=>_b,guid:()=>ac,hex:()=>Tb,hostname:()=>Ib,html5Email:()=>xb,idnEmail:()=>Sb,integer:()=>bc,ipv4:()=>uc,ipv6:()=>lc,ksuid:()=>nc,lowercase:()=>wc,mac:()=>dc,md5_base64:()=>Ob,md5_base64url:()=>jb,md5_hex:()=>Pb,nanoid:()=>oc,null:()=>kc,number:()=>zi,rfc5322Email:()=>kb,sha1_base64:()=>Db,sha1_base64url:()=>Rb,sha1_hex:()=>Nb,sha256_base64:()=>Mb,sha256_base64url:()=>Cb,sha256_hex:()=>Ab,sha384_base64:()=>Zb,sha384_base64url:()=>Lb,sha384_hex:()=>Ub,sha512_base64:()=>Fb,sha512_base64url:()=>Vb,sha512_hex:()=>qb,string:()=>yc,time:()=>vc,ulid:()=>tc,undefined:()=>Sc,unicodeEmail:()=>tm,uppercase:()=>zc,uuid:()=>_r,uuid4:()=>yb,uuid6:()=>$b,uuid7:()=>bb,xid:()=>rc});var Qs=/^[cC][^\s-]{8,}$/,ec=/^[0-9a-z]+$/,tc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rc=/^[0-9a-vA-V]{20}$/,nc=/^[A-Za-z0-9]{27}$/,oc=/^[a-zA-Z0-9_-]{21}$/,ic=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_b=/^[-+]?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)?)??$/,ac=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,_r=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,yb=_r(4),$b=_r(6),bb=_r(7),sc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,kb=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,tm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Sb=tm,wb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,zb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function cc(){return new RegExp(zb,"u")}var uc=/^(?:(?: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])$/,lc=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,dc=e=>{let t=tt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},pc=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,fc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wi=/^[A-Za-z0-9_-]*$/,Ib=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Eb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,hc=/^\+[1-9]\d{6,14}$/,rm="(?:(?:\\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])))",gc=new RegExp(`^${rm}$`);function nm(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function vc(e){return new RegExp(`^${nm(e)}$`)}function _c(e){let t=nm({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${rm}T(?:${n})$`)}var yc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},$c=/^-?\d+n?$/,bc=/^-?\d+$/,zi=/^-?\d+(?:\.\d+)?$/,xc=/^(?:true|false)$/i,kc=/^null$/i;var Sc=/^undefined$/i;var wc=/^[^A-Z]*$/,zc=/^[^a-z]*$/,Tb=/^[0-9a-fA-F]*$/;function Qn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function eo(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Pb=/^[0-9a-fA-F]{32}$/,Ob=Qn(22,"=="),jb=eo(22),Nb=/^[0-9a-fA-F]{40}$/,Db=Qn(27,"="),Rb=eo(27),Ab=/^[0-9a-fA-F]{64}$/,Mb=Qn(43,"="),Cb=eo(43),Ub=/^[0-9a-fA-F]{96}$/,Zb=Qn(64,""),Lb=eo(64),qb=/^[0-9a-fA-F]{128}$/,Fb=Qn(86,"=="),Vb=eo(86);var se=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),im={number:"number",bigint:"bigint",object:"date"},Ic=f("$ZodCheckLessThan",(e,t)=>{se.init(e,t);let r=im[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?n.value<=t.value:n.value{se.init(e,t);let r=im[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),am=f("$ZodCheckMultipleOf",(e,t)=>{se.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ws(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),sm=f("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Xs[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=bc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}si&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),cm=f("$ZodCheckBigIntFormat",(e,t)=>{se.init(e,t);let[r,n]=Ys[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),um=f("$ZodCheckMaxSize",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Yt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Fn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lm=f("$ZodCheckMinSize",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Yt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Fn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dm=f("$ZodCheckSizeEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Yt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Fn(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pm=f("$ZodCheckMaxLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Yt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{let o=n.value;if(o.length<=t.maximum)return;let a=Vn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fm=f("$ZodCheckMinLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Yt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Vn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),mm=f("$ZodCheckLengthEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Yt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Vn(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),to=f("$ZodCheckStringFormat",(e,t)=>{var r,n;se.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),hm=f("$ZodCheckRegex",(e,t)=>{to.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gm=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=wc),to.init(e,t)}),vm=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zc),to.init(e,t)}),_m=f("$ZodCheckIncludes",(e,t)=>{se.init(e,t);let r=tt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),ym=f("$ZodCheckStartsWith",(e,t)=>{se.init(e,t);let r=new RegExp(`^${tt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),$m=f("$ZodCheckEndsWith",(e,t)=>{se.init(e,t);let r=new RegExp(`.*${tt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function om(e,t,r){e.issues.length&&t.issues.push(...Ge(r,e.issues))}var bm=f("$ZodCheckProperty",(e,t)=>{se.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>om(o,r,t.property));om(n,r,t.property)}}),xm=f("$ZodCheckMimeType",(e,t)=>{se.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),km=f("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ii=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
+`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=u?`${u[1].split("/").pop()}:${u[2]}`:"unknown",d={...n,location:l};return this.warn(t,`[HAPPY-PATH] ${r}`,d,o),i}},pe=new Ms;var X;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(X||(X={}));var Zf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Zf||(Zf={}));var w=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pt=e=>{switch(typeof e){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(e)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(e)?w.array:e===null?w.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?w.promise:typeof Map<"u"&&e instanceof Map?w.map:typeof Set<"u"&&e instanceof Set?w.set:typeof Date<"u"&&e instanceof Date?w.date:w.object;default:return w.unknown}};var y=X.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"]);var He=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;cr.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};He.create=e=>new He(e);var P$=(e,t)=>{let r;switch(e.code){case y.invalid_type:e.received===w.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,X.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${X.joinValues(e.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${X.joinValues(e.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${X.joinValues(e.options)}, received '${e.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:X.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case y.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case y.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=t.defaultError,X.assertNever(e)}return{message:r}},Bt=P$;var O$=Bt;function Pn(){return O$}var $i=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function x(e,t){let r=Pn(),n=$i({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Bt?void 0:Bt].filter(o=>!!o)});e.common.issues.push(n)}var Ee=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return C;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return C;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},C=Object.freeze({status:"aborted"}),Dr=e=>({status:"dirty",value:e}),De=e=>({status:"valid",value:e}),Us=e=>e.status==="aborted",Zs=e=>e.status==="dirty",hr=e=>e.status==="valid",On=e=>typeof Promise<"u"&&e instanceof Promise;var T;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(T||(T={}));var tt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Lf=(e,t)=>{if(hr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new He(e.common.issues);return this._error=r,this._error}}};function L(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var K=class{get description(){return this._def.description}_getType(t){return Pt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Pt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ee,ctx:{common:t.parent.common,data:t.data,parsedType:Pt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(On(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Lf(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return hr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>hr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(On(o)?o:Promise.resolve(o));return Lf(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:y.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new dt({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:r=>this["~validate"](r)}}optional(){return lt.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Yt.create(this)}promise(){return gr.create(this,this._def)}or(t){return Ur.create([this,t],this._def)}and(t){return Zr.create(this,t,this._def)}transform(t){return new dt({...L(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Jr({...L(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new bi({typeName:N.ZodBranded,type:this,...L(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Wr({...L(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return xi.create(this,t)}readonly(){return Kr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},j$=/^c[^\s-]{8,}$/i,N$=/^[0-9a-z]+$/,D$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R$=/^[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,A$=/^[a-z0-9_-]{21}$/i,C$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M$=/^[-+]?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)?)??$/,U$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Z$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ls,L$=/^(?:(?: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])$/,q$=/^(?:(?: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])$/,F$=/^(([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]))$/,V$=/^(([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])$/,J$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qf="((\\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])))",K$=new RegExp(`^${qf}$`);function Ff(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function H$(e){return new RegExp(`^${Ff(e)}$`)}function G$(e){let t=`${qf}T${Ff(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function B$(e,t){return!!((t==="v4"||!t)&&L$.test(e)||(t==="v6"||!t)&&F$.test(e))}function X$(e,t){if(!C$.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function Y$(e,t){return!!((t==="v4"||!t)&&q$.test(e)||(t==="v6"||!t)&&V$.test(e))}var Ar=class e extends K{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==w.string){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.string,received:i.parsedType}),C}let n=new Ee,o;for(let i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.lengtht.test(o),{validation:r,code:y.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...T.errToObj(t)})}url(t){return this._addCheck({kind:"url",...T.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...T.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...T.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...T.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...T.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...T.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...T.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...T.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...T.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...T.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...T.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...T.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...T.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...T.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...T.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...T.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...T.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...T.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...T.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...T.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...T.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...T.errToObj(r)})}nonempty(t){return this.min(1,T.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew Ar({checks:[],typeName:N.ZodString,coerce:e?.coerce??!1,...L(e)});function Q$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var jn=class e extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==w.number){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.number,received:i.parsedType}),C}let n,o=new Ee;for(let i of this._def.checks)i.kind==="int"?X.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Q$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_finite,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:T.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:T.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&X.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew jn({checks:[],typeName:N.ZodNumber,coerce:e?.coerce||!1,...L(e)});var Nn=class e extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==w.bigint)return this._getInvalidInput(t);let n,o=new Ee;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return x(r,{code:y.invalid_type,expected:w.bigint,received:r.parsedType}),C}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew Nn({checks:[],typeName:N.ZodBigInt,coerce:e?.coerce??!1,...L(e)});var Dn=class extends K{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==w.boolean){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.boolean,received:n.parsedType}),C}return De(t.data)}};Dn.create=e=>new Dn({typeName:N.ZodBoolean,coerce:e?.coerce||!1,...L(e)});var Rn=class e extends K{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==w.date){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.date,received:i.parsedType}),C}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_date}),C}let n=new Ee,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):X.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:T.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:T.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew Rn({checks:[],coerce:e?.coerce||!1,typeName:N.ZodDate,...L(e)});var An=class extends K{_parse(t){if(this._getType(t)!==w.symbol){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.symbol,received:n.parsedType}),C}return De(t.data)}};An.create=e=>new An({typeName:N.ZodSymbol,...L(e)});var Cr=class extends K{_parse(t){if(this._getType(t)!==w.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.undefined,received:n.parsedType}),C}return De(t.data)}};Cr.create=e=>new Cr({typeName:N.ZodUndefined,...L(e)});var Mr=class extends K{_parse(t){if(this._getType(t)!==w.null){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.null,received:n.parsedType}),C}return De(t.data)}};Mr.create=e=>new Mr({typeName:N.ZodNull,...L(e)});var Cn=class extends K{constructor(){super(...arguments),this._any=!0}_parse(t){return De(t.data)}};Cn.create=e=>new Cn({typeName:N.ZodAny,...L(e)});var Xt=class extends K{constructor(){super(...arguments),this._unknown=!0}_parse(t){return De(t.data)}};Xt.create=e=>new Xt({typeName:N.ZodUnknown,...L(e)});var _t=class extends K{_parse(t){let r=this._getOrReturnCtx(t);return x(r,{code:y.invalid_type,expected:w.never,received:r.parsedType}),C}};_t.create=e=>new _t({typeName:N.ZodNever,...L(e)});var Mn=class extends K{_parse(t){if(this._getType(t)!==w.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.void,received:n.parsedType}),C}return De(t.data)}};Mn.create=e=>new Mn({typeName:N.ZodVoid,...L(e)});var Yt=class e extends K{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==w.array)return x(r,{code:y.invalid_type,expected:w.array,received:r.parsedType}),C;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.lengtho.maxLength.value&&(x(r,{code:y.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new tt(r,a,r.path,s)))).then(a=>Ee.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new tt(r,a,r.path,s)));return Ee.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:T.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:T.toString(r)}})}nonempty(t){return this.min(1,t)}};Yt.create=(e,t)=>new Yt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...L(t)});function Rr(e){if(e instanceof Ge){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=lt.create(Rr(n))}return new Ge({...e._def,shape:()=>t})}else return e instanceof Yt?new Yt({...e._def,type:Rr(e.element)}):e instanceof lt?lt.create(Rr(e.unwrap())):e instanceof Nt?Nt.create(Rr(e.unwrap())):e instanceof jt?jt.create(e.items.map(t=>Rr(t))):e}var Ge=class e extends K{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=X.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==w.object){let u=this._getOrReturnCtx(t);return x(u,{code:y.invalid_type,expected:w.object,received:u.parsedType}),C}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof _t&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new tt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof _t){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(x(o,{code:y.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new tt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Ee.mergeObjectSync(n,u)):Ee.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return T.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:N.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of X.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of X.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Rr(this)}partial(t){let r={};for(let n of X.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of X.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof lt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Vf(X.objectKeys(this.shape))}};Ge.create=(e,t)=>new Ge({shape:()=>e,unknownKeys:"strip",catchall:_t.create(),typeName:N.ZodObject,...L(t)});Ge.strictCreate=(e,t)=>new Ge({shape:()=>e,unknownKeys:"strict",catchall:_t.create(),typeName:N.ZodObject,...L(t)});Ge.lazycreate=(e,t)=>new Ge({shape:e,unknownKeys:"strip",catchall:_t.create(),typeName:N.ZodObject,...L(t)});var Ur=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new He(s.ctx.common.issues));return x(r,{code:y.invalid_union,unionErrors:a}),C}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new He(c));return x(r,{code:y.invalid_union,unionErrors:s}),C}}get options(){return this._def.options}};Ur.create=(e,t)=>new Ur({options:e,typeName:N.ZodUnion,...L(t)});var Ot=e=>e instanceof Lr?Ot(e.schema):e instanceof dt?Ot(e.innerType()):e instanceof qr?[e.value]:e instanceof Fr?e.options:e instanceof Vr?X.objectValues(e.enum):e instanceof Jr?Ot(e._def.innerType):e instanceof Cr?[void 0]:e instanceof Mr?[null]:e instanceof lt?[void 0,...Ot(e.unwrap())]:e instanceof Nt?[null,...Ot(e.unwrap())]:e instanceof bi||e instanceof Kr?Ot(e.unwrap()):e instanceof Wr?Ot(e._def.innerType):[],qs=class e extends K{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.object)return x(r,{code:y.invalid_type,expected:w.object,received:r.parsedType}),C;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(x(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=Ot(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:N.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...L(n)})}};function Fs(e,t){let r=Pt(e),n=Pt(t);if(e===t)return{valid:!0,data:e};if(r===w.object&&n===w.object){let o=X.objectKeys(t),i=X.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Fs(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===w.array&&n===w.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i{if(Us(i)||Us(a))return C;let s=Fs(i.value,a.value);return s.valid?((Zs(i)||Zs(a))&&r.dirty(),{status:r.value,value:s.data}):(x(n,{code:y.invalid_intersection_types}),C)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Zr.create=(e,t,r)=>new Zr({left:e,right:t,typeName:N.ZodIntersection,...L(r)});var jt=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.array)return x(n,{code:y.invalid_type,expected:w.array,received:n.parsedType}),C;if(n.data.lengththis._def.items.length&&(x(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new tt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ee.mergeArray(r,a)):Ee.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};jt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jt({items:e,typeName:N.ZodTuple,rest:null,...L(t)})};var Vs=class e extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.object)return x(n,{code:y.invalid_type,expected:w.object,received:n.parsedType}),C;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new tt(n,s,n.path,s)),value:a._parse(new tt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ee.mergeObjectAsync(r,o):Ee.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof K?new e({keyType:t,valueType:r,typeName:N.ZodRecord,...L(n)}):new e({keyType:Ar.create(),valueType:t,typeName:N.ZodRecord,...L(r)})}},Un=class extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.map)return x(n,{code:y.invalid_type,expected:w.map,received:n.parsedType}),C;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new tt(n,s,n.path,[u,"key"])),value:i._parse(new tt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Un.create=(e,t,r)=>new Un({valueType:t,keyType:e,typeName:N.ZodMap,...L(r)});var Zn=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.set)return x(n,{code:y.invalid_type,expected:w.set,received:n.parsedType}),C;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(x(n,{code:y.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return C;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new tt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:T.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Zn.create=(e,t)=>new Zn({valueType:e,minSize:null,maxSize:null,typeName:N.ZodSet,...L(t)});var Js=class e extends K{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.function)return x(r,{code:y.invalid_type,expected:w.function,received:r.parsedType}),C;function n(s,c){return $i({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Pn(),Bt].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function o(s,c){return $i({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Pn(),Bt].filter(u=>!!u),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof gr){let s=this;return De(async function(...c){let u=new He([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return De(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new He([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new He([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:jt.create(t).rest(Xt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||jt.create([]).rest(Xt.create()),returns:r||Xt.create(),typeName:N.ZodFunction,...L(n)})}},Lr=class extends K{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Lr.create=(e,t)=>new Lr({getter:e,typeName:N.ZodLazy,...L(t)});var qr=class extends K{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return x(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:t.data}}get value(){return this._def.value}};qr.create=(e,t)=>new qr({value:e,typeName:N.ZodLiteral,...L(t)});function Vf(e,t){return new Fr({values:e,typeName:N.ZodEnum,...L(t)})}var Fr=class e extends K{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{expected:X.joinValues(n),received:r.parsedType,code:y.invalid_type}),C}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{received:r.data,code:y.invalid_enum_value,options:n}),C}return De(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Fr.create=Vf;var Vr=class extends K{_parse(t){let r=X.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==w.string&&n.parsedType!==w.number){let o=X.objectValues(r);return x(n,{expected:X.joinValues(o),received:n.parsedType,code:y.invalid_type}),C}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=X.objectValues(r);return x(n,{received:n.data,code:y.invalid_enum_value,options:o}),C}return De(t.data)}get enum(){return this._def.values}};Vr.create=(e,t)=>new Vr({values:e,typeName:N.ZodNativeEnum,...L(t)});var gr=class extends K{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.promise&&r.common.async===!1)return x(r,{code:y.invalid_type,expected:w.promise,received:r.parsedType}),C;let n=r.parsedType===w.promise?r.data:Promise.resolve(r.data);return De(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};gr.create=(e,t)=>new gr({type:e,typeName:N.ZodPromise,...L(t)});var dt=class extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{x(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return C;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?C:c.status==="dirty"?Dr(c.value):r.value==="dirty"?Dr(c.value):c});{if(r.value==="aborted")return C;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?C:s.status==="dirty"?Dr(s.value):r.value==="dirty"?Dr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?C:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?C:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!hr(a))return C;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>hr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):C);X.assertNever(o)}};dt.create=(e,t,r)=>new dt({schema:e,typeName:N.ZodEffects,effect:t,...L(r)});dt.createWithPreprocess=(e,t,r)=>new dt({schema:t,effect:{type:"preprocess",transform:e},typeName:N.ZodEffects,...L(r)});var lt=class extends K{_parse(t){return this._getType(t)===w.undefined?De(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};lt.create=(e,t)=>new lt({innerType:e,typeName:N.ZodOptional,...L(t)});var Nt=class extends K{_parse(t){return this._getType(t)===w.null?De(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:N.ZodNullable,...L(t)});var Jr=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===w.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:N.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...L(t)});var Wr=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return On(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new He(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new He(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:N.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...L(t)});var Ln=class extends K{_parse(t){if(this._getType(t)!==w.nan){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.nan,received:n.parsedType}),C}return{status:"valid",value:t.data}}};Ln.create=e=>new Ln({typeName:N.ZodNaN,...L(e)});var bi=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},xi=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?C:i.status==="dirty"?(r.dirty(),Dr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?C:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:N.ZodPipeline})}},Kr=class extends K{_parse(t){let r=this._def.innerType._parse(t),n=o=>(hr(o)&&(o.value=Object.freeze(o.value)),o);return On(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Kr.create=(e,t)=>new Kr({innerType:e,typeName:N.ZodReadonly,...L(t)});var tO={object:Ge.lazycreate},N;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(N||(N={}));var rO=Ar.create,nO=jn.create,oO=Ln.create,iO=Nn.create,aO=Dn.create,sO=Rn.create,cO=An.create,uO=Cr.create,lO=Mr.create,dO=Cn.create,pO=Xt.create,fO=_t.create,mO=Mn.create,hO=Yt.create,eb=Ge.create,gO=Ge.strictCreate,vO=Ur.create,_O=qs.create,yO=Zr.create,$O=jt.create,bO=Vs.create,xO=Un.create,kO=Zn.create,SO=Js.create,wO=Lr.create,zO=qr.create,IO=Fr.create,EO=Vr.create,TO=gr.create,PO=dt.create,OO=lt.create,jO=Nt.create,NO=dt.createWithPreprocess,DO=xi.create;var Jf=Object.freeze({status:"aborted"});function m(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var yt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},vr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ki={};function $e(e){return e&&Object.assign(ki,e),ki}var $={};En($,{BIGINT_FORMAT_RANGES:()=>tc,Class:()=>Ks,NUMBER_FORMAT_RANGES:()=>ec,aborted:()=>rr,allowsEval:()=>Bs,assert:()=>sb,assertEqual:()=>nb,assertIs:()=>ib,assertNever:()=>ab,assertNotEqual:()=>ob,assignProp:()=>er,base64ToUint8Array:()=>Qf,base64urlToUint8Array:()=>_b,cached:()=>Gr,captureStackTrace:()=>wi,cleanEnum:()=>vb,cleanRegex:()=>Vn,clone:()=>Re,cloneDef:()=>ub,createTransparentProxy:()=>hb,defineLazy:()=>q,esc:()=>Si,escapeRegex:()=>rt,extend:()=>Gf,finalizeIssue:()=>qe,floatSafeRemainder:()=>Hs,getElementAtPath:()=>lb,getEnumValues:()=>Fn,getLengthableOrigin:()=>Kn,getParsedType:()=>mb,getSizableOrigin:()=>Wn,hexToUint8Array:()=>$b,isObject:()=>_r,isPlainObject:()=>tr,issue:()=>Br,joinValues:()=>D,jsonStringifyReplacer:()=>Hr,merge:()=>gb,mergeDefs:()=>Dt,normalizeParams:()=>k,nullish:()=>Qt,numKeys:()=>fb,objectClone:()=>cb,omit:()=>Hf,optionalKeys:()=>Qs,parsedType:()=>M,partial:()=>Xf,pick:()=>Kf,prefixIssues:()=>Be,primitiveTypes:()=>Ys,promiseAllObject:()=>db,propertyKeyTypes:()=>Jn,randomString:()=>pb,required:()=>Yf,safeExtend:()=>Bf,shallowClone:()=>Xs,slugify:()=>Gs,stringifyPrimitive:()=>R,uint8ArrayToBase64:()=>em,uint8ArrayToBase64url:()=>yb,uint8ArrayToHex:()=>bb,unwrapMessage:()=>qn});function nb(e){return e}function ob(e){return e}function ib(e){}function ab(e){throw new Error("Unexpected value in exhaustive check")}function sb(e){}function Fn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function D(e,t="|"){return e.map(r=>R(r)).join(t)}function Hr(e,t){return typeof t=="bigint"?t.toString():t}function Gr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Qt(e){return e==null}function Vn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Hs(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var Wf=Symbol("evaluating");function q(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Wf)return n===void 0&&(n=Wf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function cb(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function er(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Dt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ub(e){return Dt(e._zod.def)}function lb(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function db(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function _r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Bs=Gr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function tr(e){if(_r(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(_r(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Xs(e){return tr(e)?{...e}:Array.isArray(e)?[...e]:e}function fb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var mb=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Jn=new Set(["string","number","symbol"]),Ys=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Re(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function k(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function hb(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function R(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Qs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ec={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},tc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Kf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Dt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return er(this,"shape",a),a},checks:[]});return Re(e,i)}function Hf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Dt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return er(this,"shape",a),a},checks:[]});return Re(e,i)}function Gf(e,t){if(!tr(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Dt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return er(this,"shape",i),i}});return Re(e,o)}function Bf(e,t){if(!tr(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Dt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return er(this,"shape",n),n}});return Re(e,r)}function gb(e,t){let r=Dt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return er(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Re(e,r)}function Xf(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Dt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return er(this,"shape",c),c},checks:[]});return Re(t,a)}function Yf(e,t,r){let n=Dt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return er(this,"shape",i),i}});return Re(t,n)}function rr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function qn(e){return typeof e=="string"?e:e?.message}function qe(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=qn(e.inst?._zod.def?.error?.(e))??qn(t?.error?.(e))??qn(r.customError?.(e))??qn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Wn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Kn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function M(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Br(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function vb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Qf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;nt.toString(16).padStart(2,"0")).join("")}var Ks=class{constructor(...t){}};var tm=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Hr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},zi=m("$ZodError",tm),Hn=m("$ZodError",tm,{Parent:Error});function Ii(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ei(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new yt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>qe(c,i,$e())));throw wi(s,o?.callee),s}return a.value},Bn=Gn(Hn),Xn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>qe(c,i,$e())));throw wi(s,o?.callee),s}return a.value},Yn=Xn(Hn),Qn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new yt;return i.issues.length?{success:!1,error:new(e??zi)(i.issues.map(a=>qe(a,o,$e())))}:{success:!0,data:i.value}},Xr=Qn(Hn),eo=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>qe(a,o,$e())))}:{success:!0,data:i.value}},to=eo(Hn),rm=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Gn(e)(t,r,o)};var nm=e=>(t,r,n)=>Gn(e)(t,r,n);var om=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,o)};var im=e=>async(t,r,n)=>Xn(e)(t,r,n);var am=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qn(e)(t,r,o)};var sm=e=>(t,r,n)=>Qn(e)(t,r,n);var cm=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return eo(e)(t,r,o)};var um=e=>async(t,r,n)=>eo(e)(t,r,n);var nt={};En(nt,{base64:()=>vc,base64url:()=>Ti,bigint:()=>kc,boolean:()=>wc,browserEmail:()=>Pb,cidrv4:()=>hc,cidrv6:()=>gc,cuid:()=>rc,cuid2:()=>nc,date:()=>yc,datetime:()=>bc,domain:()=>Nb,duration:()=>cc,e164:()=>_c,email:()=>lc,emoji:()=>dc,extendedDuration:()=>kb,guid:()=>uc,hex:()=>Db,hostname:()=>jb,html5Email:()=>Ib,idnEmail:()=>Tb,integer:()=>Sc,ipv4:()=>pc,ipv6:()=>fc,ksuid:()=>ac,lowercase:()=>Ec,mac:()=>mc,md5_base64:()=>Ab,md5_base64url:()=>Cb,md5_hex:()=>Rb,nanoid:()=>sc,null:()=>zc,number:()=>Pi,rfc5322Email:()=>Eb,sha1_base64:()=>Ub,sha1_base64url:()=>Zb,sha1_hex:()=>Mb,sha256_base64:()=>qb,sha256_base64url:()=>Fb,sha256_hex:()=>Lb,sha384_base64:()=>Jb,sha384_base64url:()=>Wb,sha384_hex:()=>Vb,sha512_base64:()=>Hb,sha512_base64url:()=>Gb,sha512_hex:()=>Kb,string:()=>xc,time:()=>$c,ulid:()=>oc,undefined:()=>Ic,unicodeEmail:()=>lm,uppercase:()=>Tc,uuid:()=>yr,uuid4:()=>Sb,uuid6:()=>wb,uuid7:()=>zb,xid:()=>ic});var rc=/^[cC][^\s-]{8,}$/,nc=/^[0-9a-z]+$/,oc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ic=/^[0-9a-vA-V]{20}$/,ac=/^[A-Za-z0-9]{27}$/,sc=/^[a-zA-Z0-9_-]{21}$/,cc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kb=/^[-+]?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)?)??$/,uc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Sb=yr(4),wb=yr(6),zb=yr(7),lc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ib=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Eb=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,lm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Tb=lm,Pb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ob="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function dc(){return new RegExp(Ob,"u")}var pc=/^(?:(?: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])$/,fc=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,mc=e=>{let t=rt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},hc=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,gc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ti=/^[A-Za-z0-9_-]*$/,jb=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Nb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,_c=/^\+[1-9]\d{6,14}$/,dm="(?:(?:\\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])))",yc=new RegExp(`^${dm}$`);function pm(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $c(e){return new RegExp(`^${pm(e)}$`)}function bc(e){let t=pm({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${dm}T(?:${n})$`)}var xc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},kc=/^-?\d+n?$/,Sc=/^-?\d+$/,Pi=/^-?\d+(?:\.\d+)?$/,wc=/^(?:true|false)$/i,zc=/^null$/i;var Ic=/^undefined$/i;var Ec=/^[^A-Z]*$/,Tc=/^[^a-z]*$/,Db=/^[0-9a-fA-F]*$/;function ro(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function no(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Rb=/^[0-9a-fA-F]{32}$/,Ab=ro(22,"=="),Cb=no(22),Mb=/^[0-9a-fA-F]{40}$/,Ub=ro(27,"="),Zb=no(27),Lb=/^[0-9a-fA-F]{64}$/,qb=ro(43,"="),Fb=no(43),Vb=/^[0-9a-fA-F]{96}$/,Jb=ro(64,""),Wb=no(64),Kb=/^[0-9a-fA-F]{128}$/,Hb=ro(86,"=="),Gb=no(86);var se=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),mm={number:"number",bigint:"bigint",object:"date"},Pc=m("$ZodCheckLessThan",(e,t)=>{se.init(e,t);let r=mm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?n.value<=t.value:n.value{se.init(e,t);let r=mm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hm=m("$ZodCheckMultipleOf",(e,t)=>{se.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Hs(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),gm=m("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=ec[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=Sc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}si&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),vm=m("$ZodCheckBigIntFormat",(e,t)=>{se.init(e,t);let[r,n]=tc[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),_m=m("$ZodCheckMaxSize",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Qt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Wn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ym=m("$ZodCheckMinSize",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Qt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Wn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$m=m("$ZodCheckSizeEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Qt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Wn(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bm=m("$ZodCheckMaxLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Qt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{let o=n.value;if(o.length<=t.maximum)return;let a=Kn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xm=m("$ZodCheckMinLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Qt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Kn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),km=m("$ZodCheckLengthEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Qt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Kn(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),oo=m("$ZodCheckStringFormat",(e,t)=>{var r,n;se.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Sm=m("$ZodCheckRegex",(e,t)=>{oo.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),wm=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ec),oo.init(e,t)}),zm=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Tc),oo.init(e,t)}),Im=m("$ZodCheckIncludes",(e,t)=>{se.init(e,t);let r=rt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Em=m("$ZodCheckStartsWith",(e,t)=>{se.init(e,t);let r=new RegExp(`^${rt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Tm=m("$ZodCheckEndsWith",(e,t)=>{se.init(e,t);let r=new RegExp(`.*${rt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function fm(e,t,r){e.issues.length&&t.issues.push(...Be(r,e.issues))}var Pm=m("$ZodCheckProperty",(e,t)=>{se.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>fm(o,r,t.property));fm(n,r,t.property)}}),Om=m("$ZodCheckMimeType",(e,t)=>{se.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),jm=m("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Oi=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
-`))}};var wm={major:4,minor:3,patch:4};var Z=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=tr(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let m=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new _t;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==m&&(u||(u=tr(a,m)))});else{if(a.issues.length===m)continue;u||(u=tr(a,m))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(tr(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new _t;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new _t;return c.then(u=>o(u,n,s))}return o(c,n,s)}}V(e,"~standard",()=>({validate:o=>{try{let i=Br(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Yn(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),yr=f("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),oe=f("$ZodStringFormat",(e,t)=>{to.init(e,t),yr.init(e,t)}),Pc=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ac),oe.init(e,t)}),Oc=f("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=_r(n))}else t.pattern??(t.pattern=_r());oe.init(e,t)}),jc=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=sc),oe.init(e,t)}),Nc=f("$ZodURL",(e,t)=>{oe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Dc=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=cc()),oe.init(e,t)}),Rc=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=oc),oe.init(e,t)}),Ac=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qs),oe.init(e,t)}),Mc=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ec),oe.init(e,t)}),Cc=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tc),oe.init(e,t)}),Uc=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rc),oe.init(e,t)}),Zc=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nc),oe.init(e,t)}),Lc=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_c(t)),oe.init(e,t)}),qc=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=gc),oe.init(e,t)}),Fc=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=vc(t)),oe.init(e,t)}),Vc=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ic),oe.init(e,t)}),Jc=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=uc),oe.init(e,t),e._zod.bag.format="ipv4"}),Wc=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=lc),oe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Kc=f("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=dc(t.delimiter)),oe.init(e,t),e._zod.bag.format="mac"}),Hc=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pc),oe.init(e,t)}),Gc=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fc),oe.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Mm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Bc=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mc),oe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Mm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Jb(e){if(!wi.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Mm(r)}var Xc=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=wi),oe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Jb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Yc=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=hc),oe.init(e,t)});function Wb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Qc=f("$ZodJWT",(e,t)=>{oe.init(e,t),e._zod.check=r=>{Wb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),eu=f("$ZodCustomStringFormat",(e,t)=>{oe.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Ni=f("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??zi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),tu=f("$ZodNumberFormat",(e,t)=>{sm.init(e,t),Ni.init(e,t)}),ro=f("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=xc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Di=f("$ZodBigInt",(e,t)=>{Z.init(e,t),e._zod.pattern=$c,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),ru=f("$ZodBigIntFormat",(e,t)=>{cm.init(e,t),Di.init(e,t)}),nu=f("$ZodSymbol",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),ou=f("$ZodUndefined",(e,t)=>{Z.init(e,t),e._zod.pattern=Sc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),iu=f("$ZodNull",(e,t)=>{Z.init(e,t),e._zod.pattern=kc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),au=f("$ZodAny",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),su=f("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),cu=f("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),uu=f("$ZodVoid",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),lu=f("$ZodDate",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function zm(e,t,r){e.issues.length&&t.issues.push(...Ge(r,e.issues)),t.value[r]=e.value}var du=f("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;azm(u,r,a))):zm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function ji(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Ge(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Cm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Bs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Um(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let m=c.run({value:t[d],issues:[]},n);m instanceof Promise?e.push(m.then(p=>ji(p,r,d,t,l))):ji(m,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Zm=f("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Hr(()=>Cm(t));V(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=vr,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let m of a.keys){let p=d[m],g=p._zod.optout==="optional",h=p._zod.run({value:u[m],issues:[]},c);h instanceof Promise?l.push(h.then(_=>ji(_,s,m,u,g))):ji(h,s,m,u,g)}return i?Um(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Lm=f("$ZodObjectJIT",(e,t)=>{Zm.init(e,t);let r=e._zod.parse,n=Hr(()=>Cm(t)),o=m=>{let p=new Ii(["shape","payload","ctx"]),g=n.value,h=I=>{let A=$i(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),b=0;for(let I of g.keys)_[I]=`key_${b++}`;p.write("const newResult = {};");for(let I of g.keys){let A=_[I],j=$i(I),de=m[I]?._zod?.optout==="optional";p.write(`const ${A} = ${h(I)};`),de?p.write(`
+`))}};var Dm={major:4,minor:3,patch:6};var Z=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Dm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=rr(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new yt;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=rr(a,p)))});else{if(a.issues.length===p)continue;u||(u=rr(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(rr(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new yt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new yt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}q(e,"~standard",()=>({validate:o=>{try{let i=Xr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return to(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),$r=m("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??xc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),oe=m("$ZodStringFormat",(e,t)=>{oo.init(e,t),$r.init(e,t)}),Nc=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=uc),oe.init(e,t)}),Dc=m("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yr(n))}else t.pattern??(t.pattern=yr());oe.init(e,t)}),Rc=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lc),oe.init(e,t)}),Ac=m("$ZodURL",(e,t)=>{oe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Cc=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=dc()),oe.init(e,t)}),Mc=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=sc),oe.init(e,t)}),Uc=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=rc),oe.init(e,t)}),Zc=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nc),oe.init(e,t)}),Lc=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=oc),oe.init(e,t)}),qc=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ic),oe.init(e,t)}),Fc=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ac),oe.init(e,t)}),Vc=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=bc(t)),oe.init(e,t)}),Jc=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yc),oe.init(e,t)}),Wc=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$c(t)),oe.init(e,t)}),Kc=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cc),oe.init(e,t)}),Hc=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=pc),oe.init(e,t),e._zod.bag.format="ipv4"}),Gc=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fc),oe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Bc=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=mc(t.delimiter)),oe.init(e,t),e._zod.bag.format="mac"}),Xc=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=hc),oe.init(e,t)}),Yc=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=gc),oe.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Wm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Qc=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=vc),oe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Wm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Bb(e){if(!Ti.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Wm(r)}var eu=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ti),oe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Bb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),tu=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_c),oe.init(e,t)});function Xb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var ru=m("$ZodJWT",(e,t)=>{oe.init(e,t),e._zod.check=r=>{Xb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),nu=m("$ZodCustomStringFormat",(e,t)=>{oe.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Ci=m("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??Pi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),ou=m("$ZodNumberFormat",(e,t)=>{gm.init(e,t),Ci.init(e,t)}),io=m("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=wc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Mi=m("$ZodBigInt",(e,t)=>{Z.init(e,t),e._zod.pattern=kc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),iu=m("$ZodBigIntFormat",(e,t)=>{vm.init(e,t),Mi.init(e,t)}),au=m("$ZodSymbol",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),su=m("$ZodUndefined",(e,t)=>{Z.init(e,t),e._zod.pattern=Ic,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),cu=m("$ZodNull",(e,t)=>{Z.init(e,t),e._zod.pattern=zc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),uu=m("$ZodAny",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),lu=m("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),du=m("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),pu=m("$ZodVoid",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),fu=m("$ZodDate",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function Rm(e,t,r){e.issues.length&&t.issues.push(...Be(r,e.issues)),t.value[r]=e.value}var mu=m("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;aRm(u,r,a))):Rm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ai(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Be(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Km(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Qs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Hm(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:t[d],issues:[]},n);p instanceof Promise?e.push(p.then(f=>Ai(f,r,d,t,l))):Ai(p,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Gm=m("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Gr(()=>Km(t));q(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=_r,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],g=f._zod.optout==="optional",h=f._zod.run({value:u[p],issues:[]},c);h instanceof Promise?l.push(h.then(_=>Ai(_,s,p,u,g))):Ai(h,s,p,u,g)}return i?Hm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Bm=m("$ZodObjectJIT",(e,t)=>{Gm.init(e,t);let r=e._zod.parse,n=Gr(()=>Km(t)),o=p=>{let f=new Oi(["shape","payload","ctx"]),g=n.value,h=I=>{let A=Si(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};f.write("const input = payload.value;");let _=Object.create(null),b=0;for(let I of g.keys)_[I]=`key_${b++}`;f.write("const newResult = {};");for(let I of g.keys){let A=_[I],j=Si(I),de=p[I]?._zod?.optout==="optional";f.write(`const ${A} = ${h(I)};`),de?f.write(`
if (${A}.issues.length) {
if (${j} in input) {
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
@@ -34,7 +34,7 @@ ${i.stack}`:` ${i.message}`:this.getLevel()===0&&typeof i=="object"?l=`
newResult[${j}] = ${A}.value;
}
- `):p.write(`
+ `):f.write(`
if (${A}.issues.length) {
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
...iss,
@@ -50,11 +50,11 @@ ${i.stack}`:` ${i.message}`:this.getLevel()===0&&typeof i=="object"?l=`
newResult[${j}] = ${A}.value;
}
- `)}p.write("payload.value = newResult;"),p.write("return payload;");let E=p.compile();return(I,A)=>E(m,I,A)},i,a=vr,s=!yi.jitless,u=s&&Hs.value,l=t.catchall,d;e._zod.parse=(m,p)=>{d??(d=n.value);let g=m.value;return a(g)?s&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),m=i(m,p),l?Um([],g,m,p,d,e):m):r(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Im(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!tr(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>qe(a,n,$e())))}),t)}var no=f("$ZodUnion",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Ln(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Im(c,o,e,i)):Im(s,o,e,i)}});function Em(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>qe(a,n,$e())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var pu=f("$ZodXor",(e,t)=>{no.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>Em(c,o,e,i)):Em(s,o,e,i)}}),fu=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,no.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Hr(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!vr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),mu=f("$ZodIntersection",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Tm(r,c,u)):Tm(r,i,a)}});function Tc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(er(e)&&er(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Tc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;ns.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),tr(e))return e;let a=Tc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Ri=f("$ZodTuple",(e,t)=>{Z.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(m=>Ei(m,n,u))):Ei(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let m=t.rest._zod.run({value:d,issues:[]},o);m instanceof Promise?a.push(m.then(p=>Ei(p,n,u))):Ei(m,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Ei(e,t,r){e.issues.length&&t.issues.push(...Ge(r,e.issues)),t.value[r]=e.value}var hu=f("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!er(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Ge(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Ge(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&zi.test(s)&&c.issues.length&&c.issues.some(d=>d.code==="invalid_type"&&d.expected==="number")){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>qe(d,n,$e())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Ge(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Ge(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),gu=f("$ZodMap",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{Pm(l,d,r,a,o,e,n)})):Pm(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function Pm(e,t,r,n,o,i,a){e.issues.length&&(qn.has(typeof n)?r.issues.push(...Ge(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>qe(s,a,$e()))})),t.issues.length&&(qn.has(typeof n)?r.issues.push(...Ge(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>qe(s,a,$e()))})),r.value.set(e.value,t.value)}var vu=f("$ZodSet",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>Om(c,r))):Om(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Om(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var _u=f("$ZodEnum",(e,t)=>{Z.init(e,t);let r=Zn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>qn.has(typeof o)).map(o=>typeof o=="string"?tt(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),yu=f("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?tt(n):n?tt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),$u=f("$ZodFile",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),bu=f("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new _t;return r.value=o,r}});function jm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ai=f("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ln(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>jm(i,r.value)):jm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),xu=f("$ZodExactOptional",(e,t)=>{Ai.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ku=f("$ZodNullable",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ln(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Su=f("$ZodDefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Nm(i,t)):Nm(o,t)}});function Nm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var wu=f("$ZodPrefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),zu=f("$ZodNonOptional",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Dm(i,e)):Dm(o,e)}});function Dm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Iu=f("$ZodSuccess",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),Eu=f("$ZodCatch",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>qe(a,n,$e()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>qe(i,n,$e()))},input:r.value}),r.issues=[]),r)}}),Tu=f("$ZodNaN",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Pu=f("$ZodPipe",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ti(a,t.in,n)):Ti(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Ti(i,t.out,n)):Ti(o,t.out,n)}});function Ti(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var oo=f("$ZodCodec",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Pi(a,t,n)):Pi(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Pi(a,t,n)):Pi(i,t,n)}}});function Pi(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Oi(e,i,t.out,r)):Oi(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Oi(e,i,t.in,r)):Oi(e,o,t.in,r)}}function Oi(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Ou=f("$ZodReadonly",(e,t)=>{Z.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType?._zod?.optin),V(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Rm):Rm(o)}});function Rm(e){return e.value=Object.freeze(e.value),e}var ju=f("$ZodTemplateLiteral",(e,t)=>{Z.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Gs.has(typeof n))r.push(tt(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Nu=f("$ZodFunction",(e,t)=>(Z.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?Kn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Kn(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await Gn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Gn(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Ri({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Du=f("$ZodPromise",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),Ru=f("$ZodLazy",(e,t)=>{Z.init(e,t),V(e._zod,"innerType",()=>t.getter()),V(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),V(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),V(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),V(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Au=f("$ZodCustom",(e,t)=>{se.init(e,t),Z.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Am(i,r,n,e));Am(o,r,n,e)}});function Am(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Gr(o))}}var Hb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=C(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${R(o.values[0])}`:`Invalid option: expected one of ${D(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${D(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Mu(){return{localeError:Hb()}}var qm;var Uu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Zu(){return new Uu}(qm=globalThis).__zod_globalRegistry??(qm.__zod_globalRegistry=Zu());var Ae=globalThis.__zod_globalRegistry;function Lu(e,t){return new e({type:"string",...k(t)})}function Mi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...k(t)})}function io(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...k(t)})}function Ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...k(t)})}function Ui(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(t)})}function Zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(t)})}function Li(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(t)})}function ao(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...k(t)})}function qi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...k(t)})}function Fi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(t)})}function Vi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...k(t)})}function Ji(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(t)})}function Wi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...k(t)})}function Ki(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...k(t)})}function Hi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(t)})}function Gi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(t)})}function Bi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(t)})}function qu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...k(t)})}function Xi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(t)})}function Yi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(t)})}function Qi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...k(t)})}function ea(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...k(t)})}function ta(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...k(t)})}function ra(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...k(t)})}function Fu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(t)})}function Vu(e,t){return new e({type:"string",format:"date",check:"string_format",...k(t)})}function Ju(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...k(t)})}function Wu(e,t){return new e({type:"string",format:"duration",check:"string_format",...k(t)})}function Ku(e,t){return new e({type:"number",checks:[],...k(t)})}function Hu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...k(t)})}function Gu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...k(t)})}function Bu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...k(t)})}function Xu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...k(t)})}function Yu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...k(t)})}function Qu(e,t){return new e({type:"boolean",...k(t)})}function el(e,t){return new e({type:"bigint",...k(t)})}function tl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...k(t)})}function rl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...k(t)})}function nl(e,t){return new e({type:"symbol",...k(t)})}function ol(e,t){return new e({type:"undefined",...k(t)})}function il(e,t){return new e({type:"null",...k(t)})}function al(e){return new e({type:"any"})}function sl(e){return new e({type:"unknown"})}function cl(e,t){return new e({type:"never",...k(t)})}function ul(e,t){return new e({type:"void",...k(t)})}function ll(e,t){return new e({type:"date",...k(t)})}function dl(e,t){return new e({type:"nan",...k(t)})}function Dt(e,t){return new Ic({check:"less_than",...k(t),value:e,inclusive:!1})}function Be(e,t){return new Ic({check:"less_than",...k(t),value:e,inclusive:!0})}function Rt(e,t){return new Ec({check:"greater_than",...k(t),value:e,inclusive:!1})}function Me(e,t){return new Ec({check:"greater_than",...k(t),value:e,inclusive:!0})}function pl(e){return Rt(0,e)}function fl(e){return Dt(0,e)}function ml(e){return Be(0,e)}function hl(e){return Me(0,e)}function $r(e,t){return new am({check:"multiple_of",...k(t),value:e})}function br(e,t){return new um({check:"max_size",...k(t),maximum:e})}function At(e,t){return new lm({check:"min_size",...k(t),minimum:e})}function Xr(e,t){return new dm({check:"size_equals",...k(t),size:e})}function Yr(e,t){return new pm({check:"max_length",...k(t),maximum:e})}function rr(e,t){return new fm({check:"min_length",...k(t),minimum:e})}function Qr(e,t){return new mm({check:"length_equals",...k(t),length:e})}function so(e,t){return new hm({check:"string_format",format:"regex",...k(t),pattern:e})}function co(e){return new gm({check:"string_format",format:"lowercase",...k(e)})}function uo(e){return new vm({check:"string_format",format:"uppercase",...k(e)})}function lo(e,t){return new _m({check:"string_format",format:"includes",...k(t),includes:e})}function po(e,t){return new ym({check:"string_format",format:"starts_with",...k(t),prefix:e})}function fo(e,t){return new $m({check:"string_format",format:"ends_with",...k(t),suffix:e})}function gl(e,t,r){return new bm({check:"property",property:e,schema:t,...k(r)})}function mo(e,t){return new xm({check:"mime_type",mime:e,...k(t)})}function yt(e){return new km({check:"overwrite",tx:e})}function ho(e){return yt(t=>t.normalize(e))}function go(){return yt(e=>e.trim())}function vo(){return yt(e=>e.toLowerCase())}function _o(){return yt(e=>e.toUpperCase())}function na(){return yt(e=>Ks(e))}function Fm(e,t,r){return new e({type:"array",element:t,...k(r)})}function vl(e,t){return new e({type:"file",...k(t)})}function _l(e,t,r){let n=k(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function yl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...k(r)})}function $l(e){let t=Yb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Gr(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Gr(o))}},e(r.value,r)));return t}function Yb(e,t){let r=new se({check:"custom",...k(t)});return r._zod.check=e,r}function bl(e){let t=new se({check:"describe"});return t._zod.onattach=[r=>{let n=Ae.get(r)??{};Ae.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function xl(e){let t=new se({check:"meta"});return t._zod.onattach=[r=>{let n=Ae.get(r)??{};Ae.add(r,{...n,...e})}],t._zod.check=()=>{},t}function kl(e,t){let r=k(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),a=new Set(o),s=e.Codec??oo,c=e.Boolean??ro,u=e.String??yr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),m=new s({type:"pipe",in:l,out:d,transform:((p,g)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((p,g)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return m}function en(e,t,r,n={}){let o=k(n),i={...k(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}function oa(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ae,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function pe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let m=a.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),pe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Ce(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function ia(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,m=e.external.uri??(g=>g);if(d)return{ref:m(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${m("__shared")}#/${s}/${p}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let E=f.compile();return(I,A)=>E(p,I,A)},i,a=_r,s=!ki.jitless,u=s&&Bs.value,l=t.catchall,d;e._zod.parse=(p,f)=>{d??(d=n.value);let g=p.value;return a(g)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(t.shape)),p=i(p,f),l?Hm([],g,p,f,d,e):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});function Am(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!rr(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>qe(a,n,$e())))}),t)}var ao=m("$ZodUnion",(e,t)=>{Z.init(e,t),q(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),q(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),q(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),q(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Vn(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Am(c,o,e,i)):Am(s,o,e,i)}});function Cm(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>qe(a,n,$e())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var hu=m("$ZodXor",(e,t)=>{ao.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>Cm(c,o,e,i)):Cm(s,o,e,i)}}),gu=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ao.init(e,t);let r=e._zod.parse;q(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Gr(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!_r(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),vu=m("$ZodIntersection",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Mm(r,c,u)):Mm(r,i,a)}});function jc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(tr(e)&&tr(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=jc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;ns.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),rr(e))return e;let a=jc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Ui=m("$ZodTuple",(e,t)=>{Z.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>ji(p,n,u))):ji(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let p=t.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(f=>ji(f,n,u))):ji(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function ji(e,t,r){e.issues.length&&t.issues.push(...Be(r,e.issues)),t.value[r]=e.value}var _u=m("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!tr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Be(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Be(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Pi.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>qe(d,n,$e())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Be(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Be(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),yu=m("$ZodMap",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{Um(l,d,r,a,o,e,n)})):Um(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function Um(e,t,r,n,o,i,a){e.issues.length&&(Jn.has(typeof n)?r.issues.push(...Be(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>qe(s,a,$e()))})),t.issues.length&&(Jn.has(typeof n)?r.issues.push(...Be(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>qe(s,a,$e()))})),r.value.set(e.value,t.value)}var $u=m("$ZodSet",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>Zm(c,r))):Zm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Zm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var bu=m("$ZodEnum",(e,t)=>{Z.init(e,t);let r=Fn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Jn.has(typeof o)).map(o=>typeof o=="string"?rt(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),xu=m("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?rt(n):n?rt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),ku=m("$ZodFile",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),Su=m("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new yt;return r.value=o,r}});function Lm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Zi=m("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),q(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Vn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Lm(i,r.value)):Lm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),wu=m("$ZodExactOptional",(e,t)=>{Zi.init(e,t),q(e._zod,"values",()=>t.innerType._zod.values),q(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),zu=m("$ZodNullable",(e,t)=>{Z.init(e,t),q(e._zod,"optin",()=>t.innerType._zod.optin),q(e._zod,"optout",()=>t.innerType._zod.optout),q(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Vn(r.source)}|null)$`):void 0}),q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Iu=m("$ZodDefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>qm(i,t)):qm(o,t)}});function qm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Eu=m("$ZodPrefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Tu=m("$ZodNonOptional",(e,t)=>{Z.init(e,t),q(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Fm(i,e)):Fm(o,e)}});function Fm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Pu=m("$ZodSuccess",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),Ou=m("$ZodCatch",(e,t)=>{Z.init(e,t),q(e._zod,"optin",()=>t.innerType._zod.optin),q(e._zod,"optout",()=>t.innerType._zod.optout),q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>qe(a,n,$e()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>qe(i,n,$e()))},input:r.value}),r.issues=[]),r)}}),ju=m("$ZodNaN",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Nu=m("$ZodPipe",(e,t)=>{Z.init(e,t),q(e._zod,"values",()=>t.in._zod.values),q(e._zod,"optin",()=>t.in._zod.optin),q(e._zod,"optout",()=>t.out._zod.optout),q(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ni(a,t.in,n)):Ni(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Ni(i,t.out,n)):Ni(o,t.out,n)}});function Ni(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var so=m("$ZodCodec",(e,t)=>{Z.init(e,t),q(e._zod,"values",()=>t.in._zod.values),q(e._zod,"optin",()=>t.in._zod.optin),q(e._zod,"optout",()=>t.out._zod.optout),q(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Di(a,t,n)):Di(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Di(a,t,n)):Di(i,t,n)}}});function Di(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Ri(e,i,t.out,r)):Ri(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Ri(e,i,t.in,r)):Ri(e,o,t.in,r)}}function Ri(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Du=m("$ZodReadonly",(e,t)=>{Z.init(e,t),q(e._zod,"propValues",()=>t.innerType._zod.propValues),q(e._zod,"values",()=>t.innerType._zod.values),q(e._zod,"optin",()=>t.innerType?._zod?.optin),q(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Vm):Vm(o)}});function Vm(e){return e.value=Object.freeze(e.value),e}var Ru=m("$ZodTemplateLiteral",(e,t)=>{Z.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Ys.has(typeof n))r.push(rt(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Au=m("$ZodFunction",(e,t)=>(Z.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?Bn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Bn(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await Yn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Yn(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Ui({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Cu=m("$ZodPromise",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),Mu=m("$ZodLazy",(e,t)=>{Z.init(e,t),q(e._zod,"innerType",()=>t.getter()),q(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),q(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),q(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),q(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Uu=m("$ZodCustom",(e,t)=>{se.init(e,t),Z.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Jm(i,r,n,e));Jm(o,r,n,e)}});function Jm(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Br(o))}}var Qb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=M(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${R(o.values[0])}`:`Invalid option: expected one of ${D(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${D(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Zu(){return{localeError:Qb()}}var Xm;var qu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Fu(){return new qu}(Xm=globalThis).__zod_globalRegistry??(Xm.__zod_globalRegistry=Fu());var Ae=globalThis.__zod_globalRegistry;function Vu(e,t){return new e({type:"string",...k(t)})}function Li(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...k(t)})}function co(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...k(t)})}function qi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...k(t)})}function Fi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(t)})}function Vi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(t)})}function Ji(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(t)})}function uo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...k(t)})}function Wi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...k(t)})}function Ki(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(t)})}function Hi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...k(t)})}function Gi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(t)})}function Bi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...k(t)})}function Xi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...k(t)})}function Yi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(t)})}function Qi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(t)})}function ea(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(t)})}function Ju(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...k(t)})}function ta(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(t)})}function ra(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(t)})}function na(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...k(t)})}function oa(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...k(t)})}function ia(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...k(t)})}function aa(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...k(t)})}function Wu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(t)})}function Ku(e,t){return new e({type:"string",format:"date",check:"string_format",...k(t)})}function Hu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...k(t)})}function Gu(e,t){return new e({type:"string",format:"duration",check:"string_format",...k(t)})}function Bu(e,t){return new e({type:"number",checks:[],...k(t)})}function Xu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...k(t)})}function Yu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...k(t)})}function Qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...k(t)})}function el(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...k(t)})}function tl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...k(t)})}function rl(e,t){return new e({type:"boolean",...k(t)})}function nl(e,t){return new e({type:"bigint",...k(t)})}function ol(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...k(t)})}function il(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...k(t)})}function al(e,t){return new e({type:"symbol",...k(t)})}function sl(e,t){return new e({type:"undefined",...k(t)})}function cl(e,t){return new e({type:"null",...k(t)})}function ul(e){return new e({type:"any"})}function ll(e){return new e({type:"unknown"})}function dl(e,t){return new e({type:"never",...k(t)})}function pl(e,t){return new e({type:"void",...k(t)})}function fl(e,t){return new e({type:"date",...k(t)})}function ml(e,t){return new e({type:"nan",...k(t)})}function Rt(e,t){return new Pc({check:"less_than",...k(t),value:e,inclusive:!1})}function Xe(e,t){return new Pc({check:"less_than",...k(t),value:e,inclusive:!0})}function At(e,t){return new Oc({check:"greater_than",...k(t),value:e,inclusive:!1})}function Ce(e,t){return new Oc({check:"greater_than",...k(t),value:e,inclusive:!0})}function hl(e){return At(0,e)}function gl(e){return Rt(0,e)}function vl(e){return Xe(0,e)}function _l(e){return Ce(0,e)}function br(e,t){return new hm({check:"multiple_of",...k(t),value:e})}function xr(e,t){return new _m({check:"max_size",...k(t),maximum:e})}function Ct(e,t){return new ym({check:"min_size",...k(t),minimum:e})}function Yr(e,t){return new $m({check:"size_equals",...k(t),size:e})}function Qr(e,t){return new bm({check:"max_length",...k(t),maximum:e})}function nr(e,t){return new xm({check:"min_length",...k(t),minimum:e})}function en(e,t){return new km({check:"length_equals",...k(t),length:e})}function lo(e,t){return new Sm({check:"string_format",format:"regex",...k(t),pattern:e})}function po(e){return new wm({check:"string_format",format:"lowercase",...k(e)})}function fo(e){return new zm({check:"string_format",format:"uppercase",...k(e)})}function mo(e,t){return new Im({check:"string_format",format:"includes",...k(t),includes:e})}function ho(e,t){return new Em({check:"string_format",format:"starts_with",...k(t),prefix:e})}function go(e,t){return new Tm({check:"string_format",format:"ends_with",...k(t),suffix:e})}function yl(e,t,r){return new Pm({check:"property",property:e,schema:t,...k(r)})}function vo(e,t){return new Om({check:"mime_type",mime:e,...k(t)})}function $t(e){return new jm({check:"overwrite",tx:e})}function _o(e){return $t(t=>t.normalize(e))}function yo(){return $t(e=>e.trim())}function $o(){return $t(e=>e.toLowerCase())}function bo(){return $t(e=>e.toUpperCase())}function sa(){return $t(e=>Gs(e))}function Ym(e,t,r){return new e({type:"array",element:t,...k(r)})}function $l(e,t){return new e({type:"file",...k(t)})}function bl(e,t,r){let n=k(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function xl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...k(r)})}function kl(e){let t=nx(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Br(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Br(o))}},e(r.value,r)));return t}function nx(e,t){let r=new se({check:"custom",...k(t)});return r._zod.check=e,r}function Sl(e){let t=new se({check:"describe"});return t._zod.onattach=[r=>{let n=Ae.get(r)??{};Ae.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function wl(e){let t=new se({check:"meta"});return t._zod.onattach=[r=>{let n=Ae.get(r)??{};Ae.add(r,{...n,...e})}],t._zod.check=()=>{},t}function zl(e,t){let r=k(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(n),a=new Set(o),s=e.Codec??so,c=e.Boolean??io,u=e.String??$r,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,g)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:p,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function tn(e,t,r,n={}){let o=k(n),i={...k(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}function ca(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ae,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let p=a.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Me(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function ua(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,p=e.external.uri??(g=>g);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/
-Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function aa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let m=e.seen.get(l),p=m.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(p.$ref)for(let h in c)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(c[h])===JSON.stringify(m.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let p in c)p==="$ref"||p==="allOf"||p in m.def&&JSON.stringify(c[p])===JSON.stringify(m.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:yo(t,"input",e.processors),output:yo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ce(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ce(n.element,r);if(n.type==="set")return Ce(n.valueType,r);if(n.type==="lazy")return Ce(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ce(n.innerType,r);if(n.type==="intersection")return Ce(n.left,r)||Ce(n.right,r);if(n.type==="record"||n.type==="map")return Ce(n.keyType,r)||Ce(n.valueType,r);if(n.type==="pipe")return Ce(n.in,r)||Ce(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ce(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ce(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ce(o,r))return!0;return!!(n.rest&&Ce(n.rest,r))}return!1}var Vm=(e,t={})=>r=>{let n=oa({...r,processors:t});return pe(e,n),ia(n,e),aa(n,e)},yo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=oa({...o??{},target:i,io:t,processors:r});return pe(e,a),ia(a,e),aa(a,e)};var Qb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Jm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=Qb[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Wm=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Km=(e,t,r,n)=>{r.type="boolean"},Hm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Gm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Bm=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Xm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Ym=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Qm=(e,t,r,n)=>{r.not={}},eh=(e,t,r,n)=>{},th=(e,t,r,n)=>{},rh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},nh=(e,t,r,n)=>{let o=e._zod.def,i=Zn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},oh=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},ih=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},ah=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},sh=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},ch=(e,t,r,n)=>{r.type="boolean"},uh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},lh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},dh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},ph=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},fh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},mh=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=pe(i.element,t,{...n,path:[...n.path,"items"]})},hh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=pe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=pe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Sl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>pe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},gh=(e,t,r,n)=>{let o=e._zod.def,i=pe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=pe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},vh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,p)=>pe(m,t,{...n,path:[...n.path,a,p]})),u=i.rest?pe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},_h=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=pe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=pe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=pe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},yh=(e,t,r,n)=>{let o=e._zod.def,i=pe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},$h=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},bh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},xh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},kh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Sh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;pe(i,t,n);let a=t.seen.get(e);a.ref=i},wh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},zh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},wl=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ih=(e,t,r,n)=>{let o=e._zod.innerType;pe(o,t,n);let i=t.seen.get(e);i.ref=o};function tn(e){return!!e._zod}function nr(e,t){return tn(e)?Br(e,t):e.safeParse(t)}function sa(e){if(!e)return;let t;if(tn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Oh(e){if(tn(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var $o={};wn($o,{ZodAny:()=>Gh,ZodArray:()=>Qh,ZodBase64:()=>Gl,ZodBase64URL:()=>Bl,ZodBigInt:()=>ga,ZodBigIntFormat:()=>Ql,ZodBoolean:()=>ha,ZodCIDRv4:()=>Kl,ZodCIDRv6:()=>Hl,ZodCUID:()=>Zl,ZodCUID2:()=>Ll,ZodCatch:()=>yg,ZodCodec:()=>ad,ZodCustom:()=>ba,ZodCustomStringFormat:()=>xo,ZodDate:()=>td,ZodDefault:()=>fg,ZodDiscriminatedUnion:()=>tg,ZodE164:()=>Xl,ZodEmail:()=>Ml,ZodEmoji:()=>Cl,ZodEnum:()=>bo,ZodExactOptional:()=>lg,ZodFile:()=>cg,ZodFunction:()=>Eg,ZodGUID:()=>ua,ZodIPv4:()=>Jl,ZodIPv6:()=>Wl,ZodIntersection:()=>rg,ZodJWT:()=>Yl,ZodKSUID:()=>Vl,ZodLazy:()=>wg,ZodLiteral:()=>sg,ZodMAC:()=>Jh,ZodMap:()=>ig,ZodNaN:()=>bg,ZodNanoID:()=>Ul,ZodNever:()=>Xh,ZodNonOptional:()=>od,ZodNull:()=>Hh,ZodNullable:()=>pg,ZodNumber:()=>ma,ZodNumberFormat:()=>rn,ZodObject:()=>va,ZodOptional:()=>nd,ZodPipe:()=>id,ZodPrefault:()=>hg,ZodPromise:()=>Ig,ZodReadonly:()=>xg,ZodRecord:()=>$a,ZodSet:()=>ag,ZodString:()=>pa,ZodStringFormat:()=>ce,ZodSuccess:()=>_g,ZodSymbol:()=>Wh,ZodTemplateLiteral:()=>Sg,ZodTransform:()=>ug,ZodTuple:()=>ng,ZodType:()=>q,ZodULID:()=>ql,ZodURL:()=>fa,ZodUUID:()=>Mt,ZodUndefined:()=>Kh,ZodUnion:()=>_a,ZodUnknown:()=>Bh,ZodVoid:()=>Yh,ZodXID:()=>Fl,ZodXor:()=>eg,_ZodString:()=>Al,_default:()=>mg,_function:()=>vk,any:()=>Qx,array:()=>G,base64:()=>Ax,base64url:()=>Mx,bigint:()=>Hx,boolean:()=>ye,catch:()=>$g,check:()=>_k,cidrv4:()=>Dx,cidrv6:()=>Rx,codec:()=>mk,cuid:()=>zx,cuid2:()=>Ix,custom:()=>sd,date:()=>tk,describe:()=>yk,discriminatedUnion:()=>ya,e164:()=>Cx,email:()=>gx,emoji:()=>Sx,enum:()=>Pe,exactOptional:()=>dg,file:()=>lk,float32:()=>Vx,float64:()=>Jx,function:()=>vk,guid:()=>vx,hash:()=>Fx,hex:()=>qx,hostname:()=>Lx,httpUrl:()=>kx,instanceof:()=>bk,int:()=>Rl,int32:()=>Wx,int64:()=>Gx,intersection:()=>So,ipv4:()=>Ox,ipv6:()=>Nx,json:()=>kk,jwt:()=>Ux,keyof:()=>rk,ksuid:()=>Px,lazy:()=>zg,literal:()=>P,looseObject:()=>Te,looseRecord:()=>ak,mac:()=>jx,map:()=>sk,meta:()=>$k,nan:()=>fk,nanoid:()=>wx,nativeEnum:()=>uk,never:()=>ed,nonoptional:()=>vg,null:()=>ko,nullable:()=>la,nullish:()=>dk,number:()=>ne,object:()=>z,optional:()=>me,partialRecord:()=>ik,pipe:()=>da,prefault:()=>gg,preprocess:()=>xa,promise:()=>gk,readonly:()=>kg,record:()=>fe,refine:()=>Tg,set:()=>ck,strictObject:()=>nk,string:()=>v,stringFormat:()=>Zx,stringbool:()=>xk,success:()=>pk,superRefine:()=>Pg,symbol:()=>Xx,templateLiteral:()=>hk,transform:()=>rd,tuple:()=>og,uint32:()=>Kx,uint64:()=>Bx,ulid:()=>Ex,undefined:()=>Yx,union:()=>ie,unknown:()=>ue,url:()=>xx,uuid:()=>_x,uuidv4:()=>yx,uuidv6:()=>$x,uuidv7:()=>bx,void:()=>ek,xid:()=>Tx,xor:()=>ok});var ca={};wn(ca,{endsWith:()=>fo,gt:()=>Rt,gte:()=>Me,includes:()=>lo,length:()=>Qr,lowercase:()=>co,lt:()=>Dt,lte:()=>Be,maxLength:()=>Yr,maxSize:()=>br,mime:()=>mo,minLength:()=>rr,minSize:()=>At,multipleOf:()=>$r,negative:()=>fl,nonnegative:()=>hl,nonpositive:()=>ml,normalize:()=>ho,overwrite:()=>yt,positive:()=>pl,property:()=>gl,regex:()=>so,size:()=>Xr,slugify:()=>na,startsWith:()=>po,toLowerCase:()=>vo,toUpperCase:()=>_o,trim:()=>go,uppercase:()=>uo});var xr={};wn(xr,{ZodISODate:()=>Tl,ZodISODateTime:()=>Il,ZodISODuration:()=>Nl,ZodISOTime:()=>Ol,date:()=>Pl,datetime:()=>El,duration:()=>Dl,time:()=>jl});var Il=f("ZodISODateTime",(e,t)=>{Lc.init(e,t),ce.init(e,t)});function El(e){return Fu(Il,e)}var Tl=f("ZodISODate",(e,t)=>{qc.init(e,t),ce.init(e,t)});function Pl(e){return Vu(Tl,e)}var Ol=f("ZodISOTime",(e,t)=>{Fc.init(e,t),ce.init(e,t)});function jl(e){return Ju(Ol,e)}var Nl=f("ZodISODuration",(e,t)=>{Vc.init(e,t),ce.init(e,t)});function Dl(e){return Wu(Nl,e)}var jh=(e,t)=>{xi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Si(e,r)},flatten:{value:r=>ki(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Kr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Kr,2)}},isEmpty:{get(){return e.issues.length===0}}})},DR=f("ZodError",jh),Xe=f("ZodError",jh,{Parent:Error});var Nh=Wn(Xe),Dh=Hn(Xe),Rh=Bn(Xe),Ah=Xn(Xe),Mh=Kf(Xe),Ch=Hf(Xe),Uh=Gf(Xe),Zh=Bf(Xe),Lh=Xf(Xe),qh=Yf(Xe),Fh=Qf(Xe),Vh=em(Xe);var q=f("ZodType",(e,t)=>(Z.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:yo(e,"input"),output:yo(e,"output")}}),e.toJSONSchema=Vm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone($.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Re(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Nh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Rh(e,r,n),e.parseAsync=async(r,n)=>Dh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ah(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Mh(e,r,n),e.decode=(r,n)=>Ch(e,r,n),e.encodeAsync=async(r,n)=>Uh(e,r,n),e.decodeAsync=async(r,n)=>Zh(e,r,n),e.safeEncode=(r,n)=>Lh(e,r,n),e.safeDecode=(r,n)=>qh(e,r,n),e.safeEncodeAsync=async(r,n)=>Fh(e,r,n),e.safeDecodeAsync=async(r,n)=>Vh(e,r,n),e.refine=(r,n)=>e.check(Tg(r,n)),e.superRefine=r=>e.check(Pg(r)),e.overwrite=r=>e.check(yt(r)),e.optional=()=>me(e),e.exactOptional=()=>dg(e),e.nullable=()=>la(e),e.nullish=()=>me(la(e)),e.nonoptional=r=>vg(e,r),e.array=()=>G(e),e.or=r=>ie([e,r]),e.and=r=>So(e,r),e.transform=r=>da(e,rd(r)),e.default=r=>mg(e,r),e.prefault=r=>gg(e,r),e.catch=r=>$g(e,r),e.pipe=r=>da(e,r),e.readonly=()=>kg(e),e.describe=r=>{let n=e.clone();return Ae.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ae.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ae.get(e);let n=e.clone();return Ae.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Al=f("_ZodString",(e,t)=>{yr.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Jm(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(so(...n)),e.includes=(...n)=>e.check(lo(...n)),e.startsWith=(...n)=>e.check(po(...n)),e.endsWith=(...n)=>e.check(fo(...n)),e.min=(...n)=>e.check(rr(...n)),e.max=(...n)=>e.check(Yr(...n)),e.length=(...n)=>e.check(Qr(...n)),e.nonempty=(...n)=>e.check(rr(1,...n)),e.lowercase=n=>e.check(co(n)),e.uppercase=n=>e.check(uo(n)),e.trim=()=>e.check(go()),e.normalize=(...n)=>e.check(ho(...n)),e.toLowerCase=()=>e.check(vo()),e.toUpperCase=()=>e.check(_o()),e.slugify=()=>e.check(na())}),pa=f("ZodString",(e,t)=>{yr.init(e,t),Al.init(e,t),e.email=r=>e.check(Mi(Ml,r)),e.url=r=>e.check(ao(fa,r)),e.jwt=r=>e.check(ra(Yl,r)),e.emoji=r=>e.check(qi(Cl,r)),e.guid=r=>e.check(io(ua,r)),e.uuid=r=>e.check(Ci(Mt,r)),e.uuidv4=r=>e.check(Ui(Mt,r)),e.uuidv6=r=>e.check(Zi(Mt,r)),e.uuidv7=r=>e.check(Li(Mt,r)),e.nanoid=r=>e.check(Fi(Ul,r)),e.guid=r=>e.check(io(ua,r)),e.cuid=r=>e.check(Vi(Zl,r)),e.cuid2=r=>e.check(Ji(Ll,r)),e.ulid=r=>e.check(Wi(ql,r)),e.base64=r=>e.check(Qi(Gl,r)),e.base64url=r=>e.check(ea(Bl,r)),e.xid=r=>e.check(Ki(Fl,r)),e.ksuid=r=>e.check(Hi(Vl,r)),e.ipv4=r=>e.check(Gi(Jl,r)),e.ipv6=r=>e.check(Bi(Wl,r)),e.cidrv4=r=>e.check(Xi(Kl,r)),e.cidrv6=r=>e.check(Yi(Hl,r)),e.e164=r=>e.check(ta(Xl,r)),e.datetime=r=>e.check(El(r)),e.date=r=>e.check(Pl(r)),e.time=r=>e.check(jl(r)),e.duration=r=>e.check(Dl(r))});function v(e){return Lu(pa,e)}var ce=f("ZodStringFormat",(e,t)=>{oe.init(e,t),Al.init(e,t)}),Ml=f("ZodEmail",(e,t)=>{jc.init(e,t),ce.init(e,t)});function gx(e){return Mi(Ml,e)}var ua=f("ZodGUID",(e,t)=>{Pc.init(e,t),ce.init(e,t)});function vx(e){return io(ua,e)}var Mt=f("ZodUUID",(e,t)=>{Oc.init(e,t),ce.init(e,t)});function _x(e){return Ci(Mt,e)}function yx(e){return Ui(Mt,e)}function $x(e){return Zi(Mt,e)}function bx(e){return Li(Mt,e)}var fa=f("ZodURL",(e,t)=>{Nc.init(e,t),ce.init(e,t)});function xx(e){return ao(fa,e)}function kx(e){return ao(fa,{protocol:/^https?$/,hostname:rt.domain,...$.normalizeParams(e)})}var Cl=f("ZodEmoji",(e,t)=>{Dc.init(e,t),ce.init(e,t)});function Sx(e){return qi(Cl,e)}var Ul=f("ZodNanoID",(e,t)=>{Rc.init(e,t),ce.init(e,t)});function wx(e){return Fi(Ul,e)}var Zl=f("ZodCUID",(e,t)=>{Ac.init(e,t),ce.init(e,t)});function zx(e){return Vi(Zl,e)}var Ll=f("ZodCUID2",(e,t)=>{Mc.init(e,t),ce.init(e,t)});function Ix(e){return Ji(Ll,e)}var ql=f("ZodULID",(e,t)=>{Cc.init(e,t),ce.init(e,t)});function Ex(e){return Wi(ql,e)}var Fl=f("ZodXID",(e,t)=>{Uc.init(e,t),ce.init(e,t)});function Tx(e){return Ki(Fl,e)}var Vl=f("ZodKSUID",(e,t)=>{Zc.init(e,t),ce.init(e,t)});function Px(e){return Hi(Vl,e)}var Jl=f("ZodIPv4",(e,t)=>{Jc.init(e,t),ce.init(e,t)});function Ox(e){return Gi(Jl,e)}var Jh=f("ZodMAC",(e,t)=>{Kc.init(e,t),ce.init(e,t)});function jx(e){return qu(Jh,e)}var Wl=f("ZodIPv6",(e,t)=>{Wc.init(e,t),ce.init(e,t)});function Nx(e){return Bi(Wl,e)}var Kl=f("ZodCIDRv4",(e,t)=>{Hc.init(e,t),ce.init(e,t)});function Dx(e){return Xi(Kl,e)}var Hl=f("ZodCIDRv6",(e,t)=>{Gc.init(e,t),ce.init(e,t)});function Rx(e){return Yi(Hl,e)}var Gl=f("ZodBase64",(e,t)=>{Bc.init(e,t),ce.init(e,t)});function Ax(e){return Qi(Gl,e)}var Bl=f("ZodBase64URL",(e,t)=>{Xc.init(e,t),ce.init(e,t)});function Mx(e){return ea(Bl,e)}var Xl=f("ZodE164",(e,t)=>{Yc.init(e,t),ce.init(e,t)});function Cx(e){return ta(Xl,e)}var Yl=f("ZodJWT",(e,t)=>{Qc.init(e,t),ce.init(e,t)});function Ux(e){return ra(Yl,e)}var xo=f("ZodCustomStringFormat",(e,t)=>{eu.init(e,t),ce.init(e,t)});function Zx(e,t,r={}){return en(xo,e,t,r)}function Lx(e){return en(xo,"hostname",rt.hostname,e)}function qx(e){return en(xo,"hex",rt.hex,e)}function Fx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=rt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return en(xo,n,o,t)}var ma=f("ZodNumber",(e,t)=>{Ni.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Wm(e,n,o,i),e.gt=(n,o)=>e.check(Rt(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Dt(n,o)),e.lte=(n,o)=>e.check(Be(n,o)),e.max=(n,o)=>e.check(Be(n,o)),e.int=n=>e.check(Rl(n)),e.safe=n=>e.check(Rl(n)),e.positive=n=>e.check(Rt(0,n)),e.nonnegative=n=>e.check(Me(0,n)),e.negative=n=>e.check(Dt(0,n)),e.nonpositive=n=>e.check(Be(0,n)),e.multipleOf=(n,o)=>e.check($r(n,o)),e.step=(n,o)=>e.check($r(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ne(e){return Ku(ma,e)}var rn=f("ZodNumberFormat",(e,t)=>{tu.init(e,t),ma.init(e,t)});function Rl(e){return Hu(rn,e)}function Vx(e){return Gu(rn,e)}function Jx(e){return Bu(rn,e)}function Wx(e){return Xu(rn,e)}function Kx(e){return Yu(rn,e)}var ha=f("ZodBoolean",(e,t)=>{ro.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Km(e,r,n,o)});function ye(e){return Qu(ha,e)}var ga=f("ZodBigInt",(e,t)=>{Di.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Hm(e,n,o,i),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.gt=(n,o)=>e.check(Rt(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Dt(n,o)),e.lte=(n,o)=>e.check(Be(n,o)),e.max=(n,o)=>e.check(Be(n,o)),e.positive=n=>e.check(Rt(BigInt(0),n)),e.negative=n=>e.check(Dt(BigInt(0),n)),e.nonpositive=n=>e.check(Be(BigInt(0),n)),e.nonnegative=n=>e.check(Me(BigInt(0),n)),e.multipleOf=(n,o)=>e.check($r(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Hx(e){return el(ga,e)}var Ql=f("ZodBigIntFormat",(e,t)=>{ru.init(e,t),ga.init(e,t)});function Gx(e){return tl(Ql,e)}function Bx(e){return rl(Ql,e)}var Wh=f("ZodSymbol",(e,t)=>{nu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o)});function Xx(e){return nl(Wh,e)}var Kh=f("ZodUndefined",(e,t)=>{ou.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o)});function Yx(e){return ol(Kh,e)}var Hh=f("ZodNull",(e,t)=>{iu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bm(e,r,n,o)});function ko(e){return il(Hh,e)}var Gh=f("ZodAny",(e,t)=>{au.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o)});function Qx(){return al(Gh)}var Bh=f("ZodUnknown",(e,t)=>{su.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o)});function ue(){return sl(Bh)}var Xh=f("ZodNever",(e,t)=>{cu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o)});function ed(e){return cl(Xh,e)}var Yh=f("ZodVoid",(e,t)=>{uu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o)});function ek(e){return ul(Yh,e)}var td=f("ZodDate",(e,t)=>{lu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>rh(e,n,o,i),e.min=(n,o)=>e.check(Me(n,o)),e.max=(n,o)=>e.check(Be(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function tk(e){return ll(td,e)}var Qh=f("ZodArray",(e,t)=>{du.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(rr(r,n)),e.nonempty=r=>e.check(rr(1,r)),e.max=(r,n)=>e.check(Yr(r,n)),e.length=(r,n)=>e.check(Qr(r,n)),e.unwrap=()=>e.element});function G(e,t){return Fm(Qh,e,t)}function rk(e){let t=e._zod.def.shape;return Pe(Object.keys(t))}var va=f("ZodObject",(e,t)=>{Lm.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o),$.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ue()}),e.loose=()=>e.clone({...e._zod.def,catchall:ue()}),e.strict=()=>e.clone({...e._zod.def,catchall:ed()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>$.extend(e,r),e.safeExtend=r=>$.safeExtend(e,r),e.merge=r=>$.merge(e,r),e.pick=r=>$.pick(e,r),e.omit=r=>$.omit(e,r),e.partial=(...r)=>$.partial(nd,e,r[0]),e.required=(...r)=>$.required(od,e,r[0])});function z(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new va(r)}function nk(e,t){return new va({type:"object",shape:e,catchall:ed(),...$.normalizeParams(t)})}function Te(e,t){return new va({type:"object",shape:e,catchall:ue(),...$.normalizeParams(t)})}var _a=f("ZodUnion",(e,t)=>{no.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sl(e,r,n,o),e.options=t.options});function ie(e,t){return new _a({type:"union",options:e,...$.normalizeParams(t)})}var eg=f("ZodXor",(e,t)=>{_a.init(e,t),pu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sl(e,r,n,o),e.options=t.options});function ok(e,t){return new eg({type:"union",options:e,inclusive:!1,...$.normalizeParams(t)})}var tg=f("ZodDiscriminatedUnion",(e,t)=>{_a.init(e,t),fu.init(e,t)});function ya(e,t,r){return new tg({type:"union",options:t,discriminator:e,...$.normalizeParams(r)})}var rg=f("ZodIntersection",(e,t)=>{mu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o)});function So(e,t){return new rg({type:"intersection",left:e,right:t})}var ng=f("ZodTuple",(e,t)=>{Ri.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function og(e,t,r){let n=t instanceof Z,o=n?r:t,i=n?t:null;return new ng({type:"tuple",items:e,rest:i,...$.normalizeParams(o)})}var $a=f("ZodRecord",(e,t)=>{hu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function fe(e,t,r){return new $a({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}function ik(e,t,r){let n=Re(e);return n._zod.values=void 0,new $a({type:"record",keyType:n,valueType:t,...$.normalizeParams(r)})}function ak(e,t,r){return new $a({type:"record",keyType:e,valueType:t,mode:"loose",...$.normalizeParams(r)})}var ig=f("ZodMap",(e,t)=>{gu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(br(...r)),e.size=(...r)=>e.check(Xr(...r))});function sk(e,t,r){return new ig({type:"map",keyType:e,valueType:t,...$.normalizeParams(r)})}var ag=f("ZodSet",(e,t)=>{vu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fh(e,r,n,o),e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(br(...r)),e.size=(...r)=>e.check(Xr(...r))});function ck(e,t){return new ag({type:"set",valueType:e,...$.normalizeParams(t)})}var bo=f("ZodEnum",(e,t)=>{_u.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>nh(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new bo({...t,checks:[],...$.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new bo({...t,checks:[],...$.normalizeParams(o),entries:i})}});function Pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bo({type:"enum",entries:r,...$.normalizeParams(t)})}function uk(e,t){return new bo({type:"enum",entries:e,...$.normalizeParams(t)})}var sg=f("ZodLiteral",(e,t)=>{yu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function P(e,t){return new sg({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(t)})}var cg=f("ZodFile",(e,t)=>{$u.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o),e.min=(r,n)=>e.check(At(r,n)),e.max=(r,n)=>e.check(br(r,n)),e.mime=(r,n)=>e.check(mo(Array.isArray(r)?r:[r],n))});function lk(e){return vl(cg,e)}var ug=f("ZodTransform",(e,t)=>{bu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push($.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function rd(e){return new ug({type:"transform",transform:e})}var nd=f("ZodOptional",(e,t)=>{Ai.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function me(e){return new nd({type:"optional",innerType:e})}var lg=f("ZodExactOptional",(e,t)=>{xu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dg(e){return new lg({type:"optional",innerType:e})}var pg=f("ZodNullable",(e,t)=>{ku.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function la(e){return new pg({type:"nullable",innerType:e})}function dk(e){return me(la(e))}var fg=f("ZodDefault",(e,t)=>{Su.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mg(e,t){return new fg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var hg=f("ZodPrefault",(e,t)=>{wu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gg(e,t){return new hg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var od=f("ZodNonOptional",(e,t)=>{zu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vg(e,t){return new od({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var _g=f("ZodSuccess",(e,t)=>{Iu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function pk(e){return new _g({type:"success",innerType:e})}var yg=f("ZodCatch",(e,t)=>{Eu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $g(e,t){return new yg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var bg=f("ZodNaN",(e,t)=>{Tu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o)});function fk(e){return dl(bg,e)}var id=f("ZodPipe",(e,t)=>{Pu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),e.in=t.in,e.out=t.out});function da(e,t){return new id({type:"pipe",in:e,out:t})}var ad=f("ZodCodec",(e,t)=>{id.init(e,t),oo.init(e,t)});function mk(e,t,r){return new ad({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var xg=f("ZodReadonly",(e,t)=>{Ou.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function kg(e){return new xg({type:"readonly",innerType:e})}var Sg=f("ZodTemplateLiteral",(e,t)=>{ju.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o)});function hk(e,t){return new Sg({type:"template_literal",parts:e,...$.normalizeParams(t)})}var wg=f("ZodLazy",(e,t)=>{Ru.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function zg(e){return new wg({type:"lazy",getter:e})}var Ig=f("ZodPromise",(e,t)=>{Du.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gk(e){return new Ig({type:"promise",innerType:e})}var Eg=f("ZodFunction",(e,t)=>{Nu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o)});function vk(e){return new Eg({type:"function",input:Array.isArray(e?.input)?og(e?.input):e?.input??G(ue()),output:e?.output??ue()})}var ba=f("ZodCustom",(e,t)=>{Au.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o)});function _k(e){let t=new se({check:"custom"});return t._zod.check=e,t}function sd(e,t){return _l(ba,e??(()=>!0),t)}function Tg(e,t={}){return yl(ba,e,t)}function Pg(e){return $l(e)}var yk=bl,$k=xl;function bk(e,t={}){let r=new ba({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...$.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var xk=(...e)=>kl({Codec:ad,Boolean:ha,String:pa},...e);function kk(e){let t=zg(()=>ie([v(e),ne(),ye(),ko(),G(t),fe(v(),t)]));return t}function xa(e,t){return da(rd(e),t)}var Og;Og||(Og={});var qR={...$o,...ca,iso:xr};$e(Mu());var ud="2025-11-25";var jg=[ud,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],or="io.modelcontextprotocol/related-task",Sa="2.0",xe=sd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Ng=ie([v(),ne().int()]),Dg=v(),s1=Te({ttl:ie([ne(),ko()]).optional(),pollInterval:ne().optional()}),Ik=z({ttl:ne().optional()}),Ek=z({taskId:v()}),ld=Te({progressToken:Ng.optional(),[or]:Ek.optional()}),Ye=z({_meta:ld.optional()}),wo=Ye.extend({task:Ik.optional()}),Rg=e=>wo.safeParse(e).success,ke=z({method:v(),params:Ye.loose().optional()}),nt=z({_meta:ld.optional()}),ot=z({method:v(),params:nt.loose().optional()}),Se=Te({_meta:ld.optional()}),wa=ie([v(),ne().int()]),Ag=z({jsonrpc:P(Sa),id:wa,...ke.shape}).strict(),dd=e=>Ag.safeParse(e).success,Mg=z({jsonrpc:P(Sa),...ot.shape}).strict(),Cg=e=>Mg.safeParse(e).success,pd=z({jsonrpc:P(Sa),id:wa,result:Se}).strict(),zo=e=>pd.safeParse(e).success;var Y;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Y||(Y={}));var fd=z({jsonrpc:P(Sa),id:wa.optional(),error:z({code:ne().int(),message:v(),data:ue().optional()})}).strict();var Ug=e=>fd.safeParse(e).success;var Zg=ie([Ag,Mg,pd,fd]),c1=ie([pd,fd]),za=Se.strict(),Tk=nt.extend({requestId:wa.optional(),reason:v().optional()}),Ia=ot.extend({method:P("notifications/cancelled"),params:Tk}),Pk=z({src:v(),mimeType:v().optional(),sizes:G(v()).optional(),theme:Pe(["light","dark"]).optional()}),Io=z({icons:G(Pk).optional()}),nn=z({name:v(),title:v().optional()}),Lg=nn.extend({...nn.shape,...Io.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Ok=So(z({applyDefaults:ye().optional()}),fe(v(),ue())),jk=xa(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,So(z({form:Ok.optional(),url:xe.optional()}),fe(v(),ue()).optional())),Nk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({sampling:Te({createMessage:xe.optional()}).optional(),elicitation:Te({create:xe.optional()}).optional()}).optional()}),Dk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({tools:Te({call:xe.optional()}).optional()}).optional()}),Rk=z({experimental:fe(v(),xe).optional(),sampling:z({context:xe.optional(),tools:xe.optional()}).optional(),elicitation:jk.optional(),roots:z({listChanged:ye().optional()}).optional(),tasks:Nk.optional()}),Ak=Ye.extend({protocolVersion:v(),capabilities:Rk,clientInfo:Lg}),md=ke.extend({method:P("initialize"),params:Ak});var Mk=z({experimental:fe(v(),xe).optional(),logging:xe.optional(),completions:xe.optional(),prompts:z({listChanged:ye().optional()}).optional(),resources:z({subscribe:ye().optional(),listChanged:ye().optional()}).optional(),tools:z({listChanged:ye().optional()}).optional(),tasks:Dk.optional()}),Ck=Se.extend({protocolVersion:v(),capabilities:Mk,serverInfo:Lg,instructions:v().optional()}),hd=ot.extend({method:P("notifications/initialized"),params:nt.optional()});var Ea=ke.extend({method:P("ping"),params:Ye.optional()}),Uk=z({progress:ne(),total:me(ne()),message:me(v())}),Zk=z({...nt.shape,...Uk.shape,progressToken:Ng}),Ta=ot.extend({method:P("notifications/progress"),params:Zk}),Lk=Ye.extend({cursor:Dg.optional()}),Eo=ke.extend({params:Lk.optional()}),To=Se.extend({nextCursor:Dg.optional()}),qk=Pe(["working","input_required","completed","failed","cancelled"]),Po=z({taskId:v(),status:qk,ttl:ie([ne(),ko()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:me(ne()),statusMessage:me(v())}),on=Se.extend({task:Po}),Fk=nt.merge(Po),Oo=ot.extend({method:P("notifications/tasks/status"),params:Fk}),Pa=ke.extend({method:P("tasks/get"),params:Ye.extend({taskId:v()})}),Oa=Se.merge(Po),ja=ke.extend({method:P("tasks/result"),params:Ye.extend({taskId:v()})}),u1=Se.loose(),Na=Eo.extend({method:P("tasks/list")}),Da=To.extend({tasks:G(Po)}),Ra=ke.extend({method:P("tasks/cancel"),params:Ye.extend({taskId:v()})}),qg=Se.merge(Po),Fg=z({uri:v(),mimeType:me(v()),_meta:fe(v(),ue()).optional()}),Vg=Fg.extend({text:v()}),gd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Jg=Fg.extend({blob:gd}),jo=Pe(["user","assistant"]),an=z({audience:G(jo).optional(),priority:ne().min(0).max(1).optional(),lastModified:xr.datetime({offset:!0}).optional()}),Wg=z({...nn.shape,...Io.shape,uri:v(),description:me(v()),mimeType:me(v()),annotations:an.optional(),_meta:me(Te({}))}),Vk=z({...nn.shape,...Io.shape,uriTemplate:v(),description:me(v()),mimeType:me(v()),annotations:an.optional(),_meta:me(Te({}))}),Jk=Eo.extend({method:P("resources/list")}),Wk=To.extend({resources:G(Wg)}),Kk=Eo.extend({method:P("resources/templates/list")}),Hk=To.extend({resourceTemplates:G(Vk)}),vd=Ye.extend({uri:v()}),Gk=vd,Bk=ke.extend({method:P("resources/read"),params:Gk}),Xk=Se.extend({contents:G(ie([Vg,Jg]))}),Yk=ot.extend({method:P("notifications/resources/list_changed"),params:nt.optional()}),Qk=vd,eS=ke.extend({method:P("resources/subscribe"),params:Qk}),tS=vd,rS=ke.extend({method:P("resources/unsubscribe"),params:tS}),nS=nt.extend({uri:v()}),oS=ot.extend({method:P("notifications/resources/updated"),params:nS}),iS=z({name:v(),description:me(v()),required:me(ye())}),aS=z({...nn.shape,...Io.shape,description:me(v()),arguments:me(G(iS)),_meta:me(Te({}))}),sS=Eo.extend({method:P("prompts/list")}),cS=To.extend({prompts:G(aS)}),uS=Ye.extend({name:v(),arguments:fe(v(),v()).optional()}),lS=ke.extend({method:P("prompts/get"),params:uS}),_d=z({type:P("text"),text:v(),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),yd=z({type:P("image"),data:gd,mimeType:v(),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),$d=z({type:P("audio"),data:gd,mimeType:v(),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),dS=z({type:P("tool_use"),name:v(),id:v(),input:fe(v(),ue()),_meta:fe(v(),ue()).optional()}),pS=z({type:P("resource"),resource:ie([Vg,Jg]),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),fS=Wg.extend({type:P("resource_link")}),bd=ie([_d,yd,$d,fS,pS]),mS=z({role:jo,content:bd}),hS=Se.extend({description:v().optional(),messages:G(mS)}),gS=ot.extend({method:P("notifications/prompts/list_changed"),params:nt.optional()}),vS=z({title:v().optional(),readOnlyHint:ye().optional(),destructiveHint:ye().optional(),idempotentHint:ye().optional(),openWorldHint:ye().optional()}),_S=z({taskSupport:Pe(["required","optional","forbidden"]).optional()}),Kg=z({...nn.shape,...Io.shape,description:v().optional(),inputSchema:z({type:P("object"),properties:fe(v(),xe).optional(),required:G(v()).optional()}).catchall(ue()),outputSchema:z({type:P("object"),properties:fe(v(),xe).optional(),required:G(v()).optional()}).catchall(ue()).optional(),annotations:vS.optional(),execution:_S.optional(),_meta:fe(v(),ue()).optional()}),xd=Eo.extend({method:P("tools/list")}),yS=To.extend({tools:G(Kg)}),Aa=Se.extend({content:G(bd).default([]),structuredContent:fe(v(),ue()).optional(),isError:ye().optional()}),l1=Aa.or(Se.extend({toolResult:ue()})),$S=wo.extend({name:v(),arguments:fe(v(),ue()).optional()}),No=ke.extend({method:P("tools/call"),params:$S}),bS=ot.extend({method:P("notifications/tools/list_changed"),params:nt.optional()}),d1=z({autoRefresh:ye().default(!0),debounceMs:ne().int().nonnegative().default(300)}),Do=Pe(["debug","info","notice","warning","error","critical","alert","emergency"]),xS=Ye.extend({level:Do}),kd=ke.extend({method:P("logging/setLevel"),params:xS}),kS=nt.extend({level:Do,logger:v().optional(),data:ue()}),SS=ot.extend({method:P("notifications/message"),params:kS}),wS=z({name:v().optional()}),zS=z({hints:G(wS).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),IS=z({mode:Pe(["auto","required","none"]).optional()}),ES=z({type:P("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:G(bd).default([]),structuredContent:z({}).loose().optional(),isError:ye().optional(),_meta:fe(v(),ue()).optional()}),TS=ya("type",[_d,yd,$d]),ka=ya("type",[_d,yd,$d,dS,ES]),PS=z({role:jo,content:ie([ka,G(ka)]),_meta:fe(v(),ue()).optional()}),OS=wo.extend({messages:G(PS),modelPreferences:zS.optional(),systemPrompt:v().optional(),includeContext:Pe(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:G(v()).optional(),metadata:xe.optional(),tools:G(Kg).optional(),toolChoice:IS.optional()}),jS=ke.extend({method:P("sampling/createMessage"),params:OS}),Sd=Se.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens"]).or(v())),role:jo,content:TS}),wd=Se.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:jo,content:ie([ka,G(ka)])}),NS=z({type:P("boolean"),title:v().optional(),description:v().optional(),default:ye().optional()}),DS=z({type:P("string"),title:v().optional(),description:v().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Pe(["email","uri","date","date-time"]).optional(),default:v().optional()}),RS=z({type:Pe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),AS=z({type:P("string"),title:v().optional(),description:v().optional(),enum:G(v()),default:v().optional()}),MS=z({type:P("string"),title:v().optional(),description:v().optional(),oneOf:G(z({const:v(),title:v()})),default:v().optional()}),CS=z({type:P("string"),title:v().optional(),description:v().optional(),enum:G(v()),enumNames:G(v()).optional(),default:v().optional()}),US=ie([AS,MS]),ZS=z({type:P("array"),title:v().optional(),description:v().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({type:P("string"),enum:G(v())}),default:G(v()).optional()}),LS=z({type:P("array"),title:v().optional(),description:v().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({anyOf:G(z({const:v(),title:v()}))}),default:G(v()).optional()}),qS=ie([ZS,LS]),FS=ie([CS,US,qS]),VS=ie([FS,NS,DS,RS]),JS=wo.extend({mode:P("form").optional(),message:v(),requestedSchema:z({type:P("object"),properties:fe(v(),VS),required:G(v()).optional()})}),WS=wo.extend({mode:P("url"),message:v(),elicitationId:v(),url:v().url()}),KS=ie([JS,WS]),HS=ke.extend({method:P("elicitation/create"),params:KS}),GS=nt.extend({elicitationId:v()}),BS=ot.extend({method:P("notifications/elicitation/complete"),params:GS}),Ma=Se.extend({action:Pe(["accept","decline","cancel"]),content:xa(e=>e===null?void 0:e,fe(v(),ie([v(),ne(),ye(),G(v())])).optional())}),XS=z({type:P("ref/resource"),uri:v()});var YS=z({type:P("ref/prompt"),name:v()}),QS=Ye.extend({ref:ie([YS,XS]),argument:z({name:v(),value:v()}),context:z({arguments:fe(v(),v()).optional()}).optional()}),ew=ke.extend({method:P("completion/complete"),params:QS});var tw=Se.extend({completion:Te({values:G(v()).max(100),total:me(ne().int()),hasMore:me(ye())})}),rw=z({uri:v().startsWith("file://"),name:v().optional(),_meta:fe(v(),ue()).optional()}),nw=ke.extend({method:P("roots/list"),params:Ye.optional()}),zd=Se.extend({roots:G(rw)}),ow=ot.extend({method:P("notifications/roots/list_changed"),params:nt.optional()}),p1=ie([Ea,md,ew,kd,lS,sS,Jk,Kk,Bk,eS,rS,No,xd,Pa,ja,Na,Ra]),f1=ie([Ia,Ta,hd,ow,Oo]),m1=ie([za,Sd,wd,Ma,zd,Oa,Da,on]),h1=ie([Ea,jS,HS,nw,Pa,ja,Na,Ra]),g1=ie([Ia,Ta,SS,oS,Yk,bS,gS,Oo,BS]),v1=ie([za,Ck,tw,hS,cS,Wk,Hk,Xk,Aa,yS,Oa,Da,on]),J=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===Y.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new cd(o.elicitations,r)}return new e(t,r,n)}},cd=class extends J{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(Y.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function ir(e){return e==="completed"||e==="failed"||e==="cancelled"}var X1=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Id(e){let r=sa(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Oh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ed(e,t){let r=nr(e,t);if(!r.success)throw r.error;return r.data}var lw=6e4,Ca=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ia,r=>{this._oncancel(r)}),this.setNotificationHandler(Ta,r=>{this._onprogress(r)}),this.setRequestHandler(Ea,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Pa,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new J(Y.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(ja,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,m=new J(d.error.code,d.error.message,d.error.data);l(m)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new J(Y.InvalidParams,`Task not found: ${i}`);if(!ir(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(ir(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[or]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Na,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new J(Y.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Ra,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new J(Y.InvalidParams,`Task not found: ${r.params.taskId}`);if(ir(o.status))throw new J(Y.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new J(Y.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof J?o:new J(Y.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),J.fromError(Y.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),zo(i)||Ug(i)?this._onresponse(i):dd(i)?this._onrequest(i,a):Cg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=J.fromError(Y.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[or]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:Y.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=Rg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,m)=>{let p={...m,relatedRequestId:t.id};i&&!p.relatedTask&&(p.relatedTask={taskId:i});let g=p.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,p)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:Y.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),zo(t))n(t);else{let a=new J(t.error.code,t.error.message,t.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(zo(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),zo(t))o(t);else{let a=J.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof J?a:new J(Y.InternalError,String(a))}}return}let i;try{let a=await this.request(t,on,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new J(Y.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},ir(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new J(Y.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new J(Y.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof J?a:new J(Y.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=E=>{l(E)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(E){d(E);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[or]:c}});let g=E=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(E)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let I=E instanceof J?E:new J(Y.RequestTimeout,String(E));l(I)};this._responseHandlers.set(m,E=>{if(!n?.signal?.aborted){if(E instanceof Error)return l(E);try{let I=nr(r,E.result);I.success?u(I.data):l(I.error)}catch(I){l(I)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let h=n?.timeout??lw,_=()=>g(J.fromError(Y.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(m,h,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let E=I=>{let A=this._responseHandlers.get(m);A?A(I):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,E),this._enqueueTaskMessage(b,{type:"request",message:p,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(m),l(I)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(E=>{this._cleanupTimeout(m),l(E)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Oa,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Da,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},qg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[or]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[or]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[or]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Id(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Ed(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Id(t);this._notificationHandlers.set(n,o=>{let i=Ed(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&dd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new J(Y.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new J(Y.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new J(Y.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new J(Y.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Oo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),ir(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new J(Y.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(ir(s.status))throw new J(Y.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Oo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ir(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Hg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Gg(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];Hg(a)&&Hg(i)?r[o]={...a,...i}:r[o]=i}return r}var Ry=hi(mf(),1),Ay=hi(Dy(),1);function eP(){let e=new Ry.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Ay.default)(e),e}var bs=class{constructor(t){this._ajv=t??eP()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var xs=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function My(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Cy(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var ks=class extends Ca{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Do.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)this._oninitialize(n)),this.setNotificationHandler(hd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(kd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Do.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new xs(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Gg(this._capabilities,t)}setRequestHandler(t,r){let o=sa(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(tn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=nr(No,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new J(Y.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,m=await Promise.resolve(r(c,u));if(d.task){let g=nr(on,m);if(!g.success){let h=g.error instanceof Error?g.error.message:String(g.error);throw new J(Y.InvalidParams,`Invalid task creation result: ${h}`)}return g.data}let p=nr(Aa,m);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new J(Y.InvalidParams,`Invalid tools/call result: ${g}`)}return p.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){Cy(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&My(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:jg.includes(r)?r:ud,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},za)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},wd,r):this.request({method:"sampling/createMessage",params:t},Sd,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Ma,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},Ma,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new J(Y.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof J?a:new J(Y.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},zd,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var xf=hi(require("node:process"),1);var Ss=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
-`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),tP(r)}clear(){this._buffer=void 0}};function tP(e){return Zg.parse(JSON.parse(e))}function Uy(e){return JSON.stringify(e)+`
-`}var ws=class{constructor(t=xf.default.stdin,r=xf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Ss,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=Uy(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Sf=hi(require("path"),1);var kf={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:5e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5};function Zy(e){return process.platform==="win32"?Math.round(e*kf.WINDOWS_MULTIPLIER):e}var zt=require("fs"),zs=require("path"),Fy=require("os");var Ly="bugfix,feature,refactor,discovery,decision,change",qy="how-it-works,why-it-exists,what-changed,problem-solution,gotcha,pattern,trade-off";var Vt=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:(0,zs.join)((0,Fy.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:Ly,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:qy,CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database"};static getAllDefaults(){return{...this.DEFAULTS}}static get(t){return this.DEFAULTS[t]}static getInt(t){let r=this.get(t);return parseInt(r,10)}static getBool(t){let r=this.get(t);return r==="true"||r===!0}static applyEnvOverrides(t){let r={...t};for(let n of Object.keys(this.DEFAULTS))process.env[n]!==void 0&&(r[n]=process.env[n]);return r}static loadFromFile(t){try{if(!(0,zt.existsSync)(t)){let a=this.getAllDefaults();try{let s=(0,zs.dirname)(t);(0,zt.existsSync)(s)||(0,zt.mkdirSync)(s,{recursive:!0}),(0,zt.writeFileSync)(t,JSON.stringify(a,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",t)}catch(s){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",t,s)}return this.applyEnvOverrides(a)}let r=(0,zt.readFileSync)(t,"utf-8"),n=JSON.parse(r),o=n;if(n.env&&typeof n.env=="object"){o=n.env;try{(0,zt.writeFileSync)(t,JSON.stringify(o,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",t)}catch(a){console.warn("[SETTINGS] Failed to auto-migrate settings file:",t,a)}}let i={...this.DEFAULTS};for(let a of Object.keys(this.DEFAULTS))o[a]!==void 0&&(i[a]=o[a]);return this.applyEnvOverrides(i)}catch(r){return console.warn("[SETTINGS] Failed to load settings, using defaults:",t,r),this.applyEnvOverrides(this.getAllDefaults())}}};var be=require("path"),Vy=require("os");var Jy=require("url");var oP={};function rP(){return typeof __dirname<"u"?__dirname:(0,be.dirname)((0,Jy.fileURLToPath)(oP.url))}var DU=rP(),Jt=Vt.get("CLAUDE_MEM_DATA_DIR"),Is=process.env.CLAUDE_CONFIG_DIR||(0,be.join)((0,Vy.homedir)(),".claude"),nP=(0,be.join)(Is,"plugins","marketplaces","thedotmack"),RU=(0,be.join)(Jt,"archives"),AU=(0,be.join)(Jt,"logs"),MU=(0,be.join)(Jt,"trash"),CU=(0,be.join)(Jt,"backups"),UU=(0,be.join)(Jt,"modes"),ZU=(0,be.join)(Jt,"settings.json"),LU=(0,be.join)(Jt,"claude-mem.db"),qU=(0,be.join)(Jt,"vector-db"),FU=(0,be.join)(Jt,"observer-sessions"),VU=(0,be.join)(Is,"settings.json"),JU=(0,be.join)(Is,"commands"),WU=(0,be.join)(Is,"CLAUDE.md");var YU=(()=>{let e=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(e){let t=parseInt(e,10);if(Number.isFinite(t)&&t>=500&&t<=3e5)return t;ve.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:e,min:500,max:3e5})}return Zy(kf.HEALTH_CHECK)})();var Es=null,Ts=null;function Wy(){if(Es!==null)return Es;let e=Sf.default.join(Vt.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),t=Vt.loadFromFile(e);return Es=parseInt(t.CLAUDE_MEM_WORKER_PORT,10),Es}function Ky(){if(Ts!==null)return Ts;let e=Sf.default.join(Vt.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return Ts=Vt.loadFromFile(e).CLAUDE_MEM_WORKER_HOST,Ts}var Sn=require("node:fs/promises"),pi=require("node:path");var Gy=require("node:child_process"),It=require("node:fs"),Wt=require("node:path"),Ef=require("node:os"),If=require("node:module"),vP={},By=typeof __filename<"u"?(0,If.createRequire)(__filename):(0,If.createRequire)(vP.url),iP={".js":"javascript",".mjs":"javascript",".cjs":"javascript",".jsx":"tsx",".ts":"typescript",".tsx":"tsx",".py":"python",".pyw":"python",".go":"go",".rs":"rust",".rb":"ruby",".java":"java",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp"};function Xy(e){let t=e.slice(e.lastIndexOf("."));return iP[t]||"unknown"}var aP={javascript:"tree-sitter-javascript",typescript:"tree-sitter-typescript/typescript",tsx:"tree-sitter-typescript/tsx",python:"tree-sitter-python",go:"tree-sitter-go",rust:"tree-sitter-rust",ruby:"tree-sitter-ruby",java:"tree-sitter-java",c:"tree-sitter-c",cpp:"tree-sitter-cpp"};function Yy(e){let t=aP[e];if(!t)return null;try{let r=By.resolve(t+"/package.json");return(0,Wt.dirname)(r)}catch{return null}}var sP={jsts:`
+Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function la(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=e.seen.get(l),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(f.$ref&&p.def)for(let h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=e.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:xo(t,"input",e.processors),output:xo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Me(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Me(n.element,r);if(n.type==="set")return Me(n.valueType,r);if(n.type==="lazy")return Me(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Me(n.innerType,r);if(n.type==="intersection")return Me(n.left,r)||Me(n.right,r);if(n.type==="record"||n.type==="map")return Me(n.keyType,r)||Me(n.valueType,r);if(n.type==="pipe")return Me(n.in,r)||Me(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Me(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Me(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Me(o,r))return!0;return!!(n.rest&&Me(n.rest,r))}return!1}var Qm=(e,t={})=>r=>{let n=ca({...r,processors:t});return fe(e,n),ua(n,e),la(n,e)},xo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=ca({...o??{},target:i,io:t,processors:r});return fe(e,a),ua(a,e),la(a,e)};var ox={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},eh=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=ox[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},th=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},rh=(e,t,r,n)=>{r.type="boolean"},nh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},oh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},ih=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ah=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{r.not={}},uh=(e,t,r,n)=>{},lh=(e,t,r,n)=>{},dh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ph=(e,t,r,n)=>{let o=e._zod.def,i=Fn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},fh=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},gh=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},vh=(e,t,r,n)=>{r.type="boolean"},_h=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},yh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},$h=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},xh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},kh=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,t,{...n,path:[...n.path,"items"]})},Sh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Il=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},wh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},zh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,f)=>fe(p,t,{...n,path:[...n.path,a,f]})),u=i.rest?fe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Ih=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Eh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Th=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ph=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Oh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},jh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Nh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},Dh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Rh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},El=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ah=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o};function rn(e){return!!e._zod}function or(e,t){return rn(e)?Xr(e,t):e.safeParse(t)}function da(e){if(!e)return;let t;if(rn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Zh(e){if(rn(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var ko={};En(ko,{ZodAny:()=>og,ZodArray:()=>cg,ZodBase64:()=>Yl,ZodBase64URL:()=>Ql,ZodBigInt:()=>$a,ZodBigIntFormat:()=>rd,ZodBoolean:()=>ya,ZodCIDRv4:()=>Bl,ZodCIDRv6:()=>Xl,ZodCUID:()=>Fl,ZodCUID2:()=>Vl,ZodCatch:()=>Eg,ZodCodec:()=>ud,ZodCustom:()=>wa,ZodCustomStringFormat:()=>wo,ZodDate:()=>od,ZodDefault:()=>xg,ZodDiscriminatedUnion:()=>lg,ZodE164:()=>ed,ZodEmail:()=>Zl,ZodEmoji:()=>Ll,ZodEnum:()=>So,ZodExactOptional:()=>yg,ZodFile:()=>vg,ZodFunction:()=>Cg,ZodGUID:()=>fa,ZodIPv4:()=>Hl,ZodIPv6:()=>Gl,ZodIntersection:()=>dg,ZodJWT:()=>td,ZodKSUID:()=>Kl,ZodLazy:()=>Dg,ZodLiteral:()=>gg,ZodMAC:()=>eg,ZodMap:()=>mg,ZodNaN:()=>Pg,ZodNanoID:()=>ql,ZodNever:()=>ag,ZodNonOptional:()=>sd,ZodNull:()=>ng,ZodNullable:()=>bg,ZodNumber:()=>_a,ZodNumberFormat:()=>nn,ZodObject:()=>ba,ZodOptional:()=>ad,ZodPipe:()=>cd,ZodPrefault:()=>Sg,ZodPromise:()=>Ag,ZodReadonly:()=>Og,ZodRecord:()=>Sa,ZodSet:()=>hg,ZodString:()=>ga,ZodStringFormat:()=>ce,ZodSuccess:()=>Ig,ZodSymbol:()=>tg,ZodTemplateLiteral:()=>Ng,ZodTransform:()=>_g,ZodTuple:()=>pg,ZodType:()=>F,ZodULID:()=>Jl,ZodURL:()=>va,ZodUUID:()=>Mt,ZodUndefined:()=>rg,ZodUnion:()=>xa,ZodUnknown:()=>ig,ZodVoid:()=>sg,ZodXID:()=>Wl,ZodXor:()=>ug,_ZodString:()=>Ul,_default:()=>kg,_function:()=>xk,any:()=>ok,array:()=>G,base64:()=>Lx,base64url:()=>qx,bigint:()=>Qx,boolean:()=>ye,catch:()=>Tg,check:()=>kk,cidrv4:()=>Ux,cidrv6:()=>Zx,codec:()=>yk,cuid:()=>Ox,cuid2:()=>jx,custom:()=>ld,date:()=>ak,describe:()=>Sk,discriminatedUnion:()=>ka,e164:()=>Fx,email:()=>bx,emoji:()=>Tx,enum:()=>Pe,exactOptional:()=>$g,file:()=>hk,float32:()=>Gx,float64:()=>Bx,function:()=>xk,guid:()=>xx,hash:()=>Hx,hex:()=>Kx,hostname:()=>Wx,httpUrl:()=>Ex,instanceof:()=>zk,int:()=>Ml,int32:()=>Xx,int64:()=>ek,intersection:()=>Io,ipv4:()=>Ax,ipv6:()=>Mx,json:()=>Ek,jwt:()=>Vx,keyof:()=>sk,ksuid:()=>Rx,lazy:()=>Rg,literal:()=>P,looseObject:()=>Te,looseRecord:()=>dk,mac:()=>Cx,map:()=>pk,meta:()=>wk,nan:()=>_k,nanoid:()=>Px,nativeEnum:()=>mk,never:()=>nd,nonoptional:()=>zg,null:()=>zo,nullable:()=>ma,nullish:()=>gk,number:()=>ne,object:()=>z,optional:()=>he,partialRecord:()=>lk,pipe:()=>ha,prefault:()=>wg,preprocess:()=>za,promise:()=>bk,readonly:()=>jg,record:()=>me,refine:()=>Mg,set:()=>fk,strictObject:()=>ck,string:()=>v,stringFormat:()=>Jx,stringbool:()=>Ik,success:()=>vk,superRefine:()=>Ug,symbol:()=>rk,templateLiteral:()=>$k,transform:()=>id,tuple:()=>fg,uint32:()=>Yx,uint64:()=>tk,ulid:()=>Nx,undefined:()=>nk,union:()=>ie,unknown:()=>ue,url:()=>Ix,uuid:()=>kx,uuidv4:()=>Sx,uuidv6:()=>wx,uuidv7:()=>zx,void:()=>ik,xid:()=>Dx,xor:()=>uk});var pa={};En(pa,{endsWith:()=>go,gt:()=>At,gte:()=>Ce,includes:()=>mo,length:()=>en,lowercase:()=>po,lt:()=>Rt,lte:()=>Xe,maxLength:()=>Qr,maxSize:()=>xr,mime:()=>vo,minLength:()=>nr,minSize:()=>Ct,multipleOf:()=>br,negative:()=>gl,nonnegative:()=>_l,nonpositive:()=>vl,normalize:()=>_o,overwrite:()=>$t,positive:()=>hl,property:()=>yl,regex:()=>lo,size:()=>Yr,slugify:()=>sa,startsWith:()=>ho,toLowerCase:()=>$o,toUpperCase:()=>bo,trim:()=>yo,uppercase:()=>fo});var kr={};En(kr,{ZodISODate:()=>jl,ZodISODateTime:()=>Pl,ZodISODuration:()=>Al,ZodISOTime:()=>Dl,date:()=>Nl,datetime:()=>Ol,duration:()=>Cl,time:()=>Rl});var Pl=m("ZodISODateTime",(e,t)=>{Vc.init(e,t),ce.init(e,t)});function Ol(e){return Wu(Pl,e)}var jl=m("ZodISODate",(e,t)=>{Jc.init(e,t),ce.init(e,t)});function Nl(e){return Ku(jl,e)}var Dl=m("ZodISOTime",(e,t)=>{Wc.init(e,t),ce.init(e,t)});function Rl(e){return Hu(Dl,e)}var Al=m("ZodISODuration",(e,t)=>{Kc.init(e,t),ce.init(e,t)});function Cl(e){return Gu(Al,e)}var Lh=(e,t)=>{zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ei(e,r)},flatten:{value:r=>Ii(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Hr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Hr,2)}},isEmpty:{get(){return e.issues.length===0}}})},AR=m("ZodError",Lh),Ye=m("ZodError",Lh,{Parent:Error});var qh=Gn(Ye),Fh=Xn(Ye),Vh=Qn(Ye),Jh=eo(Ye),Wh=rm(Ye),Kh=nm(Ye),Hh=om(Ye),Gh=im(Ye),Bh=am(Ye),Xh=sm(Ye),Yh=cm(Ye),Qh=um(Ye);var F=m("ZodType",(e,t)=>(Z.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:xo(e,"input"),output:xo(e,"output")}}),e.toJSONSchema=Qm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone($.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Re(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>qh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Vh(e,r,n),e.parseAsync=async(r,n)=>Fh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Jh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Wh(e,r,n),e.decode=(r,n)=>Kh(e,r,n),e.encodeAsync=async(r,n)=>Hh(e,r,n),e.decodeAsync=async(r,n)=>Gh(e,r,n),e.safeEncode=(r,n)=>Bh(e,r,n),e.safeDecode=(r,n)=>Xh(e,r,n),e.safeEncodeAsync=async(r,n)=>Yh(e,r,n),e.safeDecodeAsync=async(r,n)=>Qh(e,r,n),e.refine=(r,n)=>e.check(Mg(r,n)),e.superRefine=r=>e.check(Ug(r)),e.overwrite=r=>e.check($t(r)),e.optional=()=>he(e),e.exactOptional=()=>$g(e),e.nullable=()=>ma(e),e.nullish=()=>he(ma(e)),e.nonoptional=r=>zg(e,r),e.array=()=>G(e),e.or=r=>ie([e,r]),e.and=r=>Io(e,r),e.transform=r=>ha(e,id(r)),e.default=r=>kg(e,r),e.prefault=r=>wg(e,r),e.catch=r=>Tg(e,r),e.pipe=r=>ha(e,r),e.readonly=()=>jg(e),e.describe=r=>{let n=e.clone();return Ae.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ae.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ae.get(e);let n=e.clone();return Ae.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Ul=m("_ZodString",(e,t)=>{$r.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>eh(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(lo(...n)),e.includes=(...n)=>e.check(mo(...n)),e.startsWith=(...n)=>e.check(ho(...n)),e.endsWith=(...n)=>e.check(go(...n)),e.min=(...n)=>e.check(nr(...n)),e.max=(...n)=>e.check(Qr(...n)),e.length=(...n)=>e.check(en(...n)),e.nonempty=(...n)=>e.check(nr(1,...n)),e.lowercase=n=>e.check(po(n)),e.uppercase=n=>e.check(fo(n)),e.trim=()=>e.check(yo()),e.normalize=(...n)=>e.check(_o(...n)),e.toLowerCase=()=>e.check($o()),e.toUpperCase=()=>e.check(bo()),e.slugify=()=>e.check(sa())}),ga=m("ZodString",(e,t)=>{$r.init(e,t),Ul.init(e,t),e.email=r=>e.check(Li(Zl,r)),e.url=r=>e.check(uo(va,r)),e.jwt=r=>e.check(aa(td,r)),e.emoji=r=>e.check(Wi(Ll,r)),e.guid=r=>e.check(co(fa,r)),e.uuid=r=>e.check(qi(Mt,r)),e.uuidv4=r=>e.check(Fi(Mt,r)),e.uuidv6=r=>e.check(Vi(Mt,r)),e.uuidv7=r=>e.check(Ji(Mt,r)),e.nanoid=r=>e.check(Ki(ql,r)),e.guid=r=>e.check(co(fa,r)),e.cuid=r=>e.check(Hi(Fl,r)),e.cuid2=r=>e.check(Gi(Vl,r)),e.ulid=r=>e.check(Bi(Jl,r)),e.base64=r=>e.check(na(Yl,r)),e.base64url=r=>e.check(oa(Ql,r)),e.xid=r=>e.check(Xi(Wl,r)),e.ksuid=r=>e.check(Yi(Kl,r)),e.ipv4=r=>e.check(Qi(Hl,r)),e.ipv6=r=>e.check(ea(Gl,r)),e.cidrv4=r=>e.check(ta(Bl,r)),e.cidrv6=r=>e.check(ra(Xl,r)),e.e164=r=>e.check(ia(ed,r)),e.datetime=r=>e.check(Ol(r)),e.date=r=>e.check(Nl(r)),e.time=r=>e.check(Rl(r)),e.duration=r=>e.check(Cl(r))});function v(e){return Vu(ga,e)}var ce=m("ZodStringFormat",(e,t)=>{oe.init(e,t),Ul.init(e,t)}),Zl=m("ZodEmail",(e,t)=>{Rc.init(e,t),ce.init(e,t)});function bx(e){return Li(Zl,e)}var fa=m("ZodGUID",(e,t)=>{Nc.init(e,t),ce.init(e,t)});function xx(e){return co(fa,e)}var Mt=m("ZodUUID",(e,t)=>{Dc.init(e,t),ce.init(e,t)});function kx(e){return qi(Mt,e)}function Sx(e){return Fi(Mt,e)}function wx(e){return Vi(Mt,e)}function zx(e){return Ji(Mt,e)}var va=m("ZodURL",(e,t)=>{Ac.init(e,t),ce.init(e,t)});function Ix(e){return uo(va,e)}function Ex(e){return uo(va,{protocol:/^https?$/,hostname:nt.domain,...$.normalizeParams(e)})}var Ll=m("ZodEmoji",(e,t)=>{Cc.init(e,t),ce.init(e,t)});function Tx(e){return Wi(Ll,e)}var ql=m("ZodNanoID",(e,t)=>{Mc.init(e,t),ce.init(e,t)});function Px(e){return Ki(ql,e)}var Fl=m("ZodCUID",(e,t)=>{Uc.init(e,t),ce.init(e,t)});function Ox(e){return Hi(Fl,e)}var Vl=m("ZodCUID2",(e,t)=>{Zc.init(e,t),ce.init(e,t)});function jx(e){return Gi(Vl,e)}var Jl=m("ZodULID",(e,t)=>{Lc.init(e,t),ce.init(e,t)});function Nx(e){return Bi(Jl,e)}var Wl=m("ZodXID",(e,t)=>{qc.init(e,t),ce.init(e,t)});function Dx(e){return Xi(Wl,e)}var Kl=m("ZodKSUID",(e,t)=>{Fc.init(e,t),ce.init(e,t)});function Rx(e){return Yi(Kl,e)}var Hl=m("ZodIPv4",(e,t)=>{Hc.init(e,t),ce.init(e,t)});function Ax(e){return Qi(Hl,e)}var eg=m("ZodMAC",(e,t)=>{Bc.init(e,t),ce.init(e,t)});function Cx(e){return Ju(eg,e)}var Gl=m("ZodIPv6",(e,t)=>{Gc.init(e,t),ce.init(e,t)});function Mx(e){return ea(Gl,e)}var Bl=m("ZodCIDRv4",(e,t)=>{Xc.init(e,t),ce.init(e,t)});function Ux(e){return ta(Bl,e)}var Xl=m("ZodCIDRv6",(e,t)=>{Yc.init(e,t),ce.init(e,t)});function Zx(e){return ra(Xl,e)}var Yl=m("ZodBase64",(e,t)=>{Qc.init(e,t),ce.init(e,t)});function Lx(e){return na(Yl,e)}var Ql=m("ZodBase64URL",(e,t)=>{eu.init(e,t),ce.init(e,t)});function qx(e){return oa(Ql,e)}var ed=m("ZodE164",(e,t)=>{tu.init(e,t),ce.init(e,t)});function Fx(e){return ia(ed,e)}var td=m("ZodJWT",(e,t)=>{ru.init(e,t),ce.init(e,t)});function Vx(e){return aa(td,e)}var wo=m("ZodCustomStringFormat",(e,t)=>{nu.init(e,t),ce.init(e,t)});function Jx(e,t,r={}){return tn(wo,e,t,r)}function Wx(e){return tn(wo,"hostname",nt.hostname,e)}function Kx(e){return tn(wo,"hex",nt.hex,e)}function Hx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=nt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return tn(wo,n,o,t)}var _a=m("ZodNumber",(e,t)=>{Ci.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>th(e,n,o,i),e.gt=(n,o)=>e.check(At(n,o)),e.gte=(n,o)=>e.check(Ce(n,o)),e.min=(n,o)=>e.check(Ce(n,o)),e.lt=(n,o)=>e.check(Rt(n,o)),e.lte=(n,o)=>e.check(Xe(n,o)),e.max=(n,o)=>e.check(Xe(n,o)),e.int=n=>e.check(Ml(n)),e.safe=n=>e.check(Ml(n)),e.positive=n=>e.check(At(0,n)),e.nonnegative=n=>e.check(Ce(0,n)),e.negative=n=>e.check(Rt(0,n)),e.nonpositive=n=>e.check(Xe(0,n)),e.multipleOf=(n,o)=>e.check(br(n,o)),e.step=(n,o)=>e.check(br(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ne(e){return Bu(_a,e)}var nn=m("ZodNumberFormat",(e,t)=>{ou.init(e,t),_a.init(e,t)});function Ml(e){return Xu(nn,e)}function Gx(e){return Yu(nn,e)}function Bx(e){return Qu(nn,e)}function Xx(e){return el(nn,e)}function Yx(e){return tl(nn,e)}var ya=m("ZodBoolean",(e,t)=>{io.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o)});function ye(e){return rl(ya,e)}var $a=m("ZodBigInt",(e,t)=>{Mi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>nh(e,n,o,i),e.gte=(n,o)=>e.check(Ce(n,o)),e.min=(n,o)=>e.check(Ce(n,o)),e.gt=(n,o)=>e.check(At(n,o)),e.gte=(n,o)=>e.check(Ce(n,o)),e.min=(n,o)=>e.check(Ce(n,o)),e.lt=(n,o)=>e.check(Rt(n,o)),e.lte=(n,o)=>e.check(Xe(n,o)),e.max=(n,o)=>e.check(Xe(n,o)),e.positive=n=>e.check(At(BigInt(0),n)),e.negative=n=>e.check(Rt(BigInt(0),n)),e.nonpositive=n=>e.check(Xe(BigInt(0),n)),e.nonnegative=n=>e.check(Ce(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(br(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Qx(e){return nl($a,e)}var rd=m("ZodBigIntFormat",(e,t)=>{iu.init(e,t),$a.init(e,t)});function ek(e){return ol(rd,e)}function tk(e){return il(rd,e)}var tg=m("ZodSymbol",(e,t)=>{au.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o)});function rk(e){return al(tg,e)}var rg=m("ZodUndefined",(e,t)=>{su.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o)});function nk(e){return sl(rg,e)}var ng=m("ZodNull",(e,t)=>{cu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o)});function zo(e){return cl(ng,e)}var og=m("ZodAny",(e,t)=>{uu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o)});function ok(){return ul(og)}var ig=m("ZodUnknown",(e,t)=>{lu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o)});function ue(){return ll(ig)}var ag=m("ZodNever",(e,t)=>{du.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o)});function nd(e){return dl(ag,e)}var sg=m("ZodVoid",(e,t)=>{pu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o)});function ik(e){return pl(sg,e)}var od=m("ZodDate",(e,t)=>{fu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>dh(e,n,o,i),e.min=(n,o)=>e.check(Ce(n,o)),e.max=(n,o)=>e.check(Xe(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function ak(e){return fl(od,e)}var cg=m("ZodArray",(e,t)=>{mu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(nr(r,n)),e.nonempty=r=>e.check(nr(1,r)),e.max=(r,n)=>e.check(Qr(r,n)),e.length=(r,n)=>e.check(en(r,n)),e.unwrap=()=>e.element});function G(e,t){return Ym(cg,e,t)}function sk(e){let t=e._zod.def.shape;return Pe(Object.keys(t))}var ba=m("ZodObject",(e,t)=>{Bm.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),$.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ue()}),e.loose=()=>e.clone({...e._zod.def,catchall:ue()}),e.strict=()=>e.clone({...e._zod.def,catchall:nd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>$.extend(e,r),e.safeExtend=r=>$.safeExtend(e,r),e.merge=r=>$.merge(e,r),e.pick=r=>$.pick(e,r),e.omit=r=>$.omit(e,r),e.partial=(...r)=>$.partial(ad,e,r[0]),e.required=(...r)=>$.required(sd,e,r[0])});function z(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new ba(r)}function ck(e,t){return new ba({type:"object",shape:e,catchall:nd(),...$.normalizeParams(t)})}function Te(e,t){return new ba({type:"object",shape:e,catchall:ue(),...$.normalizeParams(t)})}var xa=m("ZodUnion",(e,t)=>{ao.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o),e.options=t.options});function ie(e,t){return new xa({type:"union",options:e,...$.normalizeParams(t)})}var ug=m("ZodXor",(e,t)=>{xa.init(e,t),hu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o),e.options=t.options});function uk(e,t){return new ug({type:"union",options:e,inclusive:!1,...$.normalizeParams(t)})}var lg=m("ZodDiscriminatedUnion",(e,t)=>{xa.init(e,t),gu.init(e,t)});function ka(e,t,r){return new lg({type:"union",options:t,discriminator:e,...$.normalizeParams(r)})}var dg=m("ZodIntersection",(e,t)=>{vu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o)});function Io(e,t){return new dg({type:"intersection",left:e,right:t})}var pg=m("ZodTuple",(e,t)=>{Ui.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function fg(e,t,r){let n=t instanceof Z,o=n?r:t,i=n?t:null;return new pg({type:"tuple",items:e,rest:i,...$.normalizeParams(o)})}var Sa=m("ZodRecord",(e,t)=>{_u.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function me(e,t,r){return new Sa({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}function lk(e,t,r){let n=Re(e);return n._zod.values=void 0,new Sa({type:"record",keyType:n,valueType:t,...$.normalizeParams(r)})}function dk(e,t,r){return new Sa({type:"record",keyType:e,valueType:t,mode:"loose",...$.normalizeParams(r)})}var mg=m("ZodMap",(e,t)=>{yu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Ct(...r)),e.nonempty=r=>e.check(Ct(1,r)),e.max=(...r)=>e.check(xr(...r)),e.size=(...r)=>e.check(Yr(...r))});function pk(e,t,r){return new mg({type:"map",keyType:e,valueType:t,...$.normalizeParams(r)})}var hg=m("ZodSet",(e,t)=>{$u.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e.min=(...r)=>e.check(Ct(...r)),e.nonempty=r=>e.check(Ct(1,r)),e.max=(...r)=>e.check(xr(...r)),e.size=(...r)=>e.check(Yr(...r))});function fk(e,t){return new hg({type:"set",valueType:e,...$.normalizeParams(t)})}var So=m("ZodEnum",(e,t)=>{bu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ph(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new So({...t,checks:[],...$.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new So({...t,checks:[],...$.normalizeParams(o),entries:i})}});function Pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new So({type:"enum",entries:r,...$.normalizeParams(t)})}function mk(e,t){return new So({type:"enum",entries:e,...$.normalizeParams(t)})}var gg=m("ZodLiteral",(e,t)=>{xu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fh(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function P(e,t){return new gg({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(t)})}var vg=m("ZodFile",(e,t)=>{ku.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o),e.min=(r,n)=>e.check(Ct(r,n)),e.max=(r,n)=>e.check(xr(r,n)),e.mime=(r,n)=>e.check(vo(Array.isArray(r)?r:[r],n))});function hk(e){return $l(vg,e)}var _g=m("ZodTransform",(e,t)=>{Su.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push($.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function id(e){return new _g({type:"transform",transform:e})}var ad=m("ZodOptional",(e,t)=>{Zi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>El(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function he(e){return new ad({type:"optional",innerType:e})}var yg=m("ZodExactOptional",(e,t)=>{wu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>El(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $g(e){return new yg({type:"optional",innerType:e})}var bg=m("ZodNullable",(e,t)=>{zu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ma(e){return new bg({type:"nullable",innerType:e})}function gk(e){return he(ma(e))}var xg=m("ZodDefault",(e,t)=>{Iu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kg(e,t){return new xg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var Sg=m("ZodPrefault",(e,t)=>{Eu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function wg(e,t){return new Sg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var sd=m("ZodNonOptional",(e,t)=>{Tu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zg(e,t){return new sd({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var Ig=m("ZodSuccess",(e,t)=>{Pu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vk(e){return new Ig({type:"success",innerType:e})}var Eg=m("ZodCatch",(e,t)=>{Ou.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tg(e,t){return new Eg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Pg=m("ZodNaN",(e,t)=>{ju.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o)});function _k(e){return ml(Pg,e)}var cd=m("ZodPipe",(e,t)=>{Nu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nh(e,r,n,o),e.in=t.in,e.out=t.out});function ha(e,t){return new cd({type:"pipe",in:e,out:t})}var ud=m("ZodCodec",(e,t)=>{cd.init(e,t),so.init(e,t)});function yk(e,t,r){return new ud({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Og=m("ZodReadonly",(e,t)=>{Du.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function jg(e){return new Og({type:"readonly",innerType:e})}var Ng=m("ZodTemplateLiteral",(e,t)=>{Ru.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o)});function $k(e,t){return new Ng({type:"template_literal",parts:e,...$.normalizeParams(t)})}var Dg=m("ZodLazy",(e,t)=>{Mu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ah(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Rg(e){return new Dg({type:"lazy",getter:e})}var Ag=m("ZodPromise",(e,t)=>{Cu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bk(e){return new Ag({type:"promise",innerType:e})}var Cg=m("ZodFunction",(e,t)=>{Au.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o)});function xk(e){return new Cg({type:"function",input:Array.isArray(e?.input)?fg(e?.input):e?.input??G(ue()),output:e?.output??ue()})}var wa=m("ZodCustom",(e,t)=>{Uu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o)});function kk(e){let t=new se({check:"custom"});return t._zod.check=e,t}function ld(e,t){return bl(wa,e??(()=>!0),t)}function Mg(e,t={}){return xl(wa,e,t)}function Ug(e){return kl(e)}var Sk=Sl,wk=wl;function zk(e,t={}){let r=new wa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...$.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Ik=(...e)=>zl({Codec:ud,Boolean:ya,String:ga},...e);function Ek(e){let t=Rg(()=>ie([v(e),ne(),ye(),zo(),G(t),me(v(),t)]));return t}function za(e,t){return ha(id(e),t)}var Zg;Zg||(Zg={});var VR={...ko,...pa,iso:kr};$e(Zu());var pd="2025-11-25";var Lg=[pd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ir="io.modelcontextprotocol/related-task",Ea="2.0",xe=ld(e=>e!==null&&(typeof e=="object"||typeof e=="function")),qg=ie([v(),ne().int()]),Fg=v(),u1=Te({ttl:ie([ne(),zo()]).optional(),pollInterval:ne().optional()}),jk=z({ttl:ne().optional()}),Nk=z({taskId:v()}),fd=Te({progressToken:qg.optional(),[ir]:Nk.optional()}),Qe=z({_meta:fd.optional()}),Eo=Qe.extend({task:jk.optional()}),Vg=e=>Eo.safeParse(e).success,ke=z({method:v(),params:Qe.loose().optional()}),ot=z({_meta:fd.optional()}),it=z({method:v(),params:ot.loose().optional()}),Se=Te({_meta:fd.optional()}),Ta=ie([v(),ne().int()]),Jg=z({jsonrpc:P(Ea),id:Ta,...ke.shape}).strict(),md=e=>Jg.safeParse(e).success,Wg=z({jsonrpc:P(Ea),...it.shape}).strict(),Kg=e=>Wg.safeParse(e).success,hd=z({jsonrpc:P(Ea),id:Ta,result:Se}).strict(),To=e=>hd.safeParse(e).success;var Y;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Y||(Y={}));var gd=z({jsonrpc:P(Ea),id:Ta.optional(),error:z({code:ne().int(),message:v(),data:ue().optional()})}).strict();var Hg=e=>gd.safeParse(e).success;var Gg=ie([Jg,Wg,hd,gd]),l1=ie([hd,gd]),Pa=Se.strict(),Dk=ot.extend({requestId:Ta.optional(),reason:v().optional()}),Oa=it.extend({method:P("notifications/cancelled"),params:Dk}),Rk=z({src:v(),mimeType:v().optional(),sizes:G(v()).optional(),theme:Pe(["light","dark"]).optional()}),Po=z({icons:G(Rk).optional()}),on=z({name:v(),title:v().optional()}),Bg=on.extend({...on.shape,...Po.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Ak=Io(z({applyDefaults:ye().optional()}),me(v(),ue())),Ck=za(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Io(z({form:Ak.optional(),url:xe.optional()}),me(v(),ue()).optional())),Mk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({sampling:Te({createMessage:xe.optional()}).optional(),elicitation:Te({create:xe.optional()}).optional()}).optional()}),Uk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({tools:Te({call:xe.optional()}).optional()}).optional()}),Zk=z({experimental:me(v(),xe).optional(),sampling:z({context:xe.optional(),tools:xe.optional()}).optional(),elicitation:Ck.optional(),roots:z({listChanged:ye().optional()}).optional(),tasks:Mk.optional()}),Lk=Qe.extend({protocolVersion:v(),capabilities:Zk,clientInfo:Bg}),vd=ke.extend({method:P("initialize"),params:Lk});var qk=z({experimental:me(v(),xe).optional(),logging:xe.optional(),completions:xe.optional(),prompts:z({listChanged:ye().optional()}).optional(),resources:z({subscribe:ye().optional(),listChanged:ye().optional()}).optional(),tools:z({listChanged:ye().optional()}).optional(),tasks:Uk.optional()}),Fk=Se.extend({protocolVersion:v(),capabilities:qk,serverInfo:Bg,instructions:v().optional()}),_d=it.extend({method:P("notifications/initialized"),params:ot.optional()});var ja=ke.extend({method:P("ping"),params:Qe.optional()}),Vk=z({progress:ne(),total:he(ne()),message:he(v())}),Jk=z({...ot.shape,...Vk.shape,progressToken:qg}),Na=it.extend({method:P("notifications/progress"),params:Jk}),Wk=Qe.extend({cursor:Fg.optional()}),Oo=ke.extend({params:Wk.optional()}),jo=Se.extend({nextCursor:Fg.optional()}),Kk=Pe(["working","input_required","completed","failed","cancelled"]),No=z({taskId:v(),status:Kk,ttl:ie([ne(),zo()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:he(ne()),statusMessage:he(v())}),an=Se.extend({task:No}),Hk=ot.merge(No),Do=it.extend({method:P("notifications/tasks/status"),params:Hk}),Da=ke.extend({method:P("tasks/get"),params:Qe.extend({taskId:v()})}),Ra=Se.merge(No),Aa=ke.extend({method:P("tasks/result"),params:Qe.extend({taskId:v()})}),d1=Se.loose(),Ca=Oo.extend({method:P("tasks/list")}),Ma=jo.extend({tasks:G(No)}),Ua=ke.extend({method:P("tasks/cancel"),params:Qe.extend({taskId:v()})}),Xg=Se.merge(No),Yg=z({uri:v(),mimeType:he(v()),_meta:me(v(),ue()).optional()}),Qg=Yg.extend({text:v()}),yd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ev=Yg.extend({blob:yd}),Ro=Pe(["user","assistant"]),sn=z({audience:G(Ro).optional(),priority:ne().min(0).max(1).optional(),lastModified:kr.datetime({offset:!0}).optional()}),tv=z({...on.shape,...Po.shape,uri:v(),description:he(v()),mimeType:he(v()),annotations:sn.optional(),_meta:he(Te({}))}),Gk=z({...on.shape,...Po.shape,uriTemplate:v(),description:he(v()),mimeType:he(v()),annotations:sn.optional(),_meta:he(Te({}))}),Bk=Oo.extend({method:P("resources/list")}),Xk=jo.extend({resources:G(tv)}),Yk=Oo.extend({method:P("resources/templates/list")}),Qk=jo.extend({resourceTemplates:G(Gk)}),$d=Qe.extend({uri:v()}),eS=$d,tS=ke.extend({method:P("resources/read"),params:eS}),rS=Se.extend({contents:G(ie([Qg,ev]))}),nS=it.extend({method:P("notifications/resources/list_changed"),params:ot.optional()}),oS=$d,iS=ke.extend({method:P("resources/subscribe"),params:oS}),aS=$d,sS=ke.extend({method:P("resources/unsubscribe"),params:aS}),cS=ot.extend({uri:v()}),uS=it.extend({method:P("notifications/resources/updated"),params:cS}),lS=z({name:v(),description:he(v()),required:he(ye())}),dS=z({...on.shape,...Po.shape,description:he(v()),arguments:he(G(lS)),_meta:he(Te({}))}),pS=Oo.extend({method:P("prompts/list")}),fS=jo.extend({prompts:G(dS)}),mS=Qe.extend({name:v(),arguments:me(v(),v()).optional()}),hS=ke.extend({method:P("prompts/get"),params:mS}),bd=z({type:P("text"),text:v(),annotations:sn.optional(),_meta:me(v(),ue()).optional()}),xd=z({type:P("image"),data:yd,mimeType:v(),annotations:sn.optional(),_meta:me(v(),ue()).optional()}),kd=z({type:P("audio"),data:yd,mimeType:v(),annotations:sn.optional(),_meta:me(v(),ue()).optional()}),gS=z({type:P("tool_use"),name:v(),id:v(),input:me(v(),ue()),_meta:me(v(),ue()).optional()}),vS=z({type:P("resource"),resource:ie([Qg,ev]),annotations:sn.optional(),_meta:me(v(),ue()).optional()}),_S=tv.extend({type:P("resource_link")}),Sd=ie([bd,xd,kd,_S,vS]),yS=z({role:Ro,content:Sd}),$S=Se.extend({description:v().optional(),messages:G(yS)}),bS=it.extend({method:P("notifications/prompts/list_changed"),params:ot.optional()}),xS=z({title:v().optional(),readOnlyHint:ye().optional(),destructiveHint:ye().optional(),idempotentHint:ye().optional(),openWorldHint:ye().optional()}),kS=z({taskSupport:Pe(["required","optional","forbidden"]).optional()}),rv=z({...on.shape,...Po.shape,description:v().optional(),inputSchema:z({type:P("object"),properties:me(v(),xe).optional(),required:G(v()).optional()}).catchall(ue()),outputSchema:z({type:P("object"),properties:me(v(),xe).optional(),required:G(v()).optional()}).catchall(ue()).optional(),annotations:xS.optional(),execution:kS.optional(),_meta:me(v(),ue()).optional()}),wd=Oo.extend({method:P("tools/list")}),SS=jo.extend({tools:G(rv)}),Za=Se.extend({content:G(Sd).default([]),structuredContent:me(v(),ue()).optional(),isError:ye().optional()}),p1=Za.or(Se.extend({toolResult:ue()})),wS=Eo.extend({name:v(),arguments:me(v(),ue()).optional()}),Ao=ke.extend({method:P("tools/call"),params:wS}),zS=it.extend({method:P("notifications/tools/list_changed"),params:ot.optional()}),f1=z({autoRefresh:ye().default(!0),debounceMs:ne().int().nonnegative().default(300)}),Co=Pe(["debug","info","notice","warning","error","critical","alert","emergency"]),IS=Qe.extend({level:Co}),zd=ke.extend({method:P("logging/setLevel"),params:IS}),ES=ot.extend({level:Co,logger:v().optional(),data:ue()}),TS=it.extend({method:P("notifications/message"),params:ES}),PS=z({name:v().optional()}),OS=z({hints:G(PS).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),jS=z({mode:Pe(["auto","required","none"]).optional()}),NS=z({type:P("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:G(Sd).default([]),structuredContent:z({}).loose().optional(),isError:ye().optional(),_meta:me(v(),ue()).optional()}),DS=ka("type",[bd,xd,kd]),Ia=ka("type",[bd,xd,kd,gS,NS]),RS=z({role:Ro,content:ie([Ia,G(Ia)]),_meta:me(v(),ue()).optional()}),AS=Eo.extend({messages:G(RS),modelPreferences:OS.optional(),systemPrompt:v().optional(),includeContext:Pe(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:G(v()).optional(),metadata:xe.optional(),tools:G(rv).optional(),toolChoice:jS.optional()}),CS=ke.extend({method:P("sampling/createMessage"),params:AS}),Mo=Se.extend({model:v(),stopReason:he(Pe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Ro,content:DS}),Id=Se.extend({model:v(),stopReason:he(Pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Ro,content:ie([Ia,G(Ia)])}),MS=z({type:P("boolean"),title:v().optional(),description:v().optional(),default:ye().optional()}),US=z({type:P("string"),title:v().optional(),description:v().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Pe(["email","uri","date","date-time"]).optional(),default:v().optional()}),ZS=z({type:Pe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),LS=z({type:P("string"),title:v().optional(),description:v().optional(),enum:G(v()),default:v().optional()}),qS=z({type:P("string"),title:v().optional(),description:v().optional(),oneOf:G(z({const:v(),title:v()})),default:v().optional()}),FS=z({type:P("string"),title:v().optional(),description:v().optional(),enum:G(v()),enumNames:G(v()).optional(),default:v().optional()}),VS=ie([LS,qS]),JS=z({type:P("array"),title:v().optional(),description:v().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({type:P("string"),enum:G(v())}),default:G(v()).optional()}),WS=z({type:P("array"),title:v().optional(),description:v().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({anyOf:G(z({const:v(),title:v()}))}),default:G(v()).optional()}),KS=ie([JS,WS]),HS=ie([FS,VS,KS]),GS=ie([HS,MS,US,ZS]),BS=Eo.extend({mode:P("form").optional(),message:v(),requestedSchema:z({type:P("object"),properties:me(v(),GS),required:G(v()).optional()})}),XS=Eo.extend({mode:P("url"),message:v(),elicitationId:v(),url:v().url()}),YS=ie([BS,XS]),QS=ke.extend({method:P("elicitation/create"),params:YS}),ew=ot.extend({elicitationId:v()}),tw=it.extend({method:P("notifications/elicitation/complete"),params:ew}),cn=Se.extend({action:Pe(["accept","decline","cancel"]),content:za(e=>e===null?void 0:e,me(v(),ie([v(),ne(),ye(),G(v())])).optional())}),rw=z({type:P("ref/resource"),uri:v()});var nw=z({type:P("ref/prompt"),name:v()}),ow=Qe.extend({ref:ie([nw,rw]),argument:z({name:v(),value:v()}),context:z({arguments:me(v(),v()).optional()}).optional()}),iw=ke.extend({method:P("completion/complete"),params:ow});var aw=Se.extend({completion:Te({values:G(v()).max(100),total:he(ne().int()),hasMore:he(ye())})}),sw=z({uri:v().startsWith("file://"),name:v().optional(),_meta:me(v(),ue()).optional()}),cw=ke.extend({method:P("roots/list"),params:Qe.optional()}),Ed=Se.extend({roots:G(sw)}),uw=it.extend({method:P("notifications/roots/list_changed"),params:ot.optional()}),m1=ie([ja,vd,iw,zd,hS,pS,Bk,Yk,tS,iS,sS,Ao,wd,Da,Aa,Ca,Ua]),h1=ie([Oa,Na,_d,uw,Do]),g1=ie([Pa,Mo,Id,cn,Ed,Ra,Ma,an]),v1=ie([ja,CS,QS,cw,Da,Aa,Ca,Ua]),_1=ie([Oa,Na,TS,uS,nS,zS,bS,Do,tw]),y1=ie([Pa,Fk,aw,$S,fS,Xk,Qk,rS,Za,SS,Ra,Ma,an]),V=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===Y.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new dd(o.elicitations,r)}return new e(t,r,n)}},dd=class extends V{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(Y.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function ar(e){return e==="completed"||e==="failed"||e==="cancelled"}var Q1=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Td(e){let r=da(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Zh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Pd(e,t){let r=or(e,t);if(!r.success)throw r.error;return r.data}var hw=6e4,La=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Oa,r=>{this._oncancel(r)}),this.setNotificationHandler(Na,r=>{this._onprogress(r)}),this.setRequestHandler(ja,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Da,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new V(Y.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Aa,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new V(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new V(Y.InvalidParams,`Task not found: ${i}`);if(!ar(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(ar(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[ir]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Ca,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new V(Y.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Ua,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new V(Y.InvalidParams,`Task not found: ${r.params.taskId}`);if(ar(o.status))throw new V(Y.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new V(Y.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof V?o:new V(Y.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),V.fromError(Y.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),To(i)||Hg(i)?this._onresponse(i):md(i)?this._onrequest(i,a):Kg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=V.fromError(Y.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[ir]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:Y.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=Vg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new V(Y.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let g=f.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:Y.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),To(t))n(t);else{let a=new V(t.error.code,t.error.message,t.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(To(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),To(t))o(t);else{let a=V.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof V?a:new V(Y.InternalError,String(a))}}return}let i;try{let a=await this.request(t,an,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new V(Y.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},ar(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new V(Y.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new V(Y.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof V?a:new V(Y.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=E=>{l(E)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(E){d(E);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ir]:c}});let g=E=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(E)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let I=E instanceof V?E:new V(Y.RequestTimeout,String(E));l(I)};this._responseHandlers.set(p,E=>{if(!n?.signal?.aborted){if(E instanceof Error)return l(E);try{let I=or(r,E.result);I.success?u(I.data):l(I.error)}catch(I){l(I)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let h=n?.timeout??hw,_=()=>g(V.fromError(Y.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let E=I=>{let A=this._responseHandlers.get(p);A?A(I):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,E),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(p),l(I)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(E=>{this._cleanupTimeout(p),l(E)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ra,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Ma,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Xg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ir]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ir]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ir]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Td(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Pd(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Td(t);this._notificationHandlers.set(n,o=>{let i=Pd(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&md(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new V(Y.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new V(Y.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new V(Y.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new V(Y.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Do.parse({method:"notifications/tasks/status",params:s});await this.notification(c),ar(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new V(Y.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(ar(s.status))throw new V(Y.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Do.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ar(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function nv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ov(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];nv(a)&&nv(i)?r[o]={...a,...i}:r[o]=i}return r}var Vy=yi(gf(),1),Jy=yi(Fy(),1);function aP(){let e=new Vy.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Jy.default)(e),e}var ks=class{constructor(t){this._ajv=t??aP()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Ss=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],i=Array.isArray(o.content)?o.content:[o.content],a=i.some(l=>l.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Mo,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let i=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:i},cn,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function Wy(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Ky(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var ws=class extends La{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Co.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)this._oninitialize(n)),this.setNotificationHandler(_d,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(zd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Co.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Ss(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ov(this._capabilities,t)}setRequestHandler(t,r){let o=da(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(rn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=or(Ao,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new V(Y.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let g=or(an,p);if(!g.success){let h=g.error instanceof Error?g.error.message:String(g.error);throw new V(Y.InvalidParams,`Invalid task creation result: ${h}`)}return g.data}let f=or(Za,p);if(!f.success){let g=f.error instanceof Error?f.error.message:String(f.error);throw new V(Y.InvalidParams,`Invalid tools/call result: ${g}`)}return f.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){Ky(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Wy(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Lg.includes(r)?r:pd,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Pa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},Id,r):this.request({method:"sampling/createMessage",params:t},Mo,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},cn,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},cn,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new V(Y.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof V?a:new V(Y.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},Ed,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Sf=yi(require("node:process"),1);var zs=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
+`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),sP(r)}clear(){this._buffer=void 0}};function sP(e){return Gg.parse(JSON.parse(e))}function Hy(e){return JSON.stringify(e)+`
+`}var Is=class{constructor(t=Sf.default.stdin,r=Sf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new zs,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=Hy(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var zf=yi(require("path"),1);var wf={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:5e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5};function Gy(e){return process.platform==="win32"?Math.round(e*wf.WINDOWS_MULTIPLIER):e}var It=require("fs"),Es=require("path"),Yy=require("os");var By="bugfix,feature,refactor,discovery,decision,change",Xy="how-it-works,why-it-exists,what-changed,problem-solution,gotcha,pattern,trade-off";var Jt=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:(0,Es.join)((0,Yy.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:By,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:Xy,CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database"};static getAllDefaults(){return{...this.DEFAULTS}}static get(t){return this.DEFAULTS[t]}static getInt(t){let r=this.get(t);return parseInt(r,10)}static getBool(t){let r=this.get(t);return r==="true"||r===!0}static applyEnvOverrides(t){let r={...t};for(let n of Object.keys(this.DEFAULTS))process.env[n]!==void 0&&(r[n]=process.env[n]);return r}static loadFromFile(t){try{if(!(0,It.existsSync)(t)){let a=this.getAllDefaults();try{let s=(0,Es.dirname)(t);(0,It.existsSync)(s)||(0,It.mkdirSync)(s,{recursive:!0}),(0,It.writeFileSync)(t,JSON.stringify(a,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",t)}catch(s){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",t,s)}return this.applyEnvOverrides(a)}let r=(0,It.readFileSync)(t,"utf-8"),n=JSON.parse(r),o=n;if(n.env&&typeof n.env=="object"){o=n.env;try{(0,It.writeFileSync)(t,JSON.stringify(o,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",t)}catch(a){console.warn("[SETTINGS] Failed to auto-migrate settings file:",t,a)}}let i={...this.DEFAULTS};for(let a of Object.keys(this.DEFAULTS))o[a]!==void 0&&(i[a]=o[a]);return this.applyEnvOverrides(i)}catch(r){return console.warn("[SETTINGS] Failed to load settings, using defaults:",t,r),this.applyEnvOverrides(this.getAllDefaults())}}};var be=require("path"),Qy=require("os");var e$=require("url");var lP={};function cP(){return typeof __dirname<"u"?__dirname:(0,be.dirname)((0,e$.fileURLToPath)(lP.url))}var CU=cP(),Wt=Jt.get("CLAUDE_MEM_DATA_DIR"),Ts=process.env.CLAUDE_CONFIG_DIR||(0,be.join)((0,Qy.homedir)(),".claude"),uP=(0,be.join)(Ts,"plugins","marketplaces","thedotmack"),MU=(0,be.join)(Wt,"archives"),UU=(0,be.join)(Wt,"logs"),ZU=(0,be.join)(Wt,"trash"),LU=(0,be.join)(Wt,"backups"),qU=(0,be.join)(Wt,"modes"),FU=(0,be.join)(Wt,"settings.json"),VU=(0,be.join)(Wt,"claude-mem.db"),JU=(0,be.join)(Wt,"vector-db"),WU=(0,be.join)(Wt,"observer-sessions"),KU=(0,be.join)(Ts,"settings.json"),HU=(0,be.join)(Ts,"commands"),GU=(0,be.join)(Ts,"CLAUDE.md");var tZ=(()=>{let e=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(e){let t=parseInt(e,10);if(Number.isFinite(t)&&t>=500&&t<=3e5)return t;pe.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:e,min:500,max:3e5})}return Gy(wf.HEALTH_CHECK)})();var Ps=null,Os=null;function t$(){if(Ps!==null)return Ps;let e=zf.default.join(Jt.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),t=Jt.loadFromFile(e);return Ps=parseInt(t.CLAUDE_MEM_WORKER_PORT,10),Ps}function r$(){if(Os!==null)return Os;let e=zf.default.join(Jt.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return Os=Jt.loadFromFile(e).CLAUDE_MEM_WORKER_HOST,Os}var In=require("node:fs/promises"),gi=require("node:path");var o$=require("node:child_process"),Et=require("node:fs"),Kt=require("node:path"),Pf=require("node:os"),Tf=require("node:module"),kP={},i$=typeof __filename<"u"?(0,Tf.createRequire)(__filename):(0,Tf.createRequire)(kP.url),dP={".js":"javascript",".mjs":"javascript",".cjs":"javascript",".jsx":"tsx",".ts":"typescript",".tsx":"tsx",".py":"python",".pyw":"python",".go":"go",".rs":"rust",".rb":"ruby",".java":"java",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp"};function a$(e){let t=e.slice(e.lastIndexOf("."));return dP[t]||"unknown"}var pP={javascript:"tree-sitter-javascript",typescript:"tree-sitter-typescript/typescript",tsx:"tree-sitter-typescript/tsx",python:"tree-sitter-python",go:"tree-sitter-go",rust:"tree-sitter-rust",ruby:"tree-sitter-ruby",java:"tree-sitter-java",c:"tree-sitter-c",cpp:"tree-sitter-cpp"};function s$(e){let t=pP[e];if(!t)return null;try{let r=i$.resolve(t+"/package.json");return(0,Kt.dirname)(r)}catch{return null}}var fP={jsts:`
(function_declaration name: (identifier) @name) @func
(lexical_declaration (variable_declarator name: (identifier) @name value: [(arrow_function) (function_expression)])) @const_func
(class_declaration name: (type_identifier) @name) @cls
@@ -99,22 +99,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
(class_definition name: (identifier) @name) @cls
(import_statement) @imp
(import_declaration) @imp
-`};function Qy(e){switch(e){case"javascript":case"typescript":case"tsx":return"jsts";case"python":return"python";case"go":return"go";case"rust":return"rust";case"ruby":return"ruby";case"java":return"java";default:return"generic"}}var wf=null,zf=new Map;function e$(e){if(zf.has(e))return zf.get(e);wf||(wf=(0,It.mkdtempSync)((0,Wt.join)((0,Ef.tmpdir)(),"smart-read-queries-")));let t=(0,Wt.join)(wf,`${e}.scm`);return(0,It.writeFileSync)(t,sP[e]),zf.set(e,t),t}var di=null;function cP(){if(di)return di;try{let e=By.resolve("tree-sitter-cli/package.json"),t=(0,Wt.join)((0,Wt.dirname)(e),"tree-sitter");if((0,It.existsSync)(t))return di=t,t}catch{}return di="tree-sitter",di}function uP(e,t,r){return t$(e,[t],r).get(t)||[]}function t$(e,t,r){if(t.length===0)return new Map;let n=cP(),o=["query","-p",r,e,...t],i;try{i=(0,Gy.execFileSync)(n,o,{encoding:"utf-8",timeout:3e4,stdio:["pipe","pipe","pipe"]})}catch{return new Map}return lP(i)}function lP(e){let t=new Map,r=null,n=null;for(let o of e.split(`
-`)){if(o.length>0&&!o.startsWith(" ")&&!o.startsWith(" ")){r=o.trim(),t.has(r)||t.set(r,[]),n=null;continue}if(!r)continue;let i=o.match(/^\s+pattern:\s+(\d+)/);if(i){n={pattern:parseInt(i[1]),captures:[]},t.get(r).push(n);continue}let a=o.match(/^\s+capture:\s+(?:\d+\s*-\s*)?(\w+),\s*start:\s*\((\d+),\s*(\d+)\),\s*end:\s*\((\d+),\s*(\d+)\)(?:,\s*text:\s*`([^`]*)`)?/);a&&n&&n.captures.push({tag:a[1],startRow:parseInt(a[2]),startCol:parseInt(a[3]),endRow:parseInt(a[4]),endCol:parseInt(a[5]),text:a[6]})}return t}var Hy={func:"function",const_func:"function",cls:"class",method:"method",iface:"interface",tdef:"type",enm:"enum",struct_def:"struct",trait_def:"trait",impl_def:"impl"},dP=new Set(["class","struct","impl","trait"]);function pP(e,t,r,n=200){let i=e[t]||"";if(!i.trimEnd().endsWith("{")&&!i.trimEnd().endsWith(":")){let a=e.slice(t,Math.min(t+10,r+1)).join(`
-`),s=a.indexOf("{");s!==-1&&s<500&&(i=a.slice(0,s).replace(/\n/g," ").replace(/\s+/g," ").trim())}return i=i.replace(/\s*[{:]\s*$/,"").trim(),i.length>n&&(i=i.slice(0,n-3)+"..."),i}function fP(e,t){let r=[],n=!1;for(let o=t-1;o>=0;o--){let i=e[o].trim();if(i===""){if(n)break;continue}if(i.startsWith("/**")||i.startsWith("*")||i.startsWith("*/")||i.startsWith("//")||i.startsWith("///")||i.startsWith("//!")||i.startsWith("#")||i.startsWith("@"))r.unshift(e[o]),n=!0;else break}return r.length>0?r.join(`
-`).trim():void 0}function mP(e,t,r){for(let n=t+1;n<=Math.min(t+3,r);n++){let o=e[n]?.trim();if(o){if(o.startsWith('"""')||o.startsWith("'''"))return o;break}}}function hP(e,t,r,n,o,i){switch(i){case"javascript":case"typescript":case"tsx":return n.some(a=>t>=a.startRow&&r<=a.endRow);case"python":return!e.startsWith("_");case"go":return e.length>0&&e[0]===e[0].toUpperCase()&&e[0]!==e[0].toLowerCase();case"rust":return o[t]?.trimStart().startsWith("pub")??!1;default:return!0}}function r$(e,t,r){let n=[],o=[],i=[],a=[];for(let c of e)for(let u of c.captures)u.tag==="exp"&&i.push({startRow:u.startRow,endRow:u.endRow}),u.tag==="imp"&&o.push(u.text||t[u.startRow]?.trim()||"");for(let c of e){let u=c.captures.find(E=>Hy[E.tag]),l=c.captures.find(E=>E.tag==="name");if(!u)continue;let d=l?.text||"anonymous",m=u.startRow,p=u.endRow,g=Hy[u.tag],h=fP(t,m),_=r==="python"?mP(t,m,p):void 0,b={name:d,kind:g,signature:pP(t,m,p),jsdoc:h||_,lineStart:m,lineEnd:p,exported:hP(d,m,p,i,t,r)};dP.has(g)&&(b.children=[],a.push({sym:b,startRow:m,endRow:p})),n.push(b)}let s=new Set;for(let c of a)for(let u of n)u!==c.sym&&u.lineStart>c.startRow&&u.lineEnd<=c.endRow&&(u.kind==="function"&&(u.kind="method"),c.sym.children.push(u),s.add(u));return{symbols:n.filter(c=>!s.has(c)),imports:o}}function Ps(e,t){let r=Xy(t),n=e.split(`
-`),o=Yy(r);if(!o)return{filePath:t,language:r,symbols:[],imports:[],totalLines:n.length,foldedTokenEstimate:50};let i=Qy(r),a=e$(i),s=t.slice(t.lastIndexOf("."))||".txt",c=(0,It.mkdtempSync)((0,Wt.join)((0,Ef.tmpdir)(),"smart-src-")),u=(0,Wt.join)(c,`source${s}`);(0,It.writeFileSync)(u,e);try{let l=uP(a,u,o),d=r$(l,n,r),m=kn({filePath:t,language:r,symbols:d.symbols,imports:d.imports,totalLines:n.length,foldedTokenEstimate:0});return{filePath:t,language:r,symbols:d.symbols,imports:d.imports,totalLines:n.length,foldedTokenEstimate:Math.ceil(m.length/4)}}finally{(0,It.rmSync)(c,{recursive:!0,force:!0})}}function n$(e){let t=new Map,r=new Map;for(let n of e){let o=Xy(n.relativePath);r.has(o)||r.set(o,[]),r.get(o).push(n)}for(let[n,o]of r){let i=Yy(n);if(!i){for(let l of o){let d=l.content.split(`
-`);t.set(l.relativePath,{filePath:l.relativePath,language:n,symbols:[],imports:[],totalLines:d.length,foldedTokenEstimate:50})}continue}let a=Qy(n),s=e$(a),c=o.map(l=>l.absolutePath),u=t$(s,c,i);for(let l of o){let d=l.content.split(`
-`),m=u.get(l.absolutePath)||[],p=r$(m,d,n),g=kn({filePath:l.relativePath,language:n,symbols:p.symbols,imports:p.imports,totalLines:d.length,foldedTokenEstimate:0});t.set(l.relativePath,{filePath:l.relativePath,language:n,symbols:p.symbols,imports:p.imports,totalLines:d.length,foldedTokenEstimate:Math.ceil(g.length/4)})}}return t}function kn(e){let t=[];if(t.push(`\u{1F4C1} ${e.filePath} (${e.language}, ${e.totalLines} lines)`),t.push(""),e.imports.length>0){t.push(` \u{1F4E6} Imports: ${e.imports.length} statements`);for(let r of e.imports.slice(0,10))t.push(` ${r}`);e.imports.length>10&&t.push(` ... +${e.imports.length-10} more`),t.push("")}for(let r of e.symbols)t.push(o$(r," "));return t.join(`
-`)}function o$(e,t){let r=[],n=gP(e.kind),o=e.exported?" [exported]":"",i=e.lineStart===e.lineEnd?`L${e.lineStart+1}`:`L${e.lineStart+1}-${e.lineEnd+1}`;if(r.push(`${t}${n} ${e.name}${o} (${i})`),r.push(`${t} ${e.signature}`),e.jsdoc){let s=e.jsdoc.split(`
-`).find(c=>{let u=c.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").trim();return u.length>0&&!u.startsWith("/**")});if(s){let c=s.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").replace(/['"`]{3}$/,"").trim();c&&r.push(`${t} \u{1F4AC} ${c}`)}}if(e.children&&e.children.length>0)for(let a of e.children)r.push(o$(a,t+" "));return r.join(`
-`)}function gP(e){return{function:"\u0192",method:"\u0192",class:"\u25C6",interface:"\u25C7",type:"\u25C7",const:"\u25CF",variable:"\u25CB",export:"\u2192",struct:"\u25C6",enum:"\u25A3",trait:"\u25C7",impl:"\u25C8",property:"\u25CB",getter:"\u21E2",setter:"\u21E0"}[e]||"\xB7"}function i$(e,t,r){let n=Ps(e,t),o=u=>{for(let l of u){if(l.name===r)return l;if(l.children){let d=o(l.children);if(d)return d}}return null},i=o(n.symbols);if(!i)return null;let a=e.split(`
+`};function c$(e){switch(e){case"javascript":case"typescript":case"tsx":return"jsts";case"python":return"python";case"go":return"go";case"rust":return"rust";case"ruby":return"ruby";case"java":return"java";default:return"generic"}}var If=null,Ef=new Map;function u$(e){if(Ef.has(e))return Ef.get(e);If||(If=(0,Et.mkdtempSync)((0,Kt.join)((0,Pf.tmpdir)(),"smart-read-queries-")));let t=(0,Kt.join)(If,`${e}.scm`);return(0,Et.writeFileSync)(t,fP[e]),Ef.set(e,t),t}var hi=null;function mP(){if(hi)return hi;try{let e=i$.resolve("tree-sitter-cli/package.json"),t=(0,Kt.join)((0,Kt.dirname)(e),"tree-sitter");if((0,Et.existsSync)(t))return hi=t,t}catch{}return hi="tree-sitter",hi}function hP(e,t,r){return l$(e,[t],r).get(t)||[]}function l$(e,t,r){if(t.length===0)return new Map;let n=mP(),o=["query","-p",r,e,...t],i;try{i=(0,o$.execFileSync)(n,o,{encoding:"utf-8",timeout:3e4,stdio:["pipe","pipe","pipe"]})}catch{return new Map}return gP(i)}function gP(e){let t=new Map,r=null,n=null;for(let o of e.split(`
+`)){if(o.length>0&&!o.startsWith(" ")&&!o.startsWith(" ")){r=o.trim(),t.has(r)||t.set(r,[]),n=null;continue}if(!r)continue;let i=o.match(/^\s+pattern:\s+(\d+)/);if(i){n={pattern:parseInt(i[1]),captures:[]},t.get(r).push(n);continue}let a=o.match(/^\s+capture:\s+(?:\d+\s*-\s*)?(\w+),\s*start:\s*\((\d+),\s*(\d+)\),\s*end:\s*\((\d+),\s*(\d+)\)(?:,\s*text:\s*`([^`]*)`)?/);a&&n&&n.captures.push({tag:a[1],startRow:parseInt(a[2]),startCol:parseInt(a[3]),endRow:parseInt(a[4]),endCol:parseInt(a[5]),text:a[6]})}return t}var n$={func:"function",const_func:"function",cls:"class",method:"method",iface:"interface",tdef:"type",enm:"enum",struct_def:"struct",trait_def:"trait",impl_def:"impl"},vP=new Set(["class","struct","impl","trait"]);function _P(e,t,r,n=200){let i=e[t]||"";if(!i.trimEnd().endsWith("{")&&!i.trimEnd().endsWith(":")){let a=e.slice(t,Math.min(t+10,r+1)).join(`
+`),s=a.indexOf("{");s!==-1&&s<500&&(i=a.slice(0,s).replace(/\n/g," ").replace(/\s+/g," ").trim())}return i=i.replace(/\s*[{:]\s*$/,"").trim(),i.length>n&&(i=i.slice(0,n-3)+"..."),i}function yP(e,t){let r=[],n=!1;for(let o=t-1;o>=0;o--){let i=e[o].trim();if(i===""){if(n)break;continue}if(i.startsWith("/**")||i.startsWith("*")||i.startsWith("*/")||i.startsWith("//")||i.startsWith("///")||i.startsWith("//!")||i.startsWith("#")||i.startsWith("@"))r.unshift(e[o]),n=!0;else break}return r.length>0?r.join(`
+`).trim():void 0}function $P(e,t,r){for(let n=t+1;n<=Math.min(t+3,r);n++){let o=e[n]?.trim();if(o){if(o.startsWith('"""')||o.startsWith("'''"))return o;break}}}function bP(e,t,r,n,o,i){switch(i){case"javascript":case"typescript":case"tsx":return n.some(a=>t>=a.startRow&&r<=a.endRow);case"python":return!e.startsWith("_");case"go":return e.length>0&&e[0]===e[0].toUpperCase()&&e[0]!==e[0].toLowerCase();case"rust":return o[t]?.trimStart().startsWith("pub")??!1;default:return!0}}function d$(e,t,r){let n=[],o=[],i=[],a=[];for(let c of e)for(let u of c.captures)u.tag==="exp"&&i.push({startRow:u.startRow,endRow:u.endRow}),u.tag==="imp"&&o.push(u.text||t[u.startRow]?.trim()||"");for(let c of e){let u=c.captures.find(E=>n$[E.tag]),l=c.captures.find(E=>E.tag==="name");if(!u)continue;let d=l?.text||"anonymous",p=u.startRow,f=u.endRow,g=n$[u.tag],h=yP(t,p),_=r==="python"?$P(t,p,f):void 0,b={name:d,kind:g,signature:_P(t,p,f),jsdoc:h||_,lineStart:p,lineEnd:f,exported:bP(d,p,f,i,t,r)};vP.has(g)&&(b.children=[],a.push({sym:b,startRow:p,endRow:f})),n.push(b)}let s=new Set;for(let c of a)for(let u of n)u!==c.sym&&u.lineStart>c.startRow&&u.lineEnd<=c.endRow&&(u.kind==="function"&&(u.kind="method"),c.sym.children.push(u),s.add(u));return{symbols:n.filter(c=>!s.has(c)),imports:o}}function js(e,t){let r=a$(t),n=e.split(`
+`),o=s$(r);if(!o)return{filePath:t,language:r,symbols:[],imports:[],totalLines:n.length,foldedTokenEstimate:50};let i=c$(r),a=u$(i),s=t.slice(t.lastIndexOf("."))||".txt",c=(0,Et.mkdtempSync)((0,Kt.join)((0,Pf.tmpdir)(),"smart-src-")),u=(0,Kt.join)(c,`source${s}`);(0,Et.writeFileSync)(u,e);try{let l=hP(a,u,o),d=d$(l,n,r),p=zn({filePath:t,language:r,symbols:d.symbols,imports:d.imports,totalLines:n.length,foldedTokenEstimate:0});return{filePath:t,language:r,symbols:d.symbols,imports:d.imports,totalLines:n.length,foldedTokenEstimate:Math.ceil(p.length/4)}}finally{(0,Et.rmSync)(c,{recursive:!0,force:!0})}}function p$(e){let t=new Map,r=new Map;for(let n of e){let o=a$(n.relativePath);r.has(o)||r.set(o,[]),r.get(o).push(n)}for(let[n,o]of r){let i=s$(n);if(!i){for(let l of o){let d=l.content.split(`
+`);t.set(l.relativePath,{filePath:l.relativePath,language:n,symbols:[],imports:[],totalLines:d.length,foldedTokenEstimate:50})}continue}let a=c$(n),s=u$(a),c=o.map(l=>l.absolutePath),u=l$(s,c,i);for(let l of o){let d=l.content.split(`
+`),p=u.get(l.absolutePath)||[],f=d$(p,d,n),g=zn({filePath:l.relativePath,language:n,symbols:f.symbols,imports:f.imports,totalLines:d.length,foldedTokenEstimate:0});t.set(l.relativePath,{filePath:l.relativePath,language:n,symbols:f.symbols,imports:f.imports,totalLines:d.length,foldedTokenEstimate:Math.ceil(g.length/4)})}}return t}function zn(e){let t=[];if(t.push(`\u{1F4C1} ${e.filePath} (${e.language}, ${e.totalLines} lines)`),t.push(""),e.imports.length>0){t.push(` \u{1F4E6} Imports: ${e.imports.length} statements`);for(let r of e.imports.slice(0,10))t.push(` ${r}`);e.imports.length>10&&t.push(` ... +${e.imports.length-10} more`),t.push("")}for(let r of e.symbols)t.push(f$(r," "));return t.join(`
+`)}function f$(e,t){let r=[],n=xP(e.kind),o=e.exported?" [exported]":"",i=e.lineStart===e.lineEnd?`L${e.lineStart+1}`:`L${e.lineStart+1}-${e.lineEnd+1}`;if(r.push(`${t}${n} ${e.name}${o} (${i})`),r.push(`${t} ${e.signature}`),e.jsdoc){let s=e.jsdoc.split(`
+`).find(c=>{let u=c.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").trim();return u.length>0&&!u.startsWith("/**")});if(s){let c=s.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").replace(/['"`]{3}$/,"").trim();c&&r.push(`${t} \u{1F4AC} ${c}`)}}if(e.children&&e.children.length>0)for(let a of e.children)r.push(f$(a,t+" "));return r.join(`
+`)}function xP(e){return{function:"\u0192",method:"\u0192",class:"\u25C6",interface:"\u25C7",type:"\u25C7",const:"\u25CF",variable:"\u25CB",export:"\u2192",struct:"\u25C6",enum:"\u25A3",trait:"\u25C7",impl:"\u25C8",property:"\u25CB",getter:"\u21E2",setter:"\u21E0"}[e]||"\xB7"}function m$(e,t,r){let n=js(e,t),o=u=>{for(let l of u){if(l.name===r)return l;if(l.children){let d=o(l.children);if(d)return d}}return null},i=o(n.symbols);if(!i)return null;let a=e.split(`
`),s=i.lineStart;for(let u=i.lineStart-1;u>=0;u--){let l=a[u].trim();if(l===""||l.startsWith("*")||l.startsWith("/**")||l.startsWith("///")||l.startsWith("//")||l.startsWith("#")||l.startsWith("@")||l==="*/")s=u;else break}let c=a.slice(s,i.lineEnd+1).join(`
`);return`// \u{1F4CD} ${t} L${s+1}-${i.lineEnd+1}
-${c}`}var _P=new Set([".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".go",".rs",".rb",".java",".cs",".cpp",".c",".h",".hpp",".swift",".kt",".php",".vue",".svelte"]),yP=new Set(["node_modules",".git","dist","build",".next","__pycache__",".venv","venv","env",".env","target","vendor",".cache",".turbo","coverage",".nyc_output",".claude",".smart-file-read"]),$P=512*1024;async function*a$(e,t,r=20){if(r<=0)return;let n;try{n=await(0,Sn.readdir)(e,{withFileTypes:!0})}catch{return}for(let o of n){if(o.name.startsWith(".")&&o.name!=="."||yP.has(o.name))continue;let i=(0,pi.join)(e,o.name);if(o.isDirectory())yield*a$(i,t,r-1);else if(o.isFile()){let a=o.name.slice(o.name.lastIndexOf("."));_P.has(a)&&(yield i)}}}async function bP(e){try{let t=await(0,Sn.stat)(e);if(t.size>$P||t.size===0)return null;let r=await(0,Sn.readFile)(e,"utf-8");return r.slice(0,1e3).includes("\0")?null:r}catch{return null}}async function s$(e,t,r={}){let n=r.maxResults||20,o=t.toLowerCase(),i=o.split(/[\s_\-./]+/).filter(h=>h.length>0),a=[];for await(let h of a$(e,e)){if(r.filePattern&&!(0,pi.relative)(e,h).toLowerCase().includes(r.filePattern.toLowerCase()))continue;let _=await bP(h);_&&a.push({absolutePath:h,relativePath:(0,pi.relative)(e,h),content:_})}let s=n$(a),c=[],u=[],l=0;for(let[h,_]of s){l+=xP(_);let E=Os(h.toLowerCase(),i)>0,I=[],A=(j,Le)=>{for(let de of j){let Kt=0,Qe="",Ht=Os(de.name.toLowerCase(),i);Ht>0&&(Kt+=Ht*3,Qe="name match"),de.signature.toLowerCase().includes(o)&&(Kt+=2,Qe=Qe?`${Qe} + signature`:"signature match"),de.jsdoc&&de.jsdoc.toLowerCase().includes(o)&&(Kt+=1,Qe=Qe?`${Qe} + jsdoc`:"jsdoc match"),Kt>0&&(E=!0,I.push({filePath:h,symbolName:Le?`${Le}.${de.name}`:de.name,kind:de.kind,signature:de.signature,jsdoc:de.jsdoc,lineStart:de.lineStart,lineEnd:de.lineEnd,matchReason:Qe})),de.children&&A(de.children,de.name)}};A(_.symbols),E&&(c.push(_),u.push(...I))}u.sort((h,_)=>{let b=Os(h.symbolName.toLowerCase(),i);return Os(_.symbolName.toLowerCase(),i)-b});let d=u.slice(0,n),m=new Set(d.map(h=>h.filePath)),p=c.filter(h=>m.has(h.filePath)).slice(0,n),g=p.reduce((h,_)=>h+_.foldedTokenEstimate,0);return{foldedFiles:p,matchingSymbols:d,totalFilesScanned:a.length,totalSymbolsFound:l,tokenEstimate:g}}function Os(e,t){let r=0;for(let n of t)if(e===n)r+=10;else if(e.includes(n))r+=5;else{let o=0,i=0;for(let a of n){let s=e.indexOf(a,o);s!==-1&&(i++,o=s+1)}i===n.length&&(r+=1)}return r}function xP(e){let t=e.symbols.length;for(let r of e.symbols)r.children&&(t+=r.children.length);return t}function c$(e,t){let r=[];if(r.push(`\u{1F50D} Smart Search: "${t}"`),r.push(` Scanned ${e.totalFilesScanned} files, found ${e.totalSymbolsFound} symbols`),r.push(` ${e.matchingSymbols.length} matches across ${e.foldedFiles.length} files (~${e.tokenEstimate} tokens for folded view)`),r.push(""),e.matchingSymbols.length===0)return r.push(" No matching symbols found."),r.join(`
+${c}`}var SP=new Set([".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".go",".rs",".rb",".java",".cs",".cpp",".c",".h",".hpp",".swift",".kt",".php",".vue",".svelte"]),wP=new Set(["node_modules",".git","dist","build",".next","__pycache__",".venv","venv","env",".env","target","vendor",".cache",".turbo","coverage",".nyc_output",".claude",".smart-file-read"]),zP=512*1024;async function*h$(e,t,r=20){if(r<=0)return;let n;try{n=await(0,In.readdir)(e,{withFileTypes:!0})}catch{return}for(let o of n){if(o.name.startsWith(".")&&o.name!=="."||wP.has(o.name))continue;let i=(0,gi.join)(e,o.name);if(o.isDirectory())yield*h$(i,t,r-1);else if(o.isFile()){let a=o.name.slice(o.name.lastIndexOf("."));SP.has(a)&&(yield i)}}}async function IP(e){try{let t=await(0,In.stat)(e);if(t.size>zP||t.size===0)return null;let r=await(0,In.readFile)(e,"utf-8");return r.slice(0,1e3).includes("\0")?null:r}catch{return null}}async function g$(e,t,r={}){let n=r.maxResults||20,o=t.toLowerCase(),i=o.split(/[\s_\-./]+/).filter(h=>h.length>0),a=[];for await(let h of h$(e,e)){if(r.filePattern&&!(0,gi.relative)(e,h).toLowerCase().includes(r.filePattern.toLowerCase()))continue;let _=await IP(h);_&&a.push({absolutePath:h,relativePath:(0,gi.relative)(e,h),content:_})}let s=p$(a),c=[],u=[],l=0;for(let[h,_]of s){l+=EP(_);let E=Ns(h.toLowerCase(),i)>0,I=[],A=(j,Le)=>{for(let de of j){let Ht=0,et="",Gt=Ns(de.name.toLowerCase(),i);Gt>0&&(Ht+=Gt*3,et="name match"),de.signature.toLowerCase().includes(o)&&(Ht+=2,et=et?`${et} + signature`:"signature match"),de.jsdoc&&de.jsdoc.toLowerCase().includes(o)&&(Ht+=1,et=et?`${et} + jsdoc`:"jsdoc match"),Ht>0&&(E=!0,I.push({filePath:h,symbolName:Le?`${Le}.${de.name}`:de.name,kind:de.kind,signature:de.signature,jsdoc:de.jsdoc,lineStart:de.lineStart,lineEnd:de.lineEnd,matchReason:et})),de.children&&A(de.children,de.name)}};A(_.symbols),E&&(c.push(_),u.push(...I))}u.sort((h,_)=>{let b=Ns(h.symbolName.toLowerCase(),i);return Ns(_.symbolName.toLowerCase(),i)-b});let d=u.slice(0,n),p=new Set(d.map(h=>h.filePath)),f=c.filter(h=>p.has(h.filePath)).slice(0,n),g=f.reduce((h,_)=>h+_.foldedTokenEstimate,0);return{foldedFiles:f,matchingSymbols:d,totalFilesScanned:a.length,totalSymbolsFound:l,tokenEstimate:g}}function Ns(e,t){let r=0;for(let n of t)if(e===n)r+=10;else if(e.includes(n))r+=5;else{let o=0,i=0;for(let a of n){let s=e.indexOf(a,o);s!==-1&&(i++,o=s+1)}i===n.length&&(r+=1)}return r}function EP(e){let t=e.symbols.length;for(let r of e.symbols)r.children&&(t+=r.children.length);return t}function v$(e,t){let r=[];if(r.push(`\u{1F50D} Smart Search: "${t}"`),r.push(` Scanned ${e.totalFilesScanned} files, found ${e.totalSymbolsFound} symbols`),r.push(` ${e.matchingSymbols.length} matches across ${e.foldedFiles.length} files (~${e.tokenEstimate} tokens for folded view)`),r.push(""),e.matchingSymbols.length===0)return r.push(" No matching symbols found."),r.join(`
`);r.push("\u2500\u2500 Matching Symbols \u2500\u2500"),r.push("");for(let n of e.matchingSymbols){if(r.push(` ${n.kind} ${n.symbolName} (${n.filePath}:${n.lineStart+1})`),r.push(` ${n.signature}`),n.jsdoc){let o=n.jsdoc.split(`
-`).find(i=>i.replace(/^[\s*/]+/,"").trim().length>0);o&&r.push(` \u{1F4AC} ${o.replace(/^[\s*/]+/,"").trim()}`)}r.push("")}r.push("\u2500\u2500 Folded File Views \u2500\u2500"),r.push("");for(let n of e.foldedFiles)r.push(kn(n)),r.push("");return r.push("\u2500\u2500 Actions \u2500\u2500"),r.push(" To see full implementation: use smart_unfold with file path and symbol name"),r.join(`
-`)}var Tf=require("node:fs/promises"),js=require("node:path"),kP="10.5.2";console.log=(...e)=>{ve.error("CONSOLE","Intercepted console output (MCP protocol protection)",void 0,{args:e})};var SP=Wy(),wP=Ky(),mi=`http://${wP}:${SP}`,u$={search:"/api/search",timeline:"/api/timeline"};async function l$(e,t){ve.debug("SYSTEM","\u2192 Worker API",void 0,{endpoint:e,params:t});try{let r=new URLSearchParams;for(let[a,s]of Object.entries(t))s!=null&&r.append(a,String(s));let n=`${mi}${e}?${r}`,o=await fetch(n);if(!o.ok){let a=await o.text();throw new Error(`Worker API error (${o.status}): ${a}`)}let i=await o.json();return ve.debug("SYSTEM","\u2190 Worker API success",void 0,{endpoint:e}),i}catch(r){return ve.error("SYSTEM","\u2190 Worker API error",{endpoint:e},r),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function zP(e,t){ve.debug("HTTP","Worker API request (POST)",void 0,{endpoint:e});try{let r=`${mi}${e}`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let i=await n.text();throw new Error(`Worker API error (${n.status}): ${i}`)}let o=await n.json();return ve.debug("HTTP","Worker API success (POST)",void 0,{endpoint:e}),{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(r){return ve.error("HTTP","Worker API error (POST)",{endpoint:e},r),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function IP(){try{return(await fetch(`${mi}/api/health`)).ok}catch(e){return ve.debug("SYSTEM","Worker health check failed",{},e),!1}}var d$=[{name:"__IMPORTANT",description:`3-LAYER WORKFLOW (ALWAYS FOLLOW):
+`).find(i=>i.replace(/^[\s*/]+/,"").trim().length>0);o&&r.push(` \u{1F4AC} ${o.replace(/^[\s*/]+/,"").trim()}`)}r.push("")}r.push("\u2500\u2500 Folded File Views \u2500\u2500"),r.push("");for(let n of e.foldedFiles)r.push(zn(n)),r.push("");return r.push("\u2500\u2500 Actions \u2500\u2500"),r.push(" To see full implementation: use smart_unfold with file path and symbol name"),r.join(`
+`)}var Of=require("node:fs/promises"),Ke=require("node:path"),jf=require("node:child_process"),Nf=require("node:fs"),Ds=require("node:os"),TP="10.5.2";console.log=(...e)=>{pe.error("CONSOLE","Intercepted console output (MCP protocol protection)",void 0,{args:e})};var PP=t$(),OP=r$(),_i=`http://${OP}:${PP}`,_$={search:"/api/search",timeline:"/api/timeline"};async function y$(e,t){pe.debug("SYSTEM","\u2192 Worker API",void 0,{endpoint:e,params:t});try{let r=new URLSearchParams;for(let[a,s]of Object.entries(t))s!=null&&r.append(a,String(s));let n=`${_i}${e}?${r}`,o=await fetch(n);if(!o.ok){let a=await o.text();throw new Error(`Worker API error (${o.status}): ${a}`)}let i=await o.json();return pe.debug("SYSTEM","\u2190 Worker API success",void 0,{endpoint:e}),i}catch(r){return pe.error("SYSTEM","\u2190 Worker API error",{endpoint:e},r),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function $$(e,t){pe.debug("HTTP","Worker API request (POST)",void 0,{endpoint:e});try{let r=`${_i}${e}`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){let i=await n.text();throw new Error(`Worker API error (${n.status}): ${i}`)}let o=await n.json();return pe.debug("HTTP","Worker API success (POST)",void 0,{endpoint:e}),{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(r){return pe.error("HTTP","Worker API error (POST)",{endpoint:e},r),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function b$(){try{return(await fetch(`${_i}/api/health`)).ok}catch(e){return pe.debug("SYSTEM","Worker health check failed",{},e),!1}}var x$=[{name:"__IMPORTANT",description:`3-LAYER WORKFLOW (ALWAYS FOLLOW):
1. search(query) \u2192 Get index with IDs (~50-100 tokens/result)
2. timeline(anchor=ID) \u2192 Get context around interesting results
3. get_observations([IDs]) \u2192 Fetch full details ONLY for filtered IDs
@@ -134,8 +134,8 @@ NEVER fetch full details without filtering first. 10x token savings.`,inputSchem
\`get_observations(ids=[...])\` # ALWAYS batch for 2+ items
Returns: Complete details (~500-1000 tokens/result)
-**Why:** 10x token savings. Never fetch full details without filtering first.`}]})},{name:"search",description:"Step 1: Search memory. Returns index with IDs. Params: query, limit, project, type, obs_type, dateStart, dateEnd, offset, orderBy",inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async e=>{let t=u$.search;return await l$(t,e)}},{name:"timeline",description:"Step 2: Get context around results. Params: anchor (observation ID) OR query (finds anchor automatically), depth_before, depth_after, project",inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async e=>{let t=u$.timeline;return await l$(t,e)}},{name:"get_observations",description:"Step 3: Fetch full details for filtered IDs. Params: ids (array of observation IDs, required), orderBy, limit, project",inputSchema:{type:"object",properties:{ids:{type:"array",items:{type:"number"},description:"Array of observation IDs to fetch (required)"}},required:["ids"],additionalProperties:!0},handler:async e=>await zP("/api/observations/batch",e)},{name:"smart_search",description:"Search codebase for symbols, functions, classes using tree-sitter AST parsing. Returns folded structural views with token counts. Use path parameter to scope the search.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search term \u2014 matches against symbol names, file names, and file content"},path:{type:"string",description:"Root directory to search (default: current working directory)"},max_results:{type:"number",description:"Maximum results to return (default: 20)"},file_pattern:{type:"string",description:'Substring filter for file paths (e.g. ".ts", "src/services")'}},required:["query"]},handler:async e=>{let t=(0,js.resolve)(e.path||process.cwd()),r=await s$(t,e.query,{maxResults:e.max_results||20,filePattern:e.file_pattern});return{content:[{type:"text",text:c$(r,e.query)}]}}},{name:"smart_unfold",description:"Expand a specific symbol (function, class, method) from a file. Returns the full source code of just that symbol. Use after smart_search or smart_outline to read specific code.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"},symbol_name:{type:"string",description:"Name of the symbol to unfold (function, class, method, etc.)"}},required:["file_path","symbol_name"]},handler:async e=>{let t=(0,js.resolve)(e.file_path),r=await(0,Tf.readFile)(t,"utf-8"),n=i$(r,t,e.symbol_name);if(n)return{content:[{type:"text",text:n}]};let o=Ps(r,t);if(o.symbols.length>0){let i=o.symbols.map(a=>` - ${a.name} (${a.kind})`).join(`
+**Why:** 10x token savings. Never fetch full details without filtering first.`}]})},{name:"search",description:"Step 1: Search memory. Returns index with IDs. Params: query, limit, project, type, obs_type, dateStart, dateEnd, offset, orderBy",inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async e=>{let t=_$.search;return await y$(t,e)}},{name:"timeline",description:"Step 2: Get context around results. Params: anchor (observation ID) OR query (finds anchor automatically), depth_before, depth_after, project",inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async e=>{let t=_$.timeline;return await y$(t,e)}},{name:"get_observations",description:"Step 3: Fetch full details for filtered IDs. Params: ids (array of observation IDs, required), orderBy, limit, project",inputSchema:{type:"object",properties:{ids:{type:"array",items:{type:"number"},description:"Array of observation IDs to fetch (required)"}},required:["ids"],additionalProperties:!0},handler:async e=>await $$("/api/observations/batch",e)},{name:"save_memory",description:"Save a memory/observation to the database. Use this to persist important discoveries, decisions, patterns, or context for future sessions.",inputSchema:{type:"object",properties:{text:{type:"string",description:"The memory content to save (required)"},title:{type:"string",description:"Short title for the memory (auto-generated from text if omitted)"},project:{type:"string",description:"Project name to associate with (uses default if omitted)"}},required:["text"]},handler:async e=>await $$("/api/memory/save",e)},{name:"smart_search",description:"Search codebase for symbols, functions, classes using tree-sitter AST parsing. Returns folded structural views with token counts. Use path parameter to scope the search.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search term \u2014 matches against symbol names, file names, and file content"},path:{type:"string",description:"Root directory to search (default: current working directory)"},max_results:{type:"number",description:"Maximum results to return (default: 20)"},file_pattern:{type:"string",description:'Substring filter for file paths (e.g. ".ts", "src/services")'}},required:["query"]},handler:async e=>{let t=(0,Ke.resolve)(e.path||process.cwd()),r=await g$(t,e.query,{maxResults:e.max_results||20,filePattern:e.file_pattern});return{content:[{type:"text",text:v$(r,e.query)}]}}},{name:"smart_unfold",description:"Expand a specific symbol (function, class, method) from a file. Returns the full source code of just that symbol. Use after smart_search or smart_outline to read specific code.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"},symbol_name:{type:"string",description:"Name of the symbol to unfold (function, class, method, etc.)"}},required:["file_path","symbol_name"]},handler:async e=>{let t=(0,Ke.resolve)(e.file_path),r=await(0,Of.readFile)(t,"utf-8"),n=m$(r,t,e.symbol_name);if(n)return{content:[{type:"text",text:n}]};let o=js(r,t);if(o.symbols.length>0){let i=o.symbols.map(a=>` - ${a.name} (${a.kind})`).join(`
`);return{content:[{type:"text",text:`Symbol "${e.symbol_name}" not found in ${e.file_path}.
Available symbols:
-${i}`}]}}return{content:[{type:"text",text:`Could not parse ${e.file_path}. File may be unsupported or empty.`}]}}},{name:"smart_outline",description:"Get structural outline of a file \u2014 shows all symbols (functions, classes, methods, types) with signatures but bodies folded. Much cheaper than reading the full file.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"}},required:["file_path"]},handler:async e=>{let t=(0,js.resolve)(e.file_path),r=await(0,Tf.readFile)(t,"utf-8"),n=Ps(r,t);return n.symbols.length>0?{content:[{type:"text",text:kn(n)}]}:{content:[{type:"text",text:`Could not parse ${e.file_path}. File may use an unsupported language or be empty.`}]}}}],Pf=new ks({name:"claude-mem",version:kP},{capabilities:{tools:{}}});Pf.setRequestHandler(xd,async()=>({tools:d$.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))}));Pf.setRequestHandler(No,async e=>{let t=d$.find(r=>r.name===e.params.name);if(!t)throw new Error(`Unknown tool: ${e.params.name}`);try{return await t.handler(e.params.arguments||{})}catch(r){return ve.error("SYSTEM","Tool execution failed",{tool:e.params.name},r),{content:[{type:"text",text:`Tool execution failed: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}});var EP=3e4,fi=null;function TP(){if(process.platform==="win32")return;let e=process.ppid;fi=setInterval(()=>{(process.ppid===1||process.ppid!==e)&&(ve.info("SYSTEM","Parent process died, self-exiting to prevent orphan",{initialPpid:e,currentPpid:process.ppid}),Of())},EP),fi.unref&&fi.unref()}function Of(){fi&&clearInterval(fi),ve.info("SYSTEM","MCP server shutting down"),process.exit(0)}process.on("SIGTERM",Of);process.on("SIGINT",Of);async function PP(){let e=new ws;await Pf.connect(e),ve.info("SYSTEM","Claude-mem search server started"),TP(),setTimeout(async()=>{await IP()?ve.info("SYSTEM","Worker available",void 0,{workerUrl:mi}):(ve.error("SYSTEM","Worker not available",void 0,{workerUrl:mi}),ve.error("SYSTEM","Tools will fail until Worker is started"),ve.error("SYSTEM","Start Worker with: npm run worker:restart"))},0)}PP().catch(e=>{ve.error("SYSTEM","Fatal error",void 0,e),process.exit(0)});
+${i}`}]}}return{content:[{type:"text",text:`Could not parse ${e.file_path}. File may be unsupported or empty.`}]}}},{name:"smart_outline",description:"Get structural outline of a file \u2014 shows all symbols (functions, classes, methods, types) with signatures but bodies folded. Much cheaper than reading the full file.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"}},required:["file_path"]},handler:async e=>{let t=(0,Ke.resolve)(e.file_path),r=await(0,Of.readFile)(t,"utf-8"),n=js(r,t);return n.symbols.length>0?{content:[{type:"text",text:zn(n)}]}:{content:[{type:"text",text:`Could not parse ${e.file_path}. File may use an unsupported language or be empty.`}]}}}],Df=new ws({name:"claude-mem",version:TP},{capabilities:{tools:{}}});Df.setRequestHandler(wd,async()=>({tools:x$.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))}));Df.setRequestHandler(Ao,async e=>{let t=x$.find(r=>r.name===e.params.name);if(!t)throw new Error(`Unknown tool: ${e.params.name}`);try{return await t.handler(e.params.arguments||{})}catch(r){return pe.error("SYSTEM","Tool execution failed",{tool:e.params.name},r),{content:[{type:"text",text:`Tool execution failed: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}});async function jP(){let e=(0,Ke.join)((0,Ds.homedir)(),".claude","plugins","marketplaces","thedotmack"),t=typeof __dirname<"u"?__dirname:(0,Ke.dirname)((0,Ke.resolve)(process.argv[1]||"")),r=[(0,Ke.join)(t,"worker-cli.js"),(0,Ke.join)(e,"plugin","scripts","worker-cli.js"),(0,Ke.join)(e,"scripts","worker-cli.js")],o=process.platform==="win32"?[(0,Ke.join)((0,Ds.homedir)(),".bun","bin","bun.exe")]:[(0,Ke.join)((0,Ds.homedir)(),".bun","bin","bun"),"/usr/local/bin/bun","/opt/homebrew/bin/bun"],i=null;try{(0,jf.execSync)("bun --version",{stdio:"pipe"}),i="bun"}catch{for(let a of o)if((0,Nf.existsSync)(a)){i=a;break}}if(!i)return pe.warn("SYSTEM","Cannot auto-start worker: bun not found"),!1;for(let a of r)if((0,Nf.existsSync)(a))try{if(pe.info("SYSTEM","Auto-starting worker service",{cliPath:a}),(0,jf.execSync)(`"${i}" "${a}" start`,{stdio:"pipe",timeout:15e3,env:{...process.env}}),await new Promise(s=>setTimeout(s,2e3)),await b$())return pe.info("SYSTEM","Worker auto-started successfully"),!0}catch(s){pe.warn("SYSTEM","Worker auto-start attempt failed",{cliPath:a},s instanceof Error?s:void 0)}return!1}var NP=3e4,vi=null;function DP(){if(process.platform==="win32")return;let e=process.ppid;vi=setInterval(()=>{(process.ppid===1||process.ppid!==e)&&(pe.info("SYSTEM","Parent process died, self-exiting to prevent orphan",{initialPpid:e,currentPpid:process.ppid}),Rf())},NP),vi.unref&&vi.unref()}function Rf(){vi&&clearInterval(vi),pe.info("SYSTEM","MCP server shutting down"),process.exit(0)}process.on("SIGTERM",Rf);process.on("SIGINT",Rf);async function RP(){let e=new Is;await Df.connect(e),pe.info("SYSTEM","Claude-mem search server started"),DP(),setTimeout(async()=>{await b$()?pe.info("SYSTEM","Worker available",void 0,{workerUrl:_i}):(pe.info("SYSTEM","Worker not available, attempting auto-start"),await jP()||(pe.error("SYSTEM","Worker not available and auto-start failed",void 0,{workerUrl:_i}),pe.error("SYSTEM","Memory tools will fail until Worker is started"),pe.error("SYSTEM","Start Worker with: npm run worker:restart")))},0)}RP().catch(e=>{pe.error("SYSTEM","Fatal error",void 0,e),process.exit(0)});
diff --git a/plugin/templates/claude-mem.instructions.md b/plugin/templates/claude-mem.instructions.md
new file mode 100644
index 000000000..3b8da3565
--- /dev/null
+++ b/plugin/templates/claude-mem.instructions.md
@@ -0,0 +1,25 @@
+## MCP Tool Requirements (MANDATORY)
+
+When the `claude-mem` MCP is available, you MUST use these tools. This is NOT optional.
+
+### Code Exploration — use claude-mem tools INSTEAD of built-in tools:
+
+| Task | USE THIS | NOT THIS |
+|------|----------|----------|
+| Find symbols, functions, classes | `smart_search` | Grep, Glob |
+| Understand file structure | `smart_outline` | Read (full file) |
+| Read a specific function | `smart_unfold` | Read (full file) |
+| Recall past work / decisions | `search` → `timeline` → `get_observations` | Starting from scratch |
+
+### Memory — save as you work, NOT at the end:
+
+- **`save_memory`**: Use IMMEDIATELY when you discover something important — migration gotchas, architectural patterns, debugging insights, user preferences
+- Do NOT batch memories at the end of a session. Save them inline as you work.
+- Before starting work, ALWAYS check memory first: `search` for relevant past observations about the task at hand
+
+### When built-in tools are acceptable:
+
+- `Read` is fine for reading templates, config files, or files without parseable symbols
+- `Grep` is fine for searching inside a specific file you already identified
+- `Bash` for running commands, tests, git operations
+- `Edit`/`Write` for making changes (claude-mem has no edit tools)
diff --git a/plugin/templates/vscode-mcp.json b/plugin/templates/vscode-mcp.json
new file mode 100644
index 000000000..6a6306284
--- /dev/null
+++ b/plugin/templates/vscode-mcp.json
@@ -0,0 +1,9 @@
+{
+ "servers": {
+ "claude-mem": {
+ "type": "stdio",
+ "command": "node",
+ "args": ["REPLACE_WITH_ABSOLUTE_PATH/node_modules/claude-mem/plugin/scripts/mcp-server.cjs"]
+ }
+ }
+}
diff --git a/src/servers/mcp-server.ts b/src/servers/mcp-server.ts
index c48a77ede..d7f280e49 100644
--- a/src/servers/mcp-server.ts
+++ b/src/servers/mcp-server.ts
@@ -31,7 +31,10 @@ import { getWorkerPort, getWorkerHost } from '../shared/worker-utils.js';
import { searchCodebase, formatSearchResults } from '../services/smart-file-read/search.js';
import { parseFile, formatFoldedView, unfoldSymbol } from '../services/smart-file-read/parser.js';
import { readFile } from 'node:fs/promises';
-import { resolve } from 'node:path';
+import { resolve, join, dirname } from 'node:path';
+import { execSync } from 'node:child_process';
+import { existsSync } from 'node:fs';
+import { homedir } from 'node:os';
/**
* Worker HTTP API configuration
@@ -238,6 +241,31 @@ NEVER fetch full details without filtering first. 10x token savings.`,
return await callWorkerAPIPost('/api/observations/batch', args);
}
},
+ {
+ name: 'save_memory',
+ description: 'Save a memory/observation to the database. Use this to persist important discoveries, decisions, patterns, or context for future sessions.',
+ inputSchema: {
+ type: 'object',
+ properties: {
+ text: {
+ type: 'string',
+ description: 'The memory content to save (required)'
+ },
+ title: {
+ type: 'string',
+ description: 'Short title for the memory (auto-generated from text if omitted)'
+ },
+ project: {
+ type: 'string',
+ description: 'Project name to associate with (uses default if omitted)'
+ }
+ },
+ required: ['text']
+ },
+ handler: async (args: any) => {
+ return await callWorkerAPIPost('/api/memory/save', args);
+ }
+ },
{
name: 'smart_search',
description: 'Search codebase for symbols, functions, classes using tree-sitter AST parsing. Returns folded structural views with token counts. Use path parameter to scope the search.',
@@ -398,6 +426,70 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
}
});
+/**
+ * Attempt to start the worker service if not running.
+ * Tries the worker-cli.js script from the installed plugin location.
+ */
+async function tryStartWorker(): Promise {
+ const marketplaceRoot = join(homedir(), '.claude', 'plugins', 'marketplaces', 'thedotmack');
+
+ // Resolve worker-cli.js relative to this MCP server script's location
+ // This works regardless of install method (npm global, marketplace, repo)
+ const scriptDir = typeof __dirname !== 'undefined' ? __dirname : dirname(resolve(process.argv[1] || ''));
+
+ const workerCliPaths = [
+ join(scriptDir, 'worker-cli.js'), // Same directory as mcp-server (npm global or built plugin)
+ join(marketplaceRoot, 'plugin', 'scripts', 'worker-cli.js'),
+ join(marketplaceRoot, 'scripts', 'worker-cli.js'),
+ ];
+
+ // Find bun executable
+ const isWin = process.platform === 'win32';
+ const bunPaths = isWin
+ ? [join(homedir(), '.bun', 'bin', 'bun.exe')]
+ : [join(homedir(), '.bun', 'bin', 'bun'), '/usr/local/bin/bun', '/opt/homebrew/bin/bun'];
+
+ let bunPath: string | null = null;
+ try {
+ execSync('bun --version', { stdio: 'pipe' });
+ bunPath = 'bun';
+ } catch {
+ for (const p of bunPaths) {
+ if (existsSync(p)) { bunPath = p; break; }
+ }
+ }
+
+ if (!bunPath) {
+ logger.warn('SYSTEM', 'Cannot auto-start worker: bun not found');
+ return false;
+ }
+
+ for (const cliPath of workerCliPaths) {
+ if (!existsSync(cliPath)) continue;
+
+ try {
+ logger.info('SYSTEM', 'Auto-starting worker service', { cliPath });
+ execSync(`"${bunPath}" "${cliPath}" start`, {
+ stdio: 'pipe',
+ timeout: 15000,
+ env: { ...process.env },
+ });
+
+ // Wait briefly then verify
+ await new Promise(r => setTimeout(r, 2000));
+ if (await verifyWorkerConnection()) {
+ logger.info('SYSTEM', 'Worker auto-started successfully');
+ return true;
+ }
+ } catch (error) {
+ logger.warn('SYSTEM', 'Worker auto-start attempt failed', { cliPath },
+ error instanceof Error ? error : undefined);
+ }
+ }
+
+ return false;
+}
+
// Parent heartbeat: self-exit when parent dies (ppid=1 on Unix means orphaned)
// Prevents orphaned MCP server processes when Claude Code exits unexpectedly
const HEARTBEAT_INTERVAL_MS = 30_000;
@@ -444,13 +536,17 @@ async function main() {
// Start parent heartbeat to detect orphaned MCP servers
startParentHeartbeat();
- // Check Worker availability in background
+ // Check Worker availability in background, auto-start if needed
setTimeout(async () => {
const workerAvailable = await verifyWorkerConnection();
if (!workerAvailable) {
- logger.error('SYSTEM', 'Worker not available', undefined, { workerUrl: WORKER_BASE_URL });
- logger.error('SYSTEM', 'Tools will fail until Worker is started');
- logger.error('SYSTEM', 'Start Worker with: npm run worker:restart');
+ logger.info('SYSTEM', 'Worker not available, attempting auto-start');
+ const started = await tryStartWorker();
+ if (!started) {
+ logger.error('SYSTEM', 'Worker not available and auto-start failed', undefined, { workerUrl: WORKER_BASE_URL });
+ logger.error('SYSTEM', 'Memory tools will fail until Worker is started');
+ logger.error('SYSTEM', 'Start Worker with: npm run worker:restart');
+ }
} else {
logger.info('SYSTEM', 'Worker available', undefined, { workerUrl: WORKER_BASE_URL });
}