@iflow-ai/iflow-cli 0.2.31-beta.3 → 0.2.31

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 CHANGED
@@ -125,7 +125,7 @@ $ npm install --save-dev react-devtools-core
125
125
  `).slice(1):void 0,r=e?MCt.parseLine(e[0]):void 0,n=vDe(r?.file),i,o=0;if(n&&r?.line&&oce.existsSync(n)){let s=oce.readFileSync(n,"utf8");if(i=RCt(s,r.line),i)for(let{line:a}of i)o=Math.max(o,String(a).length)}return Dd.default.createElement(de,{flexDirection:"column",padding:1},Dd.default.createElement(de,null,Dd.default.createElement(J,{backgroundColor:"red",color:"white"}," ","ERROR"," "),Dd.default.createElement(J,null," ",t.message)),r&&n&&Dd.default.createElement(de,{marginTop:1},Dd.default.createElement(J,{dimColor:!0},n,":",r.line,":",r.column)),r&&i&&Dd.default.createElement(de,{marginTop:1,flexDirection:"column"},i.map(({line:s,value:a})=>Dd.default.createElement(de,{key:s},Dd.default.createElement(de,{width:o+1},Dd.default.createElement(J,{dimColor:s!==r.line,backgroundColor:s===r.line?"red":void 0,color:s===r.line?"white":void 0,"aria-label":s===r.line?`Line ${s}, error`:`Line ${s}`},String(s).padStart(o," "),":")),Dd.default.createElement(J,{key:s,backgroundColor:s===r.line?"red":void 0,color:s===r.line?"white":void 0}," "+a)))),t.stack&&Dd.default.createElement(de,{marginTop:1,flexDirection:"column"},t.stack.split(`
126
126
  `).slice(1).map(s=>{let a=MCt.parseLine(s);return a?Dd.default.createElement(de,{key:s},Dd.default.createElement(J,{dimColor:!0},"- "),Dd.default.createElement(J,{dimColor:!0,bold:!0},a.function),Dd.default.createElement(J,{dimColor:!0,color:"gray","aria-label":`at ${vDe(a.file)??""} line ${a.line} column ${a.column}`}," ","(",vDe(a.file)??"",":",a.line,":",a.column,")")):Dd.default.createElement(de,{key:s},Dd.default.createElement(J,{dimColor:!0},"- "),Dd.default.createElement(J,{dimColor:!0,bold:!0},s,"\\t"," "))})))}var Dd,CDe,vDe,MCt,PCt=le(()=>{Dd=Le(Ut(),1),CDe=Le(TCt(),1);BCt();ice();EDe();vDe=t=>t?.replace(`file://${FCt()}/`,""),MCt=new CDe.default({cwd:FCt(),internals:CDe.default.nodeInternals()})});import{EventEmitter as ipn}from"node:events";import opn from"node:process";var yC,spn,apn,lpn,eY,LCt=le(()=>{yC=Le(Ut(),1);cDe();fDe();pDe();hDe();gDe();rce();PCt();spn=" ",apn="\x1B[Z",lpn="\x1B",eY=class extends yC.PureComponent{static displayName="InternalApp";static getDerivedStateFromError(e){return{error:e}}state={isFocusEnabled:!0,activeFocusId:void 0,focusables:[],error:void 0};rawModeEnabledCount=0;internal_eventEmitter=new ipn;isRawModeSupported(){return this.props.stdin.isTTY}render(){return yC.default.createElement(dDe.Provider,{value:{exit:this.handleExit}},yC.default.createElement(Zle.Provider,{value:{stdin:this.props.stdin,setRawMode:this.handleSetRawMode,isRawModeSupported:this.isRawModeSupported(),internal_exitOnCtrlC:this.props.exitOnCtrlC,internal_eventEmitter:this.internal_eventEmitter}},yC.default.createElement(ece.Provider,{value:{stdout:this.props.stdout,write:this.props.writeToStdout}},yC.default.createElement(mDe.Provider,{value:{stderr:this.props.stderr,write:this.props.writeToStderr}},yC.default.createElement(tce.Provider,{value:{activeId:this.state.activeFocusId,add:this.addFocusable,remove:this.removeFocusable,activate:this.activateFocusable,deactivate:this.deactivateFocusable,enableFocus:this.enableFocus,disableFocus:this.disableFocus,focusNext:this.focusNext,focusPrevious:this.focusPrevious,focus:this.focus}},this.state.error?yC.default.createElement(bDe,{error:this.state.error}):this.props.children)))))}componentDidMount(){SM.hide(this.props.stdout)}componentWillUnmount(){SM.show(this.props.stdout),this.isRawModeSupported()&&this.handleSetRawMode(!1)}componentDidCatch(e){this.handleExit(e)}handleSetRawMode=e=>{let{stdin:r}=this.props;if(!this.isRawModeSupported())throw r===opn.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
127
127
  Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink.
128
- Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(r.setEncoding("utf8"),e){this.rawModeEnabledCount===0&&(r.ref(),r.setRawMode(!0),r.addListener("readable",this.handleReadable)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount===0&&(r.setRawMode(!1),r.removeListener("readable",this.handleReadable),r.unref())};handleReadable=()=>{let e;for(;(e=this.props.stdin.read())!==null;)this.handleInput(e),this.internal_eventEmitter.emit("input",e)};handleInput=e=>{e===""&&this.props.exitOnCtrlC&&this.handleExit(),e===lpn&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(e===spn&&this.focusNext(),e===apn&&this.focusPrevious())};handleExit=e=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(e)};enableFocus=()=>{this.setState({isFocusEnabled:!0})};disableFocus=()=>{this.setState({isFocusEnabled:!1})};focus=e=>{this.setState(r=>r.focusables.some(i=>i?.id===e)?{activeFocusId:e}:r)};focusNext=()=>{this.setState(e=>{let r=e.focusables.find(i=>i.isActive)?.id;return{activeFocusId:this.findNextFocusable(e)??r}})};focusPrevious=()=>{this.setState(e=>{let r=e.focusables.findLast(i=>i.isActive)?.id;return{activeFocusId:this.findPreviousFocusable(e)??r}})};addFocusable=(e,{autoFocus:r})=>{this.setState(n=>{let i=n.activeFocusId;return!i&&r&&(i=e),{activeFocusId:i,focusables:[...n.focusables,{id:e,isActive:!0}]}})};removeFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.filter(n=>n.id!==e)}))};activateFocusable=e=>{this.setState(r=>({focusables:r.focusables.map(n=>n.id!==e?n:{id:e,isActive:!0})}))};deactivateFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.map(n=>n.id!==e?n:{id:e,isActive:!1})}))};findNextFocusable=e=>{let r=e.focusables.findIndex(n=>n.id===e.activeFocusId);for(let n=r+1;n<e.focusables.length;n++){let i=e.focusables[n];if(i?.isActive)return i.id}};findPreviousFocusable=e=>{let r=e.focusables.findIndex(n=>n.id===e.activeFocusId);for(let n=r-1;n>=0;n--){let i=e.focusables[n];if(i?.isActive)return i.id}}}});import UCt from"node:process";var wDe,qCt,HCt,QCt,tY,GCt=le(async()=>{wDe=Le(Ut(),1);x4t();ele();OTe();R4t();qCt=Le(F4t(),1);Q4t();HCt=Le(LTe(),1);await L_();KTe();await qIe();await Yvt();await mIe();dCt();uDe();LCt();TM();QCt=()=>{},tY=class{options;log;throttledLog;isScreenReaderEnabled;isUnmounted;lastOutput;lastOutputHeight;container;rootNode;fullStaticOutput;exitPromise;restoreConsole;unsubscribeResize;constructor(e){kTe(this),this.options=e,this.rootNode=gle("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=e.isScreenReaderEnabled??UCt.env.INK_SCREEN_READER==="true";let r=e.debug||this.isScreenReaderEnabled;this.rootNode.onRender=r?this.onRender:Xae(this.onRender,3e3,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=uCt.create(e.stdout),this.throttledLog=r?this.log:Xae(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.lastOutputHeight=0,this.fullStaticOutput="",this.container=mC.createContainer(this.rootNode,HCt.LegacyRoot,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{},null),this.unsubscribeExit=(0,qCt.default)(this.unmount,{alwaysLast:!1}),UCt.env.DEV==="true"&&mC.injectIntoDevTools({bundleType:0,version:"16.13.1",rendererPackageName:"ink"}),e.patchConsole&&this.patchConsole(),sC||(e.stdout.on("resize",this.resized),this.unsubscribeResize=()=>{e.stdout.off("resize",this.resized)})}resized=()=>{this.calculateLayout(),this.onRender()};resolveExitPromise=()=>{};rejectExitPromise=()=>{};unsubscribeExit=()=>{};calculateLayout=()=>{let e=this.options.stdout.columns||80;this.rootNode.yogaNode.setWidth(e),this.rootNode.yogaNode.calculateLayout(void 0,void 0,an.DIRECTION_LTR)};onRender=()=>{if(this.isUnmounted)return;let{output:e,outputHeight:r,staticOutput:n}=jvt(this.rootNode,this.isScreenReaderEnabled),i=n&&n!==`
128
+ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(r.setEncoding("utf8"),e){this.rawModeEnabledCount===0&&(r.ref(),r.setRawMode(!0),r.addListener("readable",this.handleReadable)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount===0&&(r.setRawMode(!1),r.removeListener("readable",this.handleReadable),r.unref())};handleReadable=()=>{let e;for(;(e=this.props.stdin.read())!==null;)this.handleInput(e),this.internal_eventEmitter.emit("input",e)};handleInput=e=>{e===""&&this.props.exitOnCtrlC&&this.handleExit(),e===lpn&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(e===spn&&this.focusNext(),e===apn&&this.focusPrevious())};handleExit=e=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(e)};enableFocus=()=>{this.setState({isFocusEnabled:!0})};disableFocus=()=>{this.setState({isFocusEnabled:!1})};focus=e=>{this.setState(r=>r.focusables.some(i=>i?.id===e)?{activeFocusId:e}:r)};focusNext=()=>{this.setState(e=>{let r=e.focusables.find(i=>i.isActive)?.id;return{activeFocusId:this.findNextFocusable(e)??r}})};focusPrevious=()=>{this.setState(e=>{let r=e.focusables.findLast(i=>i.isActive)?.id;return{activeFocusId:this.findPreviousFocusable(e)??r}})};addFocusable=(e,{autoFocus:r})=>{this.setState(n=>{let i=n.activeFocusId;return!i&&r&&(i=e),{activeFocusId:i,focusables:[...n.focusables,{id:e,isActive:!0}]}})};removeFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.filter(n=>n.id!==e)}))};activateFocusable=e=>{this.setState(r=>({focusables:r.focusables.map(n=>n.id!==e?n:{id:e,isActive:!0})}))};deactivateFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.map(n=>n.id!==e?n:{id:e,isActive:!1})}))};findNextFocusable=e=>{let r=e.focusables.findIndex(n=>n.id===e.activeFocusId);for(let n=r+1;n<e.focusables.length;n++){let i=e.focusables[n];if(i?.isActive)return i.id}};findPreviousFocusable=e=>{let r=e.focusables.findIndex(n=>n.id===e.activeFocusId);for(let n=r-1;n>=0;n--){let i=e.focusables[n];if(i?.isActive)return i.id}}}});import UCt from"node:process";var wDe,qCt,HCt,QCt,tY,GCt=le(async()=>{wDe=Le(Ut(),1);x4t();ele();OTe();R4t();qCt=Le(F4t(),1);Q4t();HCt=Le(LTe(),1);await L_();KTe();await qIe();await Yvt();await mIe();dCt();uDe();LCt();TM();QCt=()=>{},tY=class{options;log;throttledLog;isScreenReaderEnabled;isUnmounted;lastOutput;lastOutputHeight;container;rootNode;fullStaticOutput;exitPromise;restoreConsole;unsubscribeResize;constructor(e){kTe(this),this.options=e,this.rootNode=gle("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=e.isScreenReaderEnabled??UCt.env.INK_SCREEN_READER==="true";let r=e.debug||this.isScreenReaderEnabled;this.rootNode.onRender=r?this.onRender:Xae(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=uCt.create(e.stdout),this.throttledLog=r?this.log:Xae(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.lastOutputHeight=0,this.fullStaticOutput="",this.container=mC.createContainer(this.rootNode,HCt.LegacyRoot,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{},null),this.unsubscribeExit=(0,qCt.default)(this.unmount,{alwaysLast:!1}),UCt.env.DEV==="true"&&mC.injectIntoDevTools({bundleType:0,version:"16.13.1",rendererPackageName:"ink"}),e.patchConsole&&this.patchConsole(),sC||(e.stdout.on("resize",this.resized),this.unsubscribeResize=()=>{e.stdout.off("resize",this.resized)})}resized=()=>{this.calculateLayout(),this.onRender()};resolveExitPromise=()=>{};rejectExitPromise=()=>{};unsubscribeExit=()=>{};calculateLayout=()=>{let e=this.options.stdout.columns||80;this.rootNode.yogaNode.setWidth(e),this.rootNode.yogaNode.calculateLayout(void 0,void 0,an.DIRECTION_LTR)};onRender=()=>{if(this.isUnmounted)return;let{output:e,outputHeight:r,staticOutput:n}=jvt(this.rootNode,this.isScreenReaderEnabled),i=n&&n!==`
129
129
  `;if(this.options.debug){i&&(this.fullStaticOutput+=n),this.options.stdout.write(this.fullStaticOutput+e);return}if(sC){i&&this.options.stdout.write(n),this.lastOutput=e,this.lastOutputHeight=r;return}if(this.isScreenReaderEnabled){if(i){let a=this.lastOutputHeight>0?Py.eraseLines(this.lastOutputHeight):"";this.options.stdout.write(a+n),this.lastOutputHeight=0}if(e===this.lastOutput&&!i)return;let o=this.options.stdout.columns||80,s=Rj(e,o,{trim:!1,hard:!0});if(i)this.options.stdout.write(s);else{let a=this.lastOutputHeight>0?Py.eraseLines(this.lastOutputHeight):"";this.options.stdout.write(a+s)}this.lastOutput=e,this.lastOutputHeight=s===""?0:s.split(`
130
130
  `).length;return}if(i&&(this.fullStaticOutput+=n),this.lastOutputHeight>=this.options.stdout.rows){this.options.stdout.write(Py.clearTerminal+this.fullStaticOutput+e+`
131
131
  `),this.lastOutput=e,this.lastOutputHeight=r,this.log.sync(e);return}i&&(this.log.clear(),this.options.stdout.write(n),this.log(e)),!i&&e!==this.lastOutput&&this.throttledLog(e),this.lastOutput=e,this.lastOutputHeight=r};render(e){let r=wDe.default.createElement(AC.Provider,{value:{isScreenReaderEnabled:this.isScreenReaderEnabled}},wDe.default.createElement(eY,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},e));mC.updateContainerSync(r,this.container,null,QCt),mC.flushSyncWork()}writeToStdout(e){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(e+this.fullStaticOutput+this.lastOutput);return}if(sC){this.options.stdout.write(e);return}this.log.clear(),this.options.stdout.write(e),this.log(this.lastOutput)}}writeToStderr(e){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(e),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(sC){this.options.stderr.write(e);return}this.log.clear(),this.options.stderr.write(e),this.log(this.lastOutput)}}unmount(e){this.isUnmounted||(this.calculateLayout(),this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),sC?this.options.stdout.write(this.lastOutput+`
@@ -446,14 +446,14 @@ ${JSON.stringify(p,null,2)}`),p.usage&&(this.lastUsageMetadata={total_tokens:p.u
446
446
  \u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
447
447
  ${e}
448
448
 
449
- \u8BF7\u76F4\u63A5\u8F93\u51FA\u4E00\u4E2A\u6B63\u786E\u7684json\u683C\u5F0F\uFF1A`;try{let n=await fetch("https://apis.iflow.cn/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:"QWen3-4B",messages:[{role:"user",content:r}],temperature:.1,max_tokens:1e3})});if(!n.ok)throw new Error(`API error: ${n.status}`);let i=await n.json();if(!i||!i.choices||!Array.isArray(i.choices)||i.choices.length===0)throw new Error("Invalid response format - missing or empty choices array");let o=i.choices[0]?.message?.content;if(!o||typeof o!="string")throw new Error("Invalid response - missing or invalid message content");let s=o.trim();if(s.startsWith("```json")?s=s.replace(/^```json\s*/,"").replace(/\s*```$/,""):s.startsWith("```")&&(s=s.replace(/^```\s*/,"").replace(/\s*```$/,"")),!s)throw new Error("Fixed JSON is empty after processing");return JSON.parse(s)}catch(n){throw t6(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 o7.STOP;case"length":return o7.MAX_TOKENS;case"content_filter":return o7.SAFETY;case"tool_calls":return o7.MALFORMED_FUNCTION_CALL;default:return o7.OTHER}}convertResponseSchema(e){if(e)return e.type==="object"||e.type==="OBJECT"?{type:"json_schema",json_schema:{name:e.name||"",description:e.description||"",schema:this.convertSchemaToJsonSchema(e),strict:!0}}:{type:"json_schema",json_schema:{name:"response_schema",description:"Generated response schema",schema:this.convertSchemaToJsonSchema(e),strict:!0}}}convertSchemaToJsonSchema(e){if(!e)return{};let r={};if(e.type)switch(e.type){case"STRING":r.type="string";break;case"INTEGER":r.type="integer";break;case"NUMBER":r.type="number";break;case"BOOLEAN":r.type="boolean";break;case"OBJECT":r.type="object";break;case"ARRAY":r.type="array";break;default:r.type=typeof e.type=="string"?e.type.toLowerCase():e.type}if(e.description&&(r.description=e.description),e.enum&&(r.enum=e.enum),e.properties){r.properties={};for(let[n,i]of Object.entries(e.properties))r.properties[n]=this.convertSchemaToJsonSchema(i)}return e.items&&(r.items=this.convertSchemaToJsonSchema(e.items)),e.required&&(r.required=e.required),r.type==="object"&&!("additionalProperties"in r)&&(r.additionalProperties=!1),r}}});var U2,Du,MF,FF,XY,BTt,r6=le(()=>{"use strict";U2="Qwen3-Coder",Du="Qwen3-Coder",MF="text-embedding-v1",FF="gemini-2.5-flash-lite",XY="https://apis.iflow.cn/v1",BTt="https://ducky.code.alibaba-inc.com/v1/openai"});async function VOe(t,e,r,n){if(e===$t.LOGIN_WITH_IFLOW){let i=await ET(e,r),o=await AE();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new kF({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||XY,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen-vl-max",config:r})}if(e===$t.CLOUD_SHELL){let i=await ET(e,r),o=await H_t(i);return new BC(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var $Oe=le(()=>{"use strict";BA();c7();G_t();cde();GOe();r6();});function $bn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function CE(t){let e=$bn(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 ZY(){return CE("apiKey")}function ez(){return CE("baseUrl")||CE("url")}function tz(){return CE("modelName")||CE("model")}function NTt(t){let e=CE(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 OTt(t){let e=CE(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function kTt(t){let e=CE(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function Ode(){return!!(ZY()||ez()||tz())}function WOe(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=CE(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=NTt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=OTt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=kTt(o);s!==void 0&&(t[o]=s)}),t}function Wbn(){return{apiKey:ZY(),baseUrl:ez(),model:tz()}}var jOe=le(()=>{"use strict";});async function YOe(t,e,r){await xF()&&(await lde()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=process.env.GEMINI_API_KEY,o=process.env.GOOGLE_API_KEY,s=process.env.GOOGLE_CLOUD_PROJECT,a=process.env.GOOGLE_CLOUD_LOCATION,c=ZY(),u=ez(),d=tz(),f=r?.apiKey||c,p=r?.baseUrl||u||jbn[e],h=t.getModel()||d||U2,m={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===$t.CLOUD_SHELL?m:e===$t.LOGIN_WITH_IFLOW?(m.baseUrl=p||XY,m.multimodalModelName="qwen-vl-max",f&&(m.apiKey=f),m):([...ag,$t.OPENAI_COMPATIBLE].includes(e)&&f&&(m.apiKey=f,m.baseUrl=p,m.model=h),m)}async function zOe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.31-beta.3 (${process.platform}; ${process.arch})`}};if(t.authType&&[...ag,$t.IDEA_LAB].includes(t.authType)||t.authType===$t.OPENAI_COMPATIBLE)return new kF({...t,config:e});if(t.authType===$t.LOGIN_WITH_IFLOW||t.authType===$t.CLOUD_SHELL)return VOe(i,t.authType,e,r);if([...ag,$t.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===$t.USE_GEMINI||t.authType===$t.USE_VERTEX_AI)return new Xue({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var $t,ag,jbn,BA=le(()=>{"use strict";Wa();$Oe();r6();GOe();jOe();c7();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})($t||($t={}));ag=[$t.IFLOW,$t.AONE],jbn={[$t.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[$t.IFLOW]:XY,[$t.AONE]:BTt}});var kde,MTt=le(()=>{"use strict";kde=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 co,Hr,uo,fo,lu=le(()=>{"use strict";co=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}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"})(Hr||(Hr={}));(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"})(uo||(uo={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(fo||(fo={}))});function wT(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 Mde=le(()=>{"use strict";});var il,Fde=le(()=>{"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",t.HOOK_BLOCKED="hook_blocked"})(il||(il={}))});function Ybn(t){return{text:t.text}}function zbn(t,e){return[{text:O.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function Jbn(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:O.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function Kbn(t){return{text:O.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function Xbn(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 Ybn(o);case"image":case"audio":return zbn(o,n);case"resource":return Jbn(o,n);case"resource_link":return Kbn(o);default:return null}}).filter(o=>o!==null):[{text:O.t("mcpTool.errors.parseResponseFailed")}]}function Zbn(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 O.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return O.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return O.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:O.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||O.t("mcpTool.display.unknownType")});default:return O.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
449
+ \u8BF7\u76F4\u63A5\u8F93\u51FA\u4E00\u4E2A\u6B63\u786E\u7684json\u683C\u5F0F\uFF1A`;try{let n=await fetch("https://apis.iflow.cn/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:"QWen3-4B",messages:[{role:"user",content:r}],temperature:.1,max_tokens:1e3})});if(!n.ok)throw new Error(`API error: ${n.status}`);let i=await n.json();if(!i||!i.choices||!Array.isArray(i.choices)||i.choices.length===0)throw new Error("Invalid response format - missing or empty choices array");let o=i.choices[0]?.message?.content;if(!o||typeof o!="string")throw new Error("Invalid response - missing or invalid message content");let s=o.trim();if(s.startsWith("```json")?s=s.replace(/^```json\s*/,"").replace(/\s*```$/,""):s.startsWith("```")&&(s=s.replace(/^```\s*/,"").replace(/\s*```$/,"")),!s)throw new Error("Fixed JSON is empty after processing");return JSON.parse(s)}catch(n){throw t6(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 o7.STOP;case"length":return o7.MAX_TOKENS;case"content_filter":return o7.SAFETY;case"tool_calls":return o7.MALFORMED_FUNCTION_CALL;default:return o7.OTHER}}convertResponseSchema(e){if(e)return e.type==="object"||e.type==="OBJECT"?{type:"json_schema",json_schema:{name:e.name||"",description:e.description||"",schema:this.convertSchemaToJsonSchema(e),strict:!0}}:{type:"json_schema",json_schema:{name:"response_schema",description:"Generated response schema",schema:this.convertSchemaToJsonSchema(e),strict:!0}}}convertSchemaToJsonSchema(e){if(!e)return{};let r={};if(e.type)switch(e.type){case"STRING":r.type="string";break;case"INTEGER":r.type="integer";break;case"NUMBER":r.type="number";break;case"BOOLEAN":r.type="boolean";break;case"OBJECT":r.type="object";break;case"ARRAY":r.type="array";break;default:r.type=typeof e.type=="string"?e.type.toLowerCase():e.type}if(e.description&&(r.description=e.description),e.enum&&(r.enum=e.enum),e.properties){r.properties={};for(let[n,i]of Object.entries(e.properties))r.properties[n]=this.convertSchemaToJsonSchema(i)}return e.items&&(r.items=this.convertSchemaToJsonSchema(e.items)),e.required&&(r.required=e.required),r.type==="object"&&!("additionalProperties"in r)&&(r.additionalProperties=!1),r}}});var U2,Du,MF,FF,XY,BTt,r6=le(()=>{"use strict";U2="Qwen3-Coder",Du="Qwen3-Coder",MF="text-embedding-v1",FF="gemini-2.5-flash-lite",XY="https://apis.iflow.cn/v1",BTt="https://ducky.code.alibaba-inc.com/v1/openai"});async function VOe(t,e,r,n){if(e===$t.LOGIN_WITH_IFLOW){let i=await ET(e,r),o=await AE();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new kF({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||XY,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen-vl-max",config:r})}if(e===$t.CLOUD_SHELL){let i=await ET(e,r),o=await H_t(i);return new BC(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var $Oe=le(()=>{"use strict";BA();c7();G_t();cde();GOe();r6();});function $bn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function CE(t){let e=$bn(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 ZY(){return CE("apiKey")}function ez(){return CE("baseUrl")||CE("url")}function tz(){return CE("modelName")||CE("model")}function NTt(t){let e=CE(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 OTt(t){let e=CE(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function kTt(t){let e=CE(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function Ode(){return!!(ZY()||ez()||tz())}function WOe(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=CE(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=NTt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=OTt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=kTt(o);s!==void 0&&(t[o]=s)}),t}function Wbn(){return{apiKey:ZY(),baseUrl:ez(),model:tz()}}var jOe=le(()=>{"use strict";});async function YOe(t,e,r){await xF()&&(await lde()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=process.env.GEMINI_API_KEY,o=process.env.GOOGLE_API_KEY,s=process.env.GOOGLE_CLOUD_PROJECT,a=process.env.GOOGLE_CLOUD_LOCATION,c=ZY(),u=ez(),d=tz(),f=r?.apiKey||c,p=r?.baseUrl||u||jbn[e],h=t.getModel()||d||U2,m={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===$t.CLOUD_SHELL?m:e===$t.LOGIN_WITH_IFLOW?(m.baseUrl=p||XY,m.multimodalModelName="qwen-vl-max",f&&(m.apiKey=f),m):([...ag,$t.OPENAI_COMPATIBLE].includes(e)&&f&&(m.apiKey=f,m.baseUrl=p,m.model=h),m)}async function zOe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.31 (${process.platform}; ${process.arch})`}};if(t.authType&&[...ag,$t.IDEA_LAB].includes(t.authType)||t.authType===$t.OPENAI_COMPATIBLE)return new kF({...t,config:e});if(t.authType===$t.LOGIN_WITH_IFLOW||t.authType===$t.CLOUD_SHELL)return VOe(i,t.authType,e,r);if([...ag,$t.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===$t.USE_GEMINI||t.authType===$t.USE_VERTEX_AI)return new Xue({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var $t,ag,jbn,BA=le(()=>{"use strict";Wa();$Oe();r6();GOe();jOe();c7();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})($t||($t={}));ag=[$t.IFLOW,$t.AONE],jbn={[$t.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[$t.IFLOW]:XY,[$t.AONE]:BTt}});var kde,MTt=le(()=>{"use strict";kde=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 co,Hr,uo,fo,lu=le(()=>{"use strict";co=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}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"})(Hr||(Hr={}));(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"})(uo||(uo={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(fo||(fo={}))});function wT(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 Mde=le(()=>{"use strict";});var il,Fde=le(()=>{"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",t.HOOK_BLOCKED="hook_blocked"})(il||(il={}))});function Ybn(t){return{text:t.text}}function zbn(t,e){return[{text:O.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function Jbn(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:O.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function Kbn(t){return{text:O.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function Xbn(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 Ybn(o);case"image":case"audio":return zbn(o,n);case"resource":return Jbn(o,n);case"resource_link":return Kbn(o);default:return null}}).filter(o=>o!==null):[{text:O.t("mcpTool.errors.parseResponseFailed")}]}function Zbn(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 O.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return O.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return O.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:O.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||O.t("mcpTool.display.unknownType")});default:return O.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
450
450
  `):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function FTt(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var Zp,rz=le(()=>{"use strict";Mde();Fde();lu();Wa();On();Zp=class t extends co{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??FTt(n),`${n} (${r} MCP Server)`,i,uo.Hammer,fo.Other,{type:Lt.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:O.t("mcpTool.messages.confirmExecution"),serverName:this.serverName,toolName:this.serverToolName,toolDisplayName:this.name,onConfirm:async s=>{s===Hr.ProceedAlwaysServer?t.allowlist.add(n):s===Hr.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: ${wT(i[0])} with response: ${wT(o)}`;return{llmContent:a,returnDisplay:O.t("mcpTool.errors.toolReportedError",{toolName:this.serverToolName}),error:{message:a,type:il.MCP_TOOL_ERROR}}}return{llmContent:Xbn(o),returnDisplay:Zbn(o)}}}});var LTt=D((qwo,PTt)=>{"use strict";PTt.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 $Tt=D((Hwo,VTt)=>{"use strict";var GTt="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",UTt=new RegExp("^"+GTt+"$"),QTt="|&;()<> \\t",e9n='"((\\\\"|[^"])*?)"',t9n="'((\\\\'|[^'])*?)'",r9n=/^#$/,qTt="'",HTt='"',JOe="$",xT="",n9n=4294967296;for(KOe=0;KOe<4;KOe++)xT+=(n9n*Math.random()).toString(16);var KOe,i9n=new RegExp("^"+xT);function o9n(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 s9n(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+xT+JSON.stringify(n)+xT:e+n}function a9n(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+QTt+`]|[^\\s'"`+QTt+"])+",o=new RegExp(["("+GTt+")","("+i+"|"+e9n+"|"+t9n+")+"].join("|"),"g"),s=o9n(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(UTt.test(u))return{op:u};var d=!1,f=!1,p="",h=!1,m;function g(){m+=1;var v,b,w=u.charAt(m);if(w==="{"){if(m+=1,u.charAt(m)==="}")throw new Error("Bad substitution: "+u.slice(m-2,m+1));if(v=u.indexOf("}",m),v<0)throw new Error("Bad substitution: "+u.slice(m));b=u.slice(m,v),m=v}else if(/[*@#?$!_-]/.test(w))b=w,m+=1;else{var I=u.slice(m);v=I.match(/[^\w\d_]/),v?(b=I.slice(0,v.index),m+=v.index-1):(b=I,m=u.length)}return s9n(e,"",b)}for(m=0;m<u.length;m++){var A=u.charAt(m);if(h=h||!d&&(A==="*"||A==="?"),f)p+=A,f=!1;else if(d)A===d?d=!1:d==qTt?p+=A:A===n?(m+=1,A=u.charAt(m),A===HTt||A===n||A===JOe?p+=A:p+=n+A):A===JOe?p+=g():p+=A;else if(A===HTt||A===qTt)d=A;else{if(UTt.test(A))return{op:u};if(r9n.test(A)){a=!0;var y={comment:t.slice(c.index+m+1)};return p.length?[p,y]:[y]}else A===n?f=!0:A===JOe?p+=g():p+=A}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}VTt.exports=function(e,r,n){var i=a9n(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("("+xT+".*?"+xT+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return i9n.test(c)?JSON.parse(c.split(xT)[1]):c}))},[])}});var Pde=D(XOe=>{"use strict";XOe.quote=LTt();XOe.parse=$Tt()});var is,ZOe,zr,bE,nz=le(()=>{(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})(is||(is={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ZOe||(ZOe={}));zr=is.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bE=t=>{switch(typeof t){case"undefined":return zr.undefined;case"string":return zr.string;case"number":return Number.isNaN(t)?zr.nan:zr.number;case"boolean":return zr.boolean;case"function":return zr.function;case"bigint":return zr.bigint;case"symbol":return zr.symbol;case"object":return Array.isArray(t)?zr.array:t===null?zr.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?zr.promise:typeof Map<"u"&&t instanceof Map?zr.map:typeof Set<"u"&&t instanceof Set?zr.set:typeof Date<"u"&&t instanceof Date?zr.date:zr.object;default:return zr.unknown}}});var gr,l9n,lg,Lde=le(()=>{nz();gr=is.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"]),l9n=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),lg=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,is.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()}};lg.create=t=>new lg(t)});var c9n,OC,eke=le(()=>{Lde();nz();c9n=(t,e)=>{let r;switch(t.code){case gr.invalid_type:t.received===zr.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case gr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,is.jsonStringifyReplacer)}`;break;case gr.unrecognized_keys:r=`Unrecognized key(s) in object: ${is.joinValues(t.keys,", ")}`;break;case gr.invalid_union:r="Invalid input";break;case gr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${is.joinValues(t.options)}`;break;case gr.invalid_enum_value:r=`Invalid enum value. Expected ${is.joinValues(t.options)}, received '${t.received}'`;break;case gr.invalid_arguments:r="Invalid function arguments";break;case gr.invalid_return_type:r="Invalid function return type";break;case gr.invalid_date:r="Invalid date";break;case gr.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}"`:is.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case gr.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 gr.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 gr.custom:r="Invalid input";break;case gr.invalid_intersection_types:r="Intersection results could not be merged";break;case gr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case gr.not_finite:r="Number must be finite";break;default:r=e.defaultError,is.assertNever(t)}return{message:r}},OC=c9n});function u9n(t){WTt=t}function PF(){return WTt}var WTt,Ude=le(()=>{eke();WTt=OC});function Qr(t,e){let r=PF(),n=iz({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===OC?void 0:OC].filter(i=>!!i)});t.common.issues.push(n)}var iz,d9n,eh,mi,ST,$h,Qde,qde,f7,LF,tke=le(()=>{Ude();eke();iz=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}},d9n=[];eh=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 mi;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 mi;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}}},mi=Object.freeze({status:"aborted"}),ST=t=>({status:"dirty",value:t}),$h=t=>({status:"valid",value:t}),Qde=t=>t.status==="aborted",qde=t=>t.status==="dirty",f7=t=>t.status==="valid",LF=t=>typeof Promise<"u"&&t instanceof Promise});var jTt=le(()=>{});var xn,YTt=le(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(xn||(xn={}))});function Ao(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 XTt(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 I9n(t){return new RegExp(`^${XTt(t)}$`)}function ZTt(t){let e=`${KTt}T${XTt(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 D9n(t,e){return!!((e==="v4"||!e)&&C9n.test(t)||(e==="v6"||!e)&&w9n.test(t))}function R9n(t,e){if(!A9n.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 B9n(t,e){return!!((e==="v4"||!e)&&b9n.test(t)||(e==="v6"||!e)&&x9n.test(t))}function N9n(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 UF(t){if(t instanceof cg){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=NA.create(UF(n))}return new cg({...t._def,shape:()=>e})}else return t instanceof FC?new FC({...t._def,type:UF(t.element)}):t instanceof NA?NA.create(UF(t.unwrap())):t instanceof xE?xE.create(UF(t.unwrap())):t instanceof wE?wE.create(t.items.map(e=>UF(e))):t}function nke(t,e){let r=bE(t),n=bE(e);if(t===e)return{valid:!0,data:t};if(r===zr.object&&n===zr.object){let i=is.objectKeys(e),o=is.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=nke(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===zr.array&&n===zr.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=nke(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===zr.date&&n===zr.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function eIt(t,e){return new FT({values:t,typeName:vi.ZodEnum,...Ao(e)})}function JTt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function tIt(t,e={},r){return t?h7.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=JTt(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=JTt(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):h7.create()}var OA,zTt,No,f9n,p9n,h9n,m9n,g9n,A9n,y9n,E9n,v9n,rke,C9n,b9n,w9n,x9n,S9n,_9n,KTt,T9n,p7,_T,TT,IT,DT,QF,RT,BT,h7,MC,n6,qF,FC,cg,NT,kC,Hde,OT,wE,Gde,HF,GF,Vde,kT,MT,FT,PT,m7,kA,NA,xE,LT,UT,VF,O9n,oz,sz,QT,k9n,vi,M9n,rIt,nIt,F9n,P9n,iIt,L9n,U9n,Q9n,q9n,H9n,G9n,V9n,$9n,W9n,j9n,Y9n,z9n,J9n,K9n,X9n,Z9n,e7n,t7n,r7n,n7n,i7n,o7n,s7n,a7n,l7n,c7n,u7n,d7n,f7n,p7n,h7n,m7n,g7n,A7n,oIt=le(()=>{Lde();Ude();YTt();tke();nz();OA=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}},zTt=(t,e)=>{if(f7(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 lg(t.common.issues);return this._error=r,this._error}}};No=class{get description(){return this._def.description}_getType(e){return bE(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:bE(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new eh,ctx:{common:e.parent.common,data:e.data,parsedType:bE(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(LF(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:bE(e)},i=this._parseSync({data:e,path:n.path,parent:n});return zTt(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bE(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return f7(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=>f7(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:bE(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(LF(i)?i:Promise.resolve(i));return zTt(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:gr.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 kA({schema:this,typeName:vi.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 NA.create(this,this._def)}nullable(){return xE.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return FC.create(this)}promise(){return m7.create(this,this._def)}or(e){return NT.create([this,e],this._def)}and(e){return OT.create(this,e,this._def)}transform(e){return new kA({...Ao(this._def),schema:this,typeName:vi.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new LT({...Ao(this._def),innerType:this,defaultValue:r,typeName:vi.ZodDefault})}brand(){return new oz({typeName:vi.ZodBranded,type:this,...Ao(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new UT({...Ao(this._def),innerType:this,catchValue:r,typeName:vi.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return sz.create(this,e)}readonly(){return QT.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},f9n=/^c[^\s-]{8,}$/i,p9n=/^[0-9a-z]+$/,h9n=/^[0-9A-HJKMNP-TV-Z]{26}$/i,m9n=/^[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,g9n=/^[a-z0-9_-]{21}$/i,A9n=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,y9n=/^[-+]?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)?)??$/,E9n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,v9n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",C9n=/^(?:(?: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])$/,b9n=/^(?:(?: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])$/,w9n=/^(([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]))$/,x9n=/^(([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])$/,S9n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_9n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,KTt="((\\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])))",T9n=new RegExp(`^${KTt}$`);p7=class t extends No{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==zr.string){let o=this._getOrReturnCtx(e);return Qr(o,{code:gr.invalid_type,expected:zr.string,received:o.parsedType}),mi}let n=new eh,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),Qr(i,{code:gr.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),Qr(i,{code:gr.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?Qr(i,{code:gr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Qr(i,{code:gr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")E9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"email",code:gr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")rke||(rke=new RegExp(v9n,"u")),rke.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"emoji",code:gr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")m9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"uuid",code:gr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")g9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"nanoid",code:gr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")f9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"cuid",code:gr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")p9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"cuid2",code:gr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")h9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"ulid",code:gr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Qr(i,{validation:"url",code:gr.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),Qr(i,{validation:"regex",code:gr.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),Qr(i,{code:gr.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),Qr(i,{code:gr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),Qr(i,{code:gr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?ZTt(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{code:gr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?T9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{code:gr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?I9n(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{code:gr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?y9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"duration",code:gr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?D9n(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"ip",code:gr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?R9n(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"jwt",code:gr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?B9n(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"cidr",code:gr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?S9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"base64",code:gr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?_9n.test(e.data)||(i=this._getOrReturnCtx(e,i),Qr(i,{validation:"base64url",code:gr.invalid_string,message:o.message}),n.dirty()):is.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:gr.invalid_string,...xn.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...xn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...xn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...xn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...xn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...xn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...xn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...xn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...xn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...xn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...xn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...xn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...xn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...xn.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...xn.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...xn.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...xn.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...xn.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...xn.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...xn.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...xn.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...xn.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...xn.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...xn.errToObj(r)})}nonempty(e){return this.min(1,xn.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};p7.create=t=>new p7({checks:[],typeName:vi.ZodString,coerce:t?.coerce??!1,...Ao(t)});_T=class t extends No{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)!==zr.number){let o=this._getOrReturnCtx(e);return Qr(o,{code:gr.invalid_type,expected:zr.number,received:o.parsedType}),mi}let n,i=new eh;for(let o of this._def.checks)o.kind==="int"?is.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Qr(n,{code:gr.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),Qr(n,{code:gr.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),Qr(n,{code:gr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?N9n(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),Qr(n,{code:gr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Qr(n,{code:gr.not_finite,message:o.message}),i.dirty()):is.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,xn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,xn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,xn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,xn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:xn.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:xn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:xn.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:xn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xn.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&is.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)}};_T.create=t=>new _T({checks:[],typeName:vi.ZodNumber,coerce:t?.coerce||!1,...Ao(t)});TT=class t extends No{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)!==zr.bigint)return this._getInvalidInput(e);let n,i=new eh;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),Qr(n,{code:gr.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),Qr(n,{code:gr.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),Qr(n,{code:gr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):is.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Qr(r,{code:gr.invalid_type,expected:zr.bigint,received:r.parsedType}),mi}gte(e,r){return this.setLimit("min",e,!0,xn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,xn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,xn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,xn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:xn.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:xn.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};TT.create=t=>new TT({checks:[],typeName:vi.ZodBigInt,coerce:t?.coerce??!1,...Ao(t)});IT=class extends No{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==zr.boolean){let n=this._getOrReturnCtx(e);return Qr(n,{code:gr.invalid_type,expected:zr.boolean,received:n.parsedType}),mi}return $h(e.data)}};IT.create=t=>new IT({typeName:vi.ZodBoolean,coerce:t?.coerce||!1,...Ao(t)});DT=class t extends No{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==zr.date){let o=this._getOrReturnCtx(e);return Qr(o,{code:gr.invalid_type,expected:zr.date,received:o.parsedType}),mi}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Qr(o,{code:gr.invalid_date}),mi}let n=new eh,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),Qr(i,{code:gr.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),Qr(i,{code:gr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):is.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:xn.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:xn.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};DT.create=t=>new DT({checks:[],coerce:t?.coerce||!1,typeName:vi.ZodDate,...Ao(t)});QF=class extends No{_parse(e){if(this._getType(e)!==zr.symbol){let n=this._getOrReturnCtx(e);return Qr(n,{code:gr.invalid_type,expected:zr.symbol,received:n.parsedType}),mi}return $h(e.data)}};QF.create=t=>new QF({typeName:vi.ZodSymbol,...Ao(t)});RT=class extends No{_parse(e){if(this._getType(e)!==zr.undefined){let n=this._getOrReturnCtx(e);return Qr(n,{code:gr.invalid_type,expected:zr.undefined,received:n.parsedType}),mi}return $h(e.data)}};RT.create=t=>new RT({typeName:vi.ZodUndefined,...Ao(t)});BT=class extends No{_parse(e){if(this._getType(e)!==zr.null){let n=this._getOrReturnCtx(e);return Qr(n,{code:gr.invalid_type,expected:zr.null,received:n.parsedType}),mi}return $h(e.data)}};BT.create=t=>new BT({typeName:vi.ZodNull,...Ao(t)});h7=class extends No{constructor(){super(...arguments),this._any=!0}_parse(e){return $h(e.data)}};h7.create=t=>new h7({typeName:vi.ZodAny,...Ao(t)});MC=class extends No{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $h(e.data)}};MC.create=t=>new MC({typeName:vi.ZodUnknown,...Ao(t)});n6=class extends No{_parse(e){let r=this._getOrReturnCtx(e);return Qr(r,{code:gr.invalid_type,expected:zr.never,received:r.parsedType}),mi}};n6.create=t=>new n6({typeName:vi.ZodNever,...Ao(t)});qF=class extends No{_parse(e){if(this._getType(e)!==zr.undefined){let n=this._getOrReturnCtx(e);return Qr(n,{code:gr.invalid_type,expected:zr.void,received:n.parsedType}),mi}return $h(e.data)}};qF.create=t=>new qF({typeName:vi.ZodVoid,...Ao(t)});FC=class t extends No{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==zr.array)return Qr(r,{code:gr.invalid_type,expected:zr.array,received:r.parsedType}),mi;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Qr(r,{code:s?gr.too_big:gr.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&&(Qr(r,{code:gr.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&&(Qr(r,{code:gr.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 OA(r,s,r.path,a)))).then(s=>eh.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new OA(r,s,r.path,a)));return eh.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:xn.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:xn.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:xn.toString(r)}})}nonempty(e){return this.min(1,e)}};FC.create=(t,e)=>new FC({type:t,minLength:null,maxLength:null,exactLength:null,typeName:vi.ZodArray,...Ao(e)});cg=class t extends No{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=is.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==zr.object){let u=this._getOrReturnCtx(e);return Qr(u,{code:gr.invalid_type,expected:zr.object,received:u.parsedType}),mi}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof n6&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let d=o[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new OA(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof n6){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")a.length>0&&(Qr(i,{code:gr.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 d of a){let f=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new OA(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>eh.mergeObjectSync(n,u)):eh.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return xn.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:xn.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:vi.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 is.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 is.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return UF(this)}partial(e){let r={};for(let n of is.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 is.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof NA;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return eIt(is.objectKeys(this.shape))}};cg.create=(t,e)=>new cg({shape:()=>t,unknownKeys:"strip",catchall:n6.create(),typeName:vi.ZodObject,...Ao(e)});cg.strictCreate=(t,e)=>new cg({shape:()=>t,unknownKeys:"strict",catchall:n6.create(),typeName:vi.ZodObject,...Ao(e)});cg.lazycreate=(t,e)=>new cg({shape:t,unknownKeys:"strip",catchall:n6.create(),typeName:vi.ZodObject,...Ao(e)});NT=class extends No{_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 lg(a.ctx.common.issues));return Qr(r,{code:gr.invalid_union,unionErrors:s}),mi}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},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,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 lg(c));return Qr(r,{code:gr.invalid_union,unionErrors:a}),mi}}get options(){return this._def.options}};NT.create=(t,e)=>new NT({options:t,typeName:vi.ZodUnion,...Ao(e)});kC=t=>t instanceof kT?kC(t.schema):t instanceof kA?kC(t.innerType()):t instanceof MT?[t.value]:t instanceof FT?t.options:t instanceof PT?is.objectValues(t.enum):t instanceof LT?kC(t._def.innerType):t instanceof RT?[void 0]:t instanceof BT?[null]:t instanceof NA?[void 0,...kC(t.unwrap())]:t instanceof xE?[null,...kC(t.unwrap())]:t instanceof oz||t instanceof QT?kC(t.unwrap()):t instanceof UT?kC(t._def.innerType):[],Hde=class t extends No{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==zr.object)return Qr(r,{code:gr.invalid_type,expected:zr.object,received:r.parsedType}),mi;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}):(Qr(r,{code:gr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mi)}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=kC(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:vi.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Ao(n)})}};OT=class extends No{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(Qde(o)||Qde(s))return mi;let a=nke(o.value,s.value);return a.valid?((qde(o)||qde(s))&&r.dirty(),{status:r.value,value:a.data}):(Qr(n,{code:gr.invalid_intersection_types}),mi)};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}))}};OT.create=(t,e,r)=>new OT({left:t,right:e,typeName:vi.ZodIntersection,...Ao(r)});wE=class t extends No{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==zr.array)return Qr(n,{code:gr.invalid_type,expected:zr.array,received:n.parsedType}),mi;if(n.data.length<this._def.items.length)return Qr(n,{code:gr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),mi;!this._def.rest&&n.data.length>this._def.items.length&&(Qr(n,{code:gr.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 OA(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>eh.mergeArray(r,s)):eh.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wE.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wE({items:t,typeName:vi.ZodTuple,rest:null,...Ao(e)})};Gde=class t extends No{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!==zr.object)return Qr(n,{code:gr.invalid_type,expected:zr.object,received:n.parsedType}),mi;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new OA(n,a,n.path,a)),value:s._parse(new OA(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?eh.mergeObjectAsync(r,i):eh.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof No?new t({keyType:e,valueType:r,typeName:vi.ZodRecord,...Ao(n)}):new t({keyType:p7.create(),valueType:e,typeName:vi.ZodRecord,...Ao(r)})}},HF=class extends No{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!==zr.map)return Qr(n,{code:gr.invalid_type,expected:zr.map,received:n.parsedType}),mi;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new OA(n,a,n.path,[u,"key"])),value:o._parse(new OA(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,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return mi;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return mi;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};HF.create=(t,e,r)=>new HF({valueType:e,keyType:t,typeName:vi.ZodMap,...Ao(r)});GF=class t extends No{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==zr.set)return Qr(n,{code:gr.invalid_type,expected:zr.set,received:n.parsedType}),mi;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Qr(n,{code:gr.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&&(Qr(n,{code:gr.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 d of c){if(d.status==="aborted")return mi;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new OA(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:xn.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:xn.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};GF.create=(t,e)=>new GF({valueType:t,minSize:null,maxSize:null,typeName:vi.ZodSet,...Ao(e)});Vde=class t extends No{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==zr.function)return Qr(r,{code:gr.invalid_type,expected:zr.function,received:r.parsedType}),mi;function n(a,c){return iz({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,PF(),OC].filter(u=>!!u),issueData:{code:gr.invalid_arguments,argumentsError:c}})}function i(a,c){return iz({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,PF(),OC].filter(u=>!!u),issueData:{code:gr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof m7){let a=this;return $h(async function(...c){let u=new lg([]),d=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),f=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(h=>{throw u.addIssue(i(f,h)),u})})}else{let a=this;return $h(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new lg([n(c,u.error)]);let d=Reflect.apply(s,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new lg([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wE.create(e).rest(MC.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||wE.create([]).rest(MC.create()),returns:r||MC.create(),typeName:vi.ZodFunction,...Ao(n)})}},kT=class extends No{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})}};kT.create=(t,e)=>new kT({getter:t,typeName:vi.ZodLazy,...Ao(e)});MT=class extends No{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Qr(r,{received:r.data,code:gr.invalid_literal,expected:this._def.value}),mi}return{status:"valid",value:e.data}}get value(){return this._def.value}};MT.create=(t,e)=>new MT({value:t,typeName:vi.ZodLiteral,...Ao(e)});FT=class t extends No{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Qr(r,{expected:is.joinValues(n),received:r.parsedType,code:gr.invalid_type}),mi}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 Qr(r,{received:r.data,code:gr.invalid_enum_value,options:n}),mi}return $h(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})}};FT.create=eIt;PT=class extends No{_parse(e){let r=is.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==zr.string&&n.parsedType!==zr.number){let i=is.objectValues(r);return Qr(n,{expected:is.joinValues(i),received:n.parsedType,code:gr.invalid_type}),mi}if(this._cache||(this._cache=new Set(is.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=is.objectValues(r);return Qr(n,{received:n.data,code:gr.invalid_enum_value,options:i}),mi}return $h(e.data)}get enum(){return this._def.values}};PT.create=(t,e)=>new PT({values:t,typeName:vi.ZodNativeEnum,...Ao(e)});m7=class extends No{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==zr.promise&&r.common.async===!1)return Qr(r,{code:gr.invalid_type,expected:zr.promise,received:r.parsedType}),mi;let n=r.parsedType===zr.promise?r.data:Promise.resolve(r.data);return $h(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};m7.create=(t,e)=>new m7({type:t,typeName:vi.ZodPromise,...Ao(e)});kA=class extends No{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===vi.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=>{Qr(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 mi;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?mi:c.status==="dirty"?ST(c.value):r.value==="dirty"?ST(c.value):c});{if(r.value==="aborted")return mi;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?mi:a.status==="dirty"?ST(a.value):r.value==="dirty"?ST(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"?mi:(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"?mi:(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(!f7(s))return mi;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=>f7(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):mi);is.assertNever(i)}};kA.create=(t,e,r)=>new kA({schema:t,typeName:vi.ZodEffects,effect:e,...Ao(r)});kA.createWithPreprocess=(t,e,r)=>new kA({schema:e,effect:{type:"preprocess",transform:t},typeName:vi.ZodEffects,...Ao(r)});NA=class extends No{_parse(e){return this._getType(e)===zr.undefined?$h(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};NA.create=(t,e)=>new NA({innerType:t,typeName:vi.ZodOptional,...Ao(e)});xE=class extends No{_parse(e){return this._getType(e)===zr.null?$h(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};xE.create=(t,e)=>new xE({innerType:t,typeName:vi.ZodNullable,...Ao(e)});LT=class extends No{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===zr.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};LT.create=(t,e)=>new LT({innerType:t,typeName:vi.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ao(e)});UT=class extends No{_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 LF(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new lg(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new lg(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};UT.create=(t,e)=>new UT({innerType:t,typeName:vi.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ao(e)});VF=class extends No{_parse(e){if(this._getType(e)!==zr.nan){let n=this._getOrReturnCtx(e);return Qr(n,{code:gr.invalid_type,expected:zr.nan,received:n.parsedType}),mi}return{status:"valid",value:e.data}}};VF.create=t=>new VF({typeName:vi.ZodNaN,...Ao(t)});O9n=Symbol("zod_brand"),oz=class extends No{_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}},sz=class t extends No{_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"?mi:o.status==="dirty"?(r.dirty(),ST(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"?mi: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:vi.ZodPipeline})}},QT=class extends No{_parse(e){let r=this._def.innerType._parse(e),n=i=>(f7(i)&&(i.value=Object.freeze(i.value)),i);return LF(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};QT.create=(t,e)=>new QT({innerType:t,typeName:vi.ZodReadonly,...Ao(e)});k9n={object:cg.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"})(vi||(vi={}));M9n=(t,e={message:`Input not instance of ${t.name}`})=>tIt(r=>r instanceof t,e),rIt=p7.create,nIt=_T.create,F9n=VF.create,P9n=TT.create,iIt=IT.create,L9n=DT.create,U9n=QF.create,Q9n=RT.create,q9n=BT.create,H9n=h7.create,G9n=MC.create,V9n=n6.create,$9n=qF.create,W9n=FC.create,j9n=cg.create,Y9n=cg.strictCreate,z9n=NT.create,J9n=Hde.create,K9n=OT.create,X9n=wE.create,Z9n=Gde.create,e7n=HF.create,t7n=GF.create,r7n=Vde.create,n7n=kT.create,i7n=MT.create,o7n=FT.create,s7n=PT.create,a7n=m7.create,l7n=kA.create,c7n=NA.create,u7n=xE.create,d7n=kA.createWithPreprocess,f7n=sz.create,p7n=()=>rIt().optional(),h7n=()=>nIt().optional(),m7n=()=>iIt().optional(),g7n={string:(t=>p7.create({...t,coerce:!0})),number:(t=>_T.create({...t,coerce:!0})),boolean:(t=>IT.create({...t,coerce:!0})),bigint:(t=>TT.create({...t,coerce:!0})),date:(t=>DT.create({...t,coerce:!0}))},A7n=mi});var ee={};cf(ee,{BRAND:()=>O9n,DIRTY:()=>ST,EMPTY_PATH:()=>d9n,INVALID:()=>mi,NEVER:()=>A7n,OK:()=>$h,ParseStatus:()=>eh,Schema:()=>No,ZodAny:()=>h7,ZodArray:()=>FC,ZodBigInt:()=>TT,ZodBoolean:()=>IT,ZodBranded:()=>oz,ZodCatch:()=>UT,ZodDate:()=>DT,ZodDefault:()=>LT,ZodDiscriminatedUnion:()=>Hde,ZodEffects:()=>kA,ZodEnum:()=>FT,ZodError:()=>lg,ZodFirstPartyTypeKind:()=>vi,ZodFunction:()=>Vde,ZodIntersection:()=>OT,ZodIssueCode:()=>gr,ZodLazy:()=>kT,ZodLiteral:()=>MT,ZodMap:()=>HF,ZodNaN:()=>VF,ZodNativeEnum:()=>PT,ZodNever:()=>n6,ZodNull:()=>BT,ZodNullable:()=>xE,ZodNumber:()=>_T,ZodObject:()=>cg,ZodOptional:()=>NA,ZodParsedType:()=>zr,ZodPipeline:()=>sz,ZodPromise:()=>m7,ZodReadonly:()=>QT,ZodRecord:()=>Gde,ZodSchema:()=>No,ZodSet:()=>GF,ZodString:()=>p7,ZodSymbol:()=>QF,ZodTransformer:()=>kA,ZodTuple:()=>wE,ZodType:()=>No,ZodUndefined:()=>RT,ZodUnion:()=>NT,ZodUnknown:()=>MC,ZodVoid:()=>qF,addIssueToContext:()=>Qr,any:()=>H9n,array:()=>W9n,bigint:()=>P9n,boolean:()=>iIt,coerce:()=>g7n,custom:()=>tIt,date:()=>L9n,datetimeRegex:()=>ZTt,defaultErrorMap:()=>OC,discriminatedUnion:()=>J9n,effect:()=>l7n,enum:()=>o7n,function:()=>r7n,getErrorMap:()=>PF,getParsedType:()=>bE,instanceof:()=>M9n,intersection:()=>K9n,isAborted:()=>Qde,isAsync:()=>LF,isDirty:()=>qde,isValid:()=>f7,late:()=>k9n,lazy:()=>n7n,literal:()=>i7n,makeIssue:()=>iz,map:()=>e7n,nan:()=>F9n,nativeEnum:()=>s7n,never:()=>V9n,null:()=>q9n,nullable:()=>u7n,number:()=>nIt,object:()=>j9n,objectUtil:()=>ZOe,oboolean:()=>m7n,onumber:()=>h7n,optional:()=>c7n,ostring:()=>p7n,pipeline:()=>f7n,preprocess:()=>d7n,promise:()=>a7n,quotelessJson:()=>l9n,record:()=>Z9n,set:()=>t7n,setErrorMap:()=>u9n,strictObject:()=>Y9n,string:()=>rIt,symbol:()=>U9n,transformer:()=>l7n,tuple:()=>X9n,undefined:()=>Q9n,union:()=>z9n,unknown:()=>G9n,util:()=>is,void:()=>$9n});var ike=le(()=>{Ude();tke();jTt();nz();oIt();Lde()});var g7=le(()=>{ike();ike()});var $F,sIt,$de,aIt,lIt,y7n,PA,ug,az,SE,LA,Wde,cIt,jde,uIt,dIt,fIt,lz,MA,pIt,hIt,A7,qT,Yde,cz,mIt,E7n,v7n,C7n,oke,gIt,AIt,zde,b7n,Jde,Kde,Xde,yIt,EIt,ske,vIt,CIt,w7n,x7n,ake,S7n,lke,_7n,cke,T7n,I7n,D7n,R7n,B7n,N7n,O7n,uz,k7n,uke,dke,fke,M7n,F7n,bIt,P7n,dz,L7n,U7n,Q7n,q7n,pke,Zde,Axo,H7n,G7n,wIt,V7n,$7n,W7n,j7n,Y7n,z7n,J7n,K7n,X7n,Z7n,ewn,twn,rwn,nwn,iwn,own,swn,hke,awn,efe,lwn,cwn,yxo,Exo,vxo,Cxo,bxo,wxo,FA,y7=le(()=>{g7();$F="2025-06-18",sIt=[$F,"2025-03-26","2024-11-05","2024-10-07"],$de="2.0",aIt=ee.union([ee.string(),ee.number().int()]),lIt=ee.string(),y7n=ee.object({progressToken:ee.optional(aIt)}).passthrough(),PA=ee.object({_meta:ee.optional(y7n)}).passthrough(),ug=ee.object({method:ee.string(),params:ee.optional(PA)}),az=ee.object({_meta:ee.optional(ee.object({}).passthrough())}).passthrough(),SE=ee.object({method:ee.string(),params:ee.optional(az)}),LA=ee.object({_meta:ee.optional(ee.object({}).passthrough())}).passthrough(),Wde=ee.union([ee.string(),ee.number().int()]),cIt=ee.object({jsonrpc:ee.literal($de),id:Wde}).merge(ug).strict(),jde=t=>cIt.safeParse(t).success,uIt=ee.object({jsonrpc:ee.literal($de)}).merge(SE).strict(),dIt=t=>uIt.safeParse(t).success,fIt=ee.object({jsonrpc:ee.literal($de),id:Wde,result:LA}).strict(),lz=t=>fIt.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"})(MA||(MA={}));pIt=ee.object({jsonrpc:ee.literal($de),id:Wde,error:ee.object({code:ee.number().int(),message:ee.string(),data:ee.optional(ee.unknown())})}).strict(),hIt=t=>pIt.safeParse(t).success,A7=ee.union([cIt,uIt,fIt,pIt]),qT=LA.strict(),Yde=SE.extend({method:ee.literal("notifications/cancelled"),params:az.extend({requestId:Wde,reason:ee.string().optional()})}),cz=ee.object({name:ee.string(),title:ee.optional(ee.string())}).passthrough(),mIt=cz.extend({version:ee.string()}),E7n=ee.object({experimental:ee.optional(ee.object({}).passthrough()),sampling:ee.optional(ee.object({}).passthrough()),elicitation:ee.optional(ee.object({}).passthrough()),roots:ee.optional(ee.object({listChanged:ee.optional(ee.boolean())}).passthrough())}).passthrough(),v7n=ug.extend({method:ee.literal("initialize"),params:PA.extend({protocolVersion:ee.string(),capabilities:E7n,clientInfo:mIt})}),C7n=ee.object({experimental:ee.optional(ee.object({}).passthrough()),logging:ee.optional(ee.object({}).passthrough()),completions:ee.optional(ee.object({}).passthrough()),prompts:ee.optional(ee.object({listChanged:ee.optional(ee.boolean())}).passthrough()),resources:ee.optional(ee.object({subscribe:ee.optional(ee.boolean()),listChanged:ee.optional(ee.boolean())}).passthrough()),tools:ee.optional(ee.object({listChanged:ee.optional(ee.boolean())}).passthrough())}).passthrough(),oke=LA.extend({protocolVersion:ee.string(),capabilities:C7n,serverInfo:mIt,instructions:ee.optional(ee.string())}),gIt=SE.extend({method:ee.literal("notifications/initialized")}),AIt=t=>gIt.safeParse(t).success,zde=ug.extend({method:ee.literal("ping")}),b7n=ee.object({progress:ee.number(),total:ee.optional(ee.number()),message:ee.optional(ee.string())}).passthrough(),Jde=SE.extend({method:ee.literal("notifications/progress"),params:az.merge(b7n).extend({progressToken:aIt})}),Kde=ug.extend({params:PA.extend({cursor:ee.optional(lIt)}).optional()}),Xde=LA.extend({nextCursor:ee.optional(lIt)}),yIt=ee.object({uri:ee.string(),mimeType:ee.optional(ee.string()),_meta:ee.optional(ee.object({}).passthrough())}).passthrough(),EIt=yIt.extend({text:ee.string()}),ske=ee.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),vIt=yIt.extend({blob:ske}),CIt=cz.extend({uri:ee.string(),description:ee.optional(ee.string()),mimeType:ee.optional(ee.string()),_meta:ee.optional(ee.object({}).passthrough())}),w7n=cz.extend({uriTemplate:ee.string(),description:ee.optional(ee.string()),mimeType:ee.optional(ee.string()),_meta:ee.optional(ee.object({}).passthrough())}),x7n=Kde.extend({method:ee.literal("resources/list")}),ake=Xde.extend({resources:ee.array(CIt)}),S7n=Kde.extend({method:ee.literal("resources/templates/list")}),lke=Xde.extend({resourceTemplates:ee.array(w7n)}),_7n=ug.extend({method:ee.literal("resources/read"),params:PA.extend({uri:ee.string()})}),cke=LA.extend({contents:ee.array(ee.union([EIt,vIt]))}),T7n=SE.extend({method:ee.literal("notifications/resources/list_changed")}),I7n=ug.extend({method:ee.literal("resources/subscribe"),params:PA.extend({uri:ee.string()})}),D7n=ug.extend({method:ee.literal("resources/unsubscribe"),params:PA.extend({uri:ee.string()})}),R7n=SE.extend({method:ee.literal("notifications/resources/updated"),params:az.extend({uri:ee.string()})}),B7n=ee.object({name:ee.string(),description:ee.optional(ee.string()),required:ee.optional(ee.boolean())}).passthrough(),N7n=cz.extend({description:ee.optional(ee.string()),arguments:ee.optional(ee.array(B7n)),_meta:ee.optional(ee.object({}).passthrough())}),O7n=Kde.extend({method:ee.literal("prompts/list")}),uz=Xde.extend({prompts:ee.array(N7n)}),k7n=ug.extend({method:ee.literal("prompts/get"),params:PA.extend({name:ee.string(),arguments:ee.optional(ee.record(ee.string()))})}),uke=ee.object({type:ee.literal("text"),text:ee.string(),_meta:ee.optional(ee.object({}).passthrough())}).passthrough(),dke=ee.object({type:ee.literal("image"),data:ske,mimeType:ee.string(),_meta:ee.optional(ee.object({}).passthrough())}).passthrough(),fke=ee.object({type:ee.literal("audio"),data:ske,mimeType:ee.string(),_meta:ee.optional(ee.object({}).passthrough())}).passthrough(),M7n=ee.object({type:ee.literal("resource"),resource:ee.union([EIt,vIt]),_meta:ee.optional(ee.object({}).passthrough())}).passthrough(),F7n=CIt.extend({type:ee.literal("resource_link")}),bIt=ee.union([uke,dke,fke,F7n,M7n]),P7n=ee.object({role:ee.enum(["user","assistant"]),content:bIt}).passthrough(),dz=LA.extend({description:ee.optional(ee.string()),messages:ee.array(P7n)}),L7n=SE.extend({method:ee.literal("notifications/prompts/list_changed")}),U7n=ee.object({title:ee.optional(ee.string()),readOnlyHint:ee.optional(ee.boolean()),destructiveHint:ee.optional(ee.boolean()),idempotentHint:ee.optional(ee.boolean()),openWorldHint:ee.optional(ee.boolean())}).passthrough(),Q7n=cz.extend({description:ee.optional(ee.string()),inputSchema:ee.object({type:ee.literal("object"),properties:ee.optional(ee.object({}).passthrough()),required:ee.optional(ee.array(ee.string()))}).passthrough(),outputSchema:ee.optional(ee.object({type:ee.literal("object"),properties:ee.optional(ee.object({}).passthrough()),required:ee.optional(ee.array(ee.string()))}).passthrough()),annotations:ee.optional(U7n),_meta:ee.optional(ee.object({}).passthrough())}),q7n=Kde.extend({method:ee.literal("tools/list")}),pke=Xde.extend({tools:ee.array(Q7n)}),Zde=LA.extend({content:ee.array(bIt).default([]),structuredContent:ee.object({}).passthrough().optional(),isError:ee.optional(ee.boolean())}),Axo=Zde.or(LA.extend({toolResult:ee.unknown()})),H7n=ug.extend({method:ee.literal("tools/call"),params:PA.extend({name:ee.string(),arguments:ee.optional(ee.record(ee.unknown()))})}),G7n=SE.extend({method:ee.literal("notifications/tools/list_changed")}),wIt=ee.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),V7n=ug.extend({method:ee.literal("logging/setLevel"),params:PA.extend({level:wIt})}),$7n=SE.extend({method:ee.literal("notifications/message"),params:az.extend({level:wIt,logger:ee.optional(ee.string()),data:ee.unknown()})}),W7n=ee.object({name:ee.string().optional()}).passthrough(),j7n=ee.object({hints:ee.optional(ee.array(W7n)),costPriority:ee.optional(ee.number().min(0).max(1)),speedPriority:ee.optional(ee.number().min(0).max(1)),intelligencePriority:ee.optional(ee.number().min(0).max(1))}).passthrough(),Y7n=ee.object({role:ee.enum(["user","assistant"]),content:ee.union([uke,dke,fke])}).passthrough(),z7n=ug.extend({method:ee.literal("sampling/createMessage"),params:PA.extend({messages:ee.array(Y7n),systemPrompt:ee.optional(ee.string()),includeContext:ee.optional(ee.enum(["none","thisServer","allServers"])),temperature:ee.optional(ee.number()),maxTokens:ee.number().int(),stopSequences:ee.optional(ee.array(ee.string())),metadata:ee.optional(ee.object({}).passthrough()),modelPreferences:ee.optional(j7n)})}),J7n=LA.extend({model:ee.string(),stopReason:ee.optional(ee.enum(["endTurn","stopSequence","maxTokens"]).or(ee.string())),role:ee.enum(["user","assistant"]),content:ee.discriminatedUnion("type",[uke,dke,fke])}),K7n=ee.object({type:ee.literal("boolean"),title:ee.optional(ee.string()),description:ee.optional(ee.string()),default:ee.optional(ee.boolean())}).passthrough(),X7n=ee.object({type:ee.literal("string"),title:ee.optional(ee.string()),description:ee.optional(ee.string()),minLength:ee.optional(ee.number()),maxLength:ee.optional(ee.number()),format:ee.optional(ee.enum(["email","uri","date","date-time"]))}).passthrough(),Z7n=ee.object({type:ee.enum(["number","integer"]),title:ee.optional(ee.string()),description:ee.optional(ee.string()),minimum:ee.optional(ee.number()),maximum:ee.optional(ee.number())}).passthrough(),ewn=ee.object({type:ee.literal("string"),title:ee.optional(ee.string()),description:ee.optional(ee.string()),enum:ee.array(ee.string()),enumNames:ee.optional(ee.array(ee.string()))}).passthrough(),twn=ee.union([K7n,X7n,Z7n,ewn]),rwn=ug.extend({method:ee.literal("elicitation/create"),params:PA.extend({message:ee.string(),requestedSchema:ee.object({type:ee.literal("object"),properties:ee.record(ee.string(),twn),required:ee.optional(ee.array(ee.string()))}).passthrough()})}),nwn=LA.extend({action:ee.enum(["accept","decline","cancel"]),content:ee.optional(ee.record(ee.string(),ee.unknown()))}),iwn=ee.object({type:ee.literal("ref/resource"),uri:ee.string()}).passthrough(),own=ee.object({type:ee.literal("ref/prompt"),name:ee.string()}).passthrough(),swn=ug.extend({method:ee.literal("completion/complete"),params:PA.extend({ref:ee.union([own,iwn]),argument:ee.object({name:ee.string(),value:ee.string()}).passthrough(),context:ee.optional(ee.object({arguments:ee.optional(ee.record(ee.string(),ee.string()))}))})}),hke=LA.extend({completion:ee.object({values:ee.array(ee.string()).max(100),total:ee.optional(ee.number().int()),hasMore:ee.optional(ee.boolean())}).passthrough()}),awn=ee.object({uri:ee.string().startsWith("file://"),name:ee.optional(ee.string()),_meta:ee.optional(ee.object({}).passthrough())}).passthrough(),efe=ug.extend({method:ee.literal("roots/list")}),lwn=LA.extend({roots:ee.array(awn)}),cwn=SE.extend({method:ee.literal("notifications/roots/list_changed")}),yxo=ee.union([zde,v7n,swn,V7n,k7n,O7n,x7n,S7n,_7n,I7n,D7n,H7n,q7n]),Exo=ee.union([Yde,Jde,gIt,cwn]),vxo=ee.union([qT,J7n,nwn,lwn]),Cxo=ee.union([zde,z7n,rwn,efe]),bxo=ee.union([Yde,Jde,$7n,R7n,T7n,G7n,L7n]),wxo=ee.union([qT,oke,hke,dz,uz,ake,lke,cke,Zde,pke]),FA=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function xIt(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 uwn,tfe,SIt=le(()=>{y7();uwn=6e4,tfe=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(Yde,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(Jde,r=>{this._onprogress(r)}),this.setRequestHandler(zde,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 FA(MA.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),lz(c)||hIt(c)?this._onresponse(c):jde(c)?this._onrequest(c,u):dIt(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 FA(MA.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:MA.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,d,f)=>this.request(u,d,{...f,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 d;if(!a.signal.aborted)return s?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:MA.InternalError,message:(d=u.message)!==null&&d!==void 0?d:"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),lz(e))n(e);else{let i=new FA(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,d,f,p,h,m;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),(d=n?.signal)===null||d===void 0||d.throwIfAborted();let g=this._requestMessageId++,A={...e,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),A.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:g}});let y=w=>{var I;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(I=this._transport)===null||I===void 0||I.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(w)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(M=>this._onerror(new Error(`Failed to send cancellation: ${M}`))),c(w)};this._responseHandlers.set(g,w=>{var I;if(!(!((I=n?.signal)===null||I===void 0)&&I.aborted)){if(w instanceof Error)return c(w);try{let M=r.parse(w.result);a(M)}catch(M){c(M)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var w;y((w=n?.signal)===null||w===void 0?void 0:w.reason)});let v=(h=n?.timeout)!==null&&h!==void 0?h:uwn,b=()=>y(new FA(MA.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(g,v,n?.maxTotalTimeout,b,(m=n?.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(A,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(w=>{this._cleanupTimeout(g),c(w)})})}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(d=>this._onerror(d))});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 TIt=D((rfe,_It)=>{(function(t,e){typeof rfe=="object"&&typeof _It<"u"?e(rfe):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(rfe,(function(t){"use strict";function e(){for(var tt=arguments.length,Ge=Array(tt),rt=0;rt<tt;rt++)Ge[rt]=arguments[rt];if(Ge.length>1){Ge[0]=Ge[0].slice(0,-1);for(var ht=Ge.length-1,gt=1;gt<ht;++gt)Ge[gt]=Ge[gt].slice(1,-1);return Ge[ht]=Ge[ht].slice(1),Ge.join("")}else return Ge[0]}function r(tt){return"(?:"+tt+")"}function n(tt){return tt===void 0?"undefined":tt===null?"null":Object.prototype.toString.call(tt).split(" ").pop().split("]").shift().toLowerCase()}function i(tt){return tt.toUpperCase()}function o(tt){return tt!=null?tt instanceof Array?tt:typeof tt.length!="number"||tt.split||tt.setInterval||tt.call?[tt]:Array.prototype.slice.call(tt):[]}function s(tt,Ge){var rt=tt;if(Ge)for(var ht in Ge)rt[ht]=Ge[ht];return rt}function a(tt){var Ge="[A-Za-z]",rt="[\\x0D]",ht="[0-9]",gt="[\\x22]",zt=e(ht,"[A-Fa-f]"),pr="[\\x0A]",Mr="[\\x20]",un=r(r("%[EFef]"+zt+"%"+zt+zt+"%"+zt+zt)+"|"+r("%[89A-Fa-f]"+zt+"%"+zt+zt)+"|"+r("%"+zt+zt)),ei="[\\:\\/\\?\\#\\[\\]\\@]",zn="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ni=e(ei,zn),Oi=tt?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Cn=tt?"[\\uE000-\\uF8FF]":"[]",hi=e(Ge,ht,"[\\-\\.\\_\\~]",Oi),So=r(Ge+e(Ge,ht,"[\\+\\-\\.]")+"*"),Xi=r(r(un+"|"+e(hi,zn,"[\\:]"))+"*"),ml=r(r("25[0-5]")+"|"+r("2[0-4]"+ht)+"|"+r("1"+ht+ht)+"|"+r("[1-9]"+ht)+"|"+ht),ma=r(r("25[0-5]")+"|"+r("2[0-4]"+ht)+"|"+r("1"+ht+ht)+"|"+r("0?[1-9]"+ht)+"|0?0?"+ht),gl=r(ma+"\\."+ma+"\\."+ma+"\\."+ma),Zi=r(zt+"{1,4}"),Dl=r(r(Zi+"\\:"+Zi)+"|"+gl),Lo=r(r(Zi+"\\:")+"{6}"+Dl),Ai=r("\\:\\:"+r(Zi+"\\:")+"{5}"+Dl),Yu=r(r(Zi)+"?\\:\\:"+r(Zi+"\\:")+"{4}"+Dl),Yl=r(r(r(Zi+"\\:")+"{0,1}"+Zi)+"?\\:\\:"+r(Zi+"\\:")+"{3}"+Dl),ef=r(r(r(Zi+"\\:")+"{0,2}"+Zi)+"?\\:\\:"+r(Zi+"\\:")+"{2}"+Dl),Zc=r(r(r(Zi+"\\:")+"{0,3}"+Zi)+"?\\:\\:"+Zi+"\\:"+Dl),ga=r(r(r(Zi+"\\:")+"{0,4}"+Zi)+"?\\:\\:"+Dl),bs=r(r(r(Zi+"\\:")+"{0,5}"+Zi)+"?\\:\\:"+Zi),eu=r(r(r(Zi+"\\:")+"{0,6}"+Zi)+"?\\:\\:"),Fe=r([Lo,Ai,Yu,Yl,ef,Zc,ga,bs,eu].join("|")),Ue=r(r(hi+"|"+un)+"+"),st=r(Fe+"\\%25"+Ue),ft=r(Fe+r("\\%25|\\%(?!"+zt+"{2})")+Ue),Et=r("[vV]"+zt+"+\\."+e(hi,zn,"[\\:]")+"+"),Mt=r("\\["+r(ft+"|"+Fe+"|"+Et)+"\\]"),Jt=r(r(un+"|"+e(hi,zn))+"*"),Zt=r(Mt+"|"+gl+"(?!"+Jt+")|"+Jt),yr=r(ht+"*"),ur=r(r(Xi+"@")+"?"+Zt+r("\\:"+yr)+"?"),Dr=r(un+"|"+e(hi,zn,"[\\:\\@]")),nn=r(Dr+"*"),$i=r(Dr+"+"),cs=r(r(un+"|"+e(hi,zn,"[\\@]"))+"+"),ti=r(r("\\/"+nn)+"*"),$a=r("\\/"+r($i+ti)+"?"),zl=r(cs+ti),Mf=r($i+ti),Xa="(?!"+Dr+")",m2=r(ti+"|"+$a+"|"+zl+"|"+Mf+"|"+Xa),_d=r(r(Dr+"|"+e("[\\/\\?]",Cn))+"*"),Mp=r(r(Dr+"|[\\/\\?]")+"*"),jm=r(r("\\/\\/"+ur+ti)+"|"+$a+"|"+Mf+"|"+Xa),gy=r(So+"\\:"+jm+r("\\?"+_d)+"?"+r("\\#"+Mp)+"?"),g2=r(r("\\/\\/"+ur+ti)+"|"+$a+"|"+zl+"|"+Xa),tu=r(g2+r("\\?"+_d)+"?"+r("\\#"+Mp)+"?"),j0=r(gy+"|"+tu),Fp=r(So+"\\:"+jm+r("\\?"+_d)+"?"),vu="^("+So+")\\:"+r(r("\\/\\/("+r("("+Xi+")@")+"?("+Zt+")"+r("\\:("+yr+")")+"?)")+"?("+ti+"|"+$a+"|"+Mf+"|"+Xa+")")+r("\\?("+_d+")")+"?"+r("\\#("+Mp+")")+"?$",tf="^(){0}"+r(r("\\/\\/("+r("("+Xi+")@")+"?("+Zt+")"+r("\\:("+yr+")")+"?)")+"?("+ti+"|"+$a+"|"+zl+"|"+Xa+")")+r("\\?("+_d+")")+"?"+r("\\#("+Mp+")")+"?$",Ym="^("+So+")\\:"+r(r("\\/\\/("+r("("+Xi+")@")+"?("+Zt+")"+r("\\:("+yr+")")+"?)")+"?("+ti+"|"+$a+"|"+Mf+"|"+Xa+")")+r("\\?("+_d+")")+"?$",bc="^"+r("\\#("+Mp+")")+"?$",Ay="^"+r("("+Xi+")@")+"?("+Zt+")"+r("\\:("+yr+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",Ge,ht,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",hi,zn),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",hi,zn),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",hi,zn),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",hi,zn),"g"),NOT_QUERY:new RegExp(e("[^\\%]",hi,zn,"[\\:\\@\\/\\?]",Cn),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",hi,zn,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",hi,zn),"g"),UNRESERVED:new RegExp(hi,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",hi,Ni),"g"),PCT_ENCODED:new RegExp(un,"g"),IPV4ADDRESS:new RegExp("^("+gl+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Fe+")"+r(r("\\%25|\\%(?!"+zt+"{2})")+"("+Ue+")")+"?\\]?$")}}var c=a(!1),u=a(!0),d=(function(){function tt(Ge,rt){var ht=[],gt=!0,zt=!1,pr=void 0;try{for(var Mr=Ge[Symbol.iterator](),un;!(gt=(un=Mr.next()).done)&&(ht.push(un.value),!(rt&&ht.length===rt));gt=!0);}catch(ei){zt=!0,pr=ei}finally{try{!gt&&Mr.return&&Mr.return()}finally{if(zt)throw pr}}return ht}return function(Ge,rt){if(Array.isArray(Ge))return Ge;if(Symbol.iterator in Object(Ge))return tt(Ge,rt);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),f=function(tt){if(Array.isArray(tt)){for(var Ge=0,rt=Array(tt.length);Ge<tt.length;Ge++)rt[Ge]=tt[Ge];return rt}else return Array.from(tt)},p=2147483647,h=36,m=1,g=26,A=38,y=700,v=72,b=128,w="-",I=/^xn--/,M=/[^\0-\x7E]/,N=/[\x2E\u3002\uFF0E\uFF61]/g,U={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=h-m,F=Math.floor,B=String.fromCharCode;function L(tt){throw new RangeError(U[tt])}function P(tt,Ge){for(var rt=[],ht=tt.length;ht--;)rt[ht]=Ge(tt[ht]);return rt}function R(tt,Ge){var rt=tt.split("@"),ht="";rt.length>1&&(ht=rt[0]+"@",tt=rt[1]),tt=tt.replace(N,".");var gt=tt.split("."),zt=P(gt,Ge).join(".");return ht+zt}function q(tt){for(var Ge=[],rt=0,ht=tt.length;rt<ht;){var gt=tt.charCodeAt(rt++);if(gt>=55296&&gt<=56319&&rt<ht){var zt=tt.charCodeAt(rt++);(zt&64512)==56320?Ge.push(((gt&1023)<<10)+(zt&1023)+65536):(Ge.push(gt),rt--)}else Ge.push(gt)}return Ge}var Q=function(Ge){return String.fromCodePoint.apply(String,f(Ge))},$=function(Ge){return Ge-48<10?Ge-22:Ge-65<26?Ge-65:Ge-97<26?Ge-97:h},G=function(Ge,rt){return Ge+22+75*(Ge<26)-((rt!=0)<<5)},K=function(Ge,rt,ht){var gt=0;for(Ge=ht?F(Ge/y):Ge>>1,Ge+=F(Ge/rt);Ge>S*g>>1;gt+=h)Ge=F(Ge/S);return F(gt+(S+1)*Ge/(Ge+A))},te=function(Ge){var rt=[],ht=Ge.length,gt=0,zt=b,pr=v,Mr=Ge.lastIndexOf(w);Mr<0&&(Mr=0);for(var un=0;un<Mr;++un)Ge.charCodeAt(un)>=128&&L("not-basic"),rt.push(Ge.charCodeAt(un));for(var ei=Mr>0?Mr+1:0;ei<ht;){for(var zn=gt,Ni=1,Oi=h;;Oi+=h){ei>=ht&&L("invalid-input");var Cn=$(Ge.charCodeAt(ei++));(Cn>=h||Cn>F((p-gt)/Ni))&&L("overflow"),gt+=Cn*Ni;var hi=Oi<=pr?m:Oi>=pr+g?g:Oi-pr;if(Cn<hi)break;var So=h-hi;Ni>F(p/So)&&L("overflow"),Ni*=So}var Xi=rt.length+1;pr=K(gt-zn,Xi,zn==0),F(gt/Xi)>p-zt&&L("overflow"),zt+=F(gt/Xi),gt%=Xi,rt.splice(gt++,0,zt)}return String.fromCodePoint.apply(String,rt)},he=function(Ge){var rt=[];Ge=q(Ge);var ht=Ge.length,gt=b,zt=0,pr=v,Mr=!0,un=!1,ei=void 0;try{for(var zn=Ge[Symbol.iterator](),Ni;!(Mr=(Ni=zn.next()).done);Mr=!0){var Oi=Ni.value;Oi<128&&rt.push(B(Oi))}}catch(ft){un=!0,ei=ft}finally{try{!Mr&&zn.return&&zn.return()}finally{if(un)throw ei}}var Cn=rt.length,hi=Cn;for(Cn&&rt.push(w);hi<ht;){var So=p,Xi=!0,ml=!1,ma=void 0;try{for(var gl=Ge[Symbol.iterator](),Zi;!(Xi=(Zi=gl.next()).done);Xi=!0){var Dl=Zi.value;Dl>=gt&&Dl<So&&(So=Dl)}}catch(ft){ml=!0,ma=ft}finally{try{!Xi&&gl.return&&gl.return()}finally{if(ml)throw ma}}var Lo=hi+1;So-gt>F((p-zt)/Lo)&&L("overflow"),zt+=(So-gt)*Lo,gt=So;var Ai=!0,Yu=!1,Yl=void 0;try{for(var ef=Ge[Symbol.iterator](),Zc;!(Ai=(Zc=ef.next()).done);Ai=!0){var ga=Zc.value;if(ga<gt&&++zt>p&&L("overflow"),ga==gt){for(var bs=zt,eu=h;;eu+=h){var Fe=eu<=pr?m:eu>=pr+g?g:eu-pr;if(bs<Fe)break;var Ue=bs-Fe,st=h-Fe;rt.push(B(G(Fe+Ue%st,0))),bs=F(Ue/st)}rt.push(B(G(bs,0))),pr=K(zt,Lo,hi==Cn),zt=0,++hi}}}catch(ft){Yu=!0,Yl=ft}finally{try{!Ai&&ef.return&&ef.return()}finally{if(Yu)throw Yl}}++zt,++gt}return rt.join("")},Ce=function(Ge){return R(Ge,function(rt){return I.test(rt)?te(rt.slice(4).toLowerCase()):rt})},me=function(Ge){return R(Ge,function(rt){return M.test(rt)?"xn--"+he(rt):rt})},ve={version:"2.1.0",ucs2:{decode:q,encode:Q},decode:te,encode:he,toASCII:me,toUnicode:Ce},be={};function ae(tt){var Ge=tt.charCodeAt(0),rt=void 0;return Ge<16?rt="%0"+Ge.toString(16).toUpperCase():Ge<128?rt="%"+Ge.toString(16).toUpperCase():Ge<2048?rt="%"+(Ge>>6|192).toString(16).toUpperCase()+"%"+(Ge&63|128).toString(16).toUpperCase():rt="%"+(Ge>>12|224).toString(16).toUpperCase()+"%"+(Ge>>6&63|128).toString(16).toUpperCase()+"%"+(Ge&63|128).toString(16).toUpperCase(),rt}function pe(tt){for(var Ge="",rt=0,ht=tt.length;rt<ht;){var gt=parseInt(tt.substr(rt+1,2),16);if(gt<128)Ge+=String.fromCharCode(gt),rt+=3;else if(gt>=194&&gt<224){if(ht-rt>=6){var zt=parseInt(tt.substr(rt+4,2),16);Ge+=String.fromCharCode((gt&31)<<6|zt&63)}else Ge+=tt.substr(rt,6);rt+=6}else if(gt>=224){if(ht-rt>=9){var pr=parseInt(tt.substr(rt+4,2),16),Mr=parseInt(tt.substr(rt+7,2),16);Ge+=String.fromCharCode((gt&15)<<12|(pr&63)<<6|Mr&63)}else Ge+=tt.substr(rt,9);rt+=9}else Ge+=tt.substr(rt,3),rt+=3}return Ge}function Ee(tt,Ge){function rt(ht){var gt=pe(ht);return gt.match(Ge.UNRESERVED)?gt:ht}return tt.scheme&&(tt.scheme=String(tt.scheme).replace(Ge.PCT_ENCODED,rt).toLowerCase().replace(Ge.NOT_SCHEME,"")),tt.userinfo!==void 0&&(tt.userinfo=String(tt.userinfo).replace(Ge.PCT_ENCODED,rt).replace(Ge.NOT_USERINFO,ae).replace(Ge.PCT_ENCODED,i)),tt.host!==void 0&&(tt.host=String(tt.host).replace(Ge.PCT_ENCODED,rt).toLowerCase().replace(Ge.NOT_HOST,ae).replace(Ge.PCT_ENCODED,i)),tt.path!==void 0&&(tt.path=String(tt.path).replace(Ge.PCT_ENCODED,rt).replace(tt.scheme?Ge.NOT_PATH:Ge.NOT_PATH_NOSCHEME,ae).replace(Ge.PCT_ENCODED,i)),tt.query!==void 0&&(tt.query=String(tt.query).replace(Ge.PCT_ENCODED,rt).replace(Ge.NOT_QUERY,ae).replace(Ge.PCT_ENCODED,i)),tt.fragment!==void 0&&(tt.fragment=String(tt.fragment).replace(Ge.PCT_ENCODED,rt).replace(Ge.NOT_FRAGMENT,ae).replace(Ge.PCT_ENCODED,i)),tt}function Z(tt){return tt.replace(/^0*(.*)/,"$1")||"0"}function ce(tt,Ge){var rt=tt.match(Ge.IPV4ADDRESS)||[],ht=d(rt,2),gt=ht[1];return gt?gt.split(".").map(Z).join("."):tt}function z(tt,Ge){var rt=tt.match(Ge.IPV6ADDRESS)||[],ht=d(rt,3),gt=ht[1],zt=ht[2];if(gt){for(var pr=gt.toLowerCase().split("::").reverse(),Mr=d(pr,2),un=Mr[0],ei=Mr[1],zn=ei?ei.split(":").map(Z):[],Ni=un.split(":").map(Z),Oi=Ge.IPV4ADDRESS.test(Ni[Ni.length-1]),Cn=Oi?7:8,hi=Ni.length-Cn,So=Array(Cn),Xi=0;Xi<Cn;++Xi)So[Xi]=zn[Xi]||Ni[hi+Xi]||"";Oi&&(So[Cn-1]=ce(So[Cn-1],Ge));var ml=So.reduce(function(Lo,Ai,Yu){if(!Ai||Ai==="0"){var Yl=Lo[Lo.length-1];Yl&&Yl.index+Yl.length===Yu?Yl.length++:Lo.push({index:Yu,length:1})}return Lo},[]),ma=ml.sort(function(Lo,Ai){return Ai.length-Lo.length})[0],gl=void 0;if(ma&&ma.length>1){var Zi=So.slice(0,ma.index),Dl=So.slice(ma.index+ma.length);gl=Zi.join(":")+"::"+Dl.join(":")}else gl=So.join(":");return zt&&(gl+="%"+zt),gl}else return tt}var ne=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ue="".match(/(){0}/)[1]===void 0;function X(tt){var Ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},rt={},ht=Ge.iri!==!1?u:c;Ge.reference==="suffix"&&(tt=(Ge.scheme?Ge.scheme+":":"")+"//"+tt);var gt=tt.match(ne);if(gt){ue?(rt.scheme=gt[1],rt.userinfo=gt[3],rt.host=gt[4],rt.port=parseInt(gt[5],10),rt.path=gt[6]||"",rt.query=gt[7],rt.fragment=gt[8],isNaN(rt.port)&&(rt.port=gt[5])):(rt.scheme=gt[1]||void 0,rt.userinfo=tt.indexOf("@")!==-1?gt[3]:void 0,rt.host=tt.indexOf("//")!==-1?gt[4]:void 0,rt.port=parseInt(gt[5],10),rt.path=gt[6]||"",rt.query=tt.indexOf("?")!==-1?gt[7]:void 0,rt.fragment=tt.indexOf("#")!==-1?gt[8]:void 0,isNaN(rt.port)&&(rt.port=tt.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?gt[4]:void 0)),rt.host&&(rt.host=z(ce(rt.host,ht),ht)),rt.scheme===void 0&&rt.userinfo===void 0&&rt.host===void 0&&rt.port===void 0&&!rt.path&&rt.query===void 0?rt.reference="same-document":rt.scheme===void 0?rt.reference="relative":rt.fragment===void 0?rt.reference="absolute":rt.reference="uri",Ge.reference&&Ge.reference!=="suffix"&&Ge.reference!==rt.reference&&(rt.error=rt.error||"URI is not a "+Ge.reference+" reference.");var zt=be[(Ge.scheme||rt.scheme||"").toLowerCase()];if(!Ge.unicodeSupport&&(!zt||!zt.unicodeSupport)){if(rt.host&&(Ge.domainHost||zt&&zt.domainHost))try{rt.host=ve.toASCII(rt.host.replace(ht.PCT_ENCODED,pe).toLowerCase())}catch(pr){rt.error=rt.error||"Host's domain name can not be converted to ASCII via punycode: "+pr}Ee(rt,c)}else Ee(rt,ht);zt&&zt.parse&&zt.parse(rt,Ge)}else rt.error=rt.error||"URI can not be parsed.";return rt}function W(tt,Ge){var rt=Ge.iri!==!1?u:c,ht=[];return tt.userinfo!==void 0&&(ht.push(tt.userinfo),ht.push("@")),tt.host!==void 0&&ht.push(z(ce(String(tt.host),rt),rt).replace(rt.IPV6ADDRESS,function(gt,zt,pr){return"["+zt+(pr?"%25"+pr:"")+"]"})),(typeof tt.port=="number"||typeof tt.port=="string")&&(ht.push(":"),ht.push(String(tt.port))),ht.length?ht.join(""):void 0}var Y=/^\.\.?\//,ye=/^\/\.(\/|$)/,Ae=/^\/\.\.(\/|$)/,j=/^\/?(?:.|\n)*?(?=\/|$)/;function xe(tt){for(var Ge=[];tt.length;)if(tt.match(Y))tt=tt.replace(Y,"");else if(tt.match(ye))tt=tt.replace(ye,"/");else if(tt.match(Ae))tt=tt.replace(Ae,"/"),Ge.pop();else if(tt==="."||tt==="..")tt="";else{var rt=tt.match(j);if(rt){var ht=rt[0];tt=tt.slice(ht.length),Ge.push(ht)}else throw new Error("Unexpected dot segment condition")}return Ge.join("")}function Be(tt){var Ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},rt=Ge.iri?u:c,ht=[],gt=be[(Ge.scheme||tt.scheme||"").toLowerCase()];if(gt&&gt.serialize&&gt.serialize(tt,Ge),tt.host&&!rt.IPV6ADDRESS.test(tt.host)){if(Ge.domainHost||gt&&gt.domainHost)try{tt.host=Ge.iri?ve.toUnicode(tt.host):ve.toASCII(tt.host.replace(rt.PCT_ENCODED,pe).toLowerCase())}catch(Mr){tt.error=tt.error||"Host's domain name can not be converted to "+(Ge.iri?"Unicode":"ASCII")+" via punycode: "+Mr}}Ee(tt,rt),Ge.reference!=="suffix"&&tt.scheme&&(ht.push(tt.scheme),ht.push(":"));var zt=W(tt,Ge);if(zt!==void 0&&(Ge.reference!=="suffix"&&ht.push("//"),ht.push(zt),tt.path&&tt.path.charAt(0)!=="/"&&ht.push("/")),tt.path!==void 0){var pr=tt.path;!Ge.absolutePath&&(!gt||!gt.absolutePath)&&(pr=xe(pr)),zt===void 0&&(pr=pr.replace(/^\/\//,"/%2F")),ht.push(pr)}return tt.query!==void 0&&(ht.push("?"),ht.push(tt.query)),tt.fragment!==void 0&&(ht.push("#"),ht.push(tt.fragment)),ht.join("")}function Oe(tt,Ge){var rt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ht=arguments[3],gt={};return ht||(tt=X(Be(tt,rt),rt),Ge=X(Be(Ge,rt),rt)),rt=rt||{},!rt.tolerant&&Ge.scheme?(gt.scheme=Ge.scheme,gt.userinfo=Ge.userinfo,gt.host=Ge.host,gt.port=Ge.port,gt.path=xe(Ge.path||""),gt.query=Ge.query):(Ge.userinfo!==void 0||Ge.host!==void 0||Ge.port!==void 0?(gt.userinfo=Ge.userinfo,gt.host=Ge.host,gt.port=Ge.port,gt.path=xe(Ge.path||""),gt.query=Ge.query):(Ge.path?(Ge.path.charAt(0)==="/"?gt.path=xe(Ge.path):((tt.userinfo!==void 0||tt.host!==void 0||tt.port!==void 0)&&!tt.path?gt.path="/"+Ge.path:tt.path?gt.path=tt.path.slice(0,tt.path.lastIndexOf("/")+1)+Ge.path:gt.path=Ge.path,gt.path=xe(gt.path)),gt.query=Ge.query):(gt.path=tt.path,Ge.query!==void 0?gt.query=Ge.query:gt.query=tt.query),gt.userinfo=tt.userinfo,gt.host=tt.host,gt.port=tt.port),gt.scheme=tt.scheme),gt.fragment=Ge.fragment,gt}function Me(tt,Ge,rt){var ht=s({scheme:"null"},rt);return Be(Oe(X(tt,ht),X(Ge,ht),ht,!0),ht)}function re(tt,Ge){return typeof tt=="string"?tt=Be(X(tt,Ge),Ge):n(tt)==="object"&&(tt=X(Be(tt,Ge),Ge)),tt}function Ie(tt,Ge,rt){return typeof tt=="string"?tt=Be(X(tt,rt),rt):n(tt)==="object"&&(tt=Be(tt,rt)),typeof Ge=="string"?Ge=Be(X(Ge,rt),rt):n(Ge)==="object"&&(Ge=Be(Ge,rt)),tt===Ge}function De(tt,Ge){return tt&&tt.toString().replace(!Ge||!Ge.iri?c.ESCAPE:u.ESCAPE,ae)}function Re(tt,Ge){return tt&&tt.toString().replace(!Ge||!Ge.iri?c.PCT_ENCODED:u.PCT_ENCODED,pe)}var He={scheme:"http",domainHost:!0,parse:function(Ge,rt){return Ge.host||(Ge.error=Ge.error||"HTTP URIs must have a host."),Ge},serialize:function(Ge,rt){var ht=String(Ge.scheme).toLowerCase()==="https";return(Ge.port===(ht?443:80)||Ge.port==="")&&(Ge.port=void 0),Ge.path||(Ge.path="/"),Ge}},Ve={scheme:"https",domainHost:He.domainHost,parse:He.parse,serialize:He.serialize};function et(tt){return typeof tt.secure=="boolean"?tt.secure:String(tt.scheme).toLowerCase()==="wss"}var lt={scheme:"ws",domainHost:!0,parse:function(Ge,rt){var ht=Ge;return ht.secure=et(ht),ht.resourceName=(ht.path||"/")+(ht.query?"?"+ht.query:""),ht.path=void 0,ht.query=void 0,ht},serialize:function(Ge,rt){if((Ge.port===(et(Ge)?443:80)||Ge.port==="")&&(Ge.port=void 0),typeof Ge.secure=="boolean"&&(Ge.scheme=Ge.secure?"wss":"ws",Ge.secure=void 0),Ge.resourceName){var ht=Ge.resourceName.split("?"),gt=d(ht,2),zt=gt[0],pr=gt[1];Ge.path=zt&&zt!=="/"?zt:void 0,Ge.query=pr,Ge.resourceName=void 0}return Ge.fragment=void 0,Ge}},pt={scheme:"wss",domainHost:lt.domainHost,parse:lt.parse,serialize:lt.serialize},jt={},mr=!0,Er="[A-Za-z0-9\\-\\.\\_\\~"+(mr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",hr="[0-9A-Fa-f]",St=r(r("%[EFef]"+hr+"%"+hr+hr+"%"+hr+hr)+"|"+r("%[89A-Fa-f]"+hr+"%"+hr+hr)+"|"+r("%"+hr+hr)),br="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Kt="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Ft=e(Kt,'[\\"\\\\]'),Yt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",or=new RegExp(Er,"g"),sr=new RegExp(St,"g"),mn=new RegExp(e("[^]",br,"[\\.]",'[\\"]',Ft),"g"),kr=new RegExp(e("[^]",Er,Yt),"g"),Wr=kr;function Nr(tt){var Ge=pe(tt);return Ge.match(or)?Ge:tt}var Xn={scheme:"mailto",parse:function(Ge,rt){var ht=Ge,gt=ht.to=ht.path?ht.path.split(","):[];if(ht.path=void 0,ht.query){for(var zt=!1,pr={},Mr=ht.query.split("&"),un=0,ei=Mr.length;un<ei;++un){var zn=Mr[un].split("=");switch(zn[0]){case"to":for(var Ni=zn[1].split(","),Oi=0,Cn=Ni.length;Oi<Cn;++Oi)gt.push(Ni[Oi]);break;case"subject":ht.subject=Re(zn[1],rt);break;case"body":ht.body=Re(zn[1],rt);break;default:zt=!0,pr[Re(zn[0],rt)]=Re(zn[1],rt);break}}zt&&(ht.headers=pr)}ht.query=void 0;for(var hi=0,So=gt.length;hi<So;++hi){var Xi=gt[hi].split("@");if(Xi[0]=Re(Xi[0]),rt.unicodeSupport)Xi[1]=Re(Xi[1],rt).toLowerCase();else try{Xi[1]=ve.toASCII(Re(Xi[1],rt).toLowerCase())}catch(ml){ht.error=ht.error||"Email address's domain name can not be converted to ASCII via punycode: "+ml}gt[hi]=Xi.join("@")}return ht},serialize:function(Ge,rt){var ht=Ge,gt=o(Ge.to);if(gt){for(var zt=0,pr=gt.length;zt<pr;++zt){var Mr=String(gt[zt]),un=Mr.lastIndexOf("@"),ei=Mr.slice(0,un).replace(sr,Nr).replace(sr,i).replace(mn,ae),zn=Mr.slice(un+1);try{zn=rt.iri?ve.toUnicode(zn):ve.toASCII(Re(zn,rt).toLowerCase())}catch(hi){ht.error=ht.error||"Email address's domain name can not be converted to "+(rt.iri?"Unicode":"ASCII")+" via punycode: "+hi}gt[zt]=ei+"@"+zn}ht.path=gt.join(",")}var Ni=Ge.headers=Ge.headers||{};Ge.subject&&(Ni.subject=Ge.subject),Ge.body&&(Ni.body=Ge.body);var Oi=[];for(var Cn in Ni)Ni[Cn]!==jt[Cn]&&Oi.push(Cn.replace(sr,Nr).replace(sr,i).replace(kr,ae)+"="+Ni[Cn].replace(sr,Nr).replace(sr,i).replace(Wr,ae));return Oi.length&&(ht.query=Oi.join("&")),ht}},Zn=/^([^\:]+)\:(.*)/,vn={scheme:"urn",parse:function(Ge,rt){var ht=Ge.path&&Ge.path.match(Zn),gt=Ge;if(ht){var zt=rt.scheme||gt.scheme||"urn",pr=ht[1].toLowerCase(),Mr=ht[2],un=zt+":"+(rt.nid||pr),ei=be[un];gt.nid=pr,gt.nss=Mr,gt.path=void 0,ei&&(gt=ei.parse(gt,rt))}else gt.error=gt.error||"URN can not be parsed.";return gt},serialize:function(Ge,rt){var ht=rt.scheme||Ge.scheme||"urn",gt=Ge.nid,zt=ht+":"+(rt.nid||gt),pr=be[zt];pr&&(Ge=pr.serialize(Ge,rt));var Mr=Ge,un=Ge.nss;return Mr.path=(gt||rt.nid)+":"+un,Mr}},Ki=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,wi={scheme:"urn:uuid",parse:function(Ge,rt){var ht=Ge;return ht.uuid=ht.nss,ht.nss=void 0,!rt.tolerant&&(!ht.uuid||!ht.uuid.match(Ki))&&(ht.error=ht.error||"UUID is not valid."),ht},serialize:function(Ge,rt){var ht=Ge;return ht.nss=(Ge.uuid||"").toLowerCase(),ht}};be[He.scheme]=He,be[Ve.scheme]=Ve,be[lt.scheme]=lt,be[pt.scheme]=pt,be[Xn.scheme]=Xn,be[vn.scheme]=vn,be[wi.scheme]=wi,t.SCHEMES=be,t.pctEncChar=ae,t.pctDecChars=pe,t.parse=X,t.removeDotSegments=xe,t.serialize=Be,t.resolveComponents=Oe,t.resolve=Me,t.normalize=re,t.equal=Ie,t.escapeComponent=De,t.unescapeComponent=Re,Object.defineProperty(t,"__esModule",{value:!0})}))});var WF=D((Txo,IIt)=>{"use strict";IIt.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 RIt=D((Ixo,DIt)=>{"use strict";DIt.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 HT=D((Dxo,OIt)=>{"use strict";OIt.exports={copy:dwn,checkDataType:mke,checkDataTypes:fwn,coerceToTypes:pwn,toHash:Ake,getProperty:yke,escapeQuotes:Eke,equal:WF(),ucs2length:RIt(),varOccurences:gwn,varReplace:Awn,schemaHasRules:ywn,schemaHasRulesExcept:Ewn,schemaUnknownRules:vwn,toQuotedString:gke,getPathExpr:Cwn,getPath:bwn,getData:Swn,unescapeFragment:_wn,unescapeJsonPointer:Cke,escapeFragment:Twn,escapeJsonPointer:vke};function dwn(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function mke(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 fwn(t,e,r){switch(t.length){case 1:return mke(t[0],e,r,!0);default:var n="",i=Ake(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?" && ":"")+mke(o,e,r,!0);return n}}var BIt=Ake(["string","number","integer","boolean","null"]);function pwn(t,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var i=e[n];(BIt[i]||t==="array"&&i==="array")&&(r[r.length]=i)}if(r.length)return r}else{if(BIt[e])return[e];if(t==="array"&&e==="array")return["array"]}}function Ake(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var hwn=/^[a-z$_][a-z$_0-9]*$/i,mwn=/'|\\/g;function yke(t){return typeof t=="number"?"["+t+"]":hwn.test(t)?"."+t:"['"+Eke(t)+"']"}function Eke(t){return t.replace(mwn,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function gwn(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function Awn(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function ywn(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function Ewn(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var n in t)if(n!=r&&e[n])return!0}function vwn(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function gke(t){return"'"+Eke(t)+"'"}function Cwn(t,e,r,n){var i=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return NIt(t,i)}function bwn(t,e,r){var n=gke(r?"/"+vke(e):yke(e));return NIt(t,n)}var wwn=/^\/(?:[^~]|~0|~1)*$/,xwn=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Swn(t,e,r){var n,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!wwn.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(xwn),!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 d=c[u];d&&(o+=yke(Cke(d)),a+=" && "+o)}return a}function NIt(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function _wn(t){return Cke(decodeURIComponent(t))}function Twn(t){return encodeURIComponent(vke(t))}function vke(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Cke(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var bke=D((Rxo,kIt)=>{"use strict";var Iwn=HT();kIt.exports=Dwn;function Dwn(t){Iwn.copy(t,this)}});var FIt=D((Bxo,MIt)=>{"use strict";var E7=MIt.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(){};nfe(e,n,i,t,"",t)};E7.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};E7.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};E7.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};E7.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 nfe(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 d in n){var f=n[d];if(Array.isArray(f)){if(d in E7.arrayKeywords)for(var p=0;p<f.length;p++)nfe(t,e,r,f[p],i+"/"+d+"/"+p,o,i,d,n,p)}else if(d in E7.propsKeywords){if(f&&typeof f=="object")for(var h in f)nfe(t,e,r,f[h],i+"/"+d+"/"+Rwn(h),o,i,d,n,h)}else(d in E7.keywords||t.allKeys&&!(d in E7.skipKeywords))&&nfe(t,e,r,f,i+"/"+d,o,i,d,n)}r(n,i,o,s,a,c,u)}}function Rwn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var cfe=D((Nxo,QIt)=>{"use strict";var fz=TIt(),PIt=WF(),afe=HT(),ife=bke(),Bwn=FIt();QIt.exports=C7;C7.normalizeId=v7;C7.fullPath=ofe;C7.url=sfe;C7.ids=Fwn;C7.inlineRef=wke;C7.schema=lfe;function C7(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return C7.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof ife)return wke(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var i=lfe.call(this,e,r),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof ife?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=wke(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function lfe(t,e){var r=fz.parse(e),n=UIt(r),i=ofe(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==i){var o=v7(n),s=this._refs[o];if(typeof s=="string")return Nwn.call(this,t,s,r);if(s instanceof ife)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof ife){if(s.validate||this._compile(s),o==v7(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=ofe(this._getId(t.schema))}return LIt.call(this,r,i,t.schema,t)}function Nwn(t,e,r){var n=lfe.call(this,t,e);if(n){var i=n.schema,o=n.baseId;t=n.root;var s=this._getId(i);return s&&(o=sfe(o,s)),LIt.call(this,r,o,i,t)}}var Own=afe.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function LIt(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=afe.unescapeFragment(s),r=r[s],r===void 0)break;var a;if(!Own[s]&&(a=this._getId(r),a&&(e=sfe(e,a)),r.$ref)){var c=sfe(e,r.$ref),u=lfe.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 kwn=afe.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function wke(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return xke(t);if(e)return Ske(t)<=e}function xke(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!xke(e))return!1}else for(var n in t)if(n=="$ref"||(e=t[n],typeof e=="object"&&!xke(e)))return!1;return!0}function Ske(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+=Ske(r)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(kwn[i])e++;else if(r=t[i],typeof r=="object"&&(e+=Ske(r)+1),e==1/0)return 1/0}return e}function ofe(t,e){e!==!1&&(t=v7(t));var r=fz.parse(t);return UIt(r)}function UIt(t){return fz.serialize(t).split("#")[0]+"#"}var Mwn=/#\/?$/;function v7(t){return t?t.replace(Mwn,""):""}function sfe(t,e){return e=v7(e),fz.resolve(t,e)}function Fwn(t){var e=v7(this._getId(t)),r={"":e},n={"":ofe(e,!1)},i={},o=this;return Bwn(t,{allKeys:!0},function(s,a,c,u,d,f,p){if(a!==""){var h=o._getId(s),m=r[u],g=n[u]+"/"+d;if(p!==void 0&&(g+="/"+(typeof p=="number"?p:afe.escapeFragment(p))),typeof h=="string"){h=m=v7(m?fz.resolve(m,h):h);var A=o._refs[h];if(typeof A=="string"&&(A=o._refs[A]),A&&A.schema){if(!PIt(s,A.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=v7(g))if(h[0]=="#"){if(i[h]&&!PIt(s,i[h]))throw new Error('id "'+h+'" resolves to more than one schema');i[h]=s}else o._refs[h]=g}r[a]=m,n[a]=g}}),i}});var ufe=D((Oxo,HIt)=>{"use strict";var _ke=cfe();HIt.exports={Validation:qIt(Pwn),MissingRef:qIt(Tke)};function Pwn(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}Tke.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function Tke(t,e,r){this.message=r||Tke.message(t,e),this.missingRef=_ke.url(t,e),this.missingSchema=_ke.normalizeId(_ke.fullPath(this.missingRef))}function qIt(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var Ike=D((kxo,GIt)=>{"use strict";GIt.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]},d={key:c,value:s[c]};return o(u,d)}}})(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,d=Object.keys(s).sort(n&&n(s));for(c="",a=0;a<d.length;a++){var f=d[a],p=o(s[f]);p&&(c&&(c+=","),c+=JSON.stringify(f)+":"+p)}return i.splice(u,1),"{"+c+"}"}})(t)}});var Dke=D((Mxo,VIt)=>{"use strict";VIt.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",d=e.level,f=e.dataLevel,p=e.schema[r],h=e.schemaPath+e.util.getProperty(r),m=e.errSchemaPath+"/"+r,I=!e.opts.allErrors,U,g="data"+(f||""),w="valid"+d;if(e.schema===!1){e.isTop?I=!0:i+=" var "+w+" = false; ";var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(U||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'boolean schema is false' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&I?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++; "}else e.isTop?o?i+=" return data; ":i+=" validate.errors = null; return true; ":i+=" var "+w+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var v=e.isTop,d=e.level=0,f=e.dataLevel=0,g="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 b="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{var d=e.level,f=e.dataLevel,g="data"+(f||"");if(a&&(e.baseId=e.resolve.url(e.baseId,a)),o&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+d+" = errors;"}var w="valid"+d,I=!e.opts.allErrors,M="",N="",U,S=e.schema.type,F=Array.isArray(S);if(S&&e.opts.nullable&&e.schema.nullable===!0&&(F?S.indexOf("null")==-1&&(S=S.concat("null")):S!="null"&&(S=[S,"null"],F=!0)),F&&S.length==1&&(S=S[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")),S){if(e.opts.coerceTypes)var B=e.util.coerceToTypes(e.opts.coerceTypes,S);var L=e.RULES.types[S];if(B||F||L===!0||L&&!j(L)){var h=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=e.schemaPath+".type",m=e.errSchemaPath+"/type",P=F?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[P](S,g,e.opts.strictNumbers,!0)+") { ",B){var R="dataType"+d,q="coerced"+d;i+=" var "+R+" = typeof "+g+"; var "+q+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+R+" == 'object' && Array.isArray("+g+") && "+g+".length == 1) { "+g+" = "+g+"[0]; "+R+" = typeof "+g+"; if ("+e.util.checkDataType(e.schema.type,g,e.opts.strictNumbers)+") "+q+" = "+g+"; } "),i+=" if ("+q+" !== undefined) ; ";var Q=B;if(Q)for(var $,G=-1,K=Q.length-1;G<K;)$=Q[G+=1],$=="string"?i+=" else if ("+R+" == 'number' || "+R+" == 'boolean') "+q+" = '' + "+g+"; else if ("+g+" === null) "+q+" = ''; ":$=="number"||$=="integer"?(i+=" else if ("+R+" == 'boolean' || "+g+" === null || ("+R+" == 'string' && "+g+" && "+g+" == +"+g+" ",$=="integer"&&(i+=" && !("+g+" % 1)"),i+=")) "+q+" = +"+g+"; "):$=="boolean"?i+=" else if ("+g+" === 'false' || "+g+" === 0 || "+g+" === null) "+q+" = false; else if ("+g+" === 'true' || "+g+" === 1) "+q+" = true; ":$=="null"?i+=" else if ("+g+" === '' || "+g+" === 0 || "+g+" === false) "+q+" = null; ":e.opts.coerceTypes=="array"&&$=="array"&&(i+=" else if ("+R+" == 'string' || "+R+" == 'number' || "+R+" == 'boolean' || "+g+" == null) "+q+" = ["+g+"]; ");i+=" else { ";var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",F?i+=""+S.join(","):i+=""+S,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?i+=""+S.join(","):i+=""+S,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&I?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+=" } if ("+q+" !== undefined) { ";var te=f?"data"+(f-1||""):"parentData",he=f?e.dataPathArr[f]:"parentDataProperty";i+=" "+g+" = "+q+"; ",f||(i+="if ("+te+" !== undefined)"),i+=" "+te+"["+he+"] = "+q+"; } "}else{var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",F?i+=""+S.join(","):i+=""+S,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?i+=""+S.join(","):i+=""+S,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&I?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+=" } "}}if(e.schema.$ref&&!s)i+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",I&&(i+=" } if (errors === ",v?i+="0":i+="errs_"+d,i+=") { ",N+="}");else{var Ce=e.RULES;if(Ce){for(var L,me=-1,ve=Ce.length-1;me<ve;)if(L=Ce[me+=1],j(L)){if(L.type&&(i+=" if ("+e.util.checkDataType(L.type,g,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(L.type=="object"&&e.schema.properties){var p=e.schema.properties,be=Object.keys(p),ae=be;if(ae)for(var pe,Ee=-1,Z=ae.length-1;Ee<Z;){pe=ae[Ee+=1];var ce=p[pe];if(ce.default!==void 0){var z=g+e.util.getProperty(pe);if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+z;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else i+=" if ("+z+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+z+" === null || "+z+" === '' "),i+=" ) "+z+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(ce.default)+" ":i+=" "+JSON.stringify(ce.default)+" ",i+="; "}}}else if(L.type=="array"&&Array.isArray(e.schema.items)){var ne=e.schema.items;if(ne){for(var ce,G=-1,ue=ne.length-1;G<ue;)if(ce=ne[G+=1],ce.default!==void 0){var z=g+"["+G+"]";if(e.compositeRule){if(e.opts.strictDefaults){var b="default is ignored for: "+z;if(e.opts.strictDefaults==="log")e.logger.warn(b);else throw new Error(b)}}else i+=" if ("+z+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+z+" === null || "+z+" === '' "),i+=" ) "+z+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(ce.default)+" ":i+=" "+JSON.stringify(ce.default)+" ",i+="; "}}}}var X=L.rules;if(X){for(var W,Y=-1,ye=X.length-1;Y<ye;)if(W=X[Y+=1],xe(W)){var Ae=W.code(e,W.keyword,L.type);Ae&&(i+=" "+Ae+" ",I&&(M+="}"))}}if(I&&(i+=" "+M+" ",M=""),L.type&&(i+=" } ",S&&S===L.type&&!B)){i+=" else { ";var h=e.schemaPath+".type",m=e.errSchemaPath+"/type",A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",F?i+=""+S.join(","):i+=""+S,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?i+=""+S.join(","):i+=""+S,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&I?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+=" } "}I&&(i+=" if (errors === ",v?i+="0":i+="errs_"+d,i+=") { ",N+="}")}}}I&&(i+=" "+N+" "),v?(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 "+w+" = errors === errs_"+d+";";function j(Oe){for(var Me=Oe.rules,re=0;re<Me.length;re++)if(xe(Me[re]))return!0}function xe(Oe){return e.schema[Oe.keyword]!==void 0||Oe.implements&&Be(Oe)}function Be(Oe){for(var Me=Oe.implements,re=0;re<Me.length;re++)if(e.schema[Me[re]]!==void 0)return!0}return i}});var zIt=D((Fxo,YIt)=>{"use strict";var dfe=cfe(),pfe=HT(),WIt=ufe(),Lwn=Ike(),$It=Dke(),Uwn=pfe.ucs2length,Qwn=WF(),qwn=WIt.Validation;YIt.exports=Rke;function Rke(t,e,r,n){var i=this,o=this._opts,s=[void 0],a={},c=[],u={},d=[],f={},p=[];e=e||{schema:t,refVal:s,refs:a};var h=Hwn.call(this,t,e,n),m=this._compilations[h.index];if(h.compiling)return m.callValidate=b;var g=this._formats,A=this.RULES;try{var y=w(t,e,r,n);m.validate=y;var v=m.callValidate;return v&&(v.schema=y.schema,v.errors=null,v.refs=y.refs,v.refVal=y.refVal,v.root=y.root,v.$async=y.$async,o.sourceCode&&(v.source=y.source)),y}finally{Gwn.call(this,t,e,n)}function b(){var P=m.validate,R=P.apply(this,arguments);return b.errors=P.errors,R}function w(P,R,q,Q){var $=!R||R&&R.schema==P;if(R.schema!=e.schema)return Rke.call(i,P,R,q,Q);var G=P.$async===!0,K=$It({isTop:!0,schema:P,isRoot:$,baseId:Q,root:R,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:WIt.MissingRef,RULES:A,validate:$It,util:pfe,resolve:dfe,resolveRef:I,usePattern:F,useDefault:B,useCustomRule:L,opts:o,formats:g,logger:i.logger,self:i});K=ffe(s,Wwn)+ffe(c,Vwn)+ffe(d,$wn)+ffe(p,jwn)+K,o.processCode&&(K=o.processCode(K,P));var te;try{var he=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",K);te=he(i,A,g,e,s,d,p,Qwn,Uwn,qwn),s[0]=te}catch(Ce){throw i.logger.error("Error compiling schema, function code:",K),Ce}return te.schema=P,te.errors=null,te.refs=a,te.refVal=s,te.root=$?te:R,G&&(te.$async=!0),o.sourceCode===!0&&(te.source={code:K,patterns:c,defaults:d}),te}function I(P,R,q){R=dfe.url(P,R);var Q=a[R],$,G;if(Q!==void 0)return $=s[Q],G="refVal["+Q+"]",S($,G);if(!q&&e.refs){var K=e.refs[R];if(K!==void 0)return $=e.refVal[K],G=M(R,$),S($,G)}G=M(R);var te=dfe.call(i,w,e,R);if(te===void 0){var he=r&&r[R];he&&(te=dfe.inlineRef(he,o.inlineRefs)?he:Rke.call(i,he,e,r,P))}if(te===void 0)N(R);else return U(R,te),S(te,G)}function M(P,R){var q=s.length;return s[q]=R,a[P]=q,"refVal"+q}function N(P){delete a[P]}function U(P,R){var q=a[P];s[q]=R}function S(P,R){return typeof P=="object"||typeof P=="boolean"?{code:R,schema:P,inline:!0}:{code:R,$async:P&&!!P.$async}}function F(P){var R=u[P];return R===void 0&&(R=u[P]=c.length,c[R]=P),"pattern"+R}function B(P){switch(typeof P){case"boolean":case"number":return""+P;case"string":return pfe.toQuotedString(P);case"object":if(P===null)return"null";var R=Lwn(P),q=f[R];return q===void 0&&(q=f[R]=d.length,d[q]=P),"default"+q}}function L(P,R,q,Q){if(i._opts.validateSchema!==!1){var $=P.definition.dependencies;if($&&!$.every(function(ae){return Object.prototype.hasOwnProperty.call(q,ae)}))throw new Error("parent schema must have all required keywords: "+$.join(","));var G=P.definition.validateSchema;if(G){var K=G(R);if(!K){var te="keyword schema is invalid: "+i.errorsText(G.errors);if(i._opts.validateSchema=="log")i.logger.error(te);else throw new Error(te)}}}var he=P.definition.compile,Ce=P.definition.inline,me=P.definition.macro,ve;if(he)ve=he.call(i,R,q,Q);else if(me)ve=me.call(i,R,q,Q),o.validateSchema!==!1&&i.validateSchema(ve,!0);else if(Ce)ve=Ce.call(i,Q,P.keyword,R,q);else if(ve=P.definition.validate,!ve)return;if(ve===void 0)throw new Error('custom keyword "'+P.keyword+'"failed to compile');var be=p.length;return p[be]=ve,{code:"customRule"+be,validate:ve}}}function Hwn(t,e,r){var n=jIt.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 Gwn(t,e,r){var n=jIt.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function jIt(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 Vwn(t,e){return"var pattern"+t+" = new RegExp("+pfe.toQuotedString(e[t])+");"}function $wn(t){return"var default"+t+" = defaults["+t+"];"}function Wwn(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function jwn(t){return"var customRule"+t+" = customRules["+t+"];"}function ffe(t,e){if(!t.length)return"";for(var r="",n=0;n<t.length;n++)r+=e(n,t);return r}});var KIt=D((Pxo,JIt)=>{"use strict";var hfe=JIt.exports=function(){this._cache={}};hfe.prototype.put=function(e,r){this._cache[e]=r};hfe.prototype.get=function(e){return this._cache[e]};hfe.prototype.del=function(e){delete this._cache[e]};hfe.prototype.clear=function(){this._cache={}}});var cDt=D((Lxo,lDt)=>{"use strict";var Ywn=HT(),zwn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Jwn=[0,31,28,31,30,31,30,31,31,30,31,30,31],Kwn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,XIt=/^(?=.{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,Xwn=/^(?:[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,Zwn=/^(?:[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,ZIt=/^(?:(?:[^\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,eDt=/^(?:(?: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,tDt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,rDt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,nDt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,iDt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;lDt.exports=mfe;function mfe(t){return t=t=="full"?"full":"fast",Ywn.copy(mfe[t])}mfe.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":ZIt,url:eDt,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:XIt,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:aDt,uuid:tDt,"json-pointer":rDt,"json-pointer-uri-fragment":nDt,"relative-json-pointer":iDt};mfe.full={date:oDt,time:sDt,"date-time":rxn,uri:ixn,"uri-reference":Zwn,"uri-template":ZIt,url:eDt,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:XIt,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:aDt,uuid:tDt,"json-pointer":rDt,"json-pointer-uri-fragment":nDt,"relative-json-pointer":iDt};function exn(t){return t%4===0&&(t%100!==0||t%400===0)}function oDt(t){var e=t.match(zwn);if(!e)return!1;var r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&exn(r)?29:Jwn[n])}function sDt(t,e){var r=t.match(Kwn);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 txn=/t|\s/i;function rxn(t){var e=t.split(txn);return e.length==2&&oDt(e[0])&&sDt(e[1],!0)}var nxn=/\/|:/;function ixn(t){return nxn.test(t)&&Xwn.test(t)}var oxn=/[^\\]\\Z/;function aDt(t){if(oxn.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var dDt=D((Uxo,uDt)=>{"use strict";uDt.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,d="data"+(s||""),f="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 m=e.resolveRef(e.baseId,a,e.isRoot);if(m===void 0){var g=e.MissingRefError.message(e.baseId,a);if(e.opts.missingRefs=="fail"){e.logger.error(g);var A=A||[];A.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: "+d+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&u?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++; ",u&&(i+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(g),u&&(i+=" if (true) { ");else throw new e.MissingRefError(e.baseId,a,g)}else if(m.inline){var v=e.util.copy(e);v.level++;var b="valid"+v.level;v.schema=m.schema,v.schemaPath="",v.errSchemaPath=a;var w=e.validate(v).replace(/validate\.schema/g,m.code);i+=" "+w+" ",u&&(i+=" if ("+b+") { ")}else p=m.$async===!0||e.async&&m.$async!==!1,h=m.code}if(h){var A=A||[];A.push(i),i="",e.opts.passContext?i+=" "+h+".call(this, ":i+=" "+h+"( ",i+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var I=s?"data"+(s-1||""):"parentData",M=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+I+" , "+M+", rootData) ";var N=i;if(i=A.pop(),p){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+f+"; "),i+=" try { await "+N+"; ",u&&(i+=" "+f+" = 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+=" "+f+" = false; "),i+=" } ",u&&(i+=" if ("+f+") { ")}else i+=" if (!"+N+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var pDt=D((Qxo,fDt)=>{"use strict";fDt.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),d="";u.level++;var f="valid"+u.level,p=u.baseId,h=!0,m=o;if(m)for(var g,A=-1,y=m.length-1;A<y;)g=m[A+=1],(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all))&&(h=!1,u.schema=g,u.schemaPath=s+"["+A+"]",u.errSchemaPath=a+"/"+A,i+=" "+e.validate(u)+" ",u.baseId=p,c&&(i+=" if ("+f+") { ",d+="}"));return c&&(h?i+=" if (true) { ":i+=" "+d.slice(0,-1)+" "),i}});var mDt=D((qxo,hDt)=>{"use strict";hDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),g="";m.level++;var A="valid"+m.level,y=a.every(function(U){return e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)});if(y){var v=m.baseId;i+=" var "+h+" = errors; var "+p+" = false; ";var b=e.compositeRule;e.compositeRule=m.compositeRule=!0;var w=a;if(w)for(var I,M=-1,N=w.length-1;M<N;)I=w[M+=1],m.schema=I,m.schemaPath=c+"["+M+"]",m.errSchemaPath=u+"/"+M,i+=" "+e.validate(m)+" ",m.baseId=v,i+=" "+p+" = "+p+" || "+A+"; if (!"+p+") { ",g+="}";e.compositeRule=m.compositeRule=b,i+=" "+g+" 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: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(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 d&&(i+=" if (true) { ");return i}});var ADt=D((Hxo,gDt)=>{"use strict";gDt.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 EDt=D((Gxo,yDt)=>{"use strict";yDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,h||(i+=" var schema"+o+" = validate.schema"+c+";"),i+="var "+p+" = equal("+f+", schema"+o+"); if (!"+p+") { ";var g=g||[];g.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: "+f+" "),i+=" } "):i+=" {} ";var A=i;return i=g.pop(),!e.compositeRule&&d?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+=" }",d&&(i+=" else { "),i}});var CDt=D((Vxo,vDt)=>{"use strict";vDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),g="";m.level++;var A="valid"+m.level,y="i"+o,v=m.dataLevel=e.dataLevel+1,b="data"+v,w=e.baseId,I=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+";",I){var M=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" var "+A+" = false; for (var "+y+" = 0; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var N=f+"["+y+"]";m.dataPathArr[v]=y;var U=e.validate(m);m.baseId=w,e.util.varOccurences(U,b)<2?i+=" "+e.util.varReplace(U,b,N)+" ":i+=" var "+b+" = "+N+"; "+U+" ",i+=" if ("+A+") break; } ",e.compositeRule=m.compositeRule=M,i+=" "+g+" if (!"+A+") {"}else i+=" if ("+f+".length == 0) {";var S=S||[];S.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: "+f+" "),i+=" } "):i+=" {} ";var F=i;return i=S.pop(),!e.compositeRule&&d?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 { ",I&&(i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var wDt=D(($xo,bDt)=>{"use strict";bDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var g="valid"+h.level,A={},y={},v=e.opts.ownProperties;for(M in a)if(M!="__proto__"){var b=a[M],w=Array.isArray(b)?y:A;w[M]=b}i+="var "+p+" = errors;";var I=e.errorPath;i+="var missing"+o+";";for(var M in y)if(w=y[M],w.length){if(i+=" if ( "+f+e.util.getProperty(M)+" !== undefined ",v&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),d){i+=" && ( ";var N=w;if(N)for(var U,S=-1,F=N.length-1;S<F;){U=N[S+=1],S&&(i+=" || ");var B=e.util.getProperty(U),L=f+B;i+=" ( ( "+L+" === undefined ",v&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(U)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?U:B)+") ) "}i+=")) { ";var P="missing"+o,R="' + "+P+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,P,!0):I+" + "+P);var q=q||[];q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(M)+"', missingProperty: '"+R+"', depsCount: "+w.length+", deps: '"+e.util.escapeQuotes(w.length==1?w[0]:w.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",w.length==1?i+="property "+e.util.escapeQuotes(w[0]):i+="properties "+e.util.escapeQuotes(w.join(", ")),i+=" when property "+e.util.escapeQuotes(M)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var Q=i;i=q.pop(),!e.compositeRule&&d?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++; "}else{i+=" ) { ";var $=w;if($)for(var U,G=-1,K=$.length-1;G<K;){U=$[G+=1];var B=e.util.getProperty(U),R=e.util.escapeQuotes(U),L=f+B;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,U,e.opts.jsonPointers)),i+=" if ( "+L+" === undefined ",v&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(U)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(M)+"', missingProperty: '"+R+"', depsCount: "+w.length+", deps: '"+e.util.escapeQuotes(w.length==1?w[0]:w.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",w.length==1?i+="property "+e.util.escapeQuotes(w[0]):i+="properties "+e.util.escapeQuotes(w.join(", ")),i+=" when property "+e.util.escapeQuotes(M)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}i+=" } ",d&&(m+="}",i+=" else { ")}e.errorPath=I;var te=h.baseId;for(var M in A){var b=A[M];(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(i+=" "+g+" = true; if ( "+f+e.util.getProperty(M)+" !== undefined ",v&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),i+=") { ",h.schema=b,h.schemaPath=c+e.util.getProperty(M),h.errSchemaPath=u+"/"+e.util.escapeFragment(M),i+=" "+e.validate(h)+" ",h.baseId=te,i+=" } ",d&&(i+=" if ("+g+") { ",m+="}"))}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var SDt=D((Wxo,xDt)=>{"use strict";xDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var g="i"+o,A="schema"+o;h||(i+=" var "+A+" = 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 "+g+"=0; "+g+"<"+A+".length; "+g+"++) if (equal("+f+", "+A+"["+g+"])) { "+p+" = true; break; }",h&&(i+=" } "),i+=" if (!"+p+") { ";var y=y||[];y.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: "+f+" "),i+=" } "):i+=" {} ";var v=i;return i=y.pop(),!e.compositeRule&&d?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+=" }",d&&(i+=" else { "),i}});var TDt=D((jxo,_Dt)=>{"use strict";_Dt.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,d=!e.opts.allErrors,f="data"+(s||"");if(e.opts.format===!1)return d&&(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 m=e.opts.unknownFormats,g=Array.isArray(m);if(p){var A="format"+o,y="isObject"+o,v="formatType"+o;i+=" var "+A+" = formats["+h+"]; var "+y+" = typeof "+A+" == 'object' && !("+A+" instanceof RegExp) && "+A+".validate; var "+v+" = "+y+" && "+A+".type || 'string'; if ("+y+") { ",e.async&&(i+=" var async"+o+" = "+A+".async; "),i+=" "+A+" = "+A+".validate; } if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" (",m!="ignore"&&(i+=" ("+h+" && !"+A+" ",g&&(i+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),i+=") || "),i+=" ("+A+" && "+v+" == '"+n+"' && !(typeof "+A+" == 'function' ? ",e.async?i+=" (async"+o+" ? await "+A+"("+f+") : "+A+"("+f+")) ":i+=" "+A+"("+f+") ",i+=" : "+A+".test("+f+"))))) {"}else{var A=e.formats[a];if(!A){if(m=="ignore")return e.logger.warn('unknown format "'+a+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(i+=" if (true) { "),i;if(g&&m.indexOf(a)>=0)return d&&(i+=" if (true) { "),i;throw new Error('unknown format "'+a+'" is used in schema at path "'+e.errSchemaPath+'"')}var y=typeof A=="object"&&!(A instanceof RegExp)&&A.validate,v=y&&A.type||"string";if(y){var b=A.async===!0;A=A.validate}if(v!=n)return d&&(i+=" if (true) { "),i;if(b){if(!e.async)throw new Error("async format in sync schema");var w="formats"+e.util.getProperty(a)+".validate";i+=" if (!(await "+w+"("+f+"))) { "}else{i+=" if (! ";var w="formats"+e.util.getProperty(a);y&&(w+=".validate"),typeof A=="function"?i+=" "+w+"("+f+") ":i+=" "+w+".test("+f+") ",i+=") { "}}var I=I||[];I.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: "+f+" "),i+=" } "):i+=" {} ";var M=i;return i=I.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+M+"]); ":i+=" validate.errors = ["+M+"]; return false; ":i+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { "),i}});var DDt=D((Yxo,IDt)=>{"use strict";IDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e);m.level++;var g="valid"+m.level,A=e.schema.then,y=e.schema.else,v=A!==void 0&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all)),b=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),w=m.baseId;if(v||b){var I;m.createErrors=!1,m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" var "+h+" = errors; var "+p+" = true; ";var M=e.compositeRule;e.compositeRule=m.compositeRule=!0,i+=" "+e.validate(m)+" ",m.baseId=w,m.createErrors=!0,i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=M,v?(i+=" if ("+g+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",i+=" "+e.validate(m)+" ",m.baseId=w,i+=" "+p+" = "+g+"; ",v&&b?(I="ifClause"+o,i+=" var "+I+" = 'then'; "):I="'then'",i+=" } ",b&&(i+=" else { ")):i+=" if (!"+g+") { ",b&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",i+=" "+e.validate(m)+" ",m.baseId=w,i+=" "+p+" = "+g+"; ",v&&b?(I="ifClause"+o,i+=" var "+I+" = 'else'; "):I="'else'",i+=" } "),i+=" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+I+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+I+` + '" schema' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",d&&(i+=" else { ")}else d&&(i+=" if (true) { ");return i}});var BDt=D((zxo,RDt)=>{"use strict";RDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),g="";m.level++;var A="valid"+m.level,y="i"+o,v=m.dataLevel=e.dataLevel+1,b="data"+v,w=e.baseId;if(i+="var "+h+" = errors;var "+p+";",Array.isArray(a)){var I=e.schema.additionalItems;if(I===!1){i+=" "+p+" = "+f+".length <= "+a.length+"; ";var M=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+p+") { ";var N=N||[];N.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: "+f+" "),i+=" } "):i+=" {} ";var U=i;i=N.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+U+"]); ":i+=" validate.errors = ["+U+"]; return false; ":i+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u=M,d&&(g+="}",i+=" else { ")}var S=a;if(S){for(var F,B=-1,L=S.length-1;B<L;)if(F=S[B+=1],e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all)){i+=" "+A+" = true; if ("+f+".length > "+B+") { ";var P=f+"["+B+"]";m.schema=F,m.schemaPath=c+"["+B+"]",m.errSchemaPath=u+"/"+B,m.errorPath=e.util.getPathExpr(e.errorPath,B,e.opts.jsonPointers,!0),m.dataPathArr[v]=B;var R=e.validate(m);m.baseId=w,e.util.varOccurences(R,b)<2?i+=" "+e.util.varReplace(R,b,P)+" ":i+=" var "+b+" = "+P+"; "+R+" ",i+=" } ",d&&(i+=" if ("+A+") { ",g+="}")}}if(typeof I=="object"&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))){m.schema=I,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+A+" = true; if ("+f+".length > "+a.length+") { for (var "+y+" = "+a.length+"; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var P=f+"["+y+"]";m.dataPathArr[v]=y;var R=e.validate(m);m.baseId=w,e.util.varOccurences(R,b)<2?i+=" "+e.util.varReplace(R,b,P)+" ":i+=" var "+b+" = "+P+"; "+R+" ",d&&(i+=" if (!"+A+") break; "),i+=" } } ",d&&(i+=" if ("+A+") { ",g+="}")}}else if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" for (var "+y+" = 0; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var P=f+"["+y+"]";m.dataPathArr[v]=y;var R=e.validate(m);m.baseId=w,e.util.varOccurences(R,b)<2?i+=" "+e.util.varReplace(R,b,P)+" ":i+=" var "+b+" = "+P+"; "+R+" ",d&&(i+=" if (!"+A+") break; "),i+=" }"}return d&&(i+=" "+g+" if ("+h+" == errors) {"),i}});var Bke=D((Jxo,NDt)=>{"use strict";NDt.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,d=!e.opts.allErrors,w,f="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 m=r=="maximum",g=m?"exclusiveMaximum":"exclusiveMinimum",A=e.schema[g],y=e.opts.$data&&A&&A.$data,v=m?"<":">",b=m?">":"<",w=void 0;if(!(p||typeof a=="number"||a===void 0))throw new Error(r+" must be number");if(!(y||A===void 0||typeof A=="number"||typeof A=="boolean"))throw new Error(g+" must be number or boolean");if(y){var I=e.util.getData(A.$data,s,e.dataPathArr),M="exclusive"+o,N="exclType"+o,U="exclIsNumber"+o,S="op"+o,F="' + "+S+" + '";i+=" var schemaExcl"+o+" = "+I+"; ",I="schemaExcl"+o,i+=" var "+M+"; var "+N+" = typeof "+I+"; if ("+N+" != 'boolean' && "+N+" != 'undefined' && "+N+" != 'number') { ";var w=g,B=B||[];B.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(w||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+g+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var L=i;i=B.pop(),!e.compositeRule&&d?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 if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+N+" == 'number' ? ( ("+M+" = "+h+" === undefined || "+I+" "+v+"= "+h+") ? "+f+" "+b+"= "+I+" : "+f+" "+b+" "+h+" ) : ( ("+M+" = "+I+" === true) ? "+f+" "+b+"= "+h+" : "+f+" "+b+" "+h+" ) || "+f+" !== "+f+") { var op"+o+" = "+M+" ? '"+v+"' : '"+v+"='; ",a===void 0&&(w=g,u=e.errSchemaPath+"/"+g,h=I,p=y)}else{var U=typeof A=="number",F=v;if(U&&p){var S="'"+F+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" ( "+h+" === undefined || "+A+" "+v+"= "+h+" ? "+f+" "+b+"= "+A+" : "+f+" "+b+" "+h+" ) || "+f+" !== "+f+") { "}else{U&&a===void 0?(M=!0,w=g,u=e.errSchemaPath+"/"+g,h=A,b+="="):(U&&(h=Math[m?"min":"max"](A,a)),A===(U?h:!0)?(M=!0,w=g,u=e.errSchemaPath+"/"+g,b+="="):(M=!1,F+="="));var S="'"+F+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+f+" "+b+" "+h+" || "+f+" !== "+f+") { "}}w=w||r;var B=B||[];B.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(w||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+S+", limit: "+h+", exclusive: "+M+" } ",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: "+f+" "),i+=" } "):i+=" {} ";var L=i;return i=B.pop(),!e.compositeRule&&d?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+=" } ",d&&(i+=" else { "),i}});var Nke=D((Kxo,ODt)=>{"use strict";ODt.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,d=!e.opts.allErrors,g,f="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 m=r=="maxItems"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+f+".length "+m+" "+h+") { ";var g=r,A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(g||"_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: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&d?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+="} ",d&&(i+=" else { "),i}});var Oke=D((Xxo,kDt)=>{"use strict";kDt.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,d=!e.opts.allErrors,g,f="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 m=r=="maxLength"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),e.opts.unicode===!1?i+=" "+f+".length ":i+=" ucs2length("+f+") ",i+=" "+m+" "+h+") { ";var g=r,A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(g||"_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: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&d?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+="} ",d&&(i+=" else { "),i}});var kke=D((Zxo,MDt)=>{"use strict";MDt.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,d=!e.opts.allErrors,g,f="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 m=r=="maxProperties"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" Object.keys("+f+").length "+m+" "+h+") { ";var g=r,A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(g||"_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: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&d?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+="} ",d&&(i+=" else { "),i}});var PDt=D((eSo,FDt)=>{"use strict";FDt.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,d=!e.opts.allErrors,f="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+" = "+f+" / "+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 m=m||[];m.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: "+f+" "),i+=" } "):i+=" {} ";var g=i;return i=m.pop(),!e.compositeRule&&d?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++; ",i+="} ",d&&(i+=" else { "),i}});var UDt=D((tSo,LDt)=>{"use strict";LDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e);h.level++;var m="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 g=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1;var A;h.opts.allErrors&&(A=h.opts.allErrors,h.opts.allErrors=!1),i+=" "+e.validate(h)+" ",h.createErrors=!0,A&&(h.opts.allErrors=A),e.compositeRule=h.compositeRule=g,i+=" if ("+m+") { ";var y=y||[];y.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: "+f+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&d?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+=" } 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: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(i+=" if (false) { ");return i}});var qDt=D((rSo,QDt)=>{"use strict";QDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),g="";m.level++;var A="valid"+m.level,y=m.baseId,v="prevValid"+o,b="passingSchemas"+o;i+="var "+h+" = errors , "+v+" = false , "+p+" = false , "+b+" = null; ";var w=e.compositeRule;e.compositeRule=m.compositeRule=!0;var I=a;if(I)for(var M,N=-1,U=I.length-1;N<U;)M=I[N+=1],(e.opts.strictKeywords?typeof M=="object"&&Object.keys(M).length>0||M===!1:e.util.schemaHasRules(M,e.RULES.all))?(m.schema=M,m.schemaPath=c+"["+N+"]",m.errSchemaPath=u+"/"+N,i+=" "+e.validate(m)+" ",m.baseId=y):i+=" var "+A+" = true; ",N&&(i+=" if ("+A+" && "+v+") { "+p+" = false; "+b+" = ["+b+", "+N+"]; } else { ",g+="}"),i+=" if ("+A+") { "+p+" = "+v+" = true; "+b+" = "+N+"; }";return e.compositeRule=m.compositeRule=w,i+=""+g+"if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+b+" } ",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: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(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 GDt=D((nSo,HDt)=>{"use strict";HDt.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,d=!e.opts.allErrors,f="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 m=p?"(new RegExp("+h+"))":e.usePattern(a);i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" !"+m+".test("+f+") ) { ";var g=g||[];g.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: "+f+" "),i+=" } "):i+=" {} ";var A=i;return i=g.pop(),!e.compositeRule&&d?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+="} ",d&&(i+=" else { "),i}});var $Dt=D((iSo,VDt)=>{"use strict";VDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var g="valid"+h.level,A="key"+o,y="idx"+o,v=h.dataLevel=e.dataLevel+1,b="data"+v,w="dataProperties"+o,I=Object.keys(a||{}).filter(G),M=e.schema.patternProperties||{},N=Object.keys(M).filter(G),U=e.schema.additionalProperties,S=I.length||N.length,F=U===!1,B=typeof U=="object"&&Object.keys(U).length,L=e.opts.removeAdditional,P=F||B||L,R=e.opts.ownProperties,q=e.baseId,Q=e.schema.required;if(Q&&!(e.opts.$data&&Q.$data)&&Q.length<e.opts.loopRequired)var $=e.util.toHash(Q);function G(Re){return Re!=="__proto__"}if(i+="var "+p+" = errors;var "+g+" = true;",R&&(i+=" var "+w+" = undefined;"),P){if(R?i+=" "+w+" = "+w+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+w+".length; "+y+"++) { var "+A+" = "+w+"["+y+"]; ":i+=" for (var "+A+" in "+f+") { ",S){if(i+=" var isAdditional"+o+" = !(false ",I.length)if(I.length>8)i+=" || validate.schema"+c+".hasOwnProperty("+A+") ";else{var K=I;if(K)for(var te,he=-1,Ce=K.length-1;he<Ce;)te=K[he+=1],i+=" || "+A+" == "+e.util.toQuotedString(te)+" "}if(N.length){var me=N;if(me)for(var ve,be=-1,ae=me.length-1;be<ae;)ve=me[be+=1],i+=" || "+e.usePattern(ve)+".test("+A+") "}i+=" ); if (isAdditional"+o+") { "}if(L=="all")i+=" delete "+f+"["+A+"]; ";else{var pe=e.errorPath,Ee="' + "+A+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,A,e.opts.jsonPointers)),F)if(L)i+=" delete "+f+"["+A+"]; ";else{i+=" "+g+" = false; ";var Z=u;u=e.errSchemaPath+"/additionalProperties";var ce=ce||[];ce.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+Ee+"' } ",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: "+f+" "),i+=" } "):i+=" {} ";var z=i;i=ce.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+z+"]); ":i+=" validate.errors = ["+z+"]; return false; ":i+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=Z,d&&(i+=" break; ")}else if(B)if(L=="failing"){i+=" var "+p+" = errors; ";var ne=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=U,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,A,e.opts.jsonPointers);var ue=f+"["+A+"]";h.dataPathArr[v]=A;var X=e.validate(h);h.baseId=q,e.util.varOccurences(X,b)<2?i+=" "+e.util.varReplace(X,b,ue)+" ":i+=" var "+b+" = "+ue+"; "+X+" ",i+=" if (!"+g+") { errors = "+p+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+A+"]; } ",e.compositeRule=h.compositeRule=ne}else{h.schema=U,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,A,e.opts.jsonPointers);var ue=f+"["+A+"]";h.dataPathArr[v]=A;var X=e.validate(h);h.baseId=q,e.util.varOccurences(X,b)<2?i+=" "+e.util.varReplace(X,b,ue)+" ":i+=" var "+b+" = "+ue+"; "+X+" ",d&&(i+=" if (!"+g+") break; ")}e.errorPath=pe}S&&(i+=" } "),i+=" } ",d&&(i+=" if ("+g+") { ",m+="}")}var W=e.opts.useDefaults&&!e.compositeRule;if(I.length){var Y=I;if(Y)for(var te,ye=-1,Ae=Y.length-1;ye<Ae;){te=Y[ye+=1];var j=a[te];if(e.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:e.util.schemaHasRules(j,e.RULES.all)){var xe=e.util.getProperty(te),ue=f+xe,Be=W&&j.default!==void 0;h.schema=j,h.schemaPath=c+xe,h.errSchemaPath=u+"/"+e.util.escapeFragment(te),h.errorPath=e.util.getPath(e.errorPath,te,e.opts.jsonPointers),h.dataPathArr[v]=e.util.toQuotedString(te);var X=e.validate(h);if(h.baseId=q,e.util.varOccurences(X,b)<2){X=e.util.varReplace(X,b,ue);var Oe=ue}else{var Oe=b;i+=" var "+b+" = "+ue+"; "}if(Be)i+=" "+X+" ";else{if($&&$[te]){i+=" if ( "+Oe+" === undefined ",R&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(te)+"') "),i+=") { "+g+" = false; ";var pe=e.errorPath,Z=u,Me=e.util.escapeQuotes(te);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(pe,te,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var ce=ce||[];ce.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+Me+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+Me+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var z=i;i=ce.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+z+"]); ":i+=" validate.errors = ["+z+"]; return false; ":i+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=Z,e.errorPath=pe,i+=" } else { "}else d?(i+=" if ( "+Oe+" === undefined ",R&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(te)+"') "),i+=") { "+g+" = true; } else { "):(i+=" if ("+Oe+" !== undefined ",R&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(te)+"') "),i+=" ) { ");i+=" "+X+" } "}}d&&(i+=" if ("+g+") { ",m+="}")}}if(N.length){var re=N;if(re)for(var ve,Ie=-1,De=re.length-1;Ie<De;){ve=re[Ie+=1];var j=M[ve];if(e.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:e.util.schemaHasRules(j,e.RULES.all)){h.schema=j,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ve),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ve),R?i+=" "+w+" = "+w+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+w+".length; "+y+"++) { var "+A+" = "+w+"["+y+"]; ":i+=" for (var "+A+" in "+f+") { ",i+=" if ("+e.usePattern(ve)+".test("+A+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,A,e.opts.jsonPointers);var ue=f+"["+A+"]";h.dataPathArr[v]=A;var X=e.validate(h);h.baseId=q,e.util.varOccurences(X,b)<2?i+=" "+e.util.varReplace(X,b,ue)+" ":i+=" var "+b+" = "+ue+"; "+X+" ",d&&(i+=" if (!"+g+") break; "),i+=" } ",d&&(i+=" else "+g+" = true; "),i+=" } ",d&&(i+=" if ("+g+") { ",m+="}")}}}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var jDt=D((oSo,WDt)=>{"use strict";WDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var g="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 A="key"+o,y="idx"+o,v="i"+o,b="' + "+A+" + '",w=h.dataLevel=e.dataLevel+1,I="data"+w,M="dataProperties"+o,N=e.opts.ownProperties,U=e.baseId;N&&(i+=" var "+M+" = undefined; "),N?i+=" "+M+" = "+M+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+M+".length; "+y+"++) { var "+A+" = "+M+"["+y+"]; ":i+=" for (var "+A+" in "+f+") { ",i+=" var startErrs"+o+" = errors; ";var S=A,F=e.compositeRule;e.compositeRule=h.compositeRule=!0;var B=e.validate(h);h.baseId=U,e.util.varOccurences(B,I)<2?i+=" "+e.util.varReplace(B,I,S)+" ":i+=" var "+I+" = "+S+"; "+B+" ",e.compositeRule=h.compositeRule=F,i+=" if (!"+g+") { for (var "+v+"=startErrs"+o+"; "+v+"<errors; "+v+"++) { vErrors["+v+"].propertyName = "+A+"; } var err = ",e.createErrors!==!1?(i+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+b+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+b+"\\' is invalid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),d&&(i+=" break; "),i+=" } }"}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var zDt=D((sSo,YDt)=>{"use strict";YDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var g="schema"+o;if(!h)if(a.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var A=[],y=a;if(y)for(var v,b=-1,w=y.length-1;b<w;){v=y[b+=1];var I=e.schema.properties[v];I&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))||(A[A.length]=v)}}else var A=a;if(h||A.length){var M=e.errorPath,N=h||A.length>=e.opts.loopRequired,U=e.opts.ownProperties;if(d)if(i+=" var missing"+o+"; ",N){h||(i+=" var "+g+" = validate.schema"+c+"; ");var S="i"+o,F="schema"+o+"["+S+"]",B="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(M,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 "+S+" = 0; "+S+" < "+g+".length; "+S+"++) { "+p+" = "+f+"["+g+"["+S+"]] !== undefined ",U&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", "+g+"["+S+"]) "),i+="; if (!"+p+") break; } ",h&&(i+=" } "),i+=" if (!"+p+") { ";var L=L||[];L.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var P=i;i=L.pop(),!e.compositeRule&&d?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+=" } else { "}else{i+=" if ( ";var R=A;if(R)for(var q,S=-1,Q=R.length-1;S<Q;){q=R[S+=1],S&&(i+=" || ");var $=e.util.getProperty(q),G=f+$;i+=" ( ( "+G+" === undefined ",U&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:$)+") ) "}i+=") { ";var F="missing"+o,B="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(M,F,!0):M+" + "+F);var L=L||[];L.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var P=i;i=L.pop(),!e.compositeRule&&d?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+=" } else { "}else if(N){h||(i+=" var "+g+" = validate.schema"+c+"; ");var S="i"+o,F="schema"+o+"["+S+"]",B="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(M,F,e.opts.jsonPointers)),h&&(i+=" if ("+g+" && !Array.isArray("+g+")) { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+g+" !== undefined) { "),i+=" for (var "+S+" = 0; "+S+" < "+g+".length; "+S+"++) { if ("+f+"["+g+"["+S+"]] === undefined ",U&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+g+"["+S+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(i+=" } ")}else{var K=A;if(K)for(var q,te=-1,he=K.length-1;te<he;){q=K[te+=1];var $=e.util.getProperty(q),B=e.util.escapeQuotes(q),G=f+$;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(M,q,e.opts.jsonPointers)),i+=" if ( "+G+" === undefined ",U&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=M}else d&&(i+=" if (true) {");return i}});var KDt=D((aSo,JDt)=>{"use strict";JDt.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,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,(a||h)&&e.opts.uniqueItems!==!1){h&&(i+=" var "+p+"; if ("+m+" === false || "+m+" === undefined) "+p+" = true; else if (typeof "+m+" != 'boolean') "+p+" = false; else { "),i+=" var i = "+f+".length , "+p+" = true , j; if (i > 1) { ";var g=e.schema.items&&e.schema.items.type,A=Array.isArray(g);if(!g||g=="object"||g=="array"||A&&(g.indexOf("object")>=0||g.indexOf("array")>=0))i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+p+" = false; break outer; } } } ";else{i+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var y="checkDataType"+(A?"s":"");i+=" if ("+e.util[y](g,"item",e.opts.strictNumbers,!0)+") continue; ",A&&(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 v=v||[];v.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: "+f+" "),i+=" } "):i+=" {} ";var b=i;i=v.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+b+"]); ":i+=" validate.errors = ["+b+"]; return false; ":i+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")}else d&&(i+=" if (true) { ");return i}});var ZDt=D((lSo,XDt)=>{"use strict";XDt.exports={$ref:dDt(),allOf:pDt(),anyOf:mDt(),$comment:ADt(),const:EDt(),contains:CDt(),dependencies:wDt(),enum:SDt(),format:TDt(),if:DDt(),items:BDt(),maximum:Bke(),minimum:Bke(),maxItems:Nke(),minItems:Nke(),maxLength:Oke(),minLength:Oke(),maxProperties:kke(),minProperties:kke(),multipleOf:PDt(),not:UDt(),oneOf:qDt(),pattern:GDt(),properties:$Dt(),propertyNames:jDt(),required:zDt(),uniqueItems:KDt(),validate:Dke()}});var rRt=D((cSo,tRt)=>{"use strict";var eRt=ZDt(),Mke=HT().toHash;tRt.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=Mke(r),e.types=Mke(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(d){r.push(d),e.all[d]=!0})}r.push(s);var u=e.all[s]={keyword:s,code:eRt[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:eRt.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=Mke(r.concat(n)),e.custom={},e}});var oRt=D((uSo,iRt)=>{"use strict";var nRt=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];iRt.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<nRt.length;o++){var s=nRt[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 lRt=D((dSo,aRt)=>{"use strict";var sxn=ufe().MissingRef;aRt.exports=sRt;function sRt(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)?sRt.call(n,{$ref:c},!0):Promise.resolve()}function s(a){try{return n._compile(a)}catch(u){if(u instanceof sxn)return c(u);throw u}function c(u){var d=u.missingSchema;if(h(d))throw new Error("Schema "+d+" is loaded but "+u.missingRef+" cannot be resolved");var f=n._loadingSchemas[d];return f||(f=n._loadingSchemas[d]=n._opts.loadSchema(d),f.then(p,p)),f.then(function(m){if(!h(d))return o(m).then(function(){h(d)||n.addSchema(m,d,void 0,e)})}).then(function(){return s(a)});function p(){delete n._loadingSchemas[d]}function h(m){return n._refs[m]||n._schemas[m]}}}}});var uRt=D((fSo,cRt)=>{"use strict";cRt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f,p="data"+(s||""),h="valid"+o,m="errs__"+o,g=e.opts.$data&&a&&a.$data,A;g?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",A="schema"+o):A=a;var y=this,v="definition"+o,b=y.definition,w="",I,M,N,U,S;if(g&&b.$data){S="keywordValidate"+o;var F=b.validateSchema;i+=" var "+v+" = RULES.custom['"+r+"'].definition; var "+S+" = "+v+".validate;"}else{if(U=e.useCustomRule(y,a,e.schema,e),!U)return;A="validate.schema"+c,S=U.code,I=b.compile,M=b.inline,N=b.macro}var B=S+".errors",L="i"+o,P="ruleErr"+o,R=b.async;if(R&&!e.async)throw new Error("async keyword in sync schema");if(M||N||(i+=""+B+" = null;"),i+="var "+m+" = errors;var "+h+";",g&&b.$data&&(w+="}",i+=" if ("+A+" === undefined) { "+h+" = true; } else { ",F&&(w+="}",i+=" "+h+" = "+v+".validateSchema("+A+"); if ("+h+") { ")),M)b.statements?i+=" "+U.validate+" ":i+=" "+h+" = "+U.validate+"; ";else if(N){var q=e.util.copy(e),w="";q.level++;var Q="valid"+q.level;q.schema=U.validate,q.schemaPath="";var $=e.compositeRule;e.compositeRule=q.compositeRule=!0;var G=e.validate(q).replace(/validate\.schema/g,S);e.compositeRule=q.compositeRule=$,i+=" "+G}else{var K=K||[];K.push(i),i="",i+=" "+S+".call( ",e.opts.passContext?i+="this":i+="self",I||b.schema===!1?i+=" , "+p+" ":i+=" , "+A+" , "+p+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var te=s?"data"+(s-1||""):"parentData",he=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+te+" , "+he+" , rootData ) ";var Ce=i;i=K.pop(),b.errors===!1?(i+=" "+h+" = ",R&&(i+="await "),i+=""+Ce+"; "):R?(B="customErrors"+o,i+=" var "+B+" = null; try { "+h+" = await "+Ce+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+B+" = e.errors; else throw e; } "):i+=" "+B+" = null; "+h+" = "+Ce+"; "}if(b.modifying&&(i+=" if ("+te+") "+p+" = "+te+"["+he+"];"),i+=""+w,b.valid)d&&(i+=" if (true) { ");else{i+=" if ( ",b.valid===void 0?(i+=" !",N?i+=""+Q:i+=""+h):i+=" "+!b.valid+" ",i+=") { ",f=y.keyword;var K=K||[];K.push(i),i="";var K=K||[];K.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var me=i;i=K.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+me+"]); ":i+=" validate.errors = ["+me+"]; return false; ":i+=" var err = "+me+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var ve=i;i=K.pop(),M?b.errors?b.errors!="full"&&(i+=" for (var "+L+"="+m+"; "+L+"<errors; "+L+"++) { var "+P+" = vErrors["+L+"]; if ("+P+".dataPath === undefined) "+P+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+P+".schemaPath === undefined) { "+P+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+P+".schema = "+A+"; "+P+".data = "+p+"; "),i+=" } "):b.errors===!1?i+=" "+ve+" ":(i+=" if ("+m+" == errors) { "+ve+" } else { for (var "+L+"="+m+"; "+L+"<errors; "+L+"++) { var "+P+" = vErrors["+L+"]; if ("+P+".dataPath === undefined) "+P+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+P+".schemaPath === undefined) { "+P+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+P+".schema = "+A+"; "+P+".data = "+p+"; "),i+=" } } "):N?(i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+y.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&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):b.errors===!1?i+=" "+ve+" ":(i+=" if (Array.isArray("+B+")) { if (vErrors === null) vErrors = "+B+"; else vErrors = vErrors.concat("+B+"); errors = vErrors.length; for (var "+L+"="+m+"; "+L+"<errors; "+L+"++) { var "+P+" = vErrors["+L+"]; if ("+P+".dataPath === undefined) "+P+".dataPath = (dataPath || '') + "+e.errorPath+"; "+P+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+P+".schema = "+A+"; "+P+".data = "+p+"; "),i+=" } } else { "+ve+" } "),i+=" } ",d&&(i+=" else { ")}return i}});var Fke=D((pSo,axn)=>{axn.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 pRt=D((hSo,fRt)=>{"use strict";var dRt=Fke();fRt.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:dRt.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:dRt.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 mRt=D((mSo,hRt)=>{"use strict";var lxn=/^[a-z_$][a-z0-9_$-]*$/i,cxn=uRt(),uxn=pRt();hRt.exports={add:dxn,get:fxn,remove:pxn,validate:Pke};function dxn(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!lxn.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 d,f=0;f<r.length;f++){var p=r[f];if(p.type==c){d=p;break}}d||(d={type:c,rules:[]},r.push(d));var h={keyword:a,definition:u,custom:!0,code:cxn,implements:u.implements};d.rules.push(h),r.custom[a]=h}return this}function fxn(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function pxn(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 Pke(t,e){Pke.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(uxn,!0);if(r(t))return!0;if(Pke.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var gRt=D((gSo,hxn)=>{hxn.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 _Rt=D((ASo,SRt)=>{"use strict";var yRt=zIt(),GT=cfe(),mxn=KIt(),ERt=bke(),gxn=Ike(),Axn=cDt(),yxn=rRt(),vRt=oRt(),CRt=HT();SRt.exports=Ru;Ru.prototype.validate=vxn;Ru.prototype.compile=Cxn;Ru.prototype.addSchema=bxn;Ru.prototype.addMetaSchema=wxn;Ru.prototype.validateSchema=xxn;Ru.prototype.getSchema=_xn;Ru.prototype.removeSchema=Ixn;Ru.prototype.addFormat=Fxn;Ru.prototype.errorsText=Mxn;Ru.prototype._addSchema=Dxn;Ru.prototype._compile=Rxn;Ru.prototype.compileAsync=lRt();var yfe=mRt();Ru.prototype.addKeyword=yfe.add;Ru.prototype.getKeyword=yfe.get;Ru.prototype.removeKeyword=yfe.remove;Ru.prototype.validateKeyword=yfe.validate;var bRt=ufe();Ru.ValidationError=bRt.Validation;Ru.MissingRefError=bRt.MissingRef;Ru.$dataMetaSchema=vRt;var Afe="http://json-schema.org/draft-07/schema",ARt=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Exn=["/properties"];function Ru(t){if(!(this instanceof Ru))return new Ru(t);t=this._opts=CRt.copy(t)||{},Hxn(this),this._schemas={},this._refs={},this._fragments={},this._formats=Axn(t.format),this._cache=t.cache||new mxn,this._loadingSchemas={},this._compilations=[],this.RULES=yxn(),this._getId=Bxn(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=gxn),this._metaOpts=qxn(this),t.formats&&Uxn(this),t.keywords&&Qxn(this),Pxn(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Lxn(this)}function vxn(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 Cxn(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function bxn(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=GT.normalizeId(e||o),xRt(this,e),this._schemas[e]=this._addSchema(t,r,n,!0),this}function wxn(t,e,r){return this.addSchema(t,e,r,!0),this}function xxn(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||Sxn(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 Sxn(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(Afe)?Afe:void 0,t._opts.defaultMeta}function _xn(t){var e=wRt(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Txn(this,t)}}function Txn(t,e){var r=GT.schema.call(t,{schema:{}},e);if(r){var n=r.schema,i=r.root,o=r.baseId,s=yRt.call(t,n,i,void 0,o);return t._fragments[e]=new ERt({ref:e,fragment:!0,schema:n,root:i,baseId:o,validate:s}),s}}function wRt(t,e){return e=GT.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Ixn(t){if(t instanceof RegExp)return gfe(this,this._schemas,t),gfe(this,this._refs,t),this;switch(typeof t){case"undefined":return gfe(this,this._schemas),gfe(this,this._refs),this._cache.clear(),this;case"string":var e=wRt(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=GT.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function gfe(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 Dxn(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=GT.normalizeId(this._getId(t));a&&n&&xRt(this,a);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=a&&a==GT.normalizeId(t.$schema))&&this.validateSchema(t,!0);var d=GT.ids.call(this,t),f=new ERt({id:a,schema:t,localRefs:d,cacheKey:o,meta:r});return a[0]!="#"&&n&&(this._refs[a]=f),this._cache.put(o,f),c&&u&&this.validateSchema(t,!0),f}function Rxn(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=yRt.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 Bxn(t){switch(t.schemaId){case"auto":return kxn;case"id":return Nxn;default:return Oxn}}function Nxn(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function Oxn(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function kxn(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 Mxn(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 Fxn(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function Pxn(t){var e;if(t._opts.$data&&(e=gRt(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=Fke();t._opts.$data&&(r=vRt(r,Exn)),t.addMetaSchema(r,Afe,!0),t._refs["http://json-schema.org/schema"]=Afe}}function Lxn(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 Uxn(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function Qxn(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function xRt(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function qxn(t){for(var e=CRt.copy(t._opts),r=0;r<ARt.length;r++)delete e[ARt[r]];return e}function Hxn(t){var e=t._opts.logger;if(e===!1)t.logger={log:Lke,warn:Lke,error:Lke};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 Lke(){}});var TRt,Q2,jF=le(()=>{SIt();y7();TRt=Le(_Rt(),1),Q2=class extends tfe{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 TRt.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=xIt(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:$F,capabilities:this._capabilities,clientInfo:this._clientInfo}},oke,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!sIt.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"},qT,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},hke,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},qT,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},dz,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},uz,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},ake,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},lke,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},cke,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},qT,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},qT,r)}async callTool(e,r=Zde,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 FA(MA.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new FA(MA.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof FA?s:new FA(MA.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},pke,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var NRt=D((CSo,BRt)=>{BRt.exports=RRt;RRt.sync=Vxn;var IRt=_e("fs");function Gxn(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 DRt(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Gxn(e,r)}function RRt(t,e,r){IRt.stat(t,function(n,i){r(n,n?!1:DRt(i,t,e))})}function Vxn(t,e){return DRt(IRt.statSync(t),t,e)}});var PRt=D((bSo,FRt)=>{FRt.exports=kRt;kRt.sync=$xn;var ORt=_e("fs");function kRt(t,e,r){ORt.stat(t,function(n,i){r(n,n?!1:MRt(i,e))})}function $xn(t,e){return MRt(ORt.statSync(t),e)}function MRt(t,e){return t.isFile()&&Wxn(t,e)}function Wxn(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),d=a|c,f=r&u||r&c&&i===s||r&a&&n===o||r&d&&o===0;return f}});var URt=D((xSo,LRt)=>{var wSo=_e("fs"),Efe;process.platform==="win32"||global.TESTING_WINDOWS?Efe=NRt():Efe=PRt();LRt.exports=Uke;Uke.sync=jxn;function Uke(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){Uke(t,e||{},function(o,s){o?i(o):n(s)})})}Efe(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function jxn(t,e){try{return Efe.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var WRt=D((SSo,$Rt)=>{var YF=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",QRt=_e("path"),Yxn=YF?";":":",qRt=URt(),HRt=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),GRt=(t,e)=>{let r=e.colon||Yxn,n=t.match(/\//)||YF&&t.match(/\\/)?[""]:[...YF?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=YF?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=YF?i.split(r):[""];return YF&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},VRt=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=GRt(t,e),s=[],a=u=>new Promise((d,f)=>{if(u===n.length)return e.all&&s.length?d(s):f(HRt(t));let p=n[u],h=/^".*"$/.test(p)?p.slice(1,-1):p,m=QRt.join(h,t),g=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;d(c(g,u,0))}),c=(u,d,f)=>new Promise((p,h)=>{if(f===i.length)return p(a(d+1));let m=i[f];qRt(u+m,{pathExt:o},(g,A)=>{if(!g&&A)if(e.all)s.push(u+m);else return p(u+m);return p(c(u,d,f+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},zxn=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=GRt(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=QRt.join(c,t),d=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let f=0;f<n.length;f++){let p=d+n[f];try{if(qRt.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 HRt(t)};$Rt.exports=VRt;VRt.sync=zxn});var YRt=D((_So,Qke)=>{"use strict";var jRt=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Qke.exports=jRt;Qke.exports.default=jRt});var XRt=D((TSo,KRt)=>{"use strict";var zRt=_e("path"),Jxn=WRt(),Kxn=YRt();function JRt(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=Jxn.sync(t.command,{path:r[Kxn({env:r})],pathExt:e?zRt.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=zRt.resolve(i?t.options.cwd:"",s)),s}function Xxn(t){return JRt(t)||JRt(t,!0)}KRt.exports=Xxn});var ZRt=D((ISo,Hke)=>{"use strict";var qke=/([()\][%!^"`<>&|;, *?])/g;function Zxn(t){return t=t.replace(qke,"^$1"),t}function eSn(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(qke,"^$1"),e&&(t=t.replace(qke,"^$1")),t}Hke.exports.command=Zxn;Hke.exports.argument=eSn});var tBt=D((DSo,eBt)=>{"use strict";eBt.exports=/^#!(.*)/});var nBt=D((RSo,rBt)=>{"use strict";var tSn=tBt();rBt.exports=(t="")=>{let e=t.match(tSn);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var oBt=D((BSo,iBt)=>{"use strict";var Gke=_e("fs"),rSn=nBt();function nSn(t){let r=Buffer.alloc(150),n;try{n=Gke.openSync(t,"r"),Gke.readSync(n,r,0,150,0),Gke.closeSync(n)}catch{}return rSn(r.toString())}iBt.exports=nSn});var cBt=D((NSo,lBt)=>{"use strict";var iSn=_e("path"),sBt=XRt(),aBt=ZRt(),oSn=oBt(),sSn=process.platform==="win32",aSn=/\.(?:com|exe)$/i,lSn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cSn(t){t.file=sBt(t);let e=t.file&&oSn(t.file);return e?(t.args.unshift(t.file),t.command=e,sBt(t)):t.file}function uSn(t){if(!sSn)return t;let e=cSn(t),r=!aSn.test(e);if(t.options.forceShell||r){let n=lSn.test(e);t.command=iSn.normalize(t.command),t.command=aBt.command(t.command),t.args=t.args.map(o=>aBt.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 dSn(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:uSn(n)}lBt.exports=dSn});var fBt=D((OSo,dBt)=>{"use strict";var Vke=process.platform==="win32";function $ke(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 fSn(t,e){if(!Vke)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=uBt(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function uBt(t,e){return Vke&&t===1&&!e.file?$ke(e.original,"spawn"):null}function pSn(t,e){return Vke&&t===1&&!e.file?$ke(e.original,"spawnSync"):null}dBt.exports={hookChildProcess:fSn,verifyENOENT:uBt,verifyENOENTSync:pSn,notFoundError:$ke}});var mBt=D((kSo,zF)=>{"use strict";var pBt=_e("child_process"),Wke=cBt(),jke=fBt();function hBt(t,e,r){let n=Wke(t,e,r),i=pBt.spawn(n.command,n.args,n.options);return jke.hookChildProcess(i,n),i}function hSn(t,e,r){let n=Wke(t,e,r),i=pBt.spawnSync(n.command,n.args,n.options);return i.error=i.error||jke.verifyENOENTSync(i.status,n),i}zF.exports=hBt;zF.exports.spawn=hBt;zF.exports.sync=hSn;zF.exports._parse=Wke;zF.exports._enoent=jke});function mSn(t){return A7.parse(JSON.parse(t))}function gBt(t){return JSON.stringify(t)+`
451
451
  `}var vfe,ABt=le(()=>{y7();vfe=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
452
452
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),mSn(r)}clear(){this._buffer=void 0}}});import Cfe from"node:process";import{PassThrough as gSn}from"node:stream";function ySn(){let t={};for(let e of ASn){let r=Cfe.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}function ESn(){return"type"in Cfe}var yBt,ASn,JF,Yke=le(()=>{yBt=Le(mBt(),1);ABt();ASn=Cfe.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];JF=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new vfe,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new gSn)}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,yBt.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...ySn(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:Cfe.platform==="win32"&&ESn(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var u,d;if(c.name==="AbortError"){(u=this.onclose)===null||u===void 0||u.call(this);return}r(c),(d=this.onerror)===null||d===void 0||d.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=gBt(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}}});function zke(t){}function wfe(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=zke,onError:r=zke,onRetry:n=zke,onComment:i}=t,o="",s=!0,a,c="",u="";function d(g){let A=s?g.replace(/^\xEF\xBB\xBF/,""):g,[y,v]=vSn(`${o}${A}`);for(let b of y)f(b);o=v,s=!1}function f(g){if(g===""){h();return}if(g.startsWith(":")){i&&i(g.slice(g.startsWith(": ")?2:1));return}let A=g.indexOf(":");if(A!==-1){let y=g.slice(0,A),v=g[A+1]===" "?2:1,b=g.slice(A+v);p(y,b,g);return}p(g,"",g)}function p(g,A,y){switch(g){case"event":u=A;break;case"data":c=`${c}${A}
453
453
  `;break;case"id":a=A.includes("\0")?void 0:A;break;case"retry":/^\d+$/.test(A)?n(parseInt(A,10)):r(new bfe(`Invalid \`retry\` value: "${A}"`,{type:"invalid-retry",value:A,line:y}));break;default:r(new bfe(`Unknown field "${g.length>20?`${g.slice(0,20)}\u2026`:g}"`,{type:"unknown-field",field:g,value:A,line:y}));break}}function h(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
454
454
  `)?c.slice(0,-1):c}),a=void 0,c="",u=""}function m(g={}){o&&g.consume&&f(o),s=!0,a=void 0,c="",u="",o=""}return{feed:d,reset:m}}function vSn(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
455
455
  `,n),s=-1;if(i!==-1&&o!==-1?s=Math.min(i,o):i!==-1?i===t.length-1?s=-1:s=i:o!==-1&&(s=o),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
456
- `&&n++}}return[e,r]}var bfe,Jke=le(()=>{bfe=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function CSn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Kke(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Kke).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Kke(t.cause)}`:t.message:`${t}`}function EBt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function bSn(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Sfe,CBt,oMe,os,df,Mc,PC,dg,VT,KF,xfe,_fe,mz,eP,gz,b7,XF,tP,ZF,pz,i6,Xke,Zke,eMe,vBt,tMe,rMe,hz,nMe,iMe,$T,bBt=le(()=>{Jke();Sfe=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(EBt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(EBt(this),r)}};CBt=t=>{throw TypeError(t)},oMe=(t,e,r)=>e.has(t)||CBt("Cannot "+r),os=(t,e,r)=>(oMe(t,e,"read from private field"),r?r.call(t):e.get(t)),df=(t,e,r)=>e.has(t)?CBt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Mc=(t,e,r,n)=>(oMe(t,e,"write to private field"),e.set(t,r),r),PC=(t,e,r)=>(oMe(t,e,"access private method"),r),$T=class extends EventTarget{constructor(e,r){var n,i;super(),df(this,i6),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,df(this,dg),df(this,VT),df(this,KF),df(this,xfe),df(this,_fe),df(this,mz),df(this,eP),df(this,gz,null),df(this,b7),df(this,XF),df(this,tP,null),df(this,ZF,null),df(this,pz,null),df(this,Zke,async o=>{var s;os(this,XF).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){PC(this,i6,hz).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Mc(this,KF,new URL(o.url)):Mc(this,KF,void 0),u!==200){PC(this,i6,hz).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){PC(this,i6,hz).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(os(this,dg)===this.CLOSED)return;Mc(this,dg,this.OPEN);let f=new Event("open");if((s=os(this,pz))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){PC(this,i6,hz).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:g,value:A}=await h.read();A&&os(this,XF).feed(p.decode(A,{stream:!g})),g&&(m=!1,os(this,XF).reset(),PC(this,i6,nMe).call(this))}while(m)}),df(this,eMe,o=>{Mc(this,b7,void 0),!(o.name==="AbortError"||o.type==="aborted")&&PC(this,i6,nMe).call(this,Kke(o))}),df(this,tMe,o=>{typeof o.id=="string"&&Mc(this,gz,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:os(this,KF)?os(this,KF).origin:os(this,VT).origin,lastEventId:o.id||""});os(this,ZF)&&(!o.event||o.event==="message")&&os(this,ZF).call(this,s),this.dispatchEvent(s)}),df(this,rMe,o=>{Mc(this,mz,o)}),df(this,iMe,()=>{Mc(this,eP,void 0),os(this,dg)===this.CONNECTING&&PC(this,i6,Xke).call(this)});try{if(e instanceof URL)Mc(this,VT,e);else if(typeof e=="string")Mc(this,VT,new URL(e,bSn()));else throw new Error("Invalid URL")}catch{throw CSn("An invalid or illegal string was specified")}Mc(this,XF,wfe({onEvent:os(this,tMe),onRetry:os(this,rMe)})),Mc(this,dg,this.CONNECTING),Mc(this,mz,3e3),Mc(this,_fe,(n=r?.fetch)!=null?n:globalThis.fetch),Mc(this,xfe,(i=r?.withCredentials)!=null?i:!1),PC(this,i6,Xke).call(this)}get readyState(){return os(this,dg)}get url(){return os(this,VT).href}get withCredentials(){return os(this,xfe)}get onerror(){return os(this,tP)}set onerror(e){Mc(this,tP,e)}get onmessage(){return os(this,ZF)}set onmessage(e){Mc(this,ZF,e)}get onopen(){return os(this,pz)}set onopen(e){Mc(this,pz,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){os(this,eP)&&clearTimeout(os(this,eP)),os(this,dg)!==this.CLOSED&&(os(this,b7)&&os(this,b7).abort(),Mc(this,dg,this.CLOSED),Mc(this,b7,void 0))}};dg=new WeakMap,VT=new WeakMap,KF=new WeakMap,xfe=new WeakMap,_fe=new WeakMap,mz=new WeakMap,eP=new WeakMap,gz=new WeakMap,b7=new WeakMap,XF=new WeakMap,tP=new WeakMap,ZF=new WeakMap,pz=new WeakMap,i6=new WeakSet,Xke=function(){Mc(this,dg,this.CONNECTING),Mc(this,b7,new AbortController),os(this,_fe)(os(this,VT),PC(this,i6,vBt).call(this)).then(os(this,Zke)).catch(os(this,eMe))},Zke=new WeakMap,eMe=new WeakMap,vBt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...os(this,gz)?{"Last-Event-ID":os(this,gz)}:void 0},cache:"no-store",signal:(t=os(this,b7))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},tMe=new WeakMap,rMe=new WeakMap,hz=function(t,e){var r;os(this,dg)!==this.CLOSED&&Mc(this,dg,this.CLOSED);let n=new Sfe("error",{code:e,message:t});(r=os(this,tP))==null||r.call(this,n),this.dispatchEvent(n)},nMe=function(t,e){var r;if(os(this,dg)===this.CLOSED)return;Mc(this,dg,this.CONNECTING);let n=new Sfe("error",{code:e,message:t});(r=os(this,tP))==null||r.call(this,n),this.dispatchEvent(n),Mc(this,eP,setTimeout(os(this,iMe),os(this,mz)))},iMe=new WeakMap,$T.CONNECTING=0,$T.OPEN=1,$T.CLOSED=2});async function wSn(t){return(await sMe).getRandomValues(new Uint8Array(t))}async function xSn(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await wSn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function SSn(t){return await xSn(t)}async function _Sn(t){let e=await(await sMe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function aMe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await SSn(t),r=await _Sn(e);return{code_verifier:e,code_challenge:r}}var sMe,wBt=le(()=>{sMe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Xf,xBt,lMe,TSn,SBt,cMe,_Bt,ISn,DSn,TBt,WSo,jSo,uMe=le(()=>{g7();Xf=ee.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:ee.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),ee.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),xBt=ee.object({resource:ee.string().url(),authorization_servers:ee.array(Xf).optional(),jwks_uri:ee.string().url().optional(),scopes_supported:ee.array(ee.string()).optional(),bearer_methods_supported:ee.array(ee.string()).optional(),resource_signing_alg_values_supported:ee.array(ee.string()).optional(),resource_name:ee.string().optional(),resource_documentation:ee.string().optional(),resource_policy_uri:ee.string().url().optional(),resource_tos_uri:ee.string().url().optional(),tls_client_certificate_bound_access_tokens:ee.boolean().optional(),authorization_details_types_supported:ee.array(ee.string()).optional(),dpop_signing_alg_values_supported:ee.array(ee.string()).optional(),dpop_bound_access_tokens_required:ee.boolean().optional()}).passthrough(),lMe=ee.object({issuer:ee.string(),authorization_endpoint:Xf,token_endpoint:Xf,registration_endpoint:Xf.optional(),scopes_supported:ee.array(ee.string()).optional(),response_types_supported:ee.array(ee.string()),response_modes_supported:ee.array(ee.string()).optional(),grant_types_supported:ee.array(ee.string()).optional(),token_endpoint_auth_methods_supported:ee.array(ee.string()).optional(),token_endpoint_auth_signing_alg_values_supported:ee.array(ee.string()).optional(),service_documentation:Xf.optional(),revocation_endpoint:Xf.optional(),revocation_endpoint_auth_methods_supported:ee.array(ee.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ee.array(ee.string()).optional(),introspection_endpoint:ee.string().optional(),introspection_endpoint_auth_methods_supported:ee.array(ee.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ee.array(ee.string()).optional(),code_challenge_methods_supported:ee.array(ee.string()).optional()}).passthrough(),TSn=ee.object({issuer:ee.string(),authorization_endpoint:Xf,token_endpoint:Xf,userinfo_endpoint:Xf.optional(),jwks_uri:Xf,registration_endpoint:Xf.optional(),scopes_supported:ee.array(ee.string()).optional(),response_types_supported:ee.array(ee.string()),response_modes_supported:ee.array(ee.string()).optional(),grant_types_supported:ee.array(ee.string()).optional(),acr_values_supported:ee.array(ee.string()).optional(),subject_types_supported:ee.array(ee.string()),id_token_signing_alg_values_supported:ee.array(ee.string()),id_token_encryption_alg_values_supported:ee.array(ee.string()).optional(),id_token_encryption_enc_values_supported:ee.array(ee.string()).optional(),userinfo_signing_alg_values_supported:ee.array(ee.string()).optional(),userinfo_encryption_alg_values_supported:ee.array(ee.string()).optional(),userinfo_encryption_enc_values_supported:ee.array(ee.string()).optional(),request_object_signing_alg_values_supported:ee.array(ee.string()).optional(),request_object_encryption_alg_values_supported:ee.array(ee.string()).optional(),request_object_encryption_enc_values_supported:ee.array(ee.string()).optional(),token_endpoint_auth_methods_supported:ee.array(ee.string()).optional(),token_endpoint_auth_signing_alg_values_supported:ee.array(ee.string()).optional(),display_values_supported:ee.array(ee.string()).optional(),claim_types_supported:ee.array(ee.string()).optional(),claims_supported:ee.array(ee.string()).optional(),service_documentation:ee.string().optional(),claims_locales_supported:ee.array(ee.string()).optional(),ui_locales_supported:ee.array(ee.string()).optional(),claims_parameter_supported:ee.boolean().optional(),request_parameter_supported:ee.boolean().optional(),request_uri_parameter_supported:ee.boolean().optional(),require_request_uri_registration:ee.boolean().optional(),op_policy_uri:Xf.optional(),op_tos_uri:Xf.optional()}).passthrough(),SBt=TSn.merge(lMe.pick({code_challenge_methods_supported:!0})),cMe=ee.object({access_token:ee.string(),id_token:ee.string().optional(),token_type:ee.string(),expires_in:ee.number().optional(),scope:ee.string().optional(),refresh_token:ee.string().optional()}).strip(),_Bt=ee.object({error:ee.string(),error_description:ee.string().optional(),error_uri:ee.string().optional()}),ISn=ee.object({redirect_uris:ee.array(Xf),token_endpoint_auth_method:ee.string().optional(),grant_types:ee.array(ee.string()).optional(),response_types:ee.array(ee.string()).optional(),client_name:ee.string().optional(),client_uri:Xf.optional(),logo_uri:Xf.optional(),scope:ee.string().optional(),contacts:ee.array(ee.string()).optional(),tos_uri:Xf.optional(),policy_uri:ee.string().optional(),jwks_uri:Xf.optional(),jwks:ee.any().optional(),software_id:ee.string().optional(),software_version:ee.string().optional(),software_statement:ee.string().optional()}).strip(),DSn=ee.object({client_id:ee.string(),client_secret:ee.string().optional(),client_id_issued_at:ee.number().optional(),client_secret_expires_at:ee.number().optional()}).strip(),TBt=ISn.merge(DSn),WSo=ee.object({error:ee.string(),error_description:ee.string().optional()}).strip(),jSo=ee.object({token:ee.string(),token_type_hint:ee.string().optional()}).strip()});function IBt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function DBt({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var RBt=le(()=>{});var Nd,Az,WT,jT,YT,yz,Ez,vz,LC,Cz,bz,wz,xz,Sz,_z,Tz,Iz,BBt,NBt=le(()=>{Nd=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Az=class extends Nd{};Az.errorCode="invalid_request";WT=class extends Nd{};WT.errorCode="invalid_client";jT=class extends Nd{};jT.errorCode="invalid_grant";YT=class extends Nd{};YT.errorCode="unauthorized_client";yz=class extends Nd{};yz.errorCode="unsupported_grant_type";Ez=class extends Nd{};Ez.errorCode="invalid_scope";vz=class extends Nd{};vz.errorCode="access_denied";LC=class extends Nd{};LC.errorCode="server_error";Cz=class extends Nd{};Cz.errorCode="temporarily_unavailable";bz=class extends Nd{};bz.errorCode="unsupported_response_type";wz=class extends Nd{};wz.errorCode="unsupported_token_type";xz=class extends Nd{};xz.errorCode="invalid_token";Sz=class extends Nd{};Sz.errorCode="method_not_allowed";_z=class extends Nd{};_z.errorCode="too_many_requests";Tz=class extends Nd{};Tz.errorCode="invalid_client_metadata";Iz=class extends Nd{};Iz.errorCode="insufficient_scope";BBt={[Az.errorCode]:Az,[WT.errorCode]:WT,[jT.errorCode]:jT,[YT.errorCode]:YT,[yz.errorCode]:yz,[Ez.errorCode]:Ez,[vz.errorCode]:vz,[LC.errorCode]:LC,[Cz.errorCode]:Cz,[bz.errorCode]:bz,[wz.errorCode]:wz,[xz.errorCode]:xz,[Sz.errorCode]:Sz,[_z.errorCode]:_z,[Tz.errorCode]:Tz,[Iz.errorCode]:Iz}});function kBt(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function MBt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":RSn(i,o,r);return;case"client_secret_post":BSn(i,o,n);return;case"none":NSn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function RSn(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function BSn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function NSn(t,e){e.set("client_id",t)}async function fMe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=_Bt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=BBt[i]||LC;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new LC(i)}}async function w7(t,e){var r,n;try{return await dMe(t,e)}catch(i){if(i instanceof WT||i instanceof YT)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await dMe(t,e);if(i instanceof jT)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await dMe(t,e);throw i}}async function dMe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await kSn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await OSn(e,t,s),u=await USn(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let g=await qSn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(g),d=g}if(r!==void 0){let g=await t.codeVerifier(),A=await hMe(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:g,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let g=await mMe(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof Nd)||g instanceof LC))throw g}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await QSn(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function OSn(t,e,r){let n=IBt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!DBt({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Dz(t){let e=t.headers.get("WWW-Authenticate");if(!e)return;let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;let o=/resource_metadata="([^"]*)"/.exec(e);if(o)try{return new URL(o[1])}catch{return}}async function kSn(t,e,r=fetch){let n=await PSn(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return xBt.parse(await n.json())}async function pMe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?pMe(t,void 0,r):void 0;throw n}}function MSn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function OBt(t,e,r=fetch){return await pMe(t,{"MCP-Protocol-Version":e},r)}function FSn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function PSn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:$F,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=MSn(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await OBt(c,a,r);if(!n?.metadataUrl&&FSn(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await OBt(d,a,r)}return u}function LSn(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function USn(t,{fetchFn:e=fetch,protocolVersion:r=$F}={}){var n;let i={"MCP-Protocol-Version":r},o=LSn(t);for(let{url:s,type:a}of o){let c=await pMe(s,i,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(a==="oauth")return lMe.parse(await c.json());{let u=SBt.parse(await c.json());if(!(!((n=u.code_challenge_methods_supported)===null||n===void 0)&&n.includes("S256")))throw new Error(`Incompatible OIDC provider at ${s}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function QSn(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a="code",c="S256",u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a))throw new Error(`Incompatible auth server: does not support response type ${a}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);let d=await aMe(),f=d.code_verifier,p=d.code_challenge;return u.searchParams.set("response_type",a),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",p),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(n)),o&&u.searchParams.set("state",o),i&&u.searchParams.set("scope",i),i?.includes("offline_access")&&u.searchParams.append("prompt","consent"),s&&u.searchParams.set("resource",s.href),{authorizationUrl:u,codeVerifier:f}}async function hMe(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let g=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],A=kBt(r,g);MBt(A,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await fMe(m);return cMe.parse(await m.json())}async function mMe(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=kBt(r,h);MBt(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await fMe(p);return cMe.parse({refresh_token:n,...await p.json()})}async function qSn(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await fMe(o);return TBt.parse(await o.json())}var fg,Tfe=le(()=>{wBt();y7();uMe();uMe();RBt();NBt();fg=class extends Error{constructor(e){super(e??"Unauthorized")}}});var gMe,rP,FBt=le(()=>{bBt();y7();Tfe();gMe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},rP=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new fg("No auth provider");let r;try{r=await w7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new fg;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new $T(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=Dz(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new gMe(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=A7.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new fg("No auth provider");if(await w7(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new fg("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){if(this._resourceMetadataUrl=Dz(a),await w7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new fg;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var Ife,PBt=le(()=>{Jke();Ife=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=wfe({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var HSn,Rz,x7,AMe=le(()=>{y7();Tfe();PBt();HSn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Rz=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},x7=class{constructor(e,r){var n;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:HSn}async _authThenStart(){var e;if(!this._authProvider)throw new fg("No auth provider");let r;try{r=await w7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new fg;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new Rz(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ife).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let g=A7.parse(JSON.parse(h.data));o!==void 0&&lz(g)&&(g.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,g)}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new fg("No auth provider");if(await w7(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new fg("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:jde(e)?e.id:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=Dz(f),await w7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new fg;return this.send(e)}let A=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${A}`)}if(f.status===202){AIt(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let m=(Array.isArray(e)?e:[e]).filter(A=>"method"in A&&"id"in A&&A.id!==void 0).length>0,g=f.headers.get("content-type");if(m)if(g?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(g?.includes("application/json")){let A=await f.json(),y=Array.isArray(A)?A.map(v=>A7.parse(v)):[A7.parse(A)];for(let v of y)(o=this.onmessage)===null||o===void 0||o.call(this,v)}else throw new Rz(-1,`Unexpected content type: ${g}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new Rz(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as GSn}from"node:fs/promises";var Bz,Nz,zT,yMe=le(()=>{"use strict";AM();Tfe();On();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(Bz||(Bz={}));Nz=class extends Error{code;constructor(e,r){super(r),this.code=e}},zT=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||hC.default}async start(){if(this._isClosed)throw new Error(O.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await mMe(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(O.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new Nz(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new Nz(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(O.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await hMe(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(O.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===hC.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(O.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(O.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==hC.default.OPEN)throw new Error(O.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new Nz(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:Bz.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.31-beta.3",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:Bz.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await GSn(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:Bz.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var LBt,Dfe,UBt=le(()=>{"use strict";LBt=Le(PY(),1);On();Dfe=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(O.t("mcp.auth.scopesRequired"));this.auth=new LBt.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(O.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as VSn}from"node:child_process";import{promisify as $Sn}from"node:util";import{platform as WSn}from"node:os";import{URL as jSn}from"node:url";function YSn(t){let e;try{e=new jSn(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function qBt(t){YSn(t);let e=WSn(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await QBt(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await QBt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var QBt,HBt=le(()=>{"use strict";QBt=$Sn(VSn)});function $o(t){return t instanceof Error&&"code"in t}function nr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function EMe(t){if(t&&typeof t=="object"&&"response"in t){let r=zSn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new Bfe(r.error.message);case 401:return new S7(r.error.message);case 403:return new Rfe(r.error.message);default:}}return t}function zSn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var Rfe,S7,Bfe,Fc=le(()=>{"use strict";Rfe=class extends Error{},S7=class extends Error{},Bfe=class extends Error{}});import{promises as nP}from"node:fs";import*as Nfe from"node:path";import*as GBt from"node:os";var Zf,Ofe=le(()=>{"use strict";Fc();On();Zf=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=GBt.homedir();return Nfe.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=Nfe.dirname(this.getTokenFilePath());await nP.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await nP.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(O.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:nr(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await nP.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(O.t("mcp.tokenStorage.errors.failedToSaveToken",{error:nr(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await nP.unlink(i):await nP.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(O.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:nr(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await nP.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(O.t("mcp.tokenStorage.errors.failedToClearTokens",{error:nr(e)}))}}}});var ep,kfe=le(()=>{"use strict";Fc();On();ep=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${nr(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${nr(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(O.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(O.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${nr(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(O.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(O.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as VBt from"node:http";import*as Oz from"node:crypto";import{URL as vMe}from"node:url";var q2,CMe=le(()=>{"use strict";HBt();Ofe();Fc();kfe();On();q2=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(O.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=ep.extractBaseUrl(e);return ep.discoverOAuthConfig(r)}static generatePKCEParams(){let e=Oz.randomBytes(32).toString("base64url"),r=Oz.createHash("sha256").update(e).digest("base64url"),n=Oz.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=VBt.createServer(async(o,s)=>{try{let a=new vMe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(O.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
456
+ `&&n++}}return[e,r]}var bfe,Jke=le(()=>{bfe=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function CSn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Kke(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Kke).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Kke(t.cause)}`:t.message:`${t}`}function EBt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function bSn(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Sfe,CBt,oMe,os,df,Mc,PC,dg,VT,KF,xfe,_fe,mz,eP,gz,b7,XF,tP,ZF,pz,i6,Xke,Zke,eMe,vBt,tMe,rMe,hz,nMe,iMe,$T,bBt=le(()=>{Jke();Sfe=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(EBt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(EBt(this),r)}};CBt=t=>{throw TypeError(t)},oMe=(t,e,r)=>e.has(t)||CBt("Cannot "+r),os=(t,e,r)=>(oMe(t,e,"read from private field"),r?r.call(t):e.get(t)),df=(t,e,r)=>e.has(t)?CBt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Mc=(t,e,r,n)=>(oMe(t,e,"write to private field"),e.set(t,r),r),PC=(t,e,r)=>(oMe(t,e,"access private method"),r),$T=class extends EventTarget{constructor(e,r){var n,i;super(),df(this,i6),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,df(this,dg),df(this,VT),df(this,KF),df(this,xfe),df(this,_fe),df(this,mz),df(this,eP),df(this,gz,null),df(this,b7),df(this,XF),df(this,tP,null),df(this,ZF,null),df(this,pz,null),df(this,Zke,async o=>{var s;os(this,XF).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){PC(this,i6,hz).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Mc(this,KF,new URL(o.url)):Mc(this,KF,void 0),u!==200){PC(this,i6,hz).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){PC(this,i6,hz).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(os(this,dg)===this.CLOSED)return;Mc(this,dg,this.OPEN);let f=new Event("open");if((s=os(this,pz))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){PC(this,i6,hz).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:g,value:A}=await h.read();A&&os(this,XF).feed(p.decode(A,{stream:!g})),g&&(m=!1,os(this,XF).reset(),PC(this,i6,nMe).call(this))}while(m)}),df(this,eMe,o=>{Mc(this,b7,void 0),!(o.name==="AbortError"||o.type==="aborted")&&PC(this,i6,nMe).call(this,Kke(o))}),df(this,tMe,o=>{typeof o.id=="string"&&Mc(this,gz,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:os(this,KF)?os(this,KF).origin:os(this,VT).origin,lastEventId:o.id||""});os(this,ZF)&&(!o.event||o.event==="message")&&os(this,ZF).call(this,s),this.dispatchEvent(s)}),df(this,rMe,o=>{Mc(this,mz,o)}),df(this,iMe,()=>{Mc(this,eP,void 0),os(this,dg)===this.CONNECTING&&PC(this,i6,Xke).call(this)});try{if(e instanceof URL)Mc(this,VT,e);else if(typeof e=="string")Mc(this,VT,new URL(e,bSn()));else throw new Error("Invalid URL")}catch{throw CSn("An invalid or illegal string was specified")}Mc(this,XF,wfe({onEvent:os(this,tMe),onRetry:os(this,rMe)})),Mc(this,dg,this.CONNECTING),Mc(this,mz,3e3),Mc(this,_fe,(n=r?.fetch)!=null?n:globalThis.fetch),Mc(this,xfe,(i=r?.withCredentials)!=null?i:!1),PC(this,i6,Xke).call(this)}get readyState(){return os(this,dg)}get url(){return os(this,VT).href}get withCredentials(){return os(this,xfe)}get onerror(){return os(this,tP)}set onerror(e){Mc(this,tP,e)}get onmessage(){return os(this,ZF)}set onmessage(e){Mc(this,ZF,e)}get onopen(){return os(this,pz)}set onopen(e){Mc(this,pz,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){os(this,eP)&&clearTimeout(os(this,eP)),os(this,dg)!==this.CLOSED&&(os(this,b7)&&os(this,b7).abort(),Mc(this,dg,this.CLOSED),Mc(this,b7,void 0))}};dg=new WeakMap,VT=new WeakMap,KF=new WeakMap,xfe=new WeakMap,_fe=new WeakMap,mz=new WeakMap,eP=new WeakMap,gz=new WeakMap,b7=new WeakMap,XF=new WeakMap,tP=new WeakMap,ZF=new WeakMap,pz=new WeakMap,i6=new WeakSet,Xke=function(){Mc(this,dg,this.CONNECTING),Mc(this,b7,new AbortController),os(this,_fe)(os(this,VT),PC(this,i6,vBt).call(this)).then(os(this,Zke)).catch(os(this,eMe))},Zke=new WeakMap,eMe=new WeakMap,vBt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...os(this,gz)?{"Last-Event-ID":os(this,gz)}:void 0},cache:"no-store",signal:(t=os(this,b7))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},tMe=new WeakMap,rMe=new WeakMap,hz=function(t,e){var r;os(this,dg)!==this.CLOSED&&Mc(this,dg,this.CLOSED);let n=new Sfe("error",{code:e,message:t});(r=os(this,tP))==null||r.call(this,n),this.dispatchEvent(n)},nMe=function(t,e){var r;if(os(this,dg)===this.CLOSED)return;Mc(this,dg,this.CONNECTING);let n=new Sfe("error",{code:e,message:t});(r=os(this,tP))==null||r.call(this,n),this.dispatchEvent(n),Mc(this,eP,setTimeout(os(this,iMe),os(this,mz)))},iMe=new WeakMap,$T.CONNECTING=0,$T.OPEN=1,$T.CLOSED=2});async function wSn(t){return(await sMe).getRandomValues(new Uint8Array(t))}async function xSn(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await wSn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function SSn(t){return await xSn(t)}async function _Sn(t){let e=await(await sMe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function aMe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await SSn(t),r=await _Sn(e);return{code_verifier:e,code_challenge:r}}var sMe,wBt=le(()=>{sMe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Xf,xBt,lMe,TSn,SBt,cMe,_Bt,ISn,DSn,TBt,WSo,jSo,uMe=le(()=>{g7();Xf=ee.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:ee.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),ee.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),xBt=ee.object({resource:ee.string().url(),authorization_servers:ee.array(Xf).optional(),jwks_uri:ee.string().url().optional(),scopes_supported:ee.array(ee.string()).optional(),bearer_methods_supported:ee.array(ee.string()).optional(),resource_signing_alg_values_supported:ee.array(ee.string()).optional(),resource_name:ee.string().optional(),resource_documentation:ee.string().optional(),resource_policy_uri:ee.string().url().optional(),resource_tos_uri:ee.string().url().optional(),tls_client_certificate_bound_access_tokens:ee.boolean().optional(),authorization_details_types_supported:ee.array(ee.string()).optional(),dpop_signing_alg_values_supported:ee.array(ee.string()).optional(),dpop_bound_access_tokens_required:ee.boolean().optional()}).passthrough(),lMe=ee.object({issuer:ee.string(),authorization_endpoint:Xf,token_endpoint:Xf,registration_endpoint:Xf.optional(),scopes_supported:ee.array(ee.string()).optional(),response_types_supported:ee.array(ee.string()),response_modes_supported:ee.array(ee.string()).optional(),grant_types_supported:ee.array(ee.string()).optional(),token_endpoint_auth_methods_supported:ee.array(ee.string()).optional(),token_endpoint_auth_signing_alg_values_supported:ee.array(ee.string()).optional(),service_documentation:Xf.optional(),revocation_endpoint:Xf.optional(),revocation_endpoint_auth_methods_supported:ee.array(ee.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ee.array(ee.string()).optional(),introspection_endpoint:ee.string().optional(),introspection_endpoint_auth_methods_supported:ee.array(ee.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ee.array(ee.string()).optional(),code_challenge_methods_supported:ee.array(ee.string()).optional()}).passthrough(),TSn=ee.object({issuer:ee.string(),authorization_endpoint:Xf,token_endpoint:Xf,userinfo_endpoint:Xf.optional(),jwks_uri:Xf,registration_endpoint:Xf.optional(),scopes_supported:ee.array(ee.string()).optional(),response_types_supported:ee.array(ee.string()),response_modes_supported:ee.array(ee.string()).optional(),grant_types_supported:ee.array(ee.string()).optional(),acr_values_supported:ee.array(ee.string()).optional(),subject_types_supported:ee.array(ee.string()),id_token_signing_alg_values_supported:ee.array(ee.string()),id_token_encryption_alg_values_supported:ee.array(ee.string()).optional(),id_token_encryption_enc_values_supported:ee.array(ee.string()).optional(),userinfo_signing_alg_values_supported:ee.array(ee.string()).optional(),userinfo_encryption_alg_values_supported:ee.array(ee.string()).optional(),userinfo_encryption_enc_values_supported:ee.array(ee.string()).optional(),request_object_signing_alg_values_supported:ee.array(ee.string()).optional(),request_object_encryption_alg_values_supported:ee.array(ee.string()).optional(),request_object_encryption_enc_values_supported:ee.array(ee.string()).optional(),token_endpoint_auth_methods_supported:ee.array(ee.string()).optional(),token_endpoint_auth_signing_alg_values_supported:ee.array(ee.string()).optional(),display_values_supported:ee.array(ee.string()).optional(),claim_types_supported:ee.array(ee.string()).optional(),claims_supported:ee.array(ee.string()).optional(),service_documentation:ee.string().optional(),claims_locales_supported:ee.array(ee.string()).optional(),ui_locales_supported:ee.array(ee.string()).optional(),claims_parameter_supported:ee.boolean().optional(),request_parameter_supported:ee.boolean().optional(),request_uri_parameter_supported:ee.boolean().optional(),require_request_uri_registration:ee.boolean().optional(),op_policy_uri:Xf.optional(),op_tos_uri:Xf.optional()}).passthrough(),SBt=TSn.merge(lMe.pick({code_challenge_methods_supported:!0})),cMe=ee.object({access_token:ee.string(),id_token:ee.string().optional(),token_type:ee.string(),expires_in:ee.number().optional(),scope:ee.string().optional(),refresh_token:ee.string().optional()}).strip(),_Bt=ee.object({error:ee.string(),error_description:ee.string().optional(),error_uri:ee.string().optional()}),ISn=ee.object({redirect_uris:ee.array(Xf),token_endpoint_auth_method:ee.string().optional(),grant_types:ee.array(ee.string()).optional(),response_types:ee.array(ee.string()).optional(),client_name:ee.string().optional(),client_uri:Xf.optional(),logo_uri:Xf.optional(),scope:ee.string().optional(),contacts:ee.array(ee.string()).optional(),tos_uri:Xf.optional(),policy_uri:ee.string().optional(),jwks_uri:Xf.optional(),jwks:ee.any().optional(),software_id:ee.string().optional(),software_version:ee.string().optional(),software_statement:ee.string().optional()}).strip(),DSn=ee.object({client_id:ee.string(),client_secret:ee.string().optional(),client_id_issued_at:ee.number().optional(),client_secret_expires_at:ee.number().optional()}).strip(),TBt=ISn.merge(DSn),WSo=ee.object({error:ee.string(),error_description:ee.string().optional()}).strip(),jSo=ee.object({token:ee.string(),token_type_hint:ee.string().optional()}).strip()});function IBt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function DBt({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var RBt=le(()=>{});var Nd,Az,WT,jT,YT,yz,Ez,vz,LC,Cz,bz,wz,xz,Sz,_z,Tz,Iz,BBt,NBt=le(()=>{Nd=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Az=class extends Nd{};Az.errorCode="invalid_request";WT=class extends Nd{};WT.errorCode="invalid_client";jT=class extends Nd{};jT.errorCode="invalid_grant";YT=class extends Nd{};YT.errorCode="unauthorized_client";yz=class extends Nd{};yz.errorCode="unsupported_grant_type";Ez=class extends Nd{};Ez.errorCode="invalid_scope";vz=class extends Nd{};vz.errorCode="access_denied";LC=class extends Nd{};LC.errorCode="server_error";Cz=class extends Nd{};Cz.errorCode="temporarily_unavailable";bz=class extends Nd{};bz.errorCode="unsupported_response_type";wz=class extends Nd{};wz.errorCode="unsupported_token_type";xz=class extends Nd{};xz.errorCode="invalid_token";Sz=class extends Nd{};Sz.errorCode="method_not_allowed";_z=class extends Nd{};_z.errorCode="too_many_requests";Tz=class extends Nd{};Tz.errorCode="invalid_client_metadata";Iz=class extends Nd{};Iz.errorCode="insufficient_scope";BBt={[Az.errorCode]:Az,[WT.errorCode]:WT,[jT.errorCode]:jT,[YT.errorCode]:YT,[yz.errorCode]:yz,[Ez.errorCode]:Ez,[vz.errorCode]:vz,[LC.errorCode]:LC,[Cz.errorCode]:Cz,[bz.errorCode]:bz,[wz.errorCode]:wz,[xz.errorCode]:xz,[Sz.errorCode]:Sz,[_z.errorCode]:_z,[Tz.errorCode]:Tz,[Iz.errorCode]:Iz}});function kBt(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function MBt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":RSn(i,o,r);return;case"client_secret_post":BSn(i,o,n);return;case"none":NSn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function RSn(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function BSn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function NSn(t,e){e.set("client_id",t)}async function fMe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=_Bt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=BBt[i]||LC;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new LC(i)}}async function w7(t,e){var r,n;try{return await dMe(t,e)}catch(i){if(i instanceof WT||i instanceof YT)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await dMe(t,e);if(i instanceof jT)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await dMe(t,e);throw i}}async function dMe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await kSn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await OSn(e,t,s),u=await USn(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let g=await qSn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(g),d=g}if(r!==void 0){let g=await t.codeVerifier(),A=await hMe(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:g,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let g=await mMe(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof Nd)||g instanceof LC))throw g}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await QSn(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function OSn(t,e,r){let n=IBt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!DBt({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Dz(t){let e=t.headers.get("WWW-Authenticate");if(!e)return;let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;let o=/resource_metadata="([^"]*)"/.exec(e);if(o)try{return new URL(o[1])}catch{return}}async function kSn(t,e,r=fetch){let n=await PSn(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return xBt.parse(await n.json())}async function pMe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?pMe(t,void 0,r):void 0;throw n}}function MSn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function OBt(t,e,r=fetch){return await pMe(t,{"MCP-Protocol-Version":e},r)}function FSn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function PSn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:$F,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=MSn(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await OBt(c,a,r);if(!n?.metadataUrl&&FSn(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await OBt(d,a,r)}return u}function LSn(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function USn(t,{fetchFn:e=fetch,protocolVersion:r=$F}={}){var n;let i={"MCP-Protocol-Version":r},o=LSn(t);for(let{url:s,type:a}of o){let c=await pMe(s,i,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(a==="oauth")return lMe.parse(await c.json());{let u=SBt.parse(await c.json());if(!(!((n=u.code_challenge_methods_supported)===null||n===void 0)&&n.includes("S256")))throw new Error(`Incompatible OIDC provider at ${s}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function QSn(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a="code",c="S256",u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a))throw new Error(`Incompatible auth server: does not support response type ${a}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);let d=await aMe(),f=d.code_verifier,p=d.code_challenge;return u.searchParams.set("response_type",a),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",p),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(n)),o&&u.searchParams.set("state",o),i&&u.searchParams.set("scope",i),i?.includes("offline_access")&&u.searchParams.append("prompt","consent"),s&&u.searchParams.set("resource",s.href),{authorizationUrl:u,codeVerifier:f}}async function hMe(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let g=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],A=kBt(r,g);MBt(A,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await fMe(m);return cMe.parse(await m.json())}async function mMe(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=kBt(r,h);MBt(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await fMe(p);return cMe.parse({refresh_token:n,...await p.json()})}async function qSn(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await fMe(o);return TBt.parse(await o.json())}var fg,Tfe=le(()=>{wBt();y7();uMe();uMe();RBt();NBt();fg=class extends Error{constructor(e){super(e??"Unauthorized")}}});var gMe,rP,FBt=le(()=>{bBt();y7();Tfe();gMe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},rP=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new fg("No auth provider");let r;try{r=await w7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new fg;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new $T(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=Dz(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new gMe(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=A7.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new fg("No auth provider");if(await w7(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new fg("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){if(this._resourceMetadataUrl=Dz(a),await w7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new fg;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var Ife,PBt=le(()=>{Jke();Ife=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=wfe({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var HSn,Rz,x7,AMe=le(()=>{y7();Tfe();PBt();HSn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Rz=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},x7=class{constructor(e,r){var n;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:HSn}async _authThenStart(){var e;if(!this._authProvider)throw new fg("No auth provider");let r;try{r=await w7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new fg;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new Rz(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ife).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let g=A7.parse(JSON.parse(h.data));o!==void 0&&lz(g)&&(g.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,g)}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new fg("No auth provider");if(await w7(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new fg("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:jde(e)?e.id:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=Dz(f),await w7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new fg;return this.send(e)}let A=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${A}`)}if(f.status===202){AIt(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let m=(Array.isArray(e)?e:[e]).filter(A=>"method"in A&&"id"in A&&A.id!==void 0).length>0,g=f.headers.get("content-type");if(m)if(g?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(g?.includes("application/json")){let A=await f.json(),y=Array.isArray(A)?A.map(v=>A7.parse(v)):[A7.parse(A)];for(let v of y)(o=this.onmessage)===null||o===void 0||o.call(this,v)}else throw new Rz(-1,`Unexpected content type: ${g}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new Rz(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as GSn}from"node:fs/promises";var Bz,Nz,zT,yMe=le(()=>{"use strict";AM();Tfe();On();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(Bz||(Bz={}));Nz=class extends Error{code;constructor(e,r){super(r),this.code=e}},zT=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||hC.default}async start(){if(this._isClosed)throw new Error(O.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await mMe(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(O.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new Nz(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new Nz(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(O.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await hMe(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(O.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===hC.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(O.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(O.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==hC.default.OPEN)throw new Error(O.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new Nz(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:Bz.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.31",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:Bz.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await GSn(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:Bz.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var LBt,Dfe,UBt=le(()=>{"use strict";LBt=Le(PY(),1);On();Dfe=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(O.t("mcp.auth.scopesRequired"));this.auth=new LBt.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(O.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as VSn}from"node:child_process";import{promisify as $Sn}from"node:util";import{platform as WSn}from"node:os";import{URL as jSn}from"node:url";function YSn(t){let e;try{e=new jSn(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function qBt(t){YSn(t);let e=WSn(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await QBt(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await QBt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var QBt,HBt=le(()=>{"use strict";QBt=$Sn(VSn)});function $o(t){return t instanceof Error&&"code"in t}function nr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function EMe(t){if(t&&typeof t=="object"&&"response"in t){let r=zSn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new Bfe(r.error.message);case 401:return new S7(r.error.message);case 403:return new Rfe(r.error.message);default:}}return t}function zSn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var Rfe,S7,Bfe,Fc=le(()=>{"use strict";Rfe=class extends Error{},S7=class extends Error{},Bfe=class extends Error{}});import{promises as nP}from"node:fs";import*as Nfe from"node:path";import*as GBt from"node:os";var Zf,Ofe=le(()=>{"use strict";Fc();On();Zf=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=GBt.homedir();return Nfe.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=Nfe.dirname(this.getTokenFilePath());await nP.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await nP.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(O.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:nr(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await nP.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(O.t("mcp.tokenStorage.errors.failedToSaveToken",{error:nr(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await nP.unlink(i):await nP.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(O.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:nr(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await nP.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(O.t("mcp.tokenStorage.errors.failedToClearTokens",{error:nr(e)}))}}}});var ep,kfe=le(()=>{"use strict";Fc();On();ep=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${nr(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${nr(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(O.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(O.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${nr(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(O.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(O.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as VBt from"node:http";import*as Oz from"node:crypto";import{URL as vMe}from"node:url";var q2,CMe=le(()=>{"use strict";HBt();Ofe();Fc();kfe();On();q2=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(O.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=ep.extractBaseUrl(e);return ep.discoverOAuthConfig(r)}static generatePKCEParams(){let e=Oz.randomBytes(32).toString("base64url"),r=Oz.createHash("sha256").update(e).digest("base64url"),n=Oz.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=VBt.createServer(async(o,s)=>{try{let a=new vMe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(O.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
457
457
  <html>
458
458
  <body>
459
459
  <h1>${O.t("mcp.ui.authenticationFailed")}</h1>
@@ -3694,7 +3694,7 @@ ${j.description}`:j.subject||j.description||"Thinking...",[]),X=(0,zs.useCallbac
3694
3694
  `,e-1);return{line:r===-1?0:t.slice(0,r+1).match(/\n/g).length,column:e-r-1}}function A2t(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=dao(t,e);return r?{line:n.line+1,column:n.column+1}:n}var fao=t=>`\\u{${t.codePointAt(0).toString(16)}}`,y2t=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??=`${hao(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
3695
3695
 
3696
3696
  ${e}
3697
- `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=pao(r,this.#t.message);if(n)return(0,LWr.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}},pao=(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)}:A2t(t,Number(n),{oneBased:!0})},hao=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${fao(n)})`);function E2t(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new y2t({jsonParseError:n,fileName:r,input:t})}}var Mjr=Le(Ojr(),1);import{fileURLToPath as flo}from"node:url";function kjr(t){return t instanceof URL?flo(t):t}var mlo=t=>hlo.resolve(kjr(t)??".","package.json"),glo=(t,e)=>{let r=typeof t=="string"?E2t(t):t;return e&&(0,Mjr.default)(r),r};async function Fjr({cwd:t,normalize:e=!0}={}){let r=await plo.readFile(mlo(t),"utf8");return glo(r,e)}async function Pjr(t){let e=await pWr("package.json",t);if(e)return{packageJson:await Fjr({...t,cwd:Alo.dirname(e)}),path:e}}import{fileURLToPath as ylo}from"url";import Elo from"path";var vlo=ylo(import.meta.url),Clo=Elo.dirname(vlo),lwe;async function d$(){if(lwe)return lwe;let t=await Pjr({cwd:Clo});if(t)return lwe=t.packageJson,lwe}async function BS(){let t=await d$();return"0.2.31-beta.3"}Vo();Ot();import iO from"node:process";var Ljr={name:"about",description:O.t("command.about"),kind:"built-in",action:async t=>{let e=iO.platform,r=O.t("aboutCommand.noSandbox");iO.env.SANDBOX&&iO.env.SANDBOX!=="sandbox-exec"?r=iO.env.SANDBOX:iO.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${iO.env.SEATBELT_PROFILE||O.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||O.t("aboutCommand.unknown"),i=await BS(),o=t.services.settings.merged.selectedAuthType||"",s=iO.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())}};Ot();Ot();Vo();var uwe="\x1B[32m";var Qjr="\x1B[31m",NS="\x1B[36m",Bh="\x1B[90m";var Ba="\x1B[0m";function cwe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
3697
+ `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=pao(r,this.#t.message);if(n)return(0,LWr.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}},pao=(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)}:A2t(t,Number(n),{oneBased:!0})},hao=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${fao(n)})`);function E2t(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new y2t({jsonParseError:n,fileName:r,input:t})}}var Mjr=Le(Ojr(),1);import{fileURLToPath as flo}from"node:url";function kjr(t){return t instanceof URL?flo(t):t}var mlo=t=>hlo.resolve(kjr(t)??".","package.json"),glo=(t,e)=>{let r=typeof t=="string"?E2t(t):t;return e&&(0,Mjr.default)(r),r};async function Fjr({cwd:t,normalize:e=!0}={}){let r=await plo.readFile(mlo(t),"utf8");return glo(r,e)}async function Pjr(t){let e=await pWr("package.json",t);if(e)return{packageJson:await Fjr({...t,cwd:Alo.dirname(e)}),path:e}}import{fileURLToPath as ylo}from"url";import Elo from"path";var vlo=ylo(import.meta.url),Clo=Elo.dirname(vlo),lwe;async function d$(){if(lwe)return lwe;let t=await Pjr({cwd:Clo});if(t)return lwe=t.packageJson,lwe}async function BS(){let t=await d$();return"0.2.31"}Vo();Ot();import iO from"node:process";var Ljr={name:"about",description:O.t("command.about"),kind:"built-in",action:async t=>{let e=iO.platform,r=O.t("aboutCommand.noSandbox");iO.env.SANDBOX&&iO.env.SANDBOX!=="sandbox-exec"?r=iO.env.SANDBOX:iO.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${iO.env.SEATBELT_PROFILE||O.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||O.t("aboutCommand.unknown"),i=await BS(),o=t.services.settings.merged.selectedAuthType||"",s=iO.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())}};Ot();Ot();Vo();var uwe="\x1B[32m";var Qjr="\x1B[31m",NS="\x1B[36m",Bh="\x1B[90m";var Ba="\x1B[0m";function cwe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
3698
3698
  ${Qjr}${O.t("agentsCommand.list.noAgentsFound")}${Ba}
3699
3699
  `;i="\u{1F7E2} ";let o=`${i}${e}
3700
3700
  `;for(let s of t)n?o+=blo(s):o+=`${uwe}- ${s.agentType}${Ba}
@@ -3737,7 +3737,7 @@ ${Bh}${O.t("agentsCommand.list.builtinAgents")}${Ba}
3737
3737
  ${Bh}${O.t("agentsCommand.list.generalPurpose")}
3738
3738
  ${Ba}`;let c=n.length+i.length;t.ui.addItem({type:"info",text:`${uwe}${O.t("agentsCommand.refresh.success",{count:c})}${Ba}
3739
3739
 
3740
- ${uwe}${a.trim()}${Ba}`},Date.now())}catch(e){let r=nr(e);t.ui.addItem({type:"error",text:`${Qjr}${O.t("agentsCommand.refresh.error",{error:r})}${Ba}`},Date.now())}}},{name:"online",description:O.t("agentsCommand.subCommands.online"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agents-online"})},{name:"install",description:O.t("agentsCommand.subCommands.install"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agent-install"})}]};Ot();var Hjr={name:"auth",description:O.t("command.auth"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"auth"})};AT();import r9 from"node:process";import wlo from"node:os";Vo();Ot();var f$="b0bcabf9 (local modifications)";Ot();async function xlo(t,e){let r="https://apis.iflow.cn/v1/bug/report",i={content:JSON.stringify(t,null,2)},o={"Content-Type":"application/json"};e&&(o.Authorization=`Bearer ${e}`);try{let s=await fetch(r,{method:"POST",headers:o,body:JSON.stringify(i)});if(s.ok){let a=await s.json();return console.log("Bug report data sent successfully to endpoint"),a.success&&a.data?a.data:(console.warn("Unexpected response format from endpoint:",a),null)}else return console.warn(`Failed to send bug report to endpoint: ${s.status} ${s.statusText}`),null}catch(s){return console.warn("Failed to send bug report to endpoint:",s),null}}var Gjr={name:"bug",description:O.t("command.bug"),kind:"built-in",action:async(t,e)=>{let r=(e||"").trim(),{config:n}=t.services,i=bT(),o=`${r9.platform} ${r9.version}`,s=O.t("bugCommand.noSandbox");r9.env.SANDBOX&&r9.env.SANDBOX!=="sandbox-exec"?s=r9.env.SANDBOX.replace(/^iflow-(?:code-)?/,""):r9.env.SANDBOX==="sandbox-exec"&&(s=`sandbox-exec (${r9.env.SEATBELT_PROFILE||"unknown"})`);let a=n?.getModel()||O.t("bugCommand.unknown"),c=await BS(),u=$V(r9.memoryUsage().rss),d=i.getInMemoryErrors(),f=O.t("bugCommand.noRecentErrors");d.length>0&&(f=d.slice(-3).map(M=>O.t("bugCommand.errorWithTimestamp",{timestamp:M.timestamp,error:M.error})).join(`
3740
+ ${uwe}${a.trim()}${Ba}`},Date.now())}catch(e){let r=nr(e);t.ui.addItem({type:"error",text:`${Qjr}${O.t("agentsCommand.refresh.error",{error:r})}${Ba}`},Date.now())}}},{name:"online",description:O.t("agentsCommand.subCommands.online"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agents-online"})},{name:"install",description:O.t("agentsCommand.subCommands.install"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agent-install"})}]};Ot();var Hjr={name:"auth",description:O.t("command.auth"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"auth"})};AT();import r9 from"node:process";import wlo from"node:os";Vo();Ot();var f$="91b481b4 (local modifications)";Ot();async function xlo(t,e){let r="https://apis.iflow.cn/v1/bug/report",i={content:JSON.stringify(t,null,2)},o={"Content-Type":"application/json"};e&&(o.Authorization=`Bearer ${e}`);try{let s=await fetch(r,{method:"POST",headers:o,body:JSON.stringify(i)});if(s.ok){let a=await s.json();return console.log("Bug report data sent successfully to endpoint"),a.success&&a.data?a.data:(console.warn("Unexpected response format from endpoint:",a),null)}else return console.warn(`Failed to send bug report to endpoint: ${s.status} ${s.statusText}`),null}catch(s){return console.warn("Failed to send bug report to endpoint:",s),null}}var Gjr={name:"bug",description:O.t("command.bug"),kind:"built-in",action:async(t,e)=>{let r=(e||"").trim(),{config:n}=t.services,i=bT(),o=`${r9.platform} ${r9.version}`,s=O.t("bugCommand.noSandbox");r9.env.SANDBOX&&r9.env.SANDBOX!=="sandbox-exec"?s=r9.env.SANDBOX.replace(/^iflow-(?:code-)?/,""):r9.env.SANDBOX==="sandbox-exec"&&(s=`sandbox-exec (${r9.env.SEATBELT_PROFILE||"unknown"})`);let a=n?.getModel()||O.t("bugCommand.unknown"),c=await BS(),u=$V(r9.memoryUsage().rss),d=i.getInMemoryErrors(),f=O.t("bugCommand.noRecentErrors");d.length>0&&(f=d.slice(-3).map(M=>O.t("bugCommand.errorWithTimestamp",{timestamp:M.timestamp,error:M.error})).join(`
3741
3741
 
3742
3742
  `));let p=wlo.userInfo().username,h=I=>{if(!p)return I;let M=new RegExp(`/${p}/`,"g");return I.replace(M,"/user/")},m=`CLI Version: ${c}
3743
3743
  Git Commit: ${f$}
@@ -4779,7 +4779,7 @@ ${O.t("gemini.errors.criticalUnhandledRejection")}
4779
4779
  =========================================
4780
4780
  ${O.t("gemini.errors.reason",{reason:e})}${e instanceof Error&&e.stack?`
4781
4781
  ${O.t("gemini.errors.stackTrace")}
4782
- ${e.stack}`:""}`;Ns.emit("log-error",n),t||(t=!0,Ns.emit("open-debug-console"))})}function f3o(){console.log(O.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.2.31-beta.3"}},r=`crash-${Date.now()}-${process.pid}.json`,n=r3o.join(process.cwd(),r);try{a3o.writeFileSync(n,JSON.stringify(e,null,2)),console.error(O.t("gemini.crashDetected",{crashFilePath:n})),console.error(O.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(O.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(O.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(O.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function _ln(){d3o();let t=process.cwd(),e=_l(t);if(!e.user.settings.cna){let p=await Cde();p&&e.setValue("User","cna",p)}if(await Ztn(),e.errors.length>0){for(let p of e.errors){let h=O.t("gemini.errorInFile",{path:p.path,message:p.message});process.env.NO_COLOR||(h=`\x1B[31m${h}\x1B[0m`),console.error(h),console.error(O.t("gemini.pleaseFixFileAndTryAgain",{path:p.path}))}process.exit(1)}let r=await Uxe();(!!r.prompt&&!r.promptInteractive&&!r.continue&&!r.resume||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let i=VS(t),o=await NO(e.merged,i,Rh.generateSessionId(),r);if(O.changeLanguage(o.getLanguage()),o.getDebugMode()&&f3o(),o3o.setDefaultResultOrder(l3o(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(O.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),o.getListExtensions()){console.debug(O.t("gemini.installedExtensions"));for(let p of i)console.debug(`- ${p.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:p}=await Promise.resolve().then(()=>(m3t(),Jtn)),h=(await Promise.resolve().then(()=>(W6t(),$6t))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:p}=await Promise.resolve().then(()=>(p3t(),Ptn)),h=(await Promise.resolve().then(()=>(W6t(),$6t))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",$t.CLOUD_SHELL),wXr(o.getDebugMode()),await o.initialize(),Va.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(Va.setActiveTheme(e.merged.theme)||console.warn(O.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let p=e.merged.autoConfigureMaxOldSpaceSize?c3o(o):[],h=o.getSandbox();if(h){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let m=EO(e.merged.selectedAuthType);if(m)throw new Error(m);await o.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(m){console.error(O.t("gemini.errorAuthenticating"),m),process.exit(1)}await rin(h,p,o),process.exit(0)}else p.length>0&&(await u3o(p),process.exit(0))}if(e.merged.selectedAuthType===$t.LOGIN_WITH_IFLOW&&o.isBrowserLaunchSuppressed()&&await ET(e.merged.selectedAuthType,o),o.getExperimentalAcp())return o.getAcpPort()?await Pan(o,e,i,r,o.getAcpPort()):Ran(o,e,i,r);let s=o.getQuestion(),a=[...await nin(),...await oin(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&s?.length===0){console.clear();let p=await BS();Sln(xln(t),e);try{await o.setIdeModeAndSyncConnection(!0)}catch(v){console.error(O.t("gemini.failedToConnectToIdeServer"),v)}let h,m=async()=>{try{if(console.clear(),Sln(xln(t),e),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),h)try{h.unmount(),await new Promise(w=>process.nextTick(w))}catch(w){console.error(O.t("gemini.errorDuringUnmount"),w)}let{executeSessionStartHooks:v}=await Promise.resolve().then(()=>(aO(),sO)),b=await v(o,"resume");h=ace((0,rae.jsx)(j6t.default.StrictMode,{children:(0,rae.jsx)(J3t,{config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:b})}),{exitOnCtrlC:!1,stdout:H2t(),stdin:process.stdin,patchConsole:!0})}catch(v){console.error(O.t("gemini.errorDuringResume"),v)}};process.on("SIGCONT",m),wse(()=>{process.off("SIGCONT",m)}),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume());let g="startup";(r.continue||r.resume)&&(g="resume");let{executeSessionStartHooks:A}=await Promise.resolve().then(()=>(aO(),sO)),y=await A(o,g);h=ace((0,rae.jsx)(j6t.default.StrictMode,{children:(0,rae.jsx)(J3t,{config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:y})}),{exitOnCtrlC:!1,stdout:H2t()}),e.merged.disableAutoUpdate||wan().then(v=>{ynn(v,e,o.getProjectRoot())}).catch(v=>{o.getDebugMode()&&console.error(O.t("gemini.updateCheckFailed"),v)}),wse(()=>h.unmount());return}!process.stdin.isTTY&&!s&&(s+=await Xnn()),s||(console.error(O.t("gemini.noInputProvidedViaStdin")),process.exit(1));let u=Math.random().toString(16).slice(2);bV(o,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:s,prompt_id:u,auth_type:o.getContentGeneratorConfig()?.authType,prompt_length:s.length});let d=await p3o(o,i,e,r),f=r.outputFile||r.output_file;await ain(d,s,u,f),process.exit(0)}function Sln(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function p3o(t,e,r,n){let i=t;if(t.getApprovalMode()!==Mn.YOLO){let o=r.merged.excludeTools||[],s=[qc.Name,qd.Name,Uu.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await NO(c,e,t.getSessionId(),u),await i.initialize()}return await h3o(r.merged.selectedAuthType,i,r)}async function h3o(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!Ode()&&(console.error(O.t("gemini.pleaseSetAuthMethod",{userSettingsPath:tO})),process.exit(1)),t||(Ode()?t=$t.IFLOW:t=$t.IFLOW);let n=EO(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:r.merged.modelName}),e}_ln().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
4782
+ ${e.stack}`:""}`;Ns.emit("log-error",n),t||(t=!0,Ns.emit("open-debug-console"))})}function f3o(){console.log(O.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.2.31"}},r=`crash-${Date.now()}-${process.pid}.json`,n=r3o.join(process.cwd(),r);try{a3o.writeFileSync(n,JSON.stringify(e,null,2)),console.error(O.t("gemini.crashDetected",{crashFilePath:n})),console.error(O.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(O.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(O.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(O.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function _ln(){d3o();let t=process.cwd(),e=_l(t);if(!e.user.settings.cna){let p=await Cde();p&&e.setValue("User","cna",p)}if(await Ztn(),e.errors.length>0){for(let p of e.errors){let h=O.t("gemini.errorInFile",{path:p.path,message:p.message});process.env.NO_COLOR||(h=`\x1B[31m${h}\x1B[0m`),console.error(h),console.error(O.t("gemini.pleaseFixFileAndTryAgain",{path:p.path}))}process.exit(1)}let r=await Uxe();(!!r.prompt&&!r.promptInteractive&&!r.continue&&!r.resume||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let i=VS(t),o=await NO(e.merged,i,Rh.generateSessionId(),r);if(O.changeLanguage(o.getLanguage()),o.getDebugMode()&&f3o(),o3o.setDefaultResultOrder(l3o(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(O.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),o.getListExtensions()){console.debug(O.t("gemini.installedExtensions"));for(let p of i)console.debug(`- ${p.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:p}=await Promise.resolve().then(()=>(m3t(),Jtn)),h=(await Promise.resolve().then(()=>(W6t(),$6t))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:p}=await Promise.resolve().then(()=>(p3t(),Ptn)),h=(await Promise.resolve().then(()=>(W6t(),$6t))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",$t.CLOUD_SHELL),wXr(o.getDebugMode()),await o.initialize(),Va.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(Va.setActiveTheme(e.merged.theme)||console.warn(O.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let p=e.merged.autoConfigureMaxOldSpaceSize?c3o(o):[],h=o.getSandbox();if(h){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let m=EO(e.merged.selectedAuthType);if(m)throw new Error(m);await o.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(m){console.error(O.t("gemini.errorAuthenticating"),m),process.exit(1)}await rin(h,p,o),process.exit(0)}else p.length>0&&(await u3o(p),process.exit(0))}if(e.merged.selectedAuthType===$t.LOGIN_WITH_IFLOW&&o.isBrowserLaunchSuppressed()&&await ET(e.merged.selectedAuthType,o),o.getExperimentalAcp())return o.getAcpPort()?await Pan(o,e,i,r,o.getAcpPort()):Ran(o,e,i,r);let s=o.getQuestion(),a=[...await nin(),...await oin(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&s?.length===0){console.clear();let p=await BS();Sln(xln(t),e);try{await o.setIdeModeAndSyncConnection(!0)}catch(v){console.error(O.t("gemini.failedToConnectToIdeServer"),v)}let h,m=async()=>{try{if(console.clear(),Sln(xln(t),e),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),h)try{h.unmount(),await new Promise(w=>process.nextTick(w))}catch(w){console.error(O.t("gemini.errorDuringUnmount"),w)}let{executeSessionStartHooks:v}=await Promise.resolve().then(()=>(aO(),sO)),b=await v(o,"resume");h=ace((0,rae.jsx)(j6t.default.StrictMode,{children:(0,rae.jsx)(J3t,{config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:b})}),{exitOnCtrlC:!1,stdout:H2t(),stdin:process.stdin,patchConsole:!0})}catch(v){console.error(O.t("gemini.errorDuringResume"),v)}};process.on("SIGCONT",m),wse(()=>{process.off("SIGCONT",m)}),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume());let g="startup";(r.continue||r.resume)&&(g="resume");let{executeSessionStartHooks:A}=await Promise.resolve().then(()=>(aO(),sO)),y=await A(o,g);h=ace((0,rae.jsx)(j6t.default.StrictMode,{children:(0,rae.jsx)(J3t,{config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:y})}),{exitOnCtrlC:!1,stdout:H2t()}),e.merged.disableAutoUpdate||wan().then(v=>{ynn(v,e,o.getProjectRoot())}).catch(v=>{o.getDebugMode()&&console.error(O.t("gemini.updateCheckFailed"),v)}),wse(()=>h.unmount());return}!process.stdin.isTTY&&!s&&(s+=await Xnn()),s||(console.error(O.t("gemini.noInputProvidedViaStdin")),process.exit(1));let u=Math.random().toString(16).slice(2);bV(o,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:s,prompt_id:u,auth_type:o.getContentGeneratorConfig()?.authType,prompt_length:s.length});let d=await p3o(o,i,e,r),f=r.outputFile||r.output_file;await ain(d,s,u,f),process.exit(0)}function Sln(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function p3o(t,e,r,n){let i=t;if(t.getApprovalMode()!==Mn.YOLO){let o=r.merged.excludeTools||[],s=[qc.Name,qd.Name,Uu.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await NO(c,e,t.getSessionId(),u),await i.initialize()}return await h3o(r.merged.selectedAuthType,i,r)}async function h3o(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!Ode()&&(console.error(O.t("gemini.pleaseSetAuthMethod",{userSettingsPath:tO})),process.exit(1)),t||(Ode()?t=$t.IFLOW:t=$t.IFLOW);let n=EO(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:r.merged.modelName}),e}_ln().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
4783
4783
  /**
4784
4784
  * @license
4785
4785
  * Copyright 2025 Google LLC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iflow-ai/iflow-cli",
3
- "version": "0.2.31-beta.3",
3
+ "version": "0.2.31",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },