@mcp-use/inspector 0.13.0-canary.13 → 0.13.0-canary.15

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.
Files changed (31) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/client/assets/{browser-9Hcz8GQa.js → browser-CLu-Wczi.js} +54 -54
  3. package/dist/client/assets/{display-A5IEINAP-CDZgqATQ.js → display-A5IEINAP-BzOV9eeq.js} +2 -2
  4. package/dist/client/assets/{embeddings-B_c8FO0V.js → embeddings-CpzGcA5C.js} +1 -1
  5. package/dist/client/assets/fs-u42MReIY.js +1 -0
  6. package/dist/client/assets/{index-COt7aP5z.js → index-3gD6WWVL.js} +1 -1
  7. package/dist/client/assets/{index-D6MZ_uWL.js → index-BtxhV1th.js} +11 -11
  8. package/dist/client/assets/{index-Dxsl-6OY.js → index-CVD-P0xp.js} +1 -1
  9. package/dist/client/assets/{index-C7WKC4_c.js → index-Cs2Qhtuo.js} +1 -1
  10. package/dist/client/assets/{index-CrP21sE-.js → index-D-OMhIK9.js} +1 -1
  11. package/dist/client/assets/{index-BcDWp7yL.js → index-DzHWl9rl.js} +1 -1
  12. package/dist/client/assets/{index-Q4cmml2q.js → index-ll3isPzo.js} +1 -1
  13. package/dist/client/assets/{index-D6VDHNX7.js → index-rYq5gryB.js} +1 -1
  14. package/dist/client/assets/{index-BWJOUedR.js → index-t0uG7tP6.js} +1 -1
  15. package/dist/client/assets/{llms-BEnmsJ6n.js → llms-CiEeBXg6.js} +1 -1
  16. package/dist/client/assets/path-Dubn5ZXB.js +1 -0
  17. package/dist/client/assets/{winston-CKwQ3MQO.js → winston-CDkaxt_Q.js} +2 -2
  18. package/dist/client/index.html +2 -2
  19. package/dist/server/{chunk-OS2WTNLR.js → chunk-JEKCWLHD.js} +1 -1
  20. package/dist/server/{chunk-Z5QIR3IS.js → chunk-MCMZDGO6.js} +2 -2
  21. package/dist/server/{chunk-WLIY2SQG.js → chunk-XGILHZOF.js} +1 -1
  22. package/dist/server/cli.js +2 -2
  23. package/dist/server/index.js +3 -3
  24. package/dist/server/middleware.js +3 -3
  25. package/dist/server/server.js +2 -2
  26. package/dist/server/shared-routes.js +2 -2
  27. package/dist/server/shared-utils-browser.d.ts.map +1 -1
  28. package/dist/server/shared-utils-browser.js +1 -1
  29. package/package.json +2 -2
  30. package/dist/client/assets/langfuse-74RGPTAH-BwcKtZq0.js +0 -1
  31. package/dist/client/assets/path-X6M8BSjL.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-CKwQ3MQO.js","assets/util-t-trnxQI.js","assets/index-DRz5BQNA.js","assets/path-X6M8BSjL.js","assets/path-MNZaYwxc.js","assets/index-CrP21sE-.js","assets/index-BWJOUedR.js","assets/index-C7WKC4_c.js","assets/llms-BEnmsJ6n.js","assets/embeddings-B_c8FO0V.js","assets/index-COt7aP5z.js","assets/index-Dxsl-6OY.js","assets/index-Q4cmml2q.js","assets/browser-9Hcz8GQa.js"])))=>i.map(i=>d[i]);
2
- var oJ=Object.defineProperty;var sJ=(e,t,n)=>t in e?oJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pf=(e,t,n)=>sJ(e,typeof t!="symbol"?t+"":t,n);function lJ(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(a,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();function ny(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function JTe(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function a(){var r=!1;try{r=this instanceof a}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}),n}var $S={exports:{}},Uf={};var sM;function cJ(){if(sM)return Uf;sM=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,r,i){var s=null;if(i!==void 0&&(s=""+i),r.key!==void 0&&(s=""+r.key),"key"in r){i={};for(var c in r)c!=="key"&&(i[c]=r[c])}else i=r;return r=i.ref,{$$typeof:e,type:a,key:s,ref:r!==void 0?r:null,props:i}}return Uf.Fragment=t,Uf.jsx=n,Uf.jsxs=n,Uf}var lM;function uJ(){return lM||(lM=1,$S.exports=cJ()),$S.exports}var f=uJ();const dJ="modulepreload",fJ=function(e){return"/inspector/"+e},cM={},Jn=function(t,n,a){let r=Promise.resolve();if(n&&n.length>0){let u=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=s?.nonce||s?.getAttribute("nonce");r=u(n.map(d=>{if(d=fJ(d),d in cM)return;cM[d]=!0;const m=d.endsWith(".css"),h=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":dJ,m||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),m)return new Promise((v,x)=>{g.addEventListener("load",v),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return r.then(s=>{for(const c of s||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};var pJ=Object.defineProperty,ze=(e,t)=>pJ(e,"name",{value:t,configurable:!0}),ks=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Xc={};async function sF(){if(typeof process<"u")try{const e=await Jn(()=>import("fs"),[]),t=await Jn(()=>import("./path-MNZaYwxc.js").then(n=>n.p),[]);return{fs:e.default,path:t.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}ze(sF,"getNodeModules");var ha=null;function lF(){if(typeof ks<"u")try{ha=ks("winston")}catch{}}ze(lF,"loadWinstonSync");async function cF(){return ha||(ha=await Jn(()=>import("./winston-CKwQ3MQO.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4]))),ha}ze(cF,"getWinston");var n_="mcp-use";function Xb(){try{return typeof navigator<"u"&&navigator.userAgent?.includes("Cloudflare-Workers")||typeof globalThis.EdgeRuntime<"u"||typeof globalThis.Deno<"u"?!1:typeof process<"u"&&!0&&typeof __dirname<"u"}catch{return!1}}ze(Xb,"isNodeJSEnvironment");var Ru,mJ=(Ru=class{_level;name;constructor(t=n_,n="info"){this.name=t,this._level=n}shouldLog(t){const n=["error","warn","info","http","verbose","debug","silly"],a=n.indexOf(this._level);return n.indexOf(t)<=a}formatMessage(t,n){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${t}: ${n}`}error(t){this.shouldLog("error")&&console.error(this.formatMessage("error",t))}warn(t){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",t))}info(t){this.shouldLog("info")&&console.info(this.formatMessage("info",t))}debug(t){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",t))}http(t){this.shouldLog("http")&&console.log(this.formatMessage("http",t))}verbose(t){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",t))}silly(t){this.shouldLog("silly")&&console.log(this.formatMessage("silly",t))}get level(){return this._level}set level(t){this._level=t}},ze(Ru,"SimpleConsoleLogger"),Ru);function kb(e){switch((typeof process<"u"&&Xc?e:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}ze(kb,"resolveLevel");var ko,uF=(ko=class{static get(t=n_){if(!Xb()){if(!this.simpleInstances[t]){const n=typeof process<"u"&&Xc?.DEBUG||void 0;this.simpleInstances[t]=new mJ(t,kb(n))}return this.simpleInstances[t]}if(!this.instances[t]){if(!ha)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:n,format:a}=ha,{combine:r,timestamp:i,label:s,colorize:c,splat:u}=a;this.instances[t]=n({level:kb(Xc.DEBUG),format:r(c(),u(),s({label:t}),i({format:"HH:mm:ss"}),this.getFormatter()),transports:[new ha.transports.Console]})}return this.instances[t]}static getFormatter(){if(!ha)throw new Error("Winston not loaded");const{format:t}=ha,{printf:n}=t,a=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s}: ${c}`),r=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`),i=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return a;case"detailed":return r;case"emoji":return i;default:return a}}static async configure(t={}){const{level:n,console:a=!0,file:r,format:i="minimal"}=t,s=typeof process<"u"&&Xc?.DEBUG||void 0,c=n??kb(s);if(this.currentFormat=i,!Xb()){Object.values(this.simpleInstances).forEach(y=>{y.level=c});return}if(await cF(),!ha)throw new Error("Failed to load winston");const u=this.get();u.level=c;const d=u;if(d.clear(),a&&d.add(new ha.transports.Console),r){const{fs:y,path:E}=await sF();if(y&&E){const _=E.dirname(E.resolve(r));y.existsSync(_)||y.mkdirSync(_,{recursive:!0}),d.add(new ha.transports.File({filename:r}))}}const{format:m}=ha,{combine:h,timestamp:g,label:v,colorize:x,splat:S}=m;Object.values(this.instances).forEach(y=>{y&&"format"in y&&(y.level=c,y.format=h(x(),S(),v({label:n_}),g({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(t){let n;t===2||t===!0?n="debug":n="info",Object.values(this.simpleInstances).forEach(a=>{a.level=n}),Object.values(this.instances).forEach(a=>{a&&(a.level=n)}),typeof process<"u"&&Xc&&(Xc.DEBUG=t?t===!0?"2":String(t):"0")}static setFormat(t){this.currentFormat=t,this.configure({format:t})}},ze(ko,"Logger"),Pf(ko,"instances",{}),Pf(ko,"simpleInstances",{}),Pf(ko,"currentFormat","minimal"),ko);Xb()&&(lF(),ha&&uF.configure());var ke=uF.get(),Tb={},dF=typeof globalThis.Deno<"u";function hJ(e){return dF?globalThis.Deno.env.get(e):Tb[e]}ze(hJ,"getEnv");function gJ(){return dF?globalThis.Deno.cwd():process.cwd()}ze(gJ,"getCwd");function Yf(){return globalThis.crypto.randomUUID()}ze(Yf,"generateUUID");var bJ="1.11.0-canary.13";function Jb(){return bJ}ze(Jb,"getPackageVersion");var Au,Ci=(Au=class{},ze(Au,"BaseTelemetryEvent"),Au),Iu,vJ=(Iu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"mcp_agent_execution"}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}},ze(Iu,"MCPAgentExecutionEvent"),Iu);function fF(e,t){const n=Array.from(e.registrations.tools.values()),a=Array.from(e.registrations.prompts.values()),r=Array.from(e.registrations.resources.values()),i=Array.from(e.registrations.resourceTemplates.values()),s=r.map(m=>({name:m.config.name,title:m.config.title??null,description:m.config.description??null,uri:m.config.uri??null,mime_type:m.config.mimeType??null})),c=s.filter(m=>m.mime_type==="text/html+skybridge"),u=s.filter(m=>m.mime_type==="text/uri-list"||m.mime_type==="text/html"),d=s.filter(m=>m.mime_type==="text/html+mcp");return{transport:t,toolsNumber:e.registeredTools.length,resourcesNumber:e.registeredResources.length,promptsNumber:e.registeredPrompts.length,auth:!!e.oauthProvider,name:e.config.name,description:e.config.description??null,baseUrl:e.serverBaseUrl??null,toolNames:e.registeredTools.length>0?e.registeredTools:null,resourceNames:e.registeredResources.length>0?e.registeredResources:null,promptNames:e.registeredPrompts.length>0?e.registeredPrompts:null,tools:n.length>0?n.map(m=>({name:m.config.name,title:m.config.title??null,description:m.config.description??null,input_schema:m.config.schema?JSON.stringify(m.config.schema):null,output_schema:m.config.outputSchema?JSON.stringify(m.config.outputSchema):null})):null,resources:s.length>0?s:null,prompts:a.length>0?a.map(m=>({name:m.config.name,title:m.config.title??null,description:m.config.description??null,args:m.config.args?JSON.stringify(m.config.args):null})):null,templates:i.length>0?i.map(m=>({name:m.config.name,title:m.config.title??null,description:m.config.description??null})):null,capabilities:{logging:!0,resources:{subscribe:!0,listChanged:!0}},appsSdkResources:c.length>0?c:null,appsSdkResourcesNumber:c.length,mcpUiResources:u.length>0?u:null,mcpUiResourcesNumber:u.length,mcpAppsResources:d.length>0?d:null,mcpAppsResourcesNumber:d.length}}ze(fF,"createServerRunEventData");var Ou,yJ=(Ou=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_run"}get properties(){return{transport:this.data.transport,tools_number:this.data.toolsNumber,resources_number:this.data.resourcesNumber,prompts_number:this.data.promptsNumber,auth:this.data.auth,name:this.data.name,description:this.data.description??null,base_url:this.data.baseUrl??null,tool_names:this.data.toolNames??null,resource_names:this.data.resourceNames??null,prompt_names:this.data.promptNames??null,tools:this.data.tools??null,resources:this.data.resources??null,prompts:this.data.prompts??null,templates:this.data.templates??null,capabilities:this.data.capabilities?JSON.stringify(this.data.capabilities):null,apps_sdk_resources:this.data.appsSdkResources?JSON.stringify(this.data.appsSdkResources):null,apps_sdk_resources_number:this.data.appsSdkResourcesNumber??0,mcp_ui_resources:this.data.mcpUiResources?JSON.stringify(this.data.mcpUiResources):null,mcp_ui_resources_number:this.data.mcpUiResourcesNumber??0,mcp_apps_resources:this.data.mcpAppsResources?JSON.stringify(this.data.mcpAppsResources):null,mcp_apps_resources_number:this.data.mcpAppsResourcesNumber??0}}},ze(Ou,"ServerRunEvent"),Ou),Du,wJ=(Du=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_initialize_call"}get properties(){return{protocol_version:this.data.protocolVersion,client_info:JSON.stringify(this.data.clientInfo),client_capabilities:JSON.stringify(this.data.clientCapabilities),session_id:this.data.sessionId??null}}},ze(Du,"ServerInitializeEvent"),Du),ju,SJ=(ju=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_tool_call"}get properties(){return{tool_name:this.data.toolName,length_input_argument:this.data.lengthInputArgument,success:this.data.success,error_type:this.data.errorType??null,execution_time_ms:this.data.executionTimeMs??null}}},ze(ju,"ServerToolCallEvent"),ju),Lu,xJ=(Lu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_resource_call"}get properties(){return{name:this.data.name,description:this.data.description,contents:this.data.contents,success:this.data.success,error_type:this.data.errorType??null}}},ze(Lu,"ServerResourceCallEvent"),Lu),$u,_J=($u=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_prompt_call"}get properties(){return{name:this.data.name,description:this.data.description,success:this.data.success,error_type:this.data.errorType??null}}},ze($u,"ServerPromptCallEvent"),$u),Mu,EJ=(Mu=class extends Ci{constructor(t){super(),this.data=t}get name(){return`server_context_${this.data.contextType}`}get properties(){return{context_type:this.data.contextType,notification_type:this.data.notificationType??null}}},ze(Mu,"ServerContextEvent"),Mu),Pu,kJ=(Pu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"mcpclient_init"}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},ze(Pu,"MCPClientInitEvent"),Pu),Uu,TJ=(Uu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"connector_init"}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},ze(Uu,"ConnectorInitEvent"),Uu),zu,NJ=(zu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"client_add_server"}get properties(){const{serverName:t,serverConfig:n}=this.data,a=n.url;return{server_name:t,server_url_domain:a?this._extractHostname(a):null,transport:n.transport??null,has_auth:!!(n.authToken||n.authProvider)}}_extractHostname(t){try{return new URL(t).hostname}catch{return null}}},ze(zu,"ClientAddServerEvent"),zu),Fu,CJ=(Fu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"client_remove_server"}get properties(){return{server_name:this.data.serverName}}},ze(Fu,"ClientRemoveServerEvent"),Fu);function pF(e){return e._llm_type||e.constructor.name.toLowerCase()}ze(pF,"getModelProvider");function mF(e){if("_identifyingParams"in e){const t=e._identifyingParams;if(typeof t=="object"&&t!==null){for(const n of["model","modelName","model_name","modelId","model_id","deploymentName","deployment_name"])if(n in t)return String(t[n])}}return e.model||e.modelName||e.constructor.name}ze(mF,"getModelName");function RJ(e){return[pF(e),mF(e)]}ze(RJ,"extractModelInfo");var uM="mcp_use_user_id";function hF(){try{return typeof globalThis.Bun<"u"?"bun":typeof globalThis.Deno<"u"?"deno":typeof navigator<"u"&&navigator.userAgent?.includes("Cloudflare-Workers")?"cloudflare-workers":typeof globalThis.EdgeRuntime<"u"?"edge":typeof window<"u"&&typeof document<"u"?"browser":typeof process<"u"&&typeof process.versions?.node<"u"?"node":"unknown"}catch{return"unknown"}}ze(hF,"detectRuntimeEnvironment");function gF(e){switch(e){case"node":case"bun":return"filesystem";case"browser":try{if(typeof localStorage<"u")return localStorage.setItem("__mcp_use_test__","1"),localStorage.removeItem("__mcp_use_test__"),"localStorage"}catch{}return"session-only";case"deno":return"session-only";default:return"session-only"}}ze(gF,"getStorageCapability");var MS=null;function bF(){return MS===null&&(MS=hF()),MS}ze(bF,"getRuntimeEnvironment");var Bu,AJ=(Bu=class{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,a=setTimeout(()=>n.abort(),this.timeout),r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(a),!r.ok)throw new Error(`HTTP error! status: ${r.status}`)}catch(n){ke.debug(`Failed to send Scarf event: ${n}`)}}},ze(Bu,"ScarfEventLogger"),Bu),gi,vF=(gi=class{PROJECT_API_KEY="phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI";HOST="https://eu.i.posthog.com";SCARF_GATEWAY_URL="https://mcpuse.gateway.scarf.sh/events-ts";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogNodeClient=null;_posthogBrowserClient=null;_posthogLoading=null;_scarfClient=null;_runtimeEnvironment;_storageCapability;_source;_userIdPath=null;_versionDownloadPath=null;constructor(){this._runtimeEnvironment=bF(),this._storageCapability=gF(this._runtimeEnvironment),this._source=typeof process<"u"&&Tb?.MCP_USE_TELEMETRY_SOURCE||this._runtimeEnvironment;const t=this._checkTelemetryDisabled(),n=this._runtimeEnvironment!=="unknown";if(t)this._posthogNodeClient=null,this._posthogBrowserClient=null,this._scarfClient=null,ke.debug("Telemetry disabled via environment/localStorage");else if(!n)this._posthogNodeClient=null,this._posthogBrowserClient=null,this._scarfClient=null,ke.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`);else{ke.info("Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."),this._posthogLoading=this._initPostHog();try{this._scarfClient=new AJ(this.SCARF_GATEWAY_URL,3e3)}catch(a){ke.warn(`Failed to initialize Scarf telemetry: ${a}`),this._scarfClient=null}}}_checkTelemetryDisabled(){return typeof process<"u"&&Tb?.MCP_USE_ANONYMIZED_TELEMETRY?.toLowerCase()==="false"||typeof localStorage<"u"&&localStorage.getItem("MCP_USE_ANONYMIZED_TELEMETRY")==="false"}async _initPostHog(){this._runtimeEnvironment==="browser"?await this._initPostHogBrowser():await this._initPostHogNode()}async _initPostHogBrowser(){try{const t=await Jn(()=>import("./module-D4IOASh4.js"),[]),n=t.default||t.posthog;if(!n||typeof n.init!="function")throw new Error("posthog-js module did not export expected interface");n.init(this.PROJECT_API_KEY,{api_host:this.HOST,persistence:"localStorage",autocapture:!1,capture_pageview:!1,disable_session_recording:!0,loaded:ze(()=>{ke.debug("PostHog browser client initialized")},"loaded")}),this._posthogBrowserClient=n}catch(t){ke.warn(`Failed to initialize PostHog browser telemetry: ${t}`),this._posthogBrowserClient=null}}async _initPostHogNode(){try{const{PostHog:t}=await Jn(async()=>{const{PostHog:r}=await import("./posthog-node-CuYhrq1Q.js");return{PostHog:r}},[]),n=["cloudflare-workers","edge","deno"].includes(this._runtimeEnvironment),a={host:this.HOST,disableGeoip:!1};n&&(a.flushAt=1,a.flushInterval=0),this._posthogNodeClient=new t(this.PROJECT_API_KEY,a),ke.debug("PostHog Node.js client initialized")}catch(t){ke.warn(`Failed to initialize PostHog Node.js telemetry: ${t}`),this._posthogNodeClient=null}}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return gi.instance||(gi.instance=new gi),gi.instance}setSource(t){this._source=t,ke.debug(`Telemetry source set to: ${t}`)}getSource(){return this._source}get isEnabled(){return this._posthogNodeClient!==null||this._posthogBrowserClient!==null||this._scarfClient!==null}get userId(){if(this._currUserId)return this._currUserId;try{switch(this._storageCapability){case"filesystem":this._currUserId=this._getUserIdFromFilesystem();break;case"localStorage":this._currUserId=this._getUserIdFromLocalStorage();break;case"session-only":default:this._currUserId=`session-${Yf()}`,ke.debug(`Using session-based user ID (${this._runtimeEnvironment} environment)`);break}this._storageCapability==="filesystem"&&this._currUserId&&this._trackPackageDownloadInternal(this._currUserId,{triggered_by:"user_id_property"}).catch(t=>ke.debug(`Failed to track package download: ${t}`))}catch(t){ke.debug(`Failed to get/create user ID: ${t}`),this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}_getUserIdFromFilesystem(){const t=ks("fs"),n=ks("os"),a=ks("path");if(this._userIdPath||(this._userIdPath=a.join(this._getCacheHome(n,a),"mcp_use_3","telemetry_user_id")),!t.existsSync(this._userIdPath)){ke.debug(`Creating user ID path: ${this._userIdPath}`),t.mkdirSync(a.dirname(this._userIdPath),{recursive:!0});const i=Yf();return t.writeFileSync(this._userIdPath,i),ke.debug(`User ID path created: ${this._userIdPath}`),i}return t.readFileSync(this._userIdPath,"utf-8").trim()}_getUserIdFromLocalStorage(){try{let t=localStorage.getItem(uM);return t||(t=Yf(),localStorage.setItem(uM,t),ke.debug("Created new browser user ID")),t}catch(t){return ke.debug(`localStorage access failed: ${t}`),`session-${Yf()}`}}_getCacheHome(t,n){const a=Tb.XDG_CACHE_HOME;if(a&&n.isAbsolute(a))return a;const r=t.homedir();return n.join(r,".cache")}async capture(t){if(this._posthogLoading&&await this._posthogLoading,!this._posthogNodeClient&&!this._posthogBrowserClient&&!this._scarfClient)return;const n={...t.properties};if(n.mcp_use_version=Jb(),n.language="typescript",n.source=this._source,n.runtime=this._runtimeEnvironment,this._posthogNodeClient)try{ke.debug(`CAPTURE: PostHog Node Event ${t.name}`),this._posthogNodeClient.capture({distinctId:this.userId,event:t.name,properties:n})}catch(a){ke.debug(`Failed to track PostHog Node event ${t.name}: ${a}`)}if(this._posthogBrowserClient)try{ke.debug(`CAPTURE: PostHog Browser Event ${t.name}`),this._posthogBrowserClient.capture(t.name,{...n,distinct_id:this.userId})}catch(a){ke.debug(`Failed to track PostHog Browser event ${t.name}: ${a}`)}if(this._scarfClient)try{const a={...n,user_id:this.userId,event:t.name};await this._scarfClient.logEvent(a)}catch(a){ke.debug(`Failed to track Scarf event ${t.name}: ${a}`)}}async trackPackageDownload(t){return this._trackPackageDownloadInternal(this.userId,t)}async _trackPackageDownloadInternal(t,n){if(this._scarfClient&&this._storageCapability==="filesystem")try{const a=ks("fs"),r=ks("path"),i=ks("os");this._versionDownloadPath||(this._versionDownloadPath=r.join(this._getCacheHome(i,r),"mcp_use","download_version"));const s=Jb();let c=!1,u=!1;if(!a.existsSync(this._versionDownloadPath))c=!0,u=!0,a.mkdirSync(r.dirname(this._versionDownloadPath),{recursive:!0}),a.writeFileSync(this._versionDownloadPath,s);else{const d=a.readFileSync(this._versionDownloadPath,"utf-8").trim();s>d&&(c=!0,u=!1,a.writeFileSync(this._versionDownloadPath,s))}if(c){ke.debug(`Tracking package download event with properties: ${JSON.stringify(n)}`);const d={...n||{}};d.mcp_use_version=s,d.user_id=t,d.event="package_download",d.first_download=u,d.language="typescript",d.source=this._source,d.runtime=this._runtimeEnvironment,await this._scarfClient.logEvent(d)}}catch(a){ke.debug(`Failed to track Scarf package_download event: ${a}`)}}async trackAgentExecution(t){if(!this.isEnabled)return;const n=new vJ(t);await this.capture(n)}async trackServerRunFromServer(t,n){if(!this.isEnabled)return;const a=fF(t,n),r=new yJ(a);await this.capture(r)}async trackServerInitialize(t){if(!this.isEnabled)return;const n=new wJ(t);await this.capture(n)}async trackServerToolCall(t){if(!this.isEnabled)return;const n=new SJ(t);await this.capture(n)}async trackServerResourceCall(t){if(!this.isEnabled)return;const n=new xJ(t);await this.capture(n)}async trackServerPromptCall(t){if(!this.isEnabled)return;const n=new _J(t);await this.capture(n)}async trackServerContext(t){if(!this.isEnabled)return;const n=new EJ(t);await this.capture(n)}async trackMCPClientInit(t){if(!this.isEnabled)return;const n=new kJ(t);await this.capture(n)}async trackConnectorInit(t){if(!this.isEnabled)return;const n=new TJ(t);await this.capture(n)}async trackClientAddServer(t,n){if(!this.isEnabled)return;const a=new NJ({serverName:t,serverConfig:n});await this.capture(a)}async trackClientRemoveServer(t){if(!this.isEnabled)return;const n=new CJ({serverName:t});await this.capture(n)}async trackUseMcpConnection(t){this.isEnabled&&await this.capture({name:"usemcp_connection",properties:{url_domain:new URL(t.url).hostname,transport_type:t.transportType,success:t.success,error_type:t.errorType??null,connection_time_ms:t.connectionTimeMs??null,has_oauth:t.hasOAuth,has_sampling:t.hasSampling,has_elicitation:t.hasElicitation}})}async trackUseMcpToolCall(t){this.isEnabled&&await this.capture({name:"usemcp_tool_call",properties:{tool_name:t.toolName,success:t.success,error_type:t.errorType??null,execution_time_ms:t.executionTimeMs??null}})}async trackUseMcpResourceRead(t){this.isEnabled&&await this.capture({name:"usemcp_resource_read",properties:{resource_uri_scheme:t.resourceUri.split(":")[0],success:t.success,error_type:t.errorType??null}})}identify(t,n){if(this._posthogBrowserClient)try{this._posthogBrowserClient.identify(t,n)}catch(a){ke.debug(`Failed to identify user: ${a}`)}}reset(){if(this._posthogBrowserClient)try{this._posthogBrowserClient.reset()}catch(t){ke.debug(`Failed to reset user: ${t}`)}this._currUserId=null}flush(){if(this._posthogNodeClient)try{this._posthogNodeClient.flush(),ke.debug("PostHog client telemetry queue flushed")}catch(t){ke.debug(`Failed to flush PostHog client: ${t}`)}}shutdown(){if(this._posthogNodeClient)try{this._posthogNodeClient.shutdown(),ke.debug("PostHog client shutdown successfully")}catch(t){ke.debug(`Error shutting down PostHog client: ${t}`)}}},ze(gi,"Telemetry"),Pf(gi,"instance",null),gi),zi=vF;function IJ(e){zi.getInstance().setSource(e)}ze(IJ,"setTelemetrySource");const yF=Object.freeze({status:"aborted"});function me(e,t,n){function a(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const d=s.prototype,m=Object.keys(d);for(let h=0;h<m.length;h++){const g=m[h];g in c||(c[g]=d[g].bind(c))}}const r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(c){var u;const d=n?.Parent?new i:this;a(d,c),(u=d._zod).deferred??(u.deferred=[]);for(const m of d._zod.deferred)m();return d}return Object.defineProperty(s,"init",{value:a}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}const wF=Symbol("zod_brand");class jl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ry extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Qb={};function Gr(e){return e&&Object.assign(Qb,e),Qb}function OJ(e){return e}function DJ(e){return e}function jJ(e){}function LJ(e){throw new Error("Unexpected value in exhaustive check")}function $J(e){}function ok(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,r])=>t.indexOf(+a)===-1).map(([a,r])=>r)}function Pe(e,t="|"){return e.map(n=>ut(n)).join(t)}function ev(e,t){return typeof t=="bigint"?t.toString():t}function cm(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ql(e){return e==null}function ay(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function SF(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let r=(a.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(a)){const u=a.match(/\d?e-(\d?)/);u?.[1]&&(r=Number.parseInt(u[1]))}const i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return s%c/10**i}const dM=Symbol("evaluating");function Ht(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==dM)return a===void 0&&(a=dM,a=n()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function MJ(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Gs(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Bo(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function PJ(e){return Bo(e._zod.def)}function UJ(e,t){return t?t.reduce((n,a)=>n?.[a],e):e}function zJ(e){const t=Object.keys(e),n=t.map(a=>e[a]);return Promise.all(n).then(a=>{const r={};for(let i=0;i<t.length;i++)r[t[i]]=a[i];return r})}function FJ(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let a=0;a<e;a++)n+=t[Math.floor(Math.random()*t.length)];return n}function r_(e){return JSON.stringify(e)}function xF(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const sk="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Xu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const _F=cm(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function zl(e){if(Xu(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Xu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function iy(e){return zl(e)?{...e}:Array.isArray(e)?[...e]:e}function BJ(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const HJ=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},tv=new Set(["string","number","symbol"]),EF=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Lo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ni(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(a._zod.parent=e),a}function Ie(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function VJ(e){let t;return new Proxy({},{get(n,a,r){return t??(t=e()),Reflect.get(t,a,r)},set(n,a,r,i){return t??(t=e()),Reflect.set(t,a,r,i)},has(n,a){return t??(t=e()),Reflect.has(t,a)},deleteProperty(n,a){return t??(t=e()),Reflect.deleteProperty(t,a)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,a){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(n,a,r){return t??(t=e()),Reflect.defineProperty(t,a,r)}})}function ut(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function kF(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const TF={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},NF={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function CF(e,t){const n=e._zod.def,a=Bo(e._zod.def,{get shape(){const r={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=n.shape[i])}return Gs(this,"shape",r),r},checks:[]});return ni(e,a)}function RF(e,t){const n=e._zod.def,a=Bo(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return Gs(this,"shape",r),r},checks:[]});return ni(e,a)}function AF(e,t){if(!zl(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const r=Bo(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Gs(this,"shape",i),i},checks:[]});return ni(e,r)}function IF(e,t){if(!zl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const a={...e._zod.def.shape,...t};return Gs(this,"shape",a),a},checks:e._zod.def.checks};return ni(e,n)}function OF(e,t){const n=Bo(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return Gs(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return ni(e,n)}function DF(e,t,n){const a=Bo(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)i[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return Gs(this,"shape",i),i},checks:[]});return ni(t,a)}function jF(e,t,n){const a=Bo(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return Gs(this,"shape",i),i},checks:[]});return ni(t,a)}function Cl(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function bi(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function qf(e){return typeof e=="string"?e:e?.message}function ti(e,t,n){const a={...e,path:e.path??[]};if(!e.message){const r=qf(e.inst?._zod.def?.error?.(e))??qf(t?.error?.(e))??qf(n.customError?.(e))??qf(n.localeError?.(e))??"Invalid input";a.message=r}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function oy(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function sy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ju(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}function GJ(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function LF(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function $F(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function WJ(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return LF(t+n)}function KJ(e){return $F(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ZJ(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let a=0;a<t.length;a+=2)n[a/2]=Number.parseInt(t.slice(a,a+2),16);return n}function YJ(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class qJ{constructor(...t){}}const MF=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:NF,Class:qJ,NUMBER_FORMAT_RANGES:TF,aborted:Cl,allowsEval:_F,assert:$J,assertEqual:OJ,assertIs:jJ,assertNever:LJ,assertNotEqual:DJ,assignProp:Gs,base64ToUint8Array:LF,base64urlToUint8Array:WJ,cached:cm,captureStackTrace:sk,cleanEnum:GJ,cleanRegex:ay,clone:ni,cloneDef:PJ,createTransparentProxy:VJ,defineLazy:Ht,esc:r_,escapeRegex:Lo,extend:AF,finalizeIssue:ti,floatSafeRemainder:SF,getElementAtPath:UJ,getEnumValues:ok,getLengthableOrigin:sy,getParsedType:HJ,getSizableOrigin:oy,hexToUint8Array:ZJ,isObject:Xu,isPlainObject:zl,issue:Ju,joinValues:Pe,jsonStringifyReplacer:ev,merge:OF,mergeDefs:Bo,normalizeParams:Ie,nullish:Ql,numKeys:BJ,objectClone:MJ,omit:RF,optionalKeys:kF,partial:DF,pick:CF,prefixIssues:bi,primitiveTypes:EF,promiseAllObject:zJ,propertyKeyTypes:tv,randomString:FJ,required:jF,safeExtend:IF,shallowClone:iy,slugify:xF,stringifyPrimitive:ut,uint8ArrayToBase64:$F,uint8ArrayToBase64url:KJ,uint8ArrayToHex:YJ,unwrapMessage:qf},Symbol.toStringTag,{value:"Module"})),PF=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ev,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lk=me("$ZodError",PF),Ma=me("$ZodError",PF,{Parent:Error});function ck(e,t=n=>n.message){const n={},a=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):a.push(t(r));return{formErrors:a,fieldErrors:n}}function uk(e,t=n=>n.message){const n={_errors:[]},a=r=>{for(const i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>a({issues:s}));else if(i.code==="invalid_key")a({issues:i.issues});else if(i.code==="invalid_element")a({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(i))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return a(e),n}function UF(e,t=n=>n.message){const n={errors:[]},a=(r,i=[])=>{var s,c;for(const u of r.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>a({issues:d},u.path));else if(u.code==="invalid_key")a({issues:u.issues},u.path);else if(u.code==="invalid_element")a({issues:u.issues},u.path);else{const d=[...i,...u.path];if(d.length===0){n.errors.push(t(u));continue}let m=n,h=0;for(;h<d.length;){const g=d[h],v=h===d.length-1;typeof g=="string"?(m.properties??(m.properties={}),(s=m.properties)[g]??(s[g]={errors:[]}),m=m.properties[g]):(m.items??(m.items=[]),(c=m.items)[g]??(c[g]={errors:[]}),m=m.items[g]),v&&m.errors.push(t(u)),h++}}};return a(e),n}function zF(e){const t=[],n=e.map(a=>typeof a=="object"?a.key:a);for(const a of n)typeof a=="number"?t.push(`[${a}]`):typeof a=="symbol"?t.push(`[${JSON.stringify(String(a))}]`):/[^\w$]/.test(a)?t.push(`[${JSON.stringify(a)}]`):(t.length&&t.push("."),t.push(a));return t.join("")}function FF(e){const t=[],n=[...e.issues].sort((a,r)=>(a.path??[]).length-(r.path??[]).length);for(const a of n)t.push(`✖ ${a.message}`),a.path?.length&&t.push(` → at ${zF(a.path)}`);return t.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-CDkaxt_Q.js","assets/util-t-trnxQI.js","assets/index-DRz5BQNA.js","assets/path-Dubn5ZXB.js","assets/fs-u42MReIY.js","assets/path-MNZaYwxc.js","assets/index-D-OMhIK9.js","assets/index-t0uG7tP6.js","assets/index-Cs2Qhtuo.js","assets/llms-CiEeBXg6.js","assets/embeddings-CpzGcA5C.js","assets/index-3gD6WWVL.js","assets/index-CVD-P0xp.js","assets/index-ll3isPzo.js","assets/browser-CLu-Wczi.js"])))=>i.map(i=>d[i]);
2
+ var oJ=Object.defineProperty;var sJ=(e,t,n)=>t in e?oJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pf=(e,t,n)=>sJ(e,typeof t!="symbol"?t+"":t,n);function lJ(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(a,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();function ny(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function JTe(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function a(){var r=!1;try{r=this instanceof a}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}),n}var $S={exports:{}},Uf={};var sM;function cJ(){if(sM)return Uf;sM=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,r,i){var s=null;if(i!==void 0&&(s=""+i),r.key!==void 0&&(s=""+r.key),"key"in r){i={};for(var c in r)c!=="key"&&(i[c]=r[c])}else i=r;return r=i.ref,{$$typeof:e,type:a,key:s,ref:r!==void 0?r:null,props:i}}return Uf.Fragment=t,Uf.jsx=n,Uf.jsxs=n,Uf}var lM;function uJ(){return lM||(lM=1,$S.exports=cJ()),$S.exports}var f=uJ();const dJ="modulepreload",fJ=function(e){return"/inspector/"+e},cM={},Jn=function(t,n,a){let r=Promise.resolve();if(n&&n.length>0){let u=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=s?.nonce||s?.getAttribute("nonce");r=u(n.map(d=>{if(d=fJ(d),d in cM)return;cM[d]=!0;const m=d.endsWith(".css"),h=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":dJ,m||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),m)return new Promise((v,x)=>{g.addEventListener("load",v),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return r.then(s=>{for(const c of s||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};var pJ=Object.defineProperty,ze=(e,t)=>pJ(e,"name",{value:t,configurable:!0}),ks=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Xc={};async function sF(){if(typeof process<"u")try{const e=await Jn(()=>import("./fs-u42MReIY.js").then(n=>n.f),[]),t=await Jn(()=>import("./path-MNZaYwxc.js").then(n=>n.p),[]);return{fs:e.default,path:t.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}ze(sF,"getNodeModules");var ha=null;function lF(){if(typeof ks<"u")try{ha=ks("winston")}catch{}}ze(lF,"loadWinstonSync");async function cF(){return ha||(ha=await Jn(()=>import("./winston-CDkaxt_Q.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4,5]))),ha}ze(cF,"getWinston");var n_="mcp-use";function Xb(){try{return typeof navigator<"u"&&navigator.userAgent?.includes("Cloudflare-Workers")||typeof globalThis.EdgeRuntime<"u"||typeof globalThis.Deno<"u"?!1:typeof process<"u"&&!0&&typeof __dirname<"u"}catch{return!1}}ze(Xb,"isNodeJSEnvironment");var Ru,mJ=(Ru=class{_level;name;constructor(t=n_,n="info"){this.name=t,this._level=n}shouldLog(t){const n=["error","warn","info","http","verbose","debug","silly"],a=n.indexOf(this._level);return n.indexOf(t)<=a}formatMessage(t,n){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${t}: ${n}`}error(t){this.shouldLog("error")&&console.error(this.formatMessage("error",t))}warn(t){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",t))}info(t){this.shouldLog("info")&&console.info(this.formatMessage("info",t))}debug(t){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",t))}http(t){this.shouldLog("http")&&console.log(this.formatMessage("http",t))}verbose(t){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",t))}silly(t){this.shouldLog("silly")&&console.log(this.formatMessage("silly",t))}get level(){return this._level}set level(t){this._level=t}},ze(Ru,"SimpleConsoleLogger"),Ru);function kb(e){switch((typeof process<"u"&&Xc?e:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}ze(kb,"resolveLevel");var ko,uF=(ko=class{static get(t=n_){if(!Xb()){if(!this.simpleInstances[t]){const n=typeof process<"u"&&Xc?.DEBUG||void 0;this.simpleInstances[t]=new mJ(t,kb(n))}return this.simpleInstances[t]}if(!this.instances[t]){if(!ha)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:n,format:a}=ha,{combine:r,timestamp:i,label:s,colorize:c,splat:u}=a;this.instances[t]=n({level:kb(Xc.DEBUG),format:r(c(),u(),s({label:t}),i({format:"HH:mm:ss"}),this.getFormatter()),transports:[new ha.transports.Console]})}return this.instances[t]}static getFormatter(){if(!ha)throw new Error("Winston not loaded");const{format:t}=ha,{printf:n}=t,a=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s}: ${c}`),r=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`),i=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return a;case"detailed":return r;case"emoji":return i;default:return a}}static async configure(t={}){const{level:n,console:a=!0,file:r,format:i="minimal"}=t,s=typeof process<"u"&&Xc?.DEBUG||void 0,c=n??kb(s);if(this.currentFormat=i,!Xb()){Object.values(this.simpleInstances).forEach(y=>{y.level=c});return}if(await cF(),!ha)throw new Error("Failed to load winston");const u=this.get();u.level=c;const d=u;if(d.clear(),a&&d.add(new ha.transports.Console),r){const{fs:y,path:E}=await sF();if(y&&E){const _=E.dirname(E.resolve(r));y.existsSync(_)||y.mkdirSync(_,{recursive:!0}),d.add(new ha.transports.File({filename:r}))}}const{format:m}=ha,{combine:h,timestamp:g,label:v,colorize:x,splat:S}=m;Object.values(this.instances).forEach(y=>{y&&"format"in y&&(y.level=c,y.format=h(x(),S(),v({label:n_}),g({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(t){let n;t===2||t===!0?n="debug":n="info",Object.values(this.simpleInstances).forEach(a=>{a.level=n}),Object.values(this.instances).forEach(a=>{a&&(a.level=n)}),typeof process<"u"&&Xc&&(Xc.DEBUG=t?t===!0?"2":String(t):"0")}static setFormat(t){this.currentFormat=t,this.configure({format:t})}},ze(ko,"Logger"),Pf(ko,"instances",{}),Pf(ko,"simpleInstances",{}),Pf(ko,"currentFormat","minimal"),ko);Xb()&&(lF(),ha&&uF.configure());var ke=uF.get(),Tb={},dF=typeof globalThis.Deno<"u";function hJ(e){return dF?globalThis.Deno.env.get(e):Tb[e]}ze(hJ,"getEnv");function gJ(){return dF?globalThis.Deno.cwd():process.cwd()}ze(gJ,"getCwd");function Yf(){return globalThis.crypto.randomUUID()}ze(Yf,"generateUUID");var bJ="1.11.0-canary.15";function Jb(){return bJ}ze(Jb,"getPackageVersion");var Au,Ci=(Au=class{},ze(Au,"BaseTelemetryEvent"),Au),Iu,vJ=(Iu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"mcp_agent_execution"}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}},ze(Iu,"MCPAgentExecutionEvent"),Iu);function fF(e,t){const n=Array.from(e.registrations.tools.values()),a=Array.from(e.registrations.prompts.values()),r=Array.from(e.registrations.resources.values()),i=Array.from(e.registrations.resourceTemplates.values()),s=r.map(m=>({name:m.config.name,title:m.config.title??null,description:m.config.description??null,uri:m.config.uri??null,mime_type:m.config.mimeType??null})),c=s.filter(m=>m.mime_type==="text/html+skybridge"),u=s.filter(m=>m.mime_type==="text/uri-list"||m.mime_type==="text/html"),d=s.filter(m=>m.mime_type==="text/html+mcp");return{transport:t,toolsNumber:e.registeredTools.length,resourcesNumber:e.registeredResources.length,promptsNumber:e.registeredPrompts.length,auth:!!e.oauthProvider,name:e.config.name,description:e.config.description??null,baseUrl:e.serverBaseUrl??null,toolNames:e.registeredTools.length>0?e.registeredTools:null,resourceNames:e.registeredResources.length>0?e.registeredResources:null,promptNames:e.registeredPrompts.length>0?e.registeredPrompts:null,tools:n.length>0?n.map(m=>({name:m.config.name,title:m.config.title??null,description:m.config.description??null,input_schema:m.config.schema?JSON.stringify(m.config.schema):null,output_schema:m.config.outputSchema?JSON.stringify(m.config.outputSchema):null})):null,resources:s.length>0?s:null,prompts:a.length>0?a.map(m=>({name:m.config.name,title:m.config.title??null,description:m.config.description??null,args:m.config.args?JSON.stringify(m.config.args):null})):null,templates:i.length>0?i.map(m=>({name:m.config.name,title:m.config.title??null,description:m.config.description??null})):null,capabilities:{logging:!0,resources:{subscribe:!0,listChanged:!0}},appsSdkResources:c.length>0?c:null,appsSdkResourcesNumber:c.length,mcpUiResources:u.length>0?u:null,mcpUiResourcesNumber:u.length,mcpAppsResources:d.length>0?d:null,mcpAppsResourcesNumber:d.length}}ze(fF,"createServerRunEventData");var Ou,yJ=(Ou=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_run"}get properties(){return{transport:this.data.transport,tools_number:this.data.toolsNumber,resources_number:this.data.resourcesNumber,prompts_number:this.data.promptsNumber,auth:this.data.auth,name:this.data.name,description:this.data.description??null,base_url:this.data.baseUrl??null,tool_names:this.data.toolNames??null,resource_names:this.data.resourceNames??null,prompt_names:this.data.promptNames??null,tools:this.data.tools??null,resources:this.data.resources??null,prompts:this.data.prompts??null,templates:this.data.templates??null,capabilities:this.data.capabilities?JSON.stringify(this.data.capabilities):null,apps_sdk_resources:this.data.appsSdkResources?JSON.stringify(this.data.appsSdkResources):null,apps_sdk_resources_number:this.data.appsSdkResourcesNumber??0,mcp_ui_resources:this.data.mcpUiResources?JSON.stringify(this.data.mcpUiResources):null,mcp_ui_resources_number:this.data.mcpUiResourcesNumber??0,mcp_apps_resources:this.data.mcpAppsResources?JSON.stringify(this.data.mcpAppsResources):null,mcp_apps_resources_number:this.data.mcpAppsResourcesNumber??0}}},ze(Ou,"ServerRunEvent"),Ou),Du,wJ=(Du=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_initialize_call"}get properties(){return{protocol_version:this.data.protocolVersion,client_info:JSON.stringify(this.data.clientInfo),client_capabilities:JSON.stringify(this.data.clientCapabilities),session_id:this.data.sessionId??null}}},ze(Du,"ServerInitializeEvent"),Du),ju,SJ=(ju=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_tool_call"}get properties(){return{tool_name:this.data.toolName,length_input_argument:this.data.lengthInputArgument,success:this.data.success,error_type:this.data.errorType??null,execution_time_ms:this.data.executionTimeMs??null}}},ze(ju,"ServerToolCallEvent"),ju),Lu,xJ=(Lu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_resource_call"}get properties(){return{name:this.data.name,description:this.data.description,contents:this.data.contents,success:this.data.success,error_type:this.data.errorType??null}}},ze(Lu,"ServerResourceCallEvent"),Lu),$u,_J=($u=class extends Ci{constructor(t){super(),this.data=t}get name(){return"server_prompt_call"}get properties(){return{name:this.data.name,description:this.data.description,success:this.data.success,error_type:this.data.errorType??null}}},ze($u,"ServerPromptCallEvent"),$u),Mu,EJ=(Mu=class extends Ci{constructor(t){super(),this.data=t}get name(){return`server_context_${this.data.contextType}`}get properties(){return{context_type:this.data.contextType,notification_type:this.data.notificationType??null}}},ze(Mu,"ServerContextEvent"),Mu),Pu,kJ=(Pu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"mcpclient_init"}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},ze(Pu,"MCPClientInitEvent"),Pu),Uu,TJ=(Uu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"connector_init"}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},ze(Uu,"ConnectorInitEvent"),Uu),zu,NJ=(zu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"client_add_server"}get properties(){const{serverName:t,serverConfig:n}=this.data,a=n.url;return{server_name:t,server_url_domain:a?this._extractHostname(a):null,transport:n.transport??null,has_auth:!!(n.authToken||n.authProvider)}}_extractHostname(t){try{return new URL(t).hostname}catch{return null}}},ze(zu,"ClientAddServerEvent"),zu),Fu,CJ=(Fu=class extends Ci{constructor(t){super(),this.data=t}get name(){return"client_remove_server"}get properties(){return{server_name:this.data.serverName}}},ze(Fu,"ClientRemoveServerEvent"),Fu);function pF(e){return e._llm_type||e.constructor.name.toLowerCase()}ze(pF,"getModelProvider");function mF(e){if("_identifyingParams"in e){const t=e._identifyingParams;if(typeof t=="object"&&t!==null){for(const n of["model","modelName","model_name","modelId","model_id","deploymentName","deployment_name"])if(n in t)return String(t[n])}}return e.model||e.modelName||e.constructor.name}ze(mF,"getModelName");function RJ(e){return[pF(e),mF(e)]}ze(RJ,"extractModelInfo");var uM="mcp_use_user_id";function hF(){try{return typeof globalThis.Bun<"u"?"bun":typeof globalThis.Deno<"u"?"deno":typeof navigator<"u"&&navigator.userAgent?.includes("Cloudflare-Workers")?"cloudflare-workers":typeof globalThis.EdgeRuntime<"u"?"edge":typeof window<"u"&&typeof document<"u"?"browser":typeof process<"u"&&typeof process.versions?.node<"u"?"node":"unknown"}catch{return"unknown"}}ze(hF,"detectRuntimeEnvironment");function gF(e){switch(e){case"node":case"bun":return"filesystem";case"browser":try{if(typeof localStorage<"u")return localStorage.setItem("__mcp_use_test__","1"),localStorage.removeItem("__mcp_use_test__"),"localStorage"}catch{}return"session-only";case"deno":return"session-only";default:return"session-only"}}ze(gF,"getStorageCapability");var MS=null;function bF(){return MS===null&&(MS=hF()),MS}ze(bF,"getRuntimeEnvironment");var Bu,AJ=(Bu=class{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,a=setTimeout(()=>n.abort(),this.timeout),r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(a),!r.ok)throw new Error(`HTTP error! status: ${r.status}`)}catch(n){ke.debug(`Failed to send Scarf event: ${n}`)}}},ze(Bu,"ScarfEventLogger"),Bu),gi,vF=(gi=class{PROJECT_API_KEY="phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI";HOST="https://eu.i.posthog.com";SCARF_GATEWAY_URL="https://mcpuse.gateway.scarf.sh/events-ts";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogNodeClient=null;_posthogBrowserClient=null;_posthogLoading=null;_scarfClient=null;_runtimeEnvironment;_storageCapability;_source;_userIdPath=null;_versionDownloadPath=null;constructor(){this._runtimeEnvironment=bF(),this._storageCapability=gF(this._runtimeEnvironment),this._source=typeof process<"u"&&Tb?.MCP_USE_TELEMETRY_SOURCE||this._runtimeEnvironment;const t=this._checkTelemetryDisabled(),n=this._runtimeEnvironment!=="unknown";if(t)this._posthogNodeClient=null,this._posthogBrowserClient=null,this._scarfClient=null,ke.debug("Telemetry disabled via environment/localStorage");else if(!n)this._posthogNodeClient=null,this._posthogBrowserClient=null,this._scarfClient=null,ke.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`);else{ke.info("Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."),this._posthogLoading=this._initPostHog();try{this._scarfClient=new AJ(this.SCARF_GATEWAY_URL,3e3)}catch(a){ke.warn(`Failed to initialize Scarf telemetry: ${a}`),this._scarfClient=null}}}_checkTelemetryDisabled(){return typeof process<"u"&&Tb?.MCP_USE_ANONYMIZED_TELEMETRY?.toLowerCase()==="false"||typeof localStorage<"u"&&localStorage.getItem("MCP_USE_ANONYMIZED_TELEMETRY")==="false"}async _initPostHog(){this._runtimeEnvironment==="browser"?await this._initPostHogBrowser():await this._initPostHogNode()}async _initPostHogBrowser(){try{const t=await Jn(()=>import("./module-D4IOASh4.js"),[]),n=t.default||t.posthog;if(!n||typeof n.init!="function")throw new Error("posthog-js module did not export expected interface");n.init(this.PROJECT_API_KEY,{api_host:this.HOST,persistence:"localStorage",autocapture:!1,capture_pageview:!1,disable_session_recording:!0,loaded:ze(()=>{ke.debug("PostHog browser client initialized")},"loaded")}),this._posthogBrowserClient=n}catch(t){ke.warn(`Failed to initialize PostHog browser telemetry: ${t}`),this._posthogBrowserClient=null}}async _initPostHogNode(){try{const{PostHog:t}=await Jn(async()=>{const{PostHog:r}=await import("./posthog-node-CuYhrq1Q.js");return{PostHog:r}},[]),n=["cloudflare-workers","edge","deno"].includes(this._runtimeEnvironment),a={host:this.HOST,disableGeoip:!1};n&&(a.flushAt=1,a.flushInterval=0),this._posthogNodeClient=new t(this.PROJECT_API_KEY,a),ke.debug("PostHog Node.js client initialized")}catch(t){ke.warn(`Failed to initialize PostHog Node.js telemetry: ${t}`),this._posthogNodeClient=null}}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return gi.instance||(gi.instance=new gi),gi.instance}setSource(t){this._source=t,ke.debug(`Telemetry source set to: ${t}`)}getSource(){return this._source}get isEnabled(){return this._posthogNodeClient!==null||this._posthogBrowserClient!==null||this._scarfClient!==null}get userId(){if(this._currUserId)return this._currUserId;try{switch(this._storageCapability){case"filesystem":this._currUserId=this._getUserIdFromFilesystem();break;case"localStorage":this._currUserId=this._getUserIdFromLocalStorage();break;case"session-only":default:this._currUserId=`session-${Yf()}`,ke.debug(`Using session-based user ID (${this._runtimeEnvironment} environment)`);break}this._storageCapability==="filesystem"&&this._currUserId&&this._trackPackageDownloadInternal(this._currUserId,{triggered_by:"user_id_property"}).catch(t=>ke.debug(`Failed to track package download: ${t}`))}catch(t){ke.debug(`Failed to get/create user ID: ${t}`),this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}_getUserIdFromFilesystem(){const t=ks("fs"),n=ks("os"),a=ks("path");if(this._userIdPath||(this._userIdPath=a.join(this._getCacheHome(n,a),"mcp_use_3","telemetry_user_id")),!t.existsSync(this._userIdPath)){ke.debug(`Creating user ID path: ${this._userIdPath}`),t.mkdirSync(a.dirname(this._userIdPath),{recursive:!0});const i=Yf();return t.writeFileSync(this._userIdPath,i),ke.debug(`User ID path created: ${this._userIdPath}`),i}return t.readFileSync(this._userIdPath,"utf-8").trim()}_getUserIdFromLocalStorage(){try{let t=localStorage.getItem(uM);return t||(t=Yf(),localStorage.setItem(uM,t),ke.debug("Created new browser user ID")),t}catch(t){return ke.debug(`localStorage access failed: ${t}`),`session-${Yf()}`}}_getCacheHome(t,n){const a=Tb.XDG_CACHE_HOME;if(a&&n.isAbsolute(a))return a;const r=t.homedir();return n.join(r,".cache")}async capture(t){if(this._posthogLoading&&await this._posthogLoading,!this._posthogNodeClient&&!this._posthogBrowserClient&&!this._scarfClient)return;const n={...t.properties};if(n.mcp_use_version=Jb(),n.language="typescript",n.source=this._source,n.runtime=this._runtimeEnvironment,this._posthogNodeClient)try{ke.debug(`CAPTURE: PostHog Node Event ${t.name}`),this._posthogNodeClient.capture({distinctId:this.userId,event:t.name,properties:n})}catch(a){ke.debug(`Failed to track PostHog Node event ${t.name}: ${a}`)}if(this._posthogBrowserClient)try{ke.debug(`CAPTURE: PostHog Browser Event ${t.name}`),this._posthogBrowserClient.capture(t.name,{...n,distinct_id:this.userId})}catch(a){ke.debug(`Failed to track PostHog Browser event ${t.name}: ${a}`)}if(this._scarfClient)try{const a={...n,user_id:this.userId,event:t.name};await this._scarfClient.logEvent(a)}catch(a){ke.debug(`Failed to track Scarf event ${t.name}: ${a}`)}}async trackPackageDownload(t){return this._trackPackageDownloadInternal(this.userId,t)}async _trackPackageDownloadInternal(t,n){if(this._scarfClient&&this._storageCapability==="filesystem")try{const a=ks("fs"),r=ks("path"),i=ks("os");this._versionDownloadPath||(this._versionDownloadPath=r.join(this._getCacheHome(i,r),"mcp_use","download_version"));const s=Jb();let c=!1,u=!1;if(!a.existsSync(this._versionDownloadPath))c=!0,u=!0,a.mkdirSync(r.dirname(this._versionDownloadPath),{recursive:!0}),a.writeFileSync(this._versionDownloadPath,s);else{const d=a.readFileSync(this._versionDownloadPath,"utf-8").trim();s>d&&(c=!0,u=!1,a.writeFileSync(this._versionDownloadPath,s))}if(c){ke.debug(`Tracking package download event with properties: ${JSON.stringify(n)}`);const d={...n||{}};d.mcp_use_version=s,d.user_id=t,d.event="package_download",d.first_download=u,d.language="typescript",d.source=this._source,d.runtime=this._runtimeEnvironment,await this._scarfClient.logEvent(d)}}catch(a){ke.debug(`Failed to track Scarf package_download event: ${a}`)}}async trackAgentExecution(t){if(!this.isEnabled)return;const n=new vJ(t);await this.capture(n)}async trackServerRunFromServer(t,n){if(!this.isEnabled)return;const a=fF(t,n),r=new yJ(a);await this.capture(r)}async trackServerInitialize(t){if(!this.isEnabled)return;const n=new wJ(t);await this.capture(n)}async trackServerToolCall(t){if(!this.isEnabled)return;const n=new SJ(t);await this.capture(n)}async trackServerResourceCall(t){if(!this.isEnabled)return;const n=new xJ(t);await this.capture(n)}async trackServerPromptCall(t){if(!this.isEnabled)return;const n=new _J(t);await this.capture(n)}async trackServerContext(t){if(!this.isEnabled)return;const n=new EJ(t);await this.capture(n)}async trackMCPClientInit(t){if(!this.isEnabled)return;const n=new kJ(t);await this.capture(n)}async trackConnectorInit(t){if(!this.isEnabled)return;const n=new TJ(t);await this.capture(n)}async trackClientAddServer(t,n){if(!this.isEnabled)return;const a=new NJ({serverName:t,serverConfig:n});await this.capture(a)}async trackClientRemoveServer(t){if(!this.isEnabled)return;const n=new CJ({serverName:t});await this.capture(n)}async trackUseMcpConnection(t){this.isEnabled&&await this.capture({name:"usemcp_connection",properties:{url_domain:new URL(t.url).hostname,transport_type:t.transportType,success:t.success,error_type:t.errorType??null,connection_time_ms:t.connectionTimeMs??null,has_oauth:t.hasOAuth,has_sampling:t.hasSampling,has_elicitation:t.hasElicitation}})}async trackUseMcpToolCall(t){this.isEnabled&&await this.capture({name:"usemcp_tool_call",properties:{tool_name:t.toolName,success:t.success,error_type:t.errorType??null,execution_time_ms:t.executionTimeMs??null}})}async trackUseMcpResourceRead(t){this.isEnabled&&await this.capture({name:"usemcp_resource_read",properties:{resource_uri_scheme:t.resourceUri.split(":")[0],success:t.success,error_type:t.errorType??null}})}identify(t,n){if(this._posthogBrowserClient)try{this._posthogBrowserClient.identify(t,n)}catch(a){ke.debug(`Failed to identify user: ${a}`)}}reset(){if(this._posthogBrowserClient)try{this._posthogBrowserClient.reset()}catch(t){ke.debug(`Failed to reset user: ${t}`)}this._currUserId=null}flush(){if(this._posthogNodeClient)try{this._posthogNodeClient.flush(),ke.debug("PostHog client telemetry queue flushed")}catch(t){ke.debug(`Failed to flush PostHog client: ${t}`)}}shutdown(){if(this._posthogNodeClient)try{this._posthogNodeClient.shutdown(),ke.debug("PostHog client shutdown successfully")}catch(t){ke.debug(`Error shutting down PostHog client: ${t}`)}}},ze(gi,"Telemetry"),Pf(gi,"instance",null),gi),zi=vF;function IJ(e){zi.getInstance().setSource(e)}ze(IJ,"setTelemetrySource");const yF=Object.freeze({status:"aborted"});function me(e,t,n){function a(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const d=s.prototype,m=Object.keys(d);for(let h=0;h<m.length;h++){const g=m[h];g in c||(c[g]=d[g].bind(c))}}const r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(c){var u;const d=n?.Parent?new i:this;a(d,c),(u=d._zod).deferred??(u.deferred=[]);for(const m of d._zod.deferred)m();return d}return Object.defineProperty(s,"init",{value:a}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}const wF=Symbol("zod_brand");class jl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ry extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Qb={};function Gr(e){return e&&Object.assign(Qb,e),Qb}function OJ(e){return e}function DJ(e){return e}function jJ(e){}function LJ(e){throw new Error("Unexpected value in exhaustive check")}function $J(e){}function ok(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,r])=>t.indexOf(+a)===-1).map(([a,r])=>r)}function Pe(e,t="|"){return e.map(n=>ut(n)).join(t)}function ev(e,t){return typeof t=="bigint"?t.toString():t}function cm(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ql(e){return e==null}function ay(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function SF(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let r=(a.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(a)){const u=a.match(/\d?e-(\d?)/);u?.[1]&&(r=Number.parseInt(u[1]))}const i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return s%c/10**i}const dM=Symbol("evaluating");function Ht(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==dM)return a===void 0&&(a=dM,a=n()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function MJ(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Gs(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Bo(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function PJ(e){return Bo(e._zod.def)}function UJ(e,t){return t?t.reduce((n,a)=>n?.[a],e):e}function zJ(e){const t=Object.keys(e),n=t.map(a=>e[a]);return Promise.all(n).then(a=>{const r={};for(let i=0;i<t.length;i++)r[t[i]]=a[i];return r})}function FJ(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let a=0;a<e;a++)n+=t[Math.floor(Math.random()*t.length)];return n}function r_(e){return JSON.stringify(e)}function xF(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const sk="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Xu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const _F=cm(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function zl(e){if(Xu(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Xu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function iy(e){return zl(e)?{...e}:Array.isArray(e)?[...e]:e}function BJ(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const HJ=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},tv=new Set(["string","number","symbol"]),EF=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Lo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ni(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(a._zod.parent=e),a}function Ie(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function VJ(e){let t;return new Proxy({},{get(n,a,r){return t??(t=e()),Reflect.get(t,a,r)},set(n,a,r,i){return t??(t=e()),Reflect.set(t,a,r,i)},has(n,a){return t??(t=e()),Reflect.has(t,a)},deleteProperty(n,a){return t??(t=e()),Reflect.deleteProperty(t,a)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,a){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(n,a,r){return t??(t=e()),Reflect.defineProperty(t,a,r)}})}function ut(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function kF(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const TF={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},NF={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function CF(e,t){const n=e._zod.def,a=Bo(e._zod.def,{get shape(){const r={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=n.shape[i])}return Gs(this,"shape",r),r},checks:[]});return ni(e,a)}function RF(e,t){const n=e._zod.def,a=Bo(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return Gs(this,"shape",r),r},checks:[]});return ni(e,a)}function AF(e,t){if(!zl(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const r=Bo(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Gs(this,"shape",i),i},checks:[]});return ni(e,r)}function IF(e,t){if(!zl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const a={...e._zod.def.shape,...t};return Gs(this,"shape",a),a},checks:e._zod.def.checks};return ni(e,n)}function OF(e,t){const n=Bo(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return Gs(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return ni(e,n)}function DF(e,t,n){const a=Bo(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)i[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return Gs(this,"shape",i),i},checks:[]});return ni(t,a)}function jF(e,t,n){const a=Bo(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return Gs(this,"shape",i),i},checks:[]});return ni(t,a)}function Cl(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function bi(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function qf(e){return typeof e=="string"?e:e?.message}function ti(e,t,n){const a={...e,path:e.path??[]};if(!e.message){const r=qf(e.inst?._zod.def?.error?.(e))??qf(t?.error?.(e))??qf(n.customError?.(e))??qf(n.localeError?.(e))??"Invalid input";a.message=r}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function oy(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function sy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ju(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}function GJ(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function LF(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function $F(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function WJ(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return LF(t+n)}function KJ(e){return $F(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ZJ(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let a=0;a<t.length;a+=2)n[a/2]=Number.parseInt(t.slice(a,a+2),16);return n}function YJ(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class qJ{constructor(...t){}}const MF=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:NF,Class:qJ,NUMBER_FORMAT_RANGES:TF,aborted:Cl,allowsEval:_F,assert:$J,assertEqual:OJ,assertIs:jJ,assertNever:LJ,assertNotEqual:DJ,assignProp:Gs,base64ToUint8Array:LF,base64urlToUint8Array:WJ,cached:cm,captureStackTrace:sk,cleanEnum:GJ,cleanRegex:ay,clone:ni,cloneDef:PJ,createTransparentProxy:VJ,defineLazy:Ht,esc:r_,escapeRegex:Lo,extend:AF,finalizeIssue:ti,floatSafeRemainder:SF,getElementAtPath:UJ,getEnumValues:ok,getLengthableOrigin:sy,getParsedType:HJ,getSizableOrigin:oy,hexToUint8Array:ZJ,isObject:Xu,isPlainObject:zl,issue:Ju,joinValues:Pe,jsonStringifyReplacer:ev,merge:OF,mergeDefs:Bo,normalizeParams:Ie,nullish:Ql,numKeys:BJ,objectClone:MJ,omit:RF,optionalKeys:kF,partial:DF,pick:CF,prefixIssues:bi,primitiveTypes:EF,promiseAllObject:zJ,propertyKeyTypes:tv,randomString:FJ,required:jF,safeExtend:IF,shallowClone:iy,slugify:xF,stringifyPrimitive:ut,uint8ArrayToBase64:$F,uint8ArrayToBase64url:KJ,uint8ArrayToHex:YJ,unwrapMessage:qf},Symbol.toStringTag,{value:"Module"})),PF=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ev,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lk=me("$ZodError",PF),Ma=me("$ZodError",PF,{Parent:Error});function ck(e,t=n=>n.message){const n={},a=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):a.push(t(r));return{formErrors:a,fieldErrors:n}}function uk(e,t=n=>n.message){const n={_errors:[]},a=r=>{for(const i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>a({issues:s}));else if(i.code==="invalid_key")a({issues:i.issues});else if(i.code==="invalid_element")a({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(i))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return a(e),n}function UF(e,t=n=>n.message){const n={errors:[]},a=(r,i=[])=>{var s,c;for(const u of r.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>a({issues:d},u.path));else if(u.code==="invalid_key")a({issues:u.issues},u.path);else if(u.code==="invalid_element")a({issues:u.issues},u.path);else{const d=[...i,...u.path];if(d.length===0){n.errors.push(t(u));continue}let m=n,h=0;for(;h<d.length;){const g=d[h],v=h===d.length-1;typeof g=="string"?(m.properties??(m.properties={}),(s=m.properties)[g]??(s[g]={errors:[]}),m=m.properties[g]):(m.items??(m.items=[]),(c=m.items)[g]??(c[g]={errors:[]}),m=m.items[g]),v&&m.errors.push(t(u)),h++}}};return a(e),n}function zF(e){const t=[],n=e.map(a=>typeof a=="object"?a.key:a);for(const a of n)typeof a=="number"?t.push(`[${a}]`):typeof a=="symbol"?t.push(`[${JSON.stringify(String(a))}]`):/[^\w$]/.test(a)?t.push(`[${JSON.stringify(a)}]`):(t.length&&t.push("."),t.push(a));return t.join("")}function FF(e){const t=[],n=[...e.issues].sort((a,r)=>(a.path??[]).length-(r.path??[]).length);for(const a of n)t.push(`✖ ${a.message}`),a.path?.length&&t.push(` → at ${zF(a.path)}`);return t.join(`
3
3
  `)}const um=e=>(t,n,a,r)=>{const i=a?Object.assign(a,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new jl;if(s.issues.length){const c=new(r?.Err??e)(s.issues.map(u=>ti(u,i,Gr())));throw sk(c,r?.callee),c}return s.value},a_=um(Ma),dm=e=>async(t,n,a,r)=>{const i=a?Object.assign(a,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const c=new(r?.Err??e)(s.issues.map(u=>ti(u,i,Gr())));throw sk(c,r?.callee),c}return s.value},i_=dm(Ma),fm=e=>(t,n,a)=>{const r=a?{...a,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new jl;return i.issues.length?{success:!1,error:new(e??lk)(i.issues.map(s=>ti(s,r,Gr())))}:{success:!0,data:i.value}},dk=fm(Ma),pm=e=>async(t,n,a)=>{const r=a?Object.assign(a,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>ti(s,r,Gr())))}:{success:!0,data:i.value}},BF=pm(Ma),fk=e=>(t,n,a)=>{const r=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return um(e)(t,n,r)},XJ=fk(Ma),pk=e=>(t,n,a)=>um(e)(t,n,a),JJ=pk(Ma),mk=e=>async(t,n,a)=>{const r=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return dm(e)(t,n,r)},QJ=mk(Ma),hk=e=>async(t,n,a)=>dm(e)(t,n,a),eQ=hk(Ma),gk=e=>(t,n,a)=>{const r=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return fm(e)(t,n,r)},tQ=gk(Ma),bk=e=>(t,n,a)=>fm(e)(t,n,a),nQ=bk(Ma),vk=e=>async(t,n,a)=>{const r=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return pm(e)(t,n,r)},rQ=vk(Ma),yk=e=>async(t,n,a)=>pm(e)(t,n,a),aQ=yk(Ma),HF=/^[cC][^\s-]{8,}$/,VF=/^[0-9a-z]+$/,GF=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,WF=/^[0-9a-vA-V]{20}$/,KF=/^[A-Za-z0-9]{27}$/,ZF=/^[a-zA-Z0-9_-]{21}$/,YF=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,iQ=/^[-+]?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)?)??$/,qF=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qu=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,oQ=Qu(4),sQ=Qu(6),lQ=Qu(7),XF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cQ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,uQ=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,JF=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,dQ=JF,fQ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,pQ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function QF(){return new RegExp(pQ,"u")}const e3=/^(?:(?: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])$/,t3=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,n3=e=>{const t=Lo(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},r3=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,a3=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,i3=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wk=/^[A-Za-z0-9_-]*$/,o3=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,s3=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,l3=/^\+(?:[0-9]){6,14}[0-9]$/,c3="(?:(?:\\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])))",u3=new RegExp(`^${c3}$`);function d3(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function f3(e){return new RegExp(`^${d3(e)}$`)}function p3(e){const t=d3({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${c3}T(?:${a})$`)}const m3=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},h3=/^-?\d+n?$/,g3=/^-?\d+$/,b3=/^-?\d+(?:\.\d+)?/,v3=/^(?:true|false)$/i,y3=/^null$/i,w3=/^undefined$/i,S3=/^[^A-Z]*$/,x3=/^[^a-z]*$/,_3=/^[0-9a-fA-F]*$/;function mm(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function hm(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const mQ=/^[0-9a-fA-F]{32}$/,hQ=mm(22,"=="),gQ=hm(22),bQ=/^[0-9a-fA-F]{40}$/,vQ=mm(27,"="),yQ=hm(27),wQ=/^[0-9a-fA-F]{64}$/,SQ=mm(43,"="),xQ=hm(43),_Q=/^[0-9a-fA-F]{96}$/,EQ=mm(64,""),kQ=hm(64),TQ=/^[0-9a-fA-F]{128}$/,NQ=mm(86,"=="),CQ=hm(86),Sk=Object.freeze(Object.defineProperty({__proto__:null,base64:i3,base64url:wk,bigint:h3,boolean:v3,browserEmail:fQ,cidrv4:r3,cidrv6:a3,cuid:HF,cuid2:VF,date:u3,datetime:p3,domain:s3,duration:YF,e164:l3,email:XF,emoji:QF,extendedDuration:iQ,guid:qF,hex:_3,hostname:o3,html5Email:cQ,idnEmail:dQ,integer:g3,ipv4:e3,ipv6:t3,ksuid:KF,lowercase:S3,mac:n3,md5_base64:hQ,md5_base64url:gQ,md5_hex:mQ,nanoid:ZF,null:y3,number:b3,rfc5322Email:uQ,sha1_base64:vQ,sha1_base64url:yQ,sha1_hex:bQ,sha256_base64:SQ,sha256_base64url:xQ,sha256_hex:wQ,sha384_base64:EQ,sha384_base64url:kQ,sha384_hex:_Q,sha512_base64:NQ,sha512_base64url:CQ,sha512_hex:TQ,string:m3,time:f3,ulid:GF,undefined:w3,unicodeEmail:JF,uppercase:x3,uuid:Qu,uuid4:oQ,uuid6:sQ,uuid7:lQ,xid:WF},Symbol.toStringTag,{value:"Module"})),zn=me("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),E3={number:"number",bigint:"bigint",object:"date"},xk=me("$ZodCheckLessThan",(e,t)=>{zn.init(e,t);const n=E3[typeof t.value];e._zod.onattach.push(a=>{const r=a._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_k=me("$ZodCheckGreaterThan",(e,t)=>{zn.init(e,t);const n=E3[typeof t.value];e._zod.onattach.push(a=>{const r=a._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),k3=me("$ZodCheckMultipleOf",(e,t)=>{zn.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):SF(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),T3=me("$ZodCheckNumberFormat",(e,t)=>{zn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),a=n?"int":"number",[r,i]=TF[t.format];e._zod.onattach.push(s=>{const c=s._zod.bag;c.format=t.format,c.minimum=r,c.maximum=i,n&&(c.pattern=g3)}),e._zod.check=s=>{const c=s.value;if(n){if(!Number.isInteger(c)){s.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort});return}}c<r&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inst:e})}}),N3=me("$ZodCheckBigIntFormat",(e,t)=>{zn.init(e,t);const[n,a]=NF[t.format];e._zod.onattach.push(r=>{const i=r._zod.bag;i.format=t.format,i.minimum=n,i.maximum=a}),e._zod.check=r=>{const i=r.value;i<n&&r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>a&&r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:a,inst:e})}}),C3=me("$ZodCheckMaxSize",(e,t)=>{var n;zn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ql(r)&&r.size!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const r=a.value;r.size<=t.maximum||a.issues.push({origin:oy(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),R3=me("$ZodCheckMinSize",(e,t)=>{var n;zn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ql(r)&&r.size!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const r=a.value;r.size>=t.minimum||a.issues.push({origin:oy(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),A3=me("$ZodCheckSizeEquals",(e,t)=>{var n;zn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ql(r)&&r.size!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=a=>{const r=a.value,i=r.size;if(i===t.size)return;const s=i>t.size;a.issues.push({origin:oy(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),I3=me("$ZodCheckMaxLength",(e,t)=>{var n;zn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ql(r)&&r.length!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const r=a.value;if(r.length<=t.maximum)return;const s=sy(r);a.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),O3=me("$ZodCheckMinLength",(e,t)=>{var n;zn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ql(r)&&r.length!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const r=a.value;if(r.length>=t.minimum)return;const s=sy(r);a.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),D3=me("$ZodCheckLengthEquals",(e,t)=>{var n;zn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ql(r)&&r.length!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=a=>{const r=a.value,i=r.length;if(i===t.length)return;const s=sy(r),c=i>t.length;a.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),gm=me("$ZodCheckStringFormat",(e,t)=>{var n,a;zn.init(e,t),e._zod.onattach.push(r=>{const i=r._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),j3=me("$ZodCheckRegex",(e,t)=>{gm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),L3=me("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=S3),gm.init(e,t)}),$3=me("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=x3),gm.init(e,t)}),M3=me("$ZodCheckIncludes",(e,t)=>{zn.init(e,t);const n=Lo(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(a)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),P3=me("$ZodCheckStartsWith",(e,t)=>{zn.init(e,t);const n=new RegExp(`^${Lo(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const r=a._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),U3=me("$ZodCheckEndsWith",(e,t)=>{zn.init(e,t);const n=new RegExp(`.*${Lo(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const r=a._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}});function fM(e,t,n){e.issues.length&&t.issues.push(...bi(n,e.issues))}const z3=me("$ZodCheckProperty",(e,t)=>{zn.init(e,t),e._zod.check=n=>{const a=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(a instanceof Promise)return a.then(r=>fM(r,n,t.property));fM(a,n,t.property)}}),F3=me("$ZodCheckMimeType",(e,t)=>{zn.init(e,t);const n=new Set(t.mime);e._zod.onattach.push(a=>{a._zod.bag.mime=t.mime}),e._zod.check=a=>{n.has(a.value.type)||a.issues.push({code:"invalid_value",values:t.mime,input:a.value.type,inst:e,continue:!t.abort})}}),B3=me("$ZodCheckOverwrite",(e,t)=>{zn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class H3{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
4
4
  `).filter(s=>s),r=Math.min(...a.map(s=>s.length-s.trimStart().length)),i=a.map(s=>s.slice(r)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this?.args,r=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,r.join(`
5
5
  `))}}const V3={major:4,minor:2,patch:0},vt=me("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=V3;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const r of a)for(const i of r._zod.onattach)i(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const r=(s,c,u)=>{let d=Cl(s),m;for(const h of c){if(h._zod.def.when){if(!h._zod.def.when(s))continue}else if(d)continue;const g=s.issues.length,v=h._zod.check(s);if(v instanceof Promise&&u?.async===!1)throw new jl;if(m||v instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await v,s.issues.length!==g&&(d||(d=Cl(s,g)))});else{if(s.issues.length===g)continue;d||(d=Cl(s,g))}}return m?m.then(()=>s):s},i=(s,c,u)=>{if(Cl(s))return s.aborted=!0,s;const d=r(c,a,u);if(d instanceof Promise){if(u.async===!1)throw new jl;return d.then(m=>e._zod.parse(m,u))}return e._zod.parse(d,u)};e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){const d=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(m=>i(m,s,c)):i(d,s,c)}const u=e._zod.parse(s,c);if(u instanceof Promise){if(c.async===!1)throw new jl;return u.then(d=>r(d,a,c))}return r(u,a,c)}}e["~standard"]={validate:r=>{try{const i=dk(e,r);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return BF(e,r).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),bm=me("$ZodString",(e,t)=>{vt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??m3(e._zod.bag),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Tn=me("$ZodStringFormat",(e,t)=>{gm.init(e,t),bm.init(e,t)}),G3=me("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=qF),Tn.init(e,t)}),W3=me("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Qu(a))}else t.pattern??(t.pattern=Qu());Tn.init(e,t)}),K3=me("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=XF),Tn.init(e,t)}),Z3=me("$ZodURL",(e,t)=>{Tn.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),r=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Y3=me("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=QF()),Tn.init(e,t)}),q3=me("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ZF),Tn.init(e,t)}),X3=me("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=HF),Tn.init(e,t)}),J3=me("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=VF),Tn.init(e,t)}),Q3=me("$ZodULID",(e,t)=>{t.pattern??(t.pattern=GF),Tn.init(e,t)}),eB=me("$ZodXID",(e,t)=>{t.pattern??(t.pattern=WF),Tn.init(e,t)}),tB=me("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=KF),Tn.init(e,t)}),nB=me("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=p3(t)),Tn.init(e,t)}),rB=me("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=u3),Tn.init(e,t)}),aB=me("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=f3(t)),Tn.init(e,t)}),iB=me("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=YF),Tn.init(e,t)}),oB=me("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=e3),Tn.init(e,t),e._zod.bag.format="ipv4"}),sB=me("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=t3),Tn.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),lB=me("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=n3(t.delimiter)),Tn.init(e,t),e._zod.bag.format="mac"}),cB=me("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=r3),Tn.init(e,t)}),uB=me("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=a3),Tn.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[r,i]=a;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ek(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const dB=me("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=i3),Tn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ek(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function fB(e){if(!wk.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ek(n)}const pB=me("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=wk),Tn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{fB(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),mB=me("$ZodE164",(e,t)=>{t.pattern??(t.pattern=l3),Tn.init(e,t)});function hB(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const r=JSON.parse(atob(a));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}const gB=me("$ZodJWT",(e,t)=>{Tn.init(e,t),e._zod.check=n=>{hB(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),bB=me("$ZodCustomStringFormat",(e,t)=>{Tn.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),kk=me("$ZodNumber",(e,t)=>{vt.init(e,t),e._zod.pattern=e._zod.bag.pattern??b3,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;const i=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}}),vB=me("$ZodNumberFormat",(e,t)=>{T3.init(e,t),kk.init(e,t)}),Tk=me("$ZodBoolean",(e,t)=>{vt.init(e,t),e._zod.pattern=v3,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Nk=me("$ZodBigInt",(e,t)=>{vt.init(e,t),e._zod.pattern=h3,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),yB=me("$ZodBigIntFormat",(e,t)=>{N3.init(e,t),Nk.init(e,t)}),wB=me("$ZodSymbol",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),SB=me("$ZodUndefined",(e,t)=>{vt.init(e,t),e._zod.pattern=w3,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,a)=>{const r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),xB=me("$ZodNull",(e,t)=>{vt.init(e,t),e._zod.pattern=y3,e._zod.values=new Set([null]),e._zod.parse=(n,a)=>{const r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),_B=me("$ZodAny",(e,t)=>{vt.init(e,t),e._zod.parse=n=>n}),EB=me("$ZodUnknown",(e,t)=>{vt.init(e,t),e._zod.parse=n=>n}),kB=me("$ZodNever",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),TB=me("$ZodVoid",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),NB=me("$ZodDate",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}const r=n.value,i=r instanceof Date;return i&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}});function pM(e,t,n){e.issues.length&&t.issues.push(...bi(n,e.issues)),t.value[n]=e.value}const CB=me("$ZodArray",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const i=[];for(let s=0;s<r.length;s++){const c=r[s],u=t.element._zod.run({value:c,issues:[]},a);u instanceof Promise?i.push(u.then(d=>pM(d,n,s))):pM(u,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function nv(e,t,n,a){e.issues.length&&t.issues.push(...bi(n,e.issues)),e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function RB(e){const t=Object.keys(e.shape);for(const a of t)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=kF(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function AB(e,t,n,a,r,i){const s=[],c=r.keySet,u=r.catchall._zod,d=u.def.type;for(const m in t){if(c.has(m))continue;if(d==="never"){s.push(m);continue}const h=u.run({value:t[m],issues:[]},a);h instanceof Promise?e.push(h.then(g=>nv(g,n,m,t))):nv(h,n,m,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const IB=me("$ZodObject",(e,t)=>{if(vt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}const a=cm(()=>RB(t));Ht(e._zod,"propValues",()=>{const c=t.shape,u={};for(const d in c){const m=c[d]._zod;if(m.values){u[d]??(u[d]=new Set);for(const h of m.values)u[d].add(h)}}return u});const r=Xu,i=t.catchall;let s;e._zod.parse=(c,u)=>{s??(s=a.value);const d=c.value;if(!r(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value={};const m=[],h=s.shape;for(const g of s.keys){const x=h[g]._zod.run({value:d[g],issues:[]},u);x instanceof Promise?m.push(x.then(S=>nv(S,c,g,d))):nv(x,c,g,d)}return i?AB(m,d,c,u,a.value,e):m.length?Promise.all(m).then(()=>c):c}}),OB=me("$ZodObjectJIT",(e,t)=>{IB.init(e,t);const n=e._zod.parse,a=cm(()=>RB(t)),r=g=>{const v=new H3(["shape","payload","ctx"]),x=a.value,S=k=>{const C=r_(k);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};v.write("const input = payload.value;");const y=Object.create(null);let E=0;for(const k of x.keys)y[k]=`key_${E++}`;v.write("const newResult = {};");for(const k of x.keys){const C=y[k],R=r_(k);v.write(`const ${C} = ${S(k)};`),v.write(`
@@ -21,18 +21,18 @@ var oJ=Object.defineProperty;var sJ=(e,t,n)=>t in e?oJ(e,t,{enumerable:!0,config
21
21
 
22
22
  `)}v.write("payload.value = newResult;"),v.write("return payload;");const _=v.compile();return(k,C)=>_(g,k,C)};let i;const s=Xu,c=!Qb.jitless,d=c&&_F.value,m=t.catchall;let h;e._zod.parse=(g,v)=>{h??(h=a.value);const x=g.value;return s(x)?c&&d&&v?.async===!1&&v.jitless!==!0?(i||(i=r(t.shape)),g=i(g,v),m?AB([],x,g,v,h,e):g):n(g,v):(g.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),g)}});function mM(e,t,n,a){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const r=e.filter(i=>!Cl(i));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ti(s,a,Gr())))}),t)}const ly=me("$ZodUnion",(e,t)=>{vt.init(e,t),Ht(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Ht(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Ht(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),Ht(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>ay(i.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return a(r,i);let s=!1;const c=[];for(const u of t.options){const d=u._zod.run({value:r.value,issues:[]},i);if(d instanceof Promise)c.push(d),s=!0;else{if(d.issues.length===0)return d;c.push(d)}}return s?Promise.all(c).then(u=>mM(u,r,e,i)):mM(c,r,e,i)}});function hM(e,t,n,a){const r=e.filter(i=>i.issues.length===0);return r.length===1?(t.value=r[0].value,t):(r.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ti(s,a,Gr())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}const DB=me("$ZodXor",(e,t)=>{ly.init(e,t),t.inclusive=!1;const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return a(r,i);let s=!1;const c=[];for(const u of t.options){const d=u._zod.run({value:r.value,issues:[]},i);d instanceof Promise?(c.push(d),s=!0):c.push(d)}return s?Promise.all(c).then(u=>hM(u,r,e,i)):hM(c,r,e,i)}}),jB=me("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ly.init(e,t);const n=e._zod.parse;Ht(e._zod,"propValues",()=>{const r={};for(const i of t.options){const s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[c,u]of Object.entries(s)){r[c]||(r[c]=new Set);for(const d of u)r[c].add(d)}}return r});const a=cm(()=>{const r=t.options,i=new Map;for(const s of r){const c=s._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const u of c){if(i.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);i.set(u,s)}}return i});e._zod.parse=(r,i)=>{const s=r.value;if(!Xu(s))return r.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),r;const c=a.value.get(s?.[t.discriminator]);return c?c._zod.run(r,i):t.unionFallback?n(r,i):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),r)}}),LB=me("$ZodIntersection",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{const r=n.value,i=t.left._zod.run({value:r,issues:[]},a),s=t.right._zod.run({value:r,issues:[]},a);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,d])=>gM(n,u,d)):gM(n,i,s)}});function o_(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(zl(e)&&zl(t)){const n=Object.keys(t),a=Object.keys(e).filter(i=>n.indexOf(i)!==-1),r={...e,...t};for(const i of a){const s=o_(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r[i]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const r=e[a],i=t[a],s=o_(r,i);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function gM(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Cl(e))return e;const a=o_(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Ck=me("$ZodTuple",(e,t)=>{vt.init(e,t);const n=t.items;e._zod.parse=(a,r)=>{const i=a.value;if(!Array.isArray(i))return a.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),a;a.value=[];const s=[],c=[...n].reverse().findIndex(m=>m._zod.optin!=="optional"),u=c===-1?0:n.length-c;if(!t.rest){const m=i.length>n.length,h=i.length<u-1;if(m||h)return a.issues.push({...m?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},input:i,inst:e,origin:"array"}),a}let d=-1;for(const m of n){if(d++,d>=i.length&&d>=u)continue;const h=m._zod.run({value:i[d],issues:[]},r);h instanceof Promise?s.push(h.then(g=>dg(g,a,d))):dg(h,a,d)}if(t.rest){const m=i.slice(n.length);for(const h of m){d++;const g=t.rest._zod.run({value:h,issues:[]},r);g instanceof Promise?s.push(g.then(v=>dg(v,a,d))):dg(g,a,d)}}return s.length?Promise.all(s).then(()=>a):a}});function dg(e,t,n){e.issues.length&&t.issues.push(...bi(n,e.issues)),t.value[n]=e.value}const $B=me("$ZodRecord",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;if(!zl(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const c=new Set;for(const d of s)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){c.add(typeof d=="number"?d.toString():d);const m=t.valueType._zod.run({value:r[d],issues:[]},a);m instanceof Promise?i.push(m.then(h=>{h.issues.length&&n.issues.push(...bi(d,h.issues)),n.value[d]=h.value})):(m.issues.length&&n.issues.push(...bi(d,m.issues)),n.value[d]=m.value)}let u;for(const d in r)c.has(d)||(u=u??[],u.push(d));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:u})}else{n.value={};for(const c of Reflect.ownKeys(r)){if(c==="__proto__")continue;const u=t.keyType._zod.run({value:c,issues:[]},a);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){t.mode==="loose"?n.value[c]=r[c]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>ti(m,a,Gr())),input:c,path:[c],inst:e});continue}const d=t.valueType._zod.run({value:r[c],issues:[]},a);d instanceof Promise?i.push(d.then(m=>{m.issues.length&&n.issues.push(...bi(c,m.issues)),n.value[u.value]=m.value})):(d.issues.length&&n.issues.push(...bi(c,d.issues)),n.value[u.value]=d.value)}}return i.length?Promise.all(i).then(()=>n):n}}),MB=me("$ZodMap",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;if(!(r instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),n;const i=[];n.value=new Map;for(const[s,c]of r){const u=t.keyType._zod.run({value:s,issues:[]},a),d=t.valueType._zod.run({value:c,issues:[]},a);u instanceof Promise||d instanceof Promise?i.push(Promise.all([u,d]).then(([m,h])=>{bM(m,h,n,s,r,e,a)})):bM(u,d,n,s,r,e,a)}return i.length?Promise.all(i).then(()=>n):n}});function bM(e,t,n,a,r,i,s){e.issues.length&&(tv.has(typeof a)?n.issues.push(...bi(a,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:i,issues:e.issues.map(c=>ti(c,s,Gr()))})),t.issues.length&&(tv.has(typeof a)?n.issues.push(...bi(a,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:i,key:a,issues:t.issues.map(c=>ti(c,s,Gr()))})),n.value.set(e.value,t.value)}const PB=me("$ZodSet",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;if(!(r instanceof Set))return n.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),n;const i=[];n.value=new Set;for(const s of r){const c=t.valueType._zod.run({value:s,issues:[]},a);c instanceof Promise?i.push(c.then(u=>vM(u,n))):vM(c,n)}return i.length?Promise.all(i).then(()=>n):n}});function vM(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const UB=me("$ZodEnum",(e,t)=>{vt.init(e,t);const n=ok(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(r=>tv.has(typeof r)).map(r=>typeof r=="string"?Lo(r):r.toString()).join("|")})$`),e._zod.parse=(r,i)=>{const s=r.value;return a.has(s)||r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),zB=me("$ZodLiteral",(e,t)=>{if(vt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?Lo(a):a?Lo(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,r)=>{const i=a.value;return n.has(i)||a.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),a}}),FB=me("$ZodFile",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;return r instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),n}}),BB=me("$ZodTransform",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ry(e.constructor.name);const r=t.transform(n.value,n);if(a.async)return(r instanceof Promise?r:Promise.resolve(r)).then(s=>(n.value=s,n));if(r instanceof Promise)throw new jl;return n.value=r,n}});function yM(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const HB=me("$ZodOptional",(e,t)=>{vt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ht(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ht(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ay(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const r=t.innerType._zod.run(n,a);return r instanceof Promise?r.then(i=>yM(i,n.value)):yM(r,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),VB=me("$ZodNullable",(e,t)=>{vt.init(e,t),Ht(e._zod,"optin",()=>t.innerType._zod.optin),Ht(e._zod,"optout",()=>t.innerType._zod.optout),Ht(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ay(n.source)}|null)$`):void 0}),Ht(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),GB=me("$ZodDefault",(e,t)=>{vt.init(e,t),e._zod.optin="optional",Ht(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const r=t.innerType._zod.run(n,a);return r instanceof Promise?r.then(i=>wM(i,t)):wM(r,t)}});function wM(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const WB=me("$ZodPrefault",(e,t)=>{vt.init(e,t),e._zod.optin="optional",Ht(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),KB=me("$ZodNonOptional",(e,t)=>{vt.init(e,t),Ht(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const r=t.innerType._zod.run(n,a);return r instanceof Promise?r.then(i=>SM(i,e)):SM(r,e)}});function SM(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ZB=me("$ZodSuccess",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ry("ZodSuccess");const r=t.innerType._zod.run(n,a);return r instanceof Promise?r.then(i=>(n.value=i.issues.length===0,n)):(n.value=r.issues.length===0,n)}}),YB=me("$ZodCatch",(e,t)=>{vt.init(e,t),Ht(e._zod,"optin",()=>t.innerType._zod.optin),Ht(e._zod,"optout",()=>t.innerType._zod.optout),Ht(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const r=t.innerType._zod.run(n,a);return r instanceof Promise?r.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>ti(s,a,Gr()))},input:n.value}),n.issues=[]),n)):(n.value=r.value,r.issues.length&&(n.value=t.catchValue({...n,error:{issues:r.issues.map(i=>ti(i,a,Gr()))},input:n.value}),n.issues=[]),n)}}),qB=me("$ZodNaN",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),XB=me("$ZodPipe",(e,t)=>{vt.init(e,t),Ht(e._zod,"values",()=>t.in._zod.values),Ht(e._zod,"optin",()=>t.in._zod.optin),Ht(e._zod,"optout",()=>t.out._zod.optout),Ht(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const i=t.out._zod.run(n,a);return i instanceof Promise?i.then(s=>fg(s,t.in,a)):fg(i,t.in,a)}const r=t.in._zod.run(n,a);return r instanceof Promise?r.then(i=>fg(i,t.out,a)):fg(r,t.out,a)}});function fg(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Rk=me("$ZodCodec",(e,t)=>{vt.init(e,t),Ht(e._zod,"values",()=>t.in._zod.values),Ht(e._zod,"optin",()=>t.in._zod.optin),Ht(e._zod,"optout",()=>t.out._zod.optout),Ht(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if((a.direction||"forward")==="forward"){const i=t.in._zod.run(n,a);return i instanceof Promise?i.then(s=>pg(s,t,a)):pg(i,t,a)}else{const i=t.out._zod.run(n,a);return i instanceof Promise?i.then(s=>pg(s,t,a)):pg(i,t,a)}}});function pg(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){const r=t.transform(e.value,e);return r instanceof Promise?r.then(i=>mg(e,i,t.out,n)):mg(e,r,t.out,n)}else{const r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(i=>mg(e,i,t.in,n)):mg(e,r,t.in,n)}}function mg(e,t,n,a){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},a)}const JB=me("$ZodReadonly",(e,t)=>{vt.init(e,t),Ht(e._zod,"propValues",()=>t.innerType._zod.propValues),Ht(e._zod,"values",()=>t.innerType._zod.values),Ht(e._zod,"optin",()=>t.innerType?._zod?.optin),Ht(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const r=t.innerType._zod.run(n,a);return r instanceof Promise?r.then(xM):xM(r)}});function xM(e){return e.value=Object.freeze(e.value),e}const QB=me("$ZodTemplateLiteral",(e,t)=>{vt.init(e,t);const n=[];for(const a of t.parts)if(typeof a=="object"&&a!==null){if(!a._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...a._zod.traits].shift()}`);const r=a._zod.pattern instanceof RegExp?a._zod.pattern.source:a._zod.pattern;if(!r)throw new Error(`Invalid template literal part: ${a._zod.traits}`);const i=r.startsWith("^")?1:0,s=r.endsWith("$")?r.length-1:r.length;n.push(r.slice(i,s))}else if(a===null||EF.has(typeof a))n.push(Lo(`${a}`));else throw new Error(`Invalid template literal part: ${a}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(a,r)=>typeof a.value!="string"?(a.issues.push({input:a.value,inst:e,expected:"template_literal",code:"invalid_type"}),a):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(a.value)||a.issues.push({input:a.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),a)}),e6=me("$ZodFunction",(e,t)=>(vt.init(e,t),e._def=t,e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return function(...a){const r=e._def.input?a_(e._def.input,a):a,i=Reflect.apply(n,this,r);return e._def.output?a_(e._def.output,i):i}},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return async function(...a){const r=e._def.input?await i_(e._def.input,a):a,i=await Reflect.apply(n,this,r);return e._def.output?await i_(e._def.output,i):i}},e._zod.parse=(n,a)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{const a=e.constructor;return Array.isArray(n[0])?new a({type:"function",input:new Ck({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new a({type:"function",input:n[0],output:e._def.output})},e.output=n=>{const a=e.constructor;return new a({type:"function",input:e._def.input,output:n})},e)),t6=me("$ZodPromise",(e,t)=>{vt.init(e,t),e._zod.parse=(n,a)=>Promise.resolve(n.value).then(r=>t.innerType._zod.run({value:r,issues:[]},a))}),n6=me("$ZodLazy",(e,t)=>{vt.init(e,t),Ht(e._zod,"innerType",()=>t.getter()),Ht(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ht(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ht(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ht(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,a)=>e._zod.innerType._zod.run(n,a)}),r6=me("$ZodCustom",(e,t)=>{zn.init(e,t),vt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,r=t.fn(a);if(r instanceof Promise)return r.then(i=>_M(i,n,a,e));_M(r,n,a,e)}});function _M(e,t,n,a){if(!e){const r={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(r.params=a._zod.def.params),t.issues.push(Ju(r))}}const RQ=()=>{const e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return r=>{switch(r.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${r.expected}، ولكن تم إدخال ${n(r.input)}`;case"invalid_value":return r.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${ut(r.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?` أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${i} ${r.maximum.toString()} ${s.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${r.origin??"القيمة"} ${i} ${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${i} ${r.minimum.toString()} ${s.unit}`:`أصغر من اللازم: يفترض لـ ${r.origin} أن يكون ${i} ${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${r.prefix}"`:i.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`:i.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`:i.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`:`${a[i.format]??r.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${r.divisor}`;case"unrecognized_keys":return`معرف${r.keys.length>1?"ات":""} غريب${r.keys.length>1?"ة":""}: ${Pe(r.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${r.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${r.origin}`;default:return"مدخل غير مقبول"}}};function AQ(){return{localeError:RQ()}}const IQ=()=>{const e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${r.expected}, daxil olan ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Yanlış dəyər: gözlənilən ${ut(r.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${i}${r.maximum.toString()} ${s.unit??"element"}`:`Çox böyük: gözlənilən ${r.origin??"dəyər"} ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Çox kiçik: gözlənilən ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`:`Çox kiçik: gözlənilən ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`:i.format==="ends_with"?`Yanlış mətn: "${i.suffix}" ilə bitməlidir`:i.format==="includes"?`Yanlış mətn: "${i.includes}" daxil olmalıdır`:i.format==="regex"?`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${a[i.format]??r.format}`}case"not_multiple_of":return`Yanlış ədəd: ${r.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${r.keys.length>1?"lar":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`${r.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${r.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function OQ(){return{localeError:IQ()}}function EM(e,t,n,a){const r=Math.abs(e),i=r%10,s=r%100;return s>=11&&s<=19?a:i===1?t:i>=2&&i<=4?n:a}const DQ=()=>{const e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"лік";case"object":{if(Array.isArray(r))return"масіў";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return r=>{switch(r.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${r.expected}, атрымана ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Няправільны ўвод: чакалася ${ut(r.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);if(s){const c=Number(r.maximum),u=EM(c,s.unit.one,s.unit.few,s.unit.many);return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна ${s.verb} ${i}${r.maximum.toString()} ${u}`}return`Занадта вялікі: чакалася, што ${r.origin??"значэнне"} павінна быць ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);if(s){const c=Number(r.minimum),u=EM(c,s.unit.one,s.unit.few,s.unit.many);return`Занадта малы: чакалася, што ${r.origin} павінна ${s.verb} ${i}${r.minimum.toString()} ${u}`}return`Занадта малы: чакалася, што ${r.origin} павінна быць ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${i.prefix}"`:i.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${i.suffix}"`:i.format==="includes"?`Няправільны радок: павінен змяшчаць "${i.includes}"`:i.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`:`Няправільны ${a[i.format]??r.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${r.keys.length>1?"ключы":"ключ"}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${r.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${r.origin}`;default:return"Няправільны ўвод"}}};function jQ(){return{localeError:DQ()}}const LQ=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"число";case"object":{if(Array.isArray(e))return"масив";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},$Q=()=>{const e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function t(a){return e[a]??null}const n={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"};return a=>{switch(a.code){case"invalid_type":return`Невалиден вход: очакван ${a.expected}, получен ${LQ(a.input)}`;case"invalid_value":return a.values.length===1?`Невалиден вход: очакван ${ut(a.values[0])}`:`Невалидна опция: очаквано едно от ${Pe(a.values,"|")}`;case"too_big":{const r=a.inclusive?"<=":"<",i=t(a.origin);return i?`Твърде голямо: очаква се ${a.origin??"стойност"} да съдържа ${r}${a.maximum.toString()} ${i.unit??"елемента"}`:`Твърде голямо: очаква се ${a.origin??"стойност"} да бъде ${r}${a.maximum.toString()}`}case"too_small":{const r=a.inclusive?">=":">",i=t(a.origin);return i?`Твърде малко: очаква се ${a.origin} да съдържа ${r}${a.minimum.toString()} ${i.unit}`:`Твърде малко: очаква се ${a.origin} да бъде ${r}${a.minimum.toString()}`}case"invalid_format":{const r=a;if(r.format==="starts_with")return`Невалиден низ: трябва да започва с "${r.prefix}"`;if(r.format==="ends_with")return`Невалиден низ: трябва да завършва с "${r.suffix}"`;if(r.format==="includes")return`Невалиден низ: трябва да включва "${r.includes}"`;if(r.format==="regex")return`Невалиден низ: трябва да съвпада с ${r.pattern}`;let i="Невалиден";return r.format==="emoji"&&(i="Невалидно"),r.format==="datetime"&&(i="Невалидно"),r.format==="date"&&(i="Невалидна"),r.format==="time"&&(i="Невалидно"),r.format==="duration"&&(i="Невалидна"),`${i} ${n[r.format]??a.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${a.divisor}`;case"unrecognized_keys":return`Неразпознат${a.keys.length>1?"и":""} ключ${a.keys.length>1?"ове":""}: ${Pe(a.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${a.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${a.origin}`;default:return"Невалиден вход"}}};function MQ(){return{localeError:$Q()}}const PQ=()=>{const e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Tipus invàlid: s'esperava ${r.expected}, s'ha rebut ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Valor invàlid: s'esperava ${ut(r.values[0])}`:`Opció invàlida: s'esperava una de ${Pe(r.values," o ")}`;case"too_big":{const i=r.inclusive?"com a màxim":"menys de",s=t(r.origin);return s?`Massa gran: s'esperava que ${r.origin??"el valor"} contingués ${i} ${r.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${r.origin??"el valor"} fos ${i} ${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?"com a mínim":"més de",s=t(r.origin);return s?`Massa petit: s'esperava que ${r.origin} contingués ${i} ${r.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${r.origin} fos ${i} ${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Format invàlid: ha de començar amb "${i.prefix}"`:i.format==="ends_with"?`Format invàlid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format invàlid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${i.pattern}`:`Format invàlid per a ${a[i.format]??r.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${r.divisor}`;case"unrecognized_keys":return`Clau${r.keys.length>1?"s":""} no reconeguda${r.keys.length>1?"s":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${r.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${r.origin}`;default:return"Entrada invàlida"}}};function UQ(){return{localeError:PQ()}}const zQ=()=>{const e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(r))return"pole";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return r=>{switch(r.code){case"invalid_type":return`Neplatný vstup: očekáváno ${r.expected}, obdrženo ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Neplatný vstup: očekáváno ${ut(r.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Hodnota je příliš velká: ${r.origin??"hodnota"} musí mít ${i}${r.maximum.toString()} ${s.unit??"prvků"}`:`Hodnota je příliš velká: ${r.origin??"hodnota"} musí být ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Hodnota je příliš malá: ${r.origin??"hodnota"} musí mít ${i}${r.minimum.toString()} ${s.unit??"prvků"}`:`Hodnota je příliš malá: ${r.origin??"hodnota"} musí být ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Neplatný řetězec: musí začínat na "${i.prefix}"`:i.format==="ends_with"?`Neplatný řetězec: musí končit na "${i.suffix}"`:i.format==="includes"?`Neplatný řetězec: musí obsahovat "${i.includes}"`:i.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`:`Neplatný formát ${a[i.format]??r.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${r.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${Pe(r.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${r.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${r.origin}`;default:return"Neplatný vstup"}}};function FQ(){return{localeError:zQ()}}const BQ=()=>{const e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function n(s){return e[s]??null}function a(s){return t[s]??s}const r=s=>{const c=typeof s;switch(c){case"number":return Number.isNaN(s)?"NaN":"tal";case"object":return Array.isArray(s)?"liste":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype&&s.constructor?s.constructor.name:"objekt"}return c},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return s=>{switch(s.code){case"invalid_type":return`Ugyldigt input: forventede ${a(s.expected)}, fik ${a(r(s.input))}`;case"invalid_value":return s.values.length===1?`Ugyldig værdi: forventede ${ut(s.values[0])}`:`Ugyldigt valg: forventede en af følgende ${Pe(s.values,"|")}`;case"too_big":{const c=s.inclusive?"<=":"<",u=n(s.origin),d=a(s.origin);return u?`For stor: forventede ${d??"value"} ${u.verb} ${c} ${s.maximum.toString()} ${u.unit??"elementer"}`:`For stor: forventede ${d??"value"} havde ${c} ${s.maximum.toString()}`}case"too_small":{const c=s.inclusive?">=":">",u=n(s.origin),d=a(s.origin);return u?`For lille: forventede ${d} ${u.verb} ${c} ${s.minimum.toString()} ${u.unit}`:`For lille: forventede ${d} havde ${c} ${s.minimum.toString()}`}case"invalid_format":{const c=s;return c.format==="starts_with"?`Ugyldig streng: skal starte med "${c.prefix}"`:c.format==="ends_with"?`Ugyldig streng: skal ende med "${c.suffix}"`:c.format==="includes"?`Ugyldig streng: skal indeholde "${c.includes}"`:c.format==="regex"?`Ugyldig streng: skal matche mønsteret ${c.pattern}`:`Ugyldig ${i[c.format]??s.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${s.divisor}`;case"unrecognized_keys":return`${s.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${Pe(s.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${s.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${s.origin}`;default:return"Ugyldigt input"}}};function HQ(){return{localeError:BQ()}}const VQ=()=>{const e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"Zahl";case"object":{if(Array.isArray(r))return"Array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return r=>{switch(r.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${r.expected}, erhalten ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ungültige Eingabe: erwartet ${ut(r.values[0])}`:`Ungültige Option: erwartet eine von ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Zu groß: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${r.origin??"Wert"} ${i}${r.maximum.toString()} ist`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${r.origin} ${i}${r.minimum.toString()} ist`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Ungültiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ungültiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ungültiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`:`Ungültig: ${a[i.format]??r.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${r.divisor} sein`;case"unrecognized_keys":return`${r.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${r.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${r.origin}`;default:return"Ungültige Eingabe"}}};function GQ(){return{localeError:VQ()}}const WQ=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},KQ=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(a){return e[a]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return a=>{switch(a.code){case"invalid_type":return`Invalid input: expected ${a.expected}, received ${WQ(a.input)}`;case"invalid_value":return a.values.length===1?`Invalid input: expected ${ut(a.values[0])}`:`Invalid option: expected one of ${Pe(a.values,"|")}`;case"too_big":{const r=a.inclusive?"<=":"<",i=t(a.origin);return i?`Too big: expected ${a.origin??"value"} to have ${r}${a.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${a.origin??"value"} to be ${r}${a.maximum.toString()}`}case"too_small":{const r=a.inclusive?">=":">",i=t(a.origin);return i?`Too small: expected ${a.origin} to have ${r}${a.minimum.toString()} ${i.unit}`:`Too small: expected ${a.origin} to be ${r}${a.minimum.toString()}`}case"invalid_format":{const r=a;return r.format==="starts_with"?`Invalid string: must start with "${r.prefix}"`:r.format==="ends_with"?`Invalid string: must end with "${r.suffix}"`:r.format==="includes"?`Invalid string: must include "${r.includes}"`:r.format==="regex"?`Invalid string: must match pattern ${r.pattern}`:`Invalid ${n[r.format]??a.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${a.divisor}`;case"unrecognized_keys":return`Unrecognized key${a.keys.length>1?"s":""}: ${Pe(a.keys,", ")}`;case"invalid_key":return`Invalid key in ${a.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${a.origin}`;default:return"Invalid input"}}};function a6(){return{localeError:KQ()}}const ZQ=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},YQ=()=>{const e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(a){return e[a]??null}const n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return a=>{switch(a.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${a.expected}, riceviĝis ${ZQ(a.input)}`;case"invalid_value":return a.values.length===1?`Nevalida enigo: atendiĝis ${ut(a.values[0])}`:`Nevalida opcio: atendiĝis unu el ${Pe(a.values,"|")}`;case"too_big":{const r=a.inclusive?"<=":"<",i=t(a.origin);return i?`Tro granda: atendiĝis ke ${a.origin??"valoro"} havu ${r}${a.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${a.origin??"valoro"} havu ${r}${a.maximum.toString()}`}case"too_small":{const r=a.inclusive?">=":">",i=t(a.origin);return i?`Tro malgranda: atendiĝis ke ${a.origin} havu ${r}${a.minimum.toString()} ${i.unit}`:`Tro malgranda: atendiĝis ke ${a.origin} estu ${r}${a.minimum.toString()}`}case"invalid_format":{const r=a;return r.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${r.prefix}"`:r.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${r.suffix}"`:r.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${r.includes}"`:r.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`:`Nevalida ${n[r.format]??a.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${a.divisor}`;case"unrecognized_keys":return`Nekonata${a.keys.length>1?"j":""} ŝlosilo${a.keys.length>1?"j":""}: ${Pe(a.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${a.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${a.origin}`;default:return"Nevalida enigo"}}};function qQ(){return{localeError:YQ()}}const XQ=()=>{const e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function n(s){return e[s]??null}function a(s){return t[s]??s}const r=s=>{const c=typeof s;switch(c){case"number":return Number.isNaN(s)?"NaN":"number";case"object":return Array.isArray(s)?"array":s===null?"null":Object.getPrototypeOf(s)!==Object.prototype?s.constructor.name:"object"}return c},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return s=>{switch(s.code){case"invalid_type":return`Entrada inválida: se esperaba ${a(s.expected)}, recibido ${a(r(s.input))}`;case"invalid_value":return s.values.length===1?`Entrada inválida: se esperaba ${ut(s.values[0])}`:`Opción inválida: se esperaba una de ${Pe(s.values,"|")}`;case"too_big":{const c=s.inclusive?"<=":"<",u=n(s.origin),d=a(s.origin);return u?`Demasiado grande: se esperaba que ${d??"valor"} tuviera ${c}${s.maximum.toString()} ${u.unit??"elementos"}`:`Demasiado grande: se esperaba que ${d??"valor"} fuera ${c}${s.maximum.toString()}`}case"too_small":{const c=s.inclusive?">=":">",u=n(s.origin),d=a(s.origin);return u?`Demasiado pequeño: se esperaba que ${d} tuviera ${c}${s.minimum.toString()} ${u.unit}`:`Demasiado pequeño: se esperaba que ${d} fuera ${c}${s.minimum.toString()}`}case"invalid_format":{const c=s;return c.format==="starts_with"?`Cadena inválida: debe comenzar con "${c.prefix}"`:c.format==="ends_with"?`Cadena inválida: debe terminar en "${c.suffix}"`:c.format==="includes"?`Cadena inválida: debe incluir "${c.includes}"`:c.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${c.pattern}`:`Inválido ${i[c.format]??s.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${s.divisor}`;case"unrecognized_keys":return`Llave${s.keys.length>1?"s":""} desconocida${s.keys.length>1?"s":""}: ${Pe(s.keys,", ")}`;case"invalid_key":return`Llave inválida en ${a(s.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${a(s.origin)}`;default:return"Entrada inválida"}}};function JQ(){return{localeError:XQ()}}const QQ=()=>{const e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"آرایه";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return r=>{switch(r.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${r.expected} می‌بود، ${n(r.input)} دریافت شد`;case"invalid_value":return r.values.length===1?`ورودی نامعتبر: می‌بایست ${ut(r.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${Pe(r.values,"|")} می‌بود`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`خیلی بزرگ: ${r.origin??"مقدار"} باید ${i}${r.maximum.toString()} ${s.unit??"عنصر"} باشد`:`خیلی بزرگ: ${r.origin??"مقدار"} باید ${i}${r.maximum.toString()} باشد`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`خیلی کوچک: ${r.origin} باید ${i}${r.minimum.toString()} ${s.unit} باشد`:`خیلی کوچک: ${r.origin} باید ${i}${r.minimum.toString()} باشد`}case"invalid_format":{const i=r;return i.format==="starts_with"?`رشته نامعتبر: باید با "${i.prefix}" شروع شود`:i.format==="ends_with"?`رشته نامعتبر: باید با "${i.suffix}" تمام شود`:i.format==="includes"?`رشته نامعتبر: باید شامل "${i.includes}" باشد`:i.format==="regex"?`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`:`${a[i.format]??r.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${r.divisor} باشد`;case"unrecognized_keys":return`کلید${r.keys.length>1?"های":""} ناشناس: ${Pe(r.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${r.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${r.origin}`;default:return"ورودی نامعتبر"}}};function eee(){return{localeError:QQ()}}const tee=()=>{const e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return r=>{switch(r.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${r.expected}, oli ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Virheellinen syöte: täytyy olla ${ut(r.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Liian suuri: ${s.subject} täytyy olla ${i}${r.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon täytyy olla ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Liian pieni: ${s.subject} täytyy olla ${i}${r.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon täytyy olla ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen syöte: täytyy sisältää "${i.includes}"`:i.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`:`Virheellinen ${a[i.format]??r.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${r.divisor} monikerta`;case"unrecognized_keys":return`${r.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${Pe(r.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function nee(){return{localeError:tee()}}const ree=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nombre";case"object":{if(Array.isArray(r))return"tableau";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return r=>{switch(r.code){case"invalid_type":return`Entrée invalide : ${r.expected} attendu, ${n(r.input)} reçu`;case"invalid_value":return r.values.length===1?`Entrée invalide : ${ut(r.values[0])} attendu`:`Option invalide : une valeur parmi ${Pe(r.values,"|")} attendue`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Trop grand : ${r.origin??"valeur"} doit ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"élément(s)"}`:`Trop grand : ${r.origin??"valeur"} doit être ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Trop petit : ${r.origin} doit ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Trop petit : ${r.origin} doit être ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Chaîne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Chaîne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Chaîne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${i.pattern}`:`${a[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${Pe(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function aee(){return{localeError:ree()}}const iee=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return r=>{switch(r.code){case"invalid_type":return`Entrée invalide : attendu ${r.expected}, reçu ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrée invalide : attendu ${ut(r.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"≤":"<",s=t(r.origin);return s?`Trop grand : attendu que ${r.origin??"la valeur"} ait ${i}${r.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${r.origin??"la valeur"} soit ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?"≥":">",s=t(r.origin);return s?`Trop petit : attendu que ${r.origin} ait ${i}${r.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${r.origin} soit ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Chaîne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Chaîne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Chaîne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Chaîne invalide : doit correspondre au motif ${i.pattern}`:`${a[i.format]??r.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${r.divisor}`;case"unrecognized_keys":return`Clé${r.keys.length>1?"s":""} non reconnue${r.keys.length>1?"s":""} : ${Pe(r.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${r.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${r.origin}`;default:return"Entrée invalide"}}};function oee(){return{localeError:iee()}}const see=()=>{const e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},t={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},n=d=>d?e[d]:void 0,a=d=>{const m=n(d);return m?m.label:d??e.unknown.label},r=d=>`ה${a(d)}`,i=d=>(n(d)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",s=d=>d?t[d]??null:null,c=d=>{const m=typeof d;switch(m){case"number":return Number.isNaN(d)?"NaN":"number";case"object":return Array.isArray(d)?"array":d===null?"null":Object.getPrototypeOf(d)!==Object.prototype&&d.constructor?d.constructor.name:"object";default:return m}},u={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}};return d=>{switch(d.code){case"invalid_type":{const m=d.expected,h=a(m),g=c(d.input),v=e[g]?.label??g;return`קלט לא תקין: צריך להיות ${h}, התקבל ${v}`}case"invalid_value":{if(d.values.length===1)return`ערך לא תקין: הערך חייב להיות ${ut(d.values[0])}`;const m=d.values.map(v=>ut(v));if(d.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${m[0]} או ${m[1]}`;const h=m[m.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${m.slice(0,-1).join(", ")} או ${h}`}case"too_big":{const m=s(d.origin),h=r(d.origin??"value");if(d.origin==="string")return`${m?.longLabel??"ארוך"} מדי: ${h} צריכה להכיל ${d.maximum.toString()} ${m?.unit??""} ${d.inclusive?"או פחות":"לכל היותר"}`.trim();if(d.origin==="number"){const x=d.inclusive?`קטן או שווה ל-${d.maximum}`:`קטן מ-${d.maximum}`;return`גדול מדי: ${h} צריך להיות ${x}`}if(d.origin==="array"||d.origin==="set"){const x=d.origin==="set"?"צריכה":"צריך",S=d.inclusive?`${d.maximum} ${m?.unit??""} או פחות`:`פחות מ-${d.maximum} ${m?.unit??""}`;return`גדול מדי: ${h} ${x} להכיל ${S}`.trim()}const g=d.inclusive?"<=":"<",v=i(d.origin??"value");return m?.unit?`${m.longLabel} מדי: ${h} ${v} ${g}${d.maximum.toString()} ${m.unit}`:`${m?.longLabel??"גדול"} מדי: ${h} ${v} ${g}${d.maximum.toString()}`}case"too_small":{const m=s(d.origin),h=r(d.origin??"value");if(d.origin==="string")return`${m?.shortLabel??"קצר"} מדי: ${h} צריכה להכיל ${d.minimum.toString()} ${m?.unit??""} ${d.inclusive?"או יותר":"לפחות"}`.trim();if(d.origin==="number"){const x=d.inclusive?`גדול או שווה ל-${d.minimum}`:`גדול מ-${d.minimum}`;return`קטן מדי: ${h} צריך להיות ${x}`}if(d.origin==="array"||d.origin==="set"){const x=d.origin==="set"?"צריכה":"צריך";if(d.minimum===1&&d.inclusive){const y=(d.origin==="set","לפחות פריט אחד");return`קטן מדי: ${h} ${x} להכיל ${y}`}const S=d.inclusive?`${d.minimum} ${m?.unit??""} או יותר`:`יותר מ-${d.minimum} ${m?.unit??""}`;return`קטן מדי: ${h} ${x} להכיל ${S}`.trim()}const g=d.inclusive?">=":">",v=i(d.origin??"value");return m?.unit?`${m.shortLabel} מדי: ${h} ${v} ${g}${d.minimum.toString()} ${m.unit}`:`${m?.shortLabel??"קטן"} מדי: ${h} ${v} ${g}${d.minimum.toString()}`}case"invalid_format":{const m=d;if(m.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${m.prefix}"`;if(m.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${m.suffix}"`;if(m.format==="includes")return`המחרוזת חייבת לכלול "${m.includes}"`;if(m.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${m.pattern}`;const h=u[m.format],g=h?.label??m.format,x=(h?.gender??"m")==="f"?"תקינה":"תקין";return`${g} לא ${x}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${d.divisor}`;case"unrecognized_keys":return`מפתח${d.keys.length>1?"ות":""} לא מזוה${d.keys.length>1?"ים":"ה"}: ${Pe(d.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${r(d.origin??"array")}`;default:return"קלט לא תקין"}}};function lee(){return{localeError:see()}}const cee=()=>{const e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"szám";case"object":{if(Array.isArray(r))return"tömb";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return r=>{switch(r.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${r.expected}, a kapott érték ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Érvénytelen bemenet: a várt érték ${ut(r.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Túl nagy: ${r.origin??"érték"} mérete túl nagy ${i}${r.maximum.toString()} ${s.unit??"elem"}`:`Túl nagy: a bemeneti érték ${r.origin??"érték"} túl nagy: ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Túl kicsi: a bemeneti érték ${r.origin} mérete túl kicsi ${i}${r.minimum.toString()} ${s.unit}`:`Túl kicsi: a bemeneti érték ${r.origin} túl kicsi ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`:i.format==="ends_with"?`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`:i.format==="includes"?`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`:i.format==="regex"?`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`:`Érvénytelen ${a[i.format]??r.format}`}case"not_multiple_of":return`Érvénytelen szám: ${r.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${r.keys.length>1?"s":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${r.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${r.origin}`;default:return"Érvénytelen bemenet"}}};function uee(){return{localeError:cee()}}const dee=()=>{const e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input tidak valid: diharapkan ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input tidak valid: diharapkan ${ut(r.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Terlalu besar: diharapkan ${r.origin??"value"} memiliki ${i}${r.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${r.origin??"value"} menjadi ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Terlalu kecil: diharapkan ${r.origin} memiliki ${i}${r.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${r.origin} menjadi ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${a[i.format]??r.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${r.keys.length>1?"s":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${r.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${r.origin}`;default:return"Input tidak valid"}}};function fee(){return{localeError:dee()}}const pee=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"númer";case"object":{if(Array.isArray(e))return"fylki";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},mee=()=>{const e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(a){return e[a]??null}const n={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return a=>{switch(a.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${pee(a.input)} þar sem á að vera ${a.expected}`;case"invalid_value":return a.values.length===1?`Rangt gildi: gert ráð fyrir ${ut(a.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${Pe(a.values,"|")}`;case"too_big":{const r=a.inclusive?"<=":"<",i=t(a.origin);return i?`Of stórt: gert er ráð fyrir að ${a.origin??"gildi"} hafi ${r}${a.maximum.toString()} ${i.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${a.origin??"gildi"} sé ${r}${a.maximum.toString()}`}case"too_small":{const r=a.inclusive?">=":">",i=t(a.origin);return i?`Of lítið: gert er ráð fyrir að ${a.origin} hafi ${r}${a.minimum.toString()} ${i.unit}`:`Of lítið: gert er ráð fyrir að ${a.origin} sé ${r}${a.minimum.toString()}`}case"invalid_format":{const r=a;return r.format==="starts_with"?`Ógildur strengur: verður að byrja á "${r.prefix}"`:r.format==="ends_with"?`Ógildur strengur: verður að enda á "${r.suffix}"`:r.format==="includes"?`Ógildur strengur: verður að innihalda "${r.includes}"`:r.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${r.pattern}`:`Rangt ${n[r.format]??a.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${a.divisor}`;case"unrecognized_keys":return`Óþekkt ${a.keys.length>1?"ir lyklar":"ur lykill"}: ${Pe(a.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${a.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${a.origin}`;default:return"Rangt gildi"}}};function hee(){return{localeError:mee()}}const gee=()=>{const e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"numero";case"object":{if(Array.isArray(r))return"vettore";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input non valido: atteso ${r.expected}, ricevuto ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input non valido: atteso ${ut(r.values[0])}`:`Opzione non valida: atteso uno tra ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Troppo grande: ${r.origin??"valore"} deve avere ${i}${r.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${r.origin??"valore"} deve essere ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Troppo piccolo: ${r.origin} deve avere ${i}${r.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${r.origin} deve essere ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${a[i.format]??r.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${r.divisor}`;case"unrecognized_keys":return`Chiav${r.keys.length>1?"i":"e"} non riconosciut${r.keys.length>1?"e":"a"}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${r.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${r.origin}`;default:return"Input non valido"}}};function bee(){return{localeError:gee()}}const vee=()=>{const e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"数値";case"object":{if(Array.isArray(r))return"配列";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return r=>{switch(r.code){case"invalid_type":return`無効な入力: ${r.expected}が期待されましたが、${n(r.input)}が入力されました`;case"invalid_value":return r.values.length===1?`無効な入力: ${ut(r.values[0])}が期待されました`:`無効な選択: ${Pe(r.values,"、")}のいずれかである必要があります`;case"too_big":{const i=r.inclusive?"以下である":"より小さい",s=t(r.origin);return s?`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${s.unit??"要素"}${i}必要があります`:`大きすぎる値: ${r.origin??"値"}は${r.maximum.toString()}${i}必要があります`}case"too_small":{const i=r.inclusive?"以上である":"より大きい",s=t(r.origin);return s?`小さすぎる値: ${r.origin}は${r.minimum.toString()}${s.unit}${i}必要があります`:`小さすぎる値: ${r.origin}は${r.minimum.toString()}${i}必要があります`}case"invalid_format":{const i=r;return i.format==="starts_with"?`無効な文字列: "${i.prefix}"で始まる必要があります`:i.format==="ends_with"?`無効な文字列: "${i.suffix}"で終わる必要があります`:i.format==="includes"?`無効な文字列: "${i.includes}"を含む必要があります`:i.format==="regex"?`無効な文字列: パターン${i.pattern}に一致する必要があります`:`無効な${a[i.format]??r.format}`}case"not_multiple_of":return`無効な数値: ${r.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${r.keys.length>1?"群":""}: ${Pe(r.keys,"、")}`;case"invalid_key":return`${r.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${r.origin}内の無効な値`;default:return"無効な入力"}}};function yee(){return{localeError:vee()}}const wee=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"რიცხვი";case"object":{if(Array.isArray(e))return"მასივი";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[t]??t},See=()=>{const e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(a){return e[a]??null}const n={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return a=>{switch(a.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${a.expected}, მიღებული ${wee(a.input)}`;case"invalid_value":return a.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${ut(a.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${Pe(a.values,"|")}-დან`;case"too_big":{const r=a.inclusive?"<=":"<",i=t(a.origin);return i?`ზედმეტად დიდი: მოსალოდნელი ${a.origin??"მნიშვნელობა"} ${i.verb} ${r}${a.maximum.toString()} ${i.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${a.origin??"მნიშვნელობა"} იყოს ${r}${a.maximum.toString()}`}case"too_small":{const r=a.inclusive?">=":">",i=t(a.origin);return i?`ზედმეტად პატარა: მოსალოდნელი ${a.origin} ${i.verb} ${r}${a.minimum.toString()} ${i.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${a.origin} იყოს ${r}${a.minimum.toString()}`}case"invalid_format":{const r=a;return r.format==="starts_with"?`არასწორი სტრინგი: უნდა იწყებოდეს "${r.prefix}"-ით`:r.format==="ends_with"?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${r.suffix}"-ით`:r.format==="includes"?`არასწორი სტრინგი: უნდა შეიცავდეს "${r.includes}"-ს`:r.format==="regex"?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${r.pattern}`:`არასწორი ${n[r.format]??a.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${a.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${a.keys.length>1?"ები":"ი"}: ${Pe(a.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${a.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${a.origin}-ში`;default:return"არასწორი შეყვანა"}}};function xee(){return{localeError:See()}}const _ee=()=>{const e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(r))return"អារេ (Array)";if(r===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return r=>{switch(r.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r.expected} ប៉ុន្តែទទួលបាន ${n(r.input)}`;case"invalid_value":return r.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${ut(r.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${i} ${r.maximum.toString()} ${s.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${r.origin??"តម្លៃ"} ${i} ${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`តូចពេក៖ ត្រូវការ ${r.origin} ${i} ${r.minimum.toString()} ${s.unit}`:`តូចពេក៖ ត្រូវការ ${r.origin} ${i} ${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`:i.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`:i.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`:i.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`:`មិនត្រឹមត្រូវ៖ ${a[i.format]??r.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${r.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${Pe(r.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${r.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function i6(){return{localeError:_ee()}}function Eee(){return i6()}const kee=()=>{const e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return r=>{switch(r.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${r.expected}, 받은 타입은 ${n(r.input)}입니다`;case"invalid_value":return r.values.length===1?`잘못된 입력: 값은 ${ut(r.values[0])} 이어야 합니다`:`잘못된 옵션: ${Pe(r.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const i=r.inclusive?"이하":"미만",s=i==="미만"?"이어야 합니다":"여야 합니다",c=t(r.origin),u=c?.unit??"요소";return c?`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()}${u} ${i}${s}`:`${r.origin??"값"}이 너무 큽니다: ${r.maximum.toString()} ${i}${s}`}case"too_small":{const i=r.inclusive?"이상":"초과",s=i==="이상"?"이어야 합니다":"여야 합니다",c=t(r.origin),u=c?.unit??"요소";return c?`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()}${u} ${i}${s}`:`${r.origin??"값"}이 너무 작습니다: ${r.minimum.toString()} ${i}${s}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`:i.format==="ends_with"?`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`:i.format==="includes"?`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`:i.format==="regex"?`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`:`잘못된 ${a[i.format]??r.format}`}case"not_multiple_of":return`잘못된 숫자: ${r.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${Pe(r.keys,", ")}`;case"invalid_key":return`잘못된 키: ${r.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${r.origin}`;default:return"잘못된 입력"}}};function Tee(){return{localeError:kee()}}const Nee=e=>Xf(typeof e,e),Xf=(e,t=void 0)=>{switch(e){case"number":return Number.isNaN(t)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return t===void 0?"nežinomas objektas":t===null?"nulinė reikšmė":Array.isArray(t)?"masyvas":Object.getPrototypeOf(t)!==Object.prototype&&t.constructor?t.constructor.name:"objektas";case"null":return"nulinė reikšmė"}return e},zf=e=>e.charAt(0).toUpperCase()+e.slice(1);function kM(e){const t=Math.abs(e),n=t%10,a=t%100;return a>=11&&a<=19||n===0?"many":n===1?"one":"few"}const Cee=()=>{const e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(a,r,i,s){const c=e[a]??null;return c===null?c:{unit:c.unit[r],verb:c.verb[s][i?"inclusive":"notInclusive"]}}const n={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return a=>{switch(a.code){case"invalid_type":return`Gautas tipas ${Nee(a.input)}, o tikėtasi - ${Xf(a.expected)}`;case"invalid_value":return a.values.length===1?`Privalo būti ${ut(a.values[0])}`:`Privalo būti vienas iš ${Pe(a.values,"|")} pasirinkimų`;case"too_big":{const r=Xf(a.origin),i=t(a.origin,kM(Number(a.maximum)),a.inclusive??!1,"smaller");if(i?.verb)return`${zf(r??a.origin??"reikšmė")} ${i.verb} ${a.maximum.toString()} ${i.unit??"elementų"}`;const s=a.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${zf(r??a.origin??"reikšmė")} turi būti ${s} ${a.maximum.toString()} ${i?.unit}`}case"too_small":{const r=Xf(a.origin),i=t(a.origin,kM(Number(a.minimum)),a.inclusive??!1,"bigger");if(i?.verb)return`${zf(r??a.origin??"reikšmė")} ${i.verb} ${a.minimum.toString()} ${i.unit??"elementų"}`;const s=a.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${zf(r??a.origin??"reikšmė")} turi būti ${s} ${a.minimum.toString()} ${i?.unit}`}case"invalid_format":{const r=a;return r.format==="starts_with"?`Eilutė privalo prasidėti "${r.prefix}"`:r.format==="ends_with"?`Eilutė privalo pasibaigti "${r.suffix}"`:r.format==="includes"?`Eilutė privalo įtraukti "${r.includes}"`:r.format==="regex"?`Eilutė privalo atitikti ${r.pattern}`:`Neteisingas ${n[r.format]??a.format}`}case"not_multiple_of":return`Skaičius privalo būti ${a.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${a.keys.length>1?"i":"as"} rakt${a.keys.length>1?"ai":"as"}: ${Pe(a.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const r=Xf(a.origin);return`${zf(r??a.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Ree(){return{localeError:Cee()}}const Aee=()=>{const e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"број";case"object":{if(Array.isArray(r))return"низа";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return r=>{switch(r.code){case"invalid_type":return`Грешен внес: се очекува ${r.expected}, примено ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Invalid input: expected ${ut(r.values[0])}`:`Грешана опција: се очекува една ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Премногу голем: се очекува ${r.origin??"вредноста"} да има ${i}${r.maximum.toString()} ${s.unit??"елементи"}`:`Премногу голем: се очекува ${r.origin??"вредноста"} да биде ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Премногу мал: се очекува ${r.origin} да има ${i}${r.minimum.toString()} ${s.unit}`:`Премногу мал: се очекува ${r.origin} да биде ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Неважечка низа: мора да започнува со "${i.prefix}"`:i.format==="ends_with"?`Неважечка низа: мора да завршува со "${i.suffix}"`:i.format==="includes"?`Неважечка низа: мора да вклучува "${i.includes}"`:i.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${i.pattern}`:`Invalid ${a[i.format]??r.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${r.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${r.origin}`;default:return"Грешен внес"}}};function Iee(){return{localeError:Aee()}}const Oee=()=>{const e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nombor";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Input tidak sah: dijangka ${r.expected}, diterima ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Input tidak sah: dijangka ${ut(r.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Terlalu besar: dijangka ${r.origin??"nilai"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${r.origin??"nilai"} adalah ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Terlalu kecil: dijangka ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${r.origin} adalah ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${a[i.format]??r.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${r.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${Pe(r.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${r.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${r.origin}`;default:return"Input tidak sah"}}};function Dee(){return{localeError:Oee()}}const jee=()=>{const e={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"getal";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return r=>{switch(r.code){case"invalid_type":return`Ongeldige invoer: verwacht ${r.expected}, ontving ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ongeldige invoer: verwacht ${ut(r.values[0])}`:`Ongeldige optie: verwacht één van ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Te groot: verwacht dat ${r.origin??"waarde"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"elementen"}`:`Te groot: verwacht dat ${r.origin??"waarde"} ${i}${r.maximum.toString()} is`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Te klein: verwacht dat ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Te klein: verwacht dat ${r.origin} ${i}${r.minimum.toString()} is`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${a[i.format]??r.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${r.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${r.keys.length>1?"s":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${r.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${r.origin}`;default:return"Ongeldige invoer"}}};function Lee(){return{localeError:jee()}}const $ee=()=>{const e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"tall";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`Ugyldig input: forventet ${r.expected}, fikk ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ugyldig verdi: forventet ${ut(r.values[0])}`:`Ugyldig valg: forventet en av ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`For stor(t): forventet ${r.origin??"value"} til å ha ${i}${r.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${r.origin??"value"} til å ha ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`For lite(n): forventet ${r.origin} til å ha ${i}${r.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${r.origin} til å ha ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Ugyldig streng: må starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: må ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: må inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: må matche mønsteret ${i.pattern}`:`Ugyldig ${a[i.format]??r.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${r.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${r.origin}`;default:return"Ugyldig input"}}};function Mee(){return{localeError:$ee()}}const Pee=()=>{const e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"numara";case"object":{if(Array.isArray(r))return"saf";if(r===null)return"gayb";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return r=>{switch(r.code){case"invalid_type":return`Fâsit giren: umulan ${r.expected}, alınan ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Fâsit giren: umulan ${ut(r.values[0])}`:`Fâsit tercih: mûteberler ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Fazla büyük: ${r.origin??"value"}, ${i}${r.maximum.toString()} ${s.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${r.origin??"value"}, ${i}${r.maximum.toString()} olmalıydı.`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Fazla küçük: ${r.origin}, ${i}${r.minimum.toString()} ${s.unit} sahip olmalıydı.`:`Fazla küçük: ${r.origin}, ${i}${r.minimum.toString()} olmalıydı.`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Fâsit metin: "${i.prefix}" ile başlamalı.`:i.format==="ends_with"?`Fâsit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`Fâsit metin: "${i.includes}" ihtivâ etmeli.`:i.format==="regex"?`Fâsit metin: ${i.pattern} nakşına uymalı.`:`Fâsit ${a[i.format]??r.format}`}case"not_multiple_of":return`Fâsit sayı: ${r.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${r.keys.length>1?"s":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`${r.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${r.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Uee(){return{localeError:Pee()}}const zee=()=>{const e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"عدد";case"object":{if(Array.isArray(r))return"ارې";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return r=>{switch(r.code){case"invalid_type":return`ناسم ورودي: باید ${r.expected} وای, مګر ${n(r.input)} ترلاسه شو`;case"invalid_value":return r.values.length===1?`ناسم ورودي: باید ${ut(r.values[0])} وای`:`ناسم انتخاب: باید یو له ${Pe(r.values,"|")} څخه وای`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`ډیر لوی: ${r.origin??"ارزښت"} باید ${i}${r.maximum.toString()} ${s.unit??"عنصرونه"} ولري`:`ډیر لوی: ${r.origin??"ارزښت"} باید ${i}${r.maximum.toString()} وي`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`ډیر کوچنی: ${r.origin} باید ${i}${r.minimum.toString()} ${s.unit} ولري`:`ډیر کوچنی: ${r.origin} باید ${i}${r.minimum.toString()} وي`}case"invalid_format":{const i=r;return i.format==="starts_with"?`ناسم متن: باید د "${i.prefix}" سره پیل شي`:i.format==="ends_with"?`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`:i.format==="includes"?`ناسم متن: باید "${i.includes}" ولري`:i.format==="regex"?`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`:`${a[i.format]??r.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${r.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${r.keys.length>1?"کلیډونه":"کلیډ"}: ${Pe(r.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${r.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${r.origin} کې`;default:return"ناسمه ورودي"}}};function Fee(){return{localeError:zee()}}const Bee=()=>{const e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"liczba";case"object":{if(Array.isArray(r))return"tablica";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return r=>{switch(r.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${r.expected}, otrzymano ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${ut(r.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Za duża wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${i}${r.maximum.toString()} ${s.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Za mała wartość: oczekiwano, że ${r.origin??"wartość"} będzie mieć ${i}${r.minimum.toString()} ${s.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${r.origin??"wartość"} będzie wynosić ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`:i.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`:i.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`:i.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`:`Nieprawidłow(y/a/e) ${a[i.format]??r.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${r.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${r.keys.length>1?"s":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${r.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${r.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Hee(){return{localeError:Bee()}}const Vee=()=>{const e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"número";case"object":{if(Array.isArray(r))return"array";if(r===null)return"nulo";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return r=>{switch(r.code){case"invalid_type":return`Tipo inválido: esperado ${r.expected}, recebido ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Entrada inválida: esperado ${ut(r.values[0])}`:`Opção inválida: esperada uma das ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Muito grande: esperado que ${r.origin??"valor"} tivesse ${i}${r.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${r.origin??"valor"} fosse ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Muito pequeno: esperado que ${r.origin} tivesse ${i}${r.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${r.origin} fosse ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Texto inválido: deve começar com "${i.prefix}"`:i.format==="ends_with"?`Texto inválido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inválido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inválido: deve corresponder ao padrão ${i.pattern}`:`${a[i.format]??r.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${r.divisor}`;case"unrecognized_keys":return`Chave${r.keys.length>1?"s":""} desconhecida${r.keys.length>1?"s":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Chave inválida em ${r.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${r.origin}`;default:return"Campo inválido"}}};function Gee(){return{localeError:Vee()}}function TM(e,t,n,a){const r=Math.abs(e),i=r%10,s=r%100;return s>=11&&s<=19?a:i===1?t:i>=2&&i<=4?n:a}const Wee=()=>{const e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"массив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return r=>{switch(r.code){case"invalid_type":return`Неверный ввод: ожидалось ${r.expected}, получено ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Неверный ввод: ожидалось ${ut(r.values[0])}`:`Неверный вариант: ожидалось одно из ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);if(s){const c=Number(r.maximum),u=TM(c,s.unit.one,s.unit.few,s.unit.many);return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет иметь ${i}${r.maximum.toString()} ${u}`}return`Слишком большое значение: ожидалось, что ${r.origin??"значение"} будет ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);if(s){const c=Number(r.minimum),u=TM(c,s.unit.one,s.unit.few,s.unit.many);return`Слишком маленькое значение: ожидалось, что ${r.origin} будет иметь ${i}${r.minimum.toString()} ${u}`}return`Слишком маленькое значение: ожидалось, что ${r.origin} будет ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Неверная строка: должна начинаться с "${i.prefix}"`:i.format==="ends_with"?`Неверная строка: должна заканчиваться на "${i.suffix}"`:i.format==="includes"?`Неверная строка: должна содержать "${i.includes}"`:i.format==="regex"?`Неверная строка: должна соответствовать шаблону ${i.pattern}`:`Неверный ${a[i.format]??r.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${r.divisor}`;case"unrecognized_keys":return`Нераспознанн${r.keys.length>1?"ые":"ый"} ключ${r.keys.length>1?"и":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${r.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${r.origin}`;default:return"Неверные входные данные"}}};function Kee(){return{localeError:Wee()}}const Zee=()=>{const e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"število";case"object":{if(Array.isArray(r))return"tabela";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return r=>{switch(r.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${r.expected}, prejeto ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Neveljaven vnos: pričakovano ${ut(r.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} imelo ${i}${r.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${r.origin??"vrednost"} ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Premajhno: pričakovano, da bo ${r.origin} imelo ${i}${r.minimum.toString()} ${s.unit}`:`Premajhno: pričakovano, da bo ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Neveljaven niz: mora se začeti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se končati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${a[i.format]??r.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${r.divisor}`;case"unrecognized_keys":return`Neprepoznan${r.keys.length>1?"i ključi":" ključ"}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${r.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${r.origin}`;default:return"Neveljaven vnos"}}};function Yee(){return{localeError:Zee()}}const qee=()=>{const e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"antal";case"object":{if(Array.isArray(r))return"lista";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return r=>{switch(r.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${r.expected}, fick ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ogiltig inmatning: förväntat ${ut(r.values[0])}`:`Ogiltigt val: förväntade en av ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`För stor(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.maximum.toString()} ${s.unit??"element"}`:`För stor(t): förväntat ${r.origin??"värdet"} att ha ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`För lite(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.minimum.toString()} ${s.unit}`:`För lite(t): förväntade ${r.origin??"värdet"} att ha ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Ogiltig sträng: måste börja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig sträng: måste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig sträng: måste innehålla "${i.includes}"`:i.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`:`Ogiltig(t) ${a[i.format]??r.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${r.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${r.origin??"värdet"}`;default:return"Ogiltig input"}}};function Xee(){return{localeError:qee()}}const Jee=()=>{const e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(r))return"அணி";if(r===null)return"வெறுமை";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return r=>{switch(r.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r.expected}, பெறப்பட்டது ${n(r.input)}`;case"invalid_value":return r.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${ut(r.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${Pe(r.values,"|")} இல் ஒன்று`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${i}${r.maximum.toString()} ${s.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${r.origin??"மதிப்பு"} ${i}${r.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${i}${r.minimum.toString()} ${s.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${r.origin} ${i}${r.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const i=r;return i.format==="starts_with"?`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`:i.format==="ends_with"?`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`:i.format==="includes"?`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`:i.format==="regex"?`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${a[i.format]??r.format}`}case"not_multiple_of":return`தவறான எண்: ${r.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${r.keys.length>1?"கள்":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`${r.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${r.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Qee(){return{localeError:Jee()}}const ete=()=>{const e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(r))return"อาร์เรย์ (Array)";if(r===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return r=>{switch(r.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${r.expected} แต่ได้รับ ${n(r.input)}`;case"invalid_value":return r.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${ut(r.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"ไม่เกิน":"น้อยกว่า",s=t(r.origin);return s?`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${i} ${r.maximum.toString()} ${s.unit??"รายการ"}`:`เกินกำหนด: ${r.origin??"ค่า"} ควรมี${i} ${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?"อย่างน้อย":"มากกว่า",s=t(r.origin);return s?`น้อยกว่ากำหนด: ${r.origin} ควรมี${i} ${r.minimum.toString()} ${s.unit}`:`น้อยกว่ากำหนด: ${r.origin} ควรมี${i} ${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`:i.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`:i.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`:i.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`:`รูปแบบไม่ถูกต้อง: ${a[i.format]??r.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${r.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${Pe(r.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${r.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${r.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function tte(){return{localeError:ete()}}const nte=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},rte=()=>{const e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(a){return e[a]??null}const n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return a=>{switch(a.code){case"invalid_type":return`Geçersiz değer: beklenen ${a.expected}, alınan ${nte(a.input)}`;case"invalid_value":return a.values.length===1?`Geçersiz değer: beklenen ${ut(a.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${Pe(a.values,"|")}`;case"too_big":{const r=a.inclusive?"<=":"<",i=t(a.origin);return i?`Çok büyük: beklenen ${a.origin??"değer"} ${r}${a.maximum.toString()} ${i.unit??"öğe"}`:`Çok büyük: beklenen ${a.origin??"değer"} ${r}${a.maximum.toString()}`}case"too_small":{const r=a.inclusive?">=":">",i=t(a.origin);return i?`Çok küçük: beklenen ${a.origin} ${r}${a.minimum.toString()} ${i.unit}`:`Çok küçük: beklenen ${a.origin} ${r}${a.minimum.toString()}`}case"invalid_format":{const r=a;return r.format==="starts_with"?`Geçersiz metin: "${r.prefix}" ile başlamalı`:r.format==="ends_with"?`Geçersiz metin: "${r.suffix}" ile bitmeli`:r.format==="includes"?`Geçersiz metin: "${r.includes}" içermeli`:r.format==="regex"?`Geçersiz metin: ${r.pattern} desenine uymalı`:`Geçersiz ${n[r.format]??a.format}`}case"not_multiple_of":return`Geçersiz sayı: ${a.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${a.keys.length>1?"lar":""}: ${Pe(a.keys,", ")}`;case"invalid_key":return`${a.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${a.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function ate(){return{localeError:rte()}}const ite=()=>{const e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"число";case"object":{if(Array.isArray(r))return"масив";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return r=>{switch(r.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${r.expected}, отримано ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Неправильні вхідні дані: очікується ${ut(r.values[0])}`:`Неправильна опція: очікується одне з ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Занадто велике: очікується, що ${r.origin??"значення"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"елементів"}`:`Занадто велике: очікується, що ${r.origin??"значення"} буде ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Занадто мале: очікується, що ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Занадто мале: очікується, що ${r.origin} буде ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Неправильний рядок: повинен починатися з "${i.prefix}"`:i.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`:i.format==="includes"?`Неправильний рядок: повинен містити "${i.includes}"`:i.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`:`Неправильний ${a[i.format]??r.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${r.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${r.keys.length>1?"і":""}: ${Pe(r.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${r.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${r.origin}`;default:return"Неправильні вхідні дані"}}};function o6(){return{localeError:ite()}}function ote(){return o6()}const ste=()=>{const e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"نمبر";case"object":{if(Array.isArray(r))return"آرے";if(r===null)return"نل";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return r=>{switch(r.code){case"invalid_type":return`غلط ان پٹ: ${r.expected} متوقع تھا، ${n(r.input)} موصول ہوا`;case"invalid_value":return r.values.length===1?`غلط ان پٹ: ${ut(r.values[0])} متوقع تھا`:`غلط آپشن: ${Pe(r.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`بہت بڑا: ${r.origin??"ویلیو"} کے ${i}${r.maximum.toString()} ${s.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${r.origin??"ویلیو"} کا ${i}${r.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`بہت چھوٹا: ${r.origin} کے ${i}${r.minimum.toString()} ${s.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${r.origin} کا ${i}${r.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const i=r;return i.format==="starts_with"?`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`:i.format==="ends_with"?`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`:i.format==="includes"?`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`:i.format==="regex"?`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`:`غلط ${a[i.format]??r.format}`}case"not_multiple_of":return`غلط نمبر: ${r.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${r.keys.length>1?"ز":""}: ${Pe(r.keys,"، ")}`;case"invalid_key":return`${r.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${r.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function lte(){return{localeError:ste()}}const cte=()=>{const e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"số";case"object":{if(Array.isArray(r))return"mảng";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return r=>{switch(r.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${r.expected}, nhận được ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Đầu vào không hợp lệ: mong đợi ${ut(r.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Quá lớn: mong đợi ${r.origin??"giá trị"} ${s.verb} ${i}${r.maximum.toString()} ${s.unit??"phần tử"}`:`Quá lớn: mong đợi ${r.origin??"giá trị"} ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Quá nhỏ: mong đợi ${r.origin} ${s.verb} ${i}${r.minimum.toString()} ${s.unit}`:`Quá nhỏ: mong đợi ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`:i.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`:i.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`:i.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`:`${a[i.format]??r.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${r.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${Pe(r.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${r.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${r.origin}`;default:return"Đầu vào không hợp lệ"}}};function ute(){return{localeError:cte()}}const dte=()=>{const e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(r))return"数组";if(r===null)return"空值(null)";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return r=>{switch(r.code){case"invalid_type":return`无效输入:期望 ${r.expected},实际接收 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`无效输入:期望 ${ut(r.values[0])}`:`无效选项:期望以下之一 ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`数值过大:期望 ${r.origin??"值"} ${i}${r.maximum.toString()} ${s.unit??"个元素"}`:`数值过大:期望 ${r.origin??"值"} ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`数值过小:期望 ${r.origin} ${i}${r.minimum.toString()} ${s.unit}`:`数值过小:期望 ${r.origin} ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`无效字符串:必须以 "${i.prefix}" 开头`:i.format==="ends_with"?`无效字符串:必须以 "${i.suffix}" 结尾`:i.format==="includes"?`无效字符串:必须包含 "${i.includes}"`:i.format==="regex"?`无效字符串:必须满足正则表达式 ${i.pattern}`:`无效${a[i.format]??r.format}`}case"not_multiple_of":return`无效数字:必须是 ${r.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${Pe(r.keys,", ")}`;case"invalid_key":return`${r.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${r.origin} 中包含无效值(value)`;default:return"无效输入"}}};function fte(){return{localeError:dte()}}const pte=()=>{const e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"number";case"object":{if(Array.isArray(r))return"array";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return r=>{switch(r.code){case"invalid_type":return`無效的輸入值:預期為 ${r.expected},但收到 ${n(r.input)}`;case"invalid_value":return r.values.length===1?`無效的輸入值:預期為 ${ut(r.values[0])}`:`無效的選項:預期為以下其中之一 ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`數值過大:預期 ${r.origin??"值"} 應為 ${i}${r.maximum.toString()} ${s.unit??"個元素"}`:`數值過大:預期 ${r.origin??"值"} 應為 ${i}${r.maximum.toString()}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`數值過小:預期 ${r.origin} 應為 ${i}${r.minimum.toString()} ${s.unit}`:`數值過小:預期 ${r.origin} 應為 ${i}${r.minimum.toString()}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`無效的字串:必須以 "${i.prefix}" 開頭`:i.format==="ends_with"?`無效的字串:必須以 "${i.suffix}" 結尾`:i.format==="includes"?`無效的字串:必須包含 "${i.includes}"`:i.format==="regex"?`無效的字串:必須符合格式 ${i.pattern}`:`無效的 ${a[i.format]??r.format}`}case"not_multiple_of":return`無效的數字:必須為 ${r.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${r.keys.length>1?"們":""}:${Pe(r.keys,"、")}`;case"invalid_key":return`${r.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${r.origin} 中有無效的值`;default:return"無效的輸入值"}}};function mte(){return{localeError:pte()}}const hte=()=>{const e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(r){return e[r]??null}const n=r=>{const i=typeof r;switch(i){case"number":return Number.isNaN(r)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(r))return"akopọ";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name}}return i},a={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return r=>{switch(r.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${r.expected}, àmọ̀ a rí ${n(r.input)}`;case"invalid_value":return r.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${ut(r.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${Pe(r.values,"|")}`;case"too_big":{const i=r.inclusive?"<=":"<",s=t(r.origin);return s?`Tó pọ̀ jù: a ní láti jẹ́ pé ${r.origin??"iye"} ${s.verb} ${i}${r.maximum} ${s.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${i}${r.maximum}`}case"too_small":{const i=r.inclusive?">=":">",s=t(r.origin);return s?`Kéré ju: a ní láti jẹ́ pé ${r.origin} ${s.verb} ${i}${r.minimum} ${s.unit}`:`Kéré ju: a ní láti jẹ́ ${i}${r.minimum}`}case"invalid_format":{const i=r;return i.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${i.prefix}"`:i.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${i.suffix}"`:i.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${i.includes}"`:i.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${i.pattern}`:`Aṣìṣe: ${a[i.format]??r.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${r.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${Pe(r.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${r.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${r.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function gte(){return{localeError:hte()}}const s6=Object.freeze(Object.defineProperty({__proto__:null,ar:AQ,az:OQ,be:jQ,bg:MQ,ca:UQ,cs:FQ,da:HQ,de:GQ,en:a6,eo:qQ,es:JQ,fa:eee,fi:nee,fr:aee,frCA:oee,he:lee,hu:uee,id:fee,is:hee,it:bee,ja:yee,ka:xee,kh:Eee,km:i6,ko:Tee,lt:Ree,mk:Iee,ms:Dee,nl:Lee,no:Mee,ota:Uee,pl:Hee,ps:Fee,pt:Gee,ru:Kee,sl:Yee,sv:Xee,ta:Qee,th:tte,tr:ate,ua:ote,uk:o6,ur:lte,vi:ute,yo:gte,zhCN:fte,zhTW:mte},Symbol.toStringTag,{value:"Module"}));var NM;const l6=Symbol("ZodOutput"),c6=Symbol("ZodInput");class u6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];if(this._map.set(t,a),a&&typeof a=="object"&&"id"in a){if(this._idmap.has(a.id))throw new Error(`ID ${a.id} already exists in the registry`);this._idmap.set(a.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const r={...a,...this._map.get(t)};return Object.keys(r).length?r:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Ak(){return new u6}(NM=globalThis).__zod_globalRegistry??(NM.__zod_globalRegistry=Ak());const vi=globalThis.__zod_globalRegistry;function d6(e,t){return new e({type:"string",...Ie(t)})}function f6(e,t){return new e({type:"string",coerce:!0,...Ie(t)})}function Ik(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ie(t)})}function rv(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ie(t)})}function Ok(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ie(t)})}function Dk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ie(t)})}function jk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ie(t)})}function Lk(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ie(t)})}function cy(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ie(t)})}function $k(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ie(t)})}function Mk(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ie(t)})}function Pk(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ie(t)})}function Uk(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ie(t)})}function zk(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ie(t)})}function Fk(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ie(t)})}function Bk(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ie(t)})}function Hk(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ie(t)})}function Vk(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ie(t)})}function p6(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...Ie(t)})}function Gk(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ie(t)})}function Wk(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ie(t)})}function Kk(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ie(t)})}function Zk(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ie(t)})}function Yk(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ie(t)})}function qk(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ie(t)})}const m6={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function h6(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ie(t)})}function g6(e,t){return new e({type:"string",format:"date",check:"string_format",...Ie(t)})}function b6(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ie(t)})}function v6(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ie(t)})}function y6(e,t){return new e({type:"number",checks:[],...Ie(t)})}function w6(e,t){return new e({type:"number",coerce:!0,checks:[],...Ie(t)})}function S6(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ie(t)})}function x6(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...Ie(t)})}function _6(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...Ie(t)})}function E6(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...Ie(t)})}function k6(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...Ie(t)})}function T6(e,t){return new e({type:"boolean",...Ie(t)})}function N6(e,t){return new e({type:"boolean",coerce:!0,...Ie(t)})}function C6(e,t){return new e({type:"bigint",...Ie(t)})}function R6(e,t){return new e({type:"bigint",coerce:!0,...Ie(t)})}function A6(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Ie(t)})}function I6(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Ie(t)})}function O6(e,t){return new e({type:"symbol",...Ie(t)})}function D6(e,t){return new e({type:"undefined",...Ie(t)})}function j6(e,t){return new e({type:"null",...Ie(t)})}function L6(e){return new e({type:"any"})}function $6(e){return new e({type:"unknown"})}function M6(e,t){return new e({type:"never",...Ie(t)})}function P6(e,t){return new e({type:"void",...Ie(t)})}function U6(e,t){return new e({type:"date",...Ie(t)})}function z6(e,t){return new e({type:"date",coerce:!0,...Ie(t)})}function F6(e,t){return new e({type:"nan",...Ie(t)})}function Fl(e,t){return new xk({check:"less_than",...Ie(t),value:e,inclusive:!1})}function yi(e,t){return new xk({check:"less_than",...Ie(t),value:e,inclusive:!0})}function Bl(e,t){return new _k({check:"greater_than",...Ie(t),value:e,inclusive:!1})}function La(e,t){return new _k({check:"greater_than",...Ie(t),value:e,inclusive:!0})}function B6(e){return Bl(0,e)}function H6(e){return Fl(0,e)}function V6(e){return yi(0,e)}function G6(e){return La(0,e)}function Rp(e,t){return new k3({check:"multiple_of",...Ie(t),value:e})}function uy(e,t){return new C3({check:"max_size",...Ie(t),maximum:e})}function Ap(e,t){return new R3({check:"min_size",...Ie(t),minimum:e})}function Xk(e,t){return new A3({check:"size_equals",...Ie(t),size:e})}function ed(e,t){return new I3({check:"max_length",...Ie(t),maximum:e})}function Ms(e,t){return new O3({check:"min_length",...Ie(t),minimum:e})}function dy(e,t){return new D3({check:"length_equals",...Ie(t),length:e})}function Jk(e,t){return new j3({check:"string_format",format:"regex",...Ie(t),pattern:e})}function Qk(e){return new L3({check:"string_format",format:"lowercase",...Ie(e)})}function eT(e){return new $3({check:"string_format",format:"uppercase",...Ie(e)})}function tT(e,t){return new M3({check:"string_format",format:"includes",...Ie(t),includes:e})}function nT(e,t){return new P3({check:"string_format",format:"starts_with",...Ie(t),prefix:e})}function rT(e,t){return new U3({check:"string_format",format:"ends_with",...Ie(t),suffix:e})}function W6(e,t,n){return new z3({check:"property",property:e,schema:t,...Ie(n)})}function aT(e,t){return new F3({check:"mime_type",mime:e,...Ie(t)})}function Ws(e){return new B3({check:"overwrite",tx:e})}function iT(e){return Ws(t=>t.normalize(e))}function oT(){return Ws(e=>e.trim())}function sT(){return Ws(e=>e.toLowerCase())}function lT(){return Ws(e=>e.toUpperCase())}function cT(){return Ws(e=>xF(e))}function K6(e,t,n){return new e({type:"array",element:t,...Ie(n)})}function bte(e,t,n){return new e({type:"union",options:t,...Ie(n)})}function vte(e,t,n){return new e({type:"union",options:t,inclusive:!1,...Ie(n)})}function yte(e,t,n,a){return new e({type:"union",options:n,discriminator:t,...Ie(a)})}function wte(e,t,n){return new e({type:"intersection",left:t,right:n})}function Ste(e,t,n,a){const r=n instanceof vt,i=r?a:n,s=r?n:null;return new e({type:"tuple",items:t,rest:s,...Ie(i)})}function xte(e,t,n,a){return new e({type:"record",keyType:t,valueType:n,...Ie(a)})}function _te(e,t,n,a){return new e({type:"map",keyType:t,valueType:n,...Ie(a)})}function Ete(e,t,n){return new e({type:"set",valueType:t,...Ie(n)})}function kte(e,t,n){const a=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new e({type:"enum",entries:a,...Ie(n)})}function Tte(e,t,n){return new e({type:"enum",entries:t,...Ie(n)})}function Nte(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...Ie(n)})}function Z6(e,t){return new e({type:"file",...Ie(t)})}function Cte(e,t){return new e({type:"transform",transform:t})}function Rte(e,t){return new e({type:"optional",innerType:t})}function Ate(e,t){return new e({type:"nullable",innerType:t})}function Ite(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():iy(n)}})}function Ote(e,t,n){return new e({type:"nonoptional",innerType:t,...Ie(n)})}function Dte(e,t){return new e({type:"success",innerType:t})}function jte(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}function Lte(e,t,n){return new e({type:"pipe",in:t,out:n})}function $te(e,t){return new e({type:"readonly",innerType:t})}function Mte(e,t,n){return new e({type:"template_literal",parts:t,...Ie(n)})}function Pte(e,t){return new e({type:"lazy",getter:t})}function Ute(e,t){return new e({type:"promise",innerType:t})}function Y6(e,t,n){const a=Ie(n);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:t,...a})}function q6(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ie(n)})}function X6(e){const t=J6(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(Ju(a,n.value,t._zod.def));else{const r=a;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(Ju(r))}},e(n.value,n)));return t}function J6(e,t){const n=new zn({check:"custom",...Ie(t)});return n._zod.check=e,n}function Q6(e){const t=new zn({check:"describe"});return t._zod.onattach=[n=>{const a=vi.get(n)??{};vi.add(n,{...a,description:e})}],t._zod.check=()=>{},t}function e5(e){const t=new zn({check:"meta"});return t._zod.onattach=[n=>{const a=vi.get(n)??{};vi.add(n,{...a,...e})}],t._zod.check=()=>{},t}function t5(e,t){const n=Ie(t);let a=n.truthy??["true","1","yes","on","y","enabled"],r=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(a=a.map(v=>typeof v=="string"?v.toLowerCase():v),r=r.map(v=>typeof v=="string"?v.toLowerCase():v));const i=new Set(a),s=new Set(r),c=e.Codec??Rk,u=e.Boolean??Tk,d=e.String??bm,m=new d({type:"string",error:n.error}),h=new u({type:"boolean",error:n.error}),g=new c({type:"pipe",in:m,out:h,transform:((v,x)=>{let S=v;return n.case!=="sensitive"&&(S=S.toLowerCase()),i.has(S)?!0:s.has(S)?!1:(x.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:x.value,inst:g,continue:!1}),{})}),reverseTransform:((v,x)=>v===!0?a[0]||"true":r[0]||"false"),error:n.error});return g}function vm(e,t,n,a={}){const r=Ie(a),i={...Ie(a),check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:c=>n.test(c),...r};return n instanceof RegExp&&(i.pattern=n),new e(i)}function td(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??vi,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function kn(e,t,n={path:[],schemaPath:[]}){var a;const r=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path},h=e._zod.parent;if(h)s.ref=h,kn(h,t,m),t.seen.get(h).isParent=!0;else if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,m);else{const g=s.schema,v=t.processors[r.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);v(e,t,g,m)}}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&ea(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&s.schema._prefault&&((a=s.schema).default??(a.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function nd(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=i=>{const s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(i[0])?.id,h=e.external.uri??(v=>v);if(m)return{ref:h(m)};const g=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=g,{defId:g,ref:`${h("__shared")}#/${s}/${g}`}}if(i[1]===n)return{ref:"#"};const u=`#/${s}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},r=i=>{if(i[1].schema.$ref)return;const s=i[1],{ref:c,defId:u}=a(i);s.def={...s.schema},u&&(s.defId=u);const d=s.schema;for(const m in d)delete d[m];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const s=i[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
23
23
 
24
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const s=i[1];if(t===i[0]){r(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){r(i);continue}}if(e.metadataRegistry.get(i[0])?.id){r(i);continue}if(s.cycle){r(i);continue}if(s.count>1&&e.reused==="ref"){r(i);continue}}}function rd(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=s=>{const c=e.seen.get(s),u=c.def??c.schema,d={...u};if(c.ref===null)return;const m=c.ref;if(c.ref=null,m){a(m);const h=e.seen.get(m).schema;h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):(Object.assign(u,h),Object.assign(u,d))}c.isParent||e.override({zodSchema:s,jsonSchema:u,path:c.path??[]})};for(const s of[...e.seen.entries()].reverse())a(s[0]);const r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(s)}Object.assign(r,n.def??n.schema);const i=e.external?.defs??{};for(const s of e.seen.entries()){const c=s[1];c.def&&c.defId&&(i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?r.$defs=i:r.definitions=i);try{const s=JSON.parse(JSON.stringify(r));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ip(t,"input"),output:Ip(t,"output")}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function ea(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return ea(a.element,n);if(a.type==="set")return ea(a.valueType,n);if(a.type==="lazy")return ea(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return ea(a.innerType,n);if(a.type==="intersection")return ea(a.left,n)||ea(a.right,n);if(a.type==="record"||a.type==="map")return ea(a.keyType,n)||ea(a.valueType,n);if(a.type==="pipe")return ea(a.in,n)||ea(a.out,n);if(a.type==="object"){for(const r in a.shape)if(ea(a.shape[r],n))return!0;return!1}if(a.type==="union"){for(const r of a.options)if(ea(r,n))return!0;return!1}if(a.type==="tuple"){for(const r of a.items)if(ea(r,n))return!0;return!!(a.rest&&ea(a.rest,n))}return!1}const n5=(e,t={})=>n=>{const a=td({...n,processors:t});return kn(e,a),nd(a,e),rd(a,e)},Ip=(e,t)=>n=>{const{libraryOptions:a,target:r}=n??{},i=td({...a??{},target:r,io:t,processors:{}});return kn(e,i),nd(i,e),rd(i,e)},zte={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},r5=(e,t,n,a)=>{const r=n;r.type="string";const{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(r.minLength=i),typeof s=="number"&&(r.maxLength=s),c&&(r.format=zte[c]??c,r.format===""&&delete r.format),d&&(r.contentEncoding=d),u&&u.size>0){const m=[...u];m.length===1?r.pattern=m[0].source:m.length>1&&(r.allOf=[...m.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},a5=(e,t,n,a)=>{const r=n,{minimum:i,maximum:s,format:c,multipleOf:u,exclusiveMaximum:d,exclusiveMinimum:m}=e._zod.bag;typeof c=="string"&&c.includes("int")?r.type="integer":r.type="number",typeof m=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.minimum=m,r.exclusiveMinimum=!0):r.exclusiveMinimum=m),typeof i=="number"&&(r.minimum=i,typeof m=="number"&&t.target!=="draft-04"&&(m>=i?delete r.minimum:delete r.exclusiveMinimum)),typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.maximum=d,r.exclusiveMaximum=!0):r.exclusiveMaximum=d),typeof s=="number"&&(r.maximum=s,typeof d=="number"&&t.target!=="draft-04"&&(d<=s?delete r.maximum:delete r.exclusiveMaximum)),typeof u=="number"&&(r.multipleOf=u)},i5=(e,t,n,a)=>{n.type="boolean"},o5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},s5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},l5=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},c5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},u5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},d5=(e,t,n,a)=>{n.not={}},f5=(e,t,n,a)=>{},p5=(e,t,n,a)=>{},m5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},h5=(e,t,n,a)=>{const r=e._zod.def,i=ok(r.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},g5=(e,t,n,a)=>{const r=e._zod.def,i=[];for(const s of r.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},b5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},v5=(e,t,n,a)=>{const r=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},y5=(e,t,n,a)=>{const r=n,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:c,mime:u}=e._zod.bag;s!==void 0&&(i.minLength=s),c!==void 0&&(i.maxLength=c),u?u.length===1?(i.contentMediaType=u[0],Object.assign(r,i)):r.anyOf=u.map(d=>({...i,contentMediaType:d})):Object.assign(r,i)},w5=(e,t,n,a)=>{n.type="boolean"},S5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},x5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},_5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},E5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},k5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},T5=(e,t,n,a)=>{const r=n,i=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;typeof s=="number"&&(r.minItems=s),typeof c=="number"&&(r.maxItems=c),r.type="array",r.items=kn(i.element,t,{...a,path:[...a.path,"items"]})},N5=(e,t,n,a)=>{const r=n,i=e._zod.def;r.type="object",r.properties={};const s=i.shape;for(const d in s)r.properties[d]=kn(s[d],t,{...a,path:[...a.path,"properties",d]});const c=new Set(Object.keys(s)),u=new Set([...c].filter(d=>{const m=i.shape[d]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(r.required=Array.from(u)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=kn(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},uT=(e,t,n,a)=>{const r=e._zod.def,i=r.inclusive===!1,s=r.options.map((c,u)=>kn(c,t,{...a,path:[...a.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=s:n.anyOf=s},C5=(e,t,n,a)=>{const r=e._zod.def,i=kn(r.left,t,{...a,path:[...a.path,"allOf",0]}),s=kn(r.right,t,{...a,path:[...a.path,"allOf",1]}),c=d=>"allOf"in d&&Object.keys(d).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];n.allOf=u},R5=(e,t,n,a)=>{const r=n,i=e._zod.def;r.type="array";const s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((g,v)=>kn(g,t,{...a,path:[...a.path,s,v]})),d=i.rest?kn(i.rest,t,{...a,path:[...a.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=u,d&&(r.items=d)):t.target==="openapi-3.0"?(r.items={anyOf:u},d&&r.items.anyOf.push(d),r.minItems=u.length,d||(r.maxItems=u.length)):(r.items=u,d&&(r.additionalItems=d));const{minimum:m,maximum:h}=e._zod.bag;typeof m=="number"&&(r.minItems=m),typeof h=="number"&&(r.maxItems=h)},A5=(e,t,n,a)=>{const r=n,i=e._zod.def;r.type="object",(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=kn(i.keyType,t,{...a,path:[...a.path,"propertyNames"]})),r.additionalProperties=kn(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]})},I5=(e,t,n,a)=>{const r=e._zod.def,i=kn(r.innerType,t,a),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},O5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType},D5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},j5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},L5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},$5=(e,t,n,a)=>{const r=e._zod.def,i=t.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;kn(i,t,a);const s=t.seen.get(e);s.ref=i},M5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType,n.readOnly=!0},P5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType},U5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType},z5=(e,t,n,a)=>{const r=e._zod.innerType;kn(r,t,a);const i=t.seen.get(e);i.ref=r},s_={string:r5,number:a5,boolean:i5,bigint:o5,symbol:s5,null:l5,undefined:c5,void:u5,never:d5,any:f5,unknown:p5,date:m5,enum:h5,literal:g5,nan:b5,template_literal:v5,file:y5,success:w5,custom:S5,function:x5,transform:_5,map:E5,set:k5,array:T5,object:N5,union:uT,intersection:C5,tuple:R5,record:A5,nullable:I5,nonoptional:O5,default:D5,prefault:j5,catch:L5,pipe:$5,readonly:M5,promise:P5,optional:U5,lazy:z5};function F5(e,t){if("_idmap"in e){const a=e,r=td({...t,processors:s_}),i={};for(const u of a._idmap.entries()){const[d,m]=u;kn(m,r)}const s={},c={registry:a,uri:t?.uri,defs:i};r.external=c;for(const u of a._idmap.entries()){const[d,m]=u;nd(r,m),s[d]=rd(r,m)}if(Object.keys(i).length>0){const u=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:i}}return{schemas:s}}const n=td({...t,processors:s_});return kn(e,n),nd(n,e),rd(n,e)}class Fte{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=td({processors:s_,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return kn(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),nd(this.ctx,t);const a=rd(this.ctx,t),{"~standard":r,...i}=a;return i}}const Bte=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Hte=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:_B,$ZodArray:CB,$ZodAsyncError:jl,$ZodBase64:dB,$ZodBase64URL:pB,$ZodBigInt:Nk,$ZodBigIntFormat:yB,$ZodBoolean:Tk,$ZodCIDRv4:cB,$ZodCIDRv6:uB,$ZodCUID:X3,$ZodCUID2:J3,$ZodCatch:YB,$ZodCheck:zn,$ZodCheckBigIntFormat:N3,$ZodCheckEndsWith:U3,$ZodCheckGreaterThan:_k,$ZodCheckIncludes:M3,$ZodCheckLengthEquals:D3,$ZodCheckLessThan:xk,$ZodCheckLowerCase:L3,$ZodCheckMaxLength:I3,$ZodCheckMaxSize:C3,$ZodCheckMimeType:F3,$ZodCheckMinLength:O3,$ZodCheckMinSize:R3,$ZodCheckMultipleOf:k3,$ZodCheckNumberFormat:T3,$ZodCheckOverwrite:B3,$ZodCheckProperty:z3,$ZodCheckRegex:j3,$ZodCheckSizeEquals:A3,$ZodCheckStartsWith:P3,$ZodCheckStringFormat:gm,$ZodCheckUpperCase:$3,$ZodCodec:Rk,$ZodCustom:r6,$ZodCustomStringFormat:bB,$ZodDate:NB,$ZodDefault:GB,$ZodDiscriminatedUnion:jB,$ZodE164:mB,$ZodEmail:K3,$ZodEmoji:Y3,$ZodEncodeError:ry,$ZodEnum:UB,$ZodError:lk,$ZodFile:FB,$ZodFunction:e6,$ZodGUID:G3,$ZodIPv4:oB,$ZodIPv6:sB,$ZodISODate:rB,$ZodISODateTime:nB,$ZodISODuration:iB,$ZodISOTime:aB,$ZodIntersection:LB,$ZodJWT:gB,$ZodKSUID:tB,$ZodLazy:n6,$ZodLiteral:zB,$ZodMAC:lB,$ZodMap:MB,$ZodNaN:qB,$ZodNanoID:q3,$ZodNever:kB,$ZodNonOptional:KB,$ZodNull:xB,$ZodNullable:VB,$ZodNumber:kk,$ZodNumberFormat:vB,$ZodObject:IB,$ZodObjectJIT:OB,$ZodOptional:HB,$ZodPipe:XB,$ZodPrefault:WB,$ZodPromise:t6,$ZodReadonly:JB,$ZodRealError:Ma,$ZodRecord:$B,$ZodRegistry:u6,$ZodSet:PB,$ZodString:bm,$ZodStringFormat:Tn,$ZodSuccess:ZB,$ZodSymbol:wB,$ZodTemplateLiteral:QB,$ZodTransform:BB,$ZodTuple:Ck,$ZodType:vt,$ZodULID:Q3,$ZodURL:Z3,$ZodUUID:W3,$ZodUndefined:SB,$ZodUnion:ly,$ZodUnknown:EB,$ZodVoid:TB,$ZodXID:eB,$ZodXor:DB,$brand:wF,$constructor:me,$input:c6,$output:l6,Doc:H3,JSONSchema:Bte,JSONSchemaGenerator:Fte,NEVER:yF,TimePrecision:m6,_any:L6,_array:K6,_base64:Kk,_base64url:Zk,_bigint:C6,_boolean:T6,_catch:jte,_check:J6,_cidrv4:Gk,_cidrv6:Wk,_coercedBigint:R6,_coercedBoolean:N6,_coercedDate:z6,_coercedNumber:w6,_coercedString:f6,_cuid:Pk,_cuid2:Uk,_custom:Y6,_date:U6,_decode:pk,_decodeAsync:hk,_default:Ite,_discriminatedUnion:yte,_e164:Yk,_email:Ik,_emoji:$k,_encode:fk,_encodeAsync:mk,_endsWith:rT,_enum:kte,_file:Z6,_float32:x6,_float64:_6,_gt:Bl,_gte:La,_guid:rv,_includes:tT,_int:S6,_int32:E6,_int64:A6,_intersection:wte,_ipv4:Hk,_ipv6:Vk,_isoDate:g6,_isoDateTime:h6,_isoDuration:v6,_isoTime:b6,_jwt:qk,_ksuid:Bk,_lazy:Pte,_length:dy,_literal:Nte,_lowercase:Qk,_lt:Fl,_lte:yi,_mac:p6,_map:_te,_max:yi,_maxLength:ed,_maxSize:uy,_mime:aT,_min:La,_minLength:Ms,_minSize:Ap,_multipleOf:Rp,_nan:F6,_nanoid:Mk,_nativeEnum:Tte,_negative:H6,_never:M6,_nonnegative:G6,_nonoptional:Ote,_nonpositive:V6,_normalize:iT,_null:j6,_nullable:Ate,_number:y6,_optional:Rte,_overwrite:Ws,_parse:um,_parseAsync:dm,_pipe:Lte,_positive:B6,_promise:Ute,_property:W6,_readonly:$te,_record:xte,_refine:q6,_regex:Jk,_safeDecode:bk,_safeDecodeAsync:yk,_safeEncode:gk,_safeEncodeAsync:vk,_safeParse:fm,_safeParseAsync:pm,_set:Ete,_size:Xk,_slugify:cT,_startsWith:nT,_string:d6,_stringFormat:vm,_stringbool:t5,_success:Dte,_superRefine:X6,_symbol:O6,_templateLiteral:Mte,_toLowerCase:sT,_toUpperCase:lT,_transform:Cte,_trim:oT,_tuple:Ste,_uint32:k6,_uint64:I6,_ulid:zk,_undefined:D6,_union:bte,_unknown:$6,_uppercase:eT,_url:cy,_uuid:Ok,_uuidv4:Dk,_uuidv6:jk,_uuidv7:Lk,_void:P6,_xid:Fk,_xor:vte,clone:ni,config:Gr,createStandardJSONSchemaMethod:Ip,createToJSONSchemaMethod:n5,decode:JJ,decodeAsync:eQ,describe:Q6,encode:XJ,encodeAsync:QJ,extractDefs:nd,finalize:rd,flattenError:ck,formatError:uk,globalConfig:Qb,globalRegistry:vi,initializeContext:td,isValidBase64:Ek,isValidBase64URL:fB,isValidJWT:hB,locales:s6,meta:e5,parse:a_,parseAsync:i_,prettifyError:FF,process:kn,regexes:Sk,registry:Ak,safeDecode:nQ,safeDecodeAsync:aQ,safeEncode:tQ,safeEncodeAsync:rQ,safeParse:dk,safeParseAsync:BF,toDotPath:zF,toJSONSchema:F5,treeifyError:UF,util:MF,version:V3},Symbol.toStringTag,{value:"Module"})),dT=me("ZodISODateTime",(e,t)=>{nB.init(e,t),In.init(e,t)});function fT(e){return h6(dT,e)}const pT=me("ZodISODate",(e,t)=>{rB.init(e,t),In.init(e,t)});function mT(e){return g6(pT,e)}const hT=me("ZodISOTime",(e,t)=>{aB.init(e,t),In.init(e,t)});function gT(e){return b6(hT,e)}const bT=me("ZodISODuration",(e,t)=>{iB.init(e,t),In.init(e,t)});function vT(e){return v6(bT,e)}const Vte=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:pT,ZodISODateTime:dT,ZodISODuration:bT,ZodISOTime:hT,date:mT,datetime:fT,duration:vT,time:gT},Symbol.toStringTag,{value:"Module"})),B5=(e,t)=>{lk.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>uk(e,n)},flatten:{value:n=>ck(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ev,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ev,2)}},isEmpty:{get(){return e.issues.length===0}}})},Gte=me("ZodError",B5),Pa=me("ZodError",B5,{Parent:Error}),H5=um(Pa),V5=dm(Pa),G5=fm(Pa),W5=pm(Pa),K5=fk(Pa),Z5=pk(Pa),Y5=mk(Pa),q5=hk(Pa),X5=gk(Pa),J5=bk(Pa),Q5=vk(Pa),eH=yk(Pa),Ot=me("ZodType",(e,t)=>(vt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ip(e,"input"),output:Ip(e,"output")}}),e.toJSONSchema=n5(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Bo(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]})),e.clone=(n,a)=>ni(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>H5(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>G5(e,n,a),e.parseAsync=async(n,a)=>V5(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>W5(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>K5(e,n,a),e.decode=(n,a)=>Z5(e,n,a),e.encodeAsync=async(n,a)=>Y5(e,n,a),e.decodeAsync=async(n,a)=>q5(e,n,a),e.safeEncode=(n,a)=>X5(e,n,a),e.safeDecode=(n,a)=>J5(e,n,a),e.safeEncodeAsync=async(n,a)=>Q5(e,n,a),e.safeDecodeAsync=async(n,a)=>eH(e,n,a),e.refine=(n,a)=>e.check(eV(n,a)),e.superRefine=n=>e.check(tV(n)),e.overwrite=n=>e.check(Ws(n)),e.optional=()=>sv(e),e.nullable=()=>jp(e),e.nullish=()=>sv(jp(e)),e.nonoptional=n=>VH(e,n),e.array=()=>id(e),e.or=n=>od([e,n]),e.and=n=>js(e,n),e.transform=n=>lv(e,zT(n)),e.default=n=>FH(e,n),e.prefault=n=>HH(e,n),e.catch=n=>KH(e,n),e.pipe=n=>lv(e,n),e.readonly=()=>GT(e),e.describe=n=>{const a=e.clone();return vi.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){return vi.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return vi.get(e);const a=e.clone();return vi.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),yT=me("_ZodString",(e,t)=>{bm.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>r5(e,a,r);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(Jk(...a)),e.includes=(...a)=>e.check(tT(...a)),e.startsWith=(...a)=>e.check(nT(...a)),e.endsWith=(...a)=>e.check(rT(...a)),e.min=(...a)=>e.check(Ms(...a)),e.max=(...a)=>e.check(ed(...a)),e.length=(...a)=>e.check(dy(...a)),e.nonempty=(...a)=>e.check(Ms(1,...a)),e.lowercase=a=>e.check(Qk(a)),e.uppercase=a=>e.check(eT(a)),e.trim=()=>e.check(oT()),e.normalize=(...a)=>e.check(iT(...a)),e.toLowerCase=()=>e.check(sT()),e.toUpperCase=()=>e.check(lT()),e.slugify=()=>e.check(cT())}),fy=me("ZodString",(e,t)=>{bm.init(e,t),yT.init(e,t),e.email=n=>e.check(Ik(wT,n)),e.url=n=>e.check(cy(py,n)),e.jwt=n=>e.check(qk(LT,n)),e.emoji=n=>e.check($k(ST,n)),e.guid=n=>e.check(rv(av,n)),e.uuid=n=>e.check(Ok(No,n)),e.uuidv4=n=>e.check(Dk(No,n)),e.uuidv6=n=>e.check(jk(No,n)),e.uuidv7=n=>e.check(Lk(No,n)),e.nanoid=n=>e.check(Mk(xT,n)),e.guid=n=>e.check(rv(av,n)),e.cuid=n=>e.check(Pk(_T,n)),e.cuid2=n=>e.check(Uk(ET,n)),e.ulid=n=>e.check(zk(kT,n)),e.base64=n=>e.check(Kk(OT,n)),e.base64url=n=>e.check(Zk(DT,n)),e.xid=n=>e.check(Fk(TT,n)),e.ksuid=n=>e.check(Bk(NT,n)),e.ipv4=n=>e.check(Hk(CT,n)),e.ipv6=n=>e.check(Vk(RT,n)),e.cidrv4=n=>e.check(Gk(AT,n)),e.cidrv6=n=>e.check(Wk(IT,n)),e.e164=n=>e.check(Yk(jT,n)),e.datetime=n=>e.check(fT(n)),e.date=n=>e.check(mT(n)),e.time=n=>e.check(gT(n)),e.duration=n=>e.check(vT(n))});function Op(e){return d6(fy,e)}const In=me("ZodStringFormat",(e,t)=>{Tn.init(e,t),yT.init(e,t)}),wT=me("ZodEmail",(e,t)=>{K3.init(e,t),In.init(e,t)});function tH(e){return Ik(wT,e)}const av=me("ZodGUID",(e,t)=>{G3.init(e,t),In.init(e,t)});function Wte(e){return rv(av,e)}const No=me("ZodUUID",(e,t)=>{W3.init(e,t),In.init(e,t)});function nH(e){return Ok(No,e)}function Kte(e){return Dk(No,e)}function Zte(e){return jk(No,e)}function Yte(e){return Lk(No,e)}const py=me("ZodURL",(e,t)=>{Z3.init(e,t),In.init(e,t)});function rH(e){return cy(py,e)}function qte(e){return cy(py,{protocol:/^https?$/,hostname:s3,...Ie(e)})}const ST=me("ZodEmoji",(e,t)=>{Y3.init(e,t),In.init(e,t)});function aH(e){return $k(ST,e)}const xT=me("ZodNanoID",(e,t)=>{q3.init(e,t),In.init(e,t)});function iH(e){return Mk(xT,e)}const _T=me("ZodCUID",(e,t)=>{X3.init(e,t),In.init(e,t)});function oH(e){return Pk(_T,e)}const ET=me("ZodCUID2",(e,t)=>{J3.init(e,t),In.init(e,t)});function sH(e){return Uk(ET,e)}const kT=me("ZodULID",(e,t)=>{Q3.init(e,t),In.init(e,t)});function lH(e){return zk(kT,e)}const TT=me("ZodXID",(e,t)=>{eB.init(e,t),In.init(e,t)});function cH(e){return Fk(TT,e)}const NT=me("ZodKSUID",(e,t)=>{tB.init(e,t),In.init(e,t)});function uH(e){return Bk(NT,e)}const CT=me("ZodIPv4",(e,t)=>{oB.init(e,t),In.init(e,t)});function dH(e){return Hk(CT,e)}const fH=me("ZodMAC",(e,t)=>{lB.init(e,t),In.init(e,t)});function pH(e){return p6(fH,e)}const RT=me("ZodIPv6",(e,t)=>{sB.init(e,t),In.init(e,t)});function mH(e){return Vk(RT,e)}const AT=me("ZodCIDRv4",(e,t)=>{cB.init(e,t),In.init(e,t)});function hH(e){return Gk(AT,e)}const IT=me("ZodCIDRv6",(e,t)=>{uB.init(e,t),In.init(e,t)});function gH(e){return Wk(IT,e)}const OT=me("ZodBase64",(e,t)=>{dB.init(e,t),In.init(e,t)});function bH(e){return Kk(OT,e)}const DT=me("ZodBase64URL",(e,t)=>{pB.init(e,t),In.init(e,t)});function vH(e){return Zk(DT,e)}const jT=me("ZodE164",(e,t)=>{mB.init(e,t),In.init(e,t)});function yH(e){return Yk(jT,e)}const LT=me("ZodJWT",(e,t)=>{gB.init(e,t),In.init(e,t)});function wH(e){return qk(LT,e)}const ym=me("ZodCustomStringFormat",(e,t)=>{bB.init(e,t),In.init(e,t)});function Xte(e,t,n={}){return vm(ym,e,t,n)}function Jte(e){return vm(ym,"hostname",o3,e)}function Qte(e){return vm(ym,"hex",_3,e)}function ene(e,t){const n=t?.enc??"hex",a=`${e}_${n}`,r=Sk[a];if(!r)throw new Error(`Unrecognized hash format: ${a}`);return vm(ym,a,r,t)}const my=me("ZodNumber",(e,t)=>{kk.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>a5(e,a,r),e.gt=(a,r)=>e.check(Bl(a,r)),e.gte=(a,r)=>e.check(La(a,r)),e.min=(a,r)=>e.check(La(a,r)),e.lt=(a,r)=>e.check(Fl(a,r)),e.lte=(a,r)=>e.check(yi(a,r)),e.max=(a,r)=>e.check(yi(a,r)),e.int=a=>e.check(l_(a)),e.safe=a=>e.check(l_(a)),e.positive=a=>e.check(Bl(0,a)),e.nonnegative=a=>e.check(La(0,a)),e.negative=a=>e.check(Fl(0,a)),e.nonpositive=a=>e.check(yi(0,a)),e.multipleOf=(a,r)=>e.check(Rp(a,r)),e.step=(a,r)=>e.check(Rp(a,r)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function iv(e){return y6(my,e)}const xd=me("ZodNumberFormat",(e,t)=>{vB.init(e,t),my.init(e,t)});function l_(e){return S6(xd,e)}function tne(e){return x6(xd,e)}function nne(e){return _6(xd,e)}function rne(e){return E6(xd,e)}function ane(e){return k6(xd,e)}const hy=me("ZodBoolean",(e,t)=>{Tk.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>i5(e,n,a)});function $T(e){return T6(hy,e)}const gy=me("ZodBigInt",(e,t)=>{Nk.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>o5(e,a),e.gte=(a,r)=>e.check(La(a,r)),e.min=(a,r)=>e.check(La(a,r)),e.gt=(a,r)=>e.check(Bl(a,r)),e.gte=(a,r)=>e.check(La(a,r)),e.min=(a,r)=>e.check(La(a,r)),e.lt=(a,r)=>e.check(Fl(a,r)),e.lte=(a,r)=>e.check(yi(a,r)),e.max=(a,r)=>e.check(yi(a,r)),e.positive=a=>e.check(Bl(BigInt(0),a)),e.negative=a=>e.check(Fl(BigInt(0),a)),e.nonpositive=a=>e.check(yi(BigInt(0),a)),e.nonnegative=a=>e.check(La(BigInt(0),a)),e.multipleOf=(a,r)=>e.check(Rp(a,r));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function ine(e){return C6(gy,e)}const MT=me("ZodBigIntFormat",(e,t)=>{yB.init(e,t),gy.init(e,t)});function one(e){return A6(MT,e)}function sne(e){return I6(MT,e)}const SH=me("ZodSymbol",(e,t)=>{wB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>s5(e,n)});function lne(e){return O6(SH,e)}const xH=me("ZodUndefined",(e,t)=>{SB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>c5(e,n)});function cne(e){return D6(xH,e)}const _H=me("ZodNull",(e,t)=>{xB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>l5(e,n,a)});function ov(e){return j6(_H,e)}const EH=me("ZodAny",(e,t)=>{_B.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>f5()});function Ll(){return L6(EH)}const kH=me("ZodUnknown",(e,t)=>{EB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>p5()});function ad(){return $6(kH)}const TH=me("ZodNever",(e,t)=>{kB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>d5(e,n,a)});function Ds(e){return M6(TH,e)}const NH=me("ZodVoid",(e,t)=>{TB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>u5(e,n)});function une(e){return P6(NH,e)}const PT=me("ZodDate",(e,t)=>{NB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>m5(e,a),e.min=(a,r)=>e.check(La(a,r)),e.max=(a,r)=>e.check(yi(a,r));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function dne(e){return U6(PT,e)}const CH=me("ZodArray",(e,t)=>{CB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>T5(e,n,a,r),e.element=t.element,e.min=(n,a)=>e.check(Ms(n,a)),e.nonempty=n=>e.check(Ms(1,n)),e.max=(n,a)=>e.check(ed(n,a)),e.length=(n,a)=>e.check(dy(n,a)),e.unwrap=()=>e.element});function id(e,t){return K6(CH,e,t)}function fne(e){const t=e._zod.def.shape;return wy(Object.keys(t))}const by=me("ZodObject",(e,t)=>{OB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>N5(e,n,a,r),Ht(e,"shape",()=>t.shape),e.keyof=()=>wy(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ad()}),e.loose=()=>e.clone({...e._zod.def,catchall:ad()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ds()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>AF(e,n),e.safeExtend=n=>IF(e,n),e.merge=n=>OF(e,n),e.pick=n=>CF(e,n),e.omit=n=>RF(e,n),e.partial=(...n)=>DF(FT,e,n[0]),e.required=(...n)=>jF(BT,e,n[0])});function Jf(e,t){const n={type:"object",shape:e??{},...Ie(t)};return new by(n)}function pne(e,t){return new by({type:"object",shape:e,catchall:Ds(),...Ie(t)})}function mne(e,t){return new by({type:"object",shape:e,catchall:ad(),...Ie(t)})}const vy=me("ZodUnion",(e,t)=>{ly.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>uT(e,n,a,r),e.options=t.options});function od(e,t){return new vy({type:"union",options:e,...Ie(t)})}const RH=me("ZodXor",(e,t)=>{vy.init(e,t),DB.init(e,t),e._zod.processJSONSchema=(n,a,r)=>uT(e,n,a,r),e.options=t.options});function AH(e,t){return new RH({type:"union",options:e,inclusive:!1,...Ie(t)})}const IH=me("ZodDiscriminatedUnion",(e,t)=>{vy.init(e,t),jB.init(e,t)});function hne(e,t,n){return new IH({type:"union",options:t,discriminator:e,...Ie(n)})}const OH=me("ZodIntersection",(e,t)=>{LB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>C5(e,n,a,r)});function js(e,t){return new OH({type:"intersection",left:e,right:t})}const DH=me("ZodTuple",(e,t)=>{Ck.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>R5(e,n,a,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function su(e,t,n){const a=t instanceof vt,r=a?n:t,i=a?t:null;return new DH({type:"tuple",items:e,rest:i,...Ie(r)})}const yy=me("ZodRecord",(e,t)=>{$B.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>A5(e,n,a,r),e.keyType=t.keyType,e.valueType=t.valueType});function UT(e,t,n){return new yy({type:"record",keyType:e,valueType:t,...Ie(n)})}function gne(e,t,n){const a=ni(e);return a._zod.values=void 0,new yy({type:"record",keyType:a,valueType:t,...Ie(n)})}function c_(e,t,n){return new yy({type:"record",keyType:e,valueType:t,mode:"loose",...Ie(n)})}const jH=me("ZodMap",(e,t)=>{MB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>E5(e,n),e.keyType=t.keyType,e.valueType=t.valueType});function bne(e,t,n){return new jH({type:"map",keyType:e,valueType:t,...Ie(n)})}const LH=me("ZodSet",(e,t)=>{PB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>k5(e,n),e.min=(...n)=>e.check(Ap(...n)),e.nonempty=n=>e.check(Ap(1,n)),e.max=(...n)=>e.check(uy(...n)),e.size=(...n)=>e.check(Xk(...n))});function vne(e,t){return new LH({type:"set",valueType:e,...Ie(t)})}const Dp=me("ZodEnum",(e,t)=>{UB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>h5(e,a,r),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,r)=>{const i={};for(const s of a)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Dp({...t,checks:[],...Ie(r),entries:i})},e.exclude=(a,r)=>{const i={...t.entries};for(const s of a)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Dp({...t,checks:[],...Ie(r),entries:i})}});function wy(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Dp({type:"enum",entries:n,...Ie(t)})}function yne(e,t){return new Dp({type:"enum",entries:e,...Ie(t)})}const $H=me("ZodLiteral",(e,t)=>{zB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>g5(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Nb(e,t){return new $H({type:"literal",values:Array.isArray(e)?e:[e],...Ie(t)})}const MH=me("ZodFile",(e,t)=>{FB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>y5(e,n,a),e.min=(n,a)=>e.check(Ap(n,a)),e.max=(n,a)=>e.check(uy(n,a)),e.mime=(n,a)=>e.check(aT(Array.isArray(n)?n:[n],a))});function wne(e){return Z6(MH,e)}const PH=me("ZodTransform",(e,t)=>{BB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>_5(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ry(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Ju(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(Ju(s))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then(i=>(n.value=i,n)):(n.value=r,n)}});function zT(e){return new PH({type:"transform",transform:e})}const FT=me("ZodOptional",(e,t)=>{HB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>U5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function sv(e){return new FT({type:"optional",innerType:e})}const UH=me("ZodNullable",(e,t)=>{VB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>I5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function jp(e){return new UH({type:"nullable",innerType:e})}function Sne(e){return sv(jp(e))}const zH=me("ZodDefault",(e,t)=>{GB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>D5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function FH(e,t){return new zH({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():iy(t)}})}const BH=me("ZodPrefault",(e,t)=>{WB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>j5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function HH(e,t){return new BH({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():iy(t)}})}const BT=me("ZodNonOptional",(e,t)=>{KB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>O5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function VH(e,t){return new BT({type:"nonoptional",innerType:e,...Ie(t)})}const GH=me("ZodSuccess",(e,t)=>{ZB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>w5(e,n,a),e.unwrap=()=>e._zod.def.innerType});function xne(e){return new GH({type:"success",innerType:e})}const WH=me("ZodCatch",(e,t)=>{YB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>L5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function KH(e,t){return new WH({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ZH=me("ZodNaN",(e,t)=>{qB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>b5(e,n)});function _ne(e){return F6(ZH,e)}const HT=me("ZodPipe",(e,t)=>{XB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>$5(e,n,a,r),e.in=t.in,e.out=t.out});function lv(e,t){return new HT({type:"pipe",in:e,out:t})}const VT=me("ZodCodec",(e,t)=>{HT.init(e,t),Rk.init(e,t)});function Ene(e,t,n){return new VT({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}const YH=me("ZodReadonly",(e,t)=>{JB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>M5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function GT(e){return new YH({type:"readonly",innerType:e})}const qH=me("ZodTemplateLiteral",(e,t)=>{QB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>v5(e,n,a)});function kne(e,t){return new qH({type:"template_literal",parts:e,...Ie(t)})}const XH=me("ZodLazy",(e,t)=>{n6.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>z5(e,n,a,r),e.unwrap=()=>e._zod.def.getter()});function WT(e){return new XH({type:"lazy",getter:e})}const JH=me("ZodPromise",(e,t)=>{t6.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>P5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function Tne(e){return new JH({type:"promise",innerType:e})}const QH=me("ZodFunction",(e,t)=>{e6.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>x5(e,n)});function CM(e){return new QH({type:"function",input:Array.isArray(e?.input)?su(e?.input):e?.input??id(ad()),output:e?.output??ad()})}const Sy=me("ZodCustom",(e,t)=>{r6.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>S5(e,n)});function Nne(e){const t=new zn({check:"custom"});return t._zod.check=e,t}function Cne(e,t){return Y6(Sy,e??(()=>!0),t)}function eV(e,t={}){return q6(Sy,e,t)}function tV(e){return X6(e)}const Rne=Q6,Ane=e5;function Ine(e,t={error:`Input not instance of ${e.name}`}){const n=new Sy({type:"custom",check:"custom",fn:a=>a instanceof e,abort:!0,...Ie(t)});return n._zod.bag.Class=e,n}const One=(...e)=>t5({Codec:VT,Boolean:hy,String:fy},...e);function Dne(e){const t=WT(()=>od([Op(e),iv(),$T(),ov(),id(t),UT(Op(),t)]));return t}function jne(e,t){return lv(zT(e),t)}const Lne={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function $ne(e){Gr({customError:e})}function Mne(){return Gr().customError}var u_;u_||(u_={});function Pne(e,t){const n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Une(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");const n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;const a=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===a){const r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function nV(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return Ds();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){const r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return WT(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);const i=Une(r,t),s=Br(i,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){const r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return ov();if(r.length===0)return Ds();if(r.length===1)return Nb(r[0]);if(r.every(s=>typeof s=="string"))return wy(r);const i=r.map(s=>Nb(s));return i.length<2?i[0]:od([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return Nb(e.const);const n=e.type;if(Array.isArray(n)){const r=n.map(i=>{const s={...e,type:i};return nV(s,t)});return r.length===0?Ds():r.length===1?r[0]:od(r)}if(!n)return Ll();let a;switch(n){case"string":{let r=Op();if(e.format){const i=e.format;i==="email"?r=r.check(tH()):i==="uri"||i==="uri-reference"?r=r.check(rH()):i==="uuid"||i==="guid"?r=r.check(nH()):i==="date-time"?r=r.check(fT()):i==="date"?r=r.check(mT()):i==="time"?r=r.check(gT()):i==="duration"?r=r.check(vT()):i==="ipv4"?r=r.check(dH()):i==="ipv6"?r=r.check(mH()):i==="mac"?r=r.check(pH()):i==="cidr"?r=r.check(hH()):i==="cidr-v6"?r=r.check(gH()):i==="base64"?r=r.check(bH()):i==="base64url"?r=r.check(vH()):i==="e164"?r=r.check(yH()):i==="jwt"?r=r.check(wH()):i==="emoji"?r=r.check(aH()):i==="nanoid"?r=r.check(iH()):i==="cuid"?r=r.check(oH()):i==="cuid2"?r=r.check(sH()):i==="ulid"?r=r.check(lH()):i==="xid"?r=r.check(cH()):i==="ksuid"&&(r=r.check(uH()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),a=r;break}case"number":case"integer":{let r=n==="integer"?iv().int():iv();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),a=r;break}case"boolean":{a=$T();break}case"null":{a=ov();break}case"object":{const r={},i=e.properties||{},s=new Set(e.required||[]);for(const[u,d]of Object.entries(i)){const m=Br(d,t);r[u]=s.has(u)?m:m.optional()}if(e.propertyNames){const u=Br(e.propertyNames,t),d=e.additionalProperties&&typeof e.additionalProperties=="object"?Br(e.additionalProperties,t):Ll();if(Object.keys(r).length===0){a=UT(u,d);break}const m=Jf(r).passthrough(),h=c_(u,d);a=js(m,h);break}if(e.patternProperties){const u=e.patternProperties,d=Object.keys(u),m=[];for(const g of d){const v=Br(u[g],t),x=Op().regex(new RegExp(g));m.push(c_(x,v))}const h=[];if(Object.keys(r).length>0&&h.push(Jf(r).passthrough()),h.push(...m),h.length===0)a=Jf({}).passthrough();else if(h.length===1)a=h[0];else{let g=js(h[0],h[1]);for(let v=2;v<h.length;v++)g=js(g,h[v]);a=g}break}const c=Jf(r);e.additionalProperties===!1?a=c.strict():typeof e.additionalProperties=="object"?a=c.catchall(Br(e.additionalProperties,t)):a=c.passthrough();break}case"array":{const r=e.prefixItems,i=e.items;if(r&&Array.isArray(r)){const s=r.map(u=>Br(u,t)),c=i&&typeof i=="object"&&!Array.isArray(i)?Br(i,t):void 0;c?a=su(s).rest(c):a=su(s),typeof e.minItems=="number"&&(a=a.check(Ms(e.minItems))),typeof e.maxItems=="number"&&(a=a.check(ed(e.maxItems)))}else if(Array.isArray(i)){const s=i.map(u=>Br(u,t)),c=e.additionalItems&&typeof e.additionalItems=="object"?Br(e.additionalItems,t):void 0;c?a=su(s).rest(c):a=su(s),typeof e.minItems=="number"&&(a=a.check(Ms(e.minItems))),typeof e.maxItems=="number"&&(a=a.check(ed(e.maxItems)))}else if(i!==void 0){const s=Br(i,t);let c=id(s);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),a=c}else a=id(Ll());break}default:throw new Error(`Unsupported type: ${n}`)}return e.description&&(a=a.describe(e.description)),e.default!==void 0&&(a=a.default(e.default)),a}function Br(e,t){if(typeof e=="boolean")return e?Ll():Ds();let n=nV(e,t);const a=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){const r=e.anyOf.map(s=>Br(s,t)),i=od(r);n=a?js(n,i):i}if(e.oneOf&&Array.isArray(e.oneOf)){const r=e.oneOf.map(s=>Br(s,t)),i=AH(r);n=a?js(n,i):i}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=a?n:Ll();else{let r=a?n:Br(e.allOf[0],t);const i=a?0:1;for(let s=i;s<e.allOf.length;s++)r=js(r,Br(e.allOf[s],t));n=r}return e.nullable===!0&&t.version==="openapi-3.0"&&(n=jp(n)),e.readOnly===!0&&(n=GT(n)),n}function zne(e,t){if(typeof e=="boolean")return e?Ll():Ds();const n=Pne(e,t?.defaultTarget),a=e.$defs||e.definitions||{};return Br(e,{version:n,defs:a,refs:new Map,processing:new Set,rootSchema:e})}function Fne(e){return f6(fy,e)}function Bne(e){return w6(my,e)}function Hne(e){return N6(hy,e)}function Vne(e){return R6(gy,e)}function Gne(e){return z6(PT,e)}const Wne=Object.freeze(Object.defineProperty({__proto__:null,bigint:Vne,boolean:Hne,date:Gne,number:Bne,string:Fne},Symbol.toStringTag,{value:"Module"}));Gr(a6());const D=Object.freeze(Object.defineProperty({__proto__:null,$brand:wF,$input:c6,$output:l6,NEVER:yF,TimePrecision:m6,ZodAny:EH,ZodArray:CH,ZodBase64:OT,ZodBase64URL:DT,ZodBigInt:gy,ZodBigIntFormat:MT,ZodBoolean:hy,ZodCIDRv4:AT,ZodCIDRv6:IT,ZodCUID:_T,ZodCUID2:ET,ZodCatch:WH,ZodCodec:VT,ZodCustom:Sy,ZodCustomStringFormat:ym,ZodDate:PT,ZodDefault:zH,ZodDiscriminatedUnion:IH,ZodE164:jT,ZodEmail:wT,ZodEmoji:ST,ZodEnum:Dp,ZodError:Gte,ZodFile:MH,get ZodFirstPartyTypeKind(){return u_},ZodFunction:QH,ZodGUID:av,ZodIPv4:CT,ZodIPv6:RT,ZodISODate:pT,ZodISODateTime:dT,ZodISODuration:bT,ZodISOTime:hT,ZodIntersection:OH,ZodIssueCode:Lne,ZodJWT:LT,ZodKSUID:NT,ZodLazy:XH,ZodLiteral:$H,ZodMAC:fH,ZodMap:jH,ZodNaN:ZH,ZodNanoID:xT,ZodNever:TH,ZodNonOptional:BT,ZodNull:_H,ZodNullable:UH,ZodNumber:my,ZodNumberFormat:xd,ZodObject:by,ZodOptional:FT,ZodPipe:HT,ZodPrefault:BH,ZodPromise:JH,ZodReadonly:YH,ZodRealError:Pa,ZodRecord:yy,ZodSet:LH,ZodString:fy,ZodStringFormat:In,ZodSuccess:GH,ZodSymbol:SH,ZodTemplateLiteral:qH,ZodTransform:PH,ZodTuple:DH,ZodType:Ot,ZodULID:kT,ZodURL:py,ZodUUID:No,ZodUndefined:xH,ZodUnion:vy,ZodUnknown:kH,ZodVoid:NH,ZodXID:TT,ZodXor:RH,_ZodString:yT,_default:FH,_function:CM,any:Ll,array:id,base64:bH,base64url:vH,bigint:ine,boolean:$T,catch:KH,check:Nne,cidrv4:hH,cidrv6:gH,clone:ni,codec:Ene,coerce:Wne,config:Gr,core:Hte,cuid:oH,cuid2:sH,custom:Cne,date:dne,decode:Z5,decodeAsync:q5,describe:Rne,discriminatedUnion:hne,e164:yH,email:tH,emoji:aH,encode:K5,encodeAsync:Y5,endsWith:rT,enum:wy,file:wne,flattenError:ck,float32:tne,float64:nne,formatError:uk,fromJSONSchema:zne,function:CM,getErrorMap:Mne,globalRegistry:vi,gt:Bl,gte:La,guid:Wte,hash:ene,hex:Qte,hostname:Jte,httpUrl:qte,includes:tT,instanceof:Ine,int:l_,int32:rne,int64:one,intersection:js,ipv4:dH,ipv6:mH,iso:Vte,json:Dne,jwt:wH,keyof:fne,ksuid:uH,lazy:WT,length:dy,literal:Nb,locales:s6,looseObject:mne,looseRecord:c_,lowercase:Qk,lt:Fl,lte:yi,mac:pH,map:bne,maxLength:ed,maxSize:uy,meta:Ane,mime:aT,minLength:Ms,minSize:Ap,multipleOf:Rp,nan:_ne,nanoid:iH,nativeEnum:yne,negative:H6,never:Ds,nonnegative:G6,nonoptional:VH,nonpositive:V6,normalize:iT,null:ov,nullable:jp,nullish:Sne,number:iv,object:Jf,optional:sv,overwrite:Ws,parse:H5,parseAsync:V5,partialRecord:gne,pipe:lv,positive:B6,prefault:HH,preprocess:jne,prettifyError:FF,promise:Tne,property:W6,readonly:GT,record:UT,refine:eV,regex:Jk,regexes:Sk,registry:Ak,safeDecode:J5,safeDecodeAsync:eH,safeEncode:X5,safeEncodeAsync:Q5,safeParse:G5,safeParseAsync:W5,set:vne,setErrorMap:$ne,size:Xk,slugify:cT,startsWith:nT,strictObject:pne,string:Op,stringFormat:Xte,stringbool:One,success:xne,superRefine:tV,symbol:lne,templateLiteral:kne,toJSONSchema:F5,toLowerCase:sT,toUpperCase:lT,transform:zT,treeifyError:UF,trim:oT,tuple:su,uint32:ane,uint64:sne,ulid:lH,undefined:cne,union:od,unknown:ad,uppercase:eT,url:rH,util:MF,uuid:nH,uuidv4:Kte,uuidv6:Zte,uuidv7:Yte,void:une,xid:cH,xor:AH},Symbol.toStringTag,{value:"Module"})),xy="2025-11-25",Kne=[xy,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Eo="io.modelcontextprotocol/related-task",_y="2.0",Hi=D.custom(e=>e!==null&&(typeof e=="object"||typeof e=="function")),rV=D.union([D.string(),D.number().int()]),aV=D.string(),Zne=D.looseObject({ttl:D.union([D.number(),D.null()]).optional(),pollInterval:D.number().optional()}),KT=D.looseObject({taskId:D.string()}),Yne=D.looseObject({progressToken:rV.optional(),[Eo]:KT.optional()}),wa=D.looseObject({task:Zne.optional(),_meta:Yne.optional()}),$r=D.object({method:D.string(),params:wa.optional()}),ec=D.looseObject({_meta:D.object({[Eo]:D.optional(KT)}).passthrough().optional()}),ri=D.object({method:D.string(),params:ec.optional()}),Kr=D.looseObject({_meta:D.looseObject({[Eo]:KT.optional()}).optional()}),Ey=D.union([D.string(),D.number().int()]),iV=D.object({jsonrpc:D.literal(_y),id:Ey,...$r.shape}).strict(),d_=e=>iV.safeParse(e).success,oV=D.object({jsonrpc:D.literal(_y),...ri.shape}).strict(),qne=e=>oV.safeParse(e).success,sV=D.object({jsonrpc:D.literal(_y),id:Ey,result:Kr}).strict(),Qf=e=>sV.safeParse(e).success;var wt;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(wt||(wt={}));const lV=D.object({jsonrpc:D.literal(_y),id:Ey,error:D.object({code:D.number().int(),message:D.string(),data:D.optional(D.unknown())})}).strict(),Xne=e=>lV.safeParse(e).success,Cb=D.union([iV,oV,sV,lV]),lu=Kr.strict(),Jne=ec.extend({requestId:Ey,reason:D.string().optional()}),ZT=ri.extend({method:D.literal("notifications/cancelled"),params:Jne}),Qne=D.object({src:D.string(),mimeType:D.string().optional(),sizes:D.array(D.string()).optional()}),wm=D.object({icons:D.array(Qne).optional()}),sd=D.object({name:D.string(),title:D.string().optional()}),cV=sd.extend({...sd.shape,...wm.shape,version:D.string(),websiteUrl:D.string().optional()}),ere=D.intersection(D.object({applyDefaults:D.boolean().optional()}),D.record(D.string(),D.unknown())),tre=D.preprocess(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,D.intersection(D.object({form:ere.optional(),url:Hi.optional()}),D.record(D.string(),D.unknown()).optional())),nre=D.object({list:D.optional(D.object({}).passthrough()),cancel:D.optional(D.object({}).passthrough()),requests:D.optional(D.object({sampling:D.optional(D.object({createMessage:D.optional(D.object({}).passthrough())}).passthrough()),elicitation:D.optional(D.object({create:D.optional(D.object({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),rre=D.object({list:D.optional(D.object({}).passthrough()),cancel:D.optional(D.object({}).passthrough()),requests:D.optional(D.object({tools:D.optional(D.object({call:D.optional(D.object({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),are=D.object({experimental:D.record(D.string(),Hi).optional(),sampling:D.object({context:Hi.optional(),tools:Hi.optional()}).optional(),elicitation:tre.optional(),roots:D.object({listChanged:D.boolean().optional()}).optional(),tasks:D.optional(nre)}),ire=wa.extend({protocolVersion:D.string(),capabilities:are,clientInfo:cV}),ore=$r.extend({method:D.literal("initialize"),params:ire}),sre=D.object({experimental:D.record(D.string(),Hi).optional(),logging:Hi.optional(),completions:Hi.optional(),prompts:D.optional(D.object({listChanged:D.optional(D.boolean())})),resources:D.object({subscribe:D.boolean().optional(),listChanged:D.boolean().optional()}).optional(),tools:D.object({listChanged:D.boolean().optional()}).optional(),tasks:D.optional(rre)}).passthrough(),uV=Kr.extend({protocolVersion:D.string(),capabilities:sre,serverInfo:cV,instructions:D.string().optional()}),dV=ri.extend({method:D.literal("notifications/initialized")}),lre=e=>dV.safeParse(e).success,YT=$r.extend({method:D.literal("ping")}),cre=D.object({progress:D.number(),total:D.optional(D.number()),message:D.optional(D.string())}),ure=D.object({...ec.shape,...cre.shape,progressToken:rV}),qT=ri.extend({method:D.literal("notifications/progress"),params:ure}),dre=wa.extend({cursor:aV.optional()}),Sm=$r.extend({params:dre.optional()}),xm=Kr.extend({nextCursor:D.optional(aV)}),_m=D.object({taskId:D.string(),status:D.enum(["working","input_required","completed","failed","cancelled"]),ttl:D.union([D.number(),D.null()]),createdAt:D.string(),lastUpdatedAt:D.string(),pollInterval:D.optional(D.number()),statusMessage:D.optional(D.string())}),Lp=Kr.extend({task:_m}),fre=ec.merge(_m),cv=ri.extend({method:D.literal("notifications/tasks/status"),params:fre}),XT=$r.extend({method:D.literal("tasks/get"),params:wa.extend({taskId:D.string()})}),JT=Kr.merge(_m),QT=$r.extend({method:D.literal("tasks/result"),params:wa.extend({taskId:D.string()})}),eN=Sm.extend({method:D.literal("tasks/list")}),tN=xm.extend({tasks:D.array(_m)}),pre=$r.extend({method:D.literal("tasks/cancel"),params:wa.extend({taskId:D.string()})}),mre=Kr.merge(_m),fV=D.object({uri:D.string(),mimeType:D.optional(D.string()),_meta:D.record(D.string(),D.unknown()).optional()}),pV=fV.extend({text:D.string()}),nN=D.string().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),mV=fV.extend({blob:nN}),Em=D.enum(["user","assistant"]),_d=D.object({audience:D.array(Em).optional(),priority:D.number().min(0).max(1).optional(),lastModified:D.iso.datetime({offset:!0}).optional()}),hV=D.object({...sd.shape,...wm.shape,uri:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string()),annotations:_d.optional(),_meta:D.optional(D.looseObject({}))}),hre=D.object({...sd.shape,...wm.shape,uriTemplate:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string()),annotations:_d.optional(),_meta:D.optional(D.looseObject({}))}),gre=Sm.extend({method:D.literal("resources/list")}),gV=xm.extend({resources:D.array(hV)}),bre=Sm.extend({method:D.literal("resources/templates/list")}),bV=xm.extend({resourceTemplates:D.array(hre)}),rN=wa.extend({uri:D.string()}),vre=rN,yre=$r.extend({method:D.literal("resources/read"),params:vre}),vV=Kr.extend({contents:D.array(D.union([pV,mV]))}),yV=ri.extend({method:D.literal("notifications/resources/list_changed")}),wre=rN,Sre=$r.extend({method:D.literal("resources/subscribe"),params:wre}),xre=rN,_re=$r.extend({method:D.literal("resources/unsubscribe"),params:xre}),Ere=ec.extend({uri:D.string()}),kre=ri.extend({method:D.literal("notifications/resources/updated"),params:Ere}),Tre=D.object({name:D.string(),description:D.optional(D.string()),required:D.optional(D.boolean())}),Nre=D.object({...sd.shape,...wm.shape,description:D.optional(D.string()),arguments:D.optional(D.array(Tre)),_meta:D.optional(D.looseObject({}))}),Cre=Sm.extend({method:D.literal("prompts/list")}),wV=xm.extend({prompts:D.array(Nre)}),Rre=wa.extend({name:D.string(),arguments:D.record(D.string(),D.string()).optional()}),Are=$r.extend({method:D.literal("prompts/get"),params:Rre}),aN=D.object({type:D.literal("text"),text:D.string(),annotations:_d.optional(),_meta:D.record(D.string(),D.unknown()).optional()}),iN=D.object({type:D.literal("image"),data:nN,mimeType:D.string(),annotations:_d.optional(),_meta:D.record(D.string(),D.unknown()).optional()}),oN=D.object({type:D.literal("audio"),data:nN,mimeType:D.string(),annotations:_d.optional(),_meta:D.record(D.string(),D.unknown()).optional()}),Ire=D.object({type:D.literal("tool_use"),name:D.string(),id:D.string(),input:D.object({}).passthrough(),_meta:D.optional(D.object({}).passthrough())}).passthrough(),Ore=D.object({type:D.literal("resource"),resource:D.union([pV,mV]),annotations:_d.optional(),_meta:D.record(D.string(),D.unknown()).optional()}),Dre=hV.extend({type:D.literal("resource_link")}),sN=D.union([aN,iN,oN,Dre,Ore]),jre=D.object({role:Em,content:sN}),SV=Kr.extend({description:D.optional(D.string()),messages:D.array(jre)}),xV=ri.extend({method:D.literal("notifications/prompts/list_changed")}),Lre=D.object({title:D.string().optional(),readOnlyHint:D.boolean().optional(),destructiveHint:D.boolean().optional(),idempotentHint:D.boolean().optional(),openWorldHint:D.boolean().optional()}),$re=D.object({taskSupport:D.enum(["required","optional","forbidden"]).optional()}),_V=D.object({...sd.shape,...wm.shape,description:D.string().optional(),inputSchema:D.object({type:D.literal("object"),properties:D.record(D.string(),Hi).optional(),required:D.array(D.string()).optional()}).catchall(D.unknown()),outputSchema:D.object({type:D.literal("object"),properties:D.record(D.string(),Hi).optional(),required:D.array(D.string()).optional()}).catchall(D.unknown()).optional(),annotations:D.optional(Lre),execution:D.optional($re),_meta:D.record(D.string(),D.unknown()).optional()}),Mre=Sm.extend({method:D.literal("tools/list")}),EV=xm.extend({tools:D.array(_V)}),ky=Kr.extend({content:D.array(sN).default([]),structuredContent:D.record(D.string(),D.unknown()).optional(),isError:D.optional(D.boolean())});ky.or(Kr.extend({toolResult:D.unknown()}));const Pre=wa.extend({name:D.string(),arguments:D.optional(D.record(D.string(),D.unknown()))}),Ure=$r.extend({method:D.literal("tools/call"),params:Pre}),kV=ri.extend({method:D.literal("notifications/tools/list_changed")}),zre=D.object({autoRefresh:D.boolean().default(!0),debounceMs:D.number().int().nonnegative().default(300)}),TV=D.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Fre=wa.extend({level:TV}),Bre=$r.extend({method:D.literal("logging/setLevel"),params:Fre}),Hre=ec.extend({level:TV,logger:D.string().optional(),data:D.unknown()}),Vre=ri.extend({method:D.literal("notifications/message"),params:Hre}),Gre=D.object({name:D.string().optional()}),Wre=D.object({hints:D.optional(D.array(Gre)),costPriority:D.optional(D.number().min(0).max(1)),speedPriority:D.optional(D.number().min(0).max(1)),intelligencePriority:D.optional(D.number().min(0).max(1))}),Kre=D.object({mode:D.optional(D.enum(["auto","required","none"]))}),Zre=D.object({type:D.literal("tool_result"),toolUseId:D.string().describe("The unique identifier for the corresponding tool call."),content:D.array(sN).default([]),structuredContent:D.object({}).passthrough().optional(),isError:D.optional(D.boolean()),_meta:D.optional(D.object({}).passthrough())}).passthrough(),Yre=D.discriminatedUnion("type",[aN,iN,oN]),uv=D.discriminatedUnion("type",[aN,iN,oN,Ire,Zre]),qre=D.object({role:Em,content:D.union([uv,D.array(uv)]),_meta:D.optional(D.object({}).passthrough())}).passthrough(),Xre=wa.extend({messages:D.array(qre),modelPreferences:Wre.optional(),systemPrompt:D.string().optional(),includeContext:D.enum(["none","thisServer","allServers"]).optional(),temperature:D.number().optional(),maxTokens:D.number().int(),stopSequences:D.array(D.string()).optional(),metadata:Hi.optional(),tools:D.optional(D.array(_V)),toolChoice:D.optional(Kre)}),lN=$r.extend({method:D.literal("sampling/createMessage"),params:Xre}),cN=Kr.extend({model:D.string(),stopReason:D.optional(D.enum(["endTurn","stopSequence","maxTokens"]).or(D.string())),role:Em,content:Yre}),Jre=Kr.extend({model:D.string(),stopReason:D.optional(D.enum(["endTurn","stopSequence","maxTokens","toolUse"]).or(D.string())),role:Em,content:D.union([uv,D.array(uv)])}),Qre=D.object({type:D.literal("boolean"),title:D.string().optional(),description:D.string().optional(),default:D.boolean().optional()}),eae=D.object({type:D.literal("string"),title:D.string().optional(),description:D.string().optional(),minLength:D.number().optional(),maxLength:D.number().optional(),format:D.enum(["email","uri","date","date-time"]).optional(),default:D.string().optional()}),tae=D.object({type:D.enum(["number","integer"]),title:D.string().optional(),description:D.string().optional(),minimum:D.number().optional(),maximum:D.number().optional(),default:D.number().optional()}),nae=D.object({type:D.literal("string"),title:D.string().optional(),description:D.string().optional(),enum:D.array(D.string()),default:D.string().optional()}),rae=D.object({type:D.literal("string"),title:D.string().optional(),description:D.string().optional(),oneOf:D.array(D.object({const:D.string(),title:D.string()})),default:D.string().optional()}),aae=D.object({type:D.literal("string"),title:D.string().optional(),description:D.string().optional(),enum:D.array(D.string()),enumNames:D.array(D.string()).optional(),default:D.string().optional()}),iae=D.union([nae,rae]),oae=D.object({type:D.literal("array"),title:D.string().optional(),description:D.string().optional(),minItems:D.number().optional(),maxItems:D.number().optional(),items:D.object({type:D.literal("string"),enum:D.array(D.string())}),default:D.array(D.string()).optional()}),sae=D.object({type:D.literal("array"),title:D.string().optional(),description:D.string().optional(),minItems:D.number().optional(),maxItems:D.number().optional(),items:D.object({anyOf:D.array(D.object({const:D.string(),title:D.string()}))}),default:D.array(D.string()).optional()}),lae=D.union([oae,sae]),cae=D.union([aae,iae,lae]),uae=D.union([cae,Qre,eae,tae]),dae=wa.extend({mode:D.literal("form").optional(),message:D.string(),requestedSchema:D.object({type:D.literal("object"),properties:D.record(D.string(),uae),required:D.array(D.string()).optional()})}),fae=wa.extend({mode:D.literal("url"),message:D.string(),elicitationId:D.string(),url:D.string().url()}),pae=D.union([dae,fae]),uN=$r.extend({method:D.literal("elicitation/create"),params:pae}),mae=ec.extend({elicitationId:D.string()}),hae=ri.extend({method:D.literal("notifications/elicitation/complete"),params:mae}),NV=Kr.extend({action:D.enum(["accept","decline","cancel"]),content:D.preprocess(e=>e===null?void 0:e,D.record(D.string(),D.union([D.string(),D.number(),D.boolean(),D.array(D.string())])).optional())}),gae=D.object({type:D.literal("ref/resource"),uri:D.string()}),bae=D.object({type:D.literal("ref/prompt"),name:D.string()}),vae=wa.extend({ref:D.union([bae,gae]),argument:D.object({name:D.string(),value:D.string()}),context:D.object({arguments:D.record(D.string(),D.string()).optional()}).optional()}),yae=$r.extend({method:D.literal("completion/complete"),params:vae}),CV=Kr.extend({completion:D.looseObject({values:D.array(D.string()).max(100),total:D.optional(D.number().int()),hasMore:D.optional(D.boolean())})}),wae=D.object({uri:D.string().startsWith("file://"),name:D.string().optional(),_meta:D.record(D.string(),D.unknown()).optional()}),RV=$r.extend({method:D.literal("roots/list")}),Sae=Kr.extend({roots:D.array(wae)}),xae=ri.extend({method:D.literal("notifications/roots/list_changed")});D.union([YT,ore,yae,Bre,Are,Cre,gre,bre,yre,Sre,_re,Ure,Mre,XT,QT,eN]);D.union([ZT,qT,dV,xae,cv]);D.union([lu,cN,Jre,NV,Sae,JT,tN,Lp]);D.union([YT,lN,uN,RV,XT,QT,eN]);D.union([ZT,qT,Vre,kre,yV,kV,xV,cv,hae]);D.union([lu,uV,CV,SV,wV,gV,bV,vV,ky,EV,JT,tN,Lp]);class lt extends Error{constructor(t,n,a){super(`MCP error ${t}: ${n}`),this.code=t,this.data=a,this.name="McpError"}static fromError(t,n,a){if(t===wt.UrlElicitationRequired&&a){const r=a;if(r.elicitations)return new _ae(r.elicitations,n)}return new lt(t,n,a)}}class _ae extends lt{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(wt.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){var t,n;return(n=(t=this.data)===null||t===void 0?void 0:t.elicitations)!==null&&n!==void 0?n:[]}}var Hu,Eae=(Hu=class{client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];constructor(t={}){this.opts=t,t.roots&&(this.rootsCache=[...t.roots])}trackConnectorInit(t){const n=this.constructor.name;vF.getInstance().trackConnectorInit({connectorType:n,...t}).catch(a=>ke.debug(`Failed to track connector init: ${a}`))}onNotification(t){this.notificationHandlers.push(t),this.client&&this.setupNotificationHandler()}setupNotificationHandler(){this.client&&(this.client.fallbackNotificationHandler=async t=>{switch(t.method){case"notifications/tools/list_changed":await this.refreshToolsCache();break;case"notifications/resources/list_changed":await this.onResourcesListChanged();break;case"notifications/prompts/list_changed":await this.onPromptsListChanged();break}for(const n of this.notificationHandlers)try{await n(t)}catch(a){ke.error("Error in notification handler:",a)}})}async refreshToolsCache(){if(this.client)try{ke.debug("[Auto] Refreshing tools cache due to list_changed notification");const t=await this.client.listTools();this.toolsCache=t.tools??[],ke.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(t){ke.warn("[Auto] Failed to refresh tools cache:",t)}}async onResourcesListChanged(){ke.debug("[Auto] Resources list changed - clients should re-fetch if needed")}async onPromptsListChanged(){ke.debug("[Auto] Prompts list changed - clients should re-fetch if needed")}async setRoots(t){this.rootsCache=[...t],this.client&&(ke.debug(`Sending roots/list_changed notification with ${t.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(RV,async(t,n)=>(ke.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){ke.debug("setupSamplingHandler: No client available");return}if(!this.opts.samplingCallback){ke.debug("setupSamplingHandler: No sampling callback provided");return}ke.debug("setupSamplingHandler: Setting up sampling request handler"),this.client.setRequestHandler(lN,async(t,n)=>(ke.debug("Server requested sampling, forwarding to callback"),await this.opts.samplingCallback(t.params))),ke.debug("setupSamplingHandler: Sampling handler registered successfully")}setupElicitationHandler(){if(!this.client){ke.debug("setupElicitationHandler: No client available");return}if(!this.opts.elicitationCallback){ke.debug("setupElicitationHandler: No elicitation callback provided");return}ke.debug("setupElicitationHandler: Setting up elicitation request handler"),this.client.setRequestHandler(uN,async(t,n)=>(ke.debug("Server requested elicitation, forwarding to callback"),await this.opts.elicitationCallback(t.params))),ke.debug("setupElicitationHandler: Elicitation handler registered successfully")}async disconnect(){if(!this.connected){ke.debug("Not connected to MCP implementation");return}ke.debug("Disconnecting from MCP implementation"),await this.cleanupResources(),this.connected=!1,ke.debug("Disconnected from MCP implementation")}get isClientConnected(){return this.client!=null}async initialize(t=this.opts.defaultRequestOptions??{}){if(!this.client)throw new Error("MCP client is not connected");ke.debug("Caching server capabilities & tools");const n=this.client.getServerCapabilities();this.capabilitiesCache=n||null;const a=this.client.getServerVersion();this.serverInfoCache=a||null;const r=await this.client.listTools(void 0,t);return this.toolsCache=r.tools??[],ke.debug(`Fetched ${this.toolsCache.length} tools from server`),ke.debug("Server capabilities:",n),ke.debug("Server info:",a),n}get tools(){if(!this.toolsCache)throw new Error("MCP client is not initialized; call initialize() first");return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}async callTool(t,n,a){if(!this.client)throw new Error("MCP client is not connected");const r=a?{...a}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},ke.debug(`[BaseConnector] Added onprogress callback for tool '${t}' to enable progressToken`)),ke.debug(`Calling tool '${t}' with args`,n);const i=await this.client.callTool({name:t,arguments:n},void 0,r);return ke.debug(`Tool '${t}' returned`,i),i}async listTools(t){if(!this.client)throw new Error("MCP client is not connected");return(await this.client.listTools(void 0,t)).tools??[]}async listResources(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug("Listing resources",t?`with cursor: ${t}`:""),await this.client.listResources({cursor:t},n)}async listAllResources(t){if(!this.client)throw new Error("MCP client is not connected");if(!this.capabilitiesCache?.resources)return ke.debug("Server does not advertise resources capability, skipping"),{resources:[]};try{ke.debug("Listing all resources (with auto-pagination)");const n=[];let a;do{const r=await this.client.listResources({cursor:a},t);n.push(...r.resources||[]),a=r.nextCursor}while(a);return{resources:n}}catch(n){if(n.code===-32601)return ke.debug("Server advertised resources but method not found"),{resources:[]};throw n}}async listResourceTemplates(t){if(!this.client)throw new Error("MCP client is not connected");return ke.debug("Listing resource templates"),await this.client.listResourceTemplates(void 0,t)}async readResource(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Reading resource ${t}`),await this.client.readResource({uri:t},n)}async subscribeToResource(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Subscribing to resource: ${t}`),await this.client.subscribeResource({uri:t},n)}async unsubscribeFromResource(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Unsubscribing from resource: ${t}`),await this.client.unsubscribeResource({uri:t},n)}async listPrompts(){if(!this.client)throw new Error("MCP client is not connected");if(!this.capabilitiesCache?.prompts)return ke.debug("Server does not advertise prompts capability, skipping"),{prompts:[]};try{return ke.debug("Listing prompts"),await this.client.listPrompts()}catch(t){if(t.code===-32601)return ke.debug("Server advertised prompts but method not found"),{prompts:[]};throw t}}async getPrompt(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Getting prompt ${t}`),await this.client.getPrompt({name:t,arguments:n})}async request(t,n=null,a){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Sending raw request '${t}' with params`,n),await this.client.request({method:t,params:n??{}},void 0,a)}async cleanupResources(){const t=[];if(this.client)try{typeof this.client.close=="function"&&await this.client.close()}catch(n){const a=`Error closing client: ${n}`;ke.warn(a),t.push(a)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(n){const a=`Error stopping connection manager: ${n}`;ke.warn(a),t.push(a)}finally{this.connectionManager=null}this.toolsCache=null,t.length&&ke.warn(`Resource cleanup finished with ${t.length} issue(s)`)}},ze(Hu,"BaseConnector"),Hu);function Ty(e){return!!e._zod}function Ts(e,t){return Ty(e)?dk(e,t):e.safeParse(t)}function AV(e){var t,n;if(!e)return;let a;if(Ty(e)?a=(n=(t=e._zod)===null||t===void 0?void 0:t.def)===null||n===void 0?void 0:n.shape:a=e.shape,!!a){if(typeof a=="function")try{return a()}catch{return}return a}}function kae(e){var t;if(Ty(e)){const s=(t=e._zod)===null||t===void 0?void 0:t.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}const a=e._def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}const r=e.value;if(r!==void 0)return r}function gl(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function RM(e){const t=AV(e),n=t?.method;if(!n)throw new Error("Schema is missing a method literal");const a=kae(n);if(typeof a!="string")throw new Error("Schema method literal must be a string");return a}function AM(e,t){const n=Ts(e,t);if(!n.success)throw n.error;return n.data}const Tae=6e4;class Nae{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(ZT,n=>{this._oncancel(n)}),this.setNotificationHandler(qT,n=>{this._onprogress(n)}),this.setRequestHandler(YT,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(XT,async(n,a)=>{const r=await this._taskStore.getTask(n.params.taskId,a.sessionId);if(!r)throw new lt(wt.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(QT,async(n,a)=>{const r=async()=>{var i;const s=n.params.taskId;if(this._taskMessageQueue){let u;for(;u=await this._taskMessageQueue.dequeue(s,a.sessionId);){if(u.type==="response"||u.type==="error"){const d=u.message,m=d.id,h=this._requestResolvers.get(m);if(h)if(this._requestResolvers.delete(m),u.type==="response")h(d);else{const g=d,v=new lt(g.error.code,g.error.message,g.error.data);h(v)}else{const g=u.type==="response"?"Response":"Error";this._onerror(new Error(`${g} handler missing for request ${m}`))}continue}await((i=this._transport)===null||i===void 0?void 0:i.send(u.message,{relatedRequestId:a.requestId}))}}const c=await this._taskStore.getTask(s,a.sessionId);if(!c)throw new lt(wt.InvalidParams,`Task not found: ${s}`);if(!gl(c.status))return await this._waitForTaskUpdate(s,a.signal),await r();if(gl(c.status)){const u=await this._taskStore.getTaskResult(s,a.sessionId);return this._clearTaskQueue(s),{...u,_meta:{...u._meta,[Eo]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(eN,async(n,a)=>{var r;try{const{tasks:i,nextCursor:s}=await this._taskStore.listTasks((r=n.params)===null||r===void 0?void 0:r.cursor,a.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new lt(wt.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(pre,async(n,a)=>{try{const r=await this._taskStore.getTask(n.params.taskId,a.sessionId);if(!r)throw new lt(wt.InvalidParams,`Task not found: ${n.params.taskId}`);if(gl(r.status))throw new lt(wt.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",a.sessionId),this._clearTaskQueue(n.params.taskId);const i=await this._taskStore.getTask(n.params.taskId,a.sessionId);if(!i)throw new lt(wt.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...i}}catch(r){throw r instanceof lt?r:new lt(wt.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){const n=this._requestHandlerAbortControllers.get(t.params.requestId);n?.abort(t.params.reason)}_setupTimeout(t,n,a,r,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const a=Date.now()-n.startTime;if(n.maxTotalTimeout&&a>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),lt.fromError(wt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:a});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var n,a,r;this._transport=t;const i=(n=this.transport)===null||n===void 0?void 0:n.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};const s=(a=this.transport)===null||a===void 0?void 0:a.onerror;this._transport.onerror=u=>{s?.(u),this._onerror(u)};const c=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(u,d)=>{c?.(u,d),Qf(u)||Xne(u)?this._onresponse(u):d_(u)?this._onrequest(u,d):qne(u)?this._onnotification(u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`))},await this._transport.start()}_onclose(){var t;const n=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const a=lt.fromError(wt.ConnectionClosed,"Connection closed");this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);for(const r of n.values())r(a)}_onerror(t){var n;(n=this.onerror)===null||n===void 0||n.call(this,t)}_onnotification(t){var n;const a=(n=this._notificationHandlers.get(t.method))!==null&&n!==void 0?n:this.fallbackNotificationHandler;a!==void 0&&Promise.resolve().then(()=>a(t)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(t,n){var a,r,i,s,c,u;const d=(a=this._requestHandlers.get(t.method))!==null&&a!==void 0?a:this.fallbackRequestHandler,m=this._transport,h=(s=(i=(r=t.params)===null||r===void 0?void 0:r._meta)===null||i===void 0?void 0:i[Eo])===null||s===void 0?void 0:s.taskId;if(d===void 0){const y={jsonrpc:"2.0",id:t.id,error:{code:wt.MethodNotFound,message:"Method not found"}};h&&this._taskMessageQueue?this._enqueueTaskMessage(h,{type:"error",message:y,timestamp:Date.now()},m?.sessionId).catch(E=>this._onerror(new Error(`Failed to enqueue error response: ${E}`))):m?.send(y).catch(E=>this._onerror(new Error(`Failed to send an error response: ${E}`)));return}const g=new AbortController;this._requestHandlerAbortControllers.set(t.id,g);const v=(c=t.params)===null||c===void 0?void 0:c.task,x=this._taskStore?this.requestTaskStore(t,m?.sessionId):void 0,S={signal:g.signal,sessionId:m?.sessionId,_meta:(u=t.params)===null||u===void 0?void 0:u._meta,sendNotification:async y=>{const E={relatedRequestId:t.id};h&&(E.relatedTask={taskId:h}),await this.notification(y,E)},sendRequest:async(y,E,_)=>{var k,C;const R={..._,relatedRequestId:t.id};h&&!R.relatedTask&&(R.relatedTask={taskId:h});const I=(C=(k=R.relatedTask)===null||k===void 0?void 0:k.taskId)!==null&&C!==void 0?C:h;return I&&x&&await x.updateTaskStatus(I,"input_required"),await this.request(y,E,R)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:h,taskStore:x,taskRequestedTtl:v?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{v&&this.assertTaskHandlerCapability(t.method)}).then(()=>d(t,S)).then(async y=>{if(g.signal.aborted)return;const E={result:y,jsonrpc:"2.0",id:t.id};h&&this._taskMessageQueue?await this._enqueueTaskMessage(h,{type:"response",message:E,timestamp:Date.now()},m?.sessionId):await m?.send(E)},async y=>{var E;if(g.signal.aborted)return;const _={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(y.code)?y.code:wt.InternalError,message:(E=y.message)!==null&&E!==void 0?E:"Internal error",...y.data!==void 0&&{data:y.data}}};h&&this._taskMessageQueue?await this._enqueueTaskMessage(h,{type:"error",message:_,timestamp:Date.now()},m?.sessionId):await m?.send(_)}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...a}=t.params,r=Number(n),i=this._progressHandlers.get(r);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const s=this._responseHandlers.get(r),c=this._timeoutInfo.get(r);if(c&&s&&c.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),s(u);return}i(a)}_onresponse(t){const n=Number(t.id),a=this._requestResolvers.get(n);if(a){if(this._requestResolvers.delete(n),Qf(t))a(t);else{const s=new lt(t.error.code,t.error.message,t.error.data);a(s)}return}const r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let i=!1;if(Qf(t)&&t.result&&typeof t.result=="object"){const s=t.result;if(s.task&&typeof s.task=="object"){const c=s.task;typeof c.taskId=="string"&&(i=!0,this._taskProgressTokens.set(c.taskId,n))}}if(i||this._progressHandlers.delete(n),Qf(t))r(t);else{const s=lt.fromError(t.error.code,t.error.message,t.error.data);r(s)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)===null||t===void 0?void 0:t.close())}async*requestStream(t,n,a){var r,i,s,c;const{task:u}=a??{};if(!u){try{yield{type:"result",result:await this.request(t,n,a)}}catch(m){yield{type:"error",error:m instanceof lt?m:new lt(wt.InternalError,String(m))}}return}let d;try{const m=await this.request(t,Lp,a);if(m.task)d=m.task.taskId,yield{type:"taskCreated",task:m.task};else throw new lt(wt.InternalError,"Task creation did not return a task");for(;;){const h=await this.getTask({taskId:d},a);if(yield{type:"taskStatus",task:h},gl(h.status)){h.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:d},n,a)}:h.status==="failed"?yield{type:"error",error:new lt(wt.InternalError,`Task ${d} failed`)}:h.status==="cancelled"&&(yield{type:"error",error:new lt(wt.InternalError,`Task ${d} was cancelled`)});return}if(h.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:d},n,a)};return}const g=(s=(r=h.pollInterval)!==null&&r!==void 0?r:(i=this._options)===null||i===void 0?void 0:i.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;await new Promise(v=>setTimeout(v,g)),(c=a?.signal)===null||c===void 0||c.throwIfAborted()}}catch(m){yield{type:"error",error:m instanceof lt?m:new lt(wt.InternalError,String(m))}}}request(t,n,a){const{relatedRequestId:r,resumptionToken:i,onresumptiontoken:s,task:c,relatedTask:u}=a??{};return new Promise((d,m)=>{var h,g,v,x,S,y,E;const _=M=>{m(M)};if(!this._transport){_(new Error("Not connected"));return}if(((h=this._options)===null||h===void 0?void 0:h.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),c&&this.assertTaskCapability(t.method)}catch(M){_(M);return}(g=a?.signal)===null||g===void 0||g.throwIfAborted();const k=this._requestMessageId++,C={...t,jsonrpc:"2.0",id:k};a?.onprogress&&(this._progressHandlers.set(k,a.onprogress),C.params={...t.params,_meta:{...((v=t.params)===null||v===void 0?void 0:v._meta)||{},progressToken:k}}),c&&(C.params={...C.params,task:c}),u&&(C.params={...C.params,_meta:{...((x=C.params)===null||x===void 0?void 0:x._meta)||{},[Eo]:u}});const R=M=>{var P;this._responseHandlers.delete(k),this._progressHandlers.delete(k),this._cleanupTimeout(k),(P=this._transport)===null||P===void 0||P.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:k,reason:String(M)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:s}).catch(K=>this._onerror(new Error(`Failed to send cancellation: ${K}`)));const B=M instanceof lt?M:new lt(wt.RequestTimeout,String(M));m(B)};this._responseHandlers.set(k,M=>{var P;if(!(!((P=a?.signal)===null||P===void 0)&&P.aborted)){if(M instanceof Error)return m(M);try{const B=Ts(n,M.result);B.success?d(B.data):m(B.error)}catch(B){m(B)}}}),(S=a?.signal)===null||S===void 0||S.addEventListener("abort",()=>{var M;R((M=a?.signal)===null||M===void 0?void 0:M.reason)});const I=(y=a?.timeout)!==null&&y!==void 0?y:Tae,A=()=>R(lt.fromError(wt.RequestTimeout,"Request timed out",{timeout:I}));this._setupTimeout(k,I,a?.maxTotalTimeout,A,(E=a?.resetTimeoutOnProgress)!==null&&E!==void 0?E:!1);const O=u?.taskId;if(O){const M=P=>{const B=this._responseHandlers.get(k);B?B(P):this._onerror(new Error(`Response handler missing for side-channeled request ${k}`))};this._requestResolvers.set(k,M),this._enqueueTaskMessage(O,{type:"request",message:C,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(k),m(P)})}else this._transport.send(C,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:s}).catch(M=>{this._cleanupTimeout(k),m(M)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},JT,n)}async getTaskResult(t,n,a){return this.request({method:"tasks/result",params:t},n,a)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},tN,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},mre,n)}async notification(t,n){var a,r,i,s,c;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const u=(a=n?.relatedTask)===null||a===void 0?void 0:a.taskId;if(u){const g={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((r=t.params)===null||r===void 0?void 0:r._meta)||{},[Eo]:n.relatedTask}}};await this._enqueueTaskMessage(u,{type:"notification",message:g,timestamp:Date.now()});return}if(((s=(i=this._options)===null||i===void 0?void 0:i.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var g,v;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let x={...t,jsonrpc:"2.0"};n?.relatedTask&&(x={...x,params:{...x.params,_meta:{...((g=x.params)===null||g===void 0?void 0:g._meta)||{},[Eo]:n.relatedTask}}}),(v=this._transport)===null||v===void 0||v.send(x,n).catch(S=>this._onerror(S))});return}let h={...t,jsonrpc:"2.0"};n?.relatedTask&&(h={...h,params:{...h.params,_meta:{...((c=h.params)===null||c===void 0?void 0:c._meta)||{},[Eo]:n.relatedTask}}}),await this._transport.send(h,n)}setRequestHandler(t,n){const a=RM(t);this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(r,i)=>{const s=AM(t,r);return Promise.resolve(n(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){const a=RM(t);this._notificationHandlers.set(a,r=>{const i=AM(t,r);return Promise.resolve(n(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,a){var r;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const i=(r=this._options)===null||r===void 0?void 0:r.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,a,i)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const a=await this._taskMessageQueue.dequeueAll(t,n);for(const r of a)if(r.type==="request"&&d_(r.message)){const i=r.message.id,s=this._requestResolvers.get(i);s?(s(new lt(wt.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var a,r,i;let s=(r=(a=this._options)===null||a===void 0?void 0:a.defaultTaskPollInterval)!==null&&r!==void 0?r:1e3;try{const c=await((i=this._taskStore)===null||i===void 0?void 0:i.getTask(t));c?.pollInterval&&(s=c.pollInterval)}catch{}return new Promise((c,u)=>{if(n.aborted){u(new lt(wt.InvalidRequest,"Request cancelled"));return}const d=setTimeout(c,s);n.addEventListener("abort",()=>{clearTimeout(d),u(new lt(wt.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const a=this._taskStore;if(!a)throw new Error("No task store configured");return{createTask:async r=>{if(!t)throw new Error("No request provided");return await a.createTask(r,t.id,{method:t.method,params:t.params},n)},getTask:async r=>{const i=await a.getTask(r,n);if(!i)throw new lt(wt.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(r,i,s)=>{await a.storeTaskResult(r,i,s,n);const c=await a.getTask(r,n);if(c){const u=cv.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gl(c.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>a.getTaskResult(r,n),updateTaskStatus:async(r,i,s)=>{const c=await a.getTask(r,n);if(!c)throw new lt(wt.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(gl(c.status))throw new lt(wt.InvalidParams,`Cannot update task "${r}" from terminal status "${c.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await a.updateTaskStatus(r,i,s,n);const u=await a.getTask(r,n);if(u){const d=cv.parse({method:"notifications/tasks/status",params:u});await this.notification(d),gl(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>a.listTasks(r,n)}}}function IM(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Cae(e,t){const n={...e};for(const a in t){const r=a,i=t[r];if(i===void 0)continue;const s=n[r];IM(s)&&IM(i)?n[r]={...s,...i}:n[r]=i}return n}var hg={exports:{}},PS={},yo={},bl={},US={},zS={},FS={},OM;function dv(){return OM||(OM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(_){if(super(),!e.IDENTIFIER.test(_))throw new Error("CodeGen: name must be a valid identifier");this.str=_}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class a extends t{constructor(_){super(),this._items=typeof _=="string"?[_]:_}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const _=this._items[0];return _===""||_==='""'}get str(){var _;return(_=this._str)!==null&&_!==void 0?_:this._str=this._items.reduce((k,C)=>`${k}${C}`,"")}get names(){var _;return(_=this._names)!==null&&_!==void 0?_:this._names=this._items.reduce((k,C)=>(C instanceof n&&(k[C.str]=(k[C.str]||0)+1),k),{})}}e._Code=a,e.nil=new a("");function r(E,..._){const k=[E[0]];let C=0;for(;C<_.length;)c(k,_[C]),k.push(E[++C]);return new a(k)}e._=r;const i=new a("+");function s(E,..._){const k=[v(E[0])];let C=0;for(;C<_.length;)k.push(i),c(k,_[C]),k.push(i,v(E[++C]));return u(k),new a(k)}e.str=s;function c(E,_){_ instanceof a?E.push(..._._items):_ instanceof n?E.push(_):E.push(h(_))}e.addCodeArg=c;function u(E){let _=1;for(;_<E.length-1;){if(E[_]===i){const k=d(E[_-1],E[_+1]);if(k!==void 0){E.splice(_-1,3,k);continue}E[_++]="+"}_++}}function d(E,_){if(_==='""')return E;if(E==='""')return _;if(typeof E=="string")return _ instanceof n||E[E.length-1]!=='"'?void 0:typeof _!="string"?`${E.slice(0,-1)}${_}"`:_[0]==='"'?E.slice(0,-1)+_.slice(1):void 0;if(typeof _=="string"&&_[0]==='"'&&!(E instanceof n))return`"${E}${_.slice(1)}`}function m(E,_){return _.emptyStr()?E:E.emptyStr()?_:s`${E}${_}`}e.strConcat=m;function h(E){return typeof E=="number"||typeof E=="boolean"||E===null?E:v(Array.isArray(E)?E.join(","):E)}function g(E){return new a(v(E))}e.stringify=g;function v(E){return JSON.stringify(E).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=v;function x(E){return typeof E=="string"&&e.IDENTIFIER.test(E)?new a(`.${E}`):r`[${E}]`}e.getProperty=x;function S(E){if(typeof E=="string"&&e.IDENTIFIER.test(E))return new a(`${E}`);throw new Error(`CodeGen: invalid export name: ${E}, use explicit $id name mapping`)}e.getEsmExportName=S;function y(E){return new a(E.toString())}e.regexpCode=y})(FS)),FS}var BS={},DM;function jM(){return DM||(DM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=dv();class n extends Error{constructor(d){super(`CodeGen: "code" for ${d} not defined`),this.value=d.value}}var a;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(a||(e.UsedValueState=a={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class r{constructor({prefixes:d,parent:m}={}){this._names={},this._prefixes=d,this._parent=m}toName(d){return d instanceof t.Name?d:this.name(d)}name(d){return new t.Name(this._newName(d))}_newName(d){const m=this._names[d]||this._nameGroup(d);return`${d}${m.index++}`}_nameGroup(d){var m,h;if(!((h=(m=this._parent)===null||m===void 0?void 0:m._prefixes)===null||h===void 0)&&h.has(d)||this._prefixes&&!this._prefixes.has(d))throw new Error(`CodeGen: prefix "${d}" is not allowed in this scope`);return this._names[d]={prefix:d,index:0}}}e.Scope=r;class i extends t.Name{constructor(d,m){super(m),this.prefix=d}setValue(d,{property:m,itemIndex:h}){this.value=d,this.scopePath=(0,t._)`.${new t.Name(m)}[${h}]`}}e.ValueScopeName=i;const s=(0,t._)`\n`;class c extends r{constructor(d){super(d),this._values={},this._scope=d.scope,this.opts={...d,_n:d.lines?s:t.nil}}get(){return this._scope}name(d){return new i(d,this._newName(d))}value(d,m){var h;if(m.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(d),{prefix:v}=g,x=(h=m.key)!==null&&h!==void 0?h:m.ref;let S=this._values[v];if(S){const _=S.get(x);if(_)return _}else S=this._values[v]=new Map;S.set(x,g);const y=this._scope[v]||(this._scope[v]=[]),E=y.length;return y[E]=m.ref,g.setValue(m,{property:v,itemIndex:E}),g}getValue(d,m){const h=this._values[d];if(h)return h.get(m)}scopeRefs(d,m=this._values){return this._reduceValues(m,h=>{if(h.scopePath===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return(0,t._)`${d}${h.scopePath}`})}scopeCode(d=this._values,m,h){return this._reduceValues(d,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},m,h)}_reduceValues(d,m,h={},g){let v=t.nil;for(const x in d){const S=d[x];if(!S)continue;const y=h[x]=h[x]||new Map;S.forEach(E=>{if(y.has(E))return;y.set(E,a.Started);let _=m(E);if(_){const k=this.opts.es5?e.varKinds.var:e.varKinds.const;v=(0,t._)`${v}${k} ${E} = ${_};${this.opts._n}`}else if(_=g?.(E))v=(0,t._)`${v}${_}${this.opts._n}`;else throw new n(E);y.set(E,a.Completed)})}return v}}e.ValueScope=c})(BS)),BS}var LM;function $t(){return LM||(LM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=dv(),n=jM();var a=dv();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return a.Name}});var r=jM();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(L,$){return this}}class s extends i{constructor(L,$,F){super(),this.varKind=L,this.name=$,this.rhs=F}render({es5:L,_n:$}){const F=L?n.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${F} ${this.name}${W};`+$}optimizeNames(L,$){if(L[this.name.str])return this.rhs&&(this.rhs=te(this.rhs,L,$)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends i{constructor(L,$,F){super(),this.lhs=L,this.rhs=$,this.sideEffects=F}render({_n:L}){return`${this.lhs} = ${this.rhs};`+L}optimizeNames(L,$){if(!(this.lhs instanceof t.Name&&!L[this.lhs.str]&&!this.sideEffects))return this.rhs=te(this.rhs,L,$),this}get names(){const L=this.lhs instanceof t.Name?{}:{...this.lhs.names};return ee(L,this.rhs)}}class u extends c{constructor(L,$,F,W){super(L,F,W),this.op=$}render({_n:L}){return`${this.lhs} ${this.op}= ${this.rhs};`+L}}class d extends i{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`${this.label}:`+L}}class m extends i{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`break${this.label?` ${this.label}`:""};`+L}}class h extends i{constructor(L){super(),this.error=L}render({_n:L}){return`throw ${this.error};`+L}get names(){return this.error.names}}class g extends i{constructor(L){super(),this.code=L}render({_n:L}){return`${this.code};`+L}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(L,$){return this.code=te(this.code,L,$),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class v extends i{constructor(L=[]){super(),this.nodes=L}render(L){return this.nodes.reduce(($,F)=>$+F.render(L),"")}optimizeNodes(){const{nodes:L}=this;let $=L.length;for(;$--;){const F=L[$].optimizeNodes();Array.isArray(F)?L.splice($,1,...F):F?L[$]=F:L.splice($,1)}return L.length>0?this:void 0}optimizeNames(L,$){const{nodes:F}=this;let W=F.length;for(;W--;){const X=F[W];X.optimizeNames(L,$)||(ae(L,X.names),F.splice(W,1))}return F.length>0?this:void 0}get names(){return this.nodes.reduce((L,$)=>K(L,$.names),{})}}class x extends v{render(L){return"{"+L._n+super.render(L)+"}"+L._n}}class S extends v{}class y extends x{}y.kind="else";class E extends x{constructor(L,$){super($),this.condition=L}render(L){let $=`if(${this.condition})`+super.render(L);return this.else&&($+="else "+this.else.render(L)),$}optimizeNodes(){super.optimizeNodes();const L=this.condition;if(L===!0)return this.nodes;let $=this.else;if($){const F=$.optimizeNodes();$=this.else=Array.isArray(F)?new y(F):F}if($)return L===!1?$ instanceof E?$:$.nodes:this.nodes.length?this:new E(H(L),$ instanceof E?[$]:$.nodes);if(!(L===!1||!this.nodes.length))return this}optimizeNames(L,$){var F;if(this.else=(F=this.else)===null||F===void 0?void 0:F.optimizeNames(L,$),!!(super.optimizeNames(L,$)||this.else))return this.condition=te(this.condition,L,$),this}get names(){const L=super.names;return ee(L,this.condition),this.else&&K(L,this.else.names),L}}E.kind="if";class _ extends x{}_.kind="for";class k extends _{constructor(L){super(),this.iteration=L}render(L){return`for(${this.iteration})`+super.render(L)}optimizeNames(L,$){if(super.optimizeNames(L,$))return this.iteration=te(this.iteration,L,$),this}get names(){return K(super.names,this.iteration.names)}}class C extends _{constructor(L,$,F,W){super(),this.varKind=L,this.name=$,this.from=F,this.to=W}render(L){const $=L.es5?n.varKinds.var:this.varKind,{name:F,from:W,to:X}=this;return`for(${$} ${F}=${W}; ${F}<${X}; ${F}++)`+super.render(L)}get names(){const L=ee(super.names,this.from);return ee(L,this.to)}}class R extends _{constructor(L,$,F,W){super(),this.loop=L,this.varKind=$,this.name=F,this.iterable=W}render(L){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(L)}optimizeNames(L,$){if(super.optimizeNames(L,$))return this.iterable=te(this.iterable,L,$),this}get names(){return K(super.names,this.iterable.names)}}class I extends x{constructor(L,$,F){super(),this.name=L,this.args=$,this.async=F}render(L){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(L)}}I.kind="func";class A extends v{render(L){return"return "+super.render(L)}}A.kind="return";class O extends x{render(L){let $="try"+super.render(L);return this.catch&&($+=this.catch.render(L)),this.finally&&($+=this.finally.render(L)),$}optimizeNodes(){var L,$;return super.optimizeNodes(),(L=this.catch)===null||L===void 0||L.optimizeNodes(),($=this.finally)===null||$===void 0||$.optimizeNodes(),this}optimizeNames(L,$){var F,W;return super.optimizeNames(L,$),(F=this.catch)===null||F===void 0||F.optimizeNames(L,$),(W=this.finally)===null||W===void 0||W.optimizeNames(L,$),this}get names(){const L=super.names;return this.catch&&K(L,this.catch.names),this.finally&&K(L,this.finally.names),L}}class M extends x{constructor(L){super(),this.error=L}render(L){return`catch(${this.error})`+super.render(L)}}M.kind="catch";class P extends x{render(L){return"finally"+super.render(L)}}P.kind="finally";class B{constructor(L,$={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...$,_n:$.lines?`
25
- `:""},this._extScope=L,this._scope=new n.Scope({parent:L}),this._nodes=[new S]}toString(){return this._root.render(this.opts)}name(L){return this._scope.name(L)}scopeName(L){return this._extScope.name(L)}scopeValue(L,$){const F=this._extScope.value(L,$);return(this._values[F.prefix]||(this._values[F.prefix]=new Set)).add(F),F}getScopeValue(L,$){return this._extScope.getValue(L,$)}scopeRefs(L){return this._extScope.scopeRefs(L,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(L,$,F,W){const X=this._scope.toName($);return F!==void 0&&W&&(this._constants[X.str]=F),this._leafNode(new s(L,X,F)),X}const(L,$,F){return this._def(n.varKinds.const,L,$,F)}let(L,$,F){return this._def(n.varKinds.let,L,$,F)}var(L,$,F){return this._def(n.varKinds.var,L,$,F)}assign(L,$,F){return this._leafNode(new c(L,$,F))}add(L,$){return this._leafNode(new u(L,e.operators.ADD,$))}code(L){return typeof L=="function"?L():L!==t.nil&&this._leafNode(new g(L)),this}object(...L){const $=["{"];for(const[F,W]of L)$.length>1&&$.push(","),$.push(F),(F!==W||this.opts.es5)&&($.push(":"),(0,t.addCodeArg)($,W));return $.push("}"),new t._Code($)}if(L,$,F){if(this._blockNode(new E(L)),$&&F)this.code($).else().code(F).endIf();else if($)this.code($).endIf();else if(F)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(L){return this._elseNode(new E(L))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(E,y)}_for(L,$){return this._blockNode(L),$&&this.code($).endFor(),this}for(L,$){return this._for(new k(L),$)}forRange(L,$,F,W,X=this.opts.es5?n.varKinds.var:n.varKinds.let){const ie=this._scope.toName(L);return this._for(new C(X,ie,$,F),()=>W(ie))}forOf(L,$,F,W=n.varKinds.const){const X=this._scope.toName(L);if(this.opts.es5){const ie=$ instanceof t.Name?$:this.var("_arr",$);return this.forRange("_i",0,(0,t._)`${ie}.length`,ce=>{this.var(X,(0,t._)`${ie}[${ce}]`),F(X)})}return this._for(new R("of",W,X,$),()=>F(X))}forIn(L,$,F,W=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(L,(0,t._)`Object.keys(${$})`,F);const X=this._scope.toName(L);return this._for(new R("in",W,X,$),()=>F(X))}endFor(){return this._endBlockNode(_)}label(L){return this._leafNode(new d(L))}break(L){return this._leafNode(new m(L))}return(L){const $=new A;if(this._blockNode($),this.code(L),$.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(L,$,F){if(!$&&!F)throw new Error('CodeGen: "try" without "catch" and "finally"');const W=new O;if(this._blockNode(W),this.code(L),$){const X=this.name("e");this._currNode=W.catch=new M(X),$(X)}return F&&(this._currNode=W.finally=new P,this.code(F)),this._endBlockNode(M,P)}throw(L){return this._leafNode(new h(L))}block(L,$){return this._blockStarts.push(this._nodes.length),L&&this.code(L).endBlock($),this}endBlock(L){const $=this._blockStarts.pop();if($===void 0)throw new Error("CodeGen: not in self-balancing block");const F=this._nodes.length-$;if(F<0||L!==void 0&&F!==L)throw new Error(`CodeGen: wrong number of nodes: ${F} vs ${L} expected`);return this._nodes.length=$,this}func(L,$=t.nil,F,W){return this._blockNode(new I(L,$,F)),W&&this.code(W).endFunc(),this}endFunc(){return this._endBlockNode(I)}optimize(L=1){for(;L-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(L){return this._currNode.nodes.push(L),this}_blockNode(L){this._currNode.nodes.push(L),this._nodes.push(L)}_endBlockNode(L,$){const F=this._currNode;if(F instanceof L||$&&F instanceof $)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${$?`${L.kind}/${$.kind}`:L.kind}"`)}_elseNode(L){const $=this._currNode;if(!($ instanceof E))throw new Error('CodeGen: "else" without "if"');return this._currNode=$.else=L,this}get _root(){return this._nodes[0]}get _currNode(){const L=this._nodes;return L[L.length-1]}set _currNode(L){const $=this._nodes;$[$.length-1]=L}}e.CodeGen=B;function K(z,L){for(const $ in L)z[$]=(z[$]||0)+(L[$]||0);return z}function ee(z,L){return L instanceof t._CodeOrName?K(z,L.names):z}function te(z,L,$){if(z instanceof t.Name)return F(z);if(!W(z))return z;return new t._Code(z._items.reduce((X,ie)=>(ie instanceof t.Name&&(ie=F(ie)),ie instanceof t._Code?X.push(...ie._items):X.push(ie),X),[]));function F(X){const ie=$[X.str];return ie===void 0||L[X.str]!==1?X:(delete L[X.str],ie)}function W(X){return X instanceof t._Code&&X._items.some(ie=>ie instanceof t.Name&&L[ie.str]===1&&$[ie.str]!==void 0)}}function ae(z,L){for(const $ in L)z[$]=(z[$]||0)-(L[$]||0)}function H(z){return typeof z=="boolean"||typeof z=="number"||z===null?!z:(0,t._)`!${V(z)}`}e.not=H;const Z=j(e.operators.AND);function G(...z){return z.reduce(Z)}e.and=G;const re=j(e.operators.OR);function ne(...z){return z.reduce(re)}e.or=ne;function j(z){return(L,$)=>L===t.nil?$:$===t.nil?L:(0,t._)`${V(L)} ${z} ${V($)}`}function V(z){return z instanceof t.Name?z:(0,t._)`(${z})`}})(zS)),zS}var jt={},$M;function sn(){if($M)return jt;$M=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.checkStrictMode=jt.getErrorPath=jt.Type=jt.useFunc=jt.setEvaluated=jt.evaluatedPropsToName=jt.mergeEvaluated=jt.eachItem=jt.unescapeJsonPointer=jt.escapeJsonPointer=jt.escapeFragment=jt.unescapeFragment=jt.schemaRefOrVal=jt.schemaHasRulesButRef=jt.schemaHasRules=jt.checkUnknownRules=jt.alwaysValidSchema=jt.toHash=void 0;const e=$t(),t=dv();function n(R){const I={};for(const A of R)I[A]=!0;return I}jt.toHash=n;function a(R,I){return typeof I=="boolean"?I:Object.keys(I).length===0?!0:(r(R,I),!i(I,R.self.RULES.all))}jt.alwaysValidSchema=a;function r(R,I=R.schema){const{opts:A,self:O}=R;if(!A.strictSchema||typeof I=="boolean")return;const M=O.RULES.keywords;for(const P in I)M[P]||C(R,`unknown keyword: "${P}"`)}jt.checkUnknownRules=r;function i(R,I){if(typeof R=="boolean")return!R;for(const A in R)if(I[A])return!0;return!1}jt.schemaHasRules=i;function s(R,I){if(typeof R=="boolean")return!R;for(const A in R)if(A!=="$ref"&&I.all[A])return!0;return!1}jt.schemaHasRulesButRef=s;function c({topSchemaRef:R,schemaPath:I},A,O,M){if(!M){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,e._)`${A}`}return(0,e._)`${R}${I}${(0,e.getProperty)(O)}`}jt.schemaRefOrVal=c;function u(R){return h(decodeURIComponent(R))}jt.unescapeFragment=u;function d(R){return encodeURIComponent(m(R))}jt.escapeFragment=d;function m(R){return typeof R=="number"?`${R}`:R.replace(/~/g,"~0").replace(/\//g,"~1")}jt.escapeJsonPointer=m;function h(R){return R.replace(/~1/g,"/").replace(/~0/g,"~")}jt.unescapeJsonPointer=h;function g(R,I){if(Array.isArray(R))for(const A of R)I(A);else I(R)}jt.eachItem=g;function v({mergeNames:R,mergeToName:I,mergeValues:A,resultToName:O}){return(M,P,B,K)=>{const ee=B===void 0?P:B instanceof e.Name?(P instanceof e.Name?R(M,P,B):I(M,P,B),B):P instanceof e.Name?(I(M,B,P),P):A(P,B);return K===e.Name&&!(ee instanceof e.Name)?O(M,ee):ee}}jt.mergeEvaluated={props:v({mergeNames:(R,I,A)=>R.if((0,e._)`${A} !== true && ${I} !== undefined`,()=>{R.if((0,e._)`${I} === true`,()=>R.assign(A,!0),()=>R.assign(A,(0,e._)`${A} || {}`).code((0,e._)`Object.assign(${A}, ${I})`))}),mergeToName:(R,I,A)=>R.if((0,e._)`${A} !== true`,()=>{I===!0?R.assign(A,!0):(R.assign(A,(0,e._)`${A} || {}`),S(R,A,I))}),mergeValues:(R,I)=>R===!0?!0:{...R,...I},resultToName:x}),items:v({mergeNames:(R,I,A)=>R.if((0,e._)`${A} !== true && ${I} !== undefined`,()=>R.assign(A,(0,e._)`${I} === true ? true : ${A} > ${I} ? ${A} : ${I}`)),mergeToName:(R,I,A)=>R.if((0,e._)`${A} !== true`,()=>R.assign(A,I===!0?!0:(0,e._)`${A} > ${I} ? ${A} : ${I}`)),mergeValues:(R,I)=>R===!0?!0:Math.max(R,I),resultToName:(R,I)=>R.var("items",I)})};function x(R,I){if(I===!0)return R.var("props",!0);const A=R.var("props",(0,e._)`{}`);return I!==void 0&&S(R,A,I),A}jt.evaluatedPropsToName=x;function S(R,I,A){Object.keys(A).forEach(O=>R.assign((0,e._)`${I}${(0,e.getProperty)(O)}`,!0))}jt.setEvaluated=S;const y={};function E(R,I){return R.scopeValue("func",{ref:I,code:y[I.code]||(y[I.code]=new t._Code(I.code))})}jt.useFunc=E;var _;(function(R){R[R.Num=0]="Num",R[R.Str=1]="Str"})(_||(jt.Type=_={}));function k(R,I,A){if(R instanceof e.Name){const O=I===_.Num;return A?O?(0,e._)`"[" + ${R} + "]"`:(0,e._)`"['" + ${R} + "']"`:O?(0,e._)`"/" + ${R}`:(0,e._)`"/" + ${R}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,e.getProperty)(R).toString():"/"+m(R)}jt.getErrorPath=k;function C(R,I,A=R.opts.strictSchema){if(A){if(I=`strict mode: ${I}`,A===!0)throw new Error(I);R.self.logger.warn(I)}}return jt.checkStrictMode=C,jt}var gg={},MM;function Ks(){if(MM)return gg;MM=1,Object.defineProperty(gg,"__esModule",{value:!0});const e=$t(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return gg.default=t,gg}var PM;function Ny(){return PM||(PM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=$t(),n=sn(),a=Ks();e.keywordError={message:({keyword:y})=>(0,t.str)`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:E})=>E?(0,t.str)`"${y}" keyword must be ${E} ($data)`:(0,t.str)`"${y}" keyword is invalid ($data)`};function r(y,E=e.keywordError,_,k){const{it:C}=y,{gen:R,compositeRule:I,allErrors:A}=C,O=h(y,E,_);k??(I||A)?u(R,O):d(C,(0,t._)`[${O}]`)}e.reportError=r;function i(y,E=e.keywordError,_){const{it:k}=y,{gen:C,compositeRule:R,allErrors:I}=k,A=h(y,E,_);u(C,A),R||I||d(k,a.default.vErrors)}e.reportExtraError=i;function s(y,E){y.assign(a.default.errors,E),y.if((0,t._)`${a.default.vErrors} !== null`,()=>y.if(E,()=>y.assign((0,t._)`${a.default.vErrors}.length`,E),()=>y.assign(a.default.vErrors,null)))}e.resetErrorsCount=s;function c({gen:y,keyword:E,schemaValue:_,data:k,errsCount:C,it:R}){if(C===void 0)throw new Error("ajv implementation error");const I=y.name("err");y.forRange("i",C,a.default.errors,A=>{y.const(I,(0,t._)`${a.default.vErrors}[${A}]`),y.if((0,t._)`${I}.instancePath === undefined`,()=>y.assign((0,t._)`${I}.instancePath`,(0,t.strConcat)(a.default.instancePath,R.errorPath))),y.assign((0,t._)`${I}.schemaPath`,(0,t.str)`${R.errSchemaPath}/${E}`),R.opts.verbose&&(y.assign((0,t._)`${I}.schema`,_),y.assign((0,t._)`${I}.data`,k))})}e.extendErrors=c;function u(y,E){const _=y.const("err",E);y.if((0,t._)`${a.default.vErrors} === null`,()=>y.assign(a.default.vErrors,(0,t._)`[${_}]`),(0,t._)`${a.default.vErrors}.push(${_})`),y.code((0,t._)`${a.default.errors}++`)}function d(y,E){const{gen:_,validateName:k,schemaEnv:C}=y;C.$async?_.throw((0,t._)`new ${y.ValidationError}(${E})`):(_.assign((0,t._)`${k}.errors`,E),_.return(!1))}const m={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function h(y,E,_){const{createErrors:k}=y.it;return k===!1?(0,t._)`{}`:g(y,E,_)}function g(y,E,_={}){const{gen:k,it:C}=y,R=[v(C,_),x(y,_)];return S(y,E,R),k.object(...R)}function v({errorPath:y},{instancePath:E}){const _=E?(0,t.str)`${y}${(0,n.getErrorPath)(E,n.Type.Str)}`:y;return[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,_)]}function x({keyword:y,it:{errSchemaPath:E}},{schemaPath:_,parentSchema:k}){let C=k?E:(0,t.str)`${E}/${y}`;return _&&(C=(0,t.str)`${C}${(0,n.getErrorPath)(_,n.Type.Str)}`),[m.schemaPath,C]}function S(y,{params:E,message:_},k){const{keyword:C,data:R,schemaValue:I,it:A}=y,{opts:O,propertyName:M,topSchemaRef:P,schemaPath:B}=A;k.push([m.keyword,C],[m.params,typeof E=="function"?E(y):E||(0,t._)`{}`]),O.messages&&k.push([m.message,typeof _=="function"?_(y):_]),O.verbose&&k.push([m.schema,I],[m.parentSchema,(0,t._)`${P}${B}`],[a.default.data,R]),M&&k.push([m.propertyName,M])}})(US)),US}var UM;function Rae(){if(UM)return bl;UM=1,Object.defineProperty(bl,"__esModule",{value:!0}),bl.boolOrEmptySchema=bl.topBoolOrEmptySchema=void 0;const e=Ny(),t=$t(),n=Ks(),a={message:"boolean schema is false"};function r(c){const{gen:u,schema:d,validateName:m}=c;d===!1?s(c,!1):typeof d=="object"&&d.$async===!0?u.return(n.default.data):(u.assign((0,t._)`${m}.errors`,null),u.return(!0))}bl.topBoolOrEmptySchema=r;function i(c,u){const{gen:d,schema:m}=c;m===!1?(d.var(u,!1),s(c)):d.var(u,!0)}bl.boolOrEmptySchema=i;function s(c,u){const{gen:d,data:m}=c,h={gen:d,keyword:"false schema",data:m,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,e.reportError)(h,a,void 0,u)}return bl}var Tr={},vl={},zM;function IV(){if(zM)return vl;zM=1,Object.defineProperty(vl,"__esModule",{value:!0}),vl.getRules=vl.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function n(r){return typeof r=="string"&&t.has(r)}vl.isJSONType=n;function a(){const r={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...r,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},r.number,r.string,r.array,r.object],post:{rules:[]},all:{},keywords:{}}}return vl.getRules=a,vl}var wo={},FM;function OV(){if(FM)return wo;FM=1,Object.defineProperty(wo,"__esModule",{value:!0}),wo.shouldUseRule=wo.shouldUseGroup=wo.schemaHasRulesForType=void 0;function e({schema:a,self:r},i){const s=r.RULES.types[i];return s&&s!==!0&&t(a,s)}wo.schemaHasRulesForType=e;function t(a,r){return r.rules.some(i=>n(a,i))}wo.shouldUseGroup=t;function n(a,r){var i;return a[r.keyword]!==void 0||((i=r.definition.implements)===null||i===void 0?void 0:i.some(s=>a[s]!==void 0))}return wo.shouldUseRule=n,wo}var BM;function fv(){if(BM)return Tr;BM=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.reportTypeError=Tr.checkDataTypes=Tr.checkDataType=Tr.coerceAndCheckDataType=Tr.getJSONTypes=Tr.getSchemaTypes=Tr.DataType=void 0;const e=IV(),t=OV(),n=Ny(),a=$t(),r=sn();var i;(function(_){_[_.Correct=0]="Correct",_[_.Wrong=1]="Wrong"})(i||(Tr.DataType=i={}));function s(_){const k=c(_.type);if(k.includes("null")){if(_.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!k.length&&_.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');_.nullable===!0&&k.push("null")}return k}Tr.getSchemaTypes=s;function c(_){const k=Array.isArray(_)?_:_?[_]:[];if(k.every(e.isJSONType))return k;throw new Error("type must be JSONType or JSONType[]: "+k.join(","))}Tr.getJSONTypes=c;function u(_,k){const{gen:C,data:R,opts:I}=_,A=m(k,I.coerceTypes),O=k.length>0&&!(A.length===0&&k.length===1&&(0,t.schemaHasRulesForType)(_,k[0]));if(O){const M=x(k,R,I.strictNumbers,i.Wrong);C.if(M,()=>{A.length?h(_,k,A):y(_)})}return O}Tr.coerceAndCheckDataType=u;const d=new Set(["string","number","integer","boolean","null"]);function m(_,k){return k?_.filter(C=>d.has(C)||k==="array"&&C==="array"):[]}function h(_,k,C){const{gen:R,data:I,opts:A}=_,O=R.let("dataType",(0,a._)`typeof ${I}`),M=R.let("coerced",(0,a._)`undefined`);A.coerceTypes==="array"&&R.if((0,a._)`${O} == 'object' && Array.isArray(${I}) && ${I}.length == 1`,()=>R.assign(I,(0,a._)`${I}[0]`).assign(O,(0,a._)`typeof ${I}`).if(x(k,I,A.strictNumbers),()=>R.assign(M,I))),R.if((0,a._)`${M} !== undefined`);for(const B of C)(d.has(B)||B==="array"&&A.coerceTypes==="array")&&P(B);R.else(),y(_),R.endIf(),R.if((0,a._)`${M} !== undefined`,()=>{R.assign(I,M),g(_,M)});function P(B){switch(B){case"string":R.elseIf((0,a._)`${O} == "number" || ${O} == "boolean"`).assign(M,(0,a._)`"" + ${I}`).elseIf((0,a._)`${I} === null`).assign(M,(0,a._)`""`);return;case"number":R.elseIf((0,a._)`${O} == "boolean" || ${I} === null
24
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const s=i[1];if(t===i[0]){r(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){r(i);continue}}if(e.metadataRegistry.get(i[0])?.id){r(i);continue}if(s.cycle){r(i);continue}if(s.count>1&&e.reused==="ref"){r(i);continue}}}function rd(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=s=>{const c=e.seen.get(s),u=c.def??c.schema,d={...u};if(c.ref===null)return;const m=c.ref;if(c.ref=null,m){a(m);const h=e.seen.get(m).schema;h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):(Object.assign(u,h),Object.assign(u,d))}c.isParent||e.override({zodSchema:s,jsonSchema:u,path:c.path??[]})};for(const s of[...e.seen.entries()].reverse())a(s[0]);const r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(s)}Object.assign(r,n.def??n.schema);const i=e.external?.defs??{};for(const s of e.seen.entries()){const c=s[1];c.def&&c.defId&&(i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?r.$defs=i:r.definitions=i);try{const s=JSON.parse(JSON.stringify(r));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ip(t,"input"),output:Ip(t,"output")}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function ea(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return ea(a.element,n);if(a.type==="set")return ea(a.valueType,n);if(a.type==="lazy")return ea(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return ea(a.innerType,n);if(a.type==="intersection")return ea(a.left,n)||ea(a.right,n);if(a.type==="record"||a.type==="map")return ea(a.keyType,n)||ea(a.valueType,n);if(a.type==="pipe")return ea(a.in,n)||ea(a.out,n);if(a.type==="object"){for(const r in a.shape)if(ea(a.shape[r],n))return!0;return!1}if(a.type==="union"){for(const r of a.options)if(ea(r,n))return!0;return!1}if(a.type==="tuple"){for(const r of a.items)if(ea(r,n))return!0;return!!(a.rest&&ea(a.rest,n))}return!1}const n5=(e,t={})=>n=>{const a=td({...n,processors:t});return kn(e,a),nd(a,e),rd(a,e)},Ip=(e,t)=>n=>{const{libraryOptions:a,target:r}=n??{},i=td({...a??{},target:r,io:t,processors:{}});return kn(e,i),nd(i,e),rd(i,e)},zte={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},r5=(e,t,n,a)=>{const r=n;r.type="string";const{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(r.minLength=i),typeof s=="number"&&(r.maxLength=s),c&&(r.format=zte[c]??c,r.format===""&&delete r.format),d&&(r.contentEncoding=d),u&&u.size>0){const m=[...u];m.length===1?r.pattern=m[0].source:m.length>1&&(r.allOf=[...m.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},a5=(e,t,n,a)=>{const r=n,{minimum:i,maximum:s,format:c,multipleOf:u,exclusiveMaximum:d,exclusiveMinimum:m}=e._zod.bag;typeof c=="string"&&c.includes("int")?r.type="integer":r.type="number",typeof m=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.minimum=m,r.exclusiveMinimum=!0):r.exclusiveMinimum=m),typeof i=="number"&&(r.minimum=i,typeof m=="number"&&t.target!=="draft-04"&&(m>=i?delete r.minimum:delete r.exclusiveMinimum)),typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(r.maximum=d,r.exclusiveMaximum=!0):r.exclusiveMaximum=d),typeof s=="number"&&(r.maximum=s,typeof d=="number"&&t.target!=="draft-04"&&(d<=s?delete r.maximum:delete r.exclusiveMaximum)),typeof u=="number"&&(r.multipleOf=u)},i5=(e,t,n,a)=>{n.type="boolean"},o5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},s5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},l5=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},c5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},u5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},d5=(e,t,n,a)=>{n.not={}},f5=(e,t,n,a)=>{},p5=(e,t,n,a)=>{},m5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},h5=(e,t,n,a)=>{const r=e._zod.def,i=ok(r.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},g5=(e,t,n,a)=>{const r=e._zod.def,i=[];for(const s of r.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},b5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},v5=(e,t,n,a)=>{const r=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=i.source},y5=(e,t,n,a)=>{const r=n,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:c,mime:u}=e._zod.bag;s!==void 0&&(i.minLength=s),c!==void 0&&(i.maxLength=c),u?u.length===1?(i.contentMediaType=u[0],Object.assign(r,i)):r.anyOf=u.map(d=>({...i,contentMediaType:d})):Object.assign(r,i)},w5=(e,t,n,a)=>{n.type="boolean"},S5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},x5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},_5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},E5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},k5=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},T5=(e,t,n,a)=>{const r=n,i=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;typeof s=="number"&&(r.minItems=s),typeof c=="number"&&(r.maxItems=c),r.type="array",r.items=kn(i.element,t,{...a,path:[...a.path,"items"]})},N5=(e,t,n,a)=>{const r=n,i=e._zod.def;r.type="object",r.properties={};const s=i.shape;for(const d in s)r.properties[d]=kn(s[d],t,{...a,path:[...a.path,"properties",d]});const c=new Set(Object.keys(s)),u=new Set([...c].filter(d=>{const m=i.shape[d]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(r.required=Array.from(u)),i.catchall?._zod.def.type==="never"?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=kn(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},uT=(e,t,n,a)=>{const r=e._zod.def,i=r.inclusive===!1,s=r.options.map((c,u)=>kn(c,t,{...a,path:[...a.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=s:n.anyOf=s},C5=(e,t,n,a)=>{const r=e._zod.def,i=kn(r.left,t,{...a,path:[...a.path,"allOf",0]}),s=kn(r.right,t,{...a,path:[...a.path,"allOf",1]}),c=d=>"allOf"in d&&Object.keys(d).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];n.allOf=u},R5=(e,t,n,a)=>{const r=n,i=e._zod.def;r.type="array";const s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((g,v)=>kn(g,t,{...a,path:[...a.path,s,v]})),d=i.rest?kn(i.rest,t,{...a,path:[...a.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=u,d&&(r.items=d)):t.target==="openapi-3.0"?(r.items={anyOf:u},d&&r.items.anyOf.push(d),r.minItems=u.length,d||(r.maxItems=u.length)):(r.items=u,d&&(r.additionalItems=d));const{minimum:m,maximum:h}=e._zod.bag;typeof m=="number"&&(r.minItems=m),typeof h=="number"&&(r.maxItems=h)},A5=(e,t,n,a)=>{const r=n,i=e._zod.def;r.type="object",(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=kn(i.keyType,t,{...a,path:[...a.path,"propertyNames"]})),r.additionalProperties=kn(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]})},I5=(e,t,n,a)=>{const r=e._zod.def,i=kn(r.innerType,t,a),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=r.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},O5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType},D5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},j5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},L5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType;let s;try{s=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},$5=(e,t,n,a)=>{const r=e._zod.def,i=t.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;kn(i,t,a);const s=t.seen.get(e);s.ref=i},M5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType,n.readOnly=!0},P5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType},U5=(e,t,n,a)=>{const r=e._zod.def;kn(r.innerType,t,a);const i=t.seen.get(e);i.ref=r.innerType},z5=(e,t,n,a)=>{const r=e._zod.innerType;kn(r,t,a);const i=t.seen.get(e);i.ref=r},s_={string:r5,number:a5,boolean:i5,bigint:o5,symbol:s5,null:l5,undefined:c5,void:u5,never:d5,any:f5,unknown:p5,date:m5,enum:h5,literal:g5,nan:b5,template_literal:v5,file:y5,success:w5,custom:S5,function:x5,transform:_5,map:E5,set:k5,array:T5,object:N5,union:uT,intersection:C5,tuple:R5,record:A5,nullable:I5,nonoptional:O5,default:D5,prefault:j5,catch:L5,pipe:$5,readonly:M5,promise:P5,optional:U5,lazy:z5};function F5(e,t){if("_idmap"in e){const a=e,r=td({...t,processors:s_}),i={};for(const u of a._idmap.entries()){const[d,m]=u;kn(m,r)}const s={},c={registry:a,uri:t?.uri,defs:i};r.external=c;for(const u of a._idmap.entries()){const[d,m]=u;nd(r,m),s[d]=rd(r,m)}if(Object.keys(i).length>0){const u=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:i}}return{schemas:s}}const n=td({...t,processors:s_});return kn(e,n),nd(n,e),rd(n,e)}class Fte{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=td({processors:s_,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return kn(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),nd(this.ctx,t);const a=rd(this.ctx,t),{"~standard":r,...i}=a;return i}}const Bte=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Hte=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:_B,$ZodArray:CB,$ZodAsyncError:jl,$ZodBase64:dB,$ZodBase64URL:pB,$ZodBigInt:Nk,$ZodBigIntFormat:yB,$ZodBoolean:Tk,$ZodCIDRv4:cB,$ZodCIDRv6:uB,$ZodCUID:X3,$ZodCUID2:J3,$ZodCatch:YB,$ZodCheck:zn,$ZodCheckBigIntFormat:N3,$ZodCheckEndsWith:U3,$ZodCheckGreaterThan:_k,$ZodCheckIncludes:M3,$ZodCheckLengthEquals:D3,$ZodCheckLessThan:xk,$ZodCheckLowerCase:L3,$ZodCheckMaxLength:I3,$ZodCheckMaxSize:C3,$ZodCheckMimeType:F3,$ZodCheckMinLength:O3,$ZodCheckMinSize:R3,$ZodCheckMultipleOf:k3,$ZodCheckNumberFormat:T3,$ZodCheckOverwrite:B3,$ZodCheckProperty:z3,$ZodCheckRegex:j3,$ZodCheckSizeEquals:A3,$ZodCheckStartsWith:P3,$ZodCheckStringFormat:gm,$ZodCheckUpperCase:$3,$ZodCodec:Rk,$ZodCustom:r6,$ZodCustomStringFormat:bB,$ZodDate:NB,$ZodDefault:GB,$ZodDiscriminatedUnion:jB,$ZodE164:mB,$ZodEmail:K3,$ZodEmoji:Y3,$ZodEncodeError:ry,$ZodEnum:UB,$ZodError:lk,$ZodFile:FB,$ZodFunction:e6,$ZodGUID:G3,$ZodIPv4:oB,$ZodIPv6:sB,$ZodISODate:rB,$ZodISODateTime:nB,$ZodISODuration:iB,$ZodISOTime:aB,$ZodIntersection:LB,$ZodJWT:gB,$ZodKSUID:tB,$ZodLazy:n6,$ZodLiteral:zB,$ZodMAC:lB,$ZodMap:MB,$ZodNaN:qB,$ZodNanoID:q3,$ZodNever:kB,$ZodNonOptional:KB,$ZodNull:xB,$ZodNullable:VB,$ZodNumber:kk,$ZodNumberFormat:vB,$ZodObject:IB,$ZodObjectJIT:OB,$ZodOptional:HB,$ZodPipe:XB,$ZodPrefault:WB,$ZodPromise:t6,$ZodReadonly:JB,$ZodRealError:Ma,$ZodRecord:$B,$ZodRegistry:u6,$ZodSet:PB,$ZodString:bm,$ZodStringFormat:Tn,$ZodSuccess:ZB,$ZodSymbol:wB,$ZodTemplateLiteral:QB,$ZodTransform:BB,$ZodTuple:Ck,$ZodType:vt,$ZodULID:Q3,$ZodURL:Z3,$ZodUUID:W3,$ZodUndefined:SB,$ZodUnion:ly,$ZodUnknown:EB,$ZodVoid:TB,$ZodXID:eB,$ZodXor:DB,$brand:wF,$constructor:me,$input:c6,$output:l6,Doc:H3,JSONSchema:Bte,JSONSchemaGenerator:Fte,NEVER:yF,TimePrecision:m6,_any:L6,_array:K6,_base64:Kk,_base64url:Zk,_bigint:C6,_boolean:T6,_catch:jte,_check:J6,_cidrv4:Gk,_cidrv6:Wk,_coercedBigint:R6,_coercedBoolean:N6,_coercedDate:z6,_coercedNumber:w6,_coercedString:f6,_cuid:Pk,_cuid2:Uk,_custom:Y6,_date:U6,_decode:pk,_decodeAsync:hk,_default:Ite,_discriminatedUnion:yte,_e164:Yk,_email:Ik,_emoji:$k,_encode:fk,_encodeAsync:mk,_endsWith:rT,_enum:kte,_file:Z6,_float32:x6,_float64:_6,_gt:Bl,_gte:La,_guid:rv,_includes:tT,_int:S6,_int32:E6,_int64:A6,_intersection:wte,_ipv4:Hk,_ipv6:Vk,_isoDate:g6,_isoDateTime:h6,_isoDuration:v6,_isoTime:b6,_jwt:qk,_ksuid:Bk,_lazy:Pte,_length:dy,_literal:Nte,_lowercase:Qk,_lt:Fl,_lte:yi,_mac:p6,_map:_te,_max:yi,_maxLength:ed,_maxSize:uy,_mime:aT,_min:La,_minLength:Ms,_minSize:Ap,_multipleOf:Rp,_nan:F6,_nanoid:Mk,_nativeEnum:Tte,_negative:H6,_never:M6,_nonnegative:G6,_nonoptional:Ote,_nonpositive:V6,_normalize:iT,_null:j6,_nullable:Ate,_number:y6,_optional:Rte,_overwrite:Ws,_parse:um,_parseAsync:dm,_pipe:Lte,_positive:B6,_promise:Ute,_property:W6,_readonly:$te,_record:xte,_refine:q6,_regex:Jk,_safeDecode:bk,_safeDecodeAsync:yk,_safeEncode:gk,_safeEncodeAsync:vk,_safeParse:fm,_safeParseAsync:pm,_set:Ete,_size:Xk,_slugify:cT,_startsWith:nT,_string:d6,_stringFormat:vm,_stringbool:t5,_success:Dte,_superRefine:X6,_symbol:O6,_templateLiteral:Mte,_toLowerCase:sT,_toUpperCase:lT,_transform:Cte,_trim:oT,_tuple:Ste,_uint32:k6,_uint64:I6,_ulid:zk,_undefined:D6,_union:bte,_unknown:$6,_uppercase:eT,_url:cy,_uuid:Ok,_uuidv4:Dk,_uuidv6:jk,_uuidv7:Lk,_void:P6,_xid:Fk,_xor:vte,clone:ni,config:Gr,createStandardJSONSchemaMethod:Ip,createToJSONSchemaMethod:n5,decode:JJ,decodeAsync:eQ,describe:Q6,encode:XJ,encodeAsync:QJ,extractDefs:nd,finalize:rd,flattenError:ck,formatError:uk,globalConfig:Qb,globalRegistry:vi,initializeContext:td,isValidBase64:Ek,isValidBase64URL:fB,isValidJWT:hB,locales:s6,meta:e5,parse:a_,parseAsync:i_,prettifyError:FF,process:kn,regexes:Sk,registry:Ak,safeDecode:nQ,safeDecodeAsync:aQ,safeEncode:tQ,safeEncodeAsync:rQ,safeParse:dk,safeParseAsync:BF,toDotPath:zF,toJSONSchema:F5,treeifyError:UF,util:MF,version:V3},Symbol.toStringTag,{value:"Module"})),dT=me("ZodISODateTime",(e,t)=>{nB.init(e,t),In.init(e,t)});function fT(e){return h6(dT,e)}const pT=me("ZodISODate",(e,t)=>{rB.init(e,t),In.init(e,t)});function mT(e){return g6(pT,e)}const hT=me("ZodISOTime",(e,t)=>{aB.init(e,t),In.init(e,t)});function gT(e){return b6(hT,e)}const bT=me("ZodISODuration",(e,t)=>{iB.init(e,t),In.init(e,t)});function vT(e){return v6(bT,e)}const Vte=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:pT,ZodISODateTime:dT,ZodISODuration:bT,ZodISOTime:hT,date:mT,datetime:fT,duration:vT,time:gT},Symbol.toStringTag,{value:"Module"})),B5=(e,t)=>{lk.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>uk(e,n)},flatten:{value:n=>ck(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ev,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ev,2)}},isEmpty:{get(){return e.issues.length===0}}})},Gte=me("ZodError",B5),Pa=me("ZodError",B5,{Parent:Error}),H5=um(Pa),V5=dm(Pa),G5=fm(Pa),W5=pm(Pa),K5=fk(Pa),Z5=pk(Pa),Y5=mk(Pa),q5=hk(Pa),X5=gk(Pa),J5=bk(Pa),Q5=vk(Pa),eH=yk(Pa),Ot=me("ZodType",(e,t)=>(vt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ip(e,"input"),output:Ip(e,"output")}}),e.toJSONSchema=n5(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Bo(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]})),e.clone=(n,a)=>ni(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>H5(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>G5(e,n,a),e.parseAsync=async(n,a)=>V5(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>W5(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>K5(e,n,a),e.decode=(n,a)=>Z5(e,n,a),e.encodeAsync=async(n,a)=>Y5(e,n,a),e.decodeAsync=async(n,a)=>q5(e,n,a),e.safeEncode=(n,a)=>X5(e,n,a),e.safeDecode=(n,a)=>J5(e,n,a),e.safeEncodeAsync=async(n,a)=>Q5(e,n,a),e.safeDecodeAsync=async(n,a)=>eH(e,n,a),e.refine=(n,a)=>e.check(eV(n,a)),e.superRefine=n=>e.check(tV(n)),e.overwrite=n=>e.check(Ws(n)),e.optional=()=>sv(e),e.nullable=()=>jp(e),e.nullish=()=>sv(jp(e)),e.nonoptional=n=>VH(e,n),e.array=()=>id(e),e.or=n=>od([e,n]),e.and=n=>js(e,n),e.transform=n=>lv(e,zT(n)),e.default=n=>FH(e,n),e.prefault=n=>HH(e,n),e.catch=n=>KH(e,n),e.pipe=n=>lv(e,n),e.readonly=()=>GT(e),e.describe=n=>{const a=e.clone();return vi.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){return vi.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return vi.get(e);const a=e.clone();return vi.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),yT=me("_ZodString",(e,t)=>{bm.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>r5(e,a,r);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(Jk(...a)),e.includes=(...a)=>e.check(tT(...a)),e.startsWith=(...a)=>e.check(nT(...a)),e.endsWith=(...a)=>e.check(rT(...a)),e.min=(...a)=>e.check(Ms(...a)),e.max=(...a)=>e.check(ed(...a)),e.length=(...a)=>e.check(dy(...a)),e.nonempty=(...a)=>e.check(Ms(1,...a)),e.lowercase=a=>e.check(Qk(a)),e.uppercase=a=>e.check(eT(a)),e.trim=()=>e.check(oT()),e.normalize=(...a)=>e.check(iT(...a)),e.toLowerCase=()=>e.check(sT()),e.toUpperCase=()=>e.check(lT()),e.slugify=()=>e.check(cT())}),fy=me("ZodString",(e,t)=>{bm.init(e,t),yT.init(e,t),e.email=n=>e.check(Ik(wT,n)),e.url=n=>e.check(cy(py,n)),e.jwt=n=>e.check(qk(LT,n)),e.emoji=n=>e.check($k(ST,n)),e.guid=n=>e.check(rv(av,n)),e.uuid=n=>e.check(Ok(No,n)),e.uuidv4=n=>e.check(Dk(No,n)),e.uuidv6=n=>e.check(jk(No,n)),e.uuidv7=n=>e.check(Lk(No,n)),e.nanoid=n=>e.check(Mk(xT,n)),e.guid=n=>e.check(rv(av,n)),e.cuid=n=>e.check(Pk(_T,n)),e.cuid2=n=>e.check(Uk(ET,n)),e.ulid=n=>e.check(zk(kT,n)),e.base64=n=>e.check(Kk(OT,n)),e.base64url=n=>e.check(Zk(DT,n)),e.xid=n=>e.check(Fk(TT,n)),e.ksuid=n=>e.check(Bk(NT,n)),e.ipv4=n=>e.check(Hk(CT,n)),e.ipv6=n=>e.check(Vk(RT,n)),e.cidrv4=n=>e.check(Gk(AT,n)),e.cidrv6=n=>e.check(Wk(IT,n)),e.e164=n=>e.check(Yk(jT,n)),e.datetime=n=>e.check(fT(n)),e.date=n=>e.check(mT(n)),e.time=n=>e.check(gT(n)),e.duration=n=>e.check(vT(n))});function Op(e){return d6(fy,e)}const In=me("ZodStringFormat",(e,t)=>{Tn.init(e,t),yT.init(e,t)}),wT=me("ZodEmail",(e,t)=>{K3.init(e,t),In.init(e,t)});function tH(e){return Ik(wT,e)}const av=me("ZodGUID",(e,t)=>{G3.init(e,t),In.init(e,t)});function Wte(e){return rv(av,e)}const No=me("ZodUUID",(e,t)=>{W3.init(e,t),In.init(e,t)});function nH(e){return Ok(No,e)}function Kte(e){return Dk(No,e)}function Zte(e){return jk(No,e)}function Yte(e){return Lk(No,e)}const py=me("ZodURL",(e,t)=>{Z3.init(e,t),In.init(e,t)});function rH(e){return cy(py,e)}function qte(e){return cy(py,{protocol:/^https?$/,hostname:s3,...Ie(e)})}const ST=me("ZodEmoji",(e,t)=>{Y3.init(e,t),In.init(e,t)});function aH(e){return $k(ST,e)}const xT=me("ZodNanoID",(e,t)=>{q3.init(e,t),In.init(e,t)});function iH(e){return Mk(xT,e)}const _T=me("ZodCUID",(e,t)=>{X3.init(e,t),In.init(e,t)});function oH(e){return Pk(_T,e)}const ET=me("ZodCUID2",(e,t)=>{J3.init(e,t),In.init(e,t)});function sH(e){return Uk(ET,e)}const kT=me("ZodULID",(e,t)=>{Q3.init(e,t),In.init(e,t)});function lH(e){return zk(kT,e)}const TT=me("ZodXID",(e,t)=>{eB.init(e,t),In.init(e,t)});function cH(e){return Fk(TT,e)}const NT=me("ZodKSUID",(e,t)=>{tB.init(e,t),In.init(e,t)});function uH(e){return Bk(NT,e)}const CT=me("ZodIPv4",(e,t)=>{oB.init(e,t),In.init(e,t)});function dH(e){return Hk(CT,e)}const fH=me("ZodMAC",(e,t)=>{lB.init(e,t),In.init(e,t)});function pH(e){return p6(fH,e)}const RT=me("ZodIPv6",(e,t)=>{sB.init(e,t),In.init(e,t)});function mH(e){return Vk(RT,e)}const AT=me("ZodCIDRv4",(e,t)=>{cB.init(e,t),In.init(e,t)});function hH(e){return Gk(AT,e)}const IT=me("ZodCIDRv6",(e,t)=>{uB.init(e,t),In.init(e,t)});function gH(e){return Wk(IT,e)}const OT=me("ZodBase64",(e,t)=>{dB.init(e,t),In.init(e,t)});function bH(e){return Kk(OT,e)}const DT=me("ZodBase64URL",(e,t)=>{pB.init(e,t),In.init(e,t)});function vH(e){return Zk(DT,e)}const jT=me("ZodE164",(e,t)=>{mB.init(e,t),In.init(e,t)});function yH(e){return Yk(jT,e)}const LT=me("ZodJWT",(e,t)=>{gB.init(e,t),In.init(e,t)});function wH(e){return qk(LT,e)}const ym=me("ZodCustomStringFormat",(e,t)=>{bB.init(e,t),In.init(e,t)});function Xte(e,t,n={}){return vm(ym,e,t,n)}function Jte(e){return vm(ym,"hostname",o3,e)}function Qte(e){return vm(ym,"hex",_3,e)}function ene(e,t){const n=t?.enc??"hex",a=`${e}_${n}`,r=Sk[a];if(!r)throw new Error(`Unrecognized hash format: ${a}`);return vm(ym,a,r,t)}const my=me("ZodNumber",(e,t)=>{kk.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>a5(e,a,r),e.gt=(a,r)=>e.check(Bl(a,r)),e.gte=(a,r)=>e.check(La(a,r)),e.min=(a,r)=>e.check(La(a,r)),e.lt=(a,r)=>e.check(Fl(a,r)),e.lte=(a,r)=>e.check(yi(a,r)),e.max=(a,r)=>e.check(yi(a,r)),e.int=a=>e.check(l_(a)),e.safe=a=>e.check(l_(a)),e.positive=a=>e.check(Bl(0,a)),e.nonnegative=a=>e.check(La(0,a)),e.negative=a=>e.check(Fl(0,a)),e.nonpositive=a=>e.check(yi(0,a)),e.multipleOf=(a,r)=>e.check(Rp(a,r)),e.step=(a,r)=>e.check(Rp(a,r)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function iv(e){return y6(my,e)}const xd=me("ZodNumberFormat",(e,t)=>{vB.init(e,t),my.init(e,t)});function l_(e){return S6(xd,e)}function tne(e){return x6(xd,e)}function nne(e){return _6(xd,e)}function rne(e){return E6(xd,e)}function ane(e){return k6(xd,e)}const hy=me("ZodBoolean",(e,t)=>{Tk.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>i5(e,n,a)});function $T(e){return T6(hy,e)}const gy=me("ZodBigInt",(e,t)=>{Nk.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>o5(e,a),e.gte=(a,r)=>e.check(La(a,r)),e.min=(a,r)=>e.check(La(a,r)),e.gt=(a,r)=>e.check(Bl(a,r)),e.gte=(a,r)=>e.check(La(a,r)),e.min=(a,r)=>e.check(La(a,r)),e.lt=(a,r)=>e.check(Fl(a,r)),e.lte=(a,r)=>e.check(yi(a,r)),e.max=(a,r)=>e.check(yi(a,r)),e.positive=a=>e.check(Bl(BigInt(0),a)),e.negative=a=>e.check(Fl(BigInt(0),a)),e.nonpositive=a=>e.check(yi(BigInt(0),a)),e.nonnegative=a=>e.check(La(BigInt(0),a)),e.multipleOf=(a,r)=>e.check(Rp(a,r));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function ine(e){return C6(gy,e)}const MT=me("ZodBigIntFormat",(e,t)=>{yB.init(e,t),gy.init(e,t)});function one(e){return A6(MT,e)}function sne(e){return I6(MT,e)}const SH=me("ZodSymbol",(e,t)=>{wB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>s5(e,n)});function lne(e){return O6(SH,e)}const xH=me("ZodUndefined",(e,t)=>{SB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>c5(e,n)});function cne(e){return D6(xH,e)}const _H=me("ZodNull",(e,t)=>{xB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>l5(e,n,a)});function ov(e){return j6(_H,e)}const EH=me("ZodAny",(e,t)=>{_B.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>f5()});function Ll(){return L6(EH)}const kH=me("ZodUnknown",(e,t)=>{EB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>p5()});function ad(){return $6(kH)}const TH=me("ZodNever",(e,t)=>{kB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>d5(e,n,a)});function Ds(e){return M6(TH,e)}const NH=me("ZodVoid",(e,t)=>{TB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>u5(e,n)});function une(e){return P6(NH,e)}const PT=me("ZodDate",(e,t)=>{NB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>m5(e,a),e.min=(a,r)=>e.check(La(a,r)),e.max=(a,r)=>e.check(yi(a,r));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function dne(e){return U6(PT,e)}const CH=me("ZodArray",(e,t)=>{CB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>T5(e,n,a,r),e.element=t.element,e.min=(n,a)=>e.check(Ms(n,a)),e.nonempty=n=>e.check(Ms(1,n)),e.max=(n,a)=>e.check(ed(n,a)),e.length=(n,a)=>e.check(dy(n,a)),e.unwrap=()=>e.element});function id(e,t){return K6(CH,e,t)}function fne(e){const t=e._zod.def.shape;return wy(Object.keys(t))}const by=me("ZodObject",(e,t)=>{OB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>N5(e,n,a,r),Ht(e,"shape",()=>t.shape),e.keyof=()=>wy(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ad()}),e.loose=()=>e.clone({...e._zod.def,catchall:ad()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ds()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>AF(e,n),e.safeExtend=n=>IF(e,n),e.merge=n=>OF(e,n),e.pick=n=>CF(e,n),e.omit=n=>RF(e,n),e.partial=(...n)=>DF(FT,e,n[0]),e.required=(...n)=>jF(BT,e,n[0])});function Jf(e,t){const n={type:"object",shape:e??{},...Ie(t)};return new by(n)}function pne(e,t){return new by({type:"object",shape:e,catchall:Ds(),...Ie(t)})}function mne(e,t){return new by({type:"object",shape:e,catchall:ad(),...Ie(t)})}const vy=me("ZodUnion",(e,t)=>{ly.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>uT(e,n,a,r),e.options=t.options});function od(e,t){return new vy({type:"union",options:e,...Ie(t)})}const RH=me("ZodXor",(e,t)=>{vy.init(e,t),DB.init(e,t),e._zod.processJSONSchema=(n,a,r)=>uT(e,n,a,r),e.options=t.options});function AH(e,t){return new RH({type:"union",options:e,inclusive:!1,...Ie(t)})}const IH=me("ZodDiscriminatedUnion",(e,t)=>{vy.init(e,t),jB.init(e,t)});function hne(e,t,n){return new IH({type:"union",options:t,discriminator:e,...Ie(n)})}const OH=me("ZodIntersection",(e,t)=>{LB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>C5(e,n,a,r)});function js(e,t){return new OH({type:"intersection",left:e,right:t})}const DH=me("ZodTuple",(e,t)=>{Ck.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>R5(e,n,a,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function su(e,t,n){const a=t instanceof vt,r=a?n:t,i=a?t:null;return new DH({type:"tuple",items:e,rest:i,...Ie(r)})}const yy=me("ZodRecord",(e,t)=>{$B.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>A5(e,n,a,r),e.keyType=t.keyType,e.valueType=t.valueType});function UT(e,t,n){return new yy({type:"record",keyType:e,valueType:t,...Ie(n)})}function gne(e,t,n){const a=ni(e);return a._zod.values=void 0,new yy({type:"record",keyType:a,valueType:t,...Ie(n)})}function c_(e,t,n){return new yy({type:"record",keyType:e,valueType:t,mode:"loose",...Ie(n)})}const jH=me("ZodMap",(e,t)=>{MB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>E5(e,n),e.keyType=t.keyType,e.valueType=t.valueType});function bne(e,t,n){return new jH({type:"map",keyType:e,valueType:t,...Ie(n)})}const LH=me("ZodSet",(e,t)=>{PB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>k5(e,n),e.min=(...n)=>e.check(Ap(...n)),e.nonempty=n=>e.check(Ap(1,n)),e.max=(...n)=>e.check(uy(...n)),e.size=(...n)=>e.check(Xk(...n))});function vne(e,t){return new LH({type:"set",valueType:e,...Ie(t)})}const Dp=me("ZodEnum",(e,t)=>{UB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(a,r,i)=>h5(e,a,r),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,r)=>{const i={};for(const s of a)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Dp({...t,checks:[],...Ie(r),entries:i})},e.exclude=(a,r)=>{const i={...t.entries};for(const s of a)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Dp({...t,checks:[],...Ie(r),entries:i})}});function wy(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Dp({type:"enum",entries:n,...Ie(t)})}function yne(e,t){return new Dp({type:"enum",entries:e,...Ie(t)})}const $H=me("ZodLiteral",(e,t)=>{zB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>g5(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Nb(e,t){return new $H({type:"literal",values:Array.isArray(e)?e:[e],...Ie(t)})}const MH=me("ZodFile",(e,t)=>{FB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>y5(e,n,a),e.min=(n,a)=>e.check(Ap(n,a)),e.max=(n,a)=>e.check(uy(n,a)),e.mime=(n,a)=>e.check(aT(Array.isArray(n)?n:[n],a))});function wne(e){return Z6(MH,e)}const PH=me("ZodTransform",(e,t)=>{BB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>_5(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ry(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Ju(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(Ju(s))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then(i=>(n.value=i,n)):(n.value=r,n)}});function zT(e){return new PH({type:"transform",transform:e})}const FT=me("ZodOptional",(e,t)=>{HB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>U5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function sv(e){return new FT({type:"optional",innerType:e})}const UH=me("ZodNullable",(e,t)=>{VB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>I5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function jp(e){return new UH({type:"nullable",innerType:e})}function Sne(e){return sv(jp(e))}const zH=me("ZodDefault",(e,t)=>{GB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>D5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function FH(e,t){return new zH({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():iy(t)}})}const BH=me("ZodPrefault",(e,t)=>{WB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>j5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function HH(e,t){return new BH({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():iy(t)}})}const BT=me("ZodNonOptional",(e,t)=>{KB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>O5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function VH(e,t){return new BT({type:"nonoptional",innerType:e,...Ie(t)})}const GH=me("ZodSuccess",(e,t)=>{ZB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>w5(e,n,a),e.unwrap=()=>e._zod.def.innerType});function xne(e){return new GH({type:"success",innerType:e})}const WH=me("ZodCatch",(e,t)=>{YB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>L5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function KH(e,t){return new WH({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const ZH=me("ZodNaN",(e,t)=>{qB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>b5(e,n)});function _ne(e){return F6(ZH,e)}const HT=me("ZodPipe",(e,t)=>{XB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>$5(e,n,a,r),e.in=t.in,e.out=t.out});function lv(e,t){return new HT({type:"pipe",in:e,out:t})}const VT=me("ZodCodec",(e,t)=>{HT.init(e,t),Rk.init(e,t)});function Ene(e,t,n){return new VT({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}const YH=me("ZodReadonly",(e,t)=>{JB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>M5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function GT(e){return new YH({type:"readonly",innerType:e})}const qH=me("ZodTemplateLiteral",(e,t)=>{QB.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>v5(e,n,a)});function kne(e,t){return new qH({type:"template_literal",parts:e,...Ie(t)})}const XH=me("ZodLazy",(e,t)=>{n6.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>z5(e,n,a,r),e.unwrap=()=>e._zod.def.getter()});function WT(e){return new XH({type:"lazy",getter:e})}const JH=me("ZodPromise",(e,t)=>{t6.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>P5(e,n,a,r),e.unwrap=()=>e._zod.def.innerType});function Tne(e){return new JH({type:"promise",innerType:e})}const QH=me("ZodFunction",(e,t)=>{e6.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>x5(e,n)});function CM(e){return new QH({type:"function",input:Array.isArray(e?.input)?su(e?.input):e?.input??id(ad()),output:e?.output??ad()})}const Sy=me("ZodCustom",(e,t)=>{r6.init(e,t),Ot.init(e,t),e._zod.processJSONSchema=(n,a,r)=>S5(e,n)});function Nne(e){const t=new zn({check:"custom"});return t._zod.check=e,t}function Cne(e,t){return Y6(Sy,e??(()=>!0),t)}function eV(e,t={}){return q6(Sy,e,t)}function tV(e){return X6(e)}const Rne=Q6,Ane=e5;function Ine(e,t={error:`Input not instance of ${e.name}`}){const n=new Sy({type:"custom",check:"custom",fn:a=>a instanceof e,abort:!0,...Ie(t)});return n._zod.bag.Class=e,n}const One=(...e)=>t5({Codec:VT,Boolean:hy,String:fy},...e);function Dne(e){const t=WT(()=>od([Op(e),iv(),$T(),ov(),id(t),UT(Op(),t)]));return t}function jne(e,t){return lv(zT(e),t)}const Lne={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function $ne(e){Gr({customError:e})}function Mne(){return Gr().customError}var u_;u_||(u_={});function Pne(e,t){const n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Une(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");const n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;const a=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===a){const r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function nV(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return Ds();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){const r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return WT(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);const i=Une(r,t),s=Br(i,t);return t.refs.set(r,s),t.processing.delete(r),s}if(e.enum!==void 0){const r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return ov();if(r.length===0)return Ds();if(r.length===1)return Nb(r[0]);if(r.every(s=>typeof s=="string"))return wy(r);const i=r.map(s=>Nb(s));return i.length<2?i[0]:od([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return Nb(e.const);const n=e.type;if(Array.isArray(n)){const r=n.map(i=>{const s={...e,type:i};return nV(s,t)});return r.length===0?Ds():r.length===1?r[0]:od(r)}if(!n)return Ll();let a;switch(n){case"string":{let r=Op();if(e.format){const i=e.format;i==="email"?r=r.check(tH()):i==="uri"||i==="uri-reference"?r=r.check(rH()):i==="uuid"||i==="guid"?r=r.check(nH()):i==="date-time"?r=r.check(fT()):i==="date"?r=r.check(mT()):i==="time"?r=r.check(gT()):i==="duration"?r=r.check(vT()):i==="ipv4"?r=r.check(dH()):i==="ipv6"?r=r.check(mH()):i==="mac"?r=r.check(pH()):i==="cidr"?r=r.check(hH()):i==="cidr-v6"?r=r.check(gH()):i==="base64"?r=r.check(bH()):i==="base64url"?r=r.check(vH()):i==="e164"?r=r.check(yH()):i==="jwt"?r=r.check(wH()):i==="emoji"?r=r.check(aH()):i==="nanoid"?r=r.check(iH()):i==="cuid"?r=r.check(oH()):i==="cuid2"?r=r.check(sH()):i==="ulid"?r=r.check(lH()):i==="xid"?r=r.check(cH()):i==="ksuid"&&(r=r.check(uH()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),a=r;break}case"number":case"integer":{let r=n==="integer"?iv().int():iv();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),a=r;break}case"boolean":{a=$T();break}case"null":{a=ov();break}case"object":{const r={},i=e.properties||{},s=new Set(e.required||[]);for(const[u,d]of Object.entries(i)){const m=Br(d,t);r[u]=s.has(u)?m:m.optional()}if(e.propertyNames){const u=Br(e.propertyNames,t),d=e.additionalProperties&&typeof e.additionalProperties=="object"?Br(e.additionalProperties,t):Ll();if(Object.keys(r).length===0){a=UT(u,d);break}const m=Jf(r).passthrough(),h=c_(u,d);a=js(m,h);break}if(e.patternProperties){const u=e.patternProperties,d=Object.keys(u),m=[];for(const g of d){const v=Br(u[g],t),x=Op().regex(new RegExp(g));m.push(c_(x,v))}const h=[];if(Object.keys(r).length>0&&h.push(Jf(r).passthrough()),h.push(...m),h.length===0)a=Jf({}).passthrough();else if(h.length===1)a=h[0];else{let g=js(h[0],h[1]);for(let v=2;v<h.length;v++)g=js(g,h[v]);a=g}break}const c=Jf(r);e.additionalProperties===!1?a=c.strict():typeof e.additionalProperties=="object"?a=c.catchall(Br(e.additionalProperties,t)):a=c.passthrough();break}case"array":{const r=e.prefixItems,i=e.items;if(r&&Array.isArray(r)){const s=r.map(u=>Br(u,t)),c=i&&typeof i=="object"&&!Array.isArray(i)?Br(i,t):void 0;c?a=su(s).rest(c):a=su(s),typeof e.minItems=="number"&&(a=a.check(Ms(e.minItems))),typeof e.maxItems=="number"&&(a=a.check(ed(e.maxItems)))}else if(Array.isArray(i)){const s=i.map(u=>Br(u,t)),c=e.additionalItems&&typeof e.additionalItems=="object"?Br(e.additionalItems,t):void 0;c?a=su(s).rest(c):a=su(s),typeof e.minItems=="number"&&(a=a.check(Ms(e.minItems))),typeof e.maxItems=="number"&&(a=a.check(ed(e.maxItems)))}else if(i!==void 0){const s=Br(i,t);let c=id(s);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),a=c}else a=id(Ll());break}default:throw new Error(`Unsupported type: ${n}`)}return e.description&&(a=a.describe(e.description)),e.default!==void 0&&(a=a.default(e.default)),a}function Br(e,t){if(typeof e=="boolean")return e?Ll():Ds();let n=nV(e,t);const a=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){const r=e.anyOf.map(s=>Br(s,t)),i=od(r);n=a?js(n,i):i}if(e.oneOf&&Array.isArray(e.oneOf)){const r=e.oneOf.map(s=>Br(s,t)),i=AH(r);n=a?js(n,i):i}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=a?n:Ll();else{let r=a?n:Br(e.allOf[0],t);const i=a?0:1;for(let s=i;s<e.allOf.length;s++)r=js(r,Br(e.allOf[s],t));n=r}return e.nullable===!0&&t.version==="openapi-3.0"&&(n=jp(n)),e.readOnly===!0&&(n=GT(n)),n}function zne(e,t){if(typeof e=="boolean")return e?Ll():Ds();const n=Pne(e,t?.defaultTarget),a=e.$defs||e.definitions||{};return Br(e,{version:n,defs:a,refs:new Map,processing:new Set,rootSchema:e})}function Fne(e){return f6(fy,e)}function Bne(e){return w6(my,e)}function Hne(e){return N6(hy,e)}function Vne(e){return R6(gy,e)}function Gne(e){return z6(PT,e)}const Wne=Object.freeze(Object.defineProperty({__proto__:null,bigint:Vne,boolean:Hne,date:Gne,number:Bne,string:Fne},Symbol.toStringTag,{value:"Module"}));Gr(a6());const D=Object.freeze(Object.defineProperty({__proto__:null,$brand:wF,$input:c6,$output:l6,NEVER:yF,TimePrecision:m6,ZodAny:EH,ZodArray:CH,ZodBase64:OT,ZodBase64URL:DT,ZodBigInt:gy,ZodBigIntFormat:MT,ZodBoolean:hy,ZodCIDRv4:AT,ZodCIDRv6:IT,ZodCUID:_T,ZodCUID2:ET,ZodCatch:WH,ZodCodec:VT,ZodCustom:Sy,ZodCustomStringFormat:ym,ZodDate:PT,ZodDefault:zH,ZodDiscriminatedUnion:IH,ZodE164:jT,ZodEmail:wT,ZodEmoji:ST,ZodEnum:Dp,ZodError:Gte,ZodFile:MH,get ZodFirstPartyTypeKind(){return u_},ZodFunction:QH,ZodGUID:av,ZodIPv4:CT,ZodIPv6:RT,ZodISODate:pT,ZodISODateTime:dT,ZodISODuration:bT,ZodISOTime:hT,ZodIntersection:OH,ZodIssueCode:Lne,ZodJWT:LT,ZodKSUID:NT,ZodLazy:XH,ZodLiteral:$H,ZodMAC:fH,ZodMap:jH,ZodNaN:ZH,ZodNanoID:xT,ZodNever:TH,ZodNonOptional:BT,ZodNull:_H,ZodNullable:UH,ZodNumber:my,ZodNumberFormat:xd,ZodObject:by,ZodOptional:FT,ZodPipe:HT,ZodPrefault:BH,ZodPromise:JH,ZodReadonly:YH,ZodRealError:Pa,ZodRecord:yy,ZodSet:LH,ZodString:fy,ZodStringFormat:In,ZodSuccess:GH,ZodSymbol:SH,ZodTemplateLiteral:qH,ZodTransform:PH,ZodTuple:DH,ZodType:Ot,ZodULID:kT,ZodURL:py,ZodUUID:No,ZodUndefined:xH,ZodUnion:vy,ZodUnknown:kH,ZodVoid:NH,ZodXID:TT,ZodXor:RH,_ZodString:yT,_default:FH,_function:CM,any:Ll,array:id,base64:bH,base64url:vH,bigint:ine,boolean:$T,catch:KH,check:Nne,cidrv4:hH,cidrv6:gH,clone:ni,codec:Ene,coerce:Wne,config:Gr,core:Hte,cuid:oH,cuid2:sH,custom:Cne,date:dne,decode:Z5,decodeAsync:q5,describe:Rne,discriminatedUnion:hne,e164:yH,email:tH,emoji:aH,encode:K5,encodeAsync:Y5,endsWith:rT,enum:wy,file:wne,flattenError:ck,float32:tne,float64:nne,formatError:uk,fromJSONSchema:zne,function:CM,getErrorMap:Mne,globalRegistry:vi,gt:Bl,gte:La,guid:Wte,hash:ene,hex:Qte,hostname:Jte,httpUrl:qte,includes:tT,instanceof:Ine,int:l_,int32:rne,int64:one,intersection:js,ipv4:dH,ipv6:mH,iso:Vte,json:Dne,jwt:wH,keyof:fne,ksuid:uH,lazy:WT,length:dy,literal:Nb,locales:s6,looseObject:mne,looseRecord:c_,lowercase:Qk,lt:Fl,lte:yi,mac:pH,map:bne,maxLength:ed,maxSize:uy,meta:Ane,mime:aT,minLength:Ms,minSize:Ap,multipleOf:Rp,nan:_ne,nanoid:iH,nativeEnum:yne,negative:H6,never:Ds,nonnegative:G6,nonoptional:VH,nonpositive:V6,normalize:iT,null:ov,nullable:jp,nullish:Sne,number:iv,object:Jf,optional:sv,overwrite:Ws,parse:H5,parseAsync:V5,partialRecord:gne,pipe:lv,positive:B6,prefault:HH,preprocess:jne,prettifyError:FF,promise:Tne,property:W6,readonly:GT,record:UT,refine:eV,regex:Jk,regexes:Sk,registry:Ak,safeDecode:J5,safeDecodeAsync:eH,safeEncode:X5,safeEncodeAsync:Q5,safeParse:G5,safeParseAsync:W5,set:vne,setErrorMap:$ne,size:Xk,slugify:cT,startsWith:nT,strictObject:pne,string:Op,stringFormat:Xte,stringbool:One,success:xne,superRefine:tV,symbol:lne,templateLiteral:kne,toJSONSchema:F5,toLowerCase:sT,toUpperCase:lT,transform:zT,treeifyError:UF,trim:oT,tuple:su,uint32:ane,uint64:sne,ulid:lH,undefined:cne,union:od,unknown:ad,uppercase:eT,url:rH,util:MF,uuid:nH,uuidv4:Kte,uuidv6:Zte,uuidv7:Yte,void:une,xid:cH,xor:AH},Symbol.toStringTag,{value:"Module"})),xy="2025-11-25",Kne=[xy,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Eo="io.modelcontextprotocol/related-task",_y="2.0",Hi=D.custom(e=>e!==null&&(typeof e=="object"||typeof e=="function")),rV=D.union([D.string(),D.number().int()]),aV=D.string(),Zne=D.looseObject({ttl:D.union([D.number(),D.null()]).optional(),pollInterval:D.number().optional()}),KT=D.looseObject({taskId:D.string()}),Yne=D.looseObject({progressToken:rV.optional(),[Eo]:KT.optional()}),wa=D.looseObject({task:Zne.optional(),_meta:Yne.optional()}),$r=D.object({method:D.string(),params:wa.optional()}),ec=D.looseObject({_meta:D.object({[Eo]:D.optional(KT)}).passthrough().optional()}),ri=D.object({method:D.string(),params:ec.optional()}),Kr=D.looseObject({_meta:D.looseObject({[Eo]:KT.optional()}).optional()}),Ey=D.union([D.string(),D.number().int()]),iV=D.object({jsonrpc:D.literal(_y),id:Ey,...$r.shape}).strict(),d_=e=>iV.safeParse(e).success,oV=D.object({jsonrpc:D.literal(_y),...ri.shape}).strict(),qne=e=>oV.safeParse(e).success,sV=D.object({jsonrpc:D.literal(_y),id:Ey,result:Kr}).strict(),Qf=e=>sV.safeParse(e).success;var wt;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(wt||(wt={}));const lV=D.object({jsonrpc:D.literal(_y),id:Ey,error:D.object({code:D.number().int(),message:D.string(),data:D.optional(D.unknown())})}).strict(),Xne=e=>lV.safeParse(e).success,Cb=D.union([iV,oV,sV,lV]),lu=Kr.strict(),Jne=ec.extend({requestId:Ey,reason:D.string().optional()}),ZT=ri.extend({method:D.literal("notifications/cancelled"),params:Jne}),Qne=D.object({src:D.string(),mimeType:D.string().optional(),sizes:D.array(D.string()).optional()}),wm=D.object({icons:D.array(Qne).optional()}),sd=D.object({name:D.string(),title:D.string().optional()}),cV=sd.extend({...sd.shape,...wm.shape,version:D.string(),websiteUrl:D.string().optional()}),ere=D.intersection(D.object({applyDefaults:D.boolean().optional()}),D.record(D.string(),D.unknown())),tre=D.preprocess(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,D.intersection(D.object({form:ere.optional(),url:Hi.optional()}),D.record(D.string(),D.unknown()).optional())),nre=D.object({list:D.optional(D.object({}).passthrough()),cancel:D.optional(D.object({}).passthrough()),requests:D.optional(D.object({sampling:D.optional(D.object({createMessage:D.optional(D.object({}).passthrough())}).passthrough()),elicitation:D.optional(D.object({create:D.optional(D.object({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),rre=D.object({list:D.optional(D.object({}).passthrough()),cancel:D.optional(D.object({}).passthrough()),requests:D.optional(D.object({tools:D.optional(D.object({call:D.optional(D.object({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),are=D.object({experimental:D.record(D.string(),Hi).optional(),sampling:D.object({context:Hi.optional(),tools:Hi.optional()}).optional(),elicitation:tre.optional(),roots:D.object({listChanged:D.boolean().optional()}).optional(),tasks:D.optional(nre)}),ire=wa.extend({protocolVersion:D.string(),capabilities:are,clientInfo:cV}),ore=$r.extend({method:D.literal("initialize"),params:ire}),sre=D.object({experimental:D.record(D.string(),Hi).optional(),logging:Hi.optional(),completions:Hi.optional(),prompts:D.optional(D.object({listChanged:D.optional(D.boolean())})),resources:D.object({subscribe:D.boolean().optional(),listChanged:D.boolean().optional()}).optional(),tools:D.object({listChanged:D.boolean().optional()}).optional(),tasks:D.optional(rre)}).passthrough(),uV=Kr.extend({protocolVersion:D.string(),capabilities:sre,serverInfo:cV,instructions:D.string().optional()}),dV=ri.extend({method:D.literal("notifications/initialized")}),lre=e=>dV.safeParse(e).success,YT=$r.extend({method:D.literal("ping")}),cre=D.object({progress:D.number(),total:D.optional(D.number()),message:D.optional(D.string())}),ure=D.object({...ec.shape,...cre.shape,progressToken:rV}),qT=ri.extend({method:D.literal("notifications/progress"),params:ure}),dre=wa.extend({cursor:aV.optional()}),Sm=$r.extend({params:dre.optional()}),xm=Kr.extend({nextCursor:D.optional(aV)}),_m=D.object({taskId:D.string(),status:D.enum(["working","input_required","completed","failed","cancelled"]),ttl:D.union([D.number(),D.null()]),createdAt:D.string(),lastUpdatedAt:D.string(),pollInterval:D.optional(D.number()),statusMessage:D.optional(D.string())}),Lp=Kr.extend({task:_m}),fre=ec.merge(_m),cv=ri.extend({method:D.literal("notifications/tasks/status"),params:fre}),XT=$r.extend({method:D.literal("tasks/get"),params:wa.extend({taskId:D.string()})}),JT=Kr.merge(_m),QT=$r.extend({method:D.literal("tasks/result"),params:wa.extend({taskId:D.string()})}),eN=Sm.extend({method:D.literal("tasks/list")}),tN=xm.extend({tasks:D.array(_m)}),pre=$r.extend({method:D.literal("tasks/cancel"),params:wa.extend({taskId:D.string()})}),mre=Kr.merge(_m),fV=D.object({uri:D.string(),mimeType:D.optional(D.string()),_meta:D.record(D.string(),D.unknown()).optional()}),pV=fV.extend({text:D.string()}),nN=D.string().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),mV=fV.extend({blob:nN}),Em=D.enum(["user","assistant"]),_d=D.object({audience:D.array(Em).optional(),priority:D.number().min(0).max(1).optional(),lastModified:D.iso.datetime({offset:!0}).optional()}),hV=D.object({...sd.shape,...wm.shape,uri:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string()),annotations:_d.optional(),_meta:D.optional(D.looseObject({}))}),hre=D.object({...sd.shape,...wm.shape,uriTemplate:D.string(),description:D.optional(D.string()),mimeType:D.optional(D.string()),annotations:_d.optional(),_meta:D.optional(D.looseObject({}))}),gre=Sm.extend({method:D.literal("resources/list")}),gV=xm.extend({resources:D.array(hV)}),bre=Sm.extend({method:D.literal("resources/templates/list")}),bV=xm.extend({resourceTemplates:D.array(hre)}),rN=wa.extend({uri:D.string()}),vre=rN,yre=$r.extend({method:D.literal("resources/read"),params:vre}),vV=Kr.extend({contents:D.array(D.union([pV,mV]))}),yV=ri.extend({method:D.literal("notifications/resources/list_changed")}),wre=rN,Sre=$r.extend({method:D.literal("resources/subscribe"),params:wre}),xre=rN,_re=$r.extend({method:D.literal("resources/unsubscribe"),params:xre}),Ere=ec.extend({uri:D.string()}),kre=ri.extend({method:D.literal("notifications/resources/updated"),params:Ere}),Tre=D.object({name:D.string(),description:D.optional(D.string()),required:D.optional(D.boolean())}),Nre=D.object({...sd.shape,...wm.shape,description:D.optional(D.string()),arguments:D.optional(D.array(Tre)),_meta:D.optional(D.looseObject({}))}),Cre=Sm.extend({method:D.literal("prompts/list")}),wV=xm.extend({prompts:D.array(Nre)}),Rre=wa.extend({name:D.string(),arguments:D.record(D.string(),D.string()).optional()}),Are=$r.extend({method:D.literal("prompts/get"),params:Rre}),aN=D.object({type:D.literal("text"),text:D.string(),annotations:_d.optional(),_meta:D.record(D.string(),D.unknown()).optional()}),iN=D.object({type:D.literal("image"),data:nN,mimeType:D.string(),annotations:_d.optional(),_meta:D.record(D.string(),D.unknown()).optional()}),oN=D.object({type:D.literal("audio"),data:nN,mimeType:D.string(),annotations:_d.optional(),_meta:D.record(D.string(),D.unknown()).optional()}),Ire=D.object({type:D.literal("tool_use"),name:D.string(),id:D.string(),input:D.object({}).passthrough(),_meta:D.optional(D.object({}).passthrough())}).passthrough(),Ore=D.object({type:D.literal("resource"),resource:D.union([pV,mV]),annotations:_d.optional(),_meta:D.record(D.string(),D.unknown()).optional()}),Dre=hV.extend({type:D.literal("resource_link")}),sN=D.union([aN,iN,oN,Dre,Ore]),jre=D.object({role:Em,content:sN}),SV=Kr.extend({description:D.optional(D.string()),messages:D.array(jre)}),xV=ri.extend({method:D.literal("notifications/prompts/list_changed")}),Lre=D.object({title:D.string().optional(),readOnlyHint:D.boolean().optional(),destructiveHint:D.boolean().optional(),idempotentHint:D.boolean().optional(),openWorldHint:D.boolean().optional()}),$re=D.object({taskSupport:D.enum(["required","optional","forbidden"]).optional()}),_V=D.object({...sd.shape,...wm.shape,description:D.string().optional(),inputSchema:D.object({type:D.literal("object"),properties:D.record(D.string(),Hi).optional(),required:D.array(D.string()).optional()}).catchall(D.unknown()),outputSchema:D.object({type:D.literal("object"),properties:D.record(D.string(),Hi).optional(),required:D.array(D.string()).optional()}).catchall(D.unknown()).optional(),annotations:D.optional(Lre),execution:D.optional($re),_meta:D.record(D.string(),D.unknown()).optional()}),Mre=Sm.extend({method:D.literal("tools/list")}),EV=xm.extend({tools:D.array(_V)}),ky=Kr.extend({content:D.array(sN).default([]),structuredContent:D.record(D.string(),D.unknown()).optional(),isError:D.optional(D.boolean())});ky.or(Kr.extend({toolResult:D.unknown()}));const Pre=wa.extend({name:D.string(),arguments:D.optional(D.record(D.string(),D.unknown()))}),Ure=$r.extend({method:D.literal("tools/call"),params:Pre}),kV=ri.extend({method:D.literal("notifications/tools/list_changed")}),zre=D.object({autoRefresh:D.boolean().default(!0),debounceMs:D.number().int().nonnegative().default(300)}),TV=D.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Fre=wa.extend({level:TV}),Bre=$r.extend({method:D.literal("logging/setLevel"),params:Fre}),Hre=ec.extend({level:TV,logger:D.string().optional(),data:D.unknown()}),Vre=ri.extend({method:D.literal("notifications/message"),params:Hre}),Gre=D.object({name:D.string().optional()}),Wre=D.object({hints:D.optional(D.array(Gre)),costPriority:D.optional(D.number().min(0).max(1)),speedPriority:D.optional(D.number().min(0).max(1)),intelligencePriority:D.optional(D.number().min(0).max(1))}),Kre=D.object({mode:D.optional(D.enum(["auto","required","none"]))}),Zre=D.object({type:D.literal("tool_result"),toolUseId:D.string().describe("The unique identifier for the corresponding tool call."),content:D.array(sN).default([]),structuredContent:D.object({}).passthrough().optional(),isError:D.optional(D.boolean()),_meta:D.optional(D.object({}).passthrough())}).passthrough(),Yre=D.discriminatedUnion("type",[aN,iN,oN]),uv=D.discriminatedUnion("type",[aN,iN,oN,Ire,Zre]),qre=D.object({role:Em,content:D.union([uv,D.array(uv)]),_meta:D.optional(D.object({}).passthrough())}).passthrough(),Xre=wa.extend({messages:D.array(qre),modelPreferences:Wre.optional(),systemPrompt:D.string().optional(),includeContext:D.enum(["none","thisServer","allServers"]).optional(),temperature:D.number().optional(),maxTokens:D.number().int(),stopSequences:D.array(D.string()).optional(),metadata:Hi.optional(),tools:D.optional(D.array(_V)),toolChoice:D.optional(Kre)}),lN=$r.extend({method:D.literal("sampling/createMessage"),params:Xre}),cN=Kr.extend({model:D.string(),stopReason:D.optional(D.enum(["endTurn","stopSequence","maxTokens"]).or(D.string())),role:Em,content:Yre}),Jre=Kr.extend({model:D.string(),stopReason:D.optional(D.enum(["endTurn","stopSequence","maxTokens","toolUse"]).or(D.string())),role:Em,content:D.union([uv,D.array(uv)])}),Qre=D.object({type:D.literal("boolean"),title:D.string().optional(),description:D.string().optional(),default:D.boolean().optional()}),eae=D.object({type:D.literal("string"),title:D.string().optional(),description:D.string().optional(),minLength:D.number().optional(),maxLength:D.number().optional(),format:D.enum(["email","uri","date","date-time"]).optional(),default:D.string().optional()}),tae=D.object({type:D.enum(["number","integer"]),title:D.string().optional(),description:D.string().optional(),minimum:D.number().optional(),maximum:D.number().optional(),default:D.number().optional()}),nae=D.object({type:D.literal("string"),title:D.string().optional(),description:D.string().optional(),enum:D.array(D.string()),default:D.string().optional()}),rae=D.object({type:D.literal("string"),title:D.string().optional(),description:D.string().optional(),oneOf:D.array(D.object({const:D.string(),title:D.string()})),default:D.string().optional()}),aae=D.object({type:D.literal("string"),title:D.string().optional(),description:D.string().optional(),enum:D.array(D.string()),enumNames:D.array(D.string()).optional(),default:D.string().optional()}),iae=D.union([nae,rae]),oae=D.object({type:D.literal("array"),title:D.string().optional(),description:D.string().optional(),minItems:D.number().optional(),maxItems:D.number().optional(),items:D.object({type:D.literal("string"),enum:D.array(D.string())}),default:D.array(D.string()).optional()}),sae=D.object({type:D.literal("array"),title:D.string().optional(),description:D.string().optional(),minItems:D.number().optional(),maxItems:D.number().optional(),items:D.object({anyOf:D.array(D.object({const:D.string(),title:D.string()}))}),default:D.array(D.string()).optional()}),lae=D.union([oae,sae]),cae=D.union([aae,iae,lae]),uae=D.union([cae,Qre,eae,tae]),dae=wa.extend({mode:D.literal("form").optional(),message:D.string(),requestedSchema:D.object({type:D.literal("object"),properties:D.record(D.string(),uae),required:D.array(D.string()).optional()})}),fae=wa.extend({mode:D.literal("url"),message:D.string(),elicitationId:D.string(),url:D.string().url()}),pae=D.union([dae,fae]),uN=$r.extend({method:D.literal("elicitation/create"),params:pae}),mae=ec.extend({elicitationId:D.string()}),hae=ri.extend({method:D.literal("notifications/elicitation/complete"),params:mae}),NV=Kr.extend({action:D.enum(["accept","decline","cancel"]),content:D.preprocess(e=>e===null?void 0:e,D.record(D.string(),D.union([D.string(),D.number(),D.boolean(),D.array(D.string())])).optional())}),gae=D.object({type:D.literal("ref/resource"),uri:D.string()}),bae=D.object({type:D.literal("ref/prompt"),name:D.string()}),vae=wa.extend({ref:D.union([bae,gae]),argument:D.object({name:D.string(),value:D.string()}),context:D.object({arguments:D.record(D.string(),D.string()).optional()}).optional()}),yae=$r.extend({method:D.literal("completion/complete"),params:vae}),CV=Kr.extend({completion:D.looseObject({values:D.array(D.string()).max(100),total:D.optional(D.number().int()),hasMore:D.optional(D.boolean())})}),wae=D.object({uri:D.string().startsWith("file://"),name:D.string().optional(),_meta:D.record(D.string(),D.unknown()).optional()}),RV=$r.extend({method:D.literal("roots/list")}),Sae=Kr.extend({roots:D.array(wae)}),xae=ri.extend({method:D.literal("notifications/roots/list_changed")});D.union([YT,ore,yae,Bre,Are,Cre,gre,bre,yre,Sre,_re,Ure,Mre,XT,QT,eN]);D.union([ZT,qT,dV,xae,cv]);D.union([lu,cN,Jre,NV,Sae,JT,tN,Lp]);D.union([YT,lN,uN,RV,XT,QT,eN]);D.union([ZT,qT,Vre,kre,yV,kV,xV,cv,hae]);D.union([lu,uV,CV,SV,wV,gV,bV,vV,ky,EV,JT,tN,Lp]);class lt extends Error{constructor(t,n,a){super(`MCP error ${t}: ${n}`),this.code=t,this.data=a,this.name="McpError"}static fromError(t,n,a){if(t===wt.UrlElicitationRequired&&a){const r=a;if(r.elicitations)return new _ae(r.elicitations,n)}return new lt(t,n,a)}}class _ae extends lt{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(wt.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){var t,n;return(n=(t=this.data)===null||t===void 0?void 0:t.elicitations)!==null&&n!==void 0?n:[]}}function Ty(e){return!!e._zod}function Ts(e,t){return Ty(e)?dk(e,t):e.safeParse(t)}function AV(e){var t,n;if(!e)return;let a;if(Ty(e)?a=(n=(t=e._zod)===null||t===void 0?void 0:t.def)===null||n===void 0?void 0:n.shape:a=e.shape,!!a){if(typeof a=="function")try{return a()}catch{return}return a}}function Eae(e){var t;if(Ty(e)){const s=(t=e._zod)===null||t===void 0?void 0:t.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}const a=e._def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}const r=e.value;if(r!==void 0)return r}function gl(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function RM(e){const t=AV(e),n=t?.method;if(!n)throw new Error("Schema is missing a method literal");const a=Eae(n);if(typeof a!="string")throw new Error("Schema method literal must be a string");return a}function AM(e,t){const n=Ts(e,t);if(!n.success)throw n.error;return n.data}const kae=6e4;class Tae{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(ZT,n=>{this._oncancel(n)}),this.setNotificationHandler(qT,n=>{this._onprogress(n)}),this.setRequestHandler(YT,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(XT,async(n,a)=>{const r=await this._taskStore.getTask(n.params.taskId,a.sessionId);if(!r)throw new lt(wt.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(QT,async(n,a)=>{const r=async()=>{var i;const s=n.params.taskId;if(this._taskMessageQueue){let u;for(;u=await this._taskMessageQueue.dequeue(s,a.sessionId);){if(u.type==="response"||u.type==="error"){const d=u.message,m=d.id,h=this._requestResolvers.get(m);if(h)if(this._requestResolvers.delete(m),u.type==="response")h(d);else{const g=d,v=new lt(g.error.code,g.error.message,g.error.data);h(v)}else{const g=u.type==="response"?"Response":"Error";this._onerror(new Error(`${g} handler missing for request ${m}`))}continue}await((i=this._transport)===null||i===void 0?void 0:i.send(u.message,{relatedRequestId:a.requestId}))}}const c=await this._taskStore.getTask(s,a.sessionId);if(!c)throw new lt(wt.InvalidParams,`Task not found: ${s}`);if(!gl(c.status))return await this._waitForTaskUpdate(s,a.signal),await r();if(gl(c.status)){const u=await this._taskStore.getTaskResult(s,a.sessionId);return this._clearTaskQueue(s),{...u,_meta:{...u._meta,[Eo]:{taskId:s}}}}return await r()};return await r()}),this.setRequestHandler(eN,async(n,a)=>{var r;try{const{tasks:i,nextCursor:s}=await this._taskStore.listTasks((r=n.params)===null||r===void 0?void 0:r.cursor,a.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new lt(wt.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(pre,async(n,a)=>{try{const r=await this._taskStore.getTask(n.params.taskId,a.sessionId);if(!r)throw new lt(wt.InvalidParams,`Task not found: ${n.params.taskId}`);if(gl(r.status))throw new lt(wt.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",a.sessionId),this._clearTaskQueue(n.params.taskId);const i=await this._taskStore.getTask(n.params.taskId,a.sessionId);if(!i)throw new lt(wt.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...i}}catch(r){throw r instanceof lt?r:new lt(wt.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){const n=this._requestHandlerAbortControllers.get(t.params.requestId);n?.abort(t.params.reason)}_setupTimeout(t,n,a,r,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const a=Date.now()-n.startTime;if(n.maxTotalTimeout&&a>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),lt.fromError(wt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:a});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var n,a,r;this._transport=t;const i=(n=this.transport)===null||n===void 0?void 0:n.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};const s=(a=this.transport)===null||a===void 0?void 0:a.onerror;this._transport.onerror=u=>{s?.(u),this._onerror(u)};const c=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(u,d)=>{c?.(u,d),Qf(u)||Xne(u)?this._onresponse(u):d_(u)?this._onrequest(u,d):qne(u)?this._onnotification(u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`))},await this._transport.start()}_onclose(){var t;const n=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const a=lt.fromError(wt.ConnectionClosed,"Connection closed");this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);for(const r of n.values())r(a)}_onerror(t){var n;(n=this.onerror)===null||n===void 0||n.call(this,t)}_onnotification(t){var n;const a=(n=this._notificationHandlers.get(t.method))!==null&&n!==void 0?n:this.fallbackNotificationHandler;a!==void 0&&Promise.resolve().then(()=>a(t)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(t,n){var a,r,i,s,c,u;const d=(a=this._requestHandlers.get(t.method))!==null&&a!==void 0?a:this.fallbackRequestHandler,m=this._transport,h=(s=(i=(r=t.params)===null||r===void 0?void 0:r._meta)===null||i===void 0?void 0:i[Eo])===null||s===void 0?void 0:s.taskId;if(d===void 0){const y={jsonrpc:"2.0",id:t.id,error:{code:wt.MethodNotFound,message:"Method not found"}};h&&this._taskMessageQueue?this._enqueueTaskMessage(h,{type:"error",message:y,timestamp:Date.now()},m?.sessionId).catch(E=>this._onerror(new Error(`Failed to enqueue error response: ${E}`))):m?.send(y).catch(E=>this._onerror(new Error(`Failed to send an error response: ${E}`)));return}const g=new AbortController;this._requestHandlerAbortControllers.set(t.id,g);const v=(c=t.params)===null||c===void 0?void 0:c.task,x=this._taskStore?this.requestTaskStore(t,m?.sessionId):void 0,S={signal:g.signal,sessionId:m?.sessionId,_meta:(u=t.params)===null||u===void 0?void 0:u._meta,sendNotification:async y=>{const E={relatedRequestId:t.id};h&&(E.relatedTask={taskId:h}),await this.notification(y,E)},sendRequest:async(y,E,_)=>{var k,C;const R={..._,relatedRequestId:t.id};h&&!R.relatedTask&&(R.relatedTask={taskId:h});const I=(C=(k=R.relatedTask)===null||k===void 0?void 0:k.taskId)!==null&&C!==void 0?C:h;return I&&x&&await x.updateTaskStatus(I,"input_required"),await this.request(y,E,R)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:h,taskStore:x,taskRequestedTtl:v?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{v&&this.assertTaskHandlerCapability(t.method)}).then(()=>d(t,S)).then(async y=>{if(g.signal.aborted)return;const E={result:y,jsonrpc:"2.0",id:t.id};h&&this._taskMessageQueue?await this._enqueueTaskMessage(h,{type:"response",message:E,timestamp:Date.now()},m?.sessionId):await m?.send(E)},async y=>{var E;if(g.signal.aborted)return;const _={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(y.code)?y.code:wt.InternalError,message:(E=y.message)!==null&&E!==void 0?E:"Internal error",...y.data!==void 0&&{data:y.data}}};h&&this._taskMessageQueue?await this._enqueueTaskMessage(h,{type:"error",message:_,timestamp:Date.now()},m?.sessionId):await m?.send(_)}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...a}=t.params,r=Number(n),i=this._progressHandlers.get(r);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const s=this._responseHandlers.get(r),c=this._timeoutInfo.get(r);if(c&&s&&c.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),s(u);return}i(a)}_onresponse(t){const n=Number(t.id),a=this._requestResolvers.get(n);if(a){if(this._requestResolvers.delete(n),Qf(t))a(t);else{const s=new lt(t.error.code,t.error.message,t.error.data);a(s)}return}const r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let i=!1;if(Qf(t)&&t.result&&typeof t.result=="object"){const s=t.result;if(s.task&&typeof s.task=="object"){const c=s.task;typeof c.taskId=="string"&&(i=!0,this._taskProgressTokens.set(c.taskId,n))}}if(i||this._progressHandlers.delete(n),Qf(t))r(t);else{const s=lt.fromError(t.error.code,t.error.message,t.error.data);r(s)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)===null||t===void 0?void 0:t.close())}async*requestStream(t,n,a){var r,i,s,c;const{task:u}=a??{};if(!u){try{yield{type:"result",result:await this.request(t,n,a)}}catch(m){yield{type:"error",error:m instanceof lt?m:new lt(wt.InternalError,String(m))}}return}let d;try{const m=await this.request(t,Lp,a);if(m.task)d=m.task.taskId,yield{type:"taskCreated",task:m.task};else throw new lt(wt.InternalError,"Task creation did not return a task");for(;;){const h=await this.getTask({taskId:d},a);if(yield{type:"taskStatus",task:h},gl(h.status)){h.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:d},n,a)}:h.status==="failed"?yield{type:"error",error:new lt(wt.InternalError,`Task ${d} failed`)}:h.status==="cancelled"&&(yield{type:"error",error:new lt(wt.InternalError,`Task ${d} was cancelled`)});return}if(h.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:d},n,a)};return}const g=(s=(r=h.pollInterval)!==null&&r!==void 0?r:(i=this._options)===null||i===void 0?void 0:i.defaultTaskPollInterval)!==null&&s!==void 0?s:1e3;await new Promise(v=>setTimeout(v,g)),(c=a?.signal)===null||c===void 0||c.throwIfAborted()}}catch(m){yield{type:"error",error:m instanceof lt?m:new lt(wt.InternalError,String(m))}}}request(t,n,a){const{relatedRequestId:r,resumptionToken:i,onresumptiontoken:s,task:c,relatedTask:u}=a??{};return new Promise((d,m)=>{var h,g,v,x,S,y,E;const _=M=>{m(M)};if(!this._transport){_(new Error("Not connected"));return}if(((h=this._options)===null||h===void 0?void 0:h.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),c&&this.assertTaskCapability(t.method)}catch(M){_(M);return}(g=a?.signal)===null||g===void 0||g.throwIfAborted();const k=this._requestMessageId++,C={...t,jsonrpc:"2.0",id:k};a?.onprogress&&(this._progressHandlers.set(k,a.onprogress),C.params={...t.params,_meta:{...((v=t.params)===null||v===void 0?void 0:v._meta)||{},progressToken:k}}),c&&(C.params={...C.params,task:c}),u&&(C.params={...C.params,_meta:{...((x=C.params)===null||x===void 0?void 0:x._meta)||{},[Eo]:u}});const R=M=>{var P;this._responseHandlers.delete(k),this._progressHandlers.delete(k),this._cleanupTimeout(k),(P=this._transport)===null||P===void 0||P.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:k,reason:String(M)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:s}).catch(K=>this._onerror(new Error(`Failed to send cancellation: ${K}`)));const B=M instanceof lt?M:new lt(wt.RequestTimeout,String(M));m(B)};this._responseHandlers.set(k,M=>{var P;if(!(!((P=a?.signal)===null||P===void 0)&&P.aborted)){if(M instanceof Error)return m(M);try{const B=Ts(n,M.result);B.success?d(B.data):m(B.error)}catch(B){m(B)}}}),(S=a?.signal)===null||S===void 0||S.addEventListener("abort",()=>{var M;R((M=a?.signal)===null||M===void 0?void 0:M.reason)});const I=(y=a?.timeout)!==null&&y!==void 0?y:kae,A=()=>R(lt.fromError(wt.RequestTimeout,"Request timed out",{timeout:I}));this._setupTimeout(k,I,a?.maxTotalTimeout,A,(E=a?.resetTimeoutOnProgress)!==null&&E!==void 0?E:!1);const O=u?.taskId;if(O){const M=P=>{const B=this._responseHandlers.get(k);B?B(P):this._onerror(new Error(`Response handler missing for side-channeled request ${k}`))};this._requestResolvers.set(k,M),this._enqueueTaskMessage(O,{type:"request",message:C,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(k),m(P)})}else this._transport.send(C,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:s}).catch(M=>{this._cleanupTimeout(k),m(M)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},JT,n)}async getTaskResult(t,n,a){return this.request({method:"tasks/result",params:t},n,a)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},tN,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},mre,n)}async notification(t,n){var a,r,i,s,c;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const u=(a=n?.relatedTask)===null||a===void 0?void 0:a.taskId;if(u){const g={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((r=t.params)===null||r===void 0?void 0:r._meta)||{},[Eo]:n.relatedTask}}};await this._enqueueTaskMessage(u,{type:"notification",message:g,timestamp:Date.now()});return}if(((s=(i=this._options)===null||i===void 0?void 0:i.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var g,v;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let x={...t,jsonrpc:"2.0"};n?.relatedTask&&(x={...x,params:{...x.params,_meta:{...((g=x.params)===null||g===void 0?void 0:g._meta)||{},[Eo]:n.relatedTask}}}),(v=this._transport)===null||v===void 0||v.send(x,n).catch(S=>this._onerror(S))});return}let h={...t,jsonrpc:"2.0"};n?.relatedTask&&(h={...h,params:{...h.params,_meta:{...((c=h.params)===null||c===void 0?void 0:c._meta)||{},[Eo]:n.relatedTask}}}),await this._transport.send(h,n)}setRequestHandler(t,n){const a=RM(t);this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(r,i)=>{const s=AM(t,r);return Promise.resolve(n(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){const a=RM(t);this._notificationHandlers.set(a,r=>{const i=AM(t,r);return Promise.resolve(n(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,a){var r;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const i=(r=this._options)===null||r===void 0?void 0:r.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,a,i)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const a=await this._taskMessageQueue.dequeueAll(t,n);for(const r of a)if(r.type==="request"&&d_(r.message)){const i=r.message.id,s=this._requestResolvers.get(i);s?(s(new lt(wt.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var a,r,i;let s=(r=(a=this._options)===null||a===void 0?void 0:a.defaultTaskPollInterval)!==null&&r!==void 0?r:1e3;try{const c=await((i=this._taskStore)===null||i===void 0?void 0:i.getTask(t));c?.pollInterval&&(s=c.pollInterval)}catch{}return new Promise((c,u)=>{if(n.aborted){u(new lt(wt.InvalidRequest,"Request cancelled"));return}const d=setTimeout(c,s);n.addEventListener("abort",()=>{clearTimeout(d),u(new lt(wt.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const a=this._taskStore;if(!a)throw new Error("No task store configured");return{createTask:async r=>{if(!t)throw new Error("No request provided");return await a.createTask(r,t.id,{method:t.method,params:t.params},n)},getTask:async r=>{const i=await a.getTask(r,n);if(!i)throw new lt(wt.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(r,i,s)=>{await a.storeTaskResult(r,i,s,n);const c=await a.getTask(r,n);if(c){const u=cv.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gl(c.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>a.getTaskResult(r,n),updateTaskStatus:async(r,i,s)=>{const c=await a.getTask(r,n);if(!c)throw new lt(wt.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(gl(c.status))throw new lt(wt.InvalidParams,`Cannot update task "${r}" from terminal status "${c.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await a.updateTaskStatus(r,i,s,n);const u=await a.getTask(r,n);if(u){const d=cv.parse({method:"notifications/tasks/status",params:u});await this.notification(d),gl(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>a.listTasks(r,n)}}}function IM(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Nae(e,t){const n={...e};for(const a in t){const r=a,i=t[r];if(i===void 0)continue;const s=n[r];IM(s)&&IM(i)?n[r]={...s,...i}:n[r]=i}return n}var hg={exports:{}},PS={},yo={},bl={},US={},zS={},FS={},OM;function dv(){return OM||(OM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(_){if(super(),!e.IDENTIFIER.test(_))throw new Error("CodeGen: name must be a valid identifier");this.str=_}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class a extends t{constructor(_){super(),this._items=typeof _=="string"?[_]:_}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const _=this._items[0];return _===""||_==='""'}get str(){var _;return(_=this._str)!==null&&_!==void 0?_:this._str=this._items.reduce((k,C)=>`${k}${C}`,"")}get names(){var _;return(_=this._names)!==null&&_!==void 0?_:this._names=this._items.reduce((k,C)=>(C instanceof n&&(k[C.str]=(k[C.str]||0)+1),k),{})}}e._Code=a,e.nil=new a("");function r(E,..._){const k=[E[0]];let C=0;for(;C<_.length;)c(k,_[C]),k.push(E[++C]);return new a(k)}e._=r;const i=new a("+");function s(E,..._){const k=[v(E[0])];let C=0;for(;C<_.length;)k.push(i),c(k,_[C]),k.push(i,v(E[++C]));return u(k),new a(k)}e.str=s;function c(E,_){_ instanceof a?E.push(..._._items):_ instanceof n?E.push(_):E.push(h(_))}e.addCodeArg=c;function u(E){let _=1;for(;_<E.length-1;){if(E[_]===i){const k=d(E[_-1],E[_+1]);if(k!==void 0){E.splice(_-1,3,k);continue}E[_++]="+"}_++}}function d(E,_){if(_==='""')return E;if(E==='""')return _;if(typeof E=="string")return _ instanceof n||E[E.length-1]!=='"'?void 0:typeof _!="string"?`${E.slice(0,-1)}${_}"`:_[0]==='"'?E.slice(0,-1)+_.slice(1):void 0;if(typeof _=="string"&&_[0]==='"'&&!(E instanceof n))return`"${E}${_.slice(1)}`}function m(E,_){return _.emptyStr()?E:E.emptyStr()?_:s`${E}${_}`}e.strConcat=m;function h(E){return typeof E=="number"||typeof E=="boolean"||E===null?E:v(Array.isArray(E)?E.join(","):E)}function g(E){return new a(v(E))}e.stringify=g;function v(E){return JSON.stringify(E).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=v;function x(E){return typeof E=="string"&&e.IDENTIFIER.test(E)?new a(`.${E}`):r`[${E}]`}e.getProperty=x;function S(E){if(typeof E=="string"&&e.IDENTIFIER.test(E))return new a(`${E}`);throw new Error(`CodeGen: invalid export name: ${E}, use explicit $id name mapping`)}e.getEsmExportName=S;function y(E){return new a(E.toString())}e.regexpCode=y})(FS)),FS}var BS={},DM;function jM(){return DM||(DM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=dv();class n extends Error{constructor(d){super(`CodeGen: "code" for ${d} not defined`),this.value=d.value}}var a;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(a||(e.UsedValueState=a={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class r{constructor({prefixes:d,parent:m}={}){this._names={},this._prefixes=d,this._parent=m}toName(d){return d instanceof t.Name?d:this.name(d)}name(d){return new t.Name(this._newName(d))}_newName(d){const m=this._names[d]||this._nameGroup(d);return`${d}${m.index++}`}_nameGroup(d){var m,h;if(!((h=(m=this._parent)===null||m===void 0?void 0:m._prefixes)===null||h===void 0)&&h.has(d)||this._prefixes&&!this._prefixes.has(d))throw new Error(`CodeGen: prefix "${d}" is not allowed in this scope`);return this._names[d]={prefix:d,index:0}}}e.Scope=r;class i extends t.Name{constructor(d,m){super(m),this.prefix=d}setValue(d,{property:m,itemIndex:h}){this.value=d,this.scopePath=(0,t._)`.${new t.Name(m)}[${h}]`}}e.ValueScopeName=i;const s=(0,t._)`\n`;class c extends r{constructor(d){super(d),this._values={},this._scope=d.scope,this.opts={...d,_n:d.lines?s:t.nil}}get(){return this._scope}name(d){return new i(d,this._newName(d))}value(d,m){var h;if(m.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(d),{prefix:v}=g,x=(h=m.key)!==null&&h!==void 0?h:m.ref;let S=this._values[v];if(S){const _=S.get(x);if(_)return _}else S=this._values[v]=new Map;S.set(x,g);const y=this._scope[v]||(this._scope[v]=[]),E=y.length;return y[E]=m.ref,g.setValue(m,{property:v,itemIndex:E}),g}getValue(d,m){const h=this._values[d];if(h)return h.get(m)}scopeRefs(d,m=this._values){return this._reduceValues(m,h=>{if(h.scopePath===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return(0,t._)`${d}${h.scopePath}`})}scopeCode(d=this._values,m,h){return this._reduceValues(d,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},m,h)}_reduceValues(d,m,h={},g){let v=t.nil;for(const x in d){const S=d[x];if(!S)continue;const y=h[x]=h[x]||new Map;S.forEach(E=>{if(y.has(E))return;y.set(E,a.Started);let _=m(E);if(_){const k=this.opts.es5?e.varKinds.var:e.varKinds.const;v=(0,t._)`${v}${k} ${E} = ${_};${this.opts._n}`}else if(_=g?.(E))v=(0,t._)`${v}${_}${this.opts._n}`;else throw new n(E);y.set(E,a.Completed)})}return v}}e.ValueScope=c})(BS)),BS}var LM;function $t(){return LM||(LM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=dv(),n=jM();var a=dv();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return a._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return a.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return a.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return a.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return a.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return a.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return a.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return a.Name}});var r=jM();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return r.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return r.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return r.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return r.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(L,$){return this}}class s extends i{constructor(L,$,F){super(),this.varKind=L,this.name=$,this.rhs=F}render({es5:L,_n:$}){const F=L?n.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${F} ${this.name}${W};`+$}optimizeNames(L,$){if(L[this.name.str])return this.rhs&&(this.rhs=te(this.rhs,L,$)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends i{constructor(L,$,F){super(),this.lhs=L,this.rhs=$,this.sideEffects=F}render({_n:L}){return`${this.lhs} = ${this.rhs};`+L}optimizeNames(L,$){if(!(this.lhs instanceof t.Name&&!L[this.lhs.str]&&!this.sideEffects))return this.rhs=te(this.rhs,L,$),this}get names(){const L=this.lhs instanceof t.Name?{}:{...this.lhs.names};return ee(L,this.rhs)}}class u extends c{constructor(L,$,F,W){super(L,F,W),this.op=$}render({_n:L}){return`${this.lhs} ${this.op}= ${this.rhs};`+L}}class d extends i{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`${this.label}:`+L}}class m extends i{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`break${this.label?` ${this.label}`:""};`+L}}class h extends i{constructor(L){super(),this.error=L}render({_n:L}){return`throw ${this.error};`+L}get names(){return this.error.names}}class g extends i{constructor(L){super(),this.code=L}render({_n:L}){return`${this.code};`+L}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(L,$){return this.code=te(this.code,L,$),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class v extends i{constructor(L=[]){super(),this.nodes=L}render(L){return this.nodes.reduce(($,F)=>$+F.render(L),"")}optimizeNodes(){const{nodes:L}=this;let $=L.length;for(;$--;){const F=L[$].optimizeNodes();Array.isArray(F)?L.splice($,1,...F):F?L[$]=F:L.splice($,1)}return L.length>0?this:void 0}optimizeNames(L,$){const{nodes:F}=this;let W=F.length;for(;W--;){const X=F[W];X.optimizeNames(L,$)||(ae(L,X.names),F.splice(W,1))}return F.length>0?this:void 0}get names(){return this.nodes.reduce((L,$)=>K(L,$.names),{})}}class x extends v{render(L){return"{"+L._n+super.render(L)+"}"+L._n}}class S extends v{}class y extends x{}y.kind="else";class E extends x{constructor(L,$){super($),this.condition=L}render(L){let $=`if(${this.condition})`+super.render(L);return this.else&&($+="else "+this.else.render(L)),$}optimizeNodes(){super.optimizeNodes();const L=this.condition;if(L===!0)return this.nodes;let $=this.else;if($){const F=$.optimizeNodes();$=this.else=Array.isArray(F)?new y(F):F}if($)return L===!1?$ instanceof E?$:$.nodes:this.nodes.length?this:new E(H(L),$ instanceof E?[$]:$.nodes);if(!(L===!1||!this.nodes.length))return this}optimizeNames(L,$){var F;if(this.else=(F=this.else)===null||F===void 0?void 0:F.optimizeNames(L,$),!!(super.optimizeNames(L,$)||this.else))return this.condition=te(this.condition,L,$),this}get names(){const L=super.names;return ee(L,this.condition),this.else&&K(L,this.else.names),L}}E.kind="if";class _ extends x{}_.kind="for";class k extends _{constructor(L){super(),this.iteration=L}render(L){return`for(${this.iteration})`+super.render(L)}optimizeNames(L,$){if(super.optimizeNames(L,$))return this.iteration=te(this.iteration,L,$),this}get names(){return K(super.names,this.iteration.names)}}class C extends _{constructor(L,$,F,W){super(),this.varKind=L,this.name=$,this.from=F,this.to=W}render(L){const $=L.es5?n.varKinds.var:this.varKind,{name:F,from:W,to:X}=this;return`for(${$} ${F}=${W}; ${F}<${X}; ${F}++)`+super.render(L)}get names(){const L=ee(super.names,this.from);return ee(L,this.to)}}class R extends _{constructor(L,$,F,W){super(),this.loop=L,this.varKind=$,this.name=F,this.iterable=W}render(L){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(L)}optimizeNames(L,$){if(super.optimizeNames(L,$))return this.iterable=te(this.iterable,L,$),this}get names(){return K(super.names,this.iterable.names)}}class I extends x{constructor(L,$,F){super(),this.name=L,this.args=$,this.async=F}render(L){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(L)}}I.kind="func";class A extends v{render(L){return"return "+super.render(L)}}A.kind="return";class O extends x{render(L){let $="try"+super.render(L);return this.catch&&($+=this.catch.render(L)),this.finally&&($+=this.finally.render(L)),$}optimizeNodes(){var L,$;return super.optimizeNodes(),(L=this.catch)===null||L===void 0||L.optimizeNodes(),($=this.finally)===null||$===void 0||$.optimizeNodes(),this}optimizeNames(L,$){var F,W;return super.optimizeNames(L,$),(F=this.catch)===null||F===void 0||F.optimizeNames(L,$),(W=this.finally)===null||W===void 0||W.optimizeNames(L,$),this}get names(){const L=super.names;return this.catch&&K(L,this.catch.names),this.finally&&K(L,this.finally.names),L}}class M extends x{constructor(L){super(),this.error=L}render(L){return`catch(${this.error})`+super.render(L)}}M.kind="catch";class P extends x{render(L){return"finally"+super.render(L)}}P.kind="finally";class B{constructor(L,$={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...$,_n:$.lines?`
25
+ `:""},this._extScope=L,this._scope=new n.Scope({parent:L}),this._nodes=[new S]}toString(){return this._root.render(this.opts)}name(L){return this._scope.name(L)}scopeName(L){return this._extScope.name(L)}scopeValue(L,$){const F=this._extScope.value(L,$);return(this._values[F.prefix]||(this._values[F.prefix]=new Set)).add(F),F}getScopeValue(L,$){return this._extScope.getValue(L,$)}scopeRefs(L){return this._extScope.scopeRefs(L,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(L,$,F,W){const X=this._scope.toName($);return F!==void 0&&W&&(this._constants[X.str]=F),this._leafNode(new s(L,X,F)),X}const(L,$,F){return this._def(n.varKinds.const,L,$,F)}let(L,$,F){return this._def(n.varKinds.let,L,$,F)}var(L,$,F){return this._def(n.varKinds.var,L,$,F)}assign(L,$,F){return this._leafNode(new c(L,$,F))}add(L,$){return this._leafNode(new u(L,e.operators.ADD,$))}code(L){return typeof L=="function"?L():L!==t.nil&&this._leafNode(new g(L)),this}object(...L){const $=["{"];for(const[F,W]of L)$.length>1&&$.push(","),$.push(F),(F!==W||this.opts.es5)&&($.push(":"),(0,t.addCodeArg)($,W));return $.push("}"),new t._Code($)}if(L,$,F){if(this._blockNode(new E(L)),$&&F)this.code($).else().code(F).endIf();else if($)this.code($).endIf();else if(F)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(L){return this._elseNode(new E(L))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(E,y)}_for(L,$){return this._blockNode(L),$&&this.code($).endFor(),this}for(L,$){return this._for(new k(L),$)}forRange(L,$,F,W,X=this.opts.es5?n.varKinds.var:n.varKinds.let){const ie=this._scope.toName(L);return this._for(new C(X,ie,$,F),()=>W(ie))}forOf(L,$,F,W=n.varKinds.const){const X=this._scope.toName(L);if(this.opts.es5){const ie=$ instanceof t.Name?$:this.var("_arr",$);return this.forRange("_i",0,(0,t._)`${ie}.length`,ce=>{this.var(X,(0,t._)`${ie}[${ce}]`),F(X)})}return this._for(new R("of",W,X,$),()=>F(X))}forIn(L,$,F,W=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(L,(0,t._)`Object.keys(${$})`,F);const X=this._scope.toName(L);return this._for(new R("in",W,X,$),()=>F(X))}endFor(){return this._endBlockNode(_)}label(L){return this._leafNode(new d(L))}break(L){return this._leafNode(new m(L))}return(L){const $=new A;if(this._blockNode($),this.code(L),$.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(L,$,F){if(!$&&!F)throw new Error('CodeGen: "try" without "catch" and "finally"');const W=new O;if(this._blockNode(W),this.code(L),$){const X=this.name("e");this._currNode=W.catch=new M(X),$(X)}return F&&(this._currNode=W.finally=new P,this.code(F)),this._endBlockNode(M,P)}throw(L){return this._leafNode(new h(L))}block(L,$){return this._blockStarts.push(this._nodes.length),L&&this.code(L).endBlock($),this}endBlock(L){const $=this._blockStarts.pop();if($===void 0)throw new Error("CodeGen: not in self-balancing block");const F=this._nodes.length-$;if(F<0||L!==void 0&&F!==L)throw new Error(`CodeGen: wrong number of nodes: ${F} vs ${L} expected`);return this._nodes.length=$,this}func(L,$=t.nil,F,W){return this._blockNode(new I(L,$,F)),W&&this.code(W).endFunc(),this}endFunc(){return this._endBlockNode(I)}optimize(L=1){for(;L-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(L){return this._currNode.nodes.push(L),this}_blockNode(L){this._currNode.nodes.push(L),this._nodes.push(L)}_endBlockNode(L,$){const F=this._currNode;if(F instanceof L||$&&F instanceof $)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${$?`${L.kind}/${$.kind}`:L.kind}"`)}_elseNode(L){const $=this._currNode;if(!($ instanceof E))throw new Error('CodeGen: "else" without "if"');return this._currNode=$.else=L,this}get _root(){return this._nodes[0]}get _currNode(){const L=this._nodes;return L[L.length-1]}set _currNode(L){const $=this._nodes;$[$.length-1]=L}}e.CodeGen=B;function K(z,L){for(const $ in L)z[$]=(z[$]||0)+(L[$]||0);return z}function ee(z,L){return L instanceof t._CodeOrName?K(z,L.names):z}function te(z,L,$){if(z instanceof t.Name)return F(z);if(!W(z))return z;return new t._Code(z._items.reduce((X,ie)=>(ie instanceof t.Name&&(ie=F(ie)),ie instanceof t._Code?X.push(...ie._items):X.push(ie),X),[]));function F(X){const ie=$[X.str];return ie===void 0||L[X.str]!==1?X:(delete L[X.str],ie)}function W(X){return X instanceof t._Code&&X._items.some(ie=>ie instanceof t.Name&&L[ie.str]===1&&$[ie.str]!==void 0)}}function ae(z,L){for(const $ in L)z[$]=(z[$]||0)-(L[$]||0)}function H(z){return typeof z=="boolean"||typeof z=="number"||z===null?!z:(0,t._)`!${V(z)}`}e.not=H;const Z=j(e.operators.AND);function G(...z){return z.reduce(Z)}e.and=G;const re=j(e.operators.OR);function ne(...z){return z.reduce(re)}e.or=ne;function j(z){return(L,$)=>L===t.nil?$:$===t.nil?L:(0,t._)`${V(L)} ${z} ${V($)}`}function V(z){return z instanceof t.Name?z:(0,t._)`(${z})`}})(zS)),zS}var jt={},$M;function sn(){if($M)return jt;$M=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.checkStrictMode=jt.getErrorPath=jt.Type=jt.useFunc=jt.setEvaluated=jt.evaluatedPropsToName=jt.mergeEvaluated=jt.eachItem=jt.unescapeJsonPointer=jt.escapeJsonPointer=jt.escapeFragment=jt.unescapeFragment=jt.schemaRefOrVal=jt.schemaHasRulesButRef=jt.schemaHasRules=jt.checkUnknownRules=jt.alwaysValidSchema=jt.toHash=void 0;const e=$t(),t=dv();function n(R){const I={};for(const A of R)I[A]=!0;return I}jt.toHash=n;function a(R,I){return typeof I=="boolean"?I:Object.keys(I).length===0?!0:(r(R,I),!i(I,R.self.RULES.all))}jt.alwaysValidSchema=a;function r(R,I=R.schema){const{opts:A,self:O}=R;if(!A.strictSchema||typeof I=="boolean")return;const M=O.RULES.keywords;for(const P in I)M[P]||C(R,`unknown keyword: "${P}"`)}jt.checkUnknownRules=r;function i(R,I){if(typeof R=="boolean")return!R;for(const A in R)if(I[A])return!0;return!1}jt.schemaHasRules=i;function s(R,I){if(typeof R=="boolean")return!R;for(const A in R)if(A!=="$ref"&&I.all[A])return!0;return!1}jt.schemaHasRulesButRef=s;function c({topSchemaRef:R,schemaPath:I},A,O,M){if(!M){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,e._)`${A}`}return(0,e._)`${R}${I}${(0,e.getProperty)(O)}`}jt.schemaRefOrVal=c;function u(R){return h(decodeURIComponent(R))}jt.unescapeFragment=u;function d(R){return encodeURIComponent(m(R))}jt.escapeFragment=d;function m(R){return typeof R=="number"?`${R}`:R.replace(/~/g,"~0").replace(/\//g,"~1")}jt.escapeJsonPointer=m;function h(R){return R.replace(/~1/g,"/").replace(/~0/g,"~")}jt.unescapeJsonPointer=h;function g(R,I){if(Array.isArray(R))for(const A of R)I(A);else I(R)}jt.eachItem=g;function v({mergeNames:R,mergeToName:I,mergeValues:A,resultToName:O}){return(M,P,B,K)=>{const ee=B===void 0?P:B instanceof e.Name?(P instanceof e.Name?R(M,P,B):I(M,P,B),B):P instanceof e.Name?(I(M,B,P),P):A(P,B);return K===e.Name&&!(ee instanceof e.Name)?O(M,ee):ee}}jt.mergeEvaluated={props:v({mergeNames:(R,I,A)=>R.if((0,e._)`${A} !== true && ${I} !== undefined`,()=>{R.if((0,e._)`${I} === true`,()=>R.assign(A,!0),()=>R.assign(A,(0,e._)`${A} || {}`).code((0,e._)`Object.assign(${A}, ${I})`))}),mergeToName:(R,I,A)=>R.if((0,e._)`${A} !== true`,()=>{I===!0?R.assign(A,!0):(R.assign(A,(0,e._)`${A} || {}`),S(R,A,I))}),mergeValues:(R,I)=>R===!0?!0:{...R,...I},resultToName:x}),items:v({mergeNames:(R,I,A)=>R.if((0,e._)`${A} !== true && ${I} !== undefined`,()=>R.assign(A,(0,e._)`${I} === true ? true : ${A} > ${I} ? ${A} : ${I}`)),mergeToName:(R,I,A)=>R.if((0,e._)`${A} !== true`,()=>R.assign(A,I===!0?!0:(0,e._)`${A} > ${I} ? ${A} : ${I}`)),mergeValues:(R,I)=>R===!0?!0:Math.max(R,I),resultToName:(R,I)=>R.var("items",I)})};function x(R,I){if(I===!0)return R.var("props",!0);const A=R.var("props",(0,e._)`{}`);return I!==void 0&&S(R,A,I),A}jt.evaluatedPropsToName=x;function S(R,I,A){Object.keys(A).forEach(O=>R.assign((0,e._)`${I}${(0,e.getProperty)(O)}`,!0))}jt.setEvaluated=S;const y={};function E(R,I){return R.scopeValue("func",{ref:I,code:y[I.code]||(y[I.code]=new t._Code(I.code))})}jt.useFunc=E;var _;(function(R){R[R.Num=0]="Num",R[R.Str=1]="Str"})(_||(jt.Type=_={}));function k(R,I,A){if(R instanceof e.Name){const O=I===_.Num;return A?O?(0,e._)`"[" + ${R} + "]"`:(0,e._)`"['" + ${R} + "']"`:O?(0,e._)`"/" + ${R}`:(0,e._)`"/" + ${R}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,e.getProperty)(R).toString():"/"+m(R)}jt.getErrorPath=k;function C(R,I,A=R.opts.strictSchema){if(A){if(I=`strict mode: ${I}`,A===!0)throw new Error(I);R.self.logger.warn(I)}}return jt.checkStrictMode=C,jt}var gg={},MM;function Ks(){if(MM)return gg;MM=1,Object.defineProperty(gg,"__esModule",{value:!0});const e=$t(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return gg.default=t,gg}var PM;function Ny(){return PM||(PM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=$t(),n=sn(),a=Ks();e.keywordError={message:({keyword:y})=>(0,t.str)`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:E})=>E?(0,t.str)`"${y}" keyword must be ${E} ($data)`:(0,t.str)`"${y}" keyword is invalid ($data)`};function r(y,E=e.keywordError,_,k){const{it:C}=y,{gen:R,compositeRule:I,allErrors:A}=C,O=h(y,E,_);k??(I||A)?u(R,O):d(C,(0,t._)`[${O}]`)}e.reportError=r;function i(y,E=e.keywordError,_){const{it:k}=y,{gen:C,compositeRule:R,allErrors:I}=k,A=h(y,E,_);u(C,A),R||I||d(k,a.default.vErrors)}e.reportExtraError=i;function s(y,E){y.assign(a.default.errors,E),y.if((0,t._)`${a.default.vErrors} !== null`,()=>y.if(E,()=>y.assign((0,t._)`${a.default.vErrors}.length`,E),()=>y.assign(a.default.vErrors,null)))}e.resetErrorsCount=s;function c({gen:y,keyword:E,schemaValue:_,data:k,errsCount:C,it:R}){if(C===void 0)throw new Error("ajv implementation error");const I=y.name("err");y.forRange("i",C,a.default.errors,A=>{y.const(I,(0,t._)`${a.default.vErrors}[${A}]`),y.if((0,t._)`${I}.instancePath === undefined`,()=>y.assign((0,t._)`${I}.instancePath`,(0,t.strConcat)(a.default.instancePath,R.errorPath))),y.assign((0,t._)`${I}.schemaPath`,(0,t.str)`${R.errSchemaPath}/${E}`),R.opts.verbose&&(y.assign((0,t._)`${I}.schema`,_),y.assign((0,t._)`${I}.data`,k))})}e.extendErrors=c;function u(y,E){const _=y.const("err",E);y.if((0,t._)`${a.default.vErrors} === null`,()=>y.assign(a.default.vErrors,(0,t._)`[${_}]`),(0,t._)`${a.default.vErrors}.push(${_})`),y.code((0,t._)`${a.default.errors}++`)}function d(y,E){const{gen:_,validateName:k,schemaEnv:C}=y;C.$async?_.throw((0,t._)`new ${y.ValidationError}(${E})`):(_.assign((0,t._)`${k}.errors`,E),_.return(!1))}const m={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function h(y,E,_){const{createErrors:k}=y.it;return k===!1?(0,t._)`{}`:g(y,E,_)}function g(y,E,_={}){const{gen:k,it:C}=y,R=[v(C,_),x(y,_)];return S(y,E,R),k.object(...R)}function v({errorPath:y},{instancePath:E}){const _=E?(0,t.str)`${y}${(0,n.getErrorPath)(E,n.Type.Str)}`:y;return[a.default.instancePath,(0,t.strConcat)(a.default.instancePath,_)]}function x({keyword:y,it:{errSchemaPath:E}},{schemaPath:_,parentSchema:k}){let C=k?E:(0,t.str)`${E}/${y}`;return _&&(C=(0,t.str)`${C}${(0,n.getErrorPath)(_,n.Type.Str)}`),[m.schemaPath,C]}function S(y,{params:E,message:_},k){const{keyword:C,data:R,schemaValue:I,it:A}=y,{opts:O,propertyName:M,topSchemaRef:P,schemaPath:B}=A;k.push([m.keyword,C],[m.params,typeof E=="function"?E(y):E||(0,t._)`{}`]),O.messages&&k.push([m.message,typeof _=="function"?_(y):_]),O.verbose&&k.push([m.schema,I],[m.parentSchema,(0,t._)`${P}${B}`],[a.default.data,R]),M&&k.push([m.propertyName,M])}})(US)),US}var UM;function Cae(){if(UM)return bl;UM=1,Object.defineProperty(bl,"__esModule",{value:!0}),bl.boolOrEmptySchema=bl.topBoolOrEmptySchema=void 0;const e=Ny(),t=$t(),n=Ks(),a={message:"boolean schema is false"};function r(c){const{gen:u,schema:d,validateName:m}=c;d===!1?s(c,!1):typeof d=="object"&&d.$async===!0?u.return(n.default.data):(u.assign((0,t._)`${m}.errors`,null),u.return(!0))}bl.topBoolOrEmptySchema=r;function i(c,u){const{gen:d,schema:m}=c;m===!1?(d.var(u,!1),s(c)):d.var(u,!0)}bl.boolOrEmptySchema=i;function s(c,u){const{gen:d,data:m}=c,h={gen:d,keyword:"false schema",data:m,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,e.reportError)(h,a,void 0,u)}return bl}var Tr={},vl={},zM;function IV(){if(zM)return vl;zM=1,Object.defineProperty(vl,"__esModule",{value:!0}),vl.getRules=vl.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function n(r){return typeof r=="string"&&t.has(r)}vl.isJSONType=n;function a(){const r={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...r,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},r.number,r.string,r.array,r.object],post:{rules:[]},all:{},keywords:{}}}return vl.getRules=a,vl}var wo={},FM;function OV(){if(FM)return wo;FM=1,Object.defineProperty(wo,"__esModule",{value:!0}),wo.shouldUseRule=wo.shouldUseGroup=wo.schemaHasRulesForType=void 0;function e({schema:a,self:r},i){const s=r.RULES.types[i];return s&&s!==!0&&t(a,s)}wo.schemaHasRulesForType=e;function t(a,r){return r.rules.some(i=>n(a,i))}wo.shouldUseGroup=t;function n(a,r){var i;return a[r.keyword]!==void 0||((i=r.definition.implements)===null||i===void 0?void 0:i.some(s=>a[s]!==void 0))}return wo.shouldUseRule=n,wo}var BM;function fv(){if(BM)return Tr;BM=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.reportTypeError=Tr.checkDataTypes=Tr.checkDataType=Tr.coerceAndCheckDataType=Tr.getJSONTypes=Tr.getSchemaTypes=Tr.DataType=void 0;const e=IV(),t=OV(),n=Ny(),a=$t(),r=sn();var i;(function(_){_[_.Correct=0]="Correct",_[_.Wrong=1]="Wrong"})(i||(Tr.DataType=i={}));function s(_){const k=c(_.type);if(k.includes("null")){if(_.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!k.length&&_.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');_.nullable===!0&&k.push("null")}return k}Tr.getSchemaTypes=s;function c(_){const k=Array.isArray(_)?_:_?[_]:[];if(k.every(e.isJSONType))return k;throw new Error("type must be JSONType or JSONType[]: "+k.join(","))}Tr.getJSONTypes=c;function u(_,k){const{gen:C,data:R,opts:I}=_,A=m(k,I.coerceTypes),O=k.length>0&&!(A.length===0&&k.length===1&&(0,t.schemaHasRulesForType)(_,k[0]));if(O){const M=x(k,R,I.strictNumbers,i.Wrong);C.if(M,()=>{A.length?h(_,k,A):y(_)})}return O}Tr.coerceAndCheckDataType=u;const d=new Set(["string","number","integer","boolean","null"]);function m(_,k){return k?_.filter(C=>d.has(C)||k==="array"&&C==="array"):[]}function h(_,k,C){const{gen:R,data:I,opts:A}=_,O=R.let("dataType",(0,a._)`typeof ${I}`),M=R.let("coerced",(0,a._)`undefined`);A.coerceTypes==="array"&&R.if((0,a._)`${O} == 'object' && Array.isArray(${I}) && ${I}.length == 1`,()=>R.assign(I,(0,a._)`${I}[0]`).assign(O,(0,a._)`typeof ${I}`).if(x(k,I,A.strictNumbers),()=>R.assign(M,I))),R.if((0,a._)`${M} !== undefined`);for(const B of C)(d.has(B)||B==="array"&&A.coerceTypes==="array")&&P(B);R.else(),y(_),R.endIf(),R.if((0,a._)`${M} !== undefined`,()=>{R.assign(I,M),g(_,M)});function P(B){switch(B){case"string":R.elseIf((0,a._)`${O} == "number" || ${O} == "boolean"`).assign(M,(0,a._)`"" + ${I}`).elseIf((0,a._)`${I} === null`).assign(M,(0,a._)`""`);return;case"number":R.elseIf((0,a._)`${O} == "boolean" || ${I} === null
26
26
  || (${O} == "string" && ${I} && ${I} == +${I})`).assign(M,(0,a._)`+${I}`);return;case"integer":R.elseIf((0,a._)`${O} === "boolean" || ${I} === null
27
27
  || (${O} === "string" && ${I} && ${I} == +${I} && !(${I} % 1))`).assign(M,(0,a._)`+${I}`);return;case"boolean":R.elseIf((0,a._)`${I} === "false" || ${I} === 0 || ${I} === null`).assign(M,!1).elseIf((0,a._)`${I} === "true" || ${I} === 1`).assign(M,!0);return;case"null":R.elseIf((0,a._)`${I} === "" || ${I} === 0 || ${I} === false`),R.assign(M,null);return;case"array":R.elseIf((0,a._)`${O} === "string" || ${O} === "number"
28
- || ${O} === "boolean" || ${I} === null`).assign(M,(0,a._)`[${I}]`)}}}function g({gen:_,parentData:k,parentDataProperty:C},R){_.if((0,a._)`${k} !== undefined`,()=>_.assign((0,a._)`${k}[${C}]`,R))}function v(_,k,C,R=i.Correct){const I=R===i.Correct?a.operators.EQ:a.operators.NEQ;let A;switch(_){case"null":return(0,a._)`${k} ${I} null`;case"array":A=(0,a._)`Array.isArray(${k})`;break;case"object":A=(0,a._)`${k} && typeof ${k} == "object" && !Array.isArray(${k})`;break;case"integer":A=O((0,a._)`!(${k} % 1) && !isNaN(${k})`);break;case"number":A=O();break;default:return(0,a._)`typeof ${k} ${I} ${_}`}return R===i.Correct?A:(0,a.not)(A);function O(M=a.nil){return(0,a.and)((0,a._)`typeof ${k} == "number"`,M,C?(0,a._)`isFinite(${k})`:a.nil)}}Tr.checkDataType=v;function x(_,k,C,R){if(_.length===1)return v(_[0],k,C,R);let I;const A=(0,r.toHash)(_);if(A.array&&A.object){const O=(0,a._)`typeof ${k} != "object"`;I=A.null?O:(0,a._)`!${k} || ${O}`,delete A.null,delete A.array,delete A.object}else I=a.nil;A.number&&delete A.integer;for(const O in A)I=(0,a.and)(I,v(O,k,C,R));return I}Tr.checkDataTypes=x;const S={message:({schema:_})=>`must be ${_}`,params:({schema:_,schemaValue:k})=>typeof _=="string"?(0,a._)`{type: ${_}}`:(0,a._)`{type: ${k}}`};function y(_){const k=E(_);(0,n.reportError)(k,S)}Tr.reportTypeError=y;function E(_){const{gen:k,data:C,schema:R}=_,I=(0,r.schemaRefOrVal)(_,R,"type");return{gen:k,keyword:"type",data:C,schema:R.type,schemaCode:I,schemaValue:I,parentSchema:R,params:{},it:_}}return Tr}var Ff={},HM;function Aae(){if(HM)return Ff;HM=1,Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.assignDefaults=void 0;const e=$t(),t=sn();function n(r,i){const{properties:s,items:c}=r.schema;if(i==="object"&&s)for(const u in s)a(r,u,s[u].default);else i==="array"&&Array.isArray(c)&&c.forEach((u,d)=>a(r,d,u.default))}Ff.assignDefaults=n;function a(r,i,s){const{gen:c,compositeRule:u,data:d,opts:m}=r;if(s===void 0)return;const h=(0,e._)`${d}${(0,e.getProperty)(i)}`;if(u){(0,t.checkStrictMode)(r,`default is ignored for: ${h}`);return}let g=(0,e._)`${h} === undefined`;m.useDefaults==="empty"&&(g=(0,e._)`${g} || ${h} === null || ${h} === ""`),c.if(g,(0,e._)`${h} = ${(0,e.stringify)(s)}`)}return Ff}var li={},vn={},VM;function Ri(){if(VM)return vn;VM=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.validateUnion=vn.validateArray=vn.usePattern=vn.callValidateCode=vn.schemaProperties=vn.allSchemaProperties=vn.noPropertyInData=vn.propertyInData=vn.isOwnProperty=vn.hasPropFunc=vn.reportMissingProp=vn.checkMissingProp=vn.checkReportMissingProp=void 0;const e=$t(),t=sn(),n=Ks(),a=sn();function r(_,k){const{gen:C,data:R,it:I}=_;C.if(m(C,R,k,I.opts.ownProperties),()=>{_.setParams({missingProperty:(0,e._)`${k}`},!0),_.error()})}vn.checkReportMissingProp=r;function i({gen:_,data:k,it:{opts:C}},R,I){return(0,e.or)(...R.map(A=>(0,e.and)(m(_,k,A,C.ownProperties),(0,e._)`${I} = ${A}`)))}vn.checkMissingProp=i;function s(_,k){_.setParams({missingProperty:k},!0),_.error()}vn.reportMissingProp=s;function c(_){return _.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}vn.hasPropFunc=c;function u(_,k,C){return(0,e._)`${c(_)}.call(${k}, ${C})`}vn.isOwnProperty=u;function d(_,k,C,R){const I=(0,e._)`${k}${(0,e.getProperty)(C)} !== undefined`;return R?(0,e._)`${I} && ${u(_,k,C)}`:I}vn.propertyInData=d;function m(_,k,C,R){const I=(0,e._)`${k}${(0,e.getProperty)(C)} === undefined`;return R?(0,e.or)(I,(0,e.not)(u(_,k,C))):I}vn.noPropertyInData=m;function h(_){return _?Object.keys(_).filter(k=>k!=="__proto__"):[]}vn.allSchemaProperties=h;function g(_,k){return h(k).filter(C=>!(0,t.alwaysValidSchema)(_,k[C]))}vn.schemaProperties=g;function v({schemaCode:_,data:k,it:{gen:C,topSchemaRef:R,schemaPath:I,errorPath:A},it:O},M,P,B){const K=B?(0,e._)`${_}, ${k}, ${R}${I}`:k,ee=[[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,A)],[n.default.parentData,O.parentData],[n.default.parentDataProperty,O.parentDataProperty],[n.default.rootData,n.default.rootData]];O.opts.dynamicRef&&ee.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const te=(0,e._)`${K}, ${C.object(...ee)}`;return P!==e.nil?(0,e._)`${M}.call(${P}, ${te})`:(0,e._)`${M}(${te})`}vn.callValidateCode=v;const x=(0,e._)`new RegExp`;function S({gen:_,it:{opts:k}},C){const R=k.unicodeRegExp?"u":"",{regExp:I}=k.code,A=I(C,R);return _.scopeValue("pattern",{key:A.toString(),ref:A,code:(0,e._)`${I.code==="new RegExp"?x:(0,a.useFunc)(_,I)}(${C}, ${R})`})}vn.usePattern=S;function y(_){const{gen:k,data:C,keyword:R,it:I}=_,A=k.name("valid");if(I.allErrors){const M=k.let("valid",!0);return O(()=>k.assign(M,!1)),M}return k.var(A,!0),O(()=>k.break()),A;function O(M){const P=k.const("len",(0,e._)`${C}.length`);k.forRange("i",0,P,B=>{_.subschema({keyword:R,dataProp:B,dataPropType:t.Type.Num},A),k.if((0,e.not)(A),M)})}}vn.validateArray=y;function E(_){const{gen:k,schema:C,keyword:R,it:I}=_;if(!Array.isArray(C))throw new Error("ajv implementation error");if(C.some(P=>(0,t.alwaysValidSchema)(I,P))&&!I.opts.unevaluated)return;const O=k.let("valid",!1),M=k.name("_valid");k.block(()=>C.forEach((P,B)=>{const K=_.subschema({keyword:R,schemaProp:B,compositeRule:!0},M);k.assign(O,(0,e._)`${O} || ${M}`),_.mergeValidEvaluated(K,M)||k.if((0,e.not)(O))})),_.result(O,()=>_.reset(),()=>_.error(!0))}return vn.validateUnion=E,vn}var GM;function Iae(){if(GM)return li;GM=1,Object.defineProperty(li,"__esModule",{value:!0}),li.validateKeywordUsage=li.validSchemaType=li.funcKeywordCode=li.macroKeywordCode=void 0;const e=$t(),t=Ks(),n=Ri(),a=Ny();function r(g,v){const{gen:x,keyword:S,schema:y,parentSchema:E,it:_}=g,k=v.macro.call(_.self,y,E,_),C=d(x,S,k);_.opts.validateSchema!==!1&&_.self.validateSchema(k,!0);const R=x.name("valid");g.subschema({schema:k,schemaPath:e.nil,errSchemaPath:`${_.errSchemaPath}/${S}`,topSchemaRef:C,compositeRule:!0},R),g.pass(R,()=>g.error(!0))}li.macroKeywordCode=r;function i(g,v){var x;const{gen:S,keyword:y,schema:E,parentSchema:_,$data:k,it:C}=g;u(C,v);const R=!k&&v.compile?v.compile.call(C.self,E,_,C):v.validate,I=d(S,y,R),A=S.let("valid");g.block$data(A,O),g.ok((x=v.valid)!==null&&x!==void 0?x:A);function O(){if(v.errors===!1)B(),v.modifying&&s(g),K(()=>g.error());else{const ee=v.async?M():P();v.modifying&&s(g),K(()=>c(g,ee))}}function M(){const ee=S.let("ruleErrs",null);return S.try(()=>B((0,e._)`await `),te=>S.assign(A,!1).if((0,e._)`${te} instanceof ${C.ValidationError}`,()=>S.assign(ee,(0,e._)`${te}.errors`),()=>S.throw(te))),ee}function P(){const ee=(0,e._)`${I}.errors`;return S.assign(ee,null),B(e.nil),ee}function B(ee=v.async?(0,e._)`await `:e.nil){const te=C.opts.passContext?t.default.this:t.default.self,ae=!("compile"in v&&!k||v.schema===!1);S.assign(A,(0,e._)`${ee}${(0,n.callValidateCode)(g,I,te,ae)}`,v.modifying)}function K(ee){var te;S.if((0,e.not)((te=v.valid)!==null&&te!==void 0?te:A),ee)}}li.funcKeywordCode=i;function s(g){const{gen:v,data:x,it:S}=g;v.if(S.parentData,()=>v.assign(x,(0,e._)`${S.parentData}[${S.parentDataProperty}]`))}function c(g,v){const{gen:x}=g;x.if((0,e._)`Array.isArray(${v})`,()=>{x.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${v} : ${t.default.vErrors}.concat(${v})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,a.extendErrors)(g)},()=>g.error())}function u({schemaEnv:g},v){if(v.async&&!g.$async)throw new Error("async keyword in sync schema")}function d(g,v,x){if(x===void 0)throw new Error(`keyword "${v}" failed to compile`);return g.scopeValue("keyword",typeof x=="function"?{ref:x}:{ref:x,code:(0,e.stringify)(x)})}function m(g,v,x=!1){return!v.length||v.some(S=>S==="array"?Array.isArray(g):S==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==S||x&&typeof g>"u")}li.validSchemaType=m;function h({schema:g,opts:v,self:x,errSchemaPath:S},y,E){if(Array.isArray(y.keyword)?!y.keyword.includes(E):y.keyword!==E)throw new Error("ajv implementation error");const _=y.dependencies;if(_?.some(k=>!Object.prototype.hasOwnProperty.call(g,k)))throw new Error(`parent schema must have dependencies of ${E}: ${_.join(",")}`);if(y.validateSchema&&!y.validateSchema(g[E])){const C=`keyword "${E}" value is invalid at path "${S}": `+x.errorsText(y.validateSchema.errors);if(v.validateSchema==="log")x.logger.error(C);else throw new Error(C)}}return li.validateKeywordUsage=h,li}var So={},WM;function Oae(){if(WM)return So;WM=1,Object.defineProperty(So,"__esModule",{value:!0}),So.extendSubschemaMode=So.extendSubschemaData=So.getSubschema=void 0;const e=$t(),t=sn();function n(i,{keyword:s,schemaProp:c,schema:u,schemaPath:d,errSchemaPath:m,topSchemaRef:h}){if(s!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(s!==void 0){const g=i.schema[s];return c===void 0?{schema:g,schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(s)}`,errSchemaPath:`${i.errSchemaPath}/${s}`}:{schema:g[c],schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(s)}${(0,e.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${s}/${(0,t.escapeFragment)(c)}`}}if(u!==void 0){if(d===void 0||m===void 0||h===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:d,topSchemaRef:h,errSchemaPath:m}}throw new Error('either "keyword" or "schema" must be passed')}So.getSubschema=n;function a(i,s,{dataProp:c,dataPropType:u,data:d,dataTypes:m,propertyName:h}){if(d!==void 0&&c!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:g}=s;if(c!==void 0){const{errorPath:x,dataPathArr:S,opts:y}=s,E=g.let("data",(0,e._)`${s.data}${(0,e.getProperty)(c)}`,!0);v(E),i.errorPath=(0,e.str)`${x}${(0,t.getErrorPath)(c,u,y.jsPropertySyntax)}`,i.parentDataProperty=(0,e._)`${c}`,i.dataPathArr=[...S,i.parentDataProperty]}if(d!==void 0){const x=d instanceof e.Name?d:g.let("data",d,!0);v(x),h!==void 0&&(i.propertyName=h)}m&&(i.dataTypes=m);function v(x){i.data=x,i.dataLevel=s.dataLevel+1,i.dataTypes=[],s.definedProperties=new Set,i.parentData=s.data,i.dataNames=[...s.dataNames,x]}}So.extendSubschemaData=a;function r(i,{jtdDiscriminator:s,jtdMetadata:c,compositeRule:u,createErrors:d,allErrors:m}){u!==void 0&&(i.compositeRule=u),d!==void 0&&(i.createErrors=d),m!==void 0&&(i.allErrors=m),i.jtdDiscriminator=s,i.jtdMetadata=c}return So.extendSubschemaMode=r,So}var Qr={},HS,KM;function DV(){return KM||(KM=1,HS=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var a,r,i;if(Array.isArray(t)){if(a=t.length,a!=n.length)return!1;for(r=a;r--!==0;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),a=i.length,a!==Object.keys(n).length)return!1;for(r=a;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=a;r--!==0;){var s=i[r];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}),HS}var VS={exports:{}},ZM;function Dae(){if(ZM)return VS.exports;ZM=1;var e=VS.exports=function(a,r,i){typeof r=="function"&&(i=r,r={}),i=r.cb||i;var s=typeof i=="function"?i:i.pre||function(){},c=i.post||function(){};t(r,s,c,a,"",a)};e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.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 t(a,r,i,s,c,u,d,m,h,g){if(s&&typeof s=="object"&&!Array.isArray(s)){r(s,c,u,d,m,h,g);for(var v in s){var x=s[v];if(Array.isArray(x)){if(v in e.arrayKeywords)for(var S=0;S<x.length;S++)t(a,r,i,x[S],c+"/"+v+"/"+S,u,c,v,s,S)}else if(v in e.propsKeywords){if(x&&typeof x=="object")for(var y in x)t(a,r,i,x[y],c+"/"+v+"/"+n(y),u,c,v,s,y)}else(v in e.keywords||a.allKeys&&!(v in e.skipKeywords))&&t(a,r,i,x,c+"/"+v,u,c,v,s)}i(s,c,u,d,m,h,g)}}function n(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}return VS.exports}var YM;function Cy(){if(YM)return Qr;YM=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.getSchemaRefs=Qr.resolveUrl=Qr.normalizeId=Qr._getFullPath=Qr.getFullPath=Qr.inlineRef=void 0;const e=sn(),t=DV(),n=Dae(),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function r(S,y=!0){return typeof S=="boolean"?!0:y===!0?!s(S):y?c(S)<=y:!1}Qr.inlineRef=r;const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(S){for(const y in S){if(i.has(y))return!0;const E=S[y];if(Array.isArray(E)&&E.some(s)||typeof E=="object"&&s(E))return!0}return!1}function c(S){let y=0;for(const E in S){if(E==="$ref")return 1/0;if(y++,!a.has(E)&&(typeof S[E]=="object"&&(0,e.eachItem)(S[E],_=>y+=c(_)),y===1/0))return 1/0}return y}function u(S,y="",E){E!==!1&&(y=h(y));const _=S.parse(y);return d(S,_)}Qr.getFullPath=u;function d(S,y){return S.serialize(y).split("#")[0]+"#"}Qr._getFullPath=d;const m=/#\/?$/;function h(S){return S?S.replace(m,""):""}Qr.normalizeId=h;function g(S,y,E){return E=h(E),S.resolve(y,E)}Qr.resolveUrl=g;const v=/^[a-z_][-a-z0-9._]*$/i;function x(S,y){if(typeof S=="boolean")return{};const{schemaId:E,uriResolver:_}=this.opts,k=h(S[E]||y),C={"":k},R=u(_,k,!1),I={},A=new Set;return n(S,{allKeys:!0},(P,B,K,ee)=>{if(ee===void 0)return;const te=R+B;let ae=C[ee];typeof P[E]=="string"&&(ae=H.call(this,P[E])),Z.call(this,P.$anchor),Z.call(this,P.$dynamicAnchor),C[B]=ae;function H(G){const re=this.opts.uriResolver.resolve;if(G=h(ae?re(ae,G):G),A.has(G))throw M(G);A.add(G);let ne=this.refs[G];return typeof ne=="string"&&(ne=this.refs[ne]),typeof ne=="object"?O(P,ne.schema,G):G!==h(te)&&(G[0]==="#"?(O(P,I[G],G),I[G]=P):this.refs[G]=te),G}function Z(G){if(typeof G=="string"){if(!v.test(G))throw new Error(`invalid anchor "${G}"`);H.call(this,`#${G}`)}}}),I;function O(P,B,K){if(B!==void 0&&!t(P,B))throw M(K)}function M(P){return new Error(`reference "${P}" resolves to more than one schema`)}}return Qr.getSchemaRefs=x,Qr}var qM;function Ry(){if(qM)return yo;qM=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.getData=yo.KeywordCxt=yo.validateFunctionCode=void 0;const e=Rae(),t=fv(),n=OV(),a=fv(),r=Aae(),i=Iae(),s=Oae(),c=$t(),u=Ks(),d=Cy(),m=sn(),h=Ny();function g(J){if(R(J)&&(A(J),C(J))){y(J);return}v(J,()=>(0,e.topBoolOrEmptySchema)(J))}yo.validateFunctionCode=g;function v({gen:J,validateName:q,schema:le,schemaEnv:he,opts:oe},Ce){oe.code.es5?J.func(q,(0,c._)`${u.default.data}, ${u.default.valCxt}`,he.$async,()=>{J.code((0,c._)`"use strict"; ${_(le,oe)}`),S(J,oe),J.code(Ce)}):J.func(q,(0,c._)`${u.default.data}, ${x(oe)}`,he.$async,()=>J.code(_(le,oe)).code(Ce))}function x(J){return(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${J.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function S(J,q){J.if(u.default.valCxt,()=>{J.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),J.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),J.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),J.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),q.dynamicRef&&J.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{J.var(u.default.instancePath,(0,c._)`""`),J.var(u.default.parentData,(0,c._)`undefined`),J.var(u.default.parentDataProperty,(0,c._)`undefined`),J.var(u.default.rootData,u.default.data),q.dynamicRef&&J.var(u.default.dynamicAnchors,(0,c._)`{}`)})}function y(J){const{schema:q,opts:le,gen:he}=J;v(J,()=>{le.$comment&&q.$comment&&ee(J),P(J),he.let(u.default.vErrors,null),he.let(u.default.errors,0),le.unevaluated&&E(J),O(J),te(J)})}function E(J){const{gen:q,validateName:le}=J;J.evaluated=q.const("evaluated",(0,c._)`${le}.evaluated`),q.if((0,c._)`${J.evaluated}.dynamicProps`,()=>q.assign((0,c._)`${J.evaluated}.props`,(0,c._)`undefined`)),q.if((0,c._)`${J.evaluated}.dynamicItems`,()=>q.assign((0,c._)`${J.evaluated}.items`,(0,c._)`undefined`))}function _(J,q){const le=typeof J=="object"&&J[q.schemaId];return le&&(q.code.source||q.code.process)?(0,c._)`/*# sourceURL=${le} */`:c.nil}function k(J,q){if(R(J)&&(A(J),C(J))){I(J,q);return}(0,e.boolOrEmptySchema)(J,q)}function C({schema:J,self:q}){if(typeof J=="boolean")return!J;for(const le in J)if(q.RULES.all[le])return!0;return!1}function R(J){return typeof J.schema!="boolean"}function I(J,q){const{schema:le,gen:he,opts:oe}=J;oe.$comment&&le.$comment&&ee(J),B(J),K(J);const Ce=he.const("_errs",u.default.errors);O(J,Ce),he.var(q,(0,c._)`${Ce} === ${u.default.errors}`)}function A(J){(0,m.checkUnknownRules)(J),M(J)}function O(J,q){if(J.opts.jtd)return H(J,[],!1,q);const le=(0,t.getSchemaTypes)(J.schema),he=(0,t.coerceAndCheckDataType)(J,le);H(J,le,!he,q)}function M(J){const{schema:q,errSchemaPath:le,opts:he,self:oe}=J;q.$ref&&he.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(q,oe.RULES)&&oe.logger.warn(`$ref: keywords ignored in schema at path "${le}"`)}function P(J){const{schema:q,opts:le}=J;q.default!==void 0&&le.useDefaults&&le.strictSchema&&(0,m.checkStrictMode)(J,"default is ignored in the schema root")}function B(J){const q=J.schema[J.opts.schemaId];q&&(J.baseId=(0,d.resolveUrl)(J.opts.uriResolver,J.baseId,q))}function K(J){if(J.schema.$async&&!J.schemaEnv.$async)throw new Error("async schema in sync schema")}function ee({gen:J,schemaEnv:q,schema:le,errSchemaPath:he,opts:oe}){const Ce=le.$comment;if(oe.$comment===!0)J.code((0,c._)`${u.default.self}.logger.log(${Ce})`);else if(typeof oe.$comment=="function"){const Ve=(0,c.str)`${he}/$comment`,xe=J.scopeValue("root",{ref:q.root});J.code((0,c._)`${u.default.self}.opts.$comment(${Ce}, ${Ve}, ${xe}.schema)`)}}function te(J){const{gen:q,schemaEnv:le,validateName:he,ValidationError:oe,opts:Ce}=J;le.$async?q.if((0,c._)`${u.default.errors} === 0`,()=>q.return(u.default.data),()=>q.throw((0,c._)`new ${oe}(${u.default.vErrors})`)):(q.assign((0,c._)`${he}.errors`,u.default.vErrors),Ce.unevaluated&&ae(J),q.return((0,c._)`${u.default.errors} === 0`))}function ae({gen:J,evaluated:q,props:le,items:he}){le instanceof c.Name&&J.assign((0,c._)`${q}.props`,le),he instanceof c.Name&&J.assign((0,c._)`${q}.items`,he)}function H(J,q,le,he){const{gen:oe,schema:Ce,data:Ve,allErrors:xe,opts:Te,self:Fe}=J,{RULES:pe}=Fe;if(Ce.$ref&&(Te.ignoreKeywordsWithRef||!(0,m.schemaHasRulesButRef)(Ce,pe))){oe.block(()=>W(J,"$ref",pe.all.$ref.definition));return}Te.jtd||G(J,q),oe.block(()=>{for(const He of pe.rules)Oe(He);Oe(pe.post)});function Oe(He){(0,n.shouldUseGroup)(Ce,He)&&(He.type?(oe.if((0,a.checkDataType)(He.type,Ve,Te.strictNumbers)),Z(J,He),q.length===1&&q[0]===He.type&&le&&(oe.else(),(0,a.reportTypeError)(J)),oe.endIf()):Z(J,He),xe||oe.if((0,c._)`${u.default.errors} === ${he||0}`))}}function Z(J,q){const{gen:le,schema:he,opts:{useDefaults:oe}}=J;oe&&(0,r.assignDefaults)(J,q.type),le.block(()=>{for(const Ce of q.rules)(0,n.shouldUseRule)(he,Ce)&&W(J,Ce.keyword,Ce.definition,q.type)})}function G(J,q){J.schemaEnv.meta||!J.opts.strictTypes||(re(J,q),J.opts.allowUnionTypes||ne(J,q),j(J,J.dataTypes))}function re(J,q){if(q.length){if(!J.dataTypes.length){J.dataTypes=q;return}q.forEach(le=>{z(J.dataTypes,le)||$(J,`type "${le}" not allowed by context "${J.dataTypes.join(",")}"`)}),L(J,q)}}function ne(J,q){q.length>1&&!(q.length===2&&q.includes("null"))&&$(J,"use allowUnionTypes to allow union type keyword")}function j(J,q){const le=J.self.RULES.all;for(const he in le){const oe=le[he];if(typeof oe=="object"&&(0,n.shouldUseRule)(J.schema,oe)){const{type:Ce}=oe.definition;Ce.length&&!Ce.some(Ve=>V(q,Ve))&&$(J,`missing type "${Ce.join(",")}" for keyword "${he}"`)}}}function V(J,q){return J.includes(q)||q==="number"&&J.includes("integer")}function z(J,q){return J.includes(q)||q==="integer"&&J.includes("number")}function L(J,q){const le=[];for(const he of J.dataTypes)z(q,he)?le.push(he):q.includes("integer")&&he==="number"&&le.push("integer");J.dataTypes=le}function $(J,q){const le=J.schemaEnv.baseId+J.errSchemaPath;q+=` at "${le}" (strictTypes)`,(0,m.checkStrictMode)(J,q,J.opts.strictTypes)}class F{constructor(q,le,he){if((0,i.validateKeywordUsage)(q,le,he),this.gen=q.gen,this.allErrors=q.allErrors,this.keyword=he,this.data=q.data,this.schema=q.schema[he],this.$data=le.$data&&q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,m.schemaRefOrVal)(q,this.schema,he,this.$data),this.schemaType=le.schemaType,this.parentSchema=q.schema,this.params={},this.it=q,this.def=le,this.$data)this.schemaCode=q.gen.const("vSchema",ce(this.$data,q));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,le.schemaType,le.allowUndefined))throw new Error(`${he} value must be ${JSON.stringify(le.schemaType)}`);("code"in le?le.trackErrors:le.errors!==!1)&&(this.errsCount=q.gen.const("_errs",u.default.errors))}result(q,le,he){this.failResult((0,c.not)(q),le,he)}failResult(q,le,he){this.gen.if(q),he?he():this.error(),le?(this.gen.else(),le(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(q,le){this.failResult((0,c.not)(q),void 0,le)}fail(q){if(q===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(q),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(q){if(!this.$data)return this.fail(q);const{schemaCode:le}=this;this.fail((0,c._)`${le} !== undefined && (${(0,c.or)(this.invalid$data(),q)})`)}error(q,le,he){if(le){this.setParams(le),this._error(q,he),this.setParams({});return}this._error(q,he)}_error(q,le){(q?h.reportExtraError:h.reportError)(this,this.def.error,le)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(q){this.allErrors||this.gen.if(q)}setParams(q,le){le?Object.assign(this.params,q):this.params=q}block$data(q,le,he=c.nil){this.gen.block(()=>{this.check$data(q,he),le()})}check$data(q=c.nil,le=c.nil){if(!this.$data)return;const{gen:he,schemaCode:oe,schemaType:Ce,def:Ve}=this;he.if((0,c.or)((0,c._)`${oe} === undefined`,le)),q!==c.nil&&he.assign(q,!0),(Ce.length||Ve.validateSchema)&&(he.elseIf(this.invalid$data()),this.$dataError(),q!==c.nil&&he.assign(q,!1)),he.else()}invalid$data(){const{gen:q,schemaCode:le,schemaType:he,def:oe,it:Ce}=this;return(0,c.or)(Ve(),xe());function Ve(){if(he.length){if(!(le instanceof c.Name))throw new Error("ajv implementation error");const Te=Array.isArray(he)?he:[he];return(0,c._)`${(0,a.checkDataTypes)(Te,le,Ce.opts.strictNumbers,a.DataType.Wrong)}`}return c.nil}function xe(){if(oe.validateSchema){const Te=q.scopeValue("validate$data",{ref:oe.validateSchema});return(0,c._)`!${Te}(${le})`}return c.nil}}subschema(q,le){const he=(0,s.getSubschema)(this.it,q);(0,s.extendSubschemaData)(he,this.it,q),(0,s.extendSubschemaMode)(he,q);const oe={...this.it,...he,items:void 0,props:void 0};return k(oe,le),oe}mergeEvaluated(q,le){const{it:he,gen:oe}=this;he.opts.unevaluated&&(he.props!==!0&&q.props!==void 0&&(he.props=m.mergeEvaluated.props(oe,q.props,he.props,le)),he.items!==!0&&q.items!==void 0&&(he.items=m.mergeEvaluated.items(oe,q.items,he.items,le)))}mergeValidEvaluated(q,le){const{it:he,gen:oe}=this;if(he.opts.unevaluated&&(he.props!==!0||he.items!==!0))return oe.if(le,()=>this.mergeEvaluated(q,c.Name)),!0}}yo.KeywordCxt=F;function W(J,q,le,he){const oe=new F(J,le,q);"code"in le?le.code(oe,he):oe.$data&&le.validate?(0,i.funcKeywordCode)(oe,le):"macro"in le?(0,i.macroKeywordCode)(oe,le):(le.compile||le.validate)&&(0,i.funcKeywordCode)(oe,le)}const X=/^\/(?:[^~]|~0|~1)*$/,ie=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ce(J,{dataLevel:q,dataNames:le,dataPathArr:he}){let oe,Ce;if(J==="")return u.default.rootData;if(J[0]==="/"){if(!X.test(J))throw new Error(`Invalid JSON-pointer: ${J}`);oe=J,Ce=u.default.rootData}else{const Fe=ie.exec(J);if(!Fe)throw new Error(`Invalid JSON-pointer: ${J}`);const pe=+Fe[1];if(oe=Fe[2],oe==="#"){if(pe>=q)throw new Error(Te("property/index",pe));return he[q-pe]}if(pe>q)throw new Error(Te("data",pe));if(Ce=le[q-pe],!oe)return Ce}let Ve=Ce;const xe=oe.split("/");for(const Fe of xe)Fe&&(Ce=(0,c._)`${Ce}${(0,c.getProperty)((0,m.unescapeJsonPointer)(Fe))}`,Ve=(0,c._)`${Ve} && ${Ce}`);return Ve;function Te(Fe,pe){return`Cannot access ${Fe} ${pe} levels up, current level is ${q}`}}return yo.getData=ce,yo}var bg={},XM;function dN(){if(XM)return bg;XM=1,Object.defineProperty(bg,"__esModule",{value:!0});class e extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return bg.default=e,bg}var vg={},JM;function Ay(){if(JM)return vg;JM=1,Object.defineProperty(vg,"__esModule",{value:!0});const e=Cy();class t extends Error{constructor(a,r,i,s){super(s||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,e.resolveUrl)(a,r,i),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(a,this.missingRef))}}return vg.default=t,vg}var Ia={},QM;function fN(){if(QM)return Ia;QM=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.resolveSchema=Ia.getCompilingSchema=Ia.resolveRef=Ia.compileSchema=Ia.SchemaEnv=void 0;const e=$t(),t=dN(),n=Ks(),a=Cy(),r=sn(),i=Ry();class s{constructor(E){var _;this.refs={},this.dynamicAnchors={};let k;typeof E.schema=="object"&&(k=E.schema),this.schema=E.schema,this.schemaId=E.schemaId,this.root=E.root||this,this.baseId=(_=E.baseId)!==null&&_!==void 0?_:(0,a.normalizeId)(k?.[E.schemaId||"$id"]),this.schemaPath=E.schemaPath,this.localRefs=E.localRefs,this.meta=E.meta,this.$async=k?.$async,this.refs={}}}Ia.SchemaEnv=s;function c(y){const E=m.call(this,y);if(E)return E;const _=(0,a.getFullPath)(this.opts.uriResolver,y.root.baseId),{es5:k,lines:C}=this.opts.code,{ownProperties:R}=this.opts,I=new e.CodeGen(this.scope,{es5:k,lines:C,ownProperties:R});let A;y.$async&&(A=I.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const O=I.scopeName("validate");y.validateName=O;const M={gen:I,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:I.scopeValue("schema",this.opts.code.source===!0?{ref:y.schema,code:(0,e.stringify)(y.schema)}:{ref:y.schema}),validateName:O,ValidationError:A,schema:y.schema,schemaEnv:y,rootId:_,baseId:y.baseId||_,schemaPath:e.nil,errSchemaPath:y.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,e._)`""`,opts:this.opts,self:this};let P;try{this._compilations.add(y),(0,i.validateFunctionCode)(M),I.optimize(this.opts.code.optimize);const B=I.toString();P=`${I.scopeRefs(n.default.scope)}return ${B}`,this.opts.code.process&&(P=this.opts.code.process(P,y));const ee=new Function(`${n.default.self}`,`${n.default.scope}`,P)(this,this.scope.get());if(this.scope.value(O,{ref:ee}),ee.errors=null,ee.schema=y.schema,ee.schemaEnv=y,y.$async&&(ee.$async=!0),this.opts.code.source===!0&&(ee.source={validateName:O,validateCode:B,scopeValues:I._values}),this.opts.unevaluated){const{props:te,items:ae}=M;ee.evaluated={props:te instanceof e.Name?void 0:te,items:ae instanceof e.Name?void 0:ae,dynamicProps:te instanceof e.Name,dynamicItems:ae instanceof e.Name},ee.source&&(ee.source.evaluated=(0,e.stringify)(ee.evaluated))}return y.validate=ee,y}catch(B){throw delete y.validate,delete y.validateName,P&&this.logger.error("Error compiling schema, function code:",P),B}finally{this._compilations.delete(y)}}Ia.compileSchema=c;function u(y,E,_){var k;_=(0,a.resolveUrl)(this.opts.uriResolver,E,_);const C=y.refs[_];if(C)return C;let R=g.call(this,y,_);if(R===void 0){const I=(k=y.localRefs)===null||k===void 0?void 0:k[_],{schemaId:A}=this.opts;I&&(R=new s({schema:I,schemaId:A,root:y,baseId:E}))}if(R!==void 0)return y.refs[_]=d.call(this,R)}Ia.resolveRef=u;function d(y){return(0,a.inlineRef)(y.schema,this.opts.inlineRefs)?y.schema:y.validate?y:c.call(this,y)}function m(y){for(const E of this._compilations)if(h(E,y))return E}Ia.getCompilingSchema=m;function h(y,E){return y.schema===E.schema&&y.root===E.root&&y.baseId===E.baseId}function g(y,E){let _;for(;typeof(_=this.refs[E])=="string";)E=_;return _||this.schemas[E]||v.call(this,y,E)}function v(y,E){const _=this.opts.uriResolver.parse(E),k=(0,a._getFullPath)(this.opts.uriResolver,_);let C=(0,a.getFullPath)(this.opts.uriResolver,y.baseId,void 0);if(Object.keys(y.schema).length>0&&k===C)return S.call(this,_,y);const R=(0,a.normalizeId)(k),I=this.refs[R]||this.schemas[R];if(typeof I=="string"){const A=v.call(this,y,I);return typeof A?.schema!="object"?void 0:S.call(this,_,A)}if(typeof I?.schema=="object"){if(I.validate||c.call(this,I),R===(0,a.normalizeId)(E)){const{schema:A}=I,{schemaId:O}=this.opts,M=A[O];return M&&(C=(0,a.resolveUrl)(this.opts.uriResolver,C,M)),new s({schema:A,schemaId:O,root:y,baseId:C})}return S.call(this,_,I)}}Ia.resolveSchema=v;const x=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function S(y,{baseId:E,schema:_,root:k}){var C;if(((C=y.fragment)===null||C===void 0?void 0:C[0])!=="/")return;for(const A of y.fragment.slice(1).split("/")){if(typeof _=="boolean")return;const O=_[(0,r.unescapeFragment)(A)];if(O===void 0)return;_=O;const M=typeof _=="object"&&_[this.opts.schemaId];!x.has(A)&&M&&(E=(0,a.resolveUrl)(this.opts.uriResolver,E,M))}let R;if(typeof _!="boolean"&&_.$ref&&!(0,r.schemaHasRulesButRef)(_,this.RULES)){const A=(0,a.resolveUrl)(this.opts.uriResolver,E,_.$ref);R=v.call(this,k,A)}const{schemaId:I}=this.opts;if(R=R||new s({schema:_,schemaId:I,root:k,baseId:E}),R.schema!==R.root.schema)return R}return Ia}const jae="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Lae="Meta-schema for $data reference (JSON AnySchema extension proposal)",$ae="object",Mae=["$data"],Pae={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Uae=!1,zae={$id:jae,description:Lae,type:$ae,required:Mae,properties:Pae,additionalProperties:Uae};var yg={},Bf={exports:{}},GS,eP;function jV(){if(eP)return GS;eP=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(g){let v="",x=0,S=0;for(S=0;S<g.length;S++)if(x=g[S].charCodeAt(0),x!==48){if(!(x>=48&&x<=57||x>=65&&x<=70||x>=97&&x<=102))return"";v+=g[S];break}for(S+=1;S<g.length;S++){if(x=g[S].charCodeAt(0),!(x>=48&&x<=57||x>=65&&x<=70||x>=97&&x<=102))return"";v+=g[S]}return v}const a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function r(g){return g.length=0,!0}function i(g,v,x){if(g.length){const S=n(g);if(S!=="")v.push(S);else return x.error=!0,!1;g.length=0}return!0}function s(g){let v=0;const x={error:!1,address:"",zone:""},S=[],y=[];let E=!1,_=!1,k=i;for(let C=0;C<g.length;C++){const R=g[C];if(!(R==="["||R==="]"))if(R===":"){if(E===!0&&(_=!0),!k(y,S,x))break;if(++v>7){x.error=!0;break}C>0&&g[C-1]===":"&&(E=!0),S.push(":");continue}else if(R==="%"){if(!k(y,S,x))break;k=r}else{y.push(R);continue}}return y.length&&(k===r?x.zone=y.join(""):_?S.push(y.join("")):S.push(n(y))),x.address=S.join(""),x}function c(g){if(u(g,":")<2)return{host:g,isIPV6:!1};const v=s(g);if(v.error)return{host:g,isIPV6:!1};{let x=v.address,S=v.address;return v.zone&&(x+="%"+v.zone,S+="%25"+v.zone),{host:x,isIPV6:!0,escapedHost:S}}}function u(g,v){let x=0;for(let S=0;S<g.length;S++)g[S]===v&&x++;return x}function d(g){let v=g;const x=[];let S=-1,y=0;for(;y=v.length;){if(y===1){if(v===".")break;if(v==="/"){x.push("/");break}else{x.push(v);break}}else if(y===2){if(v[0]==="."){if(v[1]===".")break;if(v[1]==="/"){v=v.slice(2);continue}}else if(v[0]==="/"&&(v[1]==="."||v[1]==="/")){x.push("/");break}}else if(y===3&&v==="/.."){x.length!==0&&x.pop(),x.push("/");break}if(v[0]==="."){if(v[1]==="."){if(v[2]==="/"){v=v.slice(3);continue}}else if(v[1]==="/"){v=v.slice(2);continue}}else if(v[0]==="/"&&v[1]==="."){if(v[2]==="/"){v=v.slice(2);continue}else if(v[2]==="."&&v[3]==="/"){v=v.slice(3),x.length!==0&&x.pop();continue}}if((S=v.indexOf("/",1))===-1){x.push(v);break}else x.push(v.slice(0,S)),v=v.slice(S)}return x.join("")}function m(g,v){const x=v!==!0?escape:unescape;return g.scheme!==void 0&&(g.scheme=x(g.scheme)),g.userinfo!==void 0&&(g.userinfo=x(g.userinfo)),g.host!==void 0&&(g.host=x(g.host)),g.path!==void 0&&(g.path=x(g.path)),g.query!==void 0&&(g.query=x(g.query)),g.fragment!==void 0&&(g.fragment=x(g.fragment)),g}function h(g){const v=[];if(g.userinfo!==void 0&&(v.push(g.userinfo),v.push("@")),g.host!==void 0){let x=unescape(g.host);if(!t(x)){const S=c(x);S.isIPV6===!0?x=`[${S.escapedHost}]`:x=g.host}v.push(x)}return(typeof g.port=="number"||typeof g.port=="string")&&(v.push(":"),v.push(String(g.port))),v.length?v.join(""):void 0}return GS={nonSimpleDomain:a,recomposeAuthority:h,normalizeComponentEncoding:m,removeDotSegments:d,isIPv4:t,isUUID:e,normalizeIPv6:c,stringArrayToHexStripped:n},GS}var WS,tP;function Fae(){if(tP)return WS;tP=1;const{isUUID:e}=jV(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function a(R){return n.indexOf(R)!==-1}function r(R){return R.secure===!0?!0:R.secure===!1?!1:R.scheme?R.scheme.length===3&&(R.scheme[0]==="w"||R.scheme[0]==="W")&&(R.scheme[1]==="s"||R.scheme[1]==="S")&&(R.scheme[2]==="s"||R.scheme[2]==="S"):!1}function i(R){return R.host||(R.error=R.error||"HTTP URIs must have a host."),R}function s(R){const I=String(R.scheme).toLowerCase()==="https";return(R.port===(I?443:80)||R.port==="")&&(R.port=void 0),R.path||(R.path="/"),R}function c(R){return R.secure=r(R),R.resourceName=(R.path||"/")+(R.query?"?"+R.query:""),R.path=void 0,R.query=void 0,R}function u(R){if((R.port===(r(R)?443:80)||R.port==="")&&(R.port=void 0),typeof R.secure=="boolean"&&(R.scheme=R.secure?"wss":"ws",R.secure=void 0),R.resourceName){const[I,A]=R.resourceName.split("?");R.path=I&&I!=="/"?I:void 0,R.query=A,R.resourceName=void 0}return R.fragment=void 0,R}function d(R,I){if(!R.path)return R.error="URN can not be parsed",R;const A=R.path.match(t);if(A){const O=I.scheme||R.scheme||"urn";R.nid=A[1].toLowerCase(),R.nss=A[2];const M=`${O}:${I.nid||R.nid}`,P=C(M);R.path=void 0,P&&(R=P.parse(R,I))}else R.error=R.error||"URN can not be parsed.";return R}function m(R,I){if(R.nid===void 0)throw new Error("URN without nid cannot be serialized");const A=I.scheme||R.scheme||"urn",O=R.nid.toLowerCase(),M=`${A}:${I.nid||O}`,P=C(M);P&&(R=P.serialize(R,I));const B=R,K=R.nss;return B.path=`${O||I.nid}:${K}`,I.skipEscape=!0,B}function h(R,I){const A=R;return A.uuid=A.nss,A.nss=void 0,!I.tolerant&&(!A.uuid||!e(A.uuid))&&(A.error=A.error||"UUID is not valid."),A}function g(R){const I=R;return I.nss=(R.uuid||"").toLowerCase(),I}const v={scheme:"http",domainHost:!0,parse:i,serialize:s},x={scheme:"https",domainHost:v.domainHost,parse:i,serialize:s},S={scheme:"ws",domainHost:!0,parse:c,serialize:u},y={scheme:"wss",domainHost:S.domainHost,parse:S.parse,serialize:S.serialize},k={http:v,https:x,ws:S,wss:y,urn:{scheme:"urn",parse:d,serialize:m,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:h,serialize:g,skipNormalize:!0}};Object.setPrototypeOf(k,null);function C(R){return R&&(k[R]||k[R.toLowerCase()])||void 0}return WS={wsIsSecure:r,SCHEMES:k,isValidSchemeName:a,getSchemeHandler:C},WS}var nP;function Bae(){if(nP)return Bf.exports;nP=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:a,isIPv4:r,nonSimpleDomain:i}=jV(),{SCHEMES:s,getSchemeHandler:c}=Fae();function u(y,E){return typeof y=="string"?y=g(x(y,E),E):typeof y=="object"&&(y=x(g(y,E),E)),y}function d(y,E,_){const k=_?Object.assign({scheme:"null"},_):{scheme:"null"},C=m(x(y,k),x(E,k),k,!0);return k.skipEscape=!0,g(C,k)}function m(y,E,_,k){const C={};return k||(y=x(g(y,_),_),E=x(g(E,_),_)),_=_||{},!_.tolerant&&E.scheme?(C.scheme=E.scheme,C.userinfo=E.userinfo,C.host=E.host,C.port=E.port,C.path=t(E.path||""),C.query=E.query):(E.userinfo!==void 0||E.host!==void 0||E.port!==void 0?(C.userinfo=E.userinfo,C.host=E.host,C.port=E.port,C.path=t(E.path||""),C.query=E.query):(E.path?(E.path[0]==="/"?C.path=t(E.path):((y.userinfo!==void 0||y.host!==void 0||y.port!==void 0)&&!y.path?C.path="/"+E.path:y.path?C.path=y.path.slice(0,y.path.lastIndexOf("/")+1)+E.path:C.path=E.path,C.path=t(C.path)),C.query=E.query):(C.path=y.path,E.query!==void 0?C.query=E.query:C.query=y.query),C.userinfo=y.userinfo,C.host=y.host,C.port=y.port),C.scheme=y.scheme),C.fragment=E.fragment,C}function h(y,E,_){return typeof y=="string"?(y=unescape(y),y=g(a(x(y,_),!0),{..._,skipEscape:!0})):typeof y=="object"&&(y=g(a(y,!0),{..._,skipEscape:!0})),typeof E=="string"?(E=unescape(E),E=g(a(x(E,_),!0),{..._,skipEscape:!0})):typeof E=="object"&&(E=g(a(E,!0),{..._,skipEscape:!0})),y.toLowerCase()===E.toLowerCase()}function g(y,E){const _={host:y.host,scheme:y.scheme,userinfo:y.userinfo,port:y.port,path:y.path,query:y.query,nid:y.nid,nss:y.nss,uuid:y.uuid,fragment:y.fragment,reference:y.reference,resourceName:y.resourceName,secure:y.secure,error:""},k=Object.assign({},E),C=[],R=c(k.scheme||_.scheme);R&&R.serialize&&R.serialize(_,k),_.path!==void 0&&(k.skipEscape?_.path=unescape(_.path):(_.path=escape(_.path),_.scheme!==void 0&&(_.path=_.path.split("%3A").join(":")))),k.reference!=="suffix"&&_.scheme&&C.push(_.scheme,":");const I=n(_);if(I!==void 0&&(k.reference!=="suffix"&&C.push("//"),C.push(I),_.path&&_.path[0]!=="/"&&C.push("/")),_.path!==void 0){let A=_.path;!k.absolutePath&&(!R||!R.absolutePath)&&(A=t(A)),I===void 0&&A[0]==="/"&&A[1]==="/"&&(A="/%2F"+A.slice(2)),C.push(A)}return _.query!==void 0&&C.push("?",_.query),_.fragment!==void 0&&C.push("#",_.fragment),C.join("")}const v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function x(y,E){const _=Object.assign({},E),k={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let C=!1;_.reference==="suffix"&&(_.scheme?y=_.scheme+":"+y:y="//"+y);const R=y.match(v);if(R){if(k.scheme=R[1],k.userinfo=R[3],k.host=R[4],k.port=parseInt(R[5],10),k.path=R[6]||"",k.query=R[7],k.fragment=R[8],isNaN(k.port)&&(k.port=R[5]),k.host)if(r(k.host)===!1){const O=e(k.host);k.host=O.host.toLowerCase(),C=O.isIPV6}else C=!0;k.scheme===void 0&&k.userinfo===void 0&&k.host===void 0&&k.port===void 0&&k.query===void 0&&!k.path?k.reference="same-document":k.scheme===void 0?k.reference="relative":k.fragment===void 0?k.reference="absolute":k.reference="uri",_.reference&&_.reference!=="suffix"&&_.reference!==k.reference&&(k.error=k.error||"URI is not a "+_.reference+" reference.");const I=c(_.scheme||k.scheme);if(!_.unicodeSupport&&(!I||!I.unicodeSupport)&&k.host&&(_.domainHost||I&&I.domainHost)&&C===!1&&i(k.host))try{k.host=URL.domainToASCII(k.host.toLowerCase())}catch(A){k.error=k.error||"Host's domain name can not be converted to ASCII: "+A}(!I||I&&!I.skipNormalize)&&(y.indexOf("%")!==-1&&(k.scheme!==void 0&&(k.scheme=unescape(k.scheme)),k.host!==void 0&&(k.host=unescape(k.host))),k.path&&(k.path=escape(unescape(k.path))),k.fragment&&(k.fragment=encodeURI(decodeURIComponent(k.fragment)))),I&&I.parse&&I.parse(k,_)}else k.error=k.error||"URI can not be parsed.";return k}const S={SCHEMES:s,normalize:u,resolve:d,resolveComponent:m,equal:h,serialize:g,parse:x};return Bf.exports=S,Bf.exports.default=S,Bf.exports.fastUri=S,Bf.exports}var rP;function Hae(){if(rP)return yg;rP=1,Object.defineProperty(yg,"__esModule",{value:!0});const e=Bae();return e.code='require("ajv/dist/runtime/uri").default',yg.default=e,yg}var aP;function Vae(){return aP||(aP=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Ry();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=$t();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const a=dN(),r=Ay(),i=IV(),s=fN(),c=$t(),u=Cy(),d=fv(),m=sn(),h=zae,g=Hae(),v=(ne,j)=>new RegExp(ne,j);v.code="new RegExp";const x=["removeAdditional","useDefaults","coerceTypes"],S=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},E={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},_=200;function k(ne){var j,V,z,L,$,F,W,X,ie,ce,J,q,le,he,oe,Ce,Ve,xe,Te,Fe,pe,Oe,He,Se,at;const nt=ne.strict,ft=(j=ne.code)===null||j===void 0?void 0:j.optimize,Et=ft===!0||ft===void 0?1:ft||0,pt=(z=(V=ne.code)===null||V===void 0?void 0:V.regExp)!==null&&z!==void 0?z:v,mn=(L=ne.uriResolver)!==null&&L!==void 0?L:g.default;return{strictSchema:(F=($=ne.strictSchema)!==null&&$!==void 0?$:nt)!==null&&F!==void 0?F:!0,strictNumbers:(X=(W=ne.strictNumbers)!==null&&W!==void 0?W:nt)!==null&&X!==void 0?X:!0,strictTypes:(ce=(ie=ne.strictTypes)!==null&&ie!==void 0?ie:nt)!==null&&ce!==void 0?ce:"log",strictTuples:(q=(J=ne.strictTuples)!==null&&J!==void 0?J:nt)!==null&&q!==void 0?q:"log",strictRequired:(he=(le=ne.strictRequired)!==null&&le!==void 0?le:nt)!==null&&he!==void 0?he:!1,code:ne.code?{...ne.code,optimize:Et,regExp:pt}:{optimize:Et,regExp:pt},loopRequired:(oe=ne.loopRequired)!==null&&oe!==void 0?oe:_,loopEnum:(Ce=ne.loopEnum)!==null&&Ce!==void 0?Ce:_,meta:(Ve=ne.meta)!==null&&Ve!==void 0?Ve:!0,messages:(xe=ne.messages)!==null&&xe!==void 0?xe:!0,inlineRefs:(Te=ne.inlineRefs)!==null&&Te!==void 0?Te:!0,schemaId:(Fe=ne.schemaId)!==null&&Fe!==void 0?Fe:"$id",addUsedSchema:(pe=ne.addUsedSchema)!==null&&pe!==void 0?pe:!0,validateSchema:(Oe=ne.validateSchema)!==null&&Oe!==void 0?Oe:!0,validateFormats:(He=ne.validateFormats)!==null&&He!==void 0?He:!0,unicodeRegExp:(Se=ne.unicodeRegExp)!==null&&Se!==void 0?Se:!0,int32range:(at=ne.int32range)!==null&&at!==void 0?at:!0,uriResolver:mn}}class C{constructor(j={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,j=this.opts={...j,...k(j)};const{es5:V,lines:z}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:S,es5:V,lines:z}),this.logger=K(j.logger);const L=j.validateFormats;j.validateFormats=!1,this.RULES=(0,i.getRules)(),R.call(this,y,j,"NOT SUPPORTED"),R.call(this,E,j,"DEPRECATED","warn"),this._metaOpts=P.call(this),j.formats&&O.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),j.keywords&&M.call(this,j.keywords),typeof j.meta=="object"&&this.addMetaSchema(j.meta),A.call(this),j.validateFormats=L}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:j,meta:V,schemaId:z}=this.opts;let L=h;z==="id"&&(L={...h},L.id=L.$id,delete L.$id),V&&j&&this.addMetaSchema(L,L[z],!1)}defaultMeta(){const{meta:j,schemaId:V}=this.opts;return this.opts.defaultMeta=typeof j=="object"?j[V]||j:void 0}validate(j,V){let z;if(typeof j=="string"){if(z=this.getSchema(j),!z)throw new Error(`no schema with key or ref "${j}"`)}else z=this.compile(j);const L=z(V);return"$async"in z||(this.errors=z.errors),L}compile(j,V){const z=this._addSchema(j,V);return z.validate||this._compileSchemaEnv(z)}compileAsync(j,V){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:z}=this.opts;return L.call(this,j,V);async function L(ce,J){await $.call(this,ce.$schema);const q=this._addSchema(ce,J);return q.validate||F.call(this,q)}async function $(ce){ce&&!this.getSchema(ce)&&await L.call(this,{$ref:ce},!0)}async function F(ce){try{return this._compileSchemaEnv(ce)}catch(J){if(!(J instanceof r.default))throw J;return W.call(this,J),await X.call(this,J.missingSchema),F.call(this,ce)}}function W({missingSchema:ce,missingRef:J}){if(this.refs[ce])throw new Error(`AnySchema ${ce} is loaded but ${J} cannot be resolved`)}async function X(ce){const J=await ie.call(this,ce);this.refs[ce]||await $.call(this,J.$schema),this.refs[ce]||this.addSchema(J,ce,V)}async function ie(ce){const J=this._loading[ce];if(J)return J;try{return await(this._loading[ce]=z(ce))}finally{delete this._loading[ce]}}}addSchema(j,V,z,L=this.opts.validateSchema){if(Array.isArray(j)){for(const F of j)this.addSchema(F,void 0,z,L);return this}let $;if(typeof j=="object"){const{schemaId:F}=this.opts;if($=j[F],$!==void 0&&typeof $!="string")throw new Error(`schema ${F} must be string`)}return V=(0,u.normalizeId)(V||$),this._checkUnique(V),this.schemas[V]=this._addSchema(j,z,V,L,!0),this}addMetaSchema(j,V,z=this.opts.validateSchema){return this.addSchema(j,V,!0,z),this}validateSchema(j,V){if(typeof j=="boolean")return!0;let z;if(z=j.$schema,z!==void 0&&typeof z!="string")throw new Error("$schema must be a string");if(z=z||this.opts.defaultMeta||this.defaultMeta(),!z)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const L=this.validate(z,j);if(!L&&V){const $="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error($);else throw new Error($)}return L}getSchema(j){let V;for(;typeof(V=I.call(this,j))=="string";)j=V;if(V===void 0){const{schemaId:z}=this.opts,L=new s.SchemaEnv({schema:{},schemaId:z});if(V=s.resolveSchema.call(this,L,j),!V)return;this.refs[j]=V}return V.validate||this._compileSchemaEnv(V)}removeSchema(j){if(j instanceof RegExp)return this._removeAllSchemas(this.schemas,j),this._removeAllSchemas(this.refs,j),this;switch(typeof j){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const V=I.call(this,j);return typeof V=="object"&&this._cache.delete(V.schema),delete this.schemas[j],delete this.refs[j],this}case"object":{const V=j;this._cache.delete(V);let z=j[this.opts.schemaId];return z&&(z=(0,u.normalizeId)(z),delete this.schemas[z],delete this.refs[z]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(j){for(const V of j)this.addKeyword(V);return this}addKeyword(j,V){let z;if(typeof j=="string")z=j,typeof V=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),V.keyword=z);else if(typeof j=="object"&&V===void 0){if(V=j,z=V.keyword,Array.isArray(z)&&!z.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(te.call(this,z,V),!V)return(0,m.eachItem)(z,$=>ae.call(this,$)),this;Z.call(this,V);const L={...V,type:(0,d.getJSONTypes)(V.type),schemaType:(0,d.getJSONTypes)(V.schemaType)};return(0,m.eachItem)(z,L.type.length===0?$=>ae.call(this,$,L):$=>L.type.forEach(F=>ae.call(this,$,L,F))),this}getKeyword(j){const V=this.RULES.all[j];return typeof V=="object"?V.definition:!!V}removeKeyword(j){const{RULES:V}=this;delete V.keywords[j],delete V.all[j];for(const z of V.rules){const L=z.rules.findIndex($=>$.keyword===j);L>=0&&z.rules.splice(L,1)}return this}addFormat(j,V){return typeof V=="string"&&(V=new RegExp(V)),this.formats[j]=V,this}errorsText(j=this.errors,{separator:V=", ",dataVar:z="data"}={}){return!j||j.length===0?"No errors":j.map(L=>`${z}${L.instancePath} ${L.message}`).reduce((L,$)=>L+V+$)}$dataMetaSchema(j,V){const z=this.RULES.all;j=JSON.parse(JSON.stringify(j));for(const L of V){const $=L.split("/").slice(1);let F=j;for(const W of $)F=F[W];for(const W in z){const X=z[W];if(typeof X!="object")continue;const{$data:ie}=X.definition,ce=F[W];ie&&ce&&(F[W]=re(ce))}}return j}_removeAllSchemas(j,V){for(const z in j){const L=j[z];(!V||V.test(z))&&(typeof L=="string"?delete j[z]:L&&!L.meta&&(this._cache.delete(L.schema),delete j[z]))}}_addSchema(j,V,z,L=this.opts.validateSchema,$=this.opts.addUsedSchema){let F;const{schemaId:W}=this.opts;if(typeof j=="object")F=j[W];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof j!="boolean")throw new Error("schema must be object or boolean")}let X=this._cache.get(j);if(X!==void 0)return X;z=(0,u.normalizeId)(F||z);const ie=u.getSchemaRefs.call(this,j,z);return X=new s.SchemaEnv({schema:j,schemaId:W,meta:V,baseId:z,localRefs:ie}),this._cache.set(X.schema,X),$&&!z.startsWith("#")&&(z&&this._checkUnique(z),this.refs[z]=X),L&&this.validateSchema(j,!0),X}_checkUnique(j){if(this.schemas[j]||this.refs[j])throw new Error(`schema with key or id "${j}" already exists`)}_compileSchemaEnv(j){if(j.meta?this._compileMetaSchema(j):s.compileSchema.call(this,j),!j.validate)throw new Error("ajv implementation error");return j.validate}_compileMetaSchema(j){const V=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,j)}finally{this.opts=V}}}C.ValidationError=a.default,C.MissingRefError=r.default,e.default=C;function R(ne,j,V,z="error"){for(const L in ne){const $=L;$ in j&&this.logger[z](`${V}: option ${L}. ${ne[$]}`)}}function I(ne){return ne=(0,u.normalizeId)(ne),this.schemas[ne]||this.refs[ne]}function A(){const ne=this.opts.schemas;if(ne)if(Array.isArray(ne))this.addSchema(ne);else for(const j in ne)this.addSchema(ne[j],j)}function O(){for(const ne in this.opts.formats){const j=this.opts.formats[ne];j&&this.addFormat(ne,j)}}function M(ne){if(Array.isArray(ne)){this.addVocabulary(ne);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const j in ne){const V=ne[j];V.keyword||(V.keyword=j),this.addKeyword(V)}}function P(){const ne={...this.opts};for(const j of x)delete ne[j];return ne}const B={log(){},warn(){},error(){}};function K(ne){if(ne===!1)return B;if(ne===void 0)return console;if(ne.log&&ne.warn&&ne.error)return ne;throw new Error("logger must implement log, warn and error methods")}const ee=/^[a-z_$][a-z0-9_$:-]*$/i;function te(ne,j){const{RULES:V}=this;if((0,m.eachItem)(ne,z=>{if(V.keywords[z])throw new Error(`Keyword ${z} is already defined`);if(!ee.test(z))throw new Error(`Keyword ${z} has invalid name`)}),!!j&&j.$data&&!("code"in j||"validate"in j))throw new Error('$data keyword must have "code" or "validate" function')}function ae(ne,j,V){var z;const L=j?.post;if(V&&L)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:$}=this;let F=L?$.post:$.rules.find(({type:X})=>X===V);if(F||(F={type:V,rules:[]},$.rules.push(F)),$.keywords[ne]=!0,!j)return;const W={keyword:ne,definition:{...j,type:(0,d.getJSONTypes)(j.type),schemaType:(0,d.getJSONTypes)(j.schemaType)}};j.before?H.call(this,F,W,j.before):F.rules.push(W),$.all[ne]=W,(z=j.implements)===null||z===void 0||z.forEach(X=>this.addKeyword(X))}function H(ne,j,V){const z=ne.rules.findIndex(L=>L.keyword===V);z>=0?ne.rules.splice(z,0,j):(ne.rules.push(j),this.logger.warn(`rule ${V} is not defined`))}function Z(ne){let{metaSchema:j}=ne;j!==void 0&&(ne.$data&&this.opts.$data&&(j=re(j)),ne.validateSchema=this.compile(j,!0))}const G={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function re(ne){return{anyOf:[ne,G]}}})(PS)),PS}var wg={},Sg={},xg={},iP;function Gae(){if(iP)return xg;iP=1,Object.defineProperty(xg,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return xg.default=e,xg}var bs={},oP;function Wae(){if(oP)return bs;oP=1,Object.defineProperty(bs,"__esModule",{value:!0}),bs.callRef=bs.getValidate=void 0;const e=Ay(),t=Ri(),n=$t(),a=Ks(),r=fN(),i=sn(),s={keyword:"$ref",schemaType:"string",code(d){const{gen:m,schema:h,it:g}=d,{baseId:v,schemaEnv:x,validateName:S,opts:y,self:E}=g,{root:_}=x;if((h==="#"||h==="#/")&&v===_.baseId)return C();const k=r.resolveRef.call(E,_,v,h);if(k===void 0)throw new e.default(g.opts.uriResolver,v,h);if(k instanceof r.SchemaEnv)return R(k);return I(k);function C(){if(x===_)return u(d,S,x,x.$async);const A=m.scopeValue("root",{ref:_});return u(d,(0,n._)`${A}.validate`,_,_.$async)}function R(A){const O=c(d,A);u(d,O,A,A.$async)}function I(A){const O=m.scopeValue("schema",y.code.source===!0?{ref:A,code:(0,n.stringify)(A)}:{ref:A}),M=m.name("valid"),P=d.subschema({schema:A,dataTypes:[],schemaPath:n.nil,topSchemaRef:O,errSchemaPath:h},M);d.mergeEvaluated(P),d.ok(M)}}};function c(d,m){const{gen:h}=d;return m.validate?h.scopeValue("validate",{ref:m.validate}):(0,n._)`${h.scopeValue("wrapper",{ref:m})}.validate`}bs.getValidate=c;function u(d,m,h,g){const{gen:v,it:x}=d,{allErrors:S,schemaEnv:y,opts:E}=x,_=E.passContext?a.default.this:n.nil;g?k():C();function k(){if(!y.$async)throw new Error("async schema referenced by sync schema");const A=v.let("valid");v.try(()=>{v.code((0,n._)`await ${(0,t.callValidateCode)(d,m,_)}`),I(m),S||v.assign(A,!0)},O=>{v.if((0,n._)`!(${O} instanceof ${x.ValidationError})`,()=>v.throw(O)),R(O),S||v.assign(A,!1)}),d.ok(A)}function C(){d.result((0,t.callValidateCode)(d,m,_),()=>I(m),()=>R(m))}function R(A){const O=(0,n._)`${A}.errors`;v.assign(a.default.vErrors,(0,n._)`${a.default.vErrors} === null ? ${O} : ${a.default.vErrors}.concat(${O})`),v.assign(a.default.errors,(0,n._)`${a.default.vErrors}.length`)}function I(A){var O;if(!x.opts.unevaluated)return;const M=(O=h?.validate)===null||O===void 0?void 0:O.evaluated;if(x.props!==!0)if(M&&!M.dynamicProps)M.props!==void 0&&(x.props=i.mergeEvaluated.props(v,M.props,x.props));else{const P=v.var("props",(0,n._)`${A}.evaluated.props`);x.props=i.mergeEvaluated.props(v,P,x.props,n.Name)}if(x.items!==!0)if(M&&!M.dynamicItems)M.items!==void 0&&(x.items=i.mergeEvaluated.items(v,M.items,x.items));else{const P=v.var("items",(0,n._)`${A}.evaluated.items`);x.items=i.mergeEvaluated.items(v,P,x.items,n.Name)}}}return bs.callRef=u,bs.default=s,bs}var sP;function Kae(){if(sP)return Sg;sP=1,Object.defineProperty(Sg,"__esModule",{value:!0});const e=Gae(),t=Wae(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return Sg.default=n,Sg}var _g={},Eg={},lP;function Zae(){if(lP)return Eg;lP=1,Object.defineProperty(Eg,"__esModule",{value:!0});const e=$t(),t=e.operators,n={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},a={message:({keyword:i,schemaCode:s})=>(0,e.str)`must be ${n[i].okStr} ${s}`,params:({keyword:i,schemaCode:s})=>(0,e._)`{comparison: ${n[i].okStr}, limit: ${s}}`},r={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:a,code(i){const{keyword:s,data:c,schemaCode:u}=i;i.fail$data((0,e._)`${c} ${n[s].fail} ${u} || isNaN(${c})`)}};return Eg.default=r,Eg}var kg={},cP;function Yae(){if(cP)return kg;cP=1,Object.defineProperty(kg,"__esModule",{value:!0});const e=$t(),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:a})=>(0,e.str)`must be multiple of ${a}`,params:({schemaCode:a})=>(0,e._)`{multipleOf: ${a}}`},code(a){const{gen:r,data:i,schemaCode:s,it:c}=a,u=c.opts.multipleOfPrecision,d=r.let("res"),m=u?(0,e._)`Math.abs(Math.round(${d}) - ${d}) > 1e-${u}`:(0,e._)`${d} !== parseInt(${d})`;a.fail$data((0,e._)`(${s} === 0 || (${d} = ${i}/${s}, ${m}))`)}};return kg.default=n,kg}var Tg={},Ng={},uP;function qae(){if(uP)return Ng;uP=1,Object.defineProperty(Ng,"__esModule",{value:!0});function e(t){const n=t.length;let a=0,r=0,i;for(;r<n;)a++,i=t.charCodeAt(r++),i>=55296&&i<=56319&&r<n&&(i=t.charCodeAt(r),(i&64512)===56320&&r++);return a}return Ng.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Ng}var dP;function Xae(){if(dP)return Tg;dP=1,Object.defineProperty(Tg,"__esModule",{value:!0});const e=$t(),t=sn(),n=qae(),r={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:i,schemaCode:s}){const c=i==="maxLength"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${s} characters`},params:({schemaCode:i})=>(0,e._)`{limit: ${i}}`},code(i){const{keyword:s,data:c,schemaCode:u,it:d}=i,m=s==="maxLength"?e.operators.GT:e.operators.LT,h=d.opts.unicode===!1?(0,e._)`${c}.length`:(0,e._)`${(0,t.useFunc)(i.gen,n.default)}(${c})`;i.fail$data((0,e._)`${h} ${m} ${u}`)}};return Tg.default=r,Tg}var Cg={},fP;function Jae(){if(fP)return Cg;fP=1,Object.defineProperty(Cg,"__esModule",{value:!0});const e=Ri(),t=$t(),a={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,t.str)`must match pattern "${r}"`,params:({schemaCode:r})=>(0,t._)`{pattern: ${r}}`},code(r){const{data:i,$data:s,schema:c,schemaCode:u,it:d}=r,m=d.opts.unicodeRegExp?"u":"",h=s?(0,t._)`(new RegExp(${u}, ${m}))`:(0,e.usePattern)(r,c);r.fail$data((0,t._)`!${h}.test(${i})`)}};return Cg.default=a,Cg}var Rg={},pP;function Qae(){if(pP)return Rg;pP=1,Object.defineProperty(Rg,"__esModule",{value:!0});const e=$t(),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:a,schemaCode:r}){const i=a==="maxProperties"?"more":"fewer";return(0,e.str)`must NOT have ${i} than ${r} properties`},params:({schemaCode:a})=>(0,e._)`{limit: ${a}}`},code(a){const{keyword:r,data:i,schemaCode:s}=a,c=r==="maxProperties"?e.operators.GT:e.operators.LT;a.fail$data((0,e._)`Object.keys(${i}).length ${c} ${s}`)}};return Rg.default=n,Rg}var Ag={},mP;function eie(){if(mP)return Ag;mP=1,Object.defineProperty(Ag,"__esModule",{value:!0});const e=Ri(),t=$t(),n=sn(),r={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>(0,t.str)`must have required property '${i}'`,params:({params:{missingProperty:i}})=>(0,t._)`{missingProperty: ${i}}`},code(i){const{gen:s,schema:c,schemaCode:u,data:d,$data:m,it:h}=i,{opts:g}=h;if(!m&&c.length===0)return;const v=c.length>=g.loopRequired;if(h.allErrors?x():S(),g.strictRequired){const _=i.parentSchema.properties,{definedProperties:k}=i.it;for(const C of c)if(_?.[C]===void 0&&!k.has(C)){const R=h.schemaEnv.baseId+h.errSchemaPath,I=`required property "${C}" is not defined at "${R}" (strictRequired)`;(0,n.checkStrictMode)(h,I,h.opts.strictRequired)}}function x(){if(v||m)i.block$data(t.nil,y);else for(const _ of c)(0,e.checkReportMissingProp)(i,_)}function S(){const _=s.let("missing");if(v||m){const k=s.let("valid",!0);i.block$data(k,()=>E(_,k)),i.ok(k)}else s.if((0,e.checkMissingProp)(i,c,_)),(0,e.reportMissingProp)(i,_),s.else()}function y(){s.forOf("prop",u,_=>{i.setParams({missingProperty:_}),s.if((0,e.noPropertyInData)(s,d,_,g.ownProperties),()=>i.error())})}function E(_,k){i.setParams({missingProperty:_}),s.forOf(_,u,()=>{s.assign(k,(0,e.propertyInData)(s,d,_,g.ownProperties)),s.if((0,t.not)(k),()=>{i.error(),s.break()})},t.nil)}}};return Ag.default=r,Ag}var Ig={},hP;function tie(){if(hP)return Ig;hP=1,Object.defineProperty(Ig,"__esModule",{value:!0});const e=$t(),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:a,schemaCode:r}){const i=a==="maxItems"?"more":"fewer";return(0,e.str)`must NOT have ${i} than ${r} items`},params:({schemaCode:a})=>(0,e._)`{limit: ${a}}`},code(a){const{keyword:r,data:i,schemaCode:s}=a,c=r==="maxItems"?e.operators.GT:e.operators.LT;a.fail$data((0,e._)`${i}.length ${c} ${s}`)}};return Ig.default=n,Ig}var Og={},Dg={},gP;function pN(){if(gP)return Dg;gP=1,Object.defineProperty(Dg,"__esModule",{value:!0});const e=DV();return e.code='require("ajv/dist/runtime/equal").default',Dg.default=e,Dg}var bP;function nie(){if(bP)return Og;bP=1,Object.defineProperty(Og,"__esModule",{value:!0});const e=fv(),t=$t(),n=sn(),a=pN(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:s,j:c}})=>(0,t.str)`must NOT have duplicate items (items ## ${c} and ${s} are identical)`,params:({params:{i:s,j:c}})=>(0,t._)`{i: ${s}, j: ${c}}`},code(s){const{gen:c,data:u,$data:d,schema:m,parentSchema:h,schemaCode:g,it:v}=s;if(!d&&!m)return;const x=c.let("valid"),S=h.items?(0,e.getSchemaTypes)(h.items):[];s.block$data(x,y,(0,t._)`${g} === false`),s.ok(x);function y(){const C=c.let("i",(0,t._)`${u}.length`),R=c.let("j");s.setParams({i:C,j:R}),c.assign(x,!0),c.if((0,t._)`${C} > 1`,()=>(E()?_:k)(C,R))}function E(){return S.length>0&&!S.some(C=>C==="object"||C==="array")}function _(C,R){const I=c.name("item"),A=(0,e.checkDataTypes)(S,I,v.opts.strictNumbers,e.DataType.Wrong),O=c.const("indices",(0,t._)`{}`);c.for((0,t._)`;${C}--;`,()=>{c.let(I,(0,t._)`${u}[${C}]`),c.if(A,(0,t._)`continue`),S.length>1&&c.if((0,t._)`typeof ${I} == "string"`,(0,t._)`${I} += "_"`),c.if((0,t._)`typeof ${O}[${I}] == "number"`,()=>{c.assign(R,(0,t._)`${O}[${I}]`),s.error(),c.assign(x,!1).break()}).code((0,t._)`${O}[${I}] = ${C}`)})}function k(C,R){const I=(0,n.useFunc)(c,a.default),A=c.name("outer");c.label(A).for((0,t._)`;${C}--;`,()=>c.for((0,t._)`${R} = ${C}; ${R}--;`,()=>c.if((0,t._)`${I}(${u}[${C}], ${u}[${R}])`,()=>{s.error(),c.assign(x,!1).break(A)})))}}};return Og.default=i,Og}var jg={},vP;function rie(){if(vP)return jg;vP=1,Object.defineProperty(jg,"__esModule",{value:!0});const e=$t(),t=sn(),n=pN(),r={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>(0,e._)`{allowedValue: ${i}}`},code(i){const{gen:s,data:c,$data:u,schemaCode:d,schema:m}=i;u||m&&typeof m=="object"?i.fail$data((0,e._)`!${(0,t.useFunc)(s,n.default)}(${c}, ${d})`):i.fail((0,e._)`${m} !== ${c}`)}};return jg.default=r,jg}var Lg={},yP;function aie(){if(yP)return Lg;yP=1,Object.defineProperty(Lg,"__esModule",{value:!0});const e=$t(),t=sn(),n=pN(),r={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>(0,e._)`{allowedValues: ${i}}`},code(i){const{gen:s,data:c,$data:u,schema:d,schemaCode:m,it:h}=i;if(!u&&d.length===0)throw new Error("enum must have non-empty array");const g=d.length>=h.opts.loopEnum;let v;const x=()=>v??(v=(0,t.useFunc)(s,n.default));let S;if(g||u)S=s.let("valid"),i.block$data(S,y);else{if(!Array.isArray(d))throw new Error("ajv implementation error");const _=s.const("vSchema",m);S=(0,e.or)(...d.map((k,C)=>E(_,C)))}i.pass(S);function y(){s.assign(S,!1),s.forOf("v",m,_=>s.if((0,e._)`${x()}(${c}, ${_})`,()=>s.assign(S,!0).break()))}function E(_,k){const C=d[k];return typeof C=="object"&&C!==null?(0,e._)`${x()}(${c}, ${_}[${k}])`:(0,e._)`${c} === ${C}`}}};return Lg.default=r,Lg}var wP;function iie(){if(wP)return _g;wP=1,Object.defineProperty(_g,"__esModule",{value:!0});const e=Zae(),t=Yae(),n=Xae(),a=Jae(),r=Qae(),i=eie(),s=tie(),c=nie(),u=rie(),d=aie(),m=[e.default,t.default,n.default,a.default,r.default,i.default,s.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default];return _g.default=m,_g}var $g={},Hc={},SP;function LV(){if(SP)return Hc;SP=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.validateAdditionalItems=void 0;const e=$t(),t=sn(),a={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,e.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,e._)`{limit: ${i}}`},code(i){const{parentSchema:s,it:c}=i,{items:u}=s;if(!Array.isArray(u)){(0,t.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}r(i,u)}};function r(i,s){const{gen:c,schema:u,data:d,keyword:m,it:h}=i;h.items=!0;const g=c.const("len",(0,e._)`${d}.length`);if(u===!1)i.setParams({len:s.length}),i.pass((0,e._)`${g} <= ${s.length}`);else if(typeof u=="object"&&!(0,t.alwaysValidSchema)(h,u)){const x=c.var("valid",(0,e._)`${g} <= ${s.length}`);c.if((0,e.not)(x),()=>v(x)),i.ok(x)}function v(x){c.forRange("i",s.length,g,S=>{i.subschema({keyword:m,dataProp:S,dataPropType:t.Type.Num},x),h.allErrors||c.if((0,e.not)(x),()=>c.break())})}}return Hc.validateAdditionalItems=r,Hc.default=a,Hc}var Mg={},Vc={},xP;function $V(){if(xP)return Vc;xP=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.validateTuple=void 0;const e=$t(),t=sn(),n=Ri(),a={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){const{schema:s,it:c}=i;if(Array.isArray(s))return r(i,"additionalItems",s);c.items=!0,!(0,t.alwaysValidSchema)(c,s)&&i.ok((0,n.validateArray)(i))}};function r(i,s,c=i.schema){const{gen:u,parentSchema:d,data:m,keyword:h,it:g}=i;S(d),g.opts.unevaluated&&c.length&&g.items!==!0&&(g.items=t.mergeEvaluated.items(u,c.length,g.items));const v=u.name("valid"),x=u.const("len",(0,e._)`${m}.length`);c.forEach((y,E)=>{(0,t.alwaysValidSchema)(g,y)||(u.if((0,e._)`${x} > ${E}`,()=>i.subschema({keyword:h,schemaProp:E,dataProp:E},v)),i.ok(v))});function S(y){const{opts:E,errSchemaPath:_}=g,k=c.length,C=k===y.minItems&&(k===y.maxItems||y[s]===!1);if(E.strictTuples&&!C){const R=`"${h}" is ${k}-tuple, but minItems or maxItems/${s} are not specified or different at path "${_}"`;(0,t.checkStrictMode)(g,R,E.strictTuples)}}}return Vc.validateTuple=r,Vc.default=a,Vc}var _P;function oie(){if(_P)return Mg;_P=1,Object.defineProperty(Mg,"__esModule",{value:!0});const e=$V(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,e.validateTuple)(n,"items")};return Mg.default=t,Mg}var Pg={},EP;function sie(){if(EP)return Pg;EP=1,Object.defineProperty(Pg,"__esModule",{value:!0});const e=$t(),t=sn(),n=Ri(),a=LV(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,e.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,e._)`{limit: ${s}}`},code(s){const{schema:c,parentSchema:u,it:d}=s,{prefixItems:m}=u;d.items=!0,!(0,t.alwaysValidSchema)(d,c)&&(m?(0,a.validateAdditionalItems)(s,m):s.ok((0,n.validateArray)(s)))}};return Pg.default=i,Pg}var Ug={},kP;function lie(){if(kP)return Ug;kP=1,Object.defineProperty(Ug,"__esModule",{value:!0});const e=$t(),t=sn(),a={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:r,max:i}})=>i===void 0?(0,e.str)`must contain at least ${r} valid item(s)`:(0,e.str)`must contain at least ${r} and no more than ${i} valid item(s)`,params:({params:{min:r,max:i}})=>i===void 0?(0,e._)`{minContains: ${r}}`:(0,e._)`{minContains: ${r}, maxContains: ${i}}`},code(r){const{gen:i,schema:s,parentSchema:c,data:u,it:d}=r;let m,h;const{minContains:g,maxContains:v}=c;d.opts.next?(m=g===void 0?1:g,h=v):m=1;const x=i.const("len",(0,e._)`${u}.length`);if(r.setParams({min:m,max:h}),h===void 0&&m===0){(0,t.checkStrictMode)(d,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&m>h){(0,t.checkStrictMode)(d,'"minContains" > "maxContains" is always invalid'),r.fail();return}if((0,t.alwaysValidSchema)(d,s)){let k=(0,e._)`${x} >= ${m}`;h!==void 0&&(k=(0,e._)`${k} && ${x} <= ${h}`),r.pass(k);return}d.items=!0;const S=i.name("valid");h===void 0&&m===1?E(S,()=>i.if(S,()=>i.break())):m===0?(i.let(S,!0),h!==void 0&&i.if((0,e._)`${u}.length > 0`,y)):(i.let(S,!1),y()),r.result(S,()=>r.reset());function y(){const k=i.name("_valid"),C=i.let("count",0);E(k,()=>i.if(k,()=>_(C)))}function E(k,C){i.forRange("i",0,x,R=>{r.subschema({keyword:"contains",dataProp:R,dataPropType:t.Type.Num,compositeRule:!0},k),C()})}function _(k){i.code((0,e._)`${k}++`),h===void 0?i.if((0,e._)`${k} >= ${m}`,()=>i.assign(S,!0).break()):(i.if((0,e._)`${k} > ${h}`,()=>i.assign(S,!1).break()),m===1?i.assign(S,!0):i.if((0,e._)`${k} >= ${m}`,()=>i.assign(S,!0)))}}};return Ug.default=a,Ug}var KS={},TP;function cie(){return TP||(TP=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=$t(),n=sn(),a=Ri();e.error={message:({params:{property:u,depsCount:d,deps:m}})=>{const h=d===1?"property":"properties";return(0,t.str)`must have ${h} ${m} when property ${u} is present`},params:({params:{property:u,depsCount:d,deps:m,missingProperty:h}})=>(0,t._)`{property: ${u},
28
+ || ${O} === "boolean" || ${I} === null`).assign(M,(0,a._)`[${I}]`)}}}function g({gen:_,parentData:k,parentDataProperty:C},R){_.if((0,a._)`${k} !== undefined`,()=>_.assign((0,a._)`${k}[${C}]`,R))}function v(_,k,C,R=i.Correct){const I=R===i.Correct?a.operators.EQ:a.operators.NEQ;let A;switch(_){case"null":return(0,a._)`${k} ${I} null`;case"array":A=(0,a._)`Array.isArray(${k})`;break;case"object":A=(0,a._)`${k} && typeof ${k} == "object" && !Array.isArray(${k})`;break;case"integer":A=O((0,a._)`!(${k} % 1) && !isNaN(${k})`);break;case"number":A=O();break;default:return(0,a._)`typeof ${k} ${I} ${_}`}return R===i.Correct?A:(0,a.not)(A);function O(M=a.nil){return(0,a.and)((0,a._)`typeof ${k} == "number"`,M,C?(0,a._)`isFinite(${k})`:a.nil)}}Tr.checkDataType=v;function x(_,k,C,R){if(_.length===1)return v(_[0],k,C,R);let I;const A=(0,r.toHash)(_);if(A.array&&A.object){const O=(0,a._)`typeof ${k} != "object"`;I=A.null?O:(0,a._)`!${k} || ${O}`,delete A.null,delete A.array,delete A.object}else I=a.nil;A.number&&delete A.integer;for(const O in A)I=(0,a.and)(I,v(O,k,C,R));return I}Tr.checkDataTypes=x;const S={message:({schema:_})=>`must be ${_}`,params:({schema:_,schemaValue:k})=>typeof _=="string"?(0,a._)`{type: ${_}}`:(0,a._)`{type: ${k}}`};function y(_){const k=E(_);(0,n.reportError)(k,S)}Tr.reportTypeError=y;function E(_){const{gen:k,data:C,schema:R}=_,I=(0,r.schemaRefOrVal)(_,R,"type");return{gen:k,keyword:"type",data:C,schema:R.type,schemaCode:I,schemaValue:I,parentSchema:R,params:{},it:_}}return Tr}var Ff={},HM;function Rae(){if(HM)return Ff;HM=1,Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.assignDefaults=void 0;const e=$t(),t=sn();function n(r,i){const{properties:s,items:c}=r.schema;if(i==="object"&&s)for(const u in s)a(r,u,s[u].default);else i==="array"&&Array.isArray(c)&&c.forEach((u,d)=>a(r,d,u.default))}Ff.assignDefaults=n;function a(r,i,s){const{gen:c,compositeRule:u,data:d,opts:m}=r;if(s===void 0)return;const h=(0,e._)`${d}${(0,e.getProperty)(i)}`;if(u){(0,t.checkStrictMode)(r,`default is ignored for: ${h}`);return}let g=(0,e._)`${h} === undefined`;m.useDefaults==="empty"&&(g=(0,e._)`${g} || ${h} === null || ${h} === ""`),c.if(g,(0,e._)`${h} = ${(0,e.stringify)(s)}`)}return Ff}var li={},vn={},VM;function Ri(){if(VM)return vn;VM=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.validateUnion=vn.validateArray=vn.usePattern=vn.callValidateCode=vn.schemaProperties=vn.allSchemaProperties=vn.noPropertyInData=vn.propertyInData=vn.isOwnProperty=vn.hasPropFunc=vn.reportMissingProp=vn.checkMissingProp=vn.checkReportMissingProp=void 0;const e=$t(),t=sn(),n=Ks(),a=sn();function r(_,k){const{gen:C,data:R,it:I}=_;C.if(m(C,R,k,I.opts.ownProperties),()=>{_.setParams({missingProperty:(0,e._)`${k}`},!0),_.error()})}vn.checkReportMissingProp=r;function i({gen:_,data:k,it:{opts:C}},R,I){return(0,e.or)(...R.map(A=>(0,e.and)(m(_,k,A,C.ownProperties),(0,e._)`${I} = ${A}`)))}vn.checkMissingProp=i;function s(_,k){_.setParams({missingProperty:k},!0),_.error()}vn.reportMissingProp=s;function c(_){return _.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}vn.hasPropFunc=c;function u(_,k,C){return(0,e._)`${c(_)}.call(${k}, ${C})`}vn.isOwnProperty=u;function d(_,k,C,R){const I=(0,e._)`${k}${(0,e.getProperty)(C)} !== undefined`;return R?(0,e._)`${I} && ${u(_,k,C)}`:I}vn.propertyInData=d;function m(_,k,C,R){const I=(0,e._)`${k}${(0,e.getProperty)(C)} === undefined`;return R?(0,e.or)(I,(0,e.not)(u(_,k,C))):I}vn.noPropertyInData=m;function h(_){return _?Object.keys(_).filter(k=>k!=="__proto__"):[]}vn.allSchemaProperties=h;function g(_,k){return h(k).filter(C=>!(0,t.alwaysValidSchema)(_,k[C]))}vn.schemaProperties=g;function v({schemaCode:_,data:k,it:{gen:C,topSchemaRef:R,schemaPath:I,errorPath:A},it:O},M,P,B){const K=B?(0,e._)`${_}, ${k}, ${R}${I}`:k,ee=[[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,A)],[n.default.parentData,O.parentData],[n.default.parentDataProperty,O.parentDataProperty],[n.default.rootData,n.default.rootData]];O.opts.dynamicRef&&ee.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const te=(0,e._)`${K}, ${C.object(...ee)}`;return P!==e.nil?(0,e._)`${M}.call(${P}, ${te})`:(0,e._)`${M}(${te})`}vn.callValidateCode=v;const x=(0,e._)`new RegExp`;function S({gen:_,it:{opts:k}},C){const R=k.unicodeRegExp?"u":"",{regExp:I}=k.code,A=I(C,R);return _.scopeValue("pattern",{key:A.toString(),ref:A,code:(0,e._)`${I.code==="new RegExp"?x:(0,a.useFunc)(_,I)}(${C}, ${R})`})}vn.usePattern=S;function y(_){const{gen:k,data:C,keyword:R,it:I}=_,A=k.name("valid");if(I.allErrors){const M=k.let("valid",!0);return O(()=>k.assign(M,!1)),M}return k.var(A,!0),O(()=>k.break()),A;function O(M){const P=k.const("len",(0,e._)`${C}.length`);k.forRange("i",0,P,B=>{_.subschema({keyword:R,dataProp:B,dataPropType:t.Type.Num},A),k.if((0,e.not)(A),M)})}}vn.validateArray=y;function E(_){const{gen:k,schema:C,keyword:R,it:I}=_;if(!Array.isArray(C))throw new Error("ajv implementation error");if(C.some(P=>(0,t.alwaysValidSchema)(I,P))&&!I.opts.unevaluated)return;const O=k.let("valid",!1),M=k.name("_valid");k.block(()=>C.forEach((P,B)=>{const K=_.subschema({keyword:R,schemaProp:B,compositeRule:!0},M);k.assign(O,(0,e._)`${O} || ${M}`),_.mergeValidEvaluated(K,M)||k.if((0,e.not)(O))})),_.result(O,()=>_.reset(),()=>_.error(!0))}return vn.validateUnion=E,vn}var GM;function Aae(){if(GM)return li;GM=1,Object.defineProperty(li,"__esModule",{value:!0}),li.validateKeywordUsage=li.validSchemaType=li.funcKeywordCode=li.macroKeywordCode=void 0;const e=$t(),t=Ks(),n=Ri(),a=Ny();function r(g,v){const{gen:x,keyword:S,schema:y,parentSchema:E,it:_}=g,k=v.macro.call(_.self,y,E,_),C=d(x,S,k);_.opts.validateSchema!==!1&&_.self.validateSchema(k,!0);const R=x.name("valid");g.subschema({schema:k,schemaPath:e.nil,errSchemaPath:`${_.errSchemaPath}/${S}`,topSchemaRef:C,compositeRule:!0},R),g.pass(R,()=>g.error(!0))}li.macroKeywordCode=r;function i(g,v){var x;const{gen:S,keyword:y,schema:E,parentSchema:_,$data:k,it:C}=g;u(C,v);const R=!k&&v.compile?v.compile.call(C.self,E,_,C):v.validate,I=d(S,y,R),A=S.let("valid");g.block$data(A,O),g.ok((x=v.valid)!==null&&x!==void 0?x:A);function O(){if(v.errors===!1)B(),v.modifying&&s(g),K(()=>g.error());else{const ee=v.async?M():P();v.modifying&&s(g),K(()=>c(g,ee))}}function M(){const ee=S.let("ruleErrs",null);return S.try(()=>B((0,e._)`await `),te=>S.assign(A,!1).if((0,e._)`${te} instanceof ${C.ValidationError}`,()=>S.assign(ee,(0,e._)`${te}.errors`),()=>S.throw(te))),ee}function P(){const ee=(0,e._)`${I}.errors`;return S.assign(ee,null),B(e.nil),ee}function B(ee=v.async?(0,e._)`await `:e.nil){const te=C.opts.passContext?t.default.this:t.default.self,ae=!("compile"in v&&!k||v.schema===!1);S.assign(A,(0,e._)`${ee}${(0,n.callValidateCode)(g,I,te,ae)}`,v.modifying)}function K(ee){var te;S.if((0,e.not)((te=v.valid)!==null&&te!==void 0?te:A),ee)}}li.funcKeywordCode=i;function s(g){const{gen:v,data:x,it:S}=g;v.if(S.parentData,()=>v.assign(x,(0,e._)`${S.parentData}[${S.parentDataProperty}]`))}function c(g,v){const{gen:x}=g;x.if((0,e._)`Array.isArray(${v})`,()=>{x.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${v} : ${t.default.vErrors}.concat(${v})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,a.extendErrors)(g)},()=>g.error())}function u({schemaEnv:g},v){if(v.async&&!g.$async)throw new Error("async keyword in sync schema")}function d(g,v,x){if(x===void 0)throw new Error(`keyword "${v}" failed to compile`);return g.scopeValue("keyword",typeof x=="function"?{ref:x}:{ref:x,code:(0,e.stringify)(x)})}function m(g,v,x=!1){return!v.length||v.some(S=>S==="array"?Array.isArray(g):S==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==S||x&&typeof g>"u")}li.validSchemaType=m;function h({schema:g,opts:v,self:x,errSchemaPath:S},y,E){if(Array.isArray(y.keyword)?!y.keyword.includes(E):y.keyword!==E)throw new Error("ajv implementation error");const _=y.dependencies;if(_?.some(k=>!Object.prototype.hasOwnProperty.call(g,k)))throw new Error(`parent schema must have dependencies of ${E}: ${_.join(",")}`);if(y.validateSchema&&!y.validateSchema(g[E])){const C=`keyword "${E}" value is invalid at path "${S}": `+x.errorsText(y.validateSchema.errors);if(v.validateSchema==="log")x.logger.error(C);else throw new Error(C)}}return li.validateKeywordUsage=h,li}var So={},WM;function Iae(){if(WM)return So;WM=1,Object.defineProperty(So,"__esModule",{value:!0}),So.extendSubschemaMode=So.extendSubschemaData=So.getSubschema=void 0;const e=$t(),t=sn();function n(i,{keyword:s,schemaProp:c,schema:u,schemaPath:d,errSchemaPath:m,topSchemaRef:h}){if(s!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(s!==void 0){const g=i.schema[s];return c===void 0?{schema:g,schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(s)}`,errSchemaPath:`${i.errSchemaPath}/${s}`}:{schema:g[c],schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(s)}${(0,e.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${s}/${(0,t.escapeFragment)(c)}`}}if(u!==void 0){if(d===void 0||m===void 0||h===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:d,topSchemaRef:h,errSchemaPath:m}}throw new Error('either "keyword" or "schema" must be passed')}So.getSubschema=n;function a(i,s,{dataProp:c,dataPropType:u,data:d,dataTypes:m,propertyName:h}){if(d!==void 0&&c!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:g}=s;if(c!==void 0){const{errorPath:x,dataPathArr:S,opts:y}=s,E=g.let("data",(0,e._)`${s.data}${(0,e.getProperty)(c)}`,!0);v(E),i.errorPath=(0,e.str)`${x}${(0,t.getErrorPath)(c,u,y.jsPropertySyntax)}`,i.parentDataProperty=(0,e._)`${c}`,i.dataPathArr=[...S,i.parentDataProperty]}if(d!==void 0){const x=d instanceof e.Name?d:g.let("data",d,!0);v(x),h!==void 0&&(i.propertyName=h)}m&&(i.dataTypes=m);function v(x){i.data=x,i.dataLevel=s.dataLevel+1,i.dataTypes=[],s.definedProperties=new Set,i.parentData=s.data,i.dataNames=[...s.dataNames,x]}}So.extendSubschemaData=a;function r(i,{jtdDiscriminator:s,jtdMetadata:c,compositeRule:u,createErrors:d,allErrors:m}){u!==void 0&&(i.compositeRule=u),d!==void 0&&(i.createErrors=d),m!==void 0&&(i.allErrors=m),i.jtdDiscriminator=s,i.jtdMetadata=c}return So.extendSubschemaMode=r,So}var Qr={},HS,KM;function DV(){return KM||(KM=1,HS=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var a,r,i;if(Array.isArray(t)){if(a=t.length,a!=n.length)return!1;for(r=a;r--!==0;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),a=i.length,a!==Object.keys(n).length)return!1;for(r=a;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=a;r--!==0;){var s=i[r];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}),HS}var VS={exports:{}},ZM;function Oae(){if(ZM)return VS.exports;ZM=1;var e=VS.exports=function(a,r,i){typeof r=="function"&&(i=r,r={}),i=r.cb||i;var s=typeof i=="function"?i:i.pre||function(){},c=i.post||function(){};t(r,s,c,a,"",a)};e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.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 t(a,r,i,s,c,u,d,m,h,g){if(s&&typeof s=="object"&&!Array.isArray(s)){r(s,c,u,d,m,h,g);for(var v in s){var x=s[v];if(Array.isArray(x)){if(v in e.arrayKeywords)for(var S=0;S<x.length;S++)t(a,r,i,x[S],c+"/"+v+"/"+S,u,c,v,s,S)}else if(v in e.propsKeywords){if(x&&typeof x=="object")for(var y in x)t(a,r,i,x[y],c+"/"+v+"/"+n(y),u,c,v,s,y)}else(v in e.keywords||a.allKeys&&!(v in e.skipKeywords))&&t(a,r,i,x,c+"/"+v,u,c,v,s)}i(s,c,u,d,m,h,g)}}function n(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}return VS.exports}var YM;function Cy(){if(YM)return Qr;YM=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.getSchemaRefs=Qr.resolveUrl=Qr.normalizeId=Qr._getFullPath=Qr.getFullPath=Qr.inlineRef=void 0;const e=sn(),t=DV(),n=Oae(),a=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function r(S,y=!0){return typeof S=="boolean"?!0:y===!0?!s(S):y?c(S)<=y:!1}Qr.inlineRef=r;const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(S){for(const y in S){if(i.has(y))return!0;const E=S[y];if(Array.isArray(E)&&E.some(s)||typeof E=="object"&&s(E))return!0}return!1}function c(S){let y=0;for(const E in S){if(E==="$ref")return 1/0;if(y++,!a.has(E)&&(typeof S[E]=="object"&&(0,e.eachItem)(S[E],_=>y+=c(_)),y===1/0))return 1/0}return y}function u(S,y="",E){E!==!1&&(y=h(y));const _=S.parse(y);return d(S,_)}Qr.getFullPath=u;function d(S,y){return S.serialize(y).split("#")[0]+"#"}Qr._getFullPath=d;const m=/#\/?$/;function h(S){return S?S.replace(m,""):""}Qr.normalizeId=h;function g(S,y,E){return E=h(E),S.resolve(y,E)}Qr.resolveUrl=g;const v=/^[a-z_][-a-z0-9._]*$/i;function x(S,y){if(typeof S=="boolean")return{};const{schemaId:E,uriResolver:_}=this.opts,k=h(S[E]||y),C={"":k},R=u(_,k,!1),I={},A=new Set;return n(S,{allKeys:!0},(P,B,K,ee)=>{if(ee===void 0)return;const te=R+B;let ae=C[ee];typeof P[E]=="string"&&(ae=H.call(this,P[E])),Z.call(this,P.$anchor),Z.call(this,P.$dynamicAnchor),C[B]=ae;function H(G){const re=this.opts.uriResolver.resolve;if(G=h(ae?re(ae,G):G),A.has(G))throw M(G);A.add(G);let ne=this.refs[G];return typeof ne=="string"&&(ne=this.refs[ne]),typeof ne=="object"?O(P,ne.schema,G):G!==h(te)&&(G[0]==="#"?(O(P,I[G],G),I[G]=P):this.refs[G]=te),G}function Z(G){if(typeof G=="string"){if(!v.test(G))throw new Error(`invalid anchor "${G}"`);H.call(this,`#${G}`)}}}),I;function O(P,B,K){if(B!==void 0&&!t(P,B))throw M(K)}function M(P){return new Error(`reference "${P}" resolves to more than one schema`)}}return Qr.getSchemaRefs=x,Qr}var qM;function Ry(){if(qM)return yo;qM=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.getData=yo.KeywordCxt=yo.validateFunctionCode=void 0;const e=Cae(),t=fv(),n=OV(),a=fv(),r=Rae(),i=Aae(),s=Iae(),c=$t(),u=Ks(),d=Cy(),m=sn(),h=Ny();function g(J){if(R(J)&&(A(J),C(J))){y(J);return}v(J,()=>(0,e.topBoolOrEmptySchema)(J))}yo.validateFunctionCode=g;function v({gen:J,validateName:q,schema:le,schemaEnv:he,opts:oe},Ce){oe.code.es5?J.func(q,(0,c._)`${u.default.data}, ${u.default.valCxt}`,he.$async,()=>{J.code((0,c._)`"use strict"; ${_(le,oe)}`),S(J,oe),J.code(Ce)}):J.func(q,(0,c._)`${u.default.data}, ${x(oe)}`,he.$async,()=>J.code(_(le,oe)).code(Ce))}function x(J){return(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${J.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function S(J,q){J.if(u.default.valCxt,()=>{J.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),J.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),J.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),J.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),q.dynamicRef&&J.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{J.var(u.default.instancePath,(0,c._)`""`),J.var(u.default.parentData,(0,c._)`undefined`),J.var(u.default.parentDataProperty,(0,c._)`undefined`),J.var(u.default.rootData,u.default.data),q.dynamicRef&&J.var(u.default.dynamicAnchors,(0,c._)`{}`)})}function y(J){const{schema:q,opts:le,gen:he}=J;v(J,()=>{le.$comment&&q.$comment&&ee(J),P(J),he.let(u.default.vErrors,null),he.let(u.default.errors,0),le.unevaluated&&E(J),O(J),te(J)})}function E(J){const{gen:q,validateName:le}=J;J.evaluated=q.const("evaluated",(0,c._)`${le}.evaluated`),q.if((0,c._)`${J.evaluated}.dynamicProps`,()=>q.assign((0,c._)`${J.evaluated}.props`,(0,c._)`undefined`)),q.if((0,c._)`${J.evaluated}.dynamicItems`,()=>q.assign((0,c._)`${J.evaluated}.items`,(0,c._)`undefined`))}function _(J,q){const le=typeof J=="object"&&J[q.schemaId];return le&&(q.code.source||q.code.process)?(0,c._)`/*# sourceURL=${le} */`:c.nil}function k(J,q){if(R(J)&&(A(J),C(J))){I(J,q);return}(0,e.boolOrEmptySchema)(J,q)}function C({schema:J,self:q}){if(typeof J=="boolean")return!J;for(const le in J)if(q.RULES.all[le])return!0;return!1}function R(J){return typeof J.schema!="boolean"}function I(J,q){const{schema:le,gen:he,opts:oe}=J;oe.$comment&&le.$comment&&ee(J),B(J),K(J);const Ce=he.const("_errs",u.default.errors);O(J,Ce),he.var(q,(0,c._)`${Ce} === ${u.default.errors}`)}function A(J){(0,m.checkUnknownRules)(J),M(J)}function O(J,q){if(J.opts.jtd)return H(J,[],!1,q);const le=(0,t.getSchemaTypes)(J.schema),he=(0,t.coerceAndCheckDataType)(J,le);H(J,le,!he,q)}function M(J){const{schema:q,errSchemaPath:le,opts:he,self:oe}=J;q.$ref&&he.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(q,oe.RULES)&&oe.logger.warn(`$ref: keywords ignored in schema at path "${le}"`)}function P(J){const{schema:q,opts:le}=J;q.default!==void 0&&le.useDefaults&&le.strictSchema&&(0,m.checkStrictMode)(J,"default is ignored in the schema root")}function B(J){const q=J.schema[J.opts.schemaId];q&&(J.baseId=(0,d.resolveUrl)(J.opts.uriResolver,J.baseId,q))}function K(J){if(J.schema.$async&&!J.schemaEnv.$async)throw new Error("async schema in sync schema")}function ee({gen:J,schemaEnv:q,schema:le,errSchemaPath:he,opts:oe}){const Ce=le.$comment;if(oe.$comment===!0)J.code((0,c._)`${u.default.self}.logger.log(${Ce})`);else if(typeof oe.$comment=="function"){const Ve=(0,c.str)`${he}/$comment`,xe=J.scopeValue("root",{ref:q.root});J.code((0,c._)`${u.default.self}.opts.$comment(${Ce}, ${Ve}, ${xe}.schema)`)}}function te(J){const{gen:q,schemaEnv:le,validateName:he,ValidationError:oe,opts:Ce}=J;le.$async?q.if((0,c._)`${u.default.errors} === 0`,()=>q.return(u.default.data),()=>q.throw((0,c._)`new ${oe}(${u.default.vErrors})`)):(q.assign((0,c._)`${he}.errors`,u.default.vErrors),Ce.unevaluated&&ae(J),q.return((0,c._)`${u.default.errors} === 0`))}function ae({gen:J,evaluated:q,props:le,items:he}){le instanceof c.Name&&J.assign((0,c._)`${q}.props`,le),he instanceof c.Name&&J.assign((0,c._)`${q}.items`,he)}function H(J,q,le,he){const{gen:oe,schema:Ce,data:Ve,allErrors:xe,opts:Te,self:Fe}=J,{RULES:pe}=Fe;if(Ce.$ref&&(Te.ignoreKeywordsWithRef||!(0,m.schemaHasRulesButRef)(Ce,pe))){oe.block(()=>W(J,"$ref",pe.all.$ref.definition));return}Te.jtd||G(J,q),oe.block(()=>{for(const He of pe.rules)Oe(He);Oe(pe.post)});function Oe(He){(0,n.shouldUseGroup)(Ce,He)&&(He.type?(oe.if((0,a.checkDataType)(He.type,Ve,Te.strictNumbers)),Z(J,He),q.length===1&&q[0]===He.type&&le&&(oe.else(),(0,a.reportTypeError)(J)),oe.endIf()):Z(J,He),xe||oe.if((0,c._)`${u.default.errors} === ${he||0}`))}}function Z(J,q){const{gen:le,schema:he,opts:{useDefaults:oe}}=J;oe&&(0,r.assignDefaults)(J,q.type),le.block(()=>{for(const Ce of q.rules)(0,n.shouldUseRule)(he,Ce)&&W(J,Ce.keyword,Ce.definition,q.type)})}function G(J,q){J.schemaEnv.meta||!J.opts.strictTypes||(re(J,q),J.opts.allowUnionTypes||ne(J,q),j(J,J.dataTypes))}function re(J,q){if(q.length){if(!J.dataTypes.length){J.dataTypes=q;return}q.forEach(le=>{z(J.dataTypes,le)||$(J,`type "${le}" not allowed by context "${J.dataTypes.join(",")}"`)}),L(J,q)}}function ne(J,q){q.length>1&&!(q.length===2&&q.includes("null"))&&$(J,"use allowUnionTypes to allow union type keyword")}function j(J,q){const le=J.self.RULES.all;for(const he in le){const oe=le[he];if(typeof oe=="object"&&(0,n.shouldUseRule)(J.schema,oe)){const{type:Ce}=oe.definition;Ce.length&&!Ce.some(Ve=>V(q,Ve))&&$(J,`missing type "${Ce.join(",")}" for keyword "${he}"`)}}}function V(J,q){return J.includes(q)||q==="number"&&J.includes("integer")}function z(J,q){return J.includes(q)||q==="integer"&&J.includes("number")}function L(J,q){const le=[];for(const he of J.dataTypes)z(q,he)?le.push(he):q.includes("integer")&&he==="number"&&le.push("integer");J.dataTypes=le}function $(J,q){const le=J.schemaEnv.baseId+J.errSchemaPath;q+=` at "${le}" (strictTypes)`,(0,m.checkStrictMode)(J,q,J.opts.strictTypes)}class F{constructor(q,le,he){if((0,i.validateKeywordUsage)(q,le,he),this.gen=q.gen,this.allErrors=q.allErrors,this.keyword=he,this.data=q.data,this.schema=q.schema[he],this.$data=le.$data&&q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,m.schemaRefOrVal)(q,this.schema,he,this.$data),this.schemaType=le.schemaType,this.parentSchema=q.schema,this.params={},this.it=q,this.def=le,this.$data)this.schemaCode=q.gen.const("vSchema",ce(this.$data,q));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,le.schemaType,le.allowUndefined))throw new Error(`${he} value must be ${JSON.stringify(le.schemaType)}`);("code"in le?le.trackErrors:le.errors!==!1)&&(this.errsCount=q.gen.const("_errs",u.default.errors))}result(q,le,he){this.failResult((0,c.not)(q),le,he)}failResult(q,le,he){this.gen.if(q),he?he():this.error(),le?(this.gen.else(),le(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(q,le){this.failResult((0,c.not)(q),void 0,le)}fail(q){if(q===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(q),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(q){if(!this.$data)return this.fail(q);const{schemaCode:le}=this;this.fail((0,c._)`${le} !== undefined && (${(0,c.or)(this.invalid$data(),q)})`)}error(q,le,he){if(le){this.setParams(le),this._error(q,he),this.setParams({});return}this._error(q,he)}_error(q,le){(q?h.reportExtraError:h.reportError)(this,this.def.error,le)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(q){this.allErrors||this.gen.if(q)}setParams(q,le){le?Object.assign(this.params,q):this.params=q}block$data(q,le,he=c.nil){this.gen.block(()=>{this.check$data(q,he),le()})}check$data(q=c.nil,le=c.nil){if(!this.$data)return;const{gen:he,schemaCode:oe,schemaType:Ce,def:Ve}=this;he.if((0,c.or)((0,c._)`${oe} === undefined`,le)),q!==c.nil&&he.assign(q,!0),(Ce.length||Ve.validateSchema)&&(he.elseIf(this.invalid$data()),this.$dataError(),q!==c.nil&&he.assign(q,!1)),he.else()}invalid$data(){const{gen:q,schemaCode:le,schemaType:he,def:oe,it:Ce}=this;return(0,c.or)(Ve(),xe());function Ve(){if(he.length){if(!(le instanceof c.Name))throw new Error("ajv implementation error");const Te=Array.isArray(he)?he:[he];return(0,c._)`${(0,a.checkDataTypes)(Te,le,Ce.opts.strictNumbers,a.DataType.Wrong)}`}return c.nil}function xe(){if(oe.validateSchema){const Te=q.scopeValue("validate$data",{ref:oe.validateSchema});return(0,c._)`!${Te}(${le})`}return c.nil}}subschema(q,le){const he=(0,s.getSubschema)(this.it,q);(0,s.extendSubschemaData)(he,this.it,q),(0,s.extendSubschemaMode)(he,q);const oe={...this.it,...he,items:void 0,props:void 0};return k(oe,le),oe}mergeEvaluated(q,le){const{it:he,gen:oe}=this;he.opts.unevaluated&&(he.props!==!0&&q.props!==void 0&&(he.props=m.mergeEvaluated.props(oe,q.props,he.props,le)),he.items!==!0&&q.items!==void 0&&(he.items=m.mergeEvaluated.items(oe,q.items,he.items,le)))}mergeValidEvaluated(q,le){const{it:he,gen:oe}=this;if(he.opts.unevaluated&&(he.props!==!0||he.items!==!0))return oe.if(le,()=>this.mergeEvaluated(q,c.Name)),!0}}yo.KeywordCxt=F;function W(J,q,le,he){const oe=new F(J,le,q);"code"in le?le.code(oe,he):oe.$data&&le.validate?(0,i.funcKeywordCode)(oe,le):"macro"in le?(0,i.macroKeywordCode)(oe,le):(le.compile||le.validate)&&(0,i.funcKeywordCode)(oe,le)}const X=/^\/(?:[^~]|~0|~1)*$/,ie=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ce(J,{dataLevel:q,dataNames:le,dataPathArr:he}){let oe,Ce;if(J==="")return u.default.rootData;if(J[0]==="/"){if(!X.test(J))throw new Error(`Invalid JSON-pointer: ${J}`);oe=J,Ce=u.default.rootData}else{const Fe=ie.exec(J);if(!Fe)throw new Error(`Invalid JSON-pointer: ${J}`);const pe=+Fe[1];if(oe=Fe[2],oe==="#"){if(pe>=q)throw new Error(Te("property/index",pe));return he[q-pe]}if(pe>q)throw new Error(Te("data",pe));if(Ce=le[q-pe],!oe)return Ce}let Ve=Ce;const xe=oe.split("/");for(const Fe of xe)Fe&&(Ce=(0,c._)`${Ce}${(0,c.getProperty)((0,m.unescapeJsonPointer)(Fe))}`,Ve=(0,c._)`${Ve} && ${Ce}`);return Ve;function Te(Fe,pe){return`Cannot access ${Fe} ${pe} levels up, current level is ${q}`}}return yo.getData=ce,yo}var bg={},XM;function dN(){if(XM)return bg;XM=1,Object.defineProperty(bg,"__esModule",{value:!0});class e extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return bg.default=e,bg}var vg={},JM;function Ay(){if(JM)return vg;JM=1,Object.defineProperty(vg,"__esModule",{value:!0});const e=Cy();class t extends Error{constructor(a,r,i,s){super(s||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,e.resolveUrl)(a,r,i),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(a,this.missingRef))}}return vg.default=t,vg}var Ia={},QM;function fN(){if(QM)return Ia;QM=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.resolveSchema=Ia.getCompilingSchema=Ia.resolveRef=Ia.compileSchema=Ia.SchemaEnv=void 0;const e=$t(),t=dN(),n=Ks(),a=Cy(),r=sn(),i=Ry();class s{constructor(E){var _;this.refs={},this.dynamicAnchors={};let k;typeof E.schema=="object"&&(k=E.schema),this.schema=E.schema,this.schemaId=E.schemaId,this.root=E.root||this,this.baseId=(_=E.baseId)!==null&&_!==void 0?_:(0,a.normalizeId)(k?.[E.schemaId||"$id"]),this.schemaPath=E.schemaPath,this.localRefs=E.localRefs,this.meta=E.meta,this.$async=k?.$async,this.refs={}}}Ia.SchemaEnv=s;function c(y){const E=m.call(this,y);if(E)return E;const _=(0,a.getFullPath)(this.opts.uriResolver,y.root.baseId),{es5:k,lines:C}=this.opts.code,{ownProperties:R}=this.opts,I=new e.CodeGen(this.scope,{es5:k,lines:C,ownProperties:R});let A;y.$async&&(A=I.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const O=I.scopeName("validate");y.validateName=O;const M={gen:I,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:I.scopeValue("schema",this.opts.code.source===!0?{ref:y.schema,code:(0,e.stringify)(y.schema)}:{ref:y.schema}),validateName:O,ValidationError:A,schema:y.schema,schemaEnv:y,rootId:_,baseId:y.baseId||_,schemaPath:e.nil,errSchemaPath:y.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,e._)`""`,opts:this.opts,self:this};let P;try{this._compilations.add(y),(0,i.validateFunctionCode)(M),I.optimize(this.opts.code.optimize);const B=I.toString();P=`${I.scopeRefs(n.default.scope)}return ${B}`,this.opts.code.process&&(P=this.opts.code.process(P,y));const ee=new Function(`${n.default.self}`,`${n.default.scope}`,P)(this,this.scope.get());if(this.scope.value(O,{ref:ee}),ee.errors=null,ee.schema=y.schema,ee.schemaEnv=y,y.$async&&(ee.$async=!0),this.opts.code.source===!0&&(ee.source={validateName:O,validateCode:B,scopeValues:I._values}),this.opts.unevaluated){const{props:te,items:ae}=M;ee.evaluated={props:te instanceof e.Name?void 0:te,items:ae instanceof e.Name?void 0:ae,dynamicProps:te instanceof e.Name,dynamicItems:ae instanceof e.Name},ee.source&&(ee.source.evaluated=(0,e.stringify)(ee.evaluated))}return y.validate=ee,y}catch(B){throw delete y.validate,delete y.validateName,P&&this.logger.error("Error compiling schema, function code:",P),B}finally{this._compilations.delete(y)}}Ia.compileSchema=c;function u(y,E,_){var k;_=(0,a.resolveUrl)(this.opts.uriResolver,E,_);const C=y.refs[_];if(C)return C;let R=g.call(this,y,_);if(R===void 0){const I=(k=y.localRefs)===null||k===void 0?void 0:k[_],{schemaId:A}=this.opts;I&&(R=new s({schema:I,schemaId:A,root:y,baseId:E}))}if(R!==void 0)return y.refs[_]=d.call(this,R)}Ia.resolveRef=u;function d(y){return(0,a.inlineRef)(y.schema,this.opts.inlineRefs)?y.schema:y.validate?y:c.call(this,y)}function m(y){for(const E of this._compilations)if(h(E,y))return E}Ia.getCompilingSchema=m;function h(y,E){return y.schema===E.schema&&y.root===E.root&&y.baseId===E.baseId}function g(y,E){let _;for(;typeof(_=this.refs[E])=="string";)E=_;return _||this.schemas[E]||v.call(this,y,E)}function v(y,E){const _=this.opts.uriResolver.parse(E),k=(0,a._getFullPath)(this.opts.uriResolver,_);let C=(0,a.getFullPath)(this.opts.uriResolver,y.baseId,void 0);if(Object.keys(y.schema).length>0&&k===C)return S.call(this,_,y);const R=(0,a.normalizeId)(k),I=this.refs[R]||this.schemas[R];if(typeof I=="string"){const A=v.call(this,y,I);return typeof A?.schema!="object"?void 0:S.call(this,_,A)}if(typeof I?.schema=="object"){if(I.validate||c.call(this,I),R===(0,a.normalizeId)(E)){const{schema:A}=I,{schemaId:O}=this.opts,M=A[O];return M&&(C=(0,a.resolveUrl)(this.opts.uriResolver,C,M)),new s({schema:A,schemaId:O,root:y,baseId:C})}return S.call(this,_,I)}}Ia.resolveSchema=v;const x=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function S(y,{baseId:E,schema:_,root:k}){var C;if(((C=y.fragment)===null||C===void 0?void 0:C[0])!=="/")return;for(const A of y.fragment.slice(1).split("/")){if(typeof _=="boolean")return;const O=_[(0,r.unescapeFragment)(A)];if(O===void 0)return;_=O;const M=typeof _=="object"&&_[this.opts.schemaId];!x.has(A)&&M&&(E=(0,a.resolveUrl)(this.opts.uriResolver,E,M))}let R;if(typeof _!="boolean"&&_.$ref&&!(0,r.schemaHasRulesButRef)(_,this.RULES)){const A=(0,a.resolveUrl)(this.opts.uriResolver,E,_.$ref);R=v.call(this,k,A)}const{schemaId:I}=this.opts;if(R=R||new s({schema:_,schemaId:I,root:k,baseId:E}),R.schema!==R.root.schema)return R}return Ia}const Dae="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",jae="Meta-schema for $data reference (JSON AnySchema extension proposal)",Lae="object",$ae=["$data"],Mae={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Pae=!1,Uae={$id:Dae,description:jae,type:Lae,required:$ae,properties:Mae,additionalProperties:Pae};var yg={},Bf={exports:{}},GS,eP;function jV(){if(eP)return GS;eP=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(g){let v="",x=0,S=0;for(S=0;S<g.length;S++)if(x=g[S].charCodeAt(0),x!==48){if(!(x>=48&&x<=57||x>=65&&x<=70||x>=97&&x<=102))return"";v+=g[S];break}for(S+=1;S<g.length;S++){if(x=g[S].charCodeAt(0),!(x>=48&&x<=57||x>=65&&x<=70||x>=97&&x<=102))return"";v+=g[S]}return v}const a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function r(g){return g.length=0,!0}function i(g,v,x){if(g.length){const S=n(g);if(S!=="")v.push(S);else return x.error=!0,!1;g.length=0}return!0}function s(g){let v=0;const x={error:!1,address:"",zone:""},S=[],y=[];let E=!1,_=!1,k=i;for(let C=0;C<g.length;C++){const R=g[C];if(!(R==="["||R==="]"))if(R===":"){if(E===!0&&(_=!0),!k(y,S,x))break;if(++v>7){x.error=!0;break}C>0&&g[C-1]===":"&&(E=!0),S.push(":");continue}else if(R==="%"){if(!k(y,S,x))break;k=r}else{y.push(R);continue}}return y.length&&(k===r?x.zone=y.join(""):_?S.push(y.join("")):S.push(n(y))),x.address=S.join(""),x}function c(g){if(u(g,":")<2)return{host:g,isIPV6:!1};const v=s(g);if(v.error)return{host:g,isIPV6:!1};{let x=v.address,S=v.address;return v.zone&&(x+="%"+v.zone,S+="%25"+v.zone),{host:x,isIPV6:!0,escapedHost:S}}}function u(g,v){let x=0;for(let S=0;S<g.length;S++)g[S]===v&&x++;return x}function d(g){let v=g;const x=[];let S=-1,y=0;for(;y=v.length;){if(y===1){if(v===".")break;if(v==="/"){x.push("/");break}else{x.push(v);break}}else if(y===2){if(v[0]==="."){if(v[1]===".")break;if(v[1]==="/"){v=v.slice(2);continue}}else if(v[0]==="/"&&(v[1]==="."||v[1]==="/")){x.push("/");break}}else if(y===3&&v==="/.."){x.length!==0&&x.pop(),x.push("/");break}if(v[0]==="."){if(v[1]==="."){if(v[2]==="/"){v=v.slice(3);continue}}else if(v[1]==="/"){v=v.slice(2);continue}}else if(v[0]==="/"&&v[1]==="."){if(v[2]==="/"){v=v.slice(2);continue}else if(v[2]==="."&&v[3]==="/"){v=v.slice(3),x.length!==0&&x.pop();continue}}if((S=v.indexOf("/",1))===-1){x.push(v);break}else x.push(v.slice(0,S)),v=v.slice(S)}return x.join("")}function m(g,v){const x=v!==!0?escape:unescape;return g.scheme!==void 0&&(g.scheme=x(g.scheme)),g.userinfo!==void 0&&(g.userinfo=x(g.userinfo)),g.host!==void 0&&(g.host=x(g.host)),g.path!==void 0&&(g.path=x(g.path)),g.query!==void 0&&(g.query=x(g.query)),g.fragment!==void 0&&(g.fragment=x(g.fragment)),g}function h(g){const v=[];if(g.userinfo!==void 0&&(v.push(g.userinfo),v.push("@")),g.host!==void 0){let x=unescape(g.host);if(!t(x)){const S=c(x);S.isIPV6===!0?x=`[${S.escapedHost}]`:x=g.host}v.push(x)}return(typeof g.port=="number"||typeof g.port=="string")&&(v.push(":"),v.push(String(g.port))),v.length?v.join(""):void 0}return GS={nonSimpleDomain:a,recomposeAuthority:h,normalizeComponentEncoding:m,removeDotSegments:d,isIPv4:t,isUUID:e,normalizeIPv6:c,stringArrayToHexStripped:n},GS}var WS,tP;function zae(){if(tP)return WS;tP=1;const{isUUID:e}=jV(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function a(R){return n.indexOf(R)!==-1}function r(R){return R.secure===!0?!0:R.secure===!1?!1:R.scheme?R.scheme.length===3&&(R.scheme[0]==="w"||R.scheme[0]==="W")&&(R.scheme[1]==="s"||R.scheme[1]==="S")&&(R.scheme[2]==="s"||R.scheme[2]==="S"):!1}function i(R){return R.host||(R.error=R.error||"HTTP URIs must have a host."),R}function s(R){const I=String(R.scheme).toLowerCase()==="https";return(R.port===(I?443:80)||R.port==="")&&(R.port=void 0),R.path||(R.path="/"),R}function c(R){return R.secure=r(R),R.resourceName=(R.path||"/")+(R.query?"?"+R.query:""),R.path=void 0,R.query=void 0,R}function u(R){if((R.port===(r(R)?443:80)||R.port==="")&&(R.port=void 0),typeof R.secure=="boolean"&&(R.scheme=R.secure?"wss":"ws",R.secure=void 0),R.resourceName){const[I,A]=R.resourceName.split("?");R.path=I&&I!=="/"?I:void 0,R.query=A,R.resourceName=void 0}return R.fragment=void 0,R}function d(R,I){if(!R.path)return R.error="URN can not be parsed",R;const A=R.path.match(t);if(A){const O=I.scheme||R.scheme||"urn";R.nid=A[1].toLowerCase(),R.nss=A[2];const M=`${O}:${I.nid||R.nid}`,P=C(M);R.path=void 0,P&&(R=P.parse(R,I))}else R.error=R.error||"URN can not be parsed.";return R}function m(R,I){if(R.nid===void 0)throw new Error("URN without nid cannot be serialized");const A=I.scheme||R.scheme||"urn",O=R.nid.toLowerCase(),M=`${A}:${I.nid||O}`,P=C(M);P&&(R=P.serialize(R,I));const B=R,K=R.nss;return B.path=`${O||I.nid}:${K}`,I.skipEscape=!0,B}function h(R,I){const A=R;return A.uuid=A.nss,A.nss=void 0,!I.tolerant&&(!A.uuid||!e(A.uuid))&&(A.error=A.error||"UUID is not valid."),A}function g(R){const I=R;return I.nss=(R.uuid||"").toLowerCase(),I}const v={scheme:"http",domainHost:!0,parse:i,serialize:s},x={scheme:"https",domainHost:v.domainHost,parse:i,serialize:s},S={scheme:"ws",domainHost:!0,parse:c,serialize:u},y={scheme:"wss",domainHost:S.domainHost,parse:S.parse,serialize:S.serialize},k={http:v,https:x,ws:S,wss:y,urn:{scheme:"urn",parse:d,serialize:m,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:h,serialize:g,skipNormalize:!0}};Object.setPrototypeOf(k,null);function C(R){return R&&(k[R]||k[R.toLowerCase()])||void 0}return WS={wsIsSecure:r,SCHEMES:k,isValidSchemeName:a,getSchemeHandler:C},WS}var nP;function Fae(){if(nP)return Bf.exports;nP=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:a,isIPv4:r,nonSimpleDomain:i}=jV(),{SCHEMES:s,getSchemeHandler:c}=zae();function u(y,E){return typeof y=="string"?y=g(x(y,E),E):typeof y=="object"&&(y=x(g(y,E),E)),y}function d(y,E,_){const k=_?Object.assign({scheme:"null"},_):{scheme:"null"},C=m(x(y,k),x(E,k),k,!0);return k.skipEscape=!0,g(C,k)}function m(y,E,_,k){const C={};return k||(y=x(g(y,_),_),E=x(g(E,_),_)),_=_||{},!_.tolerant&&E.scheme?(C.scheme=E.scheme,C.userinfo=E.userinfo,C.host=E.host,C.port=E.port,C.path=t(E.path||""),C.query=E.query):(E.userinfo!==void 0||E.host!==void 0||E.port!==void 0?(C.userinfo=E.userinfo,C.host=E.host,C.port=E.port,C.path=t(E.path||""),C.query=E.query):(E.path?(E.path[0]==="/"?C.path=t(E.path):((y.userinfo!==void 0||y.host!==void 0||y.port!==void 0)&&!y.path?C.path="/"+E.path:y.path?C.path=y.path.slice(0,y.path.lastIndexOf("/")+1)+E.path:C.path=E.path,C.path=t(C.path)),C.query=E.query):(C.path=y.path,E.query!==void 0?C.query=E.query:C.query=y.query),C.userinfo=y.userinfo,C.host=y.host,C.port=y.port),C.scheme=y.scheme),C.fragment=E.fragment,C}function h(y,E,_){return typeof y=="string"?(y=unescape(y),y=g(a(x(y,_),!0),{..._,skipEscape:!0})):typeof y=="object"&&(y=g(a(y,!0),{..._,skipEscape:!0})),typeof E=="string"?(E=unescape(E),E=g(a(x(E,_),!0),{..._,skipEscape:!0})):typeof E=="object"&&(E=g(a(E,!0),{..._,skipEscape:!0})),y.toLowerCase()===E.toLowerCase()}function g(y,E){const _={host:y.host,scheme:y.scheme,userinfo:y.userinfo,port:y.port,path:y.path,query:y.query,nid:y.nid,nss:y.nss,uuid:y.uuid,fragment:y.fragment,reference:y.reference,resourceName:y.resourceName,secure:y.secure,error:""},k=Object.assign({},E),C=[],R=c(k.scheme||_.scheme);R&&R.serialize&&R.serialize(_,k),_.path!==void 0&&(k.skipEscape?_.path=unescape(_.path):(_.path=escape(_.path),_.scheme!==void 0&&(_.path=_.path.split("%3A").join(":")))),k.reference!=="suffix"&&_.scheme&&C.push(_.scheme,":");const I=n(_);if(I!==void 0&&(k.reference!=="suffix"&&C.push("//"),C.push(I),_.path&&_.path[0]!=="/"&&C.push("/")),_.path!==void 0){let A=_.path;!k.absolutePath&&(!R||!R.absolutePath)&&(A=t(A)),I===void 0&&A[0]==="/"&&A[1]==="/"&&(A="/%2F"+A.slice(2)),C.push(A)}return _.query!==void 0&&C.push("?",_.query),_.fragment!==void 0&&C.push("#",_.fragment),C.join("")}const v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function x(y,E){const _=Object.assign({},E),k={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let C=!1;_.reference==="suffix"&&(_.scheme?y=_.scheme+":"+y:y="//"+y);const R=y.match(v);if(R){if(k.scheme=R[1],k.userinfo=R[3],k.host=R[4],k.port=parseInt(R[5],10),k.path=R[6]||"",k.query=R[7],k.fragment=R[8],isNaN(k.port)&&(k.port=R[5]),k.host)if(r(k.host)===!1){const O=e(k.host);k.host=O.host.toLowerCase(),C=O.isIPV6}else C=!0;k.scheme===void 0&&k.userinfo===void 0&&k.host===void 0&&k.port===void 0&&k.query===void 0&&!k.path?k.reference="same-document":k.scheme===void 0?k.reference="relative":k.fragment===void 0?k.reference="absolute":k.reference="uri",_.reference&&_.reference!=="suffix"&&_.reference!==k.reference&&(k.error=k.error||"URI is not a "+_.reference+" reference.");const I=c(_.scheme||k.scheme);if(!_.unicodeSupport&&(!I||!I.unicodeSupport)&&k.host&&(_.domainHost||I&&I.domainHost)&&C===!1&&i(k.host))try{k.host=URL.domainToASCII(k.host.toLowerCase())}catch(A){k.error=k.error||"Host's domain name can not be converted to ASCII: "+A}(!I||I&&!I.skipNormalize)&&(y.indexOf("%")!==-1&&(k.scheme!==void 0&&(k.scheme=unescape(k.scheme)),k.host!==void 0&&(k.host=unescape(k.host))),k.path&&(k.path=escape(unescape(k.path))),k.fragment&&(k.fragment=encodeURI(decodeURIComponent(k.fragment)))),I&&I.parse&&I.parse(k,_)}else k.error=k.error||"URI can not be parsed.";return k}const S={SCHEMES:s,normalize:u,resolve:d,resolveComponent:m,equal:h,serialize:g,parse:x};return Bf.exports=S,Bf.exports.default=S,Bf.exports.fastUri=S,Bf.exports}var rP;function Bae(){if(rP)return yg;rP=1,Object.defineProperty(yg,"__esModule",{value:!0});const e=Fae();return e.code='require("ajv/dist/runtime/uri").default',yg.default=e,yg}var aP;function Hae(){return aP||(aP=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Ry();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=$t();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const a=dN(),r=Ay(),i=IV(),s=fN(),c=$t(),u=Cy(),d=fv(),m=sn(),h=Uae,g=Bae(),v=(ne,j)=>new RegExp(ne,j);v.code="new RegExp";const x=["removeAdditional","useDefaults","coerceTypes"],S=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},E={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},_=200;function k(ne){var j,V,z,L,$,F,W,X,ie,ce,J,q,le,he,oe,Ce,Ve,xe,Te,Fe,pe,Oe,He,Se,at;const nt=ne.strict,ft=(j=ne.code)===null||j===void 0?void 0:j.optimize,Et=ft===!0||ft===void 0?1:ft||0,pt=(z=(V=ne.code)===null||V===void 0?void 0:V.regExp)!==null&&z!==void 0?z:v,mn=(L=ne.uriResolver)!==null&&L!==void 0?L:g.default;return{strictSchema:(F=($=ne.strictSchema)!==null&&$!==void 0?$:nt)!==null&&F!==void 0?F:!0,strictNumbers:(X=(W=ne.strictNumbers)!==null&&W!==void 0?W:nt)!==null&&X!==void 0?X:!0,strictTypes:(ce=(ie=ne.strictTypes)!==null&&ie!==void 0?ie:nt)!==null&&ce!==void 0?ce:"log",strictTuples:(q=(J=ne.strictTuples)!==null&&J!==void 0?J:nt)!==null&&q!==void 0?q:"log",strictRequired:(he=(le=ne.strictRequired)!==null&&le!==void 0?le:nt)!==null&&he!==void 0?he:!1,code:ne.code?{...ne.code,optimize:Et,regExp:pt}:{optimize:Et,regExp:pt},loopRequired:(oe=ne.loopRequired)!==null&&oe!==void 0?oe:_,loopEnum:(Ce=ne.loopEnum)!==null&&Ce!==void 0?Ce:_,meta:(Ve=ne.meta)!==null&&Ve!==void 0?Ve:!0,messages:(xe=ne.messages)!==null&&xe!==void 0?xe:!0,inlineRefs:(Te=ne.inlineRefs)!==null&&Te!==void 0?Te:!0,schemaId:(Fe=ne.schemaId)!==null&&Fe!==void 0?Fe:"$id",addUsedSchema:(pe=ne.addUsedSchema)!==null&&pe!==void 0?pe:!0,validateSchema:(Oe=ne.validateSchema)!==null&&Oe!==void 0?Oe:!0,validateFormats:(He=ne.validateFormats)!==null&&He!==void 0?He:!0,unicodeRegExp:(Se=ne.unicodeRegExp)!==null&&Se!==void 0?Se:!0,int32range:(at=ne.int32range)!==null&&at!==void 0?at:!0,uriResolver:mn}}class C{constructor(j={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,j=this.opts={...j,...k(j)};const{es5:V,lines:z}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:S,es5:V,lines:z}),this.logger=K(j.logger);const L=j.validateFormats;j.validateFormats=!1,this.RULES=(0,i.getRules)(),R.call(this,y,j,"NOT SUPPORTED"),R.call(this,E,j,"DEPRECATED","warn"),this._metaOpts=P.call(this),j.formats&&O.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),j.keywords&&M.call(this,j.keywords),typeof j.meta=="object"&&this.addMetaSchema(j.meta),A.call(this),j.validateFormats=L}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:j,meta:V,schemaId:z}=this.opts;let L=h;z==="id"&&(L={...h},L.id=L.$id,delete L.$id),V&&j&&this.addMetaSchema(L,L[z],!1)}defaultMeta(){const{meta:j,schemaId:V}=this.opts;return this.opts.defaultMeta=typeof j=="object"?j[V]||j:void 0}validate(j,V){let z;if(typeof j=="string"){if(z=this.getSchema(j),!z)throw new Error(`no schema with key or ref "${j}"`)}else z=this.compile(j);const L=z(V);return"$async"in z||(this.errors=z.errors),L}compile(j,V){const z=this._addSchema(j,V);return z.validate||this._compileSchemaEnv(z)}compileAsync(j,V){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:z}=this.opts;return L.call(this,j,V);async function L(ce,J){await $.call(this,ce.$schema);const q=this._addSchema(ce,J);return q.validate||F.call(this,q)}async function $(ce){ce&&!this.getSchema(ce)&&await L.call(this,{$ref:ce},!0)}async function F(ce){try{return this._compileSchemaEnv(ce)}catch(J){if(!(J instanceof r.default))throw J;return W.call(this,J),await X.call(this,J.missingSchema),F.call(this,ce)}}function W({missingSchema:ce,missingRef:J}){if(this.refs[ce])throw new Error(`AnySchema ${ce} is loaded but ${J} cannot be resolved`)}async function X(ce){const J=await ie.call(this,ce);this.refs[ce]||await $.call(this,J.$schema),this.refs[ce]||this.addSchema(J,ce,V)}async function ie(ce){const J=this._loading[ce];if(J)return J;try{return await(this._loading[ce]=z(ce))}finally{delete this._loading[ce]}}}addSchema(j,V,z,L=this.opts.validateSchema){if(Array.isArray(j)){for(const F of j)this.addSchema(F,void 0,z,L);return this}let $;if(typeof j=="object"){const{schemaId:F}=this.opts;if($=j[F],$!==void 0&&typeof $!="string")throw new Error(`schema ${F} must be string`)}return V=(0,u.normalizeId)(V||$),this._checkUnique(V),this.schemas[V]=this._addSchema(j,z,V,L,!0),this}addMetaSchema(j,V,z=this.opts.validateSchema){return this.addSchema(j,V,!0,z),this}validateSchema(j,V){if(typeof j=="boolean")return!0;let z;if(z=j.$schema,z!==void 0&&typeof z!="string")throw new Error("$schema must be a string");if(z=z||this.opts.defaultMeta||this.defaultMeta(),!z)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const L=this.validate(z,j);if(!L&&V){const $="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error($);else throw new Error($)}return L}getSchema(j){let V;for(;typeof(V=I.call(this,j))=="string";)j=V;if(V===void 0){const{schemaId:z}=this.opts,L=new s.SchemaEnv({schema:{},schemaId:z});if(V=s.resolveSchema.call(this,L,j),!V)return;this.refs[j]=V}return V.validate||this._compileSchemaEnv(V)}removeSchema(j){if(j instanceof RegExp)return this._removeAllSchemas(this.schemas,j),this._removeAllSchemas(this.refs,j),this;switch(typeof j){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const V=I.call(this,j);return typeof V=="object"&&this._cache.delete(V.schema),delete this.schemas[j],delete this.refs[j],this}case"object":{const V=j;this._cache.delete(V);let z=j[this.opts.schemaId];return z&&(z=(0,u.normalizeId)(z),delete this.schemas[z],delete this.refs[z]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(j){for(const V of j)this.addKeyword(V);return this}addKeyword(j,V){let z;if(typeof j=="string")z=j,typeof V=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),V.keyword=z);else if(typeof j=="object"&&V===void 0){if(V=j,z=V.keyword,Array.isArray(z)&&!z.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(te.call(this,z,V),!V)return(0,m.eachItem)(z,$=>ae.call(this,$)),this;Z.call(this,V);const L={...V,type:(0,d.getJSONTypes)(V.type),schemaType:(0,d.getJSONTypes)(V.schemaType)};return(0,m.eachItem)(z,L.type.length===0?$=>ae.call(this,$,L):$=>L.type.forEach(F=>ae.call(this,$,L,F))),this}getKeyword(j){const V=this.RULES.all[j];return typeof V=="object"?V.definition:!!V}removeKeyword(j){const{RULES:V}=this;delete V.keywords[j],delete V.all[j];for(const z of V.rules){const L=z.rules.findIndex($=>$.keyword===j);L>=0&&z.rules.splice(L,1)}return this}addFormat(j,V){return typeof V=="string"&&(V=new RegExp(V)),this.formats[j]=V,this}errorsText(j=this.errors,{separator:V=", ",dataVar:z="data"}={}){return!j||j.length===0?"No errors":j.map(L=>`${z}${L.instancePath} ${L.message}`).reduce((L,$)=>L+V+$)}$dataMetaSchema(j,V){const z=this.RULES.all;j=JSON.parse(JSON.stringify(j));for(const L of V){const $=L.split("/").slice(1);let F=j;for(const W of $)F=F[W];for(const W in z){const X=z[W];if(typeof X!="object")continue;const{$data:ie}=X.definition,ce=F[W];ie&&ce&&(F[W]=re(ce))}}return j}_removeAllSchemas(j,V){for(const z in j){const L=j[z];(!V||V.test(z))&&(typeof L=="string"?delete j[z]:L&&!L.meta&&(this._cache.delete(L.schema),delete j[z]))}}_addSchema(j,V,z,L=this.opts.validateSchema,$=this.opts.addUsedSchema){let F;const{schemaId:W}=this.opts;if(typeof j=="object")F=j[W];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof j!="boolean")throw new Error("schema must be object or boolean")}let X=this._cache.get(j);if(X!==void 0)return X;z=(0,u.normalizeId)(F||z);const ie=u.getSchemaRefs.call(this,j,z);return X=new s.SchemaEnv({schema:j,schemaId:W,meta:V,baseId:z,localRefs:ie}),this._cache.set(X.schema,X),$&&!z.startsWith("#")&&(z&&this._checkUnique(z),this.refs[z]=X),L&&this.validateSchema(j,!0),X}_checkUnique(j){if(this.schemas[j]||this.refs[j])throw new Error(`schema with key or id "${j}" already exists`)}_compileSchemaEnv(j){if(j.meta?this._compileMetaSchema(j):s.compileSchema.call(this,j),!j.validate)throw new Error("ajv implementation error");return j.validate}_compileMetaSchema(j){const V=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,j)}finally{this.opts=V}}}C.ValidationError=a.default,C.MissingRefError=r.default,e.default=C;function R(ne,j,V,z="error"){for(const L in ne){const $=L;$ in j&&this.logger[z](`${V}: option ${L}. ${ne[$]}`)}}function I(ne){return ne=(0,u.normalizeId)(ne),this.schemas[ne]||this.refs[ne]}function A(){const ne=this.opts.schemas;if(ne)if(Array.isArray(ne))this.addSchema(ne);else for(const j in ne)this.addSchema(ne[j],j)}function O(){for(const ne in this.opts.formats){const j=this.opts.formats[ne];j&&this.addFormat(ne,j)}}function M(ne){if(Array.isArray(ne)){this.addVocabulary(ne);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const j in ne){const V=ne[j];V.keyword||(V.keyword=j),this.addKeyword(V)}}function P(){const ne={...this.opts};for(const j of x)delete ne[j];return ne}const B={log(){},warn(){},error(){}};function K(ne){if(ne===!1)return B;if(ne===void 0)return console;if(ne.log&&ne.warn&&ne.error)return ne;throw new Error("logger must implement log, warn and error methods")}const ee=/^[a-z_$][a-z0-9_$:-]*$/i;function te(ne,j){const{RULES:V}=this;if((0,m.eachItem)(ne,z=>{if(V.keywords[z])throw new Error(`Keyword ${z} is already defined`);if(!ee.test(z))throw new Error(`Keyword ${z} has invalid name`)}),!!j&&j.$data&&!("code"in j||"validate"in j))throw new Error('$data keyword must have "code" or "validate" function')}function ae(ne,j,V){var z;const L=j?.post;if(V&&L)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:$}=this;let F=L?$.post:$.rules.find(({type:X})=>X===V);if(F||(F={type:V,rules:[]},$.rules.push(F)),$.keywords[ne]=!0,!j)return;const W={keyword:ne,definition:{...j,type:(0,d.getJSONTypes)(j.type),schemaType:(0,d.getJSONTypes)(j.schemaType)}};j.before?H.call(this,F,W,j.before):F.rules.push(W),$.all[ne]=W,(z=j.implements)===null||z===void 0||z.forEach(X=>this.addKeyword(X))}function H(ne,j,V){const z=ne.rules.findIndex(L=>L.keyword===V);z>=0?ne.rules.splice(z,0,j):(ne.rules.push(j),this.logger.warn(`rule ${V} is not defined`))}function Z(ne){let{metaSchema:j}=ne;j!==void 0&&(ne.$data&&this.opts.$data&&(j=re(j)),ne.validateSchema=this.compile(j,!0))}const G={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function re(ne){return{anyOf:[ne,G]}}})(PS)),PS}var wg={},Sg={},xg={},iP;function Vae(){if(iP)return xg;iP=1,Object.defineProperty(xg,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return xg.default=e,xg}var bs={},oP;function Gae(){if(oP)return bs;oP=1,Object.defineProperty(bs,"__esModule",{value:!0}),bs.callRef=bs.getValidate=void 0;const e=Ay(),t=Ri(),n=$t(),a=Ks(),r=fN(),i=sn(),s={keyword:"$ref",schemaType:"string",code(d){const{gen:m,schema:h,it:g}=d,{baseId:v,schemaEnv:x,validateName:S,opts:y,self:E}=g,{root:_}=x;if((h==="#"||h==="#/")&&v===_.baseId)return C();const k=r.resolveRef.call(E,_,v,h);if(k===void 0)throw new e.default(g.opts.uriResolver,v,h);if(k instanceof r.SchemaEnv)return R(k);return I(k);function C(){if(x===_)return u(d,S,x,x.$async);const A=m.scopeValue("root",{ref:_});return u(d,(0,n._)`${A}.validate`,_,_.$async)}function R(A){const O=c(d,A);u(d,O,A,A.$async)}function I(A){const O=m.scopeValue("schema",y.code.source===!0?{ref:A,code:(0,n.stringify)(A)}:{ref:A}),M=m.name("valid"),P=d.subschema({schema:A,dataTypes:[],schemaPath:n.nil,topSchemaRef:O,errSchemaPath:h},M);d.mergeEvaluated(P),d.ok(M)}}};function c(d,m){const{gen:h}=d;return m.validate?h.scopeValue("validate",{ref:m.validate}):(0,n._)`${h.scopeValue("wrapper",{ref:m})}.validate`}bs.getValidate=c;function u(d,m,h,g){const{gen:v,it:x}=d,{allErrors:S,schemaEnv:y,opts:E}=x,_=E.passContext?a.default.this:n.nil;g?k():C();function k(){if(!y.$async)throw new Error("async schema referenced by sync schema");const A=v.let("valid");v.try(()=>{v.code((0,n._)`await ${(0,t.callValidateCode)(d,m,_)}`),I(m),S||v.assign(A,!0)},O=>{v.if((0,n._)`!(${O} instanceof ${x.ValidationError})`,()=>v.throw(O)),R(O),S||v.assign(A,!1)}),d.ok(A)}function C(){d.result((0,t.callValidateCode)(d,m,_),()=>I(m),()=>R(m))}function R(A){const O=(0,n._)`${A}.errors`;v.assign(a.default.vErrors,(0,n._)`${a.default.vErrors} === null ? ${O} : ${a.default.vErrors}.concat(${O})`),v.assign(a.default.errors,(0,n._)`${a.default.vErrors}.length`)}function I(A){var O;if(!x.opts.unevaluated)return;const M=(O=h?.validate)===null||O===void 0?void 0:O.evaluated;if(x.props!==!0)if(M&&!M.dynamicProps)M.props!==void 0&&(x.props=i.mergeEvaluated.props(v,M.props,x.props));else{const P=v.var("props",(0,n._)`${A}.evaluated.props`);x.props=i.mergeEvaluated.props(v,P,x.props,n.Name)}if(x.items!==!0)if(M&&!M.dynamicItems)M.items!==void 0&&(x.items=i.mergeEvaluated.items(v,M.items,x.items));else{const P=v.var("items",(0,n._)`${A}.evaluated.items`);x.items=i.mergeEvaluated.items(v,P,x.items,n.Name)}}}return bs.callRef=u,bs.default=s,bs}var sP;function Wae(){if(sP)return Sg;sP=1,Object.defineProperty(Sg,"__esModule",{value:!0});const e=Vae(),t=Gae(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return Sg.default=n,Sg}var _g={},Eg={},lP;function Kae(){if(lP)return Eg;lP=1,Object.defineProperty(Eg,"__esModule",{value:!0});const e=$t(),t=e.operators,n={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},a={message:({keyword:i,schemaCode:s})=>(0,e.str)`must be ${n[i].okStr} ${s}`,params:({keyword:i,schemaCode:s})=>(0,e._)`{comparison: ${n[i].okStr}, limit: ${s}}`},r={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:a,code(i){const{keyword:s,data:c,schemaCode:u}=i;i.fail$data((0,e._)`${c} ${n[s].fail} ${u} || isNaN(${c})`)}};return Eg.default=r,Eg}var kg={},cP;function Zae(){if(cP)return kg;cP=1,Object.defineProperty(kg,"__esModule",{value:!0});const e=$t(),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:a})=>(0,e.str)`must be multiple of ${a}`,params:({schemaCode:a})=>(0,e._)`{multipleOf: ${a}}`},code(a){const{gen:r,data:i,schemaCode:s,it:c}=a,u=c.opts.multipleOfPrecision,d=r.let("res"),m=u?(0,e._)`Math.abs(Math.round(${d}) - ${d}) > 1e-${u}`:(0,e._)`${d} !== parseInt(${d})`;a.fail$data((0,e._)`(${s} === 0 || (${d} = ${i}/${s}, ${m}))`)}};return kg.default=n,kg}var Tg={},Ng={},uP;function Yae(){if(uP)return Ng;uP=1,Object.defineProperty(Ng,"__esModule",{value:!0});function e(t){const n=t.length;let a=0,r=0,i;for(;r<n;)a++,i=t.charCodeAt(r++),i>=55296&&i<=56319&&r<n&&(i=t.charCodeAt(r),(i&64512)===56320&&r++);return a}return Ng.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Ng}var dP;function qae(){if(dP)return Tg;dP=1,Object.defineProperty(Tg,"__esModule",{value:!0});const e=$t(),t=sn(),n=Yae(),r={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:i,schemaCode:s}){const c=i==="maxLength"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${s} characters`},params:({schemaCode:i})=>(0,e._)`{limit: ${i}}`},code(i){const{keyword:s,data:c,schemaCode:u,it:d}=i,m=s==="maxLength"?e.operators.GT:e.operators.LT,h=d.opts.unicode===!1?(0,e._)`${c}.length`:(0,e._)`${(0,t.useFunc)(i.gen,n.default)}(${c})`;i.fail$data((0,e._)`${h} ${m} ${u}`)}};return Tg.default=r,Tg}var Cg={},fP;function Xae(){if(fP)return Cg;fP=1,Object.defineProperty(Cg,"__esModule",{value:!0});const e=Ri(),t=$t(),a={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,t.str)`must match pattern "${r}"`,params:({schemaCode:r})=>(0,t._)`{pattern: ${r}}`},code(r){const{data:i,$data:s,schema:c,schemaCode:u,it:d}=r,m=d.opts.unicodeRegExp?"u":"",h=s?(0,t._)`(new RegExp(${u}, ${m}))`:(0,e.usePattern)(r,c);r.fail$data((0,t._)`!${h}.test(${i})`)}};return Cg.default=a,Cg}var Rg={},pP;function Jae(){if(pP)return Rg;pP=1,Object.defineProperty(Rg,"__esModule",{value:!0});const e=$t(),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:a,schemaCode:r}){const i=a==="maxProperties"?"more":"fewer";return(0,e.str)`must NOT have ${i} than ${r} properties`},params:({schemaCode:a})=>(0,e._)`{limit: ${a}}`},code(a){const{keyword:r,data:i,schemaCode:s}=a,c=r==="maxProperties"?e.operators.GT:e.operators.LT;a.fail$data((0,e._)`Object.keys(${i}).length ${c} ${s}`)}};return Rg.default=n,Rg}var Ag={},mP;function Qae(){if(mP)return Ag;mP=1,Object.defineProperty(Ag,"__esModule",{value:!0});const e=Ri(),t=$t(),n=sn(),r={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>(0,t.str)`must have required property '${i}'`,params:({params:{missingProperty:i}})=>(0,t._)`{missingProperty: ${i}}`},code(i){const{gen:s,schema:c,schemaCode:u,data:d,$data:m,it:h}=i,{opts:g}=h;if(!m&&c.length===0)return;const v=c.length>=g.loopRequired;if(h.allErrors?x():S(),g.strictRequired){const _=i.parentSchema.properties,{definedProperties:k}=i.it;for(const C of c)if(_?.[C]===void 0&&!k.has(C)){const R=h.schemaEnv.baseId+h.errSchemaPath,I=`required property "${C}" is not defined at "${R}" (strictRequired)`;(0,n.checkStrictMode)(h,I,h.opts.strictRequired)}}function x(){if(v||m)i.block$data(t.nil,y);else for(const _ of c)(0,e.checkReportMissingProp)(i,_)}function S(){const _=s.let("missing");if(v||m){const k=s.let("valid",!0);i.block$data(k,()=>E(_,k)),i.ok(k)}else s.if((0,e.checkMissingProp)(i,c,_)),(0,e.reportMissingProp)(i,_),s.else()}function y(){s.forOf("prop",u,_=>{i.setParams({missingProperty:_}),s.if((0,e.noPropertyInData)(s,d,_,g.ownProperties),()=>i.error())})}function E(_,k){i.setParams({missingProperty:_}),s.forOf(_,u,()=>{s.assign(k,(0,e.propertyInData)(s,d,_,g.ownProperties)),s.if((0,t.not)(k),()=>{i.error(),s.break()})},t.nil)}}};return Ag.default=r,Ag}var Ig={},hP;function eie(){if(hP)return Ig;hP=1,Object.defineProperty(Ig,"__esModule",{value:!0});const e=$t(),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:a,schemaCode:r}){const i=a==="maxItems"?"more":"fewer";return(0,e.str)`must NOT have ${i} than ${r} items`},params:({schemaCode:a})=>(0,e._)`{limit: ${a}}`},code(a){const{keyword:r,data:i,schemaCode:s}=a,c=r==="maxItems"?e.operators.GT:e.operators.LT;a.fail$data((0,e._)`${i}.length ${c} ${s}`)}};return Ig.default=n,Ig}var Og={},Dg={},gP;function pN(){if(gP)return Dg;gP=1,Object.defineProperty(Dg,"__esModule",{value:!0});const e=DV();return e.code='require("ajv/dist/runtime/equal").default',Dg.default=e,Dg}var bP;function tie(){if(bP)return Og;bP=1,Object.defineProperty(Og,"__esModule",{value:!0});const e=fv(),t=$t(),n=sn(),a=pN(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:s,j:c}})=>(0,t.str)`must NOT have duplicate items (items ## ${c} and ${s} are identical)`,params:({params:{i:s,j:c}})=>(0,t._)`{i: ${s}, j: ${c}}`},code(s){const{gen:c,data:u,$data:d,schema:m,parentSchema:h,schemaCode:g,it:v}=s;if(!d&&!m)return;const x=c.let("valid"),S=h.items?(0,e.getSchemaTypes)(h.items):[];s.block$data(x,y,(0,t._)`${g} === false`),s.ok(x);function y(){const C=c.let("i",(0,t._)`${u}.length`),R=c.let("j");s.setParams({i:C,j:R}),c.assign(x,!0),c.if((0,t._)`${C} > 1`,()=>(E()?_:k)(C,R))}function E(){return S.length>0&&!S.some(C=>C==="object"||C==="array")}function _(C,R){const I=c.name("item"),A=(0,e.checkDataTypes)(S,I,v.opts.strictNumbers,e.DataType.Wrong),O=c.const("indices",(0,t._)`{}`);c.for((0,t._)`;${C}--;`,()=>{c.let(I,(0,t._)`${u}[${C}]`),c.if(A,(0,t._)`continue`),S.length>1&&c.if((0,t._)`typeof ${I} == "string"`,(0,t._)`${I} += "_"`),c.if((0,t._)`typeof ${O}[${I}] == "number"`,()=>{c.assign(R,(0,t._)`${O}[${I}]`),s.error(),c.assign(x,!1).break()}).code((0,t._)`${O}[${I}] = ${C}`)})}function k(C,R){const I=(0,n.useFunc)(c,a.default),A=c.name("outer");c.label(A).for((0,t._)`;${C}--;`,()=>c.for((0,t._)`${R} = ${C}; ${R}--;`,()=>c.if((0,t._)`${I}(${u}[${C}], ${u}[${R}])`,()=>{s.error(),c.assign(x,!1).break(A)})))}}};return Og.default=i,Og}var jg={},vP;function nie(){if(vP)return jg;vP=1,Object.defineProperty(jg,"__esModule",{value:!0});const e=$t(),t=sn(),n=pN(),r={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>(0,e._)`{allowedValue: ${i}}`},code(i){const{gen:s,data:c,$data:u,schemaCode:d,schema:m}=i;u||m&&typeof m=="object"?i.fail$data((0,e._)`!${(0,t.useFunc)(s,n.default)}(${c}, ${d})`):i.fail((0,e._)`${m} !== ${c}`)}};return jg.default=r,jg}var Lg={},yP;function rie(){if(yP)return Lg;yP=1,Object.defineProperty(Lg,"__esModule",{value:!0});const e=$t(),t=sn(),n=pN(),r={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>(0,e._)`{allowedValues: ${i}}`},code(i){const{gen:s,data:c,$data:u,schema:d,schemaCode:m,it:h}=i;if(!u&&d.length===0)throw new Error("enum must have non-empty array");const g=d.length>=h.opts.loopEnum;let v;const x=()=>v??(v=(0,t.useFunc)(s,n.default));let S;if(g||u)S=s.let("valid"),i.block$data(S,y);else{if(!Array.isArray(d))throw new Error("ajv implementation error");const _=s.const("vSchema",m);S=(0,e.or)(...d.map((k,C)=>E(_,C)))}i.pass(S);function y(){s.assign(S,!1),s.forOf("v",m,_=>s.if((0,e._)`${x()}(${c}, ${_})`,()=>s.assign(S,!0).break()))}function E(_,k){const C=d[k];return typeof C=="object"&&C!==null?(0,e._)`${x()}(${c}, ${_}[${k}])`:(0,e._)`${c} === ${C}`}}};return Lg.default=r,Lg}var wP;function aie(){if(wP)return _g;wP=1,Object.defineProperty(_g,"__esModule",{value:!0});const e=Kae(),t=Zae(),n=qae(),a=Xae(),r=Jae(),i=Qae(),s=eie(),c=tie(),u=nie(),d=rie(),m=[e.default,t.default,n.default,a.default,r.default,i.default,s.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default];return _g.default=m,_g}var $g={},Hc={},SP;function LV(){if(SP)return Hc;SP=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.validateAdditionalItems=void 0;const e=$t(),t=sn(),a={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,e.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,e._)`{limit: ${i}}`},code(i){const{parentSchema:s,it:c}=i,{items:u}=s;if(!Array.isArray(u)){(0,t.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}r(i,u)}};function r(i,s){const{gen:c,schema:u,data:d,keyword:m,it:h}=i;h.items=!0;const g=c.const("len",(0,e._)`${d}.length`);if(u===!1)i.setParams({len:s.length}),i.pass((0,e._)`${g} <= ${s.length}`);else if(typeof u=="object"&&!(0,t.alwaysValidSchema)(h,u)){const x=c.var("valid",(0,e._)`${g} <= ${s.length}`);c.if((0,e.not)(x),()=>v(x)),i.ok(x)}function v(x){c.forRange("i",s.length,g,S=>{i.subschema({keyword:m,dataProp:S,dataPropType:t.Type.Num},x),h.allErrors||c.if((0,e.not)(x),()=>c.break())})}}return Hc.validateAdditionalItems=r,Hc.default=a,Hc}var Mg={},Vc={},xP;function $V(){if(xP)return Vc;xP=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.validateTuple=void 0;const e=$t(),t=sn(),n=Ri(),a={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){const{schema:s,it:c}=i;if(Array.isArray(s))return r(i,"additionalItems",s);c.items=!0,!(0,t.alwaysValidSchema)(c,s)&&i.ok((0,n.validateArray)(i))}};function r(i,s,c=i.schema){const{gen:u,parentSchema:d,data:m,keyword:h,it:g}=i;S(d),g.opts.unevaluated&&c.length&&g.items!==!0&&(g.items=t.mergeEvaluated.items(u,c.length,g.items));const v=u.name("valid"),x=u.const("len",(0,e._)`${m}.length`);c.forEach((y,E)=>{(0,t.alwaysValidSchema)(g,y)||(u.if((0,e._)`${x} > ${E}`,()=>i.subschema({keyword:h,schemaProp:E,dataProp:E},v)),i.ok(v))});function S(y){const{opts:E,errSchemaPath:_}=g,k=c.length,C=k===y.minItems&&(k===y.maxItems||y[s]===!1);if(E.strictTuples&&!C){const R=`"${h}" is ${k}-tuple, but minItems or maxItems/${s} are not specified or different at path "${_}"`;(0,t.checkStrictMode)(g,R,E.strictTuples)}}}return Vc.validateTuple=r,Vc.default=a,Vc}var _P;function iie(){if(_P)return Mg;_P=1,Object.defineProperty(Mg,"__esModule",{value:!0});const e=$V(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,e.validateTuple)(n,"items")};return Mg.default=t,Mg}var Pg={},EP;function oie(){if(EP)return Pg;EP=1,Object.defineProperty(Pg,"__esModule",{value:!0});const e=$t(),t=sn(),n=Ri(),a=LV(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,e.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,e._)`{limit: ${s}}`},code(s){const{schema:c,parentSchema:u,it:d}=s,{prefixItems:m}=u;d.items=!0,!(0,t.alwaysValidSchema)(d,c)&&(m?(0,a.validateAdditionalItems)(s,m):s.ok((0,n.validateArray)(s)))}};return Pg.default=i,Pg}var Ug={},kP;function sie(){if(kP)return Ug;kP=1,Object.defineProperty(Ug,"__esModule",{value:!0});const e=$t(),t=sn(),a={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:r,max:i}})=>i===void 0?(0,e.str)`must contain at least ${r} valid item(s)`:(0,e.str)`must contain at least ${r} and no more than ${i} valid item(s)`,params:({params:{min:r,max:i}})=>i===void 0?(0,e._)`{minContains: ${r}}`:(0,e._)`{minContains: ${r}, maxContains: ${i}}`},code(r){const{gen:i,schema:s,parentSchema:c,data:u,it:d}=r;let m,h;const{minContains:g,maxContains:v}=c;d.opts.next?(m=g===void 0?1:g,h=v):m=1;const x=i.const("len",(0,e._)`${u}.length`);if(r.setParams({min:m,max:h}),h===void 0&&m===0){(0,t.checkStrictMode)(d,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&m>h){(0,t.checkStrictMode)(d,'"minContains" > "maxContains" is always invalid'),r.fail();return}if((0,t.alwaysValidSchema)(d,s)){let k=(0,e._)`${x} >= ${m}`;h!==void 0&&(k=(0,e._)`${k} && ${x} <= ${h}`),r.pass(k);return}d.items=!0;const S=i.name("valid");h===void 0&&m===1?E(S,()=>i.if(S,()=>i.break())):m===0?(i.let(S,!0),h!==void 0&&i.if((0,e._)`${u}.length > 0`,y)):(i.let(S,!1),y()),r.result(S,()=>r.reset());function y(){const k=i.name("_valid"),C=i.let("count",0);E(k,()=>i.if(k,()=>_(C)))}function E(k,C){i.forRange("i",0,x,R=>{r.subschema({keyword:"contains",dataProp:R,dataPropType:t.Type.Num,compositeRule:!0},k),C()})}function _(k){i.code((0,e._)`${k}++`),h===void 0?i.if((0,e._)`${k} >= ${m}`,()=>i.assign(S,!0).break()):(i.if((0,e._)`${k} > ${h}`,()=>i.assign(S,!1).break()),m===1?i.assign(S,!0):i.if((0,e._)`${k} >= ${m}`,()=>i.assign(S,!0)))}}};return Ug.default=a,Ug}var KS={},TP;function lie(){return TP||(TP=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=$t(),n=sn(),a=Ri();e.error={message:({params:{property:u,depsCount:d,deps:m}})=>{const h=d===1?"property":"properties";return(0,t.str)`must have ${h} ${m} when property ${u} is present`},params:({params:{property:u,depsCount:d,deps:m,missingProperty:h}})=>(0,t._)`{property: ${u},
29
29
  missingProperty: ${h},
30
30
  depsCount: ${d},
31
- deps: ${m}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[d,m]=i(u);s(u,d),c(u,m)}};function i({schema:u}){const d={},m={};for(const h in u){if(h==="__proto__")continue;const g=Array.isArray(u[h])?d:m;g[h]=u[h]}return[d,m]}function s(u,d=u.schema){const{gen:m,data:h,it:g}=u;if(Object.keys(d).length===0)return;const v=m.let("missing");for(const x in d){const S=d[x];if(S.length===0)continue;const y=(0,a.propertyInData)(m,h,x,g.opts.ownProperties);u.setParams({property:x,depsCount:S.length,deps:S.join(", ")}),g.allErrors?m.if(y,()=>{for(const E of S)(0,a.checkReportMissingProp)(u,E)}):(m.if((0,t._)`${y} && (${(0,a.checkMissingProp)(u,S,v)})`),(0,a.reportMissingProp)(u,v),m.else())}}e.validatePropertyDeps=s;function c(u,d=u.schema){const{gen:m,data:h,keyword:g,it:v}=u,x=m.name("valid");for(const S in d)(0,n.alwaysValidSchema)(v,d[S])||(m.if((0,a.propertyInData)(m,h,S,v.opts.ownProperties),()=>{const y=u.subschema({keyword:g,schemaProp:S},x);u.mergeValidEvaluated(y,x)},()=>m.var(x,!0)),u.ok(x))}e.validateSchemaDeps=c,e.default=r})(KS)),KS}var zg={},NP;function uie(){if(NP)return zg;NP=1,Object.defineProperty(zg,"__esModule",{value:!0});const e=$t(),t=sn(),a={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:r})=>(0,e._)`{propertyName: ${r.propertyName}}`},code(r){const{gen:i,schema:s,data:c,it:u}=r;if((0,t.alwaysValidSchema)(u,s))return;const d=i.name("valid");i.forIn("key",c,m=>{r.setParams({propertyName:m}),r.subschema({keyword:"propertyNames",data:m,dataTypes:["string"],propertyName:m,compositeRule:!0},d),i.if((0,e.not)(d),()=>{r.error(!0),u.allErrors||i.break()})}),r.ok(d)}};return zg.default=a,zg}var Fg={},CP;function MV(){if(CP)return Fg;CP=1,Object.defineProperty(Fg,"__esModule",{value:!0});const e=Ri(),t=$t(),n=Ks(),a=sn(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:s})=>(0,t._)`{additionalProperty: ${s.additionalProperty}}`},code(s){const{gen:c,schema:u,parentSchema:d,data:m,errsCount:h,it:g}=s;if(!h)throw new Error("ajv implementation error");const{allErrors:v,opts:x}=g;if(g.props=!0,x.removeAdditional!=="all"&&(0,a.alwaysValidSchema)(g,u))return;const S=(0,e.allSchemaProperties)(d.properties),y=(0,e.allSchemaProperties)(d.patternProperties);E(),s.ok((0,t._)`${h} === ${n.default.errors}`);function E(){c.forIn("key",m,I=>{!S.length&&!y.length?C(I):c.if(_(I),()=>C(I))})}function _(I){let A;if(S.length>8){const O=(0,a.schemaRefOrVal)(g,d.properties,"properties");A=(0,e.isOwnProperty)(c,O,I)}else S.length?A=(0,t.or)(...S.map(O=>(0,t._)`${I} === ${O}`)):A=t.nil;return y.length&&(A=(0,t.or)(A,...y.map(O=>(0,t._)`${(0,e.usePattern)(s,O)}.test(${I})`))),(0,t.not)(A)}function k(I){c.code((0,t._)`delete ${m}[${I}]`)}function C(I){if(x.removeAdditional==="all"||x.removeAdditional&&u===!1){k(I);return}if(u===!1){s.setParams({additionalProperty:I}),s.error(),v||c.break();return}if(typeof u=="object"&&!(0,a.alwaysValidSchema)(g,u)){const A=c.name("valid");x.removeAdditional==="failing"?(R(I,A,!1),c.if((0,t.not)(A),()=>{s.reset(),k(I)})):(R(I,A),v||c.if((0,t.not)(A),()=>c.break()))}}function R(I,A,O){const M={keyword:"additionalProperties",dataProp:I,dataPropType:a.Type.Str};O===!1&&Object.assign(M,{compositeRule:!0,createErrors:!1,allErrors:!1}),s.subschema(M,A)}}};return Fg.default=i,Fg}var Bg={},RP;function die(){if(RP)return Bg;RP=1,Object.defineProperty(Bg,"__esModule",{value:!0});const e=Ry(),t=Ri(),n=sn(),a=MV(),r={keyword:"properties",type:"object",schemaType:"object",code(i){const{gen:s,schema:c,parentSchema:u,data:d,it:m}=i;m.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&a.default.code(new e.KeywordCxt(m,a.default,"additionalProperties"));const h=(0,t.allSchemaProperties)(c);for(const y of h)m.definedProperties.add(y);m.opts.unevaluated&&h.length&&m.props!==!0&&(m.props=n.mergeEvaluated.props(s,(0,n.toHash)(h),m.props));const g=h.filter(y=>!(0,n.alwaysValidSchema)(m,c[y]));if(g.length===0)return;const v=s.name("valid");for(const y of g)x(y)?S(y):(s.if((0,t.propertyInData)(s,d,y,m.opts.ownProperties)),S(y),m.allErrors||s.else().var(v,!0),s.endIf()),i.it.definedProperties.add(y),i.ok(v);function x(y){return m.opts.useDefaults&&!m.compositeRule&&c[y].default!==void 0}function S(y){i.subschema({keyword:"properties",schemaProp:y,dataProp:y},v)}}};return Bg.default=r,Bg}var Hg={},AP;function fie(){if(AP)return Hg;AP=1,Object.defineProperty(Hg,"__esModule",{value:!0});const e=Ri(),t=$t(),n=sn(),a=sn(),r={keyword:"patternProperties",type:"object",schemaType:"object",code(i){const{gen:s,schema:c,data:u,parentSchema:d,it:m}=i,{opts:h}=m,g=(0,e.allSchemaProperties)(c),v=g.filter(C=>(0,n.alwaysValidSchema)(m,c[C]));if(g.length===0||v.length===g.length&&(!m.opts.unevaluated||m.props===!0))return;const x=h.strictSchema&&!h.allowMatchingProperties&&d.properties,S=s.name("valid");m.props!==!0&&!(m.props instanceof t.Name)&&(m.props=(0,a.evaluatedPropsToName)(s,m.props));const{props:y}=m;E();function E(){for(const C of g)x&&_(C),m.allErrors?k(C):(s.var(S,!0),k(C),s.if(S))}function _(C){for(const R in x)new RegExp(C).test(R)&&(0,n.checkStrictMode)(m,`property ${R} matches pattern ${C} (use allowMatchingProperties)`)}function k(C){s.forIn("key",u,R=>{s.if((0,t._)`${(0,e.usePattern)(i,C)}.test(${R})`,()=>{const I=v.includes(C);I||i.subschema({keyword:"patternProperties",schemaProp:C,dataProp:R,dataPropType:a.Type.Str},S),m.opts.unevaluated&&y!==!0?s.assign((0,t._)`${y}[${R}]`,!0):!I&&!m.allErrors&&s.if((0,t.not)(S),()=>s.break())})})}}};return Hg.default=r,Hg}var Vg={},IP;function pie(){if(IP)return Vg;IP=1,Object.defineProperty(Vg,"__esModule",{value:!0});const e=sn(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:a,schema:r,it:i}=n;if((0,e.alwaysValidSchema)(i,r)){n.fail();return}const s=a.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),n.failResult(s,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return Vg.default=t,Vg}var Gg={},OP;function mie(){if(OP)return Gg;OP=1,Object.defineProperty(Gg,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ri().validateUnion,error:{message:"must match a schema in anyOf"}};return Gg.default=t,Gg}var Wg={},DP;function hie(){if(DP)return Wg;DP=1,Object.defineProperty(Wg,"__esModule",{value:!0});const e=$t(),t=sn(),a={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:r})=>(0,e._)`{passingSchemas: ${r.passing}}`},code(r){const{gen:i,schema:s,parentSchema:c,it:u}=r;if(!Array.isArray(s))throw new Error("ajv implementation error");if(u.opts.discriminator&&c.discriminator)return;const d=s,m=i.let("valid",!1),h=i.let("passing",null),g=i.name("_valid");r.setParams({passing:h}),i.block(v),r.result(m,()=>r.reset(),()=>r.error(!0));function v(){d.forEach((x,S)=>{let y;(0,t.alwaysValidSchema)(u,x)?i.var(g,!0):y=r.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},g),S>0&&i.if((0,e._)`${g} && ${m}`).assign(m,!1).assign(h,(0,e._)`[${h}, ${S}]`).else(),i.if(g,()=>{i.assign(m,!0),i.assign(h,S),y&&r.mergeEvaluated(y,e.Name)})})}}};return Wg.default=a,Wg}var Kg={},jP;function gie(){if(jP)return Kg;jP=1,Object.defineProperty(Kg,"__esModule",{value:!0});const e=sn(),t={keyword:"allOf",schemaType:"array",code(n){const{gen:a,schema:r,it:i}=n;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=a.name("valid");r.forEach((c,u)=>{if((0,e.alwaysValidSchema)(i,c))return;const d=n.subschema({keyword:"allOf",schemaProp:u},s);n.ok(s),n.mergeEvaluated(d)})}};return Kg.default=t,Kg}var Zg={},LP;function bie(){if(LP)return Zg;LP=1,Object.defineProperty(Zg,"__esModule",{value:!0});const e=$t(),t=sn(),a={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,e.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,e._)`{failingKeyword: ${i.ifClause}}`},code(i){const{gen:s,parentSchema:c,it:u}=i;c.then===void 0&&c.else===void 0&&(0,t.checkStrictMode)(u,'"if" without "then" and "else" is ignored');const d=r(u,"then"),m=r(u,"else");if(!d&&!m)return;const h=s.let("valid",!0),g=s.name("_valid");if(v(),i.reset(),d&&m){const S=s.let("ifClause");i.setParams({ifClause:S}),s.if(g,x("then",S),x("else",S))}else d?s.if(g,x("then")):s.if((0,e.not)(g),x("else"));i.pass(h,()=>i.error(!0));function v(){const S=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},g);i.mergeEvaluated(S)}function x(S,y){return()=>{const E=i.subschema({keyword:S},g);s.assign(h,g),i.mergeValidEvaluated(E,h),y?s.assign(y,(0,e._)`${S}`):i.setParams({ifClause:S})}}}};function r(i,s){const c=i.schema[s];return c!==void 0&&!(0,t.alwaysValidSchema)(i,c)}return Zg.default=a,Zg}var Yg={},$P;function vie(){if($P)return Yg;$P=1,Object.defineProperty(Yg,"__esModule",{value:!0});const e=sn(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:a,it:r}){a.if===void 0&&(0,e.checkStrictMode)(r,`"${n}" without "if" is ignored`)}};return Yg.default=t,Yg}var MP;function yie(){if(MP)return $g;MP=1,Object.defineProperty($g,"__esModule",{value:!0});const e=LV(),t=oie(),n=$V(),a=sie(),r=lie(),i=cie(),s=uie(),c=MV(),u=die(),d=fie(),m=pie(),h=mie(),g=hie(),v=gie(),x=bie(),S=vie();function y(E=!1){const _=[m.default,h.default,g.default,v.default,x.default,S.default,s.default,c.default,i.default,u.default,d.default];return E?_.push(t.default,a.default):_.push(e.default,n.default),_.push(r.default),_}return $g.default=y,$g}var qg={},Xg={},PP;function wie(){if(PP)return Xg;PP=1,Object.defineProperty(Xg,"__esModule",{value:!0});const e=$t(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:a})=>(0,e.str)`must match format "${a}"`,params:({schemaCode:a})=>(0,e._)`{format: ${a}}`},code(a,r){const{gen:i,data:s,$data:c,schema:u,schemaCode:d,it:m}=a,{opts:h,errSchemaPath:g,schemaEnv:v,self:x}=m;if(!h.validateFormats)return;c?S():y();function S(){const E=i.scopeValue("formats",{ref:x.formats,code:h.code.formats}),_=i.const("fDef",(0,e._)`${E}[${d}]`),k=i.let("fType"),C=i.let("format");i.if((0,e._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>i.assign(k,(0,e._)`${_}.type || "string"`).assign(C,(0,e._)`${_}.validate`),()=>i.assign(k,(0,e._)`"string"`).assign(C,_)),a.fail$data((0,e.or)(R(),I()));function R(){return h.strictSchema===!1?e.nil:(0,e._)`${d} && !${C}`}function I(){const A=v.$async?(0,e._)`(${_}.async ? await ${C}(${s}) : ${C}(${s}))`:(0,e._)`${C}(${s})`,O=(0,e._)`(typeof ${C} == "function" ? ${A} : ${C}.test(${s}))`;return(0,e._)`${C} && ${C} !== true && ${k} === ${r} && !${O}`}}function y(){const E=x.formats[u];if(!E){R();return}if(E===!0)return;const[_,k,C]=I(E);_===r&&a.pass(A());function R(){if(h.strictSchema===!1){x.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${u}" ignored in schema at path "${g}"`}}function I(O){const M=O instanceof RegExp?(0,e.regexpCode)(O):h.code.formats?(0,e._)`${h.code.formats}${(0,e.getProperty)(u)}`:void 0,P=i.scopeValue("formats",{key:u,ref:O,code:M});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,e._)`${P}.validate`]:["string",O,P]}function A(){if(typeof E=="object"&&!(E instanceof RegExp)&&E.async){if(!v.$async)throw new Error("async format in sync schema");return(0,e._)`await ${C}(${s})`}return typeof k=="function"?(0,e._)`${C}(${s})`:(0,e._)`${C}.test(${s})`}}}};return Xg.default=n,Xg}var UP;function Sie(){if(UP)return qg;UP=1,Object.defineProperty(qg,"__esModule",{value:!0});const t=[wie().default];return qg.default=t,qg}var yl={},zP;function xie(){return zP||(zP=1,Object.defineProperty(yl,"__esModule",{value:!0}),yl.contentVocabulary=yl.metadataVocabulary=void 0,yl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],yl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),yl}var FP;function _ie(){if(FP)return wg;FP=1,Object.defineProperty(wg,"__esModule",{value:!0});const e=Kae(),t=iie(),n=yie(),a=Sie(),r=xie(),i=[e.default,t.default,(0,n.default)(),a.default,r.metadataVocabulary,r.contentVocabulary];return wg.default=i,wg}var Jg={},Hf={},BP;function Eie(){if(BP)return Hf;BP=1,Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(Hf.DiscrError=e={})),Hf}var HP;function kie(){if(HP)return Jg;HP=1,Object.defineProperty(Jg,"__esModule",{value:!0});const e=$t(),t=Eie(),n=fN(),a=Ay(),r=sn(),s={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:u}})=>c===t.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:c,tag:u,tagName:d}})=>(0,e._)`{error: ${c}, tag: ${d}, tagValue: ${u}}`},code(c){const{gen:u,data:d,schema:m,parentSchema:h,it:g}=c,{oneOf:v}=h;if(!g.opts.discriminator)throw new Error("discriminator: requires discriminator option");const x=m.propertyName;if(typeof x!="string")throw new Error("discriminator: requires propertyName");if(m.mapping)throw new Error("discriminator: mapping is not supported");if(!v)throw new Error("discriminator: requires oneOf keyword");const S=u.let("valid",!1),y=u.const("tag",(0,e._)`${d}${(0,e.getProperty)(x)}`);u.if((0,e._)`typeof ${y} == "string"`,()=>E(),()=>c.error(!1,{discrError:t.DiscrError.Tag,tag:y,tagName:x})),c.ok(S);function E(){const C=k();u.if(!1);for(const R in C)u.elseIf((0,e._)`${y} === ${R}`),u.assign(S,_(C[R]));u.else(),c.error(!1,{discrError:t.DiscrError.Mapping,tag:y,tagName:x}),u.endIf()}function _(C){const R=u.name("valid"),I=c.subschema({keyword:"oneOf",schemaProp:C},R);return c.mergeEvaluated(I,e.Name),R}function k(){var C;const R={},I=O(h);let A=!0;for(let B=0;B<v.length;B++){let K=v[B];if(K?.$ref&&!(0,r.schemaHasRulesButRef)(K,g.self.RULES)){const te=K.$ref;if(K=n.resolveRef.call(g.self,g.schemaEnv.root,g.baseId,te),K instanceof n.SchemaEnv&&(K=K.schema),K===void 0)throw new a.default(g.opts.uriResolver,g.baseId,te)}const ee=(C=K?.properties)===null||C===void 0?void 0:C[x];if(typeof ee!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${x}"`);A=A&&(I||O(K)),M(ee,B)}if(!A)throw new Error(`discriminator: "${x}" must be required`);return R;function O({required:B}){return Array.isArray(B)&&B.includes(x)}function M(B,K){if(B.const)P(B.const,K);else if(B.enum)for(const ee of B.enum)P(ee,K);else throw new Error(`discriminator: "properties/${x}" must have "const" or "enum"`)}function P(B,K){if(typeof B!="string"||B in R)throw new Error(`discriminator: "${x}" values must be unique strings`);R[B]=K}}}};return Jg.default=s,Jg}const Tie="http://json-schema.org/draft-07/schema#",Nie="http://json-schema.org/draft-07/schema#",Cie="Core schema meta-schema",Rie={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:[]}},Aie=["object","boolean"],Iie={$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:"#"}},Oie={$schema:Tie,$id:Nie,title:Cie,definitions:Rie,type:Aie,properties:Iie,default:!0};var VP;function PV(){return VP||(VP=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const n=Vae(),a=_ie(),r=kie(),i=Oie,s=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends n.default{_addVocabularies(){super._addVocabularies(),a.default.forEach(x=>this.addVocabulary(x)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const x=this.opts.$data?this.$dataMetaSchema(i,s):i;this.addMetaSchema(x,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}t.Ajv=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var d=Ry();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var m=$t();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=dN();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var g=Ay();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(hg,hg.exports)),hg.exports}var Die=PV(),Qg={exports:{}},ZS={},GP;function jie(){return GP||(GP=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(B,K){return{validate:B,compare:K}}e.fullFormats={date:t(i,s),time:t(u(!0),d),"date-time":t(g(!0),v),"iso-time":t(u(),m),"iso-date-time":t(g(),x),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:E,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:P,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:k,int32:{type:"number",validate:I},int64:{type:"number",validate:A},float:{type:"number",validate:O},double:{type:"number",validate:O},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,d),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,v),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),"iso-date-time":t(/^\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,x),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(B){return B%4===0&&(B%100!==0||B%400===0)}const a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(B){const K=a.exec(B);if(!K)return!1;const ee=+K[1],te=+K[2],ae=+K[3];return te>=1&&te<=12&&ae>=1&&ae<=(te===2&&n(ee)?29:r[te])}function s(B,K){if(B&&K)return B>K?1:B<K?-1:0}const c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(B){return function(ee){const te=c.exec(ee);if(!te)return!1;const ae=+te[1],H=+te[2],Z=+te[3],G=te[4],re=te[5]==="-"?-1:1,ne=+(te[6]||0),j=+(te[7]||0);if(ne>23||j>59||B&&!G)return!1;if(ae<=23&&H<=59&&Z<60)return!0;const V=H-j*re,z=ae-ne*re-(V<0?1:0);return(z===23||z===-1)&&(V===59||V===-1)&&Z<61}}function d(B,K){if(!(B&&K))return;const ee=new Date("2020-01-01T"+B).valueOf(),te=new Date("2020-01-01T"+K).valueOf();if(ee&&te)return ee-te}function m(B,K){if(!(B&&K))return;const ee=c.exec(B),te=c.exec(K);if(ee&&te)return B=ee[1]+ee[2]+ee[3],K=te[1]+te[2]+te[3],B>K?1:B<K?-1:0}const h=/t|\s/i;function g(B){const K=u(B);return function(te){const ae=te.split(h);return ae.length===2&&i(ae[0])&&K(ae[1])}}function v(B,K){if(!(B&&K))return;const ee=new Date(B).valueOf(),te=new Date(K).valueOf();if(ee&&te)return ee-te}function x(B,K){if(!(B&&K))return;const[ee,te]=B.split(h),[ae,H]=K.split(h),Z=s(ee,ae);if(Z!==void 0)return Z||d(te,H)}const S=/\/|:/,y=/^(?:[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;function E(B){return S.test(B)&&y.test(B)}const _=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function k(B){return _.lastIndex=0,_.test(B)}const C=-2147483648,R=2**31-1;function I(B){return Number.isInteger(B)&&B<=R&&B>=C}function A(B){return Number.isInteger(B)}function O(){return!0}const M=/[^\\]\\Z/;function P(B){if(M.test(B))return!1;try{return new RegExp(B),!0}catch{return!1}}})(ZS)),ZS}var YS={},WP;function Lie(){return WP||(WP=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=PV(),n=$t(),a=n.operators,r={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}},i={message:({keyword:c,schemaCode:u})=>(0,n.str)`should be ${r[c].okStr} ${u}`,params:({keyword:c,schemaCode:u})=>(0,n._)`{comparison: ${r[c].okStr}, limit: ${u}}`};e.formatLimitDefinition={keyword:Object.keys(r),type:"string",schemaType:"string",$data:!0,error:i,code(c){const{gen:u,data:d,schemaCode:m,keyword:h,it:g}=c,{opts:v,self:x}=g;if(!v.validateFormats)return;const S=new t.KeywordCxt(g,x.RULES.all.format.definition,"format");S.$data?y():E();function y(){const k=u.scopeValue("formats",{ref:x.formats,code:v.code.formats}),C=u.const("fmt",(0,n._)`${k}[${S.schemaCode}]`);c.fail$data((0,n.or)((0,n._)`typeof ${C} != "object"`,(0,n._)`${C} instanceof RegExp`,(0,n._)`typeof ${C}.compare != "function"`,_(C)))}function E(){const k=S.schema,C=x.formats[k];if(!C||C===!0)return;if(typeof C!="object"||C instanceof RegExp||typeof C.compare!="function")throw new Error(`"${h}": format "${k}" does not define "compare" function`);const R=u.scopeValue("formats",{key:k,ref:C,code:v.code.formats?(0,n._)`${v.code.formats}${(0,n.getProperty)(k)}`:void 0});c.fail$data(_(R))}function _(k){return(0,n._)`${k}.compare(${d}, ${m}) ${r[h].fail} 0`}},dependencies:["format"]};const s=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=s})(YS)),YS}var KP;function $ie(){return KP||(KP=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=jie(),a=Lie(),r=$t(),i=new r.Name("fullFormats"),s=new r.Name("fastFormats"),c=(d,m={keywords:!0})=>{if(Array.isArray(m))return u(d,m,n.fullFormats,i),d;const[h,g]=m.mode==="fast"?[n.fastFormats,s]:[n.fullFormats,i],v=m.formats||n.formatNames;return u(d,v,h,g),m.keywords&&(0,a.default)(d),d};c.get=(d,m="full")=>{const g=(m==="fast"?n.fastFormats:n.fullFormats)[d];if(!g)throw new Error(`Unknown format "${d}"`);return g};function u(d,m,h,g){var v,x;(v=(x=d.opts.code).formats)!==null&&v!==void 0||(x.formats=(0,r._)`require("ajv-formats/dist/formats").${g}`);for(const S of m)d.addFormat(S,h[S])}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c})(Qg,Qg.exports)),Qg.exports}var Mie=$ie();const Pie=ny(Mie);function Uie(){const e=new Die.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Pie(e),e}class zie{constructor(t){this._ajv=t??Uie()}getValidator(t){var n;const a="$id"in t&&typeof t.$id=="string"?(n=this._ajv.getSchema(t.$id))!==null&&n!==void 0?n:this._ajv.compile(t):this._ajv.compile(t);return r=>a(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(a.errors)}}}class Fie{constructor(t){this._client=t}async*callToolStream(t,n=ky,a){var r;const i=this._client,s={...a,task:(r=a?.task)!==null&&r!==void 0?r:i.isToolTask(t.name)?{}:void 0},c=i.requestStream({method:"tools/call",params:t},n,s),u=i.getToolOutputValidator(t.name);for await(const d of c){if(d.type==="result"&&u){const m=d.result;if(!m.structuredContent&&!m.isError){yield{type:"error",error:new lt(wt.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(m.structuredContent)try{const h=u(m.structuredContent);if(!h.valid){yield{type:"error",error:new lt(wt.InvalidParams,`Structured content does not match the tool's output schema: ${h.errorMessage}`)};return}}catch(h){if(h instanceof lt){yield{type:"error",error:h};return}yield{type:"error",error:new lt(wt.InvalidParams,`Failed to validate structured content: ${h instanceof Error?h.message:String(h)}`)};return}}yield d}}async getTask(t,n){return this._client.getTask({taskId:t},n)}async getTaskResult(t,n,a){return this._client.getTaskResult({taskId:t},n,a)}async listTasks(t,n){return this._client.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._client.cancelTask({taskId:t},n)}requestStream(t,n,a){return this._client.requestStream(t,n,a)}}function Bie(e,t,n){var a;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!(!((a=e.tools)===null||a===void 0)&&a.call))throw new Error(`${n} does not support task creation for tools/call (required for ${t})`);break}}function Hie(e,t,n){var a,r;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!(!((a=e.sampling)===null||a===void 0)&&a.createMessage))throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!(!((r=e.elicitation)===null||r===void 0)&&r.create))throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break}}function Rb(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){const n=t,a=e.properties;for(const r of Object.keys(a)){const i=a[r];n[r]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(n[r]=i.default),n[r]!==void 0&&Rb(i,n[r])}}if(Array.isArray(e.anyOf))for(const n of e.anyOf)typeof n!="boolean"&&Rb(n,t);if(Array.isArray(e.oneOf))for(const n of e.oneOf)typeof n!="boolean"&&Rb(n,t)}}function Vie(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};const t=e.form!==void 0,n=e.url!==void 0;return{supportsFormMode:t||!t&&!n,supportsUrlMode:n}}class ZP extends Nae{constructor(t,n){var a,r;super(n),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(a=n?.capabilities)!==null&&a!==void 0?a:{},this._jsonSchemaValidator=(r=n?.jsonSchemaValidator)!==null&&r!==void 0?r:new zie,n?.listChanged&&(this._pendingListChangedConfig=n.listChanged)}_setupListChangedHandlers(t){var n,a,r,i,s,c;t.tools&&(!((a=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tools)===null||a===void 0)&&a.listChanged)&&this._setupListChangedHandler("tools",kV,t.tools,async()=>(await this.listTools()).tools),t.prompts&&(!((i=(r=this._serverCapabilities)===null||r===void 0?void 0:r.prompts)===null||i===void 0)&&i.listChanged)&&this._setupListChangedHandler("prompts",xV,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&(!((c=(s=this._serverCapabilities)===null||s===void 0?void 0:s.resources)===null||c===void 0)&&c.listChanged)&&this._setupListChangedHandler("resources",yV,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Fie(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Cae(this._capabilities,t)}setRequestHandler(t,n){var a,r,i;const s=AV(t),c=s?.method;if(!c)throw new Error("Schema is missing a method literal");let u;if(Ty(c)){const m=c,h=(a=m._zod)===null||a===void 0?void 0:a.def;u=(r=h?.value)!==null&&r!==void 0?r:m.value}else{const m=c,h=m._def;u=(i=h?.value)!==null&&i!==void 0?i:m.value}if(typeof u!="string")throw new Error("Schema method literal must be a string");const d=u;if(d==="elicitation/create"){const m=async(h,g)=>{var v,x,S;const y=Ts(uN,h);if(!y.success){const M=y.error instanceof Error?y.error.message:String(y.error);throw new lt(wt.InvalidParams,`Invalid elicitation request: ${M}`)}const{params:E}=y.data,_=(v=E.mode)!==null&&v!==void 0?v:"form",{supportsFormMode:k,supportsUrlMode:C}=Vie(this._capabilities.elicitation);if(_==="form"&&!k)throw new lt(wt.InvalidParams,"Client does not support form-mode elicitation requests");if(_==="url"&&!C)throw new lt(wt.InvalidParams,"Client does not support URL-mode elicitation requests");const R=await Promise.resolve(n(h,g));if(E.task){const M=Ts(Lp,R);if(!M.success){const P=M.error instanceof Error?M.error.message:String(M.error);throw new lt(wt.InvalidParams,`Invalid task creation result: ${P}`)}return M.data}const I=Ts(NV,R);if(!I.success){const M=I.error instanceof Error?I.error.message:String(I.error);throw new lt(wt.InvalidParams,`Invalid elicitation result: ${M}`)}const A=I.data,O=_==="form"?E.requestedSchema:void 0;if(_==="form"&&A.action==="accept"&&A.content&&O&&!((S=(x=this._capabilities.elicitation)===null||x===void 0?void 0:x.form)===null||S===void 0)&&S.applyDefaults)try{Rb(O,A.content)}catch{}return A};return super.setRequestHandler(t,m)}if(d==="sampling/createMessage"){const m=async(h,g)=>{const v=Ts(lN,h);if(!v.success){const E=v.error instanceof Error?v.error.message:String(v.error);throw new lt(wt.InvalidParams,`Invalid sampling request: ${E}`)}const{params:x}=v.data,S=await Promise.resolve(n(h,g));if(x.task){const E=Ts(Lp,S);if(!E.success){const _=E.error instanceof Error?E.error.message:String(E.error);throw new lt(wt.InvalidParams,`Invalid task creation result: ${_}`)}return E.data}const y=Ts(cN,S);if(!y.success){const E=y.error instanceof Error?y.error.message:String(y.error);throw new lt(wt.InvalidParams,`Invalid sampling result: ${E}`)}return y.data};return super.setRequestHandler(t,m)}return super.setRequestHandler(t,n)}assertCapability(t,n){var a;if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a[t]))throw new Error(`Server does not support ${t} (required for ${n})`)}async connect(t,n){if(await super.connect(t),t.sessionId===void 0)try{const a=await this.request({method:"initialize",params:{protocolVersion:xy,capabilities:this._capabilities,clientInfo:this._clientInfo}},uV,n);if(a===void 0)throw new Error(`Server sent invalid initialize result: ${a}`);if(!Kne.includes(a.protocolVersion))throw new Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(a.protocolVersion),this._instructions=a.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(a){throw this.close(),a}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var n,a,r,i,s;switch(t){case"logging/setLevel":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.resources))throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${t})`);break}}assertNotificationCapability(t){var n;switch(t){case"notifications/roots/list_changed":if(!(!((n=this._capabilities.roots)===null||n===void 0)&&n.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break}}assertTaskCapability(t){var n,a;Bie((a=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tasks)===null||a===void 0?void 0:a.requests,t,"Server")}assertTaskHandlerCapability(t){var n;this._capabilities&&Hie((n=this._capabilities.tasks)===null||n===void 0?void 0:n.requests,t,"Client")}async ping(t){return this.request({method:"ping"},lu,t)}async complete(t,n){return this.request({method:"completion/complete",params:t},CV,n)}async setLoggingLevel(t,n){return this.request({method:"logging/setLevel",params:{level:t}},lu,n)}async getPrompt(t,n){return this.request({method:"prompts/get",params:t},SV,n)}async listPrompts(t,n){return this.request({method:"prompts/list",params:t},wV,n)}async listResources(t,n){return this.request({method:"resources/list",params:t},gV,n)}async listResourceTemplates(t,n){return this.request({method:"resources/templates/list",params:t},bV,n)}async readResource(t,n){return this.request({method:"resources/read",params:t},vV,n)}async subscribeResource(t,n){return this.request({method:"resources/subscribe",params:t},lu,n)}async unsubscribeResource(t,n){return this.request({method:"resources/unsubscribe",params:t},lu,n)}async callTool(t,n=ky,a){if(this.isToolTaskRequired(t.name))throw new lt(wt.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const r=await this.request({method:"tools/call",params:t},n,a),i=this.getToolOutputValidator(t.name);if(i){if(!r.structuredContent&&!r.isError)throw new lt(wt.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(r.structuredContent)try{const s=i(r.structuredContent);if(!s.valid)throw new lt(wt.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof lt?s:new lt(wt.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return r}isToolTask(t){var n,a,r,i;return!((i=(r=(a=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tasks)===null||a===void 0?void 0:a.requests)===null||r===void 0?void 0:r.tools)===null||i===void 0)&&i.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){var n;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const a of t){if(a.outputSchema){const i=this._jsonSchemaValidator.getValidator(a.outputSchema);this._cachedToolOutputValidators.set(a.name,i)}const r=(n=a.execution)===null||n===void 0?void 0:n.taskSupport;(r==="required"||r==="optional")&&this._cachedKnownTaskTools.add(a.name),r==="required"&&this._cachedRequiredTaskTools.add(a.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,n){const a=await this.request({method:"tools/list",params:t},EV,n);return this.cacheToolMetadata(a.tools),a}_setupListChangedHandler(t,n,a,r){const i=zre.safeParse(a);if(!i.success)throw new Error(`Invalid ${t} listChanged options: ${i.error.message}`);if(typeof a.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:s,debounceMs:c}=i.data,{onChanged:u}=a,d=async()=>{if(!s){u(null,null);return}try{const h=await r();u(null,h)}catch(h){const g=h instanceof Error?h:new Error(String(h));u(g,null)}},m=()=>{if(c){const h=this._listChangedDebounceTimers.get(t);h&&clearTimeout(h);const g=setTimeout(d,c);this._listChangedDebounceTimers.set(t,g)}else d()};this.setNotificationHandler(n,m)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function pv(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function UV(e=fetch,t){return t?async(n,a)=>{const r={...t,...a,headers:a?.headers?{...pv(t.headers),...pv(a.headers)}:t.headers};return e(n,r)}:e}let mN;mN=globalThis.crypto;async function Gie(e){return(await mN).getRandomValues(new Uint8Array(e))}async function Wie(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",n=Math.pow(2,8)-Math.pow(2,8)%t.length;let a="";for(;a.length<e;){const r=await Gie(e-a.length);for(const i of r)i<n&&(a+=t[i%t.length])}return a}async function Kie(e){return await Wie(e)}async function Zie(e){const t=await(await mN).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Yie(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await Kie(e),n=await Zie(t);return{code_verifier:t,code_challenge:n}}const Rr=D.url().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:D.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),D.NEVER}).refine(e=>{const t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),qie=D.looseObject({resource:D.string().url(),authorization_servers:D.array(Rr).optional(),jwks_uri:D.string().url().optional(),scopes_supported:D.array(D.string()).optional(),bearer_methods_supported:D.array(D.string()).optional(),resource_signing_alg_values_supported:D.array(D.string()).optional(),resource_name:D.string().optional(),resource_documentation:D.string().optional(),resource_policy_uri:D.string().url().optional(),resource_tos_uri:D.string().url().optional(),tls_client_certificate_bound_access_tokens:D.boolean().optional(),authorization_details_types_supported:D.array(D.string()).optional(),dpop_signing_alg_values_supported:D.array(D.string()).optional(),dpop_bound_access_tokens_required:D.boolean().optional()}),zV=D.looseObject({issuer:D.string(),authorization_endpoint:Rr,token_endpoint:Rr,registration_endpoint:Rr.optional(),scopes_supported:D.array(D.string()).optional(),response_types_supported:D.array(D.string()),response_modes_supported:D.array(D.string()).optional(),grant_types_supported:D.array(D.string()).optional(),token_endpoint_auth_methods_supported:D.array(D.string()).optional(),token_endpoint_auth_signing_alg_values_supported:D.array(D.string()).optional(),service_documentation:Rr.optional(),revocation_endpoint:Rr.optional(),revocation_endpoint_auth_methods_supported:D.array(D.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:D.array(D.string()).optional(),introspection_endpoint:D.string().optional(),introspection_endpoint_auth_methods_supported:D.array(D.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:D.array(D.string()).optional(),code_challenge_methods_supported:D.array(D.string()).optional(),client_id_metadata_document_supported:D.boolean().optional()}),Xie=D.looseObject({issuer:D.string(),authorization_endpoint:Rr,token_endpoint:Rr,userinfo_endpoint:Rr.optional(),jwks_uri:Rr,registration_endpoint:Rr.optional(),scopes_supported:D.array(D.string()).optional(),response_types_supported:D.array(D.string()),response_modes_supported:D.array(D.string()).optional(),grant_types_supported:D.array(D.string()).optional(),acr_values_supported:D.array(D.string()).optional(),subject_types_supported:D.array(D.string()),id_token_signing_alg_values_supported:D.array(D.string()),id_token_encryption_alg_values_supported:D.array(D.string()).optional(),id_token_encryption_enc_values_supported:D.array(D.string()).optional(),userinfo_signing_alg_values_supported:D.array(D.string()).optional(),userinfo_encryption_alg_values_supported:D.array(D.string()).optional(),userinfo_encryption_enc_values_supported:D.array(D.string()).optional(),request_object_signing_alg_values_supported:D.array(D.string()).optional(),request_object_encryption_alg_values_supported:D.array(D.string()).optional(),request_object_encryption_enc_values_supported:D.array(D.string()).optional(),token_endpoint_auth_methods_supported:D.array(D.string()).optional(),token_endpoint_auth_signing_alg_values_supported:D.array(D.string()).optional(),display_values_supported:D.array(D.string()).optional(),claim_types_supported:D.array(D.string()).optional(),claims_supported:D.array(D.string()).optional(),service_documentation:D.string().optional(),claims_locales_supported:D.array(D.string()).optional(),ui_locales_supported:D.array(D.string()).optional(),claims_parameter_supported:D.boolean().optional(),request_parameter_supported:D.boolean().optional(),request_uri_parameter_supported:D.boolean().optional(),require_request_uri_registration:D.boolean().optional(),op_policy_uri:Rr.optional(),op_tos_uri:Rr.optional(),client_id_metadata_document_supported:D.boolean().optional()}),Jie=D.object({...Xie.shape,...zV.pick({code_challenge_methods_supported:!0}).shape}),Qie=D.object({access_token:D.string(),id_token:D.string().optional(),token_type:D.string(),expires_in:D.coerce.number().optional(),scope:D.string().optional(),refresh_token:D.string().optional()}).strip(),eoe=D.object({error:D.string(),error_description:D.string().optional(),error_uri:D.string().optional()}),YP=Rr.optional().or(D.literal("").transform(()=>{})),toe=D.object({redirect_uris:D.array(Rr),token_endpoint_auth_method:D.string().optional(),grant_types:D.array(D.string()).optional(),response_types:D.array(D.string()).optional(),client_name:D.string().optional(),client_uri:Rr.optional(),logo_uri:YP,scope:D.string().optional(),contacts:D.array(D.string()).optional(),tos_uri:YP,policy_uri:D.string().optional(),jwks_uri:Rr.optional(),jwks:D.any().optional(),software_id:D.string().optional(),software_version:D.string().optional(),software_statement:D.string().optional()}).strip(),noe=D.object({client_id:D.string(),client_secret:D.string().optional(),client_id_issued_at:D.number().optional(),client_secret_expires_at:D.number().optional()}).strip(),roe=toe.merge(noe);D.object({error:D.string(),error_description:D.string().optional()}).strip();D.object({token:D.string(),token_type_hint:D.string().optional()}).strip();function aoe(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function ioe({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),a=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==a.origin||n.pathname.length<a.pathname.length)return!1;const r=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",i=a.pathname.endsWith("/")?a.pathname:a.pathname+"/";return r.startsWith(i)}class Sr extends Error{constructor(t,n){super(t),this.errorUri=n,this.name=this.constructor.name}toResponseObject(){const t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}}class f_ extends Sr{}f_.errorCode="invalid_request";class mv extends Sr{}mv.errorCode="invalid_client";class hv extends Sr{}hv.errorCode="invalid_grant";class gv extends Sr{}gv.errorCode="unauthorized_client";class p_ extends Sr{}p_.errorCode="unsupported_grant_type";class m_ extends Sr{}m_.errorCode="invalid_scope";class h_ extends Sr{}h_.errorCode="access_denied";class ld extends Sr{}ld.errorCode="server_error";class g_ extends Sr{}g_.errorCode="temporarily_unavailable";class b_ extends Sr{}b_.errorCode="unsupported_response_type";class v_ extends Sr{}v_.errorCode="unsupported_token_type";class y_ extends Sr{}y_.errorCode="invalid_token";class w_ extends Sr{}w_.errorCode="method_not_allowed";class S_ extends Sr{}S_.errorCode="too_many_requests";class bv extends Sr{}bv.errorCode="invalid_client_metadata";class x_ extends Sr{}x_.errorCode="insufficient_scope";class __ extends Sr{}__.errorCode="invalid_target";const ooe={[f_.errorCode]:f_,[mv.errorCode]:mv,[hv.errorCode]:hv,[gv.errorCode]:gv,[p_.errorCode]:p_,[m_.errorCode]:m_,[h_.errorCode]:h_,[ld.errorCode]:ld,[g_.errorCode]:g_,[b_.errorCode]:b_,[v_.errorCode]:v_,[y_.errorCode]:y_,[w_.errorCode]:w_,[S_.errorCode]:S_,[bv.errorCode]:bv,[x_.errorCode]:x_,[__.errorCode]:__};class qa extends Error{constructor(t){super(t??"Unauthorized")}}function soe(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const qS="code",XS="S256";function FV(e,t){const n=e.client_secret!==void 0;return t.length===0?n?"client_secret_post":"none":"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&soe(e.token_endpoint_auth_method)&&t.includes(e.token_endpoint_auth_method)?e.token_endpoint_auth_method:n&&t.includes("client_secret_basic")?"client_secret_basic":n&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":n?"client_secret_post":"none"}function loe(e,t,n,a){const{client_id:r,client_secret:i}=t;switch(e){case"client_secret_basic":coe(r,i,n);return;case"client_secret_post":uoe(r,i,a);return;case"none":doe(r,a);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function coe(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const a=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${a}`)}function uoe(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function doe(e,t){t.set("client_id",e)}async function hN(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const a=eoe.parse(JSON.parse(n)),{error:r,error_description:i,error_uri:s}=a,c=ooe[r]||ld;return new c(i||"",s)}catch(a){const r=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${a}. Raw body: ${n}`;return new ld(r)}}async function Co(e,t){var n,a;try{return await JS(e,t)}catch(r){if(r instanceof mv||r instanceof gv)return await((n=e.invalidateCredentials)===null||n===void 0?void 0:n.call(e,"all")),await JS(e,t);if(r instanceof hv)return await((a=e.invalidateCredentials)===null||a===void 0?void 0:a.call(e,"tokens")),await JS(e,t);throw r}}async function JS(e,{serverUrl:t,authorizationCode:n,scope:a,resourceMetadataUrl:r,fetchFn:i}){var s,c;let u,d;try{u=await VV(t,{resourceMetadataUrl:r},i),u.authorization_servers&&u.authorization_servers.length>0&&(d=u.authorization_servers[0])}catch{}d||(d=new URL("/",t));const m=await HV(t,e,u),h=await WV(d,{fetchFn:i});let g=await Promise.resolve(e.clientInformation());if(!g){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const _=h?.client_id_metadata_document_supported===!0,k=e.clientMetadataUrl;if(k&&!BV(k))throw new bv(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${k}`);if(_&&k)g={client_id:k},await((s=e.saveClientInformation)===null||s===void 0?void 0:s.call(e,g));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const R=await JV(d,{metadata:h,clientMetadata:e.clientMetadata,fetchFn:i});await e.saveClientInformation(R),g=R}}const v=!e.redirectUrl;if(n!==void 0||v){const _=await XV(e,d,{metadata:h,resource:m,authorizationCode:n,fetchFn:i});return await e.saveTokens(_),"AUTHORIZED"}const x=await e.tokens();if(x?.refresh_token)try{const _=await qV(d,{metadata:h,clientInformation:g,refreshToken:x.refresh_token,resource:m,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(_),"AUTHORIZED"}catch(_){if(!(!(_ instanceof Sr)||_ instanceof ld))throw _}const S=e.state?await e.state():void 0,{authorizationUrl:y,codeVerifier:E}=await KV(d,{metadata:h,clientInformation:g,state:S,redirectUrl:e.redirectUrl,scope:a||((c=u?.scopes_supported)===null||c===void 0?void 0:c.join(" "))||e.clientMetadata.scope,resource:m});return await e.saveCodeVerifier(E),await e.redirectToAuthorization(y),"REDIRECT"}function BV(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function HV(e,t,n){const a=aoe(e);if(t.validateResourceURL)return await t.validateResourceURL(a,n?.resource);if(n){if(!ioe({requestedResource:a,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${a} (or origin)`);return new URL(n.resource)}}function $p(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,a]=t.split(" ");if(n.toLowerCase()!=="bearer"||!a)return{};const r=QS(e,"resource_metadata")||void 0;let i;if(r)try{i=new URL(r)}catch{}const s=QS(e,"scope")||void 0,c=QS(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:c}}function QS(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const a=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),r=n.match(a);return r?r[1]||r[2]:null}async function VV(e,t,n=fetch){var a,r;const i=await moe(e,"oauth-protected-resource",n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!i||i.status===404)throw await((a=i?.body)===null||a===void 0?void 0:a.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!i.ok)throw await((r=i.body)===null||r===void 0?void 0:r.cancel()),new Error(`HTTP ${i.status} trying to load well-known OAuth protected resource metadata.`);return qie.parse(await i.json())}async function gN(e,t,n=fetch){try{return await n(e,{headers:t})}catch(a){if(a instanceof TypeError)return t?gN(e,void 0,n):void 0;throw a}}function foe(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function qP(e,t,n=fetch){return await gN(e,{"MCP-Protocol-Version":t},n)}function poe(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function moe(e,t,n,a){var r,i;const s=new URL(e),c=(r=a?.protocolVersion)!==null&&r!==void 0?r:xy;let u;if(a?.metadataUrl)u=new URL(a.metadataUrl);else{const m=foe(t,s.pathname);u=new URL(m,(i=a?.metadataServerUrl)!==null&&i!==void 0?i:s),u.search=s.search}let d=await qP(u,c,n);if(!a?.metadataUrl&&poe(d,s.pathname)){const m=new URL(`/.well-known/${t}`,s);d=await qP(m,c,n)}return d}function GV(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",a=[];if(!n)return a.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),a.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),a;let r=t.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),a.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,t.origin),type:"oauth"}),a.push({url:new URL(`/.well-known/openid-configuration${r}`,t.origin),type:"oidc"}),a.push({url:new URL(`${r}/.well-known/openid-configuration`,t.origin),type:"oidc"}),a}async function WV(e,{fetchFn:t=fetch,protocolVersion:n=xy}={}){var a;const r={"MCP-Protocol-Version":n,Accept:"application/json"},i=GV(e);for(const{url:s,type:c}of i){const u=await gN(s,r,t);if(u){if(!u.ok){if(await((a=u.body)===null||a===void 0?void 0:a.cancel()),u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${c==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return c==="oauth"?zV.parse(await u.json()):Jie.parse(await u.json())}}}async function KV(e,{metadata:t,clientInformation:n,redirectUrl:a,scope:r,state:i,resource:s}){let c;if(t){if(c=new URL(t.authorization_endpoint),!t.response_types_supported.includes(qS))throw new Error(`Incompatible auth server: does not support response type ${qS}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(XS))throw new Error(`Incompatible auth server: does not support code challenge method ${XS}`)}else c=new URL("/authorize",e);const u=await Yie(),d=u.code_verifier,m=u.code_challenge;return c.searchParams.set("response_type",qS),c.searchParams.set("client_id",n.client_id),c.searchParams.set("code_challenge",m),c.searchParams.set("code_challenge_method",XS),c.searchParams.set("redirect_uri",String(a)),i&&c.searchParams.set("state",i),r&&c.searchParams.set("scope",r),r?.includes("offline_access")&&c.searchParams.append("prompt","consent"),s&&c.searchParams.set("resource",s.href),{authorizationUrl:c,codeVerifier:d}}function ZV(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function YV(e,{metadata:t,tokenRequestParams:n,clientInformation:a,addClientAuthentication:r,resource:i,fetchFn:s}){var c;const u=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&n.set("resource",i.href),r)await r(d,n,u,t);else if(a){const h=(c=t?.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],g=FV(a,h);loe(g,a,d,n)}const m=await(s??fetch)(u,{method:"POST",headers:d,body:n});if(!m.ok)throw await hN(m);return Qie.parse(await m.json())}async function qV(e,{metadata:t,clientInformation:n,refreshToken:a,resource:r,addClientAuthentication:i,fetchFn:s}){const c=new URLSearchParams({grant_type:"refresh_token",refresh_token:a}),u=await YV(e,{metadata:t,tokenRequestParams:c,clientInformation:n,addClientAuthentication:i,resource:r,fetchFn:s});return{refresh_token:a,...u}}async function XV(e,t,{metadata:n,resource:a,authorizationCode:r,fetchFn:i}={}){const s=e.clientMetadata.scope;let c;if(e.prepareTokenRequest&&(c=await e.prepareTokenRequest(s)),!c){if(!r)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const d=await e.codeVerifier();c=ZV(r,d,e.redirectUrl)}const u=await e.clientInformation();return YV(t,{metadata:n,tokenRequestParams:c,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:a,fetchFn:i})}async function JV(e,{metadata:t,clientMetadata:n,fetchFn:a}){let r;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(t.registration_endpoint)}else r=new URL("/register",e);const i=await(a??fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw await hN(i);return roe.parse(await i.json())}const XP=Object.freeze(Object.defineProperty({__proto__:null,UnauthorizedError:qa,auth:Co,buildDiscoveryUrls:GV,discoverAuthorizationServerMetadata:WV,discoverOAuthProtectedResourceMetadata:VV,extractWWWAuthenticateParams:$p,fetchToken:XV,isHttpsUrl:BV,parseErrorResponse:hN,prepareAuthorizationCodeRequest:ZV,refreshAuthorization:qV,registerClient:JV,selectClientAuthMethod:FV,selectResourceURL:HV,startAuthorization:KV},Symbol.toStringTag,{value:"Module"}));class JP extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}function ex(e){}function QV(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=ex,onError:n=ex,onRetry:a=ex,onComment:r}=e;let i="",s=!0,c,u="",d="";function m(S){const y=s?S.replace(/^\xEF\xBB\xBF/,""):S,[E,_]=hoe(`${i}${y}`);for(const k of E)h(k);i=_,s=!1}function h(S){if(S===""){v();return}if(S.startsWith(":")){r&&r(S.slice(S.startsWith(": ")?2:1));return}const y=S.indexOf(":");if(y!==-1){const E=S.slice(0,y),_=S[y+1]===" "?2:1,k=S.slice(y+_);g(E,k,S);return}g(S,"",S)}function g(S,y,E){switch(S){case"event":d=y;break;case"data":u=`${u}${y}
31
+ deps: ${m}}`};const r={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[d,m]=i(u);s(u,d),c(u,m)}};function i({schema:u}){const d={},m={};for(const h in u){if(h==="__proto__")continue;const g=Array.isArray(u[h])?d:m;g[h]=u[h]}return[d,m]}function s(u,d=u.schema){const{gen:m,data:h,it:g}=u;if(Object.keys(d).length===0)return;const v=m.let("missing");for(const x in d){const S=d[x];if(S.length===0)continue;const y=(0,a.propertyInData)(m,h,x,g.opts.ownProperties);u.setParams({property:x,depsCount:S.length,deps:S.join(", ")}),g.allErrors?m.if(y,()=>{for(const E of S)(0,a.checkReportMissingProp)(u,E)}):(m.if((0,t._)`${y} && (${(0,a.checkMissingProp)(u,S,v)})`),(0,a.reportMissingProp)(u,v),m.else())}}e.validatePropertyDeps=s;function c(u,d=u.schema){const{gen:m,data:h,keyword:g,it:v}=u,x=m.name("valid");for(const S in d)(0,n.alwaysValidSchema)(v,d[S])||(m.if((0,a.propertyInData)(m,h,S,v.opts.ownProperties),()=>{const y=u.subschema({keyword:g,schemaProp:S},x);u.mergeValidEvaluated(y,x)},()=>m.var(x,!0)),u.ok(x))}e.validateSchemaDeps=c,e.default=r})(KS)),KS}var zg={},NP;function cie(){if(NP)return zg;NP=1,Object.defineProperty(zg,"__esModule",{value:!0});const e=$t(),t=sn(),a={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:r})=>(0,e._)`{propertyName: ${r.propertyName}}`},code(r){const{gen:i,schema:s,data:c,it:u}=r;if((0,t.alwaysValidSchema)(u,s))return;const d=i.name("valid");i.forIn("key",c,m=>{r.setParams({propertyName:m}),r.subschema({keyword:"propertyNames",data:m,dataTypes:["string"],propertyName:m,compositeRule:!0},d),i.if((0,e.not)(d),()=>{r.error(!0),u.allErrors||i.break()})}),r.ok(d)}};return zg.default=a,zg}var Fg={},CP;function MV(){if(CP)return Fg;CP=1,Object.defineProperty(Fg,"__esModule",{value:!0});const e=Ri(),t=$t(),n=Ks(),a=sn(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:s})=>(0,t._)`{additionalProperty: ${s.additionalProperty}}`},code(s){const{gen:c,schema:u,parentSchema:d,data:m,errsCount:h,it:g}=s;if(!h)throw new Error("ajv implementation error");const{allErrors:v,opts:x}=g;if(g.props=!0,x.removeAdditional!=="all"&&(0,a.alwaysValidSchema)(g,u))return;const S=(0,e.allSchemaProperties)(d.properties),y=(0,e.allSchemaProperties)(d.patternProperties);E(),s.ok((0,t._)`${h} === ${n.default.errors}`);function E(){c.forIn("key",m,I=>{!S.length&&!y.length?C(I):c.if(_(I),()=>C(I))})}function _(I){let A;if(S.length>8){const O=(0,a.schemaRefOrVal)(g,d.properties,"properties");A=(0,e.isOwnProperty)(c,O,I)}else S.length?A=(0,t.or)(...S.map(O=>(0,t._)`${I} === ${O}`)):A=t.nil;return y.length&&(A=(0,t.or)(A,...y.map(O=>(0,t._)`${(0,e.usePattern)(s,O)}.test(${I})`))),(0,t.not)(A)}function k(I){c.code((0,t._)`delete ${m}[${I}]`)}function C(I){if(x.removeAdditional==="all"||x.removeAdditional&&u===!1){k(I);return}if(u===!1){s.setParams({additionalProperty:I}),s.error(),v||c.break();return}if(typeof u=="object"&&!(0,a.alwaysValidSchema)(g,u)){const A=c.name("valid");x.removeAdditional==="failing"?(R(I,A,!1),c.if((0,t.not)(A),()=>{s.reset(),k(I)})):(R(I,A),v||c.if((0,t.not)(A),()=>c.break()))}}function R(I,A,O){const M={keyword:"additionalProperties",dataProp:I,dataPropType:a.Type.Str};O===!1&&Object.assign(M,{compositeRule:!0,createErrors:!1,allErrors:!1}),s.subschema(M,A)}}};return Fg.default=i,Fg}var Bg={},RP;function uie(){if(RP)return Bg;RP=1,Object.defineProperty(Bg,"__esModule",{value:!0});const e=Ry(),t=Ri(),n=sn(),a=MV(),r={keyword:"properties",type:"object",schemaType:"object",code(i){const{gen:s,schema:c,parentSchema:u,data:d,it:m}=i;m.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&a.default.code(new e.KeywordCxt(m,a.default,"additionalProperties"));const h=(0,t.allSchemaProperties)(c);for(const y of h)m.definedProperties.add(y);m.opts.unevaluated&&h.length&&m.props!==!0&&(m.props=n.mergeEvaluated.props(s,(0,n.toHash)(h),m.props));const g=h.filter(y=>!(0,n.alwaysValidSchema)(m,c[y]));if(g.length===0)return;const v=s.name("valid");for(const y of g)x(y)?S(y):(s.if((0,t.propertyInData)(s,d,y,m.opts.ownProperties)),S(y),m.allErrors||s.else().var(v,!0),s.endIf()),i.it.definedProperties.add(y),i.ok(v);function x(y){return m.opts.useDefaults&&!m.compositeRule&&c[y].default!==void 0}function S(y){i.subschema({keyword:"properties",schemaProp:y,dataProp:y},v)}}};return Bg.default=r,Bg}var Hg={},AP;function die(){if(AP)return Hg;AP=1,Object.defineProperty(Hg,"__esModule",{value:!0});const e=Ri(),t=$t(),n=sn(),a=sn(),r={keyword:"patternProperties",type:"object",schemaType:"object",code(i){const{gen:s,schema:c,data:u,parentSchema:d,it:m}=i,{opts:h}=m,g=(0,e.allSchemaProperties)(c),v=g.filter(C=>(0,n.alwaysValidSchema)(m,c[C]));if(g.length===0||v.length===g.length&&(!m.opts.unevaluated||m.props===!0))return;const x=h.strictSchema&&!h.allowMatchingProperties&&d.properties,S=s.name("valid");m.props!==!0&&!(m.props instanceof t.Name)&&(m.props=(0,a.evaluatedPropsToName)(s,m.props));const{props:y}=m;E();function E(){for(const C of g)x&&_(C),m.allErrors?k(C):(s.var(S,!0),k(C),s.if(S))}function _(C){for(const R in x)new RegExp(C).test(R)&&(0,n.checkStrictMode)(m,`property ${R} matches pattern ${C} (use allowMatchingProperties)`)}function k(C){s.forIn("key",u,R=>{s.if((0,t._)`${(0,e.usePattern)(i,C)}.test(${R})`,()=>{const I=v.includes(C);I||i.subschema({keyword:"patternProperties",schemaProp:C,dataProp:R,dataPropType:a.Type.Str},S),m.opts.unevaluated&&y!==!0?s.assign((0,t._)`${y}[${R}]`,!0):!I&&!m.allErrors&&s.if((0,t.not)(S),()=>s.break())})})}}};return Hg.default=r,Hg}var Vg={},IP;function fie(){if(IP)return Vg;IP=1,Object.defineProperty(Vg,"__esModule",{value:!0});const e=sn(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:a,schema:r,it:i}=n;if((0,e.alwaysValidSchema)(i,r)){n.fail();return}const s=a.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),n.failResult(s,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return Vg.default=t,Vg}var Gg={},OP;function pie(){if(OP)return Gg;OP=1,Object.defineProperty(Gg,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ri().validateUnion,error:{message:"must match a schema in anyOf"}};return Gg.default=t,Gg}var Wg={},DP;function mie(){if(DP)return Wg;DP=1,Object.defineProperty(Wg,"__esModule",{value:!0});const e=$t(),t=sn(),a={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:r})=>(0,e._)`{passingSchemas: ${r.passing}}`},code(r){const{gen:i,schema:s,parentSchema:c,it:u}=r;if(!Array.isArray(s))throw new Error("ajv implementation error");if(u.opts.discriminator&&c.discriminator)return;const d=s,m=i.let("valid",!1),h=i.let("passing",null),g=i.name("_valid");r.setParams({passing:h}),i.block(v),r.result(m,()=>r.reset(),()=>r.error(!0));function v(){d.forEach((x,S)=>{let y;(0,t.alwaysValidSchema)(u,x)?i.var(g,!0):y=r.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},g),S>0&&i.if((0,e._)`${g} && ${m}`).assign(m,!1).assign(h,(0,e._)`[${h}, ${S}]`).else(),i.if(g,()=>{i.assign(m,!0),i.assign(h,S),y&&r.mergeEvaluated(y,e.Name)})})}}};return Wg.default=a,Wg}var Kg={},jP;function hie(){if(jP)return Kg;jP=1,Object.defineProperty(Kg,"__esModule",{value:!0});const e=sn(),t={keyword:"allOf",schemaType:"array",code(n){const{gen:a,schema:r,it:i}=n;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=a.name("valid");r.forEach((c,u)=>{if((0,e.alwaysValidSchema)(i,c))return;const d=n.subschema({keyword:"allOf",schemaProp:u},s);n.ok(s),n.mergeEvaluated(d)})}};return Kg.default=t,Kg}var Zg={},LP;function gie(){if(LP)return Zg;LP=1,Object.defineProperty(Zg,"__esModule",{value:!0});const e=$t(),t=sn(),a={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,e.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,e._)`{failingKeyword: ${i.ifClause}}`},code(i){const{gen:s,parentSchema:c,it:u}=i;c.then===void 0&&c.else===void 0&&(0,t.checkStrictMode)(u,'"if" without "then" and "else" is ignored');const d=r(u,"then"),m=r(u,"else");if(!d&&!m)return;const h=s.let("valid",!0),g=s.name("_valid");if(v(),i.reset(),d&&m){const S=s.let("ifClause");i.setParams({ifClause:S}),s.if(g,x("then",S),x("else",S))}else d?s.if(g,x("then")):s.if((0,e.not)(g),x("else"));i.pass(h,()=>i.error(!0));function v(){const S=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},g);i.mergeEvaluated(S)}function x(S,y){return()=>{const E=i.subschema({keyword:S},g);s.assign(h,g),i.mergeValidEvaluated(E,h),y?s.assign(y,(0,e._)`${S}`):i.setParams({ifClause:S})}}}};function r(i,s){const c=i.schema[s];return c!==void 0&&!(0,t.alwaysValidSchema)(i,c)}return Zg.default=a,Zg}var Yg={},$P;function bie(){if($P)return Yg;$P=1,Object.defineProperty(Yg,"__esModule",{value:!0});const e=sn(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:a,it:r}){a.if===void 0&&(0,e.checkStrictMode)(r,`"${n}" without "if" is ignored`)}};return Yg.default=t,Yg}var MP;function vie(){if(MP)return $g;MP=1,Object.defineProperty($g,"__esModule",{value:!0});const e=LV(),t=iie(),n=$V(),a=oie(),r=sie(),i=lie(),s=cie(),c=MV(),u=uie(),d=die(),m=fie(),h=pie(),g=mie(),v=hie(),x=gie(),S=bie();function y(E=!1){const _=[m.default,h.default,g.default,v.default,x.default,S.default,s.default,c.default,i.default,u.default,d.default];return E?_.push(t.default,a.default):_.push(e.default,n.default),_.push(r.default),_}return $g.default=y,$g}var qg={},Xg={},PP;function yie(){if(PP)return Xg;PP=1,Object.defineProperty(Xg,"__esModule",{value:!0});const e=$t(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:a})=>(0,e.str)`must match format "${a}"`,params:({schemaCode:a})=>(0,e._)`{format: ${a}}`},code(a,r){const{gen:i,data:s,$data:c,schema:u,schemaCode:d,it:m}=a,{opts:h,errSchemaPath:g,schemaEnv:v,self:x}=m;if(!h.validateFormats)return;c?S():y();function S(){const E=i.scopeValue("formats",{ref:x.formats,code:h.code.formats}),_=i.const("fDef",(0,e._)`${E}[${d}]`),k=i.let("fType"),C=i.let("format");i.if((0,e._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>i.assign(k,(0,e._)`${_}.type || "string"`).assign(C,(0,e._)`${_}.validate`),()=>i.assign(k,(0,e._)`"string"`).assign(C,_)),a.fail$data((0,e.or)(R(),I()));function R(){return h.strictSchema===!1?e.nil:(0,e._)`${d} && !${C}`}function I(){const A=v.$async?(0,e._)`(${_}.async ? await ${C}(${s}) : ${C}(${s}))`:(0,e._)`${C}(${s})`,O=(0,e._)`(typeof ${C} == "function" ? ${A} : ${C}.test(${s}))`;return(0,e._)`${C} && ${C} !== true && ${k} === ${r} && !${O}`}}function y(){const E=x.formats[u];if(!E){R();return}if(E===!0)return;const[_,k,C]=I(E);_===r&&a.pass(A());function R(){if(h.strictSchema===!1){x.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${u}" ignored in schema at path "${g}"`}}function I(O){const M=O instanceof RegExp?(0,e.regexpCode)(O):h.code.formats?(0,e._)`${h.code.formats}${(0,e.getProperty)(u)}`:void 0,P=i.scopeValue("formats",{key:u,ref:O,code:M});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,e._)`${P}.validate`]:["string",O,P]}function A(){if(typeof E=="object"&&!(E instanceof RegExp)&&E.async){if(!v.$async)throw new Error("async format in sync schema");return(0,e._)`await ${C}(${s})`}return typeof k=="function"?(0,e._)`${C}(${s})`:(0,e._)`${C}.test(${s})`}}}};return Xg.default=n,Xg}var UP;function wie(){if(UP)return qg;UP=1,Object.defineProperty(qg,"__esModule",{value:!0});const t=[yie().default];return qg.default=t,qg}var yl={},zP;function Sie(){return zP||(zP=1,Object.defineProperty(yl,"__esModule",{value:!0}),yl.contentVocabulary=yl.metadataVocabulary=void 0,yl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],yl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),yl}var FP;function xie(){if(FP)return wg;FP=1,Object.defineProperty(wg,"__esModule",{value:!0});const e=Wae(),t=aie(),n=vie(),a=wie(),r=Sie(),i=[e.default,t.default,(0,n.default)(),a.default,r.metadataVocabulary,r.contentVocabulary];return wg.default=i,wg}var Jg={},Hf={},BP;function _ie(){if(BP)return Hf;BP=1,Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(Hf.DiscrError=e={})),Hf}var HP;function Eie(){if(HP)return Jg;HP=1,Object.defineProperty(Jg,"__esModule",{value:!0});const e=$t(),t=_ie(),n=fN(),a=Ay(),r=sn(),s={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:u}})=>c===t.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:c,tag:u,tagName:d}})=>(0,e._)`{error: ${c}, tag: ${d}, tagValue: ${u}}`},code(c){const{gen:u,data:d,schema:m,parentSchema:h,it:g}=c,{oneOf:v}=h;if(!g.opts.discriminator)throw new Error("discriminator: requires discriminator option");const x=m.propertyName;if(typeof x!="string")throw new Error("discriminator: requires propertyName");if(m.mapping)throw new Error("discriminator: mapping is not supported");if(!v)throw new Error("discriminator: requires oneOf keyword");const S=u.let("valid",!1),y=u.const("tag",(0,e._)`${d}${(0,e.getProperty)(x)}`);u.if((0,e._)`typeof ${y} == "string"`,()=>E(),()=>c.error(!1,{discrError:t.DiscrError.Tag,tag:y,tagName:x})),c.ok(S);function E(){const C=k();u.if(!1);for(const R in C)u.elseIf((0,e._)`${y} === ${R}`),u.assign(S,_(C[R]));u.else(),c.error(!1,{discrError:t.DiscrError.Mapping,tag:y,tagName:x}),u.endIf()}function _(C){const R=u.name("valid"),I=c.subschema({keyword:"oneOf",schemaProp:C},R);return c.mergeEvaluated(I,e.Name),R}function k(){var C;const R={},I=O(h);let A=!0;for(let B=0;B<v.length;B++){let K=v[B];if(K?.$ref&&!(0,r.schemaHasRulesButRef)(K,g.self.RULES)){const te=K.$ref;if(K=n.resolveRef.call(g.self,g.schemaEnv.root,g.baseId,te),K instanceof n.SchemaEnv&&(K=K.schema),K===void 0)throw new a.default(g.opts.uriResolver,g.baseId,te)}const ee=(C=K?.properties)===null||C===void 0?void 0:C[x];if(typeof ee!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${x}"`);A=A&&(I||O(K)),M(ee,B)}if(!A)throw new Error(`discriminator: "${x}" must be required`);return R;function O({required:B}){return Array.isArray(B)&&B.includes(x)}function M(B,K){if(B.const)P(B.const,K);else if(B.enum)for(const ee of B.enum)P(ee,K);else throw new Error(`discriminator: "properties/${x}" must have "const" or "enum"`)}function P(B,K){if(typeof B!="string"||B in R)throw new Error(`discriminator: "${x}" values must be unique strings`);R[B]=K}}}};return Jg.default=s,Jg}const kie="http://json-schema.org/draft-07/schema#",Tie="http://json-schema.org/draft-07/schema#",Nie="Core schema meta-schema",Cie={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:[]}},Rie=["object","boolean"],Aie={$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:"#"}},Iie={$schema:kie,$id:Tie,title:Nie,definitions:Cie,type:Rie,properties:Aie,default:!0};var VP;function PV(){return VP||(VP=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const n=Hae(),a=xie(),r=Eie(),i=Iie,s=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends n.default{_addVocabularies(){super._addVocabularies(),a.default.forEach(x=>this.addVocabulary(x)),this.opts.discriminator&&this.addKeyword(r.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const x=this.opts.$data?this.$dataMetaSchema(i,s):i;this.addMetaSchema(x,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}t.Ajv=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var d=Ry();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var m=$t();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=dN();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var g=Ay();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(hg,hg.exports)),hg.exports}var Oie=PV(),Qg={exports:{}},ZS={},GP;function Die(){return GP||(GP=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(B,K){return{validate:B,compare:K}}e.fullFormats={date:t(i,s),time:t(u(!0),d),"date-time":t(g(!0),v),"iso-time":t(u(),m),"iso-date-time":t(g(),x),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:E,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:P,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:k,int32:{type:"number",validate:I},int64:{type:"number",validate:A},float:{type:"number",validate:O},double:{type:"number",validate:O},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,d),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,v),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),"iso-date-time":t(/^\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,x),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(B){return B%4===0&&(B%100!==0||B%400===0)}const a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(B){const K=a.exec(B);if(!K)return!1;const ee=+K[1],te=+K[2],ae=+K[3];return te>=1&&te<=12&&ae>=1&&ae<=(te===2&&n(ee)?29:r[te])}function s(B,K){if(B&&K)return B>K?1:B<K?-1:0}const c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(B){return function(ee){const te=c.exec(ee);if(!te)return!1;const ae=+te[1],H=+te[2],Z=+te[3],G=te[4],re=te[5]==="-"?-1:1,ne=+(te[6]||0),j=+(te[7]||0);if(ne>23||j>59||B&&!G)return!1;if(ae<=23&&H<=59&&Z<60)return!0;const V=H-j*re,z=ae-ne*re-(V<0?1:0);return(z===23||z===-1)&&(V===59||V===-1)&&Z<61}}function d(B,K){if(!(B&&K))return;const ee=new Date("2020-01-01T"+B).valueOf(),te=new Date("2020-01-01T"+K).valueOf();if(ee&&te)return ee-te}function m(B,K){if(!(B&&K))return;const ee=c.exec(B),te=c.exec(K);if(ee&&te)return B=ee[1]+ee[2]+ee[3],K=te[1]+te[2]+te[3],B>K?1:B<K?-1:0}const h=/t|\s/i;function g(B){const K=u(B);return function(te){const ae=te.split(h);return ae.length===2&&i(ae[0])&&K(ae[1])}}function v(B,K){if(!(B&&K))return;const ee=new Date(B).valueOf(),te=new Date(K).valueOf();if(ee&&te)return ee-te}function x(B,K){if(!(B&&K))return;const[ee,te]=B.split(h),[ae,H]=K.split(h),Z=s(ee,ae);if(Z!==void 0)return Z||d(te,H)}const S=/\/|:/,y=/^(?:[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;function E(B){return S.test(B)&&y.test(B)}const _=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function k(B){return _.lastIndex=0,_.test(B)}const C=-2147483648,R=2**31-1;function I(B){return Number.isInteger(B)&&B<=R&&B>=C}function A(B){return Number.isInteger(B)}function O(){return!0}const M=/[^\\]\\Z/;function P(B){if(M.test(B))return!1;try{return new RegExp(B),!0}catch{return!1}}})(ZS)),ZS}var YS={},WP;function jie(){return WP||(WP=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=PV(),n=$t(),a=n.operators,r={formatMaximum:{okStr:"<=",ok:a.LTE,fail:a.GT},formatMinimum:{okStr:">=",ok:a.GTE,fail:a.LT},formatExclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},formatExclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}},i={message:({keyword:c,schemaCode:u})=>(0,n.str)`should be ${r[c].okStr} ${u}`,params:({keyword:c,schemaCode:u})=>(0,n._)`{comparison: ${r[c].okStr}, limit: ${u}}`};e.formatLimitDefinition={keyword:Object.keys(r),type:"string",schemaType:"string",$data:!0,error:i,code(c){const{gen:u,data:d,schemaCode:m,keyword:h,it:g}=c,{opts:v,self:x}=g;if(!v.validateFormats)return;const S=new t.KeywordCxt(g,x.RULES.all.format.definition,"format");S.$data?y():E();function y(){const k=u.scopeValue("formats",{ref:x.formats,code:v.code.formats}),C=u.const("fmt",(0,n._)`${k}[${S.schemaCode}]`);c.fail$data((0,n.or)((0,n._)`typeof ${C} != "object"`,(0,n._)`${C} instanceof RegExp`,(0,n._)`typeof ${C}.compare != "function"`,_(C)))}function E(){const k=S.schema,C=x.formats[k];if(!C||C===!0)return;if(typeof C!="object"||C instanceof RegExp||typeof C.compare!="function")throw new Error(`"${h}": format "${k}" does not define "compare" function`);const R=u.scopeValue("formats",{key:k,ref:C,code:v.code.formats?(0,n._)`${v.code.formats}${(0,n.getProperty)(k)}`:void 0});c.fail$data(_(R))}function _(k){return(0,n._)`${k}.compare(${d}, ${m}) ${r[h].fail} 0`}},dependencies:["format"]};const s=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=s})(YS)),YS}var KP;function Lie(){return KP||(KP=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=Die(),a=jie(),r=$t(),i=new r.Name("fullFormats"),s=new r.Name("fastFormats"),c=(d,m={keywords:!0})=>{if(Array.isArray(m))return u(d,m,n.fullFormats,i),d;const[h,g]=m.mode==="fast"?[n.fastFormats,s]:[n.fullFormats,i],v=m.formats||n.formatNames;return u(d,v,h,g),m.keywords&&(0,a.default)(d),d};c.get=(d,m="full")=>{const g=(m==="fast"?n.fastFormats:n.fullFormats)[d];if(!g)throw new Error(`Unknown format "${d}"`);return g};function u(d,m,h,g){var v,x;(v=(x=d.opts.code).formats)!==null&&v!==void 0||(x.formats=(0,r._)`require("ajv-formats/dist/formats").${g}`);for(const S of m)d.addFormat(S,h[S])}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c})(Qg,Qg.exports)),Qg.exports}var $ie=Lie();const Mie=ny($ie);function Pie(){const e=new Oie.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Mie(e),e}class Uie{constructor(t){this._ajv=t??Pie()}getValidator(t){var n;const a="$id"in t&&typeof t.$id=="string"?(n=this._ajv.getSchema(t.$id))!==null&&n!==void 0?n:this._ajv.compile(t):this._ajv.compile(t);return r=>a(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(a.errors)}}}class zie{constructor(t){this._client=t}async*callToolStream(t,n=ky,a){var r;const i=this._client,s={...a,task:(r=a?.task)!==null&&r!==void 0?r:i.isToolTask(t.name)?{}:void 0},c=i.requestStream({method:"tools/call",params:t},n,s),u=i.getToolOutputValidator(t.name);for await(const d of c){if(d.type==="result"&&u){const m=d.result;if(!m.structuredContent&&!m.isError){yield{type:"error",error:new lt(wt.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(m.structuredContent)try{const h=u(m.structuredContent);if(!h.valid){yield{type:"error",error:new lt(wt.InvalidParams,`Structured content does not match the tool's output schema: ${h.errorMessage}`)};return}}catch(h){if(h instanceof lt){yield{type:"error",error:h};return}yield{type:"error",error:new lt(wt.InvalidParams,`Failed to validate structured content: ${h instanceof Error?h.message:String(h)}`)};return}}yield d}}async getTask(t,n){return this._client.getTask({taskId:t},n)}async getTaskResult(t,n,a){return this._client.getTaskResult({taskId:t},n,a)}async listTasks(t,n){return this._client.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._client.cancelTask({taskId:t},n)}requestStream(t,n,a){return this._client.requestStream(t,n,a)}}function Fie(e,t,n){var a;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!(!((a=e.tools)===null||a===void 0)&&a.call))throw new Error(`${n} does not support task creation for tools/call (required for ${t})`);break}}function Bie(e,t,n){var a,r;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!(!((a=e.sampling)===null||a===void 0)&&a.createMessage))throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!(!((r=e.elicitation)===null||r===void 0)&&r.create))throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break}}function Rb(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){const n=t,a=e.properties;for(const r of Object.keys(a)){const i=a[r];n[r]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(n[r]=i.default),n[r]!==void 0&&Rb(i,n[r])}}if(Array.isArray(e.anyOf))for(const n of e.anyOf)typeof n!="boolean"&&Rb(n,t);if(Array.isArray(e.oneOf))for(const n of e.oneOf)typeof n!="boolean"&&Rb(n,t)}}function Hie(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};const t=e.form!==void 0,n=e.url!==void 0;return{supportsFormMode:t||!t&&!n,supportsUrlMode:n}}class ZP extends Tae{constructor(t,n){var a,r;super(n),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(a=n?.capabilities)!==null&&a!==void 0?a:{},this._jsonSchemaValidator=(r=n?.jsonSchemaValidator)!==null&&r!==void 0?r:new Uie,n?.listChanged&&(this._pendingListChangedConfig=n.listChanged)}_setupListChangedHandlers(t){var n,a,r,i,s,c;t.tools&&(!((a=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tools)===null||a===void 0)&&a.listChanged)&&this._setupListChangedHandler("tools",kV,t.tools,async()=>(await this.listTools()).tools),t.prompts&&(!((i=(r=this._serverCapabilities)===null||r===void 0?void 0:r.prompts)===null||i===void 0)&&i.listChanged)&&this._setupListChangedHandler("prompts",xV,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&(!((c=(s=this._serverCapabilities)===null||s===void 0?void 0:s.resources)===null||c===void 0)&&c.listChanged)&&this._setupListChangedHandler("resources",yV,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new zie(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Nae(this._capabilities,t)}setRequestHandler(t,n){var a,r,i;const s=AV(t),c=s?.method;if(!c)throw new Error("Schema is missing a method literal");let u;if(Ty(c)){const m=c,h=(a=m._zod)===null||a===void 0?void 0:a.def;u=(r=h?.value)!==null&&r!==void 0?r:m.value}else{const m=c,h=m._def;u=(i=h?.value)!==null&&i!==void 0?i:m.value}if(typeof u!="string")throw new Error("Schema method literal must be a string");const d=u;if(d==="elicitation/create"){const m=async(h,g)=>{var v,x,S;const y=Ts(uN,h);if(!y.success){const M=y.error instanceof Error?y.error.message:String(y.error);throw new lt(wt.InvalidParams,`Invalid elicitation request: ${M}`)}const{params:E}=y.data,_=(v=E.mode)!==null&&v!==void 0?v:"form",{supportsFormMode:k,supportsUrlMode:C}=Hie(this._capabilities.elicitation);if(_==="form"&&!k)throw new lt(wt.InvalidParams,"Client does not support form-mode elicitation requests");if(_==="url"&&!C)throw new lt(wt.InvalidParams,"Client does not support URL-mode elicitation requests");const R=await Promise.resolve(n(h,g));if(E.task){const M=Ts(Lp,R);if(!M.success){const P=M.error instanceof Error?M.error.message:String(M.error);throw new lt(wt.InvalidParams,`Invalid task creation result: ${P}`)}return M.data}const I=Ts(NV,R);if(!I.success){const M=I.error instanceof Error?I.error.message:String(I.error);throw new lt(wt.InvalidParams,`Invalid elicitation result: ${M}`)}const A=I.data,O=_==="form"?E.requestedSchema:void 0;if(_==="form"&&A.action==="accept"&&A.content&&O&&!((S=(x=this._capabilities.elicitation)===null||x===void 0?void 0:x.form)===null||S===void 0)&&S.applyDefaults)try{Rb(O,A.content)}catch{}return A};return super.setRequestHandler(t,m)}if(d==="sampling/createMessage"){const m=async(h,g)=>{const v=Ts(lN,h);if(!v.success){const E=v.error instanceof Error?v.error.message:String(v.error);throw new lt(wt.InvalidParams,`Invalid sampling request: ${E}`)}const{params:x}=v.data,S=await Promise.resolve(n(h,g));if(x.task){const E=Ts(Lp,S);if(!E.success){const _=E.error instanceof Error?E.error.message:String(E.error);throw new lt(wt.InvalidParams,`Invalid task creation result: ${_}`)}return E.data}const y=Ts(cN,S);if(!y.success){const E=y.error instanceof Error?y.error.message:String(y.error);throw new lt(wt.InvalidParams,`Invalid sampling result: ${E}`)}return y.data};return super.setRequestHandler(t,m)}return super.setRequestHandler(t,n)}assertCapability(t,n){var a;if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a[t]))throw new Error(`Server does not support ${t} (required for ${n})`)}async connect(t,n){if(await super.connect(t),t.sessionId===void 0)try{const a=await this.request({method:"initialize",params:{protocolVersion:xy,capabilities:this._capabilities,clientInfo:this._clientInfo}},uV,n);if(a===void 0)throw new Error(`Server sent invalid initialize result: ${a}`);if(!Kne.includes(a.protocolVersion))throw new Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(a.protocolVersion),this._instructions=a.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(a){throw this.close(),a}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var n,a,r,i,s;switch(t){case"logging/setLevel":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.resources))throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${t})`);break}}assertNotificationCapability(t){var n;switch(t){case"notifications/roots/list_changed":if(!(!((n=this._capabilities.roots)===null||n===void 0)&&n.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break}}assertTaskCapability(t){var n,a;Fie((a=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tasks)===null||a===void 0?void 0:a.requests,t,"Server")}assertTaskHandlerCapability(t){var n;this._capabilities&&Bie((n=this._capabilities.tasks)===null||n===void 0?void 0:n.requests,t,"Client")}async ping(t){return this.request({method:"ping"},lu,t)}async complete(t,n){return this.request({method:"completion/complete",params:t},CV,n)}async setLoggingLevel(t,n){return this.request({method:"logging/setLevel",params:{level:t}},lu,n)}async getPrompt(t,n){return this.request({method:"prompts/get",params:t},SV,n)}async listPrompts(t,n){return this.request({method:"prompts/list",params:t},wV,n)}async listResources(t,n){return this.request({method:"resources/list",params:t},gV,n)}async listResourceTemplates(t,n){return this.request({method:"resources/templates/list",params:t},bV,n)}async readResource(t,n){return this.request({method:"resources/read",params:t},vV,n)}async subscribeResource(t,n){return this.request({method:"resources/subscribe",params:t},lu,n)}async unsubscribeResource(t,n){return this.request({method:"resources/unsubscribe",params:t},lu,n)}async callTool(t,n=ky,a){if(this.isToolTaskRequired(t.name))throw new lt(wt.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const r=await this.request({method:"tools/call",params:t},n,a),i=this.getToolOutputValidator(t.name);if(i){if(!r.structuredContent&&!r.isError)throw new lt(wt.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(r.structuredContent)try{const s=i(r.structuredContent);if(!s.valid)throw new lt(wt.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof lt?s:new lt(wt.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return r}isToolTask(t){var n,a,r,i;return!((i=(r=(a=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tasks)===null||a===void 0?void 0:a.requests)===null||r===void 0?void 0:r.tools)===null||i===void 0)&&i.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){var n;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const a of t){if(a.outputSchema){const i=this._jsonSchemaValidator.getValidator(a.outputSchema);this._cachedToolOutputValidators.set(a.name,i)}const r=(n=a.execution)===null||n===void 0?void 0:n.taskSupport;(r==="required"||r==="optional")&&this._cachedKnownTaskTools.add(a.name),r==="required"&&this._cachedRequiredTaskTools.add(a.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,n){const a=await this.request({method:"tools/list",params:t},EV,n);return this.cacheToolMetadata(a.tools),a}_setupListChangedHandler(t,n,a,r){const i=zre.safeParse(a);if(!i.success)throw new Error(`Invalid ${t} listChanged options: ${i.error.message}`);if(typeof a.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:s,debounceMs:c}=i.data,{onChanged:u}=a,d=async()=>{if(!s){u(null,null);return}try{const h=await r();u(null,h)}catch(h){const g=h instanceof Error?h:new Error(String(h));u(g,null)}},m=()=>{if(c){const h=this._listChangedDebounceTimers.get(t);h&&clearTimeout(h);const g=setTimeout(d,c);this._listChangedDebounceTimers.set(t,g)}else d()};this.setNotificationHandler(n,m)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function pv(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function UV(e=fetch,t){return t?async(n,a)=>{const r={...t,...a,headers:a?.headers?{...pv(t.headers),...pv(a.headers)}:t.headers};return e(n,r)}:e}let mN;mN=globalThis.crypto;async function Vie(e){return(await mN).getRandomValues(new Uint8Array(e))}async function Gie(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",n=Math.pow(2,8)-Math.pow(2,8)%t.length;let a="";for(;a.length<e;){const r=await Vie(e-a.length);for(const i of r)i<n&&(a+=t[i%t.length])}return a}async function Wie(e){return await Gie(e)}async function Kie(e){const t=await(await mN).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Zie(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await Wie(e),n=await Kie(t);return{code_verifier:t,code_challenge:n}}const Rr=D.url().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:D.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),D.NEVER}).refine(e=>{const t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Yie=D.looseObject({resource:D.string().url(),authorization_servers:D.array(Rr).optional(),jwks_uri:D.string().url().optional(),scopes_supported:D.array(D.string()).optional(),bearer_methods_supported:D.array(D.string()).optional(),resource_signing_alg_values_supported:D.array(D.string()).optional(),resource_name:D.string().optional(),resource_documentation:D.string().optional(),resource_policy_uri:D.string().url().optional(),resource_tos_uri:D.string().url().optional(),tls_client_certificate_bound_access_tokens:D.boolean().optional(),authorization_details_types_supported:D.array(D.string()).optional(),dpop_signing_alg_values_supported:D.array(D.string()).optional(),dpop_bound_access_tokens_required:D.boolean().optional()}),zV=D.looseObject({issuer:D.string(),authorization_endpoint:Rr,token_endpoint:Rr,registration_endpoint:Rr.optional(),scopes_supported:D.array(D.string()).optional(),response_types_supported:D.array(D.string()),response_modes_supported:D.array(D.string()).optional(),grant_types_supported:D.array(D.string()).optional(),token_endpoint_auth_methods_supported:D.array(D.string()).optional(),token_endpoint_auth_signing_alg_values_supported:D.array(D.string()).optional(),service_documentation:Rr.optional(),revocation_endpoint:Rr.optional(),revocation_endpoint_auth_methods_supported:D.array(D.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:D.array(D.string()).optional(),introspection_endpoint:D.string().optional(),introspection_endpoint_auth_methods_supported:D.array(D.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:D.array(D.string()).optional(),code_challenge_methods_supported:D.array(D.string()).optional(),client_id_metadata_document_supported:D.boolean().optional()}),qie=D.looseObject({issuer:D.string(),authorization_endpoint:Rr,token_endpoint:Rr,userinfo_endpoint:Rr.optional(),jwks_uri:Rr,registration_endpoint:Rr.optional(),scopes_supported:D.array(D.string()).optional(),response_types_supported:D.array(D.string()),response_modes_supported:D.array(D.string()).optional(),grant_types_supported:D.array(D.string()).optional(),acr_values_supported:D.array(D.string()).optional(),subject_types_supported:D.array(D.string()),id_token_signing_alg_values_supported:D.array(D.string()),id_token_encryption_alg_values_supported:D.array(D.string()).optional(),id_token_encryption_enc_values_supported:D.array(D.string()).optional(),userinfo_signing_alg_values_supported:D.array(D.string()).optional(),userinfo_encryption_alg_values_supported:D.array(D.string()).optional(),userinfo_encryption_enc_values_supported:D.array(D.string()).optional(),request_object_signing_alg_values_supported:D.array(D.string()).optional(),request_object_encryption_alg_values_supported:D.array(D.string()).optional(),request_object_encryption_enc_values_supported:D.array(D.string()).optional(),token_endpoint_auth_methods_supported:D.array(D.string()).optional(),token_endpoint_auth_signing_alg_values_supported:D.array(D.string()).optional(),display_values_supported:D.array(D.string()).optional(),claim_types_supported:D.array(D.string()).optional(),claims_supported:D.array(D.string()).optional(),service_documentation:D.string().optional(),claims_locales_supported:D.array(D.string()).optional(),ui_locales_supported:D.array(D.string()).optional(),claims_parameter_supported:D.boolean().optional(),request_parameter_supported:D.boolean().optional(),request_uri_parameter_supported:D.boolean().optional(),require_request_uri_registration:D.boolean().optional(),op_policy_uri:Rr.optional(),op_tos_uri:Rr.optional(),client_id_metadata_document_supported:D.boolean().optional()}),Xie=D.object({...qie.shape,...zV.pick({code_challenge_methods_supported:!0}).shape}),Jie=D.object({access_token:D.string(),id_token:D.string().optional(),token_type:D.string(),expires_in:D.coerce.number().optional(),scope:D.string().optional(),refresh_token:D.string().optional()}).strip(),Qie=D.object({error:D.string(),error_description:D.string().optional(),error_uri:D.string().optional()}),YP=Rr.optional().or(D.literal("").transform(()=>{})),eoe=D.object({redirect_uris:D.array(Rr),token_endpoint_auth_method:D.string().optional(),grant_types:D.array(D.string()).optional(),response_types:D.array(D.string()).optional(),client_name:D.string().optional(),client_uri:Rr.optional(),logo_uri:YP,scope:D.string().optional(),contacts:D.array(D.string()).optional(),tos_uri:YP,policy_uri:D.string().optional(),jwks_uri:Rr.optional(),jwks:D.any().optional(),software_id:D.string().optional(),software_version:D.string().optional(),software_statement:D.string().optional()}).strip(),toe=D.object({client_id:D.string(),client_secret:D.string().optional(),client_id_issued_at:D.number().optional(),client_secret_expires_at:D.number().optional()}).strip(),noe=eoe.merge(toe);D.object({error:D.string(),error_description:D.string().optional()}).strip();D.object({token:D.string(),token_type_hint:D.string().optional()}).strip();function roe(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function aoe({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),a=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==a.origin||n.pathname.length<a.pathname.length)return!1;const r=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",i=a.pathname.endsWith("/")?a.pathname:a.pathname+"/";return r.startsWith(i)}class Sr extends Error{constructor(t,n){super(t),this.errorUri=n,this.name=this.constructor.name}toResponseObject(){const t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}}class f_ extends Sr{}f_.errorCode="invalid_request";class mv extends Sr{}mv.errorCode="invalid_client";class hv extends Sr{}hv.errorCode="invalid_grant";class gv extends Sr{}gv.errorCode="unauthorized_client";class p_ extends Sr{}p_.errorCode="unsupported_grant_type";class m_ extends Sr{}m_.errorCode="invalid_scope";class h_ extends Sr{}h_.errorCode="access_denied";class ld extends Sr{}ld.errorCode="server_error";class g_ extends Sr{}g_.errorCode="temporarily_unavailable";class b_ extends Sr{}b_.errorCode="unsupported_response_type";class v_ extends Sr{}v_.errorCode="unsupported_token_type";class y_ extends Sr{}y_.errorCode="invalid_token";class w_ extends Sr{}w_.errorCode="method_not_allowed";class S_ extends Sr{}S_.errorCode="too_many_requests";class bv extends Sr{}bv.errorCode="invalid_client_metadata";class x_ extends Sr{}x_.errorCode="insufficient_scope";class __ extends Sr{}__.errorCode="invalid_target";const ioe={[f_.errorCode]:f_,[mv.errorCode]:mv,[hv.errorCode]:hv,[gv.errorCode]:gv,[p_.errorCode]:p_,[m_.errorCode]:m_,[h_.errorCode]:h_,[ld.errorCode]:ld,[g_.errorCode]:g_,[b_.errorCode]:b_,[v_.errorCode]:v_,[y_.errorCode]:y_,[w_.errorCode]:w_,[S_.errorCode]:S_,[bv.errorCode]:bv,[x_.errorCode]:x_,[__.errorCode]:__};class qa extends Error{constructor(t){super(t??"Unauthorized")}}function ooe(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const qS="code",XS="S256";function FV(e,t){const n=e.client_secret!==void 0;return t.length===0?n?"client_secret_post":"none":"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&ooe(e.token_endpoint_auth_method)&&t.includes(e.token_endpoint_auth_method)?e.token_endpoint_auth_method:n&&t.includes("client_secret_basic")?"client_secret_basic":n&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":n?"client_secret_post":"none"}function soe(e,t,n,a){const{client_id:r,client_secret:i}=t;switch(e){case"client_secret_basic":loe(r,i,n);return;case"client_secret_post":coe(r,i,a);return;case"none":uoe(r,a);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function loe(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const a=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${a}`)}function coe(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function uoe(e,t){t.set("client_id",e)}async function hN(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const a=Qie.parse(JSON.parse(n)),{error:r,error_description:i,error_uri:s}=a,c=ioe[r]||ld;return new c(i||"",s)}catch(a){const r=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${a}. Raw body: ${n}`;return new ld(r)}}async function Co(e,t){var n,a;try{return await JS(e,t)}catch(r){if(r instanceof mv||r instanceof gv)return await((n=e.invalidateCredentials)===null||n===void 0?void 0:n.call(e,"all")),await JS(e,t);if(r instanceof hv)return await((a=e.invalidateCredentials)===null||a===void 0?void 0:a.call(e,"tokens")),await JS(e,t);throw r}}async function JS(e,{serverUrl:t,authorizationCode:n,scope:a,resourceMetadataUrl:r,fetchFn:i}){var s,c;let u,d;try{u=await VV(t,{resourceMetadataUrl:r},i),u.authorization_servers&&u.authorization_servers.length>0&&(d=u.authorization_servers[0])}catch{}d||(d=new URL("/",t));const m=await HV(t,e,u),h=await WV(d,{fetchFn:i});let g=await Promise.resolve(e.clientInformation());if(!g){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const _=h?.client_id_metadata_document_supported===!0,k=e.clientMetadataUrl;if(k&&!BV(k))throw new bv(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${k}`);if(_&&k)g={client_id:k},await((s=e.saveClientInformation)===null||s===void 0?void 0:s.call(e,g));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const R=await JV(d,{metadata:h,clientMetadata:e.clientMetadata,fetchFn:i});await e.saveClientInformation(R),g=R}}const v=!e.redirectUrl;if(n!==void 0||v){const _=await XV(e,d,{metadata:h,resource:m,authorizationCode:n,fetchFn:i});return await e.saveTokens(_),"AUTHORIZED"}const x=await e.tokens();if(x?.refresh_token)try{const _=await qV(d,{metadata:h,clientInformation:g,refreshToken:x.refresh_token,resource:m,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(_),"AUTHORIZED"}catch(_){if(!(!(_ instanceof Sr)||_ instanceof ld))throw _}const S=e.state?await e.state():void 0,{authorizationUrl:y,codeVerifier:E}=await KV(d,{metadata:h,clientInformation:g,state:S,redirectUrl:e.redirectUrl,scope:a||((c=u?.scopes_supported)===null||c===void 0?void 0:c.join(" "))||e.clientMetadata.scope,resource:m});return await e.saveCodeVerifier(E),await e.redirectToAuthorization(y),"REDIRECT"}function BV(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function HV(e,t,n){const a=roe(e);if(t.validateResourceURL)return await t.validateResourceURL(a,n?.resource);if(n){if(!aoe({requestedResource:a,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${a} (or origin)`);return new URL(n.resource)}}function $p(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,a]=t.split(" ");if(n.toLowerCase()!=="bearer"||!a)return{};const r=QS(e,"resource_metadata")||void 0;let i;if(r)try{i=new URL(r)}catch{}const s=QS(e,"scope")||void 0,c=QS(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:c}}function QS(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const a=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),r=n.match(a);return r?r[1]||r[2]:null}async function VV(e,t,n=fetch){var a,r;const i=await poe(e,"oauth-protected-resource",n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!i||i.status===404)throw await((a=i?.body)===null||a===void 0?void 0:a.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!i.ok)throw await((r=i.body)===null||r===void 0?void 0:r.cancel()),new Error(`HTTP ${i.status} trying to load well-known OAuth protected resource metadata.`);return Yie.parse(await i.json())}async function gN(e,t,n=fetch){try{return await n(e,{headers:t})}catch(a){if(a instanceof TypeError)return t?gN(e,void 0,n):void 0;throw a}}function doe(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function qP(e,t,n=fetch){return await gN(e,{"MCP-Protocol-Version":t},n)}function foe(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function poe(e,t,n,a){var r,i;const s=new URL(e),c=(r=a?.protocolVersion)!==null&&r!==void 0?r:xy;let u;if(a?.metadataUrl)u=new URL(a.metadataUrl);else{const m=doe(t,s.pathname);u=new URL(m,(i=a?.metadataServerUrl)!==null&&i!==void 0?i:s),u.search=s.search}let d=await qP(u,c,n);if(!a?.metadataUrl&&foe(d,s.pathname)){const m=new URL(`/.well-known/${t}`,s);d=await qP(m,c,n)}return d}function GV(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",a=[];if(!n)return a.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),a.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),a;let r=t.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),a.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,t.origin),type:"oauth"}),a.push({url:new URL(`/.well-known/openid-configuration${r}`,t.origin),type:"oidc"}),a.push({url:new URL(`${r}/.well-known/openid-configuration`,t.origin),type:"oidc"}),a}async function WV(e,{fetchFn:t=fetch,protocolVersion:n=xy}={}){var a;const r={"MCP-Protocol-Version":n,Accept:"application/json"},i=GV(e);for(const{url:s,type:c}of i){const u=await gN(s,r,t);if(u){if(!u.ok){if(await((a=u.body)===null||a===void 0?void 0:a.cancel()),u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${c==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return c==="oauth"?zV.parse(await u.json()):Xie.parse(await u.json())}}}async function KV(e,{metadata:t,clientInformation:n,redirectUrl:a,scope:r,state:i,resource:s}){let c;if(t){if(c=new URL(t.authorization_endpoint),!t.response_types_supported.includes(qS))throw new Error(`Incompatible auth server: does not support response type ${qS}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(XS))throw new Error(`Incompatible auth server: does not support code challenge method ${XS}`)}else c=new URL("/authorize",e);const u=await Zie(),d=u.code_verifier,m=u.code_challenge;return c.searchParams.set("response_type",qS),c.searchParams.set("client_id",n.client_id),c.searchParams.set("code_challenge",m),c.searchParams.set("code_challenge_method",XS),c.searchParams.set("redirect_uri",String(a)),i&&c.searchParams.set("state",i),r&&c.searchParams.set("scope",r),r?.includes("offline_access")&&c.searchParams.append("prompt","consent"),s&&c.searchParams.set("resource",s.href),{authorizationUrl:c,codeVerifier:d}}function ZV(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function YV(e,{metadata:t,tokenRequestParams:n,clientInformation:a,addClientAuthentication:r,resource:i,fetchFn:s}){var c;const u=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),d=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&n.set("resource",i.href),r)await r(d,n,u,t);else if(a){const h=(c=t?.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],g=FV(a,h);soe(g,a,d,n)}const m=await(s??fetch)(u,{method:"POST",headers:d,body:n});if(!m.ok)throw await hN(m);return Jie.parse(await m.json())}async function qV(e,{metadata:t,clientInformation:n,refreshToken:a,resource:r,addClientAuthentication:i,fetchFn:s}){const c=new URLSearchParams({grant_type:"refresh_token",refresh_token:a}),u=await YV(e,{metadata:t,tokenRequestParams:c,clientInformation:n,addClientAuthentication:i,resource:r,fetchFn:s});return{refresh_token:a,...u}}async function XV(e,t,{metadata:n,resource:a,authorizationCode:r,fetchFn:i}={}){const s=e.clientMetadata.scope;let c;if(e.prepareTokenRequest&&(c=await e.prepareTokenRequest(s)),!c){if(!r)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const d=await e.codeVerifier();c=ZV(r,d,e.redirectUrl)}const u=await e.clientInformation();return YV(t,{metadata:n,tokenRequestParams:c,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:a,fetchFn:i})}async function JV(e,{metadata:t,clientMetadata:n,fetchFn:a}){let r;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(t.registration_endpoint)}else r=new URL("/register",e);const i=await(a??fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw await hN(i);return noe.parse(await i.json())}const XP=Object.freeze(Object.defineProperty({__proto__:null,UnauthorizedError:qa,auth:Co,buildDiscoveryUrls:GV,discoverAuthorizationServerMetadata:WV,discoverOAuthProtectedResourceMetadata:VV,extractWWWAuthenticateParams:$p,fetchToken:XV,isHttpsUrl:BV,parseErrorResponse:hN,prepareAuthorizationCodeRequest:ZV,refreshAuthorization:qV,registerClient:JV,selectClientAuthMethod:FV,selectResourceURL:HV,startAuthorization:KV},Symbol.toStringTag,{value:"Module"}));class JP extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}function ex(e){}function QV(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=ex,onError:n=ex,onRetry:a=ex,onComment:r}=e;let i="",s=!0,c,u="",d="";function m(S){const y=s?S.replace(/^\xEF\xBB\xBF/,""):S,[E,_]=moe(`${i}${y}`);for(const k of E)h(k);i=_,s=!1}function h(S){if(S===""){v();return}if(S.startsWith(":")){r&&r(S.slice(S.startsWith(": ")?2:1));return}const y=S.indexOf(":");if(y!==-1){const E=S.slice(0,y),_=S[y+1]===" "?2:1,k=S.slice(y+_);g(E,k,S);return}g(S,"",S)}function g(S,y,E){switch(S){case"event":d=y;break;case"data":u=`${u}${y}
32
32
  `;break;case"id":c=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?a(parseInt(y,10)):n(new JP(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:E}));break;default:n(new JP(`Unknown field "${S.length>20?`${S.slice(0,20)}…`:S}"`,{type:"unknown-field",field:S,value:y,line:E}));break}}function v(){u.length>0&&t({id:c,event:d||void 0,data:u.endsWith(`
33
- `)?u.slice(0,-1):u}),c=void 0,u="",d=""}function x(S={}){i&&S.consume&&h(i),s=!0,c=void 0,u="",d="",i=""}return{feed:m,reset:x}}function hoe(e){const t=[];let n="",a=0;for(;a<e.length;){const r=e.indexOf("\r",a),i=e.indexOf(`
33
+ `)?u.slice(0,-1):u}),c=void 0,u="",d=""}function x(S={}){i&&S.consume&&h(i),s=!0,c=void 0,u="",d="",i=""}return{feed:m,reset:x}}function moe(e){const t=[];let n="",a=0;for(;a<e.length;){const r=e.indexOf("\r",a),i=e.indexOf(`
34
34
  `,a);let s=-1;if(r!==-1&&i!==-1?s=Math.min(r,i):r!==-1?r===e.length-1?s=-1:s=r:i!==-1&&(s=i),s===-1){n=e.slice(a);break}else{const c=e.slice(a,s);t.push(c),a=s+1,e[a-1]==="\r"&&e[a]===`
35
- `&&a++}}return[t,n]}class goe extends TransformStream{constructor({onError:t,onRetry:n,onComment:a}={}){let r;super({start(i){r=QV({onEvent:s=>{i.enqueue(s)},onError(s){t==="terminate"?i.error(s):typeof t=="function"&&t(s)},onRetry:n,onComment:a})},transform(i){r.feed(i)}})}}const boe={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class El extends Error{constructor(t,n){super(`Streamable HTTP error: ${n}`),this.code=t}}class voe{constructor(t,n){var a;this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=UV(n?.fetch,n?.requestInit),this._sessionId=n?.sessionId,this._reconnectionOptions=(a=n?.reconnectionOptions)!==null&&a!==void 0?a:boe}async _authThenStart(){var t;if(!this._authProvider)throw new qa("No auth provider");let n;try{n=await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(a){throw(t=this.onerror)===null||t===void 0||t.call(this,a),a}if(n!=="AUTHORIZED")throw new qa;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var t;const n={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(n.Authorization=`Bearer ${r.access_token}`)}this._sessionId&&(n["mcp-session-id"]=this._sessionId),this._protocolVersion&&(n["mcp-protocol-version"]=this._protocolVersion);const a=pv((t=this._requestInit)===null||t===void 0?void 0:t.headers);return new Headers({...n,...a})}async _startOrAuthSse(t){var n,a,r,i;const{resumptionToken:s}=t;try{const c=await this._commonHeaders();c.set("Accept","text/event-stream"),s&&c.set("last-event-id",s);const u=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,{method:"GET",headers:c,signal:(a=this._abortController)===null||a===void 0?void 0:a.signal});if(!u.ok){if(await((r=u.body)===null||r===void 0?void 0:r.cancel()),u.status===401&&this._authProvider)return await this._authThenStart();if(u.status===405)return;throw new El(u.status,`Failed to open SSE stream: ${u.statusText}`)}this._handleSseStream(u.body,t,!0)}catch(c){throw(i=this.onerror)===null||i===void 0||i.call(this,c),c}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const n=this._reconnectionOptions.initialReconnectionDelay,a=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(n*Math.pow(a,t),r)}_scheduleReconnection(t,n=0){var a;const r=this._reconnectionOptions.maxRetries;if(n>=r){(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}const i=this._getNextReconnectionDelay(n);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,n+1)})},i)}_handleSseStream(t,n,a){if(!t)return;const{onresumptiontoken:r,replayMessageId:i}=n;let s,c=!1,u=!1;(async()=>{var m,h,g,v;try{const x=t.pipeThrough(new TextDecoderStream).pipeThrough(new goe({onRetry:E=>{this._serverRetryMs=E}})).getReader();for(;;){const{value:E,done:_}=await x.read();if(_)break;if(E.id&&(s=E.id,c=!0,r?.(E.id)),!!E.data&&(!E.event||E.event==="message"))try{const k=Cb.parse(JSON.parse(E.data));Qf(k)&&(u=!0,i!==void 0&&(k.id=i)),(m=this.onmessage)===null||m===void 0||m.call(this,k)}catch(k){(h=this.onerror)===null||h===void 0||h.call(this,k)}}(a||c)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:r,replayMessageId:i},0)}catch(x){if((g=this.onerror)===null||g===void 0||g.call(this,new Error(`SSE stream disconnected: ${x}`)),(a||c)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:r,replayMessageId:i},0)}catch(E){(v=this.onerror)===null||v===void 0||v.call(this,new Error(`Failed to reconnect: ${E instanceof Error?E.message:String(E)}`))}}})()}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(t){if(!this._authProvider)throw new qa("No auth provider");if(await Co(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qa("Failed to authorize")}async close(){var t,n;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(t=this._abortController)===null||t===void 0||t.abort(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(t,n){var a,r,i,s,c,u,d;try{const{resumptionToken:m,onresumptiontoken:h}=n||{};if(m){this._startOrAuthSse({resumptionToken:m,replayMessageId:d_(t)?t.id:void 0}).catch(k=>{var C;return(C=this.onerror)===null||C===void 0?void 0:C.call(this,k)});return}const g=await this._commonHeaders();g.set("content-type","application/json"),g.set("accept","application/json, text/event-stream");const v={...this._requestInit,method:"POST",headers:g,body:JSON.stringify(t),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},x=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,v),S=x.headers.get("mcp-session-id");if(S&&(this._sessionId=S),!x.ok){const k=await x.text().catch(()=>null);if(x.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new El(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:C,scope:R}=$p(x);if(this._resourceMetadataUrl=C,this._scope=R,await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qa;return this._hasCompletedAuthFlow=!0,this.send(t)}if(x.status===403&&this._authProvider){const{resourceMetadataUrl:C,scope:R,error:I}=$p(x);if(I==="insufficient_scope"){const A=x.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===A)throw new El(403,"Server returned 403 after trying upscoping");if(R&&(this._scope=R),C&&(this._resourceMetadataUrl=C),this._lastUpscopingHeader=A??void 0,await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new qa;return this.send(t)}}throw new El(x.status,`Error POSTing to endpoint: ${k}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,x.status===202){await((i=x.body)===null||i===void 0?void 0:i.cancel()),lre(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(k=>{var C;return(C=this.onerror)===null||C===void 0?void 0:C.call(this,k)});return}const E=(Array.isArray(t)?t:[t]).filter(k=>"method"in k&&"id"in k&&k.id!==void 0).length>0,_=x.headers.get("content-type");if(E)if(_?.includes("text/event-stream"))this._handleSseStream(x.body,{onresumptiontoken:h},!1);else if(_?.includes("application/json")){const k=await x.json(),C=Array.isArray(k)?k.map(R=>Cb.parse(R)):[Cb.parse(k)];for(const R of C)(s=this.onmessage)===null||s===void 0||s.call(this,R)}else throw await((c=x.body)===null||c===void 0?void 0:c.cancel()),new El(-1,`Unexpected content type: ${_}`);else await((u=x.body)===null||u===void 0?void 0:u.cancel())}catch(m){throw(d=this.onerror)===null||d===void 0||d.call(this,m),m}}get sessionId(){return this._sessionId}async terminateSession(){var t,n,a,r;if(this._sessionId)try{const i=await this._commonHeaders(),s={...this._requestInit,method:"DELETE",headers:i,signal:(t=this._abortController)===null||t===void 0?void 0:t.signal},c=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,s);if(await((a=c.body)===null||a===void 0?void 0:a.cancel()),!c.ok&&c.status!==405)throw new El(c.status,`Failed to terminate session: ${c.statusText}`);this._sessionId=void 0}catch(i){throw(r=this.onerror)===null||r===void 0||r.call(this,i),i}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,n){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:n?.onresumptiontoken})}}class QP extends Event{constructor(t,n){var a,r;super(t),this.code=(a=n?.code)!=null?a:void 0,this.message=(r=n?.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,a){return a(eU(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(eU(this),n)}}function yoe(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function E_(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(E_).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${E_(e.cause)}`:e.message:`${e}`}function eU(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var e9=e=>{throw TypeError(e)},bN=(e,t,n)=>t.has(e)||e9("Cannot "+n),Ft=(e,t,n)=>(bN(e,t,"read from private field"),n?n.call(e):t.get(e)),ur=(e,t,n)=>t.has(e)?e9("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Mn=(e,t,n,a)=>(bN(e,t,"write to private field"),t.set(e,n),n),_o=(e,t,n)=>(bN(e,t,"access private method"),n),ba,Tl,Jc,Ab,vv,dp,cu,fp,Cs,Qc,wu,eu,ep,fi,k_,T_,N_,tU,C_,R_,tp,A_,I_;class Ib extends EventTarget{constructor(t,n){var a,r;super(),ur(this,fi),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,ur(this,ba),ur(this,Tl),ur(this,Jc),ur(this,Ab),ur(this,vv),ur(this,dp),ur(this,cu),ur(this,fp,null),ur(this,Cs),ur(this,Qc),ur(this,wu,null),ur(this,eu,null),ur(this,ep,null),ur(this,T_,async i=>{var s;Ft(this,Qc).reset();const{body:c,redirected:u,status:d,headers:m}=i;if(d===204){_o(this,fi,tp).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?Mn(this,Jc,new URL(i.url)):Mn(this,Jc,void 0),d!==200){_o(this,fi,tp).call(this,`Non-200 status code (${d})`,d);return}if(!(m.get("content-type")||"").startsWith("text/event-stream")){_o(this,fi,tp).call(this,'Invalid content type, expected "text/event-stream"',d);return}if(Ft(this,ba)===this.CLOSED)return;Mn(this,ba,this.OPEN);const h=new Event("open");if((s=Ft(this,ep))==null||s.call(this,h),this.dispatchEvent(h),typeof c!="object"||!c||!("getReader"in c)){_o(this,fi,tp).call(this,"Invalid response body, expected a web ReadableStream",d),this.close();return}const g=new TextDecoder,v=c.getReader();let x=!0;do{const{done:S,value:y}=await v.read();y&&Ft(this,Qc).feed(g.decode(y,{stream:!S})),S&&(x=!1,Ft(this,Qc).reset(),_o(this,fi,A_).call(this))}while(x)}),ur(this,N_,i=>{Mn(this,Cs,void 0),!(i.name==="AbortError"||i.type==="aborted")&&_o(this,fi,A_).call(this,E_(i))}),ur(this,C_,i=>{typeof i.id=="string"&&Mn(this,fp,i.id);const s=new MessageEvent(i.event||"message",{data:i.data,origin:Ft(this,Jc)?Ft(this,Jc).origin:Ft(this,Tl).origin,lastEventId:i.id||""});Ft(this,eu)&&(!i.event||i.event==="message")&&Ft(this,eu).call(this,s),this.dispatchEvent(s)}),ur(this,R_,i=>{Mn(this,dp,i)}),ur(this,I_,()=>{Mn(this,cu,void 0),Ft(this,ba)===this.CONNECTING&&_o(this,fi,k_).call(this)});try{if(t instanceof URL)Mn(this,Tl,t);else if(typeof t=="string")Mn(this,Tl,new URL(t,woe()));else throw new Error("Invalid URL")}catch{throw yoe("An invalid or illegal string was specified")}Mn(this,Qc,QV({onEvent:Ft(this,C_),onRetry:Ft(this,R_)})),Mn(this,ba,this.CONNECTING),Mn(this,dp,3e3),Mn(this,vv,(a=n?.fetch)!=null?a:globalThis.fetch),Mn(this,Ab,(r=n?.withCredentials)!=null?r:!1),_o(this,fi,k_).call(this)}get readyState(){return Ft(this,ba)}get url(){return Ft(this,Tl).href}get withCredentials(){return Ft(this,Ab)}get onerror(){return Ft(this,wu)}set onerror(t){Mn(this,wu,t)}get onmessage(){return Ft(this,eu)}set onmessage(t){Mn(this,eu,t)}get onopen(){return Ft(this,ep)}set onopen(t){Mn(this,ep,t)}addEventListener(t,n,a){const r=n;super.addEventListener(t,r,a)}removeEventListener(t,n,a){const r=n;super.removeEventListener(t,r,a)}close(){Ft(this,cu)&&clearTimeout(Ft(this,cu)),Ft(this,ba)!==this.CLOSED&&(Ft(this,Cs)&&Ft(this,Cs).abort(),Mn(this,ba,this.CLOSED),Mn(this,Cs,void 0))}}ba=new WeakMap,Tl=new WeakMap,Jc=new WeakMap,Ab=new WeakMap,vv=new WeakMap,dp=new WeakMap,cu=new WeakMap,fp=new WeakMap,Cs=new WeakMap,Qc=new WeakMap,wu=new WeakMap,eu=new WeakMap,ep=new WeakMap,fi=new WeakSet,k_=function(){Mn(this,ba,this.CONNECTING),Mn(this,Cs,new AbortController),Ft(this,vv)(Ft(this,Tl),_o(this,fi,tU).call(this)).then(Ft(this,T_)).catch(Ft(this,N_))},T_=new WeakMap,N_=new WeakMap,tU=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ft(this,fp)?{"Last-Event-ID":Ft(this,fp)}:void 0},cache:"no-store",signal:(e=Ft(this,Cs))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},C_=new WeakMap,R_=new WeakMap,tp=function(e,t){var n;Ft(this,ba)!==this.CLOSED&&Mn(this,ba,this.CLOSED);const a=new QP("error",{code:t,message:e});(n=Ft(this,wu))==null||n.call(this,a),this.dispatchEvent(a)},A_=function(e,t){var n;if(Ft(this,ba)===this.CLOSED)return;Mn(this,ba,this.CONNECTING);const a=new QP("error",{code:t,message:e});(n=Ft(this,wu))==null||n.call(this,a),this.dispatchEvent(a),Mn(this,cu,setTimeout(Ft(this,I_),Ft(this,dp)))},I_=new WeakMap,Ib.CONNECTING=0,Ib.OPEN=1,Ib.CLOSED=2;function woe(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class Soe extends Error{constructor(t,n,a){super(`SSE error: ${n}`),this.code=t,this.event=a}}class xoe{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n?.eventSourceInit,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=UV(n?.fetch,n?.requestInit)}async _authThenStart(){var t;if(!this._authProvider)throw new qa("No auth provider");let n;try{n=await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(a){throw(t=this.onerror)===null||t===void 0||t.call(this,a),a}if(n!=="AUTHORIZED")throw new qa;return await this._startOrAuth()}async _commonHeaders(){var t;const n={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(n.Authorization=`Bearer ${r.access_token}`)}this._protocolVersion&&(n["mcp-protocol-version"]=this._protocolVersion);const a=pv((t=this._requestInit)===null||t===void 0?void 0:t.headers);return new Headers({...n,...a})}_startOrAuth(){var t,n,a;const r=(a=(n=(t=this===null||this===void 0?void 0:this._eventSourceInit)===null||t===void 0?void 0:t.fetch)!==null&&n!==void 0?n:this._fetch)!==null&&a!==void 0?a:fetch;return new Promise((i,s)=>{this._eventSource=new Ib(this._url.href,{...this._eventSourceInit,fetch:async(c,u)=>{const d=await this._commonHeaders();d.set("Accept","text/event-stream");const m=await r(c,{...u,headers:d});if(m.status===401&&m.headers.has("www-authenticate")){const{resourceMetadataUrl:h,scope:g}=$p(m);this._resourceMetadataUrl=h,this._scope=g}return m}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var u;if(c.code===401&&this._authProvider){this._authThenStart().then(i,s);return}const d=new Soe(c.code,c.message,c);s(d),(u=this.onerror)===null||u===void 0||u.call(this,d)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var u;const d=c;try{if(this._endpoint=new URL(d.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(m){s(m),(u=this.onerror)===null||u===void 0||u.call(this,m),this.close();return}i()}),this._eventSource.onmessage=c=>{var u,d;const m=c;let h;try{h=Cb.parse(JSON.parse(m.data))}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g);return}(d=this.onmessage)===null||d===void 0||d.call(this,h)}})}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(t){if(!this._authProvider)throw new qa("No auth provider");if(await Co(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qa("Failed to authorize")}async close(){var t,n,a;(t=this._abortController)===null||t===void 0||t.abort(),(n=this._eventSource)===null||n===void 0||n.close(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(t){var n,a,r,i;if(!this._endpoint)throw new Error("Not connected");try{const s=await this._commonHeaders();s.set("content-type","application/json");const c={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},u=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._endpoint,c);if(!u.ok){const d=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){const{resourceMetadataUrl:m,scope:h}=$p(u);if(this._resourceMetadataUrl=m,this._scope=h,await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qa;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${d}`)}await((r=u.body)===null||r===void 0?void 0:r.cancel())}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}setProtocolVersion(t){this._protocolVersion=t}}var Vu,_oe=(Vu=class{connector;autoConnect;constructor(t,n=!0){this.connector=t,this.autoConnect=n}async connect(){await this.connector.connect()}async disconnect(){await this.connector.disconnect()}async initialize(){!this.isConnected&&this.autoConnect&&await this.connect(),await this.connector.initialize()}get isConnected(){return this.connector&&this.connector.isClientConnected}on(t,n){t==="notification"&&this.connector.onNotification(n)}async setRoots(t){return this.connector.setRoots(t)}getRoots(){return this.connector.getRoots()}get tools(){return this.connector.tools}async listTools(t){return this.connector.listTools(t)}get serverCapabilities(){return this.connector.serverCapabilities}get serverInfo(){return this.connector.serverInfo}async callTool(t,n={},a){return this.connector.callTool(t,n,a)}async listResources(t,n){return this.connector.listResources(t,n)}async listAllResources(t){return this.connector.listAllResources(t)}async listResourceTemplates(t){return this.connector.listResourceTemplates(t)}async readResource(t,n){return this.connector.readResource(t,n)}async subscribeToResource(t,n){return this.connector.subscribeToResource(t,n)}async unsubscribeFromResource(t,n){return this.connector.unsubscribeFromResource(t,n)}async listPrompts(){return this.connector.listPrompts()}async getPrompt(t,n){return this.connector.getPrompt(t,n)}async request(t,n=null,a){return this.connector.request(t,n,a)}},ze(Vu,"MCPSession"),Vu),Gu,Eoe=(Gu=class{config={};sessions={};activeSessions=[];constructor(t){t&&(this.config=t)}static fromDict(t){throw new Error("fromDict must be implemented by concrete class")}addServer(t,n){this.config.mcpServers=this.config.mcpServers||{},this.config.mcpServers[t]=n,zi.getInstance().trackClientAddServer(t,n)}removeServer(t){this.config.mcpServers?.[t]&&(delete this.config.mcpServers[t],this.activeSessions=this.activeSessions.filter(n=>n!==t),zi.getInstance().trackClientRemoveServer(t))}getServerNames(){return Object.keys(this.config.mcpServers??{})}getServerConfig(t){return this.config.mcpServers?.[t]}getConfig(){return this.config??{}}async createSession(t,n=!0){const a=this.config.mcpServers??{};if(Object.keys(a).length===0&&ke.warn("No MCP servers defined in config"),!a[t])throw new Error(`Server '${t}' not found in config`);const r=this.createConnectorFromConfig(a[t]),i=new _oe(r);return n&&await i.initialize(),this.sessions[t]=i,this.activeSessions.includes(t)||this.activeSessions.push(t),i}async createAllSessions(t=!0){const n=this.config.mcpServers??{};Object.keys(n).length===0&&ke.warn("No MCP servers defined in config");for(const a of Object.keys(n))await this.createSession(a,t);return this.sessions}getSession(t){const n=this.sessions[t];return n||null}requireSession(t){const n=this.sessions[t];if(!n)throw new Error(`Session '${t}' not found. Available sessions: ${this.activeSessions.join(", ")||"none"}`);return n}getAllActiveSessions(){return Object.fromEntries(this.activeSessions.map(t=>[t,this.sessions[t]]))}async closeSession(t){const n=this.sessions[t];if(!n){ke.warn(`No session exists for server ${t}, nothing to close`);return}try{ke.debug(`Closing session for server ${t}`),await n.disconnect()}catch(a){ke.error(`Error closing session for server '${t}': ${a}`)}finally{delete this.sessions[t],this.activeSessions=this.activeSessions.filter(a=>a!==t)}}async closeAllSessions(){const t=Object.keys(this.sessions),n=[];for(const a of t)try{ke.debug(`Closing session for server ${a}`),await this.closeSession(a)}catch(r){const i=`Failed to close session for server '${a}': ${r}`;ke.error(i),n.push(i)}n.length?ke.error(`Encountered ${n.length} errors while closing sessions`):ke.debug("All sessions closed successfully")}},ze(Gu,"BaseMCPClient"),Gu),Wu,koe=(Wu=class{_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),ke.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw new Error("Connection was not established");return this._connection}async stop(){if(this._task&&this._abortController){ke.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(t){t instanceof Error&&t.name==="AbortError"?ke.debug(`${this.constructor.name} task aborted successfully`):ke.warn(`Error stopping ${this.constructor.name} task: ${t}`)}}await this._donePromise,ke.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(t=>this._readyResolver=t),this._donePromise=new Promise(t=>this._doneResolver=t),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){ke.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),ke.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(t){this._exception=t,ke.error(`Error in ${this.constructor.name} task: ${t}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(t){ke.warn(`Error closing connection in ${this.constructor.name}: ${t}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((t,n)=>{if(!this._abortController)return;const a=this._abortController.signal;if(a.aborted){t();return}const r=ze(()=>{a.removeEventListener("abort",r),t()},"onAbort");a.addEventListener("abort",r)})}},ze(Wu,"ConnectionManager"),Wu),Ku,Toe=(Ku=class extends koe{url;opts;_transport=null;reinitializing=!1;constructor(t,n){super(),this.url=typeof t=="string"?new URL(t):t,this.opts=n}async establishConnection(){const t=new xoe(this.url,this.opts),n=t.send.bind(t);return t.send=async a=>{const r=ze(async i=>{if(Array.isArray(i))for(const s of i)await n(s);else await n(i)},"sendMessage");try{await r(a)}catch(i){if(i?.code===404&&t.sessionId&&!this.reinitializing){ke.warn("[SSE] Session not found (404), re-initializing per MCP spec..."),this.reinitializing=!0;try{t.sessionId=void 0,await this.reinitialize(t),ke.info("[SSE] Re-initialization successful, retrying request"),await r(a)}finally{this.reinitializing=!1}}else throw i}},this._transport=t,ke.debug(`${this.constructor.name} connected successfully`),t}async reinitialize(t){ke.debug("[SSE] Re-initialization triggered")}async closeConnection(t){if(this._transport)try{await this._transport.close()}catch(n){ke.warn(`Error closing SSE transport: ${n}`)}finally{this._transport=null}}},ze(Ku,"SseConnectionManager"),Ku),Zu,Noe=(Zu=class extends Eae{baseUrl;headers;timeout;sseReadTimeout;clientInfo;preferSse;transportType=null;streamableTransport=null;constructor(t,n={}){super(n),this.baseUrl=t.replace(/\/$/,""),this.headers={...n.headers??{}},n.authToken&&(this.headers.Authorization=`Bearer ${n.authToken}`),this.timeout=n.timeout??3e4,this.sseReadTimeout=n.sseReadTimeout??3e5,this.clientInfo=n.clientInfo??{name:"http-connector",version:"1.0.0"},this.preferSse=n.preferSse??!1}async connect(){if(this.connected){ke.debug("Already connected to MCP implementation");return}const t=this.baseUrl;if(this.preferSse){ke.debug(`Connecting to MCP implementation via HTTP/SSE: ${t}`),await this.connectWithSse(t);return}ke.debug(`Connecting to MCP implementation via HTTP: ${t}`);try{ke.info("🔄 Attempting streamable HTTP transport..."),await this.connectWithStreamableHttp(t),ke.info("✅ Successfully connected via streamable HTTP")}catch(n){let a="Unknown error",r=!1;if(n instanceof El){const i=n;r=i.code===401,i.code===400&&i.message.includes("Missing session ID")?(a="Server requires session ID (FastMCP compatibility) - using SSE transport",ke.warn(`⚠️ ${a}`)):i.code===404||i.code===405?(a=`Server returned ${i.code} - server likely doesn't support streamable HTTP`,ke.debug(a)):(a=`Server returned ${i.code}: ${i.message}`,ke.debug(a))}else if(n instanceof Error){const i=n.toString(),s=n.message||"";r=i.includes("401")||s.includes("Unauthorized"),i.includes("Missing session ID")||i.includes("Bad Request: Missing session ID")||s.includes("FastMCP session ID error")?(a="Server requires session ID (FastMCP compatibility) - using SSE transport",ke.warn(`⚠️ ${a}`)):i.includes("405 Method Not Allowed")||i.includes("404 Not Found")?(a="Server doesn't support streamable HTTP (405/404)",ke.debug(a)):(a=`Streamable HTTP failed: ${n.message}`,ke.debug(a))}if(r){ke.info("Authentication required - skipping SSE fallback"),await this.cleanupResources();const i=new Error("Authentication required");throw i.code=401,i}ke.info("🔄 Falling back to SSE transport...");try{await this.connectWithSse(t)}catch(i){if(ke.error("Failed to connect with both transports:"),ke.error(` Streamable HTTP: ${a}`),ke.error(` SSE: ${i}`),await this.cleanupResources(),i?.message?.includes("401")||i?.message?.includes("Unauthorized")){const c=new Error("Authentication required");throw c.code=401,c}throw new Error("Could not connect to server with any available transport")}}}async connectWithStreamableHttp(t){try{const n=new voe(new URL(t),{authProvider:this.opts.authProvider,requestInit:{headers:this.headers},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});let a=n;if(this.opts.wrapTransport){const i=this.baseUrl;a=this.opts.wrapTransport(a,i)}const r={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.samplingCallback?{sampling:{}}:{},...this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};ke.debug("Creating Client with capabilities:",JSON.stringify(r.capabilities,null,2)),this.client=new ZP(this.clientInfo,r),this.setupRootsHandler(),ke.debug("Roots handler registered before connect");try{await this.client.connect(a,{timeout:Math.min(this.timeout,3e3)});const i=n.sessionId;i?ke.debug(`Session ID obtained: ${i}`):ke.warn("Session ID not available after connect - this may cause issues with SSE stream")}catch(i){if(i instanceof Error){const s=i.message||i.toString();if(s.includes("Missing session ID")||s.includes("Bad Request: Missing session ID")||s.includes("Mcp-Session-Id header is required")){const c=new Error(`Session ID error: ${s}. The SDK should automatically extract session ID from initialize response.`);throw c.cause=i,c}}throw i}this.streamableTransport=n,this.connectionManager={stop:ze(async()=>{if(this.streamableTransport)try{await this.streamableTransport.terminateSession(),await this.streamableTransport.close()}catch(i){ke.warn(`Error closing Streamable HTTP transport: ${i}`)}finally{this.streamableTransport=null}},"stop")},this.connected=!0,this.transportType="streamable-http",this.setupNotificationHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),ke.debug(`Successfully connected to MCP implementation via streamable HTTP: ${t}`),this.trackConnectorInit({serverUrl:this.baseUrl,publicIdentifier:`${this.baseUrl} (streamable-http)`})}catch(n){throw await this.cleanupResources(),n}}async connectWithSse(t){try{this.connectionManager=new Toe(t,{authProvider:this.opts.authProvider,requestInit:{headers:this.headers}});let n=await this.connectionManager.start();if(this.opts.wrapTransport){const r=this.baseUrl;n=this.opts.wrapTransport(n,r)}const a={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.samplingCallback?{sampling:{}}:{},...this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};ke.debug("Creating Client with capabilities (SSE):",JSON.stringify(a.capabilities,null,2)),this.client=new ZP(this.clientInfo,a),this.setupRootsHandler(),ke.debug("Roots handler registered before connect (SSE)"),await this.client.connect(n),this.connected=!0,this.transportType="sse",this.setupNotificationHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),ke.debug(`Successfully connected to MCP implementation via HTTP/SSE: ${t}`),this.trackConnectorInit({serverUrl:this.baseUrl,publicIdentifier:`${this.baseUrl} (sse)`})}catch(n){throw await this.cleanupResources(),n}}get publicIdentifier(){return{type:"http",url:this.baseUrl,transport:this.transportType||"unknown"}}getTransportType(){return this.transportType}},ze(Zu,"HttpConnector"),Zu),Ul,Coe=(Ul=class extends Eoe{static getPackageVersion(){return Jb()}constructor(t){super(t),this._trackClientInit()}_trackClientInit(){const t=Object.keys(this.config.mcpServers??{});zi.getInstance().trackMCPClientInit({codeMode:!1,sandbox:!1,allCallbacks:!1,verify:!1,servers:t,numServers:t.length,isBrowser:!0}).catch(n=>ke.debug(`Failed to track BrowserMCPClient init: ${n}`))}static fromDict(t){return new Ul(t)}createConnectorFromConfig(t){const{url:n,headers:a,authToken:r,authProvider:i,wrapTransport:s,clientOptions:c,samplingCallback:u,elicitationCallback:d}=t;if(!n)throw new Error("Server URL is required");const m={headers:a,authToken:r,authProvider:i,wrapTransport:s,clientOptions:c,samplingCallback:u,elicitationCallback:d};return c?console.log("[BrowserMCPClient] Passing clientOptions to connector:",JSON.stringify(c,null,2)):console.warn("[BrowserMCPClient] No clientOptions provided to connector!"),new Noe(n,m)}},ze(Ul,"BrowserMCPClient"),Ul);function uu(e){const t=ze(()=>{throw new Error(`Invalid url to pass to open(): ${e}`)},"abort");let n;try{n=new URL(e)}catch{t()}return n.protocol!=="https:"&&n.protocol!=="http:"&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&(n.username=encodeURIComponent(n.username)),n.password&&(n.password=encodeURIComponent(n.password)),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi,"/"),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(t9).join("&"),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}ze(uu,"sanitizeUrl");function t9([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}ze(t9,"sanitizeParam");var Yu,Ob=(Yu=class{serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;callbackUrl;preventAutoAuth;useRedirectFlow;onPopupWindow;constructor(t,n={}){this.serverUrl=t,this.storageKeyPrefix=n.storageKeyPrefix||"mcp:auth",this.serverUrlHash=this.hashString(t),this.clientName=n.clientName||"mcp-use",this.clientUri=n.clientUri||(typeof window<"u"?window.location.origin:""),this.callbackUrl=uu(n.callbackUrl||(typeof window<"u"?new URL("/oauth/callback",window.location.origin).toString():"/oauth/callback")),this.preventAutoAuth=n.preventAutoAuth,this.useRedirectFlow=n.useRedirectFlow,this.onPopupWindow=n.onPopupWindow}get redirectUrl(){return uu(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:this.clientName,client_uri:this.clientUri}}async clientInformation(){const t=this.getKey("client_info"),n=localStorage.getItem(t);if(n)try{return JSON.parse(n)}catch(a){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,a),localStorage.removeItem(t);return}}async saveClientInformation(t){const n=this.getKey("client_info");localStorage.setItem(n,JSON.stringify(t))}async tokens(){const t=this.getKey("tokens"),n=localStorage.getItem(t);if(n)try{return JSON.parse(n)}catch(a){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,a),localStorage.removeItem(t);return}}async saveTokens(t){const n=this.getKey("tokens");localStorage.setItem(n,JSON.stringify(t)),localStorage.removeItem(this.getKey("code_verifier")),localStorage.removeItem(this.getKey("last_auth_url"))}async saveCodeVerifier(t){const n=this.getKey("code_verifier");localStorage.setItem(n,t)}async codeVerifier(){const t=this.getKey("code_verifier"),n=localStorage.getItem(t);if(!n)throw new Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${t}. Auth flow likely corrupted or timed out.`);return n}async prepareAuthorizationUrl(t){const n=globalThis.crypto.randomUUID(),a=`${this.storageKeyPrefix}:state_${n}`,r={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl},flowType:this.useRedirectFlow?"redirect":"popup",returnUrl:this.useRedirectFlow&&typeof window<"u"?window.location.href:void 0};localStorage.setItem(a,JSON.stringify(r)),t.searchParams.set("state",n);const i=t.toString(),s=uu(i);return localStorage.setItem(this.getKey("last_auth_url"),s),s}async redirectToAuthorization(t){const n=await this.prepareAuthorizationUrl(t);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=n;return}const a="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const r=window.open(n,`mcp_auth_${this.serverUrlHash}`,a);this.onPopupWindow&&this.onPopupWindow(n,a,r),!r||r.closed||typeof r.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(r.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(r){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,r)}}getLastAttemptedAuthUrl(){const t=localStorage.getItem(this.getKey("last_auth_url"));return t?uu(t):null}clearStorage(){const t=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,n=`${this.storageKeyPrefix}:state_`,a=[];let r=0;for(let s=0;s<localStorage.length;s++){const c=localStorage.key(s);if(c){if(c.startsWith(t))a.push(c);else if(c.startsWith(n))try{const u=localStorage.getItem(c);u&&JSON.parse(u).serverUrlHash===this.serverUrlHash&&a.push(c)}catch(u){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${c} during clearStorage:`,u)}}}return[...new Set(a)].forEach(s=>{localStorage.removeItem(s),r++}),r}hashString(t){let n=0;for(let a=0;a<t.length;a++){const r=t.charCodeAt(a);n=(n<<5)-n+r,n=n&n}return Math.abs(n).toString(16)}getKey(t){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${t}`}},ze(Yu,"BrowserOAuthClientProvider"),Yu);async function vN(){const e=new URLSearchParams(window.location.search),t=e.get("code"),n=e.get("state"),a=e.get("error"),r=e.get("error_description"),i="[mcp-callback]";console.log(`${i} Handling callback...`,{code:t,state:n,error:a,errorDescription:r});let s=null,c=null;const u=n?`mcp:auth:state_${n}`:null;try{if(a)throw new Error(`OAuth error: ${a} - ${r||"No description provided."}`);if(!t)throw new Error("Authorization code not found in callback query parameters.");if(!n||!u)throw new Error("State parameter not found or invalid in callback query parameters.");const d=localStorage.getItem(u);if(!d)throw new Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{c=JSON.parse(d)}catch{throw new Error("Failed to parse stored OAuth state.")}if(!c.expiry||c.expiry<Date.now())throw localStorage.removeItem(u),new Error("OAuth state has expired. Please try initiating authentication again.");if(!c.providerOptions)throw new Error("Stored state is missing required provider options.");const{serverUrl:m,...h}=c.providerOptions;console.log(`${i} Re-instantiating provider for server: ${m}`),s=new Ob(m,h),console.log(`${i} Calling SDK auth() to exchange code...`);const g=new URL(m).origin,v=await Co(s,{serverUrl:g,authorizationCode:t});if(v==="AUTHORIZED")if(console.log(`${i} Authorization successful via SDK auth().`),c.flowType==="redirect"&&c.returnUrl)console.log(`${i} Redirect flow complete. Returning to: ${c.returnUrl}`),localStorage.removeItem(u),window.location.href=c.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${i} Popup flow complete. Notifying opener...`),window.opener.postMessage({type:"mcp_auth_callback",success:!0},window.location.origin),localStorage.removeItem(u),window.close();else{console.warn(`${i} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(u);const S=window.location.pathname.split("/").filter(Boolean),y=S.length>0&&S[S.length-1]==="callback"?"/"+S.slice(0,-2).join("/"):"/";window.location.href=y||"/"}else throw console.warn(`${i} SDK auth() returned unexpected status: ${v}`),new Error(`Unexpected result from authentication library: ${v}`)}catch(d){console.error(`${i} Error during OAuth callback handling:`,d);const m=d instanceof Error?d.message:String(d);window.opener&&!window.opener.closed&&window.opener.postMessage({type:"mcp_auth_callback",success:!1,error:m},window.location.origin);try{document.body.innerHTML="";const h=document.createElement("div");h.style.fontFamily="sans-serif",h.style.padding="20px";const g=document.createElement("h1");g.textContent="Authentication Error",h.appendChild(g);const v=document.createElement("p");v.style.color="red",v.style.backgroundColor="#ffebeb",v.style.border="1px solid red",v.style.padding="10px",v.style.borderRadius="4px",v.textContent=m,h.appendChild(v);const x=document.createElement("p");x.textContent="You can close this window or ";const S=document.createElement("a");if(S.href="#",S.textContent="click here to close",S.onclick=y=>(y.preventDefault(),window.close(),!1),x.appendChild(S),x.appendChild(document.createTextNode(".")),h.appendChild(x),d instanceof Error&&d.stack){const y=document.createElement("pre");y.style.fontSize="0.8em",y.style.color="#555",y.style.marginTop="20px",y.style.whiteSpace="pre-wrap",y.textContent=d.stack,h.appendChild(y)}document.body.appendChild(h)}catch(h){console.error(`${i} Could not display error in callback window:`,h)}u&&localStorage.removeItem(u),s&&(localStorage.removeItem(s.getKey("code_verifier")),localStorage.removeItem(s.getKey("last_auth_url")))}}ze(vN,"onMcpAuthorization");var tx={exports:{}},bt={};var nU;function Roe(){if(nU)return bt;nU=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function v(j){return j===null||typeof j!="object"?null:(j=g&&j[g]||j["@@iterator"],typeof j=="function"?j:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,y={};function E(j,V,z){this.props=j,this.context=V,this.refs=y,this.updater=z||x}E.prototype.isReactComponent={},E.prototype.setState=function(j,V){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,V,"setState")},E.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function _(){}_.prototype=E.prototype;function k(j,V,z){this.props=j,this.context=V,this.refs=y,this.updater=z||x}var C=k.prototype=new _;C.constructor=k,S(C,E.prototype),C.isPureReactComponent=!0;var R=Array.isArray;function I(){}var A={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function M(j,V,z){var L=z.ref;return{$$typeof:e,type:j,key:V,ref:L!==void 0?L:null,props:z}}function P(j,V){return M(j.type,V,j.props)}function B(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function K(j){var V={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(z){return V[z]})}var ee=/\/+/g;function te(j,V){return typeof j=="object"&&j!==null&&j.key!=null?K(""+j.key):V.toString(36)}function ae(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(I,I):(j.status="pending",j.then(function(V){j.status==="pending"&&(j.status="fulfilled",j.value=V)},function(V){j.status==="pending"&&(j.status="rejected",j.reason=V)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function H(j,V,z,L,$){var F=typeof j;(F==="undefined"||F==="boolean")&&(j=null);var W=!1;if(j===null)W=!0;else switch(F){case"bigint":case"string":case"number":W=!0;break;case"object":switch(j.$$typeof){case e:case t:W=!0;break;case m:return W=j._init,H(W(j._payload),V,z,L,$)}}if(W)return $=$(j),W=L===""?"."+te(j,0):L,R($)?(z="",W!=null&&(z=W.replace(ee,"$&/")+"/"),H($,V,z,"",function(ce){return ce})):$!=null&&(B($)&&($=P($,z+($.key==null||j&&j.key===$.key?"":(""+$.key).replace(ee,"$&/")+"/")+W)),V.push($)),1;W=0;var X=L===""?".":L+":";if(R(j))for(var ie=0;ie<j.length;ie++)L=j[ie],F=X+te(L,ie),W+=H(L,V,z,F,$);else if(ie=v(j),typeof ie=="function")for(j=ie.call(j),ie=0;!(L=j.next()).done;)L=L.value,F=X+te(L,ie++),W+=H(L,V,z,F,$);else if(F==="object"){if(typeof j.then=="function")return H(ae(j),V,z,L,$);throw V=String(j),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return W}function Z(j,V,z){if(j==null)return j;var L=[],$=0;return H(j,L,"","",function(F){return V.call(z,F,$++)}),L}function G(j){if(j._status===-1){var V=j._result;V=V(),V.then(function(z){(j._status===0||j._status===-1)&&(j._status=1,j._result=z)},function(z){(j._status===0||j._status===-1)&&(j._status=2,j._result=z)}),j._status===-1&&(j._status=0,j._result=V)}if(j._status===1)return j._result.default;throw j._result}var re=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},ne={map:Z,forEach:function(j,V,z){Z(j,function(){V.apply(this,arguments)},z)},count:function(j){var V=0;return Z(j,function(){V++}),V},toArray:function(j){return Z(j,function(V){return V})||[]},only:function(j){if(!B(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return bt.Activity=h,bt.Children=ne,bt.Component=E,bt.Fragment=n,bt.Profiler=r,bt.PureComponent=k,bt.StrictMode=a,bt.Suspense=u,bt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,bt.__COMPILER_RUNTIME={__proto__:null,c:function(j){return A.H.useMemoCache(j)}},bt.cache=function(j){return function(){return j.apply(null,arguments)}},bt.cacheSignal=function(){return null},bt.cloneElement=function(j,V,z){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var L=S({},j.props),$=j.key;if(V!=null)for(F in V.key!==void 0&&($=""+V.key),V)!O.call(V,F)||F==="key"||F==="__self"||F==="__source"||F==="ref"&&V.ref===void 0||(L[F]=V[F]);var F=arguments.length-2;if(F===1)L.children=z;else if(1<F){for(var W=Array(F),X=0;X<F;X++)W[X]=arguments[X+2];L.children=W}return M(j.type,$,L)},bt.createContext=function(j){return j={$$typeof:s,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:i,_context:j},j},bt.createElement=function(j,V,z){var L,$={},F=null;if(V!=null)for(L in V.key!==void 0&&(F=""+V.key),V)O.call(V,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&($[L]=V[L]);var W=arguments.length-2;if(W===1)$.children=z;else if(1<W){for(var X=Array(W),ie=0;ie<W;ie++)X[ie]=arguments[ie+2];$.children=X}if(j&&j.defaultProps)for(L in W=j.defaultProps,W)$[L]===void 0&&($[L]=W[L]);return M(j,F,$)},bt.createRef=function(){return{current:null}},bt.forwardRef=function(j){return{$$typeof:c,render:j}},bt.isValidElement=B,bt.lazy=function(j){return{$$typeof:m,_payload:{_status:-1,_result:j},_init:G}},bt.memo=function(j,V){return{$$typeof:d,type:j,compare:V===void 0?null:V}},bt.startTransition=function(j){var V=A.T,z={};A.T=z;try{var L=j(),$=A.S;$!==null&&$(z,L),typeof L=="object"&&L!==null&&typeof L.then=="function"&&L.then(I,re)}catch(F){re(F)}finally{V!==null&&z.types!==null&&(V.types=z.types),A.T=V}},bt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},bt.use=function(j){return A.H.use(j)},bt.useActionState=function(j,V,z){return A.H.useActionState(j,V,z)},bt.useCallback=function(j,V){return A.H.useCallback(j,V)},bt.useContext=function(j){return A.H.useContext(j)},bt.useDebugValue=function(){},bt.useDeferredValue=function(j,V){return A.H.useDeferredValue(j,V)},bt.useEffect=function(j,V){return A.H.useEffect(j,V)},bt.useEffectEvent=function(j){return A.H.useEffectEvent(j)},bt.useId=function(){return A.H.useId()},bt.useImperativeHandle=function(j,V,z){return A.H.useImperativeHandle(j,V,z)},bt.useInsertionEffect=function(j,V){return A.H.useInsertionEffect(j,V)},bt.useLayoutEffect=function(j,V){return A.H.useLayoutEffect(j,V)},bt.useMemo=function(j,V){return A.H.useMemo(j,V)},bt.useOptimistic=function(j,V){return A.H.useOptimistic(j,V)},bt.useReducer=function(j,V,z){return A.H.useReducer(j,V,z)},bt.useRef=function(j){return A.H.useRef(j)},bt.useState=function(j){return A.H.useState(j)},bt.useSyncExternalStore=function(j,V,z){return A.H.useSyncExternalStore(j,V,z)},bt.useTransition=function(){return A.H.useTransition()},bt.version="19.2.3",bt}var rU;function yN(){return rU||(rU=1,tx.exports=Roe()),tx.exports}var w=yN();const ue=ny(w),Ed=lJ({__proto__:null,default:ue},[w]);function O_(e,t){if(!e)throw new Error(t)}ze(O_,"assert");var aU=3e3,Aoe=5e3;function wN(e){const{url:t,enabled:n=!0,clientName:a,clientUri:r,callbackUrl:i=typeof window<"u"?uu(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:s="mcp:auth",clientConfig:c={},customHeaders:u={},debug:d=!1,autoRetry:m=!1,autoReconnect:h=aU,transportType:g="auto",preventAutoAuth:v=!1,useRedirectFlow:x=!1,onPopupWindow:S,timeout:y=3e4,sseReadTimeout:E=3e5,wrapTransport:_,onNotification:k,samplingCallback:C,onElicitation:R}=e,[I,A]=w.useState("discovering"),[O,M]=w.useState([]),[P,B]=w.useState([]),[K,ee]=w.useState([]),[te,ae]=w.useState([]),[H,Z]=w.useState(),[G,re]=w.useState(),[ne,j]=w.useState(void 0),[V,z]=w.useState([]),[L,$]=w.useState(void 0),F=w.useRef(null),W=w.useRef(null),X=w.useRef(!1),ie=w.useRef(!0),ce=w.useRef(0),J=w.useRef(null),q=w.useRef(I),le=w.useRef(h),he=w.useRef(null);w.useEffect(()=>{q.current=I,le.current=h},[I,h]);const oe=w.useCallback((Be,$e,..._e)=>{const je=_e.length>0?`${$e} ${_e.map(Ue=>JSON.stringify(Ue)).join(" ")}`:$e;console[Be](`[useMcp] ${je}`),ie.current&&z(Ue=>[...Ue.slice(-100),{level:Be,message:je,timestamp:Date.now()}])},[]),Ce=w.useCallback(async(Be=!1)=>{if(Be||oe("info","Disconnecting..."),X.current=!1,J.current&&clearTimeout(J.current),J.current=null,F.current)try{const $e="inspector-server",_e=F.current.getSession($e);_e&&_e._healthCheckCleanup&&(_e._healthCheckCleanup(),_e._healthCheckCleanup=null),await F.current.closeSession($e)}catch($e){Be||oe("warn","Error closing session:",$e)}F.current=null,ie.current&&!Be&&(A("discovering"),M([]),B([]),ee([]),ae([]),j(void 0),$(void 0))},[oe]),Ve=w.useCallback((Be,$e)=>{if(oe("error",Be,$e??""),ie.current){A("failed"),j(Be);const _e=W.current?.getLastAttemptedAuthUrl();_e&&($(_e),oe("info","Manual authentication URL may be available.",_e))}X.current=!1,t&&zi.getInstance().trackUseMcpConnection({url:t,transportType:g,success:!1,errorType:$e?.name||"UnknownError",hasOAuth:!!W.current,hasSampling:!!C,hasElicitation:!!R}).catch(()=>{})},[oe,t,g,C,R]),xe=w.useCallback(async()=>{if(!n||!t){oe("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag.");return}if(X.current){oe("debug","Connection attempt already in progress.");return}if(!ie.current){oe("debug","Connect called after unmount, aborting.");return}X.current=!0,ce.current+=1,j(void 0),$(void 0),he.current=null,A("discovering"),oe("info",`Connecting attempt #${ce.current} to ${t}...`),W.current||(W.current=new Ob(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:v,useRedirectFlow:x,onPopupWindow:S}),oe("debug","BrowserOAuthClientProvider initialized in connect.")),F.current||(F.current=new Coe,oe("debug","BrowserMCPClient initialized in connect."));const Be=ze(async(_e,je=!1)=>{oe("info",`Attempting connection with transport: ${_e}`);try{const Ue="inspector-server",We={url:t,transport:_e==="sse"?"http":_e};if(u&&Object.keys(u).length>0&&(We.headers=u),W.current){const Ze=await W.current.tokens();Ze?.access_token&&(We.headers={...We.headers,Authorization:`Bearer ${Ze.access_token}`})}F.current.addServer(Ue,{...We,authProvider:W.current,clientOptions:c,samplingCallback:C,elicitationCallback:R,wrapTransport:_?Ze=>(console.log("[useMcp] Applying transport wrapper for server:",Ue,"url:",t),_(Ze,t)):void 0});const Je=await F.current.createSession(Ue,!1);Je.on("notification",Ze=>{k?.(Ze),Ze.method==="notifications/tools/list_changed"?(oe("info","Tools list changed, auto-refreshing..."),nt().catch(dt=>oe("warn","Auto-refresh tools failed:",dt))):Ze.method==="notifications/resources/list_changed"?(oe("info","Resources list changed, auto-refreshing..."),ft().catch(dt=>oe("warn","Auto-refresh resources failed:",dt))):Ze.method==="notifications/prompts/list_changed"&&(oe("info","Prompts list changed, auto-refreshing..."),Et().catch(dt=>oe("warn","Auto-refresh prompts failed:",dt)))}),await Je.initialize(),oe("info","✅ Successfully connected to MCP server"),oe("info","Server info:",Je.connector.serverInfo),oe("info","Server capabilities:",Je.connector.serverCapabilities),console.log("[useMcp] Server info:",Je.connector.serverInfo),console.log("[useMcp] Server capabilities:",Je.connector.serverCapabilities),A("ready"),he.current=_e;const yt=ze(()=>{let Ze=null,dt=Date.now();const At=1e4,Qn=3e4;return Ze=setInterval(ze(async()=>{if(!ie.current||q.current!=="ready"){Ze&&(clearInterval(Ze),Ze=null);return}try{await Je.connector.listTools(),dt=Date.now()}catch{const Ln=Date.now()-dt;Ln>Qn&&(oe("warn",`Connection appears to be broken (no response for ${Math.round(Ln/1e3)}s), attempting to reconnect...`),Ze&&(clearInterval(Ze),Ze=null),le.current&&ie.current&&(A("discovering"),oe("info","Auto-reconnecting to MCP server..."),setTimeout(()=>{ie.current&&q.current==="discovering"&&xe()},typeof le.current=="number"?le.current:aU)))}},"checkConnectionHealth"),At),()=>{Ze&&(clearInterval(Ze),Ze=null)}},"setupConnectionMonitoring");if(h){const Ze=yt();Je._healthCheckCleanup=Ze}zi.getInstance().trackUseMcpConnection({url:t,transportType:_e,success:!0,hasOAuth:!!W.current,hasSampling:!!C,hasElicitation:!!R}).catch(()=>{}),M(Je.connector.tools||[]);const mt=await Je.connector.listAllResources();B(mt.resources||[]);const Mt=await Je.connector.listPrompts();ae(Mt.prompts||[]);const nn=Je.connector.serverInfo,Ke=Je.connector.serverCapabilities;return nn&&(console.log("[useMcp] Server info:",nn),Z(nn)),Ke&&(console.log("[useMcp] Server capabilities:",Ke),re(Ke)),"success"}catch(Ue){const We=Ue,Je=We?.message||String(Ue);if(We.code===401||Je.includes("401")||Je.includes("Unauthorized")){if(W.current){oe("info","Authentication required. OAuth provider available.");try{const{auth:yt}=await Jn(async()=>{const{auth:Mt}=await Promise.resolve().then(()=>XP);return{auth:Mt}},void 0),mt=new URL(t).origin;yt(W.current,{serverUrl:mt}).catch(()=>{}),setTimeout(()=>{if(ie.current){const Mt=W.current?.getLastAttemptedAuthUrl();Mt?($(Mt),oe("info","Manual authentication URL available:",Mt)):oe("warn","Could not generate authentication URL")}},100)}catch(yt){oe("warn","Error generating auth URL:",yt)}return ie.current&&A("pending_auth"),X.current=!1,"auth_redirect"}return u&&Object.keys(u).length>0?(Ve("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."),"failed"):(Ve("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."),"failed")}return Ve(Je,We instanceof Error?We:new Error(String(We))),"failed"}},"tryConnectWithTransport");let $e="failed";if(g==="sse")oe("debug","Using SSE-only transport mode"),$e=await Be("sse");else if(g==="http")oe("debug","Using HTTP-only transport mode"),$e=await Be("http");else{oe("debug","Using auto transport mode (HTTP with SSE fallback)");const _e=await Be("http");_e==="fallback"&&ie.current&&q.current!=="authenticating"?(oe("info","HTTP failed, attempting SSE fallback..."),$e=await Be("sse")):$e=_e}($e==="success"||$e==="failed"||$e==="auth_redirect")&&(X.current=!1),oe("debug",`Connection sequence finished with status: ${$e}`)},[oe,Ve,Ce,t,s,a,r,i,c.name,c.version,u,g,v,x,S,n,y,E]),Te=w.useCallback(async(Be,$e,_e)=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot call tool "${Be}".`);oe("info",`Calling tool: ${Be}`,$e);const je=Date.now();try{const We=F.current.getSession("inspector-server");if(!We)throw new Error("No active session found");const Je=await We.connector.callTool(Be,$e||{},_e);return oe("info",`Tool "${Be}" call successful:`,Je),zi.getInstance().trackUseMcpToolCall({toolName:Be,success:!0,executionTimeMs:Date.now()-je}).catch(()=>{}),Je}catch(Ue){throw oe("error",`Tool "${Be}" call failed:`,Ue),zi.getInstance().trackUseMcpToolCall({toolName:Be,success:!1,errorType:Ue instanceof Error?Ue.name:"UnknownError",executionTimeMs:Date.now()-je}).catch(()=>{}),Ue}},[I]),Fe=w.useCallback(()=>{q.current==="failed"?(oe("info","Retry requested..."),xe()):oe("warn",`Retry called but state is not 'failed' (state: ${q.current}). Ignoring.`)},[oe,xe]),pe=w.useCallback(async()=>{oe("info","Manual authentication requested...");const Be=q.current;if(Be==="failed")oe("info","Attempting to reconnect and authenticate via retry..."),Fe();else if(Be==="pending_auth"){oe("info","Proceeding with authentication from pending state...");try{O_(W.current,"Auth Provider not available for manual auth"),O_(t,"Server URL is required for authentication"),oe("info","Clearing all OAuth state and initiating fresh flow...");const $e=`${s}:${W.current.serverUrlHash}`;Object.keys(localStorage).forEach(We=>{We.startsWith($e)&&(oe("debug",`Removing stale OAuth key: ${We}`),localStorage.removeItem(We)),We.startsWith(`${s}:state_`)&&(oe("debug",`Removing orphaned state: ${We}`),localStorage.removeItem(We))}),A("authenticating");const _e=new Ob(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:!1,useRedirectFlow:x,onPopupWindow:S});W.current=_e,oe("info","Triggering fresh OAuth authorization...");const{auth:je}=await Jn(async()=>{const{auth:We}=await Promise.resolve().then(()=>XP);return{auth:We}},void 0),Ue=new URL(t).origin;je(_e,{serverUrl:Ue}).catch(We=>{oe("info","OAuth flow initiated:",We instanceof Error?We.message:"Redirecting...")})}catch($e){if(!ie.current)return;A("pending_auth"),oe("error",`Manual authentication failed: ${$e instanceof Error?$e.message:String($e)}`)}}else if(Be==="authenticating"){oe("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const $e=W.current?.getLastAttemptedAuthUrl();$e&&!L&&($($e),oe("info","Manual authentication URL retrieved:",$e))}else oe("info",`Client not in a state requiring manual authentication trigger (state: ${Be}). If needed, try disconnecting and reconnecting.`)},[oe,Fe,L,t,x,S,s,a,r,i]),Oe=w.useCallback(()=>{if(W.current){const Be=W.current.clearStorage();oe("info",`Cleared ${Be} item(s) from localStorage for ${t}.`),$(void 0),Ce()}else oe("warn","Auth provider not initialized, cannot clear storage.")},[t,oe,Ce]),He=w.useCallback(async()=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot list resources.`);oe("info","Listing resources");try{const $e=F.current.getSession("inspector-server");if(!$e)throw new Error("No active session found");const _e=await $e.connector.listAllResources();B(_e.resources||[]),oe("info","Resources listed successfully")}catch(Be){throw oe("error","List resources failed:",Be),Be}},[I]),Se=w.useCallback(async Be=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot read resource.`);oe("info",`Reading resource: ${Be}`);try{const _e=F.current.getSession("inspector-server");if(!_e)throw new Error("No active session found");const je=await _e.connector.readResource(Be);return oe("info","Resource read successful:",je),zi.getInstance().trackUseMcpResourceRead({resourceUri:Be,success:!0}).catch(()=>{}),je}catch($e){throw oe("error","Resource read failed:",$e),zi.getInstance().trackUseMcpResourceRead({resourceUri:Be,success:!1,errorType:$e instanceof Error?$e.name:"UnknownError"}).catch(()=>{}),$e}},[I]),at=w.useCallback(async()=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot list prompts.`);oe("info","Listing prompts");try{const $e=F.current.getSession("inspector-server");if(!$e)throw new Error("No active session found");const _e=await $e.connector.listPrompts();ae(_e.prompts||[]),oe("info","Prompts listed successfully")}catch(Be){throw oe("error","List prompts failed:",Be),Be}},[I]),nt=w.useCallback(async()=>{if(q.current!=="ready"||!F.current){oe("debug","Cannot refresh tools - client not ready");return}oe("debug","Refreshing tools list");try{const $e=F.current.getSession("inspector-server");if(!$e){oe("warn","No active session found for tools refresh");return}const _e=await $e.connector.listTools();M(_e||[]),oe("info","Tools list refreshed successfully")}catch(Be){oe("warn","Failed to refresh tools:",Be)}},[oe]),ft=w.useCallback(async()=>{if(q.current!=="ready"||!F.current){oe("debug","Cannot refresh resources - client not ready");return}oe("debug","Refreshing resources list");try{const $e=F.current.getSession("inspector-server");if(!$e){oe("warn","No active session found for resources refresh");return}const _e=await $e.connector.listAllResources();B(_e.resources||[]),oe("info","Resources list refreshed successfully")}catch(Be){oe("warn","Failed to refresh resources:",Be)}},[oe]),Et=w.useCallback(async()=>{if(q.current!=="ready"||!F.current){oe("debug","Cannot refresh prompts - client not ready");return}oe("debug","Refreshing prompts list");try{const $e=F.current.getSession("inspector-server");if(!$e){oe("warn","No active session found for prompts refresh");return}const _e=await $e.connector.listPrompts();ae(_e.prompts||[]),oe("info","Prompts list refreshed successfully")}catch(Be){oe("warn","Failed to refresh prompts:",Be)}},[oe]),pt=w.useCallback(async()=>{oe("info","Refreshing all lists (tools, resources, prompts)"),await Promise.all([nt(),ft(),Et()])},[nt,ft,Et,oe]),mn=w.useCallback(async(Be,$e)=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot get prompt.`);oe("info",`Getting prompt: ${Be}`,$e);try{const je=F.current.getSession("inspector-server");if(!je)throw new Error("No active session found");const Ue=await je.connector.getPrompt(Be,$e||{});return oe("info",`Prompt "${Be}" retrieved successfully:`,Ue),Ue}catch(_e){throw oe("error",`Prompt "${Be}" retrieval failed:`,_e),_e}},[I]),Pr=w.useRef(xe),St=w.useRef(Ve);return w.useEffect(()=>{Pr.current=xe,St.current=Ve}),w.useEffect(()=>{const Be=ze($e=>{$e.origin===window.location.origin&&$e.data?.type==="mcp_auth_callback"&&(oe("info","Received auth callback message.",$e.data),J.current&&clearTimeout(J.current),J.current=null,$e.data.success?(oe("info","Authentication successful via popup. Reconnecting client..."),X.current&&oe("debug","Connection attempt already in progress, resetting flag to allow reconnection."),X.current=!1,setTimeout(()=>{ie.current&&(oe("debug","Initiating reconnection after successful auth callback."),Pr.current())},100)):St.current(`Authentication failed in callback: ${$e.data.error||"Unknown reason."}`))},"messageHandler");return window.addEventListener("message",Be),oe("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Be),oe("debug","Auth callback message listener removed."),J.current&&clearTimeout(J.current)}},[oe]),w.useEffect(()=>(ie.current=!0,!n||!t?(oe("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag."),A("discovering"),()=>{ie.current=!1}):(oe("debug","useMcp mounted, initiating connection."),ce.current=0,(!W.current||W.current.serverUrl!==t)&&(W.current=new Ob(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:v,useRedirectFlow:x,onPopupWindow:S}),oe("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),xe(),()=>{ie.current=!1,oe("debug","useMcp unmounting, disconnecting."),Ce(!0)})),[t,n,s,i,a,r,c.name,c.version,x]),w.useEffect(()=>{let Be=null;if(I==="failed"&&m&&ce.current>0){const $e=typeof m=="number"?m:Aoe;oe("info",`Connection failed, auto-retrying in ${$e}ms...`),Be=setTimeout(()=>{ie.current&&q.current==="failed"&&Fe()},$e)}return()=>{Be&&clearTimeout(Be)}},[I,m,Fe,oe]),{state:I,tools:O,resources:P,resourceTemplates:K,prompts:te,serverInfo:H,capabilities:G,error:ne,log:V,authUrl:L,client:F.current,callTool:Te,readResource:Se,listResources:He,listPrompts:at,getPrompt:mn,refreshTools:nt,refreshResources:ft,refreshPrompts:Et,refreshAll:pt,retry:Fe,disconnect:Ce,authenticate:pe,clearStorage:Oe}}ze(wN,"useMcp");var qu,Ioe=(qu=class extends ue.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Widget Error:",t,n)}render(){return this.state.hasError?ue.createElement("div",{className:"p-4 border border-red-500 bg-red-50 text-red-900 rounded-md dark:bg-red-900/20 dark:text-red-100"},ue.createElement("h3",{className:"font-bold mb-2"},"Widget Error"),ue.createElement("pre",{className:"text-sm whitespace-pre-wrap"},this.state.error?.message)):this.props.children}},ze(qu,"ErrorBoundary"),qu),pp="openai:set_globals";function di(e){return w.useSyncExternalStore(t=>{const n=ze(a=>{a.detail.globals[e]!==void 0&&t()},"handleSetGlobal");return typeof window<"u"&&window.addEventListener(pp,n),()=>{typeof window<"u"&&window.removeEventListener(pp,n)}},()=>typeof window<"u"&&window.openai?window.openai[e]:void 0)}ze(di,"useOpenAiGlobal");function kd(e){const[t,n]=w.useState(()=>typeof window<"u"&&!!window.openai);w.useEffect(()=>{if(typeof window<"u"&&window.openai){n(!0);return}const P=setInterval(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(P))},100),B=ze(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(P))},"handleSetGlobals");typeof window<"u"&&window.addEventListener(pp,B);const K=setTimeout(()=>{clearInterval(P),typeof window<"u"&&window.removeEventListener(pp,B)},5e3);return()=>{clearInterval(P),clearTimeout(K),typeof window<"u"&&window.removeEventListener(pp,B)}},[]);const a=w.useMemo(()=>t?"openai":"mcp-ui",[t]),r=typeof window<"u"?window.location.search:"",i=w.useMemo(()=>{const P=new URLSearchParams(r);return P.has("mcpUseParams")?JSON.parse(P.get("mcpUseParams")):{toolInput:{},toolOutput:{},toolId:""}},[r]),s=a==="openai"?di("toolInput"):i.toolInput,c=a==="openai"?di("toolOutput"):i.toolOutput,u=di("toolResponseMetadata"),d=w.useMemo(()=>{if(u&&typeof u=="object"){const P=u["mcp-use/props"];if(P)return P}return e||{}},[u,e]),m=di("widgetState"),h=di("theme"),g=di("displayMode"),v=di("safeArea"),x=di("maxHeight"),S=di("userAgent"),y=di("locale"),E=w.useMemo(()=>typeof window<"u"&&window.__mcpPublicUrl?window.__mcpPublicUrl.replace(/\/mcp-use\/public$/,""):"",[]),[_,k]=w.useState(null);w.useEffect(()=>{m!==void 0&&k(m)},[m]);const C=w.useCallback(async(P,B)=>{if(!window.openai?.callTool)throw new Error("window.openai.callTool is not available");return window.openai.callTool(P,B)},[]),R=w.useCallback(async P=>{if(!window.openai?.sendFollowUpMessage)throw new Error("window.openai.sendFollowUpMessage is not available");return window.openai.sendFollowUpMessage({prompt:P})},[]),I=w.useCallback(P=>{if(!window.openai?.openExternal)throw new Error("window.openai.openExternal is not available");window.openai.openExternal({href:P})},[]),A=w.useCallback(async P=>{if(!window.openai?.requestDisplayMode)throw new Error("window.openai.requestDisplayMode is not available");return window.openai.requestDisplayMode({mode:P})},[]),O=w.useCallback(async P=>{if(!window.openai?.setWidgetState)throw new Error("window.openai.setWidgetState is not available");const K=typeof P=="function"?P(m!==void 0?m:_):P;return k(K),window.openai.setWidgetState(K)},[m,_]),M=w.useMemo(()=>a==="openai"&&u===null,[a,u]);return{props:d,toolInput:s||{},output:c??null,metadata:u??null,state:_,setState:O,theme:h||"light",displayMode:g||"inline",safeArea:v||{insets:{top:0,bottom:0,left:0,right:0}},maxHeight:x||600,userAgent:S||{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:y||"en",mcp_url:E,callTool:C,sendFollowUpMessage:R,openExternal:I,requestDisplayMode:A,isAvailable:t,isPending:M}}ze(kd,"useWidget");function Ooe(e){const{props:t}=kd(e);return t}ze(Ooe,"useWidgetProps");function Doe(){const{theme:e}=kd();return e}ze(Doe,"useWidgetTheme");function joe(e){const{state:t,setState:n}=kd();return w.useEffect(()=>{t===null&&e!==void 0&&window.openai?.setWidgetState&&n(e)},[]),[t,n]}ze(joe,"useWidgetState");var iU=ze(({children:e})=>{const{theme:t,isAvailable:n}=kd();console.log("theme",t);const[a,r]=w.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");w.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),c=ze(u=>{r(u.matches?"dark":"light")},"handleChange");return s.addEventListener("change",c),()=>s.removeEventListener("change",c)},[]);const i=n?t:a;return w.useLayoutEffect(()=>{typeof document>"u"||(i==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[i]),ue.createElement(ue.Fragment,null,e)},"ThemeProvider");function n9({children:e,className:t="",position:n="top-right",attachTo:a,showLabels:r=!0,debugger:i=!1,viewControls:s=!1}){const{props:c,output:u,metadata:d,state:m,theme:h,displayMode:g,safeArea:v,maxHeight:x,userAgent:S,locale:y,isAvailable:E,callTool:_,sendFollowUpMessage:k,openExternal:C,requestDisplayMode:R,setState:I}=kd(),[A,O]=w.useState(!1),[M,P]=w.useState(!1),B=w.useRef(null),K=w.useRef(null),[ee,te]=w.useState([]),[ae,H]=w.useState(""),[Z,G]=w.useState("get-my-city"),[re,ne]=w.useState("{}"),[j,V]=w.useState("Test follow-up message"),[z,L]=w.useState("https://docs.mcp-use.com"),$=g==="fullscreen"&&E,F=g==="pip"&&E,W=typeof window<"u"&&window.location.pathname.includes("/inspector/api/");w.useEffect(()=>{const Se=setTimeout(()=>{if(typeof window<"u"&&window.openai)try{const at=Object.keys(window.openai);te(at)}catch{te([])}else te([])},100);return()=>{clearTimeout(Se)}},[]);const X=h==="dark",ie=ze(()=>{const Se=["absolute","z-[1000]","flex","gap-2","transition-opacity","duration-200","ease-in-out",A?"opacity-100":"opacity-0",A?"pointer-events-auto":"pointer-events-none"];switch(n){case"top-left":return[...Se,"top-4","left-4"];case"top-center":return[...Se,"top-4","left-1/2","-translate-x-1/2"];case"top-right":return[...Se,"top-4","right-4"];case"center-left":return[...Se,"top-1/2","left-4","-translate-y-1/2"];case"center-right":return[...Se,"top-1/2","right-4","-translate-y-1/2"];case"bottom-left":return[...Se,"bottom-4","left-4"];case"bottom-center":return[...Se,"bottom-4","left-1/2","-translate-x-1/2"];case"bottom-right":return[...Se,"bottom-4","right-4"];default:return[...Se,"top-4","right-4"]}},"getPositionClasses"),ce=ze(()=>{const at=v?.insets?.top?Math.max(16,v.insets.top+8):16,nt=v?.insets?.right?Math.max(16,v.insets.right+8):16,ft=v?.insets?.bottom?Math.max(16,v.insets.bottom+8):16,Et=v?.insets?.left?Math.max(16,v.insets.left+8):16,pt={};switch(n){case"top-left":pt.top=`${at}px`,pt.left=`${Et}px`;break;case"top-center":pt.top=`${at}px`;break;case"top-right":pt.top=`${at}px`,pt.right=`${nt}px`;break;case"center-left":pt.left=`${Et}px`;break;case"center-right":pt.right=`${nt}px`;break;case"bottom-left":pt.bottom=`${ft}px`,pt.left=`${Et}px`;break;case"bottom-center":pt.bottom=`${ft}px`;break;case"bottom-right":pt.bottom=`${ft}px`,pt.right=`${nt}px`;break;default:pt.top=`${at}px`,pt.right=`${nt}px`;break}return pt},"getPositionOffsetStyles");w.useEffect(()=>{if(!a)return;const Se=ze(()=>O(!0),"handleMouseEnter"),at=ze(()=>O(!1),"handleMouseLeave");return a.addEventListener("mouseenter",Se),a.addEventListener("mouseleave",at),()=>{a.removeEventListener("mouseenter",Se),a.removeEventListener("mouseleave",at)}},[a]),w.useEffect(()=>{if(!M)return;const Se=ze(at=>{K.current&&!K.current.contains(at.target)&&P(!1)},"handleClickOutside");return document.addEventListener("mousedown",Se),()=>{document.removeEventListener("mousedown",Se)}},[M]),w.useEffect(()=>(M?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[M]);const J=ze(()=>{P(!M)},"handleToggleOverlay"),q=ze(async()=>{try{H("Calling tool...");const Se=re.trim()?JSON.parse(re):{},at=await _(Z,Se);H(`Success: ${JSON.stringify(at,null,2)}`)}catch(Se){H(`Error: ${Se.message}`)}},"handleCallTool"),le=ze(async()=>{try{H("Sending follow-up message..."),await k(j),H("Follow-up message sent successfully")}catch(Se){H(`Error: ${Se.message}`)}},"handleSendFollowUpMessage"),he=ze(()=>{try{C(z),H(`Opened external link: ${z}`)}catch(Se){H(`Error: ${Se.message}`)}},"handleOpenExternal"),oe=ze(async Se=>{try{H(`Requesting display mode: ${Se}...`);const at=await R(Se);H(`Display mode granted: ${at.mode}`)}catch(at){H(`Error: ${at.message}`)}},"handleRequestDisplayMode"),Ce=ze(async()=>{try{const Se=m?{...m,debugTimestamp:new Date().toISOString()}:{debugTimestamp:new Date().toISOString()};H("Setting state..."),await I(Se),H(`State updated: ${JSON.stringify(Se,null,2)}`)}catch(Se){H(`Error: ${Se.message}`)}},"handleSetState"),Ve=ze(async()=>{try{await R("fullscreen")}catch(Se){console.error("Failed to go fullscreen:",Se)}},"handleFullscreen"),xe=ze(async()=>{try{await R("pip")}catch(Se){console.error("Failed to go pip:",Se)}},"handlePip"),Te=ze(()=>{const Se=["absolute","px-2","py-1","bg-black/90","text-white","rounded","text-xs","whitespace-nowrap","pointer-events-none","transition-opacity","duration-200","ease-in-out"];switch(n){case"top-right":return[...Se,"top-full","right-0","mt-2"];case"top-left":return[...Se,"top-full","left-0","mt-2"];case"top-center":return[...Se,"top-full","left-1/2","-translate-x-1/2","mt-2"];case"bottom-right":return[...Se,"bottom-full","right-0","mb-2"];case"bottom-left":return[...Se,"bottom-full","left-0","mb-2"];case"bottom-center":return[...Se,"bottom-full","left-1/2","-translate-x-1/2","mb-2"];case"center-left":return[...Se,"left-full","top-1/2","-translate-y-1/2","ml-2"];case"center-right":return[...Se,"right-full","top-1/2","-translate-y-1/2","mr-2"];default:return[...Se,"top-full","right-0","mt-2"]}},"getTooltipClasses"),Fe=ze(({onClick:Se,label:at,children:nt})=>{const[ft,Et]=w.useState(!1),pt=Te();return ue.createElement("button",{className:`p-2 ${X?"bg-white/10 hover:bg-white/20":"bg-black/70 hover:bg-black/90"} text-white border-none rounded-lg cursor-pointer flex items-center justify-center w-8 h-8 transition-colors duration-200 backdrop-blur-md ${X?"shadow-[0_2px_8px_rgba(0,0,0,0.3)]":"shadow-[0_2px_8px_rgba(0,0,0,0.2)]"} relative`,onMouseEnter:()=>Et(!0),onMouseLeave:()=>Et(!1),onClick:Se,"aria-label":at},ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"block"},nt),r&&ue.createElement("span",{className:`${pt.join(" ")} ${ft?"opacity-100":"opacity-0"}`},at))},"IconButton"),pe=ze(Se=>{if(Se===null)return"null";if(Se===void 0)return"undefined";if(typeof Se=="object")try{return JSON.stringify(Se,null,2)}catch{return String(Se)}return String(Se)},"formatValue"),Oe=ze(Se=>Se?`${Se.device?.type||"unknown"}`:"N/A","formatUserAgent"),He=ze(Se=>{if(!Se?.insets)return"N/A";const{top:at,bottom:nt,left:ft,right:Et}=Se.insets;return`T:${at} B:${nt} L:${ft} R:${Et}`},"formatSafeArea");return ue.createElement(ue.Fragment,null,ue.createElement("div",{ref:B,className:`${t} relative h-fit`,onMouseEnter:()=>!a&&O(!0),onMouseLeave:()=>!a&&O(!1)},ue.createElement("div",{className:ie().join(" "),style:ce()},!W&&ue.createElement(ue.Fragment,null,!$&&!F&&ue.createElement(ue.Fragment,null,(s===!0||s==="fullscreen")&&ue.createElement(Fe,{onClick:Ve,label:"Fullscreen"},ue.createElement("path",{d:"M15 3h6v6"}),ue.createElement("path",{d:"m21 3-7 7"}),ue.createElement("path",{d:"m3 21 7-7"}),ue.createElement("path",{d:"M9 21H3v-6"})),(s===!0||s==="pip")&&ue.createElement(Fe,{onClick:xe,label:"Picture in Picture"},ue.createElement("path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4"}),ue.createElement("rect",{width:"10",height:"7",x:"12",y:"13",rx:"2"}))),i&&ue.createElement(Fe,{onClick:J,label:"Debug Info"},ue.createElement("path",{d:"M12 20v-9"}),ue.createElement("path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}),ue.createElement("path",{d:"M14.12 3.88 16 2"}),ue.createElement("path",{d:"M21 21a4 4 0 0 0-3.81-4"}),ue.createElement("path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}),ue.createElement("path",{d:"M22 13h-4"}),ue.createElement("path",{d:"M3 21a4 4 0 0 1 3.81-4"}),ue.createElement("path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}),ue.createElement("path",{d:"M6 13H2"}),ue.createElement("path",{d:"m8 2 1.88 1.88"}),ue.createElement("path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"})))),e),M&&i&&ue.createElement("div",{ref:K,className:"fixed inset-0 bg-black text-white font-mono text-xs z-[10000] overflow-auto p-4",onClick:Se=>{Se.target===K.current&&P(!1)}},ue.createElement("button",{onClick:()=>P(!1),className:"absolute top-4 right-4 bg-white/10 text-white border-none rounded w-8 h-8 cursor-pointer flex items-center justify-center text-lg leading-none","aria-label":"Close"},"×"),ue.createElement("div",{className:"max-w-[1200px] mx-auto pt-10"},ue.createElement("h1",{className:"text-lg font-bold mb-4 border-b border-gray-700 pb-2"},"Debug Info"),ue.createElement("table",{className:"w-full border-collapse border-spacing-0"},ue.createElement("tbody",null,ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Props"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(c))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Output"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(u))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Metadata"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(d))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"State"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(m))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Theme"),ue.createElement("td",{className:"p-2"},h)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Display Mode"),ue.createElement("td",{className:"p-2"},g)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Locale"),ue.createElement("td",{className:"p-2"},y)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Max Height"),ue.createElement("td",{className:"p-2"},x,"px")),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"User Agent"),ue.createElement("td",{className:"p-2"},Oe(S))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Safe Area"),ue.createElement("td",{className:"p-2"},He(v))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"API Available"),ue.createElement("td",{className:"p-2"},E?"Yes":"No")),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"window.openai Keys"),ue.createElement("td",{className:"p-2"},ee.length>0?ee.join(", "):"N/A")))),ue.createElement("h2",{className:"text-base font-bold mt-8 mb-4 border-b border-gray-700 pb-2"},"Actions"),ue.createElement("div",{className:"flex flex-col gap-3"},ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:Z,onChange:Se=>G(Se.target.value),placeholder:"Tool name",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs w-[150px]"}),ue.createElement("input",{type:"text",value:re,onChange:Se=>ne(Se.target.value),placeholder:'{"key": "value"}',className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:q,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Call Tool")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:j,onChange:Se=>V(Se.target.value),placeholder:"Follow-up message",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:le,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Send Follow-Up")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:z,onChange:Se=>L(Se.target.value),placeholder:"External URL",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:he,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Open Link")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("span",{className:"w-[150px] text-xs"},"Display Mode:"),ue.createElement("button",{onClick:()=>oe("inline"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Inline"),ue.createElement("button",{onClick:()=>oe("pip"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"PiP"),ue.createElement("button",{onClick:()=>oe("fullscreen"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Fullscreen")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("button",{onClick:Ce,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Set State (Add Timestamp)")),ae&&ue.createElement("div",{className:"mt-2 p-2 bg-[#1a1a1a] border border-gray-700 rounded whitespace-pre-wrap break-all text-[11px] max-h-[200px] overflow-auto"},ue.createElement("div",{className:"font-bold mb-1 text-gray-400"},"Result:"),ae,ue.createElement("button",{onClick:()=>H(""),className:"mt-2 py-1 px-2 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-[11px]"},"Clear"))))))}ze(n9,"WidgetControls");function r9(){if(typeof window>"u")return"/";const t=window.location.pathname.match(/^(\/inspector\/api\/dev-widget\/[^/]+)/);return t?t[1]:"/"}ze(r9,"getBasename");var Loe=150,$oe=5;function Moe({children:e,debugger:t=!1,viewControls:n=!1,autoSize:a=!1}){const r=r9(),i=w.useRef(null),s=w.useRef(0),c=w.useRef(null),u=w.useRef(!1),[d,m]=w.useState(null),[h,g]=w.useState(null),[v,x]=w.useState(!0);w.useEffect(()=>{let _=!0;return(async()=>{try{const k=await Jn(()=>import("./index-D6VDHNX7.js"),[]);_&&(m(()=>k.BrowserRouter),x(!1))}catch{_&&(g(new Error(`❌ react-router not installed!
35
+ `&&a++}}return[t,n]}class hoe extends TransformStream{constructor({onError:t,onRetry:n,onComment:a}={}){let r;super({start(i){r=QV({onEvent:s=>{i.enqueue(s)},onError(s){t==="terminate"?i.error(s):typeof t=="function"&&t(s)},onRetry:n,onComment:a})},transform(i){r.feed(i)}})}}const goe={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class El extends Error{constructor(t,n){super(`Streamable HTTP error: ${n}`),this.code=t}}class boe{constructor(t,n){var a;this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=UV(n?.fetch,n?.requestInit),this._sessionId=n?.sessionId,this._reconnectionOptions=(a=n?.reconnectionOptions)!==null&&a!==void 0?a:goe}async _authThenStart(){var t;if(!this._authProvider)throw new qa("No auth provider");let n;try{n=await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(a){throw(t=this.onerror)===null||t===void 0||t.call(this,a),a}if(n!=="AUTHORIZED")throw new qa;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var t;const n={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(n.Authorization=`Bearer ${r.access_token}`)}this._sessionId&&(n["mcp-session-id"]=this._sessionId),this._protocolVersion&&(n["mcp-protocol-version"]=this._protocolVersion);const a=pv((t=this._requestInit)===null||t===void 0?void 0:t.headers);return new Headers({...n,...a})}async _startOrAuthSse(t){var n,a,r,i;const{resumptionToken:s}=t;try{const c=await this._commonHeaders();c.set("Accept","text/event-stream"),s&&c.set("last-event-id",s);const u=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,{method:"GET",headers:c,signal:(a=this._abortController)===null||a===void 0?void 0:a.signal});if(!u.ok){if(await((r=u.body)===null||r===void 0?void 0:r.cancel()),u.status===401&&this._authProvider)return await this._authThenStart();if(u.status===405)return;throw new El(u.status,`Failed to open SSE stream: ${u.statusText}`)}this._handleSseStream(u.body,t,!0)}catch(c){throw(i=this.onerror)===null||i===void 0||i.call(this,c),c}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const n=this._reconnectionOptions.initialReconnectionDelay,a=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(n*Math.pow(a,t),r)}_scheduleReconnection(t,n=0){var a;const r=this._reconnectionOptions.maxRetries;if(n>=r){(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}const i=this._getNextReconnectionDelay(n);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,n+1)})},i)}_handleSseStream(t,n,a){if(!t)return;const{onresumptiontoken:r,replayMessageId:i}=n;let s,c=!1,u=!1;(async()=>{var m,h,g,v;try{const x=t.pipeThrough(new TextDecoderStream).pipeThrough(new hoe({onRetry:E=>{this._serverRetryMs=E}})).getReader();for(;;){const{value:E,done:_}=await x.read();if(_)break;if(E.id&&(s=E.id,c=!0,r?.(E.id)),!!E.data&&(!E.event||E.event==="message"))try{const k=Cb.parse(JSON.parse(E.data));Qf(k)&&(u=!0,i!==void 0&&(k.id=i)),(m=this.onmessage)===null||m===void 0||m.call(this,k)}catch(k){(h=this.onerror)===null||h===void 0||h.call(this,k)}}(a||c)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:r,replayMessageId:i},0)}catch(x){if((g=this.onerror)===null||g===void 0||g.call(this,new Error(`SSE stream disconnected: ${x}`)),(a||c)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:r,replayMessageId:i},0)}catch(E){(v=this.onerror)===null||v===void 0||v.call(this,new Error(`Failed to reconnect: ${E instanceof Error?E.message:String(E)}`))}}})()}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(t){if(!this._authProvider)throw new qa("No auth provider");if(await Co(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qa("Failed to authorize")}async close(){var t,n;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(t=this._abortController)===null||t===void 0||t.abort(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(t,n){var a,r,i,s,c,u,d;try{const{resumptionToken:m,onresumptiontoken:h}=n||{};if(m){this._startOrAuthSse({resumptionToken:m,replayMessageId:d_(t)?t.id:void 0}).catch(k=>{var C;return(C=this.onerror)===null||C===void 0?void 0:C.call(this,k)});return}const g=await this._commonHeaders();g.set("content-type","application/json"),g.set("accept","application/json, text/event-stream");const v={...this._requestInit,method:"POST",headers:g,body:JSON.stringify(t),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},x=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,v),S=x.headers.get("mcp-session-id");if(S&&(this._sessionId=S),!x.ok){const k=await x.text().catch(()=>null);if(x.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new El(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:C,scope:R}=$p(x);if(this._resourceMetadataUrl=C,this._scope=R,await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qa;return this._hasCompletedAuthFlow=!0,this.send(t)}if(x.status===403&&this._authProvider){const{resourceMetadataUrl:C,scope:R,error:I}=$p(x);if(I==="insufficient_scope"){const A=x.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===A)throw new El(403,"Server returned 403 after trying upscoping");if(R&&(this._scope=R),C&&(this._resourceMetadataUrl=C),this._lastUpscopingHeader=A??void 0,await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new qa;return this.send(t)}}throw new El(x.status,`Error POSTing to endpoint: ${k}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,x.status===202){await((i=x.body)===null||i===void 0?void 0:i.cancel()),lre(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(k=>{var C;return(C=this.onerror)===null||C===void 0?void 0:C.call(this,k)});return}const E=(Array.isArray(t)?t:[t]).filter(k=>"method"in k&&"id"in k&&k.id!==void 0).length>0,_=x.headers.get("content-type");if(E)if(_?.includes("text/event-stream"))this._handleSseStream(x.body,{onresumptiontoken:h},!1);else if(_?.includes("application/json")){const k=await x.json(),C=Array.isArray(k)?k.map(R=>Cb.parse(R)):[Cb.parse(k)];for(const R of C)(s=this.onmessage)===null||s===void 0||s.call(this,R)}else throw await((c=x.body)===null||c===void 0?void 0:c.cancel()),new El(-1,`Unexpected content type: ${_}`);else await((u=x.body)===null||u===void 0?void 0:u.cancel())}catch(m){throw(d=this.onerror)===null||d===void 0||d.call(this,m),m}}get sessionId(){return this._sessionId}async terminateSession(){var t,n,a,r;if(this._sessionId)try{const i=await this._commonHeaders(),s={...this._requestInit,method:"DELETE",headers:i,signal:(t=this._abortController)===null||t===void 0?void 0:t.signal},c=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,s);if(await((a=c.body)===null||a===void 0?void 0:a.cancel()),!c.ok&&c.status!==405)throw new El(c.status,`Failed to terminate session: ${c.statusText}`);this._sessionId=void 0}catch(i){throw(r=this.onerror)===null||r===void 0||r.call(this,i),i}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,n){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:n?.onresumptiontoken})}}class QP extends Event{constructor(t,n){var a,r;super(t),this.code=(a=n?.code)!=null?a:void 0,this.message=(r=n?.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,a){return a(eU(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(eU(this),n)}}function voe(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function E_(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(E_).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${E_(e.cause)}`:e.message:`${e}`}function eU(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var e9=e=>{throw TypeError(e)},bN=(e,t,n)=>t.has(e)||e9("Cannot "+n),Ft=(e,t,n)=>(bN(e,t,"read from private field"),n?n.call(e):t.get(e)),ur=(e,t,n)=>t.has(e)?e9("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Mn=(e,t,n,a)=>(bN(e,t,"write to private field"),t.set(e,n),n),_o=(e,t,n)=>(bN(e,t,"access private method"),n),ba,Tl,Jc,Ab,vv,dp,cu,fp,Cs,Qc,wu,eu,ep,fi,k_,T_,N_,tU,C_,R_,tp,A_,I_;class Ib extends EventTarget{constructor(t,n){var a,r;super(),ur(this,fi),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,ur(this,ba),ur(this,Tl),ur(this,Jc),ur(this,Ab),ur(this,vv),ur(this,dp),ur(this,cu),ur(this,fp,null),ur(this,Cs),ur(this,Qc),ur(this,wu,null),ur(this,eu,null),ur(this,ep,null),ur(this,T_,async i=>{var s;Ft(this,Qc).reset();const{body:c,redirected:u,status:d,headers:m}=i;if(d===204){_o(this,fi,tp).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?Mn(this,Jc,new URL(i.url)):Mn(this,Jc,void 0),d!==200){_o(this,fi,tp).call(this,`Non-200 status code (${d})`,d);return}if(!(m.get("content-type")||"").startsWith("text/event-stream")){_o(this,fi,tp).call(this,'Invalid content type, expected "text/event-stream"',d);return}if(Ft(this,ba)===this.CLOSED)return;Mn(this,ba,this.OPEN);const h=new Event("open");if((s=Ft(this,ep))==null||s.call(this,h),this.dispatchEvent(h),typeof c!="object"||!c||!("getReader"in c)){_o(this,fi,tp).call(this,"Invalid response body, expected a web ReadableStream",d),this.close();return}const g=new TextDecoder,v=c.getReader();let x=!0;do{const{done:S,value:y}=await v.read();y&&Ft(this,Qc).feed(g.decode(y,{stream:!S})),S&&(x=!1,Ft(this,Qc).reset(),_o(this,fi,A_).call(this))}while(x)}),ur(this,N_,i=>{Mn(this,Cs,void 0),!(i.name==="AbortError"||i.type==="aborted")&&_o(this,fi,A_).call(this,E_(i))}),ur(this,C_,i=>{typeof i.id=="string"&&Mn(this,fp,i.id);const s=new MessageEvent(i.event||"message",{data:i.data,origin:Ft(this,Jc)?Ft(this,Jc).origin:Ft(this,Tl).origin,lastEventId:i.id||""});Ft(this,eu)&&(!i.event||i.event==="message")&&Ft(this,eu).call(this,s),this.dispatchEvent(s)}),ur(this,R_,i=>{Mn(this,dp,i)}),ur(this,I_,()=>{Mn(this,cu,void 0),Ft(this,ba)===this.CONNECTING&&_o(this,fi,k_).call(this)});try{if(t instanceof URL)Mn(this,Tl,t);else if(typeof t=="string")Mn(this,Tl,new URL(t,yoe()));else throw new Error("Invalid URL")}catch{throw voe("An invalid or illegal string was specified")}Mn(this,Qc,QV({onEvent:Ft(this,C_),onRetry:Ft(this,R_)})),Mn(this,ba,this.CONNECTING),Mn(this,dp,3e3),Mn(this,vv,(a=n?.fetch)!=null?a:globalThis.fetch),Mn(this,Ab,(r=n?.withCredentials)!=null?r:!1),_o(this,fi,k_).call(this)}get readyState(){return Ft(this,ba)}get url(){return Ft(this,Tl).href}get withCredentials(){return Ft(this,Ab)}get onerror(){return Ft(this,wu)}set onerror(t){Mn(this,wu,t)}get onmessage(){return Ft(this,eu)}set onmessage(t){Mn(this,eu,t)}get onopen(){return Ft(this,ep)}set onopen(t){Mn(this,ep,t)}addEventListener(t,n,a){const r=n;super.addEventListener(t,r,a)}removeEventListener(t,n,a){const r=n;super.removeEventListener(t,r,a)}close(){Ft(this,cu)&&clearTimeout(Ft(this,cu)),Ft(this,ba)!==this.CLOSED&&(Ft(this,Cs)&&Ft(this,Cs).abort(),Mn(this,ba,this.CLOSED),Mn(this,Cs,void 0))}}ba=new WeakMap,Tl=new WeakMap,Jc=new WeakMap,Ab=new WeakMap,vv=new WeakMap,dp=new WeakMap,cu=new WeakMap,fp=new WeakMap,Cs=new WeakMap,Qc=new WeakMap,wu=new WeakMap,eu=new WeakMap,ep=new WeakMap,fi=new WeakSet,k_=function(){Mn(this,ba,this.CONNECTING),Mn(this,Cs,new AbortController),Ft(this,vv)(Ft(this,Tl),_o(this,fi,tU).call(this)).then(Ft(this,T_)).catch(Ft(this,N_))},T_=new WeakMap,N_=new WeakMap,tU=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ft(this,fp)?{"Last-Event-ID":Ft(this,fp)}:void 0},cache:"no-store",signal:(e=Ft(this,Cs))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},C_=new WeakMap,R_=new WeakMap,tp=function(e,t){var n;Ft(this,ba)!==this.CLOSED&&Mn(this,ba,this.CLOSED);const a=new QP("error",{code:t,message:e});(n=Ft(this,wu))==null||n.call(this,a),this.dispatchEvent(a)},A_=function(e,t){var n;if(Ft(this,ba)===this.CLOSED)return;Mn(this,ba,this.CONNECTING);const a=new QP("error",{code:t,message:e});(n=Ft(this,wu))==null||n.call(this,a),this.dispatchEvent(a),Mn(this,cu,setTimeout(Ft(this,I_),Ft(this,dp)))},I_=new WeakMap,Ib.CONNECTING=0,Ib.OPEN=1,Ib.CLOSED=2;function yoe(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class woe extends Error{constructor(t,n,a){super(`SSE error: ${n}`),this.code=t,this.event=a}}class Soe{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n?.eventSourceInit,this._requestInit=n?.requestInit,this._authProvider=n?.authProvider,this._fetch=n?.fetch,this._fetchWithInit=UV(n?.fetch,n?.requestInit)}async _authThenStart(){var t;if(!this._authProvider)throw new qa("No auth provider");let n;try{n=await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(a){throw(t=this.onerror)===null||t===void 0||t.call(this,a),a}if(n!=="AUTHORIZED")throw new qa;return await this._startOrAuth()}async _commonHeaders(){var t;const n={};if(this._authProvider){const r=await this._authProvider.tokens();r&&(n.Authorization=`Bearer ${r.access_token}`)}this._protocolVersion&&(n["mcp-protocol-version"]=this._protocolVersion);const a=pv((t=this._requestInit)===null||t===void 0?void 0:t.headers);return new Headers({...n,...a})}_startOrAuth(){var t,n,a;const r=(a=(n=(t=this===null||this===void 0?void 0:this._eventSourceInit)===null||t===void 0?void 0:t.fetch)!==null&&n!==void 0?n:this._fetch)!==null&&a!==void 0?a:fetch;return new Promise((i,s)=>{this._eventSource=new Ib(this._url.href,{...this._eventSourceInit,fetch:async(c,u)=>{const d=await this._commonHeaders();d.set("Accept","text/event-stream");const m=await r(c,{...u,headers:d});if(m.status===401&&m.headers.has("www-authenticate")){const{resourceMetadataUrl:h,scope:g}=$p(m);this._resourceMetadataUrl=h,this._scope=g}return m}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var u;if(c.code===401&&this._authProvider){this._authThenStart().then(i,s);return}const d=new woe(c.code,c.message,c);s(d),(u=this.onerror)===null||u===void 0||u.call(this,d)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var u;const d=c;try{if(this._endpoint=new URL(d.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(m){s(m),(u=this.onerror)===null||u===void 0||u.call(this,m),this.close();return}i()}),this._eventSource.onmessage=c=>{var u,d;const m=c;let h;try{h=Cb.parse(JSON.parse(m.data))}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g);return}(d=this.onmessage)===null||d===void 0||d.call(this,h)}})}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(t){if(!this._authProvider)throw new qa("No auth provider");if(await Co(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qa("Failed to authorize")}async close(){var t,n,a;(t=this._abortController)===null||t===void 0||t.abort(),(n=this._eventSource)===null||n===void 0||n.close(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(t){var n,a,r,i;if(!this._endpoint)throw new Error("Not connected");try{const s=await this._commonHeaders();s.set("content-type","application/json");const c={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},u=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._endpoint,c);if(!u.ok){const d=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){const{resourceMetadataUrl:m,scope:h}=$p(u);if(this._resourceMetadataUrl=m,this._scope=h,await Co(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qa;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${d}`)}await((r=u.body)===null||r===void 0?void 0:r.cancel())}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}setProtocolVersion(t){this._protocolVersion=t}}var Hu,xoe=(Hu=class{connector;autoConnect;constructor(t,n=!0){this.connector=t,this.autoConnect=n}async connect(){await this.connector.connect()}async disconnect(){await this.connector.disconnect()}async initialize(){!this.isConnected&&this.autoConnect&&await this.connect(),await this.connector.initialize()}get isConnected(){return this.connector&&this.connector.isClientConnected}on(t,n){t==="notification"&&this.connector.onNotification(n)}async setRoots(t){return this.connector.setRoots(t)}getRoots(){return this.connector.getRoots()}get tools(){return this.connector.tools}async listTools(t){return this.connector.listTools(t)}get serverCapabilities(){return this.connector.serverCapabilities}get serverInfo(){return this.connector.serverInfo}async callTool(t,n={},a){return this.connector.callTool(t,n,a)}async listResources(t,n){return this.connector.listResources(t,n)}async listAllResources(t){return this.connector.listAllResources(t)}async listResourceTemplates(t){return this.connector.listResourceTemplates(t)}async readResource(t,n){return this.connector.readResource(t,n)}async subscribeToResource(t,n){return this.connector.subscribeToResource(t,n)}async unsubscribeFromResource(t,n){return this.connector.unsubscribeFromResource(t,n)}async listPrompts(){return this.connector.listPrompts()}async getPrompt(t,n){return this.connector.getPrompt(t,n)}async request(t,n=null,a){return this.connector.request(t,n,a)}},ze(Hu,"MCPSession"),Hu),Vu,_oe=(Vu=class{config={};sessions={};activeSessions=[];constructor(t){t&&(this.config=t)}static fromDict(t){throw new Error("fromDict must be implemented by concrete class")}addServer(t,n){this.config.mcpServers=this.config.mcpServers||{},this.config.mcpServers[t]=n,zi.getInstance().trackClientAddServer(t,n)}removeServer(t){this.config.mcpServers?.[t]&&(delete this.config.mcpServers[t],this.activeSessions=this.activeSessions.filter(n=>n!==t),zi.getInstance().trackClientRemoveServer(t))}getServerNames(){return Object.keys(this.config.mcpServers??{})}getServerConfig(t){return this.config.mcpServers?.[t]}getConfig(){return this.config??{}}async createSession(t,n=!0){const a=this.config.mcpServers??{};if(Object.keys(a).length===0&&ke.warn("No MCP servers defined in config"),!a[t])throw new Error(`Server '${t}' not found in config`);const r=this.createConnectorFromConfig(a[t]),i=new xoe(r);return n&&await i.initialize(),this.sessions[t]=i,this.activeSessions.includes(t)||this.activeSessions.push(t),i}async createAllSessions(t=!0){const n=this.config.mcpServers??{};Object.keys(n).length===0&&ke.warn("No MCP servers defined in config");for(const a of Object.keys(n))await this.createSession(a,t);return this.sessions}getSession(t){const n=this.sessions[t];return n||null}requireSession(t){const n=this.sessions[t];if(!n)throw new Error(`Session '${t}' not found. Available sessions: ${this.activeSessions.join(", ")||"none"}`);return n}getAllActiveSessions(){return Object.fromEntries(this.activeSessions.map(t=>[t,this.sessions[t]]))}async closeSession(t){const n=this.sessions[t];if(!n){ke.warn(`No session exists for server ${t}, nothing to close`);return}try{ke.debug(`Closing session for server ${t}`),await n.disconnect()}catch(a){ke.error(`Error closing session for server '${t}': ${a}`)}finally{delete this.sessions[t],this.activeSessions=this.activeSessions.filter(a=>a!==t)}}async closeAllSessions(){const t=Object.keys(this.sessions),n=[];for(const a of t)try{ke.debug(`Closing session for server ${a}`),await this.closeSession(a)}catch(r){const i=`Failed to close session for server '${a}': ${r}`;ke.error(i),n.push(i)}n.length?ke.error(`Encountered ${n.length} errors while closing sessions`):ke.debug("All sessions closed successfully")}},ze(Vu,"BaseMCPClient"),Vu),Gu,Eoe=(Gu=class{client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];constructor(t={}){this.opts=t,t.roots&&(this.rootsCache=[...t.roots])}trackConnectorInit(t){const n=this.constructor.name;vF.getInstance().trackConnectorInit({connectorType:n,...t}).catch(a=>ke.debug(`Failed to track connector init: ${a}`))}onNotification(t){this.notificationHandlers.push(t),this.client&&this.setupNotificationHandler()}setupNotificationHandler(){this.client&&(this.client.fallbackNotificationHandler=async t=>{switch(t.method){case"notifications/tools/list_changed":await this.refreshToolsCache();break;case"notifications/resources/list_changed":await this.onResourcesListChanged();break;case"notifications/prompts/list_changed":await this.onPromptsListChanged();break}for(const n of this.notificationHandlers)try{await n(t)}catch(a){ke.error("Error in notification handler:",a)}})}async refreshToolsCache(){if(this.client)try{ke.debug("[Auto] Refreshing tools cache due to list_changed notification");const t=await this.client.listTools();this.toolsCache=t.tools??[],ke.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(t){ke.warn("[Auto] Failed to refresh tools cache:",t)}}async onResourcesListChanged(){ke.debug("[Auto] Resources list changed - clients should re-fetch if needed")}async onPromptsListChanged(){ke.debug("[Auto] Prompts list changed - clients should re-fetch if needed")}async setRoots(t){this.rootsCache=[...t],this.client&&(ke.debug(`Sending roots/list_changed notification with ${t.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(RV,async(t,n)=>(ke.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){ke.debug("setupSamplingHandler: No client available");return}if(!this.opts.samplingCallback){ke.debug("setupSamplingHandler: No sampling callback provided");return}ke.debug("setupSamplingHandler: Setting up sampling request handler"),this.client.setRequestHandler(lN,async(t,n)=>(ke.debug("Server requested sampling, forwarding to callback"),await this.opts.samplingCallback(t.params))),ke.debug("setupSamplingHandler: Sampling handler registered successfully")}setupElicitationHandler(){if(!this.client){ke.debug("setupElicitationHandler: No client available");return}if(!this.opts.elicitationCallback){ke.debug("setupElicitationHandler: No elicitation callback provided");return}ke.debug("setupElicitationHandler: Setting up elicitation request handler"),this.client.setRequestHandler(uN,async(t,n)=>(ke.debug("Server requested elicitation, forwarding to callback"),await this.opts.elicitationCallback(t.params))),ke.debug("setupElicitationHandler: Elicitation handler registered successfully")}async disconnect(){if(!this.connected){ke.debug("Not connected to MCP implementation");return}ke.debug("Disconnecting from MCP implementation"),await this.cleanupResources(),this.connected=!1,ke.debug("Disconnected from MCP implementation")}get isClientConnected(){return this.client!=null}async initialize(t=this.opts.defaultRequestOptions??{}){if(!this.client)throw new Error("MCP client is not connected");ke.debug("Caching server capabilities & tools");const n=this.client.getServerCapabilities();this.capabilitiesCache=n||null;const a=this.client.getServerVersion();this.serverInfoCache=a||null;const r=await this.client.listTools(void 0,t);return this.toolsCache=r.tools??[],ke.debug(`Fetched ${this.toolsCache.length} tools from server`),ke.debug("Server capabilities:",n),ke.debug("Server info:",a),n}get tools(){if(!this.toolsCache)throw new Error("MCP client is not initialized; call initialize() first");return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}async callTool(t,n,a){if(!this.client)throw new Error("MCP client is not connected");const r=a?{...a}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},ke.debug(`[BaseConnector] Added onprogress callback for tool '${t}' to enable progressToken`)),ke.debug(`Calling tool '${t}' with args`,n);const i=await this.client.callTool({name:t,arguments:n},void 0,r);return ke.debug(`Tool '${t}' returned`,i),i}async listTools(t){if(!this.client)throw new Error("MCP client is not connected");return(await this.client.listTools(void 0,t)).tools??[]}async listResources(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug("Listing resources",t?`with cursor: ${t}`:""),await this.client.listResources({cursor:t},n)}async listAllResources(t){if(!this.client)throw new Error("MCP client is not connected");if(!this.capabilitiesCache?.resources)return ke.debug("Server does not advertise resources capability, skipping"),{resources:[]};try{ke.debug("Listing all resources (with auto-pagination)");const n=[];let a;do{const r=await this.client.listResources({cursor:a},t);n.push(...r.resources||[]),a=r.nextCursor}while(a);return{resources:n}}catch(n){if(n.code===-32601)return ke.debug("Server advertised resources but method not found"),{resources:[]};throw n}}async listResourceTemplates(t){if(!this.client)throw new Error("MCP client is not connected");return ke.debug("Listing resource templates"),await this.client.listResourceTemplates(void 0,t)}async readResource(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Reading resource ${t}`),await this.client.readResource({uri:t},n)}async subscribeToResource(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Subscribing to resource: ${t}`),await this.client.subscribeResource({uri:t},n)}async unsubscribeFromResource(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Unsubscribing from resource: ${t}`),await this.client.unsubscribeResource({uri:t},n)}async listPrompts(){if(!this.client)throw new Error("MCP client is not connected");if(!this.capabilitiesCache?.prompts)return ke.debug("Server does not advertise prompts capability, skipping"),{prompts:[]};try{return ke.debug("Listing prompts"),await this.client.listPrompts()}catch(t){if(t.code===-32601)return ke.debug("Server advertised prompts but method not found"),{prompts:[]};throw t}}async getPrompt(t,n){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Getting prompt ${t}`),await this.client.getPrompt({name:t,arguments:n})}async request(t,n=null,a){if(!this.client)throw new Error("MCP client is not connected");return ke.debug(`Sending raw request '${t}' with params`,n),await this.client.request({method:t,params:n??{}},void 0,a)}async cleanupResources(){const t=[];if(this.client)try{typeof this.client.close=="function"&&await this.client.close()}catch(n){const a=`Error closing client: ${n}`;ke.warn(a),t.push(a)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(n){const a=`Error stopping connection manager: ${n}`;ke.warn(a),t.push(a)}finally{this.connectionManager=null}this.toolsCache=null,t.length&&ke.warn(`Resource cleanup finished with ${t.length} issue(s)`)}},ze(Gu,"BaseConnector"),Gu),Wu,koe=(Wu=class{_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),ke.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw new Error("Connection was not established");return this._connection}async stop(){if(this._task&&this._abortController){ke.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(t){t instanceof Error&&t.name==="AbortError"?ke.debug(`${this.constructor.name} task aborted successfully`):ke.warn(`Error stopping ${this.constructor.name} task: ${t}`)}}await this._donePromise,ke.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(t=>this._readyResolver=t),this._donePromise=new Promise(t=>this._doneResolver=t),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){ke.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),ke.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(t){this._exception=t,ke.error(`Error in ${this.constructor.name} task: ${t}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(t){ke.warn(`Error closing connection in ${this.constructor.name}: ${t}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((t,n)=>{if(!this._abortController)return;const a=this._abortController.signal;if(a.aborted){t();return}const r=ze(()=>{a.removeEventListener("abort",r),t()},"onAbort");a.addEventListener("abort",r)})}},ze(Wu,"ConnectionManager"),Wu),Ku,Toe=(Ku=class extends koe{url;opts;_transport=null;reinitializing=!1;constructor(t,n){super(),this.url=typeof t=="string"?new URL(t):t,this.opts=n}async establishConnection(){const t=new Soe(this.url,this.opts),n=t.send.bind(t);return t.send=async a=>{const r=ze(async i=>{if(Array.isArray(i))for(const s of i)await n(s);else await n(i)},"sendMessage");try{await r(a)}catch(i){if(i?.code===404&&t.sessionId&&!this.reinitializing){ke.warn("[SSE] Session not found (404), re-initializing per MCP spec..."),this.reinitializing=!0;try{t.sessionId=void 0,await this.reinitialize(t),ke.info("[SSE] Re-initialization successful, retrying request"),await r(a)}finally{this.reinitializing=!1}}else throw i}},this._transport=t,ke.debug(`${this.constructor.name} connected successfully`),t}async reinitialize(t){ke.debug("[SSE] Re-initialization triggered")}async closeConnection(t){if(this._transport)try{await this._transport.close()}catch(n){ke.warn(`Error closing SSE transport: ${n}`)}finally{this._transport=null}}},ze(Ku,"SseConnectionManager"),Ku),Zu,Noe=(Zu=class extends Eoe{baseUrl;headers;timeout;sseReadTimeout;clientInfo;preferSse;transportType=null;streamableTransport=null;constructor(t,n={}){super(n),this.baseUrl=t.replace(/\/$/,""),this.headers={...n.headers??{}},n.authToken&&(this.headers.Authorization=`Bearer ${n.authToken}`),this.timeout=n.timeout??3e4,this.sseReadTimeout=n.sseReadTimeout??3e5,this.clientInfo=n.clientInfo??{name:"http-connector",version:"1.0.0"},this.preferSse=n.preferSse??!1}async connect(){if(this.connected){ke.debug("Already connected to MCP implementation");return}const t=this.baseUrl;if(this.preferSse){ke.debug(`Connecting to MCP implementation via HTTP/SSE: ${t}`),await this.connectWithSse(t);return}ke.debug(`Connecting to MCP implementation via HTTP: ${t}`);try{ke.info("🔄 Attempting streamable HTTP transport..."),await this.connectWithStreamableHttp(t),ke.info("✅ Successfully connected via streamable HTTP")}catch(n){let a="Unknown error",r=!1;if(n instanceof El){const i=n;r=i.code===401,i.code===400&&i.message.includes("Missing session ID")?(a="Server requires session ID (FastMCP compatibility) - using SSE transport",ke.warn(`⚠️ ${a}`)):i.code===404||i.code===405?(a=`Server returned ${i.code} - server likely doesn't support streamable HTTP`,ke.debug(a)):(a=`Server returned ${i.code}: ${i.message}`,ke.debug(a))}else if(n instanceof Error){const i=n.toString(),s=n.message||"";r=i.includes("401")||s.includes("Unauthorized"),i.includes("Missing session ID")||i.includes("Bad Request: Missing session ID")||s.includes("FastMCP session ID error")?(a="Server requires session ID (FastMCP compatibility) - using SSE transport",ke.warn(`⚠️ ${a}`)):i.includes("405 Method Not Allowed")||i.includes("404 Not Found")?(a="Server doesn't support streamable HTTP (405/404)",ke.debug(a)):(a=`Streamable HTTP failed: ${n.message}`,ke.debug(a))}if(r){ke.info("Authentication required - skipping SSE fallback"),await this.cleanupResources();const i=new Error("Authentication required");throw i.code=401,i}ke.info("🔄 Falling back to SSE transport...");try{await this.connectWithSse(t)}catch(i){if(ke.error("Failed to connect with both transports:"),ke.error(` Streamable HTTP: ${a}`),ke.error(` SSE: ${i}`),await this.cleanupResources(),i?.message?.includes("401")||i?.message?.includes("Unauthorized")){const c=new Error("Authentication required");throw c.code=401,c}throw new Error("Could not connect to server with any available transport")}}}async connectWithStreamableHttp(t){try{const n=new boe(new URL(t),{authProvider:this.opts.authProvider,requestInit:{headers:this.headers},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});let a=n;if(this.opts.wrapTransport){const i=this.baseUrl;a=this.opts.wrapTransport(a,i)}const r={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.samplingCallback?{sampling:{}}:{},...this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};ke.debug("Creating Client with capabilities:",JSON.stringify(r.capabilities,null,2)),this.client=new ZP(this.clientInfo,r),this.setupRootsHandler(),ke.debug("Roots handler registered before connect");try{await this.client.connect(a,{timeout:Math.min(this.timeout,3e3)});const i=n.sessionId;i?ke.debug(`Session ID obtained: ${i}`):ke.warn("Session ID not available after connect - this may cause issues with SSE stream")}catch(i){if(i instanceof Error){const s=i.message||i.toString();if(s.includes("Missing session ID")||s.includes("Bad Request: Missing session ID")||s.includes("Mcp-Session-Id header is required")){const c=new Error(`Session ID error: ${s}. The SDK should automatically extract session ID from initialize response.`);throw c.cause=i,c}}throw i}this.streamableTransport=n,this.connectionManager={stop:ze(async()=>{if(this.streamableTransport)try{await this.streamableTransport.terminateSession(),await this.streamableTransport.close()}catch(i){ke.warn(`Error closing Streamable HTTP transport: ${i}`)}finally{this.streamableTransport=null}},"stop")},this.connected=!0,this.transportType="streamable-http",this.setupNotificationHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),ke.debug(`Successfully connected to MCP implementation via streamable HTTP: ${t}`),this.trackConnectorInit({serverUrl:this.baseUrl,publicIdentifier:`${this.baseUrl} (streamable-http)`})}catch(n){throw await this.cleanupResources(),n}}async connectWithSse(t){try{this.connectionManager=new Toe(t,{authProvider:this.opts.authProvider,requestInit:{headers:this.headers}});let n=await this.connectionManager.start();if(this.opts.wrapTransport){const r=this.baseUrl;n=this.opts.wrapTransport(n,r)}const a={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.samplingCallback?{sampling:{}}:{},...this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};ke.debug("Creating Client with capabilities (SSE):",JSON.stringify(a.capabilities,null,2)),this.client=new ZP(this.clientInfo,a),this.setupRootsHandler(),ke.debug("Roots handler registered before connect (SSE)"),await this.client.connect(n),this.connected=!0,this.transportType="sse",this.setupNotificationHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),ke.debug(`Successfully connected to MCP implementation via HTTP/SSE: ${t}`),this.trackConnectorInit({serverUrl:this.baseUrl,publicIdentifier:`${this.baseUrl} (sse)`})}catch(n){throw await this.cleanupResources(),n}}get publicIdentifier(){return{type:"http",url:this.baseUrl,transport:this.transportType||"unknown"}}getTransportType(){return this.transportType}},ze(Zu,"HttpConnector"),Zu),Ul,Coe=(Ul=class extends _oe{static getPackageVersion(){return Jb()}constructor(t){super(t),this._trackClientInit()}_trackClientInit(){const t=Object.keys(this.config.mcpServers??{});zi.getInstance().trackMCPClientInit({codeMode:!1,sandbox:!1,allCallbacks:!1,verify:!1,servers:t,numServers:t.length,isBrowser:!0}).catch(n=>ke.debug(`Failed to track BrowserMCPClient init: ${n}`))}static fromDict(t){return new Ul(t)}createConnectorFromConfig(t){const{url:n,headers:a,authToken:r,authProvider:i,wrapTransport:s,clientOptions:c,samplingCallback:u,elicitationCallback:d}=t;if(!n)throw new Error("Server URL is required");const m={headers:a,authToken:r,authProvider:i,wrapTransport:s,clientOptions:c,samplingCallback:u,elicitationCallback:d};return c?console.log("[BrowserMCPClient] Passing clientOptions to connector:",JSON.stringify(c,null,2)):console.warn("[BrowserMCPClient] No clientOptions provided to connector!"),new Noe(n,m)}},ze(Ul,"BrowserMCPClient"),Ul);function uu(e){const t=ze(()=>{throw new Error(`Invalid url to pass to open(): ${e}`)},"abort");let n;try{n=new URL(e)}catch{t()}return n.protocol!=="https:"&&n.protocol!=="http:"&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&(n.username=encodeURIComponent(n.username)),n.password&&(n.password=encodeURIComponent(n.password)),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi,"/"),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(t9).join("&"),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}ze(uu,"sanitizeUrl");function t9([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}ze(t9,"sanitizeParam");var Yu,Ob=(Yu=class{serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;callbackUrl;preventAutoAuth;useRedirectFlow;onPopupWindow;constructor(t,n={}){this.serverUrl=t,this.storageKeyPrefix=n.storageKeyPrefix||"mcp:auth",this.serverUrlHash=this.hashString(t),this.clientName=n.clientName||"mcp-use",this.clientUri=n.clientUri||(typeof window<"u"?window.location.origin:""),this.callbackUrl=uu(n.callbackUrl||(typeof window<"u"?new URL("/oauth/callback",window.location.origin).toString():"/oauth/callback")),this.preventAutoAuth=n.preventAutoAuth,this.useRedirectFlow=n.useRedirectFlow,this.onPopupWindow=n.onPopupWindow}get redirectUrl(){return uu(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:this.clientName,client_uri:this.clientUri}}async clientInformation(){const t=this.getKey("client_info"),n=localStorage.getItem(t);if(n)try{return JSON.parse(n)}catch(a){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,a),localStorage.removeItem(t);return}}async saveClientInformation(t){const n=this.getKey("client_info");localStorage.setItem(n,JSON.stringify(t))}async tokens(){const t=this.getKey("tokens"),n=localStorage.getItem(t);if(n)try{return JSON.parse(n)}catch(a){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,a),localStorage.removeItem(t);return}}async saveTokens(t){const n=this.getKey("tokens");localStorage.setItem(n,JSON.stringify(t)),localStorage.removeItem(this.getKey("code_verifier")),localStorage.removeItem(this.getKey("last_auth_url"))}async saveCodeVerifier(t){const n=this.getKey("code_verifier");localStorage.setItem(n,t)}async codeVerifier(){const t=this.getKey("code_verifier"),n=localStorage.getItem(t);if(!n)throw new Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${t}. Auth flow likely corrupted or timed out.`);return n}async prepareAuthorizationUrl(t){const n=globalThis.crypto.randomUUID(),a=`${this.storageKeyPrefix}:state_${n}`,r={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl},flowType:this.useRedirectFlow?"redirect":"popup",returnUrl:this.useRedirectFlow&&typeof window<"u"?window.location.href:void 0};localStorage.setItem(a,JSON.stringify(r)),t.searchParams.set("state",n);const i=t.toString(),s=uu(i);return localStorage.setItem(this.getKey("last_auth_url"),s),s}async redirectToAuthorization(t){const n=await this.prepareAuthorizationUrl(t);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=n;return}const a="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const r=window.open(n,`mcp_auth_${this.serverUrlHash}`,a);this.onPopupWindow&&this.onPopupWindow(n,a,r),!r||r.closed||typeof r.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(r.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(r){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,r)}}getLastAttemptedAuthUrl(){const t=localStorage.getItem(this.getKey("last_auth_url"));return t?uu(t):null}clearStorage(){const t=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,n=`${this.storageKeyPrefix}:state_`,a=[];let r=0;for(let s=0;s<localStorage.length;s++){const c=localStorage.key(s);if(c){if(c.startsWith(t))a.push(c);else if(c.startsWith(n))try{const u=localStorage.getItem(c);u&&JSON.parse(u).serverUrlHash===this.serverUrlHash&&a.push(c)}catch(u){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${c} during clearStorage:`,u)}}}return[...new Set(a)].forEach(s=>{localStorage.removeItem(s),r++}),r}hashString(t){let n=0;for(let a=0;a<t.length;a++){const r=t.charCodeAt(a);n=(n<<5)-n+r,n=n&n}return Math.abs(n).toString(16)}getKey(t){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${t}`}},ze(Yu,"BrowserOAuthClientProvider"),Yu);async function vN(){const e=new URLSearchParams(window.location.search),t=e.get("code"),n=e.get("state"),a=e.get("error"),r=e.get("error_description"),i="[mcp-callback]";console.log(`${i} Handling callback...`,{code:t,state:n,error:a,errorDescription:r});let s=null,c=null;const u=n?`mcp:auth:state_${n}`:null;try{if(a)throw new Error(`OAuth error: ${a} - ${r||"No description provided."}`);if(!t)throw new Error("Authorization code not found in callback query parameters.");if(!n||!u)throw new Error("State parameter not found or invalid in callback query parameters.");const d=localStorage.getItem(u);if(!d)throw new Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{c=JSON.parse(d)}catch{throw new Error("Failed to parse stored OAuth state.")}if(!c.expiry||c.expiry<Date.now())throw localStorage.removeItem(u),new Error("OAuth state has expired. Please try initiating authentication again.");if(!c.providerOptions)throw new Error("Stored state is missing required provider options.");const{serverUrl:m,...h}=c.providerOptions;console.log(`${i} Re-instantiating provider for server: ${m}`),s=new Ob(m,h),console.log(`${i} Calling SDK auth() to exchange code...`);const g=new URL(m).origin,v=await Co(s,{serverUrl:g,authorizationCode:t});if(v==="AUTHORIZED")if(console.log(`${i} Authorization successful via SDK auth().`),c.flowType==="redirect"&&c.returnUrl)console.log(`${i} Redirect flow complete. Returning to: ${c.returnUrl}`),localStorage.removeItem(u),window.location.href=c.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${i} Popup flow complete. Notifying opener...`),window.opener.postMessage({type:"mcp_auth_callback",success:!0},window.location.origin),localStorage.removeItem(u),window.close();else{console.warn(`${i} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(u);const S=window.location.pathname.split("/").filter(Boolean),y=S.length>0&&S[S.length-1]==="callback"?"/"+S.slice(0,-2).join("/"):"/";window.location.href=y||"/"}else throw console.warn(`${i} SDK auth() returned unexpected status: ${v}`),new Error(`Unexpected result from authentication library: ${v}`)}catch(d){console.error(`${i} Error during OAuth callback handling:`,d);const m=d instanceof Error?d.message:String(d);window.opener&&!window.opener.closed&&window.opener.postMessage({type:"mcp_auth_callback",success:!1,error:m},window.location.origin);try{document.body.innerHTML="";const h=document.createElement("div");h.style.fontFamily="sans-serif",h.style.padding="20px";const g=document.createElement("h1");g.textContent="Authentication Error",h.appendChild(g);const v=document.createElement("p");v.style.color="red",v.style.backgroundColor="#ffebeb",v.style.border="1px solid red",v.style.padding="10px",v.style.borderRadius="4px",v.textContent=m,h.appendChild(v);const x=document.createElement("p");x.textContent="You can close this window or ";const S=document.createElement("a");if(S.href="#",S.textContent="click here to close",S.onclick=y=>(y.preventDefault(),window.close(),!1),x.appendChild(S),x.appendChild(document.createTextNode(".")),h.appendChild(x),d instanceof Error&&d.stack){const y=document.createElement("pre");y.style.fontSize="0.8em",y.style.color="#555",y.style.marginTop="20px",y.style.whiteSpace="pre-wrap",y.textContent=d.stack,h.appendChild(y)}document.body.appendChild(h)}catch(h){console.error(`${i} Could not display error in callback window:`,h)}u&&localStorage.removeItem(u),s&&(localStorage.removeItem(s.getKey("code_verifier")),localStorage.removeItem(s.getKey("last_auth_url")))}}ze(vN,"onMcpAuthorization");var tx={exports:{}},bt={};var nU;function Roe(){if(nU)return bt;nU=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function v(j){return j===null||typeof j!="object"?null:(j=g&&j[g]||j["@@iterator"],typeof j=="function"?j:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,y={};function E(j,V,z){this.props=j,this.context=V,this.refs=y,this.updater=z||x}E.prototype.isReactComponent={},E.prototype.setState=function(j,V){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,V,"setState")},E.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function _(){}_.prototype=E.prototype;function k(j,V,z){this.props=j,this.context=V,this.refs=y,this.updater=z||x}var C=k.prototype=new _;C.constructor=k,S(C,E.prototype),C.isPureReactComponent=!0;var R=Array.isArray;function I(){}var A={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function M(j,V,z){var L=z.ref;return{$$typeof:e,type:j,key:V,ref:L!==void 0?L:null,props:z}}function P(j,V){return M(j.type,V,j.props)}function B(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function K(j){var V={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(z){return V[z]})}var ee=/\/+/g;function te(j,V){return typeof j=="object"&&j!==null&&j.key!=null?K(""+j.key):V.toString(36)}function ae(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(I,I):(j.status="pending",j.then(function(V){j.status==="pending"&&(j.status="fulfilled",j.value=V)},function(V){j.status==="pending"&&(j.status="rejected",j.reason=V)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function H(j,V,z,L,$){var F=typeof j;(F==="undefined"||F==="boolean")&&(j=null);var W=!1;if(j===null)W=!0;else switch(F){case"bigint":case"string":case"number":W=!0;break;case"object":switch(j.$$typeof){case e:case t:W=!0;break;case m:return W=j._init,H(W(j._payload),V,z,L,$)}}if(W)return $=$(j),W=L===""?"."+te(j,0):L,R($)?(z="",W!=null&&(z=W.replace(ee,"$&/")+"/"),H($,V,z,"",function(ce){return ce})):$!=null&&(B($)&&($=P($,z+($.key==null||j&&j.key===$.key?"":(""+$.key).replace(ee,"$&/")+"/")+W)),V.push($)),1;W=0;var X=L===""?".":L+":";if(R(j))for(var ie=0;ie<j.length;ie++)L=j[ie],F=X+te(L,ie),W+=H(L,V,z,F,$);else if(ie=v(j),typeof ie=="function")for(j=ie.call(j),ie=0;!(L=j.next()).done;)L=L.value,F=X+te(L,ie++),W+=H(L,V,z,F,$);else if(F==="object"){if(typeof j.then=="function")return H(ae(j),V,z,L,$);throw V=String(j),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return W}function Z(j,V,z){if(j==null)return j;var L=[],$=0;return H(j,L,"","",function(F){return V.call(z,F,$++)}),L}function G(j){if(j._status===-1){var V=j._result;V=V(),V.then(function(z){(j._status===0||j._status===-1)&&(j._status=1,j._result=z)},function(z){(j._status===0||j._status===-1)&&(j._status=2,j._result=z)}),j._status===-1&&(j._status=0,j._result=V)}if(j._status===1)return j._result.default;throw j._result}var re=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},ne={map:Z,forEach:function(j,V,z){Z(j,function(){V.apply(this,arguments)},z)},count:function(j){var V=0;return Z(j,function(){V++}),V},toArray:function(j){return Z(j,function(V){return V})||[]},only:function(j){if(!B(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return bt.Activity=h,bt.Children=ne,bt.Component=E,bt.Fragment=n,bt.Profiler=r,bt.PureComponent=k,bt.StrictMode=a,bt.Suspense=u,bt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,bt.__COMPILER_RUNTIME={__proto__:null,c:function(j){return A.H.useMemoCache(j)}},bt.cache=function(j){return function(){return j.apply(null,arguments)}},bt.cacheSignal=function(){return null},bt.cloneElement=function(j,V,z){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var L=S({},j.props),$=j.key;if(V!=null)for(F in V.key!==void 0&&($=""+V.key),V)!O.call(V,F)||F==="key"||F==="__self"||F==="__source"||F==="ref"&&V.ref===void 0||(L[F]=V[F]);var F=arguments.length-2;if(F===1)L.children=z;else if(1<F){for(var W=Array(F),X=0;X<F;X++)W[X]=arguments[X+2];L.children=W}return M(j.type,$,L)},bt.createContext=function(j){return j={$$typeof:s,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:i,_context:j},j},bt.createElement=function(j,V,z){var L,$={},F=null;if(V!=null)for(L in V.key!==void 0&&(F=""+V.key),V)O.call(V,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&($[L]=V[L]);var W=arguments.length-2;if(W===1)$.children=z;else if(1<W){for(var X=Array(W),ie=0;ie<W;ie++)X[ie]=arguments[ie+2];$.children=X}if(j&&j.defaultProps)for(L in W=j.defaultProps,W)$[L]===void 0&&($[L]=W[L]);return M(j,F,$)},bt.createRef=function(){return{current:null}},bt.forwardRef=function(j){return{$$typeof:c,render:j}},bt.isValidElement=B,bt.lazy=function(j){return{$$typeof:m,_payload:{_status:-1,_result:j},_init:G}},bt.memo=function(j,V){return{$$typeof:d,type:j,compare:V===void 0?null:V}},bt.startTransition=function(j){var V=A.T,z={};A.T=z;try{var L=j(),$=A.S;$!==null&&$(z,L),typeof L=="object"&&L!==null&&typeof L.then=="function"&&L.then(I,re)}catch(F){re(F)}finally{V!==null&&z.types!==null&&(V.types=z.types),A.T=V}},bt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},bt.use=function(j){return A.H.use(j)},bt.useActionState=function(j,V,z){return A.H.useActionState(j,V,z)},bt.useCallback=function(j,V){return A.H.useCallback(j,V)},bt.useContext=function(j){return A.H.useContext(j)},bt.useDebugValue=function(){},bt.useDeferredValue=function(j,V){return A.H.useDeferredValue(j,V)},bt.useEffect=function(j,V){return A.H.useEffect(j,V)},bt.useEffectEvent=function(j){return A.H.useEffectEvent(j)},bt.useId=function(){return A.H.useId()},bt.useImperativeHandle=function(j,V,z){return A.H.useImperativeHandle(j,V,z)},bt.useInsertionEffect=function(j,V){return A.H.useInsertionEffect(j,V)},bt.useLayoutEffect=function(j,V){return A.H.useLayoutEffect(j,V)},bt.useMemo=function(j,V){return A.H.useMemo(j,V)},bt.useOptimistic=function(j,V){return A.H.useOptimistic(j,V)},bt.useReducer=function(j,V,z){return A.H.useReducer(j,V,z)},bt.useRef=function(j){return A.H.useRef(j)},bt.useState=function(j){return A.H.useState(j)},bt.useSyncExternalStore=function(j,V,z){return A.H.useSyncExternalStore(j,V,z)},bt.useTransition=function(){return A.H.useTransition()},bt.version="19.2.3",bt}var rU;function yN(){return rU||(rU=1,tx.exports=Roe()),tx.exports}var w=yN();const ue=ny(w),Ed=lJ({__proto__:null,default:ue},[w]);function O_(e,t){if(!e)throw new Error(t)}ze(O_,"assert");var aU=3e3,Aoe=5e3;function wN(e){const{url:t,enabled:n=!0,clientName:a,clientUri:r,callbackUrl:i=typeof window<"u"?uu(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:s="mcp:auth",clientConfig:c={},customHeaders:u={},debug:d=!1,autoRetry:m=!1,autoReconnect:h=aU,transportType:g="auto",preventAutoAuth:v=!1,useRedirectFlow:x=!1,onPopupWindow:S,timeout:y=3e4,sseReadTimeout:E=3e5,wrapTransport:_,onNotification:k,samplingCallback:C,onElicitation:R}=e,[I,A]=w.useState("discovering"),[O,M]=w.useState([]),[P,B]=w.useState([]),[K,ee]=w.useState([]),[te,ae]=w.useState([]),[H,Z]=w.useState(),[G,re]=w.useState(),[ne,j]=w.useState(void 0),[V,z]=w.useState([]),[L,$]=w.useState(void 0),F=w.useRef(null),W=w.useRef(null),X=w.useRef(!1),ie=w.useRef(!0),ce=w.useRef(0),J=w.useRef(null),q=w.useRef(I),le=w.useRef(h),he=w.useRef(null);w.useEffect(()=>{q.current=I,le.current=h},[I,h]);const oe=w.useCallback((Be,$e,..._e)=>{const je=_e.length>0?`${$e} ${_e.map(Ue=>JSON.stringify(Ue)).join(" ")}`:$e;console[Be](`[useMcp] ${je}`),ie.current&&z(Ue=>[...Ue.slice(-100),{level:Be,message:je,timestamp:Date.now()}])},[]),Ce=w.useCallback(async(Be=!1)=>{if(Be||oe("info","Disconnecting..."),X.current=!1,J.current&&clearTimeout(J.current),J.current=null,F.current)try{const $e="inspector-server",_e=F.current.getSession($e);_e&&_e._healthCheckCleanup&&(_e._healthCheckCleanup(),_e._healthCheckCleanup=null),await F.current.closeSession($e)}catch($e){Be||oe("warn","Error closing session:",$e)}F.current=null,ie.current&&!Be&&(A("discovering"),M([]),B([]),ee([]),ae([]),j(void 0),$(void 0))},[oe]),Ve=w.useCallback((Be,$e)=>{if(oe("error",Be,$e??""),ie.current){A("failed"),j(Be);const _e=W.current?.getLastAttemptedAuthUrl();_e&&($(_e),oe("info","Manual authentication URL may be available.",_e))}X.current=!1,t&&zi.getInstance().trackUseMcpConnection({url:t,transportType:g,success:!1,errorType:$e?.name||"UnknownError",hasOAuth:!!W.current,hasSampling:!!C,hasElicitation:!!R}).catch(()=>{})},[oe,t,g,C,R]),xe=w.useCallback(async()=>{if(!n||!t){oe("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag.");return}if(X.current){oe("debug","Connection attempt already in progress.");return}if(!ie.current){oe("debug","Connect called after unmount, aborting.");return}X.current=!0,ce.current+=1,j(void 0),$(void 0),he.current=null,A("discovering"),oe("info",`Connecting attempt #${ce.current} to ${t}...`),W.current||(W.current=new Ob(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:v,useRedirectFlow:x,onPopupWindow:S}),oe("debug","BrowserOAuthClientProvider initialized in connect.")),F.current||(F.current=new Coe,oe("debug","BrowserMCPClient initialized in connect."));const Be=ze(async(_e,je=!1)=>{oe("info",`Attempting connection with transport: ${_e}`);try{const Ue="inspector-server",We={url:t,transport:_e==="sse"?"http":_e};if(u&&Object.keys(u).length>0&&(We.headers=u),W.current){const Ze=await W.current.tokens();Ze?.access_token&&(We.headers={...We.headers,Authorization:`Bearer ${Ze.access_token}`})}F.current.addServer(Ue,{...We,authProvider:W.current,clientOptions:c,samplingCallback:C,elicitationCallback:R,wrapTransport:_?Ze=>(console.log("[useMcp] Applying transport wrapper for server:",Ue,"url:",t),_(Ze,t)):void 0});const Je=await F.current.createSession(Ue,!1);Je.on("notification",Ze=>{k?.(Ze),Ze.method==="notifications/tools/list_changed"?(oe("info","Tools list changed, auto-refreshing..."),nt().catch(dt=>oe("warn","Auto-refresh tools failed:",dt))):Ze.method==="notifications/resources/list_changed"?(oe("info","Resources list changed, auto-refreshing..."),ft().catch(dt=>oe("warn","Auto-refresh resources failed:",dt))):Ze.method==="notifications/prompts/list_changed"&&(oe("info","Prompts list changed, auto-refreshing..."),Et().catch(dt=>oe("warn","Auto-refresh prompts failed:",dt)))}),await Je.initialize(),oe("info","✅ Successfully connected to MCP server"),oe("info","Server info:",Je.connector.serverInfo),oe("info","Server capabilities:",Je.connector.serverCapabilities),console.log("[useMcp] Server info:",Je.connector.serverInfo),console.log("[useMcp] Server capabilities:",Je.connector.serverCapabilities),A("ready"),he.current=_e;const yt=ze(()=>{let Ze=null,dt=Date.now();const At=1e4,Qn=3e4;return Ze=setInterval(ze(async()=>{if(!ie.current||q.current!=="ready"){Ze&&(clearInterval(Ze),Ze=null);return}try{await Je.connector.listTools(),dt=Date.now()}catch{const Ln=Date.now()-dt;Ln>Qn&&(oe("warn",`Connection appears to be broken (no response for ${Math.round(Ln/1e3)}s), attempting to reconnect...`),Ze&&(clearInterval(Ze),Ze=null),le.current&&ie.current&&(A("discovering"),oe("info","Auto-reconnecting to MCP server..."),setTimeout(()=>{ie.current&&q.current==="discovering"&&xe()},typeof le.current=="number"?le.current:aU)))}},"checkConnectionHealth"),At),()=>{Ze&&(clearInterval(Ze),Ze=null)}},"setupConnectionMonitoring");if(h){const Ze=yt();Je._healthCheckCleanup=Ze}zi.getInstance().trackUseMcpConnection({url:t,transportType:_e,success:!0,hasOAuth:!!W.current,hasSampling:!!C,hasElicitation:!!R}).catch(()=>{}),M(Je.connector.tools||[]);const mt=await Je.connector.listAllResources();B(mt.resources||[]);const Mt=await Je.connector.listPrompts();ae(Mt.prompts||[]);const nn=Je.connector.serverInfo,Ke=Je.connector.serverCapabilities;return nn&&(console.log("[useMcp] Server info:",nn),Z(nn)),Ke&&(console.log("[useMcp] Server capabilities:",Ke),re(Ke)),"success"}catch(Ue){const We=Ue,Je=We?.message||String(Ue);if(We.code===401||Je.includes("401")||Je.includes("Unauthorized")){if(W.current){oe("info","Authentication required. OAuth provider available.");try{const{auth:yt}=await Jn(async()=>{const{auth:Mt}=await Promise.resolve().then(()=>XP);return{auth:Mt}},void 0),mt=new URL(t).origin;yt(W.current,{serverUrl:mt}).catch(()=>{}),setTimeout(()=>{if(ie.current){const Mt=W.current?.getLastAttemptedAuthUrl();Mt?($(Mt),oe("info","Manual authentication URL available:",Mt)):oe("warn","Could not generate authentication URL")}},100)}catch(yt){oe("warn","Error generating auth URL:",yt)}return ie.current&&A("pending_auth"),X.current=!1,"auth_redirect"}return u&&Object.keys(u).length>0?(Ve("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."),"failed"):(Ve("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."),"failed")}return Ve(Je,We instanceof Error?We:new Error(String(We))),"failed"}},"tryConnectWithTransport");let $e="failed";if(g==="sse")oe("debug","Using SSE-only transport mode"),$e=await Be("sse");else if(g==="http")oe("debug","Using HTTP-only transport mode"),$e=await Be("http");else{oe("debug","Using auto transport mode (HTTP with SSE fallback)");const _e=await Be("http");_e==="fallback"&&ie.current&&q.current!=="authenticating"?(oe("info","HTTP failed, attempting SSE fallback..."),$e=await Be("sse")):$e=_e}($e==="success"||$e==="failed"||$e==="auth_redirect")&&(X.current=!1),oe("debug",`Connection sequence finished with status: ${$e}`)},[oe,Ve,Ce,t,s,a,r,i,c.name,c.version,u,g,v,x,S,n,y,E]),Te=w.useCallback(async(Be,$e,_e)=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot call tool "${Be}".`);oe("info",`Calling tool: ${Be}`,$e);const je=Date.now();try{const We=F.current.getSession("inspector-server");if(!We)throw new Error("No active session found");const Je=await We.connector.callTool(Be,$e||{},_e);return oe("info",`Tool "${Be}" call successful:`,Je),zi.getInstance().trackUseMcpToolCall({toolName:Be,success:!0,executionTimeMs:Date.now()-je}).catch(()=>{}),Je}catch(Ue){throw oe("error",`Tool "${Be}" call failed:`,Ue),zi.getInstance().trackUseMcpToolCall({toolName:Be,success:!1,errorType:Ue instanceof Error?Ue.name:"UnknownError",executionTimeMs:Date.now()-je}).catch(()=>{}),Ue}},[I]),Fe=w.useCallback(()=>{q.current==="failed"?(oe("info","Retry requested..."),xe()):oe("warn",`Retry called but state is not 'failed' (state: ${q.current}). Ignoring.`)},[oe,xe]),pe=w.useCallback(async()=>{oe("info","Manual authentication requested...");const Be=q.current;if(Be==="failed")oe("info","Attempting to reconnect and authenticate via retry..."),Fe();else if(Be==="pending_auth"){oe("info","Proceeding with authentication from pending state...");try{O_(W.current,"Auth Provider not available for manual auth"),O_(t,"Server URL is required for authentication"),oe("info","Clearing all OAuth state and initiating fresh flow...");const $e=`${s}:${W.current.serverUrlHash}`;Object.keys(localStorage).forEach(We=>{We.startsWith($e)&&(oe("debug",`Removing stale OAuth key: ${We}`),localStorage.removeItem(We)),We.startsWith(`${s}:state_`)&&(oe("debug",`Removing orphaned state: ${We}`),localStorage.removeItem(We))}),A("authenticating");const _e=new Ob(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:!1,useRedirectFlow:x,onPopupWindow:S});W.current=_e,oe("info","Triggering fresh OAuth authorization...");const{auth:je}=await Jn(async()=>{const{auth:We}=await Promise.resolve().then(()=>XP);return{auth:We}},void 0),Ue=new URL(t).origin;je(_e,{serverUrl:Ue}).catch(We=>{oe("info","OAuth flow initiated:",We instanceof Error?We.message:"Redirecting...")})}catch($e){if(!ie.current)return;A("pending_auth"),oe("error",`Manual authentication failed: ${$e instanceof Error?$e.message:String($e)}`)}}else if(Be==="authenticating"){oe("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const $e=W.current?.getLastAttemptedAuthUrl();$e&&!L&&($($e),oe("info","Manual authentication URL retrieved:",$e))}else oe("info",`Client not in a state requiring manual authentication trigger (state: ${Be}). If needed, try disconnecting and reconnecting.`)},[oe,Fe,L,t,x,S,s,a,r,i]),Oe=w.useCallback(()=>{if(W.current){const Be=W.current.clearStorage();oe("info",`Cleared ${Be} item(s) from localStorage for ${t}.`),$(void 0),Ce()}else oe("warn","Auth provider not initialized, cannot clear storage.")},[t,oe,Ce]),He=w.useCallback(async()=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot list resources.`);oe("info","Listing resources");try{const $e=F.current.getSession("inspector-server");if(!$e)throw new Error("No active session found");const _e=await $e.connector.listAllResources();B(_e.resources||[]),oe("info","Resources listed successfully")}catch(Be){throw oe("error","List resources failed:",Be),Be}},[I]),Se=w.useCallback(async Be=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot read resource.`);oe("info",`Reading resource: ${Be}`);try{const _e=F.current.getSession("inspector-server");if(!_e)throw new Error("No active session found");const je=await _e.connector.readResource(Be);return oe("info","Resource read successful:",je),zi.getInstance().trackUseMcpResourceRead({resourceUri:Be,success:!0}).catch(()=>{}),je}catch($e){throw oe("error","Resource read failed:",$e),zi.getInstance().trackUseMcpResourceRead({resourceUri:Be,success:!1,errorType:$e instanceof Error?$e.name:"UnknownError"}).catch(()=>{}),$e}},[I]),at=w.useCallback(async()=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot list prompts.`);oe("info","Listing prompts");try{const $e=F.current.getSession("inspector-server");if(!$e)throw new Error("No active session found");const _e=await $e.connector.listPrompts();ae(_e.prompts||[]),oe("info","Prompts listed successfully")}catch(Be){throw oe("error","List prompts failed:",Be),Be}},[I]),nt=w.useCallback(async()=>{if(q.current!=="ready"||!F.current){oe("debug","Cannot refresh tools - client not ready");return}oe("debug","Refreshing tools list");try{const $e=F.current.getSession("inspector-server");if(!$e){oe("warn","No active session found for tools refresh");return}const _e=await $e.connector.listTools();M(_e||[]),oe("info","Tools list refreshed successfully")}catch(Be){oe("warn","Failed to refresh tools:",Be)}},[oe]),ft=w.useCallback(async()=>{if(q.current!=="ready"||!F.current){oe("debug","Cannot refresh resources - client not ready");return}oe("debug","Refreshing resources list");try{const $e=F.current.getSession("inspector-server");if(!$e){oe("warn","No active session found for resources refresh");return}const _e=await $e.connector.listAllResources();B(_e.resources||[]),oe("info","Resources list refreshed successfully")}catch(Be){oe("warn","Failed to refresh resources:",Be)}},[oe]),Et=w.useCallback(async()=>{if(q.current!=="ready"||!F.current){oe("debug","Cannot refresh prompts - client not ready");return}oe("debug","Refreshing prompts list");try{const $e=F.current.getSession("inspector-server");if(!$e){oe("warn","No active session found for prompts refresh");return}const _e=await $e.connector.listPrompts();ae(_e.prompts||[]),oe("info","Prompts list refreshed successfully")}catch(Be){oe("warn","Failed to refresh prompts:",Be)}},[oe]),pt=w.useCallback(async()=>{oe("info","Refreshing all lists (tools, resources, prompts)"),await Promise.all([nt(),ft(),Et()])},[nt,ft,Et,oe]),mn=w.useCallback(async(Be,$e)=>{if(q.current!=="ready"||!F.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot get prompt.`);oe("info",`Getting prompt: ${Be}`,$e);try{const je=F.current.getSession("inspector-server");if(!je)throw new Error("No active session found");const Ue=await je.connector.getPrompt(Be,$e||{});return oe("info",`Prompt "${Be}" retrieved successfully:`,Ue),Ue}catch(_e){throw oe("error",`Prompt "${Be}" retrieval failed:`,_e),_e}},[I]),Pr=w.useRef(xe),St=w.useRef(Ve);return w.useEffect(()=>{Pr.current=xe,St.current=Ve}),w.useEffect(()=>{const Be=ze($e=>{$e.origin===window.location.origin&&$e.data?.type==="mcp_auth_callback"&&(oe("info","Received auth callback message.",$e.data),J.current&&clearTimeout(J.current),J.current=null,$e.data.success?(oe("info","Authentication successful via popup. Reconnecting client..."),X.current&&oe("debug","Connection attempt already in progress, resetting flag to allow reconnection."),X.current=!1,setTimeout(()=>{ie.current&&(oe("debug","Initiating reconnection after successful auth callback."),Pr.current())},100)):St.current(`Authentication failed in callback: ${$e.data.error||"Unknown reason."}`))},"messageHandler");return window.addEventListener("message",Be),oe("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Be),oe("debug","Auth callback message listener removed."),J.current&&clearTimeout(J.current)}},[oe]),w.useEffect(()=>(ie.current=!0,!n||!t?(oe("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag."),A("discovering"),()=>{ie.current=!1}):(oe("debug","useMcp mounted, initiating connection."),ce.current=0,(!W.current||W.current.serverUrl!==t)&&(W.current=new Ob(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:v,useRedirectFlow:x,onPopupWindow:S}),oe("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),xe(),()=>{ie.current=!1,oe("debug","useMcp unmounting, disconnecting."),Ce(!0)})),[t,n,s,i,a,r,c.name,c.version,x]),w.useEffect(()=>{let Be=null;if(I==="failed"&&m&&ce.current>0){const $e=typeof m=="number"?m:Aoe;oe("info",`Connection failed, auto-retrying in ${$e}ms...`),Be=setTimeout(()=>{ie.current&&q.current==="failed"&&Fe()},$e)}return()=>{Be&&clearTimeout(Be)}},[I,m,Fe,oe]),{state:I,tools:O,resources:P,resourceTemplates:K,prompts:te,serverInfo:H,capabilities:G,error:ne,log:V,authUrl:L,client:F.current,callTool:Te,readResource:Se,listResources:He,listPrompts:at,getPrompt:mn,refreshTools:nt,refreshResources:ft,refreshPrompts:Et,refreshAll:pt,retry:Fe,disconnect:Ce,authenticate:pe,clearStorage:Oe}}ze(wN,"useMcp");var qu,Ioe=(qu=class extends ue.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Widget Error:",t,n)}render(){return this.state.hasError?ue.createElement("div",{className:"p-4 border border-red-500 bg-red-50 text-red-900 rounded-md dark:bg-red-900/20 dark:text-red-100"},ue.createElement("h3",{className:"font-bold mb-2"},"Widget Error"),ue.createElement("pre",{className:"text-sm whitespace-pre-wrap"},this.state.error?.message)):this.props.children}},ze(qu,"ErrorBoundary"),qu),pp="openai:set_globals";function di(e){return w.useSyncExternalStore(t=>{const n=ze(a=>{a.detail.globals[e]!==void 0&&t()},"handleSetGlobal");return typeof window<"u"&&window.addEventListener(pp,n),()=>{typeof window<"u"&&window.removeEventListener(pp,n)}},()=>typeof window<"u"&&window.openai?window.openai[e]:void 0)}ze(di,"useOpenAiGlobal");function kd(e){const[t,n]=w.useState(()=>typeof window<"u"&&!!window.openai);w.useEffect(()=>{if(typeof window<"u"&&window.openai){n(!0);return}const P=setInterval(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(P))},100),B=ze(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(P))},"handleSetGlobals");typeof window<"u"&&window.addEventListener(pp,B);const K=setTimeout(()=>{clearInterval(P),typeof window<"u"&&window.removeEventListener(pp,B)},5e3);return()=>{clearInterval(P),clearTimeout(K),typeof window<"u"&&window.removeEventListener(pp,B)}},[]);const a=w.useMemo(()=>t?"openai":"mcp-ui",[t]),r=typeof window<"u"?window.location.search:"",i=w.useMemo(()=>{const P=new URLSearchParams(r);return P.has("mcpUseParams")?JSON.parse(P.get("mcpUseParams")):{toolInput:{},toolOutput:{},toolId:""}},[r]),s=a==="openai"?di("toolInput"):i.toolInput,c=a==="openai"?di("toolOutput"):i.toolOutput,u=di("toolResponseMetadata"),d=w.useMemo(()=>{if(u&&typeof u=="object"){const P=u["mcp-use/props"];if(P)return P}return e||{}},[u,e]),m=di("widgetState"),h=di("theme"),g=di("displayMode"),v=di("safeArea"),x=di("maxHeight"),S=di("userAgent"),y=di("locale"),E=w.useMemo(()=>typeof window<"u"&&window.__mcpPublicUrl?window.__mcpPublicUrl.replace(/\/mcp-use\/public$/,""):"",[]),[_,k]=w.useState(null);w.useEffect(()=>{m!==void 0&&k(m)},[m]);const C=w.useCallback(async(P,B)=>{if(!window.openai?.callTool)throw new Error("window.openai.callTool is not available");return window.openai.callTool(P,B)},[]),R=w.useCallback(async P=>{if(!window.openai?.sendFollowUpMessage)throw new Error("window.openai.sendFollowUpMessage is not available");return window.openai.sendFollowUpMessage({prompt:P})},[]),I=w.useCallback(P=>{if(!window.openai?.openExternal)throw new Error("window.openai.openExternal is not available");window.openai.openExternal({href:P})},[]),A=w.useCallback(async P=>{if(!window.openai?.requestDisplayMode)throw new Error("window.openai.requestDisplayMode is not available");return window.openai.requestDisplayMode({mode:P})},[]),O=w.useCallback(async P=>{if(!window.openai?.setWidgetState)throw new Error("window.openai.setWidgetState is not available");const K=typeof P=="function"?P(m!==void 0?m:_):P;return k(K),window.openai.setWidgetState(K)},[m,_]),M=w.useMemo(()=>a==="openai"&&u===null,[a,u]);return{props:d,toolInput:s||{},output:c??null,metadata:u??null,state:_,setState:O,theme:h||"light",displayMode:g||"inline",safeArea:v||{insets:{top:0,bottom:0,left:0,right:0}},maxHeight:x||600,userAgent:S||{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:y||"en",mcp_url:E,callTool:C,sendFollowUpMessage:R,openExternal:I,requestDisplayMode:A,isAvailable:t,isPending:M}}ze(kd,"useWidget");function Ooe(e){const{props:t}=kd(e);return t}ze(Ooe,"useWidgetProps");function Doe(){const{theme:e}=kd();return e}ze(Doe,"useWidgetTheme");function joe(e){const{state:t,setState:n}=kd();return w.useEffect(()=>{t===null&&e!==void 0&&window.openai?.setWidgetState&&n(e)},[]),[t,n]}ze(joe,"useWidgetState");var iU=ze(({children:e})=>{const{theme:t,isAvailable:n}=kd();console.log("theme",t);const[a,r]=w.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");w.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),c=ze(u=>{r(u.matches?"dark":"light")},"handleChange");return s.addEventListener("change",c),()=>s.removeEventListener("change",c)},[]);const i=n?t:a;return w.useLayoutEffect(()=>{typeof document>"u"||(i==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[i]),ue.createElement(ue.Fragment,null,e)},"ThemeProvider");function n9({children:e,className:t="",position:n="top-right",attachTo:a,showLabels:r=!0,debugger:i=!1,viewControls:s=!1}){const{props:c,output:u,metadata:d,state:m,theme:h,displayMode:g,safeArea:v,maxHeight:x,userAgent:S,locale:y,isAvailable:E,callTool:_,sendFollowUpMessage:k,openExternal:C,requestDisplayMode:R,setState:I}=kd(),[A,O]=w.useState(!1),[M,P]=w.useState(!1),B=w.useRef(null),K=w.useRef(null),[ee,te]=w.useState([]),[ae,H]=w.useState(""),[Z,G]=w.useState("get-my-city"),[re,ne]=w.useState("{}"),[j,V]=w.useState("Test follow-up message"),[z,L]=w.useState("https://docs.mcp-use.com"),$=g==="fullscreen"&&E,F=g==="pip"&&E,W=typeof window<"u"&&window.location.pathname.includes("/inspector/api/");w.useEffect(()=>{const Se=setTimeout(()=>{if(typeof window<"u"&&window.openai)try{const at=Object.keys(window.openai);te(at)}catch{te([])}else te([])},100);return()=>{clearTimeout(Se)}},[]);const X=h==="dark",ie=ze(()=>{const Se=["absolute","z-[1000]","flex","gap-2","transition-opacity","duration-200","ease-in-out",A?"opacity-100":"opacity-0",A?"pointer-events-auto":"pointer-events-none"];switch(n){case"top-left":return[...Se,"top-4","left-4"];case"top-center":return[...Se,"top-4","left-1/2","-translate-x-1/2"];case"top-right":return[...Se,"top-4","right-4"];case"center-left":return[...Se,"top-1/2","left-4","-translate-y-1/2"];case"center-right":return[...Se,"top-1/2","right-4","-translate-y-1/2"];case"bottom-left":return[...Se,"bottom-4","left-4"];case"bottom-center":return[...Se,"bottom-4","left-1/2","-translate-x-1/2"];case"bottom-right":return[...Se,"bottom-4","right-4"];default:return[...Se,"top-4","right-4"]}},"getPositionClasses"),ce=ze(()=>{const at=v?.insets?.top?Math.max(16,v.insets.top+8):16,nt=v?.insets?.right?Math.max(16,v.insets.right+8):16,ft=v?.insets?.bottom?Math.max(16,v.insets.bottom+8):16,Et=v?.insets?.left?Math.max(16,v.insets.left+8):16,pt={};switch(n){case"top-left":pt.top=`${at}px`,pt.left=`${Et}px`;break;case"top-center":pt.top=`${at}px`;break;case"top-right":pt.top=`${at}px`,pt.right=`${nt}px`;break;case"center-left":pt.left=`${Et}px`;break;case"center-right":pt.right=`${nt}px`;break;case"bottom-left":pt.bottom=`${ft}px`,pt.left=`${Et}px`;break;case"bottom-center":pt.bottom=`${ft}px`;break;case"bottom-right":pt.bottom=`${ft}px`,pt.right=`${nt}px`;break;default:pt.top=`${at}px`,pt.right=`${nt}px`;break}return pt},"getPositionOffsetStyles");w.useEffect(()=>{if(!a)return;const Se=ze(()=>O(!0),"handleMouseEnter"),at=ze(()=>O(!1),"handleMouseLeave");return a.addEventListener("mouseenter",Se),a.addEventListener("mouseleave",at),()=>{a.removeEventListener("mouseenter",Se),a.removeEventListener("mouseleave",at)}},[a]),w.useEffect(()=>{if(!M)return;const Se=ze(at=>{K.current&&!K.current.contains(at.target)&&P(!1)},"handleClickOutside");return document.addEventListener("mousedown",Se),()=>{document.removeEventListener("mousedown",Se)}},[M]),w.useEffect(()=>(M?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[M]);const J=ze(()=>{P(!M)},"handleToggleOverlay"),q=ze(async()=>{try{H("Calling tool...");const Se=re.trim()?JSON.parse(re):{},at=await _(Z,Se);H(`Success: ${JSON.stringify(at,null,2)}`)}catch(Se){H(`Error: ${Se.message}`)}},"handleCallTool"),le=ze(async()=>{try{H("Sending follow-up message..."),await k(j),H("Follow-up message sent successfully")}catch(Se){H(`Error: ${Se.message}`)}},"handleSendFollowUpMessage"),he=ze(()=>{try{C(z),H(`Opened external link: ${z}`)}catch(Se){H(`Error: ${Se.message}`)}},"handleOpenExternal"),oe=ze(async Se=>{try{H(`Requesting display mode: ${Se}...`);const at=await R(Se);H(`Display mode granted: ${at.mode}`)}catch(at){H(`Error: ${at.message}`)}},"handleRequestDisplayMode"),Ce=ze(async()=>{try{const Se=m?{...m,debugTimestamp:new Date().toISOString()}:{debugTimestamp:new Date().toISOString()};H("Setting state..."),await I(Se),H(`State updated: ${JSON.stringify(Se,null,2)}`)}catch(Se){H(`Error: ${Se.message}`)}},"handleSetState"),Ve=ze(async()=>{try{await R("fullscreen")}catch(Se){console.error("Failed to go fullscreen:",Se)}},"handleFullscreen"),xe=ze(async()=>{try{await R("pip")}catch(Se){console.error("Failed to go pip:",Se)}},"handlePip"),Te=ze(()=>{const Se=["absolute","px-2","py-1","bg-black/90","text-white","rounded","text-xs","whitespace-nowrap","pointer-events-none","transition-opacity","duration-200","ease-in-out"];switch(n){case"top-right":return[...Se,"top-full","right-0","mt-2"];case"top-left":return[...Se,"top-full","left-0","mt-2"];case"top-center":return[...Se,"top-full","left-1/2","-translate-x-1/2","mt-2"];case"bottom-right":return[...Se,"bottom-full","right-0","mb-2"];case"bottom-left":return[...Se,"bottom-full","left-0","mb-2"];case"bottom-center":return[...Se,"bottom-full","left-1/2","-translate-x-1/2","mb-2"];case"center-left":return[...Se,"left-full","top-1/2","-translate-y-1/2","ml-2"];case"center-right":return[...Se,"right-full","top-1/2","-translate-y-1/2","mr-2"];default:return[...Se,"top-full","right-0","mt-2"]}},"getTooltipClasses"),Fe=ze(({onClick:Se,label:at,children:nt})=>{const[ft,Et]=w.useState(!1),pt=Te();return ue.createElement("button",{className:`p-2 ${X?"bg-white/10 hover:bg-white/20":"bg-black/70 hover:bg-black/90"} text-white border-none rounded-lg cursor-pointer flex items-center justify-center w-8 h-8 transition-colors duration-200 backdrop-blur-md ${X?"shadow-[0_2px_8px_rgba(0,0,0,0.3)]":"shadow-[0_2px_8px_rgba(0,0,0,0.2)]"} relative`,onMouseEnter:()=>Et(!0),onMouseLeave:()=>Et(!1),onClick:Se,"aria-label":at},ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"block"},nt),r&&ue.createElement("span",{className:`${pt.join(" ")} ${ft?"opacity-100":"opacity-0"}`},at))},"IconButton"),pe=ze(Se=>{if(Se===null)return"null";if(Se===void 0)return"undefined";if(typeof Se=="object")try{return JSON.stringify(Se,null,2)}catch{return String(Se)}return String(Se)},"formatValue"),Oe=ze(Se=>Se?`${Se.device?.type||"unknown"}`:"N/A","formatUserAgent"),He=ze(Se=>{if(!Se?.insets)return"N/A";const{top:at,bottom:nt,left:ft,right:Et}=Se.insets;return`T:${at} B:${nt} L:${ft} R:${Et}`},"formatSafeArea");return ue.createElement(ue.Fragment,null,ue.createElement("div",{ref:B,className:`${t} relative h-fit`,onMouseEnter:()=>!a&&O(!0),onMouseLeave:()=>!a&&O(!1)},ue.createElement("div",{className:ie().join(" "),style:ce()},!W&&ue.createElement(ue.Fragment,null,!$&&!F&&ue.createElement(ue.Fragment,null,(s===!0||s==="fullscreen")&&ue.createElement(Fe,{onClick:Ve,label:"Fullscreen"},ue.createElement("path",{d:"M15 3h6v6"}),ue.createElement("path",{d:"m21 3-7 7"}),ue.createElement("path",{d:"m3 21 7-7"}),ue.createElement("path",{d:"M9 21H3v-6"})),(s===!0||s==="pip")&&ue.createElement(Fe,{onClick:xe,label:"Picture in Picture"},ue.createElement("path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4"}),ue.createElement("rect",{width:"10",height:"7",x:"12",y:"13",rx:"2"}))),i&&ue.createElement(Fe,{onClick:J,label:"Debug Info"},ue.createElement("path",{d:"M12 20v-9"}),ue.createElement("path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}),ue.createElement("path",{d:"M14.12 3.88 16 2"}),ue.createElement("path",{d:"M21 21a4 4 0 0 0-3.81-4"}),ue.createElement("path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}),ue.createElement("path",{d:"M22 13h-4"}),ue.createElement("path",{d:"M3 21a4 4 0 0 1 3.81-4"}),ue.createElement("path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}),ue.createElement("path",{d:"M6 13H2"}),ue.createElement("path",{d:"m8 2 1.88 1.88"}),ue.createElement("path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"})))),e),M&&i&&ue.createElement("div",{ref:K,className:"fixed inset-0 bg-black text-white font-mono text-xs z-[10000] overflow-auto p-4",onClick:Se=>{Se.target===K.current&&P(!1)}},ue.createElement("button",{onClick:()=>P(!1),className:"absolute top-4 right-4 bg-white/10 text-white border-none rounded w-8 h-8 cursor-pointer flex items-center justify-center text-lg leading-none","aria-label":"Close"},"×"),ue.createElement("div",{className:"max-w-[1200px] mx-auto pt-10"},ue.createElement("h1",{className:"text-lg font-bold mb-4 border-b border-gray-700 pb-2"},"Debug Info"),ue.createElement("table",{className:"w-full border-collapse border-spacing-0"},ue.createElement("tbody",null,ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Props"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(c))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Output"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(u))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Metadata"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(d))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"State"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(m))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Theme"),ue.createElement("td",{className:"p-2"},h)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Display Mode"),ue.createElement("td",{className:"p-2"},g)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Locale"),ue.createElement("td",{className:"p-2"},y)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Max Height"),ue.createElement("td",{className:"p-2"},x,"px")),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"User Agent"),ue.createElement("td",{className:"p-2"},Oe(S))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Safe Area"),ue.createElement("td",{className:"p-2"},He(v))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"API Available"),ue.createElement("td",{className:"p-2"},E?"Yes":"No")),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"window.openai Keys"),ue.createElement("td",{className:"p-2"},ee.length>0?ee.join(", "):"N/A")))),ue.createElement("h2",{className:"text-base font-bold mt-8 mb-4 border-b border-gray-700 pb-2"},"Actions"),ue.createElement("div",{className:"flex flex-col gap-3"},ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:Z,onChange:Se=>G(Se.target.value),placeholder:"Tool name",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs w-[150px]"}),ue.createElement("input",{type:"text",value:re,onChange:Se=>ne(Se.target.value),placeholder:'{"key": "value"}',className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:q,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Call Tool")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:j,onChange:Se=>V(Se.target.value),placeholder:"Follow-up message",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:le,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Send Follow-Up")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:z,onChange:Se=>L(Se.target.value),placeholder:"External URL",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:he,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Open Link")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("span",{className:"w-[150px] text-xs"},"Display Mode:"),ue.createElement("button",{onClick:()=>oe("inline"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Inline"),ue.createElement("button",{onClick:()=>oe("pip"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"PiP"),ue.createElement("button",{onClick:()=>oe("fullscreen"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Fullscreen")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("button",{onClick:Ce,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Set State (Add Timestamp)")),ae&&ue.createElement("div",{className:"mt-2 p-2 bg-[#1a1a1a] border border-gray-700 rounded whitespace-pre-wrap break-all text-[11px] max-h-[200px] overflow-auto"},ue.createElement("div",{className:"font-bold mb-1 text-gray-400"},"Result:"),ae,ue.createElement("button",{onClick:()=>H(""),className:"mt-2 py-1 px-2 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-[11px]"},"Clear"))))))}ze(n9,"WidgetControls");function r9(){if(typeof window>"u")return"/";const t=window.location.pathname.match(/^(\/inspector\/api\/dev-widget\/[^/]+)/);return t?t[1]:"/"}ze(r9,"getBasename");var Loe=150,$oe=5;function Moe({children:e,debugger:t=!1,viewControls:n=!1,autoSize:a=!1}){const r=r9(),i=w.useRef(null),s=w.useRef(0),c=w.useRef(null),u=w.useRef(!1),[d,m]=w.useState(null),[h,g]=w.useState(null),[v,x]=w.useState(!0);w.useEffect(()=>{let _=!0;return(async()=>{try{const k=await Jn(()=>import("./index-rYq5gryB.js"),[]);_&&(m(()=>k.BrowserRouter),x(!1))}catch{_&&(g(new Error(`❌ react-router not installed!
36
36
 
37
37
  To use MCP widgets with McpUseProvider, you need to install:
38
38
 
@@ -90,7 +90,7 @@ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}
90
90
  `)},GU=function(){var e=parseInt(document.body.getAttribute(xu)||"0",10);return isFinite(e)?e:0},Gde=function(){w.useEffect(function(){return document.body.setAttribute(xu,(GU()+1).toString()),function(){var e=GU()-1;e<=0?document.body.removeAttribute(xu):document.body.setAttribute(xu,e.toString())}},[])},Wde=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,r=a===void 0?"margin":a;Gde();var i=w.useMemo(function(){return Bde(r)},[r]);return w.createElement(Hde,{styles:Vde(i,!t,r,n?"":"!important")})},B_=!1;if(typeof window<"u")try{var sb=Object.defineProperty({},"passive",{get:function(){return B_=!0,!0}});window.addEventListener("test",sb,sb),window.removeEventListener("test",sb,sb)}catch{B_=!1}var Kc=B_?{passive:!1}:!1,Kde=function(e){return e.tagName==="TEXTAREA"},E8=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Kde(e)&&n[t]==="visible")},Zde=function(e){return E8(e,"overflowY")},Yde=function(e){return E8(e,"overflowX")},WU=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var r=k8(e,a);if(r){var i=T8(e,a),s=i[1],c=i[2];if(s>c)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},qde=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},Xde=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},k8=function(e,t){return e==="v"?Zde(t):Yde(t)},T8=function(e,t){return e==="v"?qde(t):Xde(t)},Jde=function(e,t){return e==="h"&&t==="rtl"?-1:1},Qde=function(e,t,n,a,r){var i=Jde(e,window.getComputedStyle(t).direction),s=i*a,c=n.target,u=t.contains(c),d=!1,m=s>0,h=0,g=0;do{if(!c)break;var v=T8(e,c),x=v[0],S=v[1],y=v[2],E=S-y-i*x;(x||E)&&k8(e,c)&&(h+=E,g+=x);var _=c.parentNode;c=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(m&&Math.abs(h)<1||!m&&Math.abs(g)<1)&&(d=!0),d},lb=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},KU=function(e){return[e.deltaX,e.deltaY]},ZU=function(e){return e&&"current"in e?e.current:e},efe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},tfe=function(e){return`
91
91
  .block-interactivity-`.concat(e,` {pointer-events: none;}
92
92
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
93
- `)},nfe=0,Zc=[];function rfe(e){var t=w.useRef([]),n=w.useRef([0,0]),a=w.useRef(),r=w.useState(nfe++)[0],i=w.useState(_8)[0],s=w.useRef(e);w.useEffect(function(){s.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var S=Ede([e.lockRef.current],(e.shards||[]).map(ZU),!0).filter(Boolean);return S.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),S.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var c=w.useCallback(function(S,y){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!s.current.allowPinchZoom;var E=lb(S),_=n.current,k="deltaX"in S?S.deltaX:_[0]-E[0],C="deltaY"in S?S.deltaY:_[1]-E[1],R,I=S.target,A=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in S&&A==="h"&&I.type==="range")return!1;var O=window.getSelection(),M=O&&O.anchorNode,P=M?M===I||M.contains(I):!1;if(P)return!1;var B=WU(A,I);if(!B)return!0;if(B?R=A:(R=A==="v"?"h":"v",B=WU(A,I)),!B)return!1;if(!a.current&&"changedTouches"in S&&(k||C)&&(a.current=R),!R)return!0;var K=a.current||R;return Qde(K,y,S,K==="h"?k:C)},[]),u=w.useCallback(function(S){var y=S;if(!(!Zc.length||Zc[Zc.length-1]!==i)){var E="deltaY"in y?KU(y):lb(y),_=t.current.filter(function(R){return R.name===y.type&&(R.target===y.target||y.target===R.shadowParent)&&efe(R.delta,E)})[0];if(_&&_.should){y.cancelable&&y.preventDefault();return}if(!_){var k=(s.current.shards||[]).map(ZU).filter(Boolean).filter(function(R){return R.contains(y.target)}),C=k.length>0?c(y,k[0]):!s.current.noIsolation;C&&y.cancelable&&y.preventDefault()}}},[]),d=w.useCallback(function(S,y,E,_){var k={name:S,delta:y,target:E,should:_,shadowParent:afe(E)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),m=w.useCallback(function(S){n.current=lb(S),a.current=void 0},[]),h=w.useCallback(function(S){d(S.type,KU(S),S.target,c(S,e.lockRef.current))},[]),g=w.useCallback(function(S){d(S.type,lb(S),S.target,c(S,e.lockRef.current))},[]);w.useEffect(function(){return Zc.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Kc),document.addEventListener("touchmove",u,Kc),document.addEventListener("touchstart",m,Kc),function(){Zc=Zc.filter(function(S){return S!==i}),document.removeEventListener("wheel",u,Kc),document.removeEventListener("touchmove",u,Kc),document.removeEventListener("touchstart",m,Kc)}},[]);var v=e.removeScrollBar,x=e.inert;return w.createElement(w.Fragment,null,x?w.createElement(i,{styles:tfe(r)}):null,v?w.createElement(Wde,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function afe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ife=Dde(x8,rfe);var Om=w.forwardRef(function(e,t){return w.createElement(By,Fi({},e,{ref:t,sideCar:ife}))});Om.classNames=By.classNames;var H_=["Enter"," "],ofe=["ArrowDown","PageUp","Home"],N8=["ArrowUp","PageDown","End"],sfe=[...ofe,...N8],lfe={ltr:[...H_,"ArrowRight"],rtl:[...H_,"ArrowLeft"]},cfe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Dm="Menu",[zp,ufe,dfe]=NN(Dm),[tc,C8]=Ii(Dm,[dfe,Zs,m8]),Hy=Zs(),R8=m8(),[ffe,nc]=tc(Dm),[pfe,jm]=tc(Dm),A8=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:i,modal:s=!0}=e,c=Hy(t),[u,d]=w.useState(null),m=w.useRef(!1),h=Zi(i),g=CN(r);return w.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),f.jsx(Py,{...c,children:f.jsx(ffe,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:d,children:f.jsx(pfe,{scope:t,onClose:w.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:g,modal:s,children:a})})})};A8.displayName=Dm;var mfe="MenuAnchor",PN=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Hy(n);return f.jsx(Am,{...r,...a,ref:t})});PN.displayName=mfe;var UN="MenuPortal",[hfe,I8]=tc(UN,{forceMount:void 0}),O8=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,i=nc(UN,t);return f.jsx(hfe,{scope:t,forceMount:n,children:f.jsx(Ua,{present:n||i.open,children:f.jsx(Ld,{asChild:!0,container:r,children:a})})})};O8.displayName=UN;var Qa="MenuContent",[gfe,zN]=tc(Qa),D8=w.forwardRef((e,t)=>{const n=I8(Qa,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,i=nc(Qa,e.__scopeMenu),s=jm(Qa,e.__scopeMenu);return f.jsx(zp.Provider,{scope:e.__scopeMenu,children:f.jsx(Ua,{present:a||i.open,children:f.jsx(zp.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(bfe,{...r,ref:t}):f.jsx(vfe,{...r,ref:t})})})})}),bfe=w.forwardRef((e,t)=>{const n=nc(Qa,e.__scopeMenu),a=w.useRef(null),r=Jt(t,a);return w.useEffect(()=>{const i=a.current;if(i)return Fy(i)},[]),f.jsx(FN,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ge(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),vfe=w.forwardRef((e,t)=>{const n=nc(Qa,e.__scopeMenu);return f.jsx(FN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yfe=Hl("MenuContent.ScrollLock"),FN=w.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:x,...S}=e,y=nc(Qa,n),E=jm(Qa,n),_=Hy(n),k=R8(n),C=ufe(n),[R,I]=w.useState(null),A=w.useRef(null),O=Jt(t,A,y.onContentChange),M=w.useRef(0),P=w.useRef(""),B=w.useRef(0),K=w.useRef(null),ee=w.useRef("right"),te=w.useRef(0),ae=x?Om:w.Fragment,H=x?{as:yfe,allowPinchZoom:!0}:void 0,Z=re=>{const ne=P.current+re,j=C().filter(W=>!W.disabled),V=document.activeElement,z=j.find(W=>W.ref.current===V)?.textValue,L=j.map(W=>W.textValue),$=Ife(L,ne,z),F=j.find(W=>W.textValue===$)?.ref.current;(function W(X){P.current=X,window.clearTimeout(M.current),X!==""&&(M.current=window.setTimeout(()=>W(""),1e3))})(ne),F&&setTimeout(()=>F.focus())};w.useEffect(()=>()=>window.clearTimeout(M.current),[]),Dy();const G=w.useCallback(re=>ee.current===K.current?.side&&Dfe(re,K.current?.area),[]);return f.jsx(gfe,{scope:n,searchRef:P,onItemEnter:w.useCallback(re=>{G(re)&&re.preventDefault()},[G]),onItemLeave:w.useCallback(re=>{G(re)||(A.current?.focus(),I(null))},[G]),onTriggerLeave:w.useCallback(re=>{G(re)&&re.preventDefault()},[G]),pointerGraceTimerRef:B,onPointerGraceIntentChange:w.useCallback(re=>{K.current=re},[]),children:f.jsx(ae,{...H,children:f.jsx(Cm,{asChild:!0,trapped:r,onMountAutoFocus:Ge(i,re=>{re.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx(Od,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:f.jsx(yde,{asChild:!0,...k,dir:E.dir,orientation:"vertical",loop:a,currentTabStopId:R,onCurrentTabStopIdChange:I,onEntryFocus:Ge(u,re=>{E.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Uy,{role:"menu","aria-orientation":"vertical","data-state":Y8(y.open),"data-radix-menu-content":"",dir:E.dir,..._,...S,ref:O,style:{outline:"none",...S.style},onKeyDown:Ge(S.onKeyDown,re=>{const j=re.target.closest("[data-radix-menu-content]")===re.currentTarget,V=re.ctrlKey||re.altKey||re.metaKey,z=re.key.length===1;j&&(re.key==="Tab"&&re.preventDefault(),!V&&z&&Z(re.key));const L=A.current;if(re.target!==L||!sfe.includes(re.key))return;re.preventDefault();const F=C().filter(W=>!W.disabled).map(W=>W.ref.current);N8.includes(re.key)&&F.reverse(),Rfe(F)}),onBlur:Ge(e.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(M.current),P.current="")}),onPointerMove:Ge(e.onPointerMove,Fp(re=>{const ne=re.target,j=te.current!==re.clientX;if(re.currentTarget.contains(ne)&&j){const V=re.clientX>te.current?"right":"left";ee.current=V,te.current=re.clientX}}))})})})})})})});D8.displayName=Qa;var wfe="MenuGroup",BN=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return f.jsx(_t.div,{role:"group",...a,ref:t})});BN.displayName=wfe;var Sfe="MenuLabel",j8=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return f.jsx(_t.div,{...a,ref:t})});j8.displayName=Sfe;var Tv="MenuItem",YU="menu.itemSelect",Vy=w.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,i=w.useRef(null),s=jm(Tv,e.__scopeMenu),c=zN(Tv,e.__scopeMenu),u=Jt(t,i),d=w.useRef(!1),m=()=>{const h=i.current;if(!n&&h){const g=new CustomEvent(YU,{bubbles:!0,cancelable:!0});h.addEventListener(YU,v=>a?.(v),{once:!0}),B9(h,g),g.defaultPrevented?d.current=!1:s.onClose()}};return f.jsx(L8,{...r,ref:u,disabled:n,onClick:Ge(e.onClick,m),onPointerDown:h=>{e.onPointerDown?.(h),d.current=!0},onPointerUp:Ge(e.onPointerUp,h=>{d.current||h.currentTarget?.click()}),onKeyDown:Ge(e.onKeyDown,h=>{const g=c.searchRef.current!=="";n||g&&h.key===" "||H_.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Vy.displayName=Tv;var L8=w.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...i}=e,s=zN(Tv,n),c=R8(n),u=w.useRef(null),d=Jt(t,u),[m,h]=w.useState(!1),[g,v]=w.useState("");return w.useEffect(()=>{const x=u.current;x&&v((x.textContent??"").trim())},[i.children]),f.jsx(zp.ItemSlot,{scope:n,disabled:a,textValue:r??g,children:f.jsx(wde,{asChild:!0,...c,focusable:!a,children:f.jsx(_t.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...i,ref:d,onPointerMove:Ge(e.onPointerMove,Fp(x=>{a?s.onItemLeave(x):(s.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ge(e.onPointerLeave,Fp(x=>s.onItemLeave(x))),onFocus:Ge(e.onFocus,()=>h(!0)),onBlur:Ge(e.onBlur,()=>h(!1))})})})}),xfe="MenuCheckboxItem",$8=w.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return f.jsx(F8,{scope:e.__scopeMenu,checked:n,children:f.jsx(Vy,{role:"menuitemcheckbox","aria-checked":Nv(n)?"mixed":n,...r,ref:t,"data-state":VN(n),onSelect:Ge(r.onSelect,()=>a?.(Nv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});$8.displayName=xfe;var M8="MenuRadioGroup",[_fe,Efe]=tc(M8,{value:void 0,onValueChange:()=>{}}),P8=w.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,i=Zi(a);return f.jsx(_fe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(BN,{...r,ref:t})})});P8.displayName=M8;var U8="MenuRadioItem",z8=w.forwardRef((e,t)=>{const{value:n,...a}=e,r=Efe(U8,e.__scopeMenu),i=n===r.value;return f.jsx(F8,{scope:e.__scopeMenu,checked:i,children:f.jsx(Vy,{role:"menuitemradio","aria-checked":i,...a,ref:t,"data-state":VN(i),onSelect:Ge(a.onSelect,()=>r.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});z8.displayName=U8;var HN="MenuItemIndicator",[F8,kfe]=tc(HN,{checked:!1}),B8=w.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,i=kfe(HN,n);return f.jsx(Ua,{present:a||Nv(i.checked)||i.checked===!0,children:f.jsx(_t.span,{...r,ref:t,"data-state":VN(i.checked)})})});B8.displayName=HN;var Tfe="MenuSeparator",H8=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return f.jsx(_t.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});H8.displayName=Tfe;var Nfe="MenuArrow",V8=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Hy(n);return f.jsx(zy,{...r,...a,ref:t})});V8.displayName=Nfe;var Cfe="MenuSub",[QTe,G8]=tc(Cfe),np="MenuSubTrigger",W8=w.forwardRef((e,t)=>{const n=nc(np,e.__scopeMenu),a=jm(np,e.__scopeMenu),r=G8(np,e.__scopeMenu),i=zN(np,e.__scopeMenu),s=w.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=i,d={__scopeMenu:e.__scopeMenu},m=w.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return w.useEffect(()=>m,[m]),w.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),u(null)}},[c,u]),f.jsx(PN,{asChild:!0,...d,children:f.jsx(L8,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Y8(n.open),...e,ref:Ki(t,r.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ge(e.onPointerMove,Fp(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ge(e.onPointerLeave,Fp(h=>{m();const g=n.content?.getBoundingClientRect();if(g){const v=n.content?.dataset.side,x=v==="right",S=x?-5:5,y=g[x?"left":"right"],E=g[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+S,y:h.clientY},{x:y,y:g.top},{x:E,y:g.top},{x:E,y:g.bottom},{x:y,y:g.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ge(e.onKeyDown,h=>{const g=i.searchRef.current!=="";e.disabled||g&&h.key===" "||lfe[a.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});W8.displayName=np;var K8="MenuSubContent",Z8=w.forwardRef((e,t)=>{const n=I8(Qa,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,i=nc(Qa,e.__scopeMenu),s=jm(Qa,e.__scopeMenu),c=G8(K8,e.__scopeMenu),u=w.useRef(null),d=Jt(t,u);return f.jsx(zp.Provider,{scope:e.__scopeMenu,children:f.jsx(Ua,{present:a||i.open,children:f.jsx(zp.Slot,{scope:e.__scopeMenu,children:f.jsx(FN,{id:c.contentId,"aria-labelledby":c.triggerId,...r,ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{s.isUsingKeyboardRef.current&&u.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ge(e.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ge(e.onEscapeKeyDown,m=>{s.onClose(),m.preventDefault()}),onKeyDown:Ge(e.onKeyDown,m=>{const h=m.currentTarget.contains(m.target),g=cfe[s.dir].includes(m.key);h&&g&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});Z8.displayName=K8;function Y8(e){return e?"open":"closed"}function Nv(e){return e==="indeterminate"}function VN(e){return Nv(e)?"indeterminate":e?"checked":"unchecked"}function Rfe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Afe(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function Ife(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=Afe(e,Math.max(i,0));r.length===1&&(s=s.filter(d=>d!==n));const u=s.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return u!==n?u:void 0}function Ofe(e,t){const{x:n,y:a}=e;let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,m=c.y,h=u.x,g=u.y;m>a!=g>a&&n<(h-d)*(a-m)/(g-m)+d&&(r=!r)}return r}function Dfe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Ofe(n,t)}function Fp(e){return t=>t.pointerType==="mouse"?e(t):void 0}var jfe=A8,Lfe=PN,$fe=O8,Mfe=D8,Pfe=BN,Ufe=j8,zfe=Vy,Ffe=$8,Bfe=P8,Hfe=z8,Vfe=B8,Gfe=H8,Wfe=V8,Kfe=W8,Zfe=Z8,Gy="DropdownMenu",[Yfe]=Ii(Gy,[C8]),ia=C8(),[qfe,q8]=Yfe(Gy),X8=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,u=ia(t),d=w.useRef(null),[m,h]=Mo({prop:r,defaultProp:i??!1,onChange:s,caller:Gy});return f.jsx(qfe,{scope:t,triggerId:jr(),triggerRef:d,contentId:jr(),open:m,onOpenChange:h,onOpenToggle:w.useCallback(()=>h(g=>!g),[h]),modal:c,children:f.jsx(jfe,{...u,open:m,onOpenChange:h,dir:a,modal:c,children:n})})};X8.displayName=Gy;var J8="DropdownMenuTrigger",Q8=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,i=q8(J8,n),s=ia(n);return f.jsx(Lfe,{asChild:!0,...s,children:f.jsx(_t.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...r,ref:Ki(t,i.triggerRef),onPointerDown:Ge(e.onPointerDown,c=>{!a&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:Ge(e.onKeyDown,c=>{a||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});Q8.displayName=J8;var Xfe="DropdownMenuPortal",eG=e=>{const{__scopeDropdownMenu:t,...n}=e,a=ia(t);return f.jsx($fe,{...a,...n})};eG.displayName=Xfe;var tG="DropdownMenuContent",nG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=q8(tG,n),i=ia(n),s=w.useRef(!1);return f.jsx(Mfe,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...a,ref:t,onCloseAutoFocus:Ge(e.onCloseAutoFocus,c=>{s.current||r.triggerRef.current?.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Ge(e.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,m=u.button===2||d;(!r.modal||m)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nG.displayName=tG;var Jfe="DropdownMenuGroup",Qfe=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Pfe,{...r,...a,ref:t})});Qfe.displayName=Jfe;var epe="DropdownMenuLabel",rG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Ufe,{...r,...a,ref:t})});rG.displayName=epe;var tpe="DropdownMenuItem",aG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(zfe,{...r,...a,ref:t})});aG.displayName=tpe;var npe="DropdownMenuCheckboxItem",iG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Ffe,{...r,...a,ref:t})});iG.displayName=npe;var rpe="DropdownMenuRadioGroup",ape=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Bfe,{...r,...a,ref:t})});ape.displayName=rpe;var ipe="DropdownMenuRadioItem",oG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Hfe,{...r,...a,ref:t})});oG.displayName=ipe;var ope="DropdownMenuItemIndicator",spe=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Vfe,{...r,...a,ref:t})});spe.displayName=ope;var lpe="DropdownMenuSeparator",sG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Gfe,{...r,...a,ref:t})});sG.displayName=lpe;var cpe="DropdownMenuArrow",upe=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Wfe,{...r,...a,ref:t})});upe.displayName=cpe;var dpe="DropdownMenuSubTrigger",lG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Kfe,{...r,...a,ref:t})});lG.displayName=dpe;var fpe="DropdownMenuSubContent",cG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Zfe,{...r,...a,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});cG.displayName=fpe;var ppe=X8,mpe=Q8,hpe=eG,uG=nG,dG=rG,fG=aG,gpe=iG,bpe=oG,pG=sG,vpe=lG,ype=cG;const V_=ppe,G_=mpe;vpe.displayName;ype.displayName;function Cv({ref:e,className:t,sideOffset:n=4,...a}){return f.jsx(hpe,{children:f.jsx(uG,{ref:e,sideOffset:n,className:De("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})})}Cv.displayName=uG.displayName;function Ro({ref:e,className:t,inset:n,...a}){return f.jsx(fG,{ref:e,className:De("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",t),...a})}Ro.displayName=fG.displayName;gpe.displayName;bpe.displayName;function W_({ref:e,className:t,inset:n,...a}){return f.jsx(dG,{ref:e,className:De("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...a})}W_.displayName=dG.displayName;function rp({ref:e,className:t,...n}){return f.jsx(pG,{ref:e,className:De("-mx-1 my-1 h-px bg-muted",t),...n})}rp.displayName=pG.displayName;var wpe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Go=wpe.reduce((e,t)=>{const n=_9(`Primitive.${t}`),a=w.forwardRef((r,i)=>{const{asChild:s,...c}=r,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(u,{...c,ref:i})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Spe="Label",mG=w.forwardRef((e,t)=>f.jsx(Go.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));mG.displayName=Spe;var xpe=mG;function Kt({className:e,...t}){return f.jsx(xpe,{"data-slot":"label",className:De("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function $d({message:e,className:t="",vertical:n,noBorder:a}){return f.jsx("div",{className:De(`mt-2 rounded-md p-6 ${t}`,!a&&"border"),children:f.jsxs("p",{className:De("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[f.jsx("svg",{width:"40",height:"40",viewBox:"0 0 273 273",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:f.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:f.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[f.jsx("path",{d:"M49.953025,-2.10854389 C63.26892,-2.21867124 76.6185256,2.70621155 86.9019463,12.6653164 L86.9019463,12.6653164 L87.505627,13.2592944 C97.5154947,23.2654892 102.640454,36.3074513 102.880738,49.4222247 C103.08932,77.4533067 113.877287,105.391753 135.242867,126.757333 C156.613383,148.127849 184.559216,158.914875 212.568138,159.119313 L212.568138,159.119313 L213.212264,159.134159 C225.843948,159.517566 238.363557,164.434972 248.121998,173.886137 L248.121998,173.886137 L248.725621,174.480088 C258.982114,184.732164 264.11035,198.171134 264.11035,211.6101 C264.11035,225.04592 258.984514,238.481745 248.732867,248.732867 C238.592792,258.872942 225.336706,263.997882 212.046872,264.107794 C198.731075,264.21792 185.381569,259.293085 175.098248,249.334078 L175.098248,249.334078 L174.494602,248.740134 C163.75802,238.008189 158.640853,223.784027 159.143413,209.719372 C158.258245,182.640933 147.489786,155.83332 126.828333,135.171867 C106.351297,114.694831 79.8363505,103.934873 53.0237258,102.891841 L53.0237258,102.891841 L52.2811438,102.865674 C38.4791718,103.347421 24.5325234,98.4328111 13.8776628,88.1140866 L13.8776628,88.1140866 L13.2739843,87.5201168 C3.12895117,77.3789607 -1.9984796,64.1195994 -2.10841888,50.8264755 C-2.21854669,37.5105567 2.70635908,24.1609269 12.6655135,13.8774565 L12.6655135,13.8774565 L13.2594878,13.2737797 C23.4005926,3.12880025 36.659927,-1.99860507 49.953025,-2.10854389 Z"}),f.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),f.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),e]})})}function hG({className:e,color:t,children:n,grayscaled:a=!1}){const r=w.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return a?0:.2},[t,a]),i=w.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return a?.3:.4},[t,a]),s=w.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[2]||"0")}return Math.floor(Math.random()*360)},[t]),c=w.useMemo(()=>t||`oklch(${Math.min(i,1)} ${r} ${s})`,[s,r,i]),u=w.useMemo(()=>`oklch(${Math.min(i*2,1)} ${r} ${s})`,[s,r,i,t]),d=w.useMemo(()=>Math.floor(Math.random()*360),[s]),m=w.useMemo(()=>"1000%",[]);return f.jsx("section",{className:De("relative w-full h-full overflow-hidden",e),style:{background:`${u}`},children:f.jsxs("div",{className:"isolate relative w-full h-full",children:[f.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${d}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${m})`}}),n&&f.jsx("div",{className:"relative z-10 w-full h-full",children:n})]})})}function GN(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Wy="Switch",[_pe]=Ii(Wy),[Epe,kpe]=_pe(Wy),gG=w.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:r,defaultChecked:i,required:s,disabled:c,value:u="on",onCheckedChange:d,form:m,...h}=e,[g,v]=w.useState(null),x=Jt(t,k=>v(k)),S=w.useRef(!1),y=g?m||!!g.closest("form"):!0,[E,_]=Mo({prop:r,defaultProp:i??!1,onChange:d,caller:Wy});return f.jsxs(Epe,{scope:n,checked:E,disabled:c,children:[f.jsx(_t.button,{type:"button",role:"switch","aria-checked":E,"aria-required":s,"data-state":wG(E),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:x,onClick:Ge(e.onClick,k=>{_(C=>!C),y&&(S.current=k.isPropagationStopped(),S.current||k.stopPropagation())})}),y&&f.jsx(yG,{control:g,bubbles:!S.current,name:a,value:u,checked:E,required:s,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});gG.displayName=Wy;var bG="SwitchThumb",vG=w.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,r=kpe(bG,n);return f.jsx(_t.span,{"data-state":wG(r.checked),"data-disabled":r.disabled?"":void 0,...a,ref:t})});vG.displayName=bG;var Tpe="SwitchBubbleInput",yG=w.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...r},i)=>{const s=w.useRef(null),c=Jt(s,i),u=GN(n),d=LN(t);return w.useEffect(()=>{const m=s.current;if(!m)return;const h=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==n&&v){const x=new Event("click",{bubbles:a});v.call(m,n),m.dispatchEvent(x)}},[u,n,a]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:c,style:{...r.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});yG.displayName=Tpe;function wG(e){return e?"checked":"unchecked"}var SG=gG,Npe=vG;function Ky({ref:e,className:t,...n}){return f.jsx(SG,{className:De("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...n,ref:e,children:f.jsx(Npe,{className:De("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}Ky.displayName=SG.displayName;var xG=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Cpe="VisuallyHidden",_G=w.forwardRef((e,t)=>f.jsx(_t.span,{...e,ref:t,style:{...xG,...e.style}}));_G.displayName=Cpe;var Rpe=_G,[Zy]=Ii("Tooltip",[Zs]),Yy=Zs(),EG="TooltipProvider",Ape=700,K_="tooltip.open",[Ipe,WN]=Zy(EG),kG=e=>{const{__scopeTooltip:t,delayDuration:n=Ape,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:i}=e,s=w.useRef(!0),c=w.useRef(!1),u=w.useRef(0);return w.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),f.jsx(Ipe,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:w.useCallback(d=>{c.current=d},[]),disableHoverableContent:r,children:i})};kG.displayName=EG;var Bp="Tooltip",[Ope,Lm]=Zy(Bp),TG=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:i,disableHoverableContent:s,delayDuration:c}=e,u=WN(Bp,e.__scopeTooltip),d=Yy(t),[m,h]=w.useState(null),g=jr(),v=w.useRef(0),x=s??u.disableHoverableContent,S=c??u.delayDuration,y=w.useRef(!1),[E,_]=Mo({prop:a,defaultProp:r??!1,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(K_))):u.onClose(),i?.(A)},caller:Bp}),k=w.useMemo(()=>E?y.current?"delayed-open":"instant-open":"closed",[E]),C=w.useCallback(()=>{window.clearTimeout(v.current),v.current=0,y.current=!1,_(!0)},[_]),R=w.useCallback(()=>{window.clearTimeout(v.current),v.current=0,_(!1)},[_]),I=w.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{y.current=!0,_(!0),v.current=0},S)},[S,_]);return w.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),f.jsx(Py,{...d,children:f.jsx(Ope,{scope:t,contentId:g,open:E,stateAttribute:k,trigger:m,onTriggerChange:h,onTriggerEnter:w.useCallback(()=>{u.isOpenDelayedRef.current?I():C()},[u.isOpenDelayedRef,I,C]),onTriggerLeave:w.useCallback(()=>{x?R():(window.clearTimeout(v.current),v.current=0)},[R,x]),onOpen:C,onClose:R,disableHoverableContent:x,children:n})})};TG.displayName=Bp;var Z_="TooltipTrigger",NG=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Lm(Z_,n),i=WN(Z_,n),s=Yy(n),c=w.useRef(null),u=Jt(t,c,r.onTriggerChange),d=w.useRef(!1),m=w.useRef(!1),h=w.useCallback(()=>d.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),f.jsx(Am,{asChild:!0,...s,children:f.jsx(_t.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:u,onPointerMove:Ge(e.onPointerMove,g=>{g.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ge(e.onPointerLeave,()=>{r.onTriggerLeave(),m.current=!1}),onPointerDown:Ge(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ge(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:Ge(e.onBlur,r.onClose),onClick:Ge(e.onClick,r.onClose)})})});NG.displayName=Z_;var KN="TooltipPortal",[Dpe,jpe]=Zy(KN,{forceMount:void 0}),CG=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,i=Lm(KN,t);return f.jsx(Dpe,{scope:t,forceMount:n,children:f.jsx(Ua,{present:n||i.open,children:f.jsx(Ld,{asChild:!0,container:r,children:a})})})};CG.displayName=KN;var ud="TooltipContent",RG=w.forwardRef((e,t)=>{const n=jpe(ud,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...i}=e,s=Lm(ud,e.__scopeTooltip);return f.jsx(Ua,{present:a||s.open,children:s.disableHoverableContent?f.jsx(AG,{side:r,...i,ref:t}):f.jsx(Lpe,{side:r,...i,ref:t})})}),Lpe=w.forwardRef((e,t)=>{const n=Lm(ud,e.__scopeTooltip),a=WN(ud,e.__scopeTooltip),r=w.useRef(null),i=Jt(t,r),[s,c]=w.useState(null),{trigger:u,onClose:d}=n,m=r.current,{onPointerInTransitChange:h}=a,g=w.useCallback(()=>{c(null),h(!1)},[h]),v=w.useCallback((x,S)=>{const y=x.currentTarget,E={x:x.clientX,y:x.clientY},_=Upe(E,y.getBoundingClientRect()),k=zpe(E,_),C=Fpe(S.getBoundingClientRect()),R=Hpe([...k,...C]);c(R),h(!0)},[h]);return w.useEffect(()=>()=>g(),[g]),w.useEffect(()=>{if(u&&m){const x=y=>v(y,m),S=y=>v(y,u);return u.addEventListener("pointerleave",x),m.addEventListener("pointerleave",S),()=>{u.removeEventListener("pointerleave",x),m.removeEventListener("pointerleave",S)}}},[u,m,v,g]),w.useEffect(()=>{if(s){const x=S=>{const y=S.target,E={x:S.clientX,y:S.clientY},_=u?.contains(y)||m?.contains(y),k=!Bpe(E,s);_?g():k&&(g(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,m,s,d,g]),f.jsx(AG,{...e,ref:i})}),[$pe,Mpe]=Zy(Bp,{isInside:!1}),Ppe=vce("TooltipContent"),AG=w.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:s,...c}=e,u=Lm(ud,n),d=Yy(n),{onClose:m}=u;return w.useEffect(()=>(document.addEventListener(K_,m),()=>document.removeEventListener(K_,m)),[m]),w.useEffect(()=>{if(u.trigger){const h=g=>{g.target?.contains(u.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,m]),f.jsx(Od,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:f.jsxs(Uy,{"data-state":u.stateAttribute,...d,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(Ppe,{children:a}),f.jsx($pe,{scope:n,isInside:!0,children:f.jsx(Rpe,{id:u.contentId,role:"tooltip",children:r||a})})]})})});RG.displayName=ud;var IG="TooltipArrow",OG=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Yy(n);return Mpe(IG,n).isInside?null:f.jsx(zy,{...r,...a,ref:t})});OG.displayName=IG;function Upe(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,a,r,i)){case i:return"left";case r:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function zpe(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function Fpe(e){const{top:t,right:n,bottom:a,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:a},{x:r,y:a}]}function Bpe(e,t){const{x:n,y:a}=e;let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,m=c.y,h=u.x,g=u.y;m>a!=g>a&&n<(h-d)*(a-m)/(g-m)+d&&(r=!r)}return r}function Hpe(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),Vpe(t)}function Vpe(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const r=e[a];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(r.y-s.y)>=(i.y-s.y)*(r.x-s.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const r=e[a];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(r.y-s.y)>=(i.y-s.y)*(r.x-s.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Gpe=kG,Wpe=TG,Kpe=NG,Zpe=CG,Ype=RG,qpe=OG;function ZN({delayDuration:e=0,...t}){return f.jsx(Gpe,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Nt({...e}){return f.jsx(ZN,{children:f.jsx(Wpe,{"data-slot":"tooltip",...e})})}function Ct({...e}){return f.jsx(Kpe,{"data-slot":"tooltip-trigger",...e})}function Rt({className:e,sideOffset:t=0,children:n,...a}){return f.jsx(Zpe,{children:f.jsxs(Ype,{"data-slot":"tooltip-content",sideOffset:t,className:De("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...a,children:[n,f.jsx(qpe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class Xpe{name="mcp_inspector_open";properties;constructor(t){this.properties={server_url:t.serverUrl,connection_count:t.connectionCount}}}class qU{name="mcp_tool_execution";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId,success:t.success,duration:t.duration,error:t.error}}}class XU{name="mcp_resource_read";properties;constructor(t){this.properties={resource_uri:t.resourceUri,server_id:t.serverId,success:t.success,error:t.error}}}class JU{name="mcp_prompt_call";properties;constructor(t){this.properties={prompt_name:t.promptName,server_id:t.serverId,success:t.success,error:t.error}}}class QU{name="mcp_chat_message";properties;constructor(t){this.properties={server_id:t.serverId,provider:t.provider,model:t.model,message_count:t.messageCount,tool_calls_count:t.toolCallsCount,success:t.success,execution_mode:t.executionMode,duration:t.duration,error:t.error}}}class Jpe{name="mcp_server_added";properties;constructor(t){this.properties={server_id:t.serverId,server_url:t.serverUrl,connection_type:t.connectionType,via_proxy:t.viaProxy}}}class Qpe{name="mcp_server_removed";properties;constructor(t){this.properties={server_id:t.serverId}}}class eme{name="mcp_command_palette_open";properties;constructor(t){this.properties={trigger:t.trigger}}}class tme{name="mcp_tool_saved";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId}}}function wx(){try{return"0.13.0-canary.13"}catch{return"0.0.0"}}var nme={};function Sx(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class ez{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,a=setTimeout(()=>n.abort(),this.timeout),r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(a),!r.ok)throw new Error(`HTTP error! status: ${r.status}`)}catch{}}}function ys(e){return`mcp_inspector_telemetry_${e}`}class vr{static instance=null;POSTHOG_PROXY_URL="/inspector/api/tel/posthog";SCARF_PROXY_URL="/inspector/api/tel/scarf";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogClient=null;_scarfClient=null;_source="inspector";constructor(){const t=Sx(),n=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",n)this._posthogClient=null,this._scarfClient=null;else if(!t)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new ez(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new ez(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(ys("disabled"))==="true"||typeof process<"u"&&nme?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(ys("source")):null}static getInstance(){return vr.instance||(vr.instance=new vr),vr.instance}setSource(t){this._source=t,typeof localStorage<"u"&&localStorage.setItem(ys("source"),t)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!Sx())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const t=localStorage.getItem(ys("user_id"));if(t)this._currUserId=t;else{const n=this.generateUserId();localStorage.setItem(ys("user_id"),n),this._currUserId=n}this.trackPackageDownload({triggered_by:"user_id_property"}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){const t=window.crypto;if(t){const n=new Uint8Array(16);t.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;const a=Array.from(n).map(r=>r.toString(16).padStart(2,"0")).join("");return a.slice(0,8)+"-"+a.slice(8,12)+"-"+a.slice(12,16)+"-"+a.slice(16,20)+"-"+a.slice(20,32)}else return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const a=Math.random()*16|0;return(n==="x"?a:a&3|8).toString(16)})}async capture(t){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const n={event:t.name,user_id:this.userId,properties:{...t.properties,mcp_use_version:wx(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(n)}catch{}if(this._scarfClient)try{const n={};n.mcp_use_version=wx(),n.user_id=this.userId,n.event=t.name,n.language="typescript",n.source=this._source,n.package="inspector",await this._scarfClient.logEvent(n)}catch{}}}async trackPackageDownload(t){if(this._scarfClient&&Sx())try{const n=wx();let a=!1,r=!1;const i=localStorage.getItem(ys("download_version"));if(i?n>i&&(a=!0,r=!1,localStorage.setItem(ys("download_version"),n)):(a=!0,r=!0,localStorage.setItem(ys("download_version"),n)),a){const s={...t||{}};s.mcp_use_version=n,s.user_id=this.userId,s.event="package_download",s.first_download=r,s.language="typescript",s.source=this._source,s.package="inspector",await this._scarfClient.logEvent(s)}}catch{}}async trackInspectorOpen(t){const n=new Xpe(t);await this.capture(n)}}const rme={model:"stub-model",stopReason:"endTurn",role:"assistant",content:{type:"text",text:"positive"}};function ame({requestId:e,serverName:t,onViewDetails:n,onApprove:a,onDeny:r}){return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{children:[f.jsx("strong",{children:"Sampling Request Received"}),f.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["New request from ",t]})]}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:i=>{i.stopPropagation(),n()},children:"View Details"}),f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:i=>{i.stopPropagation(),a(rme)},children:"Approve"}),f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:i=>{i.stopPropagation(),r()},children:"Deny"})]})]})}function ime({requestId:e,serverName:t,mode:n,message:a,url:r,onViewDetails:i,onOpenUrl:s,onCancel:c}){return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{children:[f.jsx("strong",{children:"Elicitation Request Received"}),f.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["From ",t,": ",a]}),n==="url"&&r&&f.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono",children:r})]}),f.jsxs("div",{className:"flex gap-2 flex-wrap",children:[f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:u=>{u.stopPropagation(),i()},children:"View Details"}),n==="url"&&s&&f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:u=>{u.stopPropagation(),s()},children:"Open URL"}),f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:u=>{u.stopPropagation(),c()},children:"Cancel"})]})]})}const cb=()=>{},ub=()=>{},db=()=>{},fb=()=>{},DG=w.createContext(null);function YN(){const e=w.use(DG);if(!e)throw new Error("useMcpContext must be used within a McpProvider");return e}function ome({url:e,name:t,proxyConfig:n,transportType:a,connectionId:r,onUpdate:i,onRemove:s}){const c=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=e,d={};if(n?.proxyAddress){const L=new URL(n.proxyAddress),$=new URL(e);u=`${L.origin}${L.pathname}${$.pathname}${$.search}`,d["X-Target-URL"]=e}n?.customHeaders&&(d={...d,...n.customHeaders});const[m,h]=w.useState([]),g=w.useRef(0),[v,x]=w.useState([]),S=w.useRef(0),y=w.useMemo(()=>m.map(L=>({id:L.id,request:L.request,timestamp:L.timestamp,serverName:L.serverName})),[m]),E=w.useMemo(()=>v.map(L=>({id:L.id,request:L.request,timestamp:L.timestamp,serverName:L.serverName})),[v]),_=w.useRef(null),[k,C]=w.useState(!1),R=w.useRef(!1);w.useEffect(()=>{typeof window<"u"&&!R.current&&(R.current=!0,Jn(()=>import("./transport-wrapper-browser-BI4dDu3b.js"),[]).then(L=>{_.current=L.wrapTransportForLogging,C(!0),console.log("[McpContext] Transport wrapper loaded")}).catch(L=>{console.error("[McpContext] Failed to load transport wrapper:",L)}))},[]);const I=w.useMemo(()=>{if(!(!k||!_.current))return(L,$)=>{const F=r;return console.log("[McpContext] Applying transport wrapper, serverId:",F,"from connector:",$),_.current(L,F)}},[k,r]),A=`mcp-inspector-notifications-${r}`,O=500,[M,P]=w.useState([]);w.useEffect(()=>{try{const L=localStorage.getItem(A);if(L){const $=JSON.parse(L);Array.isArray($)&&P($)}}catch(L){console.error("Failed to load notifications from localStorage:",L)}},[A]),w.useEffect(()=>{try{localStorage.setItem(A,JSON.stringify(M))}catch(L){console.error("Failed to save notifications to localStorage:",L)}},[M,A]);const B=w.useCallback(L=>{P($=>$.map(F=>F.id===L?{...F,read:!0}:F))},[]),K=w.useCallback(()=>{P(L=>L.map($=>({...$,read:!0})))},[]),ee=w.useCallback(()=>{P([])},[]),te=w.useCallback(L=>{P($=>{const F=[L,...$];return F.length>O?F.slice(0,O):F})},[]),ae=w.useCallback((L,$)=>{h(F=>{const W=F.find(X=>X.id===L);return W?(W.resolve($),F.filter(X=>X.id!==L)):F})},[]),H=w.useCallback((L,$)=>{h(F=>{const W=F.find(X=>X.id===L);return W?(W.reject(new Error($||"User rejected sampling request")),F.filter(X=>X.id!==L)):F})},[]),Z=w.useCallback((L,$)=>{x(F=>{const W=F.find(X=>X.id===L);return W?(W.resolve($),F.filter(X=>X.id!==L)):F})},[]),G=w.useCallback((L,$)=>{x(F=>{const W=F.find(X=>X.id===L);return W?(W.reject(new Error($||"User rejected elicitation request")),F.filter(X=>X.id!==L)):F})},[]),re=w.useCallback(async L=>new Promise(($,F)=>{const W=`sampling-${g.current++}`,X={id:W,request:{params:L},timestamp:Date.now(),serverName:t,resolve:$,reject:F};h(ie=>[...ie,X]),typeof window<"u"&&Jn(async()=>{const{toast:ie}=await Promise.resolve().then(()=>sz);return{toast:ie}},void 0).then(({toast:ie})=>{const ce=ie(f.jsx(ame,{requestId:W,serverName:t,onViewDetails:()=>{const J=new globalThis.CustomEvent("navigate-to-sampling",{detail:{requestId:W}});window.dispatchEvent(J),ie.dismiss(ce)},onApprove:J=>{h(q=>{const le=q.find(he=>he.id===W);return le?(le.resolve(J),ie.success("Sampling request approved"),q.filter(he=>he.id!==W)):q}),ie.dismiss(ce)},onDeny:()=>{h(J=>{const q=J.find(le=>le.id===W);return q?(q.reject(new Error("User denied sampling request from toast")),ie.error("Sampling request denied"),J.filter(le=>le.id!==W)):J}),ie.dismiss(ce)}}),{duration:5e3})})}),[t]),ne=w.useCallback(async L=>new Promise(($,F)=>{const W=`elicitation-${S.current++}`,X={id:W,request:L,timestamp:Date.now(),serverName:t,resolve:$,reject:F};x(ie=>[...ie,X]),typeof window<"u"&&Jn(async()=>{const{toast:ie}=await Promise.resolve().then(()=>sz);return{toast:ie}},void 0).then(({toast:ie})=>{const ce=ie(f.jsx(ime,{requestId:W,serverName:t,mode:L.mode||"form",message:L.message,url:L.mode==="url"?L.url:void 0,onViewDetails:()=>{const J=new globalThis.CustomEvent("navigate-to-elicitation",{detail:{requestId:W}});window.dispatchEvent(J),ie.dismiss(ce)},onOpenUrl:L.mode==="url"?()=>{window.open(L.url,"_blank"),ie.dismiss(ce)}:void 0,onCancel:()=>{x(J=>{const q=J.find(le=>le.id===W);return q?(q.reject(new Error("User cancelled elicitation request from toast")),ie.error("Elicitation request cancelled"),J.filter(le=>le.id!==W)):J}),ie.dismiss(ce)}}),{duration:5e3})})}),[t]),j=wN({url:u,callbackUrl:c,customHeaders:Object.keys(d).length>0?d:void 0,transportType:a||"http",preventAutoAuth:!0,useRedirectFlow:!0,enabled:k,wrapTransport:I,onNotification:L=>{te({id:globalThis.crypto.randomUUID(),method:L.method,params:L.params,timestamp:Date.now(),read:!1})},samplingCallback:re,onElicitation:ne}),V=w.useRef(i),z=w.useRef(null);return w.useEffect(()=>{V.current=i},[i]),w.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{j.state==="ready"&&j.serverInfo&&console.log("[McpContext] Server info available:",j.serverInfo);const L=M.filter(W=>!W.read).length,$={id:r,url:e,name:j.serverInfo?.name||t,state:j.state,tools:j.tools,resources:j.resources,prompts:j.prompts,error:j.error??null,authUrl:j.authUrl??null,customHeaders:d,transportType:a,proxyConfig:n,serverInfo:j.serverInfo,capabilities:j.capabilities,notifications:M,unreadNotificationCount:L,markNotificationRead:B,markAllNotificationsRead:K,clearNotifications:ee,pendingSamplingRequests:y,approveSampling:ae,rejectSampling:H,pendingElicitationRequests:E,approveElicitation:Z,rejectElicitation:G,callTool:j.callTool,readResource:j.readResource,listPrompts:j.listPrompts,getPrompt:j.getPrompt,authenticate:j.authenticate,retry:j.retry,clearStorage:j.clearStorage,disconnect:j.disconnect,client:j.client},F=z.current;(!F||F.state!==$.state||F.error!==$.error||F.authUrl!==$.authUrl||F.name!==$.name||F.tools.length!==$.tools.length||F.resources.length!==$.resources.length||F.prompts.length!==$.prompts.length||F.serverInfo!==$.serverInfo||F.capabilities!==$.capabilities||F.notifications.length!==$.notifications.length||F.unreadNotificationCount!==$.unreadNotificationCount||F.pendingSamplingRequests.length!==$.pendingSamplingRequests.length||F.pendingElicitationRequests.length!==$.pendingElicitationRequests.length||!F.client)&&(z.current=$,V.current($))});else{const L=M.filter(W=>!W.read).length,$={id:r,url:e,name:j.serverInfo?.name||t,state:j.state,tools:j.tools,resources:j.resources,prompts:j.prompts,error:j.error??null,authUrl:j.authUrl??null,customHeaders:d,transportType:a,proxyConfig:n,serverInfo:j.serverInfo,capabilities:j.capabilities,notifications:M,unreadNotificationCount:L,markNotificationRead:B,markAllNotificationsRead:K,clearNotifications:ee,pendingSamplingRequests:y,approveSampling:ae,rejectSampling:H,pendingElicitationRequests:E,approveElicitation:Z,rejectElicitation:G,callTool:j.callTool,readResource:j.readResource,listPrompts:j.listPrompts,getPrompt:j.getPrompt,authenticate:j.authenticate,retry:j.retry,clearStorage:j.clearStorage,disconnect:j.disconnect,client:j.client},F=z.current;(!F||F.state!==$.state||F.error!==$.error||F.authUrl!==$.authUrl||F.name!==$.name||F.tools.length!==$.tools.length||F.resources.length!==$.resources.length||F.prompts.length!==$.prompts.length||F.serverInfo!==$.serverInfo||F.capabilities!==$.capabilities||F.notifications.length!==$.notifications.length||F.unreadNotificationCount!==$.unreadNotificationCount||F.pendingSamplingRequests.length!==$.pendingSamplingRequests.length||F.pendingElicitationRequests.length!==$.pendingElicitationRequests.length||!F.client)&&(z.current=$,V.current($))}},[e,t,a,n,d,r,j.state,j.tools,j.resources,j.prompts,j.error,j.authUrl,j.serverInfo,j.capabilities,j.client,M,B,K,ee,j.callTool,j.readResource,j.listPrompts,j.getPrompt,j.authenticate,j.retry,j.clearStorage,m,ae,H,E,Z,G]),null}function sme({children:e}){const[t,n]=w.useState([]),[a,r]=w.useState(!1),[i,s]=w.useState(!0),[c,u]=w.useState([]);w.useEffect(()=>{try{const y=localStorage.getItem("mcp-inspector-connections");if(y){const _=JSON.parse(y);Array.isArray(_)&&(u(_),n(_.map(k=>({id:k.id||k.url,url:k.url,name:k.name||"MCP Server",state:"discovering",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:k.proxyConfig?.customHeaders,transportType:k.transportType,proxyConfig:k.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:cb,rejectSampling:ub,pendingElicitationRequests:[],approveElicitation:db,rejectElicitation:fb,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}))))}const E=localStorage.getItem("mcp-inspector-auto-connect");E!==null&&s(E==="true")}catch(y){console.error("Failed to load connections from localStorage:",y)}finally{r(!0)}},[]),w.useEffect(()=>{a&&localStorage.setItem("mcp-inspector-connections",JSON.stringify(c))},[c,a]),w.useEffect(()=>{a&&localStorage.setItem("mcp-inspector-auto-connect",String(i))},[i,a]);const d=w.useCallback((y,E,_,k)=>{const C=c.find(A=>A.url===y),R=t.find(A=>A.url===y);if(C&&R){if(JSON.stringify(C.proxyConfig)!==JSON.stringify(_)&&_){u(O=>O.filter(M=>M.url!==y)),n(O=>O.filter(M=>M.url!==y)),setTimeout(()=>{const O={id:y,url:y,name:E||C.name||"MCP Server",proxyConfig:_,transportType:k||C.transportType};u(M=>[...M,O]),n(M=>[...M,{id:y,url:y,name:E||C.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:_?.customHeaders,transportType:k||C.transportType,proxyConfig:_,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:cb,rejectSampling:ub,pendingElicitationRequests:[],approveElicitation:db,rejectElicitation:fb,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},10);return}return}if(C&&!R){(_||k)&&u(A=>A.map(O=>O.url===y?{...O,proxyConfig:_||O.proxyConfig,transportType:k||O.transportType,name:E||O.name}:O)),n(A=>[...A,{id:C.id||y,url:y,name:E||C.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:_?.customHeaders||C.proxyConfig?.customHeaders,transportType:k||C.transportType,proxyConfig:_||C.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:cb,rejectSampling:ub,pendingElicitationRequests:[],approveElicitation:db,rejectElicitation:fb,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}]);return}const I={id:y,url:y,name:E||"MCP Server",proxyConfig:_,transportType:k};u(A=>[...A,I]),n(A=>[...A,{id:y,url:y,name:E||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:_?.customHeaders,transportType:k,proxyConfig:_,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:cb,rejectSampling:ub,pendingElicitationRequests:[],approveElicitation:db,rejectElicitation:fb,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},[c,t]),m=w.useCallback(y=>{const E=t.find(k=>k.id===y);E&&(console.log(`[McpContext] Cleaning up connection: ${y}`),E.disconnect&&(console.log(`[McpContext] Disconnecting from server: ${y}`),E.disconnect()),E.clearStorage&&(console.log(`[McpContext] Clearing OAuth storage for connection: ${y}`),E.clearStorage())),u(k=>k.filter(C=>C.id!==y)),n(k=>k.filter(C=>C.id!==y));const _=localStorage.getItem("mcp-inspector-connections");if(_)try{const C=JSON.parse(_).filter(R=>(R.id||R.url)!==y);localStorage.setItem("mcp-inspector-connections",JSON.stringify(C))}catch(k){console.error("Failed to update localStorage on remove:",k)}vr.getInstance().capture(new Qpe({serverId:y}))},[t]),h=w.useCallback((y,E)=>{u(_=>_.map(k=>k.id===y||k.url===y?{...k,...E}:k)),n(_=>_.map(k=>k.id===y?{...k,...E}:k))},[]),g=w.useCallback(y=>{n(E=>{const _=E.findIndex(R=>R.id===y.id);if(_===-1)return E;const k=E[_];if(k.state===y.state&&k.tools===y.tools&&k.resources===y.resources&&k.prompts===y.prompts&&k.error===y.error&&k.serverInfo===y.serverInfo&&k.client===y.client&&k.notifications===y.notifications&&k.unreadNotificationCount===y.unreadNotificationCount&&k.pendingSamplingRequests.length===y.pendingSamplingRequests.length&&k.pendingElicitationRequests.length===y.pendingElicitationRequests.length)return E;const C=[...E];return C[_]=y,C})},[]),v=w.useCallback(y=>{console.log("Connect requested for:",y)},[]),x=w.useCallback(y=>{console.log("Disconnect requested for:",y)},[]),S=w.useMemo(()=>({connections:t,addConnection:d,removeConnection:m,updateConnectionConfig:h,autoConnect:i,setAutoConnect:s,connectServer:v,disconnectServer:x,configLoaded:a}),[t,d,m,h,i,v,x,a]);return f.jsxs(DG.Provider,{value:S,children:[e,a&&i&&c.map(y=>{const E=`${y.id||y.url}-${y.proxyConfig?.proxyAddress?"proxy":"direct"}`;return console.warn("[McpContext] Rendering McpConnectionWrapper with key:",E,"proxyConfig:",y.proxyConfig),f.jsx(ome,{url:y.url,name:y.name,proxyConfig:y.proxyConfig,transportType:y.transportType,connectionId:y.id||y.url,onUpdate:g,onRemove:()=>m(y.id||y.url)},E)})]})}const lme=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cme=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),tz=e=>{const t=cme(e);return t.charAt(0).toUpperCase()+t.slice(1)},jG=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),ume=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var dme={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const fme=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:i,iconNode:s,...c},u)=>w.createElement("svg",{ref:u,...dme,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:jG("lucide",r),...!i&&!ume(c)&&{"aria-hidden":"true"},...c},[...s.map(([d,m])=>w.createElement(d,m)),...Array.isArray(i)?i:[i]]));const et=(e,t)=>{const n=w.forwardRef(({className:a,...r},i)=>w.createElement(fme,{ref:i,iconNode:t,className:jG(`lucide-${lme(tz(e))}`,`lucide-${e}`,a),...r}));return n.displayName=tz(e),n};const pme=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],mme=et("arrow-down-to-line",pme);const hme=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],gme=et("arrow-up-from-line",hme);const bme=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],vme=et("arrow-up",bme);const yme=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],qN=et("bell",yme);const wme=[["path",{d:"m11 10 3 3",key:"fzmg1i"}],["path",{d:"M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z",key:"p4q2r7"}],["path",{d:"M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031",key:"wy6l02"}]],LG=et("brush",wme);const Sme=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],xme=et("bug",Sme);const _me=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ra=et("check",_me);const Eme=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rc=et("chevron-down",Eme);const kme=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],qy=et("chevron-left",kme);const Tme=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$G=et("chevron-right",Tme);const Nme=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Cme=et("chevron-up",Nme);const Rme=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Ame=et("chevrons-up-down",Rme);const Ime=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],nz=et("circle-minus",Ime);const Ome=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],dd=et("clock",Ome);const Dme=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],XN=et("code",Dme);const jme=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],Lme=et("cog",jme);const $me=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Mme=et("command",$me);const Pme=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Lr=et("copy",Pme);const Ume=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Xy=et("database",Ume);const zme=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],$m=et("download",zme);const Fme=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Bme=et("ellipsis-vertical",Fme);const Hme=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Y_=et("external-link",Hme);const Vme=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],MG=et("eye-off",Vme);const Gme=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],q_=et("eye",Gme);const Wme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Kme=et("file-code",Wme);const Zme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],Yme=et("file-image",Zme);const qme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],JN=et("file-text",qme);const Xme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Jme=et("file",Xme);const Qme=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ehe=et("folder-open",Qme);const the=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],nhe=et("globe",the);const rhe=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],ahe=et("grip-vertical",rhe);const ihe=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],PG=et("hash",ihe);const ohe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Rv=et("history",ohe);const she=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],UG=et("key",she);const lhe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],zs=et("loader-circle",lhe);const che=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],QN=et("maximize-2",che);const uhe=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],eC=et("maximize",uhe);const dhe=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],fhe=et("message-circle",dhe);const phe=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Hp=et("message-square",phe);const mhe=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],hhe=et("minimize",mhe);const ghe=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],rz=et("monitor",ghe);const bhe=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],vhe=et("moon",bhe);const yhe=[["path",{d:"M2 10h6V4",key:"zwrco"}],["path",{d:"m2 4 6 6",key:"ug085t"}],["path",{d:"M21 10V7a2 2 0 0 0-2-2h-7",key:"git5jr"}],["path",{d:"M3 14v2a2 2 0 0 0 2 2h3",key:"1f7fh3"}],["rect",{x:"12",y:"14",width:"10",height:"7",rx:"1",key:"1wjs3o"}]],whe=et("picture-in-picture",yhe);const She=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],zG=et("play",She);const xhe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],FG=et("plus",xhe);const _he=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],az=et("rotate-ccw",_he);const Ehe=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],tC=et("save",Ehe);const khe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Md=et("search",khe);const The=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Nhe=et("send",The);const Che=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Rhe=et("server",Che);const Ahe=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],_u=et("settings",Ahe);const Ihe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Ohe=et("shield",Ihe);const Dhe=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],jhe=et("sparkles",Dhe);const Lhe=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],BG=et("square-check-big",Lhe);const $he=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Mhe=et("square-pen",$he);const Phe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]],Uhe=et("sun-dim",Phe);const zhe=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],xx=et("terminal",zhe);const Fhe=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Fs=et("trash-2",Fhe);const Bhe=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Hhe=et("trash",Bhe);const Vhe=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Gl=et("wrench",Vhe);const Ghe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ji=et("x",Ghe);const Whe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Vp=et("zap",Whe);function Khe(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Zhe=e=>{switch(e){case"success":return Xhe;case"info":return Qhe;case"warning":return Jhe;case"error":return ege;default:return null}},Yhe=Array(12).fill(0),qhe=({visible:e,className:t})=>ue.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ue.createElement("div",{className:"sonner-spinner"},Yhe.map((n,a)=>ue.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),Xhe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Jhe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Qhe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),ege=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),tge=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ue.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ue.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),nge=()=>{const[e,t]=ue.useState(document.hidden);return ue.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let X_=1;class rge{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:a,...r}=t,i=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:X_++,s=this.toasts.find(u=>u.id===i),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(u=>u.id===i?(this.publish({...u,...t,id:i,title:a}),{...u,...t,id:i,dismissible:c,title:a}):u):this.addToast({title:a,...r,dismissible:c,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(a=>a({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let a;n.loading!==void 0&&(a=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const r=Promise.resolve(t instanceof Function?t():t);let i=a!==void 0,s;const c=r.then(async d=>{if(s=["resolve",d],ue.isValidElement(d))i=!1,this.create({id:a,type:"default",message:d});else if(ige(d)&&!d.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,g=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,x=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...x})}else if(d instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,g=typeof n.description=="function"?await n.description(d):n.description,x=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...x})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(d):n.success,g=typeof n.description=="function"?await n.description(d):n.description,x=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"success",description:g,...x})}}).catch(async d=>{if(s=["reject",d],n.error!==void 0){i=!1;const m=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description,v=typeof m=="object"&&!ue.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:h,...v})}}).finally(()=>{i&&(this.dismiss(a),a=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((d,m)=>c.then(()=>s[0]==="reject"?m(s[1]):d(s[1])).catch(m));return typeof a!="string"&&typeof a!="number"?{unwrap:u}:Object.assign(a,{unwrap:u})},this.custom=(t,n)=>{const a=n?.id||X_++;return this.create({jsx:t(a),id:a,...n}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ga=new rge,age=(e,t)=>{const n=t?.id||X_++;return ga.addToast({title:e,...t,id:n}),n},ige=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",oge=age,sge=()=>ga.toasts,lge=()=>ga.getActiveToasts(),Xt=Object.assign(oge,{success:ga.success,info:ga.info,warning:ga.warning,error:ga.error,custom:ga.custom,message:ga.message,promise:ga.promise,dismiss:ga.dismiss,loading:ga.loading},{getHistory:sge,getToasts:lge});Khe("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function pb(e){return e.label!==void 0}const cge=3,uge="24px",dge="16px",iz=4e3,fge=356,pge=14,mge=45,hge=200;function Ui(...e){return e.filter(Boolean).join(" ")}function gge(e){const[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}const bge=e=>{var t,n,a,r,i,s,c,u,d;const{invert:m,toast:h,unstyled:g,interacting:v,setHeights:x,visibleToasts:S,heights:y,index:E,toasts:_,expanded:k,removeToast:C,defaultRichColors:R,closeButton:I,style:A,cancelButtonStyle:O,actionButtonStyle:M,className:P="",descriptionClassName:B="",duration:K,position:ee,gap:te,expandByDefault:ae,classNames:H,icons:Z,closeButtonAriaLabel:G="Close toast"}=e,[re,ne]=ue.useState(null),[j,V]=ue.useState(null),[z,L]=ue.useState(!1),[$,F]=ue.useState(!1),[W,X]=ue.useState(!1),[ie,ce]=ue.useState(!1),[J,q]=ue.useState(!1),[le,he]=ue.useState(0),[oe,Ce]=ue.useState(0),Ve=ue.useRef(h.duration||K||iz),xe=ue.useRef(null),Te=ue.useRef(null),Fe=E===0,pe=E+1<=S,Oe=h.type,He=h.dismissible!==!1,Se=h.className||"",at=h.descriptionClassName||"",nt=ue.useMemo(()=>y.findIndex(Ke=>Ke.toastId===h.id)||0,[y,h.id]),ft=ue.useMemo(()=>{var Ke;return(Ke=h.closeButton)!=null?Ke:I},[h.closeButton,I]),Et=ue.useMemo(()=>h.duration||K||iz,[h.duration,K]),pt=ue.useRef(0),mn=ue.useRef(0),Pr=ue.useRef(0),St=ue.useRef(null),[Be,$e]=ee.split("-"),_e=ue.useMemo(()=>y.reduce((Ke,Ze,dt)=>dt>=nt?Ke:Ke+Ze.height,0),[y,nt]),je=nge(),Ue=h.invert||m,We=Oe==="loading";mn.current=ue.useMemo(()=>nt*te+_e,[nt,_e]),ue.useEffect(()=>{Ve.current=Et},[Et]),ue.useEffect(()=>{L(!0)},[]),ue.useEffect(()=>{const Ke=Te.current;if(Ke){const Ze=Ke.getBoundingClientRect().height;return Ce(Ze),x(dt=>[{toastId:h.id,height:Ze,position:h.position},...dt]),()=>x(dt=>dt.filter(At=>At.toastId!==h.id))}},[x,h.id]),ue.useLayoutEffect(()=>{if(!z)return;const Ke=Te.current,Ze=Ke.style.height;Ke.style.height="auto";const dt=Ke.getBoundingClientRect().height;Ke.style.height=Ze,Ce(dt),x(At=>At.find(ln=>ln.toastId===h.id)?At.map(ln=>ln.toastId===h.id?{...ln,height:dt}:ln):[{toastId:h.id,height:dt,position:h.position},...At])},[z,h.title,h.description,x,h.id,h.jsx,h.action,h.cancel]);const Je=ue.useCallback(()=>{F(!0),he(mn.current),x(Ke=>Ke.filter(Ze=>Ze.toastId!==h.id)),setTimeout(()=>{C(h)},hge)},[h,C,x,mn]);ue.useEffect(()=>{if(h.promise&&Oe==="loading"||h.duration===1/0||h.type==="loading")return;let Ke;return k||v||je?(()=>{if(Pr.current<pt.current){const At=new Date().getTime()-pt.current;Ve.current=Ve.current-At}Pr.current=new Date().getTime()})():Ve.current!==1/0&&(pt.current=new Date().getTime(),Ke=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),Je()},Ve.current)),()=>clearTimeout(Ke)},[k,v,h,Oe,je,Je]),ue.useEffect(()=>{h.delete&&(Je(),h.onDismiss==null||h.onDismiss.call(h,h))},[Je,h.delete]);function yt(){var Ke;if(Z?.loading){var Ze;return ue.createElement("div",{className:Ui(H?.loader,h==null||(Ze=h.classNames)==null?void 0:Ze.loader,"sonner-loader"),"data-visible":Oe==="loading"},Z.loading)}return ue.createElement(qhe,{className:Ui(H?.loader,h==null||(Ke=h.classNames)==null?void 0:Ke.loader),visible:Oe==="loading"})}const mt=h.icon||Z?.[Oe]||Zhe(Oe);var Mt,nn;return ue.createElement("li",{tabIndex:0,ref:Te,className:Ui(P,Se,H?.toast,h==null||(t=h.classNames)==null?void 0:t.toast,H?.default,H?.[Oe],h==null||(n=h.classNames)==null?void 0:n[Oe]),"data-sonner-toast":"","data-rich-colors":(Mt=h.richColors)!=null?Mt:R,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":z,"data-promise":!!h.promise,"data-swiped":J,"data-removed":$,"data-visible":pe,"data-y-position":Be,"data-x-position":$e,"data-index":E,"data-front":Fe,"data-swiping":W,"data-dismissible":He,"data-type":Oe,"data-invert":Ue,"data-swipe-out":ie,"data-swipe-direction":j,"data-expanded":!!(k||ae&&z),"data-testid":h.testId,style:{"--index":E,"--toasts-before":E,"--z-index":_.length-E,"--offset":`${$?le:mn.current}px`,"--initial-height":ae?"auto":`${oe}px`,...A,...h.style},onDragEnd:()=>{X(!1),ne(null),St.current=null},onPointerDown:Ke=>{Ke.button!==2&&(We||!He||(xe.current=new Date,he(mn.current),Ke.target.setPointerCapture(Ke.pointerId),Ke.target.tagName!=="BUTTON"&&(X(!0),St.current={x:Ke.clientX,y:Ke.clientY})))},onPointerUp:()=>{var Ke,Ze,dt;if(ie||!He)return;St.current=null;const At=Number(((Ke=Te.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Qn=Number(((Ze=Te.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ln=new Date().getTime()-((dt=xe.current)==null?void 0:dt.getTime()),Vn=re==="x"?At:Qn,Ln=Math.abs(Vn)/ln;if(Math.abs(Vn)>=mge||Ln>.11){he(mn.current),h.onDismiss==null||h.onDismiss.call(h,h),V(re==="x"?At>0?"right":"left":Qn>0?"down":"up"),Je(),ce(!0);return}else{var yn,fn;(yn=Te.current)==null||yn.style.setProperty("--swipe-amount-x","0px"),(fn=Te.current)==null||fn.style.setProperty("--swipe-amount-y","0px")}q(!1),X(!1),ne(null)},onPointerMove:Ke=>{var Ze,dt,At;if(!St.current||!He||((Ze=window.getSelection())==null?void 0:Ze.toString().length)>0)return;const ln=Ke.clientY-St.current.y,Vn=Ke.clientX-St.current.x;var Ln;const yn=(Ln=e.swipeDirections)!=null?Ln:gge(ee);!re&&(Math.abs(Vn)>1||Math.abs(ln)>1)&&ne(Math.abs(Vn)>Math.abs(ln)?"x":"y");let fn={x:0,y:0};const oa=Qt=>1/(1.5+Math.abs(Qt)/20);if(re==="y"){if(yn.includes("top")||yn.includes("bottom"))if(yn.includes("top")&&ln<0||yn.includes("bottom")&&ln>0)fn.y=ln;else{const Qt=ln*oa(ln);fn.y=Math.abs(Qt)<Math.abs(ln)?Qt:ln}}else if(re==="x"&&(yn.includes("left")||yn.includes("right")))if(yn.includes("left")&&Vn<0||yn.includes("right")&&Vn>0)fn.x=Vn;else{const Qt=Vn*oa(Vn);fn.x=Math.abs(Qt)<Math.abs(Vn)?Qt:Vn}(Math.abs(fn.x)>0||Math.abs(fn.y)>0)&&q(!0),(dt=Te.current)==null||dt.style.setProperty("--swipe-amount-x",`${fn.x}px`),(At=Te.current)==null||At.style.setProperty("--swipe-amount-y",`${fn.y}px`)}},ft&&!h.jsx&&Oe!=="loading"?ue.createElement("button",{"aria-label":G,"data-disabled":We,"data-close-button":!0,onClick:We||!He?()=>{}:()=>{Je(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Ui(H?.closeButton,h==null||(a=h.classNames)==null?void 0:a.closeButton)},(nn=Z?.close)!=null?nn:tge):null,(Oe||h.icon||h.promise)&&h.icon!==null&&(Z?.[Oe]!==null||h.icon)?ue.createElement("div",{"data-icon":"",className:Ui(H?.icon,h==null||(r=h.classNames)==null?void 0:r.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||yt():null,h.type!=="loading"?mt:null):null,ue.createElement("div",{"data-content":"",className:Ui(H?.content,h==null||(i=h.classNames)==null?void 0:i.content)},ue.createElement("div",{"data-title":"",className:Ui(H?.title,h==null||(s=h.classNames)==null?void 0:s.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?ue.createElement("div",{"data-description":"",className:Ui(B,at,H?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),ue.isValidElement(h.cancel)?h.cancel:h.cancel&&pb(h.cancel)?ue.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:Ke=>{pb(h.cancel)&&He&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Ke),Je())},className:Ui(H?.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,ue.isValidElement(h.action)?h.action:h.action&&pb(h.action)?ue.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||M,onClick:Ke=>{pb(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Ke),!Ke.defaultPrevented&&Je())},className:Ui(H?.actionButton,h==null||(d=h.classNames)==null?void 0:d.actionButton)},h.action.label):null)};function oz(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function vge(e,t){const n={};return[e,t].forEach((a,r)=>{const i=r===1,s=i?"--mobile-offset":"--offset",c=i?dge:uge;function u(d){["top","right","bottom","left"].forEach(m=>{n[`${s}-${m}`]=typeof d=="number"?`${d}px`:d})}typeof a=="number"||typeof a=="string"?u(a):typeof a=="object"?["top","right","bottom","left"].forEach(d=>{a[d]===void 0?n[`${s}-${d}`]=c:n[`${s}-${d}`]=typeof a[d]=="number"?`${a[d]}px`:a[d]}):u(c)}),n}const HG=ue.forwardRef(function(t,n){const{id:a,invert:r,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:c,closeButton:u,className:d,offset:m,mobileOffset:h,theme:g="light",richColors:v,duration:x,style:S,visibleToasts:y=cge,toastOptions:E,dir:_=oz(),gap:k=pge,icons:C,containerAriaLabel:R="Notifications"}=t,[I,A]=ue.useState([]),O=ue.useMemo(()=>a?I.filter(z=>z.toasterId===a):I.filter(z=>!z.toasterId),[I,a]),M=ue.useMemo(()=>Array.from(new Set([i].concat(O.filter(z=>z.position).map(z=>z.position)))),[O,i]),[P,B]=ue.useState([]),[K,ee]=ue.useState(!1),[te,ae]=ue.useState(!1),[H,Z]=ue.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=ue.useRef(null),re=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),ne=ue.useRef(null),j=ue.useRef(!1),V=ue.useCallback(z=>{A(L=>{var $;return($=L.find(F=>F.id===z.id))!=null&&$.delete||ga.dismiss(z.id),L.filter(({id:F})=>F!==z.id)})},[]);return ue.useEffect(()=>ga.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{A(L=>L.map($=>$.id===z.id?{...$,delete:!0}:$))});return}setTimeout(()=>{z9.flushSync(()=>{A(L=>{const $=L.findIndex(F=>F.id===z.id);return $!==-1?[...L.slice(0,$),{...L[$],...z},...L.slice($+1)]:[z,...L]})})})}),[I]),ue.useEffect(()=>{if(g!=="system"){Z(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:L})=>{Z(L?"dark":"light")})}catch{z.addListener(({matches:$})=>{try{Z($?"dark":"light")}catch(F){console.error(F)}})}},[g]),ue.useEffect(()=>{I.length<=1&&ee(!1)},[I]),ue.useEffect(()=>{const z=L=>{var $;if(s.every(X=>L[X]||L.code===X)){var W;ee(!0),(W=G.current)==null||W.focus()}L.code==="Escape"&&(document.activeElement===G.current||($=G.current)!=null&&$.contains(document.activeElement))&&ee(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),ue.useEffect(()=>{if(G.current)return()=>{ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null,j.current=!1)}},[G.current]),ue.createElement("section",{ref:n,"aria-label":`${R} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((z,L)=>{var $;const[F,W]=z.split("-");return O.length?ue.createElement("ol",{key:z,dir:_==="auto"?oz():_,tabIndex:-1,ref:G,className:d,"data-sonner-toaster":!0,"data-sonner-theme":H,"data-y-position":F,"data-x-position":W,style:{"--front-toast-height":`${(($=P[0])==null?void 0:$.height)||0}px`,"--width":`${fge}px`,"--gap":`${k}px`,...S,...vge(m,h)},onBlur:X=>{j.current&&!X.currentTarget.contains(X.relatedTarget)&&(j.current=!1,ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||j.current||(j.current=!0,ne.current=X.relatedTarget)},onMouseEnter:()=>ee(!0),onMouseMove:()=>ee(!0),onMouseLeave:()=>{te||ee(!1)},onDragEnd:()=>ee(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ae(!0)},onPointerUp:()=>ae(!1)},O.filter(X=>!X.position&&L===0||X.position===z).map((X,ie)=>{var ce,J;return ue.createElement(bge,{key:X.id,icons:C,index:ie,toast:X,defaultRichColors:v,duration:(ce=E?.duration)!=null?ce:x,className:E?.className,descriptionClassName:E?.descriptionClassName,invert:r,visibleToasts:y,closeButton:(J=E?.closeButton)!=null?J:u,interacting:te,position:z,style:E?.style,unstyled:E?.unstyled,classNames:E?.classNames,cancelButtonStyle:E?.cancelButtonStyle,actionButtonStyle:E?.actionButtonStyle,closeButtonAriaLabel:E?.closeButtonAriaLabel,removeToast:V,toasts:O.filter(q=>q.position==X.position),heights:P.filter(q=>q.position==X.position),setHeights:B,expandByDefault:c,gap:k,expanded:K,swipeDirections:t.swipeDirections})})):null}))}),sz=Object.freeze(Object.defineProperty({__proto__:null,Toaster:HG,toast:Xt},Symbol.toStringTag,{value:"Module"}));var Jy="Dialog",[VG]=Ii(Jy),[yge,Oi]=VG(Jy),GG=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:r,onOpenChange:i,modal:s=!0}=e,c=w.useRef(null),u=w.useRef(null),[d,m]=Mo({prop:a,defaultProp:r??!1,onChange:i,caller:Jy});return f.jsx(yge,{scope:t,triggerRef:c,contentRef:u,contentId:jr(),titleId:jr(),descriptionId:jr(),open:d,onOpenChange:m,onOpenToggle:w.useCallback(()=>m(h=>!h),[m]),modal:s,children:n})};GG.displayName=Jy;var WG="DialogTrigger",KG=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(WG,n),i=Jt(t,r.triggerRef);return f.jsx(_t.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":aC(r.open),...a,ref:i,onClick:Ge(e.onClick,r.onOpenToggle)})});KG.displayName=WG;var nC="DialogPortal",[wge,ZG]=VG(nC,{forceMount:void 0}),YG=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:r}=e,i=Oi(nC,t);return f.jsx(wge,{scope:t,forceMount:n,children:w.Children.map(a,s=>f.jsx(Ua,{present:n||i.open,children:f.jsx(Ld,{asChild:!0,container:r,children:s})}))})};YG.displayName=nC;var Av="DialogOverlay",qG=w.forwardRef((e,t)=>{const n=ZG(Av,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,i=Oi(Av,e.__scopeDialog);return i.modal?f.jsx(Ua,{present:a||i.open,children:f.jsx(xge,{...r,ref:t})}):null});qG.displayName=Av;var Sge=Hl("DialogOverlay.RemoveScroll"),xge=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(Av,n);return f.jsx(Om,{as:Sge,allowPinchZoom:!0,shards:[r.contentRef],children:f.jsx(_t.div,{"data-state":aC(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Wl="DialogContent",XG=w.forwardRef((e,t)=>{const n=ZG(Wl,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,i=Oi(Wl,e.__scopeDialog);return f.jsx(Ua,{present:a||i.open,children:i.modal?f.jsx(_ge,{...r,ref:t}):f.jsx(Ege,{...r,ref:t})})});XG.displayName=Wl;var _ge=w.forwardRef((e,t)=>{const n=Oi(Wl,e.__scopeDialog),a=w.useRef(null),r=Jt(t,n.contentRef,a);return w.useEffect(()=>{const i=a.current;if(i)return Fy(i)},[]),f.jsx(JG,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ge(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ge(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&i.preventDefault()}),onFocusOutside:Ge(e.onFocusOutside,i=>i.preventDefault())})}),Ege=w.forwardRef((e,t)=>{const n=Oi(Wl,e.__scopeDialog),a=w.useRef(!1),r=w.useRef(!1);return f.jsx(JG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(a.current||n.triggerRef.current?.focus(),i.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(a.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),JG=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:i,...s}=e,c=Oi(Wl,n),u=w.useRef(null),d=Jt(t,u);return Dy(),f.jsxs(f.Fragment,{children:[f.jsx(Cm,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:i,children:f.jsx(Od,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":aC(c.open),...s,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(kge,{titleId:c.titleId}),f.jsx(Nge,{contentRef:u,descriptionId:c.descriptionId})]})]})}),rC="DialogTitle",QG=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(rC,n);return f.jsx(_t.h2,{id:r.titleId,...a,ref:t})});QG.displayName=rC;var e7="DialogDescription",t7=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(e7,n);return f.jsx(_t.p,{id:r.descriptionId,...a,ref:t})});t7.displayName=e7;var n7="DialogClose",r7=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(n7,n);return f.jsx(_t.button,{type:"button",...a,ref:t,onClick:Ge(e.onClick,()=>r.onOpenChange(!1))})});r7.displayName=n7;function aC(e){return e?"open":"closed"}var a7="DialogTitleWarning",[eNe,i7]=fce(a7,{contentName:Wl,titleName:rC,docsSlug:"dialog"}),kge=({titleId:e})=>{const t=i7(a7),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
93
+ `)},nfe=0,Zc=[];function rfe(e){var t=w.useRef([]),n=w.useRef([0,0]),a=w.useRef(),r=w.useState(nfe++)[0],i=w.useState(_8)[0],s=w.useRef(e);w.useEffect(function(){s.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var S=Ede([e.lockRef.current],(e.shards||[]).map(ZU),!0).filter(Boolean);return S.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),S.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var c=w.useCallback(function(S,y){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!s.current.allowPinchZoom;var E=lb(S),_=n.current,k="deltaX"in S?S.deltaX:_[0]-E[0],C="deltaY"in S?S.deltaY:_[1]-E[1],R,I=S.target,A=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in S&&A==="h"&&I.type==="range")return!1;var O=window.getSelection(),M=O&&O.anchorNode,P=M?M===I||M.contains(I):!1;if(P)return!1;var B=WU(A,I);if(!B)return!0;if(B?R=A:(R=A==="v"?"h":"v",B=WU(A,I)),!B)return!1;if(!a.current&&"changedTouches"in S&&(k||C)&&(a.current=R),!R)return!0;var K=a.current||R;return Qde(K,y,S,K==="h"?k:C)},[]),u=w.useCallback(function(S){var y=S;if(!(!Zc.length||Zc[Zc.length-1]!==i)){var E="deltaY"in y?KU(y):lb(y),_=t.current.filter(function(R){return R.name===y.type&&(R.target===y.target||y.target===R.shadowParent)&&efe(R.delta,E)})[0];if(_&&_.should){y.cancelable&&y.preventDefault();return}if(!_){var k=(s.current.shards||[]).map(ZU).filter(Boolean).filter(function(R){return R.contains(y.target)}),C=k.length>0?c(y,k[0]):!s.current.noIsolation;C&&y.cancelable&&y.preventDefault()}}},[]),d=w.useCallback(function(S,y,E,_){var k={name:S,delta:y,target:E,should:_,shadowParent:afe(E)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),m=w.useCallback(function(S){n.current=lb(S),a.current=void 0},[]),h=w.useCallback(function(S){d(S.type,KU(S),S.target,c(S,e.lockRef.current))},[]),g=w.useCallback(function(S){d(S.type,lb(S),S.target,c(S,e.lockRef.current))},[]);w.useEffect(function(){return Zc.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Kc),document.addEventListener("touchmove",u,Kc),document.addEventListener("touchstart",m,Kc),function(){Zc=Zc.filter(function(S){return S!==i}),document.removeEventListener("wheel",u,Kc),document.removeEventListener("touchmove",u,Kc),document.removeEventListener("touchstart",m,Kc)}},[]);var v=e.removeScrollBar,x=e.inert;return w.createElement(w.Fragment,null,x?w.createElement(i,{styles:tfe(r)}):null,v?w.createElement(Wde,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function afe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ife=Dde(x8,rfe);var Om=w.forwardRef(function(e,t){return w.createElement(By,Fi({},e,{ref:t,sideCar:ife}))});Om.classNames=By.classNames;var H_=["Enter"," "],ofe=["ArrowDown","PageUp","Home"],N8=["ArrowUp","PageDown","End"],sfe=[...ofe,...N8],lfe={ltr:[...H_,"ArrowRight"],rtl:[...H_,"ArrowLeft"]},cfe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Dm="Menu",[zp,ufe,dfe]=NN(Dm),[tc,C8]=Ii(Dm,[dfe,Zs,m8]),Hy=Zs(),R8=m8(),[ffe,nc]=tc(Dm),[pfe,jm]=tc(Dm),A8=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:i,modal:s=!0}=e,c=Hy(t),[u,d]=w.useState(null),m=w.useRef(!1),h=Zi(i),g=CN(r);return w.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),f.jsx(Py,{...c,children:f.jsx(ffe,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:d,children:f.jsx(pfe,{scope:t,onClose:w.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:g,modal:s,children:a})})})};A8.displayName=Dm;var mfe="MenuAnchor",PN=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Hy(n);return f.jsx(Am,{...r,...a,ref:t})});PN.displayName=mfe;var UN="MenuPortal",[hfe,I8]=tc(UN,{forceMount:void 0}),O8=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,i=nc(UN,t);return f.jsx(hfe,{scope:t,forceMount:n,children:f.jsx(Ua,{present:n||i.open,children:f.jsx(Ld,{asChild:!0,container:r,children:a})})})};O8.displayName=UN;var Qa="MenuContent",[gfe,zN]=tc(Qa),D8=w.forwardRef((e,t)=>{const n=I8(Qa,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,i=nc(Qa,e.__scopeMenu),s=jm(Qa,e.__scopeMenu);return f.jsx(zp.Provider,{scope:e.__scopeMenu,children:f.jsx(Ua,{present:a||i.open,children:f.jsx(zp.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(bfe,{...r,ref:t}):f.jsx(vfe,{...r,ref:t})})})})}),bfe=w.forwardRef((e,t)=>{const n=nc(Qa,e.__scopeMenu),a=w.useRef(null),r=Jt(t,a);return w.useEffect(()=>{const i=a.current;if(i)return Fy(i)},[]),f.jsx(FN,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ge(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),vfe=w.forwardRef((e,t)=>{const n=nc(Qa,e.__scopeMenu);return f.jsx(FN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yfe=Hl("MenuContent.ScrollLock"),FN=w.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:x,...S}=e,y=nc(Qa,n),E=jm(Qa,n),_=Hy(n),k=R8(n),C=ufe(n),[R,I]=w.useState(null),A=w.useRef(null),O=Jt(t,A,y.onContentChange),M=w.useRef(0),P=w.useRef(""),B=w.useRef(0),K=w.useRef(null),ee=w.useRef("right"),te=w.useRef(0),ae=x?Om:w.Fragment,H=x?{as:yfe,allowPinchZoom:!0}:void 0,Z=re=>{const ne=P.current+re,j=C().filter(W=>!W.disabled),V=document.activeElement,z=j.find(W=>W.ref.current===V)?.textValue,L=j.map(W=>W.textValue),$=Ife(L,ne,z),F=j.find(W=>W.textValue===$)?.ref.current;(function W(X){P.current=X,window.clearTimeout(M.current),X!==""&&(M.current=window.setTimeout(()=>W(""),1e3))})(ne),F&&setTimeout(()=>F.focus())};w.useEffect(()=>()=>window.clearTimeout(M.current),[]),Dy();const G=w.useCallback(re=>ee.current===K.current?.side&&Dfe(re,K.current?.area),[]);return f.jsx(gfe,{scope:n,searchRef:P,onItemEnter:w.useCallback(re=>{G(re)&&re.preventDefault()},[G]),onItemLeave:w.useCallback(re=>{G(re)||(A.current?.focus(),I(null))},[G]),onTriggerLeave:w.useCallback(re=>{G(re)&&re.preventDefault()},[G]),pointerGraceTimerRef:B,onPointerGraceIntentChange:w.useCallback(re=>{K.current=re},[]),children:f.jsx(ae,{...H,children:f.jsx(Cm,{asChild:!0,trapped:r,onMountAutoFocus:Ge(i,re=>{re.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx(Od,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:f.jsx(yde,{asChild:!0,...k,dir:E.dir,orientation:"vertical",loop:a,currentTabStopId:R,onCurrentTabStopIdChange:I,onEntryFocus:Ge(u,re=>{E.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Uy,{role:"menu","aria-orientation":"vertical","data-state":Y8(y.open),"data-radix-menu-content":"",dir:E.dir,..._,...S,ref:O,style:{outline:"none",...S.style},onKeyDown:Ge(S.onKeyDown,re=>{const j=re.target.closest("[data-radix-menu-content]")===re.currentTarget,V=re.ctrlKey||re.altKey||re.metaKey,z=re.key.length===1;j&&(re.key==="Tab"&&re.preventDefault(),!V&&z&&Z(re.key));const L=A.current;if(re.target!==L||!sfe.includes(re.key))return;re.preventDefault();const F=C().filter(W=>!W.disabled).map(W=>W.ref.current);N8.includes(re.key)&&F.reverse(),Rfe(F)}),onBlur:Ge(e.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(M.current),P.current="")}),onPointerMove:Ge(e.onPointerMove,Fp(re=>{const ne=re.target,j=te.current!==re.clientX;if(re.currentTarget.contains(ne)&&j){const V=re.clientX>te.current?"right":"left";ee.current=V,te.current=re.clientX}}))})})})})})})});D8.displayName=Qa;var wfe="MenuGroup",BN=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return f.jsx(_t.div,{role:"group",...a,ref:t})});BN.displayName=wfe;var Sfe="MenuLabel",j8=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return f.jsx(_t.div,{...a,ref:t})});j8.displayName=Sfe;var Tv="MenuItem",YU="menu.itemSelect",Vy=w.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,i=w.useRef(null),s=jm(Tv,e.__scopeMenu),c=zN(Tv,e.__scopeMenu),u=Jt(t,i),d=w.useRef(!1),m=()=>{const h=i.current;if(!n&&h){const g=new CustomEvent(YU,{bubbles:!0,cancelable:!0});h.addEventListener(YU,v=>a?.(v),{once:!0}),B9(h,g),g.defaultPrevented?d.current=!1:s.onClose()}};return f.jsx(L8,{...r,ref:u,disabled:n,onClick:Ge(e.onClick,m),onPointerDown:h=>{e.onPointerDown?.(h),d.current=!0},onPointerUp:Ge(e.onPointerUp,h=>{d.current||h.currentTarget?.click()}),onKeyDown:Ge(e.onKeyDown,h=>{const g=c.searchRef.current!=="";n||g&&h.key===" "||H_.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Vy.displayName=Tv;var L8=w.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...i}=e,s=zN(Tv,n),c=R8(n),u=w.useRef(null),d=Jt(t,u),[m,h]=w.useState(!1),[g,v]=w.useState("");return w.useEffect(()=>{const x=u.current;x&&v((x.textContent??"").trim())},[i.children]),f.jsx(zp.ItemSlot,{scope:n,disabled:a,textValue:r??g,children:f.jsx(wde,{asChild:!0,...c,focusable:!a,children:f.jsx(_t.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...i,ref:d,onPointerMove:Ge(e.onPointerMove,Fp(x=>{a?s.onItemLeave(x):(s.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ge(e.onPointerLeave,Fp(x=>s.onItemLeave(x))),onFocus:Ge(e.onFocus,()=>h(!0)),onBlur:Ge(e.onBlur,()=>h(!1))})})})}),xfe="MenuCheckboxItem",$8=w.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return f.jsx(F8,{scope:e.__scopeMenu,checked:n,children:f.jsx(Vy,{role:"menuitemcheckbox","aria-checked":Nv(n)?"mixed":n,...r,ref:t,"data-state":VN(n),onSelect:Ge(r.onSelect,()=>a?.(Nv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});$8.displayName=xfe;var M8="MenuRadioGroup",[_fe,Efe]=tc(M8,{value:void 0,onValueChange:()=>{}}),P8=w.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,i=Zi(a);return f.jsx(_fe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(BN,{...r,ref:t})})});P8.displayName=M8;var U8="MenuRadioItem",z8=w.forwardRef((e,t)=>{const{value:n,...a}=e,r=Efe(U8,e.__scopeMenu),i=n===r.value;return f.jsx(F8,{scope:e.__scopeMenu,checked:i,children:f.jsx(Vy,{role:"menuitemradio","aria-checked":i,...a,ref:t,"data-state":VN(i),onSelect:Ge(a.onSelect,()=>r.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});z8.displayName=U8;var HN="MenuItemIndicator",[F8,kfe]=tc(HN,{checked:!1}),B8=w.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,i=kfe(HN,n);return f.jsx(Ua,{present:a||Nv(i.checked)||i.checked===!0,children:f.jsx(_t.span,{...r,ref:t,"data-state":VN(i.checked)})})});B8.displayName=HN;var Tfe="MenuSeparator",H8=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return f.jsx(_t.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});H8.displayName=Tfe;var Nfe="MenuArrow",V8=w.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Hy(n);return f.jsx(zy,{...r,...a,ref:t})});V8.displayName=Nfe;var Cfe="MenuSub",[QTe,G8]=tc(Cfe),np="MenuSubTrigger",W8=w.forwardRef((e,t)=>{const n=nc(np,e.__scopeMenu),a=jm(np,e.__scopeMenu),r=G8(np,e.__scopeMenu),i=zN(np,e.__scopeMenu),s=w.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=i,d={__scopeMenu:e.__scopeMenu},m=w.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return w.useEffect(()=>m,[m]),w.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),u(null)}},[c,u]),f.jsx(PN,{asChild:!0,...d,children:f.jsx(L8,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Y8(n.open),...e,ref:Ki(t,r.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ge(e.onPointerMove,Fp(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ge(e.onPointerLeave,Fp(h=>{m();const g=n.content?.getBoundingClientRect();if(g){const v=n.content?.dataset.side,x=v==="right",S=x?-5:5,y=g[x?"left":"right"],E=g[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+S,y:h.clientY},{x:y,y:g.top},{x:E,y:g.top},{x:E,y:g.bottom},{x:y,y:g.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ge(e.onKeyDown,h=>{const g=i.searchRef.current!=="";e.disabled||g&&h.key===" "||lfe[a.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});W8.displayName=np;var K8="MenuSubContent",Z8=w.forwardRef((e,t)=>{const n=I8(Qa,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,i=nc(Qa,e.__scopeMenu),s=jm(Qa,e.__scopeMenu),c=G8(K8,e.__scopeMenu),u=w.useRef(null),d=Jt(t,u);return f.jsx(zp.Provider,{scope:e.__scopeMenu,children:f.jsx(Ua,{present:a||i.open,children:f.jsx(zp.Slot,{scope:e.__scopeMenu,children:f.jsx(FN,{id:c.contentId,"aria-labelledby":c.triggerId,...r,ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{s.isUsingKeyboardRef.current&&u.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ge(e.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ge(e.onEscapeKeyDown,m=>{s.onClose(),m.preventDefault()}),onKeyDown:Ge(e.onKeyDown,m=>{const h=m.currentTarget.contains(m.target),g=cfe[s.dir].includes(m.key);h&&g&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});Z8.displayName=K8;function Y8(e){return e?"open":"closed"}function Nv(e){return e==="indeterminate"}function VN(e){return Nv(e)?"indeterminate":e?"checked":"unchecked"}function Rfe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Afe(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function Ife(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=Afe(e,Math.max(i,0));r.length===1&&(s=s.filter(d=>d!==n));const u=s.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return u!==n?u:void 0}function Ofe(e,t){const{x:n,y:a}=e;let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,m=c.y,h=u.x,g=u.y;m>a!=g>a&&n<(h-d)*(a-m)/(g-m)+d&&(r=!r)}return r}function Dfe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Ofe(n,t)}function Fp(e){return t=>t.pointerType==="mouse"?e(t):void 0}var jfe=A8,Lfe=PN,$fe=O8,Mfe=D8,Pfe=BN,Ufe=j8,zfe=Vy,Ffe=$8,Bfe=P8,Hfe=z8,Vfe=B8,Gfe=H8,Wfe=V8,Kfe=W8,Zfe=Z8,Gy="DropdownMenu",[Yfe]=Ii(Gy,[C8]),ia=C8(),[qfe,q8]=Yfe(Gy),X8=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,u=ia(t),d=w.useRef(null),[m,h]=Mo({prop:r,defaultProp:i??!1,onChange:s,caller:Gy});return f.jsx(qfe,{scope:t,triggerId:jr(),triggerRef:d,contentId:jr(),open:m,onOpenChange:h,onOpenToggle:w.useCallback(()=>h(g=>!g),[h]),modal:c,children:f.jsx(jfe,{...u,open:m,onOpenChange:h,dir:a,modal:c,children:n})})};X8.displayName=Gy;var J8="DropdownMenuTrigger",Q8=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,i=q8(J8,n),s=ia(n);return f.jsx(Lfe,{asChild:!0,...s,children:f.jsx(_t.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...r,ref:Ki(t,i.triggerRef),onPointerDown:Ge(e.onPointerDown,c=>{!a&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:Ge(e.onKeyDown,c=>{a||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});Q8.displayName=J8;var Xfe="DropdownMenuPortal",eG=e=>{const{__scopeDropdownMenu:t,...n}=e,a=ia(t);return f.jsx($fe,{...a,...n})};eG.displayName=Xfe;var tG="DropdownMenuContent",nG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=q8(tG,n),i=ia(n),s=w.useRef(!1);return f.jsx(Mfe,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...a,ref:t,onCloseAutoFocus:Ge(e.onCloseAutoFocus,c=>{s.current||r.triggerRef.current?.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Ge(e.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,m=u.button===2||d;(!r.modal||m)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nG.displayName=tG;var Jfe="DropdownMenuGroup",Qfe=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Pfe,{...r,...a,ref:t})});Qfe.displayName=Jfe;var epe="DropdownMenuLabel",rG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Ufe,{...r,...a,ref:t})});rG.displayName=epe;var tpe="DropdownMenuItem",aG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(zfe,{...r,...a,ref:t})});aG.displayName=tpe;var npe="DropdownMenuCheckboxItem",iG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Ffe,{...r,...a,ref:t})});iG.displayName=npe;var rpe="DropdownMenuRadioGroup",ape=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Bfe,{...r,...a,ref:t})});ape.displayName=rpe;var ipe="DropdownMenuRadioItem",oG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Hfe,{...r,...a,ref:t})});oG.displayName=ipe;var ope="DropdownMenuItemIndicator",spe=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Vfe,{...r,...a,ref:t})});spe.displayName=ope;var lpe="DropdownMenuSeparator",sG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Gfe,{...r,...a,ref:t})});sG.displayName=lpe;var cpe="DropdownMenuArrow",upe=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Wfe,{...r,...a,ref:t})});upe.displayName=cpe;var dpe="DropdownMenuSubTrigger",lG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Kfe,{...r,...a,ref:t})});lG.displayName=dpe;var fpe="DropdownMenuSubContent",cG=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ia(n);return f.jsx(Zfe,{...r,...a,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});cG.displayName=fpe;var ppe=X8,mpe=Q8,hpe=eG,uG=nG,dG=rG,fG=aG,gpe=iG,bpe=oG,pG=sG,vpe=lG,ype=cG;const V_=ppe,G_=mpe;vpe.displayName;ype.displayName;function Cv({ref:e,className:t,sideOffset:n=4,...a}){return f.jsx(hpe,{children:f.jsx(uG,{ref:e,sideOffset:n,className:De("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})})}Cv.displayName=uG.displayName;function Ro({ref:e,className:t,inset:n,...a}){return f.jsx(fG,{ref:e,className:De("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",t),...a})}Ro.displayName=fG.displayName;gpe.displayName;bpe.displayName;function W_({ref:e,className:t,inset:n,...a}){return f.jsx(dG,{ref:e,className:De("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...a})}W_.displayName=dG.displayName;function rp({ref:e,className:t,...n}){return f.jsx(pG,{ref:e,className:De("-mx-1 my-1 h-px bg-muted",t),...n})}rp.displayName=pG.displayName;var wpe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Go=wpe.reduce((e,t)=>{const n=_9(`Primitive.${t}`),a=w.forwardRef((r,i)=>{const{asChild:s,...c}=r,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(u,{...c,ref:i})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Spe="Label",mG=w.forwardRef((e,t)=>f.jsx(Go.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));mG.displayName=Spe;var xpe=mG;function Kt({className:e,...t}){return f.jsx(xpe,{"data-slot":"label",className:De("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function $d({message:e,className:t="",vertical:n,noBorder:a}){return f.jsx("div",{className:De(`mt-2 rounded-md p-6 ${t}`,!a&&"border"),children:f.jsxs("p",{className:De("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[f.jsx("svg",{width:"40",height:"40",viewBox:"0 0 273 273",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:f.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:f.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[f.jsx("path",{d:"M49.953025,-2.10854389 C63.26892,-2.21867124 76.6185256,2.70621155 86.9019463,12.6653164 L86.9019463,12.6653164 L87.505627,13.2592944 C97.5154947,23.2654892 102.640454,36.3074513 102.880738,49.4222247 C103.08932,77.4533067 113.877287,105.391753 135.242867,126.757333 C156.613383,148.127849 184.559216,158.914875 212.568138,159.119313 L212.568138,159.119313 L213.212264,159.134159 C225.843948,159.517566 238.363557,164.434972 248.121998,173.886137 L248.121998,173.886137 L248.725621,174.480088 C258.982114,184.732164 264.11035,198.171134 264.11035,211.6101 C264.11035,225.04592 258.984514,238.481745 248.732867,248.732867 C238.592792,258.872942 225.336706,263.997882 212.046872,264.107794 C198.731075,264.21792 185.381569,259.293085 175.098248,249.334078 L175.098248,249.334078 L174.494602,248.740134 C163.75802,238.008189 158.640853,223.784027 159.143413,209.719372 C158.258245,182.640933 147.489786,155.83332 126.828333,135.171867 C106.351297,114.694831 79.8363505,103.934873 53.0237258,102.891841 L53.0237258,102.891841 L52.2811438,102.865674 C38.4791718,103.347421 24.5325234,98.4328111 13.8776628,88.1140866 L13.8776628,88.1140866 L13.2739843,87.5201168 C3.12895117,77.3789607 -1.9984796,64.1195994 -2.10841888,50.8264755 C-2.21854669,37.5105567 2.70635908,24.1609269 12.6655135,13.8774565 L12.6655135,13.8774565 L13.2594878,13.2737797 C23.4005926,3.12880025 36.659927,-1.99860507 49.953025,-2.10854389 Z"}),f.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),f.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),e]})})}function hG({className:e,color:t,children:n,grayscaled:a=!1}){const r=w.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return a?0:.2},[t,a]),i=w.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return a?.3:.4},[t,a]),s=w.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[2]||"0")}return Math.floor(Math.random()*360)},[t]),c=w.useMemo(()=>t||`oklch(${Math.min(i,1)} ${r} ${s})`,[s,r,i]),u=w.useMemo(()=>`oklch(${Math.min(i*2,1)} ${r} ${s})`,[s,r,i,t]),d=w.useMemo(()=>Math.floor(Math.random()*360),[s]),m=w.useMemo(()=>"1000%",[]);return f.jsx("section",{className:De("relative w-full h-full overflow-hidden",e),style:{background:`${u}`},children:f.jsxs("div",{className:"isolate relative w-full h-full",children:[f.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${d}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${m})`}}),n&&f.jsx("div",{className:"relative z-10 w-full h-full",children:n})]})})}function GN(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Wy="Switch",[_pe]=Ii(Wy),[Epe,kpe]=_pe(Wy),gG=w.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:r,defaultChecked:i,required:s,disabled:c,value:u="on",onCheckedChange:d,form:m,...h}=e,[g,v]=w.useState(null),x=Jt(t,k=>v(k)),S=w.useRef(!1),y=g?m||!!g.closest("form"):!0,[E,_]=Mo({prop:r,defaultProp:i??!1,onChange:d,caller:Wy});return f.jsxs(Epe,{scope:n,checked:E,disabled:c,children:[f.jsx(_t.button,{type:"button",role:"switch","aria-checked":E,"aria-required":s,"data-state":wG(E),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:x,onClick:Ge(e.onClick,k=>{_(C=>!C),y&&(S.current=k.isPropagationStopped(),S.current||k.stopPropagation())})}),y&&f.jsx(yG,{control:g,bubbles:!S.current,name:a,value:u,checked:E,required:s,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});gG.displayName=Wy;var bG="SwitchThumb",vG=w.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,r=kpe(bG,n);return f.jsx(_t.span,{"data-state":wG(r.checked),"data-disabled":r.disabled?"":void 0,...a,ref:t})});vG.displayName=bG;var Tpe="SwitchBubbleInput",yG=w.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...r},i)=>{const s=w.useRef(null),c=Jt(s,i),u=GN(n),d=LN(t);return w.useEffect(()=>{const m=s.current;if(!m)return;const h=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==n&&v){const x=new Event("click",{bubbles:a});v.call(m,n),m.dispatchEvent(x)}},[u,n,a]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:c,style:{...r.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});yG.displayName=Tpe;function wG(e){return e?"checked":"unchecked"}var SG=gG,Npe=vG;function Ky({ref:e,className:t,...n}){return f.jsx(SG,{className:De("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...n,ref:e,children:f.jsx(Npe,{className:De("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}Ky.displayName=SG.displayName;var xG=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Cpe="VisuallyHidden",_G=w.forwardRef((e,t)=>f.jsx(_t.span,{...e,ref:t,style:{...xG,...e.style}}));_G.displayName=Cpe;var Rpe=_G,[Zy]=Ii("Tooltip",[Zs]),Yy=Zs(),EG="TooltipProvider",Ape=700,K_="tooltip.open",[Ipe,WN]=Zy(EG),kG=e=>{const{__scopeTooltip:t,delayDuration:n=Ape,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:i}=e,s=w.useRef(!0),c=w.useRef(!1),u=w.useRef(0);return w.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),f.jsx(Ipe,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:w.useCallback(d=>{c.current=d},[]),disableHoverableContent:r,children:i})};kG.displayName=EG;var Bp="Tooltip",[Ope,Lm]=Zy(Bp),TG=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:i,disableHoverableContent:s,delayDuration:c}=e,u=WN(Bp,e.__scopeTooltip),d=Yy(t),[m,h]=w.useState(null),g=jr(),v=w.useRef(0),x=s??u.disableHoverableContent,S=c??u.delayDuration,y=w.useRef(!1),[E,_]=Mo({prop:a,defaultProp:r??!1,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(K_))):u.onClose(),i?.(A)},caller:Bp}),k=w.useMemo(()=>E?y.current?"delayed-open":"instant-open":"closed",[E]),C=w.useCallback(()=>{window.clearTimeout(v.current),v.current=0,y.current=!1,_(!0)},[_]),R=w.useCallback(()=>{window.clearTimeout(v.current),v.current=0,_(!1)},[_]),I=w.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{y.current=!0,_(!0),v.current=0},S)},[S,_]);return w.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),f.jsx(Py,{...d,children:f.jsx(Ope,{scope:t,contentId:g,open:E,stateAttribute:k,trigger:m,onTriggerChange:h,onTriggerEnter:w.useCallback(()=>{u.isOpenDelayedRef.current?I():C()},[u.isOpenDelayedRef,I,C]),onTriggerLeave:w.useCallback(()=>{x?R():(window.clearTimeout(v.current),v.current=0)},[R,x]),onOpen:C,onClose:R,disableHoverableContent:x,children:n})})};TG.displayName=Bp;var Z_="TooltipTrigger",NG=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Lm(Z_,n),i=WN(Z_,n),s=Yy(n),c=w.useRef(null),u=Jt(t,c,r.onTriggerChange),d=w.useRef(!1),m=w.useRef(!1),h=w.useCallback(()=>d.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),f.jsx(Am,{asChild:!0,...s,children:f.jsx(_t.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:u,onPointerMove:Ge(e.onPointerMove,g=>{g.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ge(e.onPointerLeave,()=>{r.onTriggerLeave(),m.current=!1}),onPointerDown:Ge(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ge(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:Ge(e.onBlur,r.onClose),onClick:Ge(e.onClick,r.onClose)})})});NG.displayName=Z_;var KN="TooltipPortal",[Dpe,jpe]=Zy(KN,{forceMount:void 0}),CG=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,i=Lm(KN,t);return f.jsx(Dpe,{scope:t,forceMount:n,children:f.jsx(Ua,{present:n||i.open,children:f.jsx(Ld,{asChild:!0,container:r,children:a})})})};CG.displayName=KN;var ud="TooltipContent",RG=w.forwardRef((e,t)=>{const n=jpe(ud,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...i}=e,s=Lm(ud,e.__scopeTooltip);return f.jsx(Ua,{present:a||s.open,children:s.disableHoverableContent?f.jsx(AG,{side:r,...i,ref:t}):f.jsx(Lpe,{side:r,...i,ref:t})})}),Lpe=w.forwardRef((e,t)=>{const n=Lm(ud,e.__scopeTooltip),a=WN(ud,e.__scopeTooltip),r=w.useRef(null),i=Jt(t,r),[s,c]=w.useState(null),{trigger:u,onClose:d}=n,m=r.current,{onPointerInTransitChange:h}=a,g=w.useCallback(()=>{c(null),h(!1)},[h]),v=w.useCallback((x,S)=>{const y=x.currentTarget,E={x:x.clientX,y:x.clientY},_=Upe(E,y.getBoundingClientRect()),k=zpe(E,_),C=Fpe(S.getBoundingClientRect()),R=Hpe([...k,...C]);c(R),h(!0)},[h]);return w.useEffect(()=>()=>g(),[g]),w.useEffect(()=>{if(u&&m){const x=y=>v(y,m),S=y=>v(y,u);return u.addEventListener("pointerleave",x),m.addEventListener("pointerleave",S),()=>{u.removeEventListener("pointerleave",x),m.removeEventListener("pointerleave",S)}}},[u,m,v,g]),w.useEffect(()=>{if(s){const x=S=>{const y=S.target,E={x:S.clientX,y:S.clientY},_=u?.contains(y)||m?.contains(y),k=!Bpe(E,s);_?g():k&&(g(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,m,s,d,g]),f.jsx(AG,{...e,ref:i})}),[$pe,Mpe]=Zy(Bp,{isInside:!1}),Ppe=vce("TooltipContent"),AG=w.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:s,...c}=e,u=Lm(ud,n),d=Yy(n),{onClose:m}=u;return w.useEffect(()=>(document.addEventListener(K_,m),()=>document.removeEventListener(K_,m)),[m]),w.useEffect(()=>{if(u.trigger){const h=g=>{g.target?.contains(u.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,m]),f.jsx(Od,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:f.jsxs(Uy,{"data-state":u.stateAttribute,...d,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(Ppe,{children:a}),f.jsx($pe,{scope:n,isInside:!0,children:f.jsx(Rpe,{id:u.contentId,role:"tooltip",children:r||a})})]})})});RG.displayName=ud;var IG="TooltipArrow",OG=w.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Yy(n);return Mpe(IG,n).isInside?null:f.jsx(zy,{...r,...a,ref:t})});OG.displayName=IG;function Upe(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,a,r,i)){case i:return"left";case r:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function zpe(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function Fpe(e){const{top:t,right:n,bottom:a,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:a},{x:r,y:a}]}function Bpe(e,t){const{x:n,y:a}=e;let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,m=c.y,h=u.x,g=u.y;m>a!=g>a&&n<(h-d)*(a-m)/(g-m)+d&&(r=!r)}return r}function Hpe(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),Vpe(t)}function Vpe(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const r=e[a];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(r.y-s.y)>=(i.y-s.y)*(r.x-s.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const r=e[a];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(r.y-s.y)>=(i.y-s.y)*(r.x-s.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Gpe=kG,Wpe=TG,Kpe=NG,Zpe=CG,Ype=RG,qpe=OG;function ZN({delayDuration:e=0,...t}){return f.jsx(Gpe,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Nt({...e}){return f.jsx(ZN,{children:f.jsx(Wpe,{"data-slot":"tooltip",...e})})}function Ct({...e}){return f.jsx(Kpe,{"data-slot":"tooltip-trigger",...e})}function Rt({className:e,sideOffset:t=0,children:n,...a}){return f.jsx(Zpe,{children:f.jsxs(Ype,{"data-slot":"tooltip-content",sideOffset:t,className:De("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...a,children:[n,f.jsx(qpe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class Xpe{name="mcp_inspector_open";properties;constructor(t){this.properties={server_url:t.serverUrl,connection_count:t.connectionCount}}}class qU{name="mcp_tool_execution";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId,success:t.success,duration:t.duration,error:t.error}}}class XU{name="mcp_resource_read";properties;constructor(t){this.properties={resource_uri:t.resourceUri,server_id:t.serverId,success:t.success,error:t.error}}}class JU{name="mcp_prompt_call";properties;constructor(t){this.properties={prompt_name:t.promptName,server_id:t.serverId,success:t.success,error:t.error}}}class QU{name="mcp_chat_message";properties;constructor(t){this.properties={server_id:t.serverId,provider:t.provider,model:t.model,message_count:t.messageCount,tool_calls_count:t.toolCallsCount,success:t.success,execution_mode:t.executionMode,duration:t.duration,error:t.error}}}class Jpe{name="mcp_server_added";properties;constructor(t){this.properties={server_id:t.serverId,server_url:t.serverUrl,connection_type:t.connectionType,via_proxy:t.viaProxy}}}class Qpe{name="mcp_server_removed";properties;constructor(t){this.properties={server_id:t.serverId}}}class eme{name="mcp_command_palette_open";properties;constructor(t){this.properties={trigger:t.trigger}}}class tme{name="mcp_tool_saved";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId}}}function wx(){try{return"0.13.0-canary.15"}catch{return"0.0.0"}}var nme={};function Sx(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class ez{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,a=setTimeout(()=>n.abort(),this.timeout),r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(a),!r.ok)throw new Error(`HTTP error! status: ${r.status}`)}catch{}}}function ys(e){return`mcp_inspector_telemetry_${e}`}class vr{static instance=null;POSTHOG_PROXY_URL="/inspector/api/tel/posthog";SCARF_PROXY_URL="/inspector/api/tel/scarf";UNKNOWN_USER_ID="UNKNOWN_USER_ID";_currUserId=null;_posthogClient=null;_scarfClient=null;_source="inspector";constructor(){const t=Sx(),n=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||"inspector",n)this._posthogClient=null,this._scarfClient=null;else if(!t)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new ez(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new ez(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(ys("disabled"))==="true"||typeof process<"u"&&nme?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(ys("source")):null}static getInstance(){return vr.instance||(vr.instance=new vr),vr.instance}setSource(t){this._source=t,typeof localStorage<"u"&&localStorage.setItem(ys("source"),t)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!Sx())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const t=localStorage.getItem(ys("user_id"));if(t)this._currUserId=t;else{const n=this.generateUserId();localStorage.setItem(ys("user_id"),n),this._currUserId=n}this.trackPackageDownload({triggered_by:"user_id_property"}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){const t=window.crypto;if(t){const n=new Uint8Array(16);t.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;const a=Array.from(n).map(r=>r.toString(16).padStart(2,"0")).join("");return a.slice(0,8)+"-"+a.slice(8,12)+"-"+a.slice(12,16)+"-"+a.slice(16,20)+"-"+a.slice(20,32)}else return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const a=Math.random()*16|0;return(n==="x"?a:a&3|8).toString(16)})}async capture(t){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{const n={event:t.name,user_id:this.userId,properties:{...t.properties,mcp_use_version:wx(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(n)}catch{}if(this._scarfClient)try{const n={};n.mcp_use_version=wx(),n.user_id=this.userId,n.event=t.name,n.language="typescript",n.source=this._source,n.package="inspector",await this._scarfClient.logEvent(n)}catch{}}}async trackPackageDownload(t){if(this._scarfClient&&Sx())try{const n=wx();let a=!1,r=!1;const i=localStorage.getItem(ys("download_version"));if(i?n>i&&(a=!0,r=!1,localStorage.setItem(ys("download_version"),n)):(a=!0,r=!0,localStorage.setItem(ys("download_version"),n)),a){const s={...t||{}};s.mcp_use_version=n,s.user_id=this.userId,s.event="package_download",s.first_download=r,s.language="typescript",s.source=this._source,s.package="inspector",await this._scarfClient.logEvent(s)}}catch{}}async trackInspectorOpen(t){const n=new Xpe(t);await this.capture(n)}}const rme={model:"stub-model",stopReason:"endTurn",role:"assistant",content:{type:"text",text:"positive"}};function ame({requestId:e,serverName:t,onViewDetails:n,onApprove:a,onDeny:r}){return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{children:[f.jsx("strong",{children:"Sampling Request Received"}),f.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["New request from ",t]})]}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:i=>{i.stopPropagation(),n()},children:"View Details"}),f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:i=>{i.stopPropagation(),a(rme)},children:"Approve"}),f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:i=>{i.stopPropagation(),r()},children:"Deny"})]})]})}function ime({requestId:e,serverName:t,mode:n,message:a,url:r,onViewDetails:i,onOpenUrl:s,onCancel:c}){return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{children:[f.jsx("strong",{children:"Elicitation Request Received"}),f.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["From ",t,": ",a]}),n==="url"&&r&&f.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono",children:r})]}),f.jsxs("div",{className:"flex gap-2 flex-wrap",children:[f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:u=>{u.stopPropagation(),i()},children:"View Details"}),n==="url"&&s&&f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:u=>{u.stopPropagation(),s()},children:"Open URL"}),f.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:u=>{u.stopPropagation(),c()},children:"Cancel"})]})]})}const cb=()=>{},ub=()=>{},db=()=>{},fb=()=>{},DG=w.createContext(null);function YN(){const e=w.use(DG);if(!e)throw new Error("useMcpContext must be used within a McpProvider");return e}function ome({url:e,name:t,proxyConfig:n,transportType:a,connectionId:r,onUpdate:i,onRemove:s}){const c=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=e,d={};if(n?.proxyAddress){const L=new URL(n.proxyAddress),$=new URL(e);u=`${L.origin}${L.pathname}${$.pathname}${$.search}`,d["X-Target-URL"]=e}n?.customHeaders&&(d={...d,...n.customHeaders});const[m,h]=w.useState([]),g=w.useRef(0),[v,x]=w.useState([]),S=w.useRef(0),y=w.useMemo(()=>m.map(L=>({id:L.id,request:L.request,timestamp:L.timestamp,serverName:L.serverName})),[m]),E=w.useMemo(()=>v.map(L=>({id:L.id,request:L.request,timestamp:L.timestamp,serverName:L.serverName})),[v]),_=w.useRef(null),[k,C]=w.useState(!1),R=w.useRef(!1);w.useEffect(()=>{typeof window<"u"&&!R.current&&(R.current=!0,Jn(()=>import("./transport-wrapper-browser-BI4dDu3b.js"),[]).then(L=>{_.current=L.wrapTransportForLogging,C(!0),console.log("[McpContext] Transport wrapper loaded")}).catch(L=>{console.error("[McpContext] Failed to load transport wrapper:",L)}))},[]);const I=w.useMemo(()=>{if(!(!k||!_.current))return(L,$)=>{const F=r;return console.log("[McpContext] Applying transport wrapper, serverId:",F,"from connector:",$),_.current(L,F)}},[k,r]),A=`mcp-inspector-notifications-${r}`,O=500,[M,P]=w.useState([]);w.useEffect(()=>{try{const L=localStorage.getItem(A);if(L){const $=JSON.parse(L);Array.isArray($)&&P($)}}catch(L){console.error("Failed to load notifications from localStorage:",L)}},[A]),w.useEffect(()=>{try{localStorage.setItem(A,JSON.stringify(M))}catch(L){console.error("Failed to save notifications to localStorage:",L)}},[M,A]);const B=w.useCallback(L=>{P($=>$.map(F=>F.id===L?{...F,read:!0}:F))},[]),K=w.useCallback(()=>{P(L=>L.map($=>({...$,read:!0})))},[]),ee=w.useCallback(()=>{P([])},[]),te=w.useCallback(L=>{P($=>{const F=[L,...$];return F.length>O?F.slice(0,O):F})},[]),ae=w.useCallback((L,$)=>{h(F=>{const W=F.find(X=>X.id===L);return W?(W.resolve($),F.filter(X=>X.id!==L)):F})},[]),H=w.useCallback((L,$)=>{h(F=>{const W=F.find(X=>X.id===L);return W?(W.reject(new Error($||"User rejected sampling request")),F.filter(X=>X.id!==L)):F})},[]),Z=w.useCallback((L,$)=>{x(F=>{const W=F.find(X=>X.id===L);return W?(W.resolve($),F.filter(X=>X.id!==L)):F})},[]),G=w.useCallback((L,$)=>{x(F=>{const W=F.find(X=>X.id===L);return W?(W.reject(new Error($||"User rejected elicitation request")),F.filter(X=>X.id!==L)):F})},[]),re=w.useCallback(async L=>new Promise(($,F)=>{const W=`sampling-${g.current++}`,X={id:W,request:{params:L},timestamp:Date.now(),serverName:t,resolve:$,reject:F};h(ie=>[...ie,X]),typeof window<"u"&&Jn(async()=>{const{toast:ie}=await Promise.resolve().then(()=>sz);return{toast:ie}},void 0).then(({toast:ie})=>{const ce=ie(f.jsx(ame,{requestId:W,serverName:t,onViewDetails:()=>{const J=new globalThis.CustomEvent("navigate-to-sampling",{detail:{requestId:W}});window.dispatchEvent(J),ie.dismiss(ce)},onApprove:J=>{h(q=>{const le=q.find(he=>he.id===W);return le?(le.resolve(J),ie.success("Sampling request approved"),q.filter(he=>he.id!==W)):q}),ie.dismiss(ce)},onDeny:()=>{h(J=>{const q=J.find(le=>le.id===W);return q?(q.reject(new Error("User denied sampling request from toast")),ie.error("Sampling request denied"),J.filter(le=>le.id!==W)):J}),ie.dismiss(ce)}}),{duration:5e3})})}),[t]),ne=w.useCallback(async L=>new Promise(($,F)=>{const W=`elicitation-${S.current++}`,X={id:W,request:L,timestamp:Date.now(),serverName:t,resolve:$,reject:F};x(ie=>[...ie,X]),typeof window<"u"&&Jn(async()=>{const{toast:ie}=await Promise.resolve().then(()=>sz);return{toast:ie}},void 0).then(({toast:ie})=>{const ce=ie(f.jsx(ime,{requestId:W,serverName:t,mode:L.mode||"form",message:L.message,url:L.mode==="url"?L.url:void 0,onViewDetails:()=>{const J=new globalThis.CustomEvent("navigate-to-elicitation",{detail:{requestId:W}});window.dispatchEvent(J),ie.dismiss(ce)},onOpenUrl:L.mode==="url"?()=>{window.open(L.url,"_blank"),ie.dismiss(ce)}:void 0,onCancel:()=>{x(J=>{const q=J.find(le=>le.id===W);return q?(q.reject(new Error("User cancelled elicitation request from toast")),ie.error("Elicitation request cancelled"),J.filter(le=>le.id!==W)):J}),ie.dismiss(ce)}}),{duration:5e3})})}),[t]),j=wN({url:u,callbackUrl:c,customHeaders:Object.keys(d).length>0?d:void 0,transportType:a||"http",preventAutoAuth:!0,useRedirectFlow:!0,enabled:k,wrapTransport:I,onNotification:L=>{te({id:globalThis.crypto.randomUUID(),method:L.method,params:L.params,timestamp:Date.now(),read:!1})},samplingCallback:re,onElicitation:ne}),V=w.useRef(i),z=w.useRef(null);return w.useEffect(()=>{V.current=i},[i]),w.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{j.state==="ready"&&j.serverInfo&&console.log("[McpContext] Server info available:",j.serverInfo);const L=M.filter(W=>!W.read).length,$={id:r,url:e,name:j.serverInfo?.name||t,state:j.state,tools:j.tools,resources:j.resources,prompts:j.prompts,error:j.error??null,authUrl:j.authUrl??null,customHeaders:d,transportType:a,proxyConfig:n,serverInfo:j.serverInfo,capabilities:j.capabilities,notifications:M,unreadNotificationCount:L,markNotificationRead:B,markAllNotificationsRead:K,clearNotifications:ee,pendingSamplingRequests:y,approveSampling:ae,rejectSampling:H,pendingElicitationRequests:E,approveElicitation:Z,rejectElicitation:G,callTool:j.callTool,readResource:j.readResource,listPrompts:j.listPrompts,getPrompt:j.getPrompt,authenticate:j.authenticate,retry:j.retry,clearStorage:j.clearStorage,disconnect:j.disconnect,client:j.client},F=z.current;(!F||F.state!==$.state||F.error!==$.error||F.authUrl!==$.authUrl||F.name!==$.name||F.tools.length!==$.tools.length||F.resources.length!==$.resources.length||F.prompts.length!==$.prompts.length||F.serverInfo!==$.serverInfo||F.capabilities!==$.capabilities||F.notifications.length!==$.notifications.length||F.unreadNotificationCount!==$.unreadNotificationCount||F.pendingSamplingRequests.length!==$.pendingSamplingRequests.length||F.pendingElicitationRequests.length!==$.pendingElicitationRequests.length||!F.client)&&(z.current=$,V.current($))});else{const L=M.filter(W=>!W.read).length,$={id:r,url:e,name:j.serverInfo?.name||t,state:j.state,tools:j.tools,resources:j.resources,prompts:j.prompts,error:j.error??null,authUrl:j.authUrl??null,customHeaders:d,transportType:a,proxyConfig:n,serverInfo:j.serverInfo,capabilities:j.capabilities,notifications:M,unreadNotificationCount:L,markNotificationRead:B,markAllNotificationsRead:K,clearNotifications:ee,pendingSamplingRequests:y,approveSampling:ae,rejectSampling:H,pendingElicitationRequests:E,approveElicitation:Z,rejectElicitation:G,callTool:j.callTool,readResource:j.readResource,listPrompts:j.listPrompts,getPrompt:j.getPrompt,authenticate:j.authenticate,retry:j.retry,clearStorage:j.clearStorage,disconnect:j.disconnect,client:j.client},F=z.current;(!F||F.state!==$.state||F.error!==$.error||F.authUrl!==$.authUrl||F.name!==$.name||F.tools.length!==$.tools.length||F.resources.length!==$.resources.length||F.prompts.length!==$.prompts.length||F.serverInfo!==$.serverInfo||F.capabilities!==$.capabilities||F.notifications.length!==$.notifications.length||F.unreadNotificationCount!==$.unreadNotificationCount||F.pendingSamplingRequests.length!==$.pendingSamplingRequests.length||F.pendingElicitationRequests.length!==$.pendingElicitationRequests.length||!F.client)&&(z.current=$,V.current($))}},[e,t,a,n,d,r,j.state,j.tools,j.resources,j.prompts,j.error,j.authUrl,j.serverInfo,j.capabilities,j.client,M,B,K,ee,j.callTool,j.readResource,j.listPrompts,j.getPrompt,j.authenticate,j.retry,j.clearStorage,m,ae,H,E,Z,G]),null}function sme({children:e}){const[t,n]=w.useState([]),[a,r]=w.useState(!1),[i,s]=w.useState(!0),[c,u]=w.useState([]);w.useEffect(()=>{try{const y=localStorage.getItem("mcp-inspector-connections");if(y){const _=JSON.parse(y);Array.isArray(_)&&(u(_),n(_.map(k=>({id:k.id||k.url,url:k.url,name:k.name||"MCP Server",state:"discovering",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:k.proxyConfig?.customHeaders,transportType:k.transportType,proxyConfig:k.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:cb,rejectSampling:ub,pendingElicitationRequests:[],approveElicitation:db,rejectElicitation:fb,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}))))}const E=localStorage.getItem("mcp-inspector-auto-connect");E!==null&&s(E==="true")}catch(y){console.error("Failed to load connections from localStorage:",y)}finally{r(!0)}},[]),w.useEffect(()=>{a&&localStorage.setItem("mcp-inspector-connections",JSON.stringify(c))},[c,a]),w.useEffect(()=>{a&&localStorage.setItem("mcp-inspector-auto-connect",String(i))},[i,a]);const d=w.useCallback((y,E,_,k)=>{const C=c.find(A=>A.url===y),R=t.find(A=>A.url===y);if(C&&R){if(JSON.stringify(C.proxyConfig)!==JSON.stringify(_)&&_){u(O=>O.filter(M=>M.url!==y)),n(O=>O.filter(M=>M.url!==y)),setTimeout(()=>{const O={id:y,url:y,name:E||C.name||"MCP Server",proxyConfig:_,transportType:k||C.transportType};u(M=>[...M,O]),n(M=>[...M,{id:y,url:y,name:E||C.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:_?.customHeaders,transportType:k||C.transportType,proxyConfig:_,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:cb,rejectSampling:ub,pendingElicitationRequests:[],approveElicitation:db,rejectElicitation:fb,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},10);return}return}if(C&&!R){(_||k)&&u(A=>A.map(O=>O.url===y?{...O,proxyConfig:_||O.proxyConfig,transportType:k||O.transportType,name:E||O.name}:O)),n(A=>[...A,{id:C.id||y,url:y,name:E||C.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:_?.customHeaders||C.proxyConfig?.customHeaders,transportType:k||C.transportType,proxyConfig:_||C.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:cb,rejectSampling:ub,pendingElicitationRequests:[],approveElicitation:db,rejectElicitation:fb,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}]);return}const I={id:y,url:y,name:E||"MCP Server",proxyConfig:_,transportType:k};u(A=>[...A,I]),n(A=>[...A,{id:y,url:y,name:E||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:_?.customHeaders,transportType:k,proxyConfig:_,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:cb,rejectSampling:ub,pendingElicitationRequests:[],approveElicitation:db,rejectElicitation:fb,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},[c,t]),m=w.useCallback(y=>{const E=t.find(k=>k.id===y);E&&(console.log(`[McpContext] Cleaning up connection: ${y}`),E.disconnect&&(console.log(`[McpContext] Disconnecting from server: ${y}`),E.disconnect()),E.clearStorage&&(console.log(`[McpContext] Clearing OAuth storage for connection: ${y}`),E.clearStorage())),u(k=>k.filter(C=>C.id!==y)),n(k=>k.filter(C=>C.id!==y));const _=localStorage.getItem("mcp-inspector-connections");if(_)try{const C=JSON.parse(_).filter(R=>(R.id||R.url)!==y);localStorage.setItem("mcp-inspector-connections",JSON.stringify(C))}catch(k){console.error("Failed to update localStorage on remove:",k)}vr.getInstance().capture(new Qpe({serverId:y}))},[t]),h=w.useCallback((y,E)=>{u(_=>_.map(k=>k.id===y||k.url===y?{...k,...E}:k)),n(_=>_.map(k=>k.id===y?{...k,...E}:k))},[]),g=w.useCallback(y=>{n(E=>{const _=E.findIndex(R=>R.id===y.id);if(_===-1)return E;const k=E[_];if(k.state===y.state&&k.tools===y.tools&&k.resources===y.resources&&k.prompts===y.prompts&&k.error===y.error&&k.serverInfo===y.serverInfo&&k.client===y.client&&k.notifications===y.notifications&&k.unreadNotificationCount===y.unreadNotificationCount&&k.pendingSamplingRequests.length===y.pendingSamplingRequests.length&&k.pendingElicitationRequests.length===y.pendingElicitationRequests.length)return E;const C=[...E];return C[_]=y,C})},[]),v=w.useCallback(y=>{console.log("Connect requested for:",y)},[]),x=w.useCallback(y=>{console.log("Disconnect requested for:",y)},[]),S=w.useMemo(()=>({connections:t,addConnection:d,removeConnection:m,updateConnectionConfig:h,autoConnect:i,setAutoConnect:s,connectServer:v,disconnectServer:x,configLoaded:a}),[t,d,m,h,i,v,x,a]);return f.jsxs(DG.Provider,{value:S,children:[e,a&&i&&c.map(y=>{const E=`${y.id||y.url}-${y.proxyConfig?.proxyAddress?"proxy":"direct"}`;return console.warn("[McpContext] Rendering McpConnectionWrapper with key:",E,"proxyConfig:",y.proxyConfig),f.jsx(ome,{url:y.url,name:y.name,proxyConfig:y.proxyConfig,transportType:y.transportType,connectionId:y.id||y.url,onUpdate:g,onRemove:()=>m(y.id||y.url)},E)})]})}const lme=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cme=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),tz=e=>{const t=cme(e);return t.charAt(0).toUpperCase()+t.slice(1)},jG=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),ume=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var dme={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const fme=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:i,iconNode:s,...c},u)=>w.createElement("svg",{ref:u,...dme,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:jG("lucide",r),...!i&&!ume(c)&&{"aria-hidden":"true"},...c},[...s.map(([d,m])=>w.createElement(d,m)),...Array.isArray(i)?i:[i]]));const et=(e,t)=>{const n=w.forwardRef(({className:a,...r},i)=>w.createElement(fme,{ref:i,iconNode:t,className:jG(`lucide-${lme(tz(e))}`,`lucide-${e}`,a),...r}));return n.displayName=tz(e),n};const pme=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],mme=et("arrow-down-to-line",pme);const hme=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],gme=et("arrow-up-from-line",hme);const bme=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],vme=et("arrow-up",bme);const yme=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],qN=et("bell",yme);const wme=[["path",{d:"m11 10 3 3",key:"fzmg1i"}],["path",{d:"M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z",key:"p4q2r7"}],["path",{d:"M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031",key:"wy6l02"}]],LG=et("brush",wme);const Sme=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],xme=et("bug",Sme);const _me=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ra=et("check",_me);const Eme=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rc=et("chevron-down",Eme);const kme=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],qy=et("chevron-left",kme);const Tme=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$G=et("chevron-right",Tme);const Nme=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Cme=et("chevron-up",Nme);const Rme=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Ame=et("chevrons-up-down",Rme);const Ime=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],nz=et("circle-minus",Ime);const Ome=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],dd=et("clock",Ome);const Dme=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],XN=et("code",Dme);const jme=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],Lme=et("cog",jme);const $me=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Mme=et("command",$me);const Pme=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Lr=et("copy",Pme);const Ume=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Xy=et("database",Ume);const zme=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],$m=et("download",zme);const Fme=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Bme=et("ellipsis-vertical",Fme);const Hme=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Y_=et("external-link",Hme);const Vme=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],MG=et("eye-off",Vme);const Gme=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],q_=et("eye",Gme);const Wme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Kme=et("file-code",Wme);const Zme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],Yme=et("file-image",Zme);const qme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],JN=et("file-text",qme);const Xme=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Jme=et("file",Xme);const Qme=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ehe=et("folder-open",Qme);const the=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],nhe=et("globe",the);const rhe=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],ahe=et("grip-vertical",rhe);const ihe=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],PG=et("hash",ihe);const ohe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Rv=et("history",ohe);const she=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],UG=et("key",she);const lhe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],zs=et("loader-circle",lhe);const che=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],QN=et("maximize-2",che);const uhe=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],eC=et("maximize",uhe);const dhe=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],fhe=et("message-circle",dhe);const phe=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Hp=et("message-square",phe);const mhe=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],hhe=et("minimize",mhe);const ghe=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],rz=et("monitor",ghe);const bhe=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],vhe=et("moon",bhe);const yhe=[["path",{d:"M2 10h6V4",key:"zwrco"}],["path",{d:"m2 4 6 6",key:"ug085t"}],["path",{d:"M21 10V7a2 2 0 0 0-2-2h-7",key:"git5jr"}],["path",{d:"M3 14v2a2 2 0 0 0 2 2h3",key:"1f7fh3"}],["rect",{x:"12",y:"14",width:"10",height:"7",rx:"1",key:"1wjs3o"}]],whe=et("picture-in-picture",yhe);const She=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],zG=et("play",She);const xhe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],FG=et("plus",xhe);const _he=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],az=et("rotate-ccw",_he);const Ehe=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],tC=et("save",Ehe);const khe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Md=et("search",khe);const The=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Nhe=et("send",The);const Che=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Rhe=et("server",Che);const Ahe=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],_u=et("settings",Ahe);const Ihe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Ohe=et("shield",Ihe);const Dhe=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],jhe=et("sparkles",Dhe);const Lhe=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],BG=et("square-check-big",Lhe);const $he=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Mhe=et("square-pen",$he);const Phe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]],Uhe=et("sun-dim",Phe);const zhe=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],xx=et("terminal",zhe);const Fhe=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Fs=et("trash-2",Fhe);const Bhe=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Hhe=et("trash",Bhe);const Vhe=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Gl=et("wrench",Vhe);const Ghe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ji=et("x",Ghe);const Whe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Vp=et("zap",Whe);function Khe(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Zhe=e=>{switch(e){case"success":return Xhe;case"info":return Qhe;case"warning":return Jhe;case"error":return ege;default:return null}},Yhe=Array(12).fill(0),qhe=({visible:e,className:t})=>ue.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ue.createElement("div",{className:"sonner-spinner"},Yhe.map((n,a)=>ue.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),Xhe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Jhe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Qhe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),ege=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),tge=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ue.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ue.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),nge=()=>{const[e,t]=ue.useState(document.hidden);return ue.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let X_=1;class rge{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:a,...r}=t,i=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:X_++,s=this.toasts.find(u=>u.id===i),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(u=>u.id===i?(this.publish({...u,...t,id:i,title:a}),{...u,...t,id:i,dismissible:c,title:a}):u):this.addToast({title:a,...r,dismissible:c,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(a=>a({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let a;n.loading!==void 0&&(a=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const r=Promise.resolve(t instanceof Function?t():t);let i=a!==void 0,s;const c=r.then(async d=>{if(s=["resolve",d],ue.isValidElement(d))i=!1,this.create({id:a,type:"default",message:d});else if(ige(d)&&!d.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,g=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,x=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...x})}else if(d instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,g=typeof n.description=="function"?await n.description(d):n.description,x=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...x})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(d):n.success,g=typeof n.description=="function"?await n.description(d):n.description,x=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"success",description:g,...x})}}).catch(async d=>{if(s=["reject",d],n.error!==void 0){i=!1;const m=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description,v=typeof m=="object"&&!ue.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:h,...v})}}).finally(()=>{i&&(this.dismiss(a),a=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((d,m)=>c.then(()=>s[0]==="reject"?m(s[1]):d(s[1])).catch(m));return typeof a!="string"&&typeof a!="number"?{unwrap:u}:Object.assign(a,{unwrap:u})},this.custom=(t,n)=>{const a=n?.id||X_++;return this.create({jsx:t(a),id:a,...n}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ga=new rge,age=(e,t)=>{const n=t?.id||X_++;return ga.addToast({title:e,...t,id:n}),n},ige=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",oge=age,sge=()=>ga.toasts,lge=()=>ga.getActiveToasts(),Xt=Object.assign(oge,{success:ga.success,info:ga.info,warning:ga.warning,error:ga.error,custom:ga.custom,message:ga.message,promise:ga.promise,dismiss:ga.dismiss,loading:ga.loading},{getHistory:sge,getToasts:lge});Khe("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function pb(e){return e.label!==void 0}const cge=3,uge="24px",dge="16px",iz=4e3,fge=356,pge=14,mge=45,hge=200;function Ui(...e){return e.filter(Boolean).join(" ")}function gge(e){const[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}const bge=e=>{var t,n,a,r,i,s,c,u,d;const{invert:m,toast:h,unstyled:g,interacting:v,setHeights:x,visibleToasts:S,heights:y,index:E,toasts:_,expanded:k,removeToast:C,defaultRichColors:R,closeButton:I,style:A,cancelButtonStyle:O,actionButtonStyle:M,className:P="",descriptionClassName:B="",duration:K,position:ee,gap:te,expandByDefault:ae,classNames:H,icons:Z,closeButtonAriaLabel:G="Close toast"}=e,[re,ne]=ue.useState(null),[j,V]=ue.useState(null),[z,L]=ue.useState(!1),[$,F]=ue.useState(!1),[W,X]=ue.useState(!1),[ie,ce]=ue.useState(!1),[J,q]=ue.useState(!1),[le,he]=ue.useState(0),[oe,Ce]=ue.useState(0),Ve=ue.useRef(h.duration||K||iz),xe=ue.useRef(null),Te=ue.useRef(null),Fe=E===0,pe=E+1<=S,Oe=h.type,He=h.dismissible!==!1,Se=h.className||"",at=h.descriptionClassName||"",nt=ue.useMemo(()=>y.findIndex(Ke=>Ke.toastId===h.id)||0,[y,h.id]),ft=ue.useMemo(()=>{var Ke;return(Ke=h.closeButton)!=null?Ke:I},[h.closeButton,I]),Et=ue.useMemo(()=>h.duration||K||iz,[h.duration,K]),pt=ue.useRef(0),mn=ue.useRef(0),Pr=ue.useRef(0),St=ue.useRef(null),[Be,$e]=ee.split("-"),_e=ue.useMemo(()=>y.reduce((Ke,Ze,dt)=>dt>=nt?Ke:Ke+Ze.height,0),[y,nt]),je=nge(),Ue=h.invert||m,We=Oe==="loading";mn.current=ue.useMemo(()=>nt*te+_e,[nt,_e]),ue.useEffect(()=>{Ve.current=Et},[Et]),ue.useEffect(()=>{L(!0)},[]),ue.useEffect(()=>{const Ke=Te.current;if(Ke){const Ze=Ke.getBoundingClientRect().height;return Ce(Ze),x(dt=>[{toastId:h.id,height:Ze,position:h.position},...dt]),()=>x(dt=>dt.filter(At=>At.toastId!==h.id))}},[x,h.id]),ue.useLayoutEffect(()=>{if(!z)return;const Ke=Te.current,Ze=Ke.style.height;Ke.style.height="auto";const dt=Ke.getBoundingClientRect().height;Ke.style.height=Ze,Ce(dt),x(At=>At.find(ln=>ln.toastId===h.id)?At.map(ln=>ln.toastId===h.id?{...ln,height:dt}:ln):[{toastId:h.id,height:dt,position:h.position},...At])},[z,h.title,h.description,x,h.id,h.jsx,h.action,h.cancel]);const Je=ue.useCallback(()=>{F(!0),he(mn.current),x(Ke=>Ke.filter(Ze=>Ze.toastId!==h.id)),setTimeout(()=>{C(h)},hge)},[h,C,x,mn]);ue.useEffect(()=>{if(h.promise&&Oe==="loading"||h.duration===1/0||h.type==="loading")return;let Ke;return k||v||je?(()=>{if(Pr.current<pt.current){const At=new Date().getTime()-pt.current;Ve.current=Ve.current-At}Pr.current=new Date().getTime()})():Ve.current!==1/0&&(pt.current=new Date().getTime(),Ke=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),Je()},Ve.current)),()=>clearTimeout(Ke)},[k,v,h,Oe,je,Je]),ue.useEffect(()=>{h.delete&&(Je(),h.onDismiss==null||h.onDismiss.call(h,h))},[Je,h.delete]);function yt(){var Ke;if(Z?.loading){var Ze;return ue.createElement("div",{className:Ui(H?.loader,h==null||(Ze=h.classNames)==null?void 0:Ze.loader,"sonner-loader"),"data-visible":Oe==="loading"},Z.loading)}return ue.createElement(qhe,{className:Ui(H?.loader,h==null||(Ke=h.classNames)==null?void 0:Ke.loader),visible:Oe==="loading"})}const mt=h.icon||Z?.[Oe]||Zhe(Oe);var Mt,nn;return ue.createElement("li",{tabIndex:0,ref:Te,className:Ui(P,Se,H?.toast,h==null||(t=h.classNames)==null?void 0:t.toast,H?.default,H?.[Oe],h==null||(n=h.classNames)==null?void 0:n[Oe]),"data-sonner-toast":"","data-rich-colors":(Mt=h.richColors)!=null?Mt:R,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":z,"data-promise":!!h.promise,"data-swiped":J,"data-removed":$,"data-visible":pe,"data-y-position":Be,"data-x-position":$e,"data-index":E,"data-front":Fe,"data-swiping":W,"data-dismissible":He,"data-type":Oe,"data-invert":Ue,"data-swipe-out":ie,"data-swipe-direction":j,"data-expanded":!!(k||ae&&z),"data-testid":h.testId,style:{"--index":E,"--toasts-before":E,"--z-index":_.length-E,"--offset":`${$?le:mn.current}px`,"--initial-height":ae?"auto":`${oe}px`,...A,...h.style},onDragEnd:()=>{X(!1),ne(null),St.current=null},onPointerDown:Ke=>{Ke.button!==2&&(We||!He||(xe.current=new Date,he(mn.current),Ke.target.setPointerCapture(Ke.pointerId),Ke.target.tagName!=="BUTTON"&&(X(!0),St.current={x:Ke.clientX,y:Ke.clientY})))},onPointerUp:()=>{var Ke,Ze,dt;if(ie||!He)return;St.current=null;const At=Number(((Ke=Te.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Qn=Number(((Ze=Te.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ln=new Date().getTime()-((dt=xe.current)==null?void 0:dt.getTime()),Vn=re==="x"?At:Qn,Ln=Math.abs(Vn)/ln;if(Math.abs(Vn)>=mge||Ln>.11){he(mn.current),h.onDismiss==null||h.onDismiss.call(h,h),V(re==="x"?At>0?"right":"left":Qn>0?"down":"up"),Je(),ce(!0);return}else{var yn,fn;(yn=Te.current)==null||yn.style.setProperty("--swipe-amount-x","0px"),(fn=Te.current)==null||fn.style.setProperty("--swipe-amount-y","0px")}q(!1),X(!1),ne(null)},onPointerMove:Ke=>{var Ze,dt,At;if(!St.current||!He||((Ze=window.getSelection())==null?void 0:Ze.toString().length)>0)return;const ln=Ke.clientY-St.current.y,Vn=Ke.clientX-St.current.x;var Ln;const yn=(Ln=e.swipeDirections)!=null?Ln:gge(ee);!re&&(Math.abs(Vn)>1||Math.abs(ln)>1)&&ne(Math.abs(Vn)>Math.abs(ln)?"x":"y");let fn={x:0,y:0};const oa=Qt=>1/(1.5+Math.abs(Qt)/20);if(re==="y"){if(yn.includes("top")||yn.includes("bottom"))if(yn.includes("top")&&ln<0||yn.includes("bottom")&&ln>0)fn.y=ln;else{const Qt=ln*oa(ln);fn.y=Math.abs(Qt)<Math.abs(ln)?Qt:ln}}else if(re==="x"&&(yn.includes("left")||yn.includes("right")))if(yn.includes("left")&&Vn<0||yn.includes("right")&&Vn>0)fn.x=Vn;else{const Qt=Vn*oa(Vn);fn.x=Math.abs(Qt)<Math.abs(Vn)?Qt:Vn}(Math.abs(fn.x)>0||Math.abs(fn.y)>0)&&q(!0),(dt=Te.current)==null||dt.style.setProperty("--swipe-amount-x",`${fn.x}px`),(At=Te.current)==null||At.style.setProperty("--swipe-amount-y",`${fn.y}px`)}},ft&&!h.jsx&&Oe!=="loading"?ue.createElement("button",{"aria-label":G,"data-disabled":We,"data-close-button":!0,onClick:We||!He?()=>{}:()=>{Je(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Ui(H?.closeButton,h==null||(a=h.classNames)==null?void 0:a.closeButton)},(nn=Z?.close)!=null?nn:tge):null,(Oe||h.icon||h.promise)&&h.icon!==null&&(Z?.[Oe]!==null||h.icon)?ue.createElement("div",{"data-icon":"",className:Ui(H?.icon,h==null||(r=h.classNames)==null?void 0:r.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||yt():null,h.type!=="loading"?mt:null):null,ue.createElement("div",{"data-content":"",className:Ui(H?.content,h==null||(i=h.classNames)==null?void 0:i.content)},ue.createElement("div",{"data-title":"",className:Ui(H?.title,h==null||(s=h.classNames)==null?void 0:s.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?ue.createElement("div",{"data-description":"",className:Ui(B,at,H?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),ue.isValidElement(h.cancel)?h.cancel:h.cancel&&pb(h.cancel)?ue.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:Ke=>{pb(h.cancel)&&He&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Ke),Je())},className:Ui(H?.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,ue.isValidElement(h.action)?h.action:h.action&&pb(h.action)?ue.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||M,onClick:Ke=>{pb(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Ke),!Ke.defaultPrevented&&Je())},className:Ui(H?.actionButton,h==null||(d=h.classNames)==null?void 0:d.actionButton)},h.action.label):null)};function oz(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function vge(e,t){const n={};return[e,t].forEach((a,r)=>{const i=r===1,s=i?"--mobile-offset":"--offset",c=i?dge:uge;function u(d){["top","right","bottom","left"].forEach(m=>{n[`${s}-${m}`]=typeof d=="number"?`${d}px`:d})}typeof a=="number"||typeof a=="string"?u(a):typeof a=="object"?["top","right","bottom","left"].forEach(d=>{a[d]===void 0?n[`${s}-${d}`]=c:n[`${s}-${d}`]=typeof a[d]=="number"?`${a[d]}px`:a[d]}):u(c)}),n}const HG=ue.forwardRef(function(t,n){const{id:a,invert:r,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:c,closeButton:u,className:d,offset:m,mobileOffset:h,theme:g="light",richColors:v,duration:x,style:S,visibleToasts:y=cge,toastOptions:E,dir:_=oz(),gap:k=pge,icons:C,containerAriaLabel:R="Notifications"}=t,[I,A]=ue.useState([]),O=ue.useMemo(()=>a?I.filter(z=>z.toasterId===a):I.filter(z=>!z.toasterId),[I,a]),M=ue.useMemo(()=>Array.from(new Set([i].concat(O.filter(z=>z.position).map(z=>z.position)))),[O,i]),[P,B]=ue.useState([]),[K,ee]=ue.useState(!1),[te,ae]=ue.useState(!1),[H,Z]=ue.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=ue.useRef(null),re=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),ne=ue.useRef(null),j=ue.useRef(!1),V=ue.useCallback(z=>{A(L=>{var $;return($=L.find(F=>F.id===z.id))!=null&&$.delete||ga.dismiss(z.id),L.filter(({id:F})=>F!==z.id)})},[]);return ue.useEffect(()=>ga.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{A(L=>L.map($=>$.id===z.id?{...$,delete:!0}:$))});return}setTimeout(()=>{z9.flushSync(()=>{A(L=>{const $=L.findIndex(F=>F.id===z.id);return $!==-1?[...L.slice(0,$),{...L[$],...z},...L.slice($+1)]:[z,...L]})})})}),[I]),ue.useEffect(()=>{if(g!=="system"){Z(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:L})=>{Z(L?"dark":"light")})}catch{z.addListener(({matches:$})=>{try{Z($?"dark":"light")}catch(F){console.error(F)}})}},[g]),ue.useEffect(()=>{I.length<=1&&ee(!1)},[I]),ue.useEffect(()=>{const z=L=>{var $;if(s.every(X=>L[X]||L.code===X)){var W;ee(!0),(W=G.current)==null||W.focus()}L.code==="Escape"&&(document.activeElement===G.current||($=G.current)!=null&&$.contains(document.activeElement))&&ee(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),ue.useEffect(()=>{if(G.current)return()=>{ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null,j.current=!1)}},[G.current]),ue.createElement("section",{ref:n,"aria-label":`${R} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((z,L)=>{var $;const[F,W]=z.split("-");return O.length?ue.createElement("ol",{key:z,dir:_==="auto"?oz():_,tabIndex:-1,ref:G,className:d,"data-sonner-toaster":!0,"data-sonner-theme":H,"data-y-position":F,"data-x-position":W,style:{"--front-toast-height":`${(($=P[0])==null?void 0:$.height)||0}px`,"--width":`${fge}px`,"--gap":`${k}px`,...S,...vge(m,h)},onBlur:X=>{j.current&&!X.currentTarget.contains(X.relatedTarget)&&(j.current=!1,ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||j.current||(j.current=!0,ne.current=X.relatedTarget)},onMouseEnter:()=>ee(!0),onMouseMove:()=>ee(!0),onMouseLeave:()=>{te||ee(!1)},onDragEnd:()=>ee(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ae(!0)},onPointerUp:()=>ae(!1)},O.filter(X=>!X.position&&L===0||X.position===z).map((X,ie)=>{var ce,J;return ue.createElement(bge,{key:X.id,icons:C,index:ie,toast:X,defaultRichColors:v,duration:(ce=E?.duration)!=null?ce:x,className:E?.className,descriptionClassName:E?.descriptionClassName,invert:r,visibleToasts:y,closeButton:(J=E?.closeButton)!=null?J:u,interacting:te,position:z,style:E?.style,unstyled:E?.unstyled,classNames:E?.classNames,cancelButtonStyle:E?.cancelButtonStyle,actionButtonStyle:E?.actionButtonStyle,closeButtonAriaLabel:E?.closeButtonAriaLabel,removeToast:V,toasts:O.filter(q=>q.position==X.position),heights:P.filter(q=>q.position==X.position),setHeights:B,expandByDefault:c,gap:k,expanded:K,swipeDirections:t.swipeDirections})})):null}))}),sz=Object.freeze(Object.defineProperty({__proto__:null,Toaster:HG,toast:Xt},Symbol.toStringTag,{value:"Module"}));var Jy="Dialog",[VG]=Ii(Jy),[yge,Oi]=VG(Jy),GG=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:r,onOpenChange:i,modal:s=!0}=e,c=w.useRef(null),u=w.useRef(null),[d,m]=Mo({prop:a,defaultProp:r??!1,onChange:i,caller:Jy});return f.jsx(yge,{scope:t,triggerRef:c,contentRef:u,contentId:jr(),titleId:jr(),descriptionId:jr(),open:d,onOpenChange:m,onOpenToggle:w.useCallback(()=>m(h=>!h),[m]),modal:s,children:n})};GG.displayName=Jy;var WG="DialogTrigger",KG=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(WG,n),i=Jt(t,r.triggerRef);return f.jsx(_t.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":aC(r.open),...a,ref:i,onClick:Ge(e.onClick,r.onOpenToggle)})});KG.displayName=WG;var nC="DialogPortal",[wge,ZG]=VG(nC,{forceMount:void 0}),YG=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:r}=e,i=Oi(nC,t);return f.jsx(wge,{scope:t,forceMount:n,children:w.Children.map(a,s=>f.jsx(Ua,{present:n||i.open,children:f.jsx(Ld,{asChild:!0,container:r,children:s})}))})};YG.displayName=nC;var Av="DialogOverlay",qG=w.forwardRef((e,t)=>{const n=ZG(Av,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,i=Oi(Av,e.__scopeDialog);return i.modal?f.jsx(Ua,{present:a||i.open,children:f.jsx(xge,{...r,ref:t})}):null});qG.displayName=Av;var Sge=Hl("DialogOverlay.RemoveScroll"),xge=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(Av,n);return f.jsx(Om,{as:Sge,allowPinchZoom:!0,shards:[r.contentRef],children:f.jsx(_t.div,{"data-state":aC(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Wl="DialogContent",XG=w.forwardRef((e,t)=>{const n=ZG(Wl,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,i=Oi(Wl,e.__scopeDialog);return f.jsx(Ua,{present:a||i.open,children:i.modal?f.jsx(_ge,{...r,ref:t}):f.jsx(Ege,{...r,ref:t})})});XG.displayName=Wl;var _ge=w.forwardRef((e,t)=>{const n=Oi(Wl,e.__scopeDialog),a=w.useRef(null),r=Jt(t,n.contentRef,a);return w.useEffect(()=>{const i=a.current;if(i)return Fy(i)},[]),f.jsx(JG,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ge(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ge(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&i.preventDefault()}),onFocusOutside:Ge(e.onFocusOutside,i=>i.preventDefault())})}),Ege=w.forwardRef((e,t)=>{const n=Oi(Wl,e.__scopeDialog),a=w.useRef(!1),r=w.useRef(!1);return f.jsx(JG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(a.current||n.triggerRef.current?.focus(),i.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(a.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),JG=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:i,...s}=e,c=Oi(Wl,n),u=w.useRef(null),d=Jt(t,u);return Dy(),f.jsxs(f.Fragment,{children:[f.jsx(Cm,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:i,children:f.jsx(Od,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":aC(c.open),...s,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(kge,{titleId:c.titleId}),f.jsx(Nge,{contentRef:u,descriptionId:c.descriptionId})]})]})}),rC="DialogTitle",QG=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(rC,n);return f.jsx(_t.h2,{id:r.titleId,...a,ref:t})});QG.displayName=rC;var e7="DialogDescription",t7=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(e7,n);return f.jsx(_t.p,{id:r.descriptionId,...a,ref:t})});t7.displayName=e7;var n7="DialogClose",r7=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=Oi(n7,n);return f.jsx(_t.button,{type:"button",...a,ref:t,onClick:Ge(e.onClick,()=>r.onOpenChange(!1))})});r7.displayName=n7;function aC(e){return e?"open":"closed"}var a7="DialogTitleWarning",[eNe,i7]=fce(a7,{contentName:Wl,titleName:rC,docsSlug:"dialog"}),kge=({titleId:e})=>{const t=i7(a7),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
94
94
 
95
95
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
96
96
 
@@ -1657,7 +1657,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1657
1657
  <\/script>
1658
1658
  </body>
1659
1659
  </html>`,dY=1,g2=2,fY=3,b2=4,pY=5,v2=Symbol.for("quilt.threads.serialize"),hke=Symbol.for("quilt.threads.transferable");class gke extends AbortController{constructor(...t){super();const n=t.find(a=>a.aborted);if(n)this.abort(n.reason);else{const a=i=>this.abort(i.target.reason),r={signal:this.signal};for(const i of t)i.addEventListener("abort",a,r)}}}class y2 extends Error{constructor(){super("You attempted to call a function on a closed thread.")}}let bke="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function mY(e=21){let t="",n=crypto.getRandomValues(new Uint8Array(e));for(let a=0;a<e;a++)t+=bke[63&n[a]];return t}var sp,au,lp,Zb,QE,hY;class vke{constructor(){hi(this,QE),hi(this,sp,new Map),hi(this,au,new Map),hi(this,lp,new Map),hi(this,Zb,new WeakMap)}get(t){return Pn(this,au).get(t)}release(t){const n=Pn(this,au).get(t);return n&&(Pn(this,au).delete(t),Pn(this,sp).delete(n)),!!n}serialize(t){let n=Pn(this,sp).get(t);return n==null&&(n=mY(),Pn(this,sp).set(t,n),Pn(this,au).set(n,t)),n}deserialize(t,n){var a,r;let i=(a=Pn(this,lp).get(t))==null?void 0:a.deref();return i||(i=(...s)=>{if(!Pn(this,lp).has(t))throw new Error("You attempted to call a function that was already revoked.");return n.call((c,u,d)=>{n.messages.send([fY,c,t,u],d)},s)},(r=Cr(this,QE,hY).call(this,n))==null||r.register(i,t),Pn(this,lp).set(t,new WeakRef(i)),i)}}sp=new WeakMap,au=new WeakMap,lp=new WeakMap,Zb=new WeakMap,QE=new WeakSet,hY=function(e){let t=Pn(this,Zb).get(e);if(!(typeof FinalizationRegistry>"u"))return t||(t=new FinalizationRegistry(n=>{e.messages.send([pY,n])}),Pn(this,Zb).set(e,t)),t};function yke(e){return e!=null&&(Symbol.asyncIterator in e||Symbol.iterator in e)&&typeof e.next=="function"}function w2(e){if(e==null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t==null||t===Object.prototype}const qx="_@f",S2="_@i";var Np,Cp,Ya,Yb,_s;class wke{constructor(t){hi(this,Ya),hi(this,Np),hi(this,Cp),XE(this,Np,t?.serialize),XE(this,Cp,t?.deserialize)}serialize(t,n,a){return Cr(this,Ya,Yb).call(this,t,n,a)}deserialize(t,n){return Cr(this,Ya,_s).call(this,t,n)}}Np=new WeakMap,Cp=new WeakMap,Ya=new WeakSet,Yb=function(e,t,n,a=new Map,r=!1){if(e==null)return e;if(a.has(e))return a.get(e);if(a.set(e,void 0),typeof e=="object"){if(Pn(this,Np)&&!r){const c=Pn(this,Np).call(this,e,u=>Cr(this,Ya,Yb).call(this,u,t,n,a,!0),t,n);if(c!==void 0)return a.set(e,c),c}if(e[hke])return n?.push(e),a.set(e,e),e;const i=c=>Cr(this,Ya,Yb).call(this,c,t,n,a);if(typeof e[v2]=="function"){const c=e[v2]({serialize:i});return a.set(e,c),c}if(Array.isArray(e)){const c=e.map(u=>i(u));return a.set(e,c),c}if(e instanceof Map){const c=[...e.entries()].map(([d,m])=>[i(d),i(m)]),u=new Map(c);return a.set(e,u),u}if(e instanceof Set){const c=[...e].map(d=>i(d)),u=new Set(c);return a.set(e,u),u}const s=yke(e);if(w2(e)||s){const c={};for(const u of Object.keys(e))c[u]=i(e[u]);return s&&(c.next??(c.next=i(e.next.bind(e))),c.return??(c.return=i(e.return.bind(e))),c.throw??(c.throw=i(e.throw.bind(e))),c[S2]=!0),a.set(e,c),c}}if(typeof e=="function"){const i=t.functions.serialize(e,t,n),s={[qx]:i};return a.set(e,s),s}return a.set(e,e),e},_s=function(e,t,n=!1){if(e==null)return e;if(typeof e=="object"){if(Pn(this,Cp)&&!n){const r=Pn(this,Cp).call(this,e,i=>Cr(this,Ya,_s).call(this,i,t,!0),t);if(r!==void 0)return r}if(e==null)return e;if(Array.isArray(e))return e.map(r=>Cr(this,Ya,_s).call(this,r,t));if(e instanceof Map)return new Map([...e].map(([r,i])=>[Cr(this,Ya,_s).call(this,r,t),Cr(this,Ya,_s).call(this,i,t)]));if(e instanceof Set)return new Set([...e].map(r=>Cr(this,Ya,_s).call(this,r,t)));if(qx in e)return t.functions.deserialize(e[qx],t);if(!w2(e))return e;const a={};for(const r of Object.keys(e))r===S2?a[Symbol.asyncIterator]=()=>a:a[r]=Cr(this,Ya,_s).call(this,e[r],t);return a}return e};var iu,Dl,Es,ek,gY,tk,bY;class Ske{constructor(t,{imports:n,exports:a,functions:r=new vke,serialization:i=new wke,signal:s}={}){hi(this,Es),hi(this,iu),hi(this,Dl,new Map);var c,u,d,m;this.messages=t,XE(this,iu,s?new gke(s):new AbortController),this.exports=a??{},this.imports=xke(Cr(this,Es,gY).bind(this),n),this.functions=r,this.serialization=i,(u=(c=this.functions).start)==null||u.call(c,this),(m=(d=this.serialization).start)==null||m.call(d,this),this.signal.addEventListener("abort",()=>{for(const h of Pn(this,Dl).keys())Cr(this,Es,tk).call(this,h,void 0,new y2);Pn(this,Dl).clear()},{once:!0}),t.listen(async h=>{if(!(Array.isArray(h)&&typeof h[0]=="number"))return;const g=h;switch(g[0]){case dY:{const[,v,x,S]=g,y=this.exports[x]??(()=>{throw new Error(`No '${x}' method is exported from this thread`)});await Cr(this,Es,ek).call(this,y,S,(E,_,k)=>{this.messages.send([g2,v,E,_],k)});break}case fY:{const[,v,x,S]=g,y=this.functions.get(x,this)??_ke;await Cr(this,Es,ek).call(this,y,S,(E,_,k)=>{this.messages.send([b2,v,E,_],k)});break}case g2:case b2:{Cr(this,Es,tk).call(this,...g.slice(1));break}case pY:{const v=g[1];this.functions.release(v,this);break}}},{signal:this.signal})}get signal(){return Pn(this,iu).signal}get closed(){return Pn(this,iu).signal.aborted}close(){Pn(this,iu).abort()}call(t,n){if(this.closed)return Promise.reject(new y2);const a=[],r=this.serialization.serialize(n,this,a),i=mY(),s=Cr(this,Es,bY).call(this,i);return t(i,r,a),s}}iu=new WeakMap,Dl=new WeakMap,Es=new WeakSet,ek=async function(e,t,n){try{const a=this.functions.call?await this.functions.call(e,t,this):await e(...this.serialization.deserialize(t,this)),r=[],i=this.serialization.serialize(a,this,r);n(i,void 0,r)}catch(a){n(void 0,this.serialization.serialize(a,this))}},gY=function(e){return(...t)=>{try{if(typeof e!="string"&&typeof e!="number")throw new Error(`Can’t call a symbol method on a thread: ${e.toString()}`);return this.call((n,a,r)=>{this.messages.send([dY,n,e,a],r)},t)}catch(n){return Promise.reject(n)}}},tk=function(...e){const t=e[0],n=Pn(this,Dl).get(t);n&&(n(...e),Pn(this,Dl).delete(t))},bY=function(e){const t=new Promise((n,a)=>{Pn(this,Dl).set(e,(r,i,s)=>{s==null?n(this.serialization.deserialize(i,this)):a(this.serialization.deserialize(s,this))})});return Object.defineProperty(t,Symbol.asyncIterator,{async*value(){const n=await t;Object.defineProperty(n,Symbol.asyncIterator,{value:()=>n}),yield*n}}),t};function xke(e,t){let n;if(t==null){if(typeof Proxy!="function")throw new Error("You must pass an array of callable methods in environments without Proxies.");const a=new Map;n=new Proxy({},{get(r,i){if(a.has(i))return a.get(i);const s=e(i);return a.set(i,s),s}})}else{n={};for(const a of t)Object.defineProperty(n,a,{value:e(a),writable:!1,configurable:!0,enumerable:!0})}return n}function _ke(){throw new Error("You attempted to call a function that is not stored. It may have already been released.")}const Eke="quilt.threads.ping",x2="quilt.threads.pong";function kke(e,{targetOrigin:t="*"}={}){let n=!1;const a=function(i,s){e.postMessage(i,t,s)},r=new Promise(i=>{const s=new AbortController;globalThis.window.addEventListener("message",c=>{c.source===e&&c.data===x2&&(n=!0,s.abort(),i())},{signal:s.signal}),s.signal.addEventListener("abort",()=>i(),{once:!0}),a(Eke)});return{send(i,s){return n?a(i,s):r.then(()=>{if(n)return a(i,s)})},listen(i,{signal:s}){self.addEventListener("message",c=>{c.source===e&&c.data!==x2&&i(c.data)},{signal:s})}}}class Tke extends Ske{constructor(t,{targetOrigin:n="*",...a}={}){super(kke(t.contentWindow,{targetOrigin:n}),a),this.iframe=t}}const vY=ue.forwardRef(({content:e,children:t,...n},a)=>f.jsx("span",{ref:a,...n,children:e||t}));vY.displayName="UIText";const yY=ue.forwardRef(({label:e,onPress:t,onClick:n,children:a,...r},i)=>f.jsx("button",{ref:i,onClick:s=>{t&&t(),n&&n(s)},style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},...r,children:e||a}));yY.displayName="UIButton";const wY=ue.forwardRef(({direction:e="vertical",spacing:t="8",align:n="stretch",justify:a="flex-start",children:r,...i},s)=>f.jsx("div",{ref:s,style:{display:"flex",flexDirection:e==="horizontal"?"row":"column",gap:`${t}px`,alignItems:n,justifyContent:a},...i,children:r}));wY.displayName="UIStack";const SY=ue.forwardRef(({src:e,alt:t,width:n,height:a,children:r,...i},s)=>f.jsx("img",{ref:s,src:e,alt:t,width:n,height:a,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},...i}));SY.displayName="UIImage";const yD={name:"basic",elements:[{tagName:"ui-text",component:vY,propMapping:{content:"content"},eventMapping:{}},{tagName:"ui-button",component:yY,propMapping:{label:"label"},eventMapping:{press:"onPress"}},{tagName:"ui-stack",component:wY,propMapping:{direction:"direction",spacing:"spacing",align:"align",justify:"justify"},eventMapping:{}},{tagName:"ui-image",component:SY,propMapping:{src:"src",alt:"alt",width:"width",height:"height"},eventMapping:{}}]},Nke=({receiver:e})=>{const t=w.useRef(null);return w.useEffect(()=>{if(t.current)return e.connect(t.current),()=>{e.disconnect()}},[e]),f.jsx("div",{ref:t,"data-testid":"standard-dom-renderer-container"})},Cke=({resource:e,library:t,remoteElements:n=[],onUIAction:a})=>{const r=w.useRef(null),i=w.useRef(null),[s,c]=w.useState(null),u=w.useMemo(()=>(e.mimeType||"").includes("framework=react")?"react":"webcomponents",[e.mimeType]),d=`${t?.name}-${u}`,{receiver:m,components:h}=w.useMemo(()=>{switch(u){case"react":{const v=new ike,x=t||yD,S=new Map;return x&&x.elements.forEach(y=>{const E=dke(y.component);S.set(y.tagName,E)}),{receiver:v,components:S}}case"webcomponents":default:return{receiver:new oke,components:null}}},[e,t,n]);w.useEffect(()=>{function v(x){var S;if(r.current&&x.source===r.current.contentWindow){const y=x.data;if(!y)return;(S=a?.(y))==null||S.catch(E=>{console.error("Error handling UI action result in RemoteDOMResourceRenderer:",E)})}}return window.addEventListener("message",v),()=>window.removeEventListener("message",v)},[a]),w.useEffect(()=>{const v=i.current;return i.current=null,()=>{v?.close()}},[d]);const g=()=>{const v=r.current;if(!v||i.current)return;const x=new Tke(v);i.current=x;const{code:S,error:y}=qEe(e);if(y){c(y);return}if(S&&m!=null&&m.connection){const E={code:S,remoteElements:n,useReactRenderer:u==="react",componentLibrary:t?.name};x.imports.render(E,m.connection).catch(_=>console.error("Error calling remote render:",_))}};return s?f.jsx("p",{className:"text-red-500",children:s}):f.jsxs(f.Fragment,{children:[f.jsx("iframe",{ref:r,srcDoc:mke,sandbox:"allow-scripts",style:{display:"none"},title:"Remote DOM Sandbox",onLoad:g},d),u==="react"&&h?f.jsx(pke,{receiver:m,components:h}):f.jsx(Nke,{receiver:m})]})};function Rke(e){var t;if(e.contentType)return e.contentType;if(e.mimeType==="text/html")return"rawHtml";if(e.mimeType==="text/uri-list")return"externalUrl";if((t=e.mimeType)!=null&&t.startsWith("application/vnd.mcp-ui.remote-dom"))return"remoteDom"}const wD=e=>{const{resource:t,onUIAction:n,supportedContentTypes:a,htmlProps:r,remoteDomProps:i}=e,s=Rke(t);if(a&&s&&!a.includes(s))return f.jsxs("p",{className:"text-red-500",children:["Unsupported content type: ",s,"."]});switch(s){case"rawHtml":case"externalUrl":return f.jsx(iY,{resource:t,onUIAction:n,...r});case"remoteDom":return f.jsx(Cke,{resource:t,onUIAction:n,library:i?.library||yD,...i});default:return f.jsx("p",{className:"text-red-500",children:"Unsupported resource type."})}};wD.displayName="UIResourceRenderer";const Ake={tagName:"ui-button",remoteAttributes:["label"],remoteEvents:["click","press"]},Ike={tagName:"ui-text",remoteAttributes:["content"]},Oke={tagName:"ui-stack",remoteAttributes:["direction","spacing","align","justify"]},Dke={tagName:"ui-image",remoteAttributes:["src","alt","width","height"]},jke=w.memo(({resource:e})=>{const t=async n=>(n.type==="tool"||n.type==="prompt"||(n.type==="link"?n.payload.url&&window.open(n.payload.url,"_blank"):n.type==="intent"||n.type),{status:"Action received"});return e.uri?.startsWith("ui://")?f.jsx("div",{className:"my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card",children:f.jsx(wD,{resource:e,onUIAction:t,htmlProps:{style:{maxWidth:"100%",height:"100%",overflow:"auto"},autoResizeIframe:!0,sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"}})}):null});function _2({toolName:e,toolArgs:t,result:n,serverId:a,readResource:r,toolMeta:i}){const[s,c]=w.useState(null);w.useEffect(()=>{console.log("[ToolResultRenderer] Rendering:",{toolName:e,hasToolMeta:!!i,outputTemplate:i?.["openai/outputTemplate"],hasResult:!!n,hasServerId:!!a,hasReadResource:!!r})},[e,i,n,a,r]);const u=w.useMemo(()=>{if(typeof n=="string")try{return JSON.parse(n)}catch(v){return console.error("[ToolResultRenderer] Failed to parse result:",v),n}return n},[n]),d=w.useMemo(()=>!!i?.["openai/outputTemplate"],[i]),m=w.useMemo(()=>!!(u?.content&&Array.isArray(u.content)&&u.content.some(v=>v.type==="resource"&&v.resource?.uri?.startsWith("ui://")&&v.resource?.mimeType==="text/html+skybridge")),[u]),h=w.useMemo(()=>m&&u.content.find(x=>x.type==="resource"&&x.resource?.uri?.startsWith("ui://")&&x.resource?.mimeType==="text/html+skybridge")?.resource||null,[m,u]);if(w.useEffect(()=>{if(h){c(h);return}if(d&&i&&r){const v=i["openai/outputTemplate"];console.log("[ToolResultRenderer] Fetching resource for Apps SDK tool:",v),r(v).then(x=>{console.log("[ToolResultRenderer] Resource fetched:",x),x?.contents&&Array.isArray(x.contents)&&x.contents.length>0?c(x.contents[0]):console.warn("[ToolResultRenderer] No contents in fetched resource:",x)}).catch(x=>{console.error("[ToolResultRenderer] Failed to fetch resource:",x)})}},[h,d,i,r]),(d||m)&&s&&a&&r)return f.jsx(mD,{componentUrl:s.uri,toolName:e,toolArgs:t,toolResult:u,serverId:a,readResource:r,noWrapper:!0,className:"my-4",showConsole:!1});if((d||m)&&!s)return f.jsx("div",{className:"flex items-center justify-center w-full h-[200px] rounded border",children:f.jsx(ki,{className:"size-5"})});if(d&&(!a||!r))return console.error("[ToolResultRenderer] Apps SDK tool but missing serverId or readResource:",{toolName:e,hasServerId:!!a,hasReadResource:!!r}),f.jsx("div",{className:"my-4 p-4 bg-red-50/30 dark:bg-red-950/20 border border-red-200/50 dark:border-red-800/50 rounded-lg",children:f.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Cannot render widget: Missing required props (serverId or readResource)"})});const g=[];if(u?.content&&Array.isArray(u.content))for(const v of u.content)v.type==="resource"&&v.resource?.uri?.startsWith("ui://")&&v.resource?.mimeType!=="text/html+skybridge"&&g.push(v.resource);return g.length>0?f.jsx(f.Fragment,{children:g.map(v=>f.jsx(jke,{resource:v},`${e}-mcp-ui-${v.uri}`))}):(console.log("[ToolResultRenderer] Not rendering (no UI resources found):",{toolName:e,isAppsSdkTool:d,hasAppsSdkComponent:m,hasResourceData:!!s,contentLength:u?.content?.length}),null)}function Lke({content:e,timestamp:t}){return!e||e.length===0?null:f.jsx("div",{className:"flex items-start gap-3 justify-end group/user-message",children:f.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-end",children:[f.jsx("div",{className:"bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words",children:f.jsx("p",{className:"text-base leading-7 font-sans text-start break-words",children:e})}),t&&f.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:new Date(t).toLocaleTimeString()})]})})}const $ke=w.memo(({messages:e,isLoading:t,serverId:n,readResource:a,tools:r})=>{const i=w.useRef(null),s=d=>r?.find(h=>h.name===d)?._meta;w.useEffect(()=>{e.length>0&&i.current&&i.current.scrollIntoView({behavior:t?"auto":"smooth",block:"start"})},[e.length,t]);const c=t&&(()=>{if(e.length===0)return!0;const d=e[e.length-1];if(d.role==="user")return!0;if(d.role==="assistant"){const m=typeof d.content=="string"?d.content:Array.isArray(d.content)?d.content.map(g=>typeof g=="string"?g:g.text||JSON.stringify(g)).join(""):JSON.stringify(d.content);return!(m&&m.trim().length>0)}return!1})(),u=d=>{if(!t)return!1;const m=e[e.length-1];return d.id===m.id&&m.role==="assistant"};return f.jsxs("div",{className:"space-y-6 max-w-3xl mx-auto px-2",children:[e.map(d=>{const m=typeof d.content=="string"?d.content:Array.isArray(d.content)?d.content.map(h=>typeof h=="string"?h:h.text||JSON.stringify(h)).join(""):JSON.stringify(d.content);return d.role==="user"?f.jsx(Lke,{content:m,timestamp:d.timestamp},d.id):d.role==="assistant"?f.jsx("div",{className:"space-y-4",children:d.parts&&d.parts.length>0?d.parts.map((h,g)=>{const v=h.type==="text"?`${d.id}-text-${g}-${h.text?.slice(0,20)}`:`${d.id}-tool-${h.toolInvocation?.toolName}-${g}`;return h.type==="text"?f.jsx(o2,{content:h.text||"",timestamp:g===d.parts.length-1?d.timestamp:void 0,_isStreaming:u(d)},v):h.type==="tool-invocation"&&h.toolInvocation?f.jsxs("div",{children:[f.jsx(s2,{toolName:h.toolInvocation.toolName,args:h.toolInvocation.args,result:h.toolInvocation.result,state:h.toolInvocation.result?"result":"call"}),h.toolInvocation.result&&f.jsx(_2,{toolName:h.toolInvocation.toolName,toolArgs:h.toolInvocation.args,result:h.toolInvocation.result,serverId:n,readResource:a,toolMeta:s(h.toolInvocation.toolName)})]},v):null}):f.jsxs(f.Fragment,{children:[f.jsx(o2,{content:m,timestamp:d.timestamp,_isStreaming:u(d)}),d.toolCalls&&d.toolCalls.length>0&&f.jsx("div",{className:"space-y-2",children:d.toolCalls.map(h=>{const g=`${d.id}-${h.toolName}-${JSON.stringify(h.args).slice(0,50)}`;return f.jsxs("div",{children:[f.jsx(s2,{toolName:h.toolName,args:h.args,result:h.result,state:h.result?"result":"call"}),h.result&&f.jsx(_2,{toolName:h.toolName,toolArgs:h.args,result:h.result,serverId:n,readResource:a,toolMeta:s(h.toolName)})]},g)})})]})},d.id):null}),c&&f.jsx("div",{className:"flex items-start gap-3",children:f.jsx("div",{className:"flex-1",children:f.jsx("div",{className:"rounded-lg p-4 max-w-fit",children:f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("span",{className:"text-sm",children:f.jsx(txe,{duration:2,spread:1,children:"Thinking..."})})})})})}),f.jsx("div",{ref:i})]})});function xY(e){let t=0;for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);t=(t<<5)-t+a,t=t&t}return Math.abs(t).toString(16)}function Mke({mcpServerUrl:e,llmConfig:t,authConfig:n,isConnected:a}){const[r,i]=w.useState([]),[s,c]=w.useState(!1),u=w.useCallback(async m=>{if(!m.trim()||!t||!a)return;const h={id:`user-${Date.now()}`,role:"user",content:m.trim(),timestamp:Date.now()};i(g=>[...g,h]),c(!0);try{let g=n;if(n?.type==="oauth")try{const C="mcp:auth",R=xY(e),I=`${C}_${R}_tokens`,A=localStorage.getItem(I);if(A){const O=JSON.parse(A);g={...n,oauthTokens:O}}else console.warn("No OAuth tokens found in localStorage for key:",I)}catch(C){console.warn("Failed to retrieve OAuth tokens:",C)}const v=await fetch("/inspector/api/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mcpServerUrl:e,llmConfig:t,authConfig:g,messages:[...r,h].map(C=>({role:C.role,content:C.content}))})});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const x=`assistant-${Date.now()}`;let S="";const y=[];i(C=>[...C,{id:x,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);const E=v.body?.getReader(),_=new TextDecoder;if(!E)throw new Error("No response body");let k="";for(;;){const{done:C,value:R}=await E.read();if(C)break;k+=_.decode(R,{stream:!0});const I=k.split(`
1660
- `);k=I.pop()||"";for(const A of I)if(A.trim()&&A.startsWith("data: "))try{const O=JSON.parse(A.slice(6));if(console.log("[Client received event]",O.type,O.toolName||O.content?.slice?.(0,30)),O.type==="message")console.log("[Message started]",O.id);else if(O.type==="text"){S+=O.content;const M=y[y.length-1];M&&M.type==="text"?M.text=S:y.push({type:"text",text:S}),console.log("[Parts after text]",y.length,"parts, text length:",S.length),i(P=>P.map(B=>B.id===x?{...B,parts:[...y]}:B))}else if(O.type==="tool-call")S&&(S=""),y.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",y.length,"parts, tool:",O.toolName),i(M=>M.map(P=>P.id===x?{...P,parts:[...y]}:P));else if(O.type==="tool-result"){const M=y.find(P=>P.type==="tool-invocation"&&P.toolInvocation?.toolName===O.toolName&&!P.toolInvocation?.result);M&&M.toolInvocation?(M.toolInvocation.result=O.result,M.toolInvocation.state="result",console.log("[Parts after tool-result]",y.length,"parts, updated:",O.toolName),i(P=>P.map(B=>B.id===x?{...B,parts:[...y]}:B))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",y.length),i(M=>M.map(P=>P.id===x?{...P,parts:[...y],content:""}:P));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,A)}}}catch(g){let v="Unknown error occurred";if(g instanceof Error){v=g.message;const S=g;S.status&&(v=`HTTP ${S.status}: ${v}`),(S.code===401||v.includes("401")||v.includes("Unauthorized"))&&(v="Authentication failed (401). Check your Authorization header in the connection settings.")}const x={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${v}`,timestamp:Date.now()};i(S=>[...S,x])}finally{c(!1)}},[t,a,e,r,n]),d=w.useCallback(()=>{i([])},[]);return{messages:r,isLoading:s,sendMessage:u,clearMessages:d}}function Pke({connection:e,llmConfig:t,isConnected:n,readResource:a}){const[r,i]=w.useState([]),[s,c]=w.useState(!1),u=w.useRef(null),d=w.useRef(null),m=w.useRef(null),h=w.useCallback(async v=>{if(!v.trim()||!t||!n)return;const x={id:`user-${Date.now()}`,role:"user",content:v.trim(),timestamp:Date.now()};i(E=>[...E,x]),c(!0),u.current=new AbortController;const S=Date.now();let y=0;try{const E=`assistant-${Date.now()}`;let _="";const k=[];if(i(C=>[...C,{id:E,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]),!m.current||m.current.provider!==t.provider||m.current.model!==t.model||m.current.apiKey!==t.apiKey){let C;if(t.provider==="openai"){const{ChatOpenAI:R}=await Jn(async()=>{const{ChatOpenAI:I}=await import("./index-CrP21sE-.js");return{ChatOpenAI:I}},__vite__mapDeps([5,6,7,2,8,9,10]));C=new R({model:t.model,apiKey:t.apiKey})}else if(t.provider==="anthropic"){const{ChatAnthropic:R}=await Jn(async()=>{const{ChatAnthropic:I}=await import("./index-Dxsl-6OY.js");return{ChatAnthropic:I}},__vite__mapDeps([11,7,6,2,10]));C=new R({model:t.model,apiKey:t.apiKey})}else if(t.provider==="google"){const{ChatGoogleGenerativeAI:R}=await Jn(async()=>{const{ChatGoogleGenerativeAI:I}=await import("./index-Q4cmml2q.js");return{ChatGoogleGenerativeAI:I}},__vite__mapDeps([12,7,6,2,9]));C=new R({model:t.model,apiKey:t.apiKey})}else throw new Error(`Unsupported LLM provider: ${t.provider}`);m.current={instance:C,provider:t.provider,model:t.model,apiKey:t.apiKey}}if(!d.current||d.current.llm!==m.current.instance){const{MCPAgent:C}=await Jn(async()=>{const{MCPAgent:R}=await import("./browser-9Hcz8GQa.js").then(I=>I.b);return{MCPAgent:R}},__vite__mapDeps([13,4,3,10,6,7,2,9,8]));d.current=new C({llm:m.current.instance,client:e.client,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."}),await d.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",d.current.conversationHistory?.length);for await(const C of d.current.streamEvents(v,10,!1,void 0)){if(u.current?.signal.aborted)break;if(C.event==="on_chat_model_stream"&&C.data?.chunk?.text){const R=C.data.chunk.text;if(typeof R=="string"&&R.length>0){_+=R;const I=k[k.length-1];I&&I.type==="text"?I.text=_:k.push({type:"text",text:_}),i(A=>A.map(O=>O.id===E?{...O,parts:[...k]}:O))}}else if(C.event==="on_tool_start"){_&&(_="");let R={};C.data?.input?R=C.data.input:C.data?.tool_input?R=C.data.tool_input:C.data&&(R=C.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:C.name,eventData:C.data,extractedArgs:R}),y++,k.push({type:"tool-invocation",toolInvocation:{toolName:C.name||"unknown",args:R,state:"pending"}}),i(I=>I.map(A=>A.id===E?{...A,parts:[...k]}:A))}else if(C.event==="on_tool_end"){const R=k.find(I=>I.type==="tool-invocation"&&I.toolInvocation?.toolName===C.name&&!I.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:C.name,hasToolPart:!!R,output:C.data?.output}),R&&R.toolInvocation){let I=C.data?.output;if(I?.kwargs?.content&&typeof I.kwargs.content=="string")try{I=JSON.parse(I.kwargs.content)}catch(O){console.warn("[useChatMessagesClientSide] Failed to parse kwargs.content:",O),I=I.kwargs.content}else if(I?.content&&typeof I.content=="string")try{I=JSON.parse(I.content)}catch{I=I.content}R.toolInvocation.result=I,R.toolInvocation.state="result";const A=I?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:C.name,hasMeta:!!I?._meta,hasStructuredContent:!!I?.structuredContent,appsSdkUri:A}),A&&typeof A=="string"&&a){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",A);try{const O=await a(A);console.log("[useChatMessagesClientSide] Resource fetched:",O);const M=I?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const P=O.contents.map(K=>({type:"resource",resource:K}));console.log("[useChatMessagesClientSide] Created MCP resources:",P);const B={...I,content:[...I.content||[],...P],structuredContent:M};R.toolInvocation.result=B,console.log("[useChatMessagesClientSide] Updated result with resources")}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",O)}catch(O){console.error("Failed to fetch Apps SDK resource:",O)}}i(O=>O.map(M=>M.id===E?{...M,parts:[...k]}:M))}}}i(C=>C.map(R=>R.id===E?{...R,parts:[...k],content:""}:R)),t&&vr.getInstance().capture(new QU({serverId:e.url,provider:t.provider,model:t.model,messageCount:r.length+1,toolCallsCount:y,success:!0,executionMode:"client-side",duration:Date.now()-S})).catch(()=>{})}catch(E){console.error("Client-side agent error:",E);let _="Unknown error occurred";if(E instanceof Error){_=E.message;const C=E;C.status&&(_=`HTTP ${C.status}: ${_}`),(C.code===401||_.includes("401")||_.includes("Unauthorized"))&&(_="Authentication failed (401). Check your Authorization header in the connection settings.")}t&&vr.getInstance().capture(new QU({serverId:e.url,provider:t.provider,model:t.model,messageCount:r.length+1,toolCallsCount:y,success:!1,executionMode:"client-side",duration:Date.now()-S,error:_})).catch(()=>{});const k={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${_}`,timestamp:Date.now()};i(C=>[...C,k])}finally{c(!1),u.current=null}},[e,t,n,r,a]),g=w.useCallback(()=>{i([]),d.current&&d.current.clearConversationHistory()},[]);return{messages:r,isLoading:s,sendMessage:h,clearMessages:g}}const E2={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function _Y({mcpServerUrl:e}){const[t,n]=w.useState(null),[a,r]=w.useState(null),[i,s]=w.useState(!1),[c,u]=w.useState("openai"),[d,m]=w.useState(""),[h,g]=w.useState(E2.openai),v=w.useCallback(()=>{const M=localStorage.getItem("mcp-inspector-api-keys");if(M)try{return JSON.parse(M)}catch(P){return console.error("Failed to load API keys:",P),{}}return{}},[]),x=w.useCallback(M=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(M))},[]),[S,y]=w.useState("none"),[E,_]=w.useState(""),[k,C]=w.useState(""),[R,I]=w.useState("");w.useEffect(()=>{const M=localStorage.getItem("mcp-inspector-llm-config"),P=v();if(M)try{const B=JSON.parse(M);n(B),u(B.provider),m(P[B.provider]||B.apiKey||""),g(B.model)}catch(B){console.error("Failed to load LLM config:",B)}},[v]),w.useEffect(()=>{const M=localStorage.getItem("mcp-inspector-auth-config");if(M)try{const P=JSON.parse(M);r(P),y(P.type),P.username&&_(P.username),P.password&&C(P.password),P.token&&I(P.token)}catch(P){console.error("Failed to load auth config:",P)}else try{const P="mcp:auth",B=xY(e),K=`${P}_${B}_tokens`;localStorage.getItem(K)&&(r({type:"oauth"}),y("oauth"))}catch(P){console.error("Failed to check for OAuth tokens:",P)}},[e]),w.useEffect(()=>{g(E2[c]);const M=v();m(M[c]||"")},[c,v]);const A=w.useCallback(()=>{if(!d.trim())return;const M=v();M[c]=d,x(M);const P={provider:c,apiKey:d,model:h},B={type:S,...S==="basic"&&{username:E.trim(),password:k.trim()},...S==="bearer"&&{token:R.trim()}};n(P),r(B),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(P)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(B)),s(!1)},[c,d,h,S,E,k,R,v,x]),O=w.useCallback(()=>{n(null),r(null);const M=v();delete M[c],x(M),m(""),_(""),C(""),I(""),y("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,v,x]);return{llmConfig:t,authConfig:a,configDialogOpen:i,setConfigDialogOpen:s,tempProvider:c,setTempProvider:u,tempApiKey:d,setTempApiKey:m,tempModel:h,setTempModel:g,tempAuthType:S,saveLLMConfig:A,clearConfig:O}}function Uke({connection:e,isConnected:t,useClientSide:n=!0,readResource:a}){const[r,i]=w.useState(""),s=w.useRef(null),{llmConfig:c,authConfig:u,configDialogOpen:d,setConfigDialogOpen:m,tempProvider:h,setTempProvider:g,tempApiKey:v,setTempApiKey:x,tempModel:S,setTempModel:y,saveLLMConfig:E,clearConfig:_}=_Y({mcpServerUrl:e.url}),k={connection:e,llmConfig:c,isConnected:t,readResource:a},C=Mke({mcpServerUrl:e.url,llmConfig:c,authConfig:u,isConnected:t}),R=Pke(k),{messages:I,isLoading:A,sendMessage:O,clearMessages:M}=n?R:C;SK({onNewChat:M}),w.useEffect(()=>{c&&I.length===0&&s.current&&s.current.focus()},[c,I.length]),w.useEffect(()=>{!A&&I.length>0&&s.current&&s.current.focus()},[A,I.length]);const P=w.useCallback(()=>{r.trim()&&(O(r),i(""))},[r,O]),B=w.useCallback(ee=>{ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),P())},[P]),K=w.useCallback(()=>{_(),M()},[_,M]);return c&&I.length===0?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("div",{className:"absolute top-4 right-4 z-10",children:f.jsx(NE,{open:d,onOpenChange:m,tempProvider:h,tempModel:S,tempApiKey:v,onProviderChange:g,onModelChange:y,onApiKeyChange:x,onSave:E,onClear:K,showClearButton:!0,buttonLabel:"Change API Key"})}),f.jsx(QSe,{mcpServerUrl:e.url,inputValue:r,isConnected:t,isLoading:A,textareaRef:s,llmConfig:c,onInputChange:i,onKeyDown:B,onSubmit:ee=>{ee.preventDefault(),P()},onConfigDialogOpenChange:m})]}):f.jsxs("div",{className:"flex flex-col h-full relative",children:[f.jsx(qSe,{llmConfig:c,hasMessages:I.length>0,configDialogOpen:d,onConfigDialogOpenChange:m,onClearChat:M,tempProvider:h,tempModel:S,tempApiKey:v,onProviderChange:g,onModelChange:y,onApiKeyChange:x,onSaveConfig:E,onClearConfig:K}),f.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?f.jsx($ke,{messages:I,isLoading:A,serverId:e.url,readResource:a,tools:e.tools}):f.jsx(exe,{onConfigureClick:()=>m(!0)})}),c&&f.jsx(XSe,{inputValue:r,isConnected:t,isLoading:A,textareaRef:s,onInputChange:i,onKeyDown:B,onSendMessage:P})]})}const Ew=w.createContext(null);Ew.displayName="PanelGroupContext";const Zn={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},SD=10,Pl=w.useLayoutEffect,k2=Ed.useId,zke=typeof k2=="function"?k2:()=>null;let Fke=0;function xD(e=null){const t=zke(),n=w.useRef(e||t||null);return n.current===null&&(n.current=""+Fke++),e??n.current}function EY({children:e,className:t="",collapsedSize:n,collapsible:a,defaultSize:r,forwardedRef:i,id:s,maxSize:c,minSize:u,onCollapse:d,onExpand:m,onResize:h,order:g,style:v,tagName:x="div",...S}){const y=w.useContext(Ew);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:E,expandPanel:_,getPanelSize:k,getPanelStyle:C,groupId:R,isPanelCollapsed:I,reevaluatePanelConstraints:A,registerPanel:O,resizePanel:M,unregisterPanel:P}=y,B=xD(s),K=w.useRef({callbacks:{onCollapse:d,onExpand:m,onResize:h},constraints:{collapsedSize:n,collapsible:a,defaultSize:r,maxSize:c,minSize:u},id:B,idIsFromProps:s!==void 0,order:g});w.useRef({didLogMissingDefaultSizeWarning:!1}),Pl(()=>{const{callbacks:te,constraints:ae}=K.current,H={...ae};K.current.id=B,K.current.idIsFromProps=s!==void 0,K.current.order=g,te.onCollapse=d,te.onExpand=m,te.onResize=h,ae.collapsedSize=n,ae.collapsible=a,ae.defaultSize=r,ae.maxSize=c,ae.minSize=u,(H.collapsedSize!==ae.collapsedSize||H.collapsible!==ae.collapsible||H.maxSize!==ae.maxSize||H.minSize!==ae.minSize)&&A(K.current,H)}),Pl(()=>{const te=K.current;return O(te),()=>{P(te)}},[g,B,O,P]),w.useImperativeHandle(i,()=>({collapse:()=>{E(K.current)},expand:te=>{_(K.current,te)},getId(){return B},getSize(){return k(K.current)},isCollapsed(){return I(K.current)},isExpanded(){return!I(K.current)},resize:te=>{M(K.current,te)}}),[E,_,k,I,B,M]);const ee=C(K.current,r);return w.createElement(x,{...S,children:e,className:t,id:B,style:{...ee,...v},[Zn.groupId]:R,[Zn.panel]:"",[Zn.panelCollapsible]:a||void 0,[Zn.panelId]:B,[Zn.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const kY=w.forwardRef((e,t)=>w.createElement(EY,{...e,forwardedRef:t}));EY.displayName="Panel";kY.displayName="forwardRef(Panel)";let nk=null,qb=-1,Rs=null;function Bke(e,t,n){const a=(t&AY)!==0,r=(t&IY)!==0,i=(t&OY)!==0,s=(t&DY)!==0;if(t){if(a)return i?"se-resize":s?"ne-resize":"e-resize";if(r)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Hke(){Rs!==null&&(document.head.removeChild(Rs),nk=null,Rs=null,qb=-1)}function Xx(e,t,n){var a,r;const i=Bke(e,t);if(nk!==i){if(nk=i,Rs===null&&(Rs=document.createElement("style"),document.head.appendChild(Rs)),qb>=0){var s;(s=Rs.sheet)===null||s===void 0||s.removeRule(qb)}qb=(a=(r=Rs.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${i} !important;}`))!==null&&a!==void 0?a:-1}}function TY(e){return e.type==="keydown"}function NY(e){return e.type.startsWith("pointer")}function CY(e){return e.type.startsWith("mouse")}function kw(e){if(NY(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(CY(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Vke(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Gke(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Wke(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:C2(e),b:C2(t)};let a;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),a=e;It(a,"Stacking order can only be calculated for elements with a common ancestor");const r={a:N2(T2(n.a)),b:N2(T2(n.b))};if(r.a===r.b){const i=a.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const u=i[c];if(u===s.a)return 1;if(u===s.b)return-1}}return Math.sign(r.a-r.b)}const Kke=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Zke(e){var t;const n=getComputedStyle((t=RY(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Yke(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Zke(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Kke.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function T2(e){let t=e.length;for(;t--;){const n=e[t];if(It(n,"Missing node"),Yke(n))return n}return null}function N2(e){return e&&Number(getComputedStyle(e).zIndex)||0}function C2(e){const t=[];for(;e;)t.push(e),e=RY(e);return t}function RY(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const AY=1,IY=2,OY=4,DY=8,qke=Vke()==="coarse";let wi=[],Nu=!1,As=new Map,Tw=new Map;const sm=new Set;function Xke(e,t,n,a,r){var i;const{ownerDocument:s}=t,c={direction:n,element:t,hitAreaMargins:a,setResizeHandlerState:r},u=(i=As.get(s))!==null&&i!==void 0?i:0;return As.set(s,u+1),sm.add(c),Qv(),function(){var m;Tw.delete(e),sm.delete(c);const h=(m=As.get(s))!==null&&m!==void 0?m:1;if(As.set(s,h-1),Qv(),h===1&&As.delete(s),wi.includes(c)){const g=wi.indexOf(c);g>=0&&wi.splice(g,1),Nw(),r("up",!0,null)}}}function Jke(e){const{target:t}=e,{x:n,y:a}=kw(e);Nu=!0,_D({target:t,x:n,y:a}),Qv(),wi.length>0&&(ey("down",e),Nw(),e.preventDefault(),jY(t)||e.stopImmediatePropagation())}function Jx(e){const{x:t,y:n}=kw(e);if(Nu&&e.type!=="pointerleave"&&e.buttons===0&&(Nu=!1,ey("up",e)),!Nu){const{target:a}=e;_D({target:a,x:t,y:n})}ey("move",e),Nw(),wi.length>0&&e.preventDefault()}function Qx(e){const{target:t}=e,{x:n,y:a}=kw(e);Tw.clear(),Nu=!1,wi.length>0&&(e.preventDefault(),jY(t)||e.stopImmediatePropagation()),ey("up",e),_D({target:t,x:n,y:a}),Nw(),Qv()}function jY(e){let t=e;for(;t;){if(t.hasAttribute(Zn.resizeHandle))return!0;t=t.parentElement}return!1}function _D({target:e,x:t,y:n}){wi.splice(0);let a=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(a=e),sm.forEach(r=>{const{element:i,hitAreaMargins:s}=r,c=i.getBoundingClientRect(),{bottom:u,left:d,right:m,top:h}=c,g=qke?s.coarse:s.fine;if(t>=d-g&&t<=m+g&&n>=h-g&&n<=u+g){if(a!==null&&document.contains(a)&&i!==a&&!i.contains(a)&&!a.contains(i)&&Wke(a,i)>0){let x=a,S=!1;for(;x&&!x.contains(i);){if(Gke(x.getBoundingClientRect(),c)){S=!0;break}x=x.parentElement}if(S)return}wi.push(r)}})}function e_(e,t){Tw.set(e,t)}function Nw(){let e=!1,t=!1;wi.forEach(a=>{const{direction:r}=a;r==="horizontal"?e=!0:t=!0});let n=0;Tw.forEach(a=>{n|=a}),e&&t?Xx("intersection",n):e?Xx("horizontal",n):t?Xx("vertical",n):Hke()}let t_;function Qv(){var e;(e=t_)===null||e===void 0||e.abort(),t_=new AbortController;const t={capture:!0,signal:t_.signal};sm.size&&(Nu?(wi.length>0&&As.forEach((n,a)=>{const{body:r}=a;n>0&&(r.addEventListener("contextmenu",Qx,t),r.addEventListener("pointerleave",Jx,t),r.addEventListener("pointermove",Jx,t))}),As.forEach((n,a)=>{const{body:r}=a;r.addEventListener("pointerup",Qx,t),r.addEventListener("pointercancel",Qx,t)})):As.forEach((n,a)=>{const{body:r}=a;n>0&&(r.addEventListener("pointerdown",Jke,t),r.addEventListener("pointermove",Jx,t))}))}function ey(e,t){sm.forEach(n=>{const{setResizeHandlerState:a}=n,r=wi.includes(n);a(e,r,t)})}function Qke(){const[e,t]=w.useState(0);return w.useCallback(()=>t(n=>n+1),[])}function It(e,t){if(!e)throw console.error(t),Error(t)}function Jl(e,t,n=SD){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function To(e,t,n=SD){return Jl(e,t,n)===0}function Da(e,t,n){return Jl(e,t,n)===0}function eTe(e,t,n){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++){const r=e[a],i=t[a];if(!Da(r,i,n))return!1}return!0}function yu({panelConstraints:e,panelIndex:t,size:n}){const a=e[t];It(a!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:r=0,collapsible:i,maxSize:s=100,minSize:c=0}=a;if(Jl(n,c)<0)if(i){const u=(r+c)/2;Jl(n,u)<0?n=r:n=c}else n=c;return n=Math.min(s,n),n=parseFloat(n.toFixed(SD)),n}function cp({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:a,prevLayout:r,trigger:i}){if(Da(e,0))return t;const s=[...t],[c,u]=a;It(c!=null,"Invalid first pivot index"),It(u!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const h=e<0?u:c,g=n[h];It(g,`Panel constraints not found for index ${h}`);const{collapsedSize:v=0,collapsible:x,minSize:S=0}=g;if(x){const y=t[h];if(It(y!=null,`Previous layout not found for panel index ${h}`),Da(y,v)){const E=S-y;Jl(E,Math.abs(e))>0&&(e=e<0?0-E:E)}}}{const h=e<0?c:u,g=n[h];It(g,`No panel constraints found for index ${h}`);const{collapsedSize:v=0,collapsible:x,minSize:S=0}=g;if(x){const y=t[h];if(It(y!=null,`Previous layout not found for panel index ${h}`),Da(y,S)){const E=y-v;Jl(E,Math.abs(e))>0&&(e=e<0?0-E:E)}}}}{const h=e<0?1:-1;let g=e<0?u:c,v=0;for(;;){const S=t[g];It(S!=null,`Previous layout not found for panel index ${g}`);const E=yu({panelConstraints:n,panelIndex:g,size:100})-S;if(v+=E,g+=h,g<0||g>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-x:x}{let g=e<0?c:u;for(;g>=0&&g<n.length;){const v=Math.abs(e)-Math.abs(d),x=t[g];It(x!=null,`Previous layout not found for panel index ${g}`);const S=x-v,y=yu({panelConstraints:n,panelIndex:g,size:S});if(!Da(x,y)&&(d+=x-y,s[g]=y,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(eTe(r,s))return r;{const h=e<0?u:c,g=t[h];It(g!=null,`Previous layout not found for panel index ${h}`);const v=g+d,x=yu({panelConstraints:n,panelIndex:h,size:v});if(s[h]=x,!Da(x,v)){let S=v-x,E=e<0?u:c;for(;E>=0&&E<n.length;){const _=s[E];It(_!=null,`Previous layout not found for panel index ${E}`);const k=_+S,C=yu({panelConstraints:n,panelIndex:E,size:k});if(Da(_,C)||(S-=C-_,s[E]=C),Da(S,0))break;e>0?E--:E++}}}const m=s.reduce((h,g)=>g+h,0);return Da(m,100)?s:r}function tTe({layout:e,panelsArray:t,pivotIndices:n}){let a=0,r=100,i=0,s=0;const c=n[0];It(c!=null,"No pivot index found"),t.forEach((h,g)=>{const{constraints:v}=h,{maxSize:x=100,minSize:S=0}=v;g===c?(a=S,r=x):(i+=S,s+=x)});const u=Math.min(r,100-i),d=Math.max(a,100-s),m=e[c];return{valueMax:u,valueMin:d,valueNow:m}}function lm(e,t=document){return Array.from(t.querySelectorAll(`[${Zn.resizeHandleId}][data-panel-group-id="${e}"]`))}function LY(e,t,n=document){const r=lm(e,n).findIndex(i=>i.getAttribute(Zn.resizeHandleId)===t);return r??null}function $Y(e,t,n){const a=LY(e,t,n);return a!=null?[a,a+1]:[-1,-1]}function nTe(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function MY(e,t=document){if(nTe(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function Cw(e,t=document){const n=t.querySelector(`[${Zn.resizeHandleId}="${e}"]`);return n||null}function rTe(e,t,n,a=document){var r,i,s,c;const u=Cw(t,a),d=lm(e,a),m=u?d.indexOf(u):-1,h=(r=(i=n[m])===null||i===void 0?void 0:i.id)!==null&&r!==void 0?r:null,g=(s=(c=n[m+1])===null||c===void 0?void 0:c.id)!==null&&s!==void 0?s:null;return[h,g]}function aTe({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:a,panelDataArray:r,panelGroupElement:i,setLayout:s}){w.useRef({didWarnAboutMissingResizeHandle:!1}),Pl(()=>{if(!i)return;const c=lm(n,i);for(let u=0;u<r.length-1;u++){const{valueMax:d,valueMin:m,valueNow:h}=tTe({layout:a,panelsArray:r,pivotIndices:[u,u+1]}),g=c[u];if(g!=null){const v=r[u];It(v,`No panel data found for index "${u}"`),g.setAttribute("aria-controls",v.id),g.setAttribute("aria-valuemax",""+Math.round(d)),g.setAttribute("aria-valuemin",""+Math.round(m)),g.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((u,d)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[n,a,r,i]),w.useEffect(()=>{if(!i)return;const c=t.current;It(c,"Eager values not found");const{panelDataArray:u}=c,d=MY(n,i);It(d!=null,`No group found for id "${n}"`);const m=lm(n,i);It(m,`No resize handles found for group id "${n}"`);const h=m.map(g=>{const v=g.getAttribute(Zn.resizeHandleId);It(v,"Resize handle element has no handle id attribute");const[x,S]=rTe(n,v,u,i);if(x==null||S==null)return()=>{};const y=E=>{if(!E.defaultPrevented)switch(E.key){case"Enter":{E.preventDefault();const _=u.findIndex(k=>k.id===x);if(_>=0){const k=u[_];It(k,`No panel data found for index ${_}`);const C=a[_],{collapsedSize:R=0,collapsible:I,minSize:A=0}=k.constraints;if(C!=null&&I){const O=cp({delta:Da(C,R)?A-R:R-C,initialLayout:a,panelConstraints:u.map(M=>M.constraints),pivotIndices:$Y(n,v,i),prevLayout:a,trigger:"keyboard"});a!==O&&s(O)}}break}}};return g.addEventListener("keydown",y),()=>{g.removeEventListener("keydown",y)}});return()=>{h.forEach(g=>g())}},[i,e,t,n,a,r,s])}function R2(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function PY(e,t){const n=e==="horizontal",{x:a,y:r}=kw(t);return n?a:r}function iTe(e,t,n,a,r){const i=n==="horizontal",s=Cw(t,r);It(s,`No resize handle element found for id "${t}"`);const c=s.getAttribute(Zn.groupId);It(c,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=a;const d=PY(n,e),m=MY(c,r);It(m,`No group element found for id "${c}"`);const h=m.getBoundingClientRect(),g=i?h.width:h.height;return(d-u)/g*100}function oTe(e,t,n,a,r,i){if(TY(e)){const s=n==="horizontal";let c=0;e.shiftKey?c=100:r!=null?c=r:c=10;let u=0;switch(e.key){case"ArrowDown":u=s?0:c;break;case"ArrowLeft":u=s?-c:0;break;case"ArrowRight":u=s?c:0;break;case"ArrowUp":u=s?0:-c;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return a==null?0:iTe(e,t,n,a,i)}function sTe({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let a=0,r=100;for(let i=0;i<e.length;i++){const s=n[i];It(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;c!=null&&(a++,t[i]=c,r-=c)}for(let i=0;i<e.length;i++){const s=n[i];It(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;if(c!=null)continue;const u=e.length-a,d=r/u;a++,t[i]=d,r-=d}return t}function qc(e,t,n){t.forEach((a,r)=>{const i=e[r];It(i,`Panel data not found for index ${r}`);const{callbacks:s,constraints:c,id:u}=i,{collapsedSize:d=0,collapsible:m}=c,h=n[u];if(h==null||a!==h){n[u]=a;const{onCollapse:g,onExpand:v,onResize:x}=s;x&&x(a,h),m&&(g||v)&&(v&&(h==null||To(h,d))&&!To(a,d)&&v(),g&&(h==null||!To(h,d))&&To(a,d)&&g())}})}function Eb(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function lTe({defaultSize:e,dragState:t,layout:n,panelData:a,panelIndex:r,precision:i=3}){const s=n[r];let c;return s==null?c=e!=null?e.toFixed(i):"1":a.length===1?c="1":c=s.toFixed(i),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function cTe(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function A2(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function UY(e){return`react-resizable-panels:${e}`}function zY(e){return e.map(t=>{const{constraints:n,id:a,idIsFromProps:r,order:i}=t;return r?a:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function FY(e,t){try{const n=UY(e),a=t.getItem(n);if(a){const r=JSON.parse(a);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function uTe(e,t,n){var a,r;const i=(a=FY(e,n))!==null&&a!==void 0?a:{},s=zY(t);return(r=i[s])!==null&&r!==void 0?r:null}function dTe(e,t,n,a,r){var i;const s=UY(e),c=zY(t),u=(i=FY(e,r))!==null&&i!==void 0?i:{};u[c]={expandToSizes:Object.fromEntries(n.entries()),layout:a};try{r.setItem(s,JSON.stringify(u))}catch(d){console.error(d)}}function I2({layout:e,panelConstraints:t}){const n=[...e],a=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Da(a,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];It(s!=null,`No layout data found for index ${i}`);const c=100/a*s;n[i]=c}let r=0;for(let i=0;i<t.length;i++){const s=n[i];It(s!=null,`No layout data found for index ${i}`);const c=yu({panelConstraints:t,panelIndex:i,size:s});s!=c&&(r+=s-c,n[i]=c)}if(!Da(r,0))for(let i=0;i<t.length;i++){const s=n[i];It(s!=null,`No layout data found for index ${i}`);const c=s+r,u=yu({panelConstraints:t,panelIndex:i,size:c});if(s!==u&&(r-=u-s,n[i]=u,Da(r,0)))break}return n}const fTe=100,up={getItem:e=>(A2(up),up.getItem(e)),setItem:(e,t)=>{A2(up),up.setItem(e,t)}},O2={};function BY({autoSaveId:e=null,children:t,className:n="",direction:a,forwardedRef:r,id:i=null,onLayout:s=null,keyboardResizeBy:c=null,storage:u=up,style:d,tagName:m="div",...h}){const g=xD(i),v=w.useRef(null),[x,S]=w.useState(null),[y,E]=w.useState([]),_=Qke(),k=w.useRef({}),C=w.useRef(new Map),R=w.useRef(0),I=w.useRef({autoSaveId:e,direction:a,dragState:x,id:g,keyboardResizeBy:c,onLayout:s,storage:u}),A=w.useRef({layout:y,panelDataArray:[],panelDataArrayChanged:!1});w.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),w.useImperativeHandle(r,()=>({getId:()=>I.current.id,getLayout:()=>{const{layout:z}=A.current;return z},setLayout:z=>{const{onLayout:L}=I.current,{layout:$,panelDataArray:F}=A.current,W=I2({layout:z,panelConstraints:F.map(X=>X.constraints)});R2($,W)||(E(W),A.current.layout=W,L&&L(W),qc(F,W,k.current))}}),[]),Pl(()=>{I.current.autoSaveId=e,I.current.direction=a,I.current.dragState=x,I.current.id=g,I.current.onLayout=s,I.current.storage=u}),aTe({committedValuesRef:I,eagerValuesRef:A,groupId:g,layout:y,panelDataArray:A.current.panelDataArray,setLayout:E,panelGroupElement:v.current}),w.useEffect(()=>{const{panelDataArray:z}=A.current;if(e){if(y.length===0||y.length!==z.length)return;let L=O2[e];L==null&&(L=cTe(dTe,fTe),O2[e]=L);const $=[...z],F=new Map(C.current);L(e,$,F,y,u)}},[e,y,u]),w.useEffect(()=>{});const O=w.useCallback(z=>{const{onLayout:L}=I.current,{layout:$,panelDataArray:F}=A.current;if(z.constraints.collapsible){const W=F.map(J=>J.constraints),{collapsedSize:X=0,panelSize:ie,pivotIndices:ce}=_l(F,z,$);if(It(ie!=null,`Panel size not found for panel "${z.id}"`),!To(ie,X)){C.current.set(z.id,ie);const q=ou(F,z)===F.length-1?ie-X:X-ie,le=cp({delta:q,initialLayout:$,panelConstraints:W,pivotIndices:ce,prevLayout:$,trigger:"imperative-api"});Eb($,le)||(E(le),A.current.layout=le,L&&L(le),qc(F,le,k.current))}}},[]),M=w.useCallback((z,L)=>{const{onLayout:$}=I.current,{layout:F,panelDataArray:W}=A.current;if(z.constraints.collapsible){const X=W.map(he=>he.constraints),{collapsedSize:ie=0,panelSize:ce=0,minSize:J=0,pivotIndices:q}=_l(W,z,F),le=L??J;if(To(ce,ie)){const he=C.current.get(z.id),oe=he!=null&&he>=le?he:le,Ve=ou(W,z)===W.length-1?ce-oe:oe-ce,xe=cp({delta:Ve,initialLayout:F,panelConstraints:X,pivotIndices:q,prevLayout:F,trigger:"imperative-api"});Eb(F,xe)||(E(xe),A.current.layout=xe,$&&$(xe),qc(W,xe,k.current))}}},[]),P=w.useCallback(z=>{const{layout:L,panelDataArray:$}=A.current,{panelSize:F}=_l($,z,L);return It(F!=null,`Panel size not found for panel "${z.id}"`),F},[]),B=w.useCallback((z,L)=>{const{panelDataArray:$}=A.current,F=ou($,z);return lTe({defaultSize:L,dragState:x,layout:y,panelData:$,panelIndex:F})},[x,y]),K=w.useCallback(z=>{const{layout:L,panelDataArray:$}=A.current,{collapsedSize:F=0,collapsible:W,panelSize:X}=_l($,z,L);return It(X!=null,`Panel size not found for panel "${z.id}"`),W===!0&&To(X,F)},[]),ee=w.useCallback(z=>{const{layout:L,panelDataArray:$}=A.current,{collapsedSize:F=0,collapsible:W,panelSize:X}=_l($,z,L);return It(X!=null,`Panel size not found for panel "${z.id}"`),!W||Jl(X,F)>0},[]),te=w.useCallback(z=>{const{panelDataArray:L}=A.current;L.push(z),L.sort(($,F)=>{const W=$.order,X=F.order;return W==null&&X==null?0:W==null?-1:X==null?1:W-X}),A.current.panelDataArrayChanged=!0,_()},[_]);Pl(()=>{if(A.current.panelDataArrayChanged){A.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:L,storage:$}=I.current,{layout:F,panelDataArray:W}=A.current;let X=null;if(z){const ce=uTe(z,W,$);ce&&(C.current=new Map(Object.entries(ce.expandToSizes)),X=ce.layout)}X==null&&(X=sTe({panelDataArray:W}));const ie=I2({layout:X,panelConstraints:W.map(ce=>ce.constraints)});R2(F,ie)||(E(ie),A.current.layout=ie,L&&L(ie),qc(W,ie,k.current))}}),Pl(()=>{const z=A.current;return()=>{z.layout=[]}},[]);const ae=w.useCallback(z=>{let L=!1;const $=v.current;return $&&window.getComputedStyle($,null).getPropertyValue("direction")==="rtl"&&(L=!0),function(W){W.preventDefault();const X=v.current;if(!X)return()=>null;const{direction:ie,dragState:ce,id:J,keyboardResizeBy:q,onLayout:le}=I.current,{layout:he,panelDataArray:oe}=A.current,{initialLayout:Ce}=ce??{},Ve=$Y(J,z,X);let xe=oTe(W,z,ie,ce,q,X);const Te=ie==="horizontal";Te&&L&&(xe=-xe);const Fe=oe.map(He=>He.constraints),pe=cp({delta:xe,initialLayout:Ce??he,panelConstraints:Fe,pivotIndices:Ve,prevLayout:he,trigger:TY(W)?"keyboard":"mouse-or-touch"}),Oe=!Eb(he,pe);(NY(W)||CY(W))&&R.current!=xe&&(R.current=xe,!Oe&&xe!==0?Te?e_(z,xe<0?AY:IY):e_(z,xe<0?OY:DY):e_(z,0)),Oe&&(E(pe),A.current.layout=pe,le&&le(pe),qc(oe,pe,k.current))}},[]),H=w.useCallback((z,L)=>{const{onLayout:$}=I.current,{layout:F,panelDataArray:W}=A.current,X=W.map(he=>he.constraints),{panelSize:ie,pivotIndices:ce}=_l(W,z,F);It(ie!=null,`Panel size not found for panel "${z.id}"`);const q=ou(W,z)===W.length-1?ie-L:L-ie,le=cp({delta:q,initialLayout:F,panelConstraints:X,pivotIndices:ce,prevLayout:F,trigger:"imperative-api"});Eb(F,le)||(E(le),A.current.layout=le,$&&$(le),qc(W,le,k.current))},[]),Z=w.useCallback((z,L)=>{const{layout:$,panelDataArray:F}=A.current,{collapsedSize:W=0,collapsible:X}=L,{collapsedSize:ie=0,collapsible:ce,maxSize:J=100,minSize:q=0}=z.constraints,{panelSize:le}=_l(F,z,$);le!=null&&(X&&ce&&To(le,W)?To(W,ie)||H(z,ie):le<q?H(z,q):le>J&&H(z,J))},[H]),G=w.useCallback((z,L)=>{const{direction:$}=I.current,{layout:F}=A.current;if(!v.current)return;const W=Cw(z,v.current);It(W,`Drag handle element not found for id "${z}"`);const X=PY($,L);S({dragHandleId:z,dragHandleRect:W.getBoundingClientRect(),initialCursorPosition:X,initialLayout:F})},[]),re=w.useCallback(()=>{S(null)},[]),ne=w.useCallback(z=>{const{panelDataArray:L}=A.current,$=ou(L,z);$>=0&&(L.splice($,1),delete k.current[z.id],A.current.panelDataArrayChanged=!0,_())},[_]),j=w.useMemo(()=>({collapsePanel:O,direction:a,dragState:x,expandPanel:M,getPanelSize:P,getPanelStyle:B,groupId:g,isPanelCollapsed:K,isPanelExpanded:ee,reevaluatePanelConstraints:Z,registerPanel:te,registerResizeHandle:ae,resizePanel:H,startDragging:G,stopDragging:re,unregisterPanel:ne,panelGroupElement:v.current}),[O,x,a,M,P,B,g,K,ee,Z,te,ae,H,G,re,ne]),V={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return w.createElement(Ew.Provider,{value:j},w.createElement(m,{...h,children:t,className:n,id:i,ref:v,style:{...V,...d},[Zn.group]:"",[Zn.groupDirection]:a,[Zn.groupId]:g}))}const HY=w.forwardRef((e,t)=>w.createElement(BY,{...e,forwardedRef:t}));BY.displayName="PanelGroup";HY.displayName="forwardRef(PanelGroup)";function ou(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function _l(e,t,n){const a=ou(e,t),i=a===e.length-1?[a-1,a]:[a,a+1],s=n[a];return{...t.constraints,panelSize:s,pivotIndices:i}}function pTe({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:a}){w.useEffect(()=>{if(e||n==null||a==null)return;const r=Cw(t,a);if(r==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const c=r.getAttribute(Zn.groupId);It(c,`No group element found for id "${c}"`);const u=lm(c,a),d=LY(c,t,a);It(d!==null,`No resize element found for id "${t}"`);const m=s.shiftKey?d>0?d-1:u.length-1:d+1<u.length?d+1:0;u[m].focus();break}}};return r.addEventListener("keydown",i),()=>{r.removeEventListener("keydown",i)}},[a,e,t,n])}function VY({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:a,id:r,onBlur:i,onClick:s,onDragging:c,onFocus:u,onPointerDown:d,onPointerUp:m,style:h={},tabIndex:g=0,tagName:v="div",...x}){var S,y;const E=w.useRef(null),_=w.useRef({onClick:s,onDragging:c,onPointerDown:d,onPointerUp:m});w.useEffect(()=>{_.current.onClick=s,_.current.onDragging=c,_.current.onPointerDown=d,_.current.onPointerUp=m});const k=w.useContext(Ew);if(k===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:R,registerResizeHandle:I,startDragging:A,stopDragging:O,panelGroupElement:M}=k,P=xD(r),[B,K]=w.useState("inactive"),[ee,te]=w.useState(!1),[ae,H]=w.useState(null),Z=w.useRef({state:B});Pl(()=>{Z.current.state=B}),w.useEffect(()=>{if(n)H(null);else{const j=I(P);H(()=>j)}},[n,P,I]);const G=(S=a?.coarse)!==null&&S!==void 0?S:15,re=(y=a?.fine)!==null&&y!==void 0?y:5;w.useEffect(()=>{if(n||ae==null)return;const j=E.current;It(j,"Element ref not attached");let V=!1;return Xke(P,j,C,{coarse:G,fine:re},(L,$,F)=>{if(!$){K("inactive");return}switch(L){case"down":{K("drag"),V=!1,It(F,'Expected event to be defined for "down" action'),A(P,F);const{onDragging:W,onPointerDown:X}=_.current;W?.(!0),X?.();break}case"move":{const{state:W}=Z.current;V=!0,W!=="drag"&&K("hover"),It(F,'Expected event to be defined for "move" action'),ae(F);break}case"up":{K("hover"),O();const{onClick:W,onDragging:X,onPointerUp:ie}=_.current;X?.(!1),ie?.(),V||W?.();break}}})},[G,C,n,re,I,P,ae,A,O]),pTe({disabled:n,handleId:P,resizeHandler:ae,panelGroupElement:M});const ne={touchAction:"none",userSelect:"none"};return w.createElement(v,{...x,children:e,className:t,id:r,onBlur:()=>{te(!1),i?.()},onFocus:()=>{te(!0),u?.()},ref:E,role:"separator",style:{...ne,...h},tabIndex:g,[Zn.groupDirection]:C,[Zn.groupId]:R,[Zn.resizeHandle]:"",[Zn.resizeHandleActive]:B==="drag"?"pointer":ee?"keyboard":void 0,[Zn.resizeHandleEnabled]:!n,[Zn.resizeHandleId]:P,[Zn.resizeHandleState]:B})}VY.displayName="PanelResizeHandle";function na({className:e,...t}){return f.jsx(HY,{"data-slot":"resizable-panel-group",className:De("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function Rn({...e}){return f.jsx(kY,{"data-slot":"resizable-panel",...e})}function Si({withHandle:e,className:t,...n}){return f.jsx(VY,{"data-slot":"resizable-handle",className:De("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&f.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:f.jsx(ahe,{className:"size-2.5"})})})}function eh({className:e,...t}){return f.jsx("kbd",{"data-slot":"kbd",className:De("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e),...t})}function mTe({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:a,onSearchExpand:r,onSearchChange:i,onSearchBlur:s,onClearAll:c,searchInputRef:u}){return f.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?f.jsx(En,{ref:u,placeholder:"Search notifications...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Notifications"}),f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,disabled:a===0,className:"h-8 w-8 p-0",children:f.jsx(Fs,{className:"h-4 w-4"})})}),f.jsx(Rt,{side:"bottom",children:"Clear all"})]})})]})}function Qs({id:e,isSelected:t,isFocused:n,icon:a,title:r,description:i,metadata:s,onClick:c,className:u}){return f.jsx("button",{id:e,type:"button",onClick:c,className:De("w-full text-left cursor-pointer p-2 sm:p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",t&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",n&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",u),children:f.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a&&f.jsx("div",{className:"flex-shrink-0 mt-1",children:f.jsx("div",{className:De("p-2.5 rounded-full transition-colors",t?"bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600"),children:a})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"flex items-center gap-2 mb-1",children:f.jsx("h3",{className:De("font-medium truncate font-mono text-sm"),children:r})}),i&&f.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:i})]})]})})}function hTe({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:a,formatRelativeTime:r,listRef:i}){return e.length===0?f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No notifications yet"})}):f.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>f.jsx(Qs,{id:`notification-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,title:f.jsxs("span",{className:"flex items-center gap-3",children:[s.method,!s.read&&f.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const u=r(s.timestamp),d=s.params&&Object.keys(s.params).length>0?Object.keys(s.params).length:0,m=d>0?` | ${d} param${d>1?"s":""}`:"";return u+m})(),onClick:()=>n(s)},s.id))})}function gTe({notification:e,previewMode:t,onTogglePreview:n,onCopy:a,onDownload:r,onFullscreen:i,isCopied:s=!1,onClose:c}){return e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(dd,{className:"h-3 w-3 text-gray-400"}),f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.formatRelativeTime(e.timestamp)})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(Le,{variant:"ghost",size:"sm",onClick:n,className:t?"":"text-purple-600 dark:text-purple-400",children:[t?f.jsx(XN,{className:"h-4 w-4 mr-1"}):f.jsx(LG,{className:"h-4 w-4 mr-1"}),t?"JSON":"Formatted"]}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:a,children:s?f.jsx(ra,{className:"h-4 w-4"}):f.jsx(Lr,{className:"h-4 w-4"})}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:r,children:f.jsx($m,{className:"h-4 w-4"})}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:i,children:f.jsx(eC,{className:"h-4 w-4"})}),c&&f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,children:f.jsx(Ji,{className:"h-4 w-4"})})]})]}),f.jsx("div",{className:"flex-1 overflow-y-auto",children:f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:{method:e.method,timestamp:e.timestamp,read:e.read,params:e.params},filename:`notification-${e.method.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(qN,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a notification to view details"})]})}function ty(e){const n=Date.now()-e,a=Math.floor(n/1e3),r=Math.floor(a/60),i=Math.floor(r/60),s=Math.floor(i/24);return a<60?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function bTe({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:a,clearNotifications:r,serverId:i,isConnected:s}){const[c,u]=w.useState(null),[d,m]=w.useState(""),[h,g]=w.useState(-1),[v,x]=w.useState(!0),[S,y]=w.useState(!1),[E,_]=w.useState(!0),[k,C]=w.useState(!1),R=w.useRef(null),I=w.useRef(null),A=w.useRef(null),O=w.useRef(!1);w.useEffect(()=>{v&&e.length>0&&R.current&&!O.current&&(R.current.scrollTop=0)},[e.length,v]),w.useEffect(()=>{const Z=R.current;if(!Z)return;const G=()=>{Z.scrollTop>0&&(O.current=!0,x(!1))};return Z.addEventListener("scroll",G),()=>Z.removeEventListener("scroll",G)},[]),w.useEffect(()=>{e.length===0&&(O.current=!1,x(!0))},[e.length]),w.useEffect(()=>{c&&!c.read&&n(c.id)},[c,n]),w.useEffect(()=>{S&&A.current&&A.current.focus()},[S]);const M=w.useCallback(()=>{d.trim()||y(!1)},[d]),P=w.useMemo(()=>{if(!d.trim())return e;const Z=d.toLowerCase();return e.filter(G=>G.method.toLowerCase().includes(Z)||JSON.stringify(G.params||{}).toLowerCase().includes(Z))},[e,d]);w.useEffect(()=>{g(-1)},[d]),w.useEffect(()=>{const Z=G=>{const re=G.target;if(re.tagName==="INPUT"||re.tagName==="TEXTAREA"||re.contentEditable==="true"||G.metaKey||G.ctrlKey||G.altKey)return;const j=P;if(G.key==="ArrowDown")G.preventDefault(),g(V=>{const z=V+1;return z>=j.length?0:z});else if(G.key==="ArrowUp")G.preventDefault(),g(V=>{const z=V-1;return z<0?j.length-1:z});else if(G.key==="Enter"&&h>=0){G.preventDefault();const V=P[h];V&&B(V)}};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[h,P]),w.useEffect(()=>{if(h>=0){const Z=`notification-${P[h]?.id}`,G=document.getElementById(Z);G&&G.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,P]);const B=w.useCallback(Z=>{u(Z)},[]),K=w.useCallback(()=>{window.confirm("Are you sure you want to clear all notifications? This cannot be undone.")&&(r(),u(null))},[r]),ee=w.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(Z){console.error("[NotificationsTab] Failed to copy notification:",Z)}},[c]),te=w.useCallback(()=>{if(c)try{const Z=new globalThis.Blob([JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)],{type:"application/json"}),G=URL.createObjectURL(Z),re=document.createElement("a");re.href=G,re.download=`notification-${Date.now()}.json`,document.body.appendChild(re),re.click(),document.body.removeChild(re),URL.revokeObjectURL(G)}catch(Z){console.error("[NotificationsTab] Failed to download notification:",Z)}},[c]),ae=w.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(Z){console.error("[NotificationsTab] Failed to toggle fullscreen:",Z)}},[]),H=c?{method:c.method,params:c.params,timestamp:c.timestamp,read:c.read,formatRelativeTime:ty}:null;return s?f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:40,minSize:30,children:f.jsx(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:f.jsxs(Rn,{defaultSize:75,minSize:30,children:[f.jsx(mTe,{isSearchExpanded:S,searchQuery:d,filteredNotificationsCount:P.length,notificationsCount:e.length,onSearchExpand:()=>y(!0),onSearchChange:m,onSearchBlur:M,onClearAll:K,searchInputRef:A}),f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(hTe,{notifications:P,selectedNotification:c,onNotificationSelect:B,focusedIndex:h,formatRelativeTime:ty,listRef:R})})]})})}),f.jsx(Si,{}),f.jsx(Rn,{defaultSize:60,minSize:40,children:f.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:f.jsx(gTe,{notification:H,previewMode:E,onTogglePreview:()=>_(!E),onCopy:ee,onDownload:te,onFullscreen:ae,onClose:()=>u(null),isCopied:k})})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(qN,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function GY({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:a,secondaryTabTitle:r,primaryCount:i,secondaryCount:s,secondaryIcon:c,primaryIcon:u,searchPlaceholder:d="Search...",onSearchExpand:m,onSearchChange:h,onSearchBlur:g,onTabSwitch:v,searchInputRef:x,primaryTabName:S}){const y=e===S;return f.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?f.jsx(En,{ref:x,placeholder:d,value:n,onChange:E=>h(E.target.value),onBlur:g,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:y?a:r}),y&&f.jsxs(f.Fragment,{children:[f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:i}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})]})}),f.jsxs(Le,{variant:"ghost",size:"sm",onClick:v,className:"gap-2 flex-shrink-0",children:[y?f.jsx(c,{}):f.jsx(u,{}),f.jsx("span",{className:"hidden sm:inline",children:y?r:a}),y&&s>0&&f.jsx(wr,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:s})]})]})}function D2({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:a}){return e.length===0?f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(Hp,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):f.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((r,i)=>f.jsx(Qs,{id:`prompt-${r.name}`,isSelected:t?.name===r.name,isFocused:a===i,icon:f.jsx(Hp,{className:"h-4 w-4"}),title:r.name,description:r.description,metadata:r.arguments&&r.arguments.length>0&&f.jsxs(wr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[r.arguments.length," args"]}),onClick:()=>n(r)},r.name))})}function j2({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:a,savedPromptsCount:r,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return f.jsx(GY,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:a,secondaryCount:r,primaryIcon:Hp,secondaryIcon:dd,searchPlaceholder:"Search prompts...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}function L2({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:a,focusedIndex:r}){return e.length===0?f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(dd,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),f.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):f.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((i,s)=>f.jsx(Qs,{id:`saved-prompt-${i.id}`,isSelected:t?.id===i.id,isFocused:r===s,icon:f.jsx(dd,{className:"h-4 w-4"}),title:i.name,description:`${i.promptName} - ${new Date(i.savedAt).toLocaleString()}`,onClick:()=>n(i)},i.id))})}function vTe({selectedPrompt:e,promptArgs:t,onArgChange:n}){const a=e?.arguments||[];if(!(a.length>0))return f.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const i=s=>{const c=s.name,u=t[c],d=typeof u=="string"?u:JSON.stringify(u);return s.type==="boolean"?f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx("input",{id:c,type:"checkbox",checked:!!u,onChange:m=>n(c,m.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),f.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]})]},c):s.type==="number"?f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsx(En,{id:c,type:"number",value:Number(u)||0,onChange:m=>n(c,Number(m.target.value)),placeholder:s.description||`Enter ${c}`}),s.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):s.type==="array"||s.type==="object"?f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsx(ql,{id:c,value:d,onChange:m=>{try{const h=JSON.parse(m.target.value);n(c,h)}catch{n(c,m.target.value)}},placeholder:s.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),s.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsx(En,{id:c,value:d,onChange:m=>n(c,m.target.value),placeholder:s.description||`Enter ${c}`}),s.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c)};return f.jsx("div",{className:"space-y-4",children:a.map(s=>i(s))})}function $2({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:a,onArgChange:r,onExecute:i,onSave:s}){return w.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&e&&!n&&a&&(u.preventDefault(),i())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n,a,i]),e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[f.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),f.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[f.jsx(Le,{onClick:i,disabled:n||!a,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?f.jsxs(f.Fragment,{children:[f.jsx(ki,{className:"mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):f.jsxs(f.Fragment,{children:[f.jsx(zG,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Execute"}),f.jsx("span",{className:"hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2",children:"⌘↵"})]})}),f.jsxs(Le,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[f.jsx(tC,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),e.description&&f.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),f.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:f.jsx(vTe,{selectedPrompt:e,promptArgs:t,onArgChange:r})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),f.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a prompt from the list to view its details and execute it"})]})}function yTe(e){return"isError"in e&&!e.isError?null:"error"in e&&e.error?e.error:"isError"in e&&e.isError?"An error occurred":null}function M2({results:e,copiedResult:t,onCopy:n}){return f.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:f.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:e.length>0?f.jsx("div",{className:"space-y-4 flex-1 h-full",children:e.map((a,r)=>{const i=a.error||yTe(a.result);return f.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[f.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"Response"}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(dd,{className:"h-3 w-3 text-gray-400"}),f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(a.timestamp).toLocaleTimeString()})]}),a.duration!==void 0&&f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Vp,{className:"h-3 w-3 text-gray-400"}),f.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[a.duration,"ms"]})]}),f.jsx("div",{className:"flex gap-2 ml-auto",children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>n(r,a.result),className:"h-6 px-2",children:t===r?f.jsx(ra,{className:"h-4 w-4"}):f.jsx(Lr,{className:"h-4 w-4"})})})]}),i?f.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[f.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),f.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:i})]}):f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:a.result,filename:`prompt-result-${a.promptName}-${Date.now()}.json`})})]},r)})}):f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsx("div",{className:"text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function ED({serverIds:e,onCountChange:t,onClearRef:n}={}){const[a,r]=w.useState([]),i=w.useRef(null),[s,c]=w.useState(new Set),[u]=w.useState(""),d=v=>{c(x=>{const S=new Set(x);return S.has(v)?S.delete(v):S.add(v),S})},m=async()=>{r([]),c(new Set),t?.(0);try{const v=new URLSearchParams;e&&e.length>0&&v.set("serverIds",e.join(","));const x=await fetch(`/inspector/api/rpc/log?${v.toString()}`,{method:"DELETE"});x.ok||console.warn("[RPC Logger] Failed to clear server buffer:",x.status)}catch(v){console.warn("[RPC Logger] Error clearing server buffer:",v)}},h=w.useMemo(()=>!e||e.length===0?"":[...e].sort().join(","),[e]);w.useEffect(()=>(n&&(n.current=m),()=>{n&&(n.current=null)}),[n,m]),w.useEffect(()=>{t?.(a.length)},[a.length,t]),w.useEffect(()=>{let v=null;try{const x=new URLSearchParams;x.set("replay","3"),x.set("_t",Date.now().toString()),e&&e.length>0&&x.set("serverIds",e.join(","));const S=`/inspector/api/rpc/stream?${x.toString()}`;console.log("[RPC Logger] Connecting to SSE stream:",S),v=new globalThis.EventSource(S),v.onopen=()=>{console.log("[RPC Logger] SSE connection opened")},v.onmessage=y=>{try{const E=JSON.parse(y.data);if(!E||E.type!=="rpc")return;const{serverId:_,direction:k,message:C,timestamp:R}=E,I=C,A=typeof I?.method=="string"?I.method:I?.result!==void 0?"result":I?.error!==void 0?"error":"unknown",O={id:`${R??Date.now()}-${Math.random().toString(36).slice(2)}`,serverId:typeof _=="string"?_:"unknown",direction:typeof k=="string"?k.toUpperCase():"",method:A,timestamp:R??new Date().toISOString(),payload:C};console.log("[RPC Logger] Received RPC event:",{method:A,direction:k,serverId:_}),r(M=>{const P=[O,...M].slice(0,1e3);return t?.(P.length),P})}catch(E){console.error("[RPC Logger] Error parsing SSE message:",E)}},v.onerror=y=>{console.error("[RPC Logger] SSE connection error:",y);try{v?.close()}catch{}}}catch(x){console.error("[RPC Logger] Failed to create SSE connection:",x)}return()=>{try{v?.close(),console.log("[RPC Logger] SSE connection closed")}catch{}}},[h]);const g=w.useMemo(()=>{let v=a;if(e&&e.length>0){const x=new Set(e);v=v.filter(S=>x.has(S.serverId))}if(u.trim()){const x=u.toLowerCase();v=v.filter(S=>S.serverId.toLowerCase().includes(x)||S.method.toLowerCase().includes(x)||S.direction.toLowerCase().includes(x)||JSON.stringify(S.payload).toLowerCase().includes(x))}return v},[a,u,e]);return f.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:f.jsx("div",{ref:i,className:"flex-1 min-h-0 overflow-y-auto",children:g.length===0?f.jsxs("div",{className:"text-center py-8",children:[f.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages yet"}),f.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:"JSON-RPC messages will appear here"})]}):g.map(v=>{const x=s.has(v.id);return f.jsxs("div",{className:"group hover:bg-muted/50 transition-all duration-200 overflow-hidden",children:[f.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>d(v.id),children:[f.jsx("div",{className:"flex-shrink-0",children:x?f.jsx(rc,{className:"h-3 w-3 text-muted-foreground transition-transform"}):f.jsx($G,{className:"h-3 w-3 text-muted-foreground transition-transform"})}),f.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[f.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:new Date(v.timestamp).toLocaleTimeString()}),f.jsx("span",{className:`flex items-center justify-center px-1 py-0.5 rounded ${v.direction==="RECEIVE"?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-green-500/10 text-green-600 dark:text-green-400"}`,title:v.direction==="RECEIVE"?"Incoming":"Outgoing",children:v.direction==="RECEIVE"?f.jsx(mme,{className:"h-3 w-3"}):f.jsx(gme,{className:"h-3 w-3"})}),f.jsx("span",{className:"text-xs font-mono text-foreground truncate",children:v.method})]})]}),x&&f.jsx("div",{className:"border-t bg-muted/20",children:f.jsx("div",{className:"p-3",children:f.jsx("div",{className:"max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2",children:f.jsx(Xn,{data:v.payload})})})})]},v.id)})})})}const P2="mcp-inspector-saved-prompts";function WY({ref:e,prompts:t,callPrompt:n,serverId:a,isConnected:r}){const[i,s]=w.useState(null),[c,u]=w.useState(null),{selectedPromptName:d,setSelectedPromptName:m}=ac(),[h,g]=w.useState({}),[v,x]=w.useState([]),[S,y]=w.useState(!1),[E,_]=w.useState(null),[k,C]=w.useState(""),[R,I]=w.useState("prompts"),[A,O]=w.useState([]),[M,P]=w.useState(!1),[B,K]=w.useState(""),[ee,te]=w.useState(!1),[ae,H]=w.useState(-1),Z=w.useRef(null),[G,re]=w.useState(!1),[ne,j]=w.useState("list"),[V,z]=w.useState(0),[L,$]=w.useState(!0),F=w.useRef(null),W=w.useRef(null);w.useEffect(()=>{const xe=()=>{re(window.innerWidth<1024)};return xe(),window.addEventListener("resize",xe),()=>window.removeEventListener("resize",xe)},[]),w.useEffect(()=>{j(i?"detail":"list")},[i]),w.useEffect(()=>{G&&v.length>0&&!S&&j("response")},[v,S,G]),w.useImperativeHandle(e,()=>({focusSearch:()=>{te(!0),setTimeout(()=>{Z.current&&Z.current.focus()},0)},blurSearch:()=>{C(""),te(!1),Z.current&&Z.current.blur()}})),w.useEffect(()=>{try{const xe=localStorage.getItem(P2);if(xe){const Te=JSON.parse(xe);O(Te)}}catch(xe){console.error("[PromptsTab] Failed to load saved prompts:",xe)}},[]);const X=w.useCallback(xe=>{try{localStorage.setItem(P2,JSON.stringify(xe))}catch(Te){console.error("[PromptsTab] Failed to save prompts:",Te)}},[]);w.useEffect(()=>{ee&&Z.current&&Z.current.focus()},[ee]);const ie=w.useCallback(()=>{k.trim()||te(!1)},[k]),ce=w.useMemo(()=>{if(!k.trim())return t;const xe=k.toLowerCase();return t.filter(Te=>Te.name.toLowerCase().includes(xe)||Te.description?.toLowerCase().includes(xe))},[t,k]),J=w.useCallback(xe=>{s(xe);const Te={};xe.arguments&&xe.arguments.forEach(Fe=>{Fe.default!==void 0?Te[Fe.name]=Fe.default:Fe.type==="string"?Te[Fe.name]="":Fe.type==="number"?Te[Fe.name]=0:Fe.type==="boolean"?Te[Fe.name]=!1:Fe.type==="array"?Te[Fe.name]=[]:Fe.type==="object"&&(Te[Fe.name]={})}),g(Te)},[]),q=w.useCallback(xe=>{const Te=t.find(Fe=>Fe.name===xe.promptName);Te&&(s(Te),g(xe.args),u(xe))},[t]);w.useEffect(()=>{H(-1)},[k,R]),w.useEffect(()=>{const xe=Te=>{const Fe=Te.target;if(Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.contentEditable==="true"||Te.metaKey||Te.ctrlKey||Te.altKey)return;const Oe=R==="prompts"?ce:A;if(Te.key==="ArrowDown")Te.preventDefault(),H(He=>{const Se=He+1;return Se>=Oe.length?0:Se});else if(Te.key==="ArrowUp")Te.preventDefault(),H(He=>{const Se=He-1;return Se<0?Oe.length-1:Se});else if(Te.key==="Enter"&&ae>=0)if(Te.preventDefault(),R==="prompts"){const He=ce[ae];He&&J(He)}else{const He=A[ae];He&&q(He)}};return document.addEventListener("keydown",xe),()=>document.removeEventListener("keydown",xe)},[ae,ce,A,R,J,q]),w.useEffect(()=>{if(ae>=0){const xe=R==="prompts"?`prompt-${ce[ae]?.name}`:`saved-prompt-${A[ae]?.id}`,Te=document.getElementById(xe);Te&&Te.scrollIntoView({behavior:"smooth",block:"nearest"})}},[ae,ce,A,R]),w.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:d,promptsCount:t.length,currentSelectedPrompt:i?.name}),d&&t.length>0){const xe=t.find(Te=>Te.name===d);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:d,promptFound:!!xe,promptName:xe?.name,shouldSelect:xe&&i?.name!==xe.name}),xe&&i?.name!==xe.name){console.warn("[PromptsTab] Selecting prompt:",xe.name),m(null);const Te=setTimeout(()=>{J(xe);const Fe=document.getElementById(`prompt-${xe.name}`);Fe&&(console.warn("[PromptsTab] Scrolling to prompt element"),Fe.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(Te)}}},[d,t,i,J,m]);const le=w.useCallback((xe,Te)=>{g(Fe=>({...Fe,[xe]:Te}))},[]),he=w.useCallback(async()=>{if(!i||S)return;y(!0);const xe=Date.now();try{const Te=await n(i.name,h),Fe=Date.now()-xe;vr.getInstance().capture(new JU({promptName:i.name,serverId:a,success:!0})).catch(()=>{}),x(Oe=>[{promptName:i.name,args:h,result:Te,timestamp:xe,duration:Fe},...Oe])}catch(Te){vr.getInstance().capture(new JU({promptName:i.name,serverId:a,success:!1,error:Te instanceof Error?Te.message:"Unknown error"})).catch(()=>{});const pe={promptName:i.name,args:h,result:null,error:Te instanceof Error?Te.message:String(Te),timestamp:xe,duration:Date.now()-xe};x(Oe=>[pe,...Oe])}finally{y(!1)}},[i,h,S,n,a]),oe=w.useCallback(async(xe,Te)=>{try{await navigator.clipboard.writeText(JSON.stringify(Te,null,2)),_(xe),setTimeout(()=>_(null),2e3)}catch(Fe){console.error("[PromptsTab] Failed to copy result:",Fe)}},[]),Ce=w.useCallback(()=>{i&&(K(""),P(!0))},[i]),Ve=w.useCallback(xe=>{X(A.filter(Te=>Te.id!==xe)),c?.id===xe&&u(null)},[A,X,c]);return G?f.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[ne!=="list"&&f.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[f.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>{ne==="response"?j("detail"):(s(null),j("list"))},className:"p-0 h-8 w-8",children:f.jsx(qy,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex items-center text-sm font-medium",children:[f.jsx("button",{onClick:()=>{s(null),j("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),ne!=="list"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("button",{onClick:()=>{ne==="response"&&j("detail")},className:ne==="detail"?"text-foreground hover:underline":ne==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),ne==="response"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),f.jsx("div",{className:"flex-1 relative overflow-hidden",children:f.jsxs(rw,{initial:!1,mode:"popLayout",children:[ne==="list"&&f.jsxs(ya.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[f.jsx(j2,{activeTab:R,isSearchExpanded:ee,searchQuery:k,filteredPromptsCount:ce.length,savedPromptsCount:A.length,onSearchExpand:()=>te(!0),onSearchChange:C,onSearchBlur:ie,onTabSwitch:()=>I(R==="prompts"?"saved":"prompts"),searchInputRef:Z}),R==="prompts"?f.jsx(D2,{prompts:ce,selectedPrompt:i,onPromptSelect:J,focusedIndex:ae}):f.jsx(L2,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:q,onDeletePrompt:Ve,focusedIndex:ae})]},"list"),ne==="detail"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-10",children:f.jsx($2,{selectedPrompt:i,promptArgs:h,isExecuting:S,isConnected:r,onArgChange:le,onExecute:he,onSave:Ce})},"detail"),ne==="response"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-20",children:f.jsx(M2,{results:v,copiedResult:E,onCopy:oe})},"response")]})})]}):f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:33,className:"flex flex-col h-full relative",children:f.jsxs(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[f.jsx(Rn,{defaultSize:75,minSize:30,children:f.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[f.jsx(j2,{activeTab:R,isSearchExpanded:ee,searchQuery:k,filteredPromptsCount:ce.length,savedPromptsCount:A.length,onSearchExpand:()=>te(!0),onSearchChange:C,onSearchBlur:ie,onTabSwitch:()=>I(R==="prompts"?"saved":"prompts"),searchInputRef:Z}),R==="prompts"?f.jsx(D2,{prompts:ce,selectedPrompt:i,onPromptSelect:J,focusedIndex:ae}):f.jsx(L2,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:q,onDeletePrompt:Ve,focusedIndex:ae})]})}),f.jsx(Si,{withHandle:!0}),f.jsxs(Rn,{ref:F,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>$(!0),onExpand:()=>$(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[f.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),L?(F.current?.resize(25),$(!1)):(F.current?.resize(5),$(!0))},children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),V>0&&f.jsx(wr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:V}),V>0&&!L&&f.jsx(Le,{variant:"ghost",size:"sm",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),W.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:f.jsx(Fs,{className:"h-3.5 w-3.5"})})]}),f.jsx(rc,{className:`h-4 w-4 text-muted-foreground transition-transform ${L?"rotate-180":""}`})]}),!L&&f.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:f.jsx(ED,{serverIds:[a],onCountChange:z,onClearRef:W})})]})]})}),f.jsx(Si,{withHandle:!0}),f.jsx(Rn,{defaultSize:67,children:f.jsxs(na,{direction:"vertical",children:[f.jsx(Rn,{defaultSize:40,children:f.jsx($2,{selectedPrompt:i,promptArgs:h,isExecuting:S,isConnected:r,onArgChange:le,onExecute:he,onSave:Ce})}),f.jsx(Si,{withHandle:!0}),f.jsx(Rn,{defaultSize:50,children:f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(M2,{results:v,copiedResult:E,onCopy:oe})})})]})})]})}WY.displayName="PromptsTab";function Cu(e){if(!e?.mimeType)return!1;const t=e.mimeType.toLowerCase();return t==="text/html"||t==="text/html+skybridge"||t==="text/uri-list"||t.startsWith("application/vnd.mcp-ui.remote-dom")}function wTe(e){return{uri:e.uri,mimeType:e.mimeType,text:e.text,blob:e.blob}}function KY({resource:e,onUIAction:t,className:n}){const a=async i=>t?.(i),r=wTe(e);return f.jsx("div",{className:n,children:f.jsx(wD,{resource:r,onUIAction:a,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[Ike,Ake,Oke,Dke],library:yD}})})}function STe(e){if("error"in e&&e.error)return e.error;if(!("isError"in e&&e.isError))return null;if("contents"in e&&Array.isArray(e.contents)){const t=e.contents.filter(n=>"text"in n).map(n=>n.text).filter(Boolean);if(t.length>0)return t.join(`
1660
+ `);k=I.pop()||"";for(const A of I)if(A.trim()&&A.startsWith("data: "))try{const O=JSON.parse(A.slice(6));if(console.log("[Client received event]",O.type,O.toolName||O.content?.slice?.(0,30)),O.type==="message")console.log("[Message started]",O.id);else if(O.type==="text"){S+=O.content;const M=y[y.length-1];M&&M.type==="text"?M.text=S:y.push({type:"text",text:S}),console.log("[Parts after text]",y.length,"parts, text length:",S.length),i(P=>P.map(B=>B.id===x?{...B,parts:[...y]}:B))}else if(O.type==="tool-call")S&&(S=""),y.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",y.length,"parts, tool:",O.toolName),i(M=>M.map(P=>P.id===x?{...P,parts:[...y]}:P));else if(O.type==="tool-result"){const M=y.find(P=>P.type==="tool-invocation"&&P.toolInvocation?.toolName===O.toolName&&!P.toolInvocation?.result);M&&M.toolInvocation?(M.toolInvocation.result=O.result,M.toolInvocation.state="result",console.log("[Parts after tool-result]",y.length,"parts, updated:",O.toolName),i(P=>P.map(B=>B.id===x?{...B,parts:[...y]}:B))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",y.length),i(M=>M.map(P=>P.id===x?{...P,parts:[...y],content:""}:P));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,A)}}}catch(g){let v="Unknown error occurred";if(g instanceof Error){v=g.message;const S=g;S.status&&(v=`HTTP ${S.status}: ${v}`),(S.code===401||v.includes("401")||v.includes("Unauthorized"))&&(v="Authentication failed (401). Check your Authorization header in the connection settings.")}const x={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${v}`,timestamp:Date.now()};i(S=>[...S,x])}finally{c(!1)}},[t,a,e,r,n]),d=w.useCallback(()=>{i([])},[]);return{messages:r,isLoading:s,sendMessage:u,clearMessages:d}}function Pke({connection:e,llmConfig:t,isConnected:n,readResource:a}){const[r,i]=w.useState([]),[s,c]=w.useState(!1),u=w.useRef(null),d=w.useRef(null),m=w.useRef(null),h=w.useCallback(async v=>{if(!v.trim()||!t||!n)return;const x={id:`user-${Date.now()}`,role:"user",content:v.trim(),timestamp:Date.now()};i(E=>[...E,x]),c(!0),u.current=new AbortController;const S=Date.now();let y=0;try{const E=`assistant-${Date.now()}`;let _="";const k=[];if(i(C=>[...C,{id:E,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]),!m.current||m.current.provider!==t.provider||m.current.model!==t.model||m.current.apiKey!==t.apiKey){let C;if(t.provider==="openai"){const{ChatOpenAI:R}=await Jn(async()=>{const{ChatOpenAI:I}=await import("./index-D-OMhIK9.js");return{ChatOpenAI:I}},__vite__mapDeps([6,7,8,2,9,10,11]));C=new R({model:t.model,apiKey:t.apiKey})}else if(t.provider==="anthropic"){const{ChatAnthropic:R}=await Jn(async()=>{const{ChatAnthropic:I}=await import("./index-CVD-P0xp.js");return{ChatAnthropic:I}},__vite__mapDeps([12,8,7,2,11]));C=new R({model:t.model,apiKey:t.apiKey})}else if(t.provider==="google"){const{ChatGoogleGenerativeAI:R}=await Jn(async()=>{const{ChatGoogleGenerativeAI:I}=await import("./index-ll3isPzo.js");return{ChatGoogleGenerativeAI:I}},__vite__mapDeps([13,8,7,2,10]));C=new R({model:t.model,apiKey:t.apiKey})}else throw new Error(`Unsupported LLM provider: ${t.provider}`);m.current={instance:C,provider:t.provider,model:t.model,apiKey:t.apiKey}}if(!d.current||d.current.llm!==m.current.instance){const{MCPAgent:C}=await Jn(async()=>{const{MCPAgent:R}=await import("./browser-CLu-Wczi.js");return{MCPAgent:R}},__vite__mapDeps([14,4,5,3,11,7,8,2,10,9]));d.current=new C({llm:m.current.instance,client:e.client,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."}),await d.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",d.current.conversationHistory?.length);for await(const C of d.current.streamEvents(v,10,!1,void 0)){if(u.current?.signal.aborted)break;if(C.event==="on_chat_model_stream"&&C.data?.chunk?.text){const R=C.data.chunk.text;if(typeof R=="string"&&R.length>0){_+=R;const I=k[k.length-1];I&&I.type==="text"?I.text=_:k.push({type:"text",text:_}),i(A=>A.map(O=>O.id===E?{...O,parts:[...k]}:O))}}else if(C.event==="on_tool_start"){_&&(_="");let R={};C.data?.input?R=C.data.input:C.data?.tool_input?R=C.data.tool_input:C.data&&(R=C.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:C.name,eventData:C.data,extractedArgs:R}),y++,k.push({type:"tool-invocation",toolInvocation:{toolName:C.name||"unknown",args:R,state:"pending"}}),i(I=>I.map(A=>A.id===E?{...A,parts:[...k]}:A))}else if(C.event==="on_tool_end"){const R=k.find(I=>I.type==="tool-invocation"&&I.toolInvocation?.toolName===C.name&&!I.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:C.name,hasToolPart:!!R,output:C.data?.output}),R&&R.toolInvocation){let I=C.data?.output;if(I?.kwargs?.content&&typeof I.kwargs.content=="string")try{I=JSON.parse(I.kwargs.content)}catch(O){console.warn("[useChatMessagesClientSide] Failed to parse kwargs.content:",O),I=I.kwargs.content}else if(I?.content&&typeof I.content=="string")try{I=JSON.parse(I.content)}catch{I=I.content}R.toolInvocation.result=I,R.toolInvocation.state="result";const A=I?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:C.name,hasMeta:!!I?._meta,hasStructuredContent:!!I?.structuredContent,appsSdkUri:A}),A&&typeof A=="string"&&a){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",A);try{const O=await a(A);console.log("[useChatMessagesClientSide] Resource fetched:",O);const M=I?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const P=O.contents.map(K=>({type:"resource",resource:K}));console.log("[useChatMessagesClientSide] Created MCP resources:",P);const B={...I,content:[...I.content||[],...P],structuredContent:M};R.toolInvocation.result=B,console.log("[useChatMessagesClientSide] Updated result with resources")}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",O)}catch(O){console.error("Failed to fetch Apps SDK resource:",O)}}i(O=>O.map(M=>M.id===E?{...M,parts:[...k]}:M))}}}i(C=>C.map(R=>R.id===E?{...R,parts:[...k],content:""}:R)),t&&vr.getInstance().capture(new QU({serverId:e.url,provider:t.provider,model:t.model,messageCount:r.length+1,toolCallsCount:y,success:!0,executionMode:"client-side",duration:Date.now()-S})).catch(()=>{})}catch(E){console.error("Client-side agent error:",E);let _="Unknown error occurred";if(E instanceof Error){_=E.message;const C=E;C.status&&(_=`HTTP ${C.status}: ${_}`),(C.code===401||_.includes("401")||_.includes("Unauthorized"))&&(_="Authentication failed (401). Check your Authorization header in the connection settings.")}t&&vr.getInstance().capture(new QU({serverId:e.url,provider:t.provider,model:t.model,messageCount:r.length+1,toolCallsCount:y,success:!1,executionMode:"client-side",duration:Date.now()-S,error:_})).catch(()=>{});const k={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${_}`,timestamp:Date.now()};i(C=>[...C,k])}finally{c(!1),u.current=null}},[e,t,n,r,a]),g=w.useCallback(()=>{i([]),d.current&&d.current.clearConversationHistory()},[]);return{messages:r,isLoading:s,sendMessage:h,clearMessages:g}}const E2={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function _Y({mcpServerUrl:e}){const[t,n]=w.useState(null),[a,r]=w.useState(null),[i,s]=w.useState(!1),[c,u]=w.useState("openai"),[d,m]=w.useState(""),[h,g]=w.useState(E2.openai),v=w.useCallback(()=>{const M=localStorage.getItem("mcp-inspector-api-keys");if(M)try{return JSON.parse(M)}catch(P){return console.error("Failed to load API keys:",P),{}}return{}},[]),x=w.useCallback(M=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(M))},[]),[S,y]=w.useState("none"),[E,_]=w.useState(""),[k,C]=w.useState(""),[R,I]=w.useState("");w.useEffect(()=>{const M=localStorage.getItem("mcp-inspector-llm-config"),P=v();if(M)try{const B=JSON.parse(M);n(B),u(B.provider),m(P[B.provider]||B.apiKey||""),g(B.model)}catch(B){console.error("Failed to load LLM config:",B)}},[v]),w.useEffect(()=>{const M=localStorage.getItem("mcp-inspector-auth-config");if(M)try{const P=JSON.parse(M);r(P),y(P.type),P.username&&_(P.username),P.password&&C(P.password),P.token&&I(P.token)}catch(P){console.error("Failed to load auth config:",P)}else try{const P="mcp:auth",B=xY(e),K=`${P}_${B}_tokens`;localStorage.getItem(K)&&(r({type:"oauth"}),y("oauth"))}catch(P){console.error("Failed to check for OAuth tokens:",P)}},[e]),w.useEffect(()=>{g(E2[c]);const M=v();m(M[c]||"")},[c,v]);const A=w.useCallback(()=>{if(!d.trim())return;const M=v();M[c]=d,x(M);const P={provider:c,apiKey:d,model:h},B={type:S,...S==="basic"&&{username:E.trim(),password:k.trim()},...S==="bearer"&&{token:R.trim()}};n(P),r(B),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(P)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(B)),s(!1)},[c,d,h,S,E,k,R,v,x]),O=w.useCallback(()=>{n(null),r(null);const M=v();delete M[c],x(M),m(""),_(""),C(""),I(""),y("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,v,x]);return{llmConfig:t,authConfig:a,configDialogOpen:i,setConfigDialogOpen:s,tempProvider:c,setTempProvider:u,tempApiKey:d,setTempApiKey:m,tempModel:h,setTempModel:g,tempAuthType:S,saveLLMConfig:A,clearConfig:O}}function Uke({connection:e,isConnected:t,useClientSide:n=!0,readResource:a}){const[r,i]=w.useState(""),s=w.useRef(null),{llmConfig:c,authConfig:u,configDialogOpen:d,setConfigDialogOpen:m,tempProvider:h,setTempProvider:g,tempApiKey:v,setTempApiKey:x,tempModel:S,setTempModel:y,saveLLMConfig:E,clearConfig:_}=_Y({mcpServerUrl:e.url}),k={connection:e,llmConfig:c,isConnected:t,readResource:a},C=Mke({mcpServerUrl:e.url,llmConfig:c,authConfig:u,isConnected:t}),R=Pke(k),{messages:I,isLoading:A,sendMessage:O,clearMessages:M}=n?R:C;SK({onNewChat:M}),w.useEffect(()=>{c&&I.length===0&&s.current&&s.current.focus()},[c,I.length]),w.useEffect(()=>{!A&&I.length>0&&s.current&&s.current.focus()},[A,I.length]);const P=w.useCallback(()=>{r.trim()&&(O(r),i(""))},[r,O]),B=w.useCallback(ee=>{ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),P())},[P]),K=w.useCallback(()=>{_(),M()},[_,M]);return c&&I.length===0?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("div",{className:"absolute top-4 right-4 z-10",children:f.jsx(NE,{open:d,onOpenChange:m,tempProvider:h,tempModel:S,tempApiKey:v,onProviderChange:g,onModelChange:y,onApiKeyChange:x,onSave:E,onClear:K,showClearButton:!0,buttonLabel:"Change API Key"})}),f.jsx(QSe,{mcpServerUrl:e.url,inputValue:r,isConnected:t,isLoading:A,textareaRef:s,llmConfig:c,onInputChange:i,onKeyDown:B,onSubmit:ee=>{ee.preventDefault(),P()},onConfigDialogOpenChange:m})]}):f.jsxs("div",{className:"flex flex-col h-full relative",children:[f.jsx(qSe,{llmConfig:c,hasMessages:I.length>0,configDialogOpen:d,onConfigDialogOpenChange:m,onClearChat:M,tempProvider:h,tempModel:S,tempApiKey:v,onProviderChange:g,onModelChange:y,onApiKeyChange:x,onSaveConfig:E,onClearConfig:K}),f.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?f.jsx($ke,{messages:I,isLoading:A,serverId:e.url,readResource:a,tools:e.tools}):f.jsx(exe,{onConfigureClick:()=>m(!0)})}),c&&f.jsx(XSe,{inputValue:r,isConnected:t,isLoading:A,textareaRef:s,onInputChange:i,onKeyDown:B,onSendMessage:P})]})}const Ew=w.createContext(null);Ew.displayName="PanelGroupContext";const Zn={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},SD=10,Pl=w.useLayoutEffect,k2=Ed.useId,zke=typeof k2=="function"?k2:()=>null;let Fke=0;function xD(e=null){const t=zke(),n=w.useRef(e||t||null);return n.current===null&&(n.current=""+Fke++),e??n.current}function EY({children:e,className:t="",collapsedSize:n,collapsible:a,defaultSize:r,forwardedRef:i,id:s,maxSize:c,minSize:u,onCollapse:d,onExpand:m,onResize:h,order:g,style:v,tagName:x="div",...S}){const y=w.useContext(Ew);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:E,expandPanel:_,getPanelSize:k,getPanelStyle:C,groupId:R,isPanelCollapsed:I,reevaluatePanelConstraints:A,registerPanel:O,resizePanel:M,unregisterPanel:P}=y,B=xD(s),K=w.useRef({callbacks:{onCollapse:d,onExpand:m,onResize:h},constraints:{collapsedSize:n,collapsible:a,defaultSize:r,maxSize:c,minSize:u},id:B,idIsFromProps:s!==void 0,order:g});w.useRef({didLogMissingDefaultSizeWarning:!1}),Pl(()=>{const{callbacks:te,constraints:ae}=K.current,H={...ae};K.current.id=B,K.current.idIsFromProps=s!==void 0,K.current.order=g,te.onCollapse=d,te.onExpand=m,te.onResize=h,ae.collapsedSize=n,ae.collapsible=a,ae.defaultSize=r,ae.maxSize=c,ae.minSize=u,(H.collapsedSize!==ae.collapsedSize||H.collapsible!==ae.collapsible||H.maxSize!==ae.maxSize||H.minSize!==ae.minSize)&&A(K.current,H)}),Pl(()=>{const te=K.current;return O(te),()=>{P(te)}},[g,B,O,P]),w.useImperativeHandle(i,()=>({collapse:()=>{E(K.current)},expand:te=>{_(K.current,te)},getId(){return B},getSize(){return k(K.current)},isCollapsed(){return I(K.current)},isExpanded(){return!I(K.current)},resize:te=>{M(K.current,te)}}),[E,_,k,I,B,M]);const ee=C(K.current,r);return w.createElement(x,{...S,children:e,className:t,id:B,style:{...ee,...v},[Zn.groupId]:R,[Zn.panel]:"",[Zn.panelCollapsible]:a||void 0,[Zn.panelId]:B,[Zn.panelSize]:parseFloat(""+ee.flexGrow).toFixed(1)})}const kY=w.forwardRef((e,t)=>w.createElement(EY,{...e,forwardedRef:t}));EY.displayName="Panel";kY.displayName="forwardRef(Panel)";let nk=null,qb=-1,Rs=null;function Bke(e,t,n){const a=(t&AY)!==0,r=(t&IY)!==0,i=(t&OY)!==0,s=(t&DY)!==0;if(t){if(a)return i?"se-resize":s?"ne-resize":"e-resize";if(r)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Hke(){Rs!==null&&(document.head.removeChild(Rs),nk=null,Rs=null,qb=-1)}function Xx(e,t,n){var a,r;const i=Bke(e,t);if(nk!==i){if(nk=i,Rs===null&&(Rs=document.createElement("style"),document.head.appendChild(Rs)),qb>=0){var s;(s=Rs.sheet)===null||s===void 0||s.removeRule(qb)}qb=(a=(r=Rs.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${i} !important;}`))!==null&&a!==void 0?a:-1}}function TY(e){return e.type==="keydown"}function NY(e){return e.type.startsWith("pointer")}function CY(e){return e.type.startsWith("mouse")}function kw(e){if(NY(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(CY(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Vke(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Gke(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Wke(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:C2(e),b:C2(t)};let a;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),a=e;It(a,"Stacking order can only be calculated for elements with a common ancestor");const r={a:N2(T2(n.a)),b:N2(T2(n.b))};if(r.a===r.b){const i=a.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const u=i[c];if(u===s.a)return 1;if(u===s.b)return-1}}return Math.sign(r.a-r.b)}const Kke=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Zke(e){var t;const n=getComputedStyle((t=RY(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Yke(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Zke(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Kke.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function T2(e){let t=e.length;for(;t--;){const n=e[t];if(It(n,"Missing node"),Yke(n))return n}return null}function N2(e){return e&&Number(getComputedStyle(e).zIndex)||0}function C2(e){const t=[];for(;e;)t.push(e),e=RY(e);return t}function RY(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const AY=1,IY=2,OY=4,DY=8,qke=Vke()==="coarse";let wi=[],Nu=!1,As=new Map,Tw=new Map;const sm=new Set;function Xke(e,t,n,a,r){var i;const{ownerDocument:s}=t,c={direction:n,element:t,hitAreaMargins:a,setResizeHandlerState:r},u=(i=As.get(s))!==null&&i!==void 0?i:0;return As.set(s,u+1),sm.add(c),Qv(),function(){var m;Tw.delete(e),sm.delete(c);const h=(m=As.get(s))!==null&&m!==void 0?m:1;if(As.set(s,h-1),Qv(),h===1&&As.delete(s),wi.includes(c)){const g=wi.indexOf(c);g>=0&&wi.splice(g,1),Nw(),r("up",!0,null)}}}function Jke(e){const{target:t}=e,{x:n,y:a}=kw(e);Nu=!0,_D({target:t,x:n,y:a}),Qv(),wi.length>0&&(ey("down",e),Nw(),e.preventDefault(),jY(t)||e.stopImmediatePropagation())}function Jx(e){const{x:t,y:n}=kw(e);if(Nu&&e.type!=="pointerleave"&&e.buttons===0&&(Nu=!1,ey("up",e)),!Nu){const{target:a}=e;_D({target:a,x:t,y:n})}ey("move",e),Nw(),wi.length>0&&e.preventDefault()}function Qx(e){const{target:t}=e,{x:n,y:a}=kw(e);Tw.clear(),Nu=!1,wi.length>0&&(e.preventDefault(),jY(t)||e.stopImmediatePropagation()),ey("up",e),_D({target:t,x:n,y:a}),Nw(),Qv()}function jY(e){let t=e;for(;t;){if(t.hasAttribute(Zn.resizeHandle))return!0;t=t.parentElement}return!1}function _D({target:e,x:t,y:n}){wi.splice(0);let a=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(a=e),sm.forEach(r=>{const{element:i,hitAreaMargins:s}=r,c=i.getBoundingClientRect(),{bottom:u,left:d,right:m,top:h}=c,g=qke?s.coarse:s.fine;if(t>=d-g&&t<=m+g&&n>=h-g&&n<=u+g){if(a!==null&&document.contains(a)&&i!==a&&!i.contains(a)&&!a.contains(i)&&Wke(a,i)>0){let x=a,S=!1;for(;x&&!x.contains(i);){if(Gke(x.getBoundingClientRect(),c)){S=!0;break}x=x.parentElement}if(S)return}wi.push(r)}})}function e_(e,t){Tw.set(e,t)}function Nw(){let e=!1,t=!1;wi.forEach(a=>{const{direction:r}=a;r==="horizontal"?e=!0:t=!0});let n=0;Tw.forEach(a=>{n|=a}),e&&t?Xx("intersection",n):e?Xx("horizontal",n):t?Xx("vertical",n):Hke()}let t_;function Qv(){var e;(e=t_)===null||e===void 0||e.abort(),t_=new AbortController;const t={capture:!0,signal:t_.signal};sm.size&&(Nu?(wi.length>0&&As.forEach((n,a)=>{const{body:r}=a;n>0&&(r.addEventListener("contextmenu",Qx,t),r.addEventListener("pointerleave",Jx,t),r.addEventListener("pointermove",Jx,t))}),As.forEach((n,a)=>{const{body:r}=a;r.addEventListener("pointerup",Qx,t),r.addEventListener("pointercancel",Qx,t)})):As.forEach((n,a)=>{const{body:r}=a;n>0&&(r.addEventListener("pointerdown",Jke,t),r.addEventListener("pointermove",Jx,t))}))}function ey(e,t){sm.forEach(n=>{const{setResizeHandlerState:a}=n,r=wi.includes(n);a(e,r,t)})}function Qke(){const[e,t]=w.useState(0);return w.useCallback(()=>t(n=>n+1),[])}function It(e,t){if(!e)throw console.error(t),Error(t)}function Jl(e,t,n=SD){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function To(e,t,n=SD){return Jl(e,t,n)===0}function Da(e,t,n){return Jl(e,t,n)===0}function eTe(e,t,n){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++){const r=e[a],i=t[a];if(!Da(r,i,n))return!1}return!0}function yu({panelConstraints:e,panelIndex:t,size:n}){const a=e[t];It(a!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:r=0,collapsible:i,maxSize:s=100,minSize:c=0}=a;if(Jl(n,c)<0)if(i){const u=(r+c)/2;Jl(n,u)<0?n=r:n=c}else n=c;return n=Math.min(s,n),n=parseFloat(n.toFixed(SD)),n}function cp({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:a,prevLayout:r,trigger:i}){if(Da(e,0))return t;const s=[...t],[c,u]=a;It(c!=null,"Invalid first pivot index"),It(u!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const h=e<0?u:c,g=n[h];It(g,`Panel constraints not found for index ${h}`);const{collapsedSize:v=0,collapsible:x,minSize:S=0}=g;if(x){const y=t[h];if(It(y!=null,`Previous layout not found for panel index ${h}`),Da(y,v)){const E=S-y;Jl(E,Math.abs(e))>0&&(e=e<0?0-E:E)}}}{const h=e<0?c:u,g=n[h];It(g,`No panel constraints found for index ${h}`);const{collapsedSize:v=0,collapsible:x,minSize:S=0}=g;if(x){const y=t[h];if(It(y!=null,`Previous layout not found for panel index ${h}`),Da(y,S)){const E=y-v;Jl(E,Math.abs(e))>0&&(e=e<0?0-E:E)}}}}{const h=e<0?1:-1;let g=e<0?u:c,v=0;for(;;){const S=t[g];It(S!=null,`Previous layout not found for panel index ${g}`);const E=yu({panelConstraints:n,panelIndex:g,size:100})-S;if(v+=E,g+=h,g<0||g>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-x:x}{let g=e<0?c:u;for(;g>=0&&g<n.length;){const v=Math.abs(e)-Math.abs(d),x=t[g];It(x!=null,`Previous layout not found for panel index ${g}`);const S=x-v,y=yu({panelConstraints:n,panelIndex:g,size:S});if(!Da(x,y)&&(d+=x-y,s[g]=y,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(eTe(r,s))return r;{const h=e<0?u:c,g=t[h];It(g!=null,`Previous layout not found for panel index ${h}`);const v=g+d,x=yu({panelConstraints:n,panelIndex:h,size:v});if(s[h]=x,!Da(x,v)){let S=v-x,E=e<0?u:c;for(;E>=0&&E<n.length;){const _=s[E];It(_!=null,`Previous layout not found for panel index ${E}`);const k=_+S,C=yu({panelConstraints:n,panelIndex:E,size:k});if(Da(_,C)||(S-=C-_,s[E]=C),Da(S,0))break;e>0?E--:E++}}}const m=s.reduce((h,g)=>g+h,0);return Da(m,100)?s:r}function tTe({layout:e,panelsArray:t,pivotIndices:n}){let a=0,r=100,i=0,s=0;const c=n[0];It(c!=null,"No pivot index found"),t.forEach((h,g)=>{const{constraints:v}=h,{maxSize:x=100,minSize:S=0}=v;g===c?(a=S,r=x):(i+=S,s+=x)});const u=Math.min(r,100-i),d=Math.max(a,100-s),m=e[c];return{valueMax:u,valueMin:d,valueNow:m}}function lm(e,t=document){return Array.from(t.querySelectorAll(`[${Zn.resizeHandleId}][data-panel-group-id="${e}"]`))}function LY(e,t,n=document){const r=lm(e,n).findIndex(i=>i.getAttribute(Zn.resizeHandleId)===t);return r??null}function $Y(e,t,n){const a=LY(e,t,n);return a!=null?[a,a+1]:[-1,-1]}function nTe(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function MY(e,t=document){if(nTe(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function Cw(e,t=document){const n=t.querySelector(`[${Zn.resizeHandleId}="${e}"]`);return n||null}function rTe(e,t,n,a=document){var r,i,s,c;const u=Cw(t,a),d=lm(e,a),m=u?d.indexOf(u):-1,h=(r=(i=n[m])===null||i===void 0?void 0:i.id)!==null&&r!==void 0?r:null,g=(s=(c=n[m+1])===null||c===void 0?void 0:c.id)!==null&&s!==void 0?s:null;return[h,g]}function aTe({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:a,panelDataArray:r,panelGroupElement:i,setLayout:s}){w.useRef({didWarnAboutMissingResizeHandle:!1}),Pl(()=>{if(!i)return;const c=lm(n,i);for(let u=0;u<r.length-1;u++){const{valueMax:d,valueMin:m,valueNow:h}=tTe({layout:a,panelsArray:r,pivotIndices:[u,u+1]}),g=c[u];if(g!=null){const v=r[u];It(v,`No panel data found for index "${u}"`),g.setAttribute("aria-controls",v.id),g.setAttribute("aria-valuemax",""+Math.round(d)),g.setAttribute("aria-valuemin",""+Math.round(m)),g.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((u,d)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[n,a,r,i]),w.useEffect(()=>{if(!i)return;const c=t.current;It(c,"Eager values not found");const{panelDataArray:u}=c,d=MY(n,i);It(d!=null,`No group found for id "${n}"`);const m=lm(n,i);It(m,`No resize handles found for group id "${n}"`);const h=m.map(g=>{const v=g.getAttribute(Zn.resizeHandleId);It(v,"Resize handle element has no handle id attribute");const[x,S]=rTe(n,v,u,i);if(x==null||S==null)return()=>{};const y=E=>{if(!E.defaultPrevented)switch(E.key){case"Enter":{E.preventDefault();const _=u.findIndex(k=>k.id===x);if(_>=0){const k=u[_];It(k,`No panel data found for index ${_}`);const C=a[_],{collapsedSize:R=0,collapsible:I,minSize:A=0}=k.constraints;if(C!=null&&I){const O=cp({delta:Da(C,R)?A-R:R-C,initialLayout:a,panelConstraints:u.map(M=>M.constraints),pivotIndices:$Y(n,v,i),prevLayout:a,trigger:"keyboard"});a!==O&&s(O)}}break}}};return g.addEventListener("keydown",y),()=>{g.removeEventListener("keydown",y)}});return()=>{h.forEach(g=>g())}},[i,e,t,n,a,r,s])}function R2(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function PY(e,t){const n=e==="horizontal",{x:a,y:r}=kw(t);return n?a:r}function iTe(e,t,n,a,r){const i=n==="horizontal",s=Cw(t,r);It(s,`No resize handle element found for id "${t}"`);const c=s.getAttribute(Zn.groupId);It(c,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=a;const d=PY(n,e),m=MY(c,r);It(m,`No group element found for id "${c}"`);const h=m.getBoundingClientRect(),g=i?h.width:h.height;return(d-u)/g*100}function oTe(e,t,n,a,r,i){if(TY(e)){const s=n==="horizontal";let c=0;e.shiftKey?c=100:r!=null?c=r:c=10;let u=0;switch(e.key){case"ArrowDown":u=s?0:c;break;case"ArrowLeft":u=s?-c:0;break;case"ArrowRight":u=s?c:0;break;case"ArrowUp":u=s?0:-c;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return a==null?0:iTe(e,t,n,a,i)}function sTe({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let a=0,r=100;for(let i=0;i<e.length;i++){const s=n[i];It(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;c!=null&&(a++,t[i]=c,r-=c)}for(let i=0;i<e.length;i++){const s=n[i];It(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;if(c!=null)continue;const u=e.length-a,d=r/u;a++,t[i]=d,r-=d}return t}function qc(e,t,n){t.forEach((a,r)=>{const i=e[r];It(i,`Panel data not found for index ${r}`);const{callbacks:s,constraints:c,id:u}=i,{collapsedSize:d=0,collapsible:m}=c,h=n[u];if(h==null||a!==h){n[u]=a;const{onCollapse:g,onExpand:v,onResize:x}=s;x&&x(a,h),m&&(g||v)&&(v&&(h==null||To(h,d))&&!To(a,d)&&v(),g&&(h==null||!To(h,d))&&To(a,d)&&g())}})}function Eb(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function lTe({defaultSize:e,dragState:t,layout:n,panelData:a,panelIndex:r,precision:i=3}){const s=n[r];let c;return s==null?c=e!=null?e.toFixed(i):"1":a.length===1?c="1":c=s.toFixed(i),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function cTe(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function A2(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function UY(e){return`react-resizable-panels:${e}`}function zY(e){return e.map(t=>{const{constraints:n,id:a,idIsFromProps:r,order:i}=t;return r?a:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function FY(e,t){try{const n=UY(e),a=t.getItem(n);if(a){const r=JSON.parse(a);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function uTe(e,t,n){var a,r;const i=(a=FY(e,n))!==null&&a!==void 0?a:{},s=zY(t);return(r=i[s])!==null&&r!==void 0?r:null}function dTe(e,t,n,a,r){var i;const s=UY(e),c=zY(t),u=(i=FY(e,r))!==null&&i!==void 0?i:{};u[c]={expandToSizes:Object.fromEntries(n.entries()),layout:a};try{r.setItem(s,JSON.stringify(u))}catch(d){console.error(d)}}function I2({layout:e,panelConstraints:t}){const n=[...e],a=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Da(a,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];It(s!=null,`No layout data found for index ${i}`);const c=100/a*s;n[i]=c}let r=0;for(let i=0;i<t.length;i++){const s=n[i];It(s!=null,`No layout data found for index ${i}`);const c=yu({panelConstraints:t,panelIndex:i,size:s});s!=c&&(r+=s-c,n[i]=c)}if(!Da(r,0))for(let i=0;i<t.length;i++){const s=n[i];It(s!=null,`No layout data found for index ${i}`);const c=s+r,u=yu({panelConstraints:t,panelIndex:i,size:c});if(s!==u&&(r-=u-s,n[i]=u,Da(r,0)))break}return n}const fTe=100,up={getItem:e=>(A2(up),up.getItem(e)),setItem:(e,t)=>{A2(up),up.setItem(e,t)}},O2={};function BY({autoSaveId:e=null,children:t,className:n="",direction:a,forwardedRef:r,id:i=null,onLayout:s=null,keyboardResizeBy:c=null,storage:u=up,style:d,tagName:m="div",...h}){const g=xD(i),v=w.useRef(null),[x,S]=w.useState(null),[y,E]=w.useState([]),_=Qke(),k=w.useRef({}),C=w.useRef(new Map),R=w.useRef(0),I=w.useRef({autoSaveId:e,direction:a,dragState:x,id:g,keyboardResizeBy:c,onLayout:s,storage:u}),A=w.useRef({layout:y,panelDataArray:[],panelDataArrayChanged:!1});w.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),w.useImperativeHandle(r,()=>({getId:()=>I.current.id,getLayout:()=>{const{layout:z}=A.current;return z},setLayout:z=>{const{onLayout:L}=I.current,{layout:$,panelDataArray:F}=A.current,W=I2({layout:z,panelConstraints:F.map(X=>X.constraints)});R2($,W)||(E(W),A.current.layout=W,L&&L(W),qc(F,W,k.current))}}),[]),Pl(()=>{I.current.autoSaveId=e,I.current.direction=a,I.current.dragState=x,I.current.id=g,I.current.onLayout=s,I.current.storage=u}),aTe({committedValuesRef:I,eagerValuesRef:A,groupId:g,layout:y,panelDataArray:A.current.panelDataArray,setLayout:E,panelGroupElement:v.current}),w.useEffect(()=>{const{panelDataArray:z}=A.current;if(e){if(y.length===0||y.length!==z.length)return;let L=O2[e];L==null&&(L=cTe(dTe,fTe),O2[e]=L);const $=[...z],F=new Map(C.current);L(e,$,F,y,u)}},[e,y,u]),w.useEffect(()=>{});const O=w.useCallback(z=>{const{onLayout:L}=I.current,{layout:$,panelDataArray:F}=A.current;if(z.constraints.collapsible){const W=F.map(J=>J.constraints),{collapsedSize:X=0,panelSize:ie,pivotIndices:ce}=_l(F,z,$);if(It(ie!=null,`Panel size not found for panel "${z.id}"`),!To(ie,X)){C.current.set(z.id,ie);const q=ou(F,z)===F.length-1?ie-X:X-ie,le=cp({delta:q,initialLayout:$,panelConstraints:W,pivotIndices:ce,prevLayout:$,trigger:"imperative-api"});Eb($,le)||(E(le),A.current.layout=le,L&&L(le),qc(F,le,k.current))}}},[]),M=w.useCallback((z,L)=>{const{onLayout:$}=I.current,{layout:F,panelDataArray:W}=A.current;if(z.constraints.collapsible){const X=W.map(he=>he.constraints),{collapsedSize:ie=0,panelSize:ce=0,minSize:J=0,pivotIndices:q}=_l(W,z,F),le=L??J;if(To(ce,ie)){const he=C.current.get(z.id),oe=he!=null&&he>=le?he:le,Ve=ou(W,z)===W.length-1?ce-oe:oe-ce,xe=cp({delta:Ve,initialLayout:F,panelConstraints:X,pivotIndices:q,prevLayout:F,trigger:"imperative-api"});Eb(F,xe)||(E(xe),A.current.layout=xe,$&&$(xe),qc(W,xe,k.current))}}},[]),P=w.useCallback(z=>{const{layout:L,panelDataArray:$}=A.current,{panelSize:F}=_l($,z,L);return It(F!=null,`Panel size not found for panel "${z.id}"`),F},[]),B=w.useCallback((z,L)=>{const{panelDataArray:$}=A.current,F=ou($,z);return lTe({defaultSize:L,dragState:x,layout:y,panelData:$,panelIndex:F})},[x,y]),K=w.useCallback(z=>{const{layout:L,panelDataArray:$}=A.current,{collapsedSize:F=0,collapsible:W,panelSize:X}=_l($,z,L);return It(X!=null,`Panel size not found for panel "${z.id}"`),W===!0&&To(X,F)},[]),ee=w.useCallback(z=>{const{layout:L,panelDataArray:$}=A.current,{collapsedSize:F=0,collapsible:W,panelSize:X}=_l($,z,L);return It(X!=null,`Panel size not found for panel "${z.id}"`),!W||Jl(X,F)>0},[]),te=w.useCallback(z=>{const{panelDataArray:L}=A.current;L.push(z),L.sort(($,F)=>{const W=$.order,X=F.order;return W==null&&X==null?0:W==null?-1:X==null?1:W-X}),A.current.panelDataArrayChanged=!0,_()},[_]);Pl(()=>{if(A.current.panelDataArrayChanged){A.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:L,storage:$}=I.current,{layout:F,panelDataArray:W}=A.current;let X=null;if(z){const ce=uTe(z,W,$);ce&&(C.current=new Map(Object.entries(ce.expandToSizes)),X=ce.layout)}X==null&&(X=sTe({panelDataArray:W}));const ie=I2({layout:X,panelConstraints:W.map(ce=>ce.constraints)});R2(F,ie)||(E(ie),A.current.layout=ie,L&&L(ie),qc(W,ie,k.current))}}),Pl(()=>{const z=A.current;return()=>{z.layout=[]}},[]);const ae=w.useCallback(z=>{let L=!1;const $=v.current;return $&&window.getComputedStyle($,null).getPropertyValue("direction")==="rtl"&&(L=!0),function(W){W.preventDefault();const X=v.current;if(!X)return()=>null;const{direction:ie,dragState:ce,id:J,keyboardResizeBy:q,onLayout:le}=I.current,{layout:he,panelDataArray:oe}=A.current,{initialLayout:Ce}=ce??{},Ve=$Y(J,z,X);let xe=oTe(W,z,ie,ce,q,X);const Te=ie==="horizontal";Te&&L&&(xe=-xe);const Fe=oe.map(He=>He.constraints),pe=cp({delta:xe,initialLayout:Ce??he,panelConstraints:Fe,pivotIndices:Ve,prevLayout:he,trigger:TY(W)?"keyboard":"mouse-or-touch"}),Oe=!Eb(he,pe);(NY(W)||CY(W))&&R.current!=xe&&(R.current=xe,!Oe&&xe!==0?Te?e_(z,xe<0?AY:IY):e_(z,xe<0?OY:DY):e_(z,0)),Oe&&(E(pe),A.current.layout=pe,le&&le(pe),qc(oe,pe,k.current))}},[]),H=w.useCallback((z,L)=>{const{onLayout:$}=I.current,{layout:F,panelDataArray:W}=A.current,X=W.map(he=>he.constraints),{panelSize:ie,pivotIndices:ce}=_l(W,z,F);It(ie!=null,`Panel size not found for panel "${z.id}"`);const q=ou(W,z)===W.length-1?ie-L:L-ie,le=cp({delta:q,initialLayout:F,panelConstraints:X,pivotIndices:ce,prevLayout:F,trigger:"imperative-api"});Eb(F,le)||(E(le),A.current.layout=le,$&&$(le),qc(W,le,k.current))},[]),Z=w.useCallback((z,L)=>{const{layout:$,panelDataArray:F}=A.current,{collapsedSize:W=0,collapsible:X}=L,{collapsedSize:ie=0,collapsible:ce,maxSize:J=100,minSize:q=0}=z.constraints,{panelSize:le}=_l(F,z,$);le!=null&&(X&&ce&&To(le,W)?To(W,ie)||H(z,ie):le<q?H(z,q):le>J&&H(z,J))},[H]),G=w.useCallback((z,L)=>{const{direction:$}=I.current,{layout:F}=A.current;if(!v.current)return;const W=Cw(z,v.current);It(W,`Drag handle element not found for id "${z}"`);const X=PY($,L);S({dragHandleId:z,dragHandleRect:W.getBoundingClientRect(),initialCursorPosition:X,initialLayout:F})},[]),re=w.useCallback(()=>{S(null)},[]),ne=w.useCallback(z=>{const{panelDataArray:L}=A.current,$=ou(L,z);$>=0&&(L.splice($,1),delete k.current[z.id],A.current.panelDataArrayChanged=!0,_())},[_]),j=w.useMemo(()=>({collapsePanel:O,direction:a,dragState:x,expandPanel:M,getPanelSize:P,getPanelStyle:B,groupId:g,isPanelCollapsed:K,isPanelExpanded:ee,reevaluatePanelConstraints:Z,registerPanel:te,registerResizeHandle:ae,resizePanel:H,startDragging:G,stopDragging:re,unregisterPanel:ne,panelGroupElement:v.current}),[O,x,a,M,P,B,g,K,ee,Z,te,ae,H,G,re,ne]),V={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return w.createElement(Ew.Provider,{value:j},w.createElement(m,{...h,children:t,className:n,id:i,ref:v,style:{...V,...d},[Zn.group]:"",[Zn.groupDirection]:a,[Zn.groupId]:g}))}const HY=w.forwardRef((e,t)=>w.createElement(BY,{...e,forwardedRef:t}));BY.displayName="PanelGroup";HY.displayName="forwardRef(PanelGroup)";function ou(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function _l(e,t,n){const a=ou(e,t),i=a===e.length-1?[a-1,a]:[a,a+1],s=n[a];return{...t.constraints,panelSize:s,pivotIndices:i}}function pTe({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:a}){w.useEffect(()=>{if(e||n==null||a==null)return;const r=Cw(t,a);if(r==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const c=r.getAttribute(Zn.groupId);It(c,`No group element found for id "${c}"`);const u=lm(c,a),d=LY(c,t,a);It(d!==null,`No resize element found for id "${t}"`);const m=s.shiftKey?d>0?d-1:u.length-1:d+1<u.length?d+1:0;u[m].focus();break}}};return r.addEventListener("keydown",i),()=>{r.removeEventListener("keydown",i)}},[a,e,t,n])}function VY({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:a,id:r,onBlur:i,onClick:s,onDragging:c,onFocus:u,onPointerDown:d,onPointerUp:m,style:h={},tabIndex:g=0,tagName:v="div",...x}){var S,y;const E=w.useRef(null),_=w.useRef({onClick:s,onDragging:c,onPointerDown:d,onPointerUp:m});w.useEffect(()=>{_.current.onClick=s,_.current.onDragging=c,_.current.onPointerDown=d,_.current.onPointerUp=m});const k=w.useContext(Ew);if(k===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:R,registerResizeHandle:I,startDragging:A,stopDragging:O,panelGroupElement:M}=k,P=xD(r),[B,K]=w.useState("inactive"),[ee,te]=w.useState(!1),[ae,H]=w.useState(null),Z=w.useRef({state:B});Pl(()=>{Z.current.state=B}),w.useEffect(()=>{if(n)H(null);else{const j=I(P);H(()=>j)}},[n,P,I]);const G=(S=a?.coarse)!==null&&S!==void 0?S:15,re=(y=a?.fine)!==null&&y!==void 0?y:5;w.useEffect(()=>{if(n||ae==null)return;const j=E.current;It(j,"Element ref not attached");let V=!1;return Xke(P,j,C,{coarse:G,fine:re},(L,$,F)=>{if(!$){K("inactive");return}switch(L){case"down":{K("drag"),V=!1,It(F,'Expected event to be defined for "down" action'),A(P,F);const{onDragging:W,onPointerDown:X}=_.current;W?.(!0),X?.();break}case"move":{const{state:W}=Z.current;V=!0,W!=="drag"&&K("hover"),It(F,'Expected event to be defined for "move" action'),ae(F);break}case"up":{K("hover"),O();const{onClick:W,onDragging:X,onPointerUp:ie}=_.current;X?.(!1),ie?.(),V||W?.();break}}})},[G,C,n,re,I,P,ae,A,O]),pTe({disabled:n,handleId:P,resizeHandler:ae,panelGroupElement:M});const ne={touchAction:"none",userSelect:"none"};return w.createElement(v,{...x,children:e,className:t,id:r,onBlur:()=>{te(!1),i?.()},onFocus:()=>{te(!0),u?.()},ref:E,role:"separator",style:{...ne,...h},tabIndex:g,[Zn.groupDirection]:C,[Zn.groupId]:R,[Zn.resizeHandle]:"",[Zn.resizeHandleActive]:B==="drag"?"pointer":ee?"keyboard":void 0,[Zn.resizeHandleEnabled]:!n,[Zn.resizeHandleId]:P,[Zn.resizeHandleState]:B})}VY.displayName="PanelResizeHandle";function na({className:e,...t}){return f.jsx(HY,{"data-slot":"resizable-panel-group",className:De("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function Rn({...e}){return f.jsx(kY,{"data-slot":"resizable-panel",...e})}function Si({withHandle:e,className:t,...n}){return f.jsx(VY,{"data-slot":"resizable-handle",className:De("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&f.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:f.jsx(ahe,{className:"size-2.5"})})})}function eh({className:e,...t}){return f.jsx("kbd",{"data-slot":"kbd",className:De("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e),...t})}function mTe({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:a,onSearchExpand:r,onSearchChange:i,onSearchBlur:s,onClearAll:c,searchInputRef:u}){return f.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?f.jsx(En,{ref:u,placeholder:"Search notifications...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Notifications"}),f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,disabled:a===0,className:"h-8 w-8 p-0",children:f.jsx(Fs,{className:"h-4 w-4"})})}),f.jsx(Rt,{side:"bottom",children:"Clear all"})]})})]})}function Qs({id:e,isSelected:t,isFocused:n,icon:a,title:r,description:i,metadata:s,onClick:c,className:u}){return f.jsx("button",{id:e,type:"button",onClick:c,className:De("w-full text-left cursor-pointer p-2 sm:p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",t&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",n&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",u),children:f.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a&&f.jsx("div",{className:"flex-shrink-0 mt-1",children:f.jsx("div",{className:De("p-2.5 rounded-full transition-colors",t?"bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900":"bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600"),children:a})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"flex items-center gap-2 mb-1",children:f.jsx("h3",{className:De("font-medium truncate font-mono text-sm"),children:r})}),i&&f.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:i})]})]})})}function hTe({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:a,formatRelativeTime:r,listRef:i}){return e.length===0?f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No notifications yet"})}):f.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>f.jsx(Qs,{id:`notification-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,title:f.jsxs("span",{className:"flex items-center gap-3",children:[s.method,!s.read&&f.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const u=r(s.timestamp),d=s.params&&Object.keys(s.params).length>0?Object.keys(s.params).length:0,m=d>0?` | ${d} param${d>1?"s":""}`:"";return u+m})(),onClick:()=>n(s)},s.id))})}function gTe({notification:e,previewMode:t,onTogglePreview:n,onCopy:a,onDownload:r,onFullscreen:i,isCopied:s=!1,onClose:c}){return e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(dd,{className:"h-3 w-3 text-gray-400"}),f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.formatRelativeTime(e.timestamp)})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(Le,{variant:"ghost",size:"sm",onClick:n,className:t?"":"text-purple-600 dark:text-purple-400",children:[t?f.jsx(XN,{className:"h-4 w-4 mr-1"}):f.jsx(LG,{className:"h-4 w-4 mr-1"}),t?"JSON":"Formatted"]}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:a,children:s?f.jsx(ra,{className:"h-4 w-4"}):f.jsx(Lr,{className:"h-4 w-4"})}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:r,children:f.jsx($m,{className:"h-4 w-4"})}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:i,children:f.jsx(eC,{className:"h-4 w-4"})}),c&&f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,children:f.jsx(Ji,{className:"h-4 w-4"})})]})]}),f.jsx("div",{className:"flex-1 overflow-y-auto",children:f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:{method:e.method,timestamp:e.timestamp,read:e.read,params:e.params},filename:`notification-${e.method.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(qN,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a notification to view details"})]})}function ty(e){const n=Date.now()-e,a=Math.floor(n/1e3),r=Math.floor(a/60),i=Math.floor(r/60),s=Math.floor(i/24);return a<60?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function bTe({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:a,clearNotifications:r,serverId:i,isConnected:s}){const[c,u]=w.useState(null),[d,m]=w.useState(""),[h,g]=w.useState(-1),[v,x]=w.useState(!0),[S,y]=w.useState(!1),[E,_]=w.useState(!0),[k,C]=w.useState(!1),R=w.useRef(null),I=w.useRef(null),A=w.useRef(null),O=w.useRef(!1);w.useEffect(()=>{v&&e.length>0&&R.current&&!O.current&&(R.current.scrollTop=0)},[e.length,v]),w.useEffect(()=>{const Z=R.current;if(!Z)return;const G=()=>{Z.scrollTop>0&&(O.current=!0,x(!1))};return Z.addEventListener("scroll",G),()=>Z.removeEventListener("scroll",G)},[]),w.useEffect(()=>{e.length===0&&(O.current=!1,x(!0))},[e.length]),w.useEffect(()=>{c&&!c.read&&n(c.id)},[c,n]),w.useEffect(()=>{S&&A.current&&A.current.focus()},[S]);const M=w.useCallback(()=>{d.trim()||y(!1)},[d]),P=w.useMemo(()=>{if(!d.trim())return e;const Z=d.toLowerCase();return e.filter(G=>G.method.toLowerCase().includes(Z)||JSON.stringify(G.params||{}).toLowerCase().includes(Z))},[e,d]);w.useEffect(()=>{g(-1)},[d]),w.useEffect(()=>{const Z=G=>{const re=G.target;if(re.tagName==="INPUT"||re.tagName==="TEXTAREA"||re.contentEditable==="true"||G.metaKey||G.ctrlKey||G.altKey)return;const j=P;if(G.key==="ArrowDown")G.preventDefault(),g(V=>{const z=V+1;return z>=j.length?0:z});else if(G.key==="ArrowUp")G.preventDefault(),g(V=>{const z=V-1;return z<0?j.length-1:z});else if(G.key==="Enter"&&h>=0){G.preventDefault();const V=P[h];V&&B(V)}};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[h,P]),w.useEffect(()=>{if(h>=0){const Z=`notification-${P[h]?.id}`,G=document.getElementById(Z);G&&G.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,P]);const B=w.useCallback(Z=>{u(Z)},[]),K=w.useCallback(()=>{window.confirm("Are you sure you want to clear all notifications? This cannot be undone.")&&(r(),u(null))},[r]),ee=w.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(Z){console.error("[NotificationsTab] Failed to copy notification:",Z)}},[c]),te=w.useCallback(()=>{if(c)try{const Z=new globalThis.Blob([JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)],{type:"application/json"}),G=URL.createObjectURL(Z),re=document.createElement("a");re.href=G,re.download=`notification-${Date.now()}.json`,document.body.appendChild(re),re.click(),document.body.removeChild(re),URL.revokeObjectURL(G)}catch(Z){console.error("[NotificationsTab] Failed to download notification:",Z)}},[c]),ae=w.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(Z){console.error("[NotificationsTab] Failed to toggle fullscreen:",Z)}},[]),H=c?{method:c.method,params:c.params,timestamp:c.timestamp,read:c.read,formatRelativeTime:ty}:null;return s?f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:40,minSize:30,children:f.jsx(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:f.jsxs(Rn,{defaultSize:75,minSize:30,children:[f.jsx(mTe,{isSearchExpanded:S,searchQuery:d,filteredNotificationsCount:P.length,notificationsCount:e.length,onSearchExpand:()=>y(!0),onSearchChange:m,onSearchBlur:M,onClearAll:K,searchInputRef:A}),f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(hTe,{notifications:P,selectedNotification:c,onNotificationSelect:B,focusedIndex:h,formatRelativeTime:ty,listRef:R})})]})})}),f.jsx(Si,{}),f.jsx(Rn,{defaultSize:60,minSize:40,children:f.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:f.jsx(gTe,{notification:H,previewMode:E,onTogglePreview:()=>_(!E),onCopy:ee,onDownload:te,onFullscreen:ae,onClose:()=>u(null),isCopied:k})})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(qN,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function GY({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:a,secondaryTabTitle:r,primaryCount:i,secondaryCount:s,secondaryIcon:c,primaryIcon:u,searchPlaceholder:d="Search...",onSearchExpand:m,onSearchChange:h,onSearchBlur:g,onTabSwitch:v,searchInputRef:x,primaryTabName:S}){const y=e===S;return f.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?f.jsx(En,{ref:x,placeholder:d,value:n,onChange:E=>h(E.target.value),onBlur:g,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:y?a:r}),y&&f.jsxs(f.Fragment,{children:[f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:i}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})]})}),f.jsxs(Le,{variant:"ghost",size:"sm",onClick:v,className:"gap-2 flex-shrink-0",children:[y?f.jsx(c,{}):f.jsx(u,{}),f.jsx("span",{className:"hidden sm:inline",children:y?r:a}),y&&s>0&&f.jsx(wr,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:s})]})]})}function D2({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:a}){return e.length===0?f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(Hp,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):f.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((r,i)=>f.jsx(Qs,{id:`prompt-${r.name}`,isSelected:t?.name===r.name,isFocused:a===i,icon:f.jsx(Hp,{className:"h-4 w-4"}),title:r.name,description:r.description,metadata:r.arguments&&r.arguments.length>0&&f.jsxs(wr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[r.arguments.length," args"]}),onClick:()=>n(r)},r.name))})}function j2({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:a,savedPromptsCount:r,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return f.jsx(GY,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:a,secondaryCount:r,primaryIcon:Hp,secondaryIcon:dd,searchPlaceholder:"Search prompts...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}function L2({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:a,focusedIndex:r}){return e.length===0?f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(dd,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),f.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):f.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((i,s)=>f.jsx(Qs,{id:`saved-prompt-${i.id}`,isSelected:t?.id===i.id,isFocused:r===s,icon:f.jsx(dd,{className:"h-4 w-4"}),title:i.name,description:`${i.promptName} - ${new Date(i.savedAt).toLocaleString()}`,onClick:()=>n(i)},i.id))})}function vTe({selectedPrompt:e,promptArgs:t,onArgChange:n}){const a=e?.arguments||[];if(!(a.length>0))return f.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const i=s=>{const c=s.name,u=t[c],d=typeof u=="string"?u:JSON.stringify(u);return s.type==="boolean"?f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx("input",{id:c,type:"checkbox",checked:!!u,onChange:m=>n(c,m.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),f.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]})]},c):s.type==="number"?f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsx(En,{id:c,type:"number",value:Number(u)||0,onChange:m=>n(c,Number(m.target.value)),placeholder:s.description||`Enter ${c}`}),s.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):s.type==="array"||s.type==="object"?f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsx(ql,{id:c,value:d,onChange:m=>{try{const h=JSON.parse(m.target.value);n(c,h)}catch{n(c,m.target.value)}},placeholder:s.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),s.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsx(En,{id:c,value:d,onChange:m=>n(c,m.target.value),placeholder:s.description||`Enter ${c}`}),s.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c)};return f.jsx("div",{className:"space-y-4",children:a.map(s=>i(s))})}function $2({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:a,onArgChange:r,onExecute:i,onSave:s}){return w.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&e&&!n&&a&&(u.preventDefault(),i())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n,a,i]),e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[f.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),f.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[f.jsx(Le,{onClick:i,disabled:n||!a,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?f.jsxs(f.Fragment,{children:[f.jsx(ki,{className:"mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):f.jsxs(f.Fragment,{children:[f.jsx(zG,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Execute"}),f.jsx("span",{className:"hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2",children:"⌘↵"})]})}),f.jsxs(Le,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[f.jsx(tC,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),e.description&&f.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),f.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:f.jsx(vTe,{selectedPrompt:e,promptArgs:t,onArgChange:r})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),f.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a prompt from the list to view its details and execute it"})]})}function yTe(e){return"isError"in e&&!e.isError?null:"error"in e&&e.error?e.error:"isError"in e&&e.isError?"An error occurred":null}function M2({results:e,copiedResult:t,onCopy:n}){return f.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:f.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:e.length>0?f.jsx("div",{className:"space-y-4 flex-1 h-full",children:e.map((a,r)=>{const i=a.error||yTe(a.result);return f.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[f.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"Response"}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(dd,{className:"h-3 w-3 text-gray-400"}),f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(a.timestamp).toLocaleTimeString()})]}),a.duration!==void 0&&f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Vp,{className:"h-3 w-3 text-gray-400"}),f.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[a.duration,"ms"]})]}),f.jsx("div",{className:"flex gap-2 ml-auto",children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>n(r,a.result),className:"h-6 px-2",children:t===r?f.jsx(ra,{className:"h-4 w-4"}):f.jsx(Lr,{className:"h-4 w-4"})})})]}),i?f.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[f.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),f.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:i})]}):f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:a.result,filename:`prompt-result-${a.promptName}-${Date.now()}.json`})})]},r)})}):f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsx("div",{className:"text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function ED({serverIds:e,onCountChange:t,onClearRef:n}={}){const[a,r]=w.useState([]),i=w.useRef(null),[s,c]=w.useState(new Set),[u]=w.useState(""),d=v=>{c(x=>{const S=new Set(x);return S.has(v)?S.delete(v):S.add(v),S})},m=async()=>{r([]),c(new Set),t?.(0);try{const v=new URLSearchParams;e&&e.length>0&&v.set("serverIds",e.join(","));const x=await fetch(`/inspector/api/rpc/log?${v.toString()}`,{method:"DELETE"});x.ok||console.warn("[RPC Logger] Failed to clear server buffer:",x.status)}catch(v){console.warn("[RPC Logger] Error clearing server buffer:",v)}},h=w.useMemo(()=>!e||e.length===0?"":[...e].sort().join(","),[e]);w.useEffect(()=>(n&&(n.current=m),()=>{n&&(n.current=null)}),[n,m]),w.useEffect(()=>{t?.(a.length)},[a.length,t]),w.useEffect(()=>{let v=null;try{const x=new URLSearchParams;x.set("replay","3"),x.set("_t",Date.now().toString()),e&&e.length>0&&x.set("serverIds",e.join(","));const S=`/inspector/api/rpc/stream?${x.toString()}`;console.log("[RPC Logger] Connecting to SSE stream:",S),v=new globalThis.EventSource(S),v.onopen=()=>{console.log("[RPC Logger] SSE connection opened")},v.onmessage=y=>{try{const E=JSON.parse(y.data);if(!E||E.type!=="rpc")return;const{serverId:_,direction:k,message:C,timestamp:R}=E,I=C,A=typeof I?.method=="string"?I.method:I?.result!==void 0?"result":I?.error!==void 0?"error":"unknown",O={id:`${R??Date.now()}-${Math.random().toString(36).slice(2)}`,serverId:typeof _=="string"?_:"unknown",direction:typeof k=="string"?k.toUpperCase():"",method:A,timestamp:R??new Date().toISOString(),payload:C};console.log("[RPC Logger] Received RPC event:",{method:A,direction:k,serverId:_}),r(M=>{const P=[O,...M].slice(0,1e3);return t?.(P.length),P})}catch(E){console.error("[RPC Logger] Error parsing SSE message:",E)}},v.onerror=y=>{console.error("[RPC Logger] SSE connection error:",y);try{v?.close()}catch{}}}catch(x){console.error("[RPC Logger] Failed to create SSE connection:",x)}return()=>{try{v?.close(),console.log("[RPC Logger] SSE connection closed")}catch{}}},[h]);const g=w.useMemo(()=>{let v=a;if(e&&e.length>0){const x=new Set(e);v=v.filter(S=>x.has(S.serverId))}if(u.trim()){const x=u.toLowerCase();v=v.filter(S=>S.serverId.toLowerCase().includes(x)||S.method.toLowerCase().includes(x)||S.direction.toLowerCase().includes(x)||JSON.stringify(S.payload).toLowerCase().includes(x))}return v},[a,u,e]);return f.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:f.jsx("div",{ref:i,className:"flex-1 min-h-0 overflow-y-auto",children:g.length===0?f.jsxs("div",{className:"text-center py-8",children:[f.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages yet"}),f.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:"JSON-RPC messages will appear here"})]}):g.map(v=>{const x=s.has(v.id);return f.jsxs("div",{className:"group hover:bg-muted/50 transition-all duration-200 overflow-hidden",children:[f.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>d(v.id),children:[f.jsx("div",{className:"flex-shrink-0",children:x?f.jsx(rc,{className:"h-3 w-3 text-muted-foreground transition-transform"}):f.jsx($G,{className:"h-3 w-3 text-muted-foreground transition-transform"})}),f.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[f.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:new Date(v.timestamp).toLocaleTimeString()}),f.jsx("span",{className:`flex items-center justify-center px-1 py-0.5 rounded ${v.direction==="RECEIVE"?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-green-500/10 text-green-600 dark:text-green-400"}`,title:v.direction==="RECEIVE"?"Incoming":"Outgoing",children:v.direction==="RECEIVE"?f.jsx(mme,{className:"h-3 w-3"}):f.jsx(gme,{className:"h-3 w-3"})}),f.jsx("span",{className:"text-xs font-mono text-foreground truncate",children:v.method})]})]}),x&&f.jsx("div",{className:"border-t bg-muted/20",children:f.jsx("div",{className:"p-3",children:f.jsx("div",{className:"max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2",children:f.jsx(Xn,{data:v.payload})})})})]},v.id)})})})}const P2="mcp-inspector-saved-prompts";function WY({ref:e,prompts:t,callPrompt:n,serverId:a,isConnected:r}){const[i,s]=w.useState(null),[c,u]=w.useState(null),{selectedPromptName:d,setSelectedPromptName:m}=ac(),[h,g]=w.useState({}),[v,x]=w.useState([]),[S,y]=w.useState(!1),[E,_]=w.useState(null),[k,C]=w.useState(""),[R,I]=w.useState("prompts"),[A,O]=w.useState([]),[M,P]=w.useState(!1),[B,K]=w.useState(""),[ee,te]=w.useState(!1),[ae,H]=w.useState(-1),Z=w.useRef(null),[G,re]=w.useState(!1),[ne,j]=w.useState("list"),[V,z]=w.useState(0),[L,$]=w.useState(!0),F=w.useRef(null),W=w.useRef(null);w.useEffect(()=>{const xe=()=>{re(window.innerWidth<1024)};return xe(),window.addEventListener("resize",xe),()=>window.removeEventListener("resize",xe)},[]),w.useEffect(()=>{j(i?"detail":"list")},[i]),w.useEffect(()=>{G&&v.length>0&&!S&&j("response")},[v,S,G]),w.useImperativeHandle(e,()=>({focusSearch:()=>{te(!0),setTimeout(()=>{Z.current&&Z.current.focus()},0)},blurSearch:()=>{C(""),te(!1),Z.current&&Z.current.blur()}})),w.useEffect(()=>{try{const xe=localStorage.getItem(P2);if(xe){const Te=JSON.parse(xe);O(Te)}}catch(xe){console.error("[PromptsTab] Failed to load saved prompts:",xe)}},[]);const X=w.useCallback(xe=>{try{localStorage.setItem(P2,JSON.stringify(xe))}catch(Te){console.error("[PromptsTab] Failed to save prompts:",Te)}},[]);w.useEffect(()=>{ee&&Z.current&&Z.current.focus()},[ee]);const ie=w.useCallback(()=>{k.trim()||te(!1)},[k]),ce=w.useMemo(()=>{if(!k.trim())return t;const xe=k.toLowerCase();return t.filter(Te=>Te.name.toLowerCase().includes(xe)||Te.description?.toLowerCase().includes(xe))},[t,k]),J=w.useCallback(xe=>{s(xe);const Te={};xe.arguments&&xe.arguments.forEach(Fe=>{Fe.default!==void 0?Te[Fe.name]=Fe.default:Fe.type==="string"?Te[Fe.name]="":Fe.type==="number"?Te[Fe.name]=0:Fe.type==="boolean"?Te[Fe.name]=!1:Fe.type==="array"?Te[Fe.name]=[]:Fe.type==="object"&&(Te[Fe.name]={})}),g(Te)},[]),q=w.useCallback(xe=>{const Te=t.find(Fe=>Fe.name===xe.promptName);Te&&(s(Te),g(xe.args),u(xe))},[t]);w.useEffect(()=>{H(-1)},[k,R]),w.useEffect(()=>{const xe=Te=>{const Fe=Te.target;if(Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.contentEditable==="true"||Te.metaKey||Te.ctrlKey||Te.altKey)return;const Oe=R==="prompts"?ce:A;if(Te.key==="ArrowDown")Te.preventDefault(),H(He=>{const Se=He+1;return Se>=Oe.length?0:Se});else if(Te.key==="ArrowUp")Te.preventDefault(),H(He=>{const Se=He-1;return Se<0?Oe.length-1:Se});else if(Te.key==="Enter"&&ae>=0)if(Te.preventDefault(),R==="prompts"){const He=ce[ae];He&&J(He)}else{const He=A[ae];He&&q(He)}};return document.addEventListener("keydown",xe),()=>document.removeEventListener("keydown",xe)},[ae,ce,A,R,J,q]),w.useEffect(()=>{if(ae>=0){const xe=R==="prompts"?`prompt-${ce[ae]?.name}`:`saved-prompt-${A[ae]?.id}`,Te=document.getElementById(xe);Te&&Te.scrollIntoView({behavior:"smooth",block:"nearest"})}},[ae,ce,A,R]),w.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:d,promptsCount:t.length,currentSelectedPrompt:i?.name}),d&&t.length>0){const xe=t.find(Te=>Te.name===d);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:d,promptFound:!!xe,promptName:xe?.name,shouldSelect:xe&&i?.name!==xe.name}),xe&&i?.name!==xe.name){console.warn("[PromptsTab] Selecting prompt:",xe.name),m(null);const Te=setTimeout(()=>{J(xe);const Fe=document.getElementById(`prompt-${xe.name}`);Fe&&(console.warn("[PromptsTab] Scrolling to prompt element"),Fe.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(Te)}}},[d,t,i,J,m]);const le=w.useCallback((xe,Te)=>{g(Fe=>({...Fe,[xe]:Te}))},[]),he=w.useCallback(async()=>{if(!i||S)return;y(!0);const xe=Date.now();try{const Te=await n(i.name,h),Fe=Date.now()-xe;vr.getInstance().capture(new JU({promptName:i.name,serverId:a,success:!0})).catch(()=>{}),x(Oe=>[{promptName:i.name,args:h,result:Te,timestamp:xe,duration:Fe},...Oe])}catch(Te){vr.getInstance().capture(new JU({promptName:i.name,serverId:a,success:!1,error:Te instanceof Error?Te.message:"Unknown error"})).catch(()=>{});const pe={promptName:i.name,args:h,result:null,error:Te instanceof Error?Te.message:String(Te),timestamp:xe,duration:Date.now()-xe};x(Oe=>[pe,...Oe])}finally{y(!1)}},[i,h,S,n,a]),oe=w.useCallback(async(xe,Te)=>{try{await navigator.clipboard.writeText(JSON.stringify(Te,null,2)),_(xe),setTimeout(()=>_(null),2e3)}catch(Fe){console.error("[PromptsTab] Failed to copy result:",Fe)}},[]),Ce=w.useCallback(()=>{i&&(K(""),P(!0))},[i]),Ve=w.useCallback(xe=>{X(A.filter(Te=>Te.id!==xe)),c?.id===xe&&u(null)},[A,X,c]);return G?f.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[ne!=="list"&&f.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[f.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>{ne==="response"?j("detail"):(s(null),j("list"))},className:"p-0 h-8 w-8",children:f.jsx(qy,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex items-center text-sm font-medium",children:[f.jsx("button",{onClick:()=>{s(null),j("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),ne!=="list"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("button",{onClick:()=>{ne==="response"&&j("detail")},className:ne==="detail"?"text-foreground hover:underline":ne==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),ne==="response"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),f.jsx("div",{className:"flex-1 relative overflow-hidden",children:f.jsxs(rw,{initial:!1,mode:"popLayout",children:[ne==="list"&&f.jsxs(ya.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[f.jsx(j2,{activeTab:R,isSearchExpanded:ee,searchQuery:k,filteredPromptsCount:ce.length,savedPromptsCount:A.length,onSearchExpand:()=>te(!0),onSearchChange:C,onSearchBlur:ie,onTabSwitch:()=>I(R==="prompts"?"saved":"prompts"),searchInputRef:Z}),R==="prompts"?f.jsx(D2,{prompts:ce,selectedPrompt:i,onPromptSelect:J,focusedIndex:ae}):f.jsx(L2,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:q,onDeletePrompt:Ve,focusedIndex:ae})]},"list"),ne==="detail"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-10",children:f.jsx($2,{selectedPrompt:i,promptArgs:h,isExecuting:S,isConnected:r,onArgChange:le,onExecute:he,onSave:Ce})},"detail"),ne==="response"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-20",children:f.jsx(M2,{results:v,copiedResult:E,onCopy:oe})},"response")]})})]}):f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:33,className:"flex flex-col h-full relative",children:f.jsxs(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[f.jsx(Rn,{defaultSize:75,minSize:30,children:f.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[f.jsx(j2,{activeTab:R,isSearchExpanded:ee,searchQuery:k,filteredPromptsCount:ce.length,savedPromptsCount:A.length,onSearchExpand:()=>te(!0),onSearchChange:C,onSearchBlur:ie,onTabSwitch:()=>I(R==="prompts"?"saved":"prompts"),searchInputRef:Z}),R==="prompts"?f.jsx(D2,{prompts:ce,selectedPrompt:i,onPromptSelect:J,focusedIndex:ae}):f.jsx(L2,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:q,onDeletePrompt:Ve,focusedIndex:ae})]})}),f.jsx(Si,{withHandle:!0}),f.jsxs(Rn,{ref:F,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>$(!0),onExpand:()=>$(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[f.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),L?(F.current?.resize(25),$(!1)):(F.current?.resize(5),$(!0))},children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),V>0&&f.jsx(wr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:V}),V>0&&!L&&f.jsx(Le,{variant:"ghost",size:"sm",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),W.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:f.jsx(Fs,{className:"h-3.5 w-3.5"})})]}),f.jsx(rc,{className:`h-4 w-4 text-muted-foreground transition-transform ${L?"rotate-180":""}`})]}),!L&&f.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:f.jsx(ED,{serverIds:[a],onCountChange:z,onClearRef:W})})]})]})}),f.jsx(Si,{withHandle:!0}),f.jsx(Rn,{defaultSize:67,children:f.jsxs(na,{direction:"vertical",children:[f.jsx(Rn,{defaultSize:40,children:f.jsx($2,{selectedPrompt:i,promptArgs:h,isExecuting:S,isConnected:r,onArgChange:le,onExecute:he,onSave:Ce})}),f.jsx(Si,{withHandle:!0}),f.jsx(Rn,{defaultSize:50,children:f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(M2,{results:v,copiedResult:E,onCopy:oe})})})]})})]})}WY.displayName="PromptsTab";function Cu(e){if(!e?.mimeType)return!1;const t=e.mimeType.toLowerCase();return t==="text/html"||t==="text/html+skybridge"||t==="text/uri-list"||t.startsWith("application/vnd.mcp-ui.remote-dom")}function wTe(e){return{uri:e.uri,mimeType:e.mimeType,text:e.text,blob:e.blob}}function KY({resource:e,onUIAction:t,className:n}){const a=async i=>t?.(i),r=wTe(e);return f.jsx("div",{className:n,children:f.jsx(wD,{resource:r,onUIAction:a,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[Ike,Ake,Oke,Dke],library:yD}})})}function STe(e){if("error"in e&&e.error)return e.error;if(!("isError"in e&&e.isError))return null;if("contents"in e&&Array.isArray(e.contents)){const t=e.contents.filter(n=>"text"in n).map(n=>n.text).filter(Boolean);if(t.length>0)return t.join(`
1661
1661
  `)}return"An error occurred"}function U2({result:e,isLoading:t,previewMode:n,serverId:a,readResource:r,onTogglePreview:i,onCopy:s,onDownload:c,onFullscreen:u,isCopied:d=!1}){let m=[],h;if(e?.resourceAnnotations&&(m=Object.keys(e.resourceAnnotations).filter(y=>y.startsWith("openai/")),h=e.resourceAnnotations["openai/outputTemplate"]),e?.result?.contents?.[0]?._meta){const y=e.result.contents[0]._meta,E=Object.keys(y).filter(_=>_.startsWith("openai/"));E.length>0&&(m=[...m,...E]),!h&&y["openai/outputTemplate"]&&(h=y["openai/outputTemplate"]),!h&&e.uri&&e.uri.startsWith("ui://widget/")&&(h=e.uri)}const g=!!(m.length>0&&h&&typeof h=="string"&&a&&r);if(t)return f.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:f.jsx(ki,{className:"size-5"})});if(!e)return f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),f.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});const v=e.error||STe(e.result);if(v)return f.jsx("div",{className:"p-4",children:f.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[f.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),f.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:v})]})});const x=e?.result?.contents&&Array.isArray(e.result.contents)&&e.result.contents.some(y=>y.mimeType&&Cu(y)),S=x?e.result.contents.filter(y=>y.mimeType&&Cu(y)):[];return f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(dd,{className:"h-3 w-3 text-gray-400"}),f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),(()=>{const y=e?.duration??e.result?.duration??e.result?.metrics?.durationMs;return y!==void 0?f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Vp,{className:"h-3 w-3 text-gray-400"}),f.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[y,"ms"]})]}):null})(),x&&f.jsx(wr,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),g&&f.jsx(wr,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 border-none border-blue-200 dark:border-blue-800/50 text-blue-600 dark:text-blue-400",children:"OpenAI Widget"})]}),f.jsxs("div",{className:"flex items-center gap-1",children:[(x||g)&&f.jsxs(Le,{variant:"ghost",size:"sm",onClick:i,className:n?"":"text-purple-600 dark:text-purple-400",children:[n?f.jsx(XN,{className:"h-4 w-4 mr-1"}):f.jsx(LG,{className:"h-4 w-4 mr-1"}),n?"JSON":g?"Component":"Preview"]}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:s,children:d?f.jsx(ra,{className:"h-4 w-4"}):f.jsx(Lr,{className:"h-4 w-4"})}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,children:f.jsx($m,{className:"h-4 w-4"})}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:u,children:f.jsx(eC,{className:"h-4 w-4"})})]})]}),f.jsx("div",{className:"flex-1 overflow-y-auto",children:g&&a&&r&&h?n?f.jsx("div",{className:"flex-1 h-full",children:f.jsx(mD,{componentUrl:h,toolName:e.uri,toolArgs:{},toolResult:e.result,serverId:a,readResource:r,className:"w-full h-full relative flex p-4"})}):f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})}):x?n?f.jsxs("div",{className:"space-y-0 h-full",children:[S.map((y,E)=>f.jsx("div",{className:"mx-0 size-full",children:f.jsx("div",{className:"w-full h-full",children:f.jsx(KY,{resource:y,className:"w-full h-full"})})},`mcp-ui-${y.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(e.result.contents&&Array.isArray(e.result.contents)){const y=e.result.contents.filter(E=>!(E.mimeType&&Cu(E)));if(y.length>0)return f.jsx("div",{className:"px-4",children:f.jsx(Xn,{data:y,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-non-ui-${Date.now()}.json`})})}return null})()]}):f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-mcp-ui-${Date.now()}.json`})}):f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]})}function xTe(e,t){if(!e&&!t)return f.jsx(Jme,{className:"h-5 w-5"});const n=(e||t||"").toLowerCase();return n.includes("image")?f.jsx(Yme,{className:"h-5 w-5"}):n.includes("json")||n.includes("javascript")||n.includes("typescript")?f.jsx(Kme,{className:"h-5 w-5"}):n.includes("html")||n.includes("xml")?f.jsx(nhe,{className:"h-5 w-5"}):n.includes("database")||n.includes("sql")?f.jsx(Xy,{className:"h-5 w-5"}):f.jsx(JN,{className:"h-5 w-5"})}function z2({resources:e,selectedResource:t,onResourceSelect:n,focusedIndex:a}){return e.length===0?f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(Xy,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):f.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((r,i)=>{const s=xTe(r.mimeType,r.uri),c=[r.description,r.mimeType&&f.jsx("span",{className:"font-mono",children:r.mimeType},"mime")].filter(Boolean);return f.jsx(Qs,{id:`resource-${r.uri}`,isSelected:t?.uri===r.uri,isFocused:a===i,icon:s,title:r.name,description:c.length>0?f.jsxs("span",{className:"flex flex-col gap-1",children:[r.description&&f.jsx("span",{children:r.description}),r.mimeType&&f.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:r.mimeType})]}):void 0,onClick:()=>n(r)},r.uri)})})}function F2({isSearchExpanded:e,searchQuery:t,filteredResourcesCount:n,onSearchExpand:a,onSearchChange:r,onSearchBlur:i,searchInputRef:s}){return f.jsx("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:f.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?f.jsx(En,{ref:s,placeholder:"Search resources...",value:t,onChange:c=>r(c.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})})})}function ZY({ref:e,resources:t,readResource:n,serverId:a,isConnected:r}){const[i,s]=w.useState(null),{selectedResourceUri:c,setSelectedResourceUri:u}=ac(),[d,m]=w.useState(null),[h,g]=w.useState(!1),[v,x]=w.useState(""),[S]=w.useState("resources"),[y,E]=w.useState(!0),[_,k]=w.useState(!1),[C,R]=w.useState(-1),[I,A]=w.useState(!1),O=w.useRef(null),M=w.useRef(null),[P,B]=w.useState(!1),[K,ee]=w.useState("list"),[te,ae]=w.useState(0),[H,Z]=w.useState(!0),G=w.useRef(null),re=w.useRef(null);w.useEffect(()=>{const F=()=>{B(window.innerWidth<1024)};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]),w.useEffect(()=>{ee(i?"detail":"list")},[i]),w.useImperativeHandle(e,()=>({focusSearch:()=>{k(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{x(""),k(!1),O.current&&O.current.blur()}})),w.useEffect(()=>{_&&O.current&&O.current.focus()},[_]);const ne=w.useCallback(()=>{v.trim()||k(!1)},[v]),j=w.useMemo(()=>{if(!v)return t;const F=v.toLowerCase();return t.filter(W=>W.name.toLowerCase().includes(F)||W.description?.toLowerCase().includes(F)||W.uri.toLowerCase().includes(F))},[t,v]),V=w.useCallback(async F=>{if(s(F),r){g(!0);const W=Date.now();try{const X=await n(F.uri);vr.getInstance().capture(new XU({resourceUri:F.uri,serverId:a,success:!0})).catch(()=>{}),m({uri:F.uri,result:X,timestamp:W,resourceAnnotations:F.annotations})}catch(X){vr.getInstance().capture(new XU({resourceUri:F.uri,serverId:a,success:!1,error:X instanceof Error?X.message:"Unknown error"})).catch(()=>{}),m({uri:F.uri,result:null,error:X instanceof Error?X.message:"Unknown error",timestamp:W,resourceAnnotations:F.annotations})}finally{g(!1)}}},[n,a,r]);w.useEffect(()=>{R(-1)},[v,S]),w.useEffect(()=>{const F=W=>{const X=W.target;if(X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.contentEditable==="true"||W.metaKey||W.ctrlKey||W.altKey)return;const ce=j;if(W.key==="ArrowDown")W.preventDefault(),R(J=>{const q=J+1;return q>=ce.length?0:q});else if(W.key==="ArrowUp")W.preventDefault(),R(J=>{const q=J-1;return q<0?ce.length-1:q});else if(W.key==="Enter"&&C>=0){W.preventDefault();const J=j[C];J&&V(J)}};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[C,j,V]),w.useEffect(()=>{if(C>=0){const F=`resource-${j[C]?.uri}`,W=document.getElementById(F);W&&W.scrollIntoView({behavior:"smooth",block:"nearest"})}},[C,j]),w.useEffect(()=>{if(c&&t.length>0){const F=t.find(W=>W.uri===c);F&&i?.uri!==F.uri&&(u(null),setTimeout(()=>{V(F);const W=document.getElementById(`resource-${F.uri}`);W&&W.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,t,i,V,u]);const z=w.useCallback(async()=>{if(d)try{await navigator.clipboard.writeText(JSON.stringify(d.result,null,2)),A(!0),setTimeout(()=>A(!1),2e3)}catch(F){console.error("[ResourcesTab] Failed to copy result:",F)}},[d]),L=w.useCallback(()=>{if(d)try{const F=new globalThis.Blob([JSON.stringify(d.result,null,2)],{type:"application/json"}),W=URL.createObjectURL(F),X=document.createElement("a");X.href=W,X.download=`resource-${Date.now()}.json`,document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(W)}catch(F){console.error("[ResourcesTab] Failed to download result:",F)}},[d]),$=w.useCallback(async()=>{if(M.current)try{document.fullscreenElement?await document.exitFullscreen():await M.current.requestFullscreen()}catch(F){console.error("[ResourcesTab] Failed to toggle fullscreen:",F)}},[]);return P?f.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[K!=="list"&&f.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[f.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>{s(null),ee("list")},className:"p-0 h-8 w-8",children:f.jsx(qy,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex items-center text-sm font-medium",children:[f.jsx("button",{onClick:()=>{s(null),ee("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Resources"}),K==="detail"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("span",{className:"text-foreground",children:"Content"})]})]})]}),f.jsx("div",{className:"flex-1 relative overflow-hidden",children:f.jsxs(rw,{initial:!1,mode:"popLayout",children:[K==="list"&&f.jsxs(ya.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[f.jsx(F2,{activeTab:S,isSearchExpanded:_,searchQuery:v,filteredResourcesCount:j.length,onSearchExpand:()=>k(!0),onSearchChange:x,onSearchBlur:ne,onTabSwitch:()=>{},searchInputRef:O}),f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(z2,{resources:j,selectedResource:i,onResourceSelect:V,focusedIndex:C})})]},"list"),K==="detail"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-white dark:bg-zinc-900 z-10",children:f.jsx("div",{ref:M,className:"h-full",children:f.jsx(U2,{result:d,isLoading:h,previewMode:y,serverId:a,readResource:n,onTogglePreview:()=>E(!y),onCopy:z,onDownload:L,onFullscreen:$,isCopied:I})})},"detail")]})})]}):f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:25,children:f.jsxs(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[f.jsx(Rn,{defaultSize:75,minSize:30,children:f.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[f.jsx(F2,{activeTab:S,isSearchExpanded:_,searchQuery:v,filteredResourcesCount:j.length,onSearchExpand:()=>k(!0),onSearchChange:x,onSearchBlur:ne,onTabSwitch:()=>{},searchInputRef:O}),f.jsx(z2,{resources:j,selectedResource:i,onResourceSelect:V,focusedIndex:C})]})}),f.jsx(Si,{withHandle:!0}),f.jsxs(Rn,{ref:G,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>Z(!0),onExpand:()=>Z(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[f.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:F=>{F.preventDefault(),F.stopPropagation(),H?(G.current?.resize(25),Z(!1)):(G.current?.resize(5),Z(!0))},children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),te>0&&f.jsx(wr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:te}),te>0&&!H&&f.jsx(Le,{variant:"ghost",size:"sm",onClick:F=>{F.preventDefault(),F.stopPropagation(),re.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:f.jsx(Fs,{className:"h-3.5 w-3.5"})})]}),f.jsx(rc,{className:`h-4 w-4 text-muted-foreground transition-transform ${H?"":"rotate-180"}`})]}),!H&&f.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:f.jsx(ED,{serverIds:[a],onCountChange:ae,onClearRef:re})})]})]})}),f.jsx(Si,{}),f.jsx(Rn,{defaultSize:50,children:f.jsx(na,{direction:"vertical",children:f.jsx(Rn,{defaultSize:70,children:f.jsx("div",{ref:M,className:"h-full bg-white dark:bg-zinc-900",children:f.jsx(U2,{result:d,isLoading:h,previewMode:y,serverId:a,readResource:n,onTogglePreview:()=>E(!y),onCopy:z,onDownload:L,onFullscreen:$,isCopied:I})})})})})]})}ZY.displayName="ResourcesTab";function B2({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:a,focusedIndex:r}){if(e.length===0)return f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(Xy,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),f.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const i=(s,c)=>{s.stopPropagation(),c()};return f.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((s,c)=>f.jsxs("div",{className:"relative group",children:[f.jsx(Qs,{id:`saved-${s.id}`,isSelected:t?.id===s.id,isFocused:r===c,icon:f.jsx(Rv,{className:"h-4 w-4"}),title:s.name,description:s.toolName,metadata:f.jsx("div",{className:"flex flex-col gap-1",children:f.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(s.savedAt).toLocaleString()})}),onClick:()=>n(s)}),f.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"secondary",size:"sm",onClick:u=>i(u,()=>a(s.id)),className:"h-8 w-8 p-0",children:f.jsx(Fs,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:f.jsx("p",{children:"Delete saved request"})})]})})]},s.id))})}function H2({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:a,onSave:r,onCancel:i}){return e?f.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:i,children:f.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:s=>s.stopPropagation(),children:[f.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx(Kt,{htmlFor:"request-name",children:"Request Name (optional)"}),f.jsx(En,{id:"request-name",value:t,onChange:s=>a(s.target.value),placeholder:n,className:"mt-2",onKeyDown:s=>{s.key==="Enter"&&r()},autoFocus:!0})]}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Le,{variant:"outline",onClick:i,children:"Cancel"}),f.jsxs(Le,{onClick:r,children:[f.jsx(tC,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function YY(e,t){if(!e?.$ref)return e;const n=e.$ref;if(n.startsWith("#/")){const a=n.substring(2).split("/");let r=t;for(const i of a)if(r&&typeof r=="object"&&i in r)r=r[i];else return console.warn(`Could not resolve $ref: ${n}`),e;return r}return e}function _Te(e,t){if(e.anyOf&&Array.isArray(e.anyOf)){const n=e.anyOf.find(a=>a.type!=="null");if(n)return{...YY(n,t),nullable:!0}}return e}function ETe(e){return Array.isArray(e.enum)?e.enum:null}function V2({selectedTool:e,toolArgs:t,onArgChange:n}){const a=e?.inputSchema?.properties||{},r=e?.inputSchema?.required||[];return Object.keys(a).length>0?f.jsx("div",{className:"space-y-4",children:Object.entries(a).map(([s,c])=>{const u=e?.inputSchema||{};let d=_Te(c,u);d=YY(d,u);const m=ETe(d),h=d.type==="string"&&m!==null,g=d;g.required=r.includes(s);const v=t[s];let x="";return v!=null&&(typeof v=="string"?x=v:typeof v=="object"&&v!==null?x=JSON.stringify(v,null,2):x=String(v)),g.type==="object"||g.type==="array"?f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:s,className:"text-sm font-medium",children:[s,g?.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsx(ql,{id:s,value:x,onChange:y=>n(s,y.target.value),placeholder:g?.description||`Enter ${s}`,className:"min-h-[100px]"}),g?.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s):h&&m?f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:s,className:"text-sm font-medium",children:[s,g.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsxs(Io,{value:String(t[s]||""),onValueChange:y=>n(s,y),children:[f.jsx(Do,{id:s,className:"w-full",children:f.jsx(Oo,{placeholder:g.description||"Select an option"})}),f.jsx(jo,{children:m.map((y,E)=>f.jsx(Ar,{value:y,children:g.enumNames?.[E]||y},y))})]}),g.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s):f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:s,className:"text-sm font-medium",children:[s,g?.required&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),f.jsx(En,{id:s,value:x,onChange:y=>n(s,y.target.value),placeholder:g?.description||`Enter ${s}`}),g?.description&&f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s)})}):f.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function G2({selectedTool:e,toolArgs:t,isExecuting:n,isConnected:a,onArgChange:r,onExecute:i,onSave:s,onCancel:c}){const[u,d]=w.useState(!1),[m,h]=w.useState(()=>{if(typeof window<"u"){const S=localStorage.getItem("mcp-inspector-show-tool-metadata");return S?JSON.parse(S):!1}return!1}),[g,v]=w.useState(!1);w.useEffect(()=>{typeof window<"u"&&localStorage.setItem("mcp-inspector-show-tool-metadata",JSON.stringify(m))},[m]);const x=()=>{if(!e)return;const S={name:e.name,description:e.description||"",_meta:e._meta};navigator.clipboard.writeText(JSON.stringify(S,null,2)),v(!0),setTimeout(()=>v(!1),2e3)};return w.useEffect(()=>{const S=y=>{(y.metaKey||y.ctrlKey)&&y.key==="Enter"&&e&&!n&&a&&(y.preventDefault(),i()),y.key==="Escape"&&n&&c&&(y.preventDefault(),c())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[e,n,a,i,c]),e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx("div",{className:"flex-shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-4 sm:pr-4",children:f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[f.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),f.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsxs(Le,{variant:m?"default":"outline",onClick:()=>h(!m),disabled:n,size:"sm",className:"lg:size-default gap-2",title:"Toggle tool metadata",children:[f.jsx(XN,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Metadata"})]})}),f.jsx(Rt,{children:f.jsx("p",{children:"Show tool definition metadata"})})]}),f.jsxs(Le,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[f.jsx(tC,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),n&&c?f.jsxs(Nt,{open:u?void 0:!1,children:[f.jsx(Ct,{asChild:!0,children:f.jsx("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),className:"relative",children:f.jsx(Le,{onClick:c,variant:u?"destructive":"default",size:"sm",className:"lg:size-default gap-2 transition-all",children:u?f.jsxs(f.Fragment,{children:[f.jsx(Ji,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Cancel"}),f.jsx("span",{className:"hidden sm:inline text-[12px] border border-current p-1 rounded-full ml-2",children:"Esc"})]}):f.jsxs(f.Fragment,{children:[f.jsx(ki,{className:"mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]})})})}),f.jsx(Rt,{children:f.jsx("p",{children:"Hover to cancel (or press Esc)"})})]}):f.jsx(Le,{onClick:i,disabled:n||!a,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?f.jsxs(f.Fragment,{children:[f.jsx(ki,{className:"mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):f.jsxs(f.Fragment,{children:[f.jsx(zG,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Execute"}),f.jsx("span",{className:"hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2",children:"⌘↵"})]})})]})]}),e.description&&f.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),m?f.jsxs("div",{className:"flex-1 overflow-hidden flex gap-4 px-3 sm:px-6 pb-4",children:[f.jsx("div",{className:"flex-1 min-w-0 overflow-y-auto",children:f.jsx(V2,{selectedTool:e,toolArgs:t,onArgChange:r})}),f.jsxs("div",{className:"w-2/5 flex flex-col bg-zinc-50 dark:bg-zinc-900/50 rounded border border-zinc-200 dark:border-zinc-800 overflow-hidden",children:[f.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-zinc-200 dark:border-zinc-800 flex-shrink-0",children:[f.jsx("h4",{className:"text-sm font-medium",children:"Tool Definition"}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:x,className:"h-7 w-7 p-0",title:"Copy metadata",children:g?f.jsx(ra,{className:"h-3.5 w-3.5 text-green-600"}):f.jsx(Lr,{className:"h-3.5 w-3.5"})})]}),f.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:f.jsx("pre",{className:"text-xs font-mono text-zinc-700 dark:text-zinc-300 whitespace-pre-wrap break-words",children:JSON.stringify({name:e.name,description:e.description||"(no description)",_meta:e._meta||null},null,2)})})]})]}):f.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:f.jsx(V2,{selectedTool:e,toolArgs:t,onArgChange:r})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),f.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}function W2(e){const n=Date.now()-e,a=Math.floor(n/1e3),r=Math.floor(a/60),i=Math.floor(r/60),s=Math.floor(i/24);return a<10?"now":a<60?`${a}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${s}d ago`}function kTe(e){if(!e?.isError)return null;if(e.content&&Array.isArray(e.content)){const t=e.content.filter(n=>n.type==="text").map(n=>n.text).filter(Boolean);if(t.length>0)return t.join(`
1662
1662
  `)}return"An error occurred"}function TTe(e){try{return JSON.parse(e),!0}catch{return!1}}function NTe({content:e}){return!Array.isArray(e)||e.length===0?f.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content"}):f.jsx("div",{className:"space-y-4",children:e.map((t,n)=>{if(t.type==="text"){const a=t.text||"";if(TTe(a))try{const r=JSON.parse(a);return f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content (JSON)"}),f.jsx(Xn,{data:r,filename:`content-${n}.json`})]},n)}catch{}return f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content"}),f.jsx("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words",children:a})]},n)}if(t.type==="image")return f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Image Content"}),f.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[f.jsx("img",{src:`data:${t.mimeType||"image/png"};base64,${t.data}`,alt:"Result",className:"max-w-full rounded"}),t.annotations&&f.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:f.jsx(Xn,{data:t.annotations,filename:`image-annotations-${n}.json`})})]})]},n);if(t.type==="audio")return f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Audio Content"}),f.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[f.jsx("audio",{controls:!0,src:`data:${t.mimeType||"audio/wav"};base64,${t.data}`,className:"w-full"}),t.annotations&&f.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:f.jsx(Xn,{data:t.annotations,filename:`audio-annotations-${n}.json`})})]})]},n);if(t.type==="resource_link")return f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Resource Link"}),f.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[f.jsxs("div",{className:"font-mono text-sm break-all",children:[f.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",t.uri]}),t.name&&f.jsxs("div",{className:"text-sm",children:[f.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Name:"})," ",t.name]}),t.description&&f.jsxs("div",{className:"text-sm",children:[f.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Description:"})," ",t.description]}),t.mimeType&&f.jsxs("div",{className:"text-sm",children:[f.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",t.mimeType]}),t.annotations&&f.jsxs("div",{className:"mt-2",children:[f.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),f.jsx(Xn,{data:t.annotations,filename:`resource-link-annotations-${n}.json`})]})]})]},n);if(t.type==="resource"){const a=t.resource||{};return f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Embedded Resource"}),f.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[f.jsxs("div",{className:"font-mono text-sm break-all",children:[f.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",a.uri]}),a.mimeType&&f.jsxs("div",{className:"text-sm",children:[f.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",a.mimeType]}),a.text&&f.jsxs("div",{children:[f.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Content:"}),f.jsx("div",{className:"bg-white dark:bg-black rounded p-2 font-mono text-sm whitespace-pre-wrap break-words max-h-60 overflow-y-auto",children:a.text})]}),a.blob&&f.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["[Binary content: ",a.blob.length||0," bytes]"]}),a.annotations&&f.jsxs("div",{className:"mt-2",children:[f.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),f.jsx(Xn,{data:a.annotations,filename:`resource-annotations-${n}.json`})]})]})]},n)}return f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Unknown Content Type: ",t.type||"N/A"]}),f.jsx(Xn,{data:t,filename:`content-${n}.json`})]},n)})})}function K2({results:e,copiedResult:t,previewMode:n,serverId:a,readResource:r,onCopy:i,onTogglePreview:s,onMaximize:c,isMaximized:u=!1}){const[d,m]=w.useState(0),[h,g]=w.useState(""),[v,x]=w.useState(!0),S=e[0],y=S?e.filter(te=>te.toolName===S.toolName):[],E=y[d]||y[0],_=e.findIndex(te=>te===E);w.useEffect(()=>{y.length>0&&d>=y.length&&m(0)},[y.length,d]),w.useEffect(()=>{const te=()=>{E&&g(W2(E.timestamp))};te();const ae=setInterval(te,1e3);return()=>clearInterval(ae)},[E]);const k=w.useMemo(()=>E?.args,[E?.timestamp,d]),C=w.useMemo(()=>E?.result,[E?.timestamp,d]),R=w.useCallback(te=>r(te),[r]);if(e.length===0)return f.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:f.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:f.jsx("div",{className:"flex items-center justify-center h-full",children:f.jsx("div",{className:"text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})});const I=E.toolMeta?.["openai/outputTemplate"],A=!!(I&&typeof I=="string"&&E.appsSdkResource),O=I,M=E.result?.content||[],P=M.filter(te=>te.type==="resource"&&Cu(te.resource)),B=P.length>0,K=!!(M&&M.length>0||E.result?.structuredContent),ee=!B&&!A&&K;return f.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:f.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:f.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[f.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${B||A||ee?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[f.jsx("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),E.duration!==void 0&&f.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[f.jsx(Vp,{className:"h-3 w-3 text-gray-400"}),f.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[E.duration,"ms"]})]}),A&&f.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[f.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",O||"No URI"]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),f.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),f.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),B&&!A&&f.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[f.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",P[0]?.resource?.uri||"No URI"]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),f.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),f.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),ee&&f.jsxs("div",{className:"flex items-center gap-2 sm:ml-4",children:[f.jsx("button",{onClick:()=>x(!0),className:`text-xs font-medium ${v?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Formatted"}),f.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),f.jsx("button",{onClick:()=>x(!1),className:`text-xs font-medium ${v?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw"})]}),f.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(A||B)&&c&&f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,title:u?"Restore":"Maximize",children:u?f.jsx(hhe,{className:"h-4 w-4"}):f.jsx(eC,{className:"h-4 w-4"})}),y.length>1&&f.jsxs(Io,{value:d.toString(),onValueChange:te=>m(parseInt(te)),children:[f.jsx(Do,{size:"sm",className:"w-[140px] h-8 text-xs",children:f.jsx(Oo,{children:f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Rv,{className:"h-3 w-3"}),f.jsx("span",{children:h})]})})}),f.jsx(jo,{children:y.map((te,ae)=>f.jsx(Ar,{value:ae.toString(),children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Rv,{className:"h-3 w-3"}),f.jsx("span",{children:W2(te.timestamp)}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",new Date(te.timestamp).toLocaleTimeString(),")"]})]})},ae))})]}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>i(_,E.result),children:t===_?f.jsx(ra,{className:"h-4 w-4"}):f.jsx(Lr,{className:"h-4 w-4"})})]})]}),(()=>{const te=E.error||kTe(E.result);return te?f.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[f.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),f.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:te})]}):(()=>{if(A){const ae=E.appsSdkResource;return ae.isLoading?f.jsx(f.Fragment,{}):ae.error?f.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4",children:[f.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),f.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:ae.error})]}):n?f.jsx("div",{className:"flex-1",children:f.jsx(mD,{componentUrl:O,toolName:E.toolName,toolArgs:k,toolResult:C,serverId:a,readResource:R,className:"w-full h-full relative p-4"})}):f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:E.result,filename:`tool-result-${E.toolName}-${Date.now()}.json`})})}if(B)return n?f.jsxs("div",{className:"space-y-0 h-full",children:[P.map((ae,H)=>f.jsx("div",{className:"mx-0 size-full",children:f.jsx(KY,{resource:ae.resource,onUIAction:Z=>{},className:"w-full h-full relative"})},H)),M.filter(ae=>!(ae.type==="resource"&&Cu(ae.resource))).length>0&&f.jsx("div",{className:"px-4",children:f.jsx(Xn,{data:M.filter(ae=>!(ae.type==="resource"&&Cu(ae.resource))),filename:`tool-result-${E.toolName}-non-ui-${Date.now()}.json`})})]}):f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:E.result,filename:`tool-result-${E.toolName}-mcp-ui-${Date.now()}.json`})});if(ee&&v){const ae=E.result?.structuredContent;return f.jsxs("div",{className:"px-4 pt-4 space-y-4",children:[ae&&f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Structured Content"}),f.jsx(Xn,{data:ae,filename:`structured-content-${E.toolName}-${Date.now()}.json`})]}),M&&M.length>0&&f.jsx(NTe,{content:M}),!ae&&(!M||M.length===0)&&f.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content to display"})]})}return f.jsx("div",{className:"px-4 pt-4",children:f.jsx(Xn,{data:E.result,filename:`tool-result-${E.toolName}-${Date.now()}.json`})})})()})()]})})})}function Z2({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:a}){return e.length===0?f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(Gl,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):f.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((r,i)=>f.jsx(Qs,{id:`tool-${r.name}`,isSelected:t?.name===r.name,isFocused:a===i,icon:f.jsx(Gl,{className:"h-4 w-4"}),title:r.name,description:r.description,metadata:r.inputSchema?.properties&&f.jsxs(wr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(r.inputSchema.properties).length," params"]}),onClick:()=>n(r)},r.name))})}function Y2({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredToolsCount:a,savedRequestsCount:r,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return f.jsx(GY,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:a,secondaryCount:r,primaryIcon:Gl,secondaryIcon:Xy,searchPlaceholder:"Search tools...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}const q2="mcp-inspector-saved-requests";function qY({ref:e,tools:t,callTool:n,readResource:a,serverId:r,isConnected:i}){const[s,c]=w.useState(null),[u,d]=w.useState(null),{selectedToolName:m,setSelectedToolName:h}=ac(),[g,v]=w.useState({}),[x,S]=w.useState([]),[y,E]=w.useState(!1),[_,k]=w.useState(null),[C,R]=w.useState(null),[I,A]=w.useState(""),[O,M]=w.useState("tools"),[P,B]=w.useState([]),[K,ee]=w.useState(!1),[te,ae]=w.useState(""),[H,Z]=w.useState(!0),[G,re]=w.useState(!1),[ne,j]=w.useState(-1),V=w.useRef(null),[z,L]=w.useState(!1),[$,F]=w.useState("list"),[W,X]=w.useState(!1),[ie,ce]=w.useState(0),[J,q]=w.useState(!0),[le,he]=w.useState(void 0),oe=w.useRef(null),Ce=w.useRef(null),Ve=w.useRef(null),xe=w.useRef(null),Te=w.useRef(null);w.useEffect(()=>{const _e=()=>{L(window.innerWidth<1024)};return _e(),window.addEventListener("resize",_e),()=>window.removeEventListener("resize",_e)},[]),w.useEffect(()=>{F(s?"detail":"list")},[s]),w.useEffect(()=>{z&&x.length>0&&!y&&F("response")},[x,y,z]),w.useImperativeHandle(e,()=>({focusSearch:()=>{re(!0),setTimeout(()=>{V.current&&V.current.focus()},0)},blurSearch:()=>{A(""),re(!1),V.current&&V.current.blur()}})),w.useEffect(()=>{try{const _e=localStorage.getItem(q2);_e&&B(JSON.parse(_e))}catch(_e){console.error("[ToolsTab] Failed to load saved requests:",_e)}},[]);const Fe=w.useCallback(_e=>{try{localStorage.setItem(q2,JSON.stringify(_e)),B(_e)}catch(je){console.error("[ToolsTab] Failed to save requests:",je)}},[]),pe=w.useMemo(()=>{if(!I.trim())return t;const _e=I.toLowerCase();return t.filter(je=>je.name.toLowerCase().includes(_e)||je.description?.toLowerCase().includes(_e))},[t,I]),Oe=w.useCallback(_e=>{c(_e);const je={};_e.inputSchema?.properties&&Object.entries(_e.inputSchema.properties).forEach(([Ue,We])=>{const Je=We;Je.default!==void 0?je[Ue]=Je.default:Je.type==="string"?je[Ue]="":Je.type==="number"?je[Ue]=0:Je.type==="boolean"?je[Ue]=!1:Je.type==="array"?je[Ue]="[]":Je.type==="object"&&(je[Ue]="{}")}),v(je)},[]),He=w.useCallback(_e=>{const je=t.find(Ue=>Ue.name===_e.toolName);je&&(c(je),v(_e.args),d(_e))},[t]);w.useEffect(()=>{G&&V.current&&V.current.focus()},[G]);const Se=w.useCallback(()=>{I.trim()||re(!1)},[I]);w.useEffect(()=>{O!=="tools"&&re(!1)},[O]),w.useEffect(()=>{j(-1)},[I,O]),w.useEffect(()=>{const _e=je=>{const Ue=je.target;if(Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.contentEditable==="true"||je.metaKey||je.ctrlKey||je.altKey)return;const Je=O==="tools"?pe:P;if(je.key==="ArrowDown")je.preventDefault(),j(yt=>{const mt=yt+1;return mt>=Je.length?0:mt});else if(je.key==="ArrowUp")je.preventDefault(),j(yt=>{const mt=yt-1;return mt<0?Je.length-1:mt});else if(je.key==="Enter"&&ne>=0)if(je.preventDefault(),O==="tools"){const yt=pe[ne];yt&&Oe(yt)}else{const yt=P[ne];yt&&He(yt)}};return document.addEventListener("keydown",_e),()=>document.removeEventListener("keydown",_e)},[ne,pe,P,O,Oe,He]),w.useEffect(()=>{if(ne>=0){const _e=O==="tools"?`tool-${pe[ne]?.name}`:`saved-${P[ne]?.id}`,je=document.getElementById(_e);je&&je.scrollIntoView({behavior:"smooth",block:"nearest"})}},[ne,pe,P,O]),w.useEffect(()=>{if(m&&t.length>0){const _e=t.find(je=>je.name===m);if(_e&&s?.name!==_e.name){h(null);const je=setTimeout(()=>{Oe(_e);const Ue=document.getElementById(`tool-${_e.name}`);Ue&&Ue.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(je)}}},[m,t,s,Oe,h]);const at=w.useCallback((_e,je)=>{v(Ue=>{const We={...Ue};if(s?.inputSchema?.properties?.[_e]){const yt=s.inputSchema.properties[_e].type;if(yt==="object"||yt==="array")We[_e]=je;else if(yt==="string")We[_e]=je;else try{We[_e]=JSON.parse(je)}catch{We[_e]=je}}else We[_e]=je;return We})},[s]),nt=w.useCallback(async()=>{if(!s||y)return;const _e=new AbortController;R(_e),E(!0);const je=Date.now();try{const Ue={...g};s.inputSchema?.properties&&Object.entries(s.inputSchema.properties).forEach(([Ke,Ze])=>{const At=Ze.type,Qn=Ue[Ke];if((At==="object"||At==="array")&&typeof Qn=="string")try{Ue[Ke]=JSON.parse(Qn)}catch{}});const We=await n(s.name,Ue,{timeout:6e5,resetTimeoutOnProgress:!0,signal:_e.signal}),Je=Date.now()-je;vr.getInstance().capture(new qU({toolName:s.name,serverId:r,success:!0,duration:Je})).catch(()=>{});const mt=s?._meta||s?.metadata,Mt=mt?.["openai/outputTemplate"];let nn;if(Mt&&typeof Mt=="string"){const Ke={toolName:s.name,args:g,result:We,timestamp:je,duration:Je,toolMeta:mt,appsSdkResource:{uri:Mt,resourceData:null,isLoading:!0}};S([Ke]);try{const Ze=await a(Mt);let dt=null;if(We?.structuredContent)dt=We.structuredContent;else if(Array.isArray(We)&&We[0]){const At=We[0];At.output?.value?.structuredContent?dt=At.output.value.structuredContent:At.structuredContent?dt=At.structuredContent:At.output?.value&&(dt=At.output.value)}dt||(dt=We),nn={uri:Mt,resourceData:{...Ze,structuredContent:dt},isLoading:!1}}catch(Ze){nn={uri:Mt,resourceData:null,isLoading:!1,error:Ze instanceof Error?Ze.message:String(Ze)}}S(Ze=>Ze.map((dt,At)=>At===0?{...dt,appsSdkResource:nn}:dt))}else S(Ke=>[{toolName:s.name,args:g,result:We,timestamp:je,duration:Je,toolMeta:mt},...Ke])}catch(Ue){const We=Date.now()-je;vr.getInstance().capture(new qU({toolName:s.name,serverId:r,success:!1,duration:We,error:Ue instanceof Error?Ue.message:String(Ue)})).catch(()=>{});const yt=s?._meta||s?.metadata,mt={toolName:s.name,args:g,result:null,error:Ue instanceof Error?Ue.message:String(Ue),timestamp:je,duration:We,toolMeta:yt},Mt=yt?.["openai/outputTemplate"];S(Mt?[mt]:nn=>[mt,...nn])}finally{E(!1)}},[s,g,y,n,a,r]),ft=w.useCallback(async(_e,je)=>{try{await navigator.clipboard.writeText(JSON.stringify(je,null,2)),k(_e),setTimeout(()=>k(null),2e3)}catch(Ue){console.error("[ToolsTab] Failed to copy result:",Ue)}},[]),Et=w.useCallback(_e=>{S(je=>je.filter((Ue,We)=>We!==_e))},[]),pt=w.useMemo(()=>s?x.filter(_e=>_e.toolName===s.name):[],[x,s]),mn=w.useCallback(_e=>{const je=pt[_e];if(je){const Ue=window.open("","_blank","width=800,height=600");Ue&&(Ue.document.write(`
1663
1663
  <html>
@@ -1673,4 +1673,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1673
1673
  <pre>${JSON.stringify(je.result,null,2)}</pre>
1674
1674
  </body>
1675
1675
  </html>
1676
- `),Ue.document.close())}},[x]),Pr=w.useCallback(()=>{W?(oe.current&&oe.current.expand(),Ce.current&&Ce.current.expand(),X(!1)):(oe.current&&oe.current.collapse(),Ce.current&&Ce.current.collapse(),X(!0))},[W]),St=w.useCallback(()=>{s&&(ae(""),ee(!0))},[s]),Be=w.useCallback(()=>{if(!s)return;const _e={id:`${Date.now()}-${Math.random()}`,name:te.trim()||`${s.name} - ${new Date().toLocaleString()}`,toolName:s.name,args:g,savedAt:Date.now(),serverId:s._serverId,serverName:s._serverName};Fe([...P,_e]),vr.getInstance().capture(new tme({toolName:s.name,serverId:r})).catch(()=>{}),ee(!1),ae("")},[s,te,g,P,Fe,r]),$e=w.useCallback(_e=>{Fe(P.filter(je=>je.id!==_e)),u?.id===_e&&d(null)},[P,Fe,u]);return z?f.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[$!=="list"&&f.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[f.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>{$==="response"?F("detail"):(c(null),F("list"))},className:"p-0 h-8 w-8",children:f.jsx(qy,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex items-center text-sm font-medium",children:[f.jsx("button",{onClick:()=>{c(null),F("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Tools"}),$==="detail"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("button",{onClick:()=>{F("response")},className:$==="detail"?"text-foreground hover:underline":$==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),$==="response"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),f.jsx("div",{className:"flex-1 relative overflow-hidden",children:f.jsxs(rw,{initial:!1,mode:"popLayout",children:[$==="list"&&f.jsxs(ya.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[f.jsx(Y2,{activeTab:O,isSearchExpanded:G,searchQuery:I,filteredToolsCount:pe.length,savedRequestsCount:P.length,onSearchExpand:()=>re(!0),onSearchChange:A,onSearchBlur:Se,onTabSwitch:()=>M(O==="tools"?"saved":"tools"),searchInputRef:V}),O==="tools"?f.jsx(Z2,{tools:pe,selectedTool:s,onToolSelect:Oe,focusedIndex:ne}):f.jsx(B2,{savedRequests:P,selectedRequest:u,onLoadRequest:He,onDeleteRequest:$e,focusedIndex:ne})]},"list"),$==="detail"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-10",children:f.jsx(G2,{selectedTool:s,toolArgs:g,isExecuting:y,isConnected:i,onArgChange:at,onExecute:nt,onSave:St})},"detail"),$==="response"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-20",children:f.jsx(K2,{results:pt,copiedResult:_,previewMode:H,serverId:r,readResource:a,onCopy:ft,onDelete:Et,onFullscreen:mn,onTogglePreview:()=>Z(!H)})},"response")]})}),f.jsx(H2,{isOpen:K,requestName:te,defaultPlaceholder:`${s?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ae,onSave:Be,onCancel:()=>ee(!1)})]}):f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{ref:oe,defaultSize:33,collapsible:!0,className:"flex flex-col h-full relative",children:f.jsxs(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[f.jsx(Rn,{defaultSize:75,minSize:30,children:f.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[f.jsx(Y2,{activeTab:O,isSearchExpanded:G,searchQuery:I,filteredToolsCount:pe.length,savedRequestsCount:P.length,onSearchExpand:()=>re(!0),onSearchChange:A,onSearchBlur:Se,onTabSwitch:()=>M(O==="tools"?"saved":"tools"),searchInputRef:V}),O==="tools"?f.jsx(Z2,{tools:pe,selectedTool:s,onToolSelect:Oe,focusedIndex:ne}):f.jsx(B2,{savedRequests:P,selectedRequest:u,onLoadRequest:He,onDeleteRequest:$e,focusedIndex:ne})]})}),f.jsx(Si,{withHandle:!0}),f.jsxs(Rn,{ref:xe,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>{q(!0)},onExpand:()=>{q(!1)},className:"flex flex-col border-t dark:border-zinc-700",children:[f.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),J?(xe.current?.resize(25),q(!1)):(xe.current?.resize(5),q(!0))},children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),ie>0&&f.jsx(wr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:ie}),ie>0&&!J&&f.jsx(Le,{variant:"ghost",size:"sm",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),Te.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:f.jsx(Fs,{className:"h-3.5 w-3.5"})})]}),f.jsx(rc,{className:`h-4 w-4 text-muted-foreground transition-transform ${J?"":"rotate-180"}`})]}),!J&&f.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:f.jsx(ED,{serverIds:[r],onCountChange:ce,onClearRef:Te})})]})]})}),f.jsx(Si,{withHandle:!0}),f.jsx(Rn,{defaultSize:67,children:f.jsxs(na,{direction:"vertical",children:[f.jsx(Rn,{ref:Ce,defaultSize:40,collapsible:!0,children:f.jsx(G2,{selectedTool:s,toolArgs:g,isExecuting:y,isConnected:i,onArgChange:at,onExecute:nt,onSave:St,onCancel:()=>{C&&C.abort()}})}),f.jsx(Si,{withHandle:!0}),f.jsx(Rn,{ref:Ve,defaultSize:60,children:f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(K2,{results:pt,copiedResult:_,previewMode:H,serverId:r,readResource:a,onCopy:ft,onDelete:Et,onFullscreen:mn,onTogglePreview:()=>Z(!H),onMaximize:Pr,isMaximized:W})})})]})}),f.jsx(H2,{isOpen:K,requestName:te,defaultPlaceholder:`${s?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ae,onSave:Be,onCancel:()=>ee(!1)})]})}qY.displayName="ToolsTab";function CTe({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:a,onSearchExpand:r,onSearchChange:i,onSearchBlur:s,onRejectAll:c,searchInputRef:u}){return f.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?f.jsx(En,{ref:u,placeholder:"Search requests...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Sampling"}),f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,disabled:a===0,className:"h-8 w-8 p-0",children:f.jsx(Fs,{className:"h-4 w-4"})})}),f.jsx(Rt,{side:"bottom",children:"Reject all"})]})})]})}function RTe({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:a,formatRelativeTime:r,listRef:i}){return e.length===0?f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No sampling requests"})}):f.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>{const u=s.request.params?.messages?.length||0,d=s.request.params?.maxTokens;return f.jsx(Qs,{id:`sampling-request-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,title:f.jsxs("span",{className:"flex items-center gap-3",children:[s.serverName,f.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const m=r(s.timestamp),h=[];u>0&&h.push(`${u} message${u>1?"s":""}`),d&&h.push(`max ${d} tokens`);const g=h.length>0?` | ${h.join(", ")}`:"";return m+g})(),onClick:()=>n(s)},s.id)})})}function ATe({llmConfig:e}){const t=w.useRef(null);return{generateResponse:w.useCallback(async({request:a})=>{if(!e)throw new Error("LLM config is not available");const r=a.params||{},i=r.maxTokens,s=r.temperature;r.modelPreferences;const c=r.messages||[];if(console.log("[useSamplingLLM] Request structure:",{hasParams:!!r,messagesCount:c.length,messages:c,params:r}),c.length===0)throw new Error("No messages found in sampling request");const u=[],{HumanMessage:d,AIMessage:m}=await Jn(async()=>{const{HumanMessage:x,AIMessage:S}=await import("./index-BWJOUedR.js").then(y=>y.bI);return{HumanMessage:x,AIMessage:S}},[]);for(const x of c){if(!x||!x.role){console.warn("Skipping invalid message:",x);continue}const S=Array.isArray(x.content)?x.content[0]:x.content;if(!S){console.warn("Skipping message with no content:",x);continue}S.type==="text"&&S.text?x.role==="user"?u.push(new d(S.text)):x.role==="assistant"&&u.push(new m(S.text)):console.warn("Skipping message with unsupported content type:",S)}if(u.length===0)throw new Error("No valid messages could be converted. Please ensure messages have 'text' content type.");if(!t.current||t.current.provider!==e.provider||t.current.model!==e.model||t.current.apiKey!==e.apiKey){let x;const S={model:e.model,apiKey:e.apiKey};if(i!==void 0&&(S.maxTokens=i),s!==void 0?S.temperature=s:e.temperature!==void 0&&(S.temperature=e.temperature),e.provider==="openai"){const{ChatOpenAI:y}=await Jn(async()=>{const{ChatOpenAI:E}=await import("./index-CrP21sE-.js");return{ChatOpenAI:E}},__vite__mapDeps([5,6,7,2,8,9,10]));x=new y(S)}else if(e.provider==="anthropic"){const{ChatAnthropic:y}=await Jn(async()=>{const{ChatAnthropic:E}=await import("./index-Dxsl-6OY.js");return{ChatAnthropic:E}},__vite__mapDeps([11,7,6,2,10]));x=new y(S)}else if(e.provider==="google"){const{ChatGoogleGenerativeAI:y}=await Jn(async()=>{const{ChatGoogleGenerativeAI:E}=await import("./index-Q4cmml2q.js");return{ChatGoogleGenerativeAI:E}},__vite__mapDeps([12,7,6,2,9]));x=new y(S)}else throw new Error(`Unsupported LLM provider: ${e.provider}`);t.current={instance:x,provider:e.provider,model:e.model,apiKey:e.apiKey}}const h=await t.current.instance.invoke(u);return{role:"assistant",content:{type:"text",text:h.content||h.text||""},model:e.model,stopReason:"endTurn"}},[e]),isAvailable:e!==null}}function ITe({request:e,onApprove:t,onReject:n,onClose:a,previewMode:r,onTogglePreview:i,isCopied:s,onCopy:c,onDownload:u,onFullscreen:d,llmConfig:m}){const[h,g]=w.useState("manual"),[v,x]=w.useState("stub-model"),[S,y]=w.useState("endTurn"),[E,_]=w.useState("assistant"),[k,C]=w.useState("text"),[R,I]=w.useState("positive"),[A,O]=w.useState(""),[M,P]=w.useState("image/png"),[B,K]=w.useState(!1),[ee,te]=w.useState(null),{generateResponse:ae,isAvailable:H}=ATe({llmConfig:m});w.useEffect(()=>{e&&(x("stub-model"),y("endTurn"),_("assistant"),C("text"),I("positive"),O(""),P("image/png"),te(null))},[e?.id]);const Z=async()=>{if(!(!e||!H)){K(!0),te(null);try{const j=await ae({request:e.request});x(j.model||m?.model||"stub-model"),y(j.stopReason||"endTurn"),_(j.role||"assistant");const V=Array.isArray(j.content)?j.content[0]:j.content;V.type==="text"?(C("text"),I(V.text||"")):V.type==="image"&&(C("image"),O(V.data||""),P(V.mimeType||"image/png"))}catch(j){const V=j instanceof Error?j.message:"Failed to generate response";te(V),Xt.error("LLM Generation Failed",{description:V})}finally{K(!1)}}},G=w.useMemo(()=>{const j={model:v,stopReason:S,role:E,content:{type:k}};return k==="text"?j.content.text=R:k==="image"&&(j.content.data=A,j.content.mimeType=M),j},[v,S,E,k,R,A,M]),re=()=>{if(!e)return;const j=cN.safeParse(G);if(!j.success){Xt.error("Invalid response",{description:`Validation failed: ${j.error.message}`});return}t(e.id,j.data),a(),Jn(()=>Promise.resolve().then(()=>Ed),void 0).then(V=>{const z=Xt(V.createElement("div",{className:"space-y-3"},V.createElement("div",null,V.createElement("strong",null,"Sampling Response Sent"),V.createElement("p",{className:"text-sm text-muted-foreground mt-1"},"The tool will continue executing.")),V.createElement("div",{className:"flex gap-2"},V.createElement("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>{const L=new globalThis.CustomEvent("navigate-to-tool-result",{detail:{toolName:e.toolName}});window.dispatchEvent(L),Xt.dismiss(z)}},"View Tool Result"))),{duration:5e3})})},ne=()=>{e&&(n(e.id,"User rejected sampling request"),a())};return e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"flex items-center justify-between p-4 border-b dark:border-zinc-700",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.serverName}),f.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleString()})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0",children:s?f.jsx(ra,{className:"h-4 w-4 text-green-600"}):f.jsx(Lr,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Copy request"})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:f.jsx($m,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Download request"})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:d,className:"h-8 w-8 p-0",children:f.jsx(QN,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Fullscreen"})]}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:f.jsx(Ji,{className:"h-4 w-4"})})]})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Request"}),f.jsx("div",{className:"bg-muted rounded-lg p-3 max-h-64 overflow-auto",children:f.jsx(Xn,{data:e.request})})]}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Response"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Kt,{htmlFor:`responseMode-${e.id}`,className:"text-xs text-gray-500 dark:text-gray-400",children:"Mode:"}),f.jsxs(Io,{value:h,onValueChange:j=>g(j),children:[f.jsx(Do,{id:`responseMode-${e.id}`,className:"w-32 h-8 text-xs",children:f.jsx(Oo,{})}),f.jsxs(jo,{children:[f.jsx(Ar,{value:"manual",children:"Manual"}),f.jsx(Ar,{value:"llm",children:"LLM"})]})]})]})]}),h==="llm"&&f.jsxs("div",{className:"space-y-2 p-3 bg-muted rounded-lg",children:[H?f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Le,{onClick:Z,disabled:B,size:"sm",className:"flex items-center gap-2",children:B?f.jsxs(f.Fragment,{children:[f.jsx(zs,{className:"h-4 w-4 animate-spin"}),"Generating..."]}):f.jsxs(f.Fragment,{children:[f.jsx(jhe,{className:"h-4 w-4"}),"Generate with LLM"]})}),f.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Using ",m?.provider," (",m?.model,")"]})]}):f.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"LLM not configured. Please configure LLM in the Chat tab."}),ee&&f.jsx("div",{className:"text-xs text-red-600 dark:text-red-400",children:ee})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`model-${e.id}`,children:"Model"}),f.jsx(En,{id:`model-${e.id}`,value:v,onChange:j=>x(j.target.value),placeholder:"stub-model",disabled:h==="llm"&&B})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`stopReason-${e.id}`,children:"Stop Reason"}),f.jsx(En,{id:`stopReason-${e.id}`,value:S,onChange:j=>y(j.target.value),placeholder:"endTurn",disabled:h==="llm"&&B})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`role-${e.id}`,children:"Role"}),f.jsxs(Io,{value:E,onValueChange:j=>_(j),disabled:h==="llm"&&B,children:[f.jsx(Do,{id:`role-${e.id}`,children:f.jsx(Oo,{})}),f.jsxs(jo,{children:[f.jsx(Ar,{value:"assistant",children:"assistant"}),f.jsx(Ar,{value:"user",children:"user"})]})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`contentType-${e.id}`,children:"Content Type"}),f.jsxs(Io,{value:k,onValueChange:j=>C(j),disabled:h==="llm"&&B,children:[f.jsx(Do,{id:`contentType-${e.id}`,children:f.jsx(Oo,{})}),f.jsxs(jo,{children:[f.jsx(Ar,{value:"text",children:"text"}),f.jsx(Ar,{value:"image",children:"image"})]})]})]}),k==="text"&&f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`text-${e.id}`,children:"Text Content"}),f.jsx(ql,{id:`text-${e.id}`,value:R,onChange:j=>I(j.target.value),placeholder:"Enter response text...",rows:6,disabled:h==="llm"&&B})]}),k==="image"&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`imageData-${e.id}`,children:"Base64 Image Data"}),f.jsx(ql,{id:`imageData-${e.id}`,value:A,onChange:j=>O(j.target.value),placeholder:"Base64 encoded image data...",rows:4,disabled:h==="llm"&&B})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`mimeType-${e.id}`,children:"MIME Type"}),f.jsx(En,{id:`mimeType-${e.id}`,value:M,onChange:j=>P(j.target.value),placeholder:"image/png",disabled:h==="llm"&&B})]})]})]})]}),f.jsxs("div",{className:"flex gap-2 p-4 border-t dark:border-zinc-700",children:[f.jsx(Le,{onClick:re,className:"flex-1",disabled:h==="llm"&&B,children:"Approve"}),f.jsx(Le,{onClick:ne,variant:"outline",className:"flex-1",disabled:h==="llm"&&B,children:"Reject"})]})]}):f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a sampling request to view details"})})}function OTe({pendingRequests:e,onApprove:t,onReject:n,serverId:a,isConnected:r,mcpServerUrl:i}){const{selectedSamplingRequestId:s,setSelectedSamplingRequestId:c}=ac(),{llmConfig:u}=_Y({mcpServerUrl:i}),[d,m]=w.useState(null),[h,g]=w.useState(""),[v,x]=w.useState(-1),[S,y]=w.useState(!0),[E,_]=w.useState(!1),[k,C]=w.useState(!0),[R,I]=w.useState(!1),A=w.useRef(null),O=w.useRef(null),M=w.useRef(null),P=w.useRef(!1);w.useEffect(()=>{if(console.log("[SamplingTab] Auto-selection check:",{selectedSamplingRequestId:s,pendingRequestsCount:e.length,currentSelectedId:d?.id}),s&&e.length>0){const G=e.find(re=>re.id===s);console.log("[SamplingTab] Found request for auto-selection:",!!G,G?.id),G&&(console.log("[SamplingTab] Auto-selecting request:",G.id),c(null),m(G),setTimeout(()=>{const re=document.getElementById(`sampling-request-${G.id}`);console.log("[SamplingTab] Scrolling to element:",!!re),re&&re.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[s,e,c]),w.useEffect(()=>{const G=re=>{const j=re.detail.requestId;console.log("[SamplingTab] Custom navigate event received:",j);const V=e.find(z=>z.id===j);V&&(console.log("[SamplingTab] Selecting request from event:",j),m(V),setTimeout(()=>{const z=document.getElementById(`sampling-request-${j}`);z&&z.scrollIntoView({behavior:"smooth",block:"nearest"})},200))};return window.addEventListener("navigate-to-sampling",G),()=>window.removeEventListener("navigate-to-sampling",G)},[e]),w.useEffect(()=>{S&&e.length>0&&A.current&&!P.current&&(A.current.scrollTop=0)},[e.length,S]),w.useEffect(()=>{const G=A.current;if(!G)return;const re=()=>{G.scrollTop>0&&(P.current=!0,y(!1))};return G.addEventListener("scroll",re),()=>G.removeEventListener("scroll",re)},[]),w.useEffect(()=>{e.length===0&&(P.current=!1,y(!0))},[e.length]),w.useEffect(()=>{E&&M.current&&M.current.focus()},[E]);const B=w.useCallback(()=>{h.trim()||_(!1)},[h]),K=w.useMemo(()=>{if(!h.trim())return e;const G=h.toLowerCase();return e.filter(re=>re.serverName.toLowerCase().includes(G)||JSON.stringify(re.request||{}).toLowerCase().includes(G))},[e,h]);w.useEffect(()=>{x(-1)},[h]),w.useEffect(()=>{const G=re=>{const ne=re.target;if(ne.tagName==="INPUT"||ne.tagName==="TEXTAREA"||ne.contentEditable==="true"||re.metaKey||re.ctrlKey||re.altKey)return;const V=K;if(re.key==="ArrowDown")re.preventDefault(),x(z=>{const L=z+1;return L>=V.length?0:L});else if(re.key==="ArrowUp")re.preventDefault(),x(z=>{const L=z-1;return L<0?V.length-1:L});else if(re.key==="Enter"&&v>=0){re.preventDefault();const z=K[v];z&&ee(z)}};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[v,K]),w.useEffect(()=>{if(v>=0){const G=`sampling-request-${K[v]?.id}`,re=document.getElementById(G);re&&re.scrollIntoView({behavior:"smooth",block:"nearest"})}},[v,K]);const ee=w.useCallback(G=>{m(G)},[]),te=w.useCallback(()=>{window.confirm("Are you sure you want to reject all sampling requests? This cannot be undone.")&&(e.forEach(G=>{n(G.id,"User rejected all requests")}),m(null))},[e,n]),ae=w.useCallback(async()=>{if(d)try{await navigator.clipboard.writeText(JSON.stringify({id:d.id,serverName:d.serverName,timestamp:d.timestamp,request:d.request},null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch(G){console.error("[SamplingTab] Failed to copy request:",G)}},[d]),H=w.useCallback(()=>{if(d)try{const G=new globalThis.Blob([JSON.stringify({id:d.id,serverName:d.serverName,timestamp:d.timestamp,request:d.request},null,2)],{type:"application/json"}),re=URL.createObjectURL(G),ne=document.createElement("a");ne.href=re,ne.download=`sampling-request-${Date.now()}.json`,document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(re)}catch(G){console.error("[SamplingTab] Failed to download request:",G)}},[d]),Z=w.useCallback(async()=>{if(O.current)try{document.fullscreenElement?await document.exitFullscreen():await O.current.requestFullscreen()}catch(G){console.error("[SamplingTab] Failed to toggle fullscreen:",G)}},[]);return r?f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:40,minSize:30,children:f.jsx(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:f.jsxs(Rn,{defaultSize:75,minSize:30,children:[f.jsx(CTe,{isSearchExpanded:E,searchQuery:h,filteredRequestsCount:K.length,requestsCount:e.length,onSearchExpand:()=>_(!0),onSearchChange:g,onSearchBlur:B,onRejectAll:te,searchInputRef:M}),f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(RTe,{requests:K,selectedRequest:d,onRequestSelect:ee,focusedIndex:v,formatRelativeTime:ty,listRef:A})})]})})}),f.jsx(Si,{}),f.jsx(Rn,{defaultSize:60,minSize:40,children:f.jsx("div",{ref:O,className:"h-full bg-white dark:bg-zinc-900",children:f.jsx(ITe,{request:d,onApprove:t,onReject:n,onClose:()=>m(null),previewMode:k,onTogglePreview:()=>C(!k),isCopied:R,onCopy:ae,onDownload:H,onFullscreen:Z,llmConfig:u})})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(PG,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function DTe({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:a,onSearchExpand:r,onSearchChange:i,onSearchBlur:s,onCancelAll:c,searchInputRef:u}){return f.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?f.jsx(En,{ref:u,placeholder:"Search requests...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Elicitation"}),f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,disabled:a===0,className:"h-8 w-8 p-0",children:f.jsx(Ji,{className:"h-4 w-4"})})}),f.jsx(Rt,{side:"bottom",children:"Cancel all"})]})})]})}function jTe({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:a,formatRelativeTime:r,listRef:i}){return e.length===0?f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No elicitation requests"})}):f.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>{const u=s.request.mode||"form",d=u==="form"&&"requestedSchema"in s.request&&s.request.requestedSchema;return f.jsx(Qs,{id:`elicitation-request-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,title:f.jsxs("span",{className:"flex items-center gap-3",children:[s.serverName,f.jsx(wr,{variant:"outline",className:u==="url"?"bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50":"bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50",children:u})]}),description:(()=>{const m=r(s.timestamp),h=[];d&&h.push("with schema"),u==="url"&&h.push("external action");const g=h.length>0?` | ${h.join(", ")}`:"";return m+g})(),onClick:()=>n(s)},s.id)})})}function LTe({request:e,onApprove:t,onReject:n,onClose:a,previewMode:r,onTogglePreview:i,isCopied:s,onCopy:c,onDownload:u,onFullscreen:d}){const[m,h]=w.useState({}),[g,v]=w.useState(!1),x=e?.request.mode||"form",S=x==="form",y=x==="url";w.useEffect(()=>{if(e&&S&&"requestedSchema"in e.request){const A=e.request.requestedSchema,O={};if(A?.type==="object"&&A.properties)for(const[M,P]of Object.entries(A.properties)){const B=P;B.default!==void 0?O[M]=B.default:B.type==="boolean"?O[M]=!1:B.type==="number"||B.type==="integer"?O[M]=0:O[M]=""}h(O)}v(!1)},[e?.id,S]);const E=(A,O)=>{h(M=>({...M,[A]:O}))},_=()=>{if(e){if(S){if("requestedSchema"in e.request){const A=e.request.requestedSchema;if(A?.required){const O=A.required.filter(M=>m[M]===void 0||m[M]===""||m[M]===null);if(O.length>0){Xt.error("Missing required fields",{description:`Please fill in: ${O.join(", ")}`});return}}}t(e.id,{action:"accept",data:m})}else y&&t(e.id,{action:"accept"});a(),Jn(()=>Promise.resolve().then(()=>Ed),void 0).then(A=>{const O=Xt(A.createElement("div",{className:"space-y-3"},A.createElement("div",null,A.createElement("strong",null,"Elicitation Response Sent"),A.createElement("p",{className:"text-sm text-muted-foreground mt-1"},"The tool will continue executing.")),A.createElement("div",{className:"flex gap-2"},A.createElement("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>{const M=new globalThis.CustomEvent("navigate-to-tool-result",{detail:{toolName:null}});window.dispatchEvent(M),Xt.dismiss(O)}},"View Tool Result"))),{duration:5e3})})}},k=()=>{e&&(t(e.id,{action:"decline"}),a())},C=()=>{e&&(n(e.id,"User cancelled elicitation request"),a())},R=()=>{e&&y&&"url"in e.request&&(window.open(e.request.url,"_blank"),v(!0))},I=w.useMemo(()=>{if(!e||!S||!("requestedSchema"in e.request))return null;const A=e.request.requestedSchema;if(!A||A.type!=="object"||!A.properties)return f.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No form schema available"});const O=A.properties,M=A.required||[];return f.jsx("div",{className:"space-y-4",children:Object.entries(O).map(([P,B])=>{const K=B,ee=M.includes(P),te=K.type||"string",ae=K.title||P,H=K.description;return f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:`field-${P}`,children:[ae,ee&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),H&&f.jsx("p",{className:"text-xs text-muted-foreground",children:H}),te==="boolean"?f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(im,{id:`field-${P}`,checked:m[P]||!1,onCheckedChange:Z=>E(P,Z)}),f.jsx(Kt,{htmlFor:`field-${P}`,className:"text-sm font-normal cursor-pointer",children:K.title||P})]}):te==="number"||te==="integer"?f.jsx(En,{id:`field-${P}`,type:"number",value:m[P]||"",onChange:Z=>E(P,te==="integer"?parseInt(Z.target.value,10):parseFloat(Z.target.value)),placeholder:K.default?.toString()||""}):K.enum?f.jsxs("select",{id:`field-${P}`,value:m[P]||"",onChange:Z=>E(P,Z.target.value),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[f.jsx("option",{value:"",children:"Select..."}),K.enum.map(Z=>f.jsx("option",{value:Z,children:Z},Z))]}):te==="string"&&(K.format==="textarea"||K.maxLength>100)?f.jsx(ql,{id:`field-${P}`,value:m[P]||"",onChange:Z=>E(P,Z.target.value),placeholder:K.default||"",rows:4}):f.jsx(En,{id:`field-${P}`,type:"text",value:m[P]||"",onChange:Z=>E(P,Z.target.value),placeholder:K.default||""})]},P)})})},[e,m,S]);return e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"flex items-center justify-between p-4 border-b dark:border-zinc-700",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.serverName}),f.jsx(wr,{variant:"outline",className:y?"bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50":"bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50",children:x}),f.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleString()})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0",children:s?f.jsx(ra,{className:"h-4 w-4 text-green-600"}):f.jsx(Lr,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Copy request"})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:f.jsx($m,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Download request"})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:d,className:"h-8 w-8 p-0",children:f.jsx(QN,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Fullscreen"})]}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:f.jsx(Ji,{className:"h-4 w-4"})})]})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Message"}),f.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:e.request.message})]}),y&&"url"in e.request&&f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"External Action Required"}),f.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[f.jsx("p",{className:"text-sm text-muted-foreground",children:"This request requires you to complete an action at an external URL:"}),f.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background rounded border",children:[f.jsx("code",{className:"flex-1 text-xs font-mono break-all",children:e.request.url}),f.jsxs(Le,{size:"sm",variant:"outline",onClick:R,className:"flex items-center gap-2",children:[f.jsx(Y_,{className:"h-4 w-4"}),"Open URL"]})]}),f.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[f.jsx(im,{id:"url-completed",checked:g,onCheckedChange:A=>v(!!A)}),f.jsx(Kt,{htmlFor:"url-completed",className:"text-sm font-normal cursor-pointer",children:"I have completed the required action"})]})]})]}),S&&f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Form Data"}),I]}),S&&"requestedSchema"in e.request&&e.request.requestedSchema&&f.jsxs("details",{className:"space-y-2",children:[f.jsx("summary",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 cursor-pointer",children:"Schema (for reference)"}),f.jsx("div",{className:"bg-muted rounded-lg p-3 max-h-64 overflow-auto",children:f.jsx(Xn,{data:e.request.requestedSchema})})]})]}),f.jsxs("div",{className:"flex gap-2 p-4 border-t dark:border-zinc-700",children:[f.jsx(Le,{onClick:_,className:"flex-1",children:"Accept"}),f.jsx(Le,{onClick:k,variant:"outline",className:"flex-1",children:"Decline"}),f.jsx(Le,{onClick:C,variant:"outline",className:"flex-1",children:"Cancel"})]})]}):f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select an elicitation request to view details"})})}function $Te({pendingRequests:e=[],onApprove:t,onReject:n,serverId:a,isConnected:r}){const{selectedElicitationRequestId:i,setSelectedElicitationRequestId:s}=ac(),[c,u]=w.useState(null),[d,m]=w.useState(""),[h,g]=w.useState(-1),[v,x]=w.useState(!0),[S,y]=w.useState(!1),[E,_]=w.useState(!0),[k,C]=w.useState(!1),R=w.useRef(null),I=w.useRef(null),A=w.useRef(null),O=w.useRef(!1);w.useEffect(()=>{if(console.log("[ElicitationTab] Auto-selection check:",{selectedElicitationRequestId:i,pendingRequestsCount:e.length,currentSelectedId:c?.id}),i&&e.length>0){const H=e.find(Z=>Z.id===i);console.log("[ElicitationTab] Found request for auto-selection:",!!H,H?.id),H&&(console.log("[ElicitationTab] Auto-selecting request:",H.id),s(null),u(H),setTimeout(()=>{const Z=document.getElementById(`elicitation-request-${H.id}`);console.log("[ElicitationTab] Scrolling to element:",!!Z),Z&&Z.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[i,e,s]),w.useEffect(()=>{const H=Z=>{const re=Z.detail.requestId;console.log("[ElicitationTab] Custom navigate event received:",re);const ne=e.find(j=>j.id===re);ne&&(console.log("[ElicitationTab] Selecting request from event:",re),u(ne),setTimeout(()=>{const j=document.getElementById(`elicitation-request-${re}`);j&&j.scrollIntoView({behavior:"smooth",block:"nearest"})},200))};return window.addEventListener("navigate-to-elicitation",H),()=>window.removeEventListener("navigate-to-elicitation",H)},[e]),w.useEffect(()=>{v&&e.length>0&&R.current&&!O.current&&(R.current.scrollTop=0)},[e.length,v]),w.useEffect(()=>{const H=R.current;if(!H)return;const Z=()=>{H.scrollTop>0&&(O.current=!0,x(!1))};return H.addEventListener("scroll",Z),()=>H.removeEventListener("scroll",Z)},[]),w.useEffect(()=>{e.length===0&&(O.current=!1,x(!0))},[e.length]),w.useEffect(()=>{S&&A.current&&A.current.focus()},[S]);const M=w.useCallback(()=>{d.trim()||y(!1)},[d]),P=w.useMemo(()=>{if(!d.trim())return e;const H=d.toLowerCase();return e.filter(Z=>Z.serverName.toLowerCase().includes(H)||Z.request.message.toLowerCase().includes(H)||JSON.stringify(Z.request||{}).toLowerCase().includes(H))},[e,d]);w.useEffect(()=>{g(-1)},[d]),w.useEffect(()=>{const H=Z=>{const G=Z.target;if(G.tagName==="INPUT"||G.tagName==="TEXTAREA"||G.contentEditable==="true"||Z.metaKey||Z.ctrlKey||Z.altKey)return;const ne=P;if(Z.key==="ArrowDown")Z.preventDefault(),g(j=>{const V=j+1;return V>=ne.length?0:V});else if(Z.key==="ArrowUp")Z.preventDefault(),g(j=>{const V=j-1;return V<0?ne.length-1:V});else if(Z.key==="Enter"&&h>=0){Z.preventDefault();const j=P[h];j&&B(j)}};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[h,P]),w.useEffect(()=>{if(h>=0){const H=`elicitation-request-${P[h]?.id}`,Z=document.getElementById(H);Z&&Z.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,P]);const B=w.useCallback(H=>{u(H)},[]),K=w.useCallback(()=>{window.confirm("Are you sure you want to cancel all elicitation requests? This cannot be undone.")&&(e.forEach(H=>{n(H.id,"User cancelled all requests")}),u(null))},[e,n]),ee=w.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(JSON.stringify({id:c.id,serverName:c.serverName,timestamp:c.timestamp,request:c.request},null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(H){console.error("[ElicitationTab] Failed to copy request:",H)}},[c]),te=w.useCallback(()=>{if(c)try{const H=new globalThis.Blob([JSON.stringify({id:c.id,serverName:c.serverName,timestamp:c.timestamp,request:c.request},null,2)],{type:"application/json"}),Z=URL.createObjectURL(H),G=document.createElement("a");G.href=Z,G.download=`elicitation-request-${Date.now()}.json`,document.body.appendChild(G),G.click(),document.body.removeChild(G),URL.revokeObjectURL(Z)}catch(H){console.error("[ElicitationTab] Failed to download request:",H)}},[c]),ae=w.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(H){console.error("[ElicitationTab] Failed to toggle fullscreen:",H)}},[]);return r?f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:40,minSize:30,children:f.jsx(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:f.jsxs(Rn,{defaultSize:75,minSize:30,children:[f.jsx(DTe,{isSearchExpanded:S,searchQuery:d,filteredRequestsCount:P.length,requestsCount:e.length,onSearchExpand:()=>y(!0),onSearchChange:m,onSearchBlur:M,onCancelAll:K,searchInputRef:A}),f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(jTe,{requests:P,selectedRequest:c,onRequestSelect:B,focusedIndex:h,formatRelativeTime:ty,listRef:R})})]})})}),f.jsx(Si,{}),f.jsx(Rn,{defaultSize:60,minSize:40,children:f.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:f.jsx(LTe,{request:c,onApprove:t,onReject:n,onClose:()=>u(null),previewMode:E,onTogglePreview:()=>_(!E),isCopied:k,onCopy:ee,onDownload:te,onFullscreen:ae})})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(BG,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function MTe({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:a,resourcesSearchRef:r,children:i}){return e?f.jsxs(f.Fragment,{children:[f.jsx("div",{style:{display:t==="tools"?"block":"none"},className:"h-full",children:f.jsx(qY,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state==="ready"})}),f.jsx("div",{style:{display:t==="prompts"?"block":"none"},className:"h-full",children:f.jsx(WY,{ref:a,prompts:e.prompts,callPrompt:e.getPrompt,serverId:e.id,isConnected:e.state==="ready"})}),f.jsx("div",{style:{display:t==="resources"?"block":"none"},className:"h-full",children:f.jsx(ZY,{ref:r,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state==="ready"})}),f.jsx("div",{style:{display:t==="chat"?"block":"none"},className:"h-full",children:f.jsx(Uke,{connection:e,isConnected:e.state==="ready",readResource:e.readResource},e.id)}),f.jsx("div",{style:{display:t==="sampling"?"block":"none"},className:"h-full",children:f.jsx(OTe,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state==="ready",mcpServerUrl:e.url})}),f.jsx("div",{style:{display:t==="elicitation"?"block":"none"},className:"h-full",children:f.jsx($Te,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state==="ready"})}),f.jsx("div",{style:{display:t==="notifications"?"block":"none"},className:"h-full",children:f.jsx(bTe,{notifications:e.notifications,unreadCount:e.unreadNotificationCount,markNotificationRead:e.markNotificationRead,markAllNotificationsRead:e.markAllNotificationsRead,clearNotifications:e.clearNotifications,serverId:e.id,isConnected:e.state==="ready"})}),t!=="tools"&&t!=="prompts"&&t!=="resources"&&t!=="chat"&&t!=="sampling"&&t!=="elicitation"&&t!=="notifications"&&f.jsx(f.Fragment,{children:i})]}):f.jsx(f.Fragment,{children:i})}function X2({className:e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentcolor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[f.jsx("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),f.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}const XY=w.createContext(void 0);function JY(){const e=w.use(XY);if(!e)throw new Error("useTabs must be used within a TabsProvider");return e}const QY=w.createContext(void 0);function PTe(){return w.use(QY)}function rk({ref:e,children:t,defaultValue:n,value:a,onValueChange:r,className:i,collapsed:s,onCollapsedChange:c,...u}){const[d,m]=w.useState(n||""),h=a!==void 0,g=s!==void 0,[v,x]=w.useState(!1),S=w.useCallback(k=>{h||m(k),r?.(k)},[h,r]),y=h?a:d,E=g?s:v,_=w.useCallback(k=>{g||x(k),c?.(k)},[g,c]);return f.jsx(XY,{value:{activeValue:y,handleValueChange:S,collapsed:E,handleCollapsedChange:_},children:f.jsx("div",{ref:e,className:De("flex flex-col gap-2",i),...u,children:t})})}rk.displayName="Tabs";function ak({ref:e,children:t,className:n,variant:a="default",collapsible:r=!1,...i}){const{activeValue:s,collapsed:c,handleCollapsedChange:u}=JY(),[d,m]=w.useState({width:0,left:0}),h=w.useRef(null),g=w.useRef(null),v=w.useRef(null),x=w.useCallback(()=>{const E=h.current;if(!E)return;const _=E.querySelector("div:first-child");if(!_)return;const k=_.querySelector(`button[data-tab-value="${s}"]`);if(k&&s){const C=_.getBoundingClientRect(),R=k.getBoundingClientRect();m({width:R.width,left:R.left-C.left})}else m({width:0,left:0})},[s]),S=w.useCallback(()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(x,16)},[x]);w.useEffect(()=>{const E=setTimeout(x,10);return()=>clearTimeout(E)},[x,c]),w.useEffect(()=>{const E=h.current;if(!E)return;g.current=new ResizeObserver(()=>{S()}),g.current.observe(E);const _=E.querySelector("div:first-child");return _&&_.querySelectorAll("button[data-tab-value]").forEach(C=>{g.current&&g.current.observe(C)}),()=>{g.current&&g.current.disconnect(),v.current&&clearTimeout(v.current)}},[S]),w.useEffect(()=>{const E=()=>{S()};return window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[S]);const y=w.useRef(null);return w.useEffect(()=>{y.current&&(y.current.style.width=`${d.width}px`,y.current.style.left=`${d.left}px`)},[d]),f.jsx(QY,{value:{variant:a,collapsed:c,handleCollapsedChange:u},children:f.jsx("div",{ref:h,className:De("relative flex items-center bg-none gap-1",a==="default"&&"p-1 rounded-full border border-zinc-300 dark:border-zinc-600",a==="underline"&&"border-b border-zinc-200 dark:border-zinc-700",n),...i,children:f.jsxs("div",{role:"tablist",className:"flex-1 flex items-center relative",children:[t,f.jsx("span",{ref:y,className:De("absolute transition-all duration-500 ease-in-out z-0",a==="default"&&"bg-white dark:bg-zinc-700 rounded-full h-[calc(100%)] top-0 border border-zinc-300 dark:border-zinc-600",a==="underline"&&"bottom-0 h-0.5 bg-black dark:bg-white")})]})})})}ak.displayName="TabsList";const UTe=({children:e,title:t,collapsed:n})=>!t||!n?e:f.jsx(ZN,{children:f.jsxs(Nt,{children:[f.jsx(Ct,{children:e}),f.jsx(Rt,{children:t})]})}),ik=w.forwardRef(({children:e,value:t,className:n,disabled:a,icon:r,title:i,...s},c)=>{const{activeValue:u,handleValueChange:d,collapsed:m}=JY(),g=PTe()?.variant||"default",v=u===t,x=m&&i?i:void 0;return f.jsx(UTe,{title:i,collapsed:m,children:f.jsxs("button",{ref:c,disabled:a,onClick:()=>d(t),"data-tab-value":t,"data-tab-active":v,role:"tab","aria-selected":v?"true":"false",title:x,className:De("relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-500 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer",g==="default"&&"py-2.5",g==="default"&&"rounded-md px-4",g==="underline"&&"px-6 py-3 border-b-2 border-transparent",v&&"text-foreground",!v&&"text-muted-foreground hover:text-foreground",n),...s,children:[r&&f.jsx(r,{className:De("h-4 w-4 transition-all duration-500 ease-in-out",!m&&"mr-2",m&&"mr-0!")}),f.jsx("span",{className:De("transition-all duration-500 ease-in-out overflow-hidden",m?"w-0 opacity-0":"w-auto opacity-100"),children:e})]})})});ik.displayName="TabsTrigger";function J2({className:e}){const{theme:t,setTheme:n}=xw(),a=w.useRef(null),[r,i]=w.useState(!1);w.useEffect(()=>{i(!0)},[]);const s=()=>t==="system"?"light":t==="light"?"dark":"system",c=()=>t==="system"?f.jsx(rz,{className:"size-4"}):t==="light"?f.jsx(Uhe,{className:"size-5"}):f.jsx(vhe,{className:"size-4"}),u=()=>t==="system"?"Switch to light mode":t==="light"?"Switch to dark mode":"Switch to system mode",d=async()=>{if(!a.current)return;const m=s();if(typeof document<"u"&&"startViewTransition"in document){await document.startViewTransition(()=>{Id.flushSync(()=>{n(m)})}).ready;const{top:h,left:g,width:v,height:x}=a.current.getBoundingClientRect(),S=h+x/2,y=g+v/2,E=window.innerWidth-g,_=window.innerHeight-h,k=Math.hypot(Math.max(g,E),Math.max(h,_));document.documentElement.animate({clipPath:[`circle(0px at ${y}px ${S}px)`,`circle(${k}px at ${y}px ${S}px)`]},{duration:700,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})}else n(m)};return r?f.jsx("button",{ref:a,onClick:d,className:De(e),"aria-label":u(),title:`Current: ${t==="system"?"Auto":t==="light"?"Light":"Dark"}`,children:c()}):f.jsx("button",{ref:a,className:De(e),"aria-label":"Toggle theme",children:f.jsx(rz,{className:"size-4"})})}function Q2({className:e,state:t="collapsed",href:n="https://mcp-use.com"}){const[a,r]=w.useState(!1),i=.2,s=.7,c=.6,u=4,d=i+s+c,m=0,h=i/d,g=(i+s)/d,v=1;return f.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:De("flex items-center transition-opacity -my-3",t==="expanded"?"space-x-2":"",e),onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[f.jsx("div",{className:"relative",children:f.jsxs(ya.svg,{viewBox:"0 0 303 303",initial:"rest",animate:a?"hover":"rest",className:De("text-foreground",t==="expanded"?"size-[40px]":"size-[20px]"),children:[f.jsxs(ya.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:d,times:[m,h,g,v],ease:"easeInOut"}}},fill:"currentColor",fillRule:"nonzero",stroke:"currentColor",strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",children:[f.jsx("path",{d:"m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z"}),f.jsx("circle",{cx:"70.3",cy:"232.3",r:"50"}),f.jsx("circle",{cx:"232.3",cy:"70.3",r:"50"})]}),f.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",children:[f.jsx(zTe,{d:"m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z",times:{T0:m,T1:h,T2:g,T3:v},total:d}),f.jsx(eF,{cx:70.3,cy:232.3,r:50,times:{T0:m,T1:h,T2:g,T3:v},total:d}),f.jsx(eF,{cx:232.3,cy:70.3,r:50,times:{T0:m,T1:h,T2:g,T3:v},total:d})]})]})}),t==="expanded"&&f.jsxs("div",{className:"font-ubuntu flex flex-col items-start -space-y-1 mr-3",children:[f.jsx("h1",{className:"text-xl font-medium",children:"mcp-use"}),f.jsx("span",{className:"text-lg text-muted-foreground tracking-wide font-sans font-light",children:"Inspector"})]})]})}function zTe({d:e,times:t,total:n}){const{T0:a,T1:r,T2:i,T3:s}=t;return f.jsx(ya.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[a,r,i,s],ease:"easeInOut"}}}})}function eF({cx:e,cy:t,r:n,times:a,total:r}){const{T0:i,T1:s,T2:c,T3:u}=a;return f.jsx(ya.circle,{cx:e,cy:t,r:n,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:r,times:[i,s,c,u],ease:"easeInOut"}}}})}function eq({ref:e,shimmerColor:t,shimmerSize:n="0.05em",shimmerDuration:a="3s",borderRadius:r="100px",background:i,className:s,children:c,...u}){const{resolvedTheme:d}=xw(),m=d==="dark"?"#000000":"#ffffff",h=d==="dark"?"rgba(255, 255, 255, 1)":"rgba(0, 0, 0, 1)",g=t||m,v=i||h;return f.jsxs("button",{style:{"--spread":"90deg","--shimmer-color":g,"--radius":r,"--speed":a,"--cut":n,"--bg":v},className:De("group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]","transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px",d==="dark"?"border-black/10 text-black":"border-white/10 text-white",s),ref:e,...u,children:[f.jsx("div",{className:De("-z-30 blur-[2px]","[container-type:size] absolute inset-0 overflow-visible"),children:f.jsx("div",{className:"animate-shimmer-slide absolute inset-0 [aspect-ratio:1] h-[100cqh] [border-radius:0] [mask:none]",children:f.jsx("div",{className:"animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]"})})}),c,f.jsx("div",{className:De("absolute inset-0 size-full","rounded-2xl px-4 py-1.5 text-sm font-medium","transform-gpu transition-all duration-300 ease-in-out",d==="dark"?"shadow-[inset_0_-8px_10px_#0000001f] group-hover:shadow-[inset_0_-6px_10px_#0000003f] group-active:shadow-[inset_0_-10px_10px_#0000003f]":"shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]")}),f.jsx("div",{className:De("absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] [background:var(--bg)]")})]})}eq.displayName="ShimmerButton";function tF({status:e}){const t=i=>{switch(i){case"ready":return{color:"bg-emerald-500",ringColor:"ring-emerald-500",tooltip:"Connected"};case"failed":return{color:"bg-red-500",ringColor:"ring-red-500",tooltip:"Failed"};default:return{color:"bg-yellow-500",ringColor:"ring-yellow-500",tooltip:i}}},{color:n,ringColor:a,tooltip:r}=t(e);return f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsxs("div",{className:"relative",children:[f.jsx("div",{className:`absolute w-2 h-2 rounded-full ${a} animate-ping`}),f.jsx("div",{className:`relative w-2 h-2 rounded-full ${n}`})]})}),f.jsx(Rt,{children:f.jsx("p",{children:r})})]})}function nF({connections:e,selectedServer:t,onServerSelect:n,onOpenConnectionOptions:a,mobileMode:r=!1}){const i=Cd(),s=c=>{const u=e.find(d=>d.id===c);if(!u||u.state!=="ready"){Xt.error("Server is not connected and cannot be inspected");return}n(c)};return r?f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("div",{className:"relative",children:f.jsxs(V_,{children:[f.jsx(G_,{asChild:!0,children:f.jsxs(Le,{variant:"ghost",className:"h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5",children:[t?f.jsx(Il,{serverUrl:t.url,serverName:t.name,size:"md"}):f.jsx(Rhe,{className:"h-5 w-5"}),f.jsx(rc,{className:"h-4 w-4"})]})}),f.jsxs(Cv,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[f.jsx(W_,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>i("/"),children:"MCP Servers"}),f.jsx(rp,{}),e.length===0?f.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center",children:"No servers connected. Go to the dashboard to add one."}):e.map(c=>f.jsxs(Ro,{onClick:()=>s(c.id),className:"flex items-center gap-3",children:[f.jsx(Il,{serverUrl:c.url,serverName:c.name,size:"sm"}),f.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[f.jsx("div",{className:"font-medium",children:c.name}),f.jsx(tF,{status:c.state})]}),f.jsx(Le,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:u=>{u.stopPropagation(),a(c.id)},children:f.jsx(_u,{className:"h-3 w-3"})})]},c.id)),f.jsx(rp,{}),f.jsx(Ro,{onClick:()=>i("/"),children:f.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})}):f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("div",{className:"relative",children:f.jsxs(V_,{children:[f.jsx(G_,{asChild:!0,children:f.jsxs(eq,{className:De("min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200",!t&&"pl-4",t&&"pr-10"),children:[t&&f.jsx(Il,{serverUrl:t.url,serverName:t.name,size:"md",className:"mr-2"}),f.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[f.jsx("span",{className:"truncate",children:t?t.name:"Select server to inspect"}),t&&f.jsx("div",{className:"flex items-center gap-2",children:t.error&&t.state!=="ready"?f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx("button",{onClick:c=>{c.stopPropagation()},className:"w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors",title:"Click to copy error message","aria-label":"Copy error message to clipboard"})}),f.jsx(Rt,{children:f.jsx("p",{className:"max-w-xs",children:t.error})})]}):f.jsx("div",{className:`w-2 h-2 rounded-full ${t.state==="ready"?"bg-emerald-600 animate-status-pulse":t.state==="failed"?"bg-rose-600 animate-status-pulse-red":"bg-yellow-500 animate-status-pulse-yellow"}`})})]})]})}),t&&f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx("button",{type:"button",onClick:()=>{a(t.id)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black","aria-label":"Edit connection settings",children:f.jsx(_u,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:f.jsx("p",{children:"Edit connection settings"})})]}),f.jsxs(Cv,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[f.jsx(W_,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>i("/"),children:"MCP Servers"}),f.jsx(rp,{}),e.length===0?f.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center",children:"No servers connected. Go to the dashboard to add one."}):e.map(c=>f.jsxs(Ro,{onClick:()=>s(c.id),className:"flex items-center gap-3",children:[f.jsx(Il,{serverUrl:c.url,serverName:c.name,size:"sm"}),f.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[f.jsx("div",{className:"font-medium",children:c.name}),f.jsx(tF,{status:c.state})]}),f.jsx(Le,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:u=>{u.stopPropagation(),a(c.id)},children:f.jsx(_u,{className:"h-3 w-3"})})]},c.id)),f.jsx(rp,{}),f.jsx(Ro,{onClick:()=>i("/"),children:f.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})})}const rF=[{id:"tools",label:"Tools",icon:Gl},{id:"prompts",label:"Prompts",icon:Hp},{id:"resources",label:"Resources",icon:ehe},{id:"sampling",label:"Sampling",icon:PG},{id:"elicitation",label:"Elicitation",icon:BG},{id:"notifications",label:"Notifications",icon:qN},{id:"chat",label:"Chat",icon:fhe}];function aF(e,t){return e==="tools"?t.tools.length:e==="prompts"?t.prompts.length:e==="resources"?t.resources.length:e==="sampling"?t.pendingSamplingRequests?.length||0:e==="elicitation"?t.pendingElicitationRequests?.length||0:e==="notifications"?t.unreadNotificationCount:0}function FTe({collapsed:e,onToggle:t}){return f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx("button",{onClick:t,className:De("shrink-0 p-1.5 rounded-md transition-all duration-500 ease-in-out cursor-pointer","text-muted-foreground hover:text-foreground","hover:bg-zinc-100 dark:hover:bg-zinc-800","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),"aria-label":e?"Expand tabs":"Collapse tabs",type:"button",children:e?f.jsx($G,{className:"h-4 w-4 transition-transform duration-500 ease-in-out"}):f.jsx(qy,{className:"h-4 w-4 transition-transform duration-500 ease-in-out"})})}),f.jsx(Rt,{children:f.jsx("p",{children:e?"Expand tabs":"Collapse tabs"})})]})}function BTe({connections:e,selectedServer:t,activeTab:n,onServerSelect:a,onTabChange:r,onCommandPaletteOpen:i,onOpenConnectionOptions:s}){const{tunnelUrl:c}=ac(),u=t&&c,[d,m]=w.useState(!1),[h,g]=w.useState(!1),v=async()=>{if(c)try{await navigator.clipboard.writeText(`${c}/mcp`),m(!0),Xt.success("Tunnel URL copied to clipboard"),setTimeout(()=>m(!1),2e3)}catch{Xt.error("Failed to copy URL")}};return f.jsxs("header",{className:"w-full mx-auto",children:[f.jsxs("div",{className:"flex lg:hidden flex-col gap-3",children:[f.jsxs("div",{className:"flex items-center justify-between w-full",children:[f.jsx("div",{className:"flex-1 flex justify-start",children:f.jsx(nF,{connections:e,selectedServer:t,onServerSelect:a,onOpenConnectionOptions:s,mobileMode:!0})}),f.jsx("div",{className:"flex-shrink-0 flex justify-center",children:f.jsx("div",{className:"scale-150",children:f.jsx(Q2,{state:"collapsed"})})}),f.jsxs("div",{className:"flex-1 flex justify-end items-center gap-2",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",asChild:!0,children:f.jsx("a",{href:"https://github.com/mcp-use/mcp-use",target:"_blank",rel:"noopener noreferrer",className:"p-2","aria-label":"GitHub",children:f.jsx(X2,{className:"h-4 w-4"})})})}),f.jsx(Rt,{children:f.jsx("p",{children:"Give us a star ⭐"})})]}),f.jsx(J2,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})]})]}),t&&f.jsx("div",{className:"w-full",children:f.jsx(rk,{value:n,onValueChange:x=>r(x),collapsed:h,onCollapsedChange:g,children:f.jsx(ak,{className:"w-full justify-center",children:rF.map(x=>{const S=aF(x.id,t);return f.jsxs(ik,{value:x.id,icon:x.icon,className:De("[&>svg]:mr-0 flex-1 flex-row gap-2 relative",h&&"pl-2"),children:[S>0&&f.jsx("span",{className:De(n===x.id?"dark:bg-black":"dark:bg-zinc-700","bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-[10px] px-1.5 py-0.5 rounded-full font-medium"),children:S}),f.jsx("span",{className:"sr-only",children:x.label})]},x.id)})})})})]}),f.jsxs("div",{className:"hidden lg:flex items-center justify-between gap-3",children:[f.jsxs("div",{className:"flex items-center flex-wrap gap-2 md:space-x-6 space-x-2",children:[f.jsx(nF,{connections:e,selectedServer:t,onServerSelect:a,onOpenConnectionOptions:s}),t&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(rk,{value:n,onValueChange:x=>r(x),collapsed:h,onCollapsedChange:g,children:f.jsx(ak,{className:"overflow-x-auto",collapsible:!0,children:rF.map(x=>{const S=aF(x.id,t),y=S>0?`${x.label} (${S})`:x.label;return f.jsx(ik,{value:x.id,icon:x.icon,className:De("[&>svg]:mr-0 lg:[&>svg]:mr-2 relative",h&&"pl-4"),title:y,children:f.jsxs("div",{className:"items-center gap-2 hidden lg:flex",children:[x.label,S>0&&f.jsx("span",{className:De(n===x.id?" dark:bg-black ":"dark:bg-zinc-700","bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-xs px-2 py-0.5 rounded-full font-medium"),children:S})]})})})})}),f.jsx(FTe,{collapsed:h,onToggle:()=>g(!h)})]}),u&&f.jsxs(KK,{children:[f.jsx(ZK,{asChild:!0,children:f.jsxs("button",{className:"flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-500/10 to-pink-500/10 dark:from-purple-500/20 dark:to-pink-500/20 border border-purple-500/30 dark:border-purple-500/40 rounded-full hover:from-purple-500/20 hover:to-pink-500/20 dark:hover:from-purple-500/30 dark:hover:to-pink-500/30 transition-colors cursor-pointer",children:[f.jsx(Vp,{className:"size-4 text-purple-600 dark:text-purple-400 animate-pulse"}),f.jsx("span",{className:"text-xs font-medium text-purple-700 dark:text-purple-300 hidden lg:inline",children:"Tunnel"})]})}),f.jsx(WC,{className:"w-[calc(100vw-2rem)] sm:w-96",align:"start",children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsxs("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:[f.jsx(Vp,{className:"size-4 text-purple-600 dark:text-purple-400"}),"Tunnel URL"]}),f.jsxs("div",{className:"flex items-center gap-2 p-2 py-0 bg-muted rounded-full",children:[f.jsxs("code",{className:"flex-1 text-[10px] font-mono",children:[c,"/mcp"]}),f.jsx(Le,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:v,children:d?f.jsx(ra,{className:"size-3.5 text-green-600"}):f.jsx(Lr,{className:"size-3.5"})})]})]}),f.jsxs("div",{children:[f.jsx("h5",{className:"font-semibold text-sm mb-2",children:"Use in ChatGPT"}),f.jsxs("ol",{className:"space-y-2 text-xs text-muted-foreground",children:[f.jsxs("li",{className:"flex gap-2",children:[f.jsx("span",{className:"font-semibold text-foreground",children:"1."}),f.jsxs("span",{children:["Enable"," ",f.jsx("span",{className:"font-medium text-foreground",children:"dev mode"})," ","from settings"]})]}),f.jsxs("li",{className:"flex gap-2",children:[f.jsx("span",{className:"font-semibold text-foreground",children:"2."}),f.jsxs("span",{children:["In"," ",f.jsx("span",{className:"font-medium text-foreground",children:"App & Connectors"})," ","click on"," ",f.jsx("span",{className:"font-medium text-foreground",children:"create"})]})]}),f.jsxs("li",{className:"flex gap-2",children:[f.jsx("span",{className:"font-semibold text-foreground",children:"3."}),f.jsx("span",{children:"Use the tunnel URL in the input"})]})]})]})]})})]})]}),f.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{children:f.jsx(J2,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})}),f.jsx(Rt,{children:f.jsx("p",{children:"Toggle theme"})})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsxs(Le,{variant:"ghost",className:"hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full px-1 -mx-3 flex gap-1",onClick:i,children:[f.jsx(Mme,{className:"size-4"}),f.jsx("span",{className:"text-base font-mono hidden sm:inline",children:"K"})]})}),f.jsx(Rt,{children:f.jsx("p",{children:"Command Palette"})})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",asChild:!0,children:f.jsxs("a",{href:"https://github.com/mcp-use/mcp-use",className:"flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",children:[f.jsx(X2,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Github"})]})})}),f.jsx(Rt,{children:f.jsx("p",{children:"Give us a star ⭐"})})]}),f.jsx(Q2,{state:"expanded"})]})]})]})}function HTe({children:e}){const t=Cd(),n=Vo(),{connections:a,addConnection:r,removeConnection:i,updateConnectionConfig:s,configLoaded:c}=YN(),{selectedServerId:u,setSelectedServerId:d,activeTab:m,setActiveTab:h,navigateToItem:g,setTunnelUrl:v}=ac(),[x,S]=w.useState(!1),[y,E]=w.useState(null),_=rSe();w.useEffect(()=>{const Z=new URLSearchParams(n.search).get("tunnelUrl");v(Z)},[n.search,v]),w.useEffect(()=>{const H=re=>{const j=re.detail.requestId;u&&g(u,"sampling",j)},Z=re=>{const j=re.detail.requestId;u&&g(u,"elicitation",j)},G=re=>{const j=re.detail.toolName;u&&j?g(u,"tools",j):u&&h("tools")};return window.addEventListener("navigate-to-sampling",H),window.addEventListener("navigate-to-elicitation",Z),window.addEventListener("navigate-to-tool-result",G),()=>{window.removeEventListener("navigate-to-sampling",H),window.removeEventListener("navigate-to-elicitation",Z),window.removeEventListener("navigate-to-tool-result",G)}},[u,h,g]);const k=w.useRef(null),C=w.useRef(null),R=w.useRef(null),{isAutoConnecting:I}=nSe({connections:a,addConnection:r,removeConnection:i,configLoaded:c}),A=w.useCallback(H=>{vr.getInstance().capture(new eme({trigger:H})).catch(()=>{}),S(!0)},[]),O=H=>{const Z=a.find(j=>j.id===H);if(!Z||Z.state!=="ready"){Xt.error("Server is not connected and cannot be inspected");return}d(H);const re=new URLSearchParams(n.search).get("tunnelUrl"),ne=re?`/?server=${encodeURIComponent(H)}&tunnelUrl=${encodeURIComponent(re)}`:`/?server=${encodeURIComponent(H)}`;t(ne)},M=w.useCallback(H=>{E(H)},[]),P=w.useCallback(H=>{y&&(H.url!==y?(i(y),r(H.url,H.name,H.proxyConfig,H.transportType)):s(y,{name:H.name,proxyConfig:H.proxyConfig,transportType:H.transportType}),E(null),Xt.success("Connection settings updated"))},[y,i,r,s]),B=(H,Z,G)=>{if(console.warn("[Layout] handleCommandPaletteNavigate called:",{tab:H,itemName:Z,serverId:G}),G){const re=a.find(z=>z.id===G);if(console.warn("[Layout] Server lookup:",{serverId:G,serverFound:!!re,serverState:re?.state}),!re||re.state!=="ready"){console.warn("[Layout] Server not ready, showing error"),Xt.error("Server is not connected and cannot be inspected");return}console.warn("[Layout] Calling navigateToItem:",{serverId:G,tab:H,itemName:Z}),g(G,H,Z);const j=new URLSearchParams(n.search).get("tunnelUrl"),V=j?`/?server=${encodeURIComponent(G)}&tunnelUrl=${encodeURIComponent(j)}`:`/?server=${encodeURIComponent(G)}`;console.warn("[Layout] Navigating to:",V),t(V)}else console.warn("[Layout] No serverId, just updating tab to:",H),h(H)},K=a.find(H=>H.id===u),ee=K?K.tools.map(H=>({...H,_serverId:K.id})):a.flatMap(H=>H.state==="ready"?H.tools.map(Z=>({...Z,_serverId:H.id,_serverName:H.name})):[]),te=K?K.prompts.map(H=>({...H,_serverId:K.id})):a.flatMap(H=>H.state==="ready"?H.prompts.map(Z=>({...Z,_serverId:H.id,_serverName:H.name})):[]),ae=K?K.resources.map(H=>({...H,_serverId:K.id})):a.flatMap(H=>H.state==="ready"?H.resources.map(Z=>({...Z,_serverId:H.id,_serverName:H.name})):[]);return w.useEffect(()=>{const Z=new URLSearchParams(n.search).get("server"),G=Z?decodeURIComponent(Z):null;G!==u&&d(G)},[n.search,u,d]),w.useEffect(()=>{const Z=new URLSearchParams(n.search).get("server");if(!Z)return;const G=decodeURIComponent(Z),re=a.find(ne=>ne.id===G);if(!re){const ne=setTimeout(()=>t("/"),3e3);return()=>clearTimeout(ne)}if(re.state==="failed"){const ne=setTimeout(()=>t("/"),2e3);return()=>clearTimeout(ne)}},[n.search,t,a]),SK({onCommandPalette:()=>A("keyboard"),onToolsTab:()=>{K&&h("tools")},onPromptsTab:()=>{K&&h("prompts")},onResourcesTab:()=>{K&&h("resources")},onChatTab:()=>{K&&h("chat")},onHome:()=>{t("/")},onFocusSearch:()=>{m==="tools"&&k.current?k.current.focusSearch():m==="prompts"&&C.current?C.current.focusSearch():m==="resources"&&R.current&&R.current.focusSearch()},onBlurSearch:()=>{m==="tools"&&k.current?k.current.blurSearch():m==="prompts"&&C.current?C.current.blurSearch():m==="resources"&&R.current&&R.current.blurSearch()}}),I?f.jsx("div",{className:"h-screen bg-white dark:bg-zinc-900 flex items-center justify-center",children:f.jsxs("div",{className:"flex flex-col items-center gap-4",children:[f.jsx(ki,{className:"h-8 w-8 text-zinc-600 dark:text-zinc-400"}),f.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Connecting to MCP server..."})]})}):f.jsx(ZN,{children:f.jsxs("div",{className:"h-screen bg-[#f3f3f3] dark:bg-black flex flex-col px-2 py-2 sm:px-4 sm:py-4 gap-2 sm:gap-4",children:[f.jsx(BTe,{connections:a,selectedServer:K,activeTab:m,onServerSelect:O,onTabChange:h,onCommandPaletteOpen:()=>A("button"),onOpenConnectionOptions:M}),f.jsx("main",{className:"flex-1 w-full mx-auto bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 p-0 overflow-auto",children:f.jsx(MTe,{selectedServer:K,activeTab:m,toolsSearchRef:k,promptsSearchRef:C,resourcesSearchRef:R,children:e})}),f.jsx(ASe,{isOpen:x,onOpenChange:S,tools:ee,prompts:te,resources:ae,savedRequests:_,connections:a,onNavigate:B,onServerSelect:O}),f.jsx(M7,{connection:y&&a.find(H=>H.id===y)||null,open:y!==null,onOpenChange:H=>{H||E(null)},onConnect:P})]})})}function VTe(){const[e,t]=w.useState("processing"),[n,a]=w.useState("");return w.useEffect(()=>{console.log("[OAuthCallback] Component mounted, handling authorization..."),console.log("[OAuthCallback] Current URL:",window.location.href),vN().then(()=>{console.log("[OAuthCallback] Authorization successful"),t("success")}).catch(r=>{console.error("[OAuthCallback] Authorization failed:",r),t("error"),a(r instanceof Error?r.message:String(r))})},[]),e==="processing"?f.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:f.jsxs("div",{className:"flex flex-col items-center gap-4",children:[f.jsx(zs,{className:"h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400"}),f.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Completing authentication..."})]})}):e==="error"?f.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:f.jsxs("div",{className:"max-w-md p-6",children:[f.jsx("h1",{className:"text-xl font-semibold text-red-600 dark:text-red-400 mb-2",children:"Authentication Error"}),f.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mb-4",children:n}),f.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-500",children:"You can close this window and try again."})]})}):f.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:f.jsxs("div",{className:"max-w-md p-6",children:[f.jsx("h1",{className:"text-xl font-semibold text-green-600 dark:text-green-400 mb-2",children:"Authentication Successful!"}),f.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Redirecting you back..."})]})})}var GTe=(e,t,n,a,r,i,s,c)=>{let u=document.documentElement,d=["light","dark"];function m(v){(Array.isArray(e)?e:[e]).forEach(x=>{let S=x==="class",y=S&&i?r.map(E=>i[E]||E):r;S?(u.classList.remove(...y),u.classList.add(i&&i[v]?i[v]:v)):u.setAttribute(x,v)}),h(v)}function h(v){c&&d.includes(v)&&(u.style.colorScheme=v)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(a)m(a);else try{let v=localStorage.getItem(t)||n,x=s&&v==="system"?g():v;m(x)}catch{}},WTe=w.createContext(void 0),KTe={setTheme:e=>{},themes:[]},ZTe=()=>{var e;return(e=w.useContext(WTe))!=null?e:KTe};w.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:a,enableColorScheme:r,defaultTheme:i,value:s,themes:c,nonce:u,scriptProps:d})=>{let m=JSON.stringify([n,t,i,e,c,s,a,r]).slice(1,-1);return w.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?u:"",dangerouslySetInnerHTML:{__html:`(${GTe.toString()})(${m})`}})});function YTe({...e}){const{theme:t="system"}=ZTe();return f.jsx(HG,{theme:t,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...e})}function qTe(){return f.jsx(vEe,{children:f.jsx(sme,{children:f.jsxs(tSe,{children:[f.jsx(ile,{basename:"/inspector",children:f.jsxs($se,{children:[f.jsx(j_,{path:"/oauth/callback",element:f.jsx(VTe,{})}),f.jsx(j_,{path:"/",element:f.jsx(HTe,{children:f.jsx(eSe,{})})})]})}),f.jsx(YTe,{position:"top-center"})]})})})}const iF=new URLSearchParams(window.location.search);if(iF.has("code")||iF.has("error"))try{vN()}catch(e){console.error("[inspector] OAuth callback error:",e)}const oF=document.getElementById("root");oF?Voe.createRoot(oF).render(f.jsx(qTe,{})):console.error("[inspector] Root element not found");export{u6 as $,Ll as A,Eae as B,ZP as C,ov as D,Ot as E,vF as F,RJ as G,Noe as H,Ob as I,Cb as J,Coe as K,uF as L,_oe as M,vN as N,IJ as O,vi as P,i_ as Q,ue as R,ni as S,zi as T,M6 as U,bJ as V,kB as W,HB as X,AF as Y,Lne as Z,ze as _,Jn as a,DF as a0,$6 as a1,EB as a2,Ed as b,ny as c,id as d,$T as e,Cne as f,JTe as g,hne as h,wy as i,od as j,F5 as k,Nb as l,a_ as m,iv as n,Jf as o,FF as p,UT as q,w as r,Op as s,su as t,ad as u,Eoe as v,Jb as w,ke as x,ks as y,koe as z};
1676
+ `),Ue.document.close())}},[x]),Pr=w.useCallback(()=>{W?(oe.current&&oe.current.expand(),Ce.current&&Ce.current.expand(),X(!1)):(oe.current&&oe.current.collapse(),Ce.current&&Ce.current.collapse(),X(!0))},[W]),St=w.useCallback(()=>{s&&(ae(""),ee(!0))},[s]),Be=w.useCallback(()=>{if(!s)return;const _e={id:`${Date.now()}-${Math.random()}`,name:te.trim()||`${s.name} - ${new Date().toLocaleString()}`,toolName:s.name,args:g,savedAt:Date.now(),serverId:s._serverId,serverName:s._serverName};Fe([...P,_e]),vr.getInstance().capture(new tme({toolName:s.name,serverId:r})).catch(()=>{}),ee(!1),ae("")},[s,te,g,P,Fe,r]),$e=w.useCallback(_e=>{Fe(P.filter(je=>je.id!==_e)),u?.id===_e&&d(null)},[P,Fe,u]);return z?f.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[$!=="list"&&f.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[f.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>{$==="response"?F("detail"):(c(null),F("list"))},className:"p-0 h-8 w-8",children:f.jsx(qy,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex items-center text-sm font-medium",children:[f.jsx("button",{onClick:()=>{c(null),F("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Tools"}),$==="detail"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("button",{onClick:()=>{F("response")},className:$==="detail"?"text-foreground hover:underline":$==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),$==="response"&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),f.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),f.jsx("div",{className:"flex-1 relative overflow-hidden",children:f.jsxs(rw,{initial:!1,mode:"popLayout",children:[$==="list"&&f.jsxs(ya.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 flex flex-col bg-background z-0",children:[f.jsx(Y2,{activeTab:O,isSearchExpanded:G,searchQuery:I,filteredToolsCount:pe.length,savedRequestsCount:P.length,onSearchExpand:()=>re(!0),onSearchChange:A,onSearchBlur:Se,onTabSwitch:()=>M(O==="tools"?"saved":"tools"),searchInputRef:V}),O==="tools"?f.jsx(Z2,{tools:pe,selectedTool:s,onToolSelect:Oe,focusedIndex:ne}):f.jsx(B2,{savedRequests:P,selectedRequest:u,onLoadRequest:He,onDeleteRequest:$e,focusedIndex:ne})]},"list"),$==="detail"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-10",children:f.jsx(G2,{selectedTool:s,toolArgs:g,isExecuting:y,isConnected:i,onArgChange:at,onExecute:nt,onSave:St})},"detail"),$==="response"&&f.jsx(ya.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"absolute inset-0 bg-background z-20",children:f.jsx(K2,{results:pt,copiedResult:_,previewMode:H,serverId:r,readResource:a,onCopy:ft,onDelete:Et,onFullscreen:mn,onTogglePreview:()=>Z(!H)})},"response")]})}),f.jsx(H2,{isOpen:K,requestName:te,defaultPlaceholder:`${s?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ae,onSave:Be,onCancel:()=>ee(!1)})]}):f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{ref:oe,defaultSize:33,collapsible:!0,className:"flex flex-col h-full relative",children:f.jsxs(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[f.jsx(Rn,{defaultSize:75,minSize:30,children:f.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[f.jsx(Y2,{activeTab:O,isSearchExpanded:G,searchQuery:I,filteredToolsCount:pe.length,savedRequestsCount:P.length,onSearchExpand:()=>re(!0),onSearchChange:A,onSearchBlur:Se,onTabSwitch:()=>M(O==="tools"?"saved":"tools"),searchInputRef:V}),O==="tools"?f.jsx(Z2,{tools:pe,selectedTool:s,onToolSelect:Oe,focusedIndex:ne}):f.jsx(B2,{savedRequests:P,selectedRequest:u,onLoadRequest:He,onDeleteRequest:$e,focusedIndex:ne})]})}),f.jsx(Si,{withHandle:!0}),f.jsxs(Rn,{ref:xe,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>{q(!0)},onExpand:()=>{q(!1)},className:"flex flex-col border-t dark:border-zinc-700",children:[f.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),J?(xe.current?.resize(25),q(!1)):(xe.current?.resize(5),q(!0))},children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),ie>0&&f.jsx(wr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:ie}),ie>0&&!J&&f.jsx(Le,{variant:"ghost",size:"sm",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),Te.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:f.jsx(Fs,{className:"h-3.5 w-3.5"})})]}),f.jsx(rc,{className:`h-4 w-4 text-muted-foreground transition-transform ${J?"":"rotate-180"}`})]}),!J&&f.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:f.jsx(ED,{serverIds:[r],onCountChange:ce,onClearRef:Te})})]})]})}),f.jsx(Si,{withHandle:!0}),f.jsx(Rn,{defaultSize:67,children:f.jsxs(na,{direction:"vertical",children:[f.jsx(Rn,{ref:Ce,defaultSize:40,collapsible:!0,children:f.jsx(G2,{selectedTool:s,toolArgs:g,isExecuting:y,isConnected:i,onArgChange:at,onExecute:nt,onSave:St,onCancel:()=>{C&&C.abort()}})}),f.jsx(Si,{withHandle:!0}),f.jsx(Rn,{ref:Ve,defaultSize:60,children:f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(K2,{results:pt,copiedResult:_,previewMode:H,serverId:r,readResource:a,onCopy:ft,onDelete:Et,onFullscreen:mn,onTogglePreview:()=>Z(!H),onMaximize:Pr,isMaximized:W})})})]})}),f.jsx(H2,{isOpen:K,requestName:te,defaultPlaceholder:`${s?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ae,onSave:Be,onCancel:()=>ee(!1)})]})}qY.displayName="ToolsTab";function CTe({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:a,onSearchExpand:r,onSearchChange:i,onSearchBlur:s,onRejectAll:c,searchInputRef:u}){return f.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?f.jsx(En,{ref:u,placeholder:"Search requests...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Sampling"}),f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,disabled:a===0,className:"h-8 w-8 p-0",children:f.jsx(Fs,{className:"h-4 w-4"})})}),f.jsx(Rt,{side:"bottom",children:"Reject all"})]})})]})}function RTe({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:a,formatRelativeTime:r,listRef:i}){return e.length===0?f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No sampling requests"})}):f.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>{const u=s.request.params?.messages?.length||0,d=s.request.params?.maxTokens;return f.jsx(Qs,{id:`sampling-request-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,title:f.jsxs("span",{className:"flex items-center gap-3",children:[s.serverName,f.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const m=r(s.timestamp),h=[];u>0&&h.push(`${u} message${u>1?"s":""}`),d&&h.push(`max ${d} tokens`);const g=h.length>0?` | ${h.join(", ")}`:"";return m+g})(),onClick:()=>n(s)},s.id)})})}function ATe({llmConfig:e}){const t=w.useRef(null);return{generateResponse:w.useCallback(async({request:a})=>{if(!e)throw new Error("LLM config is not available");const r=a.params||{},i=r.maxTokens,s=r.temperature;r.modelPreferences;const c=r.messages||[];if(console.log("[useSamplingLLM] Request structure:",{hasParams:!!r,messagesCount:c.length,messages:c,params:r}),c.length===0)throw new Error("No messages found in sampling request");const u=[],{HumanMessage:d,AIMessage:m}=await Jn(async()=>{const{HumanMessage:x,AIMessage:S}=await import("./index-t0uG7tP6.js").then(y=>y.bI);return{HumanMessage:x,AIMessage:S}},[]);for(const x of c){if(!x||!x.role){console.warn("Skipping invalid message:",x);continue}const S=Array.isArray(x.content)?x.content[0]:x.content;if(!S){console.warn("Skipping message with no content:",x);continue}S.type==="text"&&S.text?x.role==="user"?u.push(new d(S.text)):x.role==="assistant"&&u.push(new m(S.text)):console.warn("Skipping message with unsupported content type:",S)}if(u.length===0)throw new Error("No valid messages could be converted. Please ensure messages have 'text' content type.");if(!t.current||t.current.provider!==e.provider||t.current.model!==e.model||t.current.apiKey!==e.apiKey){let x;const S={model:e.model,apiKey:e.apiKey};if(i!==void 0&&(S.maxTokens=i),s!==void 0?S.temperature=s:e.temperature!==void 0&&(S.temperature=e.temperature),e.provider==="openai"){const{ChatOpenAI:y}=await Jn(async()=>{const{ChatOpenAI:E}=await import("./index-D-OMhIK9.js");return{ChatOpenAI:E}},__vite__mapDeps([6,7,8,2,9,10,11]));x=new y(S)}else if(e.provider==="anthropic"){const{ChatAnthropic:y}=await Jn(async()=>{const{ChatAnthropic:E}=await import("./index-CVD-P0xp.js");return{ChatAnthropic:E}},__vite__mapDeps([12,8,7,2,11]));x=new y(S)}else if(e.provider==="google"){const{ChatGoogleGenerativeAI:y}=await Jn(async()=>{const{ChatGoogleGenerativeAI:E}=await import("./index-ll3isPzo.js");return{ChatGoogleGenerativeAI:E}},__vite__mapDeps([13,8,7,2,10]));x=new y(S)}else throw new Error(`Unsupported LLM provider: ${e.provider}`);t.current={instance:x,provider:e.provider,model:e.model,apiKey:e.apiKey}}const h=await t.current.instance.invoke(u);return{role:"assistant",content:{type:"text",text:h.content||h.text||""},model:e.model,stopReason:"endTurn"}},[e]),isAvailable:e!==null}}function ITe({request:e,onApprove:t,onReject:n,onClose:a,previewMode:r,onTogglePreview:i,isCopied:s,onCopy:c,onDownload:u,onFullscreen:d,llmConfig:m}){const[h,g]=w.useState("manual"),[v,x]=w.useState("stub-model"),[S,y]=w.useState("endTurn"),[E,_]=w.useState("assistant"),[k,C]=w.useState("text"),[R,I]=w.useState("positive"),[A,O]=w.useState(""),[M,P]=w.useState("image/png"),[B,K]=w.useState(!1),[ee,te]=w.useState(null),{generateResponse:ae,isAvailable:H}=ATe({llmConfig:m});w.useEffect(()=>{e&&(x("stub-model"),y("endTurn"),_("assistant"),C("text"),I("positive"),O(""),P("image/png"),te(null))},[e?.id]);const Z=async()=>{if(!(!e||!H)){K(!0),te(null);try{const j=await ae({request:e.request});x(j.model||m?.model||"stub-model"),y(j.stopReason||"endTurn"),_(j.role||"assistant");const V=Array.isArray(j.content)?j.content[0]:j.content;V.type==="text"?(C("text"),I(V.text||"")):V.type==="image"&&(C("image"),O(V.data||""),P(V.mimeType||"image/png"))}catch(j){const V=j instanceof Error?j.message:"Failed to generate response";te(V),Xt.error("LLM Generation Failed",{description:V})}finally{K(!1)}}},G=w.useMemo(()=>{const j={model:v,stopReason:S,role:E,content:{type:k}};return k==="text"?j.content.text=R:k==="image"&&(j.content.data=A,j.content.mimeType=M),j},[v,S,E,k,R,A,M]),re=()=>{if(!e)return;const j=cN.safeParse(G);if(!j.success){Xt.error("Invalid response",{description:`Validation failed: ${j.error.message}`});return}t(e.id,j.data),a(),Jn(()=>Promise.resolve().then(()=>Ed),void 0).then(V=>{const z=Xt(V.createElement("div",{className:"space-y-3"},V.createElement("div",null,V.createElement("strong",null,"Sampling Response Sent"),V.createElement("p",{className:"text-sm text-muted-foreground mt-1"},"The tool will continue executing.")),V.createElement("div",{className:"flex gap-2"},V.createElement("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>{const L=new globalThis.CustomEvent("navigate-to-tool-result",{detail:{toolName:e.toolName}});window.dispatchEvent(L),Xt.dismiss(z)}},"View Tool Result"))),{duration:5e3})})},ne=()=>{e&&(n(e.id,"User rejected sampling request"),a())};return e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"flex items-center justify-between p-4 border-b dark:border-zinc-700",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.serverName}),f.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleString()})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0",children:s?f.jsx(ra,{className:"h-4 w-4 text-green-600"}):f.jsx(Lr,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Copy request"})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:f.jsx($m,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Download request"})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:d,className:"h-8 w-8 p-0",children:f.jsx(QN,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Fullscreen"})]}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:f.jsx(Ji,{className:"h-4 w-4"})})]})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Request"}),f.jsx("div",{className:"bg-muted rounded-lg p-3 max-h-64 overflow-auto",children:f.jsx(Xn,{data:e.request})})]}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Response"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Kt,{htmlFor:`responseMode-${e.id}`,className:"text-xs text-gray-500 dark:text-gray-400",children:"Mode:"}),f.jsxs(Io,{value:h,onValueChange:j=>g(j),children:[f.jsx(Do,{id:`responseMode-${e.id}`,className:"w-32 h-8 text-xs",children:f.jsx(Oo,{})}),f.jsxs(jo,{children:[f.jsx(Ar,{value:"manual",children:"Manual"}),f.jsx(Ar,{value:"llm",children:"LLM"})]})]})]})]}),h==="llm"&&f.jsxs("div",{className:"space-y-2 p-3 bg-muted rounded-lg",children:[H?f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Le,{onClick:Z,disabled:B,size:"sm",className:"flex items-center gap-2",children:B?f.jsxs(f.Fragment,{children:[f.jsx(zs,{className:"h-4 w-4 animate-spin"}),"Generating..."]}):f.jsxs(f.Fragment,{children:[f.jsx(jhe,{className:"h-4 w-4"}),"Generate with LLM"]})}),f.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Using ",m?.provider," (",m?.model,")"]})]}):f.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"LLM not configured. Please configure LLM in the Chat tab."}),ee&&f.jsx("div",{className:"text-xs text-red-600 dark:text-red-400",children:ee})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`model-${e.id}`,children:"Model"}),f.jsx(En,{id:`model-${e.id}`,value:v,onChange:j=>x(j.target.value),placeholder:"stub-model",disabled:h==="llm"&&B})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`stopReason-${e.id}`,children:"Stop Reason"}),f.jsx(En,{id:`stopReason-${e.id}`,value:S,onChange:j=>y(j.target.value),placeholder:"endTurn",disabled:h==="llm"&&B})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`role-${e.id}`,children:"Role"}),f.jsxs(Io,{value:E,onValueChange:j=>_(j),disabled:h==="llm"&&B,children:[f.jsx(Do,{id:`role-${e.id}`,children:f.jsx(Oo,{})}),f.jsxs(jo,{children:[f.jsx(Ar,{value:"assistant",children:"assistant"}),f.jsx(Ar,{value:"user",children:"user"})]})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`contentType-${e.id}`,children:"Content Type"}),f.jsxs(Io,{value:k,onValueChange:j=>C(j),disabled:h==="llm"&&B,children:[f.jsx(Do,{id:`contentType-${e.id}`,children:f.jsx(Oo,{})}),f.jsxs(jo,{children:[f.jsx(Ar,{value:"text",children:"text"}),f.jsx(Ar,{value:"image",children:"image"})]})]})]}),k==="text"&&f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`text-${e.id}`,children:"Text Content"}),f.jsx(ql,{id:`text-${e.id}`,value:R,onChange:j=>I(j.target.value),placeholder:"Enter response text...",rows:6,disabled:h==="llm"&&B})]}),k==="image"&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`imageData-${e.id}`,children:"Base64 Image Data"}),f.jsx(ql,{id:`imageData-${e.id}`,value:A,onChange:j=>O(j.target.value),placeholder:"Base64 encoded image data...",rows:4,disabled:h==="llm"&&B})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Kt,{htmlFor:`mimeType-${e.id}`,children:"MIME Type"}),f.jsx(En,{id:`mimeType-${e.id}`,value:M,onChange:j=>P(j.target.value),placeholder:"image/png",disabled:h==="llm"&&B})]})]})]})]}),f.jsxs("div",{className:"flex gap-2 p-4 border-t dark:border-zinc-700",children:[f.jsx(Le,{onClick:re,className:"flex-1",disabled:h==="llm"&&B,children:"Approve"}),f.jsx(Le,{onClick:ne,variant:"outline",className:"flex-1",disabled:h==="llm"&&B,children:"Reject"})]})]}):f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a sampling request to view details"})})}function OTe({pendingRequests:e,onApprove:t,onReject:n,serverId:a,isConnected:r,mcpServerUrl:i}){const{selectedSamplingRequestId:s,setSelectedSamplingRequestId:c}=ac(),{llmConfig:u}=_Y({mcpServerUrl:i}),[d,m]=w.useState(null),[h,g]=w.useState(""),[v,x]=w.useState(-1),[S,y]=w.useState(!0),[E,_]=w.useState(!1),[k,C]=w.useState(!0),[R,I]=w.useState(!1),A=w.useRef(null),O=w.useRef(null),M=w.useRef(null),P=w.useRef(!1);w.useEffect(()=>{if(console.log("[SamplingTab] Auto-selection check:",{selectedSamplingRequestId:s,pendingRequestsCount:e.length,currentSelectedId:d?.id}),s&&e.length>0){const G=e.find(re=>re.id===s);console.log("[SamplingTab] Found request for auto-selection:",!!G,G?.id),G&&(console.log("[SamplingTab] Auto-selecting request:",G.id),c(null),m(G),setTimeout(()=>{const re=document.getElementById(`sampling-request-${G.id}`);console.log("[SamplingTab] Scrolling to element:",!!re),re&&re.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[s,e,c]),w.useEffect(()=>{const G=re=>{const j=re.detail.requestId;console.log("[SamplingTab] Custom navigate event received:",j);const V=e.find(z=>z.id===j);V&&(console.log("[SamplingTab] Selecting request from event:",j),m(V),setTimeout(()=>{const z=document.getElementById(`sampling-request-${j}`);z&&z.scrollIntoView({behavior:"smooth",block:"nearest"})},200))};return window.addEventListener("navigate-to-sampling",G),()=>window.removeEventListener("navigate-to-sampling",G)},[e]),w.useEffect(()=>{S&&e.length>0&&A.current&&!P.current&&(A.current.scrollTop=0)},[e.length,S]),w.useEffect(()=>{const G=A.current;if(!G)return;const re=()=>{G.scrollTop>0&&(P.current=!0,y(!1))};return G.addEventListener("scroll",re),()=>G.removeEventListener("scroll",re)},[]),w.useEffect(()=>{e.length===0&&(P.current=!1,y(!0))},[e.length]),w.useEffect(()=>{E&&M.current&&M.current.focus()},[E]);const B=w.useCallback(()=>{h.trim()||_(!1)},[h]),K=w.useMemo(()=>{if(!h.trim())return e;const G=h.toLowerCase();return e.filter(re=>re.serverName.toLowerCase().includes(G)||JSON.stringify(re.request||{}).toLowerCase().includes(G))},[e,h]);w.useEffect(()=>{x(-1)},[h]),w.useEffect(()=>{const G=re=>{const ne=re.target;if(ne.tagName==="INPUT"||ne.tagName==="TEXTAREA"||ne.contentEditable==="true"||re.metaKey||re.ctrlKey||re.altKey)return;const V=K;if(re.key==="ArrowDown")re.preventDefault(),x(z=>{const L=z+1;return L>=V.length?0:L});else if(re.key==="ArrowUp")re.preventDefault(),x(z=>{const L=z-1;return L<0?V.length-1:L});else if(re.key==="Enter"&&v>=0){re.preventDefault();const z=K[v];z&&ee(z)}};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[v,K]),w.useEffect(()=>{if(v>=0){const G=`sampling-request-${K[v]?.id}`,re=document.getElementById(G);re&&re.scrollIntoView({behavior:"smooth",block:"nearest"})}},[v,K]);const ee=w.useCallback(G=>{m(G)},[]),te=w.useCallback(()=>{window.confirm("Are you sure you want to reject all sampling requests? This cannot be undone.")&&(e.forEach(G=>{n(G.id,"User rejected all requests")}),m(null))},[e,n]),ae=w.useCallback(async()=>{if(d)try{await navigator.clipboard.writeText(JSON.stringify({id:d.id,serverName:d.serverName,timestamp:d.timestamp,request:d.request},null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch(G){console.error("[SamplingTab] Failed to copy request:",G)}},[d]),H=w.useCallback(()=>{if(d)try{const G=new globalThis.Blob([JSON.stringify({id:d.id,serverName:d.serverName,timestamp:d.timestamp,request:d.request},null,2)],{type:"application/json"}),re=URL.createObjectURL(G),ne=document.createElement("a");ne.href=re,ne.download=`sampling-request-${Date.now()}.json`,document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(re)}catch(G){console.error("[SamplingTab] Failed to download request:",G)}},[d]),Z=w.useCallback(async()=>{if(O.current)try{document.fullscreenElement?await document.exitFullscreen():await O.current.requestFullscreen()}catch(G){console.error("[SamplingTab] Failed to toggle fullscreen:",G)}},[]);return r?f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:40,minSize:30,children:f.jsx(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:f.jsxs(Rn,{defaultSize:75,minSize:30,children:[f.jsx(CTe,{isSearchExpanded:E,searchQuery:h,filteredRequestsCount:K.length,requestsCount:e.length,onSearchExpand:()=>_(!0),onSearchChange:g,onSearchBlur:B,onRejectAll:te,searchInputRef:M}),f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(RTe,{requests:K,selectedRequest:d,onRequestSelect:ee,focusedIndex:v,formatRelativeTime:ty,listRef:A})})]})})}),f.jsx(Si,{}),f.jsx(Rn,{defaultSize:60,minSize:40,children:f.jsx("div",{ref:O,className:"h-full bg-white dark:bg-zinc-900",children:f.jsx(ITe,{request:d,onApprove:t,onReject:n,onClose:()=>m(null),previewMode:k,onTogglePreview:()=>C(!k),isCopied:R,onCopy:ae,onDownload:H,onFullscreen:Z,llmConfig:u})})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(PG,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function DTe({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:a,onSearchExpand:r,onSearchChange:i,onSearchBlur:s,onCancelAll:c,searchInputRef:u}){return f.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?f.jsx(En,{ref:u,placeholder:"Search requests...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):f.jsxs(f.Fragment,{children:[f.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Elicitation"}),f.jsx(wr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:f.jsx(Md,{className:"h-4 w-4"})})}),f.jsxs(Rt,{side:"bottom",className:"flex gap-2",children:["Search",f.jsx(eh,{children:"F"})]})]})]})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,disabled:a===0,className:"h-8 w-8 p-0",children:f.jsx(Ji,{className:"h-4 w-4"})})}),f.jsx(Rt,{side:"bottom",children:"Cancel all"})]})})]})}function jTe({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:a,formatRelativeTime:r,listRef:i}){return e.length===0?f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx($d,{vertical:!0,noBorder:!0,message:"No elicitation requests"})}):f.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>{const u=s.request.mode||"form",d=u==="form"&&"requestedSchema"in s.request&&s.request.requestedSchema;return f.jsx(Qs,{id:`elicitation-request-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,title:f.jsxs("span",{className:"flex items-center gap-3",children:[s.serverName,f.jsx(wr,{variant:"outline",className:u==="url"?"bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50":"bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50",children:u})]}),description:(()=>{const m=r(s.timestamp),h=[];d&&h.push("with schema"),u==="url"&&h.push("external action");const g=h.length>0?` | ${h.join(", ")}`:"";return m+g})(),onClick:()=>n(s)},s.id)})})}function LTe({request:e,onApprove:t,onReject:n,onClose:a,previewMode:r,onTogglePreview:i,isCopied:s,onCopy:c,onDownload:u,onFullscreen:d}){const[m,h]=w.useState({}),[g,v]=w.useState(!1),x=e?.request.mode||"form",S=x==="form",y=x==="url";w.useEffect(()=>{if(e&&S&&"requestedSchema"in e.request){const A=e.request.requestedSchema,O={};if(A?.type==="object"&&A.properties)for(const[M,P]of Object.entries(A.properties)){const B=P;B.default!==void 0?O[M]=B.default:B.type==="boolean"?O[M]=!1:B.type==="number"||B.type==="integer"?O[M]=0:O[M]=""}h(O)}v(!1)},[e?.id,S]);const E=(A,O)=>{h(M=>({...M,[A]:O}))},_=()=>{if(e){if(S){if("requestedSchema"in e.request){const A=e.request.requestedSchema;if(A?.required){const O=A.required.filter(M=>m[M]===void 0||m[M]===""||m[M]===null);if(O.length>0){Xt.error("Missing required fields",{description:`Please fill in: ${O.join(", ")}`});return}}}t(e.id,{action:"accept",data:m})}else y&&t(e.id,{action:"accept"});a(),Jn(()=>Promise.resolve().then(()=>Ed),void 0).then(A=>{const O=Xt(A.createElement("div",{className:"space-y-3"},A.createElement("div",null,A.createElement("strong",null,"Elicitation Response Sent"),A.createElement("p",{className:"text-sm text-muted-foreground mt-1"},"The tool will continue executing.")),A.createElement("div",{className:"flex gap-2"},A.createElement("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90",onClick:()=>{const M=new globalThis.CustomEvent("navigate-to-tool-result",{detail:{toolName:null}});window.dispatchEvent(M),Xt.dismiss(O)}},"View Tool Result"))),{duration:5e3})})}},k=()=>{e&&(t(e.id,{action:"decline"}),a())},C=()=>{e&&(n(e.id,"User cancelled elicitation request"),a())},R=()=>{e&&y&&"url"in e.request&&(window.open(e.request.url,"_blank"),v(!0))},I=w.useMemo(()=>{if(!e||!S||!("requestedSchema"in e.request))return null;const A=e.request.requestedSchema;if(!A||A.type!=="object"||!A.properties)return f.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No form schema available"});const O=A.properties,M=A.required||[];return f.jsx("div",{className:"space-y-4",children:Object.entries(O).map(([P,B])=>{const K=B,ee=M.includes(P),te=K.type||"string",ae=K.title||P,H=K.description;return f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Kt,{htmlFor:`field-${P}`,children:[ae,ee&&f.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),H&&f.jsx("p",{className:"text-xs text-muted-foreground",children:H}),te==="boolean"?f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(im,{id:`field-${P}`,checked:m[P]||!1,onCheckedChange:Z=>E(P,Z)}),f.jsx(Kt,{htmlFor:`field-${P}`,className:"text-sm font-normal cursor-pointer",children:K.title||P})]}):te==="number"||te==="integer"?f.jsx(En,{id:`field-${P}`,type:"number",value:m[P]||"",onChange:Z=>E(P,te==="integer"?parseInt(Z.target.value,10):parseFloat(Z.target.value)),placeholder:K.default?.toString()||""}):K.enum?f.jsxs("select",{id:`field-${P}`,value:m[P]||"",onChange:Z=>E(P,Z.target.value),className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[f.jsx("option",{value:"",children:"Select..."}),K.enum.map(Z=>f.jsx("option",{value:Z,children:Z},Z))]}):te==="string"&&(K.format==="textarea"||K.maxLength>100)?f.jsx(ql,{id:`field-${P}`,value:m[P]||"",onChange:Z=>E(P,Z.target.value),placeholder:K.default||"",rows:4}):f.jsx(En,{id:`field-${P}`,type:"text",value:m[P]||"",onChange:Z=>E(P,Z.target.value),placeholder:K.default||""})]},P)})})},[e,m,S]);return e?f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"flex items-center justify-between p-4 border-b dark:border-zinc-700",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.serverName}),f.jsx(wr,{variant:"outline",className:y?"bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50":"bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50",children:x}),f.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleString()})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0",children:s?f.jsx(ra,{className:"h-4 w-4 text-green-600"}):f.jsx(Lr,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Copy request"})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:f.jsx($m,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Download request"})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",onClick:d,className:"h-8 w-8 p-0",children:f.jsx(QN,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:"Fullscreen"})]}),f.jsx(Le,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:f.jsx(Ji,{className:"h-4 w-4"})})]})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Message"}),f.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:e.request.message})]}),y&&"url"in e.request&&f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"External Action Required"}),f.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[f.jsx("p",{className:"text-sm text-muted-foreground",children:"This request requires you to complete an action at an external URL:"}),f.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background rounded border",children:[f.jsx("code",{className:"flex-1 text-xs font-mono break-all",children:e.request.url}),f.jsxs(Le,{size:"sm",variant:"outline",onClick:R,className:"flex items-center gap-2",children:[f.jsx(Y_,{className:"h-4 w-4"}),"Open URL"]})]}),f.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[f.jsx(im,{id:"url-completed",checked:g,onCheckedChange:A=>v(!!A)}),f.jsx(Kt,{htmlFor:"url-completed",className:"text-sm font-normal cursor-pointer",children:"I have completed the required action"})]})]})]}),S&&f.jsxs("div",{className:"space-y-2",children:[f.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Form Data"}),I]}),S&&"requestedSchema"in e.request&&e.request.requestedSchema&&f.jsxs("details",{className:"space-y-2",children:[f.jsx("summary",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 cursor-pointer",children:"Schema (for reference)"}),f.jsx("div",{className:"bg-muted rounded-lg p-3 max-h-64 overflow-auto",children:f.jsx(Xn,{data:e.request.requestedSchema})})]})]}),f.jsxs("div",{className:"flex gap-2 p-4 border-t dark:border-zinc-700",children:[f.jsx(Le,{onClick:_,className:"flex-1",children:"Accept"}),f.jsx(Le,{onClick:k,variant:"outline",className:"flex-1",children:"Decline"}),f.jsx(Le,{onClick:C,variant:"outline",className:"flex-1",children:"Cancel"})]})]}):f.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select an elicitation request to view details"})})}function $Te({pendingRequests:e=[],onApprove:t,onReject:n,serverId:a,isConnected:r}){const{selectedElicitationRequestId:i,setSelectedElicitationRequestId:s}=ac(),[c,u]=w.useState(null),[d,m]=w.useState(""),[h,g]=w.useState(-1),[v,x]=w.useState(!0),[S,y]=w.useState(!1),[E,_]=w.useState(!0),[k,C]=w.useState(!1),R=w.useRef(null),I=w.useRef(null),A=w.useRef(null),O=w.useRef(!1);w.useEffect(()=>{if(console.log("[ElicitationTab] Auto-selection check:",{selectedElicitationRequestId:i,pendingRequestsCount:e.length,currentSelectedId:c?.id}),i&&e.length>0){const H=e.find(Z=>Z.id===i);console.log("[ElicitationTab] Found request for auto-selection:",!!H,H?.id),H&&(console.log("[ElicitationTab] Auto-selecting request:",H.id),s(null),u(H),setTimeout(()=>{const Z=document.getElementById(`elicitation-request-${H.id}`);console.log("[ElicitationTab] Scrolling to element:",!!Z),Z&&Z.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[i,e,s]),w.useEffect(()=>{const H=Z=>{const re=Z.detail.requestId;console.log("[ElicitationTab] Custom navigate event received:",re);const ne=e.find(j=>j.id===re);ne&&(console.log("[ElicitationTab] Selecting request from event:",re),u(ne),setTimeout(()=>{const j=document.getElementById(`elicitation-request-${re}`);j&&j.scrollIntoView({behavior:"smooth",block:"nearest"})},200))};return window.addEventListener("navigate-to-elicitation",H),()=>window.removeEventListener("navigate-to-elicitation",H)},[e]),w.useEffect(()=>{v&&e.length>0&&R.current&&!O.current&&(R.current.scrollTop=0)},[e.length,v]),w.useEffect(()=>{const H=R.current;if(!H)return;const Z=()=>{H.scrollTop>0&&(O.current=!0,x(!1))};return H.addEventListener("scroll",Z),()=>H.removeEventListener("scroll",Z)},[]),w.useEffect(()=>{e.length===0&&(O.current=!1,x(!0))},[e.length]),w.useEffect(()=>{S&&A.current&&A.current.focus()},[S]);const M=w.useCallback(()=>{d.trim()||y(!1)},[d]),P=w.useMemo(()=>{if(!d.trim())return e;const H=d.toLowerCase();return e.filter(Z=>Z.serverName.toLowerCase().includes(H)||Z.request.message.toLowerCase().includes(H)||JSON.stringify(Z.request||{}).toLowerCase().includes(H))},[e,d]);w.useEffect(()=>{g(-1)},[d]),w.useEffect(()=>{const H=Z=>{const G=Z.target;if(G.tagName==="INPUT"||G.tagName==="TEXTAREA"||G.contentEditable==="true"||Z.metaKey||Z.ctrlKey||Z.altKey)return;const ne=P;if(Z.key==="ArrowDown")Z.preventDefault(),g(j=>{const V=j+1;return V>=ne.length?0:V});else if(Z.key==="ArrowUp")Z.preventDefault(),g(j=>{const V=j-1;return V<0?ne.length-1:V});else if(Z.key==="Enter"&&h>=0){Z.preventDefault();const j=P[h];j&&B(j)}};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[h,P]),w.useEffect(()=>{if(h>=0){const H=`elicitation-request-${P[h]?.id}`,Z=document.getElementById(H);Z&&Z.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,P]);const B=w.useCallback(H=>{u(H)},[]),K=w.useCallback(()=>{window.confirm("Are you sure you want to cancel all elicitation requests? This cannot be undone.")&&(e.forEach(H=>{n(H.id,"User cancelled all requests")}),u(null))},[e,n]),ee=w.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(JSON.stringify({id:c.id,serverName:c.serverName,timestamp:c.timestamp,request:c.request},null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(H){console.error("[ElicitationTab] Failed to copy request:",H)}},[c]),te=w.useCallback(()=>{if(c)try{const H=new globalThis.Blob([JSON.stringify({id:c.id,serverName:c.serverName,timestamp:c.timestamp,request:c.request},null,2)],{type:"application/json"}),Z=URL.createObjectURL(H),G=document.createElement("a");G.href=Z,G.download=`elicitation-request-${Date.now()}.json`,document.body.appendChild(G),G.click(),document.body.removeChild(G),URL.revokeObjectURL(Z)}catch(H){console.error("[ElicitationTab] Failed to download request:",H)}},[c]),ae=w.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(H){console.error("[ElicitationTab] Failed to toggle fullscreen:",H)}},[]);return r?f.jsxs(na,{direction:"horizontal",className:"h-full",children:[f.jsx(Rn,{defaultSize:40,minSize:30,children:f.jsx(na,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:f.jsxs(Rn,{defaultSize:75,minSize:30,children:[f.jsx(DTe,{isSearchExpanded:S,searchQuery:d,filteredRequestsCount:P.length,requestsCount:e.length,onSearchExpand:()=>y(!0),onSearchChange:m,onSearchBlur:M,onCancelAll:K,searchInputRef:A}),f.jsx("div",{className:"flex flex-col h-full",children:f.jsx(jTe,{requests:P,selectedRequest:c,onRequestSelect:B,focusedIndex:h,formatRelativeTime:ty,listRef:R})})]})})}),f.jsx(Si,{}),f.jsx(Rn,{defaultSize:60,minSize:40,children:f.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:f.jsx(LTe,{request:c,onApprove:t,onReject:n,onClose:()=>u(null),previewMode:E,onTogglePreview:()=>_(!E),isCopied:k,onCopy:ee,onDownload:te,onFullscreen:ae})})})]}):f.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[f.jsx(BG,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),f.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function MTe({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:a,resourcesSearchRef:r,children:i}){return e?f.jsxs(f.Fragment,{children:[f.jsx("div",{style:{display:t==="tools"?"block":"none"},className:"h-full",children:f.jsx(qY,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state==="ready"})}),f.jsx("div",{style:{display:t==="prompts"?"block":"none"},className:"h-full",children:f.jsx(WY,{ref:a,prompts:e.prompts,callPrompt:e.getPrompt,serverId:e.id,isConnected:e.state==="ready"})}),f.jsx("div",{style:{display:t==="resources"?"block":"none"},className:"h-full",children:f.jsx(ZY,{ref:r,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state==="ready"})}),f.jsx("div",{style:{display:t==="chat"?"block":"none"},className:"h-full",children:f.jsx(Uke,{connection:e,isConnected:e.state==="ready",readResource:e.readResource},e.id)}),f.jsx("div",{style:{display:t==="sampling"?"block":"none"},className:"h-full",children:f.jsx(OTe,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state==="ready",mcpServerUrl:e.url})}),f.jsx("div",{style:{display:t==="elicitation"?"block":"none"},className:"h-full",children:f.jsx($Te,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state==="ready"})}),f.jsx("div",{style:{display:t==="notifications"?"block":"none"},className:"h-full",children:f.jsx(bTe,{notifications:e.notifications,unreadCount:e.unreadNotificationCount,markNotificationRead:e.markNotificationRead,markAllNotificationsRead:e.markAllNotificationsRead,clearNotifications:e.clearNotifications,serverId:e.id,isConnected:e.state==="ready"})}),t!=="tools"&&t!=="prompts"&&t!=="resources"&&t!=="chat"&&t!=="sampling"&&t!=="elicitation"&&t!=="notifications"&&f.jsx(f.Fragment,{children:i})]}):f.jsx(f.Fragment,{children:i})}function X2({className:e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentcolor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:e,children:[f.jsx("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),f.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}const XY=w.createContext(void 0);function JY(){const e=w.use(XY);if(!e)throw new Error("useTabs must be used within a TabsProvider");return e}const QY=w.createContext(void 0);function PTe(){return w.use(QY)}function rk({ref:e,children:t,defaultValue:n,value:a,onValueChange:r,className:i,collapsed:s,onCollapsedChange:c,...u}){const[d,m]=w.useState(n||""),h=a!==void 0,g=s!==void 0,[v,x]=w.useState(!1),S=w.useCallback(k=>{h||m(k),r?.(k)},[h,r]),y=h?a:d,E=g?s:v,_=w.useCallback(k=>{g||x(k),c?.(k)},[g,c]);return f.jsx(XY,{value:{activeValue:y,handleValueChange:S,collapsed:E,handleCollapsedChange:_},children:f.jsx("div",{ref:e,className:De("flex flex-col gap-2",i),...u,children:t})})}rk.displayName="Tabs";function ak({ref:e,children:t,className:n,variant:a="default",collapsible:r=!1,...i}){const{activeValue:s,collapsed:c,handleCollapsedChange:u}=JY(),[d,m]=w.useState({width:0,left:0}),h=w.useRef(null),g=w.useRef(null),v=w.useRef(null),x=w.useCallback(()=>{const E=h.current;if(!E)return;const _=E.querySelector("div:first-child");if(!_)return;const k=_.querySelector(`button[data-tab-value="${s}"]`);if(k&&s){const C=_.getBoundingClientRect(),R=k.getBoundingClientRect();m({width:R.width,left:R.left-C.left})}else m({width:0,left:0})},[s]),S=w.useCallback(()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(x,16)},[x]);w.useEffect(()=>{const E=setTimeout(x,10);return()=>clearTimeout(E)},[x,c]),w.useEffect(()=>{const E=h.current;if(!E)return;g.current=new ResizeObserver(()=>{S()}),g.current.observe(E);const _=E.querySelector("div:first-child");return _&&_.querySelectorAll("button[data-tab-value]").forEach(C=>{g.current&&g.current.observe(C)}),()=>{g.current&&g.current.disconnect(),v.current&&clearTimeout(v.current)}},[S]),w.useEffect(()=>{const E=()=>{S()};return window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[S]);const y=w.useRef(null);return w.useEffect(()=>{y.current&&(y.current.style.width=`${d.width}px`,y.current.style.left=`${d.left}px`)},[d]),f.jsx(QY,{value:{variant:a,collapsed:c,handleCollapsedChange:u},children:f.jsx("div",{ref:h,className:De("relative flex items-center bg-none gap-1",a==="default"&&"p-1 rounded-full border border-zinc-300 dark:border-zinc-600",a==="underline"&&"border-b border-zinc-200 dark:border-zinc-700",n),...i,children:f.jsxs("div",{role:"tablist",className:"flex-1 flex items-center relative",children:[t,f.jsx("span",{ref:y,className:De("absolute transition-all duration-500 ease-in-out z-0",a==="default"&&"bg-white dark:bg-zinc-700 rounded-full h-[calc(100%)] top-0 border border-zinc-300 dark:border-zinc-600",a==="underline"&&"bottom-0 h-0.5 bg-black dark:bg-white")})]})})})}ak.displayName="TabsList";const UTe=({children:e,title:t,collapsed:n})=>!t||!n?e:f.jsx(ZN,{children:f.jsxs(Nt,{children:[f.jsx(Ct,{children:e}),f.jsx(Rt,{children:t})]})}),ik=w.forwardRef(({children:e,value:t,className:n,disabled:a,icon:r,title:i,...s},c)=>{const{activeValue:u,handleValueChange:d,collapsed:m}=JY(),g=PTe()?.variant||"default",v=u===t,x=m&&i?i:void 0;return f.jsx(UTe,{title:i,collapsed:m,children:f.jsxs("button",{ref:c,disabled:a,onClick:()=>d(t),"data-tab-value":t,"data-tab-active":v,role:"tab","aria-selected":v?"true":"false",title:x,className:De("relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-500 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer",g==="default"&&"py-2.5",g==="default"&&"rounded-md px-4",g==="underline"&&"px-6 py-3 border-b-2 border-transparent",v&&"text-foreground",!v&&"text-muted-foreground hover:text-foreground",n),...s,children:[r&&f.jsx(r,{className:De("h-4 w-4 transition-all duration-500 ease-in-out",!m&&"mr-2",m&&"mr-0!")}),f.jsx("span",{className:De("transition-all duration-500 ease-in-out overflow-hidden",m?"w-0 opacity-0":"w-auto opacity-100"),children:e})]})})});ik.displayName="TabsTrigger";function J2({className:e}){const{theme:t,setTheme:n}=xw(),a=w.useRef(null),[r,i]=w.useState(!1);w.useEffect(()=>{i(!0)},[]);const s=()=>t==="system"?"light":t==="light"?"dark":"system",c=()=>t==="system"?f.jsx(rz,{className:"size-4"}):t==="light"?f.jsx(Uhe,{className:"size-5"}):f.jsx(vhe,{className:"size-4"}),u=()=>t==="system"?"Switch to light mode":t==="light"?"Switch to dark mode":"Switch to system mode",d=async()=>{if(!a.current)return;const m=s();if(typeof document<"u"&&"startViewTransition"in document){await document.startViewTransition(()=>{Id.flushSync(()=>{n(m)})}).ready;const{top:h,left:g,width:v,height:x}=a.current.getBoundingClientRect(),S=h+x/2,y=g+v/2,E=window.innerWidth-g,_=window.innerHeight-h,k=Math.hypot(Math.max(g,E),Math.max(h,_));document.documentElement.animate({clipPath:[`circle(0px at ${y}px ${S}px)`,`circle(${k}px at ${y}px ${S}px)`]},{duration:700,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})}else n(m)};return r?f.jsx("button",{ref:a,onClick:d,className:De(e),"aria-label":u(),title:`Current: ${t==="system"?"Auto":t==="light"?"Light":"Dark"}`,children:c()}):f.jsx("button",{ref:a,className:De(e),"aria-label":"Toggle theme",children:f.jsx(rz,{className:"size-4"})})}function Q2({className:e,state:t="collapsed",href:n="https://mcp-use.com"}){const[a,r]=w.useState(!1),i=.2,s=.7,c=.6,u=4,d=i+s+c,m=0,h=i/d,g=(i+s)/d,v=1;return f.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:De("flex items-center transition-opacity -my-3",t==="expanded"?"space-x-2":"",e),onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[f.jsx("div",{className:"relative",children:f.jsxs(ya.svg,{viewBox:"0 0 303 303",initial:"rest",animate:a?"hover":"rest",className:De("text-foreground",t==="expanded"?"size-[40px]":"size-[20px]"),children:[f.jsxs(ya.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:d,times:[m,h,g,v],ease:"easeInOut"}}},fill:"currentColor",fillRule:"nonzero",stroke:"currentColor",strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",children:[f.jsx("path",{d:"m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z"}),f.jsx("circle",{cx:"70.3",cy:"232.3",r:"50"}),f.jsx("circle",{cx:"232.3",cy:"70.3",r:"50"})]}),f.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",children:[f.jsx(zTe,{d:"m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z",times:{T0:m,T1:h,T2:g,T3:v},total:d}),f.jsx(eF,{cx:70.3,cy:232.3,r:50,times:{T0:m,T1:h,T2:g,T3:v},total:d}),f.jsx(eF,{cx:232.3,cy:70.3,r:50,times:{T0:m,T1:h,T2:g,T3:v},total:d})]})]})}),t==="expanded"&&f.jsxs("div",{className:"font-ubuntu flex flex-col items-start -space-y-1 mr-3",children:[f.jsx("h1",{className:"text-xl font-medium",children:"mcp-use"}),f.jsx("span",{className:"text-lg text-muted-foreground tracking-wide font-sans font-light",children:"Inspector"})]})]})}function zTe({d:e,times:t,total:n}){const{T0:a,T1:r,T2:i,T3:s}=t;return f.jsx(ya.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[a,r,i,s],ease:"easeInOut"}}}})}function eF({cx:e,cy:t,r:n,times:a,total:r}){const{T0:i,T1:s,T2:c,T3:u}=a;return f.jsx(ya.circle,{cx:e,cy:t,r:n,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:r,times:[i,s,c,u],ease:"easeInOut"}}}})}function eq({ref:e,shimmerColor:t,shimmerSize:n="0.05em",shimmerDuration:a="3s",borderRadius:r="100px",background:i,className:s,children:c,...u}){const{resolvedTheme:d}=xw(),m=d==="dark"?"#000000":"#ffffff",h=d==="dark"?"rgba(255, 255, 255, 1)":"rgba(0, 0, 0, 1)",g=t||m,v=i||h;return f.jsxs("button",{style:{"--spread":"90deg","--shimmer-color":g,"--radius":r,"--speed":a,"--cut":n,"--bg":v},className:De("group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]","transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px",d==="dark"?"border-black/10 text-black":"border-white/10 text-white",s),ref:e,...u,children:[f.jsx("div",{className:De("-z-30 blur-[2px]","[container-type:size] absolute inset-0 overflow-visible"),children:f.jsx("div",{className:"animate-shimmer-slide absolute inset-0 [aspect-ratio:1] h-[100cqh] [border-radius:0] [mask:none]",children:f.jsx("div",{className:"animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]"})})}),c,f.jsx("div",{className:De("absolute inset-0 size-full","rounded-2xl px-4 py-1.5 text-sm font-medium","transform-gpu transition-all duration-300 ease-in-out",d==="dark"?"shadow-[inset_0_-8px_10px_#0000001f] group-hover:shadow-[inset_0_-6px_10px_#0000003f] group-active:shadow-[inset_0_-10px_10px_#0000003f]":"shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]")}),f.jsx("div",{className:De("absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] [background:var(--bg)]")})]})}eq.displayName="ShimmerButton";function tF({status:e}){const t=i=>{switch(i){case"ready":return{color:"bg-emerald-500",ringColor:"ring-emerald-500",tooltip:"Connected"};case"failed":return{color:"bg-red-500",ringColor:"ring-red-500",tooltip:"Failed"};default:return{color:"bg-yellow-500",ringColor:"ring-yellow-500",tooltip:i}}},{color:n,ringColor:a,tooltip:r}=t(e);return f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsxs("div",{className:"relative",children:[f.jsx("div",{className:`absolute w-2 h-2 rounded-full ${a} animate-ping`}),f.jsx("div",{className:`relative w-2 h-2 rounded-full ${n}`})]})}),f.jsx(Rt,{children:f.jsx("p",{children:r})})]})}function nF({connections:e,selectedServer:t,onServerSelect:n,onOpenConnectionOptions:a,mobileMode:r=!1}){const i=Cd(),s=c=>{const u=e.find(d=>d.id===c);if(!u||u.state!=="ready"){Xt.error("Server is not connected and cannot be inspected");return}n(c)};return r?f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("div",{className:"relative",children:f.jsxs(V_,{children:[f.jsx(G_,{asChild:!0,children:f.jsxs(Le,{variant:"ghost",className:"h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5",children:[t?f.jsx(Il,{serverUrl:t.url,serverName:t.name,size:"md"}):f.jsx(Rhe,{className:"h-5 w-5"}),f.jsx(rc,{className:"h-4 w-4"})]})}),f.jsxs(Cv,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[f.jsx(W_,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>i("/"),children:"MCP Servers"}),f.jsx(rp,{}),e.length===0?f.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center",children:"No servers connected. Go to the dashboard to add one."}):e.map(c=>f.jsxs(Ro,{onClick:()=>s(c.id),className:"flex items-center gap-3",children:[f.jsx(Il,{serverUrl:c.url,serverName:c.name,size:"sm"}),f.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[f.jsx("div",{className:"font-medium",children:c.name}),f.jsx(tF,{status:c.state})]}),f.jsx(Le,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:u=>{u.stopPropagation(),a(c.id)},children:f.jsx(_u,{className:"h-3 w-3"})})]},c.id)),f.jsx(rp,{}),f.jsx(Ro,{onClick:()=>i("/"),children:f.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})}):f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("div",{className:"relative",children:f.jsxs(V_,{children:[f.jsx(G_,{asChild:!0,children:f.jsxs(eq,{className:De("min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200",!t&&"pl-4",t&&"pr-10"),children:[t&&f.jsx(Il,{serverUrl:t.url,serverName:t.name,size:"md",className:"mr-2"}),f.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[f.jsx("span",{className:"truncate",children:t?t.name:"Select server to inspect"}),t&&f.jsx("div",{className:"flex items-center gap-2",children:t.error&&t.state!=="ready"?f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx("button",{onClick:c=>{c.stopPropagation()},className:"w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors",title:"Click to copy error message","aria-label":"Copy error message to clipboard"})}),f.jsx(Rt,{children:f.jsx("p",{className:"max-w-xs",children:t.error})})]}):f.jsx("div",{className:`w-2 h-2 rounded-full ${t.state==="ready"?"bg-emerald-600 animate-status-pulse":t.state==="failed"?"bg-rose-600 animate-status-pulse-red":"bg-yellow-500 animate-status-pulse-yellow"}`})})]})]})}),t&&f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx("button",{type:"button",onClick:()=>{a(t.id)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black","aria-label":"Edit connection settings",children:f.jsx(_u,{className:"h-4 w-4"})})}),f.jsx(Rt,{children:f.jsx("p",{children:"Edit connection settings"})})]}),f.jsxs(Cv,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[f.jsx(W_,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>i("/"),children:"MCP Servers"}),f.jsx(rp,{}),e.length===0?f.jsx("div",{className:"px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center",children:"No servers connected. Go to the dashboard to add one."}):e.map(c=>f.jsxs(Ro,{onClick:()=>s(c.id),className:"flex items-center gap-3",children:[f.jsx(Il,{serverUrl:c.url,serverName:c.name,size:"sm"}),f.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[f.jsx("div",{className:"font-medium",children:c.name}),f.jsx(tF,{status:c.state})]}),f.jsx(Le,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:u=>{u.stopPropagation(),a(c.id)},children:f.jsx(_u,{className:"h-3 w-3"})})]},c.id)),f.jsx(rp,{}),f.jsx(Ro,{onClick:()=>i("/"),children:f.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})})}const rF=[{id:"tools",label:"Tools",icon:Gl},{id:"prompts",label:"Prompts",icon:Hp},{id:"resources",label:"Resources",icon:ehe},{id:"sampling",label:"Sampling",icon:PG},{id:"elicitation",label:"Elicitation",icon:BG},{id:"notifications",label:"Notifications",icon:qN},{id:"chat",label:"Chat",icon:fhe}];function aF(e,t){return e==="tools"?t.tools.length:e==="prompts"?t.prompts.length:e==="resources"?t.resources.length:e==="sampling"?t.pendingSamplingRequests?.length||0:e==="elicitation"?t.pendingElicitationRequests?.length||0:e==="notifications"?t.unreadNotificationCount:0}function FTe({collapsed:e,onToggle:t}){return f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx("button",{onClick:t,className:De("shrink-0 p-1.5 rounded-md transition-all duration-500 ease-in-out cursor-pointer","text-muted-foreground hover:text-foreground","hover:bg-zinc-100 dark:hover:bg-zinc-800","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),"aria-label":e?"Expand tabs":"Collapse tabs",type:"button",children:e?f.jsx($G,{className:"h-4 w-4 transition-transform duration-500 ease-in-out"}):f.jsx(qy,{className:"h-4 w-4 transition-transform duration-500 ease-in-out"})})}),f.jsx(Rt,{children:f.jsx("p",{children:e?"Expand tabs":"Collapse tabs"})})]})}function BTe({connections:e,selectedServer:t,activeTab:n,onServerSelect:a,onTabChange:r,onCommandPaletteOpen:i,onOpenConnectionOptions:s}){const{tunnelUrl:c}=ac(),u=t&&c,[d,m]=w.useState(!1),[h,g]=w.useState(!1),v=async()=>{if(c)try{await navigator.clipboard.writeText(`${c}/mcp`),m(!0),Xt.success("Tunnel URL copied to clipboard"),setTimeout(()=>m(!1),2e3)}catch{Xt.error("Failed to copy URL")}};return f.jsxs("header",{className:"w-full mx-auto",children:[f.jsxs("div",{className:"flex lg:hidden flex-col gap-3",children:[f.jsxs("div",{className:"flex items-center justify-between w-full",children:[f.jsx("div",{className:"flex-1 flex justify-start",children:f.jsx(nF,{connections:e,selectedServer:t,onServerSelect:a,onOpenConnectionOptions:s,mobileMode:!0})}),f.jsx("div",{className:"flex-shrink-0 flex justify-center",children:f.jsx("div",{className:"scale-150",children:f.jsx(Q2,{state:"collapsed"})})}),f.jsxs("div",{className:"flex-1 flex justify-end items-center gap-2",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",asChild:!0,children:f.jsx("a",{href:"https://github.com/mcp-use/mcp-use",target:"_blank",rel:"noopener noreferrer",className:"p-2","aria-label":"GitHub",children:f.jsx(X2,{className:"h-4 w-4"})})})}),f.jsx(Rt,{children:f.jsx("p",{children:"Give us a star ⭐"})})]}),f.jsx(J2,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})]})]}),t&&f.jsx("div",{className:"w-full",children:f.jsx(rk,{value:n,onValueChange:x=>r(x),collapsed:h,onCollapsedChange:g,children:f.jsx(ak,{className:"w-full justify-center",children:rF.map(x=>{const S=aF(x.id,t);return f.jsxs(ik,{value:x.id,icon:x.icon,className:De("[&>svg]:mr-0 flex-1 flex-row gap-2 relative",h&&"pl-2"),children:[S>0&&f.jsx("span",{className:De(n===x.id?"dark:bg-black":"dark:bg-zinc-700","bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-[10px] px-1.5 py-0.5 rounded-full font-medium"),children:S}),f.jsx("span",{className:"sr-only",children:x.label})]},x.id)})})})})]}),f.jsxs("div",{className:"hidden lg:flex items-center justify-between gap-3",children:[f.jsxs("div",{className:"flex items-center flex-wrap gap-2 md:space-x-6 space-x-2",children:[f.jsx(nF,{connections:e,selectedServer:t,onServerSelect:a,onOpenConnectionOptions:s}),t&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(rk,{value:n,onValueChange:x=>r(x),collapsed:h,onCollapsedChange:g,children:f.jsx(ak,{className:"overflow-x-auto",collapsible:!0,children:rF.map(x=>{const S=aF(x.id,t),y=S>0?`${x.label} (${S})`:x.label;return f.jsx(ik,{value:x.id,icon:x.icon,className:De("[&>svg]:mr-0 lg:[&>svg]:mr-2 relative",h&&"pl-4"),title:y,children:f.jsxs("div",{className:"items-center gap-2 hidden lg:flex",children:[x.label,S>0&&f.jsx("span",{className:De(n===x.id?" dark:bg-black ":"dark:bg-zinc-700","bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-xs px-2 py-0.5 rounded-full font-medium"),children:S})]})})})})}),f.jsx(FTe,{collapsed:h,onToggle:()=>g(!h)})]}),u&&f.jsxs(KK,{children:[f.jsx(ZK,{asChild:!0,children:f.jsxs("button",{className:"flex items-center gap-2 px-3 py-1.5 bg-gradient-to-r from-purple-500/10 to-pink-500/10 dark:from-purple-500/20 dark:to-pink-500/20 border border-purple-500/30 dark:border-purple-500/40 rounded-full hover:from-purple-500/20 hover:to-pink-500/20 dark:hover:from-purple-500/30 dark:hover:to-pink-500/30 transition-colors cursor-pointer",children:[f.jsx(Vp,{className:"size-4 text-purple-600 dark:text-purple-400 animate-pulse"}),f.jsx("span",{className:"text-xs font-medium text-purple-700 dark:text-purple-300 hidden lg:inline",children:"Tunnel"})]})}),f.jsx(WC,{className:"w-[calc(100vw-2rem)] sm:w-96",align:"start",children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsxs("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:[f.jsx(Vp,{className:"size-4 text-purple-600 dark:text-purple-400"}),"Tunnel URL"]}),f.jsxs("div",{className:"flex items-center gap-2 p-2 py-0 bg-muted rounded-full",children:[f.jsxs("code",{className:"flex-1 text-[10px] font-mono",children:[c,"/mcp"]}),f.jsx(Le,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:v,children:d?f.jsx(ra,{className:"size-3.5 text-green-600"}):f.jsx(Lr,{className:"size-3.5"})})]})]}),f.jsxs("div",{children:[f.jsx("h5",{className:"font-semibold text-sm mb-2",children:"Use in ChatGPT"}),f.jsxs("ol",{className:"space-y-2 text-xs text-muted-foreground",children:[f.jsxs("li",{className:"flex gap-2",children:[f.jsx("span",{className:"font-semibold text-foreground",children:"1."}),f.jsxs("span",{children:["Enable"," ",f.jsx("span",{className:"font-medium text-foreground",children:"dev mode"})," ","from settings"]})]}),f.jsxs("li",{className:"flex gap-2",children:[f.jsx("span",{className:"font-semibold text-foreground",children:"2."}),f.jsxs("span",{children:["In"," ",f.jsx("span",{className:"font-medium text-foreground",children:"App & Connectors"})," ","click on"," ",f.jsx("span",{className:"font-medium text-foreground",children:"create"})]})]}),f.jsxs("li",{className:"flex gap-2",children:[f.jsx("span",{className:"font-semibold text-foreground",children:"3."}),f.jsx("span",{children:"Use the tunnel URL in the input"})]})]})]})]})})]})]}),f.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[f.jsxs(Nt,{children:[f.jsx(Ct,{children:f.jsx(J2,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})}),f.jsx(Rt,{children:f.jsx("p",{children:"Toggle theme"})})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsxs(Le,{variant:"ghost",className:"hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full px-1 -mx-3 flex gap-1",onClick:i,children:[f.jsx(Mme,{className:"size-4"}),f.jsx("span",{className:"text-base font-mono hidden sm:inline",children:"K"})]})}),f.jsx(Rt,{children:f.jsx("p",{children:"Command Palette"})})]}),f.jsxs(Nt,{children:[f.jsx(Ct,{asChild:!0,children:f.jsx(Le,{variant:"ghost",size:"sm",asChild:!0,children:f.jsxs("a",{href:"https://github.com/mcp-use/mcp-use",className:"flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",children:[f.jsx(X2,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Github"})]})})}),f.jsx(Rt,{children:f.jsx("p",{children:"Give us a star ⭐"})})]}),f.jsx(Q2,{state:"expanded"})]})]})]})}function HTe({children:e}){const t=Cd(),n=Vo(),{connections:a,addConnection:r,removeConnection:i,updateConnectionConfig:s,configLoaded:c}=YN(),{selectedServerId:u,setSelectedServerId:d,activeTab:m,setActiveTab:h,navigateToItem:g,setTunnelUrl:v}=ac(),[x,S]=w.useState(!1),[y,E]=w.useState(null),_=rSe();w.useEffect(()=>{const Z=new URLSearchParams(n.search).get("tunnelUrl");v(Z)},[n.search,v]),w.useEffect(()=>{const H=re=>{const j=re.detail.requestId;u&&g(u,"sampling",j)},Z=re=>{const j=re.detail.requestId;u&&g(u,"elicitation",j)},G=re=>{const j=re.detail.toolName;u&&j?g(u,"tools",j):u&&h("tools")};return window.addEventListener("navigate-to-sampling",H),window.addEventListener("navigate-to-elicitation",Z),window.addEventListener("navigate-to-tool-result",G),()=>{window.removeEventListener("navigate-to-sampling",H),window.removeEventListener("navigate-to-elicitation",Z),window.removeEventListener("navigate-to-tool-result",G)}},[u,h,g]);const k=w.useRef(null),C=w.useRef(null),R=w.useRef(null),{isAutoConnecting:I}=nSe({connections:a,addConnection:r,removeConnection:i,configLoaded:c}),A=w.useCallback(H=>{vr.getInstance().capture(new eme({trigger:H})).catch(()=>{}),S(!0)},[]),O=H=>{const Z=a.find(j=>j.id===H);if(!Z||Z.state!=="ready"){Xt.error("Server is not connected and cannot be inspected");return}d(H);const re=new URLSearchParams(n.search).get("tunnelUrl"),ne=re?`/?server=${encodeURIComponent(H)}&tunnelUrl=${encodeURIComponent(re)}`:`/?server=${encodeURIComponent(H)}`;t(ne)},M=w.useCallback(H=>{E(H)},[]),P=w.useCallback(H=>{y&&(H.url!==y?(i(y),r(H.url,H.name,H.proxyConfig,H.transportType)):s(y,{name:H.name,proxyConfig:H.proxyConfig,transportType:H.transportType}),E(null),Xt.success("Connection settings updated"))},[y,i,r,s]),B=(H,Z,G)=>{if(console.warn("[Layout] handleCommandPaletteNavigate called:",{tab:H,itemName:Z,serverId:G}),G){const re=a.find(z=>z.id===G);if(console.warn("[Layout] Server lookup:",{serverId:G,serverFound:!!re,serverState:re?.state}),!re||re.state!=="ready"){console.warn("[Layout] Server not ready, showing error"),Xt.error("Server is not connected and cannot be inspected");return}console.warn("[Layout] Calling navigateToItem:",{serverId:G,tab:H,itemName:Z}),g(G,H,Z);const j=new URLSearchParams(n.search).get("tunnelUrl"),V=j?`/?server=${encodeURIComponent(G)}&tunnelUrl=${encodeURIComponent(j)}`:`/?server=${encodeURIComponent(G)}`;console.warn("[Layout] Navigating to:",V),t(V)}else console.warn("[Layout] No serverId, just updating tab to:",H),h(H)},K=a.find(H=>H.id===u),ee=K?K.tools.map(H=>({...H,_serverId:K.id})):a.flatMap(H=>H.state==="ready"?H.tools.map(Z=>({...Z,_serverId:H.id,_serverName:H.name})):[]),te=K?K.prompts.map(H=>({...H,_serverId:K.id})):a.flatMap(H=>H.state==="ready"?H.prompts.map(Z=>({...Z,_serverId:H.id,_serverName:H.name})):[]),ae=K?K.resources.map(H=>({...H,_serverId:K.id})):a.flatMap(H=>H.state==="ready"?H.resources.map(Z=>({...Z,_serverId:H.id,_serverName:H.name})):[]);return w.useEffect(()=>{const Z=new URLSearchParams(n.search).get("server"),G=Z?decodeURIComponent(Z):null;G!==u&&d(G)},[n.search,u,d]),w.useEffect(()=>{const Z=new URLSearchParams(n.search).get("server");if(!Z)return;const G=decodeURIComponent(Z),re=a.find(ne=>ne.id===G);if(!re){const ne=setTimeout(()=>t("/"),3e3);return()=>clearTimeout(ne)}if(re.state==="failed"){const ne=setTimeout(()=>t("/"),2e3);return()=>clearTimeout(ne)}},[n.search,t,a]),SK({onCommandPalette:()=>A("keyboard"),onToolsTab:()=>{K&&h("tools")},onPromptsTab:()=>{K&&h("prompts")},onResourcesTab:()=>{K&&h("resources")},onChatTab:()=>{K&&h("chat")},onHome:()=>{t("/")},onFocusSearch:()=>{m==="tools"&&k.current?k.current.focusSearch():m==="prompts"&&C.current?C.current.focusSearch():m==="resources"&&R.current&&R.current.focusSearch()},onBlurSearch:()=>{m==="tools"&&k.current?k.current.blurSearch():m==="prompts"&&C.current?C.current.blurSearch():m==="resources"&&R.current&&R.current.blurSearch()}}),I?f.jsx("div",{className:"h-screen bg-white dark:bg-zinc-900 flex items-center justify-center",children:f.jsxs("div",{className:"flex flex-col items-center gap-4",children:[f.jsx(ki,{className:"h-8 w-8 text-zinc-600 dark:text-zinc-400"}),f.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Connecting to MCP server..."})]})}):f.jsx(ZN,{children:f.jsxs("div",{className:"h-screen bg-[#f3f3f3] dark:bg-black flex flex-col px-2 py-2 sm:px-4 sm:py-4 gap-2 sm:gap-4",children:[f.jsx(BTe,{connections:a,selectedServer:K,activeTab:m,onServerSelect:O,onTabChange:h,onCommandPaletteOpen:()=>A("button"),onOpenConnectionOptions:M}),f.jsx("main",{className:"flex-1 w-full mx-auto bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 p-0 overflow-auto",children:f.jsx(MTe,{selectedServer:K,activeTab:m,toolsSearchRef:k,promptsSearchRef:C,resourcesSearchRef:R,children:e})}),f.jsx(ASe,{isOpen:x,onOpenChange:S,tools:ee,prompts:te,resources:ae,savedRequests:_,connections:a,onNavigate:B,onServerSelect:O}),f.jsx(M7,{connection:y&&a.find(H=>H.id===y)||null,open:y!==null,onOpenChange:H=>{H||E(null)},onConnect:P})]})})}function VTe(){const[e,t]=w.useState("processing"),[n,a]=w.useState("");return w.useEffect(()=>{console.log("[OAuthCallback] Component mounted, handling authorization..."),console.log("[OAuthCallback] Current URL:",window.location.href),vN().then(()=>{console.log("[OAuthCallback] Authorization successful"),t("success")}).catch(r=>{console.error("[OAuthCallback] Authorization failed:",r),t("error"),a(r instanceof Error?r.message:String(r))})},[]),e==="processing"?f.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:f.jsxs("div",{className:"flex flex-col items-center gap-4",children:[f.jsx(zs,{className:"h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400"}),f.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Completing authentication..."})]})}):e==="error"?f.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:f.jsxs("div",{className:"max-w-md p-6",children:[f.jsx("h1",{className:"text-xl font-semibold text-red-600 dark:text-red-400 mb-2",children:"Authentication Error"}),f.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mb-4",children:n}),f.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-500",children:"You can close this window and try again."})]})}):f.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:f.jsxs("div",{className:"max-w-md p-6",children:[f.jsx("h1",{className:"text-xl font-semibold text-green-600 dark:text-green-400 mb-2",children:"Authentication Successful!"}),f.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Redirecting you back..."})]})})}var GTe=(e,t,n,a,r,i,s,c)=>{let u=document.documentElement,d=["light","dark"];function m(v){(Array.isArray(e)?e:[e]).forEach(x=>{let S=x==="class",y=S&&i?r.map(E=>i[E]||E):r;S?(u.classList.remove(...y),u.classList.add(i&&i[v]?i[v]:v)):u.setAttribute(x,v)}),h(v)}function h(v){c&&d.includes(v)&&(u.style.colorScheme=v)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(a)m(a);else try{let v=localStorage.getItem(t)||n,x=s&&v==="system"?g():v;m(x)}catch{}},WTe=w.createContext(void 0),KTe={setTheme:e=>{},themes:[]},ZTe=()=>{var e;return(e=w.useContext(WTe))!=null?e:KTe};w.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:a,enableColorScheme:r,defaultTheme:i,value:s,themes:c,nonce:u,scriptProps:d})=>{let m=JSON.stringify([n,t,i,e,c,s,a,r]).slice(1,-1);return w.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?u:"",dangerouslySetInnerHTML:{__html:`(${GTe.toString()})(${m})`}})});function YTe({...e}){const{theme:t="system"}=ZTe();return f.jsx(HG,{theme:t,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...e})}function qTe(){return f.jsx(vEe,{children:f.jsx(sme,{children:f.jsxs(tSe,{children:[f.jsx(ile,{basename:"/inspector",children:f.jsxs($se,{children:[f.jsx(j_,{path:"/oauth/callback",element:f.jsx(VTe,{})}),f.jsx(j_,{path:"/",element:f.jsx(HTe,{children:f.jsx(eSe,{})})})]})}),f.jsx(YTe,{position:"top-center"})]})})})}const iF=new URLSearchParams(window.location.search);if(iF.has("code")||iF.has("error"))try{vN()}catch(e){console.error("[inspector] OAuth callback error:",e)}const oF=document.getElementById("root");oF?Voe.createRoot(oF).render(f.jsx(qTe,{})):console.error("[inspector] Root element not found");export{kB as $,AF as A,DF as B,$6 as C,EB as D,_oe as E,Jb as F,ke as G,Noe as H,Eoe as I,Cb as J,ZP as K,ks as L,xoe as M,koe as N,Ll as O,ov as P,Ot as Q,ue as R,u6 as S,zi as T,vF as U,RJ as V,Ob as W,uF as X,Coe as Y,Lne as Z,ze as _,Jn as a,bJ as a0,vN as a1,IJ as a2,Ed as b,ny as c,id as d,$T as e,Cne as f,JTe as g,hne as h,wy as i,od as j,F5 as k,Nb as l,a_ as m,iv as n,Jf as o,FF as p,UT as q,w as r,Op as s,su as t,ad as u,vi as v,i_ as w,ni as x,M6 as y,HB as z};