@iflow-ai/iflow-cli 0.2.11-beta.1 → 0.2.11
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 +9 -9
- package/package.json +1 -1
package/bundle/iflow.js
CHANGED
|
@@ -541,7 +541,7 @@ ${JSON.stringify(a,null,2)}`),a.usage&&(this.lastUsageMetadata={total_tokens:a.u
|
|
|
541
541
|
\u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
|
|
542
542
|
${e}
|
|
543
543
|
|
|
544
|
-
\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(`QWen API error: ${n.status}`);let o=(await n.json()).choices[0].message.content.trim();return o.startsWith("```json")?o=o.replace(/^```json\s*/,"").replace(/\s*```$/,""):o.startsWith("```")&&(o=o.replace(/^```\s*/,"").replace(/\s*```$/,"")),JSON.parse(o)}catch(n){throw w5(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 Wf.STOP;case"length":return Wf.MAX_TOKENS;case"content_filter":return Wf.SAFETY;case"tool_calls":return Wf.MALFORMED_FUNCTION_CALL;default:return Wf.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}}});function LFn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function fb(t){let e=LFn(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 lee(){return fb("apiKey")}function cee(){return fb("baseUrl")||fb("url")}function uee(){return fb("modelName")||fb("model")}function FFt(t){let e=fb(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 UFt(t){let e=fb(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function QFt(t){let e=fb(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function eme(){return!!(lee()||cee()||uee())}function jQe(){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"],n=["maxSessionTurns","memoryDiscoveryMaxDirs"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=fb(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=FFt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=UFt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=QFt(o);s!==void 0&&(t[o]=s)}),t}function PFn(){return{apiKey:lee(),baseUrl:cee(),model:uee()}}var VQe=Re(()=>{"use strict";});function $Qe(t,e,r){let n=process.env.GEMINI_API_KEY,i=process.env.GOOGLE_API_KEY,o=process.env.GOOGLE_CLOUD_PROJECT,s=process.env.GOOGLE_CLOUD_LOCATION,a=lee(),c=cee(),u=uee(),f=r?.apiKey||a,d=r?.baseUrl||c||FFn[e],p=t.getModel()||u||lm,h={model:p,authType:e,proxy:t?.getProxy(),multimodalModelName:r?.multimodalModelName,debugMode:t?.getDebugMode()};return e===Jr.LOGIN_WITH_GOOGLE||e===Jr.CLOUD_SHELL?h:e===Jr.USE_GEMINI&&n?(h.apiKey=n,h.vertexai=!1,DFt(h.apiKey,h.model,h.proxy),h):e===Jr.USE_VERTEX_AI&&(i||o&&s)?(h.apiKey=i,h.vertexai=!0,h):([...zh,Jr.OPENAI_COMPATIBLE].includes(e)&&f&&(h.apiKey=f,h.baseUrl=d,h.model=p),h)}async function WQe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.11-beta.1 (${process.platform}; ${process.arch})`}};if(t.authType&&[...zh,Jr.IDEA_LAB].includes(t.authType)||t.authType===Jr.OPENAI_COMPATIBLE)return new Z2e(t);if(t.authType===Jr.LOGIN_WITH_GOOGLE||t.authType===Jr.CLOUD_SHELL)return FLe(i,t.authType,e,r);if([...zh,Jr.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===Jr.USE_GEMINI||t.authType===Jr.USE_VERTEX_AI)return new Mhe({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Jr,zh,FFn,v7=Re(()=>{"use strict";ic();ULe();A5();IFt();PFt();VQe();(function(t){t.LOGIN_WITH_GOOGLE="oauth-personal",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"})(Jr||(Jr={}));zh=[Jr.IFLOW,Jr.IDEA_LAB],FFn={[Jr.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Jr.IFLOW]:cRt}});var tme,qFt=Re(()=>{"use strict";tme=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 ss,ni,as,zf=Re(()=>{"use strict";ss=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"})(ni||(ni={}));(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"})(as||(as={}))});function HN(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 rme=Re(()=>{"use strict";});var Uc,nme=Re(()=>{"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"})(Uc||(Uc={}))});function UFn(t){return{text:t.text}}function QFn(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 qFn(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 HFn(t){return{text:`Resource Link: ${t.title||t.name} at ${t.uri}`}}function GFn(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 UFn(o);case"image":case"audio":return QFn(o,n);case"resource":return qFn(o,n);case"resource_link":return HFn(o);default:return null}}).filter(o=>o!==null):[{text:"[Error: Could not parse tool response]"}]}function jFn(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(`
|
|
544
|
+
\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(`QWen API error: ${n.status}`);let o=(await n.json()).choices[0].message.content.trim();return o.startsWith("```json")?o=o.replace(/^```json\s*/,"").replace(/\s*```$/,""):o.startsWith("```")&&(o=o.replace(/^```\s*/,"").replace(/\s*```$/,"")),JSON.parse(o)}catch(n){throw w5(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 Wf.STOP;case"length":return Wf.MAX_TOKENS;case"content_filter":return Wf.SAFETY;case"tool_calls":return Wf.MALFORMED_FUNCTION_CALL;default:return Wf.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}}});function LFn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function fb(t){let e=LFn(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 lee(){return fb("apiKey")}function cee(){return fb("baseUrl")||fb("url")}function uee(){return fb("modelName")||fb("model")}function FFt(t){let e=fb(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 UFt(t){let e=fb(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function QFt(t){let e=fb(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function eme(){return!!(lee()||cee()||uee())}function jQe(){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"],n=["maxSessionTurns","memoryDiscoveryMaxDirs"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=fb(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=FFt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=UFt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=QFt(o);s!==void 0&&(t[o]=s)}),t}function PFn(){return{apiKey:lee(),baseUrl:cee(),model:uee()}}var VQe=Re(()=>{"use strict";});function $Qe(t,e,r){let n=process.env.GEMINI_API_KEY,i=process.env.GOOGLE_API_KEY,o=process.env.GOOGLE_CLOUD_PROJECT,s=process.env.GOOGLE_CLOUD_LOCATION,a=lee(),c=cee(),u=uee(),f=r?.apiKey||a,d=r?.baseUrl||c||FFn[e],p=t.getModel()||u||lm,h={model:p,authType:e,proxy:t?.getProxy(),multimodalModelName:r?.multimodalModelName,debugMode:t?.getDebugMode()};return e===Jr.LOGIN_WITH_GOOGLE||e===Jr.CLOUD_SHELL?h:e===Jr.USE_GEMINI&&n?(h.apiKey=n,h.vertexai=!1,DFt(h.apiKey,h.model,h.proxy),h):e===Jr.USE_VERTEX_AI&&(i||o&&s)?(h.apiKey=i,h.vertexai=!0,h):([...zh,Jr.OPENAI_COMPATIBLE].includes(e)&&f&&(h.apiKey=f,h.baseUrl=d,h.model=p),h)}async function WQe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.11 (${process.platform}; ${process.arch})`}};if(t.authType&&[...zh,Jr.IDEA_LAB].includes(t.authType)||t.authType===Jr.OPENAI_COMPATIBLE)return new Z2e(t);if(t.authType===Jr.LOGIN_WITH_GOOGLE||t.authType===Jr.CLOUD_SHELL)return FLe(i,t.authType,e,r);if([...zh,Jr.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===Jr.USE_GEMINI||t.authType===Jr.USE_VERTEX_AI)return new Mhe({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Jr,zh,FFn,v7=Re(()=>{"use strict";ic();ULe();A5();IFt();PFt();VQe();(function(t){t.LOGIN_WITH_GOOGLE="oauth-personal",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"})(Jr||(Jr={}));zh=[Jr.IFLOW,Jr.IDEA_LAB],FFn={[Jr.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Jr.IFLOW]:cRt}});var tme,qFt=Re(()=>{"use strict";tme=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 ss,ni,as,zf=Re(()=>{"use strict";ss=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"})(ni||(ni={}));(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"})(as||(as={}))});function HN(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 rme=Re(()=>{"use strict";});var Uc,nme=Re(()=>{"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"})(Uc||(Uc={}))});function UFn(t){return{text:t.text}}function QFn(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 qFn(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 HFn(t){return{text:`Resource Link: ${t.title||t.name} at ${t.uri}`}}function GFn(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 UFn(o);case"image":case"audio":return QFn(o,n);case"resource":return qFn(o,n);case"resource_link":return HFn(o);default:return null}}).filter(o=>o!==null):[{text:"[Error: Could not parse tool response]"}]}function jFn(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(`
|
|
545
545
|
`):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function HFt(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var c2,fee=Re(()=>{"use strict";rme();nme();zf();ic();c2=class t extends ss{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??HFt(n),`${n} (${r} MCP Server)`,i,as.Hammer,{type:cr.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===ni.ProceedAlwaysServer?t.allowlist.add(n):s===ni.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: ${HN(i[0])} with response: ${HN(o)}`;return{llmContent:a,returnDisplay:`Error: MCP tool '${this.serverToolName}' reported an error.`,error:{message:a,type:Uc.MCP_TOOL_ERROR}}}return{llmContent:GFn(o),returnDisplay:jFn(o)}}}});var jFt=B((pOo,GFt)=>{"use strict";GFt.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 KFt=B((hOo,JFt)=>{"use strict";var zFt="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",VFt=new RegExp("^"+zFt+"$"),$Ft="|&;()<> \\t",VFn='"((\\\\"|[^"])*?)"',$Fn="'((\\\\'|[^'])*?)'",WFn=/^#$/,WFt="'",YFt='"',YQe="$",GN="",YFn=4294967296;for(zQe=0;zQe<4;zQe++)GN+=(YFn*Math.random()).toString(16);var zQe,zFn=new RegExp("^"+GN);function JFn(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 KFn(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+GN+JSON.stringify(n)+GN:e+n}function XFn(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+$Ft+`]|[^\\s'"`+$Ft+"])+",o=new RegExp(["("+zFt+")","("+i+"|"+VFn+"|"+$Fn+")+"].join("|"),"g"),s=JFn(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(VFt.test(u))return{op:u};var f=!1,d=!1,p="",h=!1,g;function A(){g+=1;var S,w,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));w=u.slice(g,S),g=S}else if(/[*@#?$!_-]/.test(T))w=T,g+=1;else{var N=u.slice(g);S=N.match(/[^\w\d_]/),S?(w=N.slice(0,S.index),g+=S.index-1):(w=N,g=u.length)}return KFn(e,"",w)}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==WFt?p+=y:y===n?(g+=1,y=u.charAt(g),y===YFt||y===n||y===YQe?p+=y:p+=n+y):y===YQe?p+=A():p+=y;else if(y===YFt||y===WFt)f=y;else{if(VFt.test(y))return{op:u};if(WFn.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===YQe?p+=A():p+=y}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}JFt.exports=function(e,r,n){var i=XFn(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("("+GN+".*?"+GN+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return zFn.test(c)?JSON.parse(c.split(GN)[1]):c}))},[])}});var ime=B(JQe=>{"use strict";JQe.quote=jFt();JQe.parse=KFt()});var Ws,KQe,An,db,dee=Re(()=>{(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})(Ws||(Ws={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(KQe||(KQe={}));An=Ws.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),db=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 kr,ZFn,Z1,ome=Re(()=>{dee();kr=Ws.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"]),ZFn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Z1=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,Ws.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()}};Z1.create=t=>new Z1(t)});var eUn,k7,XQe=Re(()=>{ome();dee();eUn=(t,e)=>{let r;switch(t.code){case kr.invalid_type:t.received===An.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case kr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ws.jsonStringifyReplacer)}`;break;case kr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ws.joinValues(t.keys,", ")}`;break;case kr.invalid_union:r="Invalid input";break;case kr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ws.joinValues(t.options)}`;break;case kr.invalid_enum_value:r=`Invalid enum value. Expected ${Ws.joinValues(t.options)}, received '${t.received}'`;break;case kr.invalid_arguments:r="Invalid function arguments";break;case kr.invalid_return_type:r="Invalid function return type";break;case kr.invalid_date:r="Invalid date";break;case kr.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}"`:Ws.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case kr.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 kr.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 kr.custom:r="Invalid input";break;case kr.invalid_intersection_types:r="Intersection results could not be merged";break;case kr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case kr.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ws.assertNever(t)}return{message:r}},k7=eUn});function tUn(t){XFt=t}function bH(){return XFt}var XFt,sme=Re(()=>{XQe();XFt=k7});function ln(t,e){let r=bH(),n=pee({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===k7?void 0:k7].filter(i=>!!i)});t.common.issues.push(n)}var pee,rUn,u2,qi,jN,pm,ame,lme,Mx,CH,ZQe=Re(()=>{sme();XQe();pee=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}},rUn=[];u2=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 qi;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 qi;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}}},qi=Object.freeze({status:"aborted"}),jN=t=>({status:"dirty",value:t}),pm=t=>({status:"valid",value:t}),ame=t=>t.status==="aborted",lme=t=>t.status==="dirty",Mx=t=>t.status==="valid",CH=t=>typeof Promise<"u"&&t instanceof Promise});var ZFt=Re(()=>{});var zn,eUt=Re(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(zn||(zn={}))});function Xo(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 iUt(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 EUn(t){return new RegExp(`^${iUt(t)}$`)}function oUt(t){let e=`${nUt}T${iUt(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 vUn(t,e){return!!((e==="v4"||!e)&&dUn.test(t)||(e==="v6"||!e)&&hUn.test(t))}function bUn(t,e){if(!lUn.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 CUn(t,e){return!!((e==="v4"||!e)&&pUn.test(t)||(e==="v6"||!e)&&mUn.test(t))}function _Un(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 _H(t){if(t instanceof eA){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=z6.create(_H(n))}return new eA({...t._def,shape:()=>e})}else return t instanceof F7?new F7({...t._def,type:_H(t.element)}):t instanceof z6?z6.create(_H(t.unwrap())):t instanceof hb?hb.create(_H(t.unwrap())):t instanceof pb?pb.create(t.items.map(e=>_H(e))):t}function tqe(t,e){let r=db(t),n=db(e);if(t===e)return{valid:!0,data:t};if(r===An.object&&n===An.object){let i=Ws.objectKeys(e),o=Ws.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=tqe(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=tqe(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 sUt(t,e){return new tO({values:t,typeName:Zi.ZodEnum,...Xo(e)})}function rUt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function aUt(t,e={},r){return t?Lx.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=rUt(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=rUt(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Lx.create()}var J6,tUt,gs,nUn,iUn,oUn,sUn,aUn,lUn,cUn,uUn,fUn,eqe,dUn,pUn,hUn,mUn,gUn,AUn,nUt,yUn,kx,VN,$N,WN,YN,SH,zN,JN,Lx,P7,x5,wH,F7,eA,KN,L7,cme,XN,pb,ume,xH,TH,fme,ZN,eO,tO,rO,Px,K6,z6,hb,nO,iO,DH,SUn,hee,mee,oO,wUn,Zi,xUn,lUt,cUt,TUn,DUn,uUt,IUn,RUn,BUn,NUn,OUn,MUn,kUn,LUn,PUn,FUn,UUn,QUn,qUn,HUn,GUn,jUn,VUn,$Un,WUn,YUn,zUn,JUn,KUn,XUn,ZUn,eQn,tQn,rQn,nQn,iQn,oQn,sQn,aQn,lQn,fUt=Re(()=>{ome();sme();eUt();ZQe();dee();J6=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}},tUt=(t,e)=>{if(Mx(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 Z1(t.common.issues);return this._error=r,this._error}}};gs=class{get description(){return this._def.description}_getType(e){return db(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:db(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u2,ctx:{common:e.parent.common,data:e.data,parsedType:db(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(CH(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:db(e)},i=this._parseSync({data:e,path:n.path,parent:n});return tUt(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:db(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Mx(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=>Mx(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:db(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(CH(i)?i:Promise.resolve(i));return tUt(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:kr.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 K6({schema:this,typeName:Zi.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 z6.create(this,this._def)}nullable(){return hb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F7.create(this)}promise(){return Px.create(this,this._def)}or(e){return KN.create([this,e],this._def)}and(e){return XN.create(this,e,this._def)}transform(e){return new K6({...Xo(this._def),schema:this,typeName:Zi.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new nO({...Xo(this._def),innerType:this,defaultValue:r,typeName:Zi.ZodDefault})}brand(){return new hee({typeName:Zi.ZodBranded,type:this,...Xo(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new iO({...Xo(this._def),innerType:this,catchValue:r,typeName:Zi.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return mee.create(this,e)}readonly(){return oO.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},nUn=/^c[^\s-]{8,}$/i,iUn=/^[0-9a-z]+$/,oUn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sUn=/^[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,aUn=/^[a-z0-9_-]{21}$/i,lUn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cUn=/^[-+]?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)?)??$/,uUn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fUn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dUn=/^(?:(?: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])$/,pUn=/^(?:(?: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])$/,hUn=/^(([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]))$/,mUn=/^(([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])$/,gUn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,AUn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nUt="((\\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])))",yUn=new RegExp(`^${nUt}$`);kx=class t extends gs{_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:kr.invalid_type,expected:An.string,received:o.parsedType}),qi}let n=new u2,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:kr.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:kr.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:kr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&ln(i,{code:kr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")uUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"email",code:kr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")eqe||(eqe=new RegExp(fUn,"u")),eqe.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"emoji",code:kr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")sUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"uuid",code:kr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")aUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"nanoid",code:kr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")nUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cuid",code:kr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")iUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cuid2",code:kr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")oUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"ulid",code:kr.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:kr.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:kr.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:kr.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:kr.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:kr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?oUt(o).test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:kr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?yUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:kr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?EUn(o).test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:kr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?cUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"duration",code:kr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?vUn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"ip",code:kr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?bUn(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"jwt",code:kr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?CUn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cidr",code:kr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?gUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"base64",code:kr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?AUn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"base64url",code:kr.invalid_string,message:o.message}),n.dirty()):Ws.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:kr.invalid_string,...zn.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...zn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...zn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...zn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...zn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...zn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...zn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...zn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...zn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...zn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...zn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...zn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...zn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...zn.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,...zn.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,...zn.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...zn.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...zn.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...zn.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...zn.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...zn.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...zn.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...zn.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...zn.errToObj(r)})}nonempty(e){return this.min(1,zn.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}};kx.create=t=>new kx({checks:[],typeName:Zi.ZodString,coerce:t?.coerce??!1,...Xo(t)});VN=class t extends gs{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:kr.invalid_type,expected:An.number,received:o.parsedType}),qi}let n,i=new u2;for(let o of this._def.checks)o.kind==="int"?Ws.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ln(n,{code:kr.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:kr.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:kr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?_Un(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),ln(n,{code:kr.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:kr.not_finite,message:o.message}),i.dirty()):Ws.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,zn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,zn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,zn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,zn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:zn.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:zn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:zn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:zn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:zn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:zn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:zn.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:zn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:zn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:zn.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"&&Ws.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)}};VN.create=t=>new VN({checks:[],typeName:Zi.ZodNumber,coerce:t?.coerce||!1,...Xo(t)});$N=class t extends gs{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 u2;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:kr.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:kr.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:kr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Ws.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ln(r,{code:kr.invalid_type,expected:An.bigint,received:r.parsedType}),qi}gte(e,r){return this.setLimit("min",e,!0,zn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,zn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,zn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,zn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:zn.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:zn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:zn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:zn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:zn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:zn.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}};$N.create=t=>new $N({checks:[],typeName:Zi.ZodBigInt,coerce:t?.coerce??!1,...Xo(t)});WN=class extends gs{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==An.boolean){let n=this._getOrReturnCtx(e);return ln(n,{code:kr.invalid_type,expected:An.boolean,received:n.parsedType}),qi}return pm(e.data)}};WN.create=t=>new WN({typeName:Zi.ZodBoolean,coerce:t?.coerce||!1,...Xo(t)});YN=class t extends gs{_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:kr.invalid_type,expected:An.date,received:o.parsedType}),qi}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return ln(o,{code:kr.invalid_date}),qi}let n=new u2,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),ln(i,{code:kr.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:kr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Ws.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:zn.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:zn.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}};YN.create=t=>new YN({checks:[],coerce:t?.coerce||!1,typeName:Zi.ZodDate,...Xo(t)});SH=class extends gs{_parse(e){if(this._getType(e)!==An.symbol){let n=this._getOrReturnCtx(e);return ln(n,{code:kr.invalid_type,expected:An.symbol,received:n.parsedType}),qi}return pm(e.data)}};SH.create=t=>new SH({typeName:Zi.ZodSymbol,...Xo(t)});zN=class extends gs{_parse(e){if(this._getType(e)!==An.undefined){let n=this._getOrReturnCtx(e);return ln(n,{code:kr.invalid_type,expected:An.undefined,received:n.parsedType}),qi}return pm(e.data)}};zN.create=t=>new zN({typeName:Zi.ZodUndefined,...Xo(t)});JN=class extends gs{_parse(e){if(this._getType(e)!==An.null){let n=this._getOrReturnCtx(e);return ln(n,{code:kr.invalid_type,expected:An.null,received:n.parsedType}),qi}return pm(e.data)}};JN.create=t=>new JN({typeName:Zi.ZodNull,...Xo(t)});Lx=class extends gs{constructor(){super(...arguments),this._any=!0}_parse(e){return pm(e.data)}};Lx.create=t=>new Lx({typeName:Zi.ZodAny,...Xo(t)});P7=class extends gs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pm(e.data)}};P7.create=t=>new P7({typeName:Zi.ZodUnknown,...Xo(t)});x5=class extends gs{_parse(e){let r=this._getOrReturnCtx(e);return ln(r,{code:kr.invalid_type,expected:An.never,received:r.parsedType}),qi}};x5.create=t=>new x5({typeName:Zi.ZodNever,...Xo(t)});wH=class extends gs{_parse(e){if(this._getType(e)!==An.undefined){let n=this._getOrReturnCtx(e);return ln(n,{code:kr.invalid_type,expected:An.void,received:n.parsedType}),qi}return pm(e.data)}};wH.create=t=>new wH({typeName:Zi.ZodVoid,...Xo(t)});F7=class t extends gs{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==An.array)return ln(r,{code:kr.invalid_type,expected:An.array,received:r.parsedType}),qi;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?kr.too_big:kr.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:kr.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:kr.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 J6(r,s,r.path,a)))).then(s=>u2.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new J6(r,s,r.path,a)));return u2.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:zn.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:zn.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:zn.toString(r)}})}nonempty(e){return this.min(1,e)}};F7.create=(t,e)=>new F7({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Zi.ZodArray,...Xo(e)});eA=class t extends gs{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=Ws.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:kr.invalid_type,expected:An.object,received:u.parsedType}),qi}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof x5&&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 J6(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof x5){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:kr.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 J6(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=>u2.mergeObjectSync(n,u)):u2.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return zn.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:zn.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:Zi.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 Ws.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 Ws.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return _H(this)}partial(e){let r={};for(let n of Ws.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 Ws.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof z6;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return sUt(Ws.objectKeys(this.shape))}};eA.create=(t,e)=>new eA({shape:()=>t,unknownKeys:"strip",catchall:x5.create(),typeName:Zi.ZodObject,...Xo(e)});eA.strictCreate=(t,e)=>new eA({shape:()=>t,unknownKeys:"strict",catchall:x5.create(),typeName:Zi.ZodObject,...Xo(e)});eA.lazycreate=(t,e)=>new eA({shape:t,unknownKeys:"strip",catchall:x5.create(),typeName:Zi.ZodObject,...Xo(e)});KN=class extends gs{_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 Z1(a.ctx.common.issues));return ln(r,{code:kr.invalid_union,unionErrors:s}),qi}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 Z1(c));return ln(r,{code:kr.invalid_union,unionErrors:a}),qi}}get options(){return this._def.options}};KN.create=(t,e)=>new KN({options:t,typeName:Zi.ZodUnion,...Xo(e)});L7=t=>t instanceof ZN?L7(t.schema):t instanceof K6?L7(t.innerType()):t instanceof eO?[t.value]:t instanceof tO?t.options:t instanceof rO?Ws.objectValues(t.enum):t instanceof nO?L7(t._def.innerType):t instanceof zN?[void 0]:t instanceof JN?[null]:t instanceof z6?[void 0,...L7(t.unwrap())]:t instanceof hb?[null,...L7(t.unwrap())]:t instanceof hee||t instanceof oO?L7(t.unwrap()):t instanceof iO?L7(t._def.innerType):[],cme=class t extends gs{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==An.object)return ln(r,{code:kr.invalid_type,expected:An.object,received:r.parsedType}),qi;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:kr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),qi)}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=L7(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:Zi.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Xo(n)})}};XN=class extends gs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(ame(o)||ame(s))return qi;let a=tqe(o.value,s.value);return a.valid?((lme(o)||lme(s))&&r.dirty(),{status:r.value,value:a.data}):(ln(n,{code:kr.invalid_intersection_types}),qi)};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}))}};XN.create=(t,e,r)=>new XN({left:t,right:e,typeName:Zi.ZodIntersection,...Xo(r)});pb=class t extends gs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==An.array)return ln(n,{code:kr.invalid_type,expected:An.array,received:n.parsedType}),qi;if(n.data.length<this._def.items.length)return ln(n,{code:kr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),qi;!this._def.rest&&n.data.length>this._def.items.length&&(ln(n,{code:kr.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 J6(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>u2.mergeArray(r,s)):u2.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};pb.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pb({items:t,typeName:Zi.ZodTuple,rest:null,...Xo(e)})};ume=class t extends gs{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:kr.invalid_type,expected:An.object,received:n.parsedType}),qi;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new J6(n,a,n.path,a)),value:s._parse(new J6(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?u2.mergeObjectAsync(r,i):u2.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof gs?new t({keyType:e,valueType:r,typeName:Zi.ZodRecord,...Xo(n)}):new t({keyType:kx.create(),valueType:e,typeName:Zi.ZodRecord,...Xo(r)})}},xH=class extends gs{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:kr.invalid_type,expected:An.map,received:n.parsedType}),qi;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new J6(n,a,n.path,[u,"key"])),value:o._parse(new J6(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 qi;(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 qi;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(u.value,f.value)}return{status:r.value,value:a}}}};xH.create=(t,e,r)=>new xH({valueType:e,keyType:t,typeName:Zi.ZodMap,...Xo(r)});TH=class t extends gs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==An.set)return ln(n,{code:kr.invalid_type,expected:An.set,received:n.parsedType}),qi;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(ln(n,{code:kr.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:kr.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 qi;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 J6(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:zn.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:zn.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};TH.create=(t,e)=>new TH({valueType:t,minSize:null,maxSize:null,typeName:Zi.ZodSet,...Xo(e)});fme=class t extends gs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==An.function)return ln(r,{code:kr.invalid_type,expected:An.function,received:r.parsedType}),qi;function n(a,c){return pee({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bH(),k7].filter(u=>!!u),issueData:{code:kr.invalid_arguments,argumentsError:c}})}function i(a,c){return pee({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bH(),k7].filter(u=>!!u),issueData:{code:kr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Px){let a=this;return pm(async function(...c){let u=new Z1([]),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 pm(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Z1([n(c,u.error)]);let f=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(f,o);if(!d.success)throw new Z1([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:pb.create(e).rest(P7.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||pb.create([]).rest(P7.create()),returns:r||P7.create(),typeName:Zi.ZodFunction,...Xo(n)})}},ZN=class extends gs{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})}};ZN.create=(t,e)=>new ZN({getter:t,typeName:Zi.ZodLazy,...Xo(e)});eO=class extends gs{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ln(r,{received:r.data,code:kr.invalid_literal,expected:this._def.value}),qi}return{status:"valid",value:e.data}}get value(){return this._def.value}};eO.create=(t,e)=>new eO({value:t,typeName:Zi.ZodLiteral,...Xo(e)});tO=class t extends gs{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ln(r,{expected:Ws.joinValues(n),received:r.parsedType,code:kr.invalid_type}),qi}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:kr.invalid_enum_value,options:n}),qi}return pm(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})}};tO.create=sUt;rO=class extends gs{_parse(e){let r=Ws.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==An.string&&n.parsedType!==An.number){let i=Ws.objectValues(r);return ln(n,{expected:Ws.joinValues(i),received:n.parsedType,code:kr.invalid_type}),qi}if(this._cache||(this._cache=new Set(Ws.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ws.objectValues(r);return ln(n,{received:n.data,code:kr.invalid_enum_value,options:i}),qi}return pm(e.data)}get enum(){return this._def.values}};rO.create=(t,e)=>new rO({values:t,typeName:Zi.ZodNativeEnum,...Xo(e)});Px=class extends gs{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:kr.invalid_type,expected:An.promise,received:r.parsedType}),qi;let n=r.parsedType===An.promise?r.data:Promise.resolve(r.data);return pm(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Px.create=(t,e)=>new Px({type:t,typeName:Zi.ZodPromise,...Xo(e)});K6=class extends gs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Zi.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 qi;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?qi:c.status==="dirty"?jN(c.value):r.value==="dirty"?jN(c.value):c});{if(r.value==="aborted")return qi;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?qi:a.status==="dirty"?jN(a.value):r.value==="dirty"?jN(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"?qi:(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"?qi:(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(!Mx(s))return qi;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=>Mx(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):qi);Ws.assertNever(i)}};K6.create=(t,e,r)=>new K6({schema:t,typeName:Zi.ZodEffects,effect:e,...Xo(r)});K6.createWithPreprocess=(t,e,r)=>new K6({schema:e,effect:{type:"preprocess",transform:t},typeName:Zi.ZodEffects,...Xo(r)});z6=class extends gs{_parse(e){return this._getType(e)===An.undefined?pm(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};z6.create=(t,e)=>new z6({innerType:t,typeName:Zi.ZodOptional,...Xo(e)});hb=class extends gs{_parse(e){return this._getType(e)===An.null?pm(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};hb.create=(t,e)=>new hb({innerType:t,typeName:Zi.ZodNullable,...Xo(e)});nO=class extends gs{_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}};nO.create=(t,e)=>new nO({innerType:t,typeName:Zi.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Xo(e)});iO=class extends gs{_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 CH(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Z1(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Z1(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};iO.create=(t,e)=>new iO({innerType:t,typeName:Zi.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Xo(e)});DH=class extends gs{_parse(e){if(this._getType(e)!==An.nan){let n=this._getOrReturnCtx(e);return ln(n,{code:kr.invalid_type,expected:An.nan,received:n.parsedType}),qi}return{status:"valid",value:e.data}}};DH.create=t=>new DH({typeName:Zi.ZodNaN,...Xo(t)});SUn=Symbol("zod_brand"),hee=class extends gs{_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}},mee=class t extends gs{_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"?qi:o.status==="dirty"?(r.dirty(),jN(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"?qi: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:Zi.ZodPipeline})}},oO=class extends gs{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Mx(i)&&(i.value=Object.freeze(i.value)),i);return CH(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};oO.create=(t,e)=>new oO({innerType:t,typeName:Zi.ZodReadonly,...Xo(e)});wUn={object:eA.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"})(Zi||(Zi={}));xUn=(t,e={message:`Input not instance of ${t.name}`})=>aUt(r=>r instanceof t,e),lUt=kx.create,cUt=VN.create,TUn=DH.create,DUn=$N.create,uUt=WN.create,IUn=YN.create,RUn=SH.create,BUn=zN.create,NUn=JN.create,OUn=Lx.create,MUn=P7.create,kUn=x5.create,LUn=wH.create,PUn=F7.create,FUn=eA.create,UUn=eA.strictCreate,QUn=KN.create,qUn=cme.create,HUn=XN.create,GUn=pb.create,jUn=ume.create,VUn=xH.create,$Un=TH.create,WUn=fme.create,YUn=ZN.create,zUn=eO.create,JUn=tO.create,KUn=rO.create,XUn=Px.create,ZUn=K6.create,eQn=z6.create,tQn=hb.create,rQn=K6.createWithPreprocess,nQn=mee.create,iQn=()=>lUt().optional(),oQn=()=>cUt().optional(),sQn=()=>uUt().optional(),aQn={string:(t=>kx.create({...t,coerce:!0})),number:(t=>VN.create({...t,coerce:!0})),boolean:(t=>WN.create({...t,coerce:!0})),bigint:(t=>$N.create({...t,coerce:!0})),date:(t=>YN.create({...t,coerce:!0}))},lQn=qi});var Me={};r2(Me,{BRAND:()=>SUn,DIRTY:()=>jN,EMPTY_PATH:()=>rUn,INVALID:()=>qi,NEVER:()=>lQn,OK:()=>pm,ParseStatus:()=>u2,Schema:()=>gs,ZodAny:()=>Lx,ZodArray:()=>F7,ZodBigInt:()=>$N,ZodBoolean:()=>WN,ZodBranded:()=>hee,ZodCatch:()=>iO,ZodDate:()=>YN,ZodDefault:()=>nO,ZodDiscriminatedUnion:()=>cme,ZodEffects:()=>K6,ZodEnum:()=>tO,ZodError:()=>Z1,ZodFirstPartyTypeKind:()=>Zi,ZodFunction:()=>fme,ZodIntersection:()=>XN,ZodIssueCode:()=>kr,ZodLazy:()=>ZN,ZodLiteral:()=>eO,ZodMap:()=>xH,ZodNaN:()=>DH,ZodNativeEnum:()=>rO,ZodNever:()=>x5,ZodNull:()=>JN,ZodNullable:()=>hb,ZodNumber:()=>VN,ZodObject:()=>eA,ZodOptional:()=>z6,ZodParsedType:()=>An,ZodPipeline:()=>mee,ZodPromise:()=>Px,ZodReadonly:()=>oO,ZodRecord:()=>ume,ZodSchema:()=>gs,ZodSet:()=>TH,ZodString:()=>kx,ZodSymbol:()=>SH,ZodTransformer:()=>K6,ZodTuple:()=>pb,ZodType:()=>gs,ZodUndefined:()=>zN,ZodUnion:()=>KN,ZodUnknown:()=>P7,ZodVoid:()=>wH,addIssueToContext:()=>ln,any:()=>OUn,array:()=>PUn,bigint:()=>DUn,boolean:()=>uUt,coerce:()=>aQn,custom:()=>aUt,date:()=>IUn,datetimeRegex:()=>oUt,defaultErrorMap:()=>k7,discriminatedUnion:()=>qUn,effect:()=>ZUn,enum:()=>JUn,function:()=>WUn,getErrorMap:()=>bH,getParsedType:()=>db,instanceof:()=>xUn,intersection:()=>HUn,isAborted:()=>ame,isAsync:()=>CH,isDirty:()=>lme,isValid:()=>Mx,late:()=>wUn,lazy:()=>YUn,literal:()=>zUn,makeIssue:()=>pee,map:()=>VUn,nan:()=>TUn,nativeEnum:()=>KUn,never:()=>kUn,null:()=>NUn,nullable:()=>tQn,number:()=>cUt,object:()=>FUn,objectUtil:()=>KQe,oboolean:()=>sQn,onumber:()=>oQn,optional:()=>eQn,ostring:()=>iQn,pipeline:()=>nQn,preprocess:()=>rQn,promise:()=>XUn,quotelessJson:()=>ZFn,record:()=>jUn,set:()=>$Un,setErrorMap:()=>tUn,strictObject:()=>UUn,string:()=>lUt,symbol:()=>RUn,transformer:()=>ZUn,tuple:()=>GUn,undefined:()=>BUn,union:()=>QUn,unknown:()=>MUn,util:()=>Ws,void:()=>LUn});var rqe=Re(()=>{sme();ZQe();ZFt();dee();fUt();ome()});var gee=Re(()=>{rqe();rqe()});var IH,dUt,dme,pUt,hUt,cQn,e4,tA,Aee,mb,t4,pme,mUt,hme,gUt,AUt,yUt,yee,X6,EUt,vUt,Fx,sO,mme,Eee,bUt,uQn,fQn,dQn,nqe,CUt,_Ut,gme,pQn,Ame,yme,Eme,SUt,wUt,iqe,xUt,TUt,hQn,mQn,oqe,gQn,sqe,AQn,aqe,yQn,EQn,vQn,bQn,CQn,_Qn,SQn,vee,wQn,lqe,cqe,uqe,xQn,TQn,DUt,DQn,bee,IQn,RQn,BQn,NQn,fqe,vme,GOo,OQn,MQn,IUt,kQn,LQn,PQn,FQn,UQn,QQn,qQn,HQn,GQn,jQn,VQn,$Qn,WQn,YQn,zQn,JQn,KQn,dqe,XQn,bme,ZQn,eqn,jOo,VOo,$Oo,WOo,YOo,zOo,Z6,Ux=Re(()=>{gee();IH="2025-06-18",dUt=[IH,"2025-03-26","2024-11-05","2024-10-07"],dme="2.0",pUt=Me.union([Me.string(),Me.number().int()]),hUt=Me.string(),cQn=Me.object({progressToken:Me.optional(pUt)}).passthrough(),e4=Me.object({_meta:Me.optional(cQn)}).passthrough(),tA=Me.object({method:Me.string(),params:Me.optional(e4)}),Aee=Me.object({_meta:Me.optional(Me.object({}).passthrough())}).passthrough(),mb=Me.object({method:Me.string(),params:Me.optional(Aee)}),t4=Me.object({_meta:Me.optional(Me.object({}).passthrough())}).passthrough(),pme=Me.union([Me.string(),Me.number().int()]),mUt=Me.object({jsonrpc:Me.literal(dme),id:pme}).merge(tA).strict(),hme=t=>mUt.safeParse(t).success,gUt=Me.object({jsonrpc:Me.literal(dme)}).merge(mb).strict(),AUt=t=>gUt.safeParse(t).success,yUt=Me.object({jsonrpc:Me.literal(dme),id:pme,result:t4}).strict(),yee=t=>yUt.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"})(X6||(X6={}));EUt=Me.object({jsonrpc:Me.literal(dme),id:pme,error:Me.object({code:Me.number().int(),message:Me.string(),data:Me.optional(Me.unknown())})}).strict(),vUt=t=>EUt.safeParse(t).success,Fx=Me.union([mUt,gUt,yUt,EUt]),sO=t4.strict(),mme=mb.extend({method:Me.literal("notifications/cancelled"),params:Aee.extend({requestId:pme,reason:Me.string().optional()})}),Eee=Me.object({name:Me.string(),title:Me.optional(Me.string())}).passthrough(),bUt=Eee.extend({version:Me.string()}),uQn=Me.object({experimental:Me.optional(Me.object({}).passthrough()),sampling:Me.optional(Me.object({}).passthrough()),elicitation:Me.optional(Me.object({}).passthrough()),roots:Me.optional(Me.object({listChanged:Me.optional(Me.boolean())}).passthrough())}).passthrough(),fQn=tA.extend({method:Me.literal("initialize"),params:e4.extend({protocolVersion:Me.string(),capabilities:uQn,clientInfo:bUt})}),dQn=Me.object({experimental:Me.optional(Me.object({}).passthrough()),logging:Me.optional(Me.object({}).passthrough()),completions:Me.optional(Me.object({}).passthrough()),prompts:Me.optional(Me.object({listChanged:Me.optional(Me.boolean())}).passthrough()),resources:Me.optional(Me.object({subscribe:Me.optional(Me.boolean()),listChanged:Me.optional(Me.boolean())}).passthrough()),tools:Me.optional(Me.object({listChanged:Me.optional(Me.boolean())}).passthrough())}).passthrough(),nqe=t4.extend({protocolVersion:Me.string(),capabilities:dQn,serverInfo:bUt,instructions:Me.optional(Me.string())}),CUt=mb.extend({method:Me.literal("notifications/initialized")}),_Ut=t=>CUt.safeParse(t).success,gme=tA.extend({method:Me.literal("ping")}),pQn=Me.object({progress:Me.number(),total:Me.optional(Me.number()),message:Me.optional(Me.string())}).passthrough(),Ame=mb.extend({method:Me.literal("notifications/progress"),params:Aee.merge(pQn).extend({progressToken:pUt})}),yme=tA.extend({params:e4.extend({cursor:Me.optional(hUt)}).optional()}),Eme=t4.extend({nextCursor:Me.optional(hUt)}),SUt=Me.object({uri:Me.string(),mimeType:Me.optional(Me.string()),_meta:Me.optional(Me.object({}).passthrough())}).passthrough(),wUt=SUt.extend({text:Me.string()}),iqe=Me.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),xUt=SUt.extend({blob:iqe}),TUt=Eee.extend({uri:Me.string(),description:Me.optional(Me.string()),mimeType:Me.optional(Me.string()),_meta:Me.optional(Me.object({}).passthrough())}),hQn=Eee.extend({uriTemplate:Me.string(),description:Me.optional(Me.string()),mimeType:Me.optional(Me.string()),_meta:Me.optional(Me.object({}).passthrough())}),mQn=yme.extend({method:Me.literal("resources/list")}),oqe=Eme.extend({resources:Me.array(TUt)}),gQn=yme.extend({method:Me.literal("resources/templates/list")}),sqe=Eme.extend({resourceTemplates:Me.array(hQn)}),AQn=tA.extend({method:Me.literal("resources/read"),params:e4.extend({uri:Me.string()})}),aqe=t4.extend({contents:Me.array(Me.union([wUt,xUt]))}),yQn=mb.extend({method:Me.literal("notifications/resources/list_changed")}),EQn=tA.extend({method:Me.literal("resources/subscribe"),params:e4.extend({uri:Me.string()})}),vQn=tA.extend({method:Me.literal("resources/unsubscribe"),params:e4.extend({uri:Me.string()})}),bQn=mb.extend({method:Me.literal("notifications/resources/updated"),params:Aee.extend({uri:Me.string()})}),CQn=Me.object({name:Me.string(),description:Me.optional(Me.string()),required:Me.optional(Me.boolean())}).passthrough(),_Qn=Eee.extend({description:Me.optional(Me.string()),arguments:Me.optional(Me.array(CQn)),_meta:Me.optional(Me.object({}).passthrough())}),SQn=yme.extend({method:Me.literal("prompts/list")}),vee=Eme.extend({prompts:Me.array(_Qn)}),wQn=tA.extend({method:Me.literal("prompts/get"),params:e4.extend({name:Me.string(),arguments:Me.optional(Me.record(Me.string()))})}),lqe=Me.object({type:Me.literal("text"),text:Me.string(),_meta:Me.optional(Me.object({}).passthrough())}).passthrough(),cqe=Me.object({type:Me.literal("image"),data:iqe,mimeType:Me.string(),_meta:Me.optional(Me.object({}).passthrough())}).passthrough(),uqe=Me.object({type:Me.literal("audio"),data:iqe,mimeType:Me.string(),_meta:Me.optional(Me.object({}).passthrough())}).passthrough(),xQn=Me.object({type:Me.literal("resource"),resource:Me.union([wUt,xUt]),_meta:Me.optional(Me.object({}).passthrough())}).passthrough(),TQn=TUt.extend({type:Me.literal("resource_link")}),DUt=Me.union([lqe,cqe,uqe,TQn,xQn]),DQn=Me.object({role:Me.enum(["user","assistant"]),content:DUt}).passthrough(),bee=t4.extend({description:Me.optional(Me.string()),messages:Me.array(DQn)}),IQn=mb.extend({method:Me.literal("notifications/prompts/list_changed")}),RQn=Me.object({title:Me.optional(Me.string()),readOnlyHint:Me.optional(Me.boolean()),destructiveHint:Me.optional(Me.boolean()),idempotentHint:Me.optional(Me.boolean()),openWorldHint:Me.optional(Me.boolean())}).passthrough(),BQn=Eee.extend({description:Me.optional(Me.string()),inputSchema:Me.object({type:Me.literal("object"),properties:Me.optional(Me.object({}).passthrough()),required:Me.optional(Me.array(Me.string()))}).passthrough(),outputSchema:Me.optional(Me.object({type:Me.literal("object"),properties:Me.optional(Me.object({}).passthrough()),required:Me.optional(Me.array(Me.string()))}).passthrough()),annotations:Me.optional(RQn),_meta:Me.optional(Me.object({}).passthrough())}),NQn=yme.extend({method:Me.literal("tools/list")}),fqe=Eme.extend({tools:Me.array(BQn)}),vme=t4.extend({content:Me.array(DUt).default([]),structuredContent:Me.object({}).passthrough().optional(),isError:Me.optional(Me.boolean())}),GOo=vme.or(t4.extend({toolResult:Me.unknown()})),OQn=tA.extend({method:Me.literal("tools/call"),params:e4.extend({name:Me.string(),arguments:Me.optional(Me.record(Me.unknown()))})}),MQn=mb.extend({method:Me.literal("notifications/tools/list_changed")}),IUt=Me.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),kQn=tA.extend({method:Me.literal("logging/setLevel"),params:e4.extend({level:IUt})}),LQn=mb.extend({method:Me.literal("notifications/message"),params:Aee.extend({level:IUt,logger:Me.optional(Me.string()),data:Me.unknown()})}),PQn=Me.object({name:Me.string().optional()}).passthrough(),FQn=Me.object({hints:Me.optional(Me.array(PQn)),costPriority:Me.optional(Me.number().min(0).max(1)),speedPriority:Me.optional(Me.number().min(0).max(1)),intelligencePriority:Me.optional(Me.number().min(0).max(1))}).passthrough(),UQn=Me.object({role:Me.enum(["user","assistant"]),content:Me.union([lqe,cqe,uqe])}).passthrough(),QQn=tA.extend({method:Me.literal("sampling/createMessage"),params:e4.extend({messages:Me.array(UQn),systemPrompt:Me.optional(Me.string()),includeContext:Me.optional(Me.enum(["none","thisServer","allServers"])),temperature:Me.optional(Me.number()),maxTokens:Me.number().int(),stopSequences:Me.optional(Me.array(Me.string())),metadata:Me.optional(Me.object({}).passthrough()),modelPreferences:Me.optional(FQn)})}),qQn=t4.extend({model:Me.string(),stopReason:Me.optional(Me.enum(["endTurn","stopSequence","maxTokens"]).or(Me.string())),role:Me.enum(["user","assistant"]),content:Me.discriminatedUnion("type",[lqe,cqe,uqe])}),HQn=Me.object({type:Me.literal("boolean"),title:Me.optional(Me.string()),description:Me.optional(Me.string()),default:Me.optional(Me.boolean())}).passthrough(),GQn=Me.object({type:Me.literal("string"),title:Me.optional(Me.string()),description:Me.optional(Me.string()),minLength:Me.optional(Me.number()),maxLength:Me.optional(Me.number()),format:Me.optional(Me.enum(["email","uri","date","date-time"]))}).passthrough(),jQn=Me.object({type:Me.enum(["number","integer"]),title:Me.optional(Me.string()),description:Me.optional(Me.string()),minimum:Me.optional(Me.number()),maximum:Me.optional(Me.number())}).passthrough(),VQn=Me.object({type:Me.literal("string"),title:Me.optional(Me.string()),description:Me.optional(Me.string()),enum:Me.array(Me.string()),enumNames:Me.optional(Me.array(Me.string()))}).passthrough(),$Qn=Me.union([HQn,GQn,jQn,VQn]),WQn=tA.extend({method:Me.literal("elicitation/create"),params:e4.extend({message:Me.string(),requestedSchema:Me.object({type:Me.literal("object"),properties:Me.record(Me.string(),$Qn),required:Me.optional(Me.array(Me.string()))}).passthrough()})}),YQn=t4.extend({action:Me.enum(["accept","decline","cancel"]),content:Me.optional(Me.record(Me.string(),Me.unknown()))}),zQn=Me.object({type:Me.literal("ref/resource"),uri:Me.string()}).passthrough(),JQn=Me.object({type:Me.literal("ref/prompt"),name:Me.string()}).passthrough(),KQn=tA.extend({method:Me.literal("completion/complete"),params:e4.extend({ref:Me.union([JQn,zQn]),argument:Me.object({name:Me.string(),value:Me.string()}).passthrough(),context:Me.optional(Me.object({arguments:Me.optional(Me.record(Me.string(),Me.string()))}))})}),dqe=t4.extend({completion:Me.object({values:Me.array(Me.string()).max(100),total:Me.optional(Me.number().int()),hasMore:Me.optional(Me.boolean())}).passthrough()}),XQn=Me.object({uri:Me.string().startsWith("file://"),name:Me.optional(Me.string()),_meta:Me.optional(Me.object({}).passthrough())}).passthrough(),bme=tA.extend({method:Me.literal("roots/list")}),ZQn=t4.extend({roots:Me.array(XQn)}),eqn=mb.extend({method:Me.literal("notifications/roots/list_changed")}),jOo=Me.union([gme,fQn,KQn,kQn,wQn,SQn,mQn,gQn,AQn,EQn,vQn,OQn,NQn]),VOo=Me.union([mme,Ame,CUt,eqn]),$Oo=Me.union([sO,qQn,YQn,ZQn]),WOo=Me.union([gme,QQn,WQn,bme]),YOo=Me.union([mme,Ame,LQn,bQn,yQn,MQn,IQn]),zOo=Me.union([sO,nqe,dqe,bee,vee,oqe,sqe,aqe,vme,fqe]),Z6=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function RUt(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 tqn,Cme,BUt=Re(()=>{Ux();tqn=6e4,Cme=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(mme,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(Ame,r=>{this._onprogress(r)}),this.setRequestHandler(gme,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 Z6(X6.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),yee(c)||vUt(c)?this._onresponse(c):hme(c)?this._onrequest(c,u):AUt(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 Z6(X6.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:X6.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:X6.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),yee(e))n(e);else{let i=new Z6(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 N;this._responseHandlers.delete(A),this._progressHandlers.delete(A),this._cleanupTimeout(A),(N=this._transport)===null||N===void 0||N.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 N;if(!(!((N=n?.signal)===null||N===void 0)&&N.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:tqn,w=()=>v(new Z6(X6.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(A,S,n?.maxTotalTimeout,w,(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 OUt=B((_me,NUt)=>{(function(t,e){typeof _me=="object"&&typeof NUt<"u"?e(_me):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(_me,(function(t){"use strict";function e(){for(var lt=arguments.length,Je=Array(lt),dt=0;dt<lt;dt++)Je[dt]=arguments[dt];if(Je.length>1){Je[0]=Je[0].slice(0,-1);for(var xt=Je.length-1,mt=1;mt<xt;++mt)Je[mt]=Je[mt].slice(1,-1);return Je[xt]=Je[xt].slice(1),Je.join("")}else return Je[0]}function r(lt){return"(?:"+lt+")"}function n(lt){return lt===void 0?"undefined":lt===null?"null":Object.prototype.toString.call(lt).split(" ").pop().split("]").shift().toLowerCase()}function i(lt){return lt.toUpperCase()}function o(lt){return lt!=null?lt instanceof Array?lt:typeof lt.length!="number"||lt.split||lt.setInterval||lt.call?[lt]:Array.prototype.slice.call(lt):[]}function s(lt,Je){var dt=lt;if(Je)for(var xt in Je)dt[xt]=Je[xt];return dt}function a(lt){var Je="[A-Za-z]",dt="[\\x0D]",xt="[0-9]",mt="[\\x22]",mr=e(xt,"[A-Fa-f]"),Rr="[\\x0A]",Yr="[\\x20]",un=r(r("%[EFef]"+mr+"%"+mr+mr+"%"+mr+mr)+"|"+r("%[89A-Fa-f]"+mr+"%"+mr+mr)+"|"+r("%"+mr+mr)),fi="[\\:\\/\\?\\#\\[\\]\\@]",dn="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ci=e(fi,dn),Li=lt?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",vn=lt?"[\\uE000-\\uF8FF]":"[]",Di=e(Je,xt,"[\\-\\.\\_\\~]",Li),uo=r(Je+e(Je,xt,"[\\+\\-\\.]")+"*"),Yi=r(r(un+"|"+e(Di,dn,"[\\:]"))+"*"),Zl=r(r("25[0-5]")+"|"+r("2[0-4]"+xt)+"|"+r("1"+xt+xt)+"|"+r("[1-9]"+xt)+"|"+xt),Xs=r(r("25[0-5]")+"|"+r("2[0-4]"+xt)+"|"+r("1"+xt+xt)+"|"+r("0?[1-9]"+xt)+"|0?0?"+xt),Zs=r(Xs+"\\."+Xs+"\\."+Xs+"\\."+Xs),vi=r(mr+"{1,4}"),ns=r(r(vi+"\\:"+vi)+"|"+Zs),Ao=r(r(vi+"\\:")+"{6}"+ns),Ri=r("\\:\\:"+r(vi+"\\:")+"{5}"+ns),Oc=r(r(vi)+"?\\:\\:"+r(vi+"\\:")+"{4}"+ns),Ua=r(r(r(vi+"\\:")+"{0,1}"+vi)+"?\\:\\:"+r(vi+"\\:")+"{3}"+ns),Do=r(r(r(vi+"\\:")+"{0,2}"+vi)+"?\\:\\:"+r(vi+"\\:")+"{2}"+ns),pa=r(r(r(vi+"\\:")+"{0,3}"+vi)+"?\\:\\:"+vi+"\\:"+ns),ea=r(r(r(vi+"\\:")+"{0,4}"+vi)+"?\\:\\:"+ns),Ss=r(r(r(vi+"\\:")+"{0,5}"+vi)+"?\\:\\:"+vi),ol=r(r(r(vi+"\\:")+"{0,6}"+vi)+"?\\:\\:"),je=r([Ao,Ri,Oc,Ua,Do,pa,ea,Ss,ol].join("|")),$e=r(r(Di+"|"+un)+"+"),At=r(je+"\\%25"+$e),wt=r(je+r("\\%25|\\%(?!"+mr+"{2})")+$e),Rt=r("[vV]"+mr+"+\\."+e(Di,dn,"[\\:]")+"+"),rr=r("\\["+r(wt+"|"+je+"|"+Rt)+"\\]"),yr=r(r(un+"|"+e(Di,dn))+"*"),fr=r(rr+"|"+Zs+"(?!"+yr+")|"+yr),_r=r(xt+"*"),xr=r(r(Yi+"@")+"?"+fr+r("\\:"+_r)+"?"),Pr=r(un+"|"+e(Di,dn,"[\\:\\@]")),Sn=r(Pr+"*"),fo=r(Pr+"+"),ws=r(r(un+"|"+e(Di,dn,"[\\@]"))+"+"),Bi=r(r("\\/"+Sn)+"*"),sl=r("\\/"+r(fo+Bi)+"?"),ec=r(ws+Bi),Lf=r(fo+Bi),vl="(?!"+Pr+")",C1=r(Bi+"|"+sl+"|"+ec+"|"+Lf+"|"+vl),np=r(r(Pr+"|"+e("[\\/\\?]",vn))+"*"),ip=r(r(Pr+"|[\\/\\?]")+"*"),Fp=r(r("\\/\\/"+xr+Bi)+"|"+sl+"|"+Lf+"|"+vl),og=r(uo+"\\:"+Fp+r("\\?"+np)+"?"+r("\\#"+ip)+"?"),mf=r(r("\\/\\/"+xr+Bi)+"|"+sl+"|"+ec+"|"+vl),$c=r(mf+r("\\?"+np)+"?"+r("\\#"+ip)+"?"),Up=r(og+"|"+$c),Pu=r(uo+"\\:"+Fp+r("\\?"+np)+"?"),wh="^("+uo+")\\:"+r(r("\\/\\/("+r("("+Yi+")@")+"?("+fr+")"+r("\\:("+_r+")")+"?)")+"?("+Bi+"|"+sl+"|"+Lf+"|"+vl+")")+r("\\?("+np+")")+"?"+r("\\#("+ip+")")+"?$",yd="^(){0}"+r(r("\\/\\/("+r("("+Yi+")@")+"?("+fr+")"+r("\\:("+_r+")")+"?)")+"?("+Bi+"|"+sl+"|"+ec+"|"+vl+")")+r("\\?("+np+")")+"?"+r("\\#("+ip+")")+"?$",P0="^("+uo+")\\:"+r(r("\\/\\/("+r("("+Yi+")@")+"?("+fr+")"+r("\\:("+_r+")")+"?)")+"?("+Bi+"|"+sl+"|"+Lf+"|"+vl+")")+r("\\?("+np+")")+"?$",lu="^"+r("\\#("+ip+")")+"?$",ZA="^"+r("("+Yi+")@")+"?("+fr+")"+r("\\:("+_r+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",Je,xt,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Di,dn),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Di,dn),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Di,dn),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Di,dn),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Di,dn,"[\\:\\@\\/\\?]",vn),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Di,dn,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Di,dn),"g"),UNRESERVED:new RegExp(Di,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Di,Ci),"g"),PCT_ENCODED:new RegExp(un,"g"),IPV4ADDRESS:new RegExp("^("+Zs+")$"),IPV6ADDRESS:new RegExp("^\\[?("+je+")"+r(r("\\%25|\\%(?!"+mr+"{2})")+"("+$e+")")+"?\\]?$")}}var c=a(!1),u=a(!0),f=(function(){function lt(Je,dt){var xt=[],mt=!0,mr=!1,Rr=void 0;try{for(var Yr=Je[Symbol.iterator](),un;!(mt=(un=Yr.next()).done)&&(xt.push(un.value),!(dt&&xt.length===dt));mt=!0);}catch(fi){mr=!0,Rr=fi}finally{try{!mt&&Yr.return&&Yr.return()}finally{if(mr)throw Rr}}return xt}return function(Je,dt){if(Array.isArray(Je))return Je;if(Symbol.iterator in Object(Je))return lt(Je,dt);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=function(lt){if(Array.isArray(lt)){for(var Je=0,dt=Array(lt.length);Je<lt.length;Je++)dt[Je]=lt[Je];return dt}else return Array.from(lt)},p=2147483647,h=36,g=1,A=26,y=38,v=700,S=72,w=128,T="-",N=/^xn--/,P=/[^\0-\x7E]/,U=/[\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"},D=h-g,F=Math.floor,O=String.fromCharCode;function q(lt){throw new RangeError(Q[lt])}function L(lt,Je){for(var dt=[],xt=lt.length;xt--;)dt[xt]=Je(lt[xt]);return dt}function M(lt,Je){var dt=lt.split("@"),xt="";dt.length>1&&(xt=dt[0]+"@",lt=dt[1]),lt=lt.replace(U,".");var mt=lt.split("."),mr=L(mt,Je).join(".");return xt+mr}function j(lt){for(var Je=[],dt=0,xt=lt.length;dt<xt;){var mt=lt.charCodeAt(dt++);if(mt>=55296&&mt<=56319&&dt<xt){var mr=lt.charCodeAt(dt++);(mr&64512)==56320?Je.push(((mt&1023)<<10)+(mr&1023)+65536):(Je.push(mt),dt--)}else Je.push(mt)}return Je}var G=function(Je){return String.fromCodePoint.apply(String,d(Je))},W=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)},X=function(Je,dt,xt){var mt=0;for(Je=xt?F(Je/v):Je>>1,Je+=F(Je/dt);Je>D*A>>1;mt+=h)Je=F(Je/D);return F(mt+(D+1)*Je/(Je+y))},K=function(Je){var dt=[],xt=Je.length,mt=0,mr=w,Rr=S,Yr=Je.lastIndexOf(T);Yr<0&&(Yr=0);for(var un=0;un<Yr;++un)Je.charCodeAt(un)>=128&&q("not-basic"),dt.push(Je.charCodeAt(un));for(var fi=Yr>0?Yr+1:0;fi<xt;){for(var dn=mt,Ci=1,Li=h;;Li+=h){fi>=xt&&q("invalid-input");var vn=W(Je.charCodeAt(fi++));(vn>=h||vn>F((p-mt)/Ci))&&q("overflow"),mt+=vn*Ci;var Di=Li<=Rr?g:Li>=Rr+A?A:Li-Rr;if(vn<Di)break;var uo=h-Di;Ci>F(p/uo)&&q("overflow"),Ci*=uo}var Yi=dt.length+1;Rr=X(mt-dn,Yi,dn==0),F(mt/Yi)>p-mr&&q("overflow"),mr+=F(mt/Yi),mt%=Yi,dt.splice(mt++,0,mr)}return String.fromCodePoint.apply(String,dt)},me=function(Je){var dt=[];Je=j(Je);var xt=Je.length,mt=w,mr=0,Rr=S,Yr=!0,un=!1,fi=void 0;try{for(var dn=Je[Symbol.iterator](),Ci;!(Yr=(Ci=dn.next()).done);Yr=!0){var Li=Ci.value;Li<128&&dt.push(O(Li))}}catch(wt){un=!0,fi=wt}finally{try{!Yr&&dn.return&&dn.return()}finally{if(un)throw fi}}var vn=dt.length,Di=vn;for(vn&&dt.push(T);Di<xt;){var uo=p,Yi=!0,Zl=!1,Xs=void 0;try{for(var Zs=Je[Symbol.iterator](),vi;!(Yi=(vi=Zs.next()).done);Yi=!0){var ns=vi.value;ns>=mt&&ns<uo&&(uo=ns)}}catch(wt){Zl=!0,Xs=wt}finally{try{!Yi&&Zs.return&&Zs.return()}finally{if(Zl)throw Xs}}var Ao=Di+1;uo-mt>F((p-mr)/Ao)&&q("overflow"),mr+=(uo-mt)*Ao,mt=uo;var Ri=!0,Oc=!1,Ua=void 0;try{for(var Do=Je[Symbol.iterator](),pa;!(Ri=(pa=Do.next()).done);Ri=!0){var ea=pa.value;if(ea<mt&&++mr>p&&q("overflow"),ea==mt){for(var Ss=mr,ol=h;;ol+=h){var je=ol<=Rr?g:ol>=Rr+A?A:ol-Rr;if(Ss<je)break;var $e=Ss-je,At=h-je;dt.push(O($(je+$e%At,0))),Ss=F($e/At)}dt.push(O($(Ss,0))),Rr=X(mr,Ao,Di==vn),mr=0,++Di}}}catch(wt){Oc=!0,Ua=wt}finally{try{!Ri&&Do.return&&Do.return()}finally{if(Oc)throw Ua}}++mr,++mt}return dt.join("")},be=function(Je){return M(Je,function(dt){return N.test(dt)?K(dt.slice(4).toLowerCase()):dt})},ge=function(Je){return M(Je,function(dt){return P.test(dt)?"xn--"+me(dt):dt})},_e={version:"2.1.0",ucs2:{decode:j,encode:G},decode:K,encode:me,toASCII:ge,toUnicode:be},Se={};function pe(lt){var Je=lt.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(lt){for(var Je="",dt=0,xt=lt.length;dt<xt;){var mt=parseInt(lt.substr(dt+1,2),16);if(mt<128)Je+=String.fromCharCode(mt),dt+=3;else if(mt>=194&&mt<224){if(xt-dt>=6){var mr=parseInt(lt.substr(dt+4,2),16);Je+=String.fromCharCode((mt&31)<<6|mr&63)}else Je+=lt.substr(dt,6);dt+=6}else if(mt>=224){if(xt-dt>=9){var Rr=parseInt(lt.substr(dt+4,2),16),Yr=parseInt(lt.substr(dt+7,2),16);Je+=String.fromCharCode((mt&15)<<12|(Rr&63)<<6|Yr&63)}else Je+=lt.substr(dt,9);dt+=9}else Je+=lt.substr(dt,3),dt+=3}return Je}function ae(lt,Je){function dt(xt){var mt=Ae(xt);return mt.match(Je.UNRESERVED)?mt:xt}return lt.scheme&&(lt.scheme=String(lt.scheme).replace(Je.PCT_ENCODED,dt).toLowerCase().replace(Je.NOT_SCHEME,"")),lt.userinfo!==void 0&&(lt.userinfo=String(lt.userinfo).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_USERINFO,pe).replace(Je.PCT_ENCODED,i)),lt.host!==void 0&&(lt.host=String(lt.host).replace(Je.PCT_ENCODED,dt).toLowerCase().replace(Je.NOT_HOST,pe).replace(Je.PCT_ENCODED,i)),lt.path!==void 0&&(lt.path=String(lt.path).replace(Je.PCT_ENCODED,dt).replace(lt.scheme?Je.NOT_PATH:Je.NOT_PATH_NOSCHEME,pe).replace(Je.PCT_ENCODED,i)),lt.query!==void 0&&(lt.query=String(lt.query).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_QUERY,pe).replace(Je.PCT_ENCODED,i)),lt.fragment!==void 0&&(lt.fragment=String(lt.fragment).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_FRAGMENT,pe).replace(Je.PCT_ENCODED,i)),lt}function ie(lt){return lt.replace(/^0*(.*)/,"$1")||"0"}function de(lt,Je){var dt=lt.match(Je.IPV4ADDRESS)||[],xt=f(dt,2),mt=xt[1];return mt?mt.split(".").map(ie).join("."):lt}function re(lt,Je){var dt=lt.match(Je.IPV6ADDRESS)||[],xt=f(dt,3),mt=xt[1],mr=xt[2];if(mt){for(var Rr=mt.toLowerCase().split("::").reverse(),Yr=f(Rr,2),un=Yr[0],fi=Yr[1],dn=fi?fi.split(":").map(ie):[],Ci=un.split(":").map(ie),Li=Je.IPV4ADDRESS.test(Ci[Ci.length-1]),vn=Li?7:8,Di=Ci.length-vn,uo=Array(vn),Yi=0;Yi<vn;++Yi)uo[Yi]=dn[Yi]||Ci[Di+Yi]||"";Li&&(uo[vn-1]=de(uo[vn-1],Je));var Zl=uo.reduce(function(Ao,Ri,Oc){if(!Ri||Ri==="0"){var Ua=Ao[Ao.length-1];Ua&&Ua.index+Ua.length===Oc?Ua.length++:Ao.push({index:Oc,length:1})}return Ao},[]),Xs=Zl.sort(function(Ao,Ri){return Ri.length-Ao.length})[0],Zs=void 0;if(Xs&&Xs.length>1){var vi=uo.slice(0,Xs.index),ns=uo.slice(Xs.index+Xs.length);Zs=vi.join(":")+"::"+ns.join(":")}else Zs=uo.join(":");return mr&&(Zs+="%"+mr),Zs}else return lt}var oe=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,he="".match(/(){0}/)[1]===void 0;function ue(lt){var Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt={},xt=Je.iri!==!1?u:c;Je.reference==="suffix"&&(lt=(Je.scheme?Je.scheme+":":"")+"//"+lt);var mt=lt.match(oe);if(mt){he?(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=lt.indexOf("@")!==-1?mt[3]:void 0,dt.host=lt.indexOf("//")!==-1?mt[4]:void 0,dt.port=parseInt(mt[5],10),dt.path=mt[6]||"",dt.query=lt.indexOf("?")!==-1?mt[7]:void 0,dt.fragment=lt.indexOf("#")!==-1?mt[8]:void 0,isNaN(dt.port)&&(dt.port=lt.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?mt[4]:void 0)),dt.host&&(dt.host=re(de(dt.host,xt),xt)),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 mr=Se[(Je.scheme||dt.scheme||"").toLowerCase()];if(!Je.unicodeSupport&&(!mr||!mr.unicodeSupport)){if(dt.host&&(Je.domainHost||mr&&mr.domainHost))try{dt.host=_e.toASCII(dt.host.replace(xt.PCT_ENCODED,Ae).toLowerCase())}catch(Rr){dt.error=dt.error||"Host's domain name can not be converted to ASCII via punycode: "+Rr}ae(dt,c)}else ae(dt,xt);mr&&mr.parse&&mr.parse(dt,Je)}else dt.error=dt.error||"URI can not be parsed.";return dt}function J(lt,Je){var dt=Je.iri!==!1?u:c,xt=[];return lt.userinfo!==void 0&&(xt.push(lt.userinfo),xt.push("@")),lt.host!==void 0&&xt.push(re(de(String(lt.host),dt),dt).replace(dt.IPV6ADDRESS,function(mt,mr,Rr){return"["+mr+(Rr?"%25"+Rr:"")+"]"})),(typeof lt.port=="number"||typeof lt.port=="string")&&(xt.push(":"),xt.push(String(lt.port))),xt.length?xt.join(""):void 0}var Z=/^\.\.?\//,Te=/^\/\.(\/|$)/,ve=/^\/\.\.(\/|$)/,te=/^\/?(?:.|\n)*?(?=\/|$)/;function Ne(lt){for(var Je=[];lt.length;)if(lt.match(Z))lt=lt.replace(Z,"");else if(lt.match(Te))lt=lt.replace(Te,"/");else if(lt.match(ve))lt=lt.replace(ve,"/"),Je.pop();else if(lt==="."||lt==="..")lt="";else{var dt=lt.match(te);if(dt){var xt=dt[0];lt=lt.slice(xt.length),Je.push(xt)}else throw new Error("Unexpected dot segment condition")}return Je.join("")}function Qe(lt){var Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=Je.iri?u:c,xt=[],mt=Se[(Je.scheme||lt.scheme||"").toLowerCase()];if(mt&&mt.serialize&&mt.serialize(lt,Je),lt.host&&!dt.IPV6ADDRESS.test(lt.host)){if(Je.domainHost||mt&&mt.domainHost)try{lt.host=Je.iri?_e.toUnicode(lt.host):_e.toASCII(lt.host.replace(dt.PCT_ENCODED,Ae).toLowerCase())}catch(Yr){lt.error=lt.error||"Host's domain name can not be converted to "+(Je.iri?"Unicode":"ASCII")+" via punycode: "+Yr}}ae(lt,dt),Je.reference!=="suffix"&<.scheme&&(xt.push(lt.scheme),xt.push(":"));var mr=J(lt,Je);if(mr!==void 0&&(Je.reference!=="suffix"&&xt.push("//"),xt.push(mr),lt.path&<.path.charAt(0)!=="/"&&xt.push("/")),lt.path!==void 0){var Rr=lt.path;!Je.absolutePath&&(!mt||!mt.absolutePath)&&(Rr=Ne(Rr)),mr===void 0&&(Rr=Rr.replace(/^\/\//,"/%2F")),xt.push(Rr)}return lt.query!==void 0&&(xt.push("?"),xt.push(lt.query)),lt.fragment!==void 0&&(xt.push("#"),xt.push(lt.fragment)),xt.join("")}function qe(lt,Je){var dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},xt=arguments[3],mt={};return xt||(lt=ue(Qe(lt,dt),dt),Je=ue(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=Ne(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=Ne(Je.path||""),mt.query=Je.query):(Je.path?(Je.path.charAt(0)==="/"?mt.path=Ne(Je.path):((lt.userinfo!==void 0||lt.host!==void 0||lt.port!==void 0)&&!lt.path?mt.path="/"+Je.path:lt.path?mt.path=lt.path.slice(0,lt.path.lastIndexOf("/")+1)+Je.path:mt.path=Je.path,mt.path=Ne(mt.path)),mt.query=Je.query):(mt.path=lt.path,Je.query!==void 0?mt.query=Je.query:mt.query=lt.query),mt.userinfo=lt.userinfo,mt.host=lt.host,mt.port=lt.port),mt.scheme=lt.scheme),mt.fragment=Je.fragment,mt}function He(lt,Je,dt){var xt=s({scheme:"null"},dt);return Qe(qe(ue(lt,xt),ue(Je,xt),xt,!0),xt)}function le(lt,Je){return typeof lt=="string"?lt=Qe(ue(lt,Je),Je):n(lt)==="object"&&(lt=ue(Qe(lt,Je),Je)),lt}function Ie(lt,Je,dt){return typeof lt=="string"?lt=Qe(ue(lt,dt),dt):n(lt)==="object"&&(lt=Qe(lt,dt)),typeof Je=="string"?Je=Qe(ue(Je,dt),dt):n(Je)==="object"&&(Je=Qe(Je,dt)),lt===Je}function Oe(lt,Je){return lt&<.toString().replace(!Je||!Je.iri?c.ESCAPE:u.ESCAPE,pe)}function Le(lt,Je){return lt&<.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 xt=String(Je.scheme).toLowerCase()==="https";return(Je.port===(xt?443:80)||Je.port==="")&&(Je.port=void 0),Je.path||(Je.path="/"),Je}},nt={scheme:"https",domainHost:Ke.domainHost,parse:Ke.parse,serialize:Ke.serialize};function pt(lt){return typeof lt.secure=="boolean"?lt.secure:String(lt.scheme).toLowerCase()==="wss"}var vt={scheme:"ws",domainHost:!0,parse:function(Je,dt){var xt=Je;return xt.secure=pt(xt),xt.resourceName=(xt.path||"/")+(xt.query?"?"+xt.query:""),xt.path=void 0,xt.query=void 0,xt},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 xt=Je.resourceName.split("?"),mt=f(xt,2),mr=mt[0],Rr=mt[1];Je.path=mr&&mr!=="/"?mr:void 0,Je.query=Rr,Je.resourceName=void 0}return Je.fragment=void 0,Je}},It={scheme:"wss",domainHost:vt.domainHost,parse:vt.parse,serialize:vt.serialize},Ar={},Mr=!0,Fe="[A-Za-z0-9\\-\\.\\_\\~"+(Mr?"\\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)),Ht="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Lt="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Pt=e(Lt,'[\\"\\\\]'),Ft="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Zt=new RegExp(Fe,"g"),Jt=new RegExp(ut,"g"),an=new RegExp(e("[^]",Ht,"[\\.]",'[\\"]',Pt),"g"),Fr=new RegExp(e("[^]",Fe,Ft),"g"),en=Fr;function Zr(lt){var Je=Ae(lt);return Je.match(Zt)?Je:lt}var Xn={scheme:"mailto",parse:function(Je,dt){var xt=Je,mt=xt.to=xt.path?xt.path.split(","):[];if(xt.path=void 0,xt.query){for(var mr=!1,Rr={},Yr=xt.query.split("&"),un=0,fi=Yr.length;un<fi;++un){var dn=Yr[un].split("=");switch(dn[0]){case"to":for(var Ci=dn[1].split(","),Li=0,vn=Ci.length;Li<vn;++Li)mt.push(Ci[Li]);break;case"subject":xt.subject=Le(dn[1],dt);break;case"body":xt.body=Le(dn[1],dt);break;default:mr=!0,Rr[Le(dn[0],dt)]=Le(dn[1],dt);break}}mr&&(xt.headers=Rr)}xt.query=void 0;for(var Di=0,uo=mt.length;Di<uo;++Di){var Yi=mt[Di].split("@");if(Yi[0]=Le(Yi[0]),dt.unicodeSupport)Yi[1]=Le(Yi[1],dt).toLowerCase();else try{Yi[1]=_e.toASCII(Le(Yi[1],dt).toLowerCase())}catch(Zl){xt.error=xt.error||"Email address's domain name can not be converted to ASCII via punycode: "+Zl}mt[Di]=Yi.join("@")}return xt},serialize:function(Je,dt){var xt=Je,mt=o(Je.to);if(mt){for(var mr=0,Rr=mt.length;mr<Rr;++mr){var Yr=String(mt[mr]),un=Yr.lastIndexOf("@"),fi=Yr.slice(0,un).replace(Jt,Zr).replace(Jt,i).replace(an,pe),dn=Yr.slice(un+1);try{dn=dt.iri?_e.toUnicode(dn):_e.toASCII(Le(dn,dt).toLowerCase())}catch(Di){xt.error=xt.error||"Email address's domain name can not be converted to "+(dt.iri?"Unicode":"ASCII")+" via punycode: "+Di}mt[mr]=fi+"@"+dn}xt.path=mt.join(",")}var Ci=Je.headers=Je.headers||{};Je.subject&&(Ci.subject=Je.subject),Je.body&&(Ci.body=Je.body);var Li=[];for(var vn in Ci)Ci[vn]!==Ar[vn]&&Li.push(vn.replace(Jt,Zr).replace(Jt,i).replace(Fr,pe)+"="+Ci[vn].replace(Jt,Zr).replace(Jt,i).replace(en,pe));return Li.length&&(xt.query=Li.join("&")),xt}},Zn=/^([^\:]+)\:(.*)/,In={scheme:"urn",parse:function(Je,dt){var xt=Je.path&&Je.path.match(Zn),mt=Je;if(xt){var mr=dt.scheme||mt.scheme||"urn",Rr=xt[1].toLowerCase(),Yr=xt[2],un=mr+":"+(dt.nid||Rr),fi=Se[un];mt.nid=Rr,mt.nss=Yr,mt.path=void 0,fi&&(mt=fi.parse(mt,dt))}else mt.error=mt.error||"URN can not be parsed.";return mt},serialize:function(Je,dt){var xt=dt.scheme||Je.scheme||"urn",mt=Je.nid,mr=xt+":"+(dt.nid||mt),Rr=Se[mr];Rr&&(Je=Rr.serialize(Je,dt));var Yr=Je,un=Je.nss;return Yr.path=(mt||dt.nid)+":"+un,Yr}},co=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Wi={scheme:"urn:uuid",parse:function(Je,dt){var xt=Je;return xt.uuid=xt.nss,xt.nss=void 0,!dt.tolerant&&(!xt.uuid||!xt.uuid.match(co))&&(xt.error=xt.error||"UUID is not valid."),xt},serialize:function(Je,dt){var xt=Je;return xt.nss=(Je.uuid||"").toLowerCase(),xt}};Se[Ke.scheme]=Ke,Se[nt.scheme]=nt,Se[vt.scheme]=vt,Se[It.scheme]=It,Se[Xn.scheme]=Xn,Se[In.scheme]=In,Se[Wi.scheme]=Wi,t.SCHEMES=Se,t.pctEncChar=pe,t.pctDecChars=Ae,t.parse=ue,t.removeDotSegments=Ne,t.serialize=Qe,t.resolveComponents=qe,t.resolve=He,t.normalize=le,t.equal=Ie,t.escapeComponent=Oe,t.unescapeComponent=Le,Object.defineProperty(t,"__esModule",{value:!0})}))});var RH=B((ZOo,MUt)=>{"use strict";MUt.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 LUt=B((eMo,kUt)=>{"use strict";kUt.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 aO=B((tMo,UUt)=>{"use strict";UUt.exports={copy:rqn,checkDataType:pqe,checkDataTypes:nqn,coerceToTypes:iqn,toHash:mqe,getProperty:gqe,escapeQuotes:Aqe,equal:RH(),ucs2length:LUt(),varOccurences:aqn,varReplace:lqn,schemaHasRules:cqn,schemaHasRulesExcept:uqn,schemaUnknownRules:fqn,toQuotedString:hqe,getPathExpr:dqn,getPath:pqn,getData:gqn,unescapeFragment:Aqn,unescapeJsonPointer:Eqe,escapeFragment:yqn,escapeJsonPointer:yqe};function rqn(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function pqe(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 nqn(t,e,r){switch(t.length){case 1:return pqe(t[0],e,r,!0);default:var n="",i=mqe(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?" && ":"")+pqe(o,e,r,!0);return n}}var PUt=mqe(["string","number","integer","boolean","null"]);function iqn(t,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var i=e[n];(PUt[i]||t==="array"&&i==="array")&&(r[r.length]=i)}if(r.length)return r}else{if(PUt[e])return[e];if(t==="array"&&e==="array")return["array"]}}function mqe(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var oqn=/^[a-z$_][a-z$_0-9]*$/i,sqn=/'|\\/g;function gqe(t){return typeof t=="number"?"["+t+"]":oqn.test(t)?"."+t:"['"+Aqe(t)+"']"}function Aqe(t){return t.replace(sqn,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function aqn(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function lqn(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function cqn(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function uqn(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var n in t)if(n!=r&&e[n])return!0}function fqn(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function hqe(t){return"'"+Aqe(t)+"'"}function dqn(t,e,r,n){var i=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return FUt(t,i)}function pqn(t,e,r){var n=hqe(r?"/"+yqe(e):gqe(e));return FUt(t,n)}var hqn=/^\/(?:[^~]|~0|~1)*$/,mqn=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function gqn(t,e,r){var n,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!hqn.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(mqn),!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+=gqe(Eqe(f)),a+=" && "+o)}return a}function FUt(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Aqn(t){return Eqe(decodeURIComponent(t))}function yqn(t){return encodeURIComponent(yqe(t))}function yqe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Eqe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var vqe=B((rMo,QUt)=>{"use strict";var Eqn=aO();QUt.exports=vqn;function vqn(t){Eqn.copy(t,this)}});var HUt=B((nMo,qUt)=>{"use strict";var Qx=qUt.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(){};Sme(e,n,i,t,"",t)};Qx.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Qx.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Qx.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Qx.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 Sme(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 Qx.arrayKeywords)for(var p=0;p<d.length;p++)Sme(t,e,r,d[p],i+"/"+f+"/"+p,o,i,f,n,p)}else if(f in Qx.propsKeywords){if(d&&typeof d=="object")for(var h in d)Sme(t,e,r,d[h],i+"/"+f+"/"+bqn(h),o,i,f,n,h)}else(f in Qx.keywords||t.allKeys&&!(f in Qx.skipKeywords))&&Sme(t,e,r,d,i+"/"+f,o,i,f,n)}r(n,i,o,s,a,c,u)}}function bqn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Rme=B((iMo,$Ut)=>{"use strict";var Cee=OUt(),GUt=RH(),Dme=aO(),wme=vqe(),Cqn=HUt();$Ut.exports=Hx;Hx.normalizeId=qx;Hx.fullPath=xme;Hx.url=Tme;Hx.ids=Tqn;Hx.inlineRef=bqe;Hx.schema=Ime;function Hx(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return Hx.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof wme)return bqe(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var i=Ime.call(this,e,r),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof wme?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=bqe(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function Ime(t,e){var r=Cee.parse(e),n=VUt(r),i=xme(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==i){var o=qx(n),s=this._refs[o];if(typeof s=="string")return _qn.call(this,t,s,r);if(s instanceof wme)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof wme){if(s.validate||this._compile(s),o==qx(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=xme(this._getId(t.schema))}return jUt.call(this,r,i,t.schema,t)}function _qn(t,e,r){var n=Ime.call(this,t,e);if(n){var i=n.schema,o=n.baseId;t=n.root;var s=this._getId(i);return s&&(o=Tme(o,s)),jUt.call(this,r,o,i,t)}}var Sqn=Dme.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function jUt(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=Dme.unescapeFragment(s),r=r[s],r===void 0)break;var a;if(!Sqn[s]&&(a=this._getId(r),a&&(e=Tme(e,a)),r.$ref)){var c=Tme(e,r.$ref),u=Ime.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 wqn=Dme.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function bqe(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return Cqe(t);if(e)return _qe(t)<=e}function Cqe(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!Cqe(e))return!1}else for(var n in t)if(n=="$ref"||(e=t[n],typeof e=="object"&&!Cqe(e)))return!1;return!0}function _qe(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+=_qe(r)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(wqn[i])e++;else if(r=t[i],typeof r=="object"&&(e+=_qe(r)+1),e==1/0)return 1/0}return e}function xme(t,e){e!==!1&&(t=qx(t));var r=Cee.parse(t);return VUt(r)}function VUt(t){return Cee.serialize(t).split("#")[0]+"#"}var xqn=/#\/?$/;function qx(t){return t?t.replace(xqn,""):""}function Tme(t,e){return e=qx(e),Cee.resolve(t,e)}function Tqn(t){var e=qx(this._getId(t)),r={"":e},n={"":xme(e,!1)},i={},o=this;return Cqn(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:Dme.escapeFragment(p))),typeof h=="string"){h=g=qx(g?Cee.resolve(g,h):h);var y=o._refs[h];if(typeof y=="string"&&(y=o._refs[y]),y&&y.schema){if(!GUt(s,y.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=qx(A))if(h[0]=="#"){if(i[h]&&!GUt(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 Bme=B((oMo,YUt)=>{"use strict";var Sqe=Rme();YUt.exports={Validation:WUt(Dqn),MissingRef:WUt(wqe)};function Dqn(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}wqe.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function wqe(t,e,r){this.message=r||wqe.message(t,e),this.missingRef=Sqe.url(t,e),this.missingSchema=Sqe.normalizeId(Sqe.fullPath(this.missingRef))}function WUt(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var xqe=B((sMo,zUt)=>{"use strict";zUt.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 Tqe=B((aMo,JUt)=>{"use strict";JUt.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,N=!e.opts.allErrors,Q,A="data"+(d||""),T="valid"+f;if(e.schema===!1){e.isTop?N=!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&&N?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 w="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(w);else throw new Error(w)}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,N=!e.opts.allErrors,P="",U="",Q,D=e.schema.type,F=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(F?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],F=!0)),F&&D.length==1&&(D=D[0],F=!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")),D){if(e.opts.coerceTypes)var O=e.util.coerceToTypes(e.opts.coerceTypes,D);var q=e.RULES.types[D];if(O||F||q===!0||q&&!te(q)){var h=e.schemaPath+".type",g=e.errSchemaPath+"/type",h=e.schemaPath+".type",g=e.errSchemaPath+"/type",L=F?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[L](D,A,e.opts.strictNumbers,!0)+") { ",O){var M="dataType"+f,j="coerced"+f;i+=" var "+M+" = typeof "+A+"; var "+j+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+M+" == 'object' && Array.isArray("+A+") && "+A+".length == 1) { "+A+" = "+A+"[0]; "+M+" = typeof "+A+"; if ("+e.util.checkDataType(e.schema.type,A,e.opts.strictNumbers)+") "+j+" = "+A+"; } "),i+=" if ("+j+" !== undefined) ; ";var G=O;if(G)for(var W,$=-1,X=G.length-1;$<X;)W=G[$+=1],W=="string"?i+=" else if ("+M+" == 'number' || "+M+" == 'boolean') "+j+" = '' + "+A+"; else if ("+A+" === null) "+j+" = ''; ":W=="number"||W=="integer"?(i+=" else if ("+M+" == 'boolean' || "+A+" === null || ("+M+" == 'string' && "+A+" && "+A+" == +"+A+" ",W=="integer"&&(i+=" && !("+A+" % 1)"),i+=")) "+j+" = +"+A+"; "):W=="boolean"?i+=" else if ("+A+" === 'false' || "+A+" === 0 || "+A+" === null) "+j+" = false; else if ("+A+" === 'true' || "+A+" === 1) "+j+" = true; ":W=="null"?i+=" else if ("+A+" === '' || "+A+" === 0 || "+A+" === false) "+j+" = null; ":e.opts.coerceTypes=="array"&&W=="array"&&(i+=" else if ("+M+" == 'string' || "+M+" == 'number' || "+M+" == 'boolean' || "+A+" == null) "+j+" = ["+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: '",F?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?i+=""+D.join(","):i+=""+D,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&&N?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 ("+j+" !== undefined) { ";var K=d?"data"+(d-1||""):"parentData",me=d?e.dataPathArr[d]:"parentDataProperty";i+=" "+A+" = "+j+"; ",d||(i+="if ("+K+" !== undefined)"),i+=" "+K+"["+me+"] = "+j+"; } "}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: '",F?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?i+=""+D.join(","):i+=""+D,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&&N?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")+" ",N&&(i+=" } if (errors === ",S?i+="0":i+="errs_"+f,i+=") { ",U+="}");else{var be=e.RULES;if(be){for(var q,ge=-1,_e=be.length-1;ge<_e;)if(q=be[ge+=1],te(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),pe=Se;if(pe)for(var Ae,ae=-1,ie=pe.length-1;ae<ie;){Ae=pe[ae+=1];var de=p[Ae];if(de.default!==void 0){var re=A+e.util.getProperty(Ae);if(e.compositeRule){if(e.opts.strictDefaults){var w="default is ignored for: "+re;if(e.opts.strictDefaults==="log")e.logger.warn(w);else throw new Error(w)}}else i+=" if ("+re+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+re+" === null || "+re+" === '' "),i+=" ) "+re+" = ",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 oe=e.schema.items;if(oe){for(var de,$=-1,he=oe.length-1;$<he;)if(de=oe[$+=1],de.default!==void 0){var re=A+"["+$+"]";if(e.compositeRule){if(e.opts.strictDefaults){var w="default is ignored for: "+re;if(e.opts.strictDefaults==="log")e.logger.warn(w);else throw new Error(w)}}else i+=" if ("+re+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+re+" === null || "+re+" === '' "),i+=" ) "+re+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(de.default)+" ":i+=" "+JSON.stringify(de.default)+" ",i+="; "}}}}var ue=q.rules;if(ue){for(var J,Z=-1,Te=ue.length-1;Z<Te;)if(J=ue[Z+=1],Ne(J)){var ve=J.code(e,J.keyword,q.type);ve&&(i+=" "+ve+" ",N&&(P+="}"))}}if(N&&(i+=" "+P+" ",P=""),q.type&&(i+=" } ",D&&D===q.type&&!O)){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: '",F?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?i+=""+D.join(","):i+=""+D,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&&N?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+=" } "}N&&(i+=" if (errors === ",S?i+="0":i+="errs_"+f,i+=") { ",U+="}")}}}N&&(i+=" "+U+" "),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 te(qe){for(var He=qe.rules,le=0;le<He.length;le++)if(Ne(He[le]))return!0}function Ne(qe){return e.schema[qe.keyword]!==void 0||qe.implements&&Qe(qe)}function Qe(qe){for(var He=qe.implements,le=0;le<He.length;le++)if(e.schema[He[le]]!==void 0)return!0}return i}});var tQt=B((lMo,eQt)=>{"use strict";var Nme=Rme(),Mme=aO(),XUt=Bme(),Iqn=xqe(),KUt=Tqe(),Rqn=Mme.ucs2length,Bqn=RH(),Nqn=XUt.Validation;eQt.exports=Dqe;function Dqe(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=Oqn.call(this,t,e,n),g=this._compilations[h.index];if(h.compiling)return g.callValidate=w;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{Mqn.call(this,t,e,n)}function w(){var L=g.validate,M=L.apply(this,arguments);return w.errors=L.errors,M}function T(L,M,j,G){var W=!M||M&&M.schema==L;if(M.schema!=e.schema)return Dqe.call(i,L,M,j,G);var $=L.$async===!0,X=KUt({isTop:!0,schema:L,isRoot:W,baseId:G,root:M,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:XUt.MissingRef,RULES:y,validate:KUt,util:Mme,resolve:Nme,resolveRef:N,usePattern:F,useDefault:O,useCustomRule:q,opts:o,formats:A,logger:i.logger,self:i});X=Ome(s,Pqn)+Ome(c,kqn)+Ome(f,Lqn)+Ome(p,Fqn)+X,o.processCode&&(X=o.processCode(X,L));var K;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",X);K=me(i,y,A,e,s,f,p,Bqn,Rqn,Nqn),s[0]=K}catch(be){throw i.logger.error("Error compiling schema, function code:",X),be}return K.schema=L,K.errors=null,K.refs=a,K.refVal=s,K.root=W?K:M,$&&(K.$async=!0),o.sourceCode===!0&&(K.source={code:X,patterns:c,defaults:f}),K}function N(L,M,j){M=Nme.url(L,M);var G=a[M],W,$;if(G!==void 0)return W=s[G],$="refVal["+G+"]",D(W,$);if(!j&&e.refs){var X=e.refs[M];if(X!==void 0)return W=e.refVal[X],$=P(M,W),D(W,$)}$=P(M);var K=Nme.call(i,T,e,M);if(K===void 0){var me=r&&r[M];me&&(K=Nme.inlineRef(me,o.inlineRefs)?me:Dqe.call(i,me,e,r,L))}if(K===void 0)U(M);else return Q(M,K),D(K,$)}function P(L,M){var j=s.length;return s[j]=M,a[L]=j,"refVal"+j}function U(L){delete a[L]}function Q(L,M){var j=a[L];s[j]=M}function D(L,M){return typeof L=="object"||typeof L=="boolean"?{code:M,schema:L,inline:!0}:{code:M,$async:L&&!!L.$async}}function F(L){var M=u[L];return M===void 0&&(M=u[L]=c.length,c[M]=L),"pattern"+M}function O(L){switch(typeof L){case"boolean":case"number":return""+L;case"string":return Mme.toQuotedString(L);case"object":if(L===null)return"null";var M=Iqn(L),j=d[M];return j===void 0&&(j=d[M]=f.length,f[j]=L),"default"+j}}function q(L,M,j,G){if(i._opts.validateSchema!==!1){var W=L.definition.dependencies;if(W&&!W.every(function(pe){return Object.prototype.hasOwnProperty.call(j,pe)}))throw new Error("parent schema must have all required keywords: "+W.join(","));var $=L.definition.validateSchema;if($){var X=$(M);if(!X){var K="keyword schema is invalid: "+i.errorsText($.errors);if(i._opts.validateSchema=="log")i.logger.error(K);else throw new Error(K)}}}var me=L.definition.compile,be=L.definition.inline,ge=L.definition.macro,_e;if(me)_e=me.call(i,M,j,G);else if(ge)_e=ge.call(i,M,j,G),o.validateSchema!==!1&&i.validateSchema(_e,!0);else if(be)_e=be.call(i,G,L.keyword,M,j);else if(_e=L.definition.validate,!_e)return;if(_e===void 0)throw new Error('custom keyword "'+L.keyword+'"failed to compile');var Se=p.length;return p[Se]=_e,{code:"customRule"+Se,validate:_e}}}function Oqn(t,e,r){var n=ZUt.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 Mqn(t,e,r){var n=ZUt.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function ZUt(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 kqn(t,e){return"var pattern"+t+" = new RegExp("+Mme.toQuotedString(e[t])+");"}function Lqn(t){return"var default"+t+" = defaults["+t+"];"}function Pqn(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function Fqn(t){return"var customRule"+t+" = customRules["+t+"];"}function Ome(t,e){if(!t.length)return"";for(var r="",n=0;n<t.length;n++)r+=e(n,t);return r}});var nQt=B((cMo,rQt)=>{"use strict";var kme=rQt.exports=function(){this._cache={}};kme.prototype.put=function(e,r){this._cache[e]=r};kme.prototype.get=function(e){return this._cache[e]};kme.prototype.del=function(e){delete this._cache[e]};kme.prototype.clear=function(){this._cache={}}});var mQt=B((uMo,hQt)=>{"use strict";var Uqn=aO(),Qqn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,qqn=[0,31,28,31,30,31,30,31,31,30,31,30,31],Hqn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,iQt=/^(?=.{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,Gqn=/^(?:[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,jqn=/^(?:[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,oQt=/^(?:(?:[^\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,sQt=/^(?:(?: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,aQt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,lQt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,cQt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,uQt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;hQt.exports=Lme;function Lme(t){return t=t=="full"?"full":"fast",Uqn.copy(Lme[t])}Lme.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":oQt,url:sQt,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:iQt,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:pQt,uuid:aQt,"json-pointer":lQt,"json-pointer-uri-fragment":cQt,"relative-json-pointer":uQt};Lme.full={date:fQt,time:dQt,"date-time":Wqn,uri:zqn,"uri-reference":jqn,"uri-template":oQt,url:sQt,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:iQt,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:pQt,uuid:aQt,"json-pointer":lQt,"json-pointer-uri-fragment":cQt,"relative-json-pointer":uQt};function Vqn(t){return t%4===0&&(t%100!==0||t%400===0)}function fQt(t){var e=t.match(Qqn);if(!e)return!1;var r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&Vqn(r)?29:qqn[n])}function dQt(t,e){var r=t.match(Hqn);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 $qn=/t|\s/i;function Wqn(t){var e=t.split($qn);return e.length==2&&fQt(e[0])&&dQt(e[1],!0)}var Yqn=/\/|:/;function zqn(t){return Yqn.test(t)&&Gqn.test(t)}var Jqn=/[^\\]\\Z/;function pQt(t){if(Jqn.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var AQt=B((fMo,gQt)=>{"use strict";gQt.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 w="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 ("+w+") { ")}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 N=s?"data"+(s-1||""):"parentData",P=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+N+" , "+P+", rootData) ";var U=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 "+U+"; ",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 (!"+U+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var EQt=B((dMo,yQt)=>{"use strict";yQt.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 bQt=B((pMo,vQt)=>{"use strict";vQt.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 w=e.compositeRule;e.compositeRule=g.compositeRule=!0;var T=a;if(T)for(var N,P=-1,U=T.length-1;P<U;)N=T[P+=1],g.schema=N,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=w,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 _Qt=B((hMo,CQt)=>{"use strict";CQt.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 wQt=B((mMo,SQt)=>{"use strict";SQt.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 TQt=B((gMo,xQt)=>{"use strict";xQt.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,w="data"+S,T=e.baseId,N=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+";",N){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 U=d+"["+v+"]";g.dataPathArr[S]=v;var Q=e.validate(g);g.baseId=T,e.util.varOccurences(Q,w)<2?i+=" "+e.util.varReplace(Q,w,U)+" ":i+=" var "+w+" = "+U+"; "+Q+" ",i+=" if ("+y+") break; } ",e.compositeRule=g.compositeRule=P,i+=" "+A+" if (!"+y+") {"}else i+=" if ("+d+".length == 0) {";var D=D||[];D.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 F=i;return i=D.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 { ",N&&(i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var IQt=B((AMo,DQt)=>{"use strict";DQt.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 w=a[P],T=Array.isArray(w)?v:y;T[P]=w}i+="var "+p+" = errors;";var N=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 U=T;if(U)for(var Q,D=-1,F=U.length-1;D<F;){Q=U[D+=1],D&&(i+=" || ");var O=e.util.getProperty(Q),q=d+O;i+=" ( ( "+q+" === undefined ",S&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(Q)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?Q:O)+") ) "}i+=")) { ";var L="missing"+o,M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(N,L,!0):N+" + "+L);var j=j||[];j.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: '"+M+"', 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=j.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 W=T;if(W)for(var Q,$=-1,X=W.length-1;$<X;){Q=W[$+=1];var O=e.util.getProperty(Q),M=e.util.escapeQuotes(Q),q=d+O;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(N,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: '"+M+"', 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=N;var K=h.baseId;for(var P in y){var w=y[P];(e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,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=w,h.schemaPath=c+e.util.getProperty(P),h.errSchemaPath=u+"/"+e.util.escapeFragment(P),i+=" "+e.validate(h)+" ",h.baseId=K,i+=" } ",f&&(i+=" if ("+A+") { ",g+="}"))}return f&&(i+=" "+g+" if ("+p+" == errors) {"),i}});var BQt=B((yMo,RQt)=>{"use strict";RQt.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 OQt=B((EMo,NQt)=>{"use strict";NQt.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 w=y.async===!0;y=y.validate}if(S!=n)return f&&(i+=" if (true) { "),i;if(w){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 N=N||[];N.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=N.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 kQt=B((vMo,MQt)=>{"use strict";MQt.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)),w=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||w){var N;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&&w?(N="ifClause"+o,i+=" var "+N+" = 'then'; "):N="'then'",i+=" } ",w&&(i+=" else { ")):i+=" if (!"+A+") { ",w&&(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&&w?(N="ifClause"+o,i+=" var "+N+" = 'else'; "):N="'else'",i+=" } "),i+=" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+N+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+N+` + '" 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 PQt=B((bMo,LQt)=>{"use strict";LQt.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,w="data"+S,T=e.baseId;if(i+="var "+h+" = errors;var "+p+";",Array.isArray(a)){var N=e.schema.additionalItems;if(N===!1){i+=" "+p+" = "+d+".length <= "+a.length+"; ";var P=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+p+") { ";var U=U||[];U.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=U.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 D=a;if(D){for(var F,O=-1,q=D.length-1;O<q;)if(F=D[O+=1],e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all)){i+=" "+y+" = true; if ("+d+".length > "+O+") { ";var L=d+"["+O+"]";g.schema=F,g.schemaPath=c+"["+O+"]",g.errSchemaPath=u+"/"+O,g.errorPath=e.util.getPathExpr(e.errorPath,O,e.opts.jsonPointers,!0),g.dataPathArr[S]=O;var M=e.validate(g);g.baseId=T,e.util.varOccurences(M,w)<2?i+=" "+e.util.varReplace(M,w,L)+" ":i+=" var "+w+" = "+L+"; "+M+" ",i+=" } ",f&&(i+=" if ("+y+") { ",A+="}")}}if(typeof N=="object"&&(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))){g.schema=N,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 L=d+"["+v+"]";g.dataPathArr[S]=v;var M=e.validate(g);g.baseId=T,e.util.varOccurences(M,w)<2?i+=" "+e.util.varReplace(M,w,L)+" ":i+=" var "+w+" = "+L+"; "+M+" ",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 L=d+"["+v+"]";g.dataPathArr[S]=v;var M=e.validate(g);g.baseId=T,e.util.varOccurences(M,w)<2?i+=" "+e.util.varReplace(M,w,L)+" ":i+=" var "+w+" = "+L+"; "+M+" ",f&&(i+=" if (!"+y+") break; "),i+=" }"}return f&&(i+=" "+A+" if ("+h+" == errors) {"),i}});var Iqe=B((CMo,FQt)=>{"use strict";FQt.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?"<":">",w=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 N=e.util.getData(y.$data,s,e.dataPathArr),P="exclusive"+o,U="exclType"+o,Q="exclIsNumber"+o,D="op"+o,F="' + "+D+" + '";i+=" var schemaExcl"+o+" = "+N+"; ",N="schemaExcl"+o,i+=" var "+P+"; var "+U+" = typeof "+N+"; if ("+U+" != 'boolean' && "+U+" != 'undefined' && "+U+" != 'number') { ";var T=A,O=O||[];O.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=O.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+=" "+U+" == 'number' ? ( ("+P+" = "+h+" === undefined || "+N+" "+S+"= "+h+") ? "+d+" "+w+"= "+N+" : "+d+" "+w+" "+h+" ) : ( ("+P+" = "+N+" === true) ? "+d+" "+w+"= "+h+" : "+d+" "+w+" "+h+" ) || "+d+" !== "+d+") { var op"+o+" = "+P+" ? '"+S+"' : '"+S+"='; ",a===void 0&&(T=A,u=e.errSchemaPath+"/"+A,h=N,p=v)}else{var Q=typeof y=="number",F=S;if(Q&&p){var D="'"+F+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" ( "+h+" === undefined || "+y+" "+S+"= "+h+" ? "+d+" "+w+"= "+y+" : "+d+" "+w+" "+h+" ) || "+d+" !== "+d+") { "}else{Q&&a===void 0?(P=!0,T=A,u=e.errSchemaPath+"/"+A,h=y,w+="="):(Q&&(h=Math[g?"min":"max"](y,a)),y===(Q?h:!0)?(P=!0,T=A,u=e.errSchemaPath+"/"+A,w+="="):(P=!1,F+="="));var D="'"+F+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+d+" "+w+" "+h+" || "+d+" !== "+d+") { "}}T=T||r;var O=O||[];O.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+D+", limit: "+h+", exclusive: "+P+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+F+" ",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=O.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 Rqe=B((_Mo,UQt)=>{"use strict";UQt.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 Bqe=B((SMo,QQt)=>{"use strict";QQt.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 Nqe=B((wMo,qQt)=>{"use strict";qQt.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 GQt=B((xMo,HQt)=>{"use strict";HQt.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 VQt=B((TMo,jQt)=>{"use strict";jQt.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 WQt=B((DMo,$Qt)=>{"use strict";$Qt.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,w="passingSchemas"+o;i+="var "+h+" = errors , "+S+" = false , "+p+" = false , "+w+" = null; ";var T=e.compositeRule;e.compositeRule=g.compositeRule=!0;var N=a;if(N)for(var P,U=-1,Q=N.length-1;U<Q;)P=N[U+=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+"["+U+"]",g.errSchemaPath=u+"/"+U,i+=" "+e.validate(g)+" ",g.baseId=v):i+=" var "+y+" = true; ",U&&(i+=" if ("+y+" && "+S+") { "+p+" = false; "+w+" = ["+w+", "+U+"]; } else { ",A+="}"),i+=" if ("+y+") { "+p+" = "+S+" = true; "+w+" = "+U+"; }";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: "+w+" } ",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 zQt=B((IMo,YQt)=>{"use strict";YQt.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 KQt=B((RMo,JQt)=>{"use strict";JQt.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,w="data"+S,T="dataProperties"+o,N=Object.keys(a||{}).filter($),P=e.schema.patternProperties||{},U=Object.keys(P).filter($),Q=e.schema.additionalProperties,D=N.length||U.length,F=Q===!1,O=typeof Q=="object"&&Object.keys(Q).length,q=e.opts.removeAdditional,L=F||O||q,M=e.opts.ownProperties,j=e.baseId,G=e.schema.required;if(G&&!(e.opts.$data&&G.$data)&&G.length<e.opts.loopRequired)var W=e.util.toHash(G);function $(Le){return Le!=="__proto__"}if(i+="var "+p+" = errors;var "+A+" = true;",M&&(i+=" var "+T+" = undefined;"),L){if(M?i+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+T+".length; "+v+"++) { var "+y+" = "+T+"["+v+"]; ":i+=" for (var "+y+" in "+d+") { ",D){if(i+=" var isAdditional"+o+" = !(false ",N.length)if(N.length>8)i+=" || validate.schema"+c+".hasOwnProperty("+y+") ";else{var X=N;if(X)for(var K,me=-1,be=X.length-1;me<be;)K=X[me+=1],i+=" || "+y+" == "+e.util.toQuotedString(K)+" "}if(U.length){var ge=U;if(ge)for(var _e,Se=-1,pe=ge.length-1;Se<pe;)_e=ge[Se+=1],i+=" || "+e.usePattern(_e)+".test("+y+") "}i+=" ); if (isAdditional"+o+") { "}if(q=="all")i+=" delete "+d+"["+y+"]; ";else{var Ae=e.errorPath,ae="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),F)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: '"+ae+"' } ",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 re=i;i=de.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+re+"]); ":i+=" validate.errors = ["+re+"]; return false; ":i+=" var err = "+re+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ie,f&&(i+=" break; ")}else if(O)if(q=="failing"){i+=" var "+p+" = errors; ";var oe=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 he=d+"["+y+"]";h.dataPathArr[S]=y;var ue=e.validate(h);h.baseId=j,e.util.varOccurences(ue,w)<2?i+=" "+e.util.varReplace(ue,w,he)+" ":i+=" var "+w+" = "+he+"; "+ue+" ",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=oe}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 he=d+"["+y+"]";h.dataPathArr[S]=y;var ue=e.validate(h);h.baseId=j,e.util.varOccurences(ue,w)<2?i+=" "+e.util.varReplace(ue,w,he)+" ":i+=" var "+w+" = "+he+"; "+ue+" ",f&&(i+=" if (!"+A+") break; ")}e.errorPath=Ae}D&&(i+=" } "),i+=" } ",f&&(i+=" if ("+A+") { ",g+="}")}var J=e.opts.useDefaults&&!e.compositeRule;if(N.length){var Z=N;if(Z)for(var K,Te=-1,ve=Z.length-1;Te<ve;){K=Z[Te+=1];var te=a[K];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){var Ne=e.util.getProperty(K),he=d+Ne,Qe=J&&te.default!==void 0;h.schema=te,h.schemaPath=c+Ne,h.errSchemaPath=u+"/"+e.util.escapeFragment(K),h.errorPath=e.util.getPath(e.errorPath,K,e.opts.jsonPointers),h.dataPathArr[S]=e.util.toQuotedString(K);var ue=e.validate(h);if(h.baseId=j,e.util.varOccurences(ue,w)<2){ue=e.util.varReplace(ue,w,he);var qe=he}else{var qe=w;i+=" var "+w+" = "+he+"; "}if(Qe)i+=" "+ue+" ";else{if(W&&W[K]){i+=" if ( "+qe+" === undefined ",M&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(K)+"') "),i+=") { "+A+" = false; ";var Ae=e.errorPath,ie=u,He=e.util.escapeQuotes(K);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ae,K,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: '"+He+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+He+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var re=i;i=de.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+re+"]); ":i+=" validate.errors = ["+re+"]; return false; ":i+=" var err = "+re+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ie,e.errorPath=Ae,i+=" } else { "}else f?(i+=" if ( "+qe+" === undefined ",M&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(K)+"') "),i+=") { "+A+" = true; } else { "):(i+=" if ("+qe+" !== undefined ",M&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(K)+"') "),i+=" ) { ");i+=" "+ue+" } "}}f&&(i+=" if ("+A+") { ",g+="}")}}if(U.length){var le=U;if(le)for(var _e,Ie=-1,Oe=le.length-1;Ie<Oe;){_e=le[Ie+=1];var te=P[_e];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){h.schema=te,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(_e),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(_e),M?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 he=d+"["+y+"]";h.dataPathArr[S]=y;var ue=e.validate(h);h.baseId=j,e.util.varOccurences(ue,w)<2?i+=" "+e.util.varReplace(ue,w,he)+" ":i+=" var "+w+" = "+he+"; "+ue+" ",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 ZQt=B((BMo,XQt)=>{"use strict";XQt.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,w="' + "+y+" + '",T=h.dataLevel=e.dataLevel+1,N="data"+T,P="dataProperties"+o,U=e.opts.ownProperties,Q=e.baseId;U&&(i+=" var "+P+" = undefined; "),U?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 D=y,F=e.compositeRule;e.compositeRule=h.compositeRule=!0;var O=e.validate(h);h.baseId=Q,e.util.varOccurences(O,N)<2?i+=" "+e.util.varReplace(O,N,D)+" ":i+=" var "+N+" = "+D+"; "+O+" ",e.compositeRule=h.compositeRule=F,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: '"+w+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+w+"\\' 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 tqt=B((NMo,eqt)=>{"use strict";eqt.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,w=-1,T=v.length-1;w<T;){S=v[w+=1];var N=e.schema.properties[S];N&&(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))||(y[y.length]=S)}}else var y=a;if(h||y.length){var P=e.errorPath,U=h||y.length>=e.opts.loopRequired,Q=e.opts.ownProperties;if(f)if(i+=" var missing"+o+"; ",U){h||(i+=" var "+A+" = validate.schema"+c+"; ");var D="i"+o,F="schema"+o+"["+D+"]",O="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(P,F,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 "+D+" = 0; "+D+" < "+A+".length; "+D+"++) { "+p+" = "+d+"["+A+"["+D+"]] !== undefined ",Q&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", "+A+"["+D+"]) "),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: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var L=i;i=q.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+L+"]); ":i+=" validate.errors = ["+L+"]; return false; ":i+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var M=y;if(M)for(var j,D=-1,G=M.length-1;D<G;){j=M[D+=1],D&&(i+=" || ");var W=e.util.getProperty(j),$=d+W;i+=" ( ( "+$+" === undefined ",Q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?j:W)+") ) "}i+=") { ";var F="missing"+o,O="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(P,F,!0):P+" + "+F);var q=q||[];q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var L=i;i=q.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+L+"]); ":i+=" validate.errors = ["+L+"]; return false; ":i+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else if(U){h||(i+=" var "+A+" = validate.schema"+c+"; ");var D="i"+o,F="schema"+o+"["+D+"]",O="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(P,F,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: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",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 "+D+" = 0; "+D+" < "+A+".length; "+D+"++) { if ("+d+"["+A+"["+D+"]] === undefined ",Q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+A+"["+D+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",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 X=y;if(X)for(var j,K=-1,me=X.length-1;K<me;){j=X[K+=1];var W=e.util.getProperty(j),O=e.util.escapeQuotes(j),$=d+W;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(P,j,e.opts.jsonPointers)),i+=" if ( "+$+" === undefined ",Q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",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 nqt=B((OMo,rqt)=>{"use strict";rqt.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 w=i;i=S.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+w+"]); ":i+=" validate.errors = ["+w+"]; return false; ":i+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",f&&(i+=" else { ")}else f&&(i+=" if (true) { ");return i}});var oqt=B((MMo,iqt)=>{"use strict";iqt.exports={$ref:AQt(),allOf:EQt(),anyOf:bQt(),$comment:_Qt(),const:wQt(),contains:TQt(),dependencies:IQt(),enum:BQt(),format:OQt(),if:kQt(),items:PQt(),maximum:Iqe(),minimum:Iqe(),maxItems:Rqe(),minItems:Rqe(),maxLength:Bqe(),minLength:Bqe(),maxProperties:Nqe(),minProperties:Nqe(),multipleOf:GQt(),not:VQt(),oneOf:WQt(),pattern:zQt(),properties:KQt(),propertyNames:ZQt(),required:tqt(),uniqueItems:nqt(),validate:Tqe()}});var lqt=B((kMo,aqt)=>{"use strict";var sqt=oqt(),Oqe=aO().toHash;aqt.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=Oqe(r),e.types=Oqe(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:sqt[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:sqt.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=Oqe(r.concat(n)),e.custom={},e}});var fqt=B((LMo,uqt)=>{"use strict";var cqt=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];uqt.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<cqt.length;o++){var s=cqt[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 hqt=B((PMo,pqt)=>{"use strict";var Kqn=Bme().MissingRef;pqt.exports=dqt;function dqt(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)?dqt.call(n,{$ref:c},!0):Promise.resolve()}function s(a){try{return n._compile(a)}catch(u){if(u instanceof Kqn)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 gqt=B((FMo,mqt)=>{"use strict";mqt.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,w=v.definition,T="",N,P,U,Q,D;if(A&&w.$data){D="keywordValidate"+o;var F=w.validateSchema;i+=" var "+S+" = RULES.custom['"+r+"'].definition; var "+D+" = "+S+".validate;"}else{if(Q=e.useCustomRule(v,a,e.schema,e),!Q)return;y="validate.schema"+c,D=Q.code,N=w.compile,P=w.inline,U=w.macro}var O=D+".errors",q="i"+o,L="ruleErr"+o,M=w.async;if(M&&!e.async)throw new Error("async keyword in sync schema");if(P||U||(i+=""+O+" = null;"),i+="var "+g+" = errors;var "+h+";",A&&w.$data&&(T+="}",i+=" if ("+y+" === undefined) { "+h+" = true; } else { ",F&&(T+="}",i+=" "+h+" = "+S+".validateSchema("+y+"); if ("+h+") { ")),P)w.statements?i+=" "+Q.validate+" ":i+=" "+h+" = "+Q.validate+"; ";else if(U){var j=e.util.copy(e),T="";j.level++;var G="valid"+j.level;j.schema=Q.validate,j.schemaPath="";var W=e.compositeRule;e.compositeRule=j.compositeRule=!0;var $=e.validate(j).replace(/validate\.schema/g,D);e.compositeRule=j.compositeRule=W,i+=" "+$}else{var X=X||[];X.push(i),i="",i+=" "+D+".call( ",e.opts.passContext?i+="this":i+="self",N||w.schema===!1?i+=" , "+p+" ":i+=" , "+y+" , "+p+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var K=s?"data"+(s-1||""):"parentData",me=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+K+" , "+me+" , rootData ) ";var be=i;i=X.pop(),w.errors===!1?(i+=" "+h+" = ",M&&(i+="await "),i+=""+be+"; "):M?(O="customErrors"+o,i+=" var "+O+" = null; try { "+h+" = await "+be+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+O+" = e.errors; else throw e; } "):i+=" "+O+" = null; "+h+" = "+be+"; "}if(w.modifying&&(i+=" if ("+K+") "+p+" = "+K+"["+me+"];"),i+=""+T,w.valid)f&&(i+=" if (true) { ");else{i+=" if ( ",w.valid===void 0?(i+=" !",U?i+=""+G:i+=""+h):i+=" "+!w.valid+" ",i+=") { ",d=v.keyword;var X=X||[];X.push(i),i="";var X=X||[];X.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 ge=i;i=X.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+ge+"]); ":i+=" validate.errors = ["+ge+"]; return false; ":i+=" var err = "+ge+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var _e=i;i=X.pop(),P?w.errors?w.errors!="full"&&(i+=" for (var "+q+"="+g+"; "+q+"<errors; "+q+"++) { var "+L+" = vErrors["+q+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+L+".schema = "+y+"; "+L+".data = "+p+"; "),i+=" } "):w.errors===!1?i+=" "+_e+" ":(i+=" if ("+g+" == errors) { "+_e+" } else { for (var "+q+"="+g+"; "+q+"<errors; "+q+"++) { var "+L+" = vErrors["+q+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+L+".schema = "+y+"; "+L+".data = "+p+"; "),i+=" } } "):U?(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; ")):w.errors===!1?i+=" "+_e+" ":(i+=" if (Array.isArray("+O+")) { if (vErrors === null) vErrors = "+O+"; else vErrors = vErrors.concat("+O+"); errors = vErrors.length; for (var "+q+"="+g+"; "+q+"<errors; "+q+"++) { var "+L+" = vErrors["+q+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; "+L+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+L+".schema = "+y+"; "+L+".data = "+p+"; "),i+=" } } else { "+_e+" } "),i+=" } ",f&&(i+=" else { ")}return i}});var Mqe=B((UMo,Xqn)=>{Xqn.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 Eqt=B((QMo,yqt)=>{"use strict";var Aqt=Mqe();yqt.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Aqt.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Aqt.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 bqt=B((qMo,vqt)=>{"use strict";var Zqn=/^[a-z_$][a-z0-9_$-]*$/i,eHn=gqt(),tHn=Eqt();vqt.exports={add:rHn,get:nHn,remove:iHn,validate:kqe};function rHn(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!Zqn.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:eHn,implements:u.implements};f.rules.push(h),r.custom[a]=h}return this}function nHn(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function iHn(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 kqe(t,e){kqe.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(tHn,!0);if(r(t))return!0;if(kqe.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var Cqt=B((HMo,oHn)=>{oHn.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 Nqt=B((GMo,Bqt)=>{"use strict";var Sqt=tQt(),lO=Rme(),sHn=nQt(),wqt=vqe(),aHn=xqe(),lHn=mQt(),cHn=lqt(),xqt=fqt(),Tqt=aO();Bqt.exports=Jf;Jf.prototype.validate=fHn;Jf.prototype.compile=dHn;Jf.prototype.addSchema=pHn;Jf.prototype.addMetaSchema=hHn;Jf.prototype.validateSchema=mHn;Jf.prototype.getSchema=AHn;Jf.prototype.removeSchema=EHn;Jf.prototype.addFormat=THn;Jf.prototype.errorsText=xHn;Jf.prototype._addSchema=vHn;Jf.prototype._compile=bHn;Jf.prototype.compileAsync=hqt();var Ume=bqt();Jf.prototype.addKeyword=Ume.add;Jf.prototype.getKeyword=Ume.get;Jf.prototype.removeKeyword=Ume.remove;Jf.prototype.validateKeyword=Ume.validate;var Dqt=Bme();Jf.ValidationError=Dqt.Validation;Jf.MissingRefError=Dqt.MissingRef;Jf.$dataMetaSchema=xqt;var Fme="http://json-schema.org/draft-07/schema",_qt=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],uHn=["/properties"];function Jf(t){if(!(this instanceof Jf))return new Jf(t);t=this._opts=Tqt.copy(t)||{},OHn(this),this._schemas={},this._refs={},this._fragments={},this._formats=lHn(t.format),this._cache=t.cache||new sHn,this._loadingSchemas={},this._compilations=[],this.RULES=cHn(),this._getId=CHn(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=aHn),this._metaOpts=NHn(this),t.formats&&RHn(this),t.keywords&&BHn(this),DHn(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),IHn(this)}function fHn(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 dHn(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function pHn(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=lO.normalizeId(e||o),Rqt(this,e),this._schemas[e]=this._addSchema(t,r,n,!0),this}function hHn(t,e,r){return this.addSchema(t,e,r,!0),this}function mHn(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||gHn(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 gHn(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(Fme)?Fme:void 0,t._opts.defaultMeta}function AHn(t){var e=Iqt(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return yHn(this,t)}}function yHn(t,e){var r=lO.schema.call(t,{schema:{}},e);if(r){var n=r.schema,i=r.root,o=r.baseId,s=Sqt.call(t,n,i,void 0,o);return t._fragments[e]=new wqt({ref:e,fragment:!0,schema:n,root:i,baseId:o,validate:s}),s}}function Iqt(t,e){return e=lO.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function EHn(t){if(t instanceof RegExp)return Pme(this,this._schemas,t),Pme(this,this._refs,t),this;switch(typeof t){case"undefined":return Pme(this,this._schemas),Pme(this,this._refs),this._cache.clear(),this;case"string":var e=Iqt(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=lO.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function Pme(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 vHn(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=lO.normalizeId(this._getId(t));a&&n&&Rqt(this,a);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=a&&a==lO.normalizeId(t.$schema))&&this.validateSchema(t,!0);var f=lO.ids.call(this,t),d=new wqt({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 bHn(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=Sqt.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 CHn(t){switch(t.schemaId){case"auto":return wHn;case"id":return _Hn;default:return SHn}}function _Hn(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function SHn(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function wHn(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 xHn(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 THn(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function DHn(t){var e;if(t._opts.$data&&(e=Cqt(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=Mqe();t._opts.$data&&(r=xqt(r,uHn)),t.addMetaSchema(r,Fme,!0),t._refs["http://json-schema.org/schema"]=Fme}}function IHn(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 RHn(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function BHn(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function Rqt(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function NHn(t){for(var e=Tqt.copy(t._opts),r=0;r<_qt.length;r++)delete e[_qt[r]];return e}function OHn(t){var e=t._opts.logger;if(e===!1)t.logger={log:Lqe,warn:Lqe,error:Lqe};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 Lqe(){}});var Oqt,U7,Qme=Re(()=>{BUt();Ux();Oqt=ze(Nqt(),1),U7=class extends Cme{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 Oqt.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=RUt(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:IH,capabilities:this._capabilities,clientInfo:this._clientInfo}},nqe,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!dUt.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"},sO,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},dqe,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},sO,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},bee,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},vee,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},oqe,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},sqe,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},aqe,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},sO,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},sO,r)}async callTool(e,r=vme,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 Z6(X6.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new Z6(X6.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof Z6?s:new Z6(X6.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},fqe,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var Fqt=B((WMo,Pqt)=>{Pqt.exports=Lqt;Lqt.sync=kHn;var Mqt=we("fs");function MHn(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 kqt(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:MHn(e,r)}function Lqt(t,e,r){Mqt.stat(t,function(n,i){r(n,n?!1:kqt(i,t,e))})}function kHn(t,e){return kqt(Mqt.statSync(t),t,e)}});var Gqt=B((YMo,Hqt)=>{Hqt.exports=Qqt;Qqt.sync=LHn;var Uqt=we("fs");function Qqt(t,e,r){Uqt.stat(t,function(n,i){r(n,n?!1:qqt(i,e))})}function LHn(t,e){return qqt(Uqt.statSync(t),e)}function qqt(t,e){return t.isFile()&&PHn(t,e)}function PHn(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 Vqt=B((JMo,jqt)=>{var zMo=we("fs"),qme;process.platform==="win32"||global.TESTING_WINDOWS?qme=Fqt():qme=Gqt();jqt.exports=Pqe;Pqe.sync=FHn;function Pqe(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){Pqe(t,e||{},function(o,s){o?i(o):n(s)})})}qme(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function FHn(t,e){try{return qme.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Xqt=B((KMo,Kqt)=>{var BH=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",$qt=we("path"),UHn=BH?";":":",Wqt=Vqt(),Yqt=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),zqt=(t,e)=>{let r=e.colon||UHn,n=t.match(/\//)||BH&&t.match(/\\/)?[""]:[...BH?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=BH?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=BH?i.split(r):[""];return BH&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},Jqt=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=zqt(t,e),s=[],a=u=>new Promise((f,d)=>{if(u===n.length)return e.all&&s.length?f(s):d(Yqt(t));let p=n[u],h=/^".*"$/.test(p)?p.slice(1,-1):p,g=$qt.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];Wqt(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)},QHn=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=zqt(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=$qt.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(Wqt.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 Yqt(t)};Kqt.exports=Jqt;Jqt.sync=QHn});var eHt=B((XMo,Fqe)=>{"use strict";var Zqt=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Fqe.exports=Zqt;Fqe.exports.default=Zqt});var iHt=B((ZMo,nHt)=>{"use strict";var tHt=we("path"),qHn=Xqt(),HHn=eHt();function rHt(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=qHn.sync(t.command,{path:r[HHn({env:r})],pathExt:e?tHt.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=tHt.resolve(i?t.options.cwd:"",s)),s}function GHn(t){return rHt(t)||rHt(t,!0)}nHt.exports=GHn});var oHt=B((eko,Qqe)=>{"use strict";var Uqe=/([()\][%!^"`<>&|;, *?])/g;function jHn(t){return t=t.replace(Uqe,"^$1"),t}function VHn(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Uqe,"^$1"),e&&(t=t.replace(Uqe,"^$1")),t}Qqe.exports.command=jHn;Qqe.exports.argument=VHn});var aHt=B((tko,sHt)=>{"use strict";sHt.exports=/^#!(.*)/});var cHt=B((rko,lHt)=>{"use strict";var $Hn=aHt();lHt.exports=(t="")=>{let e=t.match($Hn);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var fHt=B((nko,uHt)=>{"use strict";var qqe=we("fs"),WHn=cHt();function YHn(t){let r=Buffer.alloc(150),n;try{n=qqe.openSync(t,"r"),qqe.readSync(n,r,0,150,0),qqe.closeSync(n)}catch{}return WHn(r.toString())}uHt.exports=YHn});var mHt=B((iko,hHt)=>{"use strict";var zHn=we("path"),dHt=iHt(),pHt=oHt(),JHn=fHt(),KHn=process.platform==="win32",XHn=/\.(?:com|exe)$/i,ZHn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function eGn(t){t.file=dHt(t);let e=t.file&&JHn(t.file);return e?(t.args.unshift(t.file),t.command=e,dHt(t)):t.file}function tGn(t){if(!KHn)return t;let e=eGn(t),r=!XHn.test(e);if(t.options.forceShell||r){let n=ZHn.test(e);t.command=zHn.normalize(t.command),t.command=pHt.command(t.command),t.args=t.args.map(o=>pHt.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 rGn(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:tGn(n)}hHt.exports=rGn});var yHt=B((oko,AHt)=>{"use strict";var Hqe=process.platform==="win32";function Gqe(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 nGn(t,e){if(!Hqe)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=gHt(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function gHt(t,e){return Hqe&&t===1&&!e.file?Gqe(e.original,"spawn"):null}function iGn(t,e){return Hqe&&t===1&&!e.file?Gqe(e.original,"spawnSync"):null}AHt.exports={hookChildProcess:nGn,verifyENOENT:gHt,verifyENOENTSync:iGn,notFoundError:Gqe}});var bHt=B((sko,NH)=>{"use strict";var EHt=we("child_process"),jqe=mHt(),Vqe=yHt();function vHt(t,e,r){let n=jqe(t,e,r),i=EHt.spawn(n.command,n.args,n.options);return Vqe.hookChildProcess(i,n),i}function oGn(t,e,r){let n=jqe(t,e,r),i=EHt.spawnSync(n.command,n.args,n.options);return i.error=i.error||Vqe.verifyENOENTSync(i.status,n),i}NH.exports=vHt;NH.exports.spawn=vHt;NH.exports.sync=oGn;NH.exports._parse=jqe;NH.exports._enoent=Vqe});function sGn(t){return Fx.parse(JSON.parse(t))}function CHt(t){return JSON.stringify(t)+`
|
|
546
546
|
`}var Hme,_Ht=Re(()=>{Ux();Hme=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
547
547
|
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),sGn(r)}clear(){this._buffer=void 0}}});import jme from"node:process";import{PassThrough as aGn}from"node:stream";function cGn(){let t={};for(let e of lGn){let r=jme.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}function uGn(){return"type"in jme}var SHt,lGn,Gme,wHt=Re(()=>{SHt=ze(bHt(),1);_Ht();lGn=jme.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];Gme=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new Hme,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new aGn)}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,SHt.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...cGn(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:jme.platform==="win32"&&uGn(),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=CHt(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}}});function $qe(t){}function $me(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=$qe,onError:r=$qe,onRetry:n=$qe,onComment:i}=t,o="",s=!0,a,c="",u="";function f(A){let y=s?A.replace(/^\xEF\xBB\xBF/,""):A,[v,S]=fGn(`${o}${y}`);for(let w of v)d(w);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,w=A.slice(y+S);p(v,w,A);return}p(A,"",A)}function p(A,y,v){switch(A){case"event":u=y;break;case"data":c=`${c}${y}
|
|
@@ -2472,7 +2472,7 @@ Error: ${i}`}}};Jsn={command:"add <name-or-id>",describe:"Add an agent from onli
|
|
|
2472
2472
|
`);let n=r.filter(o=>o.location==="project"),i=r.filter(o=>o.location==="global");if(n.length>0){console.log(`${S5o}Project agents:${EIe}`);for(let o of n){if(console.log(`\u2022 ${Xsn}${o.name}${EIe} (${o.agentType})`),o.description&&console.log(` Description: ${o.description}`),o.model&&console.log(` Model: ${o.model}`),o.allowedTools&&o.allowedTools.length>0){let s=o.allowedTools.includes("*")?"All tools":o.allowedTools.join(", "),a=o.isInheritTools===!1?" (no inherit)":"";console.log(` Tools: ${s}${a}`)}else o.isInheritTools===!1&&console.log(" Tools: None (no inherit)");o.allowedMcps&&o.allowedMcps.length>0?console.log(` MCPs: ${o.allowedMcps.join(", ")}`):o.isInheritMcps===!1&&console.log(" MCPs: None (no inherit)"),console.log(` Location: ${o.filePath||"unknown"}`),console.log()}}if(i.length>0){console.log(`${_5o}Global agents:${EIe}`);for(let o of i){if(console.log(`\u2022 ${Xsn}${o.name}${EIe} (${o.agentType})`),o.description&&console.log(` Description: ${o.description}`),o.model&&console.log(` Model: ${o.model}`),o.allowedTools&&o.allowedTools.length>0){let s=o.allowedTools.includes("*")?"All tools":o.allowedTools.join(", "),a=o.isInheritTools===!1?" (no inherit)":"";console.log(` Tools: ${s}${a}`)}else o.isInheritTools===!1&&console.log(" Tools: None (no inherit)");o.allowedMcps&&o.allowedMcps.length>0?console.log(` MCPs: ${o.allowedMcps.join(", ")}`):o.isInheritMcps===!1&&console.log(" MCPs: None (no inherit)"),console.log(` Location: ${o.filePath||"unknown"}`),console.log()}}console.log(`Total: ${r.length} agent(s) configured`)}catch(r){console.error("Error loading agents:",r),process.exit(1)}}var Xsn,_5o,S5o,EIe,Zsn,ean=Re(()=>{"use strict";sn();Xsn="\x1B[32m",_5o="\x1B[33m",S5o="\x1B[34m",EIe="\x1B[0m";Zsn={command:"list",describe:"List configured agents",builder:t=>t.usage("Usage: iflow agent list"),handler:async()=>{await w5o()}}});import*as vIe from"fs";async function x5o(t,e){let{scope:r}=e,n=process.cwd(),i=zm(n);try{let s=(await i.getAgents()).filter(a=>a.name===t||a.agentType===t);if(r&&r!=="all"&&(s=s.filter(a=>a.location===r)),s.length===0){let a=r&&r!=="all"?` in ${r} scope`:"";console.error(`Error: Agent '${t}' not found${a}`),process.exit(1)}if(s.length>1&&!r){console.error(`Error: Multiple agents found with name '${t}'. Please specify scope:`);for(let a of s)console.error(` - ${a.name} (${a.location}): ${a.filePath}`);console.error("Use --scope to specify which one to remove."),process.exit(1)}for(let a of s)try{a.filePath&&vIe.existsSync(a.filePath)?(vIe.unlinkSync(a.filePath),console.log(`Successfully removed agent '${a.name}' from ${a.location} scope`),console.log(`Deleted: ${a.filePath}`)):console.warn(`Warning: Agent file not found: ${a.filePath}`)}catch(c){console.error(`Error removing agent file ${a.filePath}:`,c),process.exit(1)}await i.refresh()}catch(o){console.error("Error removing agent:",o),process.exit(1)}}var tan,ran=Re(()=>{"use strict";sn();tan={command:"remove <name>",describe:"Remove an agent",builder:t=>t.usage("Usage: iflow agent remove <name> [--scope project|global|all]").positional("name",{describe:"Name or type of the agent to remove",type:"string",demandOption:!0}).option("scope",{alias:"s",describe:"Scope to remove from (project, global, or all)",type:"string",choices:["project","global","all"]}),handler:async t=>{await x5o(t.name,{scope:t.scope})}}});import*as bIe from"fs";async function R5o(t){let e=process.cwd(),r=zm(e);try{let i=(await r.getAgents()).filter(o=>o.name===t||o.agentType===t);i.length===0&&(console.error(`Error: Agent '${t}' not found`),process.exit(1));for(let o of i){if(console.log(`${T5o}Agent: ${o.name}${rg}`),console.log(`${Oy}Type:${rg} ${o.agentType}`),console.log(`${Oy}Location:${rg} ${o.location}`),console.log(`${Oy}File:${rg} ${o.filePath}`),o.description&&console.log(`${Oy}Description:${rg} ${o.description}`),o.whenToUse&&console.log(`${Oy}When to use:${rg} ${o.whenToUse}`),o.model&&console.log(`${Oy}Model:${rg} ${o.model}`),o.allowedTools&&o.allowedTools.length>0){let s=o.allowedTools.includes("*")?"All tools":o.allowedTools.join(", "),a=o.isInheritTools===!1?" (no inherit)":"";console.log(`${Oy}Allowed Tools:${rg} ${s}${a}`)}else o.isInheritTools===!1?console.log(`${Oy}Allowed Tools:${rg} None (no inherit)`):console.log(`${Oy}Allowed Tools:${rg} All tools (inherit)`);if(o.allowedMcps&&o.allowedMcps.length>0?console.log(`${Oy}Allowed MCP Servers:${rg} ${o.allowedMcps.join(", ")}`):o.isInheritMcps===!1?console.log(`${Oy}Allowed MCP Servers:${rg} None (no inherit)`):console.log(`${Oy}Allowed MCP Servers:${rg} All MCP servers (inherit)`),o.systemPrompt&&(console.log(`${Oy}System Prompt:${rg}`),console.log(o.systemPrompt)),o.filePath&&bIe.existsSync(o.filePath))try{let s=bIe.readFileSync(o.filePath,"utf8");console.log(`
|
|
2473
2473
|
${I5o}File Content:${rg}`),console.log("\u2500".repeat(50)),console.log(s),console.log("\u2500".repeat(50))}catch(s){console.warn(`Warning: Could not read file content: ${s}`)}else console.warn(`${D5o}Warning:${rg} Agent file not found at ${o.filePath||"unknown path"}`);i.length>1&&console.log(`
|
|
2474
2474
|
`+"=".repeat(60)+`
|
|
2475
|
-
`)}}catch(n){console.error("Error getting agent details:",n),process.exit(1)}}var T5o,D5o,Oy,I5o,rg,nan,ian=Re(()=>{"use strict";sn();T5o="\x1B[32m",D5o="\x1B[33m",Oy="\x1B[34m",I5o="\x1B[36m",rg="\x1B[0m";nan={command:"get <name>",describe:"Get details about an agent",builder:t=>t.usage("Usage: iflow agent get <name>").positional("name",{describe:"Name or type of the agent",type:"string",demandOption:!0}),handler:async t=>{await R5o(t.name)}}});async function M5o(t={}){let{page:e=1,size:r=20,search:n}=t,o=fc(process.cwd()).merged.apiKey;o||(console.error("Error: API key not found."),console.error("Please authenticate first by running the auth command."),process.exit(1)),console.log("Loading online agents...");try{let s=await O5o(o,e,r);s.success||(console.error(`Error: ${s.message}`),process.exit(1));let a=s.agents||[];if(n&&(a=a.filter(c=>c.name.toLowerCase().includes(n.toLowerCase())||c.description.toLowerCase().includes(n.toLowerCase())||c.category.toLowerCase().includes(n.toLowerCase()))),a.length===0){let c=n?` matching "${n}"`:"";console.log(`No agents found${c}`);return}console.log(`\\n${N5o}Online Agents${n?` (filtered by "${n}")`:""}:${y1}\\n`);for(let c of a){if(console.log(`${B5o}\u2022 ${c.name}${y1} (ID: ${c.id})`),console.log(` ${Vv}Description:${y1} ${c.description}`),console.log(` ${Vv}Category:${y1} ${c.category}`),console.log(` ${Vv}Model:${y1} ${c.modelName}`),c.tags&&console.log(` ${Vv}Tags:${y1} ${c.tags}`),console.log(` ${Vv}Author:${y1} ${c.authorId}`),console.log(` ${Vv}Version:${y1} ${c.version}`),c.extInfo){if(c.extInfo["allowed-tools"]){let f=c.extInfo["allowed-tools"].split(",").map(d=>d.trim()).filter(d=>d);f.length>0?console.log(` ${Vv}Allowed Tools:${y1} ${f.join(", ")}`):c.extInfo["is-inherit-tools"]?console.log(` ${Vv}Allowed Tools:${y1} All tools available`):console.log(` ${Vv}Allowed Tools:${y1} No tools available`)}let u=c.extInfo["is-inherit-tools"];if(console.log(` ${Vv}Inherit Tools:${y1} ${u?"Yes":"No"}`),c.extInfo.mcps){let f=c.extInfo.mcps.split(",").map(d=>d.trim()).filter(d=>d);f.length>0&&console.log(` ${Vv}MCP Servers:${y1} ${f.join(", ")}`)}}console.log()}console.log(`${oan}Total: ${a.length} agent(s) shown${s.total?` (${s.total} total available)`:""}${y1}`),console.log(`${oan}To install an agent, use: iflow agent add <name-or-id>${y1}`)}catch(s){console.error("Error browsing online agents:",s),process.exit(1)}}var B5o,oan,N5o,Vv,y1,O5o,san,aan=Re(()=>{"use strict";Mf();B5o="\x1B[32m",oan="\x1B[33m",N5o="\x1B[34m",Vv="\x1B[36m",y1="\x1B[0m",O5o=async(t,e=1,r=20)=>{try{if(!t)return{success:!1,message:"Please authenticate first by running the auth command"};let i=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{Authorization:`Bearer ${t}`,"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:e,size:r})});if(!i.ok){let a="Unable to load agents. Please try again later";return i.status===401?a="Authentication failed. Please check your API key or re-authenticate":i.status===403?a="Access denied. Please check your permissions":i.status===404?a="Agents service not found. Please try again later":i.status>=500&&(a="Server error. Please try again later"),{success:!1,message:a}}let o=await i.json();return o.success?{success:!0,agents:Array.isArray(o.data.data)?o.data.data:[],total:o.data.total||0}:{success:!1,message:o.message||"Failed to load agents from server"}}catch(n){let i="Unable to load agents. Please check your connection and try again";return n instanceof Error&&n.message.includes("Failed to fetch")&&(i="Network error. Please check your internet connection"),{success:!1,message:i}}};san={command:"online",describe:"Browse online agent repository",builder:t=>t.usage("Usage: iflow agent online [options]").option("page",{alias:"p",describe:"Page number (default: 1)",type:"number",default:1}).option("size",{alias:"s",describe:"Number of agents per page (default: 20)",type:"number",default:20}).option("search",{describe:"Search term to filter agents",type:"string"}),handler:async t=>{await M5o({page:t.page,size:t.size,search:t.search})}}});var lan={};r2(lan,{agentCommand:()=>QEt});var QEt,qEt=Re(()=>{"use strict";Ksn();ean();ran();ian();aan();QEt={command:"agent",describe:"Manage agents",builder:t=>t.command(Jsn).command(Zsn).command(tan).command(nan).command(san).demandCommand(1,"You need at least one command before continuing.").version(!1),handler:()=>{}}});var Han=B((sWs,qan)=>{"use strict";var vvo=we("os"),Qan=we("tty"),CE=HQ(),{env:N0}=process,BR;CE("no-color")||CE("no-colors")||CE("color=false")||CE("color=never")?BR=0:(CE("color")||CE("colors")||CE("color=true")||CE("color=always"))&&(BR=1);"FORCE_COLOR"in N0&&(N0.FORCE_COLOR==="true"?BR=1:N0.FORCE_COLOR==="false"?BR=0:BR=N0.FORCE_COLOR.length===0?1:Math.min(parseInt(N0.FORCE_COLOR,10),3));function n5t(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function i5t(t,e){if(BR===0)return 0;if(CE("color=16m")||CE("color=full")||CE("color=truecolor"))return 3;if(CE("color=256"))return 2;if(t&&!e&&BR===void 0)return 0;let r=BR||0;if(N0.TERM==="dumb")return r;if(process.platform==="win32"){let n=vvo.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in N0)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in N0)||N0.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in N0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(N0.TEAMCITY_VERSION)?1:0;if(N0.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in N0){let n=parseInt((N0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(N0.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(N0.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(N0.TERM)||"COLORTERM"in N0?1:r}function bvo(t){let e=i5t(t,t&&t.isTTY);return n5t(e)}qan.exports={supportsColor:bvo,stdout:n5t(i5t(!0,Qan.isatty(1))),stderr:n5t(i5t(!0,Qan.isatty(2)))}});var Van=B((aWs,jan)=>{"use strict";var Cvo=Han(),rK=HQ();function Gan(t){if(/^\d{3,4}$/.test(t)){let r=/(\d{1,2})(\d{2})/.exec(t);return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let e=(t||"").split(".").map(r=>parseInt(r,10));return{major:e[0],minor:e[1],patch:e[2]}}function o5t(t){let{env:e}=process;if("FORCE_HYPERLINK"in e)return!(e.FORCE_HYPERLINK.length>0&&parseInt(e.FORCE_HYPERLINK,10)===0);if(rK("no-hyperlink")||rK("no-hyperlinks")||rK("hyperlink=false")||rK("hyperlink=never"))return!1;if(rK("hyperlink=true")||rK("hyperlink=always")||"NETLIFY"in e)return!0;if(!Cvo.supportsColor(t)||t&&!t.isTTY||process.platform==="win32"||"CI"in e||"TEAMCITY_VERSION"in e)return!1;if("TERM_PROGRAM"in e){let r=Gan(e.TERM_PROGRAM_VERSION);switch(e.TERM_PROGRAM){case"iTerm.app":return r.major===3?r.minor>=1:r.major>3;case"WezTerm":return r.major>=20200620;case"vscode":return r.major>1||r.major===1&&r.minor>=72}}if("VTE_VERSION"in e){if(e.VTE_VERSION==="0.50.0")return!1;let r=Gan(e.VTE_VERSION);return r.major>0||r.minor>=50}return!1}jan.exports={supportsHyperlink:o5t,stdout:o5t(process.stdout),stderr:o5t(process.stderr)}});var p5t={};r2(p5t,{AuthHandler:()=>d5t});var d5t,h5t=Re(()=>{"use strict";d5t=class{logger;constructor(e={}){this.logger=console}validateToken(e){return e.authToken?e.authToken.length<16?(console.error("Auth token appears to be invalid (too short)"),!1):!0:(console.error("No auth token found in server config"),!1)}buildAuthenticatedUrl(e){if(!this.validateToken(e))throw new Error("Invalid authentication token");return`${e.serverUrl.replace(/^http/,"ws")}/ws?token=${encodeURIComponent(e.authToken)}`}buildAuthHeaders(e){if(!this.validateToken(e))throw new Error("Invalid authentication token");return{Auttion:`Bearer ${e.authToken}`,"X-Auth-Token":e.authToken}}isTokenExpired(e,r=1440*60*1e3){let i=Date.now()-e.timestamp;return i>r?(console.warn(`Token is ${Math.floor(i/1e3/60)} minutes old`),!0):!1}}});var g5t={};r2(g5t,{WebSocketClientImpl:()=>m5t});import{EventEmitter as Kvo}from"events";var m5t,A5t=Re(()=>{"use strict";EX();Yxe();m5t=class extends Kvo{ws;config;isConnectedFlag=!1;heartbeatInterval;reconnectTimer;reconnectAttempts=0;pendingResponses=new Map;options;constructor(e={}){super(),this.options={reconnectAttempts:e.reconnectAttempts??3,reconnectDelay:e.reconnectDelay??1e3,heartbeatInterval:e.heartbeatInterval??3e4,connectionTimeout:e.connectionTimeout??5e3,logger:console}}async connect(e){return this.config=e,this.reconnectAttempts=0,new Promise((r,n)=>{let i=setTimeout(()=>{n(new Error("Connection timeout")),this.disconnect()},this.options.connectionTimeout);try{let o=`${e.serverUrl}?token=${e.authToken}`;this.ws=new wQ(o),this.ws.on("open",()=>{clearTimeout(i),this.isConnectedFlag=!0,console.debug("WebSocket connected"),this.sendConnectMessage(),this.startHeartbeat(),r()}),this.ws.on("message",s=>{try{let a=JSON.parse(s.toString());this.handleMessage(a)}catch(a){console.log("error","Failed to parse WebSocket message:",a)}}),this.ws.on("error",s=>{clearTimeout(i),console.log("error","WebSocket error:",s),this.emit("error",s),this.isConnectedFlag||n(s)}),this.ws.on("close",()=>{clearTimeout(i),this.isConnectedFlag=!1,this.stopHeartbeat(),this.emit("close"),this.reconnectAttempts<this.options.reconnectAttempts&&this.scheduleReconnect()})}catch(o){clearTimeout(i),n(o)}})}async disconnect(){this.isConnectedFlag=!1,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0);for(let[e,r]of this.pendingResponses)clearTimeout(r.timeout),r.reject(new Error("Connection closed"));return this.pendingResponses.clear(),new Promise(e=>{this.ws&&this.ws.readyState===wQ.OPEN?(this.ws.once("close",()=>e()),this.ws.close()):e()})}isConnected(){return this.isConnectedFlag&&this.ws?.readyState===wQ.OPEN}async send(e){if(!this.isConnected())throw new Error("WebSocket is not connected");return new Promise((r,n)=>{try{let i=JSON.stringify(e);this.ws.send(i,o=>{o?n(o):r()})}catch(i){n(i)}})}async sendRequest(e,r=3e4){return e.id||(e.id=this.generateId()),new Promise((n,i)=>{let o=setTimeout(()=>{this.pendingResponses.delete(e.id),i(new Error(`Timeout for message ${e.id}`))},r);this.pendingResponses.set(e.id,{resolve:n,reject:i,timeout:o}),this.send(e).catch(s=>{this.pendingResponses.delete(e.id),clearTimeout(o),i(s)})})}onMessage(e){this.on("message",e)}onError(e){this.on("error",e)}onClose(e){this.on("close",e)}handleMessage(e){if(e.type==="response"&&e.id){let r=this.pendingResponses.get(e.id);if(r){clearTimeout(r.timeout),this.pendingResponses.delete(e.id);let n=e.payload;n.success?r.resolve(n.data):r.reject(new Error(n.error||"Request failed"));return}}if(e.type!=="pong"){if(e.type==="active_file_changed"){this.emit("activeFileChanged",e.payload);return}if(e.type==="selection_changed"){this.emit("selectionChanged",e.payload);return}this.emit("message",e)}}sendConnectMessage(){let e={clientInfo:{version:"0.2.11-beta.1",platform:process.platform,workingDirectory:process.cwd()}},r={type:"cli_connect",timestamp:Date.now(),payload:e};this.send(r).catch(n=>{console.log("error","Failed to send connect message:",n)})}startHeartbeat(){this.heartbeatInterval=setInterval(()=>{if(this.isConnected()){let e={type:"ping",timestamp:Date.now()};this.send(e).catch(r=>{console.log("error","Failed to send ping:",r)})}},this.options.heartbeatInterval)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0)}scheduleReconnect(){this.reconnectAttempts++;let e=this.options.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);console.info(`Scheduling reconnect attempt ${this.reconnectAttempts} in ${e}ms`),this.reconnectTimer=setTimeout(()=>{this.config&&this.connect(this.config).catch(r=>{console.log("error","Reconnect failed:",r)})},e)}generateId(){return`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}}});var Vcn=B(qF=>{qF.parse=qF.decode=O8o;qF.stringify=qF.encode=Hcn;qF.safe=mK;qF.unsafe=oRe;var Q5t=typeof process<"u"&&process.platform==="win32"?`\r
|
|
2475
|
+
`)}}catch(n){console.error("Error getting agent details:",n),process.exit(1)}}var T5o,D5o,Oy,I5o,rg,nan,ian=Re(()=>{"use strict";sn();T5o="\x1B[32m",D5o="\x1B[33m",Oy="\x1B[34m",I5o="\x1B[36m",rg="\x1B[0m";nan={command:"get <name>",describe:"Get details about an agent",builder:t=>t.usage("Usage: iflow agent get <name>").positional("name",{describe:"Name or type of the agent",type:"string",demandOption:!0}),handler:async t=>{await R5o(t.name)}}});async function M5o(t={}){let{page:e=1,size:r=20,search:n}=t,o=fc(process.cwd()).merged.apiKey;o||(console.error("Error: API key not found."),console.error("Please authenticate first by running the auth command."),process.exit(1)),console.log("Loading online agents...");try{let s=await O5o(o,e,r);s.success||(console.error(`Error: ${s.message}`),process.exit(1));let a=s.agents||[];if(n&&(a=a.filter(c=>c.name.toLowerCase().includes(n.toLowerCase())||c.description.toLowerCase().includes(n.toLowerCase())||c.category.toLowerCase().includes(n.toLowerCase()))),a.length===0){let c=n?` matching "${n}"`:"";console.log(`No agents found${c}`);return}console.log(`\\n${N5o}Online Agents${n?` (filtered by "${n}")`:""}:${y1}\\n`);for(let c of a){if(console.log(`${B5o}\u2022 ${c.name}${y1} (ID: ${c.id})`),console.log(` ${Vv}Description:${y1} ${c.description}`),console.log(` ${Vv}Category:${y1} ${c.category}`),console.log(` ${Vv}Model:${y1} ${c.modelName}`),c.tags&&console.log(` ${Vv}Tags:${y1} ${c.tags}`),console.log(` ${Vv}Author:${y1} ${c.authorId}`),console.log(` ${Vv}Version:${y1} ${c.version}`),c.extInfo){if(c.extInfo["allowed-tools"]){let f=c.extInfo["allowed-tools"].split(",").map(d=>d.trim()).filter(d=>d);f.length>0?console.log(` ${Vv}Allowed Tools:${y1} ${f.join(", ")}`):c.extInfo["is-inherit-tools"]?console.log(` ${Vv}Allowed Tools:${y1} All tools available`):console.log(` ${Vv}Allowed Tools:${y1} No tools available`)}let u=c.extInfo["is-inherit-tools"];if(console.log(` ${Vv}Inherit Tools:${y1} ${u?"Yes":"No"}`),c.extInfo.mcps){let f=c.extInfo.mcps.split(",").map(d=>d.trim()).filter(d=>d);f.length>0&&console.log(` ${Vv}MCP Servers:${y1} ${f.join(", ")}`)}}console.log()}console.log(`${oan}Total: ${a.length} agent(s) shown${s.total?` (${s.total} total available)`:""}${y1}`),console.log(`${oan}To install an agent, use: iflow agent add <name-or-id>${y1}`)}catch(s){console.error("Error browsing online agents:",s),process.exit(1)}}var B5o,oan,N5o,Vv,y1,O5o,san,aan=Re(()=>{"use strict";Mf();B5o="\x1B[32m",oan="\x1B[33m",N5o="\x1B[34m",Vv="\x1B[36m",y1="\x1B[0m",O5o=async(t,e=1,r=20)=>{try{if(!t)return{success:!1,message:"Please authenticate first by running the auth command"};let i=await fetch("https://apis.iflow.cn/v1/agents/list",{method:"POST",headers:{Authorization:`Bearer ${t}`,"User-Agent":"iFlow-Cli","Content-Type":"application/json"},body:JSON.stringify({page:e,size:r})});if(!i.ok){let a="Unable to load agents. Please try again later";return i.status===401?a="Authentication failed. Please check your API key or re-authenticate":i.status===403?a="Access denied. Please check your permissions":i.status===404?a="Agents service not found. Please try again later":i.status>=500&&(a="Server error. Please try again later"),{success:!1,message:a}}let o=await i.json();return o.success?{success:!0,agents:Array.isArray(o.data.data)?o.data.data:[],total:o.data.total||0}:{success:!1,message:o.message||"Failed to load agents from server"}}catch(n){let i="Unable to load agents. Please check your connection and try again";return n instanceof Error&&n.message.includes("Failed to fetch")&&(i="Network error. Please check your internet connection"),{success:!1,message:i}}};san={command:"online",describe:"Browse online agent repository",builder:t=>t.usage("Usage: iflow agent online [options]").option("page",{alias:"p",describe:"Page number (default: 1)",type:"number",default:1}).option("size",{alias:"s",describe:"Number of agents per page (default: 20)",type:"number",default:20}).option("search",{describe:"Search term to filter agents",type:"string"}),handler:async t=>{await M5o({page:t.page,size:t.size,search:t.search})}}});var lan={};r2(lan,{agentCommand:()=>QEt});var QEt,qEt=Re(()=>{"use strict";Ksn();ean();ran();ian();aan();QEt={command:"agent",describe:"Manage agents",builder:t=>t.command(Jsn).command(Zsn).command(tan).command(nan).command(san).demandCommand(1,"You need at least one command before continuing.").version(!1),handler:()=>{}}});var Han=B((sWs,qan)=>{"use strict";var vvo=we("os"),Qan=we("tty"),CE=HQ(),{env:N0}=process,BR;CE("no-color")||CE("no-colors")||CE("color=false")||CE("color=never")?BR=0:(CE("color")||CE("colors")||CE("color=true")||CE("color=always"))&&(BR=1);"FORCE_COLOR"in N0&&(N0.FORCE_COLOR==="true"?BR=1:N0.FORCE_COLOR==="false"?BR=0:BR=N0.FORCE_COLOR.length===0?1:Math.min(parseInt(N0.FORCE_COLOR,10),3));function n5t(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function i5t(t,e){if(BR===0)return 0;if(CE("color=16m")||CE("color=full")||CE("color=truecolor"))return 3;if(CE("color=256"))return 2;if(t&&!e&&BR===void 0)return 0;let r=BR||0;if(N0.TERM==="dumb")return r;if(process.platform==="win32"){let n=vvo.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in N0)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in N0)||N0.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in N0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(N0.TEAMCITY_VERSION)?1:0;if(N0.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in N0){let n=parseInt((N0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(N0.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(N0.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(N0.TERM)||"COLORTERM"in N0?1:r}function bvo(t){let e=i5t(t,t&&t.isTTY);return n5t(e)}qan.exports={supportsColor:bvo,stdout:n5t(i5t(!0,Qan.isatty(1))),stderr:n5t(i5t(!0,Qan.isatty(2)))}});var Van=B((aWs,jan)=>{"use strict";var Cvo=Han(),rK=HQ();function Gan(t){if(/^\d{3,4}$/.test(t)){let r=/(\d{1,2})(\d{2})/.exec(t);return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let e=(t||"").split(".").map(r=>parseInt(r,10));return{major:e[0],minor:e[1],patch:e[2]}}function o5t(t){let{env:e}=process;if("FORCE_HYPERLINK"in e)return!(e.FORCE_HYPERLINK.length>0&&parseInt(e.FORCE_HYPERLINK,10)===0);if(rK("no-hyperlink")||rK("no-hyperlinks")||rK("hyperlink=false")||rK("hyperlink=never"))return!1;if(rK("hyperlink=true")||rK("hyperlink=always")||"NETLIFY"in e)return!0;if(!Cvo.supportsColor(t)||t&&!t.isTTY||process.platform==="win32"||"CI"in e||"TEAMCITY_VERSION"in e)return!1;if("TERM_PROGRAM"in e){let r=Gan(e.TERM_PROGRAM_VERSION);switch(e.TERM_PROGRAM){case"iTerm.app":return r.major===3?r.minor>=1:r.major>3;case"WezTerm":return r.major>=20200620;case"vscode":return r.major>1||r.major===1&&r.minor>=72}}if("VTE_VERSION"in e){if(e.VTE_VERSION==="0.50.0")return!1;let r=Gan(e.VTE_VERSION);return r.major>0||r.minor>=50}return!1}jan.exports={supportsHyperlink:o5t,stdout:o5t(process.stdout),stderr:o5t(process.stderr)}});var p5t={};r2(p5t,{AuthHandler:()=>d5t});var d5t,h5t=Re(()=>{"use strict";d5t=class{logger;constructor(e={}){this.logger=console}validateToken(e){return e.authToken?e.authToken.length<16?(console.error("Auth token appears to be invalid (too short)"),!1):!0:(console.error("No auth token found in server config"),!1)}buildAuthenticatedUrl(e){if(!this.validateToken(e))throw new Error("Invalid authentication token");return`${e.serverUrl.replace(/^http/,"ws")}/ws?token=${encodeURIComponent(e.authToken)}`}buildAuthHeaders(e){if(!this.validateToken(e))throw new Error("Invalid authentication token");return{Auttion:`Bearer ${e.authToken}`,"X-Auth-Token":e.authToken}}isTokenExpired(e,r=1440*60*1e3){let i=Date.now()-e.timestamp;return i>r?(console.warn(`Token is ${Math.floor(i/1e3/60)} minutes old`),!0):!1}}});var g5t={};r2(g5t,{WebSocketClientImpl:()=>m5t});import{EventEmitter as Kvo}from"events";var m5t,A5t=Re(()=>{"use strict";EX();Yxe();m5t=class extends Kvo{ws;config;isConnectedFlag=!1;heartbeatInterval;reconnectTimer;reconnectAttempts=0;pendingResponses=new Map;options;constructor(e={}){super(),this.options={reconnectAttempts:e.reconnectAttempts??3,reconnectDelay:e.reconnectDelay??1e3,heartbeatInterval:e.heartbeatInterval??3e4,connectionTimeout:e.connectionTimeout??5e3,logger:console}}async connect(e){return this.config=e,this.reconnectAttempts=0,new Promise((r,n)=>{let i=setTimeout(()=>{n(new Error("Connection timeout")),this.disconnect()},this.options.connectionTimeout);try{let o=`${e.serverUrl}?token=${e.authToken}`;this.ws=new wQ(o),this.ws.on("open",()=>{clearTimeout(i),this.isConnectedFlag=!0,console.debug("WebSocket connected"),this.sendConnectMessage(),this.startHeartbeat(),r()}),this.ws.on("message",s=>{try{let a=JSON.parse(s.toString());this.handleMessage(a)}catch(a){console.log("error","Failed to parse WebSocket message:",a)}}),this.ws.on("error",s=>{clearTimeout(i),console.log("error","WebSocket error:",s),this.emit("error",s),this.isConnectedFlag||n(s)}),this.ws.on("close",()=>{clearTimeout(i),this.isConnectedFlag=!1,this.stopHeartbeat(),this.emit("close"),this.reconnectAttempts<this.options.reconnectAttempts&&this.scheduleReconnect()})}catch(o){clearTimeout(i),n(o)}})}async disconnect(){this.isConnectedFlag=!1,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0);for(let[e,r]of this.pendingResponses)clearTimeout(r.timeout),r.reject(new Error("Connection closed"));return this.pendingResponses.clear(),new Promise(e=>{this.ws&&this.ws.readyState===wQ.OPEN?(this.ws.once("close",()=>e()),this.ws.close()):e()})}isConnected(){return this.isConnectedFlag&&this.ws?.readyState===wQ.OPEN}async send(e){if(!this.isConnected())throw new Error("WebSocket is not connected");return new Promise((r,n)=>{try{let i=JSON.stringify(e);this.ws.send(i,o=>{o?n(o):r()})}catch(i){n(i)}})}async sendRequest(e,r=3e4){return e.id||(e.id=this.generateId()),new Promise((n,i)=>{let o=setTimeout(()=>{this.pendingResponses.delete(e.id),i(new Error(`Timeout for message ${e.id}`))},r);this.pendingResponses.set(e.id,{resolve:n,reject:i,timeout:o}),this.send(e).catch(s=>{this.pendingResponses.delete(e.id),clearTimeout(o),i(s)})})}onMessage(e){this.on("message",e)}onError(e){this.on("error",e)}onClose(e){this.on("close",e)}handleMessage(e){if(e.type==="response"&&e.id){let r=this.pendingResponses.get(e.id);if(r){clearTimeout(r.timeout),this.pendingResponses.delete(e.id);let n=e.payload;n.success?r.resolve(n.data):r.reject(new Error(n.error||"Request failed"));return}}if(e.type!=="pong"){if(e.type==="active_file_changed"){this.emit("activeFileChanged",e.payload);return}if(e.type==="selection_changed"){this.emit("selectionChanged",e.payload);return}this.emit("message",e)}}sendConnectMessage(){let e={clientInfo:{version:"0.2.11",platform:process.platform,workingDirectory:process.cwd()}},r={type:"cli_connect",timestamp:Date.now(),payload:e};this.send(r).catch(n=>{console.log("error","Failed to send connect message:",n)})}startHeartbeat(){this.heartbeatInterval=setInterval(()=>{if(this.isConnected()){let e={type:"ping",timestamp:Date.now()};this.send(e).catch(r=>{console.log("error","Failed to send ping:",r)})}},this.options.heartbeatInterval)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0)}scheduleReconnect(){this.reconnectAttempts++;let e=this.options.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);console.info(`Scheduling reconnect attempt ${this.reconnectAttempts} in ${e}ms`),this.reconnectTimer=setTimeout(()=>{this.config&&this.connect(this.config).catch(r=>{console.log("error","Reconnect failed:",r)})},e)}generateId(){return`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}}});var Vcn=B(qF=>{qF.parse=qF.decode=O8o;qF.stringify=qF.encode=Hcn;qF.safe=mK;qF.unsafe=oRe;var Q5t=typeof process<"u"&&process.platform==="win32"?`\r
|
|
2476
2476
|
`:`
|
|
2477
2477
|
`;function Hcn(t,e){var r=[],n="";typeof e=="string"?e={section:e,whitespace:!1}:(e=e||{},e.whitespace=e.whitespace===!0);var i=e.whitespace?" = ":"=";return Object.keys(t).forEach(function(o,s,a){var c=t[o];c&&Array.isArray(c)?c.forEach(function(u){n+=mK(o+"[]")+i+mK(u)+`
|
|
2478
2478
|
`}):c&&typeof c=="object"?r.push(o):n+=mK(o)+i+mK(c)+Q5t}),e.section&&n.length&&(n="["+mK(e.section)+"]"+Q5t+n),r.forEach(function(o,s,a){var c=Gcn(o).join("\\."),u=(e.section?e.section+".":"")+c,f=Hcn(t[o],{section:u,whitespace:e.whitespace});n.length&&f.length&&(n+=Q5t),n+=f}),n}function Gcn(t){return t.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(e){return e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function O8o(t){var e={},r=e,n=null,i=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=t.split(/[\r\n]+/g);return o.forEach(function(s,a,c){if(!(!s||s.match(/^\s*[;#]/))){var u=s.match(i);if(u){if(u[1]!==void 0){if(n=oRe(u[1]),n==="__proto__"){r={};return}r=e[n]=e[n]||{};return}var f=oRe(u[2]);if(f!=="__proto__"){var d=u[3]?oRe(u[4]):!0;switch(d){case"true":case"false":case"null":d=JSON.parse(d)}if(f.length>2&&f.slice(-2)==="[]"){if(f=f.substring(0,f.length-2),f==="__proto__")return;r[f]?Array.isArray(r[f])||(r[f]=[r[f]]):r[f]=[]}Array.isArray(r[f])?r[f].push(d):r[f]=d}}}}),Object.keys(e).filter(function(s,a,c){if(!e[s]||typeof e[s]!="object"||Array.isArray(e[s]))return!1;var u=Gcn(s),f=e,d=u.pop(),p=d.replace(/\\\./g,".");return u.forEach(function(h,g,A){h!=="__proto__"&&((!f[h]||typeof f[h]!="object")&&(f[h]={}),f=f[h])}),f===e&&p===d?!1:(f[p]=e[s],!0)}).forEach(function(s,a,c){delete e[s]}),e}function jcn(t){return t.charAt(0)==='"'&&t.slice(-1)==='"'||t.charAt(0)==="'"&&t.slice(-1)==="'"}function mK(t){return typeof t!="string"||t.match(/[=\r\n]/)||t.match(/^\[/)||t.length>1&&jcn(t)||t!==t.trim()?JSON.stringify(t):t.replace(/;/g,"\\;").replace(/#/g,"\\#")}function oRe(t,e){if(t=(t||"").trim(),jcn(t)){t.charAt(0)==="'"&&(t=t.substr(1,t.length-2));try{t=JSON.parse(t)}catch{}}else{for(var r=!1,n="",i=0,o=t.length;i<o;i++){var s=t.charAt(i);if(r)"\\;#".indexOf(s)!==-1?n+=s:n+="\\"+s,r=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?r=!0:n+=s}}return r&&(n+="\\"),n.trim()}return t}});var Ycn=B((Rea,Wcn)=>{"use strict";var q5t=1,$cn=2;function M8o(){return""}function k8o(t,e,r){return t.slice(e,r).replace(/\S/g," ")}Wcn.exports=function(t,e){e=e||{};for(var r,n,i=!1,o=!1,s=0,a="",c=e.whitespace===!1?M8o:k8o,u=0;u<t.length;u++){if(r=t[u],n=t[u+1],!o&&r==='"'){var f=t[u-1]==="\\"&&t[u-2]!=="\\";f||(i=!i)}if(!i){if(!o&&r+n==="//")a+=t.slice(s,u),s=u,o=q5t,u++;else if(o===q5t&&r+n===`\r
|
|
@@ -2689,7 +2689,7 @@ Logging in with Google... Please restart iFlow CLI to continue.
|
|
|
2689
2689
|
`,e-1);return{line:r===-1?0:t.slice(0,r+1).match(/\n/g).length,column:e-r-1}}function Iyt(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=Tmo(t,e);return r?{line:n.line+1,column:n.column+1}:n}var Dmo=t=>`\\u{${t.codePointAt(0).toString(16)}}`,Ryt=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??=`${Rmo(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
|
|
2690
2690
|
|
|
2691
2691
|
${e}
|
|
2692
|
-
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=Imo(r,this.#t.message);if(n)return(0,lKr.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}},Imo=(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)}:Iyt(t,Number(n),{oneBased:!0})},Rmo=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${Dmo(n)})`);function Byt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new Ryt({jsonParseError:n,fileName:r,input:t})}}var oXr=ze(nXr(),1);import{fileURLToPath as Dgo}from"node:url";function iXr(t){return t instanceof URL?Dgo(t):t}var Bgo=t=>Rgo.resolve(iXr(t)??".","package.json"),Ngo=(t,e)=>{let r=typeof t=="string"?Byt(t):t;return e&&(0,oXr.default)(r),r};async function sXr({cwd:t,normalize:e=!0}={}){let r=await Igo.readFile(Bgo(t),"utf8");return Ngo(r,e)}async function aXr(t){let e=await PJr("package.json",t);if(e)return{packageJson:await sXr({...t,cwd:Ogo.dirname(e)}),path:e}}import{fileURLToPath as Mgo}from"url";import kgo from"path";var Lgo=Mgo(import.meta.url),Pgo=kgo.dirname(Lgo),vTe;async function fJ(){if(vTe)return vTe;let t=await aXr({cwd:Pgo});if(t)return vTe=t.packageJson,vTe}async function AR(){let t=await fJ();return"0.2.11
|
|
2692
|
+
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=Imo(r,this.#t.message);if(n)return(0,lKr.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}},Imo=(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)}:Iyt(t,Number(n),{oneBased:!0})},Rmo=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${Dmo(n)})`);function Byt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new Ryt({jsonParseError:n,fileName:r,input:t})}}var oXr=ze(nXr(),1);import{fileURLToPath as Dgo}from"node:url";function iXr(t){return t instanceof URL?Dgo(t):t}var Bgo=t=>Rgo.resolve(iXr(t)??".","package.json"),Ngo=(t,e)=>{let r=typeof t=="string"?Byt(t):t;return e&&(0,oXr.default)(r),r};async function sXr({cwd:t,normalize:e=!0}={}){let r=await Igo.readFile(Bgo(t),"utf8");return Ngo(r,e)}async function aXr(t){let e=await PJr("package.json",t);if(e)return{packageJson:await sXr({...t,cwd:Ogo.dirname(e)}),path:e}}import{fileURLToPath as Mgo}from"url";import kgo from"path";var Lgo=Mgo(import.meta.url),Pgo=kgo.dirname(Lgo),vTe;async function fJ(){if(vTe)return vTe;let t=await aXr({cwd:Pgo});if(t)return vTe=t.packageJson,vTe}async function AR(){let t=await fJ();return"0.2.11"}Oa();import nF from"node:process";var lXr={name:"about",description:"show version info",kind:"built-in",action:async t=>{let e=nF.platform,r="no sandbox";nF.env.SANDBOX&&nF.env.SANDBOX!=="sandbox-exec"?r=nF.env.SANDBOX:nF.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${nF.env.SEATBELT_PROFILE||"unknown"})`);let n=t.services.config?.getModel()||"Unknown",i=await AR(),o=t.services.settings.merged.selectedAuthType||"",s=nF.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())}};sn();Oa();var CTe="\x1B[32m";var uXr="\x1B[31m",Pv="\x1B[36m",Q2="\x1B[90m";var Pa="\x1B[0m";function bTe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
|
|
2693
2693
|
${uXr}No agents found${Pa}
|
|
2694
2694
|
`;i="\u{1F7E2} ";let o=`${i}${e}
|
|
2695
2695
|
`;for(let s of t)n?o+=Fgo(s):o+=`${CTe}- ${s.agentType}${Pa}
|
|
@@ -2732,7 +2732,7 @@ ${Q2}Built-in agents (always available)${Pa}
|
|
|
2732
2732
|
${Q2}- general-purpose
|
|
2733
2733
|
${Pa}`;let c=n.length+i.length;t.ui.addItem({type:"info",text:`${CTe}Agents refreshed successfully. Found ${c} agents.${Pa}
|
|
2734
2734
|
|
|
2735
|
-
${CTe}${a.trim()}${Pa}`},Date.now())}catch(e){let r=wr(e);t.ui.addItem({type:"error",text:`${uXr}Error refreshing agents: ${r}${Pa}`},Date.now())}}},{name:"online",description:"Browse and install agents from online repository",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agents-online"})},{name:"install",description:"Install a new agent with guided setup",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agent-install"})}]};Oa();var dXr={name:"auth",description:"change the auth method",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"auth"})};Tq();Oa();import HS from"node:process";import Ugo from"node:os";var dJ="
|
|
2735
|
+
${CTe}${a.trim()}${Pa}`},Date.now())}catch(e){let r=wr(e);t.ui.addItem({type:"error",text:`${uXr}Error refreshing agents: ${r}${Pa}`},Date.now())}}},{name:"online",description:"Browse and install agents from online repository",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agents-online"})},{name:"install",description:"Install a new agent with guided setup",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agent-install"})}]};Oa();var dXr={name:"auth",description:"change the auth method",kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"auth"})};Tq();Oa();import HS from"node:process";import Ugo from"node:os";var dJ="e40eb47b (local modifications)";sn();var pXr={name:"bug",description:"submit a bug report",kind:"built-in",action:async(t,e)=>{let r=(e||"").trim(),{config:n}=t.services,i=qN(),o=`${HS.platform} ${HS.version}`,s="no sandbox";HS.env.SANDBOX&&HS.env.SANDBOX!=="sandbox-exec"?s=HS.env.SANDBOX.replace(/^iflow-(?:code-)?/,""):HS.env.SANDBOX==="sandbox-exec"&&(s=`sandbox-exec (${HS.env.SEATBELT_PROFILE||"unknown"})`);let a=n?.getModel()||"Unknown",c=await AR(),u=tJ(HS.memoryUsage().rss),f=i.getInMemoryErrors(),d="No recent errors";f.length>0&&(d=f.slice(-3).map(N=>`Error (${N.timestamp}):
|
|
2736
2736
|
${N.error}`).join(`
|
|
2737
2737
|
|
|
2738
2738
|
`));let p=Ugo.userInfo().username,h=T=>{if(!p)return T;let N=new RegExp(`/${p}/`,"g");return T.replace(N,"/user/")},g=`CLI Version: ${c}
|
|
@@ -3546,11 +3546,11 @@ ${tr}`},Date.now()),Ao(null),y({type:"info",text:"Plan approval cancelled. The o
|
|
|
3546
3546
|
\u26A1 To increase your limits, upgrade to a iFlow Code Assist Standard or Enterprise plan with higher limits at https://goo.gle/set-up-gemini-code-assist
|
|
3547
3547
|
\u26A1 Or you can utilize a iFlow API Key. See: https://docs.iflow.cn/docs/
|
|
3548
3548
|
\u26A1 You can switch authentication methods by typing /auth`,y({type:"info",text:Ii},Date.now()),uo(!0),t.setQuotaErrorOccurred(!0)}return t.setModel(Br),t.setFallbackMode(!0),Fwe(t,new EW(t.getContentGeneratorConfig().authType)),!1};t.setFlashFallbackHandler(Gt)},[t,y,Yi]);let{rows:Yt,columns:Xt}=Vxe(),{stdin:gr,setRawMode:yn}=L8(),Ni=(0,ir.useRef)(!0),{inputWidth:Hi,suggestionsWidth:po,mainAreaWidth:ta,debugConsoleMaxHeight:Io,staticAreaMaxItemHeight:vd}=(0,ir.useMemo)(()=>({inputWidth:Math.max(20,Math.floor(Xt*.9)-3),suggestionsWidth:Math.max(60,Math.floor(Xt*.8)),mainAreaWidth:Math.floor(Xt*.9),debugConsoleMaxHeight:Math.floor(Math.max(Yt*.2,5)),staticAreaMaxItemHeight:Math.max(Yt*4,100)}),[Xt,Yt]),uu=(0,ir.useCallback)(()=>{let Gt=e.merged.preferredEditor;if(!vae(Gt)){ag();return}return Gt},[e.merged.preferredEditor,ag]),Mn=(0,ir.useCallback)(()=>{Ke("reauth required"),mf()},[mf,Ke]),{vimEnabled:wn,vimMode:tn,toggleVimEnabled:Wn}=QIe(),ro=(0,ir.useRef)(()=>Promise.resolve(!1)),ha=(0,ir.useMemo)(()=>new lR({userSettingsPath:void 0,projectSettingsPath:void 0}),[]),{streamingState:xs,submitQuery:Ll,initError:bd,pendingHistoryItems:Wc,thought:Ih,cancelCurrentProcessing:Gy,historyRecorder:r3}=aJr(t.getGeminiClient(),A,y,pe,t,_e,Gt=>ro.current(Gt),Lt,uu,Mn,Pe,Di,uo,ha),Y2=Nln(K,xs),{handleSlashCommand:z2,slashCommands:Q0,pendingHistoryItems:Cd,commandContext:Hs,shellConfirmationRequest:DE}=HZr(t,e,y,v,S,Y2,pe,_e,C1,mf,P0,ag,Ed,t3,mr,rr,yr,fr,_r,xr,Pr,Wn,Zs,r3);(0,ir.useEffect)(()=>{ro.current=z2},[z2]);let Xv=(0,ir.useCallback)(async Gt=>{if(!pa)return;let tr=JSON.stringify(Gt);await Ll(`/mcp online COMPLETE_VALUE_INPUT:${tr}`)},[pa,Ll]),lg=(0,ir.useCallback)(()=>{Ll("/mcp online q")},[Ll]),Qp=(0,ir.useCallback)(async(Gt,tr)=>{if(typeof Gt=="string"){if(Gt.trim().length===0)return}else if(Gt.length===0)return;p&&(h(!1),Y2());let Br;if(typeof Gt=="string")Br=Gt.trim();else{let xn=[];for(let Ii of Gt)if(Ii.type==="text"){let ko=Ii.content.trim();ko&&xn.push({text:ko})}else Ii.type==="image"&&xn.push({inlineData:{mimeType:Ii.mimeType||"image/png",data:Ii.content}});if(xn.length===0)return;Br=xn}if(xs==="responding"){if(dR.enqueueMessage(Br,tr),typeof Br=="string")y({type:"user",text:Br},Date.now());else{let xn="",Ii=Array.isArray(Br)?Br:[Br];for(let ko of Ii)typeof ko=="string"?xn+=ko:ko&&typeof ko=="object"&&"text"in ko?xn+=ko.text:ko&&typeof ko=="object"&&"inlineData"in ko&&(xn+="[Image]");y({type:"user",text:xn.trim(),content:Ii},Date.now())}y({type:"info",text:"message submit successful"},Date.now()),tr&&y({type:"ide_context",text:tr},Date.now());return}Ll(Br,void 0),tr&&y({type:"ide_context",text:tr},Date.now())},[Ll,xs,y]),x1=Gtn({initialText:"",viewport:{height:10,width:Hi},stdin:gr,setRawMode:yn,isValidPath:Zvo,shellModeActive:Lt}),{handleInput:Fu}=Eln(x1,Qp),{subAgentState:cg}=Bln(xh?hc:null,t,uu);(0,ir.useEffect)(()=>{if(hc&&W2){let Gt=hc.getEventEmitter();if(Gt){let tr=setTimeout(()=>W2(Gt),100);return()=>{clearTimeout(tr)}}}},[hc,W2]),(0,ir.useEffect)(()=>{let Gt=A[A.length-1];Gt&&(Gt.type==="compression"?In(!0):Gt.type==="user"&&(In(!1),an(!1)))},[A]);let IE=[...Cd];IE.push(...Wc);let jy=IE.some(Gt=>Gt.type==="tool_group"&&Gt.tools.some(tr=>tr.status==="Confirming")),{elapsedTime:Vy,currentLoadingPhrase:Zv}=fJr(xs),gC=GZr({config:t}),qp=(0,ir.useCallback)((Gt,tr,Br)=>{Gt?(Br.current&&clearTimeout(Br.current),z2("/quit")):(tr(!0),Br.current=setTimeout(()=>{tr(!1),Br.current=null},Xvo))},[z2]);ji((Gt,tr)=>{if(Ae){if(tr.escape){Ut();return}else if(tr.upArrow){Ne(xn=>xn===0?1:xn-1);return}else if(tr.downArrow){Ne(xn=>xn===1?0:xn+1);return}else if(tr.return){te===1?Dt():Ct();return}}let Br=!1;if(dn||(Br=!0,Ci(!0)),tr.ctrl&&Gt==="o")Zt(xn=>!xn);else if(tr.ctrl&&Gt==="r")Zn&&an(xn=>!xn),en(xn=>!xn);else if(tr.ctrl&&Gt==="t"){let xn=!co;Wi(xn),Object.keys(q||{}).length>0&&z2(xn?"/mcp desc":"/mcp nodesc")}else if(tr.ctrl&&(Gt==="c"||Gt==="C"))qp(dt,xt,Rr);else if(tr.ctrl&&Gt==="z")yn(!1),NR.stdout.write("\u23F8\uFE0F iFlow CLI has been suspended. Run `fg` to bring iFlow CLI back."),NR.kill(NR.pid,"SIGTSTP");else if(tr.ctrl&&(Gt==="d"||Gt==="D")){if(x1.text.length>0)return;qp(Yr,un,fi)}else tr.ctrl&&Gt==="s"&&!Br&&Ci(!1)}),(0,ir.useEffect)(()=>{t&&be(t.getGeminiMdFileCount())},[t]);let q0=tTe(t),[T1,bl]=(0,ir.useState)([]);(0,ir.useEffect)(()=>{(async()=>{let tr=await q0?.getPreviousUserMessages()||[],xn=[...A.filter(ko=>ko.type==="user"&&typeof ko.text=="string"&&ko.text.trim()!=="").map(ko=>ko.text).reverse(),...tr],Ii=[];if(xn.length>0){Ii.push(xn[0]);for(let ko=1;ko<xn.length;ko++)xn[ko]!==xn[ko-1]&&Ii.push(xn[ko])}bl(Ii.reverse())})()},[A,q0]);let n3=!bd&&!Xs,ap=(0,ir.useCallback)(()=>{v(),F(),console.clear(),Y2()},[v,F,Y2]),ug=(0,ir.useRef)(null),H0=(0,ir.useRef)(null);(0,ir.useEffect)(()=>{if(ug.current){let Gt=rOe(ug.current);Mr(Gt.height)}},[Yt,Q,Ft]);let G0=3,i3=(0,ir.useMemo)(()=>Yt-Ar-G0,[Yt,Ar]);(0,ir.useEffect)(()=>{if(Ni.current){Ni.current=!1;return}let Gt=setTimeout(()=>{$(!1),Y2()},300);return()=>{clearTimeout(Gt)}},[Xt,Yt,Y2]);let $y=(0,ir.useMemo)(()=>t.getDebugMode()?Q:Q.filter(Gt=>Gt.type!=="debug"),[Q,t]),o3=fln(M),Hp=(0,ir.useMemo)(()=>{let Gt=e.merged.contextFileName;return Gt?Array.isArray(Gt)?Gt:[Gt]:nL()},[e.merged.contextFileName]),Gp=(0,ir.useMemo)(()=>t.getQuestion(),[t]),fg=(0,ir.useMemo)(()=>t.getGeminiClient(),[t]);(0,ir.useEffect)(()=>{Gp&&!ec.current&&!Pu&&!Fp&&!yd&&!sg&&!vl&&!sp&&!ie&&!re&&!he&&!J&&!Te&&!Li&&!ns&&!pa&&fg?.isInitialized?.()&&(Ll(Gp),ec.current=!0)},[Gp,Ll,Pu,Fp,yd,sg,vl,sp,ie,re,he,Te,Li,ns,pa,fg]);let Wy=(0,ir.useMemo)(()=>wn?" Press 'i' for INSERT mode and 'Esc' for NORMAL mode.":" Type your message or @path/to/file",[wn]);return mt?(0,Ir.jsx)(ye,{flexDirection:"column",marginBottom:1,children:mt.map(Gt=>(0,Ir.jsx)(LIe,{availableTerminalHeight:dn?i3:void 0,terminalWidth:Xt,item:Gt,isPending:!1,subAgentState:cg,taskTool:hc,config:t,showCompressionDetails:Jt,showTaskDetails:Fr,taskExpandedStates:Zr,onToggleTaskExpanded:vi},Gt.id))}):(0,Ir.jsx)(Q6t.Provider,{value:xs,children:(0,Ir.jsxs)(ye,{flexDirection:"column",width:"90%",children:[(0,Ir.jsx)(Jde,{items:[(0,Ir.jsxs)(ye,{flexDirection:"column",children:[!e.merged.hideBanner&&p&&(0,Ir.jsx)(otn,{terminalWidth:Xt,version:n,nightly:g}),!e.merged.hideTips&&(0,Ir.jsx)(fan,{config:t})]},"header"),...A.map(Gt=>(0,Ir.jsx)(LIe,{terminalWidth:ta,availableTerminalHeight:vd,item:Gt,isPending:!1,config:t,subAgentState:cg,taskTool:hc,constrainHeight:dn,showCompressionDetails:Jt,showTaskDetails:Fr,taskExpandedStates:Zr,onToggleTaskExpanded:vi},Gt.id))],children:Gt=>Gt},X),(0,Ir.jsx)(UJ,{children:(0,Ir.jsxs)(ye,{ref:H0,flexDirection:"column",children:[IE.map((Gt,tr)=>(0,Ir.jsx)(LIe,{availableTerminalHeight:dn?i3:void 0,terminalWidth:ta,item:{...Gt,id:0},isPending:!0,config:t,isFocused:!sp,subAgentState:cg,taskTool:hc,constrainHeight:dn,showCompressionDetails:Jt,showTaskDetails:Fr,taskExpandedStates:Zr,onToggleTaskExpanded:vi},tr)),(0,Ir.jsx)(oK,{constrainHeight:dn})]})}),Se&&(0,Ir.jsx)(nin,{commands:Q0}),(0,Ir.jsxs)(ye,{flexDirection:"column",ref:ug,children:[u&&(0,Ir.jsx)(bln,{message:u.message}),r.length>0&&(0,Ir.jsx)(ye,{borderStyle:"round",borderColor:Ee.AccentYellow,paddingX:1,marginY:1,flexDirection:"column",children:r.map((Gt,tr)=>(0,Ir.jsx)(se,{color:Ee.AccentYellow,children:Gt},tr))}),ns?(0,Ir.jsx)(Ynn,{plan:ns.plan,onApprove:Dh,onKeepPlanning:U0,onExit:Ye}):DE?(0,Ir.jsx)(Vnn,{request:DE}):Ss?(0,Ir.jsxs)(ye,{flexDirection:"column",children:[je&&(0,Ir.jsx)(ye,{marginBottom:1,children:(0,Ir.jsx)(se,{color:Ee.AccentRed,children:je})}),(0,Ir.jsx)(Uln,{sessions:At,onSelect:U})]}):vl?(0,Ir.jsxs)(ye,{flexDirection:"column",children:[Ie&&(0,Ir.jsx)(ye,{marginBottom:1,children:(0,Ir.jsx)(se,{color:Ee.AccentRed,children:Ie})}),(0,Ir.jsx)(knn,{onSelect:np,onHighlight:ip,settings:e,availableTerminalHeight:dn?Yt-G0:void 0,terminalWidth:ta})]}):Pu?(0,Ir.jsxs)(Ir.Fragment,{children:[(0,Ir.jsx)(Fnn,{onTimeout:()=>{Ke("Authentication timed out. Please try again."),wh(),mf()}}),Ft&&(0,Ir.jsx)(UJ,{children:(0,Ir.jsxs)(ye,{flexDirection:"column",children:[(0,Ir.jsx)(VEt,{messages:$y,maxHeight:dn?Io:void 0,width:Hi}),(0,Ir.jsx)(oK,{constrainHeight:dn})]})}),Jt&&(0,Ir.jsx)(UJ,{children:(0,Ir.jsxs)(ye,{flexDirection:"column",children:[(0,Ir.jsx)($Et,{history:A,maxHeight:dn?Io:void 0,width:Hi,showDetails:Jt}),(0,Ir.jsx)(oK,{constrainHeight:dn})]})})]}):sg&&op?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(Hnn,{onSelect:Th,onCancel:F0,requestedModel:op.requestedModel,reason:op.reason,availableModels:op.availableModels,suggestedModel:op.suggestedModel,taskPrompt:op.taskPrompt})}):yd?(0,Ir.jsxs)(ye,{flexDirection:"column",children:[nt&&(0,Ir.jsx)(ye,{marginBottom:1,children:(0,Ir.jsx)(se,{color:Ee.AccentRed,children:nt})}),(0,Ir.jsx)(qnn,{onSelect:lu,onCancel:ZA,settings:e,initialErrorMessage:nt})]}):Fp?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(Pnn,{onSelect:$c,settings:e,initialErrorMessage:Le})}):og?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(Unn,{onContinue:Up})}):pa?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(HDe,{serverName:pa.serverName,values:pa.values,onComplete:Xv,onCancel:lg})}):sp?(0,Ir.jsxs)(ye,{flexDirection:"column",children:[vt&&(0,Ir.jsx)(ye,{marginBottom:1,children:(0,Ir.jsx)(se,{color:Ee.AccentRed,children:vt})}),(0,Ir.jsx)(jnn,{onSelect:w1,settings:e,onExit:Hy})]}):ie?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(Jnn,{settings:e,config:t,onExit:()=>de(!1),onStatusUpdate:Sn})}):re?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(Znn,{settings:e,config:t,onExit:()=>oe(!1),onStatusUpdate:fo})}):he?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(ein,{settings:e,config:t,onExit:()=>ue(!1),onStatusUpdate:ws})}):J?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(tin,{settings:e,config:t,onExit:()=>Z(!1),onStatusUpdate:Bi})}):Te?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)(rin,{settings:e,config:t,onExit:()=>ve(!1),onStatusUpdate:sl})}):Li?(0,Ir.jsx)(xln,{onExit:()=>vn(!1),config:t}):Ae?(0,Ir.jsx)(ye,{flexDirection:"column",children:(0,Ir.jsx)($nn,{servers:Qe,cwd:He,selectedIndex:te,onSelect:Ct,onCancel:Ut})}):(0,Ir.jsxs)(Ir.Fragment,{children:[(0,Ir.jsx)(ftn,{thought:xs==="waiting_for_confirmation"||t.getAccessibility()?.disableLoadingPhrases?void 0:Ih,currentLoadingPhrase:t.getAccessibility()?.disableLoadingPhrases?void 0:Zv,elapsedTime:Vy}),(0,Ir.jsx)(Qln,{}),(0,Ir.jsxs)(ye,{marginTop:1,display:"flex",justifyContent:"space-between",width:"100%",children:[(0,Ir.jsxs)(ye,{children:[NR.env.GEMINI_SYSTEM_MD&&(0,Ir.jsx)(se,{color:Ee.AccentRed,children:"|\u2310\u25A0_\u25A0| "}),dt?(0,Ir.jsx)(se,{color:Ee.AccentYellow,children:"Press Ctrl+C again to exit."}):Yr?(0,Ir.jsx)(se,{color:Ee.AccentYellow,children:"Press Ctrl+D again to exit."}):(0,Ir.jsx)(aln,{geminiMdFileCount:me,contextFileNames:Hp,mcpServers:q,blockedMcpServers:L,showToolDescriptions:co})]}),(0,Ir.jsxs)(ye,{children:[!Lt&&(0,Ir.jsx)(dtn,{approvalMode:gC}),Lt&&(0,Ir.jsx)(ptn,{})]})]}),Ft&&(0,Ir.jsx)(UJ,{children:(0,Ir.jsxs)(ye,{flexDirection:"column",children:[(0,Ir.jsx)(VEt,{messages:$y,maxHeight:dn?Io:void 0,width:Hi}),(0,Ir.jsx)(oK,{constrainHeight:dn})]})}),Jt&&(0,Ir.jsx)(UJ,{children:(0,Ir.jsxs)(ye,{flexDirection:"column",children:[(0,Ir.jsx)($Et,{history:A,maxHeight:dn?Io:void 0,width:Hi,showDetails:Jt}),(0,Ir.jsx)(oK,{constrainHeight:dn})]})}),n3&&(0,Ir.jsx)(Ytn,{buffer:x1,inputWidth:Hi,suggestionsWidth:po,onSubmit:Qp,userMessages:T1,onClearScreen:ap,config:t,slashCommands:Q0,commandContext:Hs,shellModeActive:Lt,setShellModeActive:Pt,focus:c,vimHandleInput:Fu,placeholder:Wy,agentsOnlineMode:Ua,hasActiveToolConfirmation:jy})]}),bd&&xs!=="responding"&&(0,Ir.jsx)(ye,{borderStyle:"round",borderColor:Ee.AccentRed,paddingX:1,marginBottom:1,children:A.find(Gt=>Gt.type==="error"&&Gt.text?.includes(bd))?.text?(0,Ir.jsx)(se,{color:Ee.AccentRed,children:A.find(Gt=>Gt.type==="error"&&Gt.text?.includes(bd))?.text}):(0,Ir.jsxs)(Ir.Fragment,{children:[(0,Ir.jsxs)(se,{color:Ee.AccentRed,children:["Initialization Error: ",bd]}),(0,Ir.jsxs)(se,{color:Ee.AccentRed,children:[" ","Please check API key and configuration."]})]})}),(0,Ir.jsx)(Ztn,{model:ut,targetDir:M,debugMode:O,branchName:o3,debugMessage:ge,corgiMode:Fe,errorCount:Lf,showErrorDetails:Ft,showMemoryUsage:j,promptTokenCount:G.lastPromptTokenCount,nightly:g,vimMode:wn?tn:void 0,ideConnectionStatus:w,ideFileInfo:N,version:n})]})]})})};async function $ln(){return new Promise((t,e)=>{let r="";process.stdin.setEncoding("utf8");let n=()=>{let a;for(;(a=process.stdin.read())!==null;)r+=a},i=()=>{s(),t(r)},o=a=>{s(),e(a)},s=()=>{process.stdin.removeListener("readable",n),process.stdin.removeListener("end",i),process.stdin.removeListener("error",o)};process.stdin.on("readable",n),process.stdin.on("end",i),process.stdin.on("error",o)})}import{basename as Ydn}from"node:path";import H9o from"node:v8";import G9o from"node:os";import j9o from"node:dns";import{spawn as V9o}from"node:child_process";var afe=ze(ime(),1);Mf();import{exec as t8o,execSync as OR,spawn as uK}from"node:child_process";import Kv from"node:os";import fC from"node:path";import M0 from"node:fs";import{readFile as r8o}from"node:fs/promises";import{promisify as n8o}from"util";var E5t=n8o(t8o);function KA(t){if(Kv.platform()!=="win32")return t;let r=t.replace(/\\/g,"/").match(/^([A-Z]):\/(.*)/i);return r?`/${r[1].toLowerCase()}/${r[2]}`:t}var Yln="iflow-cli-sandbox",zIe="iflow-cli-sandbox",FF="iflow-cli-sandbox-proxy",i8o=["permissive-open","permissive-closed","permissive-proxied","restrictive-open","restrictive-closed","restrictive-proxied"];async function o8o(){let t=process.env.SANDBOX_SET_UID_GID?.toLowerCase().trim();if(t==="1"||t==="true")return!0;if(t==="0"||t==="false")return!1;if(Kv.platform()==="linux")try{let e=await r8o("/etc/os-release","utf8");if(e.includes("ID=debian")||e.includes("ID=ubuntu")||e.match(/^ID_LIKE=.*debian.*/m)||e.match(/^ID_LIKE=.*ubuntu.*/m))return console.error("INFO: Defaulting to use current user UID/GID for Debian/Ubuntu-based Linux."),!0}catch{console.warn("Warning: Could not read /etc/os-release to auto-detect Debian/Ubuntu for UID/GID default.")}return!1}function s8o(t){let[e,r]=t.split(":"),n=e.split("/").at(-1)??"unknown-image";return r?`${n}-${r}`:n}function zln(){return(process.env.SANDBOX_PORTS??"").split(",").filter(t=>t.trim()).map(t=>t.trim())}function a8o(t){let e=Kv.platform()==="win32",r=KA(t),n=[],i=e?";":":",o="";if(process.env.PATH){let d=process.env.PATH.split(i);for(let p of d){let h=KA(p);h.toLowerCase().startsWith(r.toLowerCase())&&(o+=`:${h}`)}}o&&n.push(`export PATH="$PATH${o}";`);let s="";if(process.env.PYTHONPATH){let d=process.env.PYTHONPATH.split(i);for(let p of d){let h=KA(p);h.toLowerCase().startsWith(r.toLowerCase())&&(s+=`:${h}`)}}s&&n.push(`export PYTHONPATH="$PYTHONPATH${s}";`);let a=fC.join(W9,"sandbox.bashrc");M0.existsSync(a)&&n.push(`source ${KA(a)};`),zln().forEach(d=>n.push(`socat TCP4-LISTEN:${d},bind=$(hostname -i),fork,reuseaddr TCP4:127.0.0.1:${d} 2> /dev/null &`));let c=process.argv.slice(2).map(d=>(0,afe.quote)([d])),u=process.env.NODE_ENV==="development"?process.env.DEBUG?"npm run debug --":"npm rebuild && npm run start --":process.env.DEBUG?`node --inspect-brk=0.0.0.0:${process.env.DEBUG_PORT||"9229"} $(which iflow)`:"iflow";return["bash","-c",[...n,u,...c].join(" ")]}async function Jln(t,e=[],r){if(t.command==="sandbox-exec"){process.env.BUILD_SANDBOX&&(console.error("ERROR: cannot BUILD_SANDBOX when using macOS Seatbelt"),process.exit(1));let Q=process.env.SEATBELT_PROFILE??="permissive-open",D=new URL(`sandbox-macos-${Q}.sb`,import.meta.url).pathname;i8o.includes(Q)||(D=fC.join(W9,`sandbox-macos-${Q}.sb`)),M0.existsSync(D)||(console.error(`ERROR: missing macos seatbelt profile file '${D}'`),process.exit(1)),console.error(`using macos seatbelt (profile: ${Q}) ...`);let F=[...process.env.DEBUG?["--inspect-brk"]:[],...e].join(" "),O=["-D",`TARGET_DIR=${M0.realpathSync(process.cwd())}`,"-D",`TMP_DIR=${M0.realpathSync(Kv.tmpdir())}`,"-D",`HOME_DIR=${M0.realpathSync(Kv.homedir())}`,"-D",`CACHE_DIR=${M0.realpathSync(OR("getconf DARWIN_USER_CACHE_DIR").toString().trim())}`],q=5,L=M0.realpathSync(r?.getTargetDir()||""),M=[];if(r){let K=r.getWorkspaceContext().getDirectories();for(let me of K){let be=M0.realpathSync(me);be!==L&&M.push(be)}}for(let X=0;X<q;X++){let K="/dev/null";X<M.length&&(K=M[X]),O.push("-D",`INCLUDE_DIR_${X}=${K}`)}O.push("-f",D,"sh","-c",["SANDBOX=sandbox-exec",`NODE_OPTIONS="${F}"`,...process.argv.map(X=>(0,afe.quote)([X]))].join(" "));let j=process.env.IFLOW_SANDBOX_PROXY_COMMAND,G,W,$={...process.env};if(j){let X=process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||"http://localhost:8877";$.HTTPS_PROXY=X,$.https_proxy=X,$.HTTP_PROXY=X,$.http_proxy=X;let K=process.env.NO_PROXY||process.env.no_proxy;K&&($.NO_PROXY=K,$.no_proxy=K),G=uK(j,{stdio:["ignore","pipe","pipe"],shell:!0,detached:!0});let me=()=>{console.log("stopping proxy ..."),G?.pid&&process.kill(-G.pid,"SIGTERM")};process.on("exit",me),process.on("SIGINT",me),process.on("SIGTERM",me),G.stderr?.on("data",be=>{console.error(be.toString())}),G.on("close",(be,ge)=>{console.error(`ERROR: proxy command '${j}' exited with code ${be}, signal ${ge}`),W?.pid&&process.kill(-W.pid,"SIGTERM"),process.exit(1)}),console.log("waiting for proxy to start ..."),await E5t("until timeout 0.25 curl -s http://localhost:8877; do sleep 0.25; done")}W=uK(t.command,O,{stdio:"inherit"}),await new Promise(X=>W?.on("close",X));return}console.error(`hopping into sandbox (command: ${t.command}) ...`);let n=M0.realpathSync(process.argv[1]),i=fC.join(W9,"sandbox.Dockerfile"),o=M0.existsSync(i),s=t.image,a=fC.resolve(process.cwd()),c=KA(a);if(process.env.BUILD_SANDBOX)if(!n.includes("iflow-cli/packages/"))console.error("ERROR: cannot build sandbox using installed iflow binary; run `npm link ./packages/cli` under iflow-cli repo to switch to linked binary."),process.exit(1);else{console.error("building sandbox ...");let Q=n.split("/packages/")[0],D="",F=fC.join(W9,"sandbox.Dockerfile");o&&(console.error(`using ${F} for sandbox`),D+=`-f ${fC.resolve(F)} -i ${s}`),OR(`cd ${Q} && node scripts/build_sandbox.js -s ${D}`,{stdio:"inherit",env:{...process.env,IFLOW_SANDBOX:t.command}})}await c8o(t.command,s)||(console.error(`ERROR: Sandbox image '${s}' is missing or could not be pulled. ${s===Yln?"Try running `npm run build:all` or `npm run build:sandbox` under the iflow-cli repo to build it locally, or check the image name and your network connection.":"Please check the image name, your network connection, or notify iflow-cli-dev@google.com if the issue persists."}`),process.exit(1));let u=["run","-i","--rm","--init","--workdir",c];if(process.env.SANDBOX_FLAGS){let Q=(0,afe.parse)(process.env.SANDBOX_FLAGS,process.env).filter(D=>typeof D=="string");u.push(...Q)}process.stdin.isTTY&&u.push("-t"),u.push("--volume",`${a}:${c}`);let f=ITe,d=KA(`/home/node/${W9}`);M0.existsSync(f)||M0.mkdirSync(f),u.push("--volume",`${f}:${d}`),d!==f&&u.push("--volume",`${f}:${KA(f)}`),u.push("--volume",`${Kv.tmpdir()}:${KA(Kv.tmpdir())}`);let p=fC.join(Kv.homedir(),".config","gcloud");if(M0.existsSync(p)&&u.push("--volume",`${p}:${KA(p)}:ro`),process.env.GOOGLE_APPLICATION_CREDENTIALS){let Q=process.env.GOOGLE_APPLICATION_CREDENTIALS;M0.existsSync(Q)&&(u.push("--volume",`${Q}:${KA(Q)}:ro`),u.push("--env",`GOOGLE_APPLICATION_CREDENTIALS=${KA(Q)}`))}if(process.env.SANDBOX_MOUNTS){for(let Q of process.env.SANDBOX_MOUNTS.split(","))if(Q.trim()){let[D,F,O]=Q.trim().split(":");F=F||D,O=O||"ro",Q=`${D}:${F}:${O}`,fC.isAbsolute(D)||(console.error(`ERROR: path '${D}' listed in SANDBOX_MOUNTS must be absolute`),process.exit(1)),M0.existsSync(D)||(console.error(`ERROR: missing mount path '${D}' listed in SANDBOX_MOUNTS`),process.exit(1)),console.error(`SANDBOX_MOUNTS: ${D} -> ${F} (${O})`),u.push("--volume",Q)}}if(zln().forEach(Q=>u.push("--publish",`${Q}:${Q}`)),process.env.DEBUG){let Q=process.env.DEBUG_PORT||"9229";u.push("--publish",`${Q}:${Q}`)}let h=process.env.IFLOW_SANDBOX_PROXY_COMMAND;if(h){let Q=process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||"http://localhost:8877";Q=Q.replace("localhost",FF),Q&&(u.push("--env",`HTTPS_PROXY=${Q}`),u.push("--env",`https_proxy=${Q}`),u.push("--env",`HTTP_PROXY=${Q}`),u.push("--env",`http_proxy=${Q}`));let D=process.env.NO_PROXY||process.env.no_proxy;D&&(u.push("--env",`NO_PROXY=${D}`),u.push("--env",`no_proxy=${D}`)),Q&&(OR(`${t.command} network inspect ${zIe} || ${t.command} network create --internal ${zIe}`),u.push("--network",zIe),h&&OR(`${t.command} network inspect ${FF} || ${t.command} network create ${FF}`))}let g=s8o(s),A=0,y=OR(`${t.command} ps -a --format "{{.Names}}"`).toString().trim();for(;y.includes(`${g}-${A}`);)A++;let v=`${g}-${A}`;if(u.push("--name",v,"--hostname",v),process.env.GEMINI_API_KEY&&u.push("--env",`GEMINI_API_KEY=${process.env.GEMINI_API_KEY}`),process.env.GOOGLE_API_KEY&&u.push("--env",`GOOGLE_API_KEY=${process.env.GOOGLE_API_KEY}`),process.env.GOOGLE_GENAI_USE_VERTEXAI&&u.push("--env",`GOOGLE_GENAI_USE_VERTEXAI=${process.env.GOOGLE_GENAI_USE_VERTEXAI}`),process.env.GOOGLE_GENAI_USE_GCA&&u.push("--env",`GOOGLE_GENAI_USE_GCA=${process.env.GOOGLE_GENAI_USE_GCA}`),process.env.GOOGLE_CLOUD_PROJECT&&u.push("--env",`GOOGLE_CLOUD_PROJECT=${process.env.GOOGLE_CLOUD_PROJECT}`),process.env.GOOGLE_CLOUD_LOCATION&&u.push("--env",`GOOGLE_CLOUD_LOCATION=${process.env.GOOGLE_CLOUD_LOCATION}`),process.env.GEMINI_MODEL&&u.push("--env",`GEMINI_MODEL=${process.env.GEMINI_MODEL}`),process.env.TERM&&u.push("--env",`TERM=${process.env.TERM}`),process.env.COLORTERM&&u.push("--env",`COLORTERM=${process.env.COLORTERM}`),process.env.VIRTUAL_ENV?.toLowerCase().startsWith(a.toLowerCase())){let Q=fC.resolve(W9,"sandbox.venv");M0.existsSync(Q)||M0.mkdirSync(Q,{recursive:!0}),u.push("--volume",`${Q}:${KA(process.env.VIRTUAL_ENV)}`),u.push("--env",`VIRTUAL_ENV=${KA(process.env.VIRTUAL_ENV)}`)}if(process.env.SANDBOX_ENV)for(let Q of process.env.SANDBOX_ENV.split(","))(Q=Q.trim())&&(Q.includes("=")?(console.error(`SANDBOX_ENV: ${Q}`),u.push("--env",Q)):(console.error("ERROR: SANDBOX_ENV must be a comma-separated list of key=value pairs"),process.exit(1)));let S=process.env.NODE_OPTIONS||"",w=[...S?[S]:[],...e].join(" ");if(w.length>0&&u.push("--env",`NODE_OPTIONS="${w}"`),u.push("--env",`SANDBOX=${v}`),t.command==="podman"){let Q=fC.join(Kv.tmpdir(),"empty_auth.json");M0.writeFileSync(Q,"{}","utf-8"),u.push("--authfile",Q)}let T="",N=a8o(a);if(process.env.GEMINI_CLI_INTEGRATION_TEST==="true")u.push("--user","root"),T="--user root";else if(await o8o()){u.push("--user","root");let Q=OR("id -u").toString().trim(),D=OR("id -g").toString().trim(),F="iflow",O=KA(Kv.homedir()),q=[`groupadd -f -g ${D} ${F}`,`id -u ${F} &>/dev/null || useradd -o -u ${Q} -g ${D} -d ${O} -s /bin/bash ${F}`].join(" && "),M=N[2].replace(/'/g,"'\\''"),j=`su -p ${F} -c '${M}'`;N[2]=`${q} && ${j}`,T=`--user ${Q}:${D}`,u.push("--env",`HOME=${Kv.homedir()}`)}u.push(s),u.push(...N);let P,U;if(h){let Q=`${t.command} run --rm --init ${T} --name ${FF} --network ${FF} -p 8877:8877 -v ${process.cwd()}:${a} --workdir ${a} ${s} ${h}`;P=uK(Q,{stdio:["ignore","pipe","pipe"],shell:!0,detached:!0});let D=()=>{console.log("stopping proxy container ..."),OR(`${t.command} rm -f ${FF}`)};process.on("exit",D),process.on("SIGINT",D),process.on("SIGTERM",D),P.stderr?.on("data",F=>{console.error(F.toString().trim())}),P.on("close",(F,O)=>{console.error(`ERROR: proxy container command '${Q}' exited with code ${F}, signal ${O}`),U?.pid&&process.kill(-U.pid,"SIGTERM"),process.exit(1)}),console.log("waiting for proxy to start ..."),await E5t("until timeout 0.25 curl -s http://localhost:8877; do sleep 0.25; done"),await E5t(`${t.command} network connect ${zIe} ${FF}`)}U=uK(t.command,u,{stdio:"inherit"}),U.on("error",Q=>{console.error("Sandbox process error:",Q)}),await new Promise(Q=>{U?.on("close",(D,F)=>{D!==0&&console.log(`Sandbox process exited with code: ${D}, signal: ${F}`),Q()})})}async function Wln(t,e){return new Promise(r=>{let i=uK(t,["images","-q",e]),o="";i.stdout&&i.stdout.on("data",s=>{o+=s.toString()}),i.on("error",s=>{console.warn(`Failed to start '${t}' command for image check: ${s.message}`),r(!1)}),i.on("close",s=>{r(o.trim()!=="")})})}async function l8o(t,e){return console.info(`Attempting to pull image ${e} using ${t}...`),new Promise(r=>{let i=uK(t,["pull",e],{stdio:"pipe"}),o="",s=d=>{console.info(d.toString().trim())},a=d=>{o+=d.toString(),console.error(d.toString().trim())},c=d=>{console.warn(`Failed to start '${t} pull ${e}' command: ${d.message}`),f(),r(!1)},u=d=>{d===0?(console.info(`Successfully pulled image ${e}.`),f(),r(!0)):(console.warn(`Failed to pull image ${e}. '${t} pull ${e}' exited with code ${d}.`),o.trim(),f(),r(!1))},f=()=>{i.stdout&&i.stdout.removeListener("data",s),i.stderr&&i.stderr.removeListener("data",a),i.removeListener("error",c),i.removeListener("close",u),i.connected&&i.disconnect()};i.stdout&&i.stdout.on("data",s),i.stderr&&i.stderr.on("data",a),i.on("error",c),i.on("close",u)})}async function c8o(t,e){return console.info(`Checking for sandbox image: ${e}`),await Wln(t,e)?(console.info(`Sandbox image ${e} found locally.`),!0):(console.info(`Sandbox image ${e} not found locally.`),e===Yln?!1:await l8o(t,e)?await Wln(t,e)?(console.info(`Sandbox image ${e} is now available after pulling.`),!0):(console.warn(`Sandbox image ${e} still not found after a pull attempt. This might indicate an issue with the image name or registry, or the pull command reported success but failed to make the image available.`),!1):(console.error(`Failed to obtain sandbox image ${e} after check and pull attempt.`),!1))}Mf();sn();import v5t from"fs/promises";import u8o from"os";import{join as f8o}from"node:path";var b5t=f8o(u8o.tmpdir(),"iflow-cli-warnings.txt");async function Kln(){try{await v5t.access(b5t);let e=(await v5t.readFile(b5t,"utf-8")).split(`
|
|
3549
|
-
`).filter(r=>r.trim()!=="");try{await v5t.unlink(b5t)}catch{e.push("Warning: Could not delete temporary warnings file.")}return e}catch(t){return t instanceof Error&&"code"in t&&t.code==="ENOENT"?[]:[`Error checking/reading warnings file: ${wr(t)}`]}}import C5t from"fs/promises";import*as Xln from"os";import d8o from"path";var p8o={id:"home-directory",check:async t=>{try{let[e,r]=await Promise.all([C5t.realpath(t),C5t.realpath(Xln.homedir())]);return e===r?"You are running iFlow CLI in your home directory. It is recommended to run in a project-specific directory.":null}catch{return"Could not verify the current directory due to a file system error."}}},h8o={id:"root-directory",check:async t=>{try{let e=await C5t.realpath(t),r="Warning: You are running iFlow CLI in the root directory. Your entire folder structure will be used for context. It is strongly recommended to run in a project-specific directory.";return d8o.dirname(e)===e?r:null}catch{return"Could not verify the current directory due to a file system error."}}},m8o=[p8o,h8o];async function Zln(t){return(await Promise.all(m8o.map(r=>r.check(t)))).filter(r=>r!==null)}sn();async function ecn(t,e,r){await t.initialize(),process.stdout.on("error",
|
|
3550
|
-
Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json.`);return}let
|
|
3551
|
-
`)
|
|
3552
|
-
[
|
|
3553
|
-
`);return}}}catch(p){console.error(tue(p,t.getContentGeneratorConfig()?.authType)),process.exit(1)}finally{u1()&&await Bz()}}sn();import KF from"node:process";import{spawn as v9o}from"node:child_process";import{fileURLToPath as b9o}from"node:url";import Yfn from"node:path";import{format as vvt}from"node:util";var ffe=ze(Yg(),1);import ufe from"node:path";import S8o from"node:os";import g8o from"os";import JIe from"path";var MR=g8o.homedir(),{env:UF}=process,tcn=UF.XDG_DATA_HOME||(MR?JIe.join(MR,".local","share"):void 0),fK=UF.XDG_CONFIG_HOME||(MR?JIe.join(MR,".config"):void 0),zXs=UF.XDG_STATE_HOME||(MR?JIe.join(MR,".local","state"):void 0),JXs=UF.XDG_CACHE_HOME||(MR?JIe.join(MR,".cache"):void 0),KXs=UF.XDG_RUNTIME_DIR||void 0,A8o=(UF.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");tcn&&A8o.unshift(tcn);var y8o=(UF.XDG_CONFIG_DIRS||"/etc/xdg").split(":");fK&&y8o.unshift(fK);import C8o from"node:path";import il from"node:fs";import{promisify as ng}from"node:util";var KS=(t,e)=>function(...n){return t.apply(void 0,n).catch(e)},dC=(t,e)=>function(...n){try{return t.apply(void 0,n)}catch(i){return e(i)}};import rcn from"node:process";var ncn=rcn.getuid?!rcn.getuid():!1,icn=1e4,XA=()=>{};var lfe={isChangeErrorOk:t=>{if(!lfe.isNodeError(t))return!1;let{code:e}=t;return e==="ENOSYS"||!ncn&&(e==="EINVAL"||e==="EPERM")},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!lfe.isNodeError(t))return!1;let{code:e}=t;return e==="EMFILE"||e==="ENFILE"||e==="EAGAIN"||e==="EBUSY"||e==="EACCESS"||e==="EACCES"||e==="EACCS"||e==="EPERM"},onChangeError:t=>{if(!lfe.isNodeError(t))throw t;if(!lfe.isChangeErrorOk(t))throw t}},tp=lfe;var _5t=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=icn,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=e=>{this.queueWaiting.add(e),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=e=>{this.queueWaiting.delete(e),this.queueActive.delete(e)},this.schedule=()=>new Promise(e=>{let r=()=>this.remove(n),n=()=>e(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let e of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(e),this.queueActive.add(e),e()}}}}},ocn=new _5t;var XS=(t,e)=>function(n){return function i(...o){return ocn.schedule().then(s=>{let a=u=>(s(),u),c=u=>{if(s(),Date.now()>=n)throw u;if(e(u)){let f=Math.round(100*Math.random());return new Promise(p=>setTimeout(p,f)).then(()=>i.apply(void 0,o))}throw u};return t.apply(void 0,o).then(a,c)})}},ZS=(t,e)=>function(n){return function i(...o){try{return t.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(e(s))return i.apply(void 0,o);throw s}}};var E8o={attempt:{chmod:KS(ng(il.chmod),tp.onChangeError),chown:KS(ng(il.chown),tp.onChangeError),close:KS(ng(il.close),XA),fsync:KS(ng(il.fsync),XA),mkdir:KS(ng(il.mkdir),XA),realpath:KS(ng(il.realpath),XA),stat:KS(ng(il.stat),XA),unlink:KS(ng(il.unlink),XA),chmodSync:dC(il.chmodSync,tp.onChangeError),chownSync:dC(il.chownSync,tp.onChangeError),closeSync:dC(il.closeSync,XA),existsSync:dC(il.existsSync,XA),fsyncSync:dC(il.fsync,XA),mkdirSync:dC(il.mkdirSync,XA),realpathSync:dC(il.realpathSync,XA),statSync:dC(il.statSync,XA),unlinkSync:dC(il.unlinkSync,XA)},retry:{close:XS(ng(il.close),tp.isRetriableError),fsync:XS(ng(il.fsync),tp.isRetriableError),open:XS(ng(il.open),tp.isRetriableError),readFile:XS(ng(il.readFile),tp.isRetriableError),rename:XS(ng(il.rename),tp.isRetriableError),stat:XS(ng(il.stat),tp.isRetriableError),write:XS(ng(il.write),tp.isRetriableError),writeFile:XS(ng(il.writeFile),tp.isRetriableError),closeSync:ZS(il.closeSync,tp.isRetriableError),fsyncSync:ZS(il.fsyncSync,tp.isRetriableError),openSync:ZS(il.openSync,tp.isRetriableError),readFileSync:ZS(il.readFileSync,tp.isRetriableError),renameSync:ZS(il.renameSync,tp.isRetriableError),statSync:ZS(il.statSync,tp.isRetriableError),writeSync:ZS(il.writeSync,tp.isRetriableError),writeFileSync:ZS(il.writeFileSync,tp.isRetriableError)}},k0=E8o;import scn from"node:os";import S5t from"node:process";var acn="utf8",w5t=438,lcn=511;var ccn={},ucn=scn.userInfo().uid,fcn=scn.userInfo().gid;var dcn=1e3,pcn=!!S5t.getuid,AZs=S5t.getuid?!S5t.getuid():!1,x5t=128;var hcn=t=>t instanceof Error&&"code"in t;var T5t=t=>typeof t=="string",KIe=t=>t===void 0;import b8o from"node:path";import dK from"node:process";import mcn from"node:process";var gcn=mcn.platform==="linux",XIe=mcn.platform==="win32";var D5t=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];XIe||D5t.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");gcn&&D5t.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED");var Acn=D5t;var I5t=class{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=e=>{if(!this.exited){this.exited=!0;for(let r of this.callbacks)r();e&&(XIe&&e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"?dK.kill(dK.pid,"SIGTERM"):dK.kill(dK.pid,e))}},this.hook=()=>{dK.once("exit",()=>this.exit());for(let e of Acn)try{dK.once(e,()=>this.exit(e))}catch{}},this.register=e=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}},ycn=new I5t;var v8o=ycn.register,Ecn=v8o;var Py={store:{},create:t=>{let e=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),i=`.tmp-${Date.now().toString().slice(-10)}${e}`;return`${t}${i}`},get:(t,e,r=!0)=>{let n=Py.truncate(e(t));return n in Py.store?Py.get(t,e,r):(Py.store[n]=r,[n,()=>delete Py.store[n]])},purge:t=>{Py.store[t]&&(delete Py.store[t],k0.attempt.unlink(t))},purgeSync:t=>{Py.store[t]&&(delete Py.store[t],k0.attempt.unlinkSync(t))},purgeSyncAll:()=>{for(let t in Py.store)Py.purgeSync(t)},truncate:t=>{let e=b8o.basename(t);if(e.length<=x5t)return t;let r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(e);if(!r)return t;let n=e.length-x5t;return`${t.slice(0,-e.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};Ecn(Py.purgeSyncAll);var cfe=Py;function ZIe(t,e,r=ccn){if(T5t(r))return ZIe(t,e,{encoding:r});let n=Date.now()+((r.timeout??dcn)||-1),i=null,o=null,s=null;try{let a=k0.attempt.realpathSync(t),c=!!a;t=a||t,[o,i]=cfe.get(t,r.tmpCreate||cfe.create,r.tmpPurge!==!1);let u=pcn&&KIe(r.chown),f=KIe(r.mode);if(c&&(u||f)){let d=k0.attempt.statSync(t);d&&(r={...r},u&&(r.chown={uid:d.uid,gid:d.gid}),f&&(r.mode=d.mode))}if(!c){let d=C8o.dirname(t);k0.attempt.mkdirSync(d,{mode:lcn,recursive:!0})}s=k0.retry.openSync(n)(o,"w",r.mode||w5t),r.tmpCreated&&r.tmpCreated(o),T5t(e)?k0.retry.writeSync(n)(s,e,0,r.encoding||acn):KIe(e)||k0.retry.writeSync(n)(s,e,0,e.length,0),r.fsync!==!1&&(r.fsyncWait!==!1?k0.retry.fsyncSync(n)(s):k0.attempt.fsync(s)),k0.retry.closeSync(n)(s),s=null,r.chown&&(r.chown.uid!==ucn||r.chown.gid!==fcn)&&k0.attempt.chownSync(o,r.chown.uid,r.chown.gid),r.mode&&r.mode!==w5t&&k0.attempt.chmodSync(o,r.mode);try{k0.retry.renameSync(n)(o,t)}catch(d){if(!hcn(d)||d.code!=="ENAMETOOLONG")throw d;k0.retry.renameSync(n)(o,cfe.truncate(t))}i(),o=null}finally{s&&k0.attempt.closeSync(s),o&&cfe.purge(o)}}var QF=t=>{let e=typeof t;return t!==null&&(e==="object"||e==="function")};var R5t=new Set(["__proto__","prototype","constructor"]),_8o=new Set("0123456789");function eRe(t){let e=[],r="",n="start",i=!1;for(let o of t)switch(o){case"\\":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd")throw new Error("Invalid character after an index");i&&(r+=o),n="property",i=!i;break}case".":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd"){n="property";break}if(i){i=!1,r+=o;break}if(R5t.has(r))return[];e.push(r),r="",n="property";break}case"[":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd"){n="index";break}if(i){i=!1,r+=o;break}if(n==="property"){if(R5t.has(r))return[];e.push(r),r=""}n="index";break}case"]":{if(n==="index"){e.push(Number.parseInt(r,10)),r="",n="indexEnd";break}if(n==="indexEnd")throw new Error("Invalid character after an index")}default:{if(n==="index"&&!_8o.has(o))throw new Error("Invalid character in an index");if(n==="indexEnd")throw new Error("Invalid character after an index");n==="start"&&(n="property"),i&&(i=!1,r+="\\"),r+=o}}switch(i&&(r+="\\"),n){case"property":{if(R5t.has(r))return[];e.push(r);break}case"index":throw new Error("Index was not closed");case"start":{e.push("");break}}return e}function B5t(t,e){if(typeof e!="number"&&Array.isArray(t)){let r=Number.parseInt(e,10);return Number.isInteger(r)&&t[r]===t[e]}return!1}function vcn(t,e){if(B5t(t,e))throw new Error("Cannot use string index")}function bcn(t,e,r){if(!QF(t)||typeof e!="string")return r===void 0?t:r;let n=eRe(e);if(n.length===0)return r;for(let i=0;i<n.length;i++){let o=n[i];if(B5t(t,o)?t=i===n.length-1?void 0:null:t=t[o],t==null){if(i!==n.length-1)return r;break}}return t===void 0?r:t}function N5t(t,e,r){if(!QF(t)||typeof e!="string")return t;let n=t,i=eRe(e);for(let o=0;o<i.length;o++){let s=i[o];vcn(t,s),o===i.length-1?t[s]=r:QF(t[s])||(t[s]=typeof i[o+1]=="number"?[]:{}),t=t[s]}return n}function Ccn(t,e){if(!QF(t)||typeof e!="string")return!1;let r=eRe(e);for(let n=0;n<r.length;n++){let i=r[n];if(vcn(t,i),n===r.length-1)return delete t[i],!0;if(t=t[i],!QF(t))return!1}}function _cn(t,e){if(!QF(t)||typeof e!="string")return!1;let r=eRe(e);if(r.length===0)return!1;for(let n of r){if(!QF(t)||!(n in t)||B5t(t,n))return!1;t=t[n]}return!0}function w8o(t,e){let r=e?ufe.join(t,"config.json"):ufe.join("configstore",`${t}.json`),n=fK??ffe.default.mkdtempSync(ffe.default.realpathSync(S8o.tmpdir())+ufe.sep);return ufe.join(n,r)}var Scn="You don't have access to this file.",x8o={mode:448,recursive:!0},wcn={mode:384},dfe=class{constructor(e,r,n={}){this._path=n.configPath??w8o(e,n.globalConfigPath),r&&(this.all={...r,...this.all})}get all(){try{return JSON.parse(ffe.default.readFileSync(this._path,"utf8"))}catch(e){if(e.code==="ENOENT")return{};if(e.code==="EACCES"&&(e.message=`${e.message}
|
|
3549
|
+
`).filter(r=>r.trim()!=="");try{await v5t.unlink(b5t)}catch{e.push("Warning: Could not delete temporary warnings file.")}return e}catch(t){return t instanceof Error&&"code"in t&&t.code==="ENOENT"?[]:[`Error checking/reading warnings file: ${wr(t)}`]}}import C5t from"fs/promises";import*as Xln from"os";import d8o from"path";var p8o={id:"home-directory",check:async t=>{try{let[e,r]=await Promise.all([C5t.realpath(t),C5t.realpath(Xln.homedir())]);return e===r?"You are running iFlow CLI in your home directory. It is recommended to run in a project-specific directory.":null}catch{return"Could not verify the current directory due to a file system error."}}},h8o={id:"root-directory",check:async t=>{try{let e=await C5t.realpath(t),r="Warning: You are running iFlow CLI in the root directory. Your entire folder structure will be used for context. It is strongly recommended to run in a project-specific directory.";return d8o.dirname(e)===e?r:null}catch{return"Could not verify the current directory due to a file system error."}}},m8o=[p8o,h8o];async function Zln(t){return(await Promise.all(m8o.map(r=>r.check(t)))).filter(r=>r!==null)}sn();async function ecn(t,e,r){await t.initialize(),process.stdout.on("error",f=>{f.code==="EPIPE"&&process.exit(0)});let n=t.getGeminiClient(),i=await t.getToolRegistry(),o=new AbortController,s=[{role:"user",parts:[{text:e}]}],a=0,c=0,u=0;try{for(;;){if(a++,t.getMaxSessionTurns()>=0&&a>t.getMaxSessionTurns()){console.error(`
|
|
3550
|
+
Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json.`);return}let f=[],d=n.sendMessageStream(s[0]?.parts||[],o.signal,r);for await(let p of d){if(o.signal.aborted){console.error("Operation cancelled.");return}if(p.type===_o.Content)process.stdout.write(p.value);else if(p.type===_o.ToolCallRequest){let h=p.value,g={name:h.name,args:h.args,id:h.callId};f.push(g)}else if(p.type===_o.Finished){let h=p;h.usageMetadata&&(c+=h.usageMetadata.promptTokenCount||0,u+=h.usageMetadata.candidatesTokenCount||0)}}if(f.length>0){let p=[];for(let h of f){let A={callId:h.id??`${h.name}-${Date.now()}`,name:h.name,args:h.args??{},isClientInitiated:!1,prompt_id:r},y=await ryt(t,A,i,o.signal);if(y.error&&(console.error(`Error executing tool ${h.name}: ${y.resultDisplay||y.error.message}`),y.errorType===Uc.UNHANDLED_EXCEPTION&&process.exit(1)),y.responseParts){let v=Array.isArray(y.responseParts)?y.responseParts:[y.responseParts];for(let S of v)typeof S=="string"?p.push({text:S}):S&&p.push(S)}}s=[{role:"user",parts:p}]}else{if(process.stdout.write(`
|
|
3551
|
+
`),c>0||u>0){let p=c+u;process.stderr.write(`
|
|
3552
|
+
[Token Usage: Input: ${c} tokens, Output: ${u} tokens, Total: ${p} tokens]
|
|
3553
|
+
`)}return}}}catch(f){console.error(tue(f,t.getContentGeneratorConfig()?.authType)),process.exit(1)}finally{u1()&&await Bz()}}sn();import KF from"node:process";import{spawn as v9o}from"node:child_process";import{fileURLToPath as b9o}from"node:url";import Yfn from"node:path";import{format as vvt}from"node:util";var ffe=ze(Yg(),1);import ufe from"node:path";import S8o from"node:os";import g8o from"os";import JIe from"path";var MR=g8o.homedir(),{env:UF}=process,tcn=UF.XDG_DATA_HOME||(MR?JIe.join(MR,".local","share"):void 0),fK=UF.XDG_CONFIG_HOME||(MR?JIe.join(MR,".config"):void 0),zXs=UF.XDG_STATE_HOME||(MR?JIe.join(MR,".local","state"):void 0),JXs=UF.XDG_CACHE_HOME||(MR?JIe.join(MR,".cache"):void 0),KXs=UF.XDG_RUNTIME_DIR||void 0,A8o=(UF.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");tcn&&A8o.unshift(tcn);var y8o=(UF.XDG_CONFIG_DIRS||"/etc/xdg").split(":");fK&&y8o.unshift(fK);import C8o from"node:path";import il from"node:fs";import{promisify as ng}from"node:util";var KS=(t,e)=>function(...n){return t.apply(void 0,n).catch(e)},dC=(t,e)=>function(...n){try{return t.apply(void 0,n)}catch(i){return e(i)}};import rcn from"node:process";var ncn=rcn.getuid?!rcn.getuid():!1,icn=1e4,XA=()=>{};var lfe={isChangeErrorOk:t=>{if(!lfe.isNodeError(t))return!1;let{code:e}=t;return e==="ENOSYS"||!ncn&&(e==="EINVAL"||e==="EPERM")},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!lfe.isNodeError(t))return!1;let{code:e}=t;return e==="EMFILE"||e==="ENFILE"||e==="EAGAIN"||e==="EBUSY"||e==="EACCESS"||e==="EACCES"||e==="EACCS"||e==="EPERM"},onChangeError:t=>{if(!lfe.isNodeError(t))throw t;if(!lfe.isChangeErrorOk(t))throw t}},tp=lfe;var _5t=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=icn,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=e=>{this.queueWaiting.add(e),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=e=>{this.queueWaiting.delete(e),this.queueActive.delete(e)},this.schedule=()=>new Promise(e=>{let r=()=>this.remove(n),n=()=>e(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let e of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(e),this.queueActive.add(e),e()}}}}},ocn=new _5t;var XS=(t,e)=>function(n){return function i(...o){return ocn.schedule().then(s=>{let a=u=>(s(),u),c=u=>{if(s(),Date.now()>=n)throw u;if(e(u)){let f=Math.round(100*Math.random());return new Promise(p=>setTimeout(p,f)).then(()=>i.apply(void 0,o))}throw u};return t.apply(void 0,o).then(a,c)})}},ZS=(t,e)=>function(n){return function i(...o){try{return t.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(e(s))return i.apply(void 0,o);throw s}}};var E8o={attempt:{chmod:KS(ng(il.chmod),tp.onChangeError),chown:KS(ng(il.chown),tp.onChangeError),close:KS(ng(il.close),XA),fsync:KS(ng(il.fsync),XA),mkdir:KS(ng(il.mkdir),XA),realpath:KS(ng(il.realpath),XA),stat:KS(ng(il.stat),XA),unlink:KS(ng(il.unlink),XA),chmodSync:dC(il.chmodSync,tp.onChangeError),chownSync:dC(il.chownSync,tp.onChangeError),closeSync:dC(il.closeSync,XA),existsSync:dC(il.existsSync,XA),fsyncSync:dC(il.fsync,XA),mkdirSync:dC(il.mkdirSync,XA),realpathSync:dC(il.realpathSync,XA),statSync:dC(il.statSync,XA),unlinkSync:dC(il.unlinkSync,XA)},retry:{close:XS(ng(il.close),tp.isRetriableError),fsync:XS(ng(il.fsync),tp.isRetriableError),open:XS(ng(il.open),tp.isRetriableError),readFile:XS(ng(il.readFile),tp.isRetriableError),rename:XS(ng(il.rename),tp.isRetriableError),stat:XS(ng(il.stat),tp.isRetriableError),write:XS(ng(il.write),tp.isRetriableError),writeFile:XS(ng(il.writeFile),tp.isRetriableError),closeSync:ZS(il.closeSync,tp.isRetriableError),fsyncSync:ZS(il.fsyncSync,tp.isRetriableError),openSync:ZS(il.openSync,tp.isRetriableError),readFileSync:ZS(il.readFileSync,tp.isRetriableError),renameSync:ZS(il.renameSync,tp.isRetriableError),statSync:ZS(il.statSync,tp.isRetriableError),writeSync:ZS(il.writeSync,tp.isRetriableError),writeFileSync:ZS(il.writeFileSync,tp.isRetriableError)}},k0=E8o;import scn from"node:os";import S5t from"node:process";var acn="utf8",w5t=438,lcn=511;var ccn={},ucn=scn.userInfo().uid,fcn=scn.userInfo().gid;var dcn=1e3,pcn=!!S5t.getuid,AZs=S5t.getuid?!S5t.getuid():!1,x5t=128;var hcn=t=>t instanceof Error&&"code"in t;var T5t=t=>typeof t=="string",KIe=t=>t===void 0;import b8o from"node:path";import dK from"node:process";import mcn from"node:process";var gcn=mcn.platform==="linux",XIe=mcn.platform==="win32";var D5t=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];XIe||D5t.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");gcn&&D5t.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED");var Acn=D5t;var I5t=class{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=e=>{if(!this.exited){this.exited=!0;for(let r of this.callbacks)r();e&&(XIe&&e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"?dK.kill(dK.pid,"SIGTERM"):dK.kill(dK.pid,e))}},this.hook=()=>{dK.once("exit",()=>this.exit());for(let e of Acn)try{dK.once(e,()=>this.exit(e))}catch{}},this.register=e=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}},ycn=new I5t;var v8o=ycn.register,Ecn=v8o;var Py={store:{},create:t=>{let e=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),i=`.tmp-${Date.now().toString().slice(-10)}${e}`;return`${t}${i}`},get:(t,e,r=!0)=>{let n=Py.truncate(e(t));return n in Py.store?Py.get(t,e,r):(Py.store[n]=r,[n,()=>delete Py.store[n]])},purge:t=>{Py.store[t]&&(delete Py.store[t],k0.attempt.unlink(t))},purgeSync:t=>{Py.store[t]&&(delete Py.store[t],k0.attempt.unlinkSync(t))},purgeSyncAll:()=>{for(let t in Py.store)Py.purgeSync(t)},truncate:t=>{let e=b8o.basename(t);if(e.length<=x5t)return t;let r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(e);if(!r)return t;let n=e.length-x5t;return`${t.slice(0,-e.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};Ecn(Py.purgeSyncAll);var cfe=Py;function ZIe(t,e,r=ccn){if(T5t(r))return ZIe(t,e,{encoding:r});let n=Date.now()+((r.timeout??dcn)||-1),i=null,o=null,s=null;try{let a=k0.attempt.realpathSync(t),c=!!a;t=a||t,[o,i]=cfe.get(t,r.tmpCreate||cfe.create,r.tmpPurge!==!1);let u=pcn&&KIe(r.chown),f=KIe(r.mode);if(c&&(u||f)){let d=k0.attempt.statSync(t);d&&(r={...r},u&&(r.chown={uid:d.uid,gid:d.gid}),f&&(r.mode=d.mode))}if(!c){let d=C8o.dirname(t);k0.attempt.mkdirSync(d,{mode:lcn,recursive:!0})}s=k0.retry.openSync(n)(o,"w",r.mode||w5t),r.tmpCreated&&r.tmpCreated(o),T5t(e)?k0.retry.writeSync(n)(s,e,0,r.encoding||acn):KIe(e)||k0.retry.writeSync(n)(s,e,0,e.length,0),r.fsync!==!1&&(r.fsyncWait!==!1?k0.retry.fsyncSync(n)(s):k0.attempt.fsync(s)),k0.retry.closeSync(n)(s),s=null,r.chown&&(r.chown.uid!==ucn||r.chown.gid!==fcn)&&k0.attempt.chownSync(o,r.chown.uid,r.chown.gid),r.mode&&r.mode!==w5t&&k0.attempt.chmodSync(o,r.mode);try{k0.retry.renameSync(n)(o,t)}catch(d){if(!hcn(d)||d.code!=="ENAMETOOLONG")throw d;k0.retry.renameSync(n)(o,cfe.truncate(t))}i(),o=null}finally{s&&k0.attempt.closeSync(s),o&&cfe.purge(o)}}var QF=t=>{let e=typeof t;return t!==null&&(e==="object"||e==="function")};var R5t=new Set(["__proto__","prototype","constructor"]),_8o=new Set("0123456789");function eRe(t){let e=[],r="",n="start",i=!1;for(let o of t)switch(o){case"\\":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd")throw new Error("Invalid character after an index");i&&(r+=o),n="property",i=!i;break}case".":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd"){n="property";break}if(i){i=!1,r+=o;break}if(R5t.has(r))return[];e.push(r),r="",n="property";break}case"[":{if(n==="index")throw new Error("Invalid character in an index");if(n==="indexEnd"){n="index";break}if(i){i=!1,r+=o;break}if(n==="property"){if(R5t.has(r))return[];e.push(r),r=""}n="index";break}case"]":{if(n==="index"){e.push(Number.parseInt(r,10)),r="",n="indexEnd";break}if(n==="indexEnd")throw new Error("Invalid character after an index")}default:{if(n==="index"&&!_8o.has(o))throw new Error("Invalid character in an index");if(n==="indexEnd")throw new Error("Invalid character after an index");n==="start"&&(n="property"),i&&(i=!1,r+="\\"),r+=o}}switch(i&&(r+="\\"),n){case"property":{if(R5t.has(r))return[];e.push(r);break}case"index":throw new Error("Index was not closed");case"start":{e.push("");break}}return e}function B5t(t,e){if(typeof e!="number"&&Array.isArray(t)){let r=Number.parseInt(e,10);return Number.isInteger(r)&&t[r]===t[e]}return!1}function vcn(t,e){if(B5t(t,e))throw new Error("Cannot use string index")}function bcn(t,e,r){if(!QF(t)||typeof e!="string")return r===void 0?t:r;let n=eRe(e);if(n.length===0)return r;for(let i=0;i<n.length;i++){let o=n[i];if(B5t(t,o)?t=i===n.length-1?void 0:null:t=t[o],t==null){if(i!==n.length-1)return r;break}}return t===void 0?r:t}function N5t(t,e,r){if(!QF(t)||typeof e!="string")return t;let n=t,i=eRe(e);for(let o=0;o<i.length;o++){let s=i[o];vcn(t,s),o===i.length-1?t[s]=r:QF(t[s])||(t[s]=typeof i[o+1]=="number"?[]:{}),t=t[s]}return n}function Ccn(t,e){if(!QF(t)||typeof e!="string")return!1;let r=eRe(e);for(let n=0;n<r.length;n++){let i=r[n];if(vcn(t,i),n===r.length-1)return delete t[i],!0;if(t=t[i],!QF(t))return!1}}function _cn(t,e){if(!QF(t)||typeof e!="string")return!1;let r=eRe(e);if(r.length===0)return!1;for(let n of r){if(!QF(t)||!(n in t)||B5t(t,n))return!1;t=t[n]}return!0}function w8o(t,e){let r=e?ufe.join(t,"config.json"):ufe.join("configstore",`${t}.json`),n=fK??ffe.default.mkdtempSync(ffe.default.realpathSync(S8o.tmpdir())+ufe.sep);return ufe.join(n,r)}var Scn="You don't have access to this file.",x8o={mode:448,recursive:!0},wcn={mode:384},dfe=class{constructor(e,r,n={}){this._path=n.configPath??w8o(e,n.globalConfigPath),r&&(this.all={...r,...this.all})}get all(){try{return JSON.parse(ffe.default.readFileSync(this._path,"utf8"))}catch(e){if(e.code==="ENOENT")return{};if(e.code==="EACCES"&&(e.message=`${e.message}
|
|
3554
3554
|
${Scn}
|
|
3555
3555
|
`),e.name==="SyntaxError")return ZIe(this._path,"",wcn),{};throw e}}set all(e){try{ffe.default.mkdirSync(ufe.dirname(this._path),x8o),ZIe(this._path,JSON.stringify(e,void 0," "),wcn)}catch(r){throw r.code==="EACCES"&&(r.message=`${r.message}
|
|
3556
3556
|
${Scn}
|