@iflow-ai/iflow-cli 0.2.22-beta.4 → 0.2.22
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/bundle/iflow.js +4 -4
- package/package.json +1 -1
package/bundle/iflow.js
CHANGED
|
@@ -410,14 +410,14 @@ ${JSON.stringify(f,null,2)}`),f.usage&&(this.lastUsageMetadata={total_tokens:f.u
|
|
|
410
410
|
\u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
|
|
411
411
|
${e}
|
|
412
412
|
|
|
413
|
-
\u8BF7\u76F4\u63A5\u8F93\u51FA\u4E00\u4E2A\u6B63\u786E\u7684json\u683C\u5F0F\uFF1A`;try{let n=await fetch("https://apis.iflow.cn/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:"QWen3-4B",messages:[{role:"user",content:r}],temperature:.1,max_tokens:1e3})});if(!n.ok)throw new Error(`API error: ${n.status}`);let i=await n.json();if(!i||!i.choices||!Array.isArray(i.choices)||i.choices.length===0)throw new Error("Invalid response format - missing or empty choices array");let o=i.choices[0]?.message?.content;if(!o||typeof o!="string")throw new Error("Invalid response - missing or invalid message content");let s=o.trim();if(s.startsWith("```json")?s=s.replace(/^```json\s*/,"").replace(/\s*```$/,""):s.startsWith("```")&&(s=s.replace(/^```\s*/,"").replace(/\s*```$/,"")),!s)throw new Error("Fixed JSON is empty after processing");return JSON.parse(s)}catch(n){throw n5(n),console.error("QWen JSON fix failed:",n),n}}extractTextFromRequest(e){let r="";if(e.contents){let n=Array.isArray(e.contents)?e.contents:[e.contents];for(let i of n)if(i&&typeof i=="object"&&"parts"in i&&i.parts){let o=Array.isArray(i.parts)?i.parts:[i.parts];for(let s of o)if(s&&typeof s=="object"&&"text"in s&&s.text)r+=s.text+" ";else if(s.functionResponse&&s.functionResponse.response)for(let[a,c]of Object.entries(s.functionResponse.response))c!=null&&(r+=String(c)+" ")}}return r+=e.config?.systemInstruction,r.trim()}extractTextFromEmbedRequest(e){if(e.contents){let r=Array.isArray(e.contents)?e.contents:[e.contents];for(let n of r)if(typeof n=="object"&&n!==null&&"parts"in n&&n.parts){let i=Array.isArray(n.parts)?n.parts:[n.parts];for(let o of i)if(typeof o=="object"&&o!==null&&"text"in o&&o.text)return o.text}else{if(typeof n=="string")return n;if(typeof n=="object"&&n!==null&&"text"in n&&n.text)return n.text}}return""}extractSystemInstruction(e){let r="";if(typeof e=="string")r=e;else if(Array.isArray(e)){for(let n of e)typeof n=="object"&&n!==null&&"text"in n&&n.text&&(r+=n.text+" ");r=r.trim()}else if(typeof e=="object"&&e!==null)if("parts"in e&&e.parts){let n=Array.isArray(e.parts)?e.parts:[e.parts];for(let i of n)typeof i=="object"&&i!==null&&"text"in i&&i.text&&(r+=i.text+" ");r=r.trim()}else"text"in e&&e.text&&(r=e.text);return r}convertToOpenAITools(e){if(!e||e.length===0)return[];let r=[];for(let n of e)if(n.functionDeclarations&&Array.isArray(n.functionDeclarations))for(let i of n.functionDeclarations)r.push({type:"function",function:{name:i.name||"",description:i.description,parameters:this.convertParameters(i.parameters||i.parametersJsonSchema)}});return r}convertParameters(e){if(!e)return;let r={STRING:"string",INTEGER:"integer",NUMBER:"number",BOOLEAN:"boolean",OBJECT:"object",ARRAY:"array"};if(typeof e=="object"&&e.type){if(typeof e.type=="string"&&(r[e.type]?e.type=r[e.type]:e.type=e.type.toLowerCase()),e.properties)for(let i in e.properties){let o=e.properties[i],s={};o.type&&(s.type=r[o.type]),o.description&&(s.description=o.description),e.properties[i]=s}return e.items&&(e.items=this.convertParameters(e.items)),e}let n=i=>{if(!i)return;let o={};if(i.type)switch(i.type){case"STRING":o.type="string";break;case"INTEGER":o.type="integer";break;case"NUMBER":o.type="number";break;case"BOOLEAN":o.type="boolean";break;case"OBJECT":o.type="object";break;case"ARRAY":o.type="array";break;default:o.type=i.type.toLowerCase()}if(o.type="object",i.description&&(o.description=i.description),i.enum&&(o.enum=i.enum),i.properties){o.properties={};for(let[s,a]of Object.entries(i.properties))o.properties[s]=n(a)}return i.items&&(o.items=n(i.items)),i.required&&(o.required=i.required),o};return n(e)}mapFinishReason(e){switch(e){case"stop":return pw.STOP;case"length":return pw.MAX_TOKENS;case"content_filter":return pw.SAFETY;case"tool_calls":return pw.MALFORMED_FUNCTION_CALL;default:return pw.OTHER}}convertResponseSchema(e){if(e)return e.type==="object"||e.type==="OBJECT"?{type:"json_schema",json_schema:{name:e.name||"",description:e.description||"",schema:this.convertSchemaToJsonSchema(e),strict:!0}}:{type:"json_schema",json_schema:{name:"response_schema",description:"Generated response schema",schema:this.convertSchemaToJsonSchema(e),strict:!0}}}convertSchemaToJsonSchema(e){if(!e)return{};let r={};if(e.type)switch(e.type){case"STRING":r.type="string";break;case"INTEGER":r.type="integer";break;case"NUMBER":r.type="number";break;case"BOOLEAN":r.type="boolean";break;case"OBJECT":r.type="object";break;case"ARRAY":r.type="array";break;default:r.type=typeof e.type=="string"?e.type.toLowerCase():e.type}if(e.description&&(r.description=e.description),e.enum&&(r.enum=e.enum),e.properties){r.properties={};for(let[n,i]of Object.entries(e.properties))r.properties[n]=this.convertSchemaToJsonSchema(i)}return e.items&&(r.items=this.convertSchemaToJsonSchema(e.items)),e.required&&(r.required=e.required),r.type==="object"&&!("additionalProperties"in r)&&(r.additionalProperties=!1),r}}});var _3,Zf,nq,iq,PX,i5=Te(()=>{"use strict";_3="Qwen3-Coder",Zf="Qwen3-Coder",nq="text-embedding-v1",iq="gemini-2.5-flash-lite",PX="https://apis.iflow.cn/v1"});async function Dke(t,e,r,n){if(e===_r.LOGIN_WITH_IFLOW){let i=await MB(e,r),o=await Aw();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new rq({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||PX,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen-vl-max",config:r})}if(e===_r.CLOUD_SHELL){let i=await MB(e,r),o=await lIt(i);return new E7(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var Rke=Te(()=>{"use strict";B6();kB();cIt();fhe();Ike();i5();});function xbn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function G8(t){let e=xbn(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function LX(){return G8("apiKey")}function UX(){return G8("baseUrl")||G8("url")}function QX(){return G8("modelName")||G8("model")}function xIt(t){let e=G8(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function wIt(t){let e=G8(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function TIt(t){let e=G8(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function whe(){return!!(LX()||UX()||QX())}function Bke(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=G8(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=xIt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=wIt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=TIt(o);s!==void 0&&(t[o]=s)}),t}function wbn(){return{apiKey:LX(),baseUrl:UX(),model:QX()}}var Nke=Te(()=>{"use strict";});async function Oke(t,e,r){await JQ()&&(await uhe()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=process.env.GEMINI_API_KEY,o=process.env.GOOGLE_API_KEY,s=process.env.GOOGLE_CLOUD_PROJECT,a=process.env.GOOGLE_CLOUD_LOCATION,c=LX(),u=UX(),f=QX(),d=r?.apiKey||c,p=r?.baseUrl||u||Tbn[e],h=t.getModel()||f||_3,g={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===_r.CLOUD_SHELL?g:e===_r.LOGIN_WITH_IFLOW?(g.baseUrl=p||PX,g.multimodalModelName="qwen-vl-max",g):([...Q1,_r.OPENAI_COMPATIBLE].includes(e)&&d&&(g.apiKey=d,g.baseUrl=p,g.model=h,e===_r.IFLOW&&(g.multimodalModelName="qwen-vl-max")),g)}async function Mke(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.22-beta.4 (${process.platform}; ${process.arch})`}};if(t.authType&&[...Q1,_r.IDEA_LAB].includes(t.authType)||t.authType===_r.OPENAI_COMPATIBLE)return new rq({...t,config:e});if(t.authType===_r.LOGIN_WITH_IFLOW||t.authType===_r.CLOUD_SHELL)return Dke(i,t.authType,e,r);if([...Q1,_r.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===_r.USE_GEMINI||t.authType===_r.USE_VERTEX_AI)return new ehe({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var _r,Q1,Tbn,B6=Te(()=>{"use strict";Jl();Rke();i5();Ike();Nke();kB();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(_r||(_r={}));Q1=[_r.IFLOW,_r.IDEA_LAB],Tbn={[_r.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[_r.IFLOW]:PX}});var The,IIt=Te(()=>{"use strict";The=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,i)=>n.name.localeCompare(i.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var jo,Kn,Yo,Sf=Te(()=>{"use strict";jo=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s=!0,a=!1,c=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.parameterSchema=o,this.isOutputMarkdown=s,this.canUpdateOutput=a,this.aliases=c}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(Kn||(Kn={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(Yo||(Yo={}))});function UB(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var Ihe=Te(()=>{"use strict";});var Ic,Dhe=Te(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed"})(Ic||(Ic={}))});function Ibn(t){return{text:t.text}}function Dbn(t,e){return[{text:`[Tool '${e}' provided the following ${t.type} data with mime-type: ${t.mimeType}]`},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function Rbn(t,e){let r=t.resource;if(r?.text)return{text:r.text};if(r?.blob){let n=r.mimeType||"application/octet-stream";return[{text:`[Tool '${e}' provided the following embedded resource with mime-type: ${n}]`},{inlineData:{mimeType:n,data:r.blob}}]}return null}function Bbn(t){return{text:`Resource Link: ${t.title||t.name} at ${t.uri}`}}function Nbn(t){let e=t?.[0]?.functionResponse,r=e?.response?.content,n=e?.name||"unknown tool";return Array.isArray(r)?r.flatMap(o=>{switch(o.type){case"text":return Ibn(o);case"image":case"audio":return Dbn(o,n);case"resource":return Rbn(o,n);case"resource_link":return Bbn(o);default:return null}}).filter(o=>o!==null):[{text:"[Error: Could not parse tool response]"}]}function Obn(t){let e=t?.[0]?.functionResponse?.response?.content;return Array.isArray(e)?e.map(n=>{switch(n.type){case"text":return n.text;case"image":return`[Image: ${n.mimeType}]`;case"audio":return`[Audio: ${n.mimeType}]`;case"resource_link":return`[Link to ${n.title||n.name}: ${n.uri}]`;case"resource":return n.resource?.text?n.resource.text:`[Embedded Resource: ${n.resource?.mimeType||"unknown type"}]`;default:return`[Unknown content type: ${n.type}]`}}).join(`
|
|
413
|
+
\u8BF7\u76F4\u63A5\u8F93\u51FA\u4E00\u4E2A\u6B63\u786E\u7684json\u683C\u5F0F\uFF1A`;try{let n=await fetch("https://apis.iflow.cn/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:"QWen3-4B",messages:[{role:"user",content:r}],temperature:.1,max_tokens:1e3})});if(!n.ok)throw new Error(`API error: ${n.status}`);let i=await n.json();if(!i||!i.choices||!Array.isArray(i.choices)||i.choices.length===0)throw new Error("Invalid response format - missing or empty choices array");let o=i.choices[0]?.message?.content;if(!o||typeof o!="string")throw new Error("Invalid response - missing or invalid message content");let s=o.trim();if(s.startsWith("```json")?s=s.replace(/^```json\s*/,"").replace(/\s*```$/,""):s.startsWith("```")&&(s=s.replace(/^```\s*/,"").replace(/\s*```$/,"")),!s)throw new Error("Fixed JSON is empty after processing");return JSON.parse(s)}catch(n){throw n5(n),console.error("QWen JSON fix failed:",n),n}}extractTextFromRequest(e){let r="";if(e.contents){let n=Array.isArray(e.contents)?e.contents:[e.contents];for(let i of n)if(i&&typeof i=="object"&&"parts"in i&&i.parts){let o=Array.isArray(i.parts)?i.parts:[i.parts];for(let s of o)if(s&&typeof s=="object"&&"text"in s&&s.text)r+=s.text+" ";else if(s.functionResponse&&s.functionResponse.response)for(let[a,c]of Object.entries(s.functionResponse.response))c!=null&&(r+=String(c)+" ")}}return r+=e.config?.systemInstruction,r.trim()}extractTextFromEmbedRequest(e){if(e.contents){let r=Array.isArray(e.contents)?e.contents:[e.contents];for(let n of r)if(typeof n=="object"&&n!==null&&"parts"in n&&n.parts){let i=Array.isArray(n.parts)?n.parts:[n.parts];for(let o of i)if(typeof o=="object"&&o!==null&&"text"in o&&o.text)return o.text}else{if(typeof n=="string")return n;if(typeof n=="object"&&n!==null&&"text"in n&&n.text)return n.text}}return""}extractSystemInstruction(e){let r="";if(typeof e=="string")r=e;else if(Array.isArray(e)){for(let n of e)typeof n=="object"&&n!==null&&"text"in n&&n.text&&(r+=n.text+" ");r=r.trim()}else if(typeof e=="object"&&e!==null)if("parts"in e&&e.parts){let n=Array.isArray(e.parts)?e.parts:[e.parts];for(let i of n)typeof i=="object"&&i!==null&&"text"in i&&i.text&&(r+=i.text+" ");r=r.trim()}else"text"in e&&e.text&&(r=e.text);return r}convertToOpenAITools(e){if(!e||e.length===0)return[];let r=[];for(let n of e)if(n.functionDeclarations&&Array.isArray(n.functionDeclarations))for(let i of n.functionDeclarations)r.push({type:"function",function:{name:i.name||"",description:i.description,parameters:this.convertParameters(i.parameters||i.parametersJsonSchema)}});return r}convertParameters(e){if(!e)return;let r={STRING:"string",INTEGER:"integer",NUMBER:"number",BOOLEAN:"boolean",OBJECT:"object",ARRAY:"array"};if(typeof e=="object"&&e.type){if(typeof e.type=="string"&&(r[e.type]?e.type=r[e.type]:e.type=e.type.toLowerCase()),e.properties)for(let i in e.properties){let o=e.properties[i],s={};o.type&&(s.type=r[o.type]),o.description&&(s.description=o.description),e.properties[i]=s}return e.items&&(e.items=this.convertParameters(e.items)),e}let n=i=>{if(!i)return;let o={};if(i.type)switch(i.type){case"STRING":o.type="string";break;case"INTEGER":o.type="integer";break;case"NUMBER":o.type="number";break;case"BOOLEAN":o.type="boolean";break;case"OBJECT":o.type="object";break;case"ARRAY":o.type="array";break;default:o.type=i.type.toLowerCase()}if(o.type="object",i.description&&(o.description=i.description),i.enum&&(o.enum=i.enum),i.properties){o.properties={};for(let[s,a]of Object.entries(i.properties))o.properties[s]=n(a)}return i.items&&(o.items=n(i.items)),i.required&&(o.required=i.required),o};return n(e)}mapFinishReason(e){switch(e){case"stop":return pw.STOP;case"length":return pw.MAX_TOKENS;case"content_filter":return pw.SAFETY;case"tool_calls":return pw.MALFORMED_FUNCTION_CALL;default:return pw.OTHER}}convertResponseSchema(e){if(e)return e.type==="object"||e.type==="OBJECT"?{type:"json_schema",json_schema:{name:e.name||"",description:e.description||"",schema:this.convertSchemaToJsonSchema(e),strict:!0}}:{type:"json_schema",json_schema:{name:"response_schema",description:"Generated response schema",schema:this.convertSchemaToJsonSchema(e),strict:!0}}}convertSchemaToJsonSchema(e){if(!e)return{};let r={};if(e.type)switch(e.type){case"STRING":r.type="string";break;case"INTEGER":r.type="integer";break;case"NUMBER":r.type="number";break;case"BOOLEAN":r.type="boolean";break;case"OBJECT":r.type="object";break;case"ARRAY":r.type="array";break;default:r.type=typeof e.type=="string"?e.type.toLowerCase():e.type}if(e.description&&(r.description=e.description),e.enum&&(r.enum=e.enum),e.properties){r.properties={};for(let[n,i]of Object.entries(e.properties))r.properties[n]=this.convertSchemaToJsonSchema(i)}return e.items&&(r.items=this.convertSchemaToJsonSchema(e.items)),e.required&&(r.required=e.required),r.type==="object"&&!("additionalProperties"in r)&&(r.additionalProperties=!1),r}}});var _3,Zf,nq,iq,PX,i5=Te(()=>{"use strict";_3="Qwen3-Coder",Zf="Qwen3-Coder",nq="text-embedding-v1",iq="gemini-2.5-flash-lite",PX="https://apis.iflow.cn/v1"});async function Dke(t,e,r,n){if(e===_r.LOGIN_WITH_IFLOW){let i=await MB(e,r),o=await Aw();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new rq({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||PX,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen-vl-max",config:r})}if(e===_r.CLOUD_SHELL){let i=await MB(e,r),o=await lIt(i);return new E7(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var Rke=Te(()=>{"use strict";B6();kB();cIt();fhe();Ike();i5();});function xbn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function G8(t){let e=xbn(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function LX(){return G8("apiKey")}function UX(){return G8("baseUrl")||G8("url")}function QX(){return G8("modelName")||G8("model")}function xIt(t){let e=G8(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function wIt(t){let e=G8(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function TIt(t){let e=G8(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function whe(){return!!(LX()||UX()||QX())}function Bke(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=G8(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=xIt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=wIt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=TIt(o);s!==void 0&&(t[o]=s)}),t}function wbn(){return{apiKey:LX(),baseUrl:UX(),model:QX()}}var Nke=Te(()=>{"use strict";});async function Oke(t,e,r){await JQ()&&(await uhe()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=process.env.GEMINI_API_KEY,o=process.env.GOOGLE_API_KEY,s=process.env.GOOGLE_CLOUD_PROJECT,a=process.env.GOOGLE_CLOUD_LOCATION,c=LX(),u=UX(),f=QX(),d=r?.apiKey||c,p=r?.baseUrl||u||Tbn[e],h=t.getModel()||f||_3,g={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===_r.CLOUD_SHELL?g:e===_r.LOGIN_WITH_IFLOW?(g.baseUrl=p||PX,g.multimodalModelName="qwen-vl-max",g):([...Q1,_r.OPENAI_COMPATIBLE].includes(e)&&d&&(g.apiKey=d,g.baseUrl=p,g.model=h,e===_r.IFLOW&&(g.multimodalModelName="qwen-vl-max")),g)}async function Mke(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.22 (${process.platform}; ${process.arch})`}};if(t.authType&&[...Q1,_r.IDEA_LAB].includes(t.authType)||t.authType===_r.OPENAI_COMPATIBLE)return new rq({...t,config:e});if(t.authType===_r.LOGIN_WITH_IFLOW||t.authType===_r.CLOUD_SHELL)return Dke(i,t.authType,e,r);if([...Q1,_r.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===_r.USE_GEMINI||t.authType===_r.USE_VERTEX_AI)return new ehe({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var _r,Q1,Tbn,B6=Te(()=>{"use strict";Jl();Rke();i5();Ike();Nke();kB();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(_r||(_r={}));Q1=[_r.IFLOW,_r.IDEA_LAB],Tbn={[_r.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[_r.IFLOW]:PX}});var The,IIt=Te(()=>{"use strict";The=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,i)=>n.name.localeCompare(i.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var jo,Kn,Yo,Sf=Te(()=>{"use strict";jo=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s=!0,a=!1,c=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.parameterSchema=o,this.isOutputMarkdown=s,this.canUpdateOutput=a,this.aliases=c}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(Kn||(Kn={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(Yo||(Yo={}))});function UB(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var Ihe=Te(()=>{"use strict";});var Ic,Dhe=Te(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed"})(Ic||(Ic={}))});function Ibn(t){return{text:t.text}}function Dbn(t,e){return[{text:`[Tool '${e}' provided the following ${t.type} data with mime-type: ${t.mimeType}]`},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function Rbn(t,e){let r=t.resource;if(r?.text)return{text:r.text};if(r?.blob){let n=r.mimeType||"application/octet-stream";return[{text:`[Tool '${e}' provided the following embedded resource with mime-type: ${n}]`},{inlineData:{mimeType:n,data:r.blob}}]}return null}function Bbn(t){return{text:`Resource Link: ${t.title||t.name} at ${t.uri}`}}function Nbn(t){let e=t?.[0]?.functionResponse,r=e?.response?.content,n=e?.name||"unknown tool";return Array.isArray(r)?r.flatMap(o=>{switch(o.type){case"text":return Ibn(o);case"image":case"audio":return Dbn(o,n);case"resource":return Rbn(o,n);case"resource_link":return Bbn(o);default:return null}}).filter(o=>o!==null):[{text:"[Error: Could not parse tool response]"}]}function Obn(t){let e=t?.[0]?.functionResponse?.response?.content;return Array.isArray(e)?e.map(n=>{switch(n.type){case"text":return n.text;case"image":return`[Image: ${n.mimeType}]`;case"audio":return`[Audio: ${n.mimeType}]`;case"resource_link":return`[Link to ${n.title||n.name}: ${n.uri}]`;case"resource":return n.resource?.text?n.resource.text:`[Embedded Resource: ${n.resource?.mimeType||"unknown type"}]`;default:return`[Unknown content type: ${n.type}]`}}).join(`
|
|
414
414
|
`):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function DIt(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var rm,qX=Te(()=>{"use strict";Ihe();Dhe();Sf();Jl();rm=class t extends jo{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??DIt(n),`${n} (${r} MCP Server)`,i,Yo.Hammer,{type:ir.OBJECT},!0,!1),this.mcpTool=e,this.serverName=r,this.serverToolName=n,this.parameterSchemaJson=o,this.timeout=s,this.trust=a}asFullyQualifiedTool(){return new t(this.mcpTool,this.serverName,this.serverToolName,this.description,this.parameterSchemaJson,this.timeout,this.trust,`${this.serverName}__${this.serverToolName}`)}get schema(){return{name:this.name,description:this.description,parametersJsonSchema:this.parameterSchemaJson}}async shouldConfirmExecute(e,r){let n=this.serverName,i=`${this.serverName}.${this.serverToolName}`;return this.trust||t.allowlist.has(n)||t.allowlist.has(i)?!1:{type:"mcp",title:"Confirm MCP Tool Execution",serverName:this.serverName,toolName:this.serverToolName,toolDisplayName:this.name,onConfirm:async s=>{s===Kn.ProceedAlwaysServer?t.allowlist.add(n):s===Kn.ProceedAlwaysTool&&t.allowlist.add(i)}}}isMCPToolError(e){let n=e?.[0]?.functionResponse?.response;if(n){let i=n?.error,o=i?.isError;if(i&&(o===!0||o==="true"))return!0}return!1}async execute(e){let{callId:r,...n}=e,i=[{name:this.serverToolName,args:n}],o=await this.mcpTool.callTool(i);if(this.isMCPToolError(o)){let a=`MCP tool '${this.serverToolName}' reported tool error for function call: ${UB(i[0])} with response: ${UB(o)}`;return{llmContent:a,returnDisplay:`Error: MCP tool '${this.serverToolName}' reported an error.`,error:{message:a,type:Ic.MCP_TOOL_ERROR}}}return{llmContent:Nbn(o),returnDisplay:Obn(o)}}}});var BIt=N((C7o,RIt)=>{"use strict";RIt.exports=function(e){return e.map(function(r){return r===""?"''":r&&typeof r=="object"?r.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(r)&&!/'/.test(r)?"'"+r.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(r)?'"'+r.replace(/(["\\$`!])/g,"\\$1")+'"':String(r).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var LIt=N((b7o,PIt)=>{"use strict";var FIt="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",NIt=new RegExp("^"+FIt+"$"),OIt="|&;()<> \\t",Mbn='"((\\\\"|[^"])*?)"',kbn="'((\\\\'|[^'])*?)'",Fbn=/^#$/,MIt="'",kIt='"',kke="$",QB="",Pbn=4294967296;for(Fke=0;Fke<4;Fke++)QB+=(Pbn*Math.random()).toString(16);var Fke,Lbn=new RegExp("^"+QB);function Ubn(t,e){for(var r=e.lastIndex,n=[],i;i=e.exec(t);)n.push(i),e.lastIndex===i.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function Qbn(t,e,r){var n=typeof t=="function"?t(r):t[r];return typeof n>"u"&&r!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+QB+JSON.stringify(n)+QB:e+n}function qbn(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+OIt+`]|[^\\s'"`+OIt+"])+",o=new RegExp(["("+FIt+")","("+i+"|"+Mbn+"|"+kbn+")+"].join("|"),"g"),s=Ubn(t,o);if(s.length===0)return[];e||(e={});var a=!1;return s.map(function(c){var u=c[0];if(!u||a)return;if(NIt.test(u))return{op:u};var f=!1,d=!1,p="",h=!1,g;function A(){g+=1;var S,x,T=u.charAt(g);if(T==="{"){if(g+=1,u.charAt(g)==="}")throw new Error("Bad substitution: "+u.slice(g-2,g+1));if(S=u.indexOf("}",g),S<0)throw new Error("Bad substitution: "+u.slice(g));x=u.slice(g,S),g=S}else if(/[*@#?$!_-]/.test(T))x=T,g+=1;else{var B=u.slice(g);S=B.match(/[^\w\d_]/),S?(x=B.slice(0,S.index),g+=S.index-1):(x=B,g=u.length)}return Qbn(e,"",x)}for(g=0;g<u.length;g++){var y=u.charAt(g);if(h=h||!f&&(y==="*"||y==="?"),d)p+=y,d=!1;else if(f)y===f?f=!1:f==MIt?p+=y:y===n?(g+=1,y=u.charAt(g),y===kIt||y===n||y===kke?p+=y:p+=n+y):y===kke?p+=A():p+=y;else if(y===kIt||y===MIt)f=y;else{if(NIt.test(y))return{op:u};if(Fbn.test(y)){a=!0;var v={comment:t.slice(c.index+g+1)};return p.length?[p,v]:[v]}else y===n?d=!0:y===kke?p+=A():p+=y}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}PIt.exports=function(e,r,n){var i=qbn(e,r,n);return typeof r!="function"?i:i.reduce(function(o,s){if(typeof s=="object")return o.concat(s);var a=s.split(RegExp("("+QB+".*?"+QB+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return Lbn.test(c)?JSON.parse(c.split(QB)[1]):c}))},[])}});var Rhe=N(Pke=>{"use strict";Pke.quote=BIt();Pke.parse=LIt()});var $s,Lke,An,V8,HX=Te(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})($s||($s={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Lke||(Lke={}));An=$s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V8=t=>{switch(typeof t){case"undefined":return An.undefined;case"string":return An.string;case"number":return Number.isNaN(t)?An.nan:An.number;case"boolean":return An.boolean;case"function":return An.function;case"bigint":return An.bigint;case"symbol":return An.symbol;case"object":return Array.isArray(t)?An.array:t===null?An.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?An.promise:typeof Map<"u"&&t instanceof Map?An.map:typeof Set<"u"&&t instanceof Set?An.set:typeof Date<"u"&&t instanceof Date?An.date:An.object;default:return An.unknown}}});var Pr,Hbn,q1,Bhe=Te(()=>{HX();Pr=$s.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"]),Hbn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),q1=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,$s.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};q1.create=t=>new q1(t)});var Gbn,C7,Uke=Te(()=>{Bhe();HX();Gbn=(t,e)=>{let r;switch(t.code){case Pr.invalid_type:t.received===An.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Pr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,$s.jsonStringifyReplacer)}`;break;case Pr.unrecognized_keys:r=`Unrecognized key(s) in object: ${$s.joinValues(t.keys,", ")}`;break;case Pr.invalid_union:r="Invalid input";break;case Pr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${$s.joinValues(t.options)}`;break;case Pr.invalid_enum_value:r=`Invalid enum value. Expected ${$s.joinValues(t.options)}, received '${t.received}'`;break;case Pr.invalid_arguments:r="Invalid function arguments";break;case Pr.invalid_return_type:r="Invalid function return type";break;case Pr.invalid_date:r="Invalid date";break;case Pr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:$s.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Pr.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Pr.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Pr.custom:r="Invalid input";break;case Pr.invalid_intersection_types:r="Intersection results could not be merged";break;case Pr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Pr.not_finite:r="Number must be finite";break;default:r=e.defaultError,$s.assertNever(t)}return{message:r}},C7=Gbn});function Vbn(t){UIt=t}function oq(){return UIt}var UIt,Nhe=Te(()=>{Uke();UIt=C7});function ln(t,e){let r=oq(),n=GX({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===C7?void 0:C7].filter(i=>!!i)});t.common.issues.push(n)}var GX,$bn,nm,Hi,qB,Zm,Ohe,Mhe,Ew,sq,Qke=Te(()=>{Nhe();Uke();GX=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},$bn=[];nm=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Hi;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Hi;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},Hi=Object.freeze({status:"aborted"}),qB=t=>({status:"dirty",value:t}),Zm=t=>({status:"valid",value:t}),Ohe=t=>t.status==="aborted",Mhe=t=>t.status==="dirty",Ew=t=>t.status==="valid",sq=t=>typeof Promise<"u"&&t instanceof Promise});var QIt=Te(()=>{});var Xn,qIt=Te(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Xn||(Xn={}))});function is(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function $It(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function l9n(t){return new RegExp(`^${$It(t)}$`)}function WIt(t){let e=`${VIt}T${$It(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function c9n(t,e){return!!((e==="v4"||!e)&&t9n.test(t)||(e==="v6"||!e)&&n9n.test(t))}function u9n(t,e){if(!Kbn.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function f9n(t,e){return!!((e==="v4"||!e)&&r9n.test(t)||(e==="v6"||!e)&&i9n.test(t))}function d9n(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function aq(t){if(t instanceof H1){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=N6.create(aq(n))}return new H1({...t._def,shape:()=>e})}else return t instanceof S7?new S7({...t._def,type:aq(t.element)}):t instanceof N6?N6.create(aq(t.unwrap())):t instanceof W8?W8.create(aq(t.unwrap())):t instanceof $8?$8.create(t.items.map(e=>aq(e))):t}function Hke(t,e){let r=V8(t),n=V8(e);if(t===e)return{valid:!0,data:t};if(r===An.object&&n===An.object){let i=$s.objectKeys(e),o=$s.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=Hke(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===An.array&&n===An.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],c=Hke(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===An.date&&n===An.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function jIt(t,e){return new XB({values:t,typeName:Xi.ZodEnum,...is(e)})}function GIt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function YIt(t,e={},r){return t?Cw.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=GIt(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=GIt(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Cw.create()}var O6,HIt,As,Wbn,jbn,Ybn,zbn,Jbn,Kbn,Xbn,Zbn,e9n,qke,t9n,r9n,n9n,i9n,o9n,s9n,VIt,a9n,vw,HB,GB,VB,$B,lq,WB,jB,Cw,_7,o5,cq,S7,H1,YB,b7,khe,zB,$8,Fhe,uq,fq,Phe,JB,KB,XB,ZB,bw,M6,N6,W8,eN,tN,dq,p9n,VX,$X,rN,h9n,Xi,m9n,zIt,JIt,g9n,A9n,KIt,y9n,E9n,v9n,C9n,b9n,_9n,S9n,x9n,w9n,T9n,I9n,D9n,R9n,B9n,N9n,O9n,M9n,k9n,F9n,P9n,L9n,U9n,Q9n,q9n,H9n,G9n,V9n,$9n,W9n,j9n,Y9n,z9n,J9n,K9n,XIt=Te(()=>{Bhe();Nhe();qIt();Qke();HX();O6=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}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}},HIt=(t,e)=>{if(Ew(e))return{success:!0,data:e.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 r=new q1(t.common.issues);return this._error=r,this._error}}};As=class{get description(){return this._def.description}_getType(e){return V8(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:V8(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nm,ctx:{common:e.parent.common,data:e.data,parsedType:V8(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(sq(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V8(e)},i=this._parseSync({data:e,path:n.path,parent:n});return HIt(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V8(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Ew(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Ew(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V8(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(sq(i)?i:Promise.resolve(i));return HIt(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:Pr.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new M6({schema:this,typeName:Xi.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return N6.create(this,this._def)}nullable(){return W8.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return S7.create(this)}promise(){return bw.create(this,this._def)}or(e){return YB.create([this,e],this._def)}and(e){return zB.create(this,e,this._def)}transform(e){return new M6({...is(this._def),schema:this,typeName:Xi.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new eN({...is(this._def),innerType:this,defaultValue:r,typeName:Xi.ZodDefault})}brand(){return new VX({typeName:Xi.ZodBranded,type:this,...is(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new tN({...is(this._def),innerType:this,catchValue:r,typeName:Xi.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return $X.create(this,e)}readonly(){return rN.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wbn=/^c[^\s-]{8,}$/i,jbn=/^[0-9a-z]+$/,Ybn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zbn=/^[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,Jbn=/^[a-z0-9_-]{21}$/i,Kbn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Xbn=/^[-+]?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)?)??$/,Zbn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,e9n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",t9n=/^(?:(?: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])$/,r9n=/^(?:(?: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])$/,n9n=/^(([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]))$/,i9n=/^(([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])$/,o9n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,s9n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VIt="((\\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])))",a9n=new RegExp(`^${VIt}$`);vw=class t extends As{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==An.string){let o=this._getOrReturnCtx(e);return ln(o,{code:Pr.invalid_type,expected:An.string,received:o.parsedType}),Hi}let n=new nm,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?ln(i,{code:Pr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&ln(i,{code:Pr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Zbn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"email",code:Pr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")qke||(qke=new RegExp(e9n,"u")),qke.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"emoji",code:Pr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")zbn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"uuid",code:Pr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Jbn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"nanoid",code:Pr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Wbn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cuid",code:Pr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")jbn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cuid2",code:Pr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Ybn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"ulid",code:Pr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ln(i,{validation:"url",code:Pr.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"regex",code:Pr.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?WIt(o).test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?a9n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?l9n(o).test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Xbn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"duration",code:Pr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?c9n(e.data,o.version)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"ip",code:Pr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?u9n(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"jwt",code:Pr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?f9n(e.data,o.version)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cidr",code:Pr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?o9n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"base64",code:Pr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?s9n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"base64url",code:Pr.invalid_string,message:o.message}),n.dirty()):$s.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Pr.invalid_string,...Xn.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Xn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Xn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Xn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Xn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Xn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Xn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Xn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Xn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Xn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Xn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Xn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Xn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Xn.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Xn.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Xn.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Xn.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Xn.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Xn.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Xn.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Xn.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Xn.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Xn.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Xn.errToObj(r)})}nonempty(e){return this.min(1,Xn.errToObj(e))}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(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};vw.create=t=>new vw({checks:[],typeName:Xi.ZodString,coerce:t?.coerce??!1,...is(t)});HB=class t extends As{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==An.number){let o=this._getOrReturnCtx(e);return ln(o,{code:Pr.invalid_type,expected:An.number,received:o.parsedType}),Hi}let n,i=new nm;for(let o of this._def.checks)o.kind==="int"?$s.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ln(n,{code:Pr.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),ln(n,{code:Pr.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),ln(n,{code:Pr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?d9n(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),ln(n,{code:Pr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ln(n,{code:Pr.not_finite,message:o.message}),i.dirty()):$s.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Xn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Xn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Xn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Xn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Xn.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Xn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Xn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Xn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Xn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Xn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Xn.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Xn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Xn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Xn.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&$s.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};HB.create=t=>new HB({checks:[],typeName:Xi.ZodNumber,coerce:t?.coerce||!1,...is(t)});GB=class t extends As{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==An.bigint)return this._getInvalidInput(e);let n,i=new nm;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),ln(n,{code:Pr.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),ln(n,{code:Pr.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),ln(n,{code:Pr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):$s.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ln(r,{code:Pr.invalid_type,expected:An.bigint,received:r.parsedType}),Hi}gte(e,r){return this.setLimit("min",e,!0,Xn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Xn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Xn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Xn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Xn.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Xn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Xn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Xn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Xn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Xn.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};GB.create=t=>new GB({checks:[],typeName:Xi.ZodBigInt,coerce:t?.coerce??!1,...is(t)});VB=class extends As{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==An.boolean){let n=this._getOrReturnCtx(e);return ln(n,{code:Pr.invalid_type,expected:An.boolean,received:n.parsedType}),Hi}return Zm(e.data)}};VB.create=t=>new VB({typeName:Xi.ZodBoolean,coerce:t?.coerce||!1,...is(t)});$B=class t extends As{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==An.date){let o=this._getOrReturnCtx(e);return ln(o,{code:Pr.invalid_type,expected:An.date,received:o.parsedType}),Hi}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return ln(o,{code:Pr.invalid_date}),Hi}let n=new nm,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),ln(i,{code:Pr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):$s.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Xn.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Xn.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};$B.create=t=>new $B({checks:[],coerce:t?.coerce||!1,typeName:Xi.ZodDate,...is(t)});lq=class extends As{_parse(e){if(this._getType(e)!==An.symbol){let n=this._getOrReturnCtx(e);return ln(n,{code:Pr.invalid_type,expected:An.symbol,received:n.parsedType}),Hi}return Zm(e.data)}};lq.create=t=>new lq({typeName:Xi.ZodSymbol,...is(t)});WB=class extends As{_parse(e){if(this._getType(e)!==An.undefined){let n=this._getOrReturnCtx(e);return ln(n,{code:Pr.invalid_type,expected:An.undefined,received:n.parsedType}),Hi}return Zm(e.data)}};WB.create=t=>new WB({typeName:Xi.ZodUndefined,...is(t)});jB=class extends As{_parse(e){if(this._getType(e)!==An.null){let n=this._getOrReturnCtx(e);return ln(n,{code:Pr.invalid_type,expected:An.null,received:n.parsedType}),Hi}return Zm(e.data)}};jB.create=t=>new jB({typeName:Xi.ZodNull,...is(t)});Cw=class extends As{constructor(){super(...arguments),this._any=!0}_parse(e){return Zm(e.data)}};Cw.create=t=>new Cw({typeName:Xi.ZodAny,...is(t)});_7=class extends As{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Zm(e.data)}};_7.create=t=>new _7({typeName:Xi.ZodUnknown,...is(t)});o5=class extends As{_parse(e){let r=this._getOrReturnCtx(e);return ln(r,{code:Pr.invalid_type,expected:An.never,received:r.parsedType}),Hi}};o5.create=t=>new o5({typeName:Xi.ZodNever,...is(t)});cq=class extends As{_parse(e){if(this._getType(e)!==An.undefined){let n=this._getOrReturnCtx(e);return ln(n,{code:Pr.invalid_type,expected:An.void,received:n.parsedType}),Hi}return Zm(e.data)}};cq.create=t=>new cq({typeName:Xi.ZodVoid,...is(t)});S7=class t extends As{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==An.array)return ln(r,{code:Pr.invalid_type,expected:An.array,received:r.parsedType}),Hi;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(ln(r,{code:s?Pr.too_big:Pr.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(ln(r,{code:Pr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(ln(r,{code:Pr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new O6(r,s,r.path,a)))).then(s=>nm.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new O6(r,s,r.path,a)));return nm.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Xn.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Xn.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Xn.toString(r)}})}nonempty(e){return this.min(1,e)}};S7.create=(t,e)=>new S7({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Xi.ZodArray,...is(e)});H1=class t extends As{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=$s.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==An.object){let u=this._getOrReturnCtx(e);return ln(u,{code:Pr.invalid_type,expected:An.object,received:u.parsedType}),Hi}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof o5&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let f=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new O6(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof o5){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(u==="strict")a.length>0&&(ln(i,{code:Pr.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let f of a){let d=i.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new O6(i,d,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of c){let d=await f.key,p=await f.value;u.push({key:d,value:p,alwaysSet:f.alwaysSet})}return u}).then(u=>nm.mergeObjectSync(n,u)):nm.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Xn.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Xn.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Xi.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of $s.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of $s.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return aq(this)}partial(e){let r={};for(let n of $s.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of $s.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof N6;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return jIt($s.objectKeys(this.shape))}};H1.create=(t,e)=>new H1({shape:()=>t,unknownKeys:"strip",catchall:o5.create(),typeName:Xi.ZodObject,...is(e)});H1.strictCreate=(t,e)=>new H1({shape:()=>t,unknownKeys:"strict",catchall:o5.create(),typeName:Xi.ZodObject,...is(e)});H1.lazycreate=(t,e)=>new H1({shape:t,unknownKeys:"strip",catchall:o5.create(),typeName:Xi.ZodObject,...is(e)});YB=class extends As{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new q1(a.ctx.common.issues));return ln(r,{code:Pr.invalid_union,unionErrors:s}),Hi}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!o&&(o={result:f,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new q1(c));return ln(r,{code:Pr.invalid_union,unionErrors:a}),Hi}}get options(){return this._def.options}};YB.create=(t,e)=>new YB({options:t,typeName:Xi.ZodUnion,...is(e)});b7=t=>t instanceof JB?b7(t.schema):t instanceof M6?b7(t.innerType()):t instanceof KB?[t.value]:t instanceof XB?t.options:t instanceof ZB?$s.objectValues(t.enum):t instanceof eN?b7(t._def.innerType):t instanceof WB?[void 0]:t instanceof jB?[null]:t instanceof N6?[void 0,...b7(t.unwrap())]:t instanceof W8?[null,...b7(t.unwrap())]:t instanceof VX||t instanceof rN?b7(t.unwrap()):t instanceof tN?b7(t._def.innerType):[],khe=class t extends As{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==An.object)return ln(r,{code:Pr.invalid_type,expected:An.object,received:r.parsedType}),Hi;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ln(r,{code:Pr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Hi)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=b7(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:Xi.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...is(n)})}};zB=class extends As{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(Ohe(o)||Ohe(s))return Hi;let a=Hke(o.value,s.value);return a.valid?((Mhe(o)||Mhe(s))&&r.dirty(),{status:r.value,value:a.data}):(ln(n,{code:Pr.invalid_intersection_types}),Hi)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};zB.create=(t,e,r)=>new zB({left:t,right:e,typeName:Xi.ZodIntersection,...is(r)});$8=class t extends As{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==An.array)return ln(n,{code:Pr.invalid_type,expected:An.array,received:n.parsedType}),Hi;if(n.data.length<this._def.items.length)return ln(n,{code:Pr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Hi;!this._def.rest&&n.data.length>this._def.items.length&&(ln(n,{code:Pr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new O6(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>nm.mergeArray(r,s)):nm.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};$8.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $8({items:t,typeName:Xi.ZodTuple,rest:null,...is(e)})};Fhe=class t extends As{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==An.object)return ln(n,{code:Pr.invalid_type,expected:An.object,received:n.parsedType}),Hi;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new O6(n,a,n.path,a)),value:s._parse(new O6(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?nm.mergeObjectAsync(r,i):nm.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof As?new t({keyType:e,valueType:r,typeName:Xi.ZodRecord,...is(n)}):new t({keyType:vw.create(),valueType:e,typeName:Xi.ZodRecord,...is(r)})}},uq=class extends As{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==An.map)return ln(n,{code:Pr.invalid_type,expected:An.map,received:n.parsedType}),Hi;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new O6(n,a,n.path,[u,"key"])),value:o._parse(new O6(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return Hi;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(u.value,f.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return Hi;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(u.value,f.value)}return{status:r.value,value:a}}}};uq.create=(t,e,r)=>new uq({valueType:e,keyType:t,typeName:Xi.ZodMap,...is(r)});fq=class t extends As{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==An.set)return ln(n,{code:Pr.invalid_type,expected:An.set,received:n.parsedType}),Hi;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(ln(n,{code:Pr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(ln(n,{code:Pr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let f of c){if(f.status==="aborted")return Hi;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new O6(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:Xn.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Xn.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};fq.create=(t,e)=>new fq({valueType:t,minSize:null,maxSize:null,typeName:Xi.ZodSet,...is(e)});Phe=class t extends As{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==An.function)return ln(r,{code:Pr.invalid_type,expected:An.function,received:r.parsedType}),Hi;function n(a,c){return GX({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oq(),C7].filter(u=>!!u),issueData:{code:Pr.invalid_arguments,argumentsError:c}})}function i(a,c){return GX({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,oq(),C7].filter(u=>!!u),issueData:{code:Pr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof bw){let a=this;return Zm(async function(...c){let u=new q1([]),f=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),d=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{let a=this;return Zm(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new q1([n(c,u.error)]);let f=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(f,o);if(!d.success)throw new q1([i(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:$8.create(e).rest(_7.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||$8.create([]).rest(_7.create()),returns:r||_7.create(),typeName:Xi.ZodFunction,...is(n)})}},JB=class extends As{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};JB.create=(t,e)=>new JB({getter:t,typeName:Xi.ZodLazy,...is(e)});KB=class extends As{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ln(r,{received:r.data,code:Pr.invalid_literal,expected:this._def.value}),Hi}return{status:"valid",value:e.data}}get value(){return this._def.value}};KB.create=(t,e)=>new KB({value:t,typeName:Xi.ZodLiteral,...is(e)});XB=class t extends As{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ln(r,{expected:$s.joinValues(n),received:r.parsedType,code:Pr.invalid_type}),Hi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return ln(r,{received:r.data,code:Pr.invalid_enum_value,options:n}),Hi}return Zm(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};XB.create=jIt;ZB=class extends As{_parse(e){let r=$s.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==An.string&&n.parsedType!==An.number){let i=$s.objectValues(r);return ln(n,{expected:$s.joinValues(i),received:n.parsedType,code:Pr.invalid_type}),Hi}if(this._cache||(this._cache=new Set($s.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=$s.objectValues(r);return ln(n,{received:n.data,code:Pr.invalid_enum_value,options:i}),Hi}return Zm(e.data)}get enum(){return this._def.values}};ZB.create=(t,e)=>new ZB({values:t,typeName:Xi.ZodNativeEnum,...is(e)});bw=class extends As{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==An.promise&&r.common.async===!1)return ln(r,{code:Pr.invalid_type,expected:An.promise,received:r.parsedType}),Hi;let n=r.parsedType===An.promise?r.data:Promise.resolve(r.data);return Zm(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};bw.create=(t,e)=>new bw({type:t,typeName:Xi.ZodPromise,...is(e)});M6=class extends As{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Xi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{ln(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return Hi;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Hi:c.status==="dirty"?qB(c.value):r.value==="dirty"?qB(c.value):c});{if(r.value==="aborted")return Hi;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?Hi:a.status==="dirty"?qB(a.value):r.value==="dirty"?qB(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Hi:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Hi:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ew(s))return Hi;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Ew(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):Hi);$s.assertNever(i)}};M6.create=(t,e,r)=>new M6({schema:t,typeName:Xi.ZodEffects,effect:e,...is(r)});M6.createWithPreprocess=(t,e,r)=>new M6({schema:e,effect:{type:"preprocess",transform:t},typeName:Xi.ZodEffects,...is(r)});N6=class extends As{_parse(e){return this._getType(e)===An.undefined?Zm(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};N6.create=(t,e)=>new N6({innerType:t,typeName:Xi.ZodOptional,...is(e)});W8=class extends As{_parse(e){return this._getType(e)===An.null?Zm(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};W8.create=(t,e)=>new W8({innerType:t,typeName:Xi.ZodNullable,...is(e)});eN=class extends As{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===An.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};eN.create=(t,e)=>new eN({innerType:t,typeName:Xi.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...is(e)});tN=class extends As{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return sq(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new q1(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new q1(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};tN.create=(t,e)=>new tN({innerType:t,typeName:Xi.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...is(e)});dq=class extends As{_parse(e){if(this._getType(e)!==An.nan){let n=this._getOrReturnCtx(e);return ln(n,{code:Pr.invalid_type,expected:An.nan,received:n.parsedType}),Hi}return{status:"valid",value:e.data}}};dq.create=t=>new dq({typeName:Xi.ZodNaN,...is(t)});p9n=Symbol("zod_brand"),VX=class extends As{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},$X=class t extends As{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Hi:o.status==="dirty"?(r.dirty(),qB(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Hi:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Xi.ZodPipeline})}},rN=class extends As{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Ew(i)&&(i.value=Object.freeze(i.value)),i);return sq(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};rN.create=(t,e)=>new rN({innerType:t,typeName:Xi.ZodReadonly,...is(e)});h9n={object:H1.lazycreate};(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"})(Xi||(Xi={}));m9n=(t,e={message:`Input not instance of ${t.name}`})=>YIt(r=>r instanceof t,e),zIt=vw.create,JIt=HB.create,g9n=dq.create,A9n=GB.create,KIt=VB.create,y9n=$B.create,E9n=lq.create,v9n=WB.create,C9n=jB.create,b9n=Cw.create,_9n=_7.create,S9n=o5.create,x9n=cq.create,w9n=S7.create,T9n=H1.create,I9n=H1.strictCreate,D9n=YB.create,R9n=khe.create,B9n=zB.create,N9n=$8.create,O9n=Fhe.create,M9n=uq.create,k9n=fq.create,F9n=Phe.create,P9n=JB.create,L9n=KB.create,U9n=XB.create,Q9n=ZB.create,q9n=bw.create,H9n=M6.create,G9n=N6.create,V9n=W8.create,$9n=M6.createWithPreprocess,W9n=$X.create,j9n=()=>zIt().optional(),Y9n=()=>JIt().optional(),z9n=()=>KIt().optional(),J9n={string:(t=>vw.create({...t,coerce:!0})),number:(t=>HB.create({...t,coerce:!0})),boolean:(t=>VB.create({...t,coerce:!0})),bigint:(t=>GB.create({...t,coerce:!0})),date:(t=>$B.create({...t,coerce:!0}))},K9n=Hi});var Oe={};P1(Oe,{BRAND:()=>p9n,DIRTY:()=>qB,EMPTY_PATH:()=>$bn,INVALID:()=>Hi,NEVER:()=>K9n,OK:()=>Zm,ParseStatus:()=>nm,Schema:()=>As,ZodAny:()=>Cw,ZodArray:()=>S7,ZodBigInt:()=>GB,ZodBoolean:()=>VB,ZodBranded:()=>VX,ZodCatch:()=>tN,ZodDate:()=>$B,ZodDefault:()=>eN,ZodDiscriminatedUnion:()=>khe,ZodEffects:()=>M6,ZodEnum:()=>XB,ZodError:()=>q1,ZodFirstPartyTypeKind:()=>Xi,ZodFunction:()=>Phe,ZodIntersection:()=>zB,ZodIssueCode:()=>Pr,ZodLazy:()=>JB,ZodLiteral:()=>KB,ZodMap:()=>uq,ZodNaN:()=>dq,ZodNativeEnum:()=>ZB,ZodNever:()=>o5,ZodNull:()=>jB,ZodNullable:()=>W8,ZodNumber:()=>HB,ZodObject:()=>H1,ZodOptional:()=>N6,ZodParsedType:()=>An,ZodPipeline:()=>$X,ZodPromise:()=>bw,ZodReadonly:()=>rN,ZodRecord:()=>Fhe,ZodSchema:()=>As,ZodSet:()=>fq,ZodString:()=>vw,ZodSymbol:()=>lq,ZodTransformer:()=>M6,ZodTuple:()=>$8,ZodType:()=>As,ZodUndefined:()=>WB,ZodUnion:()=>YB,ZodUnknown:()=>_7,ZodVoid:()=>cq,addIssueToContext:()=>ln,any:()=>b9n,array:()=>w9n,bigint:()=>A9n,boolean:()=>KIt,coerce:()=>J9n,custom:()=>YIt,date:()=>y9n,datetimeRegex:()=>WIt,defaultErrorMap:()=>C7,discriminatedUnion:()=>R9n,effect:()=>H9n,enum:()=>U9n,function:()=>F9n,getErrorMap:()=>oq,getParsedType:()=>V8,instanceof:()=>m9n,intersection:()=>B9n,isAborted:()=>Ohe,isAsync:()=>sq,isDirty:()=>Mhe,isValid:()=>Ew,late:()=>h9n,lazy:()=>P9n,literal:()=>L9n,makeIssue:()=>GX,map:()=>M9n,nan:()=>g9n,nativeEnum:()=>Q9n,never:()=>S9n,null:()=>C9n,nullable:()=>V9n,number:()=>JIt,object:()=>T9n,objectUtil:()=>Lke,oboolean:()=>z9n,onumber:()=>Y9n,optional:()=>G9n,ostring:()=>j9n,pipeline:()=>W9n,preprocess:()=>$9n,promise:()=>q9n,quotelessJson:()=>Hbn,record:()=>O9n,set:()=>k9n,setErrorMap:()=>Vbn,strictObject:()=>I9n,string:()=>zIt,symbol:()=>E9n,transformer:()=>H9n,tuple:()=>N9n,undefined:()=>v9n,union:()=>D9n,unknown:()=>_9n,util:()=>$s,void:()=>x9n});var Gke=Te(()=>{Nhe();Qke();QIt();HX();XIt();Bhe()});var WX=Te(()=>{Gke();Gke()});var pq,ZIt,Lhe,eDt,tDt,X9n,P6,G1,jX,j8,L6,Uhe,rDt,Qhe,nDt,iDt,oDt,YX,k6,sDt,aDt,_w,nN,qhe,zX,lDt,Z9n,e7n,t7n,Vke,cDt,uDt,Hhe,r7n,Ghe,Vhe,$he,fDt,dDt,$ke,pDt,hDt,n7n,i7n,Wke,o7n,jke,s7n,Yke,a7n,l7n,c7n,u7n,f7n,d7n,p7n,JX,h7n,zke,Jke,Kke,m7n,g7n,mDt,A7n,KX,y7n,E7n,v7n,C7n,Xke,Whe,K7o,b7n,_7n,gDt,S7n,x7n,w7n,T7n,I7n,D7n,R7n,B7n,N7n,O7n,M7n,k7n,F7n,P7n,L7n,U7n,Q7n,Zke,q7n,jhe,H7n,G7n,X7o,Z7o,e_o,t_o,r_o,n_o,F6,Sw=Te(()=>{WX();pq="2025-06-18",ZIt=[pq,"2025-03-26","2024-11-05","2024-10-07"],Lhe="2.0",eDt=Oe.union([Oe.string(),Oe.number().int()]),tDt=Oe.string(),X9n=Oe.object({progressToken:Oe.optional(eDt)}).passthrough(),P6=Oe.object({_meta:Oe.optional(X9n)}).passthrough(),G1=Oe.object({method:Oe.string(),params:Oe.optional(P6)}),jX=Oe.object({_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),j8=Oe.object({method:Oe.string(),params:Oe.optional(jX)}),L6=Oe.object({_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),Uhe=Oe.union([Oe.string(),Oe.number().int()]),rDt=Oe.object({jsonrpc:Oe.literal(Lhe),id:Uhe}).merge(G1).strict(),Qhe=t=>rDt.safeParse(t).success,nDt=Oe.object({jsonrpc:Oe.literal(Lhe)}).merge(j8).strict(),iDt=t=>nDt.safeParse(t).success,oDt=Oe.object({jsonrpc:Oe.literal(Lhe),id:Uhe,result:L6}).strict(),YX=t=>oDt.safeParse(t).success;(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"})(k6||(k6={}));sDt=Oe.object({jsonrpc:Oe.literal(Lhe),id:Uhe,error:Oe.object({code:Oe.number().int(),message:Oe.string(),data:Oe.optional(Oe.unknown())})}).strict(),aDt=t=>sDt.safeParse(t).success,_w=Oe.union([rDt,nDt,oDt,sDt]),nN=L6.strict(),qhe=j8.extend({method:Oe.literal("notifications/cancelled"),params:jX.extend({requestId:Uhe,reason:Oe.string().optional()})}),zX=Oe.object({name:Oe.string(),title:Oe.optional(Oe.string())}).passthrough(),lDt=zX.extend({version:Oe.string()}),Z9n=Oe.object({experimental:Oe.optional(Oe.object({}).passthrough()),sampling:Oe.optional(Oe.object({}).passthrough()),elicitation:Oe.optional(Oe.object({}).passthrough()),roots:Oe.optional(Oe.object({listChanged:Oe.optional(Oe.boolean())}).passthrough())}).passthrough(),e7n=G1.extend({method:Oe.literal("initialize"),params:P6.extend({protocolVersion:Oe.string(),capabilities:Z9n,clientInfo:lDt})}),t7n=Oe.object({experimental:Oe.optional(Oe.object({}).passthrough()),logging:Oe.optional(Oe.object({}).passthrough()),completions:Oe.optional(Oe.object({}).passthrough()),prompts:Oe.optional(Oe.object({listChanged:Oe.optional(Oe.boolean())}).passthrough()),resources:Oe.optional(Oe.object({subscribe:Oe.optional(Oe.boolean()),listChanged:Oe.optional(Oe.boolean())}).passthrough()),tools:Oe.optional(Oe.object({listChanged:Oe.optional(Oe.boolean())}).passthrough())}).passthrough(),Vke=L6.extend({protocolVersion:Oe.string(),capabilities:t7n,serverInfo:lDt,instructions:Oe.optional(Oe.string())}),cDt=j8.extend({method:Oe.literal("notifications/initialized")}),uDt=t=>cDt.safeParse(t).success,Hhe=G1.extend({method:Oe.literal("ping")}),r7n=Oe.object({progress:Oe.number(),total:Oe.optional(Oe.number()),message:Oe.optional(Oe.string())}).passthrough(),Ghe=j8.extend({method:Oe.literal("notifications/progress"),params:jX.merge(r7n).extend({progressToken:eDt})}),Vhe=G1.extend({params:P6.extend({cursor:Oe.optional(tDt)}).optional()}),$he=L6.extend({nextCursor:Oe.optional(tDt)}),fDt=Oe.object({uri:Oe.string(),mimeType:Oe.optional(Oe.string()),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),dDt=fDt.extend({text:Oe.string()}),$ke=Oe.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),pDt=fDt.extend({blob:$ke}),hDt=zX.extend({uri:Oe.string(),description:Oe.optional(Oe.string()),mimeType:Oe.optional(Oe.string()),_meta:Oe.optional(Oe.object({}).passthrough())}),n7n=zX.extend({uriTemplate:Oe.string(),description:Oe.optional(Oe.string()),mimeType:Oe.optional(Oe.string()),_meta:Oe.optional(Oe.object({}).passthrough())}),i7n=Vhe.extend({method:Oe.literal("resources/list")}),Wke=$he.extend({resources:Oe.array(hDt)}),o7n=Vhe.extend({method:Oe.literal("resources/templates/list")}),jke=$he.extend({resourceTemplates:Oe.array(n7n)}),s7n=G1.extend({method:Oe.literal("resources/read"),params:P6.extend({uri:Oe.string()})}),Yke=L6.extend({contents:Oe.array(Oe.union([dDt,pDt]))}),a7n=j8.extend({method:Oe.literal("notifications/resources/list_changed")}),l7n=G1.extend({method:Oe.literal("resources/subscribe"),params:P6.extend({uri:Oe.string()})}),c7n=G1.extend({method:Oe.literal("resources/unsubscribe"),params:P6.extend({uri:Oe.string()})}),u7n=j8.extend({method:Oe.literal("notifications/resources/updated"),params:jX.extend({uri:Oe.string()})}),f7n=Oe.object({name:Oe.string(),description:Oe.optional(Oe.string()),required:Oe.optional(Oe.boolean())}).passthrough(),d7n=zX.extend({description:Oe.optional(Oe.string()),arguments:Oe.optional(Oe.array(f7n)),_meta:Oe.optional(Oe.object({}).passthrough())}),p7n=Vhe.extend({method:Oe.literal("prompts/list")}),JX=$he.extend({prompts:Oe.array(d7n)}),h7n=G1.extend({method:Oe.literal("prompts/get"),params:P6.extend({name:Oe.string(),arguments:Oe.optional(Oe.record(Oe.string()))})}),zke=Oe.object({type:Oe.literal("text"),text:Oe.string(),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),Jke=Oe.object({type:Oe.literal("image"),data:$ke,mimeType:Oe.string(),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),Kke=Oe.object({type:Oe.literal("audio"),data:$ke,mimeType:Oe.string(),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),m7n=Oe.object({type:Oe.literal("resource"),resource:Oe.union([dDt,pDt]),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),g7n=hDt.extend({type:Oe.literal("resource_link")}),mDt=Oe.union([zke,Jke,Kke,g7n,m7n]),A7n=Oe.object({role:Oe.enum(["user","assistant"]),content:mDt}).passthrough(),KX=L6.extend({description:Oe.optional(Oe.string()),messages:Oe.array(A7n)}),y7n=j8.extend({method:Oe.literal("notifications/prompts/list_changed")}),E7n=Oe.object({title:Oe.optional(Oe.string()),readOnlyHint:Oe.optional(Oe.boolean()),destructiveHint:Oe.optional(Oe.boolean()),idempotentHint:Oe.optional(Oe.boolean()),openWorldHint:Oe.optional(Oe.boolean())}).passthrough(),v7n=zX.extend({description:Oe.optional(Oe.string()),inputSchema:Oe.object({type:Oe.literal("object"),properties:Oe.optional(Oe.object({}).passthrough()),required:Oe.optional(Oe.array(Oe.string()))}).passthrough(),outputSchema:Oe.optional(Oe.object({type:Oe.literal("object"),properties:Oe.optional(Oe.object({}).passthrough()),required:Oe.optional(Oe.array(Oe.string()))}).passthrough()),annotations:Oe.optional(E7n),_meta:Oe.optional(Oe.object({}).passthrough())}),C7n=Vhe.extend({method:Oe.literal("tools/list")}),Xke=$he.extend({tools:Oe.array(v7n)}),Whe=L6.extend({content:Oe.array(mDt).default([]),structuredContent:Oe.object({}).passthrough().optional(),isError:Oe.optional(Oe.boolean())}),K7o=Whe.or(L6.extend({toolResult:Oe.unknown()})),b7n=G1.extend({method:Oe.literal("tools/call"),params:P6.extend({name:Oe.string(),arguments:Oe.optional(Oe.record(Oe.unknown()))})}),_7n=j8.extend({method:Oe.literal("notifications/tools/list_changed")}),gDt=Oe.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),S7n=G1.extend({method:Oe.literal("logging/setLevel"),params:P6.extend({level:gDt})}),x7n=j8.extend({method:Oe.literal("notifications/message"),params:jX.extend({level:gDt,logger:Oe.optional(Oe.string()),data:Oe.unknown()})}),w7n=Oe.object({name:Oe.string().optional()}).passthrough(),T7n=Oe.object({hints:Oe.optional(Oe.array(w7n)),costPriority:Oe.optional(Oe.number().min(0).max(1)),speedPriority:Oe.optional(Oe.number().min(0).max(1)),intelligencePriority:Oe.optional(Oe.number().min(0).max(1))}).passthrough(),I7n=Oe.object({role:Oe.enum(["user","assistant"]),content:Oe.union([zke,Jke,Kke])}).passthrough(),D7n=G1.extend({method:Oe.literal("sampling/createMessage"),params:P6.extend({messages:Oe.array(I7n),systemPrompt:Oe.optional(Oe.string()),includeContext:Oe.optional(Oe.enum(["none","thisServer","allServers"])),temperature:Oe.optional(Oe.number()),maxTokens:Oe.number().int(),stopSequences:Oe.optional(Oe.array(Oe.string())),metadata:Oe.optional(Oe.object({}).passthrough()),modelPreferences:Oe.optional(T7n)})}),R7n=L6.extend({model:Oe.string(),stopReason:Oe.optional(Oe.enum(["endTurn","stopSequence","maxTokens"]).or(Oe.string())),role:Oe.enum(["user","assistant"]),content:Oe.discriminatedUnion("type",[zke,Jke,Kke])}),B7n=Oe.object({type:Oe.literal("boolean"),title:Oe.optional(Oe.string()),description:Oe.optional(Oe.string()),default:Oe.optional(Oe.boolean())}).passthrough(),N7n=Oe.object({type:Oe.literal("string"),title:Oe.optional(Oe.string()),description:Oe.optional(Oe.string()),minLength:Oe.optional(Oe.number()),maxLength:Oe.optional(Oe.number()),format:Oe.optional(Oe.enum(["email","uri","date","date-time"]))}).passthrough(),O7n=Oe.object({type:Oe.enum(["number","integer"]),title:Oe.optional(Oe.string()),description:Oe.optional(Oe.string()),minimum:Oe.optional(Oe.number()),maximum:Oe.optional(Oe.number())}).passthrough(),M7n=Oe.object({type:Oe.literal("string"),title:Oe.optional(Oe.string()),description:Oe.optional(Oe.string()),enum:Oe.array(Oe.string()),enumNames:Oe.optional(Oe.array(Oe.string()))}).passthrough(),k7n=Oe.union([B7n,N7n,O7n,M7n]),F7n=G1.extend({method:Oe.literal("elicitation/create"),params:P6.extend({message:Oe.string(),requestedSchema:Oe.object({type:Oe.literal("object"),properties:Oe.record(Oe.string(),k7n),required:Oe.optional(Oe.array(Oe.string()))}).passthrough()})}),P7n=L6.extend({action:Oe.enum(["accept","decline","cancel"]),content:Oe.optional(Oe.record(Oe.string(),Oe.unknown()))}),L7n=Oe.object({type:Oe.literal("ref/resource"),uri:Oe.string()}).passthrough(),U7n=Oe.object({type:Oe.literal("ref/prompt"),name:Oe.string()}).passthrough(),Q7n=G1.extend({method:Oe.literal("completion/complete"),params:P6.extend({ref:Oe.union([U7n,L7n]),argument:Oe.object({name:Oe.string(),value:Oe.string()}).passthrough(),context:Oe.optional(Oe.object({arguments:Oe.optional(Oe.record(Oe.string(),Oe.string()))}))})}),Zke=L6.extend({completion:Oe.object({values:Oe.array(Oe.string()).max(100),total:Oe.optional(Oe.number().int()),hasMore:Oe.optional(Oe.boolean())}).passthrough()}),q7n=Oe.object({uri:Oe.string().startsWith("file://"),name:Oe.optional(Oe.string()),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),jhe=G1.extend({method:Oe.literal("roots/list")}),H7n=L6.extend({roots:Oe.array(q7n)}),G7n=j8.extend({method:Oe.literal("notifications/roots/list_changed")}),X7o=Oe.union([Hhe,e7n,Q7n,S7n,h7n,p7n,i7n,o7n,s7n,l7n,c7n,b7n,C7n]),Z7o=Oe.union([qhe,Ghe,cDt,G7n]),e_o=Oe.union([nN,R7n,P7n,H7n]),t_o=Oe.union([Hhe,D7n,F7n,jhe]),r_o=Oe.union([qhe,Ghe,x7n,u7n,a7n,_7n,y7n]),n_o=Oe.union([nN,Vke,Zke,KX,JX,Wke,jke,Yke,Whe,Xke]),F6=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function ADt(t,e){return Object.entries(e).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...t})}var V7n,Yhe,yDt=Te(()=>{Sw();V7n=6e4,Yhe=class{constructor(e){this._options=e,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(qhe,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(Ghe,r=>{this._onprogress(r)}),this.setRequestHandler(Hhe,r=>({}))}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new F6(k6.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let o=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),YX(c)||aDt(c)?this._onresponse(c):Qhe(c)?this._onrequest(c,u):iDt(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new F6(k6.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;let o=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,s=this._transport;if(o===void 0){s?.send({jsonrpc:"2.0",id:e.id,error:{code:k6.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let c={signal:a.signal,sessionId:s?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,f,d)=>this.request(u,f,{...d,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>o(e,c)).then(u=>{if(!a.signal.aborted)return s?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var f;if(!a.signal.aborted)return s?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:k6.InternalError,message:(f=u.message)!==null&&f!==void 0?f:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){s(c);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),YX(e))n(e);else{let i=new F6(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}=n??{};return new Promise((a,c)=>{var u,f,d,p,h,g;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(f=n?.signal)===null||f===void 0||f.throwIfAborted();let A=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:A};n?.onprogress&&(this._progressHandlers.set(A,n.onprogress),y.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:A}});let v=T=>{var B;this._responseHandlers.delete(A),this._progressHandlers.delete(A),this._cleanupTimeout(A),(B=this._transport)===null||B===void 0||B.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:A,reason:String(T)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`))),c(T)};this._responseHandlers.set(A,T=>{var B;if(!(!((B=n?.signal)===null||B===void 0)&&B.aborted)){if(T instanceof Error)return c(T);try{let P=r.parse(T.result);a(P)}catch(P){c(P)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var T;v((T=n?.signal)===null||T===void 0?void 0:T.reason)});let S=(h=n?.timeout)!==null&&h!==void 0?h:V7n,x=()=>v(new F6(k6.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(A,S,n?.maxTotalTimeout,x,(g=n?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(y,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(T=>{this._cleanupTimeout(A),c(T)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(f=>this._onerror(f))});return}let a={...e,jsonrpc:"2.0"};await this._transport.send(a,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>Promise.resolve(r(e.parse(i),o)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}});var vDt=N((zhe,EDt)=>{(function(t,e){typeof zhe=="object"&&typeof EDt<"u"?e(zhe):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(zhe,(function(t){"use strict";function e(){for(var at=arguments.length,Je=Array(at),dt=0;dt<at;dt++)Je[dt]=arguments[dt];if(Je.length>1){Je[0]=Je[0].slice(0,-1);for(var wt=Je.length-1,mt=1;mt<wt;++mt)Je[mt]=Je[mt].slice(1,-1);return Je[wt]=Je[wt].slice(1),Je.join("")}else return Je[0]}function r(at){return"(?:"+at+")"}function n(at){return at===void 0?"undefined":at===null?"null":Object.prototype.toString.call(at).split(" ").pop().split("]").shift().toLowerCase()}function i(at){return at.toUpperCase()}function o(at){return at!=null?at instanceof Array?at:typeof at.length!="number"||at.split||at.setInterval||at.call?[at]:Array.prototype.slice.call(at):[]}function s(at,Je){var dt=at;if(Je)for(var wt in Je)dt[wt]=Je[wt];return dt}function a(at){var Je="[A-Za-z]",dt="[\\x0D]",wt="[0-9]",mt="[\\x22]",Ar=e(wt,"[A-Fa-f]"),Br="[\\x0A]",zr="[\\x20]",an=r(r("%[EFef]"+Ar+"%"+Ar+Ar+"%"+Ar+Ar)+"|"+r("%[89A-Fa-f]"+Ar+"%"+Ar+Ar)+"|"+r("%"+Ar+Ar)),En="[\\:\\/\\?\\#\\[\\]\\@]",Vn="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ki=e(En,Vn),Qi=at?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Cn=at?"[\\uE000-\\uF8FF]":"[]",Si=e(Je,wt,"[\\-\\.\\_\\~]",Qi),xi=r(Je+e(Je,wt,"[\\+\\-\\.]")+"*"),Yi=r(r(an+"|"+e(Si,Vn,"[\\:]"))+"*"),Gl=r(r("25[0-5]")+"|"+r("2[0-4]"+wt)+"|"+r("1"+wt+wt)+"|"+r("[1-9]"+wt)+"|"+wt),Us=r(r("25[0-5]")+"|"+r("2[0-4]"+wt)+"|"+r("1"+wt+wt)+"|"+r("0?[1-9]"+wt)+"|0?0?"+wt),Qs=r(Us+"\\."+Us+"\\."+Us+"\\."+Us),Bi=r(Ar+"{1,4}"),Vl=r(r(Bi+"\\:"+Bi)+"|"+Qs),Go=r(r(Bi+"\\:")+"{6}"+Vl),wn=r("\\:\\:"+r(Bi+"\\:")+"{5}"+Vl),Pc=r(r(Bi)+"?\\:\\:"+r(Bi+"\\:")+"{4}"+Vl),Ba=r(r(r(Bi+"\\:")+"{0,1}"+Bi)+"?\\:\\:"+r(Bi+"\\:")+"{3}"+Vl),Fo=r(r(r(Bi+"\\:")+"{0,2}"+Bi)+"?\\:\\:"+r(Bi+"\\:")+"{2}"+Vl),Lc=r(r(r(Bi+"\\:")+"{0,3}"+Bi)+"?\\:\\:"+Bi+"\\:"+Vl),ma=r(r(r(Bi+"\\:")+"{0,4}"+Bi)+"?\\:\\:"+Vl),ws=r(r(r(Bi+"\\:")+"{0,5}"+Bi)+"?\\:\\:"+Bi),sl=r(r(r(Bi+"\\:")+"{0,6}"+Bi)+"?\\:\\:"),Ve=r([Go,wn,Pc,Ba,Fo,Lc,ma,ws,sl].join("|")),We=r(r(Si+"|"+an)+"+"),At=r(Ve+"\\%25"+We),xt=r(Ve+r("\\%25|\\%(?!"+Ar+"{2})")+We),Mt=r("[vV]"+Ar+"+\\."+e(Si,Vn,"[\\:]")+"+"),tr=r("\\["+r(xt+"|"+Ve+"|"+Mt)+"\\]"),Er=r(r(an+"|"+e(Si,Vn))+"*"),ur=r(tr+"|"+Qs+"(?!"+Er+")|"+Er),xr=r(wt+"*"),Tr=r(r(Yi+"@")+"?"+ur+r("\\:"+xr)+"?"),kr=r(an+"|"+e(Si,Vn,"[\\:\\@]")),bn=r(kr+"*"),uo=r(kr+"+"),Ts=r(r(an+"|"+e(Si,Vn,"[\\@]"))+"+"),wi=r(r("\\/"+bn)+"*"),Wa=r("\\/"+r(uo+wi)+"?"),Na=r(Ts+wi),Lf=r(uo+wi),$l="(?!"+kr+")",Ch=r(wi+"|"+Wa+"|"+Na+"|"+Lf+"|"+$l),tp=r(r(kr+"|"+e("[\\/\\?]",Cn))+"*"),Wl=r(r(kr+"|[\\/\\?]")+"*"),F0=r(r("\\/\\/"+Tr+wi)+"|"+Wa+"|"+Lf+"|"+$l),P0=r(xi+"\\:"+F0+r("\\?"+tp)+"?"+r("\\#"+Wl)+"?"),rp=r(r("\\/\\/"+Tr+wi)+"|"+Wa+"|"+Na+"|"+$l),_c=r(rp+r("\\?"+tp)+"?"+r("\\#"+Wl)+"?"),Up=r(P0+"|"+_c),Uf=r(xi+"\\:"+F0+r("\\?"+tp)+"?"),pf="^("+xi+")\\:"+r(r("\\/\\/("+r("("+Yi+")@")+"?("+ur+")"+r("\\:("+xr+")")+"?)")+"?("+wi+"|"+Wa+"|"+Lf+"|"+$l+")")+r("\\?("+tp+")")+"?"+r("\\#("+Wl+")")+"?$",Qp="^(){0}"+r(r("\\/\\/("+r("("+Yi+")@")+"?("+ur+")"+r("\\:("+xr+")")+"?)")+"?("+wi+"|"+Wa+"|"+Na+"|"+$l+")")+r("\\?("+tp+")")+"?"+r("\\#("+Wl+")")+"?$",L0="^("+xi+")\\:"+r(r("\\/\\/("+r("("+Yi+")@")+"?("+ur+")"+r("\\:("+xr+")")+"?)")+"?("+wi+"|"+Wa+"|"+Lf+"|"+$l+")")+r("\\?("+tp+")")+"?$",ru="^"+r("\\#("+Wl+")")+"?$",e2="^"+r("("+Yi+")@")+"?("+ur+")"+r("\\:("+xr+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",Je,wt,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Si,Vn),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Si,Vn),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Si,Vn),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Si,Vn),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Si,Vn,"[\\:\\@\\/\\?]",Cn),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Si,Vn,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Si,Vn),"g"),UNRESERVED:new RegExp(Si,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Si,ki),"g"),PCT_ENCODED:new RegExp(an,"g"),IPV4ADDRESS:new RegExp("^("+Qs+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Ve+")"+r(r("\\%25|\\%(?!"+Ar+"{2})")+"("+We+")")+"?\\]?$")}}var c=a(!1),u=a(!0),f=(function(){function at(Je,dt){var wt=[],mt=!0,Ar=!1,Br=void 0;try{for(var zr=Je[Symbol.iterator](),an;!(mt=(an=zr.next()).done)&&(wt.push(an.value),!(dt&&wt.length===dt));mt=!0);}catch(En){Ar=!0,Br=En}finally{try{!mt&&zr.return&&zr.return()}finally{if(Ar)throw Br}}return wt}return function(Je,dt){if(Array.isArray(Je))return Je;if(Symbol.iterator in Object(Je))return at(Je,dt);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=function(at){if(Array.isArray(at)){for(var Je=0,dt=Array(at.length);Je<at.length;Je++)dt[Je]=at[Je];return dt}else return Array.from(at)},p=2147483647,h=36,g=1,A=26,y=38,v=700,S=72,x=128,T="-",B=/^xn--/,P=/[^\0-\x7E]/,L=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=h-g,U=Math.floor,M=String.fromCharCode;function Q(at){throw new RangeError(q[at])}function F(at,Je){for(var dt=[],wt=at.length;wt--;)dt[wt]=Je(at[wt]);return dt}function O(at,Je){var dt=at.split("@"),wt="";dt.length>1&&(wt=dt[0]+"@",at=dt[1]),at=at.replace(L,".");var mt=at.split("."),Ar=F(mt,Je).join(".");return wt+Ar}function V(at){for(var Je=[],dt=0,wt=at.length;dt<wt;){var mt=at.charCodeAt(dt++);if(mt>=55296&&mt<=56319&&dt<wt){var Ar=at.charCodeAt(dt++);(Ar&64512)==56320?Je.push(((mt&1023)<<10)+(Ar&1023)+65536):(Je.push(mt),dt--)}else Je.push(mt)}return Je}var G=function(Je){return String.fromCodePoint.apply(String,d(Je))},j=function(Je){return Je-48<10?Je-22:Je-65<26?Je-65:Je-97<26?Je-97:h},$=function(Je,dt){return Je+22+75*(Je<26)-((dt!=0)<<5)},te=function(Je,dt,wt){var mt=0;for(Je=wt?U(Je/v):Je>>1,Je+=U(Je/dt);Je>I*A>>1;mt+=h)Je=U(Je/I);return U(mt+(I+1)*Je/(Je+y))},J=function(Je){var dt=[],wt=Je.length,mt=0,Ar=x,Br=S,zr=Je.lastIndexOf(T);zr<0&&(zr=0);for(var an=0;an<zr;++an)Je.charCodeAt(an)>=128&&Q("not-basic"),dt.push(Je.charCodeAt(an));for(var En=zr>0?zr+1:0;En<wt;){for(var Vn=mt,ki=1,Qi=h;;Qi+=h){En>=wt&&Q("invalid-input");var Cn=j(Je.charCodeAt(En++));(Cn>=h||Cn>U((p-mt)/ki))&&Q("overflow"),mt+=Cn*ki;var Si=Qi<=Br?g:Qi>=Br+A?A:Qi-Br;if(Cn<Si)break;var xi=h-Si;ki>U(p/xi)&&Q("overflow"),ki*=xi}var Yi=dt.length+1;Br=te(mt-Vn,Yi,Vn==0),U(mt/Yi)>p-Ar&&Q("overflow"),Ar+=U(mt/Yi),mt%=Yi,dt.splice(mt++,0,Ar)}return String.fromCodePoint.apply(String,dt)},he=function(Je){var dt=[];Je=V(Je);var wt=Je.length,mt=x,Ar=0,Br=S,zr=!0,an=!1,En=void 0;try{for(var Vn=Je[Symbol.iterator](),ki;!(zr=(ki=Vn.next()).done);zr=!0){var Qi=ki.value;Qi<128&&dt.push(M(Qi))}}catch(xt){an=!0,En=xt}finally{try{!zr&&Vn.return&&Vn.return()}finally{if(an)throw En}}var Cn=dt.length,Si=Cn;for(Cn&&dt.push(T);Si<wt;){var xi=p,Yi=!0,Gl=!1,Us=void 0;try{for(var Qs=Je[Symbol.iterator](),Bi;!(Yi=(Bi=Qs.next()).done);Yi=!0){var Vl=Bi.value;Vl>=mt&&Vl<xi&&(xi=Vl)}}catch(xt){Gl=!0,Us=xt}finally{try{!Yi&&Qs.return&&Qs.return()}finally{if(Gl)throw Us}}var Go=Si+1;xi-mt>U((p-Ar)/Go)&&Q("overflow"),Ar+=(xi-mt)*Go,mt=xi;var wn=!0,Pc=!1,Ba=void 0;try{for(var Fo=Je[Symbol.iterator](),Lc;!(wn=(Lc=Fo.next()).done);wn=!0){var ma=Lc.value;if(ma<mt&&++Ar>p&&Q("overflow"),ma==mt){for(var ws=Ar,sl=h;;sl+=h){var Ve=sl<=Br?g:sl>=Br+A?A:sl-Br;if(ws<Ve)break;var We=ws-Ve,At=h-Ve;dt.push(M($(Ve+We%At,0))),ws=U(We/At)}dt.push(M($(ws,0))),Br=te(Ar,Go,Si==Cn),Ar=0,++Si}}}catch(xt){Pc=!0,Ba=xt}finally{try{!wn&&Fo.return&&Fo.return()}finally{if(Pc)throw Ba}}++Ar,++mt}return dt.join("")},Ce=function(Je){return O(Je,function(dt){return B.test(dt)?J(dt.slice(4).toLowerCase()):dt})},me=function(Je){return O(Je,function(dt){return P.test(dt)?"xn--"+he(dt):dt})},_e={version:"2.1.0",ucs2:{decode:V,encode:G},decode:J,encode:he,toASCII:me,toUnicode:Ce},Se={};function oe(at){var Je=at.charCodeAt(0),dt=void 0;return Je<16?dt="%0"+Je.toString(16).toUpperCase():Je<128?dt="%"+Je.toString(16).toUpperCase():Je<2048?dt="%"+(Je>>6|192).toString(16).toUpperCase()+"%"+(Je&63|128).toString(16).toUpperCase():dt="%"+(Je>>12|224).toString(16).toUpperCase()+"%"+(Je>>6&63|128).toString(16).toUpperCase()+"%"+(Je&63|128).toString(16).toUpperCase(),dt}function Ae(at){for(var Je="",dt=0,wt=at.length;dt<wt;){var mt=parseInt(at.substr(dt+1,2),16);if(mt<128)Je+=String.fromCharCode(mt),dt+=3;else if(mt>=194&&mt<224){if(wt-dt>=6){var Ar=parseInt(at.substr(dt+4,2),16);Je+=String.fromCharCode((mt&31)<<6|Ar&63)}else Je+=at.substr(dt,6);dt+=6}else if(mt>=224){if(wt-dt>=9){var Br=parseInt(at.substr(dt+4,2),16),zr=parseInt(at.substr(dt+7,2),16);Je+=String.fromCharCode((mt&15)<<12|(Br&63)<<6|zr&63)}else Je+=at.substr(dt,9);dt+=9}else Je+=at.substr(dt,3),dt+=3}return Je}function pe(at,Je){function dt(wt){var mt=Ae(wt);return mt.match(Je.UNRESERVED)?mt:wt}return at.scheme&&(at.scheme=String(at.scheme).replace(Je.PCT_ENCODED,dt).toLowerCase().replace(Je.NOT_SCHEME,"")),at.userinfo!==void 0&&(at.userinfo=String(at.userinfo).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_USERINFO,oe).replace(Je.PCT_ENCODED,i)),at.host!==void 0&&(at.host=String(at.host).replace(Je.PCT_ENCODED,dt).toLowerCase().replace(Je.NOT_HOST,oe).replace(Je.PCT_ENCODED,i)),at.path!==void 0&&(at.path=String(at.path).replace(Je.PCT_ENCODED,dt).replace(at.scheme?Je.NOT_PATH:Je.NOT_PATH_NOSCHEME,oe).replace(Je.PCT_ENCODED,i)),at.query!==void 0&&(at.query=String(at.query).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_QUERY,oe).replace(Je.PCT_ENCODED,i)),at.fragment!==void 0&&(at.fragment=String(at.fragment).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_FRAGMENT,oe).replace(Je.PCT_ENCODED,i)),at}function ie(at){return at.replace(/^0*(.*)/,"$1")||"0"}function de(at,Je){var dt=at.match(Je.IPV4ADDRESS)||[],wt=f(dt,2),mt=wt[1];return mt?mt.split(".").map(ie).join("."):at}function X(at,Je){var dt=at.match(Je.IPV6ADDRESS)||[],wt=f(dt,3),mt=wt[1],Ar=wt[2];if(mt){for(var Br=mt.toLowerCase().split("::").reverse(),zr=f(Br,2),an=zr[0],En=zr[1],Vn=En?En.split(":").map(ie):[],ki=an.split(":").map(ie),Qi=Je.IPV4ADDRESS.test(ki[ki.length-1]),Cn=Qi?7:8,Si=ki.length-Cn,xi=Array(Cn),Yi=0;Yi<Cn;++Yi)xi[Yi]=Vn[Yi]||ki[Si+Yi]||"";Qi&&(xi[Cn-1]=de(xi[Cn-1],Je));var Gl=xi.reduce(function(Go,wn,Pc){if(!wn||wn==="0"){var Ba=Go[Go.length-1];Ba&&Ba.index+Ba.length===Pc?Ba.length++:Go.push({index:Pc,length:1})}return Go},[]),Us=Gl.sort(function(Go,wn){return wn.length-Go.length})[0],Qs=void 0;if(Us&&Us.length>1){var Bi=xi.slice(0,Us.index),Vl=xi.slice(Us.index+Us.length);Qs=Bi.join(":")+"::"+Vl.join(":")}else Qs=xi.join(":");return Ar&&(Qs+="%"+Ar),Qs}else return at}var le=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ge="".match(/(){0}/)[1]===void 0;function ce(at){var Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt={},wt=Je.iri!==!1?u:c;Je.reference==="suffix"&&(at=(Je.scheme?Je.scheme+":":"")+"//"+at);var mt=at.match(le);if(mt){ge?(dt.scheme=mt[1],dt.userinfo=mt[3],dt.host=mt[4],dt.port=parseInt(mt[5],10),dt.path=mt[6]||"",dt.query=mt[7],dt.fragment=mt[8],isNaN(dt.port)&&(dt.port=mt[5])):(dt.scheme=mt[1]||void 0,dt.userinfo=at.indexOf("@")!==-1?mt[3]:void 0,dt.host=at.indexOf("//")!==-1?mt[4]:void 0,dt.port=parseInt(mt[5],10),dt.path=mt[6]||"",dt.query=at.indexOf("?")!==-1?mt[7]:void 0,dt.fragment=at.indexOf("#")!==-1?mt[8]:void 0,isNaN(dt.port)&&(dt.port=at.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?mt[4]:void 0)),dt.host&&(dt.host=X(de(dt.host,wt),wt)),dt.scheme===void 0&&dt.userinfo===void 0&&dt.host===void 0&&dt.port===void 0&&!dt.path&&dt.query===void 0?dt.reference="same-document":dt.scheme===void 0?dt.reference="relative":dt.fragment===void 0?dt.reference="absolute":dt.reference="uri",Je.reference&&Je.reference!=="suffix"&&Je.reference!==dt.reference&&(dt.error=dt.error||"URI is not a "+Je.reference+" reference.");var Ar=Se[(Je.scheme||dt.scheme||"").toLowerCase()];if(!Je.unicodeSupport&&(!Ar||!Ar.unicodeSupport)){if(dt.host&&(Je.domainHost||Ar&&Ar.domainHost))try{dt.host=_e.toASCII(dt.host.replace(wt.PCT_ENCODED,Ae).toLowerCase())}catch(Br){dt.error=dt.error||"Host's domain name can not be converted to ASCII via punycode: "+Br}pe(dt,c)}else pe(dt,wt);Ar&&Ar.parse&&Ar.parse(dt,Je)}else dt.error=dt.error||"URI can not be parsed.";return dt}function K(at,Je){var dt=Je.iri!==!1?u:c,wt=[];return at.userinfo!==void 0&&(wt.push(at.userinfo),wt.push("@")),at.host!==void 0&&wt.push(X(de(String(at.host),dt),dt).replace(dt.IPV6ADDRESS,function(mt,Ar,Br){return"["+Ar+(Br?"%25"+Br:"")+"]"})),(typeof at.port=="number"||typeof at.port=="string")&&(wt.push(":"),wt.push(String(at.port))),wt.length?wt.join(""):void 0}var re=/^\.\.?\//,xe=/^\/\.(\/|$)/,ye=/^\/\.\.(\/|$)/,Z=/^\/?(?:.|\n)*?(?=\/|$)/;function Re(at){for(var Je=[];at.length;)if(at.match(re))at=at.replace(re,"");else if(at.match(xe))at=at.replace(xe,"/");else if(at.match(ye))at=at.replace(ye,"/"),Je.pop();else if(at==="."||at==="..")at="";else{var dt=at.match(Z);if(dt){var wt=dt[0];at=at.slice(wt.length),Je.push(wt)}else throw new Error("Unexpected dot segment condition")}return Je.join("")}function Qe(at){var Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=Je.iri?u:c,wt=[],mt=Se[(Je.scheme||at.scheme||"").toLowerCase()];if(mt&&mt.serialize&&mt.serialize(at,Je),at.host&&!dt.IPV6ADDRESS.test(at.host)){if(Je.domainHost||mt&&mt.domainHost)try{at.host=Je.iri?_e.toUnicode(at.host):_e.toASCII(at.host.replace(dt.PCT_ENCODED,Ae).toLowerCase())}catch(zr){at.error=at.error||"Host's domain name can not be converted to "+(Je.iri?"Unicode":"ASCII")+" via punycode: "+zr}}pe(at,dt),Je.reference!=="suffix"&&at.scheme&&(wt.push(at.scheme),wt.push(":"));var Ar=K(at,Je);if(Ar!==void 0&&(Je.reference!=="suffix"&&wt.push("//"),wt.push(Ar),at.path&&at.path.charAt(0)!=="/"&&wt.push("/")),at.path!==void 0){var Br=at.path;!Je.absolutePath&&(!mt||!mt.absolutePath)&&(Br=Re(Br)),Ar===void 0&&(Br=Br.replace(/^\/\//,"/%2F")),wt.push(Br)}return at.query!==void 0&&(wt.push("?"),wt.push(at.query)),at.fragment!==void 0&&(wt.push("#"),wt.push(at.fragment)),wt.join("")}function qe(at,Je){var dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},wt=arguments[3],mt={};return wt||(at=ce(Qe(at,dt),dt),Je=ce(Qe(Je,dt),dt)),dt=dt||{},!dt.tolerant&&Je.scheme?(mt.scheme=Je.scheme,mt.userinfo=Je.userinfo,mt.host=Je.host,mt.port=Je.port,mt.path=Re(Je.path||""),mt.query=Je.query):(Je.userinfo!==void 0||Je.host!==void 0||Je.port!==void 0?(mt.userinfo=Je.userinfo,mt.host=Je.host,mt.port=Je.port,mt.path=Re(Je.path||""),mt.query=Je.query):(Je.path?(Je.path.charAt(0)==="/"?mt.path=Re(Je.path):((at.userinfo!==void 0||at.host!==void 0||at.port!==void 0)&&!at.path?mt.path="/"+Je.path:at.path?mt.path=at.path.slice(0,at.path.lastIndexOf("/")+1)+Je.path:mt.path=Je.path,mt.path=Re(mt.path)),mt.query=Je.query):(mt.path=at.path,Je.query!==void 0?mt.query=Je.query:mt.query=at.query),mt.userinfo=at.userinfo,mt.host=at.host,mt.port=at.port),mt.scheme=at.scheme),mt.fragment=Je.fragment,mt}function Ge(at,Je,dt){var wt=s({scheme:"null"},dt);return Qe(qe(ce(at,wt),ce(Je,wt),wt,!0),wt)}function ue(at,Je){return typeof at=="string"?at=Qe(ce(at,Je),Je):n(at)==="object"&&(at=ce(Qe(at,Je),Je)),at}function Ne(at,Je,dt){return typeof at=="string"?at=Qe(ce(at,dt),dt):n(at)==="object"&&(at=Qe(at,dt)),typeof Je=="string"?Je=Qe(ce(Je,dt),dt):n(Je)==="object"&&(Je=Qe(Je,dt)),at===Je}function Me(at,Je){return at&&at.toString().replace(!Je||!Je.iri?c.ESCAPE:u.ESCAPE,oe)}function Fe(at,Je){return at&&at.toString().replace(!Je||!Je.iri?c.PCT_ENCODED:u.PCT_ENCODED,Ae)}var Ke={scheme:"http",domainHost:!0,parse:function(Je,dt){return Je.host||(Je.error=Je.error||"HTTP URIs must have a host."),Je},serialize:function(Je,dt){var wt=String(Je.scheme).toLowerCase()==="https";return(Je.port===(wt?443:80)||Je.port==="")&&(Je.port=void 0),Je.path||(Je.path="/"),Je}},rt={scheme:"https",domainHost:Ke.domainHost,parse:Ke.parse,serialize:Ke.serialize};function pt(at){return typeof at.secure=="boolean"?at.secure:String(at.scheme).toLowerCase()==="wss"}var yt={scheme:"ws",domainHost:!0,parse:function(Je,dt){var wt=Je;return wt.secure=pt(wt),wt.resourceName=(wt.path||"/")+(wt.query?"?"+wt.query:""),wt.path=void 0,wt.query=void 0,wt},serialize:function(Je,dt){if((Je.port===(pt(Je)?443:80)||Je.port==="")&&(Je.port=void 0),typeof Je.secure=="boolean"&&(Je.scheme=Je.secure?"wss":"ws",Je.secure=void 0),Je.resourceName){var wt=Je.resourceName.split("?"),mt=f(wt,2),Ar=mt[0],Br=mt[1];Je.path=Ar&&Ar!=="/"?Ar:void 0,Je.query=Br,Je.resourceName=void 0}return Je.fragment=void 0,Je}},It={scheme:"wss",domainHost:yt.domainHost,parse:yt.parse,serialize:yt.serialize},hr={},Nr=!0,Le="[A-Za-z0-9\\-\\.\\_\\~"+(Nr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ct="[0-9A-Fa-f]",ut=r(r("%[EFef]"+ct+"%"+ct+ct+"%"+ct+ct)+"|"+r("%[89A-Fa-f]"+ct+"%"+ct+ct)+"|"+r("%"+ct+ct)),Ut="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ht="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Ft=e(Ht,'[\\"\\\\]'),Qt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Zt=new RegExp(Le,"g"),Jt=new RegExp(ut,"g"),cn=new RegExp(e("[^]",Ut,"[\\.]",'[\\"]',Ft),"g"),Qr=new RegExp(e("[^]",Le,Qt),"g"),Zr=Qr;function tn(at){var Je=Ae(at);return Je.match(Zt)?Je:at}var Yn={scheme:"mailto",parse:function(Je,dt){var wt=Je,mt=wt.to=wt.path?wt.path.split(","):[];if(wt.path=void 0,wt.query){for(var Ar=!1,Br={},zr=wt.query.split("&"),an=0,En=zr.length;an<En;++an){var Vn=zr[an].split("=");switch(Vn[0]){case"to":for(var ki=Vn[1].split(","),Qi=0,Cn=ki.length;Qi<Cn;++Qi)mt.push(ki[Qi]);break;case"subject":wt.subject=Fe(Vn[1],dt);break;case"body":wt.body=Fe(Vn[1],dt);break;default:Ar=!0,Br[Fe(Vn[0],dt)]=Fe(Vn[1],dt);break}}Ar&&(wt.headers=Br)}wt.query=void 0;for(var Si=0,xi=mt.length;Si<xi;++Si){var Yi=mt[Si].split("@");if(Yi[0]=Fe(Yi[0]),dt.unicodeSupport)Yi[1]=Fe(Yi[1],dt).toLowerCase();else try{Yi[1]=_e.toASCII(Fe(Yi[1],dt).toLowerCase())}catch(Gl){wt.error=wt.error||"Email address's domain name can not be converted to ASCII via punycode: "+Gl}mt[Si]=Yi.join("@")}return wt},serialize:function(Je,dt){var wt=Je,mt=o(Je.to);if(mt){for(var Ar=0,Br=mt.length;Ar<Br;++Ar){var zr=String(mt[Ar]),an=zr.lastIndexOf("@"),En=zr.slice(0,an).replace(Jt,tn).replace(Jt,i).replace(cn,oe),Vn=zr.slice(an+1);try{Vn=dt.iri?_e.toUnicode(Vn):_e.toASCII(Fe(Vn,dt).toLowerCase())}catch(Si){wt.error=wt.error||"Email address's domain name can not be converted to "+(dt.iri?"Unicode":"ASCII")+" via punycode: "+Si}mt[Ar]=En+"@"+Vn}wt.path=mt.join(",")}var ki=Je.headers=Je.headers||{};Je.subject&&(ki.subject=Je.subject),Je.body&&(ki.body=Je.body);var Qi=[];for(var Cn in ki)ki[Cn]!==hr[Cn]&&Qi.push(Cn.replace(Jt,tn).replace(Jt,i).replace(Qr,oe)+"="+ki[Cn].replace(Jt,tn).replace(Jt,i).replace(Zr,oe));return Qi.length&&(wt.query=Qi.join("&")),wt}},ti=/^([^\:]+)\:(.*)/,On={scheme:"urn",parse:function(Je,dt){var wt=Je.path&&Je.path.match(ti),mt=Je;if(wt){var Ar=dt.scheme||mt.scheme||"urn",Br=wt[1].toLowerCase(),zr=wt[2],an=Ar+":"+(dt.nid||Br),En=Se[an];mt.nid=Br,mt.nss=zr,mt.path=void 0,En&&(mt=En.parse(mt,dt))}else mt.error=mt.error||"URN can not be parsed.";return mt},serialize:function(Je,dt){var wt=dt.scheme||Je.scheme||"urn",mt=Je.nid,Ar=wt+":"+(dt.nid||mt),Br=Se[Ar];Br&&(Je=Br.serialize(Je,dt));var zr=Je,an=Je.nss;return zr.path=(mt||dt.nid)+":"+an,zr}},ri=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ui={scheme:"urn:uuid",parse:function(Je,dt){var wt=Je;return wt.uuid=wt.nss,wt.nss=void 0,!dt.tolerant&&(!wt.uuid||!wt.uuid.match(ri))&&(wt.error=wt.error||"UUID is not valid."),wt},serialize:function(Je,dt){var wt=Je;return wt.nss=(Je.uuid||"").toLowerCase(),wt}};Se[Ke.scheme]=Ke,Se[rt.scheme]=rt,Se[yt.scheme]=yt,Se[It.scheme]=It,Se[Yn.scheme]=Yn,Se[On.scheme]=On,Se[Ui.scheme]=Ui,t.SCHEMES=Se,t.pctEncChar=oe,t.pctDecChars=Ae,t.parse=ce,t.removeDotSegments=Re,t.serialize=Qe,t.resolveComponents=qe,t.resolve=Ge,t.normalize=ue,t.equal=Ne,t.escapeComponent=Me,t.unescapeComponent=Fe,Object.defineProperty(t,"__esModule",{value:!0})}))});var hq=N((a_o,CDt)=>{"use strict";CDt.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var _Dt=N((l_o,bDt)=>{"use strict";bDt.exports=function(e){for(var r=0,n=e.length,i=0,o;i<n;)r++,o=e.charCodeAt(i++),o>=55296&&o<=56319&&i<n&&(o=e.charCodeAt(i),(o&64512)==56320&&i++);return r}});var iN=N((c_o,wDt)=>{"use strict";wDt.exports={copy:$7n,checkDataType:eFe,checkDataTypes:W7n,coerceToTypes:j7n,toHash:rFe,getProperty:nFe,escapeQuotes:iFe,equal:hq(),ucs2length:_Dt(),varOccurences:J7n,varReplace:K7n,schemaHasRules:X7n,schemaHasRulesExcept:Z7n,schemaUnknownRules:e_n,toQuotedString:tFe,getPathExpr:t_n,getPath:r_n,getData:o_n,unescapeFragment:s_n,unescapeJsonPointer:sFe,escapeFragment:a_n,escapeJsonPointer:oFe};function $7n(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function eFe(t,e,r,n){var i=n?" !== ":" === ",o=n?" || ":" && ",s=n?"!":"",a=n?"":"!";switch(t){case"null":return e+i+"null";case"array":return s+"Array.isArray("+e+")";case"object":return"("+s+e+o+"typeof "+e+i+'"object"'+o+a+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+i+'"number"'+o+a+"("+e+" % 1)"+o+e+i+e+(r?o+s+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+i+'"'+t+'"'+(r?o+s+"isFinite("+e+")":"")+")";default:return"typeof "+e+i+'"'+t+'"'}}function W7n(t,e,r){switch(t.length){case 1:return eFe(t[0],e,r,!0);default:var n="",i=rFe(t);i.array&&i.object&&(n=i.null?"(":"(!"+e+" || ",n+="typeof "+e+' !== "object")',delete i.null,delete i.array,delete i.object),i.number&&delete i.integer;for(var o in i)n+=(n?" && ":"")+eFe(o,e,r,!0);return n}}var SDt=rFe(["string","number","integer","boolean","null"]);function j7n(t,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var i=e[n];(SDt[i]||t==="array"&&i==="array")&&(r[r.length]=i)}if(r.length)return r}else{if(SDt[e])return[e];if(t==="array"&&e==="array")return["array"]}}function rFe(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var Y7n=/^[a-z$_][a-z$_0-9]*$/i,z7n=/'|\\/g;function nFe(t){return typeof t=="number"?"["+t+"]":Y7n.test(t)?"."+t:"['"+iFe(t)+"']"}function iFe(t){return t.replace(z7n,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function J7n(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function K7n(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function X7n(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function Z7n(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var n in t)if(n!=r&&e[n])return!0}function e_n(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function tFe(t){return"'"+iFe(t)+"'"}function t_n(t,e,r,n){var i=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return xDt(t,i)}function r_n(t,e,r){var n=tFe(r?"/"+oFe(e):nFe(e));return xDt(t,n)}var n_n=/^\/(?:[^~]|~0|~1)*$/,i_n=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function o_n(t,e,r){var n,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!n_n.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(i_n),!s)throw new Error("Invalid JSON-pointer: "+t);if(n=+s[1],i=s[2],i=="#"){if(n>=e)throw new Error("Cannot access property/index "+n+" levels up, current level is "+e);return r[e-n]}if(n>e)throw new Error("Cannot access data "+n+" levels up, current level is "+e);if(o="data"+(e-n||""),!i)return o}for(var a=o,c=i.split("/"),u=0;u<c.length;u++){var f=c[u];f&&(o+=nFe(sFe(f)),a+=" && "+o)}return a}function xDt(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function s_n(t){return sFe(decodeURIComponent(t))}function a_n(t){return encodeURIComponent(oFe(t))}function oFe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function sFe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var aFe=N((u_o,TDt)=>{"use strict";var l_n=iN();TDt.exports=c_n;function c_n(t){l_n.copy(t,this)}});var DDt=N((f_o,IDt)=>{"use strict";var xw=IDt.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Jhe(e,n,i,t,"",t)};xw.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};xw.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xw.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xw.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Jhe(t,e,r,n,i,o,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,c,u);for(var f in n){var d=n[f];if(Array.isArray(d)){if(f in xw.arrayKeywords)for(var p=0;p<d.length;p++)Jhe(t,e,r,d[p],i+"/"+f+"/"+p,o,i,f,n,p)}else if(f in xw.propsKeywords){if(d&&typeof d=="object")for(var h in d)Jhe(t,e,r,d[h],i+"/"+f+"/"+u_n(h),o,i,f,n,h)}else(f in xw.keywords||t.allKeys&&!(f in xw.skipKeywords))&&Jhe(t,e,r,d,i+"/"+f,o,i,f,n)}r(n,i,o,s,a,c,u)}}function u_n(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var r0e=N((d_o,ODt)=>{"use strict";var XX=vDt(),RDt=hq(),e0e=iN(),Khe=aFe(),f_n=DDt();ODt.exports=Tw;Tw.normalizeId=ww;Tw.fullPath=Xhe;Tw.url=Zhe;Tw.ids=g_n;Tw.inlineRef=lFe;Tw.schema=t0e;function Tw(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return Tw.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof Khe)return lFe(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var i=t0e.call(this,e,r),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof Khe?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=lFe(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function t0e(t,e){var r=XX.parse(e),n=NDt(r),i=Xhe(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==i){var o=ww(n),s=this._refs[o];if(typeof s=="string")return d_n.call(this,t,s,r);if(s instanceof Khe)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof Khe){if(s.validate||this._compile(s),o==ww(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=Xhe(this._getId(t.schema))}return BDt.call(this,r,i,t.schema,t)}function d_n(t,e,r){var n=t0e.call(this,t,e);if(n){var i=n.schema,o=n.baseId;t=n.root;var s=this._getId(i);return s&&(o=Zhe(o,s)),BDt.call(this,r,o,i,t)}}var p_n=e0e.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function BDt(t,e,r,n){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var i=t.fragment.split("/"),o=1;o<i.length;o++){var s=i[o];if(s){if(s=e0e.unescapeFragment(s),r=r[s],r===void 0)break;var a;if(!p_n[s]&&(a=this._getId(r),a&&(e=Zhe(e,a)),r.$ref)){var c=Zhe(e,r.$ref),u=t0e.call(this,n,c);u&&(r=u.schema,n=u.root,e=u.baseId)}}}if(r!==void 0&&r!==n.schema)return{schema:r,root:n,baseId:e}}}var h_n=e0e.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function lFe(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return cFe(t);if(e)return uFe(t)<=e}function cFe(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!cFe(e))return!1}else for(var n in t)if(n=="$ref"||(e=t[n],typeof e=="object"&&!cFe(e)))return!1;return!0}function uFe(t){var e=0,r;if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(r=t[n],typeof r=="object"&&(e+=uFe(r)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(h_n[i])e++;else if(r=t[i],typeof r=="object"&&(e+=uFe(r)+1),e==1/0)return 1/0}return e}function Xhe(t,e){e!==!1&&(t=ww(t));var r=XX.parse(t);return NDt(r)}function NDt(t){return XX.serialize(t).split("#")[0]+"#"}var m_n=/#\/?$/;function ww(t){return t?t.replace(m_n,""):""}function Zhe(t,e){return e=ww(e),XX.resolve(t,e)}function g_n(t){var e=ww(this._getId(t)),r={"":e},n={"":Xhe(e,!1)},i={},o=this;return f_n(t,{allKeys:!0},function(s,a,c,u,f,d,p){if(a!==""){var h=o._getId(s),g=r[u],A=n[u]+"/"+f;if(p!==void 0&&(A+="/"+(typeof p=="number"?p:e0e.escapeFragment(p))),typeof h=="string"){h=g=ww(g?XX.resolve(g,h):h);var y=o._refs[h];if(typeof y=="string"&&(y=o._refs[y]),y&&y.schema){if(!RDt(s,y.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=ww(A))if(h[0]=="#"){if(i[h]&&!RDt(s,i[h]))throw new Error('id "'+h+'" resolves to more than one schema');i[h]=s}else o._refs[h]=A}r[a]=g,n[a]=A}}),i}});var n0e=N((p_o,kDt)=>{"use strict";var fFe=r0e();kDt.exports={Validation:MDt(A_n),MissingRef:MDt(dFe)};function A_n(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}dFe.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function dFe(t,e,r){this.message=r||dFe.message(t,e),this.missingRef=fFe.url(t,e),this.missingSchema=fFe.normalizeId(fFe.fullPath(this.missingRef))}function MDt(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var pFe=N((h_o,FDt)=>{"use strict";FDt.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(o){return function(s){return function(a,c){var u={key:a,value:s[a]},f={key:c,value:s[c]};return o(u,f)}}})(e.cmp),i=[];return(function o(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var a,c;if(Array.isArray(s)){for(c="[",a=0;a<s.length;a++)a&&(c+=","),c+=o(s[a])||"null";return c+"]"}if(s===null)return"null";if(i.indexOf(s)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=i.push(s)-1,f=Object.keys(s).sort(n&&n(s));for(c="",a=0;a<f.length;a++){var d=f[a],p=o(s[d]);p&&(c&&(c+=","),c+=JSON.stringify(d)+":"+p)}return i.splice(u,1),"{"+c+"}"}})(t)}});var hFe=N((m_o,PDt)=>{"use strict";PDt.exports=function(e,r,n){var i="",o=e.schema.$async===!0,s=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),a=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(i+=" var validate = ",o&&(e.async=!0,i+="async "),i+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",a&&(e.opts.sourceCode||e.opts.processCode)&&(i+=" "+("/*# sourceURL="+a+" */")+" ")),typeof e.schema=="boolean"||!(s||e.schema.$ref)){var r="false schema",f=e.level,d=e.dataLevel,p=e.schema[r],h=e.schemaPath+e.util.getProperty(r),g=e.errSchemaPath+"/"+r,B=!e.opts.allErrors,q,A="data"+(d||""),T="valid"+f;if(e.schema===!1){e.isTop?B=!0:i+=" var "+T+" = false; ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'boolean schema is false' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&B?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?o?i+=" return data; ":i+=" validate.errors = null; return true; ":i+=" var "+T+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var S=e.isTop,f=e.level=0,d=e.dataLevel=0,A="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var x="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{var f=e.level,d=e.dataLevel,A="data"+(d||"");if(a&&(e.baseId=e.resolve.url(e.baseId,a)),o&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+f+" = errors;"}var T="valid"+f,B=!e.opts.allErrors,P="",L="",q,I=e.schema.type,U=Array.isArray(I);if(I&&e.opts.nullable&&e.schema.nullable===!0&&(U?I.indexOf("null")==-1&&(I=I.concat("null")):I!="null"&&(I=[I,"null"],U=!0)),U&&I.length==1&&(I=I[0],U=!1),e.schema.$ref&&s){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(s=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(i+=" "+e.RULES.all.$comment.code(e,"$comment")),I){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,I);var Q=e.RULES.types[I];if(M||U||Q===!0||Q&&!Z(Q)){var h=e.schemaPath+".type",g=e.errSchemaPath+"/type",h=e.schemaPath+".type",g=e.errSchemaPath+"/type",F=U?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[F](I,A,e.opts.strictNumbers,!0)+") { ",M){var O="dataType"+f,V="coerced"+f;i+=" var "+O+" = typeof "+A+"; var "+V+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+O+" == 'object' && Array.isArray("+A+") && "+A+".length == 1) { "+A+" = "+A+"[0]; "+O+" = typeof "+A+"; if ("+e.util.checkDataType(e.schema.type,A,e.opts.strictNumbers)+") "+V+" = "+A+"; } "),i+=" if ("+V+" !== undefined) ; ";var G=M;if(G)for(var j,$=-1,te=G.length-1;$<te;)j=G[$+=1],j=="string"?i+=" else if ("+O+" == 'number' || "+O+" == 'boolean') "+V+" = '' + "+A+"; else if ("+A+" === null) "+V+" = ''; ":j=="number"||j=="integer"?(i+=" else if ("+O+" == 'boolean' || "+A+" === null || ("+O+" == 'string' && "+A+" && "+A+" == +"+A+" ",j=="integer"&&(i+=" && !("+A+" % 1)"),i+=")) "+V+" = +"+A+"; "):j=="boolean"?i+=" else if ("+A+" === 'false' || "+A+" === 0 || "+A+" === null) "+V+" = false; else if ("+A+" === 'true' || "+A+" === 1) "+V+" = true; ":j=="null"?i+=" else if ("+A+" === '' || "+A+" === 0 || "+A+" === false) "+V+" = null; ":e.opts.coerceTypes=="array"&&j=="array"&&(i+=" else if ("+O+" == 'string' || "+O+" == 'number' || "+O+" == 'boolean' || "+A+" == null) "+V+" = ["+A+"]; ");i+=" else { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",U?i+=""+I.join(","):i+=""+I,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",U?i+=""+I.join(","):i+=""+I,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&B?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } if ("+V+" !== undefined) { ";var J=d?"data"+(d-1||""):"parentData",he=d?e.dataPathArr[d]:"parentDataProperty";i+=" "+A+" = "+V+"; ",d||(i+="if ("+J+" !== undefined)"),i+=" "+J+"["+he+"] = "+V+"; } "}else{var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",U?i+=""+I.join(","):i+=""+I,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",U?i+=""+I.join(","):i+=""+I,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&B?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}i+=" } "}}if(e.schema.$ref&&!s)i+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",B&&(i+=" } if (errors === ",S?i+="0":i+="errs_"+f,i+=") { ",L+="}");else{var Ce=e.RULES;if(Ce){for(var Q,me=-1,_e=Ce.length-1;me<_e;)if(Q=Ce[me+=1],Z(Q)){if(Q.type&&(i+=" if ("+e.util.checkDataType(Q.type,A,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(Q.type=="object"&&e.schema.properties){var p=e.schema.properties,Se=Object.keys(p),oe=Se;if(oe)for(var Ae,pe=-1,ie=oe.length-1;pe<ie;){Ae=oe[pe+=1];var de=p[Ae];if(de.default!==void 0){var X=A+e.util.getProperty(Ae);if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+X;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else i+=" if ("+X+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+X+" === null || "+X+" === '' "),i+=" ) "+X+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(de.default)+" ":i+=" "+JSON.stringify(de.default)+" ",i+="; "}}}else if(Q.type=="array"&&Array.isArray(e.schema.items)){var le=e.schema.items;if(le){for(var de,$=-1,ge=le.length-1;$<ge;)if(de=le[$+=1],de.default!==void 0){var X=A+"["+$+"]";if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+X;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else i+=" if ("+X+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+X+" === null || "+X+" === '' "),i+=" ) "+X+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(de.default)+" ":i+=" "+JSON.stringify(de.default)+" ",i+="; "}}}}var ce=Q.rules;if(ce){for(var K,re=-1,xe=ce.length-1;re<xe;)if(K=ce[re+=1],Re(K)){var ye=K.code(e,K.keyword,Q.type);ye&&(i+=" "+ye+" ",B&&(P+="}"))}}if(B&&(i+=" "+P+" ",P=""),Q.type&&(i+=" } ",I&&I===Q.type&&!M)){i+=" else { ";var h=e.schemaPath+".type",g=e.errSchemaPath+"/type",y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",U?i+=""+I.join(","):i+=""+I,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",U?i+=""+I.join(","):i+=""+I,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&B?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } "}B&&(i+=" if (errors === ",S?i+="0":i+="errs_"+f,i+=") { ",L+="}")}}}B&&(i+=" "+L+" "),S?(o?(i+=" if (errors === 0) return data; ",i+=" else throw new ValidationError(vErrors); "):(i+=" validate.errors = vErrors; ",i+=" return errors === 0; "),i+=" }; return validate;"):i+=" var "+T+" = errors === errs_"+f+";";function Z(qe){for(var Ge=qe.rules,ue=0;ue<Ge.length;ue++)if(Re(Ge[ue]))return!0}function Re(qe){return e.schema[qe.keyword]!==void 0||qe.implements&&Qe(qe)}function Qe(qe){for(var Ge=qe.implements,ue=0;ue<Ge.length;ue++)if(e.schema[Ge[ue]]!==void 0)return!0}return i}});var HDt=N((g_o,qDt)=>{"use strict";var i0e=r0e(),s0e=iN(),UDt=n0e(),y_n=pFe(),LDt=hFe(),E_n=s0e.ucs2length,v_n=hq(),C_n=UDt.Validation;qDt.exports=mFe;function mFe(t,e,r,n){var i=this,o=this._opts,s=[void 0],a={},c=[],u={},f=[],d={},p=[];e=e||{schema:t,refVal:s,refs:a};var h=b_n.call(this,t,e,n),g=this._compilations[h.index];if(h.compiling)return g.callValidate=x;var A=this._formats,y=this.RULES;try{var v=T(t,e,r,n);g.validate=v;var S=g.callValidate;return S&&(S.schema=v.schema,S.errors=null,S.refs=v.refs,S.refVal=v.refVal,S.root=v.root,S.$async=v.$async,o.sourceCode&&(S.source=v.source)),v}finally{__n.call(this,t,e,n)}function x(){var F=g.validate,O=F.apply(this,arguments);return x.errors=F.errors,O}function T(F,O,V,G){var j=!O||O&&O.schema==F;if(O.schema!=e.schema)return mFe.call(i,F,O,V,G);var $=F.$async===!0,te=LDt({isTop:!0,schema:F,isRoot:j,baseId:G,root:O,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:UDt.MissingRef,RULES:y,validate:LDt,util:s0e,resolve:i0e,resolveRef:B,usePattern:U,useDefault:M,useCustomRule:Q,opts:o,formats:A,logger:i.logger,self:i});te=o0e(s,w_n)+o0e(c,S_n)+o0e(f,x_n)+o0e(p,T_n)+te,o.processCode&&(te=o.processCode(te,F));var J;try{var he=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",te);J=he(i,y,A,e,s,f,p,v_n,E_n,C_n),s[0]=J}catch(Ce){throw i.logger.error("Error compiling schema, function code:",te),Ce}return J.schema=F,J.errors=null,J.refs=a,J.refVal=s,J.root=j?J:O,$&&(J.$async=!0),o.sourceCode===!0&&(J.source={code:te,patterns:c,defaults:f}),J}function B(F,O,V){O=i0e.url(F,O);var G=a[O],j,$;if(G!==void 0)return j=s[G],$="refVal["+G+"]",I(j,$);if(!V&&e.refs){var te=e.refs[O];if(te!==void 0)return j=e.refVal[te],$=P(O,j),I(j,$)}$=P(O);var J=i0e.call(i,T,e,O);if(J===void 0){var he=r&&r[O];he&&(J=i0e.inlineRef(he,o.inlineRefs)?he:mFe.call(i,he,e,r,F))}if(J===void 0)L(O);else return q(O,J),I(J,$)}function P(F,O){var V=s.length;return s[V]=O,a[F]=V,"refVal"+V}function L(F){delete a[F]}function q(F,O){var V=a[F];s[V]=O}function I(F,O){return typeof F=="object"||typeof F=="boolean"?{code:O,schema:F,inline:!0}:{code:O,$async:F&&!!F.$async}}function U(F){var O=u[F];return O===void 0&&(O=u[F]=c.length,c[O]=F),"pattern"+O}function M(F){switch(typeof F){case"boolean":case"number":return""+F;case"string":return s0e.toQuotedString(F);case"object":if(F===null)return"null";var O=y_n(F),V=d[O];return V===void 0&&(V=d[O]=f.length,f[V]=F),"default"+V}}function Q(F,O,V,G){if(i._opts.validateSchema!==!1){var j=F.definition.dependencies;if(j&&!j.every(function(oe){return Object.prototype.hasOwnProperty.call(V,oe)}))throw new Error("parent schema must have all required keywords: "+j.join(","));var $=F.definition.validateSchema;if($){var te=$(O);if(!te){var J="keyword schema is invalid: "+i.errorsText($.errors);if(i._opts.validateSchema=="log")i.logger.error(J);else throw new Error(J)}}}var he=F.definition.compile,Ce=F.definition.inline,me=F.definition.macro,_e;if(he)_e=he.call(i,O,V,G);else if(me)_e=me.call(i,O,V,G),o.validateSchema!==!1&&i.validateSchema(_e,!0);else if(Ce)_e=Ce.call(i,G,F.keyword,O,V);else if(_e=F.definition.validate,!_e)return;if(_e===void 0)throw new Error('custom keyword "'+F.keyword+'"failed to compile');var Se=p.length;return p[Se]=_e,{code:"customRule"+Se,validate:_e}}}function b_n(t,e,r){var n=QDt.call(this,t,e,r);return n>=0?{index:n,compiling:!0}:(n=this._compilations.length,this._compilations[n]={schema:t,root:e,baseId:r},{index:n,compiling:!1})}function __n(t,e,r){var n=QDt.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function QDt(t,e,r){for(var n=0;n<this._compilations.length;n++){var i=this._compilations[n];if(i.schema==t&&i.root==e&&i.baseId==r)return n}return-1}function S_n(t,e){return"var pattern"+t+" = new RegExp("+s0e.toQuotedString(e[t])+");"}function x_n(t){return"var default"+t+" = defaults["+t+"];"}function w_n(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function T_n(t){return"var customRule"+t+" = customRules["+t+"];"}function o0e(t,e){if(!t.length)return"";for(var r="",n=0;n<t.length;n++)r+=e(n,t);return r}});var VDt=N((A_o,GDt)=>{"use strict";var a0e=GDt.exports=function(){this._cache={}};a0e.prototype.put=function(e,r){this._cache[e]=r};a0e.prototype.get=function(e){return this._cache[e]};a0e.prototype.del=function(e){delete this._cache[e]};a0e.prototype.clear=function(){this._cache={}}});var rRt=N((y_o,tRt)=>{"use strict";var I_n=iN(),D_n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,R_n=[0,31,28,31,30,31,30,31,31,30,31,30,31],B_n=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,$Dt=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,N_n=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,O_n=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,WDt=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,jDt=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,YDt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,zDt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,JDt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,KDt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;tRt.exports=l0e;function l0e(t){return t=t=="full"?"full":"fast",I_n.copy(l0e[t])}l0e.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":WDt,url:jDt,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:$Dt,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:eRt,uuid:YDt,"json-pointer":zDt,"json-pointer-uri-fragment":JDt,"relative-json-pointer":KDt};l0e.full={date:XDt,time:ZDt,"date-time":F_n,uri:L_n,"uri-reference":O_n,"uri-template":WDt,url:jDt,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:$Dt,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:eRt,uuid:YDt,"json-pointer":zDt,"json-pointer-uri-fragment":JDt,"relative-json-pointer":KDt};function M_n(t){return t%4===0&&(t%100!==0||t%400===0)}function XDt(t){var e=t.match(D_n);if(!e)return!1;var r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&M_n(r)?29:R_n[n])}function ZDt(t,e){var r=t.match(B_n);if(!r)return!1;var n=r[1],i=r[2],o=r[3],s=r[5];return(n<=23&&i<=59&&o<=59||n==23&&i==59&&o==60)&&(!e||s)}var k_n=/t|\s/i;function F_n(t){var e=t.split(k_n);return e.length==2&&XDt(e[0])&&ZDt(e[1],!0)}var P_n=/\/|:/;function L_n(t){return P_n.test(t)&&N_n.test(t)}var U_n=/[^\\]\\Z/;function eRt(t){if(U_n.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var iRt=N((E_o,nRt)=>{"use strict";nRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,f="data"+(s||""),d="valid"+o,p,h;if(a=="#"||a=="#/")e.isRoot?(p=e.async,h="validate"):(p=e.root.schema.$async===!0,h="root.refVal[0]");else{var g=e.resolveRef(e.baseId,a,e.isRoot);if(g===void 0){var A=e.MissingRefError.message(e.baseId,a);if(e.opts.missingRefs=="fail"){e.logger.error(A);var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(a)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(a)+"' "),e.opts.verbose&&(i+=" , schema: "+e.util.toQuotedString(a)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(i+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(A),u&&(i+=" if (true) { ");else throw new e.MissingRefError(e.baseId,a,A)}else if(g.inline){var S=e.util.copy(e);S.level++;var x="valid"+S.level;S.schema=g.schema,S.schemaPath="",S.errSchemaPath=a;var T=e.validate(S).replace(/validate\.schema/g,g.code);i+=" "+T+" ",u&&(i+=" if ("+x+") { ")}else p=g.$async===!0||e.async&&g.$async!==!1,h=g.code}if(h){var y=y||[];y.push(i),i="",e.opts.passContext?i+=" "+h+".call(this, ":i+=" "+h+"( ",i+=" "+f+", (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var B=s?"data"+(s-1||""):"parentData",P=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+B+" , "+P+", rootData) ";var L=i;if(i=y.pop(),p){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+d+"; "),i+=" try { await "+L+"; ",u&&(i+=" "+d+" = true; "),i+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(i+=" "+d+" = false; "),i+=" } ",u&&(i+=" if ("+d+") { ")}else i+=" if (!"+L+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var sRt=N((v_o,oRt)=>{"use strict";oRt.exports=function(e,r,n){var i=" ",o=e.schema[r],s=e.schemaPath+e.util.getProperty(r),a=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u=e.util.copy(e),f="";u.level++;var d="valid"+u.level,p=u.baseId,h=!0,g=o;if(g)for(var A,y=-1,v=g.length-1;y<v;)A=g[y+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))&&(h=!1,u.schema=A,u.schemaPath=s+"["+y+"]",u.errSchemaPath=a+"/"+y,i+=" "+e.validate(u)+" ",u.baseId=p,c&&(i+=" if ("+d+") { ",f+="}"));return c&&(h?i+=" if (true) { ":i+=" "+f.slice(0,-1)+" "),i}});var lRt=N((C_o,aRt)=>{"use strict";aRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e),A="";g.level++;var y="valid"+g.level,v=a.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(v){var S=g.baseId;i+=" var "+h+" = errors; var "+p+" = false; ";var x=e.compositeRule;e.compositeRule=g.compositeRule=!0;var T=a;if(T)for(var B,P=-1,L=T.length-1;P<L;)B=T[P+=1],g.schema=B,g.schemaPath=c+"["+P+"]",g.errSchemaPath=u+"/"+P,i+=" "+e.validate(g)+" ",g.baseId=S,i+=" "+p+" = "+p+" || "+y+"; if (!"+p+") { ",A+="}";e.compositeRule=g.compositeRule=x,i+=" "+A+" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else f&&(i+=" if (true) { ");return i}});var uRt=N((b_o,cRt)=>{"use strict";cRt.exports=function(e,r,n){var i=" ",o=e.schema[r],s=e.errSchemaPath+"/"+r,a=!e.opts.allErrors,c=e.util.toQuotedString(o);return e.opts.$comment===!0?i+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(i+=" self._opts.$comment("+c+", "+e.util.toQuotedString(s)+", validate.root.schema);"),i}});var dRt=N((__o,fRt)=>{"use strict";fRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,g;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=a,h||(i+=" var schema"+o+" = validate.schema"+c+";"),i+="var "+p+" = equal("+d+", schema"+o+"); if (!"+p+") { ";var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to constant' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",f&&(i+=" else { "),i}});var hRt=N((S_o,pRt)=>{"use strict";pRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e),A="";g.level++;var y="valid"+g.level,v="i"+o,S=g.dataLevel=e.dataLevel+1,x="data"+S,T=e.baseId,B=e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all);if(i+="var "+h+" = errors;var "+p+";",B){var P=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=a,g.schemaPath=c,g.errSchemaPath=u,i+=" var "+y+" = false; for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var L=d+"["+v+"]";g.dataPathArr[S]=v;var q=e.validate(g);g.baseId=T,e.util.varOccurences(q,x)<2?i+=" "+e.util.varReplace(q,x,L)+" ":i+=" var "+x+" = "+L+"; "+q+" ",i+=" if ("+y+") break; } ",e.compositeRule=g.compositeRule=P,i+=" "+A+" if (!"+y+") {"}else i+=" if ("+d+".length == 0) {";var I=I||[];I.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should contain a valid item' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var U=i;return i=I.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+U+"]); ":i+=" validate.errors = ["+U+"]; return false; ":i+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { ",B&&(i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var gRt=N((x_o,mRt)=>{"use strict";mRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="errs__"+o,h=e.util.copy(e),g="";h.level++;var A="valid"+h.level,y={},v={},S=e.opts.ownProperties;for(P in a)if(P!="__proto__"){var x=a[P],T=Array.isArray(x)?v:y;T[P]=x}i+="var "+p+" = errors;";var B=e.errorPath;i+="var missing"+o+";";for(var P in v)if(T=v[P],T.length){if(i+=" if ( "+d+e.util.getProperty(P)+" !== undefined ",S&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(P)+"') "),f){i+=" && ( ";var L=T;if(L)for(var q,I=-1,U=L.length-1;I<U;){q=L[I+=1],I&&(i+=" || ");var M=e.util.getProperty(q),Q=d+M;i+=" ( ( "+Q+" === undefined ",S&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(q)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:M)+") ) "}i+=")) { ";var F="missing"+o,O="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(B,F,!0):B+" + "+F);var V=V||[];V.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(P)+"', missingProperty: '"+O+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",T.length==1?i+="property "+e.util.escapeQuotes(T[0]):i+="properties "+e.util.escapeQuotes(T.join(", ")),i+=" when property "+e.util.escapeQuotes(P)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var G=i;i=V.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+G+"]); ":i+=" validate.errors = ["+G+"]; return false; ":i+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{i+=" ) { ";var j=T;if(j)for(var q,$=-1,te=j.length-1;$<te;){q=j[$+=1];var M=e.util.getProperty(q),O=e.util.escapeQuotes(q),Q=d+M;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(B,q,e.opts.jsonPointers)),i+=" if ( "+Q+" === undefined ",S&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(q)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(P)+"', missingProperty: '"+O+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",T.length==1?i+="property "+e.util.escapeQuotes(T[0]):i+="properties "+e.util.escapeQuotes(T.join(", ")),i+=" when property "+e.util.escapeQuotes(P)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}i+=" } ",f&&(g+="}",i+=" else { ")}e.errorPath=B;var J=h.baseId;for(var P in y){var x=y[P];(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))&&(i+=" "+A+" = true; if ( "+d+e.util.getProperty(P)+" !== undefined ",S&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(P)+"') "),i+=") { ",h.schema=x,h.schemaPath=c+e.util.getProperty(P),h.errSchemaPath=u+"/"+e.util.escapeFragment(P),i+=" "+e.validate(h)+" ",h.baseId=J,i+=" } ",f&&(i+=" if ("+A+") { ",g+="}"))}return f&&(i+=" "+g+" if ("+p+" == errors) {"),i}});var yRt=N((w_o,ARt)=>{"use strict";ARt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,g;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=a;var A="i"+o,y="schema"+o;h||(i+=" var "+y+" = validate.schema"+c+";"),i+="var "+p+";",h&&(i+=" if (schema"+o+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+o+")) "+p+" = false; else {"),i+=""+p+" = false;for (var "+A+"=0; "+A+"<"+y+".length; "+A+"++) if (equal("+d+", "+y+"["+A+"])) { "+p+" = true; break; }",h&&(i+=" } "),i+=" if (!"+p+") { ";var v=v||[];v.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var S=i;return i=v.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+S+"]); ":i+=" validate.errors = ["+S+"]; return false; ":i+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",f&&(i+=" else { "),i}});var vRt=N((T_o,ERt)=>{"use strict";ERt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||"");if(e.opts.format===!1)return f&&(i+=" if (true) { "),i;var p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var g=e.opts.unknownFormats,A=Array.isArray(g);if(p){var y="format"+o,v="isObject"+o,S="formatType"+o;i+=" var "+y+" = formats["+h+"]; var "+v+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+S+" = "+v+" && "+y+".type || 'string'; if ("+v+") { ",e.async&&(i+=" var async"+o+" = "+y+".async; "),i+=" "+y+" = "+y+".validate; } if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" (",g!="ignore"&&(i+=" ("+h+" && !"+y+" ",A&&(i+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),i+=") || "),i+=" ("+y+" && "+S+" == '"+n+"' && !(typeof "+y+" == 'function' ? ",e.async?i+=" (async"+o+" ? await "+y+"("+d+") : "+y+"("+d+")) ":i+=" "+y+"("+d+") ",i+=" : "+y+".test("+d+"))))) {"}else{var y=e.formats[a];if(!y){if(g=="ignore")return e.logger.warn('unknown format "'+a+'" ignored in schema at path "'+e.errSchemaPath+'"'),f&&(i+=" if (true) { "),i;if(A&&g.indexOf(a)>=0)return f&&(i+=" if (true) { "),i;throw new Error('unknown format "'+a+'" is used in schema at path "'+e.errSchemaPath+'"')}var v=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,S=v&&y.type||"string";if(v){var x=y.async===!0;y=y.validate}if(S!=n)return f&&(i+=" if (true) { "),i;if(x){if(!e.async)throw new Error("async format in sync schema");var T="formats"+e.util.getProperty(a)+".validate";i+=" if (!(await "+T+"("+d+"))) { "}else{i+=" if (! ";var T="formats"+e.util.getProperty(a);v&&(T+=".validate"),typeof y=="function"?i+=" "+T+"("+d+") ":i+=" "+T+".test("+d+") ",i+=") { "}}var B=B||[];B.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",p?i+=""+h:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match format "`,p?i+="' + "+h+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var P=i;return i=B.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+P+"]); ":i+=" validate.errors = ["+P+"]; return false; ":i+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",f&&(i+=" else { "),i}});var bRt=N((I_o,CRt)=>{"use strict";CRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e);g.level++;var A="valid"+g.level,y=e.schema.then,v=e.schema.else,S=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),x=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),T=g.baseId;if(S||x){var B;g.createErrors=!1,g.schema=a,g.schemaPath=c,g.errSchemaPath=u,i+=" var "+h+" = errors; var "+p+" = true; ";var P=e.compositeRule;e.compositeRule=g.compositeRule=!0,i+=" "+e.validate(g)+" ",g.baseId=T,g.createErrors=!0,i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=P,S?(i+=" if ("+A+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",i+=" "+e.validate(g)+" ",g.baseId=T,i+=" "+p+" = "+A+"; ",S&&x?(B="ifClause"+o,i+=" var "+B+" = 'then'; "):B="'then'",i+=" } ",x&&(i+=" else { ")):i+=" if (!"+A+") { ",x&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",i+=" "+e.validate(g)+" ",g.baseId=T,i+=" "+p+" = "+A+"; ",S&&x?(B="ifClause"+o,i+=" var "+B+" = 'else'; "):B="'else'",i+=" } "),i+=" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+B+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+B+` + '" schema' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",f&&(i+=" else { ")}else f&&(i+=" if (true) { ");return i}});var SRt=N((D_o,_Rt)=>{"use strict";_Rt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e),A="";g.level++;var y="valid"+g.level,v="i"+o,S=g.dataLevel=e.dataLevel+1,x="data"+S,T=e.baseId;if(i+="var "+h+" = errors;var "+p+";",Array.isArray(a)){var B=e.schema.additionalItems;if(B===!1){i+=" "+p+" = "+d+".length <= "+a.length+"; ";var P=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+p+") { ";var L=L||[];L.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+a.length+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have more than "+a.length+" items' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var q=i;i=L.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+q+"]); ":i+=" validate.errors = ["+q+"]; return false; ":i+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u=P,f&&(A+="}",i+=" else { ")}var I=a;if(I){for(var U,M=-1,Q=I.length-1;M<Q;)if(U=I[M+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){i+=" "+y+" = true; if ("+d+".length > "+M+") { ";var F=d+"["+M+"]";g.schema=U,g.schemaPath=c+"["+M+"]",g.errSchemaPath=u+"/"+M,g.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),g.dataPathArr[S]=M;var O=e.validate(g);g.baseId=T,e.util.varOccurences(O,x)<2?i+=" "+e.util.varReplace(O,x,F)+" ":i+=" var "+x+" = "+F+"; "+O+" ",i+=" } ",f&&(i+=" if ("+y+") { ",A+="}")}}if(typeof B=="object"&&(e.opts.strictKeywords?typeof B=="object"&&Object.keys(B).length>0||B===!1:e.util.schemaHasRules(B,e.RULES.all))){g.schema=B,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+y+" = true; if ("+d+".length > "+a.length+") { for (var "+v+" = "+a.length+"; "+v+" < "+d+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=d+"["+v+"]";g.dataPathArr[S]=v;var O=e.validate(g);g.baseId=T,e.util.varOccurences(O,x)<2?i+=" "+e.util.varReplace(O,x,F)+" ":i+=" var "+x+" = "+F+"; "+O+" ",f&&(i+=" if (!"+y+") break; "),i+=" } } ",f&&(i+=" if ("+y+") { ",A+="}")}}else if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){g.schema=a,g.schemaPath=c,g.errSchemaPath=u,i+=" for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=d+"["+v+"]";g.dataPathArr[S]=v;var O=e.validate(g);g.baseId=T,e.util.varOccurences(O,x)<2?i+=" "+e.util.varReplace(O,x,F)+" ":i+=" var "+x+" = "+F+"; "+O+" ",f&&(i+=" if (!"+y+") break; "),i+=" }"}return f&&(i+=" "+A+" if ("+h+" == errors) {"),i}});var gFe=N((R_o,xRt)=>{"use strict";xRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,T,d="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var g=r=="maximum",A=g?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[A],v=e.opts.$data&&y&&y.$data,S=g?"<":">",x=g?">":"<",T=void 0;if(!(p||typeof a=="number"||a===void 0))throw new Error(r+" must be number");if(!(v||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(A+" must be number or boolean");if(v){var B=e.util.getData(y.$data,s,e.dataPathArr),P="exclusive"+o,L="exclType"+o,q="exclIsNumber"+o,I="op"+o,U="' + "+I+" + '";i+=" var schemaExcl"+o+" = "+B+"; ",B="schemaExcl"+o,i+=" var "+P+"; var "+L+" = typeof "+B+"; if ("+L+" != 'boolean' && "+L+" != 'undefined' && "+L+" != 'number') { ";var T=A,M=M||[];M.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+A+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var Q=i;i=M.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+Q+"]); ":i+=" validate.errors = ["+Q+"]; return false; ":i+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+L+" == 'number' ? ( ("+P+" = "+h+" === undefined || "+B+" "+S+"= "+h+") ? "+d+" "+x+"= "+B+" : "+d+" "+x+" "+h+" ) : ( ("+P+" = "+B+" === true) ? "+d+" "+x+"= "+h+" : "+d+" "+x+" "+h+" ) || "+d+" !== "+d+") { var op"+o+" = "+P+" ? '"+S+"' : '"+S+"='; ",a===void 0&&(T=A,u=e.errSchemaPath+"/"+A,h=B,p=v)}else{var q=typeof y=="number",U=S;if(q&&p){var I="'"+U+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" ( "+h+" === undefined || "+y+" "+S+"= "+h+" ? "+d+" "+x+"= "+y+" : "+d+" "+x+" "+h+" ) || "+d+" !== "+d+") { "}else{q&&a===void 0?(P=!0,T=A,u=e.errSchemaPath+"/"+A,h=y,x+="="):(q&&(h=Math[g?"min":"max"](y,a)),y===(q?h:!0)?(P=!0,T=A,u=e.errSchemaPath+"/"+A,x+="="):(P=!1,U+="="));var I="'"+U+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+d+" "+x+" "+h+" || "+d+" !== "+d+") { "}}T=T||r;var M=M||[];M.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+I+", limit: "+h+", exclusive: "+P+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+U+" ",p?i+="' + "+h:i+=""+h+"'"),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var Q=i;return i=M.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+Q+"]); ":i+=" validate.errors = ["+Q+"]; return false; ":i+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",f&&(i+=" else { "),i}});var AFe=N((B_o,wRt)=>{"use strict";wRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,A,d="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var g=r=="maxItems"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+d+".length "+g+" "+h+") { ";var A=r,y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",r=="maxItems"?i+="more":i+="fewer",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" items' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var v=i;return i=y.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",f&&(i+=" else { "),i}});var yFe=N((N_o,TRt)=>{"use strict";TRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,A,d="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var g=r=="maxLength"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),e.opts.unicode===!1?i+=" "+d+".length ":i+=" ucs2length("+d+") ",i+=" "+g+" "+h+") { ";var A=r,y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be ",r=="maxLength"?i+="longer":i+="shorter",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" characters' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var v=i;return i=y.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",f&&(i+=" else { "),i}});var EFe=N((O_o,IRt)=>{"use strict";IRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,A,d="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var g=r=="maxProperties"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" Object.keys("+d+").length "+g+" "+h+") { ";var A=r,y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",r=="maxProperties"?i+="more":i+="fewer",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" properties' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var v=i;return i=y.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",f&&(i+=" else { "),i}});var RRt=N((M_o,DRt)=>{"use strict";DRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");i+="var division"+o+";if (",p&&(i+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),i+=" (division"+o+" = "+d+" / "+h+", ",e.opts.multipleOfPrecision?i+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":i+=" division"+o+" !== parseInt(division"+o+") ",i+=" ) ",p&&(i+=" ) "),i+=" ) { ";var g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be multiple of ",p?i+="' + "+h:i+=""+h+"'"),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var A=i;return i=g.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+A+"]); ":i+=" validate.errors = ["+A+"]; return false; ":i+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",f&&(i+=" else { "),i}});var NRt=N((k_o,BRt)=>{"use strict";BRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="errs__"+o,h=e.util.copy(e);h.level++;var g="valid"+h.level;if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){h.schema=a,h.schemaPath=c,h.errSchemaPath=u,i+=" var "+p+" = errors; ";var A=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1;var y;h.opts.allErrors&&(y=h.opts.allErrors,h.opts.allErrors=!1),i+=" "+e.validate(h)+" ",h.createErrors=!0,y&&(h.opts.allErrors=y),e.compositeRule=h.compositeRule=A,i+=" if ("+g+") { ";var v=v||[];v.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var S=i;i=v.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+S+"]); ":i+=" validate.errors = ["+S+"]; return false; ":i+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(i+=" if (false) { ");return i}});var MRt=N((F_o,ORt)=>{"use strict";ORt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e),A="";g.level++;var y="valid"+g.level,v=g.baseId,S="prevValid"+o,x="passingSchemas"+o;i+="var "+h+" = errors , "+S+" = false , "+p+" = false , "+x+" = null; ";var T=e.compositeRule;e.compositeRule=g.compositeRule=!0;var B=a;if(B)for(var P,L=-1,q=B.length-1;L<q;)P=B[L+=1],(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))?(g.schema=P,g.schemaPath=c+"["+L+"]",g.errSchemaPath=u+"/"+L,i+=" "+e.validate(g)+" ",g.baseId=v):i+=" var "+y+" = true; ",L&&(i+=" if ("+y+" && "+S+") { "+p+" = false; "+x+" = ["+x+", "+L+"]; } else { ",A+="}"),i+=" if ("+y+") { "+p+" = "+S+" = true; "+x+" = "+L+"; }";return e.compositeRule=g.compositeRule=T,i+=""+A+"if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+x+" } ",e.opts.messages!==!1&&(i+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(i+=" } "),i}});var FRt=N((P_o,kRt)=>{"use strict";kRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var g=p?"(new RegExp("+h+"))":e.usePattern(a);i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" !"+g+".test("+d+") ) { ";var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",p?i+=""+h:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match pattern "`,p?i+="' + "+h+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",f&&(i+=" else { "),i}});var LRt=N((L_o,PRt)=>{"use strict";PRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="errs__"+o,h=e.util.copy(e),g="";h.level++;var A="valid"+h.level,y="key"+o,v="idx"+o,S=h.dataLevel=e.dataLevel+1,x="data"+S,T="dataProperties"+o,B=Object.keys(a||{}).filter($),P=e.schema.patternProperties||{},L=Object.keys(P).filter($),q=e.schema.additionalProperties,I=B.length||L.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,Q=e.opts.removeAdditional,F=U||M||Q,O=e.opts.ownProperties,V=e.baseId,G=e.schema.required;if(G&&!(e.opts.$data&&G.$data)&&G.length<e.opts.loopRequired)var j=e.util.toHash(G);function $(Fe){return Fe!=="__proto__"}if(i+="var "+p+" = errors;var "+A+" = true;",O&&(i+=" var "+T+" = undefined;"),F){if(O?i+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+T+".length; "+v+"++) { var "+y+" = "+T+"["+v+"]; ":i+=" for (var "+y+" in "+d+") { ",I){if(i+=" var isAdditional"+o+" = !(false ",B.length)if(B.length>8)i+=" || validate.schema"+c+".hasOwnProperty("+y+") ";else{var te=B;if(te)for(var J,he=-1,Ce=te.length-1;he<Ce;)J=te[he+=1],i+=" || "+y+" == "+e.util.toQuotedString(J)+" "}if(L.length){var me=L;if(me)for(var _e,Se=-1,oe=me.length-1;Se<oe;)_e=me[Se+=1],i+=" || "+e.usePattern(_e)+".test("+y+") "}i+=" ); if (isAdditional"+o+") { "}if(Q=="all")i+=" delete "+d+"["+y+"]; ";else{var Ae=e.errorPath,pe="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),U)if(Q)i+=" delete "+d+"["+y+"]; ";else{i+=" "+A+" = false; ";var ie=u;u=e.errSchemaPath+"/additionalProperties";var de=de||[];de.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+pe+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is an invalid additional property":i+="should NOT have additional properties",i+="' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var X=i;i=de.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+X+"]); ":i+=" validate.errors = ["+X+"]; return false; ":i+=" var err = "+X+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ie,f&&(i+=" break; ")}else if(M)if(Q=="failing"){i+=" var "+p+" = errors; ";var le=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=q,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var ge=d+"["+y+"]";h.dataPathArr[S]=y;var ce=e.validate(h);h.baseId=V,e.util.varOccurences(ce,x)<2?i+=" "+e.util.varReplace(ce,x,ge)+" ":i+=" var "+x+" = "+ge+"; "+ce+" ",i+=" if (!"+A+") { errors = "+p+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+d+"["+y+"]; } ",e.compositeRule=h.compositeRule=le}else{h.schema=q,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var ge=d+"["+y+"]";h.dataPathArr[S]=y;var ce=e.validate(h);h.baseId=V,e.util.varOccurences(ce,x)<2?i+=" "+e.util.varReplace(ce,x,ge)+" ":i+=" var "+x+" = "+ge+"; "+ce+" ",f&&(i+=" if (!"+A+") break; ")}e.errorPath=Ae}I&&(i+=" } "),i+=" } ",f&&(i+=" if ("+A+") { ",g+="}")}var K=e.opts.useDefaults&&!e.compositeRule;if(B.length){var re=B;if(re)for(var J,xe=-1,ye=re.length-1;xe<ye;){J=re[xe+=1];var Z=a[J];if(e.opts.strictKeywords?typeof Z=="object"&&Object.keys(Z).length>0||Z===!1:e.util.schemaHasRules(Z,e.RULES.all)){var Re=e.util.getProperty(J),ge=d+Re,Qe=K&&Z.default!==void 0;h.schema=Z,h.schemaPath=c+Re,h.errSchemaPath=u+"/"+e.util.escapeFragment(J),h.errorPath=e.util.getPath(e.errorPath,J,e.opts.jsonPointers),h.dataPathArr[S]=e.util.toQuotedString(J);var ce=e.validate(h);if(h.baseId=V,e.util.varOccurences(ce,x)<2){ce=e.util.varReplace(ce,x,ge);var qe=ge}else{var qe=x;i+=" var "+x+" = "+ge+"; "}if(Qe)i+=" "+ce+" ";else{if(j&&j[J]){i+=" if ( "+qe+" === undefined ",O&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),i+=") { "+A+" = false; ";var Ae=e.errorPath,ie=u,Ge=e.util.escapeQuotes(J);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ae,J,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var de=de||[];de.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+Ge+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+Ge+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var X=i;i=de.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+X+"]); ":i+=" validate.errors = ["+X+"]; return false; ":i+=" var err = "+X+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ie,e.errorPath=Ae,i+=" } else { "}else f?(i+=" if ( "+qe+" === undefined ",O&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),i+=") { "+A+" = true; } else { "):(i+=" if ("+qe+" !== undefined ",O&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),i+=" ) { ");i+=" "+ce+" } "}}f&&(i+=" if ("+A+") { ",g+="}")}}if(L.length){var ue=L;if(ue)for(var _e,Ne=-1,Me=ue.length-1;Ne<Me;){_e=ue[Ne+=1];var Z=P[_e];if(e.opts.strictKeywords?typeof Z=="object"&&Object.keys(Z).length>0||Z===!1:e.util.schemaHasRules(Z,e.RULES.all)){h.schema=Z,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(_e),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(_e),O?i+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+T+".length; "+v+"++) { var "+y+" = "+T+"["+v+"]; ":i+=" for (var "+y+" in "+d+") { ",i+=" if ("+e.usePattern(_e)+".test("+y+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var ge=d+"["+y+"]";h.dataPathArr[S]=y;var ce=e.validate(h);h.baseId=V,e.util.varOccurences(ce,x)<2?i+=" "+e.util.varReplace(ce,x,ge)+" ":i+=" var "+x+" = "+ge+"; "+ce+" ",f&&(i+=" if (!"+A+") break; "),i+=" } ",f&&(i+=" else "+A+" = true; "),i+=" } ",f&&(i+=" if ("+A+") { ",g+="}")}}}return f&&(i+=" "+g+" if ("+p+" == errors) {"),i}});var QRt=N((U_o,URt)=>{"use strict";URt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="errs__"+o,h=e.util.copy(e),g="";h.level++;var A="valid"+h.level;if(i+="var "+p+" = errors;",e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){h.schema=a,h.schemaPath=c,h.errSchemaPath=u;var y="key"+o,v="idx"+o,S="i"+o,x="' + "+y+" + '",T=h.dataLevel=e.dataLevel+1,B="data"+T,P="dataProperties"+o,L=e.opts.ownProperties,q=e.baseId;L&&(i+=" var "+P+" = undefined; "),L?i+=" "+P+" = "+P+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+P+".length; "+v+"++) { var "+y+" = "+P+"["+v+"]; ":i+=" for (var "+y+" in "+d+") { ",i+=" var startErrs"+o+" = errors; ";var I=y,U=e.compositeRule;e.compositeRule=h.compositeRule=!0;var M=e.validate(h);h.baseId=q,e.util.varOccurences(M,B)<2?i+=" "+e.util.varReplace(M,B,I)+" ":i+=" var "+B+" = "+I+"; "+M+" ",e.compositeRule=h.compositeRule=U,i+=" if (!"+A+") { for (var "+S+"=startErrs"+o+"; "+S+"<errors; "+S+"++) { vErrors["+S+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(i+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+x+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+x+"\\' is invalid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),f&&(i+=" break; "),i+=" } }"}return f&&(i+=" "+g+" if ("+p+" == errors) {"),i}});var HRt=N((Q_o,qRt)=>{"use strict";qRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,g;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=a;var A="schema"+o;if(!h)if(a.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var y=[],v=a;if(v)for(var S,x=-1,T=v.length-1;x<T;){S=v[x+=1];var B=e.schema.properties[S];B&&(e.opts.strictKeywords?typeof B=="object"&&Object.keys(B).length>0||B===!1:e.util.schemaHasRules(B,e.RULES.all))||(y[y.length]=S)}}else var y=a;if(h||y.length){var P=e.errorPath,L=h||y.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(f)if(i+=" var missing"+o+"; ",L){h||(i+=" var "+A+" = validate.schema"+c+"; ");var I="i"+o,U="schema"+o+"["+I+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(P,U,e.opts.jsonPointers)),i+=" var "+p+" = true; ",h&&(i+=" if (schema"+o+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+o+")) "+p+" = false; else {"),i+=" for (var "+I+" = 0; "+I+" < "+A+".length; "+I+"++) { "+p+" = "+d+"["+A+"["+I+"]] !== undefined ",q&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", "+A+"["+I+"]) "),i+="; if (!"+p+") break; } ",h&&(i+=" } "),i+=" if (!"+p+") { ";var Q=Q||[];Q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var F=i;i=Q.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+F+"]); ":i+=" validate.errors = ["+F+"]; return false; ":i+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var O=y;if(O)for(var V,I=-1,G=O.length-1;I<G;){V=O[I+=1],I&&(i+=" || ");var j=e.util.getProperty(V),$=d+j;i+=" ( ( "+$+" === undefined ",q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(V)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?V:j)+") ) "}i+=") { ";var U="missing"+o,M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(P,U,!0):P+" + "+U);var Q=Q||[];Q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var F=i;i=Q.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+F+"]); ":i+=" validate.errors = ["+F+"]; return false; ":i+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else if(L){h||(i+=" var "+A+" = validate.schema"+c+"; ");var I="i"+o,U="schema"+o+"["+I+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(P,U,e.opts.jsonPointers)),h&&(i+=" if ("+A+" && !Array.isArray("+A+")) { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+A+" !== undefined) { "),i+=" for (var "+I+" = 0; "+I+" < "+A+".length; "+I+"++) { if ("+d+"["+A+"["+I+"]] === undefined ",q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+A+"["+I+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(i+=" } ")}else{var te=y;if(te)for(var V,J=-1,he=te.length-1;J<he;){V=te[J+=1];var j=e.util.getProperty(V),M=e.util.escapeQuotes(V),$=d+j;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(P,V,e.opts.jsonPointers)),i+=" if ( "+$+" === undefined ",q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(V)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=P}else f&&(i+=" if (true) {");return i}});var VRt=N((q_o,GRt)=>{"use strict";GRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,g;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=a,(a||h)&&e.opts.uniqueItems!==!1){h&&(i+=" var "+p+"; if ("+g+" === false || "+g+" === undefined) "+p+" = true; else if (typeof "+g+" != 'boolean') "+p+" = false; else { "),i+=" var i = "+d+".length , "+p+" = true , j; if (i > 1) { ";var A=e.schema.items&&e.schema.items.type,y=Array.isArray(A);if(!A||A=="object"||A=="array"||y&&(A.indexOf("object")>=0||A.indexOf("array")>=0))i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+p+" = false; break outer; } } } ";else{i+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var v="checkDataType"+(y?"s":"");i+=" if ("+e.util[v](A,"item",e.opts.strictNumbers,!0)+") continue; ",y&&(i+=` if (typeof item == 'string') item = '"' + item; `),i+=" if (typeof itemIndices[item] == 'number') { "+p+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}i+=" } ",h&&(i+=" } "),i+=" if (!"+p+") { ";var S=S||[];S.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var x=i;i=S.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+x+"]); ":i+=" validate.errors = ["+x+"]; return false; ":i+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",f&&(i+=" else { ")}else f&&(i+=" if (true) { ");return i}});var WRt=N((H_o,$Rt)=>{"use strict";$Rt.exports={$ref:iRt(),allOf:sRt(),anyOf:lRt(),$comment:uRt(),const:dRt(),contains:hRt(),dependencies:gRt(),enum:yRt(),format:vRt(),if:bRt(),items:SRt(),maximum:gFe(),minimum:gFe(),maxItems:AFe(),minItems:AFe(),maxLength:yFe(),minLength:yFe(),maxProperties:EFe(),minProperties:EFe(),multipleOf:RRt(),not:NRt(),oneOf:MRt(),pattern:FRt(),properties:LRt(),propertyNames:QRt(),required:HRt(),uniqueItems:VRt(),validate:hFe()}});var zRt=N((G_o,YRt)=>{"use strict";var jRt=WRt(),vFe=iN().toHash;YRt.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],n=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],i=["number","integer","string","array","object","boolean","null"];return e.all=vFe(r),e.types=vFe(i),e.forEach(function(o){o.rules=o.rules.map(function(s){var a;if(typeof s=="object"){var c=Object.keys(s)[0];a=s[c],s=c,a.forEach(function(f){r.push(f),e.all[f]=!0})}r.push(s);var u=e.all[s]={keyword:s,code:jRt[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:jRt.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=vFe(r.concat(n)),e.custom={},e}});var XRt=N((V_o,KRt)=>{"use strict";var JRt=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];KRt.exports=function(t,e){for(var r=0;r<e.length;r++){t=JSON.parse(JSON.stringify(t));var n=e[r].split("/"),i=t,o;for(o=1;o<n.length;o++)i=i[n[o]];for(o=0;o<JRt.length;o++){var s=JRt[o],a=i[s];a&&(i[s]={anyOf:[a,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t}});var tBt=N(($_o,eBt)=>{"use strict";var Q_n=n0e().MissingRef;eBt.exports=ZRt;function ZRt(t,e,r){var n=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var i=o(t).then(function(){var a=n._addSchema(t,void 0,e);return a.validate||s(a)});return r&&i.then(function(a){r(null,a)},r),i;function o(a){var c=a.$schema;return c&&!n.getSchema(c)?ZRt.call(n,{$ref:c},!0):Promise.resolve()}function s(a){try{return n._compile(a)}catch(u){if(u instanceof Q_n)return c(u);throw u}function c(u){var f=u.missingSchema;if(h(f))throw new Error("Schema "+f+" is loaded but "+u.missingRef+" cannot be resolved");var d=n._loadingSchemas[f];return d||(d=n._loadingSchemas[f]=n._opts.loadSchema(f),d.then(p,p)),d.then(function(g){if(!h(f))return o(g).then(function(){h(f)||n.addSchema(g,f,void 0,e)})}).then(function(){return s(a)});function p(){delete n._loadingSchemas[f]}function h(g){return n._refs[g]||n._schemas[g]}}}}});var nBt=N((W_o,rBt)=>{"use strict";rBt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,f=!e.opts.allErrors,d,p="data"+(s||""),h="valid"+o,g="errs__"+o,A=e.opts.$data&&a&&a.$data,y;A?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",y="schema"+o):y=a;var v=this,S="definition"+o,x=v.definition,T="",B,P,L,q,I;if(A&&x.$data){I="keywordValidate"+o;var U=x.validateSchema;i+=" var "+S+" = RULES.custom['"+r+"'].definition; var "+I+" = "+S+".validate;"}else{if(q=e.useCustomRule(v,a,e.schema,e),!q)return;y="validate.schema"+c,I=q.code,B=x.compile,P=x.inline,L=x.macro}var M=I+".errors",Q="i"+o,F="ruleErr"+o,O=x.async;if(O&&!e.async)throw new Error("async keyword in sync schema");if(P||L||(i+=""+M+" = null;"),i+="var "+g+" = errors;var "+h+";",A&&x.$data&&(T+="}",i+=" if ("+y+" === undefined) { "+h+" = true; } else { ",U&&(T+="}",i+=" "+h+" = "+S+".validateSchema("+y+"); if ("+h+") { ")),P)x.statements?i+=" "+q.validate+" ":i+=" "+h+" = "+q.validate+"; ";else if(L){var V=e.util.copy(e),T="";V.level++;var G="valid"+V.level;V.schema=q.validate,V.schemaPath="";var j=e.compositeRule;e.compositeRule=V.compositeRule=!0;var $=e.validate(V).replace(/validate\.schema/g,I);e.compositeRule=V.compositeRule=j,i+=" "+$}else{var te=te||[];te.push(i),i="",i+=" "+I+".call( ",e.opts.passContext?i+="this":i+="self",B||x.schema===!1?i+=" , "+p+" ":i+=" , "+y+" , "+p+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var J=s?"data"+(s-1||""):"parentData",he=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+J+" , "+he+" , rootData ) ";var Ce=i;i=te.pop(),x.errors===!1?(i+=" "+h+" = ",O&&(i+="await "),i+=""+Ce+"; "):O?(M="customErrors"+o,i+=" var "+M+" = null; try { "+h+" = await "+Ce+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):i+=" "+M+" = null; "+h+" = "+Ce+"; "}if(x.modifying&&(i+=" if ("+J+") "+p+" = "+J+"["+he+"];"),i+=""+T,x.valid)f&&(i+=" if (true) { ");else{i+=" if ( ",x.valid===void 0?(i+=" !",L?i+=""+G:i+=""+h):i+=" "+!x.valid+" ",i+=") { ",d=v.keyword;var te=te||[];te.push(i),i="";var te=te||[];te.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var me=i;i=te.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+me+"]); ":i+=" validate.errors = ["+me+"]; return false; ":i+=" var err = "+me+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var _e=i;i=te.pop(),P?x.errors?x.errors!="full"&&(i+=" for (var "+Q+"="+g+"; "+Q+"<errors; "+Q+"++) { var "+F+" = vErrors["+Q+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+F+".schema = "+y+"; "+F+".data = "+p+"; "),i+=" } "):x.errors===!1?i+=" "+_e+" ":(i+=" if ("+g+" == errors) { "+_e+" } else { for (var "+Q+"="+g+"; "+Q+"<errors; "+Q+"++) { var "+F+" = vErrors["+Q+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+F+".schema = "+y+"; "+F+".data = "+p+"; "),i+=" } } "):L?(i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(d||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):x.errors===!1?i+=" "+_e+" ":(i+=" if (Array.isArray("+M+")) { if (vErrors === null) vErrors = "+M+"; else vErrors = vErrors.concat("+M+"); errors = vErrors.length; for (var "+Q+"="+g+"; "+Q+"<errors; "+Q+"++) { var "+F+" = vErrors["+Q+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; "+F+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+F+".schema = "+y+"; "+F+".data = "+p+"; "),i+=" } } else { "+_e+" } "),i+=" } ",f&&(i+=" else { ")}return i}});var CFe=N((j_o,q_n)=>{q_n.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var sBt=N((Y_o,oBt)=>{"use strict";var iBt=CFe();oBt.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:iBt.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:iBt.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var lBt=N((z_o,aBt)=>{"use strict";var H_n=/^[a-z_$][a-z0-9_$-]*$/i,G_n=nBt(),V_n=sBt();aBt.exports={add:$_n,get:W_n,remove:j_n,validate:bFe};function $_n(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!H_n.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var n=e.type;if(Array.isArray(n))for(var i=0;i<n.length;i++)s(t,n[i],e);else s(t,n,e);var o=e.metaSchema;o&&(e.$data&&this._opts.$data&&(o={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(o,!0))}r.keywords[t]=r.all[t]=!0;function s(a,c,u){for(var f,d=0;d<r.length;d++){var p=r[d];if(p.type==c){f=p;break}}f||(f={type:c,rules:[]},r.push(f));var h={keyword:a,definition:u,custom:!0,code:G_n,implements:u.implements};f.rules.push(h),r.custom[a]=h}return this}function W_n(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function j_n(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var r=0;r<e.length;r++)for(var n=e[r].rules,i=0;i<n.length;i++)if(n[i].keyword==t){n.splice(i,1);break}return this}function bFe(t,e){bFe.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(V_n,!0);if(r(t))return!0;if(bFe.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var cBt=N((J_o,Y_n)=>{Y_n.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var EBt=N((K_o,yBt)=>{"use strict";var fBt=HDt(),oN=r0e(),z_n=VDt(),dBt=aFe(),J_n=pFe(),K_n=rRt(),X_n=zRt(),pBt=XRt(),hBt=iN();yBt.exports=ed;ed.prototype.validate=eSn;ed.prototype.compile=tSn;ed.prototype.addSchema=rSn;ed.prototype.addMetaSchema=nSn;ed.prototype.validateSchema=iSn;ed.prototype.getSchema=sSn;ed.prototype.removeSchema=lSn;ed.prototype.addFormat=gSn;ed.prototype.errorsText=mSn;ed.prototype._addSchema=cSn;ed.prototype._compile=uSn;ed.prototype.compileAsync=tBt();var f0e=lBt();ed.prototype.addKeyword=f0e.add;ed.prototype.getKeyword=f0e.get;ed.prototype.removeKeyword=f0e.remove;ed.prototype.validateKeyword=f0e.validate;var mBt=n0e();ed.ValidationError=mBt.Validation;ed.MissingRefError=mBt.MissingRef;ed.$dataMetaSchema=pBt;var u0e="http://json-schema.org/draft-07/schema",uBt=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Z_n=["/properties"];function ed(t){if(!(this instanceof ed))return new ed(t);t=this._opts=hBt.copy(t)||{},bSn(this),this._schemas={},this._refs={},this._fragments={},this._formats=K_n(t.format),this._cache=t.cache||new z_n,this._loadingSchemas={},this._compilations=[],this.RULES=X_n(),this._getId=fSn(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=J_n),this._metaOpts=CSn(this),t.formats&&ESn(this),t.keywords&&vSn(this),ASn(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),ySn(this)}function eSn(t,e){var r;if(typeof t=="string"){if(r=this.getSchema(t),!r)throw new Error('no schema with key or ref "'+t+'"')}else{var n=this._addSchema(t);r=n.validate||this._compile(n)}var i=r(e);return r.$async!==!0&&(this.errors=r.errors),i}function tSn(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function rSn(t,e,r,n){if(Array.isArray(t)){for(var i=0;i<t.length;i++)this.addSchema(t[i],void 0,r,n);return this}var o=this._getId(t);if(o!==void 0&&typeof o!="string")throw new Error("schema id must be string");return e=oN.normalizeId(e||o),ABt(this,e),this._schemas[e]=this._addSchema(t,r,n,!0),this}function nSn(t,e,r){return this.addSchema(t,e,r,!0),this}function iSn(t,e){var r=t.$schema;if(r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||oSn(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var n=this.validate(r,t);if(!n&&e){var i="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(i);else throw new Error(i)}return n}function oSn(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(u0e)?u0e:void 0,t._opts.defaultMeta}function sSn(t){var e=gBt(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return aSn(this,t)}}function aSn(t,e){var r=oN.schema.call(t,{schema:{}},e);if(r){var n=r.schema,i=r.root,o=r.baseId,s=fBt.call(t,n,i,void 0,o);return t._fragments[e]=new dBt({ref:e,fragment:!0,schema:n,root:i,baseId:o,validate:s}),s}}function gBt(t,e){return e=oN.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function lSn(t){if(t instanceof RegExp)return c0e(this,this._schemas,t),c0e(this,this._refs,t),this;switch(typeof t){case"undefined":return c0e(this,this._schemas),c0e(this,this._refs),this._cache.clear(),this;case"string":var e=gBt(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var r=this._opts.serialize,n=r?r(t):t;this._cache.del(n);var i=this._getId(t);i&&(i=oN.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function c0e(t,e,r){for(var n in e){var i=e[n];!i.meta&&(!r||r.test(n))&&(t._cache.del(i.cacheKey),delete e[n])}}function cSn(t,e,r,n){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var i=this._opts.serialize,o=i?i(t):t,s=this._cache.get(o);if(s)return s;n=n||this._opts.addUsedSchema!==!1;var a=oN.normalizeId(this._getId(t));a&&n&&ABt(this,a);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=a&&a==oN.normalizeId(t.$schema))&&this.validateSchema(t,!0);var f=oN.ids.call(this,t),d=new dBt({id:a,schema:t,localRefs:f,cacheKey:o,meta:r});return a[0]!="#"&&n&&(this._refs[a]=d),this._cache.put(o,d),c&&u&&this.validateSchema(t,!0),d}function uSn(t,e){if(t.compiling)return t.validate=i,i.schema=t.schema,i.errors=null,i.root=e||i,t.schema.$async===!0&&(i.$async=!0),i;t.compiling=!0;var r;t.meta&&(r=this._opts,this._opts=this._metaOpts);var n;try{n=fBt.call(this,t.schema,e,t.localRefs)}catch(o){throw delete t.validate,o}finally{t.compiling=!1,t.meta&&(this._opts=r)}return t.validate=n,t.refs=n.refs,t.refVal=n.refVal,t.root=n.root,n;function i(){var o=t.validate,s=o.apply(this,arguments);return i.errors=o.errors,s}}function fSn(t){switch(t.schemaId){case"auto":return hSn;case"id":return dSn;default:return pSn}}function dSn(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function pSn(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function hSn(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function mSn(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var r=e.separator===void 0?", ":e.separator,n=e.dataVar===void 0?"data":e.dataVar,i="",o=0;o<t.length;o++){var s=t[o];s&&(i+=n+s.dataPath+" "+s.message+r)}return i.slice(0,-r.length)}function gSn(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function ASn(t){var e;if(t._opts.$data&&(e=cBt(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=CFe();t._opts.$data&&(r=pBt(r,Z_n)),t.addMetaSchema(r,u0e,!0),t._refs["http://json-schema.org/schema"]=u0e}}function ySn(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var r in e)t.addSchema(e[r],r)}function ESn(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function vSn(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function ABt(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function CSn(t){for(var e=hBt.copy(t._opts),r=0;r<uBt.length;r++)delete e[uBt[r]];return e}function bSn(t){var e=t._opts.logger;if(e===!1)t.logger={log:_Fe,warn:_Fe,error:_Fe};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function _Fe(){}});var vBt,S3,mq=Te(()=>{yDt();Sw();vBt=ze(EBt(),1),S3=class extends Yhe{constructor(e,r){var n;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new vBt.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ADt(this._capabilities,e)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:pq,capabilities:this._capabilities,clientInfo:this._clientInfo}},Vke,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!ZIt.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,i,o,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},nN,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Zke,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},nN,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},KX,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},JX,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Wke,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},jke,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Yke,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},nN,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},nN,r)}async callTool(e,r=Whe,n){let i=await this.request({method:"tools/call",params:e},r,n),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new F6(k6.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new F6(k6.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof F6?s:new F6(k6.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let n=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},Xke,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var xBt=N((tSo,SBt)=>{SBt.exports=_Bt;_Bt.sync=SSn;var CBt=De("fs");function _Sn(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function bBt(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:_Sn(e,r)}function _Bt(t,e,r){CBt.stat(t,function(n,i){r(n,n?!1:bBt(i,t,e))})}function SSn(t,e){return bBt(CBt.statSync(t),t,e)}});var RBt=N((rSo,DBt)=>{DBt.exports=TBt;TBt.sync=xSn;var wBt=De("fs");function TBt(t,e,r){wBt.stat(t,function(n,i){r(n,n?!1:IBt(i,e))})}function xSn(t,e){return IBt(wBt.statSync(t),e)}function IBt(t,e){return t.isFile()&&wSn(t,e)}function wSn(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),f=a|c,d=r&u||r&c&&i===s||r&a&&n===o||r&f&&o===0;return d}});var NBt=N((iSo,BBt)=>{var nSo=De("fs"),d0e;process.platform==="win32"||global.TESTING_WINDOWS?d0e=xBt():d0e=RBt();BBt.exports=SFe;SFe.sync=TSn;function SFe(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){SFe(t,e||{},function(o,s){o?i(o):n(s)})})}d0e(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function TSn(t,e){try{return d0e.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var UBt=N((oSo,LBt)=>{var gq=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",OBt=De("path"),ISn=gq?";":":",MBt=NBt(),kBt=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),FBt=(t,e)=>{let r=e.colon||ISn,n=t.match(/\//)||gq&&t.match(/\\/)?[""]:[...gq?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=gq?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=gq?i.split(r):[""];return gq&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},PBt=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=FBt(t,e),s=[],a=u=>new Promise((f,d)=>{if(u===n.length)return e.all&&s.length?f(s):d(kBt(t));let p=n[u],h=/^".*"$/.test(p)?p.slice(1,-1):p,g=OBt.join(h,t),A=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+g:g;f(c(A,u,0))}),c=(u,f,d)=>new Promise((p,h)=>{if(d===i.length)return p(a(f+1));let g=i[d];MBt(u+g,{pathExt:o},(A,y)=>{if(!A&&y)if(e.all)s.push(u+g);else return p(u+g);return p(c(u,f,d+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},DSn=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=FBt(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=OBt.join(c,t),f=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let p=f+n[d];try{if(MBt.sync(p,{pathExt:i}))if(e.all)o.push(p);else return p}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw kBt(t)};LBt.exports=PBt;PBt.sync=DSn});var qBt=N((sSo,xFe)=>{"use strict";var QBt=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};xFe.exports=QBt;xFe.exports.default=QBt});var $Bt=N((aSo,VBt)=>{"use strict";var HBt=De("path"),RSn=UBt(),BSn=qBt();function GBt(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=RSn.sync(t.command,{path:r[BSn({env:r})],pathExt:e?HBt.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=HBt.resolve(i?t.options.cwd:"",s)),s}function NSn(t){return GBt(t)||GBt(t,!0)}VBt.exports=NSn});var WBt=N((lSo,TFe)=>{"use strict";var wFe=/([()\][%!^"`<>&|;, *?])/g;function OSn(t){return t=t.replace(wFe,"^$1"),t}function MSn(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(wFe,"^$1"),e&&(t=t.replace(wFe,"^$1")),t}TFe.exports.command=OSn;TFe.exports.argument=MSn});var YBt=N((cSo,jBt)=>{"use strict";jBt.exports=/^#!(.*)/});var JBt=N((uSo,zBt)=>{"use strict";var kSn=YBt();zBt.exports=(t="")=>{let e=t.match(kSn);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var XBt=N((fSo,KBt)=>{"use strict";var IFe=De("fs"),FSn=JBt();function PSn(t){let r=Buffer.alloc(150),n;try{n=IFe.openSync(t,"r"),IFe.readSync(n,r,0,150,0),IFe.closeSync(n)}catch{}return FSn(r.toString())}KBt.exports=PSn});var rNt=N((dSo,tNt)=>{"use strict";var LSn=De("path"),ZBt=$Bt(),eNt=WBt(),USn=XBt(),QSn=process.platform==="win32",qSn=/\.(?:com|exe)$/i,HSn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function GSn(t){t.file=ZBt(t);let e=t.file&&USn(t.file);return e?(t.args.unshift(t.file),t.command=e,ZBt(t)):t.file}function VSn(t){if(!QSn)return t;let e=GSn(t),r=!qSn.test(e);if(t.options.forceShell||r){let n=HSn.test(e);t.command=LSn.normalize(t.command),t.command=eNt.command(t.command),t.args=t.args.map(o=>eNt.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function $Sn(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:VSn(n)}tNt.exports=$Sn});var oNt=N((pSo,iNt)=>{"use strict";var DFe=process.platform==="win32";function RFe(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function WSn(t,e){if(!DFe)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=nNt(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function nNt(t,e){return DFe&&t===1&&!e.file?RFe(e.original,"spawn"):null}function jSn(t,e){return DFe&&t===1&&!e.file?RFe(e.original,"spawnSync"):null}iNt.exports={hookChildProcess:WSn,verifyENOENT:nNt,verifyENOENTSync:jSn,notFoundError:RFe}});var lNt=N((hSo,Aq)=>{"use strict";var sNt=De("child_process"),BFe=rNt(),NFe=oNt();function aNt(t,e,r){let n=BFe(t,e,r),i=sNt.spawn(n.command,n.args,n.options);return NFe.hookChildProcess(i,n),i}function YSn(t,e,r){let n=BFe(t,e,r),i=sNt.spawnSync(n.command,n.args,n.options);return i.error=i.error||NFe.verifyENOENTSync(i.status,n),i}Aq.exports=aNt;Aq.exports.spawn=aNt;Aq.exports.sync=YSn;Aq.exports._parse=BFe;Aq.exports._enoent=NFe});function zSn(t){return _w.parse(JSON.parse(t))}function cNt(t){return JSON.stringify(t)+`
|
|
415
415
|
`}var p0e,uNt=Te(()=>{Sw();p0e=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
416
416
|
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),zSn(r)}clear(){this._buffer=void 0}}});import h0e from"node:process";import{PassThrough as JSn}from"node:stream";function XSn(){let t={};for(let e of KSn){let r=h0e.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}function ZSn(){return"type"in h0e}var fNt,KSn,yq,OFe=Te(()=>{fNt=ze(lNt(),1);uNt();KSn=h0e.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];yq=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new p0e,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new JSn)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{var n,i,o,s,a;this._process=(0,fNt.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...XSn(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:h0e.platform==="win32"&&ZSn(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var u,f;if(c.name==="AbortError"){(u=this.onclose)===null||u===void 0||u.call(this);return}r(c),(f=this.onerror)===null||f===void 0||f.call(this,c)}),this._process.on("spawn",()=>{e()}),this._process.on("close",c=>{var u;this._process=void 0,(u=this.onclose)===null||u===void 0||u.call(this)}),(o=this._process.stdin)===null||o===void 0||o.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),(s=this._process.stdout)===null||s===void 0||s.on("data",c=>{this._readBuffer.append(c),this.processReadBuffer()}),(a=this._process.stdout)===null||a===void 0||a.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,r;return this._stderrStream?this._stderrStream:(r=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&r!==void 0?r:null}get pid(){var e,r;return(r=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&r!==void 0?r:null}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var n;if(!(!((n=this._process)===null||n===void 0)&&n.stdin))throw new Error("Not connected");let i=cNt(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}}});function MFe(t){}function g0e(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=MFe,onError:r=MFe,onRetry:n=MFe,onComment:i}=t,o="",s=!0,a,c="",u="";function f(A){let y=s?A.replace(/^\xEF\xBB\xBF/,""):A,[v,S]=exn(`${o}${y}`);for(let x of v)d(x);o=S,s=!1}function d(A){if(A===""){h();return}if(A.startsWith(":")){i&&i(A.slice(A.startsWith(": ")?2:1));return}let y=A.indexOf(":");if(y!==-1){let v=A.slice(0,y),S=A[y+1]===" "?2:1,x=A.slice(y+S);p(v,x,A);return}p(A,"",A)}function p(A,y,v){switch(A){case"event":u=y;break;case"data":c=`${c}${y}
|
|
417
417
|
`;break;case"id":a=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new m0e(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:v}));break;default:r(new m0e(`Unknown field "${A.length>20?`${A.slice(0,20)}\u2026`:A}"`,{type:"unknown-field",field:A,value:y,line:v}));break}}function h(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
|
|
418
418
|
`)?c.slice(0,-1):c}),a=void 0,c="",u=""}function g(A={}){o&&A.consume&&d(o),s=!0,a=void 0,c="",u="",o=""}return{feed:f,reset:g}}function exn(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
|
|
419
419
|
`,n),s=-1;if(i!==-1&&o!==-1?s=Math.min(i,o):i!==-1?i===t.length-1?s=-1:s=i:o!==-1&&(s=o),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
420
|
-
`&&n++}}return[e,r]}var m0e,kFe=Te(()=>{m0e=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function txn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function FFe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(FFe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${FFe(t.cause)}`:t.message:`${t}`}function dNt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function rxn(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var y0e,hNt,VFe,Ws,Xp,Ju,x7,V1,sN,Eq,A0e,E0e,tZ,bq,rZ,Iw,vq,_q,Cq,ZX,s5,PFe,LFe,UFe,pNt,QFe,qFe,eZ,HFe,GFe,aN,mNt=Te(()=>{kFe();y0e=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(dNt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(dNt(this),r)}};hNt=t=>{throw TypeError(t)},VFe=(t,e,r)=>e.has(t)||hNt("Cannot "+r),Ws=(t,e,r)=>(VFe(t,e,"read from private field"),r?r.call(t):e.get(t)),Xp=(t,e,r)=>e.has(t)?hNt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ju=(t,e,r,n)=>(VFe(t,e,"write to private field"),e.set(t,r),r),x7=(t,e,r)=>(VFe(t,e,"access private method"),r),aN=class extends EventTarget{constructor(e,r){var n,i;super(),Xp(this,s5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xp(this,V1),Xp(this,sN),Xp(this,Eq),Xp(this,A0e),Xp(this,E0e),Xp(this,tZ),Xp(this,bq),Xp(this,rZ,null),Xp(this,Iw),Xp(this,vq),Xp(this,_q,null),Xp(this,Cq,null),Xp(this,ZX,null),Xp(this,LFe,async o=>{var s;Ws(this,vq).reset();let{body:a,redirected:c,status:u,headers:f}=o;if(u===204){x7(this,s5,eZ).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Ju(this,Eq,new URL(o.url)):Ju(this,Eq,void 0),u!==200){x7(this,s5,eZ).call(this,`Non-200 status code (${u})`,u);return}if(!(f.get("content-type")||"").startsWith("text/event-stream")){x7(this,s5,eZ).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ws(this,V1)===this.CLOSED)return;Ju(this,V1,this.OPEN);let d=new Event("open");if((s=Ws(this,ZX))==null||s.call(this,d),this.dispatchEvent(d),typeof a!="object"||!a||!("getReader"in a)){x7(this,s5,eZ).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),g=!0;do{let{done:A,value:y}=await h.read();y&&Ws(this,vq).feed(p.decode(y,{stream:!A})),A&&(g=!1,Ws(this,vq).reset(),x7(this,s5,HFe).call(this))}while(g)}),Xp(this,UFe,o=>{Ju(this,Iw,void 0),!(o.name==="AbortError"||o.type==="aborted")&&x7(this,s5,HFe).call(this,FFe(o))}),Xp(this,QFe,o=>{typeof o.id=="string"&&Ju(this,rZ,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Ws(this,Eq)?Ws(this,Eq).origin:Ws(this,sN).origin,lastEventId:o.id||""});Ws(this,Cq)&&(!o.event||o.event==="message")&&Ws(this,Cq).call(this,s),this.dispatchEvent(s)}),Xp(this,qFe,o=>{Ju(this,tZ,o)}),Xp(this,GFe,()=>{Ju(this,bq,void 0),Ws(this,V1)===this.CONNECTING&&x7(this,s5,PFe).call(this)});try{if(e instanceof URL)Ju(this,sN,e);else if(typeof e=="string")Ju(this,sN,new URL(e,rxn()));else throw new Error("Invalid URL")}catch{throw txn("An invalid or illegal string was specified")}Ju(this,vq,g0e({onEvent:Ws(this,QFe),onRetry:Ws(this,qFe)})),Ju(this,V1,this.CONNECTING),Ju(this,tZ,3e3),Ju(this,E0e,(n=r?.fetch)!=null?n:globalThis.fetch),Ju(this,A0e,(i=r?.withCredentials)!=null?i:!1),x7(this,s5,PFe).call(this)}get readyState(){return Ws(this,V1)}get url(){return Ws(this,sN).href}get withCredentials(){return Ws(this,A0e)}get onerror(){return Ws(this,_q)}set onerror(e){Ju(this,_q,e)}get onmessage(){return Ws(this,Cq)}set onmessage(e){Ju(this,Cq,e)}get onopen(){return Ws(this,ZX)}set onopen(e){Ju(this,ZX,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Ws(this,bq)&&clearTimeout(Ws(this,bq)),Ws(this,V1)!==this.CLOSED&&(Ws(this,Iw)&&Ws(this,Iw).abort(),Ju(this,V1,this.CLOSED),Ju(this,Iw,void 0))}};V1=new WeakMap,sN=new WeakMap,Eq=new WeakMap,A0e=new WeakMap,E0e=new WeakMap,tZ=new WeakMap,bq=new WeakMap,rZ=new WeakMap,Iw=new WeakMap,vq=new WeakMap,_q=new WeakMap,Cq=new WeakMap,ZX=new WeakMap,s5=new WeakSet,PFe=function(){Ju(this,V1,this.CONNECTING),Ju(this,Iw,new AbortController),Ws(this,E0e)(Ws(this,sN),x7(this,s5,pNt).call(this)).then(Ws(this,LFe)).catch(Ws(this,UFe))},LFe=new WeakMap,UFe=new WeakMap,pNt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ws(this,rZ)?{"Last-Event-ID":Ws(this,rZ)}:void 0},cache:"no-store",signal:(t=Ws(this,Iw))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},QFe=new WeakMap,qFe=new WeakMap,eZ=function(t,e){var r;Ws(this,V1)!==this.CLOSED&&Ju(this,V1,this.CLOSED);let n=new y0e("error",{code:e,message:t});(r=Ws(this,_q))==null||r.call(this,n),this.dispatchEvent(n)},HFe=function(t,e){var r;if(Ws(this,V1)===this.CLOSED)return;Ju(this,V1,this.CONNECTING);let n=new y0e("error",{code:e,message:t});(r=Ws(this,_q))==null||r.call(this,n),this.dispatchEvent(n),Ju(this,bq,setTimeout(Ws(this,GFe),Ws(this,tZ)))},GFe=new WeakMap,aN.CONNECTING=0,aN.OPEN=1,aN.CLOSED=2});async function nxn(t){return(await $Fe).getRandomValues(new Uint8Array(t))}async function ixn(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await nxn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function oxn(t){return await ixn(t)}async function sxn(t){let e=await(await $Fe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function WFe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await oxn(t),r=await sxn(e);return{code_verifier:e,code_challenge:r}}var $Fe,gNt=Te(()=>{$Fe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Jh,ANt,jFe,axn,yNt,YFe,ENt,lxn,cxn,vNt,wSo,TSo,zFe=Te(()=>{WX();Jh=Oe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Oe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),Oe.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),ANt=Oe.object({resource:Oe.string().url(),authorization_servers:Oe.array(Jh).optional(),jwks_uri:Oe.string().url().optional(),scopes_supported:Oe.array(Oe.string()).optional(),bearer_methods_supported:Oe.array(Oe.string()).optional(),resource_signing_alg_values_supported:Oe.array(Oe.string()).optional(),resource_name:Oe.string().optional(),resource_documentation:Oe.string().optional(),resource_policy_uri:Oe.string().url().optional(),resource_tos_uri:Oe.string().url().optional(),tls_client_certificate_bound_access_tokens:Oe.boolean().optional(),authorization_details_types_supported:Oe.array(Oe.string()).optional(),dpop_signing_alg_values_supported:Oe.array(Oe.string()).optional(),dpop_bound_access_tokens_required:Oe.boolean().optional()}).passthrough(),jFe=Oe.object({issuer:Oe.string(),authorization_endpoint:Jh,token_endpoint:Jh,registration_endpoint:Jh.optional(),scopes_supported:Oe.array(Oe.string()).optional(),response_types_supported:Oe.array(Oe.string()),response_modes_supported:Oe.array(Oe.string()).optional(),grant_types_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),service_documentation:Jh.optional(),revocation_endpoint:Jh.optional(),revocation_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),introspection_endpoint:Oe.string().optional(),introspection_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),code_challenge_methods_supported:Oe.array(Oe.string()).optional()}).passthrough(),axn=Oe.object({issuer:Oe.string(),authorization_endpoint:Jh,token_endpoint:Jh,userinfo_endpoint:Jh.optional(),jwks_uri:Jh,registration_endpoint:Jh.optional(),scopes_supported:Oe.array(Oe.string()).optional(),response_types_supported:Oe.array(Oe.string()),response_modes_supported:Oe.array(Oe.string()).optional(),grant_types_supported:Oe.array(Oe.string()).optional(),acr_values_supported:Oe.array(Oe.string()).optional(),subject_types_supported:Oe.array(Oe.string()),id_token_signing_alg_values_supported:Oe.array(Oe.string()),id_token_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),id_token_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),userinfo_signing_alg_values_supported:Oe.array(Oe.string()).optional(),userinfo_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),userinfo_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),request_object_signing_alg_values_supported:Oe.array(Oe.string()).optional(),request_object_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),request_object_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),display_values_supported:Oe.array(Oe.string()).optional(),claim_types_supported:Oe.array(Oe.string()).optional(),claims_supported:Oe.array(Oe.string()).optional(),service_documentation:Oe.string().optional(),claims_locales_supported:Oe.array(Oe.string()).optional(),ui_locales_supported:Oe.array(Oe.string()).optional(),claims_parameter_supported:Oe.boolean().optional(),request_parameter_supported:Oe.boolean().optional(),request_uri_parameter_supported:Oe.boolean().optional(),require_request_uri_registration:Oe.boolean().optional(),op_policy_uri:Jh.optional(),op_tos_uri:Jh.optional()}).passthrough(),yNt=axn.merge(jFe.pick({code_challenge_methods_supported:!0})),YFe=Oe.object({access_token:Oe.string(),id_token:Oe.string().optional(),token_type:Oe.string(),expires_in:Oe.number().optional(),scope:Oe.string().optional(),refresh_token:Oe.string().optional()}).strip(),ENt=Oe.object({error:Oe.string(),error_description:Oe.string().optional(),error_uri:Oe.string().optional()}),lxn=Oe.object({redirect_uris:Oe.array(Jh),token_endpoint_auth_method:Oe.string().optional(),grant_types:Oe.array(Oe.string()).optional(),response_types:Oe.array(Oe.string()).optional(),client_name:Oe.string().optional(),client_uri:Jh.optional(),logo_uri:Jh.optional(),scope:Oe.string().optional(),contacts:Oe.array(Oe.string()).optional(),tos_uri:Jh.optional(),policy_uri:Oe.string().optional(),jwks_uri:Jh.optional(),jwks:Oe.any().optional(),software_id:Oe.string().optional(),software_version:Oe.string().optional(),software_statement:Oe.string().optional()}).strip(),cxn=Oe.object({client_id:Oe.string(),client_secret:Oe.string().optional(),client_id_issued_at:Oe.number().optional(),client_secret_expires_at:Oe.number().optional()}).strip(),vNt=lxn.merge(cxn),wSo=Oe.object({error:Oe.string(),error_description:Oe.string().optional()}).strip(),TSo=Oe.object({token:Oe.string(),token_type_hint:Oe.string().optional()}).strip()});function CNt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function bNt({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var _Nt=Te(()=>{});var yp,nZ,lN,cN,uN,iZ,oZ,sZ,w7,aZ,lZ,cZ,uZ,fZ,dZ,pZ,hZ,SNt,xNt=Te(()=>{yp=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},nZ=class extends yp{};nZ.errorCode="invalid_request";lN=class extends yp{};lN.errorCode="invalid_client";cN=class extends yp{};cN.errorCode="invalid_grant";uN=class extends yp{};uN.errorCode="unauthorized_client";iZ=class extends yp{};iZ.errorCode="unsupported_grant_type";oZ=class extends yp{};oZ.errorCode="invalid_scope";sZ=class extends yp{};sZ.errorCode="access_denied";w7=class extends yp{};w7.errorCode="server_error";aZ=class extends yp{};aZ.errorCode="temporarily_unavailable";lZ=class extends yp{};lZ.errorCode="unsupported_response_type";cZ=class extends yp{};cZ.errorCode="unsupported_token_type";uZ=class extends yp{};uZ.errorCode="invalid_token";fZ=class extends yp{};fZ.errorCode="method_not_allowed";dZ=class extends yp{};dZ.errorCode="too_many_requests";pZ=class extends yp{};pZ.errorCode="invalid_client_metadata";hZ=class extends yp{};hZ.errorCode="insufficient_scope";SNt={[nZ.errorCode]:nZ,[lN.errorCode]:lN,[cN.errorCode]:cN,[uN.errorCode]:uN,[iZ.errorCode]:iZ,[oZ.errorCode]:oZ,[sZ.errorCode]:sZ,[w7.errorCode]:w7,[aZ.errorCode]:aZ,[lZ.errorCode]:lZ,[cZ.errorCode]:cZ,[uZ.errorCode]:uZ,[fZ.errorCode]:fZ,[dZ.errorCode]:dZ,[pZ.errorCode]:pZ,[hZ.errorCode]:hZ}});function TNt(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function INt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":uxn(i,o,r);return;case"client_secret_post":fxn(i,o,n);return;case"none":dxn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function uxn(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function fxn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function dxn(t,e){e.set("client_id",t)}async function KFe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=ENt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=SNt[i]||w7;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new w7(i)}}async function Dw(t,e){var r,n;try{return await JFe(t,e)}catch(i){if(i instanceof lN||i instanceof uN)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await JFe(t,e);if(i instanceof cN)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await JFe(t,e);throw i}}async function JFe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await hxn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await pxn(e,t,s),u=await Exn(a,{fetchFn:o}),f=await Promise.resolve(t.clientInformation());if(!f){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let A=await Cxn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(A),f=A}if(r!==void 0){let A=await t.codeVerifier(),y=await ZFe(a,{metadata:u,clientInformation:f,authorizationCode:r,codeVerifier:A,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(y),"AUTHORIZED"}let d=await t.tokens();if(d?.refresh_token)try{let A=await ePe(a,{metadata:u,clientInformation:f,refreshToken:d.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof yp)||A instanceof w7))throw A}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:g}=await vxn(a,{metadata:u,clientInformation:f,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(h),"REDIRECT"}async function pxn(t,e,r){let n=CNt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!bNt({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function mZ(t){let e=t.headers.get("WWW-Authenticate");if(!e)return;let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;let o=/resource_metadata="([^"]*)"/.exec(e);if(o)try{return new URL(o[1])}catch{return}}async function hxn(t,e,r=fetch){let n=await Axn(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return ANt.parse(await n.json())}async function XFe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?XFe(t,void 0,r):void 0;throw n}}function mxn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function wNt(t,e,r=fetch){return await XFe(t,{"MCP-Protocol-Version":e},r)}function gxn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function Axn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:pq,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let f=mxn(e,s.pathname);c=new URL(f,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await wNt(c,a,r);if(!n?.metadataUrl&&gxn(u,s.pathname)){let f=new URL(`/.well-known/${e}`,s);u=await wNt(f,a,r)}return u}function yxn(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function Exn(t,{fetchFn:e=fetch,protocolVersion:r=pq}={}){var n;let i={"MCP-Protocol-Version":r},o=yxn(t);for(let{url:s,type:a}of o){let c=await XFe(s,i,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(a==="oauth")return jFe.parse(await c.json());{let u=yNt.parse(await c.json());if(!(!((n=u.code_challenge_methods_supported)===null||n===void 0)&&n.includes("S256")))throw new Error(`Incompatible OIDC provider at ${s}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function vxn(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a="code",c="S256",u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a))throw new Error(`Incompatible auth server: does not support response type ${a}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);let f=await WFe(),d=f.code_verifier,p=f.code_challenge;return u.searchParams.set("response_type",a),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",p),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(n)),o&&u.searchParams.set("state",o),i&&u.searchParams.set("scope",i),i?.includes("offline_access")&&u.searchParams.append("prompt","consent"),s&&u.searchParams.set("resource",s.href),{authorizationUrl:u,codeVerifier:d}}async function ZFe(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let f="authorization_code",d=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(f))throw new Error(`Incompatible auth server: does not support grant type ${f}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:f,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let A=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],y=TNt(r,A);INt(y,r,p,h)}s&&h.set("resource",s.href);let g=await(c??fetch)(d,{method:"POST",headers:p,body:h});if(!g.ok)throw await KFe(g);return YFe.parse(await g.json())}async function ePe(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let f=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(f,d,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],g=TNt(r,h);INt(g,r,f,d)}i&&d.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:f,body:d});if(!p.ok)throw await KFe(p);return YFe.parse({refresh_token:n,...await p.json()})}async function Cxn(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await KFe(o);return vNt.parse(await o.json())}var $1,v0e=Te(()=>{gNt();Sw();zFe();zFe();_Nt();xNt();$1=class extends Error{constructor(e){super(e??"Unauthorized")}}});var tPe,Sq,DNt=Te(()=>{mNt();Sw();v0e();tPe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Sq=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new $1("No auth provider");let r;try{r=await Dw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new $1;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new aN(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let f=await i(a,{...c,headers:u});return f.status===401&&f.headers.has("www-authenticate")&&(this._resourceMetadataUrl=mZ(f)),f}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new tPe(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(f){s(f),(c=this.onerror)===null||c===void 0||c.call(this,f),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let f=a,d;try{d=_w.parse(JSON.parse(f.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,d)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new $1("No auth provider");if(await Dw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new $1("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){if(this._resourceMetadataUrl=mZ(a),await Dw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new $1;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var C0e,RNt=Te(()=>{kFe();C0e=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=g0e({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var bxn,gZ,Rw,rPe=Te(()=>{Sw();v0e();RNt();bxn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},gZ=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Rw=class{constructor(e,r){var n;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:bxn}async _authThenStart(){var e;if(!this._authProvider)throw new $1("No auth provider");let r;try{r=await Dw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new $1;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new gZ(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,f,d;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new C0e).getReader();for(;;){let{value:h,done:g}=await p.read();if(g)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let A=_w.parse(JSON.parse(h.data));o!==void 0&&YX(A)&&(A.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,A)}catch(A){(u=this.onerror)===null||u===void 0||u.call(this,A)}}}catch(p){if((f=this.onerror)===null||f===void 0||f.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(d=this.onerror)===null||d===void 0||d.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new $1("No auth provider");if(await Dw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new $1("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:Qhe(e)?e.id:void 0}).catch(y=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,y)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let f={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},d=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,f),p=d.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!d.ok){if(d.status===401&&this._authProvider){if(this._resourceMetadataUrl=mZ(d),await Dw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new $1;return this.send(e)}let y=await d.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${d.status}): ${y}`)}if(d.status===202){uDt(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(y=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,y)});return}let g=(Array.isArray(e)?e:[e]).filter(y=>"method"in y&&"id"in y&&y.id!==void 0).length>0,A=d.headers.get("content-type");if(g)if(A?.includes("text/event-stream"))this._handleSseStream(d.body,{onresumptiontoken:c},!1);else if(A?.includes("application/json")){let y=await d.json(),v=Array.isArray(y)?y.map(S=>_w.parse(S)):[_w.parse(y)];for(let S of v)(o=this.onmessage)===null||o===void 0||o.call(this,S)}else throw new gZ(-1,`Unexpected content type: ${A}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new gZ(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as _xn}from"node:fs/promises";var AZ,yZ,fN,nPe=Te(()=>{"use strict";HU();v0e();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(AZ||(AZ={}));yZ=class extends Error{code;constructor(e,r){super(r),this.code=e}},fN=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||r7.default}async start(){if(this._isClosed)throw new Error("Transport is closed");let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await ePe(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error("Unauthorized: OAuth required")}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new yZ(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new yZ(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error("No auth provider configured");try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await ZFe(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error("Client information not available")}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===r7.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error("Transport is closed");if(!this._websocket)throw new Error("Transport not started");if(this._websocket.readyState!==r7.default.OPEN)throw new Error("WebSocket is not open");try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new yZ(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:AZ.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.22-beta.4",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:AZ.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await _xn(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:AZ.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var BNt,b0e,NNt=Te(()=>{"use strict";BNt=ze(xX(),1);b0e=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error("Scopes must be provided in the oauth config for Google Credentials provider");this.auth=new BNt.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error("Failed to get access token from Google ADC");return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as Sxn}from"node:child_process";import{promisify as xxn}from"node:util";import{platform as wxn}from"node:os";import{URL as Txn}from"node:url";function Ixn(t){let e;try{e=new Txn(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function MNt(t){Ixn(t);let e=wxn(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await ONt(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await ONt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var ONt,kNt=Te(()=>{"use strict";ONt=xxn(Sxn)});function Rs(t){return t instanceof Error&&"code"in t}function wr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function iPe(t){if(t&&typeof t=="object"&&"response"in t){let r=Dxn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new S0e(r.error.message);case 401:return new Bw(r.error.message);case 403:return new _0e(r.error.message);default:}}return t}function Dxn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var _0e,Bw,S0e,Ku=Te(()=>{"use strict";_0e=class extends Error{},Bw=class extends Error{},S0e=class extends Error{}});import{promises as xq}from"node:fs";import*as x0e from"node:path";import*as FNt from"node:os";var Kh,w0e=Te(()=>{"use strict";Ku();Kh=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=FNt.homedir();return x0e.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=x0e.dirname(this.getTokenFilePath());await xq.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await xq.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(`Failed to load MCP OAuth tokens: ${wr(r)}`)}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await xq.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(f){throw console.error(`Failed to save MCP OAuth token: ${wr(f)}`),f}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await xq.unlink(i):await xq.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(`Failed to remove MCP OAuth token: ${wr(o)}`)}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await xq.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(`Failed to clear MCP OAuth tokens: ${wr(e)}`)}}}});var Xh,T0e=Te(()=>{"use strict";Ku();Xh=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${wr(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${wr(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log("Dynamic client registration is supported at:",a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log("Dynamic client registration is supported at:",i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${wr(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(`Found resource metadata URI from www-authenticate header: ${r}`);let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log("OAuth configuration discovered successfully from www-authenticate header"),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as PNt from"node:http";import*as EZ from"node:crypto";import{URL as oPe}from"node:url";var x3,sPe=Te(()=>{"use strict";kNt();w0e();Ku();T0e();x3=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(`Client registration failed: ${o.status} ${o.statusText} - ${s}`)}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Xh.extractBaseUrl(e);return Xh.discoverOAuthConfig(r)}static generatePKCEParams(){let e=EZ.randomBytes(32).toString("base64url"),r=EZ.createHash("sha256").update(e).digest("base64url"),n=EZ.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=PNt.createServer(async(o,s)=>{try{let a=new oPe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end("Not found");return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),f=a.searchParams.get("error");if(f){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
|
|
420
|
+
`&&n++}}return[e,r]}var m0e,kFe=Te(()=>{m0e=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function txn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function FFe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(FFe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${FFe(t.cause)}`:t.message:`${t}`}function dNt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function rxn(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var y0e,hNt,VFe,Ws,Xp,Ju,x7,V1,sN,Eq,A0e,E0e,tZ,bq,rZ,Iw,vq,_q,Cq,ZX,s5,PFe,LFe,UFe,pNt,QFe,qFe,eZ,HFe,GFe,aN,mNt=Te(()=>{kFe();y0e=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(dNt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(dNt(this),r)}};hNt=t=>{throw TypeError(t)},VFe=(t,e,r)=>e.has(t)||hNt("Cannot "+r),Ws=(t,e,r)=>(VFe(t,e,"read from private field"),r?r.call(t):e.get(t)),Xp=(t,e,r)=>e.has(t)?hNt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ju=(t,e,r,n)=>(VFe(t,e,"write to private field"),e.set(t,r),r),x7=(t,e,r)=>(VFe(t,e,"access private method"),r),aN=class extends EventTarget{constructor(e,r){var n,i;super(),Xp(this,s5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xp(this,V1),Xp(this,sN),Xp(this,Eq),Xp(this,A0e),Xp(this,E0e),Xp(this,tZ),Xp(this,bq),Xp(this,rZ,null),Xp(this,Iw),Xp(this,vq),Xp(this,_q,null),Xp(this,Cq,null),Xp(this,ZX,null),Xp(this,LFe,async o=>{var s;Ws(this,vq).reset();let{body:a,redirected:c,status:u,headers:f}=o;if(u===204){x7(this,s5,eZ).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Ju(this,Eq,new URL(o.url)):Ju(this,Eq,void 0),u!==200){x7(this,s5,eZ).call(this,`Non-200 status code (${u})`,u);return}if(!(f.get("content-type")||"").startsWith("text/event-stream")){x7(this,s5,eZ).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ws(this,V1)===this.CLOSED)return;Ju(this,V1,this.OPEN);let d=new Event("open");if((s=Ws(this,ZX))==null||s.call(this,d),this.dispatchEvent(d),typeof a!="object"||!a||!("getReader"in a)){x7(this,s5,eZ).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),g=!0;do{let{done:A,value:y}=await h.read();y&&Ws(this,vq).feed(p.decode(y,{stream:!A})),A&&(g=!1,Ws(this,vq).reset(),x7(this,s5,HFe).call(this))}while(g)}),Xp(this,UFe,o=>{Ju(this,Iw,void 0),!(o.name==="AbortError"||o.type==="aborted")&&x7(this,s5,HFe).call(this,FFe(o))}),Xp(this,QFe,o=>{typeof o.id=="string"&&Ju(this,rZ,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Ws(this,Eq)?Ws(this,Eq).origin:Ws(this,sN).origin,lastEventId:o.id||""});Ws(this,Cq)&&(!o.event||o.event==="message")&&Ws(this,Cq).call(this,s),this.dispatchEvent(s)}),Xp(this,qFe,o=>{Ju(this,tZ,o)}),Xp(this,GFe,()=>{Ju(this,bq,void 0),Ws(this,V1)===this.CONNECTING&&x7(this,s5,PFe).call(this)});try{if(e instanceof URL)Ju(this,sN,e);else if(typeof e=="string")Ju(this,sN,new URL(e,rxn()));else throw new Error("Invalid URL")}catch{throw txn("An invalid or illegal string was specified")}Ju(this,vq,g0e({onEvent:Ws(this,QFe),onRetry:Ws(this,qFe)})),Ju(this,V1,this.CONNECTING),Ju(this,tZ,3e3),Ju(this,E0e,(n=r?.fetch)!=null?n:globalThis.fetch),Ju(this,A0e,(i=r?.withCredentials)!=null?i:!1),x7(this,s5,PFe).call(this)}get readyState(){return Ws(this,V1)}get url(){return Ws(this,sN).href}get withCredentials(){return Ws(this,A0e)}get onerror(){return Ws(this,_q)}set onerror(e){Ju(this,_q,e)}get onmessage(){return Ws(this,Cq)}set onmessage(e){Ju(this,Cq,e)}get onopen(){return Ws(this,ZX)}set onopen(e){Ju(this,ZX,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Ws(this,bq)&&clearTimeout(Ws(this,bq)),Ws(this,V1)!==this.CLOSED&&(Ws(this,Iw)&&Ws(this,Iw).abort(),Ju(this,V1,this.CLOSED),Ju(this,Iw,void 0))}};V1=new WeakMap,sN=new WeakMap,Eq=new WeakMap,A0e=new WeakMap,E0e=new WeakMap,tZ=new WeakMap,bq=new WeakMap,rZ=new WeakMap,Iw=new WeakMap,vq=new WeakMap,_q=new WeakMap,Cq=new WeakMap,ZX=new WeakMap,s5=new WeakSet,PFe=function(){Ju(this,V1,this.CONNECTING),Ju(this,Iw,new AbortController),Ws(this,E0e)(Ws(this,sN),x7(this,s5,pNt).call(this)).then(Ws(this,LFe)).catch(Ws(this,UFe))},LFe=new WeakMap,UFe=new WeakMap,pNt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ws(this,rZ)?{"Last-Event-ID":Ws(this,rZ)}:void 0},cache:"no-store",signal:(t=Ws(this,Iw))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},QFe=new WeakMap,qFe=new WeakMap,eZ=function(t,e){var r;Ws(this,V1)!==this.CLOSED&&Ju(this,V1,this.CLOSED);let n=new y0e("error",{code:e,message:t});(r=Ws(this,_q))==null||r.call(this,n),this.dispatchEvent(n)},HFe=function(t,e){var r;if(Ws(this,V1)===this.CLOSED)return;Ju(this,V1,this.CONNECTING);let n=new y0e("error",{code:e,message:t});(r=Ws(this,_q))==null||r.call(this,n),this.dispatchEvent(n),Ju(this,bq,setTimeout(Ws(this,GFe),Ws(this,tZ)))},GFe=new WeakMap,aN.CONNECTING=0,aN.OPEN=1,aN.CLOSED=2});async function nxn(t){return(await $Fe).getRandomValues(new Uint8Array(t))}async function ixn(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await nxn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function oxn(t){return await ixn(t)}async function sxn(t){let e=await(await $Fe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function WFe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await oxn(t),r=await sxn(e);return{code_verifier:e,code_challenge:r}}var $Fe,gNt=Te(()=>{$Fe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Jh,ANt,jFe,axn,yNt,YFe,ENt,lxn,cxn,vNt,wSo,TSo,zFe=Te(()=>{WX();Jh=Oe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Oe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),Oe.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),ANt=Oe.object({resource:Oe.string().url(),authorization_servers:Oe.array(Jh).optional(),jwks_uri:Oe.string().url().optional(),scopes_supported:Oe.array(Oe.string()).optional(),bearer_methods_supported:Oe.array(Oe.string()).optional(),resource_signing_alg_values_supported:Oe.array(Oe.string()).optional(),resource_name:Oe.string().optional(),resource_documentation:Oe.string().optional(),resource_policy_uri:Oe.string().url().optional(),resource_tos_uri:Oe.string().url().optional(),tls_client_certificate_bound_access_tokens:Oe.boolean().optional(),authorization_details_types_supported:Oe.array(Oe.string()).optional(),dpop_signing_alg_values_supported:Oe.array(Oe.string()).optional(),dpop_bound_access_tokens_required:Oe.boolean().optional()}).passthrough(),jFe=Oe.object({issuer:Oe.string(),authorization_endpoint:Jh,token_endpoint:Jh,registration_endpoint:Jh.optional(),scopes_supported:Oe.array(Oe.string()).optional(),response_types_supported:Oe.array(Oe.string()),response_modes_supported:Oe.array(Oe.string()).optional(),grant_types_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),service_documentation:Jh.optional(),revocation_endpoint:Jh.optional(),revocation_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),introspection_endpoint:Oe.string().optional(),introspection_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),code_challenge_methods_supported:Oe.array(Oe.string()).optional()}).passthrough(),axn=Oe.object({issuer:Oe.string(),authorization_endpoint:Jh,token_endpoint:Jh,userinfo_endpoint:Jh.optional(),jwks_uri:Jh,registration_endpoint:Jh.optional(),scopes_supported:Oe.array(Oe.string()).optional(),response_types_supported:Oe.array(Oe.string()),response_modes_supported:Oe.array(Oe.string()).optional(),grant_types_supported:Oe.array(Oe.string()).optional(),acr_values_supported:Oe.array(Oe.string()).optional(),subject_types_supported:Oe.array(Oe.string()),id_token_signing_alg_values_supported:Oe.array(Oe.string()),id_token_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),id_token_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),userinfo_signing_alg_values_supported:Oe.array(Oe.string()).optional(),userinfo_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),userinfo_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),request_object_signing_alg_values_supported:Oe.array(Oe.string()).optional(),request_object_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),request_object_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),display_values_supported:Oe.array(Oe.string()).optional(),claim_types_supported:Oe.array(Oe.string()).optional(),claims_supported:Oe.array(Oe.string()).optional(),service_documentation:Oe.string().optional(),claims_locales_supported:Oe.array(Oe.string()).optional(),ui_locales_supported:Oe.array(Oe.string()).optional(),claims_parameter_supported:Oe.boolean().optional(),request_parameter_supported:Oe.boolean().optional(),request_uri_parameter_supported:Oe.boolean().optional(),require_request_uri_registration:Oe.boolean().optional(),op_policy_uri:Jh.optional(),op_tos_uri:Jh.optional()}).passthrough(),yNt=axn.merge(jFe.pick({code_challenge_methods_supported:!0})),YFe=Oe.object({access_token:Oe.string(),id_token:Oe.string().optional(),token_type:Oe.string(),expires_in:Oe.number().optional(),scope:Oe.string().optional(),refresh_token:Oe.string().optional()}).strip(),ENt=Oe.object({error:Oe.string(),error_description:Oe.string().optional(),error_uri:Oe.string().optional()}),lxn=Oe.object({redirect_uris:Oe.array(Jh),token_endpoint_auth_method:Oe.string().optional(),grant_types:Oe.array(Oe.string()).optional(),response_types:Oe.array(Oe.string()).optional(),client_name:Oe.string().optional(),client_uri:Jh.optional(),logo_uri:Jh.optional(),scope:Oe.string().optional(),contacts:Oe.array(Oe.string()).optional(),tos_uri:Jh.optional(),policy_uri:Oe.string().optional(),jwks_uri:Jh.optional(),jwks:Oe.any().optional(),software_id:Oe.string().optional(),software_version:Oe.string().optional(),software_statement:Oe.string().optional()}).strip(),cxn=Oe.object({client_id:Oe.string(),client_secret:Oe.string().optional(),client_id_issued_at:Oe.number().optional(),client_secret_expires_at:Oe.number().optional()}).strip(),vNt=lxn.merge(cxn),wSo=Oe.object({error:Oe.string(),error_description:Oe.string().optional()}).strip(),TSo=Oe.object({token:Oe.string(),token_type_hint:Oe.string().optional()}).strip()});function CNt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function bNt({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var _Nt=Te(()=>{});var yp,nZ,lN,cN,uN,iZ,oZ,sZ,w7,aZ,lZ,cZ,uZ,fZ,dZ,pZ,hZ,SNt,xNt=Te(()=>{yp=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},nZ=class extends yp{};nZ.errorCode="invalid_request";lN=class extends yp{};lN.errorCode="invalid_client";cN=class extends yp{};cN.errorCode="invalid_grant";uN=class extends yp{};uN.errorCode="unauthorized_client";iZ=class extends yp{};iZ.errorCode="unsupported_grant_type";oZ=class extends yp{};oZ.errorCode="invalid_scope";sZ=class extends yp{};sZ.errorCode="access_denied";w7=class extends yp{};w7.errorCode="server_error";aZ=class extends yp{};aZ.errorCode="temporarily_unavailable";lZ=class extends yp{};lZ.errorCode="unsupported_response_type";cZ=class extends yp{};cZ.errorCode="unsupported_token_type";uZ=class extends yp{};uZ.errorCode="invalid_token";fZ=class extends yp{};fZ.errorCode="method_not_allowed";dZ=class extends yp{};dZ.errorCode="too_many_requests";pZ=class extends yp{};pZ.errorCode="invalid_client_metadata";hZ=class extends yp{};hZ.errorCode="insufficient_scope";SNt={[nZ.errorCode]:nZ,[lN.errorCode]:lN,[cN.errorCode]:cN,[uN.errorCode]:uN,[iZ.errorCode]:iZ,[oZ.errorCode]:oZ,[sZ.errorCode]:sZ,[w7.errorCode]:w7,[aZ.errorCode]:aZ,[lZ.errorCode]:lZ,[cZ.errorCode]:cZ,[uZ.errorCode]:uZ,[fZ.errorCode]:fZ,[dZ.errorCode]:dZ,[pZ.errorCode]:pZ,[hZ.errorCode]:hZ}});function TNt(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function INt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":uxn(i,o,r);return;case"client_secret_post":fxn(i,o,n);return;case"none":dxn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function uxn(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function fxn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function dxn(t,e){e.set("client_id",t)}async function KFe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=ENt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=SNt[i]||w7;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new w7(i)}}async function Dw(t,e){var r,n;try{return await JFe(t,e)}catch(i){if(i instanceof lN||i instanceof uN)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await JFe(t,e);if(i instanceof cN)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await JFe(t,e);throw i}}async function JFe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await hxn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await pxn(e,t,s),u=await Exn(a,{fetchFn:o}),f=await Promise.resolve(t.clientInformation());if(!f){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let A=await Cxn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(A),f=A}if(r!==void 0){let A=await t.codeVerifier(),y=await ZFe(a,{metadata:u,clientInformation:f,authorizationCode:r,codeVerifier:A,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(y),"AUTHORIZED"}let d=await t.tokens();if(d?.refresh_token)try{let A=await ePe(a,{metadata:u,clientInformation:f,refreshToken:d.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof yp)||A instanceof w7))throw A}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:g}=await vxn(a,{metadata:u,clientInformation:f,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(h),"REDIRECT"}async function pxn(t,e,r){let n=CNt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!bNt({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function mZ(t){let e=t.headers.get("WWW-Authenticate");if(!e)return;let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;let o=/resource_metadata="([^"]*)"/.exec(e);if(o)try{return new URL(o[1])}catch{return}}async function hxn(t,e,r=fetch){let n=await Axn(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return ANt.parse(await n.json())}async function XFe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?XFe(t,void 0,r):void 0;throw n}}function mxn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function wNt(t,e,r=fetch){return await XFe(t,{"MCP-Protocol-Version":e},r)}function gxn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function Axn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:pq,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let f=mxn(e,s.pathname);c=new URL(f,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await wNt(c,a,r);if(!n?.metadataUrl&&gxn(u,s.pathname)){let f=new URL(`/.well-known/${e}`,s);u=await wNt(f,a,r)}return u}function yxn(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function Exn(t,{fetchFn:e=fetch,protocolVersion:r=pq}={}){var n;let i={"MCP-Protocol-Version":r},o=yxn(t);for(let{url:s,type:a}of o){let c=await XFe(s,i,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(a==="oauth")return jFe.parse(await c.json());{let u=yNt.parse(await c.json());if(!(!((n=u.code_challenge_methods_supported)===null||n===void 0)&&n.includes("S256")))throw new Error(`Incompatible OIDC provider at ${s}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function vxn(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a="code",c="S256",u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a))throw new Error(`Incompatible auth server: does not support response type ${a}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);let f=await WFe(),d=f.code_verifier,p=f.code_challenge;return u.searchParams.set("response_type",a),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",p),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(n)),o&&u.searchParams.set("state",o),i&&u.searchParams.set("scope",i),i?.includes("offline_access")&&u.searchParams.append("prompt","consent"),s&&u.searchParams.set("resource",s.href),{authorizationUrl:u,codeVerifier:d}}async function ZFe(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let f="authorization_code",d=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(f))throw new Error(`Incompatible auth server: does not support grant type ${f}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:f,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let A=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],y=TNt(r,A);INt(y,r,p,h)}s&&h.set("resource",s.href);let g=await(c??fetch)(d,{method:"POST",headers:p,body:h});if(!g.ok)throw await KFe(g);return YFe.parse(await g.json())}async function ePe(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let f=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(f,d,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],g=TNt(r,h);INt(g,r,f,d)}i&&d.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:f,body:d});if(!p.ok)throw await KFe(p);return YFe.parse({refresh_token:n,...await p.json()})}async function Cxn(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await KFe(o);return vNt.parse(await o.json())}var $1,v0e=Te(()=>{gNt();Sw();zFe();zFe();_Nt();xNt();$1=class extends Error{constructor(e){super(e??"Unauthorized")}}});var tPe,Sq,DNt=Te(()=>{mNt();Sw();v0e();tPe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Sq=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new $1("No auth provider");let r;try{r=await Dw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new $1;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new aN(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let f=await i(a,{...c,headers:u});return f.status===401&&f.headers.has("www-authenticate")&&(this._resourceMetadataUrl=mZ(f)),f}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new tPe(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(f){s(f),(c=this.onerror)===null||c===void 0||c.call(this,f),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let f=a,d;try{d=_w.parse(JSON.parse(f.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,d)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new $1("No auth provider");if(await Dw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new $1("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){if(this._resourceMetadataUrl=mZ(a),await Dw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new $1;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var C0e,RNt=Te(()=>{kFe();C0e=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=g0e({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var bxn,gZ,Rw,rPe=Te(()=>{Sw();v0e();RNt();bxn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},gZ=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Rw=class{constructor(e,r){var n;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:bxn}async _authThenStart(){var e;if(!this._authProvider)throw new $1("No auth provider");let r;try{r=await Dw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new $1;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new gZ(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,f,d;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new C0e).getReader();for(;;){let{value:h,done:g}=await p.read();if(g)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let A=_w.parse(JSON.parse(h.data));o!==void 0&&YX(A)&&(A.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,A)}catch(A){(u=this.onerror)===null||u===void 0||u.call(this,A)}}}catch(p){if((f=this.onerror)===null||f===void 0||f.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(d=this.onerror)===null||d===void 0||d.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new $1("No auth provider");if(await Dw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new $1("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:Qhe(e)?e.id:void 0}).catch(y=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,y)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let f={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},d=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,f),p=d.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!d.ok){if(d.status===401&&this._authProvider){if(this._resourceMetadataUrl=mZ(d),await Dw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new $1;return this.send(e)}let y=await d.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${d.status}): ${y}`)}if(d.status===202){uDt(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(y=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,y)});return}let g=(Array.isArray(e)?e:[e]).filter(y=>"method"in y&&"id"in y&&y.id!==void 0).length>0,A=d.headers.get("content-type");if(g)if(A?.includes("text/event-stream"))this._handleSseStream(d.body,{onresumptiontoken:c},!1);else if(A?.includes("application/json")){let y=await d.json(),v=Array.isArray(y)?y.map(S=>_w.parse(S)):[_w.parse(y)];for(let S of v)(o=this.onmessage)===null||o===void 0||o.call(this,S)}else throw new gZ(-1,`Unexpected content type: ${A}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new gZ(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as _xn}from"node:fs/promises";var AZ,yZ,fN,nPe=Te(()=>{"use strict";HU();v0e();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(AZ||(AZ={}));yZ=class extends Error{code;constructor(e,r){super(r),this.code=e}},fN=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||r7.default}async start(){if(this._isClosed)throw new Error("Transport is closed");let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await ePe(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error("Unauthorized: OAuth required")}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new yZ(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new yZ(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error("No auth provider configured");try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await ZFe(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error("Client information not available")}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===r7.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error("Transport is closed");if(!this._websocket)throw new Error("Transport not started");if(this._websocket.readyState!==r7.default.OPEN)throw new Error("WebSocket is not open");try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new yZ(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:AZ.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.22",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:AZ.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await _xn(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:AZ.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var BNt,b0e,NNt=Te(()=>{"use strict";BNt=ze(xX(),1);b0e=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error("Scopes must be provided in the oauth config for Google Credentials provider");this.auth=new BNt.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error("Failed to get access token from Google ADC");return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as Sxn}from"node:child_process";import{promisify as xxn}from"node:util";import{platform as wxn}from"node:os";import{URL as Txn}from"node:url";function Ixn(t){let e;try{e=new Txn(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function MNt(t){Ixn(t);let e=wxn(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await ONt(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await ONt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var ONt,kNt=Te(()=>{"use strict";ONt=xxn(Sxn)});function Rs(t){return t instanceof Error&&"code"in t}function wr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function iPe(t){if(t&&typeof t=="object"&&"response"in t){let r=Dxn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new S0e(r.error.message);case 401:return new Bw(r.error.message);case 403:return new _0e(r.error.message);default:}}return t}function Dxn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var _0e,Bw,S0e,Ku=Te(()=>{"use strict";_0e=class extends Error{},Bw=class extends Error{},S0e=class extends Error{}});import{promises as xq}from"node:fs";import*as x0e from"node:path";import*as FNt from"node:os";var Kh,w0e=Te(()=>{"use strict";Ku();Kh=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=FNt.homedir();return x0e.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=x0e.dirname(this.getTokenFilePath());await xq.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await xq.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(`Failed to load MCP OAuth tokens: ${wr(r)}`)}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await xq.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(f){throw console.error(`Failed to save MCP OAuth token: ${wr(f)}`),f}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await xq.unlink(i):await xq.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(`Failed to remove MCP OAuth token: ${wr(o)}`)}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await xq.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(`Failed to clear MCP OAuth tokens: ${wr(e)}`)}}}});var Xh,T0e=Te(()=>{"use strict";Ku();Xh=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${wr(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${wr(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log("Dynamic client registration is supported at:",a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log("Dynamic client registration is supported at:",i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${wr(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(`Found resource metadata URI from www-authenticate header: ${r}`);let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log("OAuth configuration discovered successfully from www-authenticate header"),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as PNt from"node:http";import*as EZ from"node:crypto";import{URL as oPe}from"node:url";var x3,sPe=Te(()=>{"use strict";kNt();w0e();Ku();T0e();x3=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(`Client registration failed: ${o.status} ${o.statusText} - ${s}`)}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Xh.extractBaseUrl(e);return Xh.discoverOAuthConfig(r)}static generatePKCEParams(){let e=EZ.randomBytes(32).toString("base64url"),r=EZ.createHash("sha256").update(e).digest("base64url"),n=EZ.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=PNt.createServer(async(o,s)=>{try{let a=new oPe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end("Not found");return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),f=a.searchParams.get("error");if(f){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
|
|
421
421
|
<html>
|
|
422
422
|
<body>
|
|
423
423
|
<h1>Authentication Failed</h1>
|
|
@@ -3087,7 +3087,7 @@ Content from @${U}:
|
|
|
3087
3087
|
`,e-1);return{line:r===-1?0:t.slice(0,r+1).match(/\n/g).length,column:e-r-1}}function M1t(t,e,{oneBased:r=!1}={}){if(typeof t!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(e))throw new TypeError("Index parameter should be an integer");if(e<0||e>t.length)throw new RangeError("Index out of bounds");let n=pso(t,e);return r?{line:n.line+1,column:n.column+1}:n}var hso=t=>`\\u{${t.codePointAt(0).toString(16)}}`,k1t=class t extends Error{name="JSONError";fileName;#e;#t;#r;#n;#o;constructor(e){if(typeof e=="string")super(),this.#r=e;else{let{jsonParseError:r,fileName:n,input:i}=e;super(void 0,{cause:r}),this.#e=i,this.#t=r,this.fileName=n}Error.captureStackTrace?.(this,t)}get message(){this.#r??=`${gso(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
|
|
3088
3088
|
|
|
3089
3089
|
${e}
|
|
3090
|
-
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=mso(r,this.#t.message);if(n)return(0,FWr.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#o??=this.#i(!1),this.#o}},mso=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:M1t(t,Number(n),{oneBased:!0})},gso=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${hso(n)})`);function F1t(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new k1t({jsonParseError:n,fileName:r,input:t})}}var Ojr=ze(Bjr(),1);import{fileURLToPath as hao}from"node:url";function Njr(t){return t instanceof URL?hao(t):t}var Aao=t=>gao.resolve(Njr(t)??".","package.json"),yao=(t,e)=>{let r=typeof t=="string"?F1t(t):t;return e&&(0,Ojr.default)(r),r};async function Mjr({cwd:t,normalize:e=!0}={}){let r=await mao.readFile(Aao(t),"utf8");return yao(r,e)}async function kjr(t){let e=await fWr("package.json",t);if(e)return{packageJson:await Mjr({...t,cwd:Eao.dirname(e)}),path:e}}import{fileURLToPath as vao}from"url";import Cao from"path";var bao=vao(import.meta.url),_ao=Cao.dirname(bao),qxe;async function Cz(){if(qxe)return qxe;let t=await kjr({cwd:_ao});if(t)return qxe=t.packageJson,qxe}async function Ub(){let t=await Cz();return"0.2.22
|
|
3090
|
+
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=mso(r,this.#t.message);if(n)return(0,FWr.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#o??=this.#i(!1),this.#o}},mso=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:M1t(t,Number(n),{oneBased:!0})},gso=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${hso(n)})`);function F1t(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new k1t({jsonParseError:n,fileName:r,input:t})}}var Ojr=ze(Bjr(),1);import{fileURLToPath as hao}from"node:url";function Njr(t){return t instanceof URL?hao(t):t}var Aao=t=>gao.resolve(Njr(t)??".","package.json"),yao=(t,e)=>{let r=typeof t=="string"?F1t(t):t;return e&&(0,Ojr.default)(r),r};async function Mjr({cwd:t,normalize:e=!0}={}){let r=await mao.readFile(Aao(t),"utf8");return yao(r,e)}async function kjr(t){let e=await fWr("package.json",t);if(e)return{packageJson:await Mjr({...t,cwd:Eao.dirname(e)}),path:e}}import{fileURLToPath as vao}from"url";import Cao from"path";var bao=vao(import.meta.url),_ao=Cao.dirname(bao),qxe;async function Cz(){if(qxe)return qxe;let t=await kjr({cwd:_ao});if(t)return qxe=t.packageJson,qxe}async function Ub(){let t=await Cz();return"0.2.22"}import vP from"node:process";var Fjr={name:"about",description:"show version info",kind:"built-in",action:async t=>{let e=vP.platform,r="no sandbox";vP.env.SANDBOX&&vP.env.SANDBOX!=="sandbox-exec"?r=vP.env.SANDBOX:vP.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${vP.env.SEATBELT_PROFILE||"unknown"})`);let n=t.services.config?.getModel()||"Unknown",i=await Ub(),o=t.services.settings.merged.selectedAuthType||"",s=vP.env.GOOGLE_CLOUD_PROJECT||"",a={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:o,gcpProject:s};t.ui.addItem(a,Date.now())}};nn();var Gxe="\x1B[32m";var Ljr="\x1B[31m",Cv="\x1B[36m",Om="\x1B[90m";var Da="\x1B[0m";function Hxe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
|
|
3091
3091
|
${Ljr}No agents found${Da}
|
|
3092
3092
|
`;i="\u{1F7E2} ";let o=`${i}${e}
|
|
3093
3093
|
`;for(let s of t)n?o+=Sao(s):o+=`${Gxe}- ${s.agentType}${Da}
|
|
@@ -4034,7 +4034,7 @@ CRITICAL: Unhandled Promise Rejection!
|
|
|
4034
4034
|
=========================================
|
|
4035
4035
|
Reason: ${e}${e instanceof Error&&e.stack?`
|
|
4036
4036
|
Stack trace:
|
|
4037
|
-
${e.stack}`:""}`;wa.emit("log-error",n),t||(t=!0,wa.emit("open-debug-console"))})}function K1o(){console.log("\u{1F50D} Crash diagnostics enabled - Core dump and crash files will be generated on crash"),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:process.env.NODE_ENV,SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.2.22
|
|
4037
|
+
${e.stack}`:""}`;wa.emit("log-error",n),t||(t=!0,wa.emit("open-debug-console"))})}function K1o(){console.log("\u{1F50D} Crash diagnostics enabled - Core dump and crash files will be generated on crash"),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:process.env.NODE_ENV,SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.2.22"}},r=`crash-${Date.now()}-${process.pid}.json`,n=q1o.join(process.cwd(),r);try{W1o.writeFileSync(n,JSON.stringify(e,null,2)),console.error(`\u{1F4A5} Crash detected! Crash info written to: ${n}`),console.error("\u{1F4CB} Core dump will be generated...")}catch(i){console.error("\u274C Failed to write crash file:",i)}process.abort()}),process.on("warning",t=>{console.warn("\u26A0\uFE0F Node.js Warning:",{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error("\u{1F6A8} Unhandled Promise Rejection detected:",{reason:t,promise:e.toString()})})}async function Aln(){J1o();let t=process.cwd(),e=rc(t);if(await hrn(),e.errors.length>0){for(let f of e.errors){let d=`Error in ${f.path}: ${f.message}`;process.env.NO_COLOR||(d=`\x1B[31m${d}\x1B[0m`),console.error(d),console.error(`Please fix ${f.path} and try again.`)}process.exit(1)}let r=await PTe(),n=jD(t),i=await nue(e.merged,n,Gg.generateSessionId(),r);if(i.getDebugMode()&&K1o(),V1o.setDefaultResultOrder(j1o(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error("Error: The --prompt-interactive flag is not supported when piping input from stdin."),process.exit(1)),i.getListExtensions()){console.debug("Installed extensions:");for(let f of n)console.debug(`- ${f.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:f}=await Promise.resolve().then(()=>(qyt(),frn)),d=(await Promise.resolve().then(()=>(Y4t(),j4t))).default;await d().scriptName("iflow").command(f).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:f}=await Promise.resolve().then(()=>(Uyt(),Xtn)),d=(await Promise.resolve().then(()=>(Y4t(),j4t))).default;await d().scriptName("iflow").command(f).help().version(!1).parse(),process.exit(0)}e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",_r.CLOUD_SHELL),qXr(i.getDebugMode()),await i.initialize();try{await i.setIdeModeAndSyncConnection(!0)}catch(f){console.error("Failed to connect to IDE server:",f)}if(Hl.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(Hl.setActiveTheme(e.merged.theme)||console.warn(`Warning: Theme "${e.merged.theme}" not found.`)),!process.env.SANDBOX){let f=e.merged.autoConfigureMaxOldSpaceSize?Y1o(i):[],d=i.getSandbox();if(d){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let p=NP(e.merged.selectedAuthType);if(p)throw new Error(p);await i.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(p){console.error("Error authenticating:",p),process.exit(1)}await Knn(d,f,i),process.exit(0)}else f.length>0&&(await z1o(f),process.exit(0))}if(e.merged.selectedAuthType===_r.LOGIN_WITH_IFLOW&&i.isBrowserLaunchSuppressed()&&await MB(e.merged.selectedAuthType,i),i.getExperimentalAcp())return i.getAcpPort()?await Tan(i,e,i.getAcpPort()):Ian(i,e);let o=i.getQuestion(),s=[...await Xnn(),...await ein(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&o?.length===0){console.clear();let f=await Ub();gln(mln(t),e);let d,p=async()=>{try{if(console.clear(),gln(mln(t),e),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),d)try{d.unmount(),await new Promise(h=>process.nextTick(h))}catch(h){console.error("Error during unmount:",h)}d=ode((0,Pue.jsx)(z4t.default.StrictMode,{children:(0,Pue.jsx)(p6t,{config:i,settings:e,startupWarnings:s,version:f,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0})}),{exitOnCtrlC:!1,stdout:nAt(),stdin:process.stdin,patchConsole:!0})}catch(h){console.error("Error during resume:",h)}};process.on("SIGCONT",p),iue(()=>{process.off("SIGCONT",p)}),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),d=ode((0,Pue.jsx)(z4t.default.StrictMode,{children:(0,Pue.jsx)(p6t,{config:i,settings:e,startupWarnings:s,version:f,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume})}),{exitOnCtrlC:!1,stdout:nAt()}),e.merged.disableAutoUpdate||Aan().then(h=>{Nnn(h,e,i.getProjectRoot())}).catch(h=>{i.getDebugMode()&&console.error("Update check failed:",h)}),iue(()=>d.unmount());return}!process.stdin.isTTY&&!o&&(o+=await jnn()),o||(console.error("No input provided via stdin."),process.exit(1));let c=Math.random().toString(16).slice(2);WY(i,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:o,prompt_id:c,auth_type:i.getContentGeneratorConfig()?.authType,prompt_length:o.length});let u=await X1o(i,n,e,r);await tin(u,o,c),process.exit(0)}function gln(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function X1o(t,e,r,n){let i=t;if(t.getApprovalMode()!==ci.YOLO){let o=r.merged.excludeTools||[],s=[Bf.Name,Tp.Name,cd.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await nue(c,e,t.getSessionId(),u),await i.initialize()}return await Z1o(r.merged.selectedAuthType,i,r)}async function Z1o(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!whe()&&(console.error(`Please set an Auth method in your ${CP} or specify one of the following environment variables before running:
|
|
4038
4038
|
- apiKey, APIKEY, API_KEY, api_key
|
|
4039
4039
|
- baseUrl, BASEURL, BASE_URL, base_url
|
|
4040
4040
|
- modelName, MODELNAME, MODEL_NAME, model_name `),process.exit(1)),t||(whe()?t=_r.IFLOW:t=_r.IFLOW);let n=NP(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:r.merged.modelName}),e}Aln().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
|