@github/copilot 0.0.336-3 → 0.0.336-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -4
- package/package.json +2 -2
- package/sdk/index.js +4 -4
- package/sdk/index.js.map +2 -2
package/sdk/index.js
CHANGED
|
@@ -160,7 +160,7 @@ Note: ${d.warning}`);I.debug(`Code review completed: ${h}`);let p=i.map(Z=>Z.met
|
|
|
160
160
|
* Cannot be used if the specified path already exists
|
|
161
161
|
* Parent directories must exist before creating the file
|
|
162
162
|
* Path *must* be absolute
|
|
163
|
-
`,input_schema:{type:"object",properties:{path:{description:"Absolute path to file to create.",type:"string"},file_text:{description:"The content of the file to be created.",type:"string"}},required:["path","file_text"]},callback:(c,n)=>l.callback({...c,command:"create"},n),summariseIntention:c=>l.summariseIntention({...c,command:"create"}),safeForTelemetry:!0},{name:"str_replace",description:"Tool for making string replacements in files.\n * Replaces exactly one occurrence of `old_str` with `new_str` in the specified file\n * When called multiple times in a single response, edits are independently made in the order calls are specified\n * The `old_str` parameter must match EXACTLY one or more consecutive lines from the original file\n * If `old_str` is not unique in the file, replacement will not be performed\n * Make sure to include enough context in `old_str` to make it unique\n * Path *must* be absolute\n ",input_schema:{type:"object",properties:{path:{description:"Absolute path to file to edit.",type:"string"},old_str:{description:"The string in the file to replace. Leading and ending whitespaces from file content should be preserved!",type:"string"},new_str:{description:"The new string to replace old_str with.",type:"string"}},required:["path","old_str"]},callback:(c,n)=>l.callback({...c,command:"str_replace"},n),shutdown:async()=>await l.shutdown(),summariseIntention:c=>l.summariseIntention({...c,command:"str_replace"}),safeForTelemetry:!0}]},FU=(t,I,e)=>{let l=new RU,c=new Map,n={truncateBasedOn:"tokenCount",truncateStyle:"middle"};return I.debug(`str_replace_editor: default options: ${JSON.stringify(n,null,2)}`),{name:"str_replace_editor",description:"Editing tool for viewing, creating and editing files\n * State is persistent across command calls and discussions with the user\n * If `path` is a file, `view` displays the result of applying `cat -n`. If `path` is a directory, `view` lists non-hidden files and directories up to 2 levels deep\n * The `create` command cannot be used if the specified `path` already exists, or if parent directories don't exist\n * If a `command` generates a long output, output will be truncated and marked with `<file too long...`\n * Path *must* be absolute\n\n Notes for using the `str_replace` command:\n * The `old_str` parameter should match EXACTLY one or more consecutive lines from the original file\n * If the `old_str` parameter is not unique in the file, replacement will not be performed. Make sure to include enough context in `old_str` to make it unique\n * The `new_str` parameter should contain the edited lines that should replace the `old_str`",input_schema:{type:"object",properties:{command:{type:"string",enum:["view","create","str_replace","insert"],description:`The commands to run. Allowed options are: ${Array.from(P$).map(r=>`\`${r}\``).join(", ")}.`},file_text:{description:"Required parameter of `create` command; the content of the file to be created.",type:"string"},insert_line:{description:"Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.",type:"integer"},new_str:{description:"Required parameter of `str_replace` command containing the new string. Required parameter of `insert` command containing the string to insert.",type:"string"},old_str:{description:"Required parameter of `str_replace` command containing the string in `path` to replace. Leading and ending whitespaces from file content should be preserved!",type:"string"},path:{description:"Absolute path to file or directory.",type:"string"},view_range:{description:"Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.",items:{type:"integer"},type:"array"}},required:["command","path"]},shutdown:async()=>{let r=l.getTrackedEditsJsonArrString();return l.reset(),{kind:"telemetry",telemetry:{event:"str_replace_editor_shutdown",properties:{trackedEdits:r},metrics:{},restrictedProperties:{}}}},summariseIntention:r=>{switch(r.command){case"create":return`create a new file at ${r.path}.`;case"view":return`view the file at ${r.path}.`;case"str_replace":case"insert":return`edit the file at ${r.path}.`;default:{let s=r;return`unknown command: ${JSON.stringify(r)}`}}},callback:async(r,s)=>{if(r.command==="view")return a(r,s);let o=c.get(r.path);return o||(o=new yU(I),c.set(r.path,o)),o.enqueue(()=>a(r,s))},safeForTelemetry:!0};async function a(r,s){let o={...n,...s?.toolOptions||{}};I.debug(r.command+": "+r.path);let d={properties:{command:LyI(r.command),options:JSON.stringify(o),inputs:JSON.stringify(Object.keys(r)),resolvedPathAgainstCwd:"false",fileExtension:r.path?WU(r.path):void 0},metrics:{resultLength:0,resultForLlmLength:0,responseTokenLimit:s?.truncationOptions?.tokenLimit},restrictedProperties:{}},i;try{if(typeof r.path!="string"||!r.path)return Gs("failure",d,{},"A path parameter is required, and must be a non-empty string.","",void 0,"Path not provided");
|
|
163
|
+
`,input_schema:{type:"object",properties:{path:{description:"Absolute path to file to create.",type:"string"},file_text:{description:"The content of the file to be created.",type:"string"}},required:["path","file_text"]},callback:(c,n)=>l.callback({...c,command:"create"},n),summariseIntention:c=>l.summariseIntention({...c,command:"create"}),safeForTelemetry:!0},{name:"str_replace",description:"Tool for making string replacements in files.\n * Replaces exactly one occurrence of `old_str` with `new_str` in the specified file\n * When called multiple times in a single response, edits are independently made in the order calls are specified\n * The `old_str` parameter must match EXACTLY one or more consecutive lines from the original file\n * If `old_str` is not unique in the file, replacement will not be performed\n * Make sure to include enough context in `old_str` to make it unique\n * Path *must* be absolute\n ",input_schema:{type:"object",properties:{path:{description:"Absolute path to file to edit.",type:"string"},old_str:{description:"The string in the file to replace. Leading and ending whitespaces from file content should be preserved!",type:"string"},new_str:{description:"The new string to replace old_str with.",type:"string"}},required:["path","old_str"]},callback:(c,n)=>l.callback({...c,command:"str_replace"},n),shutdown:async()=>await l.shutdown(),summariseIntention:c=>l.summariseIntention({...c,command:"str_replace"}),safeForTelemetry:!0}]},FU=(t,I,e)=>{let l=new RU,c=new Map,n={truncateBasedOn:"tokenCount",truncateStyle:"middle"};return I.debug(`str_replace_editor: default options: ${JSON.stringify(n,null,2)}`),{name:"str_replace_editor",description:"Editing tool for viewing, creating and editing files\n * State is persistent across command calls and discussions with the user\n * If `path` is a file, `view` displays the result of applying `cat -n`. If `path` is a directory, `view` lists non-hidden files and directories up to 2 levels deep\n * The `create` command cannot be used if the specified `path` already exists, or if parent directories don't exist\n * If a `command` generates a long output, output will be truncated and marked with `<file too long...`\n * Path *must* be absolute\n\n Notes for using the `str_replace` command:\n * The `old_str` parameter should match EXACTLY one or more consecutive lines from the original file\n * If the `old_str` parameter is not unique in the file, replacement will not be performed. Make sure to include enough context in `old_str` to make it unique\n * The `new_str` parameter should contain the edited lines that should replace the `old_str`",input_schema:{type:"object",properties:{command:{type:"string",enum:["view","create","str_replace","insert"],description:`The commands to run. Allowed options are: ${Array.from(P$).map(r=>`\`${r}\``).join(", ")}.`},file_text:{description:"Required parameter of `create` command; the content of the file to be created.",type:"string"},insert_line:{description:"Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.",type:"integer"},new_str:{description:"Required parameter of `str_replace` command containing the new string. Required parameter of `insert` command containing the string to insert.",type:"string"},old_str:{description:"Required parameter of `str_replace` command containing the string in `path` to replace. Leading and ending whitespaces from file content should be preserved!",type:"string"},path:{description:"Absolute path to file or directory.",type:"string"},view_range:{description:"Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.",items:{type:"integer"},type:"array"}},required:["command","path"]},shutdown:async()=>{let r=l.getTrackedEditsJsonArrString();return l.reset(),{kind:"telemetry",telemetry:{event:"str_replace_editor_shutdown",properties:{trackedEdits:r},metrics:{},restrictedProperties:{}}}},summariseIntention:r=>{switch(r.command){case"create":return`create a new file at ${r.path}.`;case"view":return`view the file at ${r.path}.`;case"str_replace":case"insert":return`edit the file at ${r.path}.`;default:{let s=r;return`unknown command: ${JSON.stringify(r)}`}}},callback:async(r,s)=>{if(r.command==="view")return a(r,s);let o=c.get(r.path);return o||(o=new yU(I),c.set(r.path,o)),o.enqueue(()=>a(r,s))},safeForTelemetry:!0};async function a(r,s){let o={...n,...s?.toolOptions||{}};I.debug(r.command+": "+r.path);let d={properties:{command:LyI(r.command),options:JSON.stringify(o),inputs:JSON.stringify(Object.keys(r)),resolvedPathAgainstCwd:"false",fileExtension:r.path?WU(r.path):void 0},metrics:{resultLength:0,resultForLlmLength:0,responseTokenLimit:s?.truncationOptions?.tokenLimit},restrictedProperties:{}},i;try{if(typeof r.path!="string"||!r.path)return Gs("failure",d,{},"A path parameter is required, and must be a non-empty string.","",void 0,"Path not provided");let h=process.cwd();if(h){let p=await gyI(r.path,h);if(!Fae(p))return I.debug(`Could not resolve path "${r.path}" against agent cwd "${h}". Need to use absolute path.`),Gs("failure",d,{},`Path "${r.path}" is not absolute. Please provide an absolute path.`,"",void 0,"Path not absolute");p!==r.path&&(I.debug(`using resolved path ${p} based on agent cwd ${h}`),r.path=p,d.properties.resolvedPathAgainstCwd="true")}switch(r.command){case"view":i=await Xae(r,d,I,s);break;case"str_replace":i=await wae(r,d,t.permissions,I,s);break;case"create":i=await Hae(r,d,t.permissions,I,s);break;case"insert":i=await Eae(r,d,t.permissions,I,s);break;default:{let p=r,Z=p.command?`Unknown command: ${p.command}`:"No command provided";return Promise.reject(new Error(`${Z}. Allowed commands are: ${Array.from(P$).join(", ")}`))}}}catch(h){i=Gs("failure",d,{},`Failed to execute \`str_replace_editor\` tool with arguments: ${JSON.stringify(r)} due to error: ${h}`,"",void 0,`Unhandled error: ${h}`)}return i.resultType!=="rejected"&&i.resultType!=="denied"&&r.path&&r.command&&typeof r.path=="string"&&typeof r.command=="string"&&l.trackEdit(r.path,LyI(r.command),i.resultType,s?.toolCallId),i}};async function Xae(t,I,e,l){let c={truncateBasedOn:"tokenCount",truncateStyle:"middle",...l?.toolOptions||{}},n,a,r="";if(!Yae(t.path))return Gs("failure",I,{properties:{viewType:"unknown"}},`Path ${t.path} does not exist. Please provide a valid path.`,"",void 0,"Path does not exist");if((await Rae(t.path)).isDirectory()){n="directory";let d=await Vae(t.path);a=d.join(`
|
|
164
164
|
`);let i=`@@ -1,0 +1,${d.length} @@`;r=hv(void 0,t.path,`${i}
|
|
165
165
|
${d.map(h=>` ${h}`).join(`
|
|
166
166
|
`)}`)}else{n="file";let d,i;t.view_range&&t.view_range.length>=1&&(d=t.view_range.at(0),i=t.view_range.at(1)),d===void 0&&(d=1,i=void 0);let h=(await q$(t.path,"utf-8")).split(`
|
|
@@ -365,14 +365,14 @@ ${this.outputBuffer.substring(I).trim()}`:""}shutdown(){if(this.process){this.is
|
|
|
365
365
|
}
|
|
366
366
|
`;return this.outputBuffer="",this.trySendInput(l)}async waitForCommandCompletion(){let I,e="";for(I=this.readOutput();I?.exitCode===void 0&&this.process;I=this.readOutput()){if(this.onPartialOutputChanged&&I){let l=I.output;l!==e&&(e=l,this.onPartialOutputChanged(I))}await new Promise(l=>{setTimeout(l,zRe)})}if(this.isCommandInProgress=!1,I)return I;throw new Error("terminal unexpectedly exited before command completed")}tryExtractOutputFromDoneMarker(){let I=this.outputBuffer.lastIndexOf(yZ),e=this.outputBuffer.match(BRe);if(I<0||!e)return;let l=this.outputBuffer.lastIndexOf(a4),c=this.outputBuffer.substring(I+yZ.length,l).trim(),n=parseInt(e[1]);return{output:c,exitCode:n,truncated:this.wasTruncated}}static ensureShellIsSupported(I){return e(t.shellIsSupportedCache,I,async()=>{if(I==="powershell"){let l="timeout";try{await Promise.race([xRe(fRe)("pwsh.exe --version",{timeout:2e4}),new Promise((c,n)=>setTimeout(()=>n(l),1e4))])}catch(c){throw t.shellIsSupportedCache.delete(I),new Error(c===l?"Timed out checking whether PowerShell 6+ (pwsh) is installed":`PowerShell 6+ (pwsh) is not available. Please install it from https://aka.ms/powershell. Error: ${c}`)}}});function e(l,c,n){return l.has(c)||l.set(c,n(c)),l.get(c)}}};async function URe(t,I,e){await t;let l=128,c=100;for(let n=0;n<e.length;n+=l){let a=e.substring(n,n+l);I.write(a),await new Promise(r=>setTimeout(r,c))}}var r4=600,B5I=10,Nj=class{constructor(I,e=!1){this.config=I;this.inTests=e;this.shellConfig=I.shellConfig||Xi.bash,this.shellDisplayName=this.shellConfig.displayName,this.defaultSessionId=`default-${this.shellConfig.shellType}-session`}sessions=new Map;shutdownSessionsInfos=[];shellConfig;defaultSessionId;shellDisplayName;getShellTool(){return{name:this.shellConfig.shellToolName,description:`Runs a ${this.shellDisplayName} command in an interactive ${this.shellDisplayName} session.
|
|
367
367
|
${['* When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.',"* You don't have access to the internet via this tool.","* You can run Python, Node.js and Go code with the `python`, `node` and `go` commands.",`* Each sessionId identifies a persistent ${this.shellDisplayName} session. State is saved across command calls and discussions with the user.`,`* \`timeout\` parameter must be greater than the default timeout of ${this.defaultTimeoutInMs()/1e3} seconds and less than ${r4} seconds}. Give long-running commands enough time to complete.`,`* If the command does not complete within "timeout" seconds, the tool will return a status indicating that it is still running asynchronously. You can then use \`${this.shellConfig.readShellToolName}\` or \`${this.shellConfig.stopShellToolName}\`.`,...this.shellConfig.descriptionLines].join(`
|
|
368
|
-
`)}`,input_schema:{type:"object",properties:{command:{type:"string",description:`The ${this.shellDisplayName} command and arguments to run.`},description:{type:"string",description:'A short human-readable description of what the command does, limited to 100 characters, for example "List files in the current directory", "Install dependencies with npm" or "Run RSpec tests".'},timeout:{type:"integer",description:`(Optional) Maximum time in seconds to wait for the command to complete when "async" is false. Default is ${this.defaultTimeoutInMs()/1e3} seconds if not provided.`},sessionId:{type:"string",description:`Indicates which ${this.shellDisplayName} session to run the command in. Multiple sessions may be used to run different commands at the same time.`},async:{type:"boolean",description:`If true, runs the command asynchronously. You can send input to the command using the \`${this.shellConfig.writeShellToolName}\` tool and read its output using the \`${this.shellConfig.readShellToolName}\` tool.`}},required:["command","description","sessionId","async"]},shutdown:this.shutdown.bind(this),summariseIntention:I=>I.description||I.command,callback:async(I,e)=>{if(!this.config.permissions.requestRequired)return this.shellTool(e?.toolCallId,I);let l=await this.shellConfig.assessScriptSafety(I.command);if(l.result==="failed")return{textResultForLlm:l.reason,resultType:"failure",error:l.reason,sessionLog:`<error>${l.reason}</error>`,toolTelemetry:{}};let c=await this.config.permissions.request({kind:"shell",fullCommandText:I.command,intention:I.description,commands:l.commands,possiblePaths:l.possiblePaths,hasWriteFileRedirection:l.hasWriteFileRedirection,canOfferSessionApproval:l.canOfferSessionApproval});switch(c.kind){case"approved":return this.shellTool(e?.toolCallId,I);case"denied-by-rules":return gU(c.rules);case"denied-no-approval-rule-and-could-not-request-from-user":return AU;case"denied-interactively-by-user":return QU;default:iV(c,`Unhandled permission result kind: ${c}`)}},
|
|
368
|
+
`)}`,input_schema:{type:"object",properties:{command:{type:"string",description:`The ${this.shellDisplayName} command and arguments to run.`},description:{type:"string",description:'A short human-readable description of what the command does, limited to 100 characters, for example "List files in the current directory", "Install dependencies with npm" or "Run RSpec tests".'},timeout:{type:"integer",description:`(Optional) Maximum time in seconds to wait for the command to complete when "async" is false. Default is ${this.defaultTimeoutInMs()/1e3} seconds if not provided.`},sessionId:{type:"string",description:`Indicates which ${this.shellDisplayName} session to run the command in. Multiple sessions may be used to run different commands at the same time.`},async:{type:"boolean",description:`If true, runs the command asynchronously. You can send input to the command using the \`${this.shellConfig.writeShellToolName}\` tool and read its output using the \`${this.shellConfig.readShellToolName}\` tool.`}},required:["command","description","sessionId","async"]},shutdown:this.shutdown.bind(this),summariseIntention:I=>I.description||I.command,callback:async(I,e)=>{if(!this.config.permissions.requestRequired)return this.shellTool(e?.toolCallId,I);let l=await this.shellConfig.assessScriptSafety(I.command);if(l.result==="failed")return{textResultForLlm:l.reason,resultType:"failure",error:l.reason,sessionLog:`<error>${l.reason}</error>`,toolTelemetry:{}};let c=await this.config.permissions.request({kind:"shell",fullCommandText:I.command,intention:I.description,commands:l.commands,possiblePaths:l.possiblePaths,hasWriteFileRedirection:l.hasWriteFileRedirection,canOfferSessionApproval:l.canOfferSessionApproval});switch(c.kind){case"approved":return this.shellTool(e?.toolCallId,I);case"denied-by-rules":return gU(c.rules);case"denied-no-approval-rule-and-could-not-request-from-user":return AU;case"denied-interactively-by-user":return QU;default:iV(c,`Unhandled permission result kind: ${c}`)}},safeForTelemetry:!0}}getWriteShellTool(){return{name:this.shellConfig.writeShellToolName,description:`Sends input to the specified command or ${this.shellDisplayName} session.
|
|
369
369
|
* This tool can be used to send input to a running ${this.shellDisplayName} command or an interactive console app.
|
|
370
370
|
* ${this.shellDisplayName} commands are run in an interactive ${this.shellDisplayName} session with a TTY device and ${this.shellDisplayName} command processor.
|
|
371
371
|
* sessionId (required) must match the sessionId used to invoke the async ${this.shellConfig.shellToolName} command.
|
|
372
372
|
* You can send text, {up}, {down}, {left}, {right}, {enter}, and {backspace} as input.
|
|
373
373
|
* Some applications present a list of options to select from. The selection is often denoted using \u276F, >, or different formatting.
|
|
374
374
|
* When presented with a list of items, make a selection by sending arrow keys like {up} or {down} to move the selection to your chosen item and then {enter} to select it.
|
|
375
|
-
* The response will contain any output read after "delay" seconds. Delay should be appropriate for the task and never less than 10 seconds.`,input_schema:{type:"object",properties:{sessionId:{type:"string",description:`Indicates which ${this.shellDisplayName} session to run the command in. Multiple sessions may be used to run different commands at the same time.`},input:{type:"string",description:"The input to send to the command or session."},delay:{type:"integer",description:"(Optional) The amount of time in seconds to wait before reading the output that resulted from the input."}},required:["sessionId","input"]},shutdown:this.shutdown.bind(this),callback:this.writeShellTool.bind(this),
|
|
375
|
+
* The response will contain any output read after "delay" seconds. Delay should be appropriate for the task and never less than 10 seconds.`,input_schema:{type:"object",properties:{sessionId:{type:"string",description:`Indicates which ${this.shellDisplayName} session to run the command in. Multiple sessions may be used to run different commands at the same time.`},input:{type:"string",description:"The input to send to the command or session."},delay:{type:"integer",description:"(Optional) The amount of time in seconds to wait before reading the output that resulted from the input."}},required:["sessionId","input"]},shutdown:this.shutdown.bind(this),callback:this.writeShellTool.bind(this),safeForTelemetry:!0}}getReadShellTool(){return{name:this.shellConfig.readShellToolName,description:`Reads output from a ${this.shellDisplayName} command.
|
|
376
376
|
* Reads the output of a command running in an "async" ${this.shellDisplayName} session.
|
|
377
377
|
* The sessionId must be the same one used to invoke the ${this.shellConfig.shellToolName} command.
|
|
378
378
|
* You can call this tool multiple times to read output produced since the last call.
|
|
@@ -1174,7 +1174,7 @@ Answer:
|
|
|
1174
1174
|
This tool is used to perform a semantic search of the codebase to find relevant information based on the question asked.
|
|
1175
1175
|
* It leverages advanced AI techniques to understand the context and semantics of the codebase.
|
|
1176
1176
|
* Use this tool when you need to find information that is not easily accessible through traditional search methods.
|
|
1177
|
-
`,input_schema:{type:"object",properties:{question:{type:"string",description:"A question about the codebase. It should reference by name any topics, specific file names, and concepts that are relevant to the question and specify the desired output format."}},required:["question"]},callback:async l=>{let c,n=Ix(t),a="",r="",s=n.split("/");if(s.length===2){[a,r]=s,e.info("Searching for repository insights");try{c=await foI(l.question,a,r,I,e),e.info(`Blackbird results: ${c}`)}catch(o){e.error(`Error occurred while searching for repository insights: ${o}`)}}return{resultType:"success",textResultForLlm:c??"No results found.",toolTelemetry:{}}}}}async function JfI(t,I,e,l,c,n,a){let r=await xfI(t),s={cwd:r.shellTool.cwd,...t},o=await X1e(s,e,l),d=vfI(e)?[new ZK(l,e,c,n,t,t.location,YU(),a).getSearch()]:[],i=t.splitEditingTools?III(s,l,e):[FU(s,l,e)];return[r.shellTool,...r.otherTools??[],...o,...d,...i,AyI(s,I,e,l,c),Cl(e,ex)?WhI(s,l,c,e):void 0,t?.requireReasoning?eII(s):void 0,Cl(e,YyI)?VyI:void 0,await w1e(t,e,l,c)].filter(h=>h!==void 0)}async function LfI(t,I){let e=await xfI(t),l={cwd:e.shellTool.cwd,...t},c=t.splitEditingTools?III(l,I):[FU(l,I)];return[e.shellTool,...e.otherTools??[],...c,t?.requireReasoning?eII(l):void 0].filter(n=>n!==void 0)}async function A1e(t,I,e,l,c,n,a){return[...await JfI(t,I,e,l,c,n,a),yyI(t,l)]}var kfI=t=>({...Sh,supports:{...Sh.supports,reasoning:t?.thinkingMode?!0:Sh.supports?.reasoning}}),Sh={supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!1},createPR:{toolInit:JfI,jitInstructions:LoI},prDetails:{},respondToPRComment:{toolInit:A1e,jitInstructions:LoI}},ffI=t=>({"sweagent-capi":{"claude-3.5-sonnet":{...Sh,supports:{tool_choice:!1,reasoning:!1}},"claude-3.7-sonnet":{...Sh,supports:{tool_choice:!1,reasoning:!1,vision:!0}},"claude-sonnet-4":{...Sh,supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!0,vision:!0},toolConfigOverrides:{splitEditingTools:!0}},"claude-sonnet-4.5":{...Sh,supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!0,vision:!0},toolConfigOverrides:{splitEditingTools:!0}},oswe:{...Sh,supports:{tool_choice:!0,reasoning:!0,vision:!0}},"oswe-prime":{...Sh,supports:{tool_choice:!0,reasoning:!0,vision:!0}},"gpt-5":{...Sh,supports:{tool_choice:!0,reasoning:!0,parallel_tool_calls:!0,vision:!0,steering:!0},toolConfigOverrides:{splitEditingTools:!0}}}});async function xfI(t){let I=new Nj(t);return{shellTool:I.getShellTool(),otherTools:[I.getWriteShellTool(),I.getReadShellTool(),I.getStopShellTool()]}}async function X1e(t,I,e){if(GsI(I,"cloud"))return[new Q4(new Kj(I,e,void 0)).getStoreMemory()];if(GsI(I,"local")){let l=new Q4(new Dj(t.location));return[l.getStoreMemory(),l.getReadMemory()]}return[]}async function w1e(t,I,e,l){if(t.includeCodeQLTool){let c=new $s(e,l),n=I.swebench_base_commit??await c.getCurrentCommitHash(t.location);return new uU(t,c,n,I,e).getCodeQLCheckerTool()}}G();G();import{Writable as Pke}from"stream";G();G();G();G();G();var R={};da(R,{BRAND:()=>tve,DIRTY:()=>d0,EMPTY_PATH:()=>C1e,INVALID:()=>Fe,NEVER:()=>Xve,OK:()=>Tr,ParseStatus:()=>br,Schema:()=>ht,ZodAny:()=>KY,ZodArray:()=>Wu,ZodBigInt:()=>b0,ZodBoolean:()=>m0,ZodBranded:()=>F9,ZodCatch:()=>F0,ZodDate:()=>h0,ZodDefault:()=>y0,ZodDiscriminatedUnion:()=>NK,ZodEffects:()=>ri,ZodEnum:()=>V0,ZodError:()=>jG,ZodFirstPartyTypeKind:()=>Xe,ZodFunction:()=>VK,ZodIntersection:()=>W0,ZodIssueCode:()=>RI,ZodLazy:()=>N0,ZodLiteral:()=>Y0,ZodMap:()=>qH,ZodNaN:()=>$H,ZodNativeEnum:()=>R0,ZodNever:()=>Fb,ZodNull:()=>Z0,ZodNullable:()=>Th,ZodNumber:()=>i0,ZodObject:()=>DG,ZodOptional:()=>ni,ZodParsedType:()=>KI,ZodPipeline:()=>Q9,ZodPromise:()=>PY,ZodReadonly:()=>Q0,ZodRecord:()=>YK,ZodSchema:()=>ht,ZodSet:()=>_H,ZodString:()=>DY,ZodSymbol:()=>KH,ZodTransformer:()=>ri,ZodTuple:()=>Mh,ZodType:()=>ht,ZodUndefined:()=>p0,ZodUnion:()=>u0,ZodUnknown:()=>uu,ZodVoid:()=>PH,addIssueToContext:()=>BI,any:()=>OoI,array:()=>jr,bigint:()=>ave,boolean:()=>Ba,coerce:()=>g9,custom:()=>jfI,date:()=>rve,datetimeRegex:()=>MfI,defaultErrorMap:()=>pu,discriminatedUnion:()=>ToI,effect:()=>Yve,enum:()=>Nu,function:()=>Zve,getErrorMap:()=>TH,getParsedType:()=>Oh,instanceof:()=>cve,intersection:()=>mve,isAborted:()=>uK,isAsync:()=>jH,isDirty:()=>WK,isValid:()=>jY,late:()=>lve,lazy:()=>uve,literal:()=>Gl,makeIssue:()=>y9,map:()=>hve,nan:()=>nve,nativeEnum:()=>Wve,never:()=>dve,null:()=>ove,nullable:()=>Rve,number:()=>jh,object:()=>we,objectUtil:()=>zoI,oboolean:()=>Ave,onumber:()=>gve,optional:()=>Vve,ostring:()=>Qve,pipeline:()=>Fve,preprocess:()=>yve,promise:()=>Nve,quotelessJson:()=>H1e,record:()=>RK,set:()=>pve,setErrorMap:()=>v1e,strictObject:()=>bve,string:()=>EI,symbol:()=>sve,transformer:()=>Yve,tuple:()=>joI,undefined:()=>Gve,union:()=>Dr,unknown:()=>MoI,util:()=>zt,void:()=>ive});G();G();G();G();G();var zt;(function(t){t.assertEqual=c=>{};function I(c){}t.assertIs=I;function e(c){throw new Error}t.assertNever=e,t.arrayToEnum=c=>{let n={};for(let a of c)n[a]=a;return n},t.getValidEnumValues=c=>{let n=t.objectKeys(c).filter(r=>typeof c[c[r]]!="number"),a={};for(let r of n)a[r]=c[r];return t.objectValues(a)},t.objectValues=c=>t.objectKeys(c).map(function(n){return c[n]}),t.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{let n=[];for(let a in c)Object.prototype.hasOwnProperty.call(c,a)&&n.push(a);return n},t.find=(c,n)=>{for(let a of c)if(n(a))return a},t.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function l(c,n=" | "){return c.map(a=>typeof a=="string"?`'${a}'`:a).join(n)}t.joinValues=l,t.jsonStringifyReplacer=(c,n)=>typeof n=="bigint"?n.toString():n})(zt||(zt={}));var zoI;(function(t){t.mergeShapes=(I,e)=>({...I,...e})})(zoI||(zoI={}));var KI=zt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Oh=t=>{switch(typeof t){case"undefined":return KI.undefined;case"string":return KI.string;case"number":return Number.isNaN(t)?KI.nan:KI.number;case"boolean":return KI.boolean;case"function":return KI.function;case"bigint":return KI.bigint;case"symbol":return KI.symbol;case"object":return Array.isArray(t)?KI.array:t===null?KI.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?KI.promise:typeof Map<"u"&&t instanceof Map?KI.map:typeof Set<"u"&&t instanceof Set?KI.set:typeof Date<"u"&&t instanceof Date?KI.date:KI.object;default:return KI.unknown}};var RI=zt.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"]),H1e=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),jG=class t extends Error{get errors(){return this.issues}constructor(I){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};let e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=I}format(I){let e=I||function(n){return n.message},l={_errors:[]},c=n=>{for(let a of n.issues)if(a.code==="invalid_union")a.unionErrors.map(c);else if(a.code==="invalid_return_type")c(a.returnTypeError);else if(a.code==="invalid_arguments")c(a.argumentsError);else if(a.path.length===0)l._errors.push(e(a));else{let r=l,s=0;for(;s<a.path.length;){let o=a.path[s];s===a.path.length-1?(r[o]=r[o]||{_errors:[]},r[o]._errors.push(e(a))):r[o]=r[o]||{_errors:[]},r=r[o],s++}}};return c(this),l}static assert(I){if(!(I instanceof t))throw new Error(`Not a ZodError: ${I}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,zt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(I=e=>e.message){let e={},l=[];for(let c of this.issues)if(c.path.length>0){let n=c.path[0];e[n]=e[n]||[],e[n].push(I(c))}else l.push(I(c));return{formErrors:l,fieldErrors:e}}get formErrors(){return this.flatten()}};jG.create=t=>new jG(t);var E1e=(t,I)=>{let e;switch(t.code){case RI.invalid_type:t.received===KI.undefined?e="Required":e=`Expected ${t.expected}, received ${t.received}`;break;case RI.invalid_literal:e=`Invalid literal value, expected ${JSON.stringify(t.expected,zt.jsonStringifyReplacer)}`;break;case RI.unrecognized_keys:e=`Unrecognized key(s) in object: ${zt.joinValues(t.keys,", ")}`;break;case RI.invalid_union:e="Invalid input";break;case RI.invalid_union_discriminator:e=`Invalid discriminator value. Expected ${zt.joinValues(t.options)}`;break;case RI.invalid_enum_value:e=`Invalid enum value. Expected ${zt.joinValues(t.options)}, received '${t.received}'`;break;case RI.invalid_arguments:e="Invalid function arguments";break;case RI.invalid_return_type:e="Invalid function return type";break;case RI.invalid_date:e="Invalid date";break;case RI.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(e=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(e=`${e} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?e=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?e=`Invalid input: must end with "${t.validation.endsWith}"`:zt.assertNever(t.validation):t.validation!=="regex"?e=`Invalid ${t.validation}`:e="Invalid";break;case RI.too_small:t.type==="array"?e=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?e=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?e=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?e=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?e=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:e="Invalid input";break;case RI.too_big:t.type==="array"?e=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?e=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?e=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?e=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?e=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:e="Invalid input";break;case RI.custom:e="Invalid input";break;case RI.invalid_intersection_types:e="Intersection results could not be merged";break;case RI.not_multiple_of:e=`Number must be a multiple of ${t.multipleOf}`;break;case RI.not_finite:e="Number must be finite";break;default:e=I.defaultError,zt.assertNever(t)}return{message:e}},pu=E1e;var BfI=pu;function v1e(t){BfI=t}function TH(){return BfI}G();var y9=t=>{let{data:I,path:e,errorMaps:l,issueData:c}=t,n=[...e,...c.path||[]],a={...c,path:n};if(c.message!==void 0)return{...c,path:n,message:c.message};let r="",s=l.filter(o=>!!o).slice().reverse();for(let o of s)r=o(a,{data:I,defaultError:r}).message;return{...c,path:n,message:r}},C1e=[];function BI(t,I){let e=TH(),l=y9({issueData:I,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,e,e===pu?void 0:pu].filter(c=>!!c)});t.common.issues.push(l)}var br=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(I,e){let l=[];for(let c of e){if(c.status==="aborted")return Fe;c.status==="dirty"&&I.dirty(),l.push(c.value)}return{status:I.value,value:l}}static async mergeObjectAsync(I,e){let l=[];for(let c of e){let n=await c.key,a=await c.value;l.push({key:n,value:a})}return t.mergeObjectSync(I,l)}static mergeObjectSync(I,e){let l={};for(let c of e){let{key:n,value:a}=c;if(n.status==="aborted"||a.status==="aborted")return Fe;n.status==="dirty"&&I.dirty(),a.status==="dirty"&&I.dirty(),n.value!=="__proto__"&&(typeof a.value<"u"||c.alwaysSet)&&(l[n.value]=a.value)}return{status:I.value,value:l}}},Fe=Object.freeze({status:"aborted"}),d0=t=>({status:"dirty",value:t}),Tr=t=>({status:"valid",value:t}),uK=t=>t.status==="aborted",WK=t=>t.status==="dirty",jY=t=>t.status==="valid",jH=t=>typeof Promise<"u"&&t instanceof Promise;G();G();var Ge;(function(t){t.errToObj=I=>typeof I=="string"?{message:I}:I||{},t.toString=I=>typeof I=="string"?I:I?.message})(Ge||(Ge={}));var ai=class{constructor(I,e,l,c){this._cachedPath=[],this.parent=I,this.data=e,this._path=l,this._key=c}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}},zfI=(t,I)=>{if(jY(I))return{success:!0,data:I.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let e=new jG(t.common.issues);return this._error=e,this._error}}};function at(t){if(!t)return{};let{errorMap:I,invalid_type_error:e,required_error:l,description:c}=t;if(I&&(e||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return I?{errorMap:I,description:c}:{errorMap:(a,r)=>{let{message:s}=t;return a.code==="invalid_enum_value"?{message:s??r.defaultError}:typeof r.data>"u"?{message:s??l??r.defaultError}:a.code!=="invalid_type"?{message:r.defaultError}:{message:s??e??r.defaultError}},description:c}}var ht=class{get description(){return this._def.description}_getType(I){return Oh(I.data)}_getOrReturnCtx(I,e){return e||{common:I.parent.common,data:I.data,parsedType:Oh(I.data),schemaErrorMap:this._def.errorMap,path:I.path,parent:I.parent}}_processInputParams(I){return{status:new br,ctx:{common:I.parent.common,data:I.data,parsedType:Oh(I.data),schemaErrorMap:this._def.errorMap,path:I.path,parent:I.parent}}}_parseSync(I){let e=this._parse(I);if(jH(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(I){let e=this._parse(I);return Promise.resolve(e)}parse(I,e){let l=this.safeParse(I,e);if(l.success)return l.data;throw l.error}safeParse(I,e){let l={common:{issues:[],async:e?.async??!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:Oh(I)},c=this._parseSync({data:I,path:l.path,parent:l});return zfI(l,c)}"~validate"(I){let e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:Oh(I)};if(!this["~standard"].async)try{let l=this._parseSync({data:I,path:[],parent:e});return jY(l)?{value:l.value}:{issues:e.common.issues}}catch(l){l?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),e.common={issues:[],async:!0}}return this._parseAsync({data:I,path:[],parent:e}).then(l=>jY(l)?{value:l.value}:{issues:e.common.issues})}async parseAsync(I,e){let l=await this.safeParseAsync(I,e);if(l.success)return l.data;throw l.error}async safeParseAsync(I,e){let l={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:Oh(I)},c=this._parse({data:I,path:l.path,parent:l}),n=await(jH(c)?c:Promise.resolve(c));return zfI(l,n)}refine(I,e){let l=c=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(c):e;return this._refinement((c,n)=>{let a=I(c),r=()=>n.addIssue({code:RI.custom,...l(c)});return typeof Promise<"u"&&a instanceof Promise?a.then(s=>s?!0:(r(),!1)):a?!0:(r(),!1)})}refinement(I,e){return this._refinement((l,c)=>I(l)?!0:(c.addIssue(typeof e=="function"?e(l,c):e),!1))}_refinement(I){return new ri({schema:this,typeName:Xe.ZodEffects,effect:{type:"refinement",refinement:I}})}superRefine(I){return this._refinement(I)}constructor(I){this.spa=this.safeParseAsync,this._def=I,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:e=>this["~validate"](e)}}optional(){return ni.create(this,this._def)}nullable(){return Th.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wu.create(this)}promise(){return PY.create(this,this._def)}or(I){return u0.create([this,I],this._def)}and(I){return W0.create(this,I,this._def)}transform(I){return new ri({...at(this._def),schema:this,typeName:Xe.ZodEffects,effect:{type:"transform",transform:I}})}default(I){let e=typeof I=="function"?I:()=>I;return new y0({...at(this._def),innerType:this,defaultValue:e,typeName:Xe.ZodDefault})}brand(){return new F9({typeName:Xe.ZodBranded,type:this,...at(this._def)})}catch(I){let e=typeof I=="function"?I:()=>I;return new F0({...at(this._def),innerType:this,catchValue:e,typeName:Xe.ZodCatch})}describe(I){let e=this.constructor;return new e({...this._def,description:I})}pipe(I){return Q9.create(this,I)}readonly(){return Q0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},J1e=/^c[^\s-]{8,}$/i,L1e=/^[0-9a-z]+$/,k1e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,f1e=/^[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,x1e=/^[a-z0-9_-]{21}$/i,B1e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,z1e=/^[-+]?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)?)??$/,U1e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,S1e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",UoI,O1e=/^(?:(?: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])$/,M1e=/^(?:(?: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])$/,T1e=/^(([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]))$/,j1e=/^(([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])$/,D1e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,K1e=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,SfI="((\\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])))",P1e=new RegExp(`^${SfI}$`);function OfI(t){let I="[0-5]\\d";t.precision?I=`${I}\\.\\d{${t.precision}}`:t.precision==null&&(I=`${I}(\\.\\d+)?`);let e=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${I})${e}`}function q1e(t){return new RegExp(`^${OfI(t)}$`)}function MfI(t){let I=`${SfI}T${OfI(t)}`,e=[];return e.push(t.local?"Z?":"Z"),t.offset&&e.push("([+-]\\d{2}:?\\d{2})"),I=`${I}(${e.join("|")})`,new RegExp(`^${I}$`)}function _1e(t,I){return!!((I==="v4"||!I)&&O1e.test(t)||(I==="v6"||!I)&&T1e.test(t))}function $1e(t,I){if(!B1e.test(t))return!1;try{let[e]=t.split(".");if(!e)return!1;let l=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),c=JSON.parse(atob(l));return!(typeof c!="object"||c===null||"typ"in c&&c?.typ!=="JWT"||!c.alg||I&&c.alg!==I)}catch{return!1}}function Ive(t,I){return!!((I==="v4"||!I)&&M1e.test(t)||(I==="v6"||!I)&&j1e.test(t))}var DY=class t extends ht{_parse(I){if(this._def.coerce&&(I.data=String(I.data)),this._getType(I)!==KI.string){let n=this._getOrReturnCtx(I);return BI(n,{code:RI.invalid_type,expected:KI.string,received:n.parsedType}),Fe}let l=new br,c;for(let n of this._def.checks)if(n.kind==="min")I.data.length<n.value&&(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),l.dirty());else if(n.kind==="max")I.data.length>n.value&&(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),l.dirty());else if(n.kind==="length"){let a=I.data.length>n.value,r=I.data.length<n.value;(a||r)&&(c=this._getOrReturnCtx(I,c),a?BI(c,{code:RI.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&BI(c,{code:RI.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),l.dirty())}else if(n.kind==="email")U1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"email",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="emoji")UoI||(UoI=new RegExp(S1e,"u")),UoI.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"emoji",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="uuid")f1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"uuid",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="nanoid")x1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"nanoid",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="cuid")J1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"cuid",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="cuid2")L1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"cuid2",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="ulid")k1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"ulid",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="url")try{new URL(I.data)}catch{c=this._getOrReturnCtx(I,c),BI(c,{validation:"url",code:RI.invalid_string,message:n.message}),l.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"regex",code:RI.invalid_string,message:n.message}),l.dirty())):n.kind==="trim"?I.data=I.data.trim():n.kind==="includes"?I.data.includes(n.value,n.position)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),l.dirty()):n.kind==="toLowerCase"?I.data=I.data.toLowerCase():n.kind==="toUpperCase"?I.data=I.data.toUpperCase():n.kind==="startsWith"?I.data.startsWith(n.value)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:{startsWith:n.value},message:n.message}),l.dirty()):n.kind==="endsWith"?I.data.endsWith(n.value)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:{endsWith:n.value},message:n.message}),l.dirty()):n.kind==="datetime"?MfI(n).test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:"datetime",message:n.message}),l.dirty()):n.kind==="date"?P1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:"date",message:n.message}),l.dirty()):n.kind==="time"?q1e(n).test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:"time",message:n.message}),l.dirty()):n.kind==="duration"?z1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"duration",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="ip"?_1e(I.data,n.version)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"ip",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="jwt"?$1e(I.data,n.alg)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"jwt",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="cidr"?Ive(I.data,n.version)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"cidr",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="base64"?D1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"base64",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="base64url"?K1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"base64url",code:RI.invalid_string,message:n.message}),l.dirty()):zt.assertNever(n);return{status:l.value,value:I.data}}_regex(I,e,l){return this.refinement(c=>I.test(c),{validation:e,code:RI.invalid_string,...Ge.errToObj(l)})}_addCheck(I){return new t({...this._def,checks:[...this._def.checks,I]})}email(I){return this._addCheck({kind:"email",...Ge.errToObj(I)})}url(I){return this._addCheck({kind:"url",...Ge.errToObj(I)})}emoji(I){return this._addCheck({kind:"emoji",...Ge.errToObj(I)})}uuid(I){return this._addCheck({kind:"uuid",...Ge.errToObj(I)})}nanoid(I){return this._addCheck({kind:"nanoid",...Ge.errToObj(I)})}cuid(I){return this._addCheck({kind:"cuid",...Ge.errToObj(I)})}cuid2(I){return this._addCheck({kind:"cuid2",...Ge.errToObj(I)})}ulid(I){return this._addCheck({kind:"ulid",...Ge.errToObj(I)})}base64(I){return this._addCheck({kind:"base64",...Ge.errToObj(I)})}base64url(I){return this._addCheck({kind:"base64url",...Ge.errToObj(I)})}jwt(I){return this._addCheck({kind:"jwt",...Ge.errToObj(I)})}ip(I){return this._addCheck({kind:"ip",...Ge.errToObj(I)})}cidr(I){return this._addCheck({kind:"cidr",...Ge.errToObj(I)})}datetime(I){return typeof I=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:I}):this._addCheck({kind:"datetime",precision:typeof I?.precision>"u"?null:I?.precision,offset:I?.offset??!1,local:I?.local??!1,...Ge.errToObj(I?.message)})}date(I){return this._addCheck({kind:"date",message:I})}time(I){return typeof I=="string"?this._addCheck({kind:"time",precision:null,message:I}):this._addCheck({kind:"time",precision:typeof I?.precision>"u"?null:I?.precision,...Ge.errToObj(I?.message)})}duration(I){return this._addCheck({kind:"duration",...Ge.errToObj(I)})}regex(I,e){return this._addCheck({kind:"regex",regex:I,...Ge.errToObj(e)})}includes(I,e){return this._addCheck({kind:"includes",value:I,position:e?.position,...Ge.errToObj(e?.message)})}startsWith(I,e){return this._addCheck({kind:"startsWith",value:I,...Ge.errToObj(e)})}endsWith(I,e){return this._addCheck({kind:"endsWith",value:I,...Ge.errToObj(e)})}min(I,e){return this._addCheck({kind:"min",value:I,...Ge.errToObj(e)})}max(I,e){return this._addCheck({kind:"max",value:I,...Ge.errToObj(e)})}length(I,e){return this._addCheck({kind:"length",value:I,...Ge.errToObj(e)})}nonempty(I){return this.min(1,Ge.errToObj(I))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(I=>I.kind==="datetime")}get isDate(){return!!this._def.checks.find(I=>I.kind==="date")}get isTime(){return!!this._def.checks.find(I=>I.kind==="time")}get isDuration(){return!!this._def.checks.find(I=>I.kind==="duration")}get isEmail(){return!!this._def.checks.find(I=>I.kind==="email")}get isURL(){return!!this._def.checks.find(I=>I.kind==="url")}get isEmoji(){return!!this._def.checks.find(I=>I.kind==="emoji")}get isUUID(){return!!this._def.checks.find(I=>I.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(I=>I.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(I=>I.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(I=>I.kind==="cuid2")}get isULID(){return!!this._def.checks.find(I=>I.kind==="ulid")}get isIP(){return!!this._def.checks.find(I=>I.kind==="ip")}get isCIDR(){return!!this._def.checks.find(I=>I.kind==="cidr")}get isBase64(){return!!this._def.checks.find(I=>I.kind==="base64")}get isBase64url(){return!!this._def.checks.find(I=>I.kind==="base64url")}get minLength(){let I=null;for(let e of this._def.checks)e.kind==="min"&&(I===null||e.value>I)&&(I=e.value);return I}get maxLength(){let I=null;for(let e of this._def.checks)e.kind==="max"&&(I===null||e.value<I)&&(I=e.value);return I}};DY.create=t=>new DY({checks:[],typeName:Xe.ZodString,coerce:t?.coerce??!1,...at(t)});function eve(t,I){let e=(t.toString().split(".")[1]||"").length,l=(I.toString().split(".")[1]||"").length,c=e>l?e:l,n=Number.parseInt(t.toFixed(c).replace(".","")),a=Number.parseInt(I.toFixed(c).replace(".",""));return n%a/10**c}var i0=class t extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(I){if(this._def.coerce&&(I.data=Number(I.data)),this._getType(I)!==KI.number){let n=this._getOrReturnCtx(I);return BI(n,{code:RI.invalid_type,expected:KI.number,received:n.parsedType}),Fe}let l,c=new br;for(let n of this._def.checks)n.kind==="int"?zt.isInteger(I.data)||(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.invalid_type,expected:"integer",received:"float",message:n.message}),c.dirty()):n.kind==="min"?(n.inclusive?I.data<n.value:I.data<=n.value)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),c.dirty()):n.kind==="max"?(n.inclusive?I.data>n.value:I.data>=n.value)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),c.dirty()):n.kind==="multipleOf"?eve(I.data,n.value)!==0&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.not_multiple_of,multipleOf:n.value,message:n.message}),c.dirty()):n.kind==="finite"?Number.isFinite(I.data)||(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.not_finite,message:n.message}),c.dirty()):zt.assertNever(n);return{status:c.value,value:I.data}}gte(I,e){return this.setLimit("min",I,!0,Ge.toString(e))}gt(I,e){return this.setLimit("min",I,!1,Ge.toString(e))}lte(I,e){return this.setLimit("max",I,!0,Ge.toString(e))}lt(I,e){return this.setLimit("max",I,!1,Ge.toString(e))}setLimit(I,e,l,c){return new t({...this._def,checks:[...this._def.checks,{kind:I,value:e,inclusive:l,message:Ge.toString(c)}]})}_addCheck(I){return new t({...this._def,checks:[...this._def.checks,I]})}int(I){return this._addCheck({kind:"int",message:Ge.toString(I)})}positive(I){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ge.toString(I)})}negative(I){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ge.toString(I)})}nonpositive(I){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ge.toString(I)})}nonnegative(I){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ge.toString(I)})}multipleOf(I,e){return this._addCheck({kind:"multipleOf",value:I,message:Ge.toString(e)})}finite(I){return this._addCheck({kind:"finite",message:Ge.toString(I)})}safe(I){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ge.toString(I)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ge.toString(I)})}get minValue(){let I=null;for(let e of this._def.checks)e.kind==="min"&&(I===null||e.value>I)&&(I=e.value);return I}get maxValue(){let I=null;for(let e of this._def.checks)e.kind==="max"&&(I===null||e.value<I)&&(I=e.value);return I}get isInt(){return!!this._def.checks.find(I=>I.kind==="int"||I.kind==="multipleOf"&&zt.isInteger(I.value))}get isFinite(){let I=null,e=null;for(let l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(e===null||l.value>e)&&(e=l.value):l.kind==="max"&&(I===null||l.value<I)&&(I=l.value)}return Number.isFinite(e)&&Number.isFinite(I)}};i0.create=t=>new i0({checks:[],typeName:Xe.ZodNumber,coerce:t?.coerce||!1,...at(t)});var b0=class t extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(I){if(this._def.coerce)try{I.data=BigInt(I.data)}catch{return this._getInvalidInput(I)}if(this._getType(I)!==KI.bigint)return this._getInvalidInput(I);let l,c=new br;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?I.data<n.value:I.data<=n.value)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),c.dirty()):n.kind==="max"?(n.inclusive?I.data>n.value:I.data>=n.value)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),c.dirty()):n.kind==="multipleOf"?I.data%n.value!==BigInt(0)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.not_multiple_of,multipleOf:n.value,message:n.message}),c.dirty()):zt.assertNever(n);return{status:c.value,value:I.data}}_getInvalidInput(I){let e=this._getOrReturnCtx(I);return BI(e,{code:RI.invalid_type,expected:KI.bigint,received:e.parsedType}),Fe}gte(I,e){return this.setLimit("min",I,!0,Ge.toString(e))}gt(I,e){return this.setLimit("min",I,!1,Ge.toString(e))}lte(I,e){return this.setLimit("max",I,!0,Ge.toString(e))}lt(I,e){return this.setLimit("max",I,!1,Ge.toString(e))}setLimit(I,e,l,c){return new t({...this._def,checks:[...this._def.checks,{kind:I,value:e,inclusive:l,message:Ge.toString(c)}]})}_addCheck(I){return new t({...this._def,checks:[...this._def.checks,I]})}positive(I){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ge.toString(I)})}negative(I){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ge.toString(I)})}nonpositive(I){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ge.toString(I)})}nonnegative(I){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ge.toString(I)})}multipleOf(I,e){return this._addCheck({kind:"multipleOf",value:I,message:Ge.toString(e)})}get minValue(){let I=null;for(let e of this._def.checks)e.kind==="min"&&(I===null||e.value>I)&&(I=e.value);return I}get maxValue(){let I=null;for(let e of this._def.checks)e.kind==="max"&&(I===null||e.value<I)&&(I=e.value);return I}};b0.create=t=>new b0({checks:[],typeName:Xe.ZodBigInt,coerce:t?.coerce??!1,...at(t)});var m0=class extends ht{_parse(I){if(this._def.coerce&&(I.data=!!I.data),this._getType(I)!==KI.boolean){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.boolean,received:l.parsedType}),Fe}return Tr(I.data)}};m0.create=t=>new m0({typeName:Xe.ZodBoolean,coerce:t?.coerce||!1,...at(t)});var h0=class t extends ht{_parse(I){if(this._def.coerce&&(I.data=new Date(I.data)),this._getType(I)!==KI.date){let n=this._getOrReturnCtx(I);return BI(n,{code:RI.invalid_type,expected:KI.date,received:n.parsedType}),Fe}if(Number.isNaN(I.data.getTime())){let n=this._getOrReturnCtx(I);return BI(n,{code:RI.invalid_date}),Fe}let l=new br,c;for(let n of this._def.checks)n.kind==="min"?I.data.getTime()<n.value&&(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),l.dirty()):n.kind==="max"?I.data.getTime()>n.value&&(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),l.dirty()):zt.assertNever(n);return{status:l.value,value:new Date(I.data.getTime())}}_addCheck(I){return new t({...this._def,checks:[...this._def.checks,I]})}min(I,e){return this._addCheck({kind:"min",value:I.getTime(),message:Ge.toString(e)})}max(I,e){return this._addCheck({kind:"max",value:I.getTime(),message:Ge.toString(e)})}get minDate(){let I=null;for(let e of this._def.checks)e.kind==="min"&&(I===null||e.value>I)&&(I=e.value);return I!=null?new Date(I):null}get maxDate(){let I=null;for(let e of this._def.checks)e.kind==="max"&&(I===null||e.value<I)&&(I=e.value);return I!=null?new Date(I):null}};h0.create=t=>new h0({checks:[],coerce:t?.coerce||!1,typeName:Xe.ZodDate,...at(t)});var KH=class extends ht{_parse(I){if(this._getType(I)!==KI.symbol){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.symbol,received:l.parsedType}),Fe}return Tr(I.data)}};KH.create=t=>new KH({typeName:Xe.ZodSymbol,...at(t)});var p0=class extends ht{_parse(I){if(this._getType(I)!==KI.undefined){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.undefined,received:l.parsedType}),Fe}return Tr(I.data)}};p0.create=t=>new p0({typeName:Xe.ZodUndefined,...at(t)});var Z0=class extends ht{_parse(I){if(this._getType(I)!==KI.null){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.null,received:l.parsedType}),Fe}return Tr(I.data)}};Z0.create=t=>new Z0({typeName:Xe.ZodNull,...at(t)});var KY=class extends ht{constructor(){super(...arguments),this._any=!0}_parse(I){return Tr(I.data)}};KY.create=t=>new KY({typeName:Xe.ZodAny,...at(t)});var uu=class extends ht{constructor(){super(...arguments),this._unknown=!0}_parse(I){return Tr(I.data)}};uu.create=t=>new uu({typeName:Xe.ZodUnknown,...at(t)});var Fb=class extends ht{_parse(I){let e=this._getOrReturnCtx(I);return BI(e,{code:RI.invalid_type,expected:KI.never,received:e.parsedType}),Fe}};Fb.create=t=>new Fb({typeName:Xe.ZodNever,...at(t)});var PH=class extends ht{_parse(I){if(this._getType(I)!==KI.undefined){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.void,received:l.parsedType}),Fe}return Tr(I.data)}};PH.create=t=>new PH({typeName:Xe.ZodVoid,...at(t)});var Wu=class t extends ht{_parse(I){let{ctx:e,status:l}=this._processInputParams(I),c=this._def;if(e.parsedType!==KI.array)return BI(e,{code:RI.invalid_type,expected:KI.array,received:e.parsedType}),Fe;if(c.exactLength!==null){let a=e.data.length>c.exactLength.value,r=e.data.length<c.exactLength.value;(a||r)&&(BI(e,{code:a?RI.too_big:RI.too_small,minimum:r?c.exactLength.value:void 0,maximum:a?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),l.dirty())}if(c.minLength!==null&&e.data.length<c.minLength.value&&(BI(e,{code:RI.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),l.dirty()),c.maxLength!==null&&e.data.length>c.maxLength.value&&(BI(e,{code:RI.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),l.dirty()),e.common.async)return Promise.all([...e.data].map((a,r)=>c.type._parseAsync(new ai(e,a,e.path,r)))).then(a=>br.mergeArray(l,a));let n=[...e.data].map((a,r)=>c.type._parseSync(new ai(e,a,e.path,r)));return br.mergeArray(l,n)}get element(){return this._def.type}min(I,e){return new t({...this._def,minLength:{value:I,message:Ge.toString(e)}})}max(I,e){return new t({...this._def,maxLength:{value:I,message:Ge.toString(e)}})}length(I,e){return new t({...this._def,exactLength:{value:I,message:Ge.toString(e)}})}nonempty(I){return this.min(1,I)}};Wu.create=(t,I)=>new Wu({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Xe.ZodArray,...at(I)});function DH(t){if(t instanceof DG){let I={};for(let e in t.shape){let l=t.shape[e];I[e]=ni.create(DH(l))}return new DG({...t._def,shape:()=>I})}else return t instanceof Wu?new Wu({...t._def,type:DH(t.element)}):t instanceof ni?ni.create(DH(t.unwrap())):t instanceof Th?Th.create(DH(t.unwrap())):t instanceof Mh?Mh.create(t.items.map(I=>DH(I))):t}var DG=class t extends ht{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let I=this._def.shape(),e=zt.objectKeys(I);return this._cached={shape:I,keys:e},this._cached}_parse(I){if(this._getType(I)!==KI.object){let o=this._getOrReturnCtx(I);return BI(o,{code:RI.invalid_type,expected:KI.object,received:o.parsedType}),Fe}let{status:l,ctx:c}=this._processInputParams(I),{shape:n,keys:a}=this._getCached(),r=[];if(!(this._def.catchall instanceof Fb&&this._def.unknownKeys==="strip"))for(let o in c.data)a.includes(o)||r.push(o);let s=[];for(let o of a){let d=n[o],i=c.data[o];s.push({key:{status:"valid",value:o},value:d._parse(new ai(c,i,c.path,o)),alwaysSet:o in c.data})}if(this._def.catchall instanceof Fb){let o=this._def.unknownKeys;if(o==="passthrough")for(let d of r)s.push({key:{status:"valid",value:d},value:{status:"valid",value:c.data[d]}});else if(o==="strict")r.length>0&&(BI(c,{code:RI.unrecognized_keys,keys:r}),l.dirty());else if(o!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let o=this._def.catchall;for(let d of r){let i=c.data[d];s.push({key:{status:"valid",value:d},value:o._parse(new ai(c,i,c.path,d)),alwaysSet:d in c.data})}}return c.common.async?Promise.resolve().then(async()=>{let o=[];for(let d of s){let i=await d.key,h=await d.value;o.push({key:i,value:h,alwaysSet:d.alwaysSet})}return o}).then(o=>br.mergeObjectSync(l,o)):br.mergeObjectSync(l,s)}get shape(){return this._def.shape()}strict(I){return Ge.errToObj,new t({...this._def,unknownKeys:"strict",...I!==void 0?{errorMap:(e,l)=>{let c=this._def.errorMap?.(e,l).message??l.defaultError;return e.code==="unrecognized_keys"?{message:Ge.errToObj(I).message??c}:{message:c}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(I){return new t({...this._def,shape:()=>({...this._def.shape(),...I})})}merge(I){return new t({unknownKeys:I._def.unknownKeys,catchall:I._def.catchall,shape:()=>({...this._def.shape(),...I._def.shape()}),typeName:Xe.ZodObject})}setKey(I,e){return this.augment({[I]:e})}catchall(I){return new t({...this._def,catchall:I})}pick(I){let e={};for(let l of zt.objectKeys(I))I[l]&&this.shape[l]&&(e[l]=this.shape[l]);return new t({...this._def,shape:()=>e})}omit(I){let e={};for(let l of zt.objectKeys(this.shape))I[l]||(e[l]=this.shape[l]);return new t({...this._def,shape:()=>e})}deepPartial(){return DH(this)}partial(I){let e={};for(let l of zt.objectKeys(this.shape)){let c=this.shape[l];I&&!I[l]?e[l]=c:e[l]=c.optional()}return new t({...this._def,shape:()=>e})}required(I){let e={};for(let l of zt.objectKeys(this.shape))if(I&&!I[l])e[l]=this.shape[l];else{let n=this.shape[l];for(;n instanceof ni;)n=n._def.innerType;e[l]=n}return new t({...this._def,shape:()=>e})}keyof(){return TfI(zt.objectKeys(this.shape))}};DG.create=(t,I)=>new DG({shape:()=>t,unknownKeys:"strip",catchall:Fb.create(),typeName:Xe.ZodObject,...at(I)});DG.strictCreate=(t,I)=>new DG({shape:()=>t,unknownKeys:"strict",catchall:Fb.create(),typeName:Xe.ZodObject,...at(I)});DG.lazycreate=(t,I)=>new DG({shape:t,unknownKeys:"strip",catchall:Fb.create(),typeName:Xe.ZodObject,...at(I)});var u0=class extends ht{_parse(I){let{ctx:e}=this._processInputParams(I),l=this._def.options;function c(n){for(let r of n)if(r.result.status==="valid")return r.result;for(let r of n)if(r.result.status==="dirty")return e.common.issues.push(...r.ctx.common.issues),r.result;let a=n.map(r=>new jG(r.ctx.common.issues));return BI(e,{code:RI.invalid_union,unionErrors:a}),Fe}if(e.common.async)return Promise.all(l.map(async n=>{let a={...e,common:{...e.common,issues:[]},parent:null};return{result:await n._parseAsync({data:e.data,path:e.path,parent:a}),ctx:a}})).then(c);{let n,a=[];for(let s of l){let o={...e,common:{...e.common,issues:[]},parent:null},d=s._parseSync({data:e.data,path:e.path,parent:o});if(d.status==="valid")return d;d.status==="dirty"&&!n&&(n={result:d,ctx:o}),o.common.issues.length&&a.push(o.common.issues)}if(n)return e.common.issues.push(...n.ctx.common.issues),n.result;let r=a.map(s=>new jG(s));return BI(e,{code:RI.invalid_union,unionErrors:r}),Fe}}get options(){return this._def.options}};u0.create=(t,I)=>new u0({options:t,typeName:Xe.ZodUnion,...at(I)});var Zu=t=>t instanceof N0?Zu(t.schema):t instanceof ri?Zu(t.innerType()):t instanceof Y0?[t.value]:t instanceof V0?t.options:t instanceof R0?zt.objectValues(t.enum):t instanceof y0?Zu(t._def.innerType):t instanceof p0?[void 0]:t instanceof Z0?[null]:t instanceof ni?[void 0,...Zu(t.unwrap())]:t instanceof Th?[null,...Zu(t.unwrap())]:t instanceof F9||t instanceof Q0?Zu(t.unwrap()):t instanceof F0?Zu(t._def.innerType):[],NK=class t extends ht{_parse(I){let{ctx:e}=this._processInputParams(I);if(e.parsedType!==KI.object)return BI(e,{code:RI.invalid_type,expected:KI.object,received:e.parsedType}),Fe;let l=this.discriminator,c=e.data[l],n=this.optionsMap.get(c);return n?e.common.async?n._parseAsync({data:e.data,path:e.path,parent:e}):n._parseSync({data:e.data,path:e.path,parent:e}):(BI(e,{code:RI.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[l]}),Fe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(I,e,l){let c=new Map;for(let n of e){let a=Zu(n.shape[I]);if(!a.length)throw new Error(`A discriminator value for key \`${I}\` could not be extracted from all schema options`);for(let r of a){if(c.has(r))throw new Error(`Discriminator property ${String(I)} has duplicate value ${String(r)}`);c.set(r,n)}}return new t({typeName:Xe.ZodDiscriminatedUnion,discriminator:I,options:e,optionsMap:c,...at(l)})}};function SoI(t,I){let e=Oh(t),l=Oh(I);if(t===I)return{valid:!0,data:t};if(e===KI.object&&l===KI.object){let c=zt.objectKeys(I),n=zt.objectKeys(t).filter(r=>c.indexOf(r)!==-1),a={...t,...I};for(let r of n){let s=SoI(t[r],I[r]);if(!s.valid)return{valid:!1};a[r]=s.data}return{valid:!0,data:a}}else if(e===KI.array&&l===KI.array){if(t.length!==I.length)return{valid:!1};let c=[];for(let n=0;n<t.length;n++){let a=t[n],r=I[n],s=SoI(a,r);if(!s.valid)return{valid:!1};c.push(s.data)}return{valid:!0,data:c}}else return e===KI.date&&l===KI.date&&+t==+I?{valid:!0,data:t}:{valid:!1}}var W0=class extends ht{_parse(I){let{status:e,ctx:l}=this._processInputParams(I),c=(n,a)=>{if(uK(n)||uK(a))return Fe;let r=SoI(n.value,a.value);return r.valid?((WK(n)||WK(a))&&e.dirty(),{status:e.value,value:r.data}):(BI(l,{code:RI.invalid_intersection_types}),Fe)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([n,a])=>c(n,a)):c(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}};W0.create=(t,I,e)=>new W0({left:t,right:I,typeName:Xe.ZodIntersection,...at(e)});var Mh=class t extends ht{_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.parsedType!==KI.array)return BI(l,{code:RI.invalid_type,expected:KI.array,received:l.parsedType}),Fe;if(l.data.length<this._def.items.length)return BI(l,{code:RI.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Fe;!this._def.rest&&l.data.length>this._def.items.length&&(BI(l,{code:RI.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty());let n=[...l.data].map((a,r)=>{let s=this._def.items[r]||this._def.rest;return s?s._parse(new ai(l,a,l.path,r)):null}).filter(a=>!!a);return l.common.async?Promise.all(n).then(a=>br.mergeArray(e,a)):br.mergeArray(e,n)}get items(){return this._def.items}rest(I){return new t({...this._def,rest:I})}};Mh.create=(t,I)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Mh({items:t,typeName:Xe.ZodTuple,rest:null,...at(I)})};var YK=class t extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.parsedType!==KI.object)return BI(l,{code:RI.invalid_type,expected:KI.object,received:l.parsedType}),Fe;let c=[],n=this._def.keyType,a=this._def.valueType;for(let r in l.data)c.push({key:n._parse(new ai(l,r,l.path,r)),value:a._parse(new ai(l,l.data[r],l.path,r)),alwaysSet:r in l.data});return l.common.async?br.mergeObjectAsync(e,c):br.mergeObjectSync(e,c)}get element(){return this._def.valueType}static create(I,e,l){return e instanceof ht?new t({keyType:I,valueType:e,typeName:Xe.ZodRecord,...at(l)}):new t({keyType:DY.create(),valueType:I,typeName:Xe.ZodRecord,...at(e)})}},qH=class extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.parsedType!==KI.map)return BI(l,{code:RI.invalid_type,expected:KI.map,received:l.parsedType}),Fe;let c=this._def.keyType,n=this._def.valueType,a=[...l.data.entries()].map(([r,s],o)=>({key:c._parse(new ai(l,r,l.path,[o,"key"])),value:n._parse(new ai(l,s,l.path,[o,"value"]))}));if(l.common.async){let r=new Map;return Promise.resolve().then(async()=>{for(let s of a){let o=await s.key,d=await s.value;if(o.status==="aborted"||d.status==="aborted")return Fe;(o.status==="dirty"||d.status==="dirty")&&e.dirty(),r.set(o.value,d.value)}return{status:e.value,value:r}})}else{let r=new Map;for(let s of a){let o=s.key,d=s.value;if(o.status==="aborted"||d.status==="aborted")return Fe;(o.status==="dirty"||d.status==="dirty")&&e.dirty(),r.set(o.value,d.value)}return{status:e.value,value:r}}}};qH.create=(t,I,e)=>new qH({valueType:I,keyType:t,typeName:Xe.ZodMap,...at(e)});var _H=class t extends ht{_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.parsedType!==KI.set)return BI(l,{code:RI.invalid_type,expected:KI.set,received:l.parsedType}),Fe;let c=this._def;c.minSize!==null&&l.data.size<c.minSize.value&&(BI(l,{code:RI.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),e.dirty()),c.maxSize!==null&&l.data.size>c.maxSize.value&&(BI(l,{code:RI.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),e.dirty());let n=this._def.valueType;function a(s){let o=new Set;for(let d of s){if(d.status==="aborted")return Fe;d.status==="dirty"&&e.dirty(),o.add(d.value)}return{status:e.value,value:o}}let r=[...l.data.values()].map((s,o)=>n._parse(new ai(l,s,l.path,o)));return l.common.async?Promise.all(r).then(s=>a(s)):a(r)}min(I,e){return new t({...this._def,minSize:{value:I,message:Ge.toString(e)}})}max(I,e){return new t({...this._def,maxSize:{value:I,message:Ge.toString(e)}})}size(I,e){return this.min(I,e).max(I,e)}nonempty(I){return this.min(1,I)}};_H.create=(t,I)=>new _H({valueType:t,minSize:null,maxSize:null,typeName:Xe.ZodSet,...at(I)});var VK=class t extends ht{constructor(){super(...arguments),this.validate=this.implement}_parse(I){let{ctx:e}=this._processInputParams(I);if(e.parsedType!==KI.function)return BI(e,{code:RI.invalid_type,expected:KI.function,received:e.parsedType}),Fe;function l(r,s){return y9({data:r,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,TH(),pu].filter(o=>!!o),issueData:{code:RI.invalid_arguments,argumentsError:s}})}function c(r,s){return y9({data:r,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,TH(),pu].filter(o=>!!o),issueData:{code:RI.invalid_return_type,returnTypeError:s}})}let n={errorMap:e.common.contextualErrorMap},a=e.data;if(this._def.returns instanceof PY){let r=this;return Tr(async function(...s){let o=new jG([]),d=await r._def.args.parseAsync(s,n).catch(p=>{throw o.addIssue(l(s,p)),o}),i=await Reflect.apply(a,this,d);return await r._def.returns._def.type.parseAsync(i,n).catch(p=>{throw o.addIssue(c(i,p)),o})})}else{let r=this;return Tr(function(...s){let o=r._def.args.safeParse(s,n);if(!o.success)throw new jG([l(s,o.error)]);let d=Reflect.apply(a,this,o.data),i=r._def.returns.safeParse(d,n);if(!i.success)throw new jG([c(d,i.error)]);return i.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...I){return new t({...this._def,args:Mh.create(I).rest(uu.create())})}returns(I){return new t({...this._def,returns:I})}implement(I){return this.parse(I)}strictImplement(I){return this.parse(I)}static create(I,e,l){return new t({args:I||Mh.create([]).rest(uu.create()),returns:e||uu.create(),typeName:Xe.ZodFunction,...at(l)})}},N0=class extends ht{get schema(){return this._def.getter()}_parse(I){let{ctx:e}=this._processInputParams(I);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};N0.create=(t,I)=>new N0({getter:t,typeName:Xe.ZodLazy,...at(I)});var Y0=class extends ht{_parse(I){if(I.data!==this._def.value){let e=this._getOrReturnCtx(I);return BI(e,{received:e.data,code:RI.invalid_literal,expected:this._def.value}),Fe}return{status:"valid",value:I.data}}get value(){return this._def.value}};Y0.create=(t,I)=>new Y0({value:t,typeName:Xe.ZodLiteral,...at(I)});function TfI(t,I){return new V0({values:t,typeName:Xe.ZodEnum,...at(I)})}var V0=class t extends ht{_parse(I){if(typeof I.data!="string"){let e=this._getOrReturnCtx(I),l=this._def.values;return BI(e,{expected:zt.joinValues(l),received:e.parsedType,code:RI.invalid_type}),Fe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(I.data)){let e=this._getOrReturnCtx(I),l=this._def.values;return BI(e,{received:e.data,code:RI.invalid_enum_value,options:l}),Fe}return Tr(I.data)}get options(){return this._def.values}get enum(){let I={};for(let e of this._def.values)I[e]=e;return I}get Values(){let I={};for(let e of this._def.values)I[e]=e;return I}get Enum(){let I={};for(let e of this._def.values)I[e]=e;return I}extract(I,e=this._def){return t.create(I,{...this._def,...e})}exclude(I,e=this._def){return t.create(this.options.filter(l=>!I.includes(l)),{...this._def,...e})}};V0.create=TfI;var R0=class extends ht{_parse(I){let e=zt.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(I);if(l.parsedType!==KI.string&&l.parsedType!==KI.number){let c=zt.objectValues(e);return BI(l,{expected:zt.joinValues(c),received:l.parsedType,code:RI.invalid_type}),Fe}if(this._cache||(this._cache=new Set(zt.getValidEnumValues(this._def.values))),!this._cache.has(I.data)){let c=zt.objectValues(e);return BI(l,{received:l.data,code:RI.invalid_enum_value,options:c}),Fe}return Tr(I.data)}get enum(){return this._def.values}};R0.create=(t,I)=>new R0({values:t,typeName:Xe.ZodNativeEnum,...at(I)});var PY=class extends ht{unwrap(){return this._def.type}_parse(I){let{ctx:e}=this._processInputParams(I);if(e.parsedType!==KI.promise&&e.common.async===!1)return BI(e,{code:RI.invalid_type,expected:KI.promise,received:e.parsedType}),Fe;let l=e.parsedType===KI.promise?e.data:Promise.resolve(e.data);return Tr(l.then(c=>this._def.type.parseAsync(c,{path:e.path,errorMap:e.common.contextualErrorMap})))}};PY.create=(t,I)=>new PY({type:t,typeName:Xe.ZodPromise,...at(I)});var ri=class extends ht{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(I){let{status:e,ctx:l}=this._processInputParams(I),c=this._def.effect||null,n={addIssue:a=>{BI(l,a),a.fatal?e.abort():e.dirty()},get path(){return l.path}};if(n.addIssue=n.addIssue.bind(n),c.type==="preprocess"){let a=c.transform(l.data,n);if(l.common.async)return Promise.resolve(a).then(async r=>{if(e.value==="aborted")return Fe;let s=await this._def.schema._parseAsync({data:r,path:l.path,parent:l});return s.status==="aborted"?Fe:s.status==="dirty"?d0(s.value):e.value==="dirty"?d0(s.value):s});{if(e.value==="aborted")return Fe;let r=this._def.schema._parseSync({data:a,path:l.path,parent:l});return r.status==="aborted"?Fe:r.status==="dirty"?d0(r.value):e.value==="dirty"?d0(r.value):r}}if(c.type==="refinement"){let a=r=>{let s=c.refinement(r,n);if(l.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return r};if(l.common.async===!1){let r=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return r.status==="aborted"?Fe:(r.status==="dirty"&&e.dirty(),a(r.value),{status:e.value,value:r.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(r=>r.status==="aborted"?Fe:(r.status==="dirty"&&e.dirty(),a(r.value).then(()=>({status:e.value,value:r.value}))))}if(c.type==="transform")if(l.common.async===!1){let a=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!jY(a))return Fe;let r=c.transform(a.value,n);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:r}}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(a=>jY(a)?Promise.resolve(c.transform(a.value,n)).then(r=>({status:e.value,value:r})):Fe);zt.assertNever(c)}};ri.create=(t,I,e)=>new ri({schema:t,typeName:Xe.ZodEffects,effect:I,...at(e)});ri.createWithPreprocess=(t,I,e)=>new ri({schema:I,effect:{type:"preprocess",transform:t},typeName:Xe.ZodEffects,...at(e)});var ni=class extends ht{_parse(I){return this._getType(I)===KI.undefined?Tr(void 0):this._def.innerType._parse(I)}unwrap(){return this._def.innerType}};ni.create=(t,I)=>new ni({innerType:t,typeName:Xe.ZodOptional,...at(I)});var Th=class extends ht{_parse(I){return this._getType(I)===KI.null?Tr(null):this._def.innerType._parse(I)}unwrap(){return this._def.innerType}};Th.create=(t,I)=>new Th({innerType:t,typeName:Xe.ZodNullable,...at(I)});var y0=class extends ht{_parse(I){let{ctx:e}=this._processInputParams(I),l=e.data;return e.parsedType===KI.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};y0.create=(t,I)=>new y0({innerType:t,typeName:Xe.ZodDefault,defaultValue:typeof I.default=="function"?I.default:()=>I.default,...at(I)});var F0=class extends ht{_parse(I){let{ctx:e}=this._processInputParams(I),l={...e,common:{...e.common,issues:[]}},c=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return jH(c)?c.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new jG(l.common.issues)},input:l.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new jG(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}};F0.create=(t,I)=>new F0({innerType:t,typeName:Xe.ZodCatch,catchValue:typeof I.catch=="function"?I.catch:()=>I.catch,...at(I)});var $H=class extends ht{_parse(I){if(this._getType(I)!==KI.nan){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.nan,received:l.parsedType}),Fe}return{status:"valid",value:I.data}}};$H.create=t=>new $H({typeName:Xe.ZodNaN,...at(t)});var tve=Symbol("zod_brand"),F9=class extends ht{_parse(I){let{ctx:e}=this._processInputParams(I),l=e.data;return this._def.type._parse({data:l,path:e.path,parent:e})}unwrap(){return this._def.type}},Q9=class t extends ht{_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return n.status==="aborted"?Fe:n.status==="dirty"?(e.dirty(),d0(n.value)):this._def.out._parseAsync({data:n.value,path:l.path,parent:l})})();{let c=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return c.status==="aborted"?Fe:c.status==="dirty"?(e.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:l.path,parent:l})}}static create(I,e){return new t({in:I,out:e,typeName:Xe.ZodPipeline})}},Q0=class extends ht{_parse(I){let e=this._def.innerType._parse(I),l=c=>(jY(c)&&(c.value=Object.freeze(c.value)),c);return jH(e)?e.then(c=>l(c)):l(e)}unwrap(){return this._def.innerType}};Q0.create=(t,I)=>new Q0({innerType:t,typeName:Xe.ZodReadonly,...at(I)});function UfI(t,I){let e=typeof t=="function"?t(I):typeof t=="string"?{message:t}:t;return typeof e=="string"?{message:e}:e}function jfI(t,I={},e){return t?KY.create().superRefine((l,c)=>{let n=t(l);if(n instanceof Promise)return n.then(a=>{if(!a){let r=UfI(I,l),s=r.fatal??e??!0;c.addIssue({code:"custom",...r,fatal:s})}});if(!n){let a=UfI(I,l),r=a.fatal??e??!0;c.addIssue({code:"custom",...a,fatal:r})}}):KY.create()}var lve={object:DG.lazycreate},Xe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Xe||(Xe={}));var cve=(t,I={message:`Input not instance of ${t.name}`})=>jfI(e=>e instanceof t,I),EI=DY.create,jh=i0.create,nve=$H.create,ave=b0.create,Ba=m0.create,rve=h0.create,sve=KH.create,Gve=p0.create,ove=Z0.create,OoI=KY.create,MoI=uu.create,dve=Fb.create,ive=PH.create,jr=Wu.create,we=DG.create,bve=DG.strictCreate,Dr=u0.create,ToI=NK.create,mve=W0.create,joI=Mh.create,RK=YK.create,hve=qH.create,pve=_H.create,Zve=VK.create,uve=N0.create,Gl=Y0.create,Nu=V0.create,Wve=R0.create,Nve=PY.create,Yve=ri.create,Vve=ni.create,Rve=Th.create,yve=ri.createWithPreprocess,Fve=Q9.create,Qve=()=>EI().optional(),gve=()=>jh().optional(),Ave=()=>Ba().optional(),g9={string:t=>DY.create({...t,coerce:!0}),number:t=>i0.create({...t,coerce:!0}),boolean:t=>m0.create({...t,coerce:!0}),bigint:t=>b0.create({...t,coerce:!0}),date:t=>h0.create({...t,coerce:!0})};var Xve=Fe;var IE="2025-06-18";var DfI=[IE,"2025-03-26","2024-11-05","2024-10-07"],yK="2.0",KfI=R.union([R.string(),R.number().int()]),PfI=R.string(),wve=R.object({progressToken:R.optional(KfI)}).passthrough(),oi=R.object({_meta:R.optional(wve)}).passthrough(),KG=R.object({method:R.string(),params:R.optional(oi)}),A9=R.object({_meta:R.optional(R.object({}).passthrough())}).passthrough(),Dh=R.object({method:R.string(),params:R.optional(A9)}),di=R.object({_meta:R.optional(R.object({}).passthrough())}).passthrough(),FK=R.union([R.string(),R.number().int()]),qfI=R.object({jsonrpc:R.literal(yK),id:FK}).merge(KG).strict(),QK=t=>qfI.safeParse(t).success,_fI=R.object({jsonrpc:R.literal(yK)}).merge(Dh).strict(),$fI=t=>_fI.safeParse(t).success,IxI=R.object({jsonrpc:R.literal(yK),id:FK,result:di}).strict(),X9=t=>IxI.safeParse(t).success,si;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(si||(si={}));var exI=R.object({jsonrpc:R.literal(yK),id:FK,error:R.object({code:R.number().int(),message:R.string(),data:R.optional(R.unknown())})}).strict(),txI=t=>exI.safeParse(t).success,qY=R.union([qfI,_fI,IxI,exI]),g0=di.strict(),gK=Dh.extend({method:R.literal("notifications/cancelled"),params:A9.extend({requestId:FK,reason:R.string().optional()})}),AK=R.object({src:R.string(),mimeType:R.optional(R.string()),sizes:R.optional(R.string())}).passthrough(),w9=R.object({name:R.string(),title:R.optional(R.string())}).passthrough(),lxI=w9.extend({version:R.string(),websiteUrl:R.optional(R.string()),icons:R.optional(R.array(AK))}),Hve=R.object({experimental:R.optional(R.object({}).passthrough()),sampling:R.optional(R.object({}).passthrough()),elicitation:R.optional(R.object({}).passthrough()),roots:R.optional(R.object({listChanged:R.optional(R.boolean())}).passthrough())}).passthrough(),Eve=KG.extend({method:R.literal("initialize"),params:oi.extend({protocolVersion:R.string(),capabilities:Hve,clientInfo:lxI})});var vve=R.object({experimental:R.optional(R.object({}).passthrough()),logging:R.optional(R.object({}).passthrough()),completions:R.optional(R.object({}).passthrough()),prompts:R.optional(R.object({listChanged:R.optional(R.boolean())}).passthrough()),resources:R.optional(R.object({subscribe:R.optional(R.boolean()),listChanged:R.optional(R.boolean())}).passthrough()),tools:R.optional(R.object({listChanged:R.optional(R.boolean())}).passthrough())}).passthrough(),KoI=di.extend({protocolVersion:R.string(),capabilities:vve,serverInfo:lxI,instructions:R.optional(R.string())}),cxI=Dh.extend({method:R.literal("notifications/initialized")}),nxI=t=>cxI.safeParse(t).success,XK=KG.extend({method:R.literal("ping")}),Cve=R.object({progress:R.number(),total:R.optional(R.number()),message:R.optional(R.string())}).passthrough(),wK=Dh.extend({method:R.literal("notifications/progress"),params:A9.merge(Cve).extend({progressToken:KfI})}),HK=KG.extend({params:oi.extend({cursor:R.optional(PfI)}).optional()}),EK=di.extend({nextCursor:R.optional(PfI)}),axI=R.object({uri:R.string(),mimeType:R.optional(R.string()),_meta:R.optional(R.object({}).passthrough())}).passthrough(),rxI=axI.extend({text:R.string()}),PoI=R.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),sxI=axI.extend({blob:PoI}),GxI=w9.extend({uri:R.string(),description:R.optional(R.string()),mimeType:R.optional(R.string()),icons:R.optional(R.array(AK)),_meta:R.optional(R.object({}).passthrough())}),Jve=w9.extend({uriTemplate:R.string(),description:R.optional(R.string()),mimeType:R.optional(R.string()),_meta:R.optional(R.object({}).passthrough())}),Lve=HK.extend({method:R.literal("resources/list")}),qoI=EK.extend({resources:R.array(GxI)}),kve=HK.extend({method:R.literal("resources/templates/list")}),_oI=EK.extend({resourceTemplates:R.array(Jve)}),fve=KG.extend({method:R.literal("resources/read"),params:oi.extend({uri:R.string()})}),$oI=di.extend({contents:R.array(R.union([rxI,sxI]))}),xve=Dh.extend({method:R.literal("notifications/resources/list_changed")}),Bve=KG.extend({method:R.literal("resources/subscribe"),params:oi.extend({uri:R.string()})}),zve=KG.extend({method:R.literal("resources/unsubscribe"),params:oi.extend({uri:R.string()})}),Uve=Dh.extend({method:R.literal("notifications/resources/updated"),params:A9.extend({uri:R.string()})}),Sve=R.object({name:R.string(),description:R.optional(R.string()),required:R.optional(R.boolean())}).passthrough(),Ove=w9.extend({description:R.optional(R.string()),arguments:R.optional(R.array(Sve)),icons:R.optional(R.array(AK)),_meta:R.optional(R.object({}).passthrough())}),Mve=HK.extend({method:R.literal("prompts/list")}),IdI=EK.extend({prompts:R.array(Ove)}),Tve=KG.extend({method:R.literal("prompts/get"),params:oi.extend({name:R.string(),arguments:R.optional(R.record(R.string()))})}),edI=R.object({type:R.literal("text"),text:R.string(),_meta:R.optional(R.object({}).passthrough())}).passthrough(),tdI=R.object({type:R.literal("image"),data:PoI,mimeType:R.string(),_meta:R.optional(R.object({}).passthrough())}).passthrough(),ldI=R.object({type:R.literal("audio"),data:PoI,mimeType:R.string(),_meta:R.optional(R.object({}).passthrough())}).passthrough(),jve=R.object({type:R.literal("resource"),resource:R.union([rxI,sxI]),_meta:R.optional(R.object({}).passthrough())}).passthrough(),Dve=GxI.extend({type:R.literal("resource_link")}),oxI=R.union([edI,tdI,ldI,Dve,jve]),Kve=R.object({role:R.enum(["user","assistant"]),content:oxI}).passthrough(),cdI=di.extend({description:R.optional(R.string()),messages:R.array(Kve)}),Pve=Dh.extend({method:R.literal("notifications/prompts/list_changed")}),qve=R.object({title:R.optional(R.string()),readOnlyHint:R.optional(R.boolean()),destructiveHint:R.optional(R.boolean()),idempotentHint:R.optional(R.boolean()),openWorldHint:R.optional(R.boolean())}).passthrough(),_ve=w9.extend({description:R.optional(R.string()),inputSchema:R.object({type:R.literal("object"),properties:R.optional(R.object({}).passthrough()),required:R.optional(R.array(R.string()))}).passthrough(),outputSchema:R.optional(R.object({type:R.literal("object"),properties:R.optional(R.object({}).passthrough()),required:R.optional(R.array(R.string()))}).passthrough()),annotations:R.optional(qve),icons:R.optional(R.array(AK)),_meta:R.optional(R.object({}).passthrough())}),$ve=HK.extend({method:R.literal("tools/list")}),ndI=EK.extend({tools:R.array(_ve)}),vK=di.extend({content:R.array(oxI).default([]),structuredContent:R.object({}).passthrough().optional(),isError:R.optional(R.boolean())}),bfl=vK.or(di.extend({toolResult:R.unknown()})),ICe=KG.extend({method:R.literal("tools/call"),params:oi.extend({name:R.string(),arguments:R.optional(R.record(R.unknown()))})}),eCe=Dh.extend({method:R.literal("notifications/tools/list_changed")}),dxI=R.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),tCe=KG.extend({method:R.literal("logging/setLevel"),params:oi.extend({level:dxI})}),lCe=Dh.extend({method:R.literal("notifications/message"),params:A9.extend({level:dxI,logger:R.optional(R.string()),data:R.unknown()})}),cCe=R.object({name:R.string().optional()}).passthrough(),nCe=R.object({hints:R.optional(R.array(cCe)),costPriority:R.optional(R.number().min(0).max(1)),speedPriority:R.optional(R.number().min(0).max(1)),intelligencePriority:R.optional(R.number().min(0).max(1))}).passthrough(),aCe=R.object({role:R.enum(["user","assistant"]),content:R.union([edI,tdI,ldI])}).passthrough(),rCe=KG.extend({method:R.literal("sampling/createMessage"),params:oi.extend({messages:R.array(aCe),systemPrompt:R.optional(R.string()),includeContext:R.optional(R.enum(["none","thisServer","allServers"])),temperature:R.optional(R.number()),maxTokens:R.number().int(),stopSequences:R.optional(R.array(R.string())),metadata:R.optional(R.object({}).passthrough()),modelPreferences:R.optional(nCe)})}),sCe=di.extend({model:R.string(),stopReason:R.optional(R.enum(["endTurn","stopSequence","maxTokens"]).or(R.string())),role:R.enum(["user","assistant"]),content:R.discriminatedUnion("type",[edI,tdI,ldI])}),GCe=R.object({type:R.literal("boolean"),title:R.optional(R.string()),description:R.optional(R.string()),default:R.optional(R.boolean())}).passthrough(),oCe=R.object({type:R.literal("string"),title:R.optional(R.string()),description:R.optional(R.string()),minLength:R.optional(R.number()),maxLength:R.optional(R.number()),format:R.optional(R.enum(["email","uri","date","date-time"]))}).passthrough(),dCe=R.object({type:R.enum(["number","integer"]),title:R.optional(R.string()),description:R.optional(R.string()),minimum:R.optional(R.number()),maximum:R.optional(R.number())}).passthrough(),iCe=R.object({type:R.literal("string"),title:R.optional(R.string()),description:R.optional(R.string()),enum:R.array(R.string()),enumNames:R.optional(R.array(R.string()))}).passthrough(),bCe=R.union([GCe,oCe,dCe,iCe]),mCe=KG.extend({method:R.literal("elicitation/create"),params:oi.extend({message:R.string(),requestedSchema:R.object({type:R.literal("object"),properties:R.record(R.string(),bCe),required:R.optional(R.array(R.string()))}).passthrough()})}),hCe=di.extend({action:R.enum(["accept","decline","cancel"]),content:R.optional(R.record(R.string(),R.unknown()))}),pCe=R.object({type:R.literal("ref/resource"),uri:R.string()}).passthrough();var ZCe=R.object({type:R.literal("ref/prompt"),name:R.string()}).passthrough(),uCe=KG.extend({method:R.literal("completion/complete"),params:oi.extend({ref:R.union([ZCe,pCe]),argument:R.object({name:R.string(),value:R.string()}).passthrough(),context:R.optional(R.object({arguments:R.optional(R.record(R.string(),R.string()))}))})}),adI=di.extend({completion:R.object({values:R.array(R.string()).max(100),total:R.optional(R.number().int()),hasMore:R.optional(R.boolean())}).passthrough()}),WCe=R.object({uri:R.string().startsWith("file://"),name:R.optional(R.string()),_meta:R.optional(R.object({}).passthrough())}).passthrough(),NCe=KG.extend({method:R.literal("roots/list")}),YCe=di.extend({roots:R.array(WCe)}),VCe=Dh.extend({method:R.literal("notifications/roots/list_changed")}),mfl=R.union([XK,Eve,uCe,tCe,Tve,Mve,Lve,kve,fve,Bve,zve,ICe,$ve]),hfl=R.union([gK,wK,cxI,VCe]),pfl=R.union([g0,sCe,hCe,YCe]),Zfl=R.union([XK,rCe,mCe,NCe]),ufl=R.union([gK,wK,lCe,Uve,xve,eCe,Pve]),Wfl=R.union([g0,KoI,adI,cdI,IdI,qoI,_oI,$oI,vK,ndI]),Gi=class extends Error{constructor(I,e,l){super(`MCP error ${I}: ${e}`),this.code=I,this.data=l,this.name="McpError"}};var RCe=6e4,CK=class{constructor(I){this._options=I,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.setNotificationHandler(gK,e=>{let l=this._requestHandlerAbortControllers.get(e.params.requestId);l?.abort(e.params.reason)}),this.setNotificationHandler(wK,e=>{this._onprogress(e)}),this.setRequestHandler(XK,e=>({}))}_setupTimeout(I,e,l,c,n=!1){this._timeoutInfo.set(I,{timeoutId:setTimeout(c,e),startTime:Date.now(),timeout:e,maxTotalTimeout:l,resetTimeoutOnProgress:n,onTimeout:c})}_resetTimeout(I){let e=this._timeoutInfo.get(I);if(!e)return!1;let l=Date.now()-e.startTime;if(e.maxTotalTimeout&&l>=e.maxTotalTimeout)throw this._timeoutInfo.delete(I),new Gi(si.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:e.maxTotalTimeout,totalElapsed:l});return clearTimeout(e.timeoutId),e.timeoutId=setTimeout(e.onTimeout,e.timeout),!0}_cleanupTimeout(I){let e=this._timeoutInfo.get(I);e&&(clearTimeout(e.timeoutId),this._timeoutInfo.delete(I))}async connect(I){var e,l,c;this._transport=I;let n=(e=this.transport)===null||e===void 0?void 0:e.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let a=(l=this.transport)===null||l===void 0?void 0:l.onerror;this._transport.onerror=s=>{a?.(s),this._onerror(s)};let r=(c=this._transport)===null||c===void 0?void 0:c.onmessage;this._transport.onmessage=(s,o)=>{r?.(s,o),X9(s)||txI(s)?this._onresponse(s):QK(s)?this._onrequest(s,o):$fI(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){var I;let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(I=this.onclose)===null||I===void 0||I.call(this);let l=new Gi(si.ConnectionClosed,"Connection closed");for(let c of e.values())c(l)}_onerror(I){var e;(e=this.onerror)===null||e===void 0||e.call(this,I)}_onnotification(I){var e;let l=(e=this._notificationHandlers.get(I.method))!==null&&e!==void 0?e:this.fallbackNotificationHandler;l!==void 0&&Promise.resolve().then(()=>l(I)).catch(c=>this._onerror(new Error(`Uncaught error in notification handler: ${c}`)))}_onrequest(I,e){var l,c;let n=(l=this._requestHandlers.get(I.method))!==null&&l!==void 0?l:this.fallbackRequestHandler,a=this._transport;if(n===void 0){a?.send({jsonrpc:"2.0",id:I.id,error:{code:si.MethodNotFound,message:"Method not found"}}).catch(o=>this._onerror(new Error(`Failed to send an error response: ${o}`)));return}let r=new AbortController;this._requestHandlerAbortControllers.set(I.id,r);let s={signal:r.signal,sessionId:a?.sessionId,_meta:(c=I.params)===null||c===void 0?void 0:c._meta,sendNotification:o=>this.notification(o,{relatedRequestId:I.id}),sendRequest:(o,d,i)=>this.request(o,d,{...i,relatedRequestId:I.id}),authInfo:e?.authInfo,requestId:I.id,requestInfo:e?.requestInfo};Promise.resolve().then(()=>n(I,s)).then(o=>{if(!r.signal.aborted)return a?.send({result:o,jsonrpc:"2.0",id:I.id})},o=>{var d;if(!r.signal.aborted)return a?.send({jsonrpc:"2.0",id:I.id,error:{code:Number.isSafeInteger(o.code)?o.code:si.InternalError,message:(d=o.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(o=>this._onerror(new Error(`Failed to send response: ${o}`))).finally(()=>{this._requestHandlerAbortControllers.delete(I.id)})}_onprogress(I){let{progressToken:e,...l}=I.params,c=Number(e),n=this._progressHandlers.get(c);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(I)}`));return}let a=this._responseHandlers.get(c),r=this._timeoutInfo.get(c);if(r&&a&&r.resetTimeoutOnProgress)try{this._resetTimeout(c)}catch(s){a(s);return}n(l)}_onresponse(I){let e=Number(I.id),l=this._responseHandlers.get(e);if(l===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(I)}`));return}if(this._responseHandlers.delete(e),this._progressHandlers.delete(e),this._cleanupTimeout(e),X9(I))l(I);else{let c=new Gi(I.error.code,I.error.message,I.error.data);l(c)}}get transport(){return this._transport}async close(){var I;await((I=this._transport)===null||I===void 0?void 0:I.close())}request(I,e,l){let{relatedRequestId:c,resumptionToken:n,onresumptiontoken:a}=l??{};return new Promise((r,s)=>{var o,d,i,h,p,Z;if(!this._transport){s(new Error("Not connected"));return}((o=this._options)===null||o===void 0?void 0:o.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(I.method),(d=l?.signal)===null||d===void 0||d.throwIfAborted();let W=this._requestMessageId++,N={...I,jsonrpc:"2.0",id:W};l?.onprogress&&(this._progressHandlers.set(W,l.onprogress),N.params={...I.params,_meta:{...((i=I.params)===null||i===void 0?void 0:i._meta)||{},progressToken:W}});let Y=A=>{var w;this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),(w=this._transport)===null||w===void 0||w.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:W,reason:String(A)}},{relatedRequestId:c,resumptionToken:n,onresumptiontoken:a}).catch(M=>this._onerror(new Error(`Failed to send cancellation: ${M}`))),s(A)};this._responseHandlers.set(W,A=>{var w;if(!(!((w=l?.signal)===null||w===void 0)&&w.aborted)){if(A instanceof Error)return s(A);try{let M=e.parse(A.result);r(M)}catch(M){s(M)}}}),(h=l?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var A;Y((A=l?.signal)===null||A===void 0?void 0:A.reason)});let F=(p=l?.timeout)!==null&&p!==void 0?p:RCe,g=()=>Y(new Gi(si.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(W,F,l?.maxTotalTimeout,g,(Z=l?.resetTimeoutOnProgress)!==null&&Z!==void 0?Z:!1),this._transport.send(N,{relatedRequestId:c,resumptionToken:n,onresumptiontoken:a}).catch(A=>{this._cleanupTimeout(W),s(A)})})}async notification(I,e){var l,c;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(I.method),((c=(l=this._options)===null||l===void 0?void 0:l.debouncedNotificationMethods)!==null&&c!==void 0?c:[]).includes(I.method)&&!I.params&&!e?.relatedRequestId){if(this._pendingDebouncedNotifications.has(I.method))return;this._pendingDebouncedNotifications.add(I.method),Promise.resolve().then(()=>{var s;if(this._pendingDebouncedNotifications.delete(I.method),!this._transport)return;let o={...I,jsonrpc:"2.0"};(s=this._transport)===null||s===void 0||s.send(o,e).catch(d=>this._onerror(d))});return}let r={...I,jsonrpc:"2.0"};await this._transport.send(r,e)}setRequestHandler(I,e){let l=I.shape.method.value;this.assertRequestHandlerCapability(l),this._requestHandlers.set(l,(c,n)=>Promise.resolve(e(I.parse(c),n)))}removeRequestHandler(I){this._requestHandlers.delete(I)}assertCanSetRequestHandler(I){if(this._requestHandlers.has(I))throw new Error(`A request handler for ${I} already exists, which would be overridden`)}setNotificationHandler(I,e){this._notificationHandlers.set(I.shape.method.value,l=>Promise.resolve(e(I.parse(l))))}removeNotificationHandler(I){this._notificationHandlers.delete(I)}};function ixI(t,I){return Object.entries(I).reduce((e,[l,c])=>(c&&typeof c=="object"?e[l]=e[l]?{...e[l],...c}:c:e[l]=c,e),{...t})}var TzI=Ac(MzI(),1),hP=class extends CK{constructor(I,e){var l;super(e),this._clientInfo=I,this._cachedToolOutputValidators=new Map,this._capabilities=(l=e?.capabilities)!==null&&l!==void 0?l:{},this._ajv=new TzI.default}registerCapabilities(I){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ixI(this._capabilities,I)}assertCapability(I,e){var l;if(!(!((l=this._serverCapabilities)===null||l===void 0)&&l[I]))throw new Error(`Server does not support ${I} (required for ${e})`)}async connect(I,e){if(await super.connect(I),I.sessionId===void 0)try{let l=await this.request({method:"initialize",params:{protocolVersion:IE,capabilities:this._capabilities,clientInfo:this._clientInfo}},KoI,e);if(l===void 0)throw new Error(`Server sent invalid initialize result: ${l}`);if(!DfI.includes(l.protocolVersion))throw new Error(`Server's protocol version is not supported: ${l.protocolVersion}`);this._serverCapabilities=l.capabilities,this._serverVersion=l.serverInfo,I.setProtocolVersion&&I.setProtocolVersion(l.protocolVersion),this._instructions=l.instructions,await this.notification({method:"notifications/initialized"})}catch(l){throw this.close(),l}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(I){var e,l,c,n,a;switch(I){case"logging/setLevel":if(!(!((e=this._serverCapabilities)===null||e===void 0)&&e.logging))throw new Error(`Server does not support logging (required for ${I})`);break;case"prompts/get":case"prompts/list":if(!(!((l=this._serverCapabilities)===null||l===void 0)&&l.prompts))throw new Error(`Server does not support prompts (required for ${I})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((c=this._serverCapabilities)===null||c===void 0)&&c.resources))throw new Error(`Server does not support resources (required for ${I})`);if(I==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${I})`);break;case"tools/call":case"tools/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${I})`);break;case"completion/complete":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.completions))throw new Error(`Server does not support completions (required for ${I})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(I){var e;switch(I){case"notifications/roots/list_changed":if(!(!((e=this._capabilities.roots)===null||e===void 0)&&e.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${I})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(I){switch(I){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${I})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${I})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${I})`);break;case"ping":break}}async ping(I){return this.request({method:"ping"},g0,I)}async complete(I,e){return this.request({method:"completion/complete",params:I},adI,e)}async setLoggingLevel(I,e){return this.request({method:"logging/setLevel",params:{level:I}},g0,e)}async getPrompt(I,e){return this.request({method:"prompts/get",params:I},cdI,e)}async listPrompts(I,e){return this.request({method:"prompts/list",params:I},IdI,e)}async listResources(I,e){return this.request({method:"resources/list",params:I},qoI,e)}async listResourceTemplates(I,e){return this.request({method:"resources/templates/list",params:I},_oI,e)}async readResource(I,e){return this.request({method:"resources/read",params:I},$oI,e)}async subscribeResource(I,e){return this.request({method:"resources/subscribe",params:I},g0,e)}async unsubscribeResource(I,e){return this.request({method:"resources/unsubscribe",params:I},g0,e)}async callTool(I,e=vK,l){let c=await this.request({method:"tools/call",params:I},e,l),n=this.getToolOutputValidator(I.name);if(n){if(!c.structuredContent&&!c.isError)throw new Gi(si.InvalidRequest,`Tool ${I.name} has an output schema but did not return structured content`);if(c.structuredContent)try{if(!n(c.structuredContent))throw new Gi(si.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(a){throw a instanceof Gi?a:new Gi(si.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return c}cacheToolOutputSchemas(I){this._cachedToolOutputValidators.clear();for(let e of I)if(e.outputSchema)try{let l=this._ajv.compile(e.outputSchema);this._cachedToolOutputValidators.set(e.name,l)}catch{}}getToolOutputValidator(I){return this._cachedToolOutputValidators.get(I)}async listTools(I,e){let l=await this.request({method:"tools/list",params:I},ndI,e);return this.cacheToolOutputSchemas(l.tools),l}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var pP=class{createClient(I,e){return new hP(I,e)}};G();G();G();G();var ZP=class extends Error{constructor(I,e){super(I),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}};function OiI(t){}function uP(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:I=OiI,onError:e=OiI,onRetry:l=OiI,onComment:c}=t,n="",a=!0,r,s="",o="";function d(W){let N=a?W.replace(/^\xEF\xBB\xBF/,""):W,[Y,F]=D3e(`${n}${N}`);for(let g of Y)i(g);n=F,a=!1}function i(W){if(W===""){p();return}if(W.startsWith(":")){c&&c(W.slice(W.startsWith(": ")?2:1));return}let N=W.indexOf(":");if(N!==-1){let Y=W.slice(0,N),F=W[N+1]===" "?2:1,g=W.slice(N+F);h(Y,g,W);return}h(W,"",W)}function h(W,N,Y){switch(W){case"event":o=N;break;case"data":s=`${s}${N}
|
|
1177
|
+
`,input_schema:{type:"object",properties:{question:{type:"string",description:"A question about the codebase. It should reference by name any topics, specific file names, and concepts that are relevant to the question and specify the desired output format."}},required:["question"]},callback:async l=>{let c,n=Ix(t),a="",r="",s=n.split("/");if(s.length===2){[a,r]=s,e.info("Searching for repository insights");try{c=await foI(l.question,a,r,I,e),e.info(`Blackbird results: ${c}`)}catch(o){e.error(`Error occurred while searching for repository insights: ${o}`)}}return{resultType:"success",textResultForLlm:c??"No results found.",toolTelemetry:{}}}}}async function JfI(t,I,e,l,c,n,a){let r=await xfI(t),s=await X1e(t,e,l),o=vfI(e)?[new ZK(l,e,c,n,t,t.location,YU(),a).getSearch()]:[],d=t.splitEditingTools?III(t,l,e):[FU(t,l,e)];return[r.shellTool,...r.otherTools??[],...s,...o,...d,AyI(t,I,e,l,c),Cl(e,ex)?WhI(t,l,c,e):void 0,t?.requireReasoning?eII(t):void 0,Cl(e,YyI)?VyI:void 0,await w1e(t,e,l,c)].filter(i=>i!==void 0)}async function LfI(t,I){let e=await xfI(t),l=t.splitEditingTools?III(t,I):[FU(t,I)];return[e.shellTool,...e.otherTools??[],...l,t?.requireReasoning?eII(t):void 0].filter(c=>c!==void 0)}async function A1e(t,I,e,l,c,n,a){return[...await JfI(t,I,e,l,c,n,a),yyI(t,l)]}var kfI=t=>({...Sh,supports:{...Sh.supports,reasoning:t?.thinkingMode?!0:Sh.supports?.reasoning}}),Sh={supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!1},createPR:{toolInit:JfI,jitInstructions:LoI},prDetails:{},respondToPRComment:{toolInit:A1e,jitInstructions:LoI}},ffI=t=>({"sweagent-capi":{"claude-3.5-sonnet":{...Sh,supports:{tool_choice:!1,reasoning:!1}},"claude-3.7-sonnet":{...Sh,supports:{tool_choice:!1,reasoning:!1,vision:!0}},"claude-sonnet-4":{...Sh,supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!0,vision:!0},toolConfigOverrides:{splitEditingTools:!0}},"claude-sonnet-4.5":{...Sh,supports:{tool_choice:!1,reasoning:!0,parallel_tool_calls:!0,vision:!0},toolConfigOverrides:{splitEditingTools:!0}},oswe:{...Sh,supports:{tool_choice:!0,reasoning:!0,vision:!0}},"oswe-prime":{...Sh,supports:{tool_choice:!0,reasoning:!0,vision:!0}},"gpt-5":{...Sh,supports:{tool_choice:!0,reasoning:!0,parallel_tool_calls:!0,vision:!0,steering:!0},toolConfigOverrides:{splitEditingTools:!0}}}});async function xfI(t){let I=new Nj(t);return{shellTool:I.getShellTool(),otherTools:[I.getWriteShellTool(),I.getReadShellTool(),I.getStopShellTool()]}}async function X1e(t,I,e){if(GsI(I,"cloud"))return[new Q4(new Kj(I,e,void 0)).getStoreMemory()];if(GsI(I,"local")){let l=new Q4(new Dj(t.location));return[l.getStoreMemory(),l.getReadMemory()]}return[]}async function w1e(t,I,e,l){if(t.includeCodeQLTool){let c=new $s(e,l),n=I.swebench_base_commit??await c.getCurrentCommitHash(t.location);return new uU(t,c,n,I,e).getCodeQLCheckerTool()}}G();G();import{Writable as Pke}from"stream";G();G();G();G();G();var R={};da(R,{BRAND:()=>tve,DIRTY:()=>d0,EMPTY_PATH:()=>C1e,INVALID:()=>Fe,NEVER:()=>Xve,OK:()=>Tr,ParseStatus:()=>br,Schema:()=>ht,ZodAny:()=>KY,ZodArray:()=>Wu,ZodBigInt:()=>b0,ZodBoolean:()=>m0,ZodBranded:()=>F9,ZodCatch:()=>F0,ZodDate:()=>h0,ZodDefault:()=>y0,ZodDiscriminatedUnion:()=>NK,ZodEffects:()=>ri,ZodEnum:()=>V0,ZodError:()=>jG,ZodFirstPartyTypeKind:()=>Xe,ZodFunction:()=>VK,ZodIntersection:()=>W0,ZodIssueCode:()=>RI,ZodLazy:()=>N0,ZodLiteral:()=>Y0,ZodMap:()=>qH,ZodNaN:()=>$H,ZodNativeEnum:()=>R0,ZodNever:()=>Fb,ZodNull:()=>Z0,ZodNullable:()=>Th,ZodNumber:()=>i0,ZodObject:()=>DG,ZodOptional:()=>ni,ZodParsedType:()=>KI,ZodPipeline:()=>Q9,ZodPromise:()=>PY,ZodReadonly:()=>Q0,ZodRecord:()=>YK,ZodSchema:()=>ht,ZodSet:()=>_H,ZodString:()=>DY,ZodSymbol:()=>KH,ZodTransformer:()=>ri,ZodTuple:()=>Mh,ZodType:()=>ht,ZodUndefined:()=>p0,ZodUnion:()=>u0,ZodUnknown:()=>uu,ZodVoid:()=>PH,addIssueToContext:()=>BI,any:()=>OoI,array:()=>jr,bigint:()=>ave,boolean:()=>Ba,coerce:()=>g9,custom:()=>jfI,date:()=>rve,datetimeRegex:()=>MfI,defaultErrorMap:()=>pu,discriminatedUnion:()=>ToI,effect:()=>Yve,enum:()=>Nu,function:()=>Zve,getErrorMap:()=>TH,getParsedType:()=>Oh,instanceof:()=>cve,intersection:()=>mve,isAborted:()=>uK,isAsync:()=>jH,isDirty:()=>WK,isValid:()=>jY,late:()=>lve,lazy:()=>uve,literal:()=>Gl,makeIssue:()=>y9,map:()=>hve,nan:()=>nve,nativeEnum:()=>Wve,never:()=>dve,null:()=>ove,nullable:()=>Rve,number:()=>jh,object:()=>we,objectUtil:()=>zoI,oboolean:()=>Ave,onumber:()=>gve,optional:()=>Vve,ostring:()=>Qve,pipeline:()=>Fve,preprocess:()=>yve,promise:()=>Nve,quotelessJson:()=>H1e,record:()=>RK,set:()=>pve,setErrorMap:()=>v1e,strictObject:()=>bve,string:()=>EI,symbol:()=>sve,transformer:()=>Yve,tuple:()=>joI,undefined:()=>Gve,union:()=>Dr,unknown:()=>MoI,util:()=>zt,void:()=>ive});G();G();G();G();G();var zt;(function(t){t.assertEqual=c=>{};function I(c){}t.assertIs=I;function e(c){throw new Error}t.assertNever=e,t.arrayToEnum=c=>{let n={};for(let a of c)n[a]=a;return n},t.getValidEnumValues=c=>{let n=t.objectKeys(c).filter(r=>typeof c[c[r]]!="number"),a={};for(let r of n)a[r]=c[r];return t.objectValues(a)},t.objectValues=c=>t.objectKeys(c).map(function(n){return c[n]}),t.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{let n=[];for(let a in c)Object.prototype.hasOwnProperty.call(c,a)&&n.push(a);return n},t.find=(c,n)=>{for(let a of c)if(n(a))return a},t.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function l(c,n=" | "){return c.map(a=>typeof a=="string"?`'${a}'`:a).join(n)}t.joinValues=l,t.jsonStringifyReplacer=(c,n)=>typeof n=="bigint"?n.toString():n})(zt||(zt={}));var zoI;(function(t){t.mergeShapes=(I,e)=>({...I,...e})})(zoI||(zoI={}));var KI=zt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Oh=t=>{switch(typeof t){case"undefined":return KI.undefined;case"string":return KI.string;case"number":return Number.isNaN(t)?KI.nan:KI.number;case"boolean":return KI.boolean;case"function":return KI.function;case"bigint":return KI.bigint;case"symbol":return KI.symbol;case"object":return Array.isArray(t)?KI.array:t===null?KI.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?KI.promise:typeof Map<"u"&&t instanceof Map?KI.map:typeof Set<"u"&&t instanceof Set?KI.set:typeof Date<"u"&&t instanceof Date?KI.date:KI.object;default:return KI.unknown}};var RI=zt.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"]),H1e=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),jG=class t extends Error{get errors(){return this.issues}constructor(I){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};let e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=I}format(I){let e=I||function(n){return n.message},l={_errors:[]},c=n=>{for(let a of n.issues)if(a.code==="invalid_union")a.unionErrors.map(c);else if(a.code==="invalid_return_type")c(a.returnTypeError);else if(a.code==="invalid_arguments")c(a.argumentsError);else if(a.path.length===0)l._errors.push(e(a));else{let r=l,s=0;for(;s<a.path.length;){let o=a.path[s];s===a.path.length-1?(r[o]=r[o]||{_errors:[]},r[o]._errors.push(e(a))):r[o]=r[o]||{_errors:[]},r=r[o],s++}}};return c(this),l}static assert(I){if(!(I instanceof t))throw new Error(`Not a ZodError: ${I}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,zt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(I=e=>e.message){let e={},l=[];for(let c of this.issues)if(c.path.length>0){let n=c.path[0];e[n]=e[n]||[],e[n].push(I(c))}else l.push(I(c));return{formErrors:l,fieldErrors:e}}get formErrors(){return this.flatten()}};jG.create=t=>new jG(t);var E1e=(t,I)=>{let e;switch(t.code){case RI.invalid_type:t.received===KI.undefined?e="Required":e=`Expected ${t.expected}, received ${t.received}`;break;case RI.invalid_literal:e=`Invalid literal value, expected ${JSON.stringify(t.expected,zt.jsonStringifyReplacer)}`;break;case RI.unrecognized_keys:e=`Unrecognized key(s) in object: ${zt.joinValues(t.keys,", ")}`;break;case RI.invalid_union:e="Invalid input";break;case RI.invalid_union_discriminator:e=`Invalid discriminator value. Expected ${zt.joinValues(t.options)}`;break;case RI.invalid_enum_value:e=`Invalid enum value. Expected ${zt.joinValues(t.options)}, received '${t.received}'`;break;case RI.invalid_arguments:e="Invalid function arguments";break;case RI.invalid_return_type:e="Invalid function return type";break;case RI.invalid_date:e="Invalid date";break;case RI.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(e=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(e=`${e} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?e=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?e=`Invalid input: must end with "${t.validation.endsWith}"`:zt.assertNever(t.validation):t.validation!=="regex"?e=`Invalid ${t.validation}`:e="Invalid";break;case RI.too_small:t.type==="array"?e=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?e=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?e=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?e=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?e=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:e="Invalid input";break;case RI.too_big:t.type==="array"?e=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?e=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?e=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?e=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?e=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:e="Invalid input";break;case RI.custom:e="Invalid input";break;case RI.invalid_intersection_types:e="Intersection results could not be merged";break;case RI.not_multiple_of:e=`Number must be a multiple of ${t.multipleOf}`;break;case RI.not_finite:e="Number must be finite";break;default:e=I.defaultError,zt.assertNever(t)}return{message:e}},pu=E1e;var BfI=pu;function v1e(t){BfI=t}function TH(){return BfI}G();var y9=t=>{let{data:I,path:e,errorMaps:l,issueData:c}=t,n=[...e,...c.path||[]],a={...c,path:n};if(c.message!==void 0)return{...c,path:n,message:c.message};let r="",s=l.filter(o=>!!o).slice().reverse();for(let o of s)r=o(a,{data:I,defaultError:r}).message;return{...c,path:n,message:r}},C1e=[];function BI(t,I){let e=TH(),l=y9({issueData:I,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,e,e===pu?void 0:pu].filter(c=>!!c)});t.common.issues.push(l)}var br=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(I,e){let l=[];for(let c of e){if(c.status==="aborted")return Fe;c.status==="dirty"&&I.dirty(),l.push(c.value)}return{status:I.value,value:l}}static async mergeObjectAsync(I,e){let l=[];for(let c of e){let n=await c.key,a=await c.value;l.push({key:n,value:a})}return t.mergeObjectSync(I,l)}static mergeObjectSync(I,e){let l={};for(let c of e){let{key:n,value:a}=c;if(n.status==="aborted"||a.status==="aborted")return Fe;n.status==="dirty"&&I.dirty(),a.status==="dirty"&&I.dirty(),n.value!=="__proto__"&&(typeof a.value<"u"||c.alwaysSet)&&(l[n.value]=a.value)}return{status:I.value,value:l}}},Fe=Object.freeze({status:"aborted"}),d0=t=>({status:"dirty",value:t}),Tr=t=>({status:"valid",value:t}),uK=t=>t.status==="aborted",WK=t=>t.status==="dirty",jY=t=>t.status==="valid",jH=t=>typeof Promise<"u"&&t instanceof Promise;G();G();var Ge;(function(t){t.errToObj=I=>typeof I=="string"?{message:I}:I||{},t.toString=I=>typeof I=="string"?I:I?.message})(Ge||(Ge={}));var ai=class{constructor(I,e,l,c){this._cachedPath=[],this.parent=I,this.data=e,this._path=l,this._key=c}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}},zfI=(t,I)=>{if(jY(I))return{success:!0,data:I.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let e=new jG(t.common.issues);return this._error=e,this._error}}};function at(t){if(!t)return{};let{errorMap:I,invalid_type_error:e,required_error:l,description:c}=t;if(I&&(e||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return I?{errorMap:I,description:c}:{errorMap:(a,r)=>{let{message:s}=t;return a.code==="invalid_enum_value"?{message:s??r.defaultError}:typeof r.data>"u"?{message:s??l??r.defaultError}:a.code!=="invalid_type"?{message:r.defaultError}:{message:s??e??r.defaultError}},description:c}}var ht=class{get description(){return this._def.description}_getType(I){return Oh(I.data)}_getOrReturnCtx(I,e){return e||{common:I.parent.common,data:I.data,parsedType:Oh(I.data),schemaErrorMap:this._def.errorMap,path:I.path,parent:I.parent}}_processInputParams(I){return{status:new br,ctx:{common:I.parent.common,data:I.data,parsedType:Oh(I.data),schemaErrorMap:this._def.errorMap,path:I.path,parent:I.parent}}}_parseSync(I){let e=this._parse(I);if(jH(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(I){let e=this._parse(I);return Promise.resolve(e)}parse(I,e){let l=this.safeParse(I,e);if(l.success)return l.data;throw l.error}safeParse(I,e){let l={common:{issues:[],async:e?.async??!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:Oh(I)},c=this._parseSync({data:I,path:l.path,parent:l});return zfI(l,c)}"~validate"(I){let e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:Oh(I)};if(!this["~standard"].async)try{let l=this._parseSync({data:I,path:[],parent:e});return jY(l)?{value:l.value}:{issues:e.common.issues}}catch(l){l?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),e.common={issues:[],async:!0}}return this._parseAsync({data:I,path:[],parent:e}).then(l=>jY(l)?{value:l.value}:{issues:e.common.issues})}async parseAsync(I,e){let l=await this.safeParseAsync(I,e);if(l.success)return l.data;throw l.error}async safeParseAsync(I,e){let l={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:I,parsedType:Oh(I)},c=this._parse({data:I,path:l.path,parent:l}),n=await(jH(c)?c:Promise.resolve(c));return zfI(l,n)}refine(I,e){let l=c=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(c):e;return this._refinement((c,n)=>{let a=I(c),r=()=>n.addIssue({code:RI.custom,...l(c)});return typeof Promise<"u"&&a instanceof Promise?a.then(s=>s?!0:(r(),!1)):a?!0:(r(),!1)})}refinement(I,e){return this._refinement((l,c)=>I(l)?!0:(c.addIssue(typeof e=="function"?e(l,c):e),!1))}_refinement(I){return new ri({schema:this,typeName:Xe.ZodEffects,effect:{type:"refinement",refinement:I}})}superRefine(I){return this._refinement(I)}constructor(I){this.spa=this.safeParseAsync,this._def=I,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:e=>this["~validate"](e)}}optional(){return ni.create(this,this._def)}nullable(){return Th.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wu.create(this)}promise(){return PY.create(this,this._def)}or(I){return u0.create([this,I],this._def)}and(I){return W0.create(this,I,this._def)}transform(I){return new ri({...at(this._def),schema:this,typeName:Xe.ZodEffects,effect:{type:"transform",transform:I}})}default(I){let e=typeof I=="function"?I:()=>I;return new y0({...at(this._def),innerType:this,defaultValue:e,typeName:Xe.ZodDefault})}brand(){return new F9({typeName:Xe.ZodBranded,type:this,...at(this._def)})}catch(I){let e=typeof I=="function"?I:()=>I;return new F0({...at(this._def),innerType:this,catchValue:e,typeName:Xe.ZodCatch})}describe(I){let e=this.constructor;return new e({...this._def,description:I})}pipe(I){return Q9.create(this,I)}readonly(){return Q0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},J1e=/^c[^\s-]{8,}$/i,L1e=/^[0-9a-z]+$/,k1e=/^[0-9A-HJKMNP-TV-Z]{26}$/i,f1e=/^[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,x1e=/^[a-z0-9_-]{21}$/i,B1e=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,z1e=/^[-+]?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)?)??$/,U1e=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,S1e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",UoI,O1e=/^(?:(?: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])$/,M1e=/^(?:(?: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])$/,T1e=/^(([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]))$/,j1e=/^(([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])$/,D1e=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,K1e=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,SfI="((\\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])))",P1e=new RegExp(`^${SfI}$`);function OfI(t){let I="[0-5]\\d";t.precision?I=`${I}\\.\\d{${t.precision}}`:t.precision==null&&(I=`${I}(\\.\\d+)?`);let e=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${I})${e}`}function q1e(t){return new RegExp(`^${OfI(t)}$`)}function MfI(t){let I=`${SfI}T${OfI(t)}`,e=[];return e.push(t.local?"Z?":"Z"),t.offset&&e.push("([+-]\\d{2}:?\\d{2})"),I=`${I}(${e.join("|")})`,new RegExp(`^${I}$`)}function _1e(t,I){return!!((I==="v4"||!I)&&O1e.test(t)||(I==="v6"||!I)&&T1e.test(t))}function $1e(t,I){if(!B1e.test(t))return!1;try{let[e]=t.split(".");if(!e)return!1;let l=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),c=JSON.parse(atob(l));return!(typeof c!="object"||c===null||"typ"in c&&c?.typ!=="JWT"||!c.alg||I&&c.alg!==I)}catch{return!1}}function Ive(t,I){return!!((I==="v4"||!I)&&M1e.test(t)||(I==="v6"||!I)&&j1e.test(t))}var DY=class t extends ht{_parse(I){if(this._def.coerce&&(I.data=String(I.data)),this._getType(I)!==KI.string){let n=this._getOrReturnCtx(I);return BI(n,{code:RI.invalid_type,expected:KI.string,received:n.parsedType}),Fe}let l=new br,c;for(let n of this._def.checks)if(n.kind==="min")I.data.length<n.value&&(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),l.dirty());else if(n.kind==="max")I.data.length>n.value&&(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),l.dirty());else if(n.kind==="length"){let a=I.data.length>n.value,r=I.data.length<n.value;(a||r)&&(c=this._getOrReturnCtx(I,c),a?BI(c,{code:RI.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&BI(c,{code:RI.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),l.dirty())}else if(n.kind==="email")U1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"email",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="emoji")UoI||(UoI=new RegExp(S1e,"u")),UoI.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"emoji",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="uuid")f1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"uuid",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="nanoid")x1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"nanoid",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="cuid")J1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"cuid",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="cuid2")L1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"cuid2",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="ulid")k1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"ulid",code:RI.invalid_string,message:n.message}),l.dirty());else if(n.kind==="url")try{new URL(I.data)}catch{c=this._getOrReturnCtx(I,c),BI(c,{validation:"url",code:RI.invalid_string,message:n.message}),l.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"regex",code:RI.invalid_string,message:n.message}),l.dirty())):n.kind==="trim"?I.data=I.data.trim():n.kind==="includes"?I.data.includes(n.value,n.position)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),l.dirty()):n.kind==="toLowerCase"?I.data=I.data.toLowerCase():n.kind==="toUpperCase"?I.data=I.data.toUpperCase():n.kind==="startsWith"?I.data.startsWith(n.value)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:{startsWith:n.value},message:n.message}),l.dirty()):n.kind==="endsWith"?I.data.endsWith(n.value)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:{endsWith:n.value},message:n.message}),l.dirty()):n.kind==="datetime"?MfI(n).test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:"datetime",message:n.message}),l.dirty()):n.kind==="date"?P1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:"date",message:n.message}),l.dirty()):n.kind==="time"?q1e(n).test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.invalid_string,validation:"time",message:n.message}),l.dirty()):n.kind==="duration"?z1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"duration",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="ip"?_1e(I.data,n.version)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"ip",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="jwt"?$1e(I.data,n.alg)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"jwt",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="cidr"?Ive(I.data,n.version)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"cidr",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="base64"?D1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"base64",code:RI.invalid_string,message:n.message}),l.dirty()):n.kind==="base64url"?K1e.test(I.data)||(c=this._getOrReturnCtx(I,c),BI(c,{validation:"base64url",code:RI.invalid_string,message:n.message}),l.dirty()):zt.assertNever(n);return{status:l.value,value:I.data}}_regex(I,e,l){return this.refinement(c=>I.test(c),{validation:e,code:RI.invalid_string,...Ge.errToObj(l)})}_addCheck(I){return new t({...this._def,checks:[...this._def.checks,I]})}email(I){return this._addCheck({kind:"email",...Ge.errToObj(I)})}url(I){return this._addCheck({kind:"url",...Ge.errToObj(I)})}emoji(I){return this._addCheck({kind:"emoji",...Ge.errToObj(I)})}uuid(I){return this._addCheck({kind:"uuid",...Ge.errToObj(I)})}nanoid(I){return this._addCheck({kind:"nanoid",...Ge.errToObj(I)})}cuid(I){return this._addCheck({kind:"cuid",...Ge.errToObj(I)})}cuid2(I){return this._addCheck({kind:"cuid2",...Ge.errToObj(I)})}ulid(I){return this._addCheck({kind:"ulid",...Ge.errToObj(I)})}base64(I){return this._addCheck({kind:"base64",...Ge.errToObj(I)})}base64url(I){return this._addCheck({kind:"base64url",...Ge.errToObj(I)})}jwt(I){return this._addCheck({kind:"jwt",...Ge.errToObj(I)})}ip(I){return this._addCheck({kind:"ip",...Ge.errToObj(I)})}cidr(I){return this._addCheck({kind:"cidr",...Ge.errToObj(I)})}datetime(I){return typeof I=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:I}):this._addCheck({kind:"datetime",precision:typeof I?.precision>"u"?null:I?.precision,offset:I?.offset??!1,local:I?.local??!1,...Ge.errToObj(I?.message)})}date(I){return this._addCheck({kind:"date",message:I})}time(I){return typeof I=="string"?this._addCheck({kind:"time",precision:null,message:I}):this._addCheck({kind:"time",precision:typeof I?.precision>"u"?null:I?.precision,...Ge.errToObj(I?.message)})}duration(I){return this._addCheck({kind:"duration",...Ge.errToObj(I)})}regex(I,e){return this._addCheck({kind:"regex",regex:I,...Ge.errToObj(e)})}includes(I,e){return this._addCheck({kind:"includes",value:I,position:e?.position,...Ge.errToObj(e?.message)})}startsWith(I,e){return this._addCheck({kind:"startsWith",value:I,...Ge.errToObj(e)})}endsWith(I,e){return this._addCheck({kind:"endsWith",value:I,...Ge.errToObj(e)})}min(I,e){return this._addCheck({kind:"min",value:I,...Ge.errToObj(e)})}max(I,e){return this._addCheck({kind:"max",value:I,...Ge.errToObj(e)})}length(I,e){return this._addCheck({kind:"length",value:I,...Ge.errToObj(e)})}nonempty(I){return this.min(1,Ge.errToObj(I))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(I=>I.kind==="datetime")}get isDate(){return!!this._def.checks.find(I=>I.kind==="date")}get isTime(){return!!this._def.checks.find(I=>I.kind==="time")}get isDuration(){return!!this._def.checks.find(I=>I.kind==="duration")}get isEmail(){return!!this._def.checks.find(I=>I.kind==="email")}get isURL(){return!!this._def.checks.find(I=>I.kind==="url")}get isEmoji(){return!!this._def.checks.find(I=>I.kind==="emoji")}get isUUID(){return!!this._def.checks.find(I=>I.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(I=>I.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(I=>I.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(I=>I.kind==="cuid2")}get isULID(){return!!this._def.checks.find(I=>I.kind==="ulid")}get isIP(){return!!this._def.checks.find(I=>I.kind==="ip")}get isCIDR(){return!!this._def.checks.find(I=>I.kind==="cidr")}get isBase64(){return!!this._def.checks.find(I=>I.kind==="base64")}get isBase64url(){return!!this._def.checks.find(I=>I.kind==="base64url")}get minLength(){let I=null;for(let e of this._def.checks)e.kind==="min"&&(I===null||e.value>I)&&(I=e.value);return I}get maxLength(){let I=null;for(let e of this._def.checks)e.kind==="max"&&(I===null||e.value<I)&&(I=e.value);return I}};DY.create=t=>new DY({checks:[],typeName:Xe.ZodString,coerce:t?.coerce??!1,...at(t)});function eve(t,I){let e=(t.toString().split(".")[1]||"").length,l=(I.toString().split(".")[1]||"").length,c=e>l?e:l,n=Number.parseInt(t.toFixed(c).replace(".","")),a=Number.parseInt(I.toFixed(c).replace(".",""));return n%a/10**c}var i0=class t extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(I){if(this._def.coerce&&(I.data=Number(I.data)),this._getType(I)!==KI.number){let n=this._getOrReturnCtx(I);return BI(n,{code:RI.invalid_type,expected:KI.number,received:n.parsedType}),Fe}let l,c=new br;for(let n of this._def.checks)n.kind==="int"?zt.isInteger(I.data)||(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.invalid_type,expected:"integer",received:"float",message:n.message}),c.dirty()):n.kind==="min"?(n.inclusive?I.data<n.value:I.data<=n.value)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),c.dirty()):n.kind==="max"?(n.inclusive?I.data>n.value:I.data>=n.value)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),c.dirty()):n.kind==="multipleOf"?eve(I.data,n.value)!==0&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.not_multiple_of,multipleOf:n.value,message:n.message}),c.dirty()):n.kind==="finite"?Number.isFinite(I.data)||(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.not_finite,message:n.message}),c.dirty()):zt.assertNever(n);return{status:c.value,value:I.data}}gte(I,e){return this.setLimit("min",I,!0,Ge.toString(e))}gt(I,e){return this.setLimit("min",I,!1,Ge.toString(e))}lte(I,e){return this.setLimit("max",I,!0,Ge.toString(e))}lt(I,e){return this.setLimit("max",I,!1,Ge.toString(e))}setLimit(I,e,l,c){return new t({...this._def,checks:[...this._def.checks,{kind:I,value:e,inclusive:l,message:Ge.toString(c)}]})}_addCheck(I){return new t({...this._def,checks:[...this._def.checks,I]})}int(I){return this._addCheck({kind:"int",message:Ge.toString(I)})}positive(I){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ge.toString(I)})}negative(I){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ge.toString(I)})}nonpositive(I){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ge.toString(I)})}nonnegative(I){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ge.toString(I)})}multipleOf(I,e){return this._addCheck({kind:"multipleOf",value:I,message:Ge.toString(e)})}finite(I){return this._addCheck({kind:"finite",message:Ge.toString(I)})}safe(I){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ge.toString(I)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ge.toString(I)})}get minValue(){let I=null;for(let e of this._def.checks)e.kind==="min"&&(I===null||e.value>I)&&(I=e.value);return I}get maxValue(){let I=null;for(let e of this._def.checks)e.kind==="max"&&(I===null||e.value<I)&&(I=e.value);return I}get isInt(){return!!this._def.checks.find(I=>I.kind==="int"||I.kind==="multipleOf"&&zt.isInteger(I.value))}get isFinite(){let I=null,e=null;for(let l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(e===null||l.value>e)&&(e=l.value):l.kind==="max"&&(I===null||l.value<I)&&(I=l.value)}return Number.isFinite(e)&&Number.isFinite(I)}};i0.create=t=>new i0({checks:[],typeName:Xe.ZodNumber,coerce:t?.coerce||!1,...at(t)});var b0=class t extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(I){if(this._def.coerce)try{I.data=BigInt(I.data)}catch{return this._getInvalidInput(I)}if(this._getType(I)!==KI.bigint)return this._getInvalidInput(I);let l,c=new br;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?I.data<n.value:I.data<=n.value)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),c.dirty()):n.kind==="max"?(n.inclusive?I.data>n.value:I.data>=n.value)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),c.dirty()):n.kind==="multipleOf"?I.data%n.value!==BigInt(0)&&(l=this._getOrReturnCtx(I,l),BI(l,{code:RI.not_multiple_of,multipleOf:n.value,message:n.message}),c.dirty()):zt.assertNever(n);return{status:c.value,value:I.data}}_getInvalidInput(I){let e=this._getOrReturnCtx(I);return BI(e,{code:RI.invalid_type,expected:KI.bigint,received:e.parsedType}),Fe}gte(I,e){return this.setLimit("min",I,!0,Ge.toString(e))}gt(I,e){return this.setLimit("min",I,!1,Ge.toString(e))}lte(I,e){return this.setLimit("max",I,!0,Ge.toString(e))}lt(I,e){return this.setLimit("max",I,!1,Ge.toString(e))}setLimit(I,e,l,c){return new t({...this._def,checks:[...this._def.checks,{kind:I,value:e,inclusive:l,message:Ge.toString(c)}]})}_addCheck(I){return new t({...this._def,checks:[...this._def.checks,I]})}positive(I){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ge.toString(I)})}negative(I){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ge.toString(I)})}nonpositive(I){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ge.toString(I)})}nonnegative(I){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ge.toString(I)})}multipleOf(I,e){return this._addCheck({kind:"multipleOf",value:I,message:Ge.toString(e)})}get minValue(){let I=null;for(let e of this._def.checks)e.kind==="min"&&(I===null||e.value>I)&&(I=e.value);return I}get maxValue(){let I=null;for(let e of this._def.checks)e.kind==="max"&&(I===null||e.value<I)&&(I=e.value);return I}};b0.create=t=>new b0({checks:[],typeName:Xe.ZodBigInt,coerce:t?.coerce??!1,...at(t)});var m0=class extends ht{_parse(I){if(this._def.coerce&&(I.data=!!I.data),this._getType(I)!==KI.boolean){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.boolean,received:l.parsedType}),Fe}return Tr(I.data)}};m0.create=t=>new m0({typeName:Xe.ZodBoolean,coerce:t?.coerce||!1,...at(t)});var h0=class t extends ht{_parse(I){if(this._def.coerce&&(I.data=new Date(I.data)),this._getType(I)!==KI.date){let n=this._getOrReturnCtx(I);return BI(n,{code:RI.invalid_type,expected:KI.date,received:n.parsedType}),Fe}if(Number.isNaN(I.data.getTime())){let n=this._getOrReturnCtx(I);return BI(n,{code:RI.invalid_date}),Fe}let l=new br,c;for(let n of this._def.checks)n.kind==="min"?I.data.getTime()<n.value&&(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),l.dirty()):n.kind==="max"?I.data.getTime()>n.value&&(c=this._getOrReturnCtx(I,c),BI(c,{code:RI.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),l.dirty()):zt.assertNever(n);return{status:l.value,value:new Date(I.data.getTime())}}_addCheck(I){return new t({...this._def,checks:[...this._def.checks,I]})}min(I,e){return this._addCheck({kind:"min",value:I.getTime(),message:Ge.toString(e)})}max(I,e){return this._addCheck({kind:"max",value:I.getTime(),message:Ge.toString(e)})}get minDate(){let I=null;for(let e of this._def.checks)e.kind==="min"&&(I===null||e.value>I)&&(I=e.value);return I!=null?new Date(I):null}get maxDate(){let I=null;for(let e of this._def.checks)e.kind==="max"&&(I===null||e.value<I)&&(I=e.value);return I!=null?new Date(I):null}};h0.create=t=>new h0({checks:[],coerce:t?.coerce||!1,typeName:Xe.ZodDate,...at(t)});var KH=class extends ht{_parse(I){if(this._getType(I)!==KI.symbol){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.symbol,received:l.parsedType}),Fe}return Tr(I.data)}};KH.create=t=>new KH({typeName:Xe.ZodSymbol,...at(t)});var p0=class extends ht{_parse(I){if(this._getType(I)!==KI.undefined){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.undefined,received:l.parsedType}),Fe}return Tr(I.data)}};p0.create=t=>new p0({typeName:Xe.ZodUndefined,...at(t)});var Z0=class extends ht{_parse(I){if(this._getType(I)!==KI.null){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.null,received:l.parsedType}),Fe}return Tr(I.data)}};Z0.create=t=>new Z0({typeName:Xe.ZodNull,...at(t)});var KY=class extends ht{constructor(){super(...arguments),this._any=!0}_parse(I){return Tr(I.data)}};KY.create=t=>new KY({typeName:Xe.ZodAny,...at(t)});var uu=class extends ht{constructor(){super(...arguments),this._unknown=!0}_parse(I){return Tr(I.data)}};uu.create=t=>new uu({typeName:Xe.ZodUnknown,...at(t)});var Fb=class extends ht{_parse(I){let e=this._getOrReturnCtx(I);return BI(e,{code:RI.invalid_type,expected:KI.never,received:e.parsedType}),Fe}};Fb.create=t=>new Fb({typeName:Xe.ZodNever,...at(t)});var PH=class extends ht{_parse(I){if(this._getType(I)!==KI.undefined){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.void,received:l.parsedType}),Fe}return Tr(I.data)}};PH.create=t=>new PH({typeName:Xe.ZodVoid,...at(t)});var Wu=class t extends ht{_parse(I){let{ctx:e,status:l}=this._processInputParams(I),c=this._def;if(e.parsedType!==KI.array)return BI(e,{code:RI.invalid_type,expected:KI.array,received:e.parsedType}),Fe;if(c.exactLength!==null){let a=e.data.length>c.exactLength.value,r=e.data.length<c.exactLength.value;(a||r)&&(BI(e,{code:a?RI.too_big:RI.too_small,minimum:r?c.exactLength.value:void 0,maximum:a?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),l.dirty())}if(c.minLength!==null&&e.data.length<c.minLength.value&&(BI(e,{code:RI.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),l.dirty()),c.maxLength!==null&&e.data.length>c.maxLength.value&&(BI(e,{code:RI.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),l.dirty()),e.common.async)return Promise.all([...e.data].map((a,r)=>c.type._parseAsync(new ai(e,a,e.path,r)))).then(a=>br.mergeArray(l,a));let n=[...e.data].map((a,r)=>c.type._parseSync(new ai(e,a,e.path,r)));return br.mergeArray(l,n)}get element(){return this._def.type}min(I,e){return new t({...this._def,minLength:{value:I,message:Ge.toString(e)}})}max(I,e){return new t({...this._def,maxLength:{value:I,message:Ge.toString(e)}})}length(I,e){return new t({...this._def,exactLength:{value:I,message:Ge.toString(e)}})}nonempty(I){return this.min(1,I)}};Wu.create=(t,I)=>new Wu({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Xe.ZodArray,...at(I)});function DH(t){if(t instanceof DG){let I={};for(let e in t.shape){let l=t.shape[e];I[e]=ni.create(DH(l))}return new DG({...t._def,shape:()=>I})}else return t instanceof Wu?new Wu({...t._def,type:DH(t.element)}):t instanceof ni?ni.create(DH(t.unwrap())):t instanceof Th?Th.create(DH(t.unwrap())):t instanceof Mh?Mh.create(t.items.map(I=>DH(I))):t}var DG=class t extends ht{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let I=this._def.shape(),e=zt.objectKeys(I);return this._cached={shape:I,keys:e},this._cached}_parse(I){if(this._getType(I)!==KI.object){let o=this._getOrReturnCtx(I);return BI(o,{code:RI.invalid_type,expected:KI.object,received:o.parsedType}),Fe}let{status:l,ctx:c}=this._processInputParams(I),{shape:n,keys:a}=this._getCached(),r=[];if(!(this._def.catchall instanceof Fb&&this._def.unknownKeys==="strip"))for(let o in c.data)a.includes(o)||r.push(o);let s=[];for(let o of a){let d=n[o],i=c.data[o];s.push({key:{status:"valid",value:o},value:d._parse(new ai(c,i,c.path,o)),alwaysSet:o in c.data})}if(this._def.catchall instanceof Fb){let o=this._def.unknownKeys;if(o==="passthrough")for(let d of r)s.push({key:{status:"valid",value:d},value:{status:"valid",value:c.data[d]}});else if(o==="strict")r.length>0&&(BI(c,{code:RI.unrecognized_keys,keys:r}),l.dirty());else if(o!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let o=this._def.catchall;for(let d of r){let i=c.data[d];s.push({key:{status:"valid",value:d},value:o._parse(new ai(c,i,c.path,d)),alwaysSet:d in c.data})}}return c.common.async?Promise.resolve().then(async()=>{let o=[];for(let d of s){let i=await d.key,h=await d.value;o.push({key:i,value:h,alwaysSet:d.alwaysSet})}return o}).then(o=>br.mergeObjectSync(l,o)):br.mergeObjectSync(l,s)}get shape(){return this._def.shape()}strict(I){return Ge.errToObj,new t({...this._def,unknownKeys:"strict",...I!==void 0?{errorMap:(e,l)=>{let c=this._def.errorMap?.(e,l).message??l.defaultError;return e.code==="unrecognized_keys"?{message:Ge.errToObj(I).message??c}:{message:c}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(I){return new t({...this._def,shape:()=>({...this._def.shape(),...I})})}merge(I){return new t({unknownKeys:I._def.unknownKeys,catchall:I._def.catchall,shape:()=>({...this._def.shape(),...I._def.shape()}),typeName:Xe.ZodObject})}setKey(I,e){return this.augment({[I]:e})}catchall(I){return new t({...this._def,catchall:I})}pick(I){let e={};for(let l of zt.objectKeys(I))I[l]&&this.shape[l]&&(e[l]=this.shape[l]);return new t({...this._def,shape:()=>e})}omit(I){let e={};for(let l of zt.objectKeys(this.shape))I[l]||(e[l]=this.shape[l]);return new t({...this._def,shape:()=>e})}deepPartial(){return DH(this)}partial(I){let e={};for(let l of zt.objectKeys(this.shape)){let c=this.shape[l];I&&!I[l]?e[l]=c:e[l]=c.optional()}return new t({...this._def,shape:()=>e})}required(I){let e={};for(let l of zt.objectKeys(this.shape))if(I&&!I[l])e[l]=this.shape[l];else{let n=this.shape[l];for(;n instanceof ni;)n=n._def.innerType;e[l]=n}return new t({...this._def,shape:()=>e})}keyof(){return TfI(zt.objectKeys(this.shape))}};DG.create=(t,I)=>new DG({shape:()=>t,unknownKeys:"strip",catchall:Fb.create(),typeName:Xe.ZodObject,...at(I)});DG.strictCreate=(t,I)=>new DG({shape:()=>t,unknownKeys:"strict",catchall:Fb.create(),typeName:Xe.ZodObject,...at(I)});DG.lazycreate=(t,I)=>new DG({shape:t,unknownKeys:"strip",catchall:Fb.create(),typeName:Xe.ZodObject,...at(I)});var u0=class extends ht{_parse(I){let{ctx:e}=this._processInputParams(I),l=this._def.options;function c(n){for(let r of n)if(r.result.status==="valid")return r.result;for(let r of n)if(r.result.status==="dirty")return e.common.issues.push(...r.ctx.common.issues),r.result;let a=n.map(r=>new jG(r.ctx.common.issues));return BI(e,{code:RI.invalid_union,unionErrors:a}),Fe}if(e.common.async)return Promise.all(l.map(async n=>{let a={...e,common:{...e.common,issues:[]},parent:null};return{result:await n._parseAsync({data:e.data,path:e.path,parent:a}),ctx:a}})).then(c);{let n,a=[];for(let s of l){let o={...e,common:{...e.common,issues:[]},parent:null},d=s._parseSync({data:e.data,path:e.path,parent:o});if(d.status==="valid")return d;d.status==="dirty"&&!n&&(n={result:d,ctx:o}),o.common.issues.length&&a.push(o.common.issues)}if(n)return e.common.issues.push(...n.ctx.common.issues),n.result;let r=a.map(s=>new jG(s));return BI(e,{code:RI.invalid_union,unionErrors:r}),Fe}}get options(){return this._def.options}};u0.create=(t,I)=>new u0({options:t,typeName:Xe.ZodUnion,...at(I)});var Zu=t=>t instanceof N0?Zu(t.schema):t instanceof ri?Zu(t.innerType()):t instanceof Y0?[t.value]:t instanceof V0?t.options:t instanceof R0?zt.objectValues(t.enum):t instanceof y0?Zu(t._def.innerType):t instanceof p0?[void 0]:t instanceof Z0?[null]:t instanceof ni?[void 0,...Zu(t.unwrap())]:t instanceof Th?[null,...Zu(t.unwrap())]:t instanceof F9||t instanceof Q0?Zu(t.unwrap()):t instanceof F0?Zu(t._def.innerType):[],NK=class t extends ht{_parse(I){let{ctx:e}=this._processInputParams(I);if(e.parsedType!==KI.object)return BI(e,{code:RI.invalid_type,expected:KI.object,received:e.parsedType}),Fe;let l=this.discriminator,c=e.data[l],n=this.optionsMap.get(c);return n?e.common.async?n._parseAsync({data:e.data,path:e.path,parent:e}):n._parseSync({data:e.data,path:e.path,parent:e}):(BI(e,{code:RI.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[l]}),Fe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(I,e,l){let c=new Map;for(let n of e){let a=Zu(n.shape[I]);if(!a.length)throw new Error(`A discriminator value for key \`${I}\` could not be extracted from all schema options`);for(let r of a){if(c.has(r))throw new Error(`Discriminator property ${String(I)} has duplicate value ${String(r)}`);c.set(r,n)}}return new t({typeName:Xe.ZodDiscriminatedUnion,discriminator:I,options:e,optionsMap:c,...at(l)})}};function SoI(t,I){let e=Oh(t),l=Oh(I);if(t===I)return{valid:!0,data:t};if(e===KI.object&&l===KI.object){let c=zt.objectKeys(I),n=zt.objectKeys(t).filter(r=>c.indexOf(r)!==-1),a={...t,...I};for(let r of n){let s=SoI(t[r],I[r]);if(!s.valid)return{valid:!1};a[r]=s.data}return{valid:!0,data:a}}else if(e===KI.array&&l===KI.array){if(t.length!==I.length)return{valid:!1};let c=[];for(let n=0;n<t.length;n++){let a=t[n],r=I[n],s=SoI(a,r);if(!s.valid)return{valid:!1};c.push(s.data)}return{valid:!0,data:c}}else return e===KI.date&&l===KI.date&&+t==+I?{valid:!0,data:t}:{valid:!1}}var W0=class extends ht{_parse(I){let{status:e,ctx:l}=this._processInputParams(I),c=(n,a)=>{if(uK(n)||uK(a))return Fe;let r=SoI(n.value,a.value);return r.valid?((WK(n)||WK(a))&&e.dirty(),{status:e.value,value:r.data}):(BI(l,{code:RI.invalid_intersection_types}),Fe)};return l.common.async?Promise.all([this._def.left._parseAsync({data:l.data,path:l.path,parent:l}),this._def.right._parseAsync({data:l.data,path:l.path,parent:l})]).then(([n,a])=>c(n,a)):c(this._def.left._parseSync({data:l.data,path:l.path,parent:l}),this._def.right._parseSync({data:l.data,path:l.path,parent:l}))}};W0.create=(t,I,e)=>new W0({left:t,right:I,typeName:Xe.ZodIntersection,...at(e)});var Mh=class t extends ht{_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.parsedType!==KI.array)return BI(l,{code:RI.invalid_type,expected:KI.array,received:l.parsedType}),Fe;if(l.data.length<this._def.items.length)return BI(l,{code:RI.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Fe;!this._def.rest&&l.data.length>this._def.items.length&&(BI(l,{code:RI.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty());let n=[...l.data].map((a,r)=>{let s=this._def.items[r]||this._def.rest;return s?s._parse(new ai(l,a,l.path,r)):null}).filter(a=>!!a);return l.common.async?Promise.all(n).then(a=>br.mergeArray(e,a)):br.mergeArray(e,n)}get items(){return this._def.items}rest(I){return new t({...this._def,rest:I})}};Mh.create=(t,I)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Mh({items:t,typeName:Xe.ZodTuple,rest:null,...at(I)})};var YK=class t extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.parsedType!==KI.object)return BI(l,{code:RI.invalid_type,expected:KI.object,received:l.parsedType}),Fe;let c=[],n=this._def.keyType,a=this._def.valueType;for(let r in l.data)c.push({key:n._parse(new ai(l,r,l.path,r)),value:a._parse(new ai(l,l.data[r],l.path,r)),alwaysSet:r in l.data});return l.common.async?br.mergeObjectAsync(e,c):br.mergeObjectSync(e,c)}get element(){return this._def.valueType}static create(I,e,l){return e instanceof ht?new t({keyType:I,valueType:e,typeName:Xe.ZodRecord,...at(l)}):new t({keyType:DY.create(),valueType:I,typeName:Xe.ZodRecord,...at(e)})}},qH=class extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.parsedType!==KI.map)return BI(l,{code:RI.invalid_type,expected:KI.map,received:l.parsedType}),Fe;let c=this._def.keyType,n=this._def.valueType,a=[...l.data.entries()].map(([r,s],o)=>({key:c._parse(new ai(l,r,l.path,[o,"key"])),value:n._parse(new ai(l,s,l.path,[o,"value"]))}));if(l.common.async){let r=new Map;return Promise.resolve().then(async()=>{for(let s of a){let o=await s.key,d=await s.value;if(o.status==="aborted"||d.status==="aborted")return Fe;(o.status==="dirty"||d.status==="dirty")&&e.dirty(),r.set(o.value,d.value)}return{status:e.value,value:r}})}else{let r=new Map;for(let s of a){let o=s.key,d=s.value;if(o.status==="aborted"||d.status==="aborted")return Fe;(o.status==="dirty"||d.status==="dirty")&&e.dirty(),r.set(o.value,d.value)}return{status:e.value,value:r}}}};qH.create=(t,I,e)=>new qH({valueType:I,keyType:t,typeName:Xe.ZodMap,...at(e)});var _H=class t extends ht{_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.parsedType!==KI.set)return BI(l,{code:RI.invalid_type,expected:KI.set,received:l.parsedType}),Fe;let c=this._def;c.minSize!==null&&l.data.size<c.minSize.value&&(BI(l,{code:RI.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),e.dirty()),c.maxSize!==null&&l.data.size>c.maxSize.value&&(BI(l,{code:RI.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),e.dirty());let n=this._def.valueType;function a(s){let o=new Set;for(let d of s){if(d.status==="aborted")return Fe;d.status==="dirty"&&e.dirty(),o.add(d.value)}return{status:e.value,value:o}}let r=[...l.data.values()].map((s,o)=>n._parse(new ai(l,s,l.path,o)));return l.common.async?Promise.all(r).then(s=>a(s)):a(r)}min(I,e){return new t({...this._def,minSize:{value:I,message:Ge.toString(e)}})}max(I,e){return new t({...this._def,maxSize:{value:I,message:Ge.toString(e)}})}size(I,e){return this.min(I,e).max(I,e)}nonempty(I){return this.min(1,I)}};_H.create=(t,I)=>new _H({valueType:t,minSize:null,maxSize:null,typeName:Xe.ZodSet,...at(I)});var VK=class t extends ht{constructor(){super(...arguments),this.validate=this.implement}_parse(I){let{ctx:e}=this._processInputParams(I);if(e.parsedType!==KI.function)return BI(e,{code:RI.invalid_type,expected:KI.function,received:e.parsedType}),Fe;function l(r,s){return y9({data:r,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,TH(),pu].filter(o=>!!o),issueData:{code:RI.invalid_arguments,argumentsError:s}})}function c(r,s){return y9({data:r,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,TH(),pu].filter(o=>!!o),issueData:{code:RI.invalid_return_type,returnTypeError:s}})}let n={errorMap:e.common.contextualErrorMap},a=e.data;if(this._def.returns instanceof PY){let r=this;return Tr(async function(...s){let o=new jG([]),d=await r._def.args.parseAsync(s,n).catch(p=>{throw o.addIssue(l(s,p)),o}),i=await Reflect.apply(a,this,d);return await r._def.returns._def.type.parseAsync(i,n).catch(p=>{throw o.addIssue(c(i,p)),o})})}else{let r=this;return Tr(function(...s){let o=r._def.args.safeParse(s,n);if(!o.success)throw new jG([l(s,o.error)]);let d=Reflect.apply(a,this,o.data),i=r._def.returns.safeParse(d,n);if(!i.success)throw new jG([c(d,i.error)]);return i.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...I){return new t({...this._def,args:Mh.create(I).rest(uu.create())})}returns(I){return new t({...this._def,returns:I})}implement(I){return this.parse(I)}strictImplement(I){return this.parse(I)}static create(I,e,l){return new t({args:I||Mh.create([]).rest(uu.create()),returns:e||uu.create(),typeName:Xe.ZodFunction,...at(l)})}},N0=class extends ht{get schema(){return this._def.getter()}_parse(I){let{ctx:e}=this._processInputParams(I);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};N0.create=(t,I)=>new N0({getter:t,typeName:Xe.ZodLazy,...at(I)});var Y0=class extends ht{_parse(I){if(I.data!==this._def.value){let e=this._getOrReturnCtx(I);return BI(e,{received:e.data,code:RI.invalid_literal,expected:this._def.value}),Fe}return{status:"valid",value:I.data}}get value(){return this._def.value}};Y0.create=(t,I)=>new Y0({value:t,typeName:Xe.ZodLiteral,...at(I)});function TfI(t,I){return new V0({values:t,typeName:Xe.ZodEnum,...at(I)})}var V0=class t extends ht{_parse(I){if(typeof I.data!="string"){let e=this._getOrReturnCtx(I),l=this._def.values;return BI(e,{expected:zt.joinValues(l),received:e.parsedType,code:RI.invalid_type}),Fe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(I.data)){let e=this._getOrReturnCtx(I),l=this._def.values;return BI(e,{received:e.data,code:RI.invalid_enum_value,options:l}),Fe}return Tr(I.data)}get options(){return this._def.values}get enum(){let I={};for(let e of this._def.values)I[e]=e;return I}get Values(){let I={};for(let e of this._def.values)I[e]=e;return I}get Enum(){let I={};for(let e of this._def.values)I[e]=e;return I}extract(I,e=this._def){return t.create(I,{...this._def,...e})}exclude(I,e=this._def){return t.create(this.options.filter(l=>!I.includes(l)),{...this._def,...e})}};V0.create=TfI;var R0=class extends ht{_parse(I){let e=zt.getValidEnumValues(this._def.values),l=this._getOrReturnCtx(I);if(l.parsedType!==KI.string&&l.parsedType!==KI.number){let c=zt.objectValues(e);return BI(l,{expected:zt.joinValues(c),received:l.parsedType,code:RI.invalid_type}),Fe}if(this._cache||(this._cache=new Set(zt.getValidEnumValues(this._def.values))),!this._cache.has(I.data)){let c=zt.objectValues(e);return BI(l,{received:l.data,code:RI.invalid_enum_value,options:c}),Fe}return Tr(I.data)}get enum(){return this._def.values}};R0.create=(t,I)=>new R0({values:t,typeName:Xe.ZodNativeEnum,...at(I)});var PY=class extends ht{unwrap(){return this._def.type}_parse(I){let{ctx:e}=this._processInputParams(I);if(e.parsedType!==KI.promise&&e.common.async===!1)return BI(e,{code:RI.invalid_type,expected:KI.promise,received:e.parsedType}),Fe;let l=e.parsedType===KI.promise?e.data:Promise.resolve(e.data);return Tr(l.then(c=>this._def.type.parseAsync(c,{path:e.path,errorMap:e.common.contextualErrorMap})))}};PY.create=(t,I)=>new PY({type:t,typeName:Xe.ZodPromise,...at(I)});var ri=class extends ht{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(I){let{status:e,ctx:l}=this._processInputParams(I),c=this._def.effect||null,n={addIssue:a=>{BI(l,a),a.fatal?e.abort():e.dirty()},get path(){return l.path}};if(n.addIssue=n.addIssue.bind(n),c.type==="preprocess"){let a=c.transform(l.data,n);if(l.common.async)return Promise.resolve(a).then(async r=>{if(e.value==="aborted")return Fe;let s=await this._def.schema._parseAsync({data:r,path:l.path,parent:l});return s.status==="aborted"?Fe:s.status==="dirty"?d0(s.value):e.value==="dirty"?d0(s.value):s});{if(e.value==="aborted")return Fe;let r=this._def.schema._parseSync({data:a,path:l.path,parent:l});return r.status==="aborted"?Fe:r.status==="dirty"?d0(r.value):e.value==="dirty"?d0(r.value):r}}if(c.type==="refinement"){let a=r=>{let s=c.refinement(r,n);if(l.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return r};if(l.common.async===!1){let r=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});return r.status==="aborted"?Fe:(r.status==="dirty"&&e.dirty(),a(r.value),{status:e.value,value:r.value})}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(r=>r.status==="aborted"?Fe:(r.status==="dirty"&&e.dirty(),a(r.value).then(()=>({status:e.value,value:r.value}))))}if(c.type==="transform")if(l.common.async===!1){let a=this._def.schema._parseSync({data:l.data,path:l.path,parent:l});if(!jY(a))return Fe;let r=c.transform(a.value,n);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:r}}else return this._def.schema._parseAsync({data:l.data,path:l.path,parent:l}).then(a=>jY(a)?Promise.resolve(c.transform(a.value,n)).then(r=>({status:e.value,value:r})):Fe);zt.assertNever(c)}};ri.create=(t,I,e)=>new ri({schema:t,typeName:Xe.ZodEffects,effect:I,...at(e)});ri.createWithPreprocess=(t,I,e)=>new ri({schema:I,effect:{type:"preprocess",transform:t},typeName:Xe.ZodEffects,...at(e)});var ni=class extends ht{_parse(I){return this._getType(I)===KI.undefined?Tr(void 0):this._def.innerType._parse(I)}unwrap(){return this._def.innerType}};ni.create=(t,I)=>new ni({innerType:t,typeName:Xe.ZodOptional,...at(I)});var Th=class extends ht{_parse(I){return this._getType(I)===KI.null?Tr(null):this._def.innerType._parse(I)}unwrap(){return this._def.innerType}};Th.create=(t,I)=>new Th({innerType:t,typeName:Xe.ZodNullable,...at(I)});var y0=class extends ht{_parse(I){let{ctx:e}=this._processInputParams(I),l=e.data;return e.parsedType===KI.undefined&&(l=this._def.defaultValue()),this._def.innerType._parse({data:l,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};y0.create=(t,I)=>new y0({innerType:t,typeName:Xe.ZodDefault,defaultValue:typeof I.default=="function"?I.default:()=>I.default,...at(I)});var F0=class extends ht{_parse(I){let{ctx:e}=this._processInputParams(I),l={...e,common:{...e.common,issues:[]}},c=this._def.innerType._parse({data:l.data,path:l.path,parent:{...l}});return jH(c)?c.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new jG(l.common.issues)},input:l.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new jG(l.common.issues)},input:l.data})}}removeCatch(){return this._def.innerType}};F0.create=(t,I)=>new F0({innerType:t,typeName:Xe.ZodCatch,catchValue:typeof I.catch=="function"?I.catch:()=>I.catch,...at(I)});var $H=class extends ht{_parse(I){if(this._getType(I)!==KI.nan){let l=this._getOrReturnCtx(I);return BI(l,{code:RI.invalid_type,expected:KI.nan,received:l.parsedType}),Fe}return{status:"valid",value:I.data}}};$H.create=t=>new $H({typeName:Xe.ZodNaN,...at(t)});var tve=Symbol("zod_brand"),F9=class extends ht{_parse(I){let{ctx:e}=this._processInputParams(I),l=e.data;return this._def.type._parse({data:l,path:e.path,parent:e})}unwrap(){return this._def.type}},Q9=class t extends ht{_parse(I){let{status:e,ctx:l}=this._processInputParams(I);if(l.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return n.status==="aborted"?Fe:n.status==="dirty"?(e.dirty(),d0(n.value)):this._def.out._parseAsync({data:n.value,path:l.path,parent:l})})();{let c=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return c.status==="aborted"?Fe:c.status==="dirty"?(e.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:l.path,parent:l})}}static create(I,e){return new t({in:I,out:e,typeName:Xe.ZodPipeline})}},Q0=class extends ht{_parse(I){let e=this._def.innerType._parse(I),l=c=>(jY(c)&&(c.value=Object.freeze(c.value)),c);return jH(e)?e.then(c=>l(c)):l(e)}unwrap(){return this._def.innerType}};Q0.create=(t,I)=>new Q0({innerType:t,typeName:Xe.ZodReadonly,...at(I)});function UfI(t,I){let e=typeof t=="function"?t(I):typeof t=="string"?{message:t}:t;return typeof e=="string"?{message:e}:e}function jfI(t,I={},e){return t?KY.create().superRefine((l,c)=>{let n=t(l);if(n instanceof Promise)return n.then(a=>{if(!a){let r=UfI(I,l),s=r.fatal??e??!0;c.addIssue({code:"custom",...r,fatal:s})}});if(!n){let a=UfI(I,l),r=a.fatal??e??!0;c.addIssue({code:"custom",...a,fatal:r})}}):KY.create()}var lve={object:DG.lazycreate},Xe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Xe||(Xe={}));var cve=(t,I={message:`Input not instance of ${t.name}`})=>jfI(e=>e instanceof t,I),EI=DY.create,jh=i0.create,nve=$H.create,ave=b0.create,Ba=m0.create,rve=h0.create,sve=KH.create,Gve=p0.create,ove=Z0.create,OoI=KY.create,MoI=uu.create,dve=Fb.create,ive=PH.create,jr=Wu.create,we=DG.create,bve=DG.strictCreate,Dr=u0.create,ToI=NK.create,mve=W0.create,joI=Mh.create,RK=YK.create,hve=qH.create,pve=_H.create,Zve=VK.create,uve=N0.create,Gl=Y0.create,Nu=V0.create,Wve=R0.create,Nve=PY.create,Yve=ri.create,Vve=ni.create,Rve=Th.create,yve=ri.createWithPreprocess,Fve=Q9.create,Qve=()=>EI().optional(),gve=()=>jh().optional(),Ave=()=>Ba().optional(),g9={string:t=>DY.create({...t,coerce:!0}),number:t=>i0.create({...t,coerce:!0}),boolean:t=>m0.create({...t,coerce:!0}),bigint:t=>b0.create({...t,coerce:!0}),date:t=>h0.create({...t,coerce:!0})};var Xve=Fe;var IE="2025-06-18";var DfI=[IE,"2025-03-26","2024-11-05","2024-10-07"],yK="2.0",KfI=R.union([R.string(),R.number().int()]),PfI=R.string(),wve=R.object({progressToken:R.optional(KfI)}).passthrough(),oi=R.object({_meta:R.optional(wve)}).passthrough(),KG=R.object({method:R.string(),params:R.optional(oi)}),A9=R.object({_meta:R.optional(R.object({}).passthrough())}).passthrough(),Dh=R.object({method:R.string(),params:R.optional(A9)}),di=R.object({_meta:R.optional(R.object({}).passthrough())}).passthrough(),FK=R.union([R.string(),R.number().int()]),qfI=R.object({jsonrpc:R.literal(yK),id:FK}).merge(KG).strict(),QK=t=>qfI.safeParse(t).success,_fI=R.object({jsonrpc:R.literal(yK)}).merge(Dh).strict(),$fI=t=>_fI.safeParse(t).success,IxI=R.object({jsonrpc:R.literal(yK),id:FK,result:di}).strict(),X9=t=>IxI.safeParse(t).success,si;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(si||(si={}));var exI=R.object({jsonrpc:R.literal(yK),id:FK,error:R.object({code:R.number().int(),message:R.string(),data:R.optional(R.unknown())})}).strict(),txI=t=>exI.safeParse(t).success,qY=R.union([qfI,_fI,IxI,exI]),g0=di.strict(),gK=Dh.extend({method:R.literal("notifications/cancelled"),params:A9.extend({requestId:FK,reason:R.string().optional()})}),AK=R.object({src:R.string(),mimeType:R.optional(R.string()),sizes:R.optional(R.string())}).passthrough(),w9=R.object({name:R.string(),title:R.optional(R.string())}).passthrough(),lxI=w9.extend({version:R.string(),websiteUrl:R.optional(R.string()),icons:R.optional(R.array(AK))}),Hve=R.object({experimental:R.optional(R.object({}).passthrough()),sampling:R.optional(R.object({}).passthrough()),elicitation:R.optional(R.object({}).passthrough()),roots:R.optional(R.object({listChanged:R.optional(R.boolean())}).passthrough())}).passthrough(),Eve=KG.extend({method:R.literal("initialize"),params:oi.extend({protocolVersion:R.string(),capabilities:Hve,clientInfo:lxI})});var vve=R.object({experimental:R.optional(R.object({}).passthrough()),logging:R.optional(R.object({}).passthrough()),completions:R.optional(R.object({}).passthrough()),prompts:R.optional(R.object({listChanged:R.optional(R.boolean())}).passthrough()),resources:R.optional(R.object({subscribe:R.optional(R.boolean()),listChanged:R.optional(R.boolean())}).passthrough()),tools:R.optional(R.object({listChanged:R.optional(R.boolean())}).passthrough())}).passthrough(),KoI=di.extend({protocolVersion:R.string(),capabilities:vve,serverInfo:lxI,instructions:R.optional(R.string())}),cxI=Dh.extend({method:R.literal("notifications/initialized")}),nxI=t=>cxI.safeParse(t).success,XK=KG.extend({method:R.literal("ping")}),Cve=R.object({progress:R.number(),total:R.optional(R.number()),message:R.optional(R.string())}).passthrough(),wK=Dh.extend({method:R.literal("notifications/progress"),params:A9.merge(Cve).extend({progressToken:KfI})}),HK=KG.extend({params:oi.extend({cursor:R.optional(PfI)}).optional()}),EK=di.extend({nextCursor:R.optional(PfI)}),axI=R.object({uri:R.string(),mimeType:R.optional(R.string()),_meta:R.optional(R.object({}).passthrough())}).passthrough(),rxI=axI.extend({text:R.string()}),PoI=R.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),sxI=axI.extend({blob:PoI}),GxI=w9.extend({uri:R.string(),description:R.optional(R.string()),mimeType:R.optional(R.string()),icons:R.optional(R.array(AK)),_meta:R.optional(R.object({}).passthrough())}),Jve=w9.extend({uriTemplate:R.string(),description:R.optional(R.string()),mimeType:R.optional(R.string()),_meta:R.optional(R.object({}).passthrough())}),Lve=HK.extend({method:R.literal("resources/list")}),qoI=EK.extend({resources:R.array(GxI)}),kve=HK.extend({method:R.literal("resources/templates/list")}),_oI=EK.extend({resourceTemplates:R.array(Jve)}),fve=KG.extend({method:R.literal("resources/read"),params:oi.extend({uri:R.string()})}),$oI=di.extend({contents:R.array(R.union([rxI,sxI]))}),xve=Dh.extend({method:R.literal("notifications/resources/list_changed")}),Bve=KG.extend({method:R.literal("resources/subscribe"),params:oi.extend({uri:R.string()})}),zve=KG.extend({method:R.literal("resources/unsubscribe"),params:oi.extend({uri:R.string()})}),Uve=Dh.extend({method:R.literal("notifications/resources/updated"),params:A9.extend({uri:R.string()})}),Sve=R.object({name:R.string(),description:R.optional(R.string()),required:R.optional(R.boolean())}).passthrough(),Ove=w9.extend({description:R.optional(R.string()),arguments:R.optional(R.array(Sve)),icons:R.optional(R.array(AK)),_meta:R.optional(R.object({}).passthrough())}),Mve=HK.extend({method:R.literal("prompts/list")}),IdI=EK.extend({prompts:R.array(Ove)}),Tve=KG.extend({method:R.literal("prompts/get"),params:oi.extend({name:R.string(),arguments:R.optional(R.record(R.string()))})}),edI=R.object({type:R.literal("text"),text:R.string(),_meta:R.optional(R.object({}).passthrough())}).passthrough(),tdI=R.object({type:R.literal("image"),data:PoI,mimeType:R.string(),_meta:R.optional(R.object({}).passthrough())}).passthrough(),ldI=R.object({type:R.literal("audio"),data:PoI,mimeType:R.string(),_meta:R.optional(R.object({}).passthrough())}).passthrough(),jve=R.object({type:R.literal("resource"),resource:R.union([rxI,sxI]),_meta:R.optional(R.object({}).passthrough())}).passthrough(),Dve=GxI.extend({type:R.literal("resource_link")}),oxI=R.union([edI,tdI,ldI,Dve,jve]),Kve=R.object({role:R.enum(["user","assistant"]),content:oxI}).passthrough(),cdI=di.extend({description:R.optional(R.string()),messages:R.array(Kve)}),Pve=Dh.extend({method:R.literal("notifications/prompts/list_changed")}),qve=R.object({title:R.optional(R.string()),readOnlyHint:R.optional(R.boolean()),destructiveHint:R.optional(R.boolean()),idempotentHint:R.optional(R.boolean()),openWorldHint:R.optional(R.boolean())}).passthrough(),_ve=w9.extend({description:R.optional(R.string()),inputSchema:R.object({type:R.literal("object"),properties:R.optional(R.object({}).passthrough()),required:R.optional(R.array(R.string()))}).passthrough(),outputSchema:R.optional(R.object({type:R.literal("object"),properties:R.optional(R.object({}).passthrough()),required:R.optional(R.array(R.string()))}).passthrough()),annotations:R.optional(qve),icons:R.optional(R.array(AK)),_meta:R.optional(R.object({}).passthrough())}),$ve=HK.extend({method:R.literal("tools/list")}),ndI=EK.extend({tools:R.array(_ve)}),vK=di.extend({content:R.array(oxI).default([]),structuredContent:R.object({}).passthrough().optional(),isError:R.optional(R.boolean())}),bfl=vK.or(di.extend({toolResult:R.unknown()})),ICe=KG.extend({method:R.literal("tools/call"),params:oi.extend({name:R.string(),arguments:R.optional(R.record(R.unknown()))})}),eCe=Dh.extend({method:R.literal("notifications/tools/list_changed")}),dxI=R.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),tCe=KG.extend({method:R.literal("logging/setLevel"),params:oi.extend({level:dxI})}),lCe=Dh.extend({method:R.literal("notifications/message"),params:A9.extend({level:dxI,logger:R.optional(R.string()),data:R.unknown()})}),cCe=R.object({name:R.string().optional()}).passthrough(),nCe=R.object({hints:R.optional(R.array(cCe)),costPriority:R.optional(R.number().min(0).max(1)),speedPriority:R.optional(R.number().min(0).max(1)),intelligencePriority:R.optional(R.number().min(0).max(1))}).passthrough(),aCe=R.object({role:R.enum(["user","assistant"]),content:R.union([edI,tdI,ldI])}).passthrough(),rCe=KG.extend({method:R.literal("sampling/createMessage"),params:oi.extend({messages:R.array(aCe),systemPrompt:R.optional(R.string()),includeContext:R.optional(R.enum(["none","thisServer","allServers"])),temperature:R.optional(R.number()),maxTokens:R.number().int(),stopSequences:R.optional(R.array(R.string())),metadata:R.optional(R.object({}).passthrough()),modelPreferences:R.optional(nCe)})}),sCe=di.extend({model:R.string(),stopReason:R.optional(R.enum(["endTurn","stopSequence","maxTokens"]).or(R.string())),role:R.enum(["user","assistant"]),content:R.discriminatedUnion("type",[edI,tdI,ldI])}),GCe=R.object({type:R.literal("boolean"),title:R.optional(R.string()),description:R.optional(R.string()),default:R.optional(R.boolean())}).passthrough(),oCe=R.object({type:R.literal("string"),title:R.optional(R.string()),description:R.optional(R.string()),minLength:R.optional(R.number()),maxLength:R.optional(R.number()),format:R.optional(R.enum(["email","uri","date","date-time"]))}).passthrough(),dCe=R.object({type:R.enum(["number","integer"]),title:R.optional(R.string()),description:R.optional(R.string()),minimum:R.optional(R.number()),maximum:R.optional(R.number())}).passthrough(),iCe=R.object({type:R.literal("string"),title:R.optional(R.string()),description:R.optional(R.string()),enum:R.array(R.string()),enumNames:R.optional(R.array(R.string()))}).passthrough(),bCe=R.union([GCe,oCe,dCe,iCe]),mCe=KG.extend({method:R.literal("elicitation/create"),params:oi.extend({message:R.string(),requestedSchema:R.object({type:R.literal("object"),properties:R.record(R.string(),bCe),required:R.optional(R.array(R.string()))}).passthrough()})}),hCe=di.extend({action:R.enum(["accept","decline","cancel"]),content:R.optional(R.record(R.string(),R.unknown()))}),pCe=R.object({type:R.literal("ref/resource"),uri:R.string()}).passthrough();var ZCe=R.object({type:R.literal("ref/prompt"),name:R.string()}).passthrough(),uCe=KG.extend({method:R.literal("completion/complete"),params:oi.extend({ref:R.union([ZCe,pCe]),argument:R.object({name:R.string(),value:R.string()}).passthrough(),context:R.optional(R.object({arguments:R.optional(R.record(R.string(),R.string()))}))})}),adI=di.extend({completion:R.object({values:R.array(R.string()).max(100),total:R.optional(R.number().int()),hasMore:R.optional(R.boolean())}).passthrough()}),WCe=R.object({uri:R.string().startsWith("file://"),name:R.optional(R.string()),_meta:R.optional(R.object({}).passthrough())}).passthrough(),NCe=KG.extend({method:R.literal("roots/list")}),YCe=di.extend({roots:R.array(WCe)}),VCe=Dh.extend({method:R.literal("notifications/roots/list_changed")}),mfl=R.union([XK,Eve,uCe,tCe,Tve,Mve,Lve,kve,fve,Bve,zve,ICe,$ve]),hfl=R.union([gK,wK,cxI,VCe]),pfl=R.union([g0,sCe,hCe,YCe]),Zfl=R.union([XK,rCe,mCe,NCe]),ufl=R.union([gK,wK,lCe,Uve,xve,eCe,Pve]),Wfl=R.union([g0,KoI,adI,cdI,IdI,qoI,_oI,$oI,vK,ndI]),Gi=class extends Error{constructor(I,e,l){super(`MCP error ${I}: ${e}`),this.code=I,this.data=l,this.name="McpError"}};var RCe=6e4,CK=class{constructor(I){this._options=I,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.setNotificationHandler(gK,e=>{let l=this._requestHandlerAbortControllers.get(e.params.requestId);l?.abort(e.params.reason)}),this.setNotificationHandler(wK,e=>{this._onprogress(e)}),this.setRequestHandler(XK,e=>({}))}_setupTimeout(I,e,l,c,n=!1){this._timeoutInfo.set(I,{timeoutId:setTimeout(c,e),startTime:Date.now(),timeout:e,maxTotalTimeout:l,resetTimeoutOnProgress:n,onTimeout:c})}_resetTimeout(I){let e=this._timeoutInfo.get(I);if(!e)return!1;let l=Date.now()-e.startTime;if(e.maxTotalTimeout&&l>=e.maxTotalTimeout)throw this._timeoutInfo.delete(I),new Gi(si.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:e.maxTotalTimeout,totalElapsed:l});return clearTimeout(e.timeoutId),e.timeoutId=setTimeout(e.onTimeout,e.timeout),!0}_cleanupTimeout(I){let e=this._timeoutInfo.get(I);e&&(clearTimeout(e.timeoutId),this._timeoutInfo.delete(I))}async connect(I){var e,l,c;this._transport=I;let n=(e=this.transport)===null||e===void 0?void 0:e.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let a=(l=this.transport)===null||l===void 0?void 0:l.onerror;this._transport.onerror=s=>{a?.(s),this._onerror(s)};let r=(c=this._transport)===null||c===void 0?void 0:c.onmessage;this._transport.onmessage=(s,o)=>{r?.(s,o),X9(s)||txI(s)?this._onresponse(s):QK(s)?this._onrequest(s,o):$fI(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){var I;let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(I=this.onclose)===null||I===void 0||I.call(this);let l=new Gi(si.ConnectionClosed,"Connection closed");for(let c of e.values())c(l)}_onerror(I){var e;(e=this.onerror)===null||e===void 0||e.call(this,I)}_onnotification(I){var e;let l=(e=this._notificationHandlers.get(I.method))!==null&&e!==void 0?e:this.fallbackNotificationHandler;l!==void 0&&Promise.resolve().then(()=>l(I)).catch(c=>this._onerror(new Error(`Uncaught error in notification handler: ${c}`)))}_onrequest(I,e){var l,c;let n=(l=this._requestHandlers.get(I.method))!==null&&l!==void 0?l:this.fallbackRequestHandler,a=this._transport;if(n===void 0){a?.send({jsonrpc:"2.0",id:I.id,error:{code:si.MethodNotFound,message:"Method not found"}}).catch(o=>this._onerror(new Error(`Failed to send an error response: ${o}`)));return}let r=new AbortController;this._requestHandlerAbortControllers.set(I.id,r);let s={signal:r.signal,sessionId:a?.sessionId,_meta:(c=I.params)===null||c===void 0?void 0:c._meta,sendNotification:o=>this.notification(o,{relatedRequestId:I.id}),sendRequest:(o,d,i)=>this.request(o,d,{...i,relatedRequestId:I.id}),authInfo:e?.authInfo,requestId:I.id,requestInfo:e?.requestInfo};Promise.resolve().then(()=>n(I,s)).then(o=>{if(!r.signal.aborted)return a?.send({result:o,jsonrpc:"2.0",id:I.id})},o=>{var d;if(!r.signal.aborted)return a?.send({jsonrpc:"2.0",id:I.id,error:{code:Number.isSafeInteger(o.code)?o.code:si.InternalError,message:(d=o.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(o=>this._onerror(new Error(`Failed to send response: ${o}`))).finally(()=>{this._requestHandlerAbortControllers.delete(I.id)})}_onprogress(I){let{progressToken:e,...l}=I.params,c=Number(e),n=this._progressHandlers.get(c);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(I)}`));return}let a=this._responseHandlers.get(c),r=this._timeoutInfo.get(c);if(r&&a&&r.resetTimeoutOnProgress)try{this._resetTimeout(c)}catch(s){a(s);return}n(l)}_onresponse(I){let e=Number(I.id),l=this._responseHandlers.get(e);if(l===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(I)}`));return}if(this._responseHandlers.delete(e),this._progressHandlers.delete(e),this._cleanupTimeout(e),X9(I))l(I);else{let c=new Gi(I.error.code,I.error.message,I.error.data);l(c)}}get transport(){return this._transport}async close(){var I;await((I=this._transport)===null||I===void 0?void 0:I.close())}request(I,e,l){let{relatedRequestId:c,resumptionToken:n,onresumptiontoken:a}=l??{};return new Promise((r,s)=>{var o,d,i,h,p,Z;if(!this._transport){s(new Error("Not connected"));return}((o=this._options)===null||o===void 0?void 0:o.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(I.method),(d=l?.signal)===null||d===void 0||d.throwIfAborted();let W=this._requestMessageId++,N={...I,jsonrpc:"2.0",id:W};l?.onprogress&&(this._progressHandlers.set(W,l.onprogress),N.params={...I.params,_meta:{...((i=I.params)===null||i===void 0?void 0:i._meta)||{},progressToken:W}});let Y=A=>{var w;this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),(w=this._transport)===null||w===void 0||w.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:W,reason:String(A)}},{relatedRequestId:c,resumptionToken:n,onresumptiontoken:a}).catch(M=>this._onerror(new Error(`Failed to send cancellation: ${M}`))),s(A)};this._responseHandlers.set(W,A=>{var w;if(!(!((w=l?.signal)===null||w===void 0)&&w.aborted)){if(A instanceof Error)return s(A);try{let M=e.parse(A.result);r(M)}catch(M){s(M)}}}),(h=l?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var A;Y((A=l?.signal)===null||A===void 0?void 0:A.reason)});let F=(p=l?.timeout)!==null&&p!==void 0?p:RCe,g=()=>Y(new Gi(si.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(W,F,l?.maxTotalTimeout,g,(Z=l?.resetTimeoutOnProgress)!==null&&Z!==void 0?Z:!1),this._transport.send(N,{relatedRequestId:c,resumptionToken:n,onresumptiontoken:a}).catch(A=>{this._cleanupTimeout(W),s(A)})})}async notification(I,e){var l,c;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(I.method),((c=(l=this._options)===null||l===void 0?void 0:l.debouncedNotificationMethods)!==null&&c!==void 0?c:[]).includes(I.method)&&!I.params&&!e?.relatedRequestId){if(this._pendingDebouncedNotifications.has(I.method))return;this._pendingDebouncedNotifications.add(I.method),Promise.resolve().then(()=>{var s;if(this._pendingDebouncedNotifications.delete(I.method),!this._transport)return;let o={...I,jsonrpc:"2.0"};(s=this._transport)===null||s===void 0||s.send(o,e).catch(d=>this._onerror(d))});return}let r={...I,jsonrpc:"2.0"};await this._transport.send(r,e)}setRequestHandler(I,e){let l=I.shape.method.value;this.assertRequestHandlerCapability(l),this._requestHandlers.set(l,(c,n)=>Promise.resolve(e(I.parse(c),n)))}removeRequestHandler(I){this._requestHandlers.delete(I)}assertCanSetRequestHandler(I){if(this._requestHandlers.has(I))throw new Error(`A request handler for ${I} already exists, which would be overridden`)}setNotificationHandler(I,e){this._notificationHandlers.set(I.shape.method.value,l=>Promise.resolve(e(I.parse(l))))}removeNotificationHandler(I){this._notificationHandlers.delete(I)}};function ixI(t,I){return Object.entries(I).reduce((e,[l,c])=>(c&&typeof c=="object"?e[l]=e[l]?{...e[l],...c}:c:e[l]=c,e),{...t})}var TzI=Ac(MzI(),1),hP=class extends CK{constructor(I,e){var l;super(e),this._clientInfo=I,this._cachedToolOutputValidators=new Map,this._capabilities=(l=e?.capabilities)!==null&&l!==void 0?l:{},this._ajv=new TzI.default}registerCapabilities(I){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ixI(this._capabilities,I)}assertCapability(I,e){var l;if(!(!((l=this._serverCapabilities)===null||l===void 0)&&l[I]))throw new Error(`Server does not support ${I} (required for ${e})`)}async connect(I,e){if(await super.connect(I),I.sessionId===void 0)try{let l=await this.request({method:"initialize",params:{protocolVersion:IE,capabilities:this._capabilities,clientInfo:this._clientInfo}},KoI,e);if(l===void 0)throw new Error(`Server sent invalid initialize result: ${l}`);if(!DfI.includes(l.protocolVersion))throw new Error(`Server's protocol version is not supported: ${l.protocolVersion}`);this._serverCapabilities=l.capabilities,this._serverVersion=l.serverInfo,I.setProtocolVersion&&I.setProtocolVersion(l.protocolVersion),this._instructions=l.instructions,await this.notification({method:"notifications/initialized"})}catch(l){throw this.close(),l}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(I){var e,l,c,n,a;switch(I){case"logging/setLevel":if(!(!((e=this._serverCapabilities)===null||e===void 0)&&e.logging))throw new Error(`Server does not support logging (required for ${I})`);break;case"prompts/get":case"prompts/list":if(!(!((l=this._serverCapabilities)===null||l===void 0)&&l.prompts))throw new Error(`Server does not support prompts (required for ${I})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((c=this._serverCapabilities)===null||c===void 0)&&c.resources))throw new Error(`Server does not support resources (required for ${I})`);if(I==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${I})`);break;case"tools/call":case"tools/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${I})`);break;case"completion/complete":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.completions))throw new Error(`Server does not support completions (required for ${I})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(I){var e;switch(I){case"notifications/roots/list_changed":if(!(!((e=this._capabilities.roots)===null||e===void 0)&&e.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${I})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(I){switch(I){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${I})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${I})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${I})`);break;case"ping":break}}async ping(I){return this.request({method:"ping"},g0,I)}async complete(I,e){return this.request({method:"completion/complete",params:I},adI,e)}async setLoggingLevel(I,e){return this.request({method:"logging/setLevel",params:{level:I}},g0,e)}async getPrompt(I,e){return this.request({method:"prompts/get",params:I},cdI,e)}async listPrompts(I,e){return this.request({method:"prompts/list",params:I},IdI,e)}async listResources(I,e){return this.request({method:"resources/list",params:I},qoI,e)}async listResourceTemplates(I,e){return this.request({method:"resources/templates/list",params:I},_oI,e)}async readResource(I,e){return this.request({method:"resources/read",params:I},$oI,e)}async subscribeResource(I,e){return this.request({method:"resources/subscribe",params:I},g0,e)}async unsubscribeResource(I,e){return this.request({method:"resources/unsubscribe",params:I},g0,e)}async callTool(I,e=vK,l){let c=await this.request({method:"tools/call",params:I},e,l),n=this.getToolOutputValidator(I.name);if(n){if(!c.structuredContent&&!c.isError)throw new Gi(si.InvalidRequest,`Tool ${I.name} has an output schema but did not return structured content`);if(c.structuredContent)try{if(!n(c.structuredContent))throw new Gi(si.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(a){throw a instanceof Gi?a:new Gi(si.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return c}cacheToolOutputSchemas(I){this._cachedToolOutputValidators.clear();for(let e of I)if(e.outputSchema)try{let l=this._ajv.compile(e.outputSchema);this._cachedToolOutputValidators.set(e.name,l)}catch{}}getToolOutputValidator(I){return this._cachedToolOutputValidators.get(I)}async listTools(I,e){let l=await this.request({method:"tools/list",params:I},ndI,e);return this.cacheToolOutputSchemas(l.tools),l}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var pP=class{createClient(I,e){return new hP(I,e)}};G();G();G();G();var ZP=class extends Error{constructor(I,e){super(I),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}};function OiI(t){}function uP(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:I=OiI,onError:e=OiI,onRetry:l=OiI,onComment:c}=t,n="",a=!0,r,s="",o="";function d(W){let N=a?W.replace(/^\xEF\xBB\xBF/,""):W,[Y,F]=D3e(`${n}${N}`);for(let g of Y)i(g);n=F,a=!1}function i(W){if(W===""){p();return}if(W.startsWith(":")){c&&c(W.slice(W.startsWith(": ")?2:1));return}let N=W.indexOf(":");if(N!==-1){let Y=W.slice(0,N),F=W[N+1]===" "?2:1,g=W.slice(N+F);h(Y,g,W);return}h(W,"",W)}function h(W,N,Y){switch(W){case"event":o=N;break;case"data":s=`${s}${N}
|
|
1178
1178
|
`;break;case"id":r=N.includes("\0")?void 0:N;break;case"retry":/^\d+$/.test(N)?l(parseInt(N,10)):e(new ZP(`Invalid \`retry\` value: "${N}"`,{type:"invalid-retry",value:N,line:Y}));break;default:e(new ZP(`Unknown field "${W.length>20?`${W.slice(0,20)}\u2026`:W}"`,{type:"unknown-field",field:W,value:N,line:Y}));break}}function p(){s.length>0&&I({id:r,event:o||void 0,data:s.endsWith(`
|
|
1179
1179
|
`)?s.slice(0,-1):s}),r=void 0,s="",o=""}function Z(W={}){n&&W.consume&&i(n),a=!0,r=void 0,s="",o="",n=""}return{feed:d,reset:Z}}function D3e(t){let I=[],e="",l=0;for(;l<t.length;){let c=t.indexOf("\r",l),n=t.indexOf(`
|
|
1180
1180
|
`,l),a=-1;if(c!==-1&&n!==-1?a=Math.min(c,n):c!==-1?a=c:n!==-1&&(a=n),a===-1){e=t.slice(l);break}else{let r=t.slice(l,a);I.push(r),l=a+1,t[l-1]==="\r"&&t[l]===`
|