@mcp-use/inspector 0.12.0-canary.5 → 0.12.0-canary.6

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.
@@ -1,8 +1,8 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-BrMISn7F.js","assets/util-t-trnxQI.js","assets/__vite-browser-external-DFygW7-s.js","assets/index-DRz5BQNA.js","assets/path-C9FudP8b.js","assets/index-BzY2KYX6.js","assets/index-Dpg6KEQB.js","assets/index-BSXCtRbq.js","assets/index-CrAps-4a.js","assets/embeddings-DVnXcoOn.js","assets/index-BHtVf3QS.js","assets/index-CSbVdovT.js","assets/browser-BX0wEGkA.js"])))=>i.map(i=>d[i]);
2
- var W9=Object.defineProperty;var K9=(e,t,n)=>t in e?W9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var lh=(e,t,n)=>K9(e,typeof t!="symbol"?t+"":t,n);function Y9(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const s=Object.getOwnPropertyDescriptor(r,a);s&&Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>r[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();function bp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Dve(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var a=!1;try{a=this instanceof r}catch{}return a?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(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var fw={exports:{}},nf={};var nL;function Z9(){if(nL)return nf;nL=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var c in a)c!=="key"&&(s[c]=a[c])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return nf.Fragment=t,nf.jsx=n,nf.jsxs=n,nf}var rL;function q9(){return rL||(rL=1,fw.exports=Z9()),fw.exports}var d=q9();const X9="modulepreload",J9=function(e){return"/inspector/"+e},aL={},hr=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(f){return Promise.all(f.map(m=>Promise.resolve(m).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");a=u(n.map(f=>{if(f=J9(f),f in aL)return;aL[f]=!0;const m=f.endsWith(".css"),h=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":X9,m||(b.as="script"),b.crossOrigin="",b.href=f,c&&b.setAttribute("nonce",c),document.head.appendChild(b),m)return new Promise((y,x)=>{b.addEventListener("load",y),b.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};var Q9=Object.defineProperty,Ge=(e,t)=>Q9(e,"name",{value:t,configurable:!0}),oL=(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')}),eG={},az=typeof globalThis.Deno<"u";function tG(e){return az?globalThis.Deno.env.get(e):eG[e]}Ge(tG,"getEnv");function nG(){return az?globalThis.Deno.cwd():process.cwd()}Ge(nG,"getCwd");function oz(){return globalThis.crypto.randomUUID()}Ge(oz,"generateUUID");var Mc={};async function sz(){if(typeof process<"u")try{const e=await hr(()=>import("./__vite-browser-external-DFygW7-s.js").then(n=>n.o),[]),t=await hr(()=>import("./path-C9FudP8b.js").then(n=>n.p),[]);return{fs:e.default,path:t.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}Ge(sz,"getNodeModules");var ja=null;function iz(){if(typeof oL<"u")try{ja=oL("winston")}catch{}}Ge(iz,"loadWinstonSync");async function lz(){return ja||(ja=await hr(()=>import("./winston-BrMISn7F.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4]))),ja}Ge(lz,"getWinston");var ME="mcp-use";function Wg(){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}}Ge(Wg,"isNodeJSEnvironment");var hu,rG=(hu=class{_level;name;constructor(t=ME,n="info"){this.name=t,this._level=n}shouldLog(t){const n=["error","warn","info","http","verbose","debug","silly"],r=n.indexOf(this._level);return n.indexOf(t)<=r}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}},Ge(hu,"SimpleConsoleLogger"),hu);function xg(e){switch((typeof process<"u"&&Mc?e:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}Ge(xg,"resolveLevel");var vs,cz=(vs=class{static get(t=ME){if(!Wg()){if(!this.simpleInstances[t]){const n=typeof process<"u"&&Mc?.DEBUG||void 0;this.simpleInstances[t]=new rG(t,xg(n))}return this.simpleInstances[t]}if(!this.instances[t]){if(!ja)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:n,format:r}=ja,{combine:a,timestamp:s,label:i,colorize:c,splat:u}=r;this.instances[t]=n({level:xg(Mc.DEBUG),format:a(c(),u(),i({label:t}),s({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})}return this.instances[t]}static getFormatter(){if(!ja)throw new Error("Winston not loaded");const{format:t}=ja,{printf:n}=t,r=n(({level:i,message:c,label:u,timestamp:f})=>`${f} [${u}] ${i}: ${c}`),a=n(({level:i,message:c,label:u,timestamp:f})=>`${f} [${u}] ${i.toUpperCase()}: ${c}`),s=n(({level:i,message:c,label:u,timestamp:f})=>`${f} [${u}] ${i.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return r;case"detailed":return a;case"emoji":return s;default:return r}}static async configure(t={}){const{level:n,console:r=!0,file:a,format:s="minimal"}=t,i=typeof process<"u"&&Mc?.DEBUG||void 0,c=n??xg(i);if(this.currentFormat=s,!Wg()){Object.values(this.simpleInstances).forEach(w=>{w.level=c});return}if(await lz(),!ja)throw new Error("Failed to load winston");const u=this.get();u.level=c;const f=u;if(f.clear(),r&&f.add(new ja.transports.Console),a){const{fs:w,path:_}=await sz();if(w&&_){const S=_.dirname(_.resolve(a));w.existsSync(S)||w.mkdirSync(S,{recursive:!0}),f.add(new ja.transports.File({filename:a}))}}const{format:m}=ja,{combine:h,timestamp:b,label:y,colorize:x,splat:E}=m;Object.values(this.instances).forEach(w=>{w&&"format"in w&&(w.level=c,w.format=h(x(),E(),y({label:ME}),b({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(t){let n;t===2||t===!0?n="debug":n="info",Object.values(this.simpleInstances).forEach(r=>{r.level=n}),Object.values(this.instances).forEach(r=>{r&&(r.level=n)}),typeof process<"u"&&Mc&&(Mc.DEBUG=t?t===!0?"2":String(t):"0")}static setFormat(t){this.currentFormat=t,this.configure({format:t})}},Ge(vs,"Logger"),lh(vs,"instances",{}),lh(vs,"simpleInstances",{}),lh(vs,"currentFormat","minimal"),vs);Wg()&&(iz(),ja&&cz.configure());var Re=cz.get();const aG=Object.freeze({status:"aborted"});function Se(e,t,n){function r(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const f=i.prototype,m=Object.keys(f);for(let h=0;h<m.length;h++){const b=m[h];b in c||(c[b]=f[b].bind(c))}}const a=n?.Parent??Object;class s extends a{}Object.defineProperty(s,"name",{value:e});function i(c){var u;const f=n?.Parent?new s:this;r(f,c),(u=f._zod).deferred??(u.deferred=[]);for(const m of f._zod.deferred)m();return f}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class ou extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class uz extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const jE={};function Ni(e){return e&&Object.assign(jE,e),jE}function oG(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function Lve(e,t="|"){return e.map(n=>uG(n)).join(t)}function PE(e,t){return typeof t=="bigint"?t.toString():t}function Gb(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function MS(e){return e==null}function jS(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function sG(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let a=(r.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u?.[1]&&(a=Number.parseInt(u[1]))}const s=n>a?n:a,i=Number.parseInt(e.toFixed(s).replace(".","")),c=Number.parseInt(t.toFixed(s).replace(".",""));return i%c/10**s}const sL=Symbol("evaluating");function Nn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==sL)return r===void 0&&(r=sL,r=n()),r},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function jl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pl(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function iL(e){return JSON.stringify(e)}function iG(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const dz="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Hf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const lG=Gb(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Nu(e){if(Hf(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Hf(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function fz(e){return Nu(e)?{...e}:Array.isArray(e)?[...e]:e}const cG=new Set(["string","number","symbol"]);function ku(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mi(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Qe(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 uG(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function dG(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const fG={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]};function pG(e,t){const n=e._zod.def,r=Pl(e._zod.def,{get shape(){const a={};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=n.shape[s])}return jl(this,"shape",a),a},checks:[]});return Mi(e,r)}function mG(e,t){const n=e._zod.def,r=Pl(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return jl(this,"shape",a),a},checks:[]});return Mi(e,r)}function hG(e,t){if(!Nu(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 a=Pl(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return jl(this,"shape",s),s},checks:[]});return Mi(e,a)}function gG(e,t){if(!Nu(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return jl(this,"shape",r),r},checks:e._zod.def.checks};return Mi(e,n)}function bG(e,t){const n=Pl(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return jl(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Mi(e,n)}function yG(e,t,n){const r=Pl(t._zod.def,{get shape(){const a=t._zod.def.shape,s={...a};if(n)for(const i in n){if(!(i in a))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=e?new e({type:"optional",innerType:a[i]}):a[i])}else for(const i in a)s[i]=e?new e({type:"optional",innerType:a[i]}):a[i];return jl(this,"shape",s),s},checks:[]});return Mi(t,r)}function vG(e,t,n){const r=Pl(t._zod.def,{get shape(){const a=t._zod.def.shape,s={...a};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:a[i]}))}else for(const i in a)s[i]=new e({type:"nonoptional",innerType:a[i]});return jl(this,"shape",s),s},checks:[]});return Mi(t,r)}function Gc(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 Wc(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ch(e){return typeof e=="string"?e:e?.message}function ki(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=ch(e.inst?._zod.def?.error?.(e))??ch(t?.error?.(e))??ch(n.customError?.(e))??ch(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function PS(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Vf(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const pz=(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,PE,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},mz=Se("$ZodError",pz),Wb=Se("$ZodError",pz,{Parent:Error});function wG(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function EG(e,t=n=>n.message){const n={_errors:[]},r=a=>{for(const s of a.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,c=0;for(;c<s.path.length;){const u=s.path[c];c===s.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(t(s))):i[u]=i[u]||{_errors:[]},i=i[u],c++}}};return r(e),n}function xG(e){const t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function Mve(e){const t=[],n=[...e.issues].sort((r,a)=>(r.path??[]).length-(a.path??[]).length);for(const r of n)t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${xG(r.path)}`);return t.join(`
3
- `)}const Kb=e=>(t,n,r,a)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new ou;if(i.issues.length){const c=new(a?.Err??e)(i.issues.map(u=>ki(u,s,Ni())));throw dz(c,a?.callee),c}return i.value},jve=Kb(Wb),Yb=e=>async(t,n,r,a)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const c=new(a?.Err??e)(i.issues.map(u=>ki(u,s,Ni())));throw dz(c,a?.callee),c}return i.value},Pve=Yb(Wb),Zb=e=>(t,n,r)=>{const a=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new ou;return s.issues.length?{success:!1,error:new(e??mz)(s.issues.map(i=>ki(i,a,Ni())))}:{success:!0,data:s.value}},hz=Zb(Wb),qb=e=>async(t,n,r)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>ki(i,a,Ni())))}:{success:!0,data:s.value}},SG=qb(Wb),_G=e=>(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Kb(e)(t,n,a)},TG=e=>(t,n,r)=>Kb(e)(t,n,r),NG=e=>async(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Yb(e)(t,n,a)},kG=e=>async(t,n,r)=>Yb(e)(t,n,r),CG=e=>(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Zb(e)(t,n,a)},RG=e=>(t,n,r)=>Zb(e)(t,n,r),AG=e=>async(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qb(e)(t,n,a)},IG=e=>async(t,n,r)=>qb(e)(t,n,r),OG=/^[cC][^\s-]{8,}$/,DG=/^[0-9a-z]+$/,LG=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,MG=/^[0-9a-vA-V]{20}$/,jG=/^[A-Za-z0-9]{27}$/,PG=/^[a-zA-Z0-9_-]{21}$/,UG=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$G=/^([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})$/,lL=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)$/,zG=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,FG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function BG(){return new RegExp(FG,"u")}const HG=/^(?:(?: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])$/,VG=/^(([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}|:))$/,GG=/^((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])$/,WG=/^(([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])$/,KG=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gz=/^[A-Za-z0-9_-]*$/,YG=/^\+(?:[0-9]){6,14}[0-9]$/,bz="(?:(?:\\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])))",ZG=new RegExp(`^${bz}$`);function yz(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 qG(e){return new RegExp(`^${yz(e)}$`)}function XG(e){const t=yz({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${bz}T(?:${r})$`)}const JG=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},QG=/^-?\d+$/,e7=/^-?\d+(?:\.\d+)?/,t7=/^(?:true|false)$/i,n7=/^null$/i,r7=/^[^A-Z]*$/,a7=/^[^a-z]*$/,xa=Se("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),vz={number:"number",bigint:"bigint",object:"date"},wz=Se("$ZodCheckLessThan",(e,t)=>{xa.init(e,t);const n=vz[typeof t.value];e._zod.onattach.push(r=>{const a=r._zod.bag,s=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ez=Se("$ZodCheckGreaterThan",(e,t)=>{xa.init(e,t);const n=vz[typeof t.value];e._zod.onattach.push(r=>{const a=r._zod.bag,s=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),o7=Se("$ZodCheckMultipleOf",(e,t)=>{xa.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.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):sG(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})}}),s7=Se("$ZodCheckNumberFormat",(e,t)=>{xa.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[a,s]=fG[t.format];e._zod.onattach.push(i=>{const c=i._zod.bag;c.format=t.format,c.minimum=a,c.maximum=s,n&&(c.pattern=QG)}),e._zod.check=i=>{const c=i.value;if(n){if(!Number.isInteger(c)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}c<a&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inst:e})}}),i7=Se("$ZodCheckMaxLength",(e,t)=>{var n;xa.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!MS(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const a=r.value;if(a.length<=t.maximum)return;const i=PS(a);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),l7=Se("$ZodCheckMinLength",(e,t)=>{var n;xa.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!MS(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const a=r.value;if(a.length>=t.minimum)return;const i=PS(a);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),c7=Se("$ZodCheckLengthEquals",(e,t)=>{var n;xa.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!MS(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=r=>{const a=r.value,s=a.length;if(s===t.length)return;const i=PS(a),c=s>t.length;r.issues.push({origin:i,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Xb=Se("$ZodCheckStringFormat",(e,t)=>{var n,r;xa.init(e,t),e._zod.onattach.push(a=>{const s=a._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),u7=Se("$ZodCheckRegex",(e,t)=>{Xb.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})}}),d7=Se("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=r7),Xb.init(e,t)}),f7=Se("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=a7),Xb.init(e,t)}),p7=Se("$ZodCheckIncludes",(e,t)=>{xa.init(e,t);const n=ku(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),m7=Se("$ZodCheckStartsWith",(e,t)=>{xa.init(e,t);const n=new RegExp(`^${ku(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),h7=Se("$ZodCheckEndsWith",(e,t)=>{xa.init(e,t);const n=new RegExp(`.*${ku(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),g7=Se("$ZodCheckOverwrite",(e,t)=>{xa.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class b7{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 r=t.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-DqTb7lu1.js","assets/util-t-trnxQI.js","assets/__vite-browser-external-DFygW7-s.js","assets/index-DRz5BQNA.js","assets/path-C9FudP8b.js","assets/index-DOX6bDm6.js","assets/index-rCecp17x.js","assets/index-B9_eialH.js","assets/index-_Ef_Est5.js","assets/embeddings-5B67FZct.js","assets/index-DtG5fMwI.js","assets/index-Cf0O1YbZ.js","assets/browser-B12tbDYW.js"])))=>i.map(i=>d[i]);
2
+ var W9=Object.defineProperty;var K9=(e,t,n)=>t in e?W9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var lh=(e,t,n)=>K9(e,typeof t!="symbol"?t+"":t,n);function Y9(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const s=Object.getOwnPropertyDescriptor(r,a);s&&Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>r[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();function bp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Dve(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var a=!1;try{a=this instanceof r}catch{}return a?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(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var fw={exports:{}},nf={};var nL;function Z9(){if(nL)return nf;nL=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var c in a)c!=="key"&&(s[c]=a[c])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return nf.Fragment=t,nf.jsx=n,nf.jsxs=n,nf}var rL;function q9(){return rL||(rL=1,fw.exports=Z9()),fw.exports}var d=q9();const X9="modulepreload",J9=function(e){return"/inspector/"+e},aL={},hr=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(f){return Promise.all(f.map(m=>Promise.resolve(m).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");a=u(n.map(f=>{if(f=J9(f),f in aL)return;aL[f]=!0;const m=f.endsWith(".css"),h=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":X9,m||(b.as="script"),b.crossOrigin="",b.href=f,c&&b.setAttribute("nonce",c),document.head.appendChild(b),m)return new Promise((y,x)=>{b.addEventListener("load",y),b.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};var Q9=Object.defineProperty,Ge=(e,t)=>Q9(e,"name",{value:t,configurable:!0}),oL=(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')}),Mc={};async function az(){if(typeof process<"u")try{const e=await hr(()=>import("./__vite-browser-external-DFygW7-s.js").then(n=>n.o),[]),t=await hr(()=>import("./path-C9FudP8b.js").then(n=>n.p),[]);return{fs:e.default,path:t.default}}catch{return{fs:null,path:null}}return{fs:null,path:null}}Ge(az,"getNodeModules");var ja=null;function oz(){if(typeof oL<"u")try{ja=oL("winston")}catch{}}Ge(oz,"loadWinstonSync");async function sz(){return ja||(ja=await hr(()=>import("./winston-DqTb7lu1.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4]))),ja}Ge(sz,"getWinston");var ME="mcp-use";function Wg(){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}}Ge(Wg,"isNodeJSEnvironment");var hu,eG=(hu=class{_level;name;constructor(t=ME,n="info"){this.name=t,this._level=n}shouldLog(t){const n=["error","warn","info","http","verbose","debug","silly"],r=n.indexOf(this._level);return n.indexOf(t)<=r}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}},Ge(hu,"SimpleConsoleLogger"),hu);function xg(e){switch((typeof process<"u"&&Mc?e:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}Ge(xg,"resolveLevel");var vs,iz=(vs=class{static get(t=ME){if(!Wg()){if(!this.simpleInstances[t]){const n=typeof process<"u"&&Mc?.DEBUG||void 0;this.simpleInstances[t]=new eG(t,xg(n))}return this.simpleInstances[t]}if(!this.instances[t]){if(!ja)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:n,format:r}=ja,{combine:a,timestamp:s,label:i,colorize:c,splat:u}=r;this.instances[t]=n({level:xg(Mc.DEBUG),format:a(c(),u(),i({label:t}),s({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})}return this.instances[t]}static getFormatter(){if(!ja)throw new Error("Winston not loaded");const{format:t}=ja,{printf:n}=t,r=n(({level:i,message:c,label:u,timestamp:f})=>`${f} [${u}] ${i}: ${c}`),a=n(({level:i,message:c,label:u,timestamp:f})=>`${f} [${u}] ${i.toUpperCase()}: ${c}`),s=n(({level:i,message:c,label:u,timestamp:f})=>`${f} [${u}] ${i.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return r;case"detailed":return a;case"emoji":return s;default:return r}}static async configure(t={}){const{level:n,console:r=!0,file:a,format:s="minimal"}=t,i=typeof process<"u"&&Mc?.DEBUG||void 0,c=n??xg(i);if(this.currentFormat=s,!Wg()){Object.values(this.simpleInstances).forEach(w=>{w.level=c});return}if(await sz(),!ja)throw new Error("Failed to load winston");const u=this.get();u.level=c;const f=u;if(f.clear(),r&&f.add(new ja.transports.Console),a){const{fs:w,path:_}=await az();if(w&&_){const S=_.dirname(_.resolve(a));w.existsSync(S)||w.mkdirSync(S,{recursive:!0}),f.add(new ja.transports.File({filename:a}))}}const{format:m}=ja,{combine:h,timestamp:b,label:y,colorize:x,splat:E}=m;Object.values(this.instances).forEach(w=>{w&&"format"in w&&(w.level=c,w.format=h(x(),E(),y({label:ME}),b({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(t){let n;t===2||t===!0?n="debug":n="info",Object.values(this.simpleInstances).forEach(r=>{r.level=n}),Object.values(this.instances).forEach(r=>{r&&(r.level=n)}),typeof process<"u"&&Mc&&(Mc.DEBUG=t?t===!0?"2":String(t):"0")}static setFormat(t){this.currentFormat=t,this.configure({format:t})}},Ge(vs,"Logger"),lh(vs,"instances",{}),lh(vs,"simpleInstances",{}),lh(vs,"currentFormat","minimal"),vs);Wg()&&(oz(),ja&&iz.configure());var Re=iz.get();const tG=Object.freeze({status:"aborted"});function Se(e,t,n){function r(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const f=i.prototype,m=Object.keys(f);for(let h=0;h<m.length;h++){const b=m[h];b in c||(c[b]=f[b].bind(c))}}const a=n?.Parent??Object;class s extends a{}Object.defineProperty(s,"name",{value:e});function i(c){var u;const f=n?.Parent?new s:this;r(f,c),(u=f._zod).deferred??(u.deferred=[]);for(const m of f._zod.deferred)m();return f}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class ou extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class lz extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const jE={};function Ni(e){return e&&Object.assign(jE,e),jE}function nG(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function Lve(e,t="|"){return e.map(n=>iG(n)).join(t)}function PE(e,t){return typeof t=="bigint"?t.toString():t}function Gb(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function MS(e){return e==null}function jS(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function rG(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let a=(r.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u?.[1]&&(a=Number.parseInt(u[1]))}const s=n>a?n:a,i=Number.parseInt(e.toFixed(s).replace(".","")),c=Number.parseInt(t.toFixed(s).replace(".",""));return i%c/10**s}const sL=Symbol("evaluating");function Nn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==sL)return r===void 0&&(r=sL,r=n()),r},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function jl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pl(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function iL(e){return JSON.stringify(e)}function aG(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const cz="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Hf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const oG=Gb(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Nu(e){if(Hf(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Hf(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function uz(e){return Nu(e)?{...e}:Array.isArray(e)?[...e]:e}const sG=new Set(["string","number","symbol"]);function ku(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mi(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Qe(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 iG(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function lG(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const cG={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]};function uG(e,t){const n=e._zod.def,r=Pl(e._zod.def,{get shape(){const a={};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=n.shape[s])}return jl(this,"shape",a),a},checks:[]});return Mi(e,r)}function dG(e,t){const n=e._zod.def,r=Pl(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return jl(this,"shape",a),a},checks:[]});return Mi(e,r)}function fG(e,t){if(!Nu(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 a=Pl(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return jl(this,"shape",s),s},checks:[]});return Mi(e,a)}function pG(e,t){if(!Nu(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return jl(this,"shape",r),r},checks:e._zod.def.checks};return Mi(e,n)}function mG(e,t){const n=Pl(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return jl(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Mi(e,n)}function hG(e,t,n){const r=Pl(t._zod.def,{get shape(){const a=t._zod.def.shape,s={...a};if(n)for(const i in n){if(!(i in a))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=e?new e({type:"optional",innerType:a[i]}):a[i])}else for(const i in a)s[i]=e?new e({type:"optional",innerType:a[i]}):a[i];return jl(this,"shape",s),s},checks:[]});return Mi(t,r)}function gG(e,t,n){const r=Pl(t._zod.def,{get shape(){const a=t._zod.def.shape,s={...a};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:a[i]}))}else for(const i in a)s[i]=new e({type:"nonoptional",innerType:a[i]});return jl(this,"shape",s),s},checks:[]});return Mi(t,r)}function Gc(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 Wc(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ch(e){return typeof e=="string"?e:e?.message}function ki(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=ch(e.inst?._zod.def?.error?.(e))??ch(t?.error?.(e))??ch(n.customError?.(e))??ch(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function PS(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Vf(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const dz=(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,PE,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fz=Se("$ZodError",dz),Wb=Se("$ZodError",dz,{Parent:Error});function bG(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function yG(e,t=n=>n.message){const n={_errors:[]},r=a=>{for(const s of a.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,c=0;for(;c<s.path.length;){const u=s.path[c];c===s.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(t(s))):i[u]=i[u]||{_errors:[]},i=i[u],c++}}};return r(e),n}function vG(e){const t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function Mve(e){const t=[],n=[...e.issues].sort((r,a)=>(r.path??[]).length-(a.path??[]).length);for(const r of n)t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${vG(r.path)}`);return t.join(`
3
+ `)}const Kb=e=>(t,n,r,a)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new ou;if(i.issues.length){const c=new(a?.Err??e)(i.issues.map(u=>ki(u,s,Ni())));throw cz(c,a?.callee),c}return i.value},jve=Kb(Wb),Yb=e=>async(t,n,r,a)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const c=new(a?.Err??e)(i.issues.map(u=>ki(u,s,Ni())));throw cz(c,a?.callee),c}return i.value},Pve=Yb(Wb),Zb=e=>(t,n,r)=>{const a=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new ou;return s.issues.length?{success:!1,error:new(e??fz)(s.issues.map(i=>ki(i,a,Ni())))}:{success:!0,data:s.value}},pz=Zb(Wb),qb=e=>async(t,n,r)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>ki(i,a,Ni())))}:{success:!0,data:s.value}},wG=qb(Wb),EG=e=>(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Kb(e)(t,n,a)},xG=e=>(t,n,r)=>Kb(e)(t,n,r),SG=e=>async(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Yb(e)(t,n,a)},_G=e=>async(t,n,r)=>Yb(e)(t,n,r),TG=e=>(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Zb(e)(t,n,a)},NG=e=>(t,n,r)=>Zb(e)(t,n,r),kG=e=>async(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qb(e)(t,n,a)},CG=e=>async(t,n,r)=>qb(e)(t,n,r),RG=/^[cC][^\s-]{8,}$/,AG=/^[0-9a-z]+$/,IG=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,OG=/^[0-9a-vA-V]{20}$/,DG=/^[A-Za-z0-9]{27}$/,LG=/^[a-zA-Z0-9_-]{21}$/,MG=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,jG=/^([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})$/,lL=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)$/,PG=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,UG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $G(){return new RegExp(UG,"u")}const zG=/^(?:(?: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])$/,FG=/^(([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}|:))$/,BG=/^((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])$/,HG=/^(([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])$/,VG=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mz=/^[A-Za-z0-9_-]*$/,GG=/^\+(?:[0-9]){6,14}[0-9]$/,hz="(?:(?:\\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])))",WG=new RegExp(`^${hz}$`);function gz(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 KG(e){return new RegExp(`^${gz(e)}$`)}function YG(e){const t=gz({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${hz}T(?:${r})$`)}const ZG=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},qG=/^-?\d+$/,XG=/^-?\d+(?:\.\d+)?/,JG=/^(?:true|false)$/i,QG=/^null$/i,e7=/^[^A-Z]*$/,t7=/^[^a-z]*$/,xa=Se("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bz={number:"number",bigint:"bigint",object:"date"},yz=Se("$ZodCheckLessThan",(e,t)=>{xa.init(e,t);const n=bz[typeof t.value];e._zod.onattach.push(r=>{const a=r._zod.bag,s=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vz=Se("$ZodCheckGreaterThan",(e,t)=>{xa.init(e,t);const n=bz[typeof t.value];e._zod.onattach.push(r=>{const a=r._zod.bag,s=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),n7=Se("$ZodCheckMultipleOf",(e,t)=>{xa.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.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):rG(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})}}),r7=Se("$ZodCheckNumberFormat",(e,t)=>{xa.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[a,s]=cG[t.format];e._zod.onattach.push(i=>{const c=i._zod.bag;c.format=t.format,c.minimum=a,c.maximum=s,n&&(c.pattern=qG)}),e._zod.check=i=>{const c=i.value;if(n){if(!Number.isInteger(c)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}c<a&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inst:e})}}),a7=Se("$ZodCheckMaxLength",(e,t)=>{var n;xa.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!MS(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const a=r.value;if(a.length<=t.maximum)return;const i=PS(a);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),o7=Se("$ZodCheckMinLength",(e,t)=>{var n;xa.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!MS(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const a=r.value;if(a.length>=t.minimum)return;const i=PS(a);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),s7=Se("$ZodCheckLengthEquals",(e,t)=>{var n;xa.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!MS(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=r=>{const a=r.value,s=a.length;if(s===t.length)return;const i=PS(a),c=s>t.length;r.issues.push({origin:i,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Xb=Se("$ZodCheckStringFormat",(e,t)=>{var n,r;xa.init(e,t),e._zod.onattach.push(a=>{const s=a._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),i7=Se("$ZodCheckRegex",(e,t)=>{Xb.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})}}),l7=Se("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=e7),Xb.init(e,t)}),c7=Se("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=t7),Xb.init(e,t)}),u7=Se("$ZodCheckIncludes",(e,t)=>{xa.init(e,t);const n=ku(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),d7=Se("$ZodCheckStartsWith",(e,t)=>{xa.init(e,t);const n=new RegExp(`^${ku(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),f7=Se("$ZodCheckEndsWith",(e,t)=>{xa.init(e,t);const n=new RegExp(`.*${ku(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),p7=Se("$ZodCheckOverwrite",(e,t)=>{xa.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class m7{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 r=t.split(`
4
4
  `).filter(i=>i),a=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(a)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,a=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,a.join(`
5
- `))}}const y7={major:4,minor:1,patch:13},Mn=Se("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=y7;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const s of a._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(i,c,u)=>{let f=Gc(i),m;for(const h of c){if(h._zod.def.when){if(!h._zod.def.when(i))continue}else if(f)continue;const b=i.issues.length,y=h._zod.check(i);if(y instanceof Promise&&u?.async===!1)throw new ou;if(m||y instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await y,i.issues.length!==b&&(f||(f=Gc(i,b)))});else{if(i.issues.length===b)continue;f||(f=Gc(i,b))}}return m?m.then(()=>i):i},s=(i,c,u)=>{if(Gc(i))return i.aborted=!0,i;const f=a(c,r,u);if(f instanceof Promise){if(u.async===!1)throw new ou;return f.then(m=>e._zod.parse(m,u))}return e._zod.parse(f,u)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){const f=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return f instanceof Promise?f.then(m=>s(m,i,c)):s(f,i,c)}const u=e._zod.parse(i,c);if(u instanceof Promise){if(c.async===!1)throw new ou;return u.then(f=>a(f,r,c))}return a(u,r,c)}}e["~standard"]={validate:a=>{try{const s=hz(e,a);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return SG(e,a).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),US=Se("$ZodString",(e,t)=>{Mn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??JG(e._zod.bag),e._zod.parse=(n,r)=>{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}}),zn=Se("$ZodStringFormat",(e,t)=>{Xb.init(e,t),US.init(e,t)}),v7=Se("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=$G),zn.init(e,t)}),w7=Se("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lL(r))}else t.pattern??(t.pattern=lL());zn.init(e,t)}),E7=Se("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zG),zn.init(e,t)}),x7=Se("$ZodURL",(e,t)=>{zn.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),a=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.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=a.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),S7=Se("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=BG()),zn.init(e,t)}),_7=Se("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=PG),zn.init(e,t)}),T7=Se("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=OG),zn.init(e,t)}),N7=Se("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=DG),zn.init(e,t)}),k7=Se("$ZodULID",(e,t)=>{t.pattern??(t.pattern=LG),zn.init(e,t)}),C7=Se("$ZodXID",(e,t)=>{t.pattern??(t.pattern=MG),zn.init(e,t)}),R7=Se("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=jG),zn.init(e,t)}),A7=Se("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=XG(t)),zn.init(e,t)}),I7=Se("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ZG),zn.init(e,t)}),O7=Se("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=qG(t)),zn.init(e,t)}),D7=Se("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=UG),zn.init(e,t)}),L7=Se("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=HG),zn.init(e,t),e._zod.bag.format="ipv4"}),M7=Se("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=VG),zn.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})}}}),j7=Se("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=GG),zn.init(e,t)}),P7=Se("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=WG),zn.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[a,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${a}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function xz(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const U7=Se("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=KG),zn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{xz(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function $7(e){if(!gz.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return xz(n)}const z7=Se("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=gz),zn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{$7(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),F7=Se("$ZodE164",(e,t)=>{t.pattern??(t.pattern=YG),zn.init(e,t)});function B7(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const a=JSON.parse(atob(r));return!("typ"in a&&a?.typ!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const H7=Se("$ZodJWT",(e,t)=>{zn.init(e,t),e._zod.check=n=>{B7(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Sz=Se("$ZodNumber",(e,t)=>{Mn.init(e,t),e._zod.pattern=e._zod.bag.pattern??e7,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const a=n.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return n;const s=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...s?{received:s}:{}}),n}}),V7=Se("$ZodNumberFormat",(e,t)=>{s7.init(e,t),Sz.init(e,t)}),G7=Se("$ZodBoolean",(e,t)=>{Mn.init(e,t),e._zod.pattern=t7,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const a=n.value;return typeof a=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),n}}),W7=Se("$ZodNull",(e,t)=>{Mn.init(e,t),e._zod.pattern=n7,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const a=n.value;return a===null||n.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),n}}),K7=Se("$ZodAny",(e,t)=>{Mn.init(e,t),e._zod.parse=n=>n}),Y7=Se("$ZodUnknown",(e,t)=>{Mn.init(e,t),e._zod.parse=n=>n}),Z7=Se("$ZodNever",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function cL(e,t,n){e.issues.length&&t.issues.push(...Wc(n,e.issues)),t.value[n]=e.value}const q7=Se("$ZodArray",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),n;n.value=Array(a.length);const s=[];for(let i=0;i<a.length;i++){const c=a[i],u=t.element._zod.run({value:c,issues:[]},r);u instanceof Promise?s.push(u.then(f=>cL(f,n,i))):cL(u,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function Kg(e,t,n,r){e.issues.length&&t.issues.push(...Wc(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function _z(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=dG(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Tz(e,t,n,r,a,s){const i=[],c=a.keySet,u=a.catchall._zod,f=u.def.type;for(const m in t){if(c.has(m))continue;if(f==="never"){i.push(m);continue}const h=u.run({value:t[m],issues:[]},r);h instanceof Promise?e.push(h.then(b=>Kg(b,n,m,t))):Kg(h,n,m,t)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const X7=Se("$ZodObject",(e,t)=>{if(Mn.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 r=Gb(()=>_z(t));Nn(e._zod,"propValues",()=>{const c=t.shape,u={};for(const f in c){const m=c[f]._zod;if(m.values){u[f]??(u[f]=new Set);for(const h of m.values)u[f].add(h)}}return u});const a=Hf,s=t.catchall;let i;e._zod.parse=(c,u)=>{i??(i=r.value);const f=c.value;if(!a(f))return c.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),c;c.value={};const m=[],h=i.shape;for(const b of i.keys){const x=h[b]._zod.run({value:f[b],issues:[]},u);x instanceof Promise?m.push(x.then(E=>Kg(E,c,b,f))):Kg(x,c,b,f)}return s?Tz(m,f,c,u,r.value,e):m.length?Promise.all(m).then(()=>c):c}}),J7=Se("$ZodObjectJIT",(e,t)=>{X7.init(e,t);const n=e._zod.parse,r=Gb(()=>_z(t)),a=b=>{const y=new b7(["shape","payload","ctx"]),x=r.value,E=T=>{const R=iL(T);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};y.write("const input = payload.value;");const w=Object.create(null);let _=0;for(const T of x.keys)w[T]=`key_${_++}`;y.write("const newResult = {};");for(const T of x.keys){const R=w[T],C=iL(T);y.write(`const ${R} = ${E(T)};`),y.write(`
5
+ `))}}const h7={major:4,minor:1,patch:13},Mn=Se("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=h7;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const s of a._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(i,c,u)=>{let f=Gc(i),m;for(const h of c){if(h._zod.def.when){if(!h._zod.def.when(i))continue}else if(f)continue;const b=i.issues.length,y=h._zod.check(i);if(y instanceof Promise&&u?.async===!1)throw new ou;if(m||y instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await y,i.issues.length!==b&&(f||(f=Gc(i,b)))});else{if(i.issues.length===b)continue;f||(f=Gc(i,b))}}return m?m.then(()=>i):i},s=(i,c,u)=>{if(Gc(i))return i.aborted=!0,i;const f=a(c,r,u);if(f instanceof Promise){if(u.async===!1)throw new ou;return f.then(m=>e._zod.parse(m,u))}return e._zod.parse(f,u)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){const f=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return f instanceof Promise?f.then(m=>s(m,i,c)):s(f,i,c)}const u=e._zod.parse(i,c);if(u instanceof Promise){if(c.async===!1)throw new ou;return u.then(f=>a(f,r,c))}return a(u,r,c)}}e["~standard"]={validate:a=>{try{const s=pz(e,a);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return wG(e,a).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),US=Se("$ZodString",(e,t)=>{Mn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ZG(e._zod.bag),e._zod.parse=(n,r)=>{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}}),zn=Se("$ZodStringFormat",(e,t)=>{Xb.init(e,t),US.init(e,t)}),g7=Se("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=jG),zn.init(e,t)}),b7=Se("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lL(r))}else t.pattern??(t.pattern=lL());zn.init(e,t)}),y7=Se("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=PG),zn.init(e,t)}),v7=Se("$ZodURL",(e,t)=>{zn.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),a=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.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=a.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),w7=Se("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$G()),zn.init(e,t)}),E7=Se("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=LG),zn.init(e,t)}),x7=Se("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=RG),zn.init(e,t)}),S7=Se("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=AG),zn.init(e,t)}),_7=Se("$ZodULID",(e,t)=>{t.pattern??(t.pattern=IG),zn.init(e,t)}),T7=Se("$ZodXID",(e,t)=>{t.pattern??(t.pattern=OG),zn.init(e,t)}),N7=Se("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=DG),zn.init(e,t)}),k7=Se("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=YG(t)),zn.init(e,t)}),C7=Se("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=WG),zn.init(e,t)}),R7=Se("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=KG(t)),zn.init(e,t)}),A7=Se("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=MG),zn.init(e,t)}),I7=Se("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=zG),zn.init(e,t),e._zod.bag.format="ipv4"}),O7=Se("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=FG),zn.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})}}}),D7=Se("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=BG),zn.init(e,t)}),L7=Se("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=HG),zn.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[a,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${a}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function wz(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const M7=Se("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=VG),zn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{wz(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function j7(e){if(!mz.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return wz(n)}const P7=Se("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mz),zn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{j7(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),U7=Se("$ZodE164",(e,t)=>{t.pattern??(t.pattern=GG),zn.init(e,t)});function $7(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const a=JSON.parse(atob(r));return!("typ"in a&&a?.typ!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const z7=Se("$ZodJWT",(e,t)=>{zn.init(e,t),e._zod.check=n=>{$7(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ez=Se("$ZodNumber",(e,t)=>{Mn.init(e,t),e._zod.pattern=e._zod.bag.pattern??XG,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const a=n.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return n;const s=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...s?{received:s}:{}}),n}}),F7=Se("$ZodNumberFormat",(e,t)=>{r7.init(e,t),Ez.init(e,t)}),B7=Se("$ZodBoolean",(e,t)=>{Mn.init(e,t),e._zod.pattern=JG,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const a=n.value;return typeof a=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),n}}),H7=Se("$ZodNull",(e,t)=>{Mn.init(e,t),e._zod.pattern=QG,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const a=n.value;return a===null||n.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),n}}),V7=Se("$ZodAny",(e,t)=>{Mn.init(e,t),e._zod.parse=n=>n}),G7=Se("$ZodUnknown",(e,t)=>{Mn.init(e,t),e._zod.parse=n=>n}),W7=Se("$ZodNever",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function cL(e,t,n){e.issues.length&&t.issues.push(...Wc(n,e.issues)),t.value[n]=e.value}const K7=Se("$ZodArray",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),n;n.value=Array(a.length);const s=[];for(let i=0;i<a.length;i++){const c=a[i],u=t.element._zod.run({value:c,issues:[]},r);u instanceof Promise?s.push(u.then(f=>cL(f,n,i))):cL(u,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function Kg(e,t,n,r){e.issues.length&&t.issues.push(...Wc(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function xz(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=lG(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Sz(e,t,n,r,a,s){const i=[],c=a.keySet,u=a.catchall._zod,f=u.def.type;for(const m in t){if(c.has(m))continue;if(f==="never"){i.push(m);continue}const h=u.run({value:t[m],issues:[]},r);h instanceof Promise?e.push(h.then(b=>Kg(b,n,m,t))):Kg(h,n,m,t)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const Y7=Se("$ZodObject",(e,t)=>{if(Mn.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 r=Gb(()=>xz(t));Nn(e._zod,"propValues",()=>{const c=t.shape,u={};for(const f in c){const m=c[f]._zod;if(m.values){u[f]??(u[f]=new Set);for(const h of m.values)u[f].add(h)}}return u});const a=Hf,s=t.catchall;let i;e._zod.parse=(c,u)=>{i??(i=r.value);const f=c.value;if(!a(f))return c.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),c;c.value={};const m=[],h=i.shape;for(const b of i.keys){const x=h[b]._zod.run({value:f[b],issues:[]},u);x instanceof Promise?m.push(x.then(E=>Kg(E,c,b,f))):Kg(x,c,b,f)}return s?Sz(m,f,c,u,r.value,e):m.length?Promise.all(m).then(()=>c):c}}),Z7=Se("$ZodObjectJIT",(e,t)=>{Y7.init(e,t);const n=e._zod.parse,r=Gb(()=>xz(t)),a=b=>{const y=new m7(["shape","payload","ctx"]),x=r.value,E=T=>{const R=iL(T);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};y.write("const input = payload.value;");const w=Object.create(null);let _=0;for(const T of x.keys)w[T]=`key_${_++}`;y.write("const newResult = {};");for(const T of x.keys){const R=w[T],C=iL(T);y.write(`const ${R} = ${E(T)};`),y.write(`
6
6
  if (${R}.issues.length) {
7
7
  payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
8
8
  ...iss,
@@ -19,18 +19,18 @@ var W9=Object.defineProperty;var K9=(e,t,n)=>t in e?W9(e,t,{enumerable:!0,config
19
19
  newResult[${C}] = ${R}.value;
20
20
  }
21
21
 
22
- `)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(T,R)=>S(b,T,R)};let s;const i=Hf,c=!jE.jitless,f=c&&lG.value,m=t.catchall;let h;e._zod.parse=(b,y)=>{h??(h=r.value);const x=b.value;return i(x)?c&&f&&y?.async===!1&&y.jitless!==!0?(s||(s=a(t.shape)),b=s(b,y),m?Tz([],x,b,y,h,e):b):n(b,y):(b.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),b)}});function uL(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const a=e.filter(s=>!Gc(s));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>ki(i,r,Ni())))}),t)}const Nz=Se("$ZodUnion",(e,t)=>{Mn.init(e,t),Nn(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),Nn(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),Nn(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),Nn(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){const a=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${a.map(s=>jS(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(n)return r(a,s);let i=!1;const c=[];for(const u of t.options){const f=u._zod.run({value:a.value,issues:[]},s);if(f instanceof Promise)c.push(f),i=!0;else{if(f.issues.length===0)return f;c.push(f)}}return i?Promise.all(c).then(u=>uL(u,a,e,s)):uL(c,a,e,s)}}),Q7=Se("$ZodDiscriminatedUnion",(e,t)=>{Nz.init(e,t);const n=e._zod.parse;Nn(e._zod,"propValues",()=>{const a={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[c,u]of Object.entries(i)){a[c]||(a[c]=new Set);for(const f of u)a[c].add(f)}}return a});const r=Gb(()=>{const a=t.options,s=new Map;for(const i of a){const c=i._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const u of c){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,i)}}return s});e._zod.parse=(a,s)=>{const i=a.value;if(!Hf(i))return a.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),a;const c=r.value.get(i?.[t.discriminator]);return c?c._zod.run(a,s):t.unionFallback?n(a,s):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),a)}}),eW=Se("$ZodIntersection",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>{const a=n.value,s=t.left._zod.run({value:a,issues:[]},r),i=t.right._zod.run({value:a,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([u,f])=>dL(n,u,f)):dL(n,s,i)}});function UE(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(Nu(e)&&Nu(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),a={...e,...t};for(const s of r){const i=UE(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a[s]=i.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const a=e[r],s=t[r],i=UE(a,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function dL(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Gc(e))return e;const r=UE(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const tW=Se("$ZodRecord",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Nu(a))return n.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const c=new Set;for(const f of i)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){c.add(typeof f=="number"?f.toString():f);const m=t.valueType._zod.run({value:a[f],issues:[]},r);m instanceof Promise?s.push(m.then(h=>{h.issues.length&&n.issues.push(...Wc(f,h.issues)),n.value[f]=h.value})):(m.issues.length&&n.issues.push(...Wc(f,m.issues)),n.value[f]=m.value)}let u;for(const f in a)c.has(f)||(u=u??[],u.push(f));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:u})}else{n.value={};for(const c of Reflect.ownKeys(a)){if(c==="__proto__")continue;const u=t.keyType._zod.run({value:c,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>ki(m,r,Ni())),input:c,path:[c],inst:e}),n.value[u.value]=u.value;continue}const f=t.valueType._zod.run({value:a[c],issues:[]},r);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&n.issues.push(...Wc(c,m.issues)),n.value[u.value]=m.value})):(f.issues.length&&n.issues.push(...Wc(c,f.issues)),n.value[u.value]=f.value)}}return s.length?Promise.all(s).then(()=>n):n}}),nW=Se("$ZodEnum",(e,t)=>{Mn.init(e,t);const n=oG(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(a=>cG.has(typeof a)).map(a=>typeof a=="string"?ku(a):a.toString()).join("|")})$`),e._zod.parse=(a,s)=>{const i=a.value;return r.has(i)||a.issues.push({code:"invalid_value",values:n,input:i,inst:e}),a}}),rW=Se("$ZodLiteral",(e,t)=>{if(Mn.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(r=>typeof r=="string"?ku(r):r?ku(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,a)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),aW=Se("$ZodTransform",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new uz(e.constructor.name);const a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(i=>(n.value=i,n));if(a instanceof Promise)throw new ou;return n.value=a,n}});function fL(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const oW=Se("$ZodOptional",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Nn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Nn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${jS(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>fL(s,n.value)):fL(a,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),sW=Se("$ZodNullable",(e,t)=>{Mn.init(e,t),Nn(e._zod,"optin",()=>t.innerType._zod.optin),Nn(e._zod,"optout",()=>t.innerType._zod.optout),Nn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${jS(n.source)}|null)$`):void 0}),Nn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),iW=Se("$ZodDefault",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",Nn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>pL(s,t)):pL(a,t)}});function pL(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const lW=Se("$ZodPrefault",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",Nn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),cW=Se("$ZodNonOptional",(e,t)=>{Mn.init(e,t),Nn(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>mL(s,e)):mL(a,e)}});function mL(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 uW=Se("$ZodCatch",(e,t)=>{Mn.init(e,t),Nn(e._zod,"optin",()=>t.innerType._zod.optin),Nn(e._zod,"optout",()=>t.innerType._zod.optout),Nn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>ki(i,r,Ni()))},input:n.value}),n.issues=[]),n)):(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(s=>ki(s,r,Ni()))},input:n.value}),n.issues=[]),n)}}),dW=Se("$ZodPipe",(e,t)=>{Mn.init(e,t),Nn(e._zod,"values",()=>t.in._zod.values),Nn(e._zod,"optin",()=>t.in._zod.optin),Nn(e._zod,"optout",()=>t.out._zod.optout),Nn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>uh(i,t.in,r)):uh(s,t.in,r)}const a=t.in._zod.run(n,r);return a instanceof Promise?a.then(s=>uh(s,t.out,r)):uh(a,t.out,r)}});function uh(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const fW=Se("$ZodReadonly",(e,t)=>{Mn.init(e,t),Nn(e._zod,"propValues",()=>t.innerType._zod.propValues),Nn(e._zod,"values",()=>t.innerType._zod.values),Nn(e._zod,"optin",()=>t.innerType?._zod?.optin),Nn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(hL):hL(a)}});function hL(e){return e.value=Object.freeze(e.value),e}const pW=Se("$ZodCustom",(e,t)=>{xa.init(e,t),Mn.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then(s=>gL(s,n,r,e));gL(a,n,r,e)}});function gL(e,t,n,r){if(!e){const a={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(a.params=r._zod.def.params),t.issues.push(Vf(a))}}var bL;class mW{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.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 r={...this.get(n)??{}};delete r.id;const a={...r,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function hW(){return new mW}(bL=globalThis).__zod_globalRegistry??(bL.__zod_globalRegistry=hW());const dh=globalThis.__zod_globalRegistry;function gW(e,t){return new e({type:"string",...Qe(t)})}function bW(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Qe(t)})}function yL(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Qe(t)})}function yW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Qe(t)})}function vW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Qe(t)})}function wW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Qe(t)})}function EW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Qe(t)})}function kz(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Qe(t)})}function xW(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Qe(t)})}function SW(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Qe(t)})}function _W(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Qe(t)})}function TW(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Qe(t)})}function NW(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Qe(t)})}function kW(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Qe(t)})}function CW(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Qe(t)})}function RW(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Qe(t)})}function AW(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Qe(t)})}function IW(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Qe(t)})}function OW(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Qe(t)})}function DW(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Qe(t)})}function LW(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Qe(t)})}function MW(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Qe(t)})}function jW(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Qe(t)})}function PW(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Qe(t)})}function UW(e,t){return new e({type:"string",format:"date",check:"string_format",...Qe(t)})}function $W(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Qe(t)})}function zW(e,t){return new e({type:"string",format:"duration",check:"string_format",...Qe(t)})}function FW(e,t){return new e({type:"number",checks:[],...Qe(t)})}function BW(e,t){return new e({type:"number",coerce:!0,checks:[],...Qe(t)})}function HW(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Qe(t)})}function VW(e,t){return new e({type:"boolean",...Qe(t)})}function GW(e,t){return new e({type:"null",...Qe(t)})}function WW(e){return new e({type:"any"})}function KW(e){return new e({type:"unknown"})}function YW(e,t){return new e({type:"never",...Qe(t)})}function vL(e,t){return new wz({check:"less_than",...Qe(t),value:e,inclusive:!1})}function pw(e,t){return new wz({check:"less_than",...Qe(t),value:e,inclusive:!0})}function wL(e,t){return new Ez({check:"greater_than",...Qe(t),value:e,inclusive:!1})}function mw(e,t){return new Ez({check:"greater_than",...Qe(t),value:e,inclusive:!0})}function EL(e,t){return new o7({check:"multiple_of",...Qe(t),value:e})}function Cz(e,t){return new i7({check:"max_length",...Qe(t),maximum:e})}function Yg(e,t){return new l7({check:"min_length",...Qe(t),minimum:e})}function Rz(e,t){return new c7({check:"length_equals",...Qe(t),length:e})}function ZW(e,t){return new u7({check:"string_format",format:"regex",...Qe(t),pattern:e})}function qW(e){return new d7({check:"string_format",format:"lowercase",...Qe(e)})}function XW(e){return new f7({check:"string_format",format:"uppercase",...Qe(e)})}function JW(e,t){return new p7({check:"string_format",format:"includes",...Qe(t),includes:e})}function QW(e,t){return new m7({check:"string_format",format:"starts_with",...Qe(t),prefix:e})}function eK(e,t){return new h7({check:"string_format",format:"ends_with",...Qe(t),suffix:e})}function Fu(e){return new g7({check:"overwrite",tx:e})}function tK(e){return Fu(t=>t.normalize(e))}function nK(){return Fu(e=>e.trim())}function rK(){return Fu(e=>e.toLowerCase())}function aK(){return Fu(e=>e.toUpperCase())}function oK(){return Fu(e=>iG(e))}function sK(e,t,n){return new e({type:"array",element:t,...Qe(n)})}function iK(e,t,n){const r=Qe(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function lK(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Qe(n)})}function cK(e){const t=uK(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Vf(r,n.value,t._zod.def));else{const a=r;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),a.continue??(a.continue=!t._zod.def.abort),n.issues.push(Vf(a))}},e(n.value,n)));return t}function uK(e,t){const n=new xa({check:"custom",...Qe(t)});return n._zod.check=e,n}const dK=Se("ZodISODateTime",(e,t)=>{A7.init(e,t),Wn.init(e,t)});function Az(e){return PW(dK,e)}const fK=Se("ZodISODate",(e,t)=>{I7.init(e,t),Wn.init(e,t)});function pK(e){return UW(fK,e)}const mK=Se("ZodISOTime",(e,t)=>{O7.init(e,t),Wn.init(e,t)});function hK(e){return $W(mK,e)}const gK=Se("ZodISODuration",(e,t)=>{D7.init(e,t),Wn.init(e,t)});function bK(e){return zW(gK,e)}const yK=(e,t)=>{mz.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>EG(e,n)},flatten:{value:n=>wG(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,PE,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,PE,2)}},isEmpty:{get(){return e.issues.length===0}}})},ro=Se("ZodError",yK,{Parent:Error}),vK=Kb(ro),wK=Yb(ro),EK=Zb(ro),xK=qb(ro),SK=_G(ro),_K=TG(ro),TK=NG(ro),NK=kG(ro),kK=CG(ro),CK=RG(ro),RK=AG(ro),AK=IG(ro),Fn=Se("ZodType",(e,t)=>(Mn.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Pl(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]})),e.clone=(n,r)=>Mi(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>vK(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>EK(e,n,r),e.parseAsync=async(n,r)=>wK(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>xK(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>SK(e,n,r),e.decode=(n,r)=>_K(e,n,r),e.encodeAsync=async(n,r)=>TK(e,n,r),e.decodeAsync=async(n,r)=>NK(e,n,r),e.safeEncode=(n,r)=>kK(e,n,r),e.safeDecode=(n,r)=>CK(e,n,r),e.safeEncodeAsync=async(n,r)=>RK(e,n,r),e.safeDecodeAsync=async(n,r)=>AK(e,n,r),e.refine=(n,r)=>e.check(EY(n,r)),e.superRefine=n=>e.check(xY(n)),e.overwrite=n=>e.check(Fu(n)),e.optional=()=>tt(e),e.nullable=()=>_L(e),e.nullish=()=>tt(_L(e)),e.nonoptional=n=>mY(e,n),e.array=()=>Fe(e),e.or=n=>Bn([e,n]),e.and=n=>zS(e,n),e.transform=n=>zE(e,Pz(n)),e.default=n=>dY(e,n),e.prefault=n=>pY(e,n),e.catch=n=>gY(e,n),e.pipe=n=>zE(e,n),e.readonly=()=>vY(e),e.describe=n=>{const r=e.clone();return dh.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return dh.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return dh.get(e);const r=e.clone();return dh.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Iz=Se("_ZodString",(e,t)=>{US.init(e,t),Fn.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(ZW(...r)),e.includes=(...r)=>e.check(JW(...r)),e.startsWith=(...r)=>e.check(QW(...r)),e.endsWith=(...r)=>e.check(eK(...r)),e.min=(...r)=>e.check(Yg(...r)),e.max=(...r)=>e.check(Cz(...r)),e.length=(...r)=>e.check(Rz(...r)),e.nonempty=(...r)=>e.check(Yg(1,...r)),e.lowercase=r=>e.check(qW(r)),e.uppercase=r=>e.check(XW(r)),e.trim=()=>e.check(nK()),e.normalize=(...r)=>e.check(tK(...r)),e.toLowerCase=()=>e.check(rK()),e.toUpperCase=()=>e.check(aK()),e.slugify=()=>e.check(oK())}),IK=Se("ZodString",(e,t)=>{US.init(e,t),Iz.init(e,t),e.email=n=>e.check(bW(OK,n)),e.url=n=>e.check(kz(Oz,n)),e.jwt=n=>e.check(jW(YK,n)),e.emoji=n=>e.check(xW(LK,n)),e.guid=n=>e.check(yL(xL,n)),e.uuid=n=>e.check(yW(fh,n)),e.uuidv4=n=>e.check(vW(fh,n)),e.uuidv6=n=>e.check(wW(fh,n)),e.uuidv7=n=>e.check(EW(fh,n)),e.nanoid=n=>e.check(SW(MK,n)),e.guid=n=>e.check(yL(xL,n)),e.cuid=n=>e.check(_W(jK,n)),e.cuid2=n=>e.check(TW(PK,n)),e.ulid=n=>e.check(NW(UK,n)),e.base64=n=>e.check(DW(GK,n)),e.base64url=n=>e.check(LW(WK,n)),e.xid=n=>e.check(kW($K,n)),e.ksuid=n=>e.check(CW(zK,n)),e.ipv4=n=>e.check(RW(FK,n)),e.ipv6=n=>e.check(AW(BK,n)),e.cidrv4=n=>e.check(IW(HK,n)),e.cidrv6=n=>e.check(OW(VK,n)),e.e164=n=>e.check(MW(KK,n)),e.datetime=n=>e.check(Az(n)),e.date=n=>e.check(pK(n)),e.time=n=>e.check(hK(n)),e.duration=n=>e.check(bK(n))});function de(e){return gW(IK,e)}const Wn=Se("ZodStringFormat",(e,t)=>{zn.init(e,t),Iz.init(e,t)}),OK=Se("ZodEmail",(e,t)=>{E7.init(e,t),Wn.init(e,t)}),xL=Se("ZodGUID",(e,t)=>{v7.init(e,t),Wn.init(e,t)}),fh=Se("ZodUUID",(e,t)=>{w7.init(e,t),Wn.init(e,t)}),Oz=Se("ZodURL",(e,t)=>{x7.init(e,t),Wn.init(e,t)});function DK(e){return kz(Oz,e)}const LK=Se("ZodEmoji",(e,t)=>{S7.init(e,t),Wn.init(e,t)}),MK=Se("ZodNanoID",(e,t)=>{_7.init(e,t),Wn.init(e,t)}),jK=Se("ZodCUID",(e,t)=>{T7.init(e,t),Wn.init(e,t)}),PK=Se("ZodCUID2",(e,t)=>{N7.init(e,t),Wn.init(e,t)}),UK=Se("ZodULID",(e,t)=>{k7.init(e,t),Wn.init(e,t)}),$K=Se("ZodXID",(e,t)=>{C7.init(e,t),Wn.init(e,t)}),zK=Se("ZodKSUID",(e,t)=>{R7.init(e,t),Wn.init(e,t)}),FK=Se("ZodIPv4",(e,t)=>{L7.init(e,t),Wn.init(e,t)}),BK=Se("ZodIPv6",(e,t)=>{M7.init(e,t),Wn.init(e,t)}),HK=Se("ZodCIDRv4",(e,t)=>{j7.init(e,t),Wn.init(e,t)}),VK=Se("ZodCIDRv6",(e,t)=>{P7.init(e,t),Wn.init(e,t)}),GK=Se("ZodBase64",(e,t)=>{U7.init(e,t),Wn.init(e,t)}),WK=Se("ZodBase64URL",(e,t)=>{z7.init(e,t),Wn.init(e,t)}),KK=Se("ZodE164",(e,t)=>{F7.init(e,t),Wn.init(e,t)}),YK=Se("ZodJWT",(e,t)=>{H7.init(e,t),Wn.init(e,t)}),$S=Se("ZodNumber",(e,t)=>{Sz.init(e,t),Fn.init(e,t),e.gt=(r,a)=>e.check(wL(r,a)),e.gte=(r,a)=>e.check(mw(r,a)),e.min=(r,a)=>e.check(mw(r,a)),e.lt=(r,a)=>e.check(vL(r,a)),e.lte=(r,a)=>e.check(pw(r,a)),e.max=(r,a)=>e.check(pw(r,a)),e.int=r=>e.check(SL(r)),e.safe=r=>e.check(SL(r)),e.positive=r=>e.check(wL(0,r)),e.nonnegative=r=>e.check(mw(0,r)),e.negative=r=>e.check(vL(0,r)),e.nonpositive=r=>e.check(pw(0,r)),e.multipleOf=(r,a)=>e.check(EL(r,a)),e.step=(r,a)=>e.check(EL(r,a)),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 vn(e){return FW($S,e)}const ZK=Se("ZodNumberFormat",(e,t)=>{V7.init(e,t),$S.init(e,t)});function SL(e){return HW(ZK,e)}const qK=Se("ZodBoolean",(e,t)=>{G7.init(e,t),Fn.init(e,t)});function Dn(e){return VW(qK,e)}const XK=Se("ZodNull",(e,t)=>{W7.init(e,t),Fn.init(e,t)});function Dz(e){return GW(XK,e)}const JK=Se("ZodAny",(e,t)=>{K7.init(e,t),Fn.init(e,t)});function QK(){return WW(JK)}const eY=Se("ZodUnknown",(e,t)=>{Y7.init(e,t),Fn.init(e,t)});function gr(){return KW(eY)}const tY=Se("ZodNever",(e,t)=>{Z7.init(e,t),Fn.init(e,t)});function nY(e){return YW(tY,e)}const rY=Se("ZodArray",(e,t)=>{q7.init(e,t),Fn.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Yg(n,r)),e.nonempty=n=>e.check(Yg(1,n)),e.max=(n,r)=>e.check(Cz(n,r)),e.length=(n,r)=>e.check(Rz(n,r)),e.unwrap=()=>e.element});function Fe(e,t){return sK(rY,e,t)}const Lz=Se("ZodObject",(e,t)=>{J7.init(e,t),Fn.init(e,t),Nn(e,"shape",()=>t.shape),e.keyof=()=>ao(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:gr()}),e.loose=()=>e.clone({...e._zod.def,catchall:gr()}),e.strict=()=>e.clone({...e._zod.def,catchall:nY()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>hG(e,n),e.safeExtend=n=>gG(e,n),e.merge=n=>bG(e,n),e.pick=n=>pG(e,n),e.omit=n=>mG(e,n),e.partial=(...n)=>yG(Uz,e,n[0]),e.required=(...n)=>vG($z,e,n[0])});function Pe(e,t){const n={type:"object",shape:e??{},...Qe(t)};return new Lz(n)}function Ea(e,t){return new Lz({type:"object",shape:e,catchall:gr(),...Qe(t)})}const Mz=Se("ZodUnion",(e,t)=>{Nz.init(e,t),Fn.init(e,t),e.options=t.options});function Bn(e,t){return new Mz({type:"union",options:e,...Qe(t)})}const aY=Se("ZodDiscriminatedUnion",(e,t)=>{Mz.init(e,t),Q7.init(e,t)});function jz(e,t,n){return new aY({type:"union",options:t,discriminator:e,...Qe(n)})}const oY=Se("ZodIntersection",(e,t)=>{eW.init(e,t),Fn.init(e,t)});function zS(e,t){return new oY({type:"intersection",left:e,right:t})}const sY=Se("ZodRecord",(e,t)=>{tW.init(e,t),Fn.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function br(e,t,n){return new sY({type:"record",keyType:e,valueType:t,...Qe(n)})}const $E=Se("ZodEnum",(e,t)=>{nW.init(e,t),Fn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new $E({...t,checks:[],...Qe(a),entries:s})},e.exclude=(r,a)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new $E({...t,checks:[],...Qe(a),entries:s})}});function ao(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new $E({type:"enum",entries:n,...Qe(t)})}const iY=Se("ZodLiteral",(e,t)=>{rW.init(e,t),Fn.init(e,t),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 et(e,t){return new iY({type:"literal",values:Array.isArray(e)?e:[e],...Qe(t)})}const lY=Se("ZodTransform",(e,t)=>{aW.init(e,t),Fn.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new uz(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Vf(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Vf(i))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(s=>(n.value=s,n)):(n.value=a,n)}});function Pz(e){return new lY({type:"transform",transform:e})}const Uz=Se("ZodOptional",(e,t)=>{oW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tt(e){return new Uz({type:"optional",innerType:e})}const cY=Se("ZodNullable",(e,t)=>{sW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _L(e){return new cY({type:"nullable",innerType:e})}const uY=Se("ZodDefault",(e,t)=>{iW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dY(e,t){return new uY({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():fz(t)}})}const fY=Se("ZodPrefault",(e,t)=>{lW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pY(e,t){return new fY({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():fz(t)}})}const $z=Se("ZodNonOptional",(e,t)=>{cW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function mY(e,t){return new $z({type:"nonoptional",innerType:e,...Qe(t)})}const hY=Se("ZodCatch",(e,t)=>{uW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gY(e,t){return new hY({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const bY=Se("ZodPipe",(e,t)=>{dW.init(e,t),Fn.init(e,t),e.in=t.in,e.out=t.out});function zE(e,t){return new bY({type:"pipe",in:e,out:t})}const yY=Se("ZodReadonly",(e,t)=>{fW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function vY(e){return new yY({type:"readonly",innerType:e})}const zz=Se("ZodCustom",(e,t)=>{pW.init(e,t),Fn.init(e,t)});function wY(e,t){return iK(zz,e??(()=>!0),t)}function EY(e,t={}){return lK(zz,e,t)}function xY(e){return cK(e)}function Fz(e,t){return zE(Pz(e),t)}const SY={custom:"custom"};function _Y(e){return BW($S,e)}const Jb="2025-11-25",TY=[Jb,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ys="io.modelcontextprotocol/related-task",Qb="2.0",Po=wY(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Bz=Bn([de(),vn().int()]),Hz=de(),NY=Ea({ttl:Bn([vn(),Dz()]).optional(),pollInterval:vn().optional()}),FS=Ea({taskId:de()}),kY=Ea({progressToken:Bz.optional(),[ys]:FS.optional()}),Sa=Ea({task:NY.optional(),_meta:kY.optional()}),Fr=Pe({method:de(),params:Sa.optional()}),Ul=Ea({_meta:Pe({[ys]:tt(FS)}).passthrough().optional()}),oo=Pe({method:de(),params:Ul.optional()}),qr=Ea({_meta:Ea({[ys]:FS.optional()}).optional()}),ey=Bn([de(),vn().int()]),Vz=Pe({jsonrpc:et(Qb),id:ey,...Fr.shape}).strict(),FE=e=>Vz.safeParse(e).success,Gz=Pe({jsonrpc:et(Qb),...oo.shape}).strict(),CY=e=>Gz.safeParse(e).success,Wz=Pe({jsonrpc:et(Qb),id:ey,result:qr}).strict(),ff=e=>Wz.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 Kz=Pe({jsonrpc:et(Qb),id:ey,error:Pe({code:vn().int(),message:de(),data:tt(gr())})}).strict(),RY=e=>Kz.safeParse(e).success,Sg=Bn([Vz,Gz,Wz,Kz]),Kc=qr.strict(),AY=Ul.extend({requestId:ey,reason:de().optional()}),BS=oo.extend({method:et("notifications/cancelled"),params:AY}),IY=Pe({src:de(),mimeType:de().optional(),sizes:Fe(de()).optional()}),yp=Pe({icons:Fe(IY).optional()}),Cu=Pe({name:de(),title:de().optional()}),Yz=Cu.extend({...Cu.shape,...yp.shape,version:de(),websiteUrl:de().optional()}),OY=zS(Pe({applyDefaults:Dn().optional()}),br(de(),gr())),DY=Fz(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,zS(Pe({form:OY.optional(),url:Po.optional()}),br(de(),gr()).optional())),LY=Pe({list:tt(Pe({}).passthrough()),cancel:tt(Pe({}).passthrough()),requests:tt(Pe({sampling:tt(Pe({createMessage:tt(Pe({}).passthrough())}).passthrough()),elicitation:tt(Pe({create:tt(Pe({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),MY=Pe({list:tt(Pe({}).passthrough()),cancel:tt(Pe({}).passthrough()),requests:tt(Pe({tools:tt(Pe({call:tt(Pe({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),jY=Pe({experimental:br(de(),Po).optional(),sampling:Pe({context:Po.optional(),tools:Po.optional()}).optional(),elicitation:DY.optional(),roots:Pe({listChanged:Dn().optional()}).optional(),tasks:tt(LY)}),PY=Sa.extend({protocolVersion:de(),capabilities:jY,clientInfo:Yz}),UY=Fr.extend({method:et("initialize"),params:PY}),$Y=Pe({experimental:br(de(),Po).optional(),logging:Po.optional(),completions:Po.optional(),prompts:tt(Pe({listChanged:tt(Dn())})),resources:Pe({subscribe:Dn().optional(),listChanged:Dn().optional()}).optional(),tools:Pe({listChanged:Dn().optional()}).optional(),tasks:tt(MY)}).passthrough(),Zz=qr.extend({protocolVersion:de(),capabilities:$Y,serverInfo:Yz,instructions:de().optional()}),qz=oo.extend({method:et("notifications/initialized")}),zY=e=>qz.safeParse(e).success,HS=Fr.extend({method:et("ping")}),FY=Pe({progress:vn(),total:tt(vn()),message:tt(de())}),BY=Pe({...Ul.shape,...FY.shape,progressToken:Bz}),VS=oo.extend({method:et("notifications/progress"),params:BY}),HY=Sa.extend({cursor:Hz.optional()}),vp=Fr.extend({params:HY.optional()}),wp=qr.extend({nextCursor:tt(Hz)}),Ep=Pe({taskId:de(),status:ao(["working","input_required","completed","failed","cancelled"]),ttl:Bn([vn(),Dz()]),createdAt:de(),lastUpdatedAt:de(),pollInterval:tt(vn()),statusMessage:tt(de())}),Gf=qr.extend({task:Ep}),VY=Ul.merge(Ep),Zg=oo.extend({method:et("notifications/tasks/status"),params:VY}),GS=Fr.extend({method:et("tasks/get"),params:Sa.extend({taskId:de()})}),WS=qr.merge(Ep),KS=Fr.extend({method:et("tasks/result"),params:Sa.extend({taskId:de()})}),YS=vp.extend({method:et("tasks/list")}),ZS=wp.extend({tasks:Fe(Ep)}),GY=Fr.extend({method:et("tasks/cancel"),params:Sa.extend({taskId:de()})}),WY=qr.merge(Ep),Xz=Pe({uri:de(),mimeType:tt(de()),_meta:br(de(),gr()).optional()}),Jz=Xz.extend({text:de()}),qS=de().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Qz=Xz.extend({blob:qS}),xp=ao(["user","assistant"]),Bu=Pe({audience:Fe(xp).optional(),priority:vn().min(0).max(1).optional(),lastModified:Az({offset:!0}).optional()}),e2=Pe({...Cu.shape,...yp.shape,uri:de(),description:tt(de()),mimeType:tt(de()),annotations:Bu.optional(),_meta:tt(Ea({}))}),KY=Pe({...Cu.shape,...yp.shape,uriTemplate:de(),description:tt(de()),mimeType:tt(de()),annotations:Bu.optional(),_meta:tt(Ea({}))}),YY=vp.extend({method:et("resources/list")}),t2=wp.extend({resources:Fe(e2)}),ZY=vp.extend({method:et("resources/templates/list")}),n2=wp.extend({resourceTemplates:Fe(KY)}),XS=Sa.extend({uri:de()}),qY=XS,XY=Fr.extend({method:et("resources/read"),params:qY}),r2=qr.extend({contents:Fe(Bn([Jz,Qz]))}),a2=oo.extend({method:et("notifications/resources/list_changed")}),JY=XS,QY=Fr.extend({method:et("resources/subscribe"),params:JY}),eZ=XS,tZ=Fr.extend({method:et("resources/unsubscribe"),params:eZ}),nZ=Ul.extend({uri:de()}),rZ=oo.extend({method:et("notifications/resources/updated"),params:nZ}),aZ=Pe({name:de(),description:tt(de()),required:tt(Dn())}),oZ=Pe({...Cu.shape,...yp.shape,description:tt(de()),arguments:tt(Fe(aZ)),_meta:tt(Ea({}))}),sZ=vp.extend({method:et("prompts/list")}),o2=wp.extend({prompts:Fe(oZ)}),iZ=Sa.extend({name:de(),arguments:br(de(),de()).optional()}),lZ=Fr.extend({method:et("prompts/get"),params:iZ}),JS=Pe({type:et("text"),text:de(),annotations:Bu.optional(),_meta:br(de(),gr()).optional()}),QS=Pe({type:et("image"),data:qS,mimeType:de(),annotations:Bu.optional(),_meta:br(de(),gr()).optional()}),e_=Pe({type:et("audio"),data:qS,mimeType:de(),annotations:Bu.optional(),_meta:br(de(),gr()).optional()}),cZ=Pe({type:et("tool_use"),name:de(),id:de(),input:Pe({}).passthrough(),_meta:tt(Pe({}).passthrough())}).passthrough(),uZ=Pe({type:et("resource"),resource:Bn([Jz,Qz]),annotations:Bu.optional(),_meta:br(de(),gr()).optional()}),dZ=e2.extend({type:et("resource_link")}),t_=Bn([JS,QS,e_,dZ,uZ]),fZ=Pe({role:xp,content:t_}),s2=qr.extend({description:tt(de()),messages:Fe(fZ)}),i2=oo.extend({method:et("notifications/prompts/list_changed")}),pZ=Pe({title:de().optional(),readOnlyHint:Dn().optional(),destructiveHint:Dn().optional(),idempotentHint:Dn().optional(),openWorldHint:Dn().optional()}),mZ=Pe({taskSupport:ao(["required","optional","forbidden"]).optional()}),l2=Pe({...Cu.shape,...yp.shape,description:de().optional(),inputSchema:Pe({type:et("object"),properties:br(de(),Po).optional(),required:Fe(de()).optional()}).catchall(gr()),outputSchema:Pe({type:et("object"),properties:br(de(),Po).optional(),required:Fe(de()).optional()}).catchall(gr()).optional(),annotations:tt(pZ),execution:tt(mZ),_meta:br(de(),gr()).optional()}),hZ=vp.extend({method:et("tools/list")}),c2=wp.extend({tools:Fe(l2)}),ty=qr.extend({content:Fe(t_).default([]),structuredContent:br(de(),gr()).optional(),isError:tt(Dn())});ty.or(qr.extend({toolResult:gr()}));const gZ=Sa.extend({name:de(),arguments:tt(br(de(),gr()))}),bZ=Fr.extend({method:et("tools/call"),params:gZ}),u2=oo.extend({method:et("notifications/tools/list_changed")}),yZ=Pe({autoRefresh:Dn().default(!0),debounceMs:vn().int().nonnegative().default(300)}),d2=ao(["debug","info","notice","warning","error","critical","alert","emergency"]),vZ=Sa.extend({level:d2}),wZ=Fr.extend({method:et("logging/setLevel"),params:vZ}),EZ=Ul.extend({level:d2,logger:de().optional(),data:gr()}),xZ=oo.extend({method:et("notifications/message"),params:EZ}),SZ=Pe({name:de().optional()}),_Z=Pe({hints:tt(Fe(SZ)),costPriority:tt(vn().min(0).max(1)),speedPriority:tt(vn().min(0).max(1)),intelligencePriority:tt(vn().min(0).max(1))}),TZ=Pe({mode:tt(ao(["auto","required","none"]))}),NZ=Pe({type:et("tool_result"),toolUseId:de().describe("The unique identifier for the corresponding tool call."),content:Fe(t_).default([]),structuredContent:Pe({}).passthrough().optional(),isError:tt(Dn()),_meta:tt(Pe({}).passthrough())}).passthrough(),kZ=jz("type",[JS,QS,e_]),qg=jz("type",[JS,QS,e_,cZ,NZ]),CZ=Pe({role:xp,content:Bn([qg,Fe(qg)]),_meta:tt(Pe({}).passthrough())}).passthrough(),RZ=Sa.extend({messages:Fe(CZ),modelPreferences:_Z.optional(),systemPrompt:de().optional(),includeContext:ao(["none","thisServer","allServers"]).optional(),temperature:vn().optional(),maxTokens:vn().int(),stopSequences:Fe(de()).optional(),metadata:Po.optional(),tools:tt(Fe(l2)),toolChoice:tt(TZ)}),n_=Fr.extend({method:et("sampling/createMessage"),params:RZ}),r_=qr.extend({model:de(),stopReason:tt(ao(["endTurn","stopSequence","maxTokens"]).or(de())),role:xp,content:kZ}),AZ=qr.extend({model:de(),stopReason:tt(ao(["endTurn","stopSequence","maxTokens","toolUse"]).or(de())),role:xp,content:Bn([qg,Fe(qg)])}),IZ=Pe({type:et("boolean"),title:de().optional(),description:de().optional(),default:Dn().optional()}),OZ=Pe({type:et("string"),title:de().optional(),description:de().optional(),minLength:vn().optional(),maxLength:vn().optional(),format:ao(["email","uri","date","date-time"]).optional(),default:de().optional()}),DZ=Pe({type:ao(["number","integer"]),title:de().optional(),description:de().optional(),minimum:vn().optional(),maximum:vn().optional(),default:vn().optional()}),LZ=Pe({type:et("string"),title:de().optional(),description:de().optional(),enum:Fe(de()),default:de().optional()}),MZ=Pe({type:et("string"),title:de().optional(),description:de().optional(),oneOf:Fe(Pe({const:de(),title:de()})),default:de().optional()}),jZ=Pe({type:et("string"),title:de().optional(),description:de().optional(),enum:Fe(de()),enumNames:Fe(de()).optional(),default:de().optional()}),PZ=Bn([LZ,MZ]),UZ=Pe({type:et("array"),title:de().optional(),description:de().optional(),minItems:vn().optional(),maxItems:vn().optional(),items:Pe({type:et("string"),enum:Fe(de())}),default:Fe(de()).optional()}),$Z=Pe({type:et("array"),title:de().optional(),description:de().optional(),minItems:vn().optional(),maxItems:vn().optional(),items:Pe({anyOf:Fe(Pe({const:de(),title:de()}))}),default:Fe(de()).optional()}),zZ=Bn([UZ,$Z]),FZ=Bn([jZ,PZ,zZ]),BZ=Bn([FZ,IZ,OZ,DZ]),HZ=Sa.extend({mode:et("form").optional(),message:de(),requestedSchema:Pe({type:et("object"),properties:br(de(),BZ),required:Fe(de()).optional()})}),VZ=Sa.extend({mode:et("url"),message:de(),elicitationId:de(),url:de().url()}),GZ=Bn([HZ,VZ]),a_=Fr.extend({method:et("elicitation/create"),params:GZ}),WZ=Ul.extend({elicitationId:de()}),KZ=oo.extend({method:et("notifications/elicitation/complete"),params:WZ}),f2=qr.extend({action:ao(["accept","decline","cancel"]),content:Fz(e=>e===null?void 0:e,br(de(),Bn([de(),vn(),Dn(),Fe(de())])).optional())}),YZ=Pe({type:et("ref/resource"),uri:de()}),ZZ=Pe({type:et("ref/prompt"),name:de()}),qZ=Sa.extend({ref:Bn([ZZ,YZ]),argument:Pe({name:de(),value:de()}),context:Pe({arguments:br(de(),de()).optional()}).optional()}),XZ=Fr.extend({method:et("completion/complete"),params:qZ}),p2=qr.extend({completion:Ea({values:Fe(de()).max(100),total:tt(vn().int()),hasMore:tt(Dn())})}),JZ=Pe({uri:de().startsWith("file://"),name:de().optional(),_meta:br(de(),gr()).optional()}),m2=Fr.extend({method:et("roots/list")}),QZ=qr.extend({roots:Fe(JZ)}),eq=oo.extend({method:et("notifications/roots/list_changed")});Bn([HS,UY,XZ,wZ,lZ,sZ,YY,ZY,XY,QY,tZ,bZ,hZ,GS,KS,YS]);Bn([BS,VS,qz,eq,Zg]);Bn([Kc,r_,AZ,f2,QZ,WS,ZS,Gf]);Bn([HS,n_,a_,m2,GS,KS,YS]);Bn([BS,VS,xZ,rZ,a2,u2,i2,Zg,KZ]);Bn([Kc,Zz,p2,s2,o2,t2,n2,r2,ty,c2,WS,ZS,Gf]);class ut extends Error{constructor(t,n,r){super(`MCP error ${t}: ${n}`),this.code=t,this.data=r,this.name="McpError"}static fromError(t,n,r){if(t===wt.UrlElicitationRequired&&r){const a=r;if(a.elicitations)return new tq(a.elicitations,n)}return new ut(t,n,r)}}class tq extends ut{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 gu,h2=(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])}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(r){Re.error("Error in notification handler:",r)}})}async refreshToolsCache(){if(this.client)try{Re.debug("[Auto] Refreshing tools cache due to list_changed notification");const t=await this.client.listTools();this.toolsCache=t.tools??[],Re.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(t){Re.warn("[Auto] Failed to refresh tools cache:",t)}}async onResourcesListChanged(){Re.debug("[Auto] Resources list changed - clients should re-fetch if needed")}async onPromptsListChanged(){Re.debug("[Auto] Prompts list changed - clients should re-fetch if needed")}async setRoots(t){this.rootsCache=[...t],this.client&&(Re.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(m2,async(t,n)=>(Re.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){Re.debug("setupSamplingHandler: No client available");return}if(!this.opts.samplingCallback){Re.debug("setupSamplingHandler: No sampling callback provided");return}Re.debug("setupSamplingHandler: Setting up sampling request handler"),this.client.setRequestHandler(n_,async(t,n)=>(Re.debug("Server requested sampling, forwarding to callback"),await this.opts.samplingCallback(t.params))),Re.debug("setupSamplingHandler: Sampling handler registered successfully")}setupElicitationHandler(){if(!this.client){Re.debug("setupElicitationHandler: No client available");return}if(!this.opts.elicitationCallback){Re.debug("setupElicitationHandler: No elicitation callback provided");return}Re.debug("setupElicitationHandler: Setting up elicitation request handler"),this.client.setRequestHandler(a_,async(t,n)=>(Re.debug("Server requested elicitation, forwarding to callback"),await this.opts.elicitationCallback(t.params))),Re.debug("setupElicitationHandler: Elicitation handler registered successfully")}async disconnect(){if(!this.connected){Re.debug("Not connected to MCP implementation");return}Re.debug("Disconnecting from MCP implementation"),await this.cleanupResources(),this.connected=!1,Re.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");Re.debug("Caching server capabilities & tools");const n=this.client.getServerCapabilities();this.capabilitiesCache=n||null;const r=this.client.getServerVersion();this.serverInfoCache=r||null;const a=await this.client.listTools(void 0,t);return this.toolsCache=a.tools??[],Re.debug(`Fetched ${this.toolsCache.length} tools from server`),Re.debug("Server capabilities:",n),Re.debug("Server info:",r),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,r){if(!this.client)throw new Error("MCP client is not connected");const a=r?{...r}:void 0;a?.resetTimeoutOnProgress&&!a.onprogress&&(a.onprogress=()=>{},Re.debug(`[BaseConnector] Added onprogress callback for tool '${t}' to enable progressToken`)),Re.debug(`Calling tool '${t}' with args`,n);const s=await this.client.callTool({name:t,arguments:n},void 0,a);return Re.debug(`Tool '${t}' returned`,s),s}async listResources(t,n){if(!this.client)throw new Error("MCP client is not connected");return Re.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 Re.debug("Server does not advertise resources capability, skipping"),{resources:[]};try{Re.debug("Listing all resources (with auto-pagination)");const n=[];let r;do{const a=await this.client.listResources({cursor:r},t);n.push(...a.resources||[]),r=a.nextCursor}while(r);return{resources:n}}catch(n){if(n.code===-32601)return Re.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 Re.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 Re.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 Re.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 Re.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 Re.debug("Server does not advertise prompts capability, skipping"),{prompts:[]};try{return Re.debug("Listing prompts"),await this.client.listPrompts()}catch(t){if(t.code===-32601)return Re.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 Re.debug(`Getting prompt ${t}`),await this.client.getPrompt({name:t,arguments:n})}async request(t,n=null,r){if(!this.client)throw new Error("MCP client is not connected");return Re.debug(`Sending raw request '${t}' with params`,n),await this.client.request({method:t,params:n??{}},void 0,r)}async cleanupResources(){const t=[];if(this.client)try{typeof this.client.close=="function"&&await this.client.close()}catch(n){const r=`Error closing client: ${n}`;Re.warn(r),t.push(r)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(n){const r=`Error stopping connection manager: ${n}`;Re.warn(r),t.push(r)}finally{this.connectionManager=null}this.toolsCache=null,t.length&&Re.warn(`Resource cleanup finished with ${t.length} issue(s)`)}},Ge(gu,"BaseConnector"),gu);function ny(e){return!!e._zod}function bi(e,t){return ny(e)?hz(e,t):e.safeParse(t)}function g2(e){var t,n;if(!e)return;let r;if(ny(e)?r=(n=(t=e._zod)===null||t===void 0?void 0:t.def)===null||n===void 0?void 0:n.shape:r=e.shape,!!r){if(typeof r=="function")try{return r()}catch{return}return r}}function nq(e){var t;if(ny(e)){const i=(t=e._zod)===null||t===void 0?void 0:t.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}const r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const a=e.value;if(a!==void 0)return a}function ol(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function TL(e){const t=g2(e),n=t?.method;if(!n)throw new Error("Schema is missing a method literal");const r=nq(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function NL(e,t){const n=bi(e,t);if(!n.success)throw n.error;return n.data}const rq=6e4;class aq{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(BS,n=>{this._oncancel(n)}),this.setNotificationHandler(VS,n=>{this._onprogress(n)}),this.setRequestHandler(HS,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(GS,async(n,r)=>{const a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new ut(wt.InvalidParams,"Failed to retrieve task: Task not found");return{...a}}),this.setRequestHandler(KS,async(n,r)=>{const a=async()=>{var s;const i=n.params.taskId;if(this._taskMessageQueue){let u;for(;u=await this._taskMessageQueue.dequeue(i,r.sessionId);){if(u.type==="response"||u.type==="error"){const f=u.message,m=f.id,h=this._requestResolvers.get(m);if(h)if(this._requestResolvers.delete(m),u.type==="response")h(f);else{const b=f,y=new ut(b.error.code,b.error.message,b.error.data);h(y)}else{const b=u.type==="response"?"Response":"Error";this._onerror(new Error(`${b} handler missing for request ${m}`))}continue}await((s=this._transport)===null||s===void 0?void 0:s.send(u.message,{relatedRequestId:r.requestId}))}}const c=await this._taskStore.getTask(i,r.sessionId);if(!c)throw new ut(wt.InvalidParams,`Task not found: ${i}`);if(!ol(c.status))return await this._waitForTaskUpdate(i,r.signal),await a();if(ol(c.status)){const u=await this._taskStore.getTaskResult(i,r.sessionId);return this._clearTaskQueue(i),{...u,_meta:{...u._meta,[ys]:{taskId:i}}}}return await a()};return await a()}),this.setRequestHandler(YS,async(n,r)=>{var a;try{const{tasks:s,nextCursor:i}=await this._taskStore.listTasks((a=n.params)===null||a===void 0?void 0:a.cursor,r.sessionId);return{tasks:s,nextCursor:i,_meta:{}}}catch(s){throw new ut(wt.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(GY,async(n,r)=>{try{const a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new ut(wt.InvalidParams,`Task not found: ${n.params.taskId}`);if(ol(a.status))throw new ut(wt.InvalidParams,`Cannot cancel task in terminal status: ${a.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);const s=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!s)throw new ut(wt.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...s}}catch(a){throw a instanceof ut?a:new ut(wt.InvalidRequest,`Failed to cancel task: ${a instanceof Error?a.message:String(a)}`)}}))}async _oncancel(t){const n=this._requestHandlerAbortControllers.get(t.params.requestId);n?.abort(t.params.reason)}_setupTimeout(t,n,r,a,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(a,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),ut.fromError(wt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});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,r,a;this._transport=t;const s=(n=this.transport)===null||n===void 0?void 0:n.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};const i=(r=this.transport)===null||r===void 0?void 0:r.onerror;this._transport.onerror=u=>{i?.(u),this._onerror(u)};const c=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(u,f)=>{c?.(u,f),ff(u)||RY(u)?this._onresponse(u):FE(u)?this._onrequest(u,f):CY(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 r=ut.fromError(wt.ConnectionClosed,"Connection closed");this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);for(const a of n.values())a(r)}_onerror(t){var n;(n=this.onerror)===null||n===void 0||n.call(this,t)}_onnotification(t){var n;const r=(n=this._notificationHandlers.get(t.method))!==null&&n!==void 0?n:this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(t,n){var r,a,s,i,c,u;const f=(r=this._requestHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackRequestHandler,m=this._transport,h=(i=(s=(a=t.params)===null||a===void 0?void 0:a._meta)===null||s===void 0?void 0:s[ys])===null||i===void 0?void 0:i.taskId;if(f===void 0){const w={jsonrpc:"2.0",id:t.id,error:{code:wt.MethodNotFound,message:"Method not found"}};h&&this._taskMessageQueue?this._enqueueTaskMessage(h,{type:"error",message:w,timestamp:Date.now()},m?.sessionId).catch(_=>this._onerror(new Error(`Failed to enqueue error response: ${_}`))):m?.send(w).catch(_=>this._onerror(new Error(`Failed to send an error response: ${_}`)));return}const b=new AbortController;this._requestHandlerAbortControllers.set(t.id,b);const y=(c=t.params)===null||c===void 0?void 0:c.task,x=this._taskStore?this.requestTaskStore(t,m?.sessionId):void 0,E={signal:b.signal,sessionId:m?.sessionId,_meta:(u=t.params)===null||u===void 0?void 0:u._meta,sendNotification:async w=>{const _={relatedRequestId:t.id};h&&(_.relatedTask={taskId:h}),await this.notification(w,_)},sendRequest:async(w,_,S)=>{var T,R;const C={...S,relatedRequestId:t.id};h&&!C.relatedTask&&(C.relatedTask={taskId:h});const I=(R=(T=C.relatedTask)===null||T===void 0?void 0:T.taskId)!==null&&R!==void 0?R:h;return I&&x&&await x.updateTaskStatus(I,"input_required"),await this.request(w,_,C)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:h,taskStore:x,taskRequestedTtl:y?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{y&&this.assertTaskHandlerCapability(t.method)}).then(()=>f(t,E)).then(async w=>{if(b.signal.aborted)return;const _={result:w,jsonrpc:"2.0",id:t.id};h&&this._taskMessageQueue?await this._enqueueTaskMessage(h,{type:"response",message:_,timestamp:Date.now()},m?.sessionId):await m?.send(_)},async w=>{var _;if(b.signal.aborted)return;const S={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(w.code)?w.code:wt.InternalError,message:(_=w.message)!==null&&_!==void 0?_:"Internal error",...w.data!==void 0&&{data:w.data}}};h&&this._taskMessageQueue?await this._enqueueTaskMessage(h,{type:"error",message:S,timestamp:Date.now()},m?.sessionId):await m?.send(S)}).catch(w=>this._onerror(new Error(`Failed to send response: ${w}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...r}=t.params,a=Number(n),s=this._progressHandlers.get(a);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(a),c=this._timeoutInfo.get(a);if(c&&i&&c.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(u){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),i(u);return}s(r)}_onresponse(t){const n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),ff(t))r(t);else{const i=new ut(t.error.code,t.error.message,t.error.data);r(i)}return}const a=this._responseHandlers.get(n);if(a===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 s=!1;if(ff(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const c=i.task;typeof c.taskId=="string"&&(s=!0,this._taskProgressTokens.set(c.taskId,n))}}if(s||this._progressHandlers.delete(n),ff(t))a(t);else{const i=ut.fromError(t.error.code,t.error.message,t.error.data);a(i)}}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,r){var a,s,i,c;const{task:u}=r??{};if(!u){try{yield{type:"result",result:await this.request(t,n,r)}}catch(m){yield{type:"error",error:m instanceof ut?m:new ut(wt.InternalError,String(m))}}return}let f;try{const m=await this.request(t,Gf,r);if(m.task)f=m.task.taskId,yield{type:"taskCreated",task:m.task};else throw new ut(wt.InternalError,"Task creation did not return a task");for(;;){const h=await this.getTask({taskId:f},r);if(yield{type:"taskStatus",task:h},ol(h.status)){h.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:f},n,r)}:h.status==="failed"?yield{type:"error",error:new ut(wt.InternalError,`Task ${f} failed`)}:h.status==="cancelled"&&(yield{type:"error",error:new ut(wt.InternalError,`Task ${f} was cancelled`)});return}if(h.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:f},n,r)};return}const b=(i=(a=h.pollInterval)!==null&&a!==void 0?a:(s=this._options)===null||s===void 0?void 0:s.defaultTaskPollInterval)!==null&&i!==void 0?i:1e3;await new Promise(y=>setTimeout(y,b)),(c=r?.signal)===null||c===void 0||c.throwIfAborted()}}catch(m){yield{type:"error",error:m instanceof ut?m:new ut(wt.InternalError,String(m))}}}request(t,n,r){const{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i,task:c,relatedTask:u}=r??{};return new Promise((f,m)=>{var h,b,y,x,E,w,_;const S=j=>{m(j)};if(!this._transport){S(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(j){S(j);return}(b=r?.signal)===null||b===void 0||b.throwIfAborted();const T=this._requestMessageId++,R={...t,jsonrpc:"2.0",id:T};r?.onprogress&&(this._progressHandlers.set(T,r.onprogress),R.params={...t.params,_meta:{...((y=t.params)===null||y===void 0?void 0:y._meta)||{},progressToken:T}}),c&&(R.params={...R.params,task:c}),u&&(R.params={...R.params,_meta:{...((x=R.params)===null||x===void 0?void 0:x._meta)||{},[ys]:u}});const C=j=>{var U;this._responseHandlers.delete(T),this._progressHandlers.delete(T),this._cleanupTimeout(T),(U=this._transport)===null||U===void 0||U.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:T,reason:String(j)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(W=>this._onerror(new Error(`Failed to send cancellation: ${W}`)));const B=j instanceof ut?j:new ut(wt.RequestTimeout,String(j));m(B)};this._responseHandlers.set(T,j=>{var U;if(!(!((U=r?.signal)===null||U===void 0)&&U.aborted)){if(j instanceof Error)return m(j);try{const B=bi(n,j.result);B.success?f(B.data):m(B.error)}catch(B){m(B)}}}),(E=r?.signal)===null||E===void 0||E.addEventListener("abort",()=>{var j;C((j=r?.signal)===null||j===void 0?void 0:j.reason)});const I=(w=r?.timeout)!==null&&w!==void 0?w:rq,A=()=>C(ut.fromError(wt.RequestTimeout,"Request timed out",{timeout:I}));this._setupTimeout(T,I,r?.maxTotalTimeout,A,(_=r?.resetTimeoutOnProgress)!==null&&_!==void 0?_:!1);const O=u?.taskId;if(O){const j=U=>{const B=this._responseHandlers.get(T);B?B(U):this._onerror(new Error(`Response handler missing for side-channeled request ${T}`))};this._requestResolvers.set(T,j),this._enqueueTaskMessage(O,{type:"request",message:R,timestamp:Date.now()}).catch(U=>{this._cleanupTimeout(T),m(U)})}else this._transport.send(R,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(j=>{this._cleanupTimeout(T),m(j)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},WS,n)}async getTaskResult(t,n,r){return this.request({method:"tasks/result",params:t},n,r)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},ZS,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},WY,n)}async notification(t,n){var r,a,s,i,c;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const u=(r=n?.relatedTask)===null||r===void 0?void 0:r.taskId;if(u){const b={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((a=t.params)===null||a===void 0?void 0:a._meta)||{},[ys]:n.relatedTask}}};await this._enqueueTaskMessage(u,{type:"notification",message:b,timestamp:Date.now()});return}if(((i=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).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 b,y;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let x={...t,jsonrpc:"2.0"};n?.relatedTask&&(x={...x,params:{...x.params,_meta:{...((b=x.params)===null||b===void 0?void 0:b._meta)||{},[ys]:n.relatedTask}}}),(y=this._transport)===null||y===void 0||y.send(x,n).catch(E=>this._onerror(E))});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)||{},[ys]:n.relatedTask}}}),await this._transport.send(h,n)}setRequestHandler(t,n){const r=TL(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(a,s)=>{const i=NL(t,a);return Promise.resolve(n(i,s))})}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 r=TL(t);this._notificationHandlers.set(r,a=>{const s=NL(t,a);return Promise.resolve(n(s))})}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,r){var a;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const s=(a=this._options)===null||a===void 0?void 0:a.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r,s)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(t,n);for(const a of r)if(a.type==="request"&&FE(a.message)){const s=a.message.id,i=this._requestResolvers.get(s);i?(i(new ut(wt.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var r,a,s;let i=(a=(r=this._options)===null||r===void 0?void 0:r.defaultTaskPollInterval)!==null&&a!==void 0?a:1e3;try{const c=await((s=this._taskStore)===null||s===void 0?void 0:s.getTask(t));c?.pollInterval&&(i=c.pollInterval)}catch{}return new Promise((c,u)=>{if(n.aborted){u(new ut(wt.InvalidRequest,"Request cancelled"));return}const f=setTimeout(c,i);n.addEventListener("abort",()=>{clearTimeout(f),u(new ut(wt.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async a=>{if(!t)throw new Error("No request provided");return await r.createTask(a,t.id,{method:t.method,params:t.params},n)},getTask:async a=>{const s=await r.getTask(a,n);if(!s)throw new ut(wt.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(a,s,i)=>{await r.storeTaskResult(a,s,i,n);const c=await r.getTask(a,n);if(c){const u=Zg.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ol(c.status)&&this._cleanupTaskProgressHandler(a)}},getTaskResult:a=>r.getTaskResult(a,n),updateTaskStatus:async(a,s,i)=>{const c=await r.getTask(a,n);if(!c)throw new ut(wt.InvalidParams,`Task "${a}" not found - it may have been cleaned up`);if(ol(c.status))throw new ut(wt.InvalidParams,`Cannot update task "${a}" from terminal status "${c.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(a,s,i,n);const u=await r.getTask(a,n);if(u){const f=Zg.parse({method:"notifications/tasks/status",params:u});await this.notification(f),ol(u.status)&&this._cleanupTaskProgressHandler(a)}},listTasks:a=>r.listTasks(a,n)}}}function kL(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oq(e,t){const n={...e};for(const r in t){const a=r,s=t[a];if(s===void 0)continue;const i=n[a];kL(i)&&kL(s)?n[a]={...i,...s}:n[a]=s}return n}var ph={exports:{}},hw={},ps={},sl={},gw={},bw={},yw={},CL;function Xg(){return CL||(CL=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(S){if(super(),!e.IDENTIFIER.test(S))throw new Error("CodeGen: name must be a valid identifier");this.str=S}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(S){super(),this._items=typeof S=="string"?[S]:S}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const S=this._items[0];return S===""||S==='""'}get str(){var S;return(S=this._str)!==null&&S!==void 0?S:this._str=this._items.reduce((T,R)=>`${T}${R}`,"")}get names(){var S;return(S=this._names)!==null&&S!==void 0?S:this._names=this._items.reduce((T,R)=>(R instanceof n&&(T[R.str]=(T[R.str]||0)+1),T),{})}}e._Code=r,e.nil=new r("");function a(_,...S){const T=[_[0]];let R=0;for(;R<S.length;)c(T,S[R]),T.push(_[++R]);return new r(T)}e._=a;const s=new r("+");function i(_,...S){const T=[y(_[0])];let R=0;for(;R<S.length;)T.push(s),c(T,S[R]),T.push(s,y(_[++R]));return u(T),new r(T)}e.str=i;function c(_,S){S instanceof r?_.push(...S._items):S instanceof n?_.push(S):_.push(h(S))}e.addCodeArg=c;function u(_){let S=1;for(;S<_.length-1;){if(_[S]===s){const T=f(_[S-1],_[S+1]);if(T!==void 0){_.splice(S-1,3,T);continue}_[S++]="+"}S++}}function f(_,S){if(S==='""')return _;if(_==='""')return S;if(typeof _=="string")return S instanceof n||_[_.length-1]!=='"'?void 0:typeof S!="string"?`${_.slice(0,-1)}${S}"`:S[0]==='"'?_.slice(0,-1)+S.slice(1):void 0;if(typeof S=="string"&&S[0]==='"'&&!(_ instanceof n))return`"${_}${S.slice(1)}`}function m(_,S){return S.emptyStr()?_:_.emptyStr()?S:i`${_}${S}`}e.strConcat=m;function h(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:y(Array.isArray(_)?_.join(","):_)}function b(_){return new r(y(_))}e.stringify=b;function y(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=y;function x(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new r(`.${_}`):a`[${_}]`}e.getProperty=x;function E(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new r(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=E;function w(_){return new r(_.toString())}e.regexpCode=w})(yw)),yw}var vw={},RL;function AL(){return RL||(RL=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Xg();class n extends Error{constructor(f){super(`CodeGen: "code" for ${f} not defined`),this.value=f.value}}var r;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class a{constructor({prefixes:f,parent:m}={}){this._names={},this._prefixes=f,this._parent=m}toName(f){return f instanceof t.Name?f:this.name(f)}name(f){return new t.Name(this._newName(f))}_newName(f){const m=this._names[f]||this._nameGroup(f);return`${f}${m.index++}`}_nameGroup(f){var m,h;if(!((h=(m=this._parent)===null||m===void 0?void 0:m._prefixes)===null||h===void 0)&&h.has(f)||this._prefixes&&!this._prefixes.has(f))throw new Error(`CodeGen: prefix "${f}" is not allowed in this scope`);return this._names[f]={prefix:f,index:0}}}e.Scope=a;class s extends t.Name{constructor(f,m){super(m),this.prefix=f}setValue(f,{property:m,itemIndex:h}){this.value=f,this.scopePath=(0,t._)`.${new t.Name(m)}[${h}]`}}e.ValueScopeName=s;const i=(0,t._)`\n`;class c extends a{constructor(f){super(f),this._values={},this._scope=f.scope,this.opts={...f,_n:f.lines?i:t.nil}}get(){return this._scope}name(f){return new s(f,this._newName(f))}value(f,m){var h;if(m.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const b=this.toName(f),{prefix:y}=b,x=(h=m.key)!==null&&h!==void 0?h:m.ref;let E=this._values[y];if(E){const S=E.get(x);if(S)return S}else E=this._values[y]=new Map;E.set(x,b);const w=this._scope[y]||(this._scope[y]=[]),_=w.length;return w[_]=m.ref,b.setValue(m,{property:y,itemIndex:_}),b}getValue(f,m){const h=this._values[f];if(h)return h.get(m)}scopeRefs(f,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._)`${f}${h.scopePath}`})}scopeCode(f=this._values,m,h){return this._reduceValues(f,b=>{if(b.value===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return b.value.code},m,h)}_reduceValues(f,m,h={},b){let y=t.nil;for(const x in f){const E=f[x];if(!E)continue;const w=h[x]=h[x]||new Map;E.forEach(_=>{if(w.has(_))return;w.set(_,r.Started);let S=m(_);if(S){const T=this.opts.es5?e.varKinds.var:e.varKinds.const;y=(0,t._)`${y}${T} ${_} = ${S};${this.opts._n}`}else if(S=b?.(_))y=(0,t._)`${y}${S}${this.opts._n}`;else throw new n(_);w.set(_,r.Completed)})}return y}}e.ValueScope=c})(vw)),vw}var IL;function Mt(){return IL||(IL=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=Xg(),n=AL();var r=Xg();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var a=AL();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return a.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 s{optimizeNodes(){return this}optimizeNames(L,M){return this}}class i extends s{constructor(L,M,z){super(),this.varKind=L,this.name=M,this.rhs=z}render({es5:L,_n:M}){const z=L?n.varKinds.var:this.varKind,G=this.rhs===void 0?"":` = ${this.rhs}`;return`${z} ${this.name}${G};`+M}optimizeNames(L,M){if(L[this.name.str])return this.rhs&&(this.rhs=ee(this.rhs,L,M)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends s{constructor(L,M,z){super(),this.lhs=L,this.rhs=M,this.sideEffects=z}render({_n:L}){return`${this.lhs} = ${this.rhs};`+L}optimizeNames(L,M){if(!(this.lhs instanceof t.Name&&!L[this.lhs.str]&&!this.sideEffects))return this.rhs=ee(this.rhs,L,M),this}get names(){const L=this.lhs instanceof t.Name?{}:{...this.lhs.names};return J(L,this.rhs)}}class u extends c{constructor(L,M,z,G){super(L,z,G),this.op=M}render({_n:L}){return`${this.lhs} ${this.op}= ${this.rhs};`+L}}class f extends s{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`${this.label}:`+L}}class m extends s{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`break${this.label?` ${this.label}`:""};`+L}}class h extends s{constructor(L){super(),this.error=L}render({_n:L}){return`throw ${this.error};`+L}get names(){return this.error.names}}class b extends s{constructor(L){super(),this.code=L}render({_n:L}){return`${this.code};`+L}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(L,M){return this.code=ee(this.code,L,M),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class y extends s{constructor(L=[]){super(),this.nodes=L}render(L){return this.nodes.reduce((M,z)=>M+z.render(L),"")}optimizeNodes(){const{nodes:L}=this;let M=L.length;for(;M--;){const z=L[M].optimizeNodes();Array.isArray(z)?L.splice(M,1,...z):z?L[M]=z:L.splice(M,1)}return L.length>0?this:void 0}optimizeNames(L,M){const{nodes:z}=this;let G=z.length;for(;G--;){const q=z[G];q.optimizeNames(L,M)||(re(L,q.names),z.splice(G,1))}return z.length>0?this:void 0}get names(){return this.nodes.reduce((L,M)=>W(L,M.names),{})}}class x extends y{render(L){return"{"+L._n+super.render(L)+"}"+L._n}}class E extends y{}class w extends x{}w.kind="else";class _ extends x{constructor(L,M){super(M),this.condition=L}render(L){let M=`if(${this.condition})`+super.render(L);return this.else&&(M+="else "+this.else.render(L)),M}optimizeNodes(){super.optimizeNodes();const L=this.condition;if(L===!0)return this.nodes;let M=this.else;if(M){const z=M.optimizeNodes();M=this.else=Array.isArray(z)?new w(z):z}if(M)return L===!1?M instanceof _?M:M.nodes:this.nodes.length?this:new _(F(L),M instanceof _?[M]:M.nodes);if(!(L===!1||!this.nodes.length))return this}optimizeNames(L,M){var z;if(this.else=(z=this.else)===null||z===void 0?void 0:z.optimizeNames(L,M),!!(super.optimizeNames(L,M)||this.else))return this.condition=ee(this.condition,L,M),this}get names(){const L=super.names;return J(L,this.condition),this.else&&W(L,this.else.names),L}}_.kind="if";class S extends x{}S.kind="for";class T extends S{constructor(L){super(),this.iteration=L}render(L){return`for(${this.iteration})`+super.render(L)}optimizeNames(L,M){if(super.optimizeNames(L,M))return this.iteration=ee(this.iteration,L,M),this}get names(){return W(super.names,this.iteration.names)}}class R extends S{constructor(L,M,z,G){super(),this.varKind=L,this.name=M,this.from=z,this.to=G}render(L){const M=L.es5?n.varKinds.var:this.varKind,{name:z,from:G,to:q}=this;return`for(${M} ${z}=${G}; ${z}<${q}; ${z}++)`+super.render(L)}get names(){const L=J(super.names,this.from);return J(L,this.to)}}class C extends S{constructor(L,M,z,G){super(),this.loop=L,this.varKind=M,this.name=z,this.iterable=G}render(L){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(L)}optimizeNames(L,M){if(super.optimizeNames(L,M))return this.iterable=ee(this.iterable,L,M),this}get names(){return W(super.names,this.iterable.names)}}class I extends x{constructor(L,M,z){super(),this.name=L,this.args=M,this.async=z}render(L){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(L)}}I.kind="func";class A extends y{render(L){return"return "+super.render(L)}}A.kind="return";class O extends x{render(L){let M="try"+super.render(L);return this.catch&&(M+=this.catch.render(L)),this.finally&&(M+=this.finally.render(L)),M}optimizeNodes(){var L,M;return super.optimizeNodes(),(L=this.catch)===null||L===void 0||L.optimizeNodes(),(M=this.finally)===null||M===void 0||M.optimizeNodes(),this}optimizeNames(L,M){var z,G;return super.optimizeNames(L,M),(z=this.catch)===null||z===void 0||z.optimizeNames(L,M),(G=this.finally)===null||G===void 0||G.optimizeNames(L,M),this}get names(){const L=super.names;return this.catch&&W(L,this.catch.names),this.finally&&W(L,this.finally.names),L}}class j extends x{constructor(L){super(),this.error=L}render(L){return`catch(${this.error})`+super.render(L)}}j.kind="catch";class U extends x{render(L){return"finally"+super.render(L)}}U.kind="finally";class B{constructor(L,M={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...M,_n:M.lines?`
22
+ `)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(T,R)=>S(b,T,R)};let s;const i=Hf,c=!jE.jitless,f=c&&oG.value,m=t.catchall;let h;e._zod.parse=(b,y)=>{h??(h=r.value);const x=b.value;return i(x)?c&&f&&y?.async===!1&&y.jitless!==!0?(s||(s=a(t.shape)),b=s(b,y),m?Sz([],x,b,y,h,e):b):n(b,y):(b.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),b)}});function uL(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const a=e.filter(s=>!Gc(s));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>ki(i,r,Ni())))}),t)}const _z=Se("$ZodUnion",(e,t)=>{Mn.init(e,t),Nn(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),Nn(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),Nn(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),Nn(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){const a=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${a.map(s=>jS(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(n)return r(a,s);let i=!1;const c=[];for(const u of t.options){const f=u._zod.run({value:a.value,issues:[]},s);if(f instanceof Promise)c.push(f),i=!0;else{if(f.issues.length===0)return f;c.push(f)}}return i?Promise.all(c).then(u=>uL(u,a,e,s)):uL(c,a,e,s)}}),q7=Se("$ZodDiscriminatedUnion",(e,t)=>{_z.init(e,t);const n=e._zod.parse;Nn(e._zod,"propValues",()=>{const a={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[c,u]of Object.entries(i)){a[c]||(a[c]=new Set);for(const f of u)a[c].add(f)}}return a});const r=Gb(()=>{const a=t.options,s=new Map;for(const i of a){const c=i._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const u of c){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,i)}}return s});e._zod.parse=(a,s)=>{const i=a.value;if(!Hf(i))return a.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),a;const c=r.value.get(i?.[t.discriminator]);return c?c._zod.run(a,s):t.unionFallback?n(a,s):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),a)}}),X7=Se("$ZodIntersection",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>{const a=n.value,s=t.left._zod.run({value:a,issues:[]},r),i=t.right._zod.run({value:a,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([u,f])=>dL(n,u,f)):dL(n,s,i)}});function UE(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(Nu(e)&&Nu(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),a={...e,...t};for(const s of r){const i=UE(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a[s]=i.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const a=e[r],s=t[r],i=UE(a,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function dL(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Gc(e))return e;const r=UE(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const J7=Se("$ZodRecord",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Nu(a))return n.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const c=new Set;for(const f of i)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){c.add(typeof f=="number"?f.toString():f);const m=t.valueType._zod.run({value:a[f],issues:[]},r);m instanceof Promise?s.push(m.then(h=>{h.issues.length&&n.issues.push(...Wc(f,h.issues)),n.value[f]=h.value})):(m.issues.length&&n.issues.push(...Wc(f,m.issues)),n.value[f]=m.value)}let u;for(const f in a)c.has(f)||(u=u??[],u.push(f));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:u})}else{n.value={};for(const c of Reflect.ownKeys(a)){if(c==="__proto__")continue;const u=t.keyType._zod.run({value:c,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>ki(m,r,Ni())),input:c,path:[c],inst:e}),n.value[u.value]=u.value;continue}const f=t.valueType._zod.run({value:a[c],issues:[]},r);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&n.issues.push(...Wc(c,m.issues)),n.value[u.value]=m.value})):(f.issues.length&&n.issues.push(...Wc(c,f.issues)),n.value[u.value]=f.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Q7=Se("$ZodEnum",(e,t)=>{Mn.init(e,t);const n=nG(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(a=>sG.has(typeof a)).map(a=>typeof a=="string"?ku(a):a.toString()).join("|")})$`),e._zod.parse=(a,s)=>{const i=a.value;return r.has(i)||a.issues.push({code:"invalid_value",values:n,input:i,inst:e}),a}}),eW=Se("$ZodLiteral",(e,t)=>{if(Mn.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(r=>typeof r=="string"?ku(r):r?ku(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,a)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),tW=Se("$ZodTransform",(e,t)=>{Mn.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new lz(e.constructor.name);const a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(i=>(n.value=i,n));if(a instanceof Promise)throw new ou;return n.value=a,n}});function fL(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const nW=Se("$ZodOptional",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Nn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Nn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${jS(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>fL(s,n.value)):fL(a,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),rW=Se("$ZodNullable",(e,t)=>{Mn.init(e,t),Nn(e._zod,"optin",()=>t.innerType._zod.optin),Nn(e._zod,"optout",()=>t.innerType._zod.optout),Nn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${jS(n.source)}|null)$`):void 0}),Nn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),aW=Se("$ZodDefault",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",Nn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>pL(s,t)):pL(a,t)}});function pL(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const oW=Se("$ZodPrefault",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",Nn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),sW=Se("$ZodNonOptional",(e,t)=>{Mn.init(e,t),Nn(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>mL(s,e)):mL(a,e)}});function mL(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 iW=Se("$ZodCatch",(e,t)=>{Mn.init(e,t),Nn(e._zod,"optin",()=>t.innerType._zod.optin),Nn(e._zod,"optout",()=>t.innerType._zod.optout),Nn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>ki(i,r,Ni()))},input:n.value}),n.issues=[]),n)):(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(s=>ki(s,r,Ni()))},input:n.value}),n.issues=[]),n)}}),lW=Se("$ZodPipe",(e,t)=>{Mn.init(e,t),Nn(e._zod,"values",()=>t.in._zod.values),Nn(e._zod,"optin",()=>t.in._zod.optin),Nn(e._zod,"optout",()=>t.out._zod.optout),Nn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>uh(i,t.in,r)):uh(s,t.in,r)}const a=t.in._zod.run(n,r);return a instanceof Promise?a.then(s=>uh(s,t.out,r)):uh(a,t.out,r)}});function uh(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const cW=Se("$ZodReadonly",(e,t)=>{Mn.init(e,t),Nn(e._zod,"propValues",()=>t.innerType._zod.propValues),Nn(e._zod,"values",()=>t.innerType._zod.values),Nn(e._zod,"optin",()=>t.innerType?._zod?.optin),Nn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(hL):hL(a)}});function hL(e){return e.value=Object.freeze(e.value),e}const uW=Se("$ZodCustom",(e,t)=>{xa.init(e,t),Mn.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then(s=>gL(s,n,r,e));gL(a,n,r,e)}});function gL(e,t,n,r){if(!e){const a={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(a.params=r._zod.def.params),t.issues.push(Vf(a))}}var bL;class dW{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.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 r={...this.get(n)??{}};delete r.id;const a={...r,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function fW(){return new dW}(bL=globalThis).__zod_globalRegistry??(bL.__zod_globalRegistry=fW());const dh=globalThis.__zod_globalRegistry;function pW(e,t){return new e({type:"string",...Qe(t)})}function mW(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Qe(t)})}function yL(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Qe(t)})}function hW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Qe(t)})}function gW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Qe(t)})}function bW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Qe(t)})}function yW(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Qe(t)})}function Tz(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Qe(t)})}function vW(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Qe(t)})}function wW(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Qe(t)})}function EW(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Qe(t)})}function xW(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Qe(t)})}function SW(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Qe(t)})}function _W(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Qe(t)})}function TW(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Qe(t)})}function NW(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Qe(t)})}function kW(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Qe(t)})}function CW(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Qe(t)})}function RW(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Qe(t)})}function AW(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Qe(t)})}function IW(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Qe(t)})}function OW(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Qe(t)})}function DW(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Qe(t)})}function LW(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Qe(t)})}function MW(e,t){return new e({type:"string",format:"date",check:"string_format",...Qe(t)})}function jW(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Qe(t)})}function PW(e,t){return new e({type:"string",format:"duration",check:"string_format",...Qe(t)})}function UW(e,t){return new e({type:"number",checks:[],...Qe(t)})}function $W(e,t){return new e({type:"number",coerce:!0,checks:[],...Qe(t)})}function zW(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Qe(t)})}function FW(e,t){return new e({type:"boolean",...Qe(t)})}function BW(e,t){return new e({type:"null",...Qe(t)})}function HW(e){return new e({type:"any"})}function VW(e){return new e({type:"unknown"})}function GW(e,t){return new e({type:"never",...Qe(t)})}function vL(e,t){return new yz({check:"less_than",...Qe(t),value:e,inclusive:!1})}function pw(e,t){return new yz({check:"less_than",...Qe(t),value:e,inclusive:!0})}function wL(e,t){return new vz({check:"greater_than",...Qe(t),value:e,inclusive:!1})}function mw(e,t){return new vz({check:"greater_than",...Qe(t),value:e,inclusive:!0})}function EL(e,t){return new n7({check:"multiple_of",...Qe(t),value:e})}function Nz(e,t){return new a7({check:"max_length",...Qe(t),maximum:e})}function Yg(e,t){return new o7({check:"min_length",...Qe(t),minimum:e})}function kz(e,t){return new s7({check:"length_equals",...Qe(t),length:e})}function WW(e,t){return new i7({check:"string_format",format:"regex",...Qe(t),pattern:e})}function KW(e){return new l7({check:"string_format",format:"lowercase",...Qe(e)})}function YW(e){return new c7({check:"string_format",format:"uppercase",...Qe(e)})}function ZW(e,t){return new u7({check:"string_format",format:"includes",...Qe(t),includes:e})}function qW(e,t){return new d7({check:"string_format",format:"starts_with",...Qe(t),prefix:e})}function XW(e,t){return new f7({check:"string_format",format:"ends_with",...Qe(t),suffix:e})}function Fu(e){return new p7({check:"overwrite",tx:e})}function JW(e){return Fu(t=>t.normalize(e))}function QW(){return Fu(e=>e.trim())}function eK(){return Fu(e=>e.toLowerCase())}function tK(){return Fu(e=>e.toUpperCase())}function nK(){return Fu(e=>aG(e))}function rK(e,t,n){return new e({type:"array",element:t,...Qe(n)})}function aK(e,t,n){const r=Qe(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function oK(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Qe(n)})}function sK(e){const t=iK(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Vf(r,n.value,t._zod.def));else{const a=r;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),a.continue??(a.continue=!t._zod.def.abort),n.issues.push(Vf(a))}},e(n.value,n)));return t}function iK(e,t){const n=new xa({check:"custom",...Qe(t)});return n._zod.check=e,n}const lK=Se("ZodISODateTime",(e,t)=>{k7.init(e,t),Wn.init(e,t)});function Cz(e){return LW(lK,e)}const cK=Se("ZodISODate",(e,t)=>{C7.init(e,t),Wn.init(e,t)});function uK(e){return MW(cK,e)}const dK=Se("ZodISOTime",(e,t)=>{R7.init(e,t),Wn.init(e,t)});function fK(e){return jW(dK,e)}const pK=Se("ZodISODuration",(e,t)=>{A7.init(e,t),Wn.init(e,t)});function mK(e){return PW(pK,e)}const hK=(e,t)=>{fz.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>yG(e,n)},flatten:{value:n=>bG(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,PE,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,PE,2)}},isEmpty:{get(){return e.issues.length===0}}})},ro=Se("ZodError",hK,{Parent:Error}),gK=Kb(ro),bK=Yb(ro),yK=Zb(ro),vK=qb(ro),wK=EG(ro),EK=xG(ro),xK=SG(ro),SK=_G(ro),_K=TG(ro),TK=NG(ro),NK=kG(ro),kK=CG(ro),Fn=Se("ZodType",(e,t)=>(Mn.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Pl(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]})),e.clone=(n,r)=>Mi(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>gK(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>yK(e,n,r),e.parseAsync=async(n,r)=>bK(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>vK(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>wK(e,n,r),e.decode=(n,r)=>EK(e,n,r),e.encodeAsync=async(n,r)=>xK(e,n,r),e.decodeAsync=async(n,r)=>SK(e,n,r),e.safeEncode=(n,r)=>_K(e,n,r),e.safeDecode=(n,r)=>TK(e,n,r),e.safeEncodeAsync=async(n,r)=>NK(e,n,r),e.safeDecodeAsync=async(n,r)=>kK(e,n,r),e.refine=(n,r)=>e.check(yY(n,r)),e.superRefine=n=>e.check(vY(n)),e.overwrite=n=>e.check(Fu(n)),e.optional=()=>tt(e),e.nullable=()=>_L(e),e.nullish=()=>tt(_L(e)),e.nonoptional=n=>dY(e,n),e.array=()=>Fe(e),e.or=n=>Bn([e,n]),e.and=n=>zS(e,n),e.transform=n=>zE(e,Mz(n)),e.default=n=>lY(e,n),e.prefault=n=>uY(e,n),e.catch=n=>pY(e,n),e.pipe=n=>zE(e,n),e.readonly=()=>gY(e),e.describe=n=>{const r=e.clone();return dh.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return dh.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return dh.get(e);const r=e.clone();return dh.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Rz=Se("_ZodString",(e,t)=>{US.init(e,t),Fn.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(WW(...r)),e.includes=(...r)=>e.check(ZW(...r)),e.startsWith=(...r)=>e.check(qW(...r)),e.endsWith=(...r)=>e.check(XW(...r)),e.min=(...r)=>e.check(Yg(...r)),e.max=(...r)=>e.check(Nz(...r)),e.length=(...r)=>e.check(kz(...r)),e.nonempty=(...r)=>e.check(Yg(1,...r)),e.lowercase=r=>e.check(KW(r)),e.uppercase=r=>e.check(YW(r)),e.trim=()=>e.check(QW()),e.normalize=(...r)=>e.check(JW(...r)),e.toLowerCase=()=>e.check(eK()),e.toUpperCase=()=>e.check(tK()),e.slugify=()=>e.check(nK())}),CK=Se("ZodString",(e,t)=>{US.init(e,t),Rz.init(e,t),e.email=n=>e.check(mW(RK,n)),e.url=n=>e.check(Tz(Az,n)),e.jwt=n=>e.check(DW(GK,n)),e.emoji=n=>e.check(vW(IK,n)),e.guid=n=>e.check(yL(xL,n)),e.uuid=n=>e.check(hW(fh,n)),e.uuidv4=n=>e.check(gW(fh,n)),e.uuidv6=n=>e.check(bW(fh,n)),e.uuidv7=n=>e.check(yW(fh,n)),e.nanoid=n=>e.check(wW(OK,n)),e.guid=n=>e.check(yL(xL,n)),e.cuid=n=>e.check(EW(DK,n)),e.cuid2=n=>e.check(xW(LK,n)),e.ulid=n=>e.check(SW(MK,n)),e.base64=n=>e.check(AW(BK,n)),e.base64url=n=>e.check(IW(HK,n)),e.xid=n=>e.check(_W(jK,n)),e.ksuid=n=>e.check(TW(PK,n)),e.ipv4=n=>e.check(NW(UK,n)),e.ipv6=n=>e.check(kW($K,n)),e.cidrv4=n=>e.check(CW(zK,n)),e.cidrv6=n=>e.check(RW(FK,n)),e.e164=n=>e.check(OW(VK,n)),e.datetime=n=>e.check(Cz(n)),e.date=n=>e.check(uK(n)),e.time=n=>e.check(fK(n)),e.duration=n=>e.check(mK(n))});function de(e){return pW(CK,e)}const Wn=Se("ZodStringFormat",(e,t)=>{zn.init(e,t),Rz.init(e,t)}),RK=Se("ZodEmail",(e,t)=>{y7.init(e,t),Wn.init(e,t)}),xL=Se("ZodGUID",(e,t)=>{g7.init(e,t),Wn.init(e,t)}),fh=Se("ZodUUID",(e,t)=>{b7.init(e,t),Wn.init(e,t)}),Az=Se("ZodURL",(e,t)=>{v7.init(e,t),Wn.init(e,t)});function AK(e){return Tz(Az,e)}const IK=Se("ZodEmoji",(e,t)=>{w7.init(e,t),Wn.init(e,t)}),OK=Se("ZodNanoID",(e,t)=>{E7.init(e,t),Wn.init(e,t)}),DK=Se("ZodCUID",(e,t)=>{x7.init(e,t),Wn.init(e,t)}),LK=Se("ZodCUID2",(e,t)=>{S7.init(e,t),Wn.init(e,t)}),MK=Se("ZodULID",(e,t)=>{_7.init(e,t),Wn.init(e,t)}),jK=Se("ZodXID",(e,t)=>{T7.init(e,t),Wn.init(e,t)}),PK=Se("ZodKSUID",(e,t)=>{N7.init(e,t),Wn.init(e,t)}),UK=Se("ZodIPv4",(e,t)=>{I7.init(e,t),Wn.init(e,t)}),$K=Se("ZodIPv6",(e,t)=>{O7.init(e,t),Wn.init(e,t)}),zK=Se("ZodCIDRv4",(e,t)=>{D7.init(e,t),Wn.init(e,t)}),FK=Se("ZodCIDRv6",(e,t)=>{L7.init(e,t),Wn.init(e,t)}),BK=Se("ZodBase64",(e,t)=>{M7.init(e,t),Wn.init(e,t)}),HK=Se("ZodBase64URL",(e,t)=>{P7.init(e,t),Wn.init(e,t)}),VK=Se("ZodE164",(e,t)=>{U7.init(e,t),Wn.init(e,t)}),GK=Se("ZodJWT",(e,t)=>{z7.init(e,t),Wn.init(e,t)}),$S=Se("ZodNumber",(e,t)=>{Ez.init(e,t),Fn.init(e,t),e.gt=(r,a)=>e.check(wL(r,a)),e.gte=(r,a)=>e.check(mw(r,a)),e.min=(r,a)=>e.check(mw(r,a)),e.lt=(r,a)=>e.check(vL(r,a)),e.lte=(r,a)=>e.check(pw(r,a)),e.max=(r,a)=>e.check(pw(r,a)),e.int=r=>e.check(SL(r)),e.safe=r=>e.check(SL(r)),e.positive=r=>e.check(wL(0,r)),e.nonnegative=r=>e.check(mw(0,r)),e.negative=r=>e.check(vL(0,r)),e.nonpositive=r=>e.check(pw(0,r)),e.multipleOf=(r,a)=>e.check(EL(r,a)),e.step=(r,a)=>e.check(EL(r,a)),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 vn(e){return UW($S,e)}const WK=Se("ZodNumberFormat",(e,t)=>{F7.init(e,t),$S.init(e,t)});function SL(e){return zW(WK,e)}const KK=Se("ZodBoolean",(e,t)=>{B7.init(e,t),Fn.init(e,t)});function Dn(e){return FW(KK,e)}const YK=Se("ZodNull",(e,t)=>{H7.init(e,t),Fn.init(e,t)});function Iz(e){return BW(YK,e)}const ZK=Se("ZodAny",(e,t)=>{V7.init(e,t),Fn.init(e,t)});function qK(){return HW(ZK)}const XK=Se("ZodUnknown",(e,t)=>{G7.init(e,t),Fn.init(e,t)});function gr(){return VW(XK)}const JK=Se("ZodNever",(e,t)=>{W7.init(e,t),Fn.init(e,t)});function QK(e){return GW(JK,e)}const eY=Se("ZodArray",(e,t)=>{K7.init(e,t),Fn.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Yg(n,r)),e.nonempty=n=>e.check(Yg(1,n)),e.max=(n,r)=>e.check(Nz(n,r)),e.length=(n,r)=>e.check(kz(n,r)),e.unwrap=()=>e.element});function Fe(e,t){return rK(eY,e,t)}const Oz=Se("ZodObject",(e,t)=>{Z7.init(e,t),Fn.init(e,t),Nn(e,"shape",()=>t.shape),e.keyof=()=>ao(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:gr()}),e.loose=()=>e.clone({...e._zod.def,catchall:gr()}),e.strict=()=>e.clone({...e._zod.def,catchall:QK()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>fG(e,n),e.safeExtend=n=>pG(e,n),e.merge=n=>mG(e,n),e.pick=n=>uG(e,n),e.omit=n=>dG(e,n),e.partial=(...n)=>hG(jz,e,n[0]),e.required=(...n)=>gG(Pz,e,n[0])});function Pe(e,t){const n={type:"object",shape:e??{},...Qe(t)};return new Oz(n)}function Ea(e,t){return new Oz({type:"object",shape:e,catchall:gr(),...Qe(t)})}const Dz=Se("ZodUnion",(e,t)=>{_z.init(e,t),Fn.init(e,t),e.options=t.options});function Bn(e,t){return new Dz({type:"union",options:e,...Qe(t)})}const tY=Se("ZodDiscriminatedUnion",(e,t)=>{Dz.init(e,t),q7.init(e,t)});function Lz(e,t,n){return new tY({type:"union",options:t,discriminator:e,...Qe(n)})}const nY=Se("ZodIntersection",(e,t)=>{X7.init(e,t),Fn.init(e,t)});function zS(e,t){return new nY({type:"intersection",left:e,right:t})}const rY=Se("ZodRecord",(e,t)=>{J7.init(e,t),Fn.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function br(e,t,n){return new rY({type:"record",keyType:e,valueType:t,...Qe(n)})}const $E=Se("ZodEnum",(e,t)=>{Q7.init(e,t),Fn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new $E({...t,checks:[],...Qe(a),entries:s})},e.exclude=(r,a)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new $E({...t,checks:[],...Qe(a),entries:s})}});function ao(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new $E({type:"enum",entries:n,...Qe(t)})}const aY=Se("ZodLiteral",(e,t)=>{eW.init(e,t),Fn.init(e,t),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 et(e,t){return new aY({type:"literal",values:Array.isArray(e)?e:[e],...Qe(t)})}const oY=Se("ZodTransform",(e,t)=>{tW.init(e,t),Fn.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new lz(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Vf(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Vf(i))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(s=>(n.value=s,n)):(n.value=a,n)}});function Mz(e){return new oY({type:"transform",transform:e})}const jz=Se("ZodOptional",(e,t)=>{nW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tt(e){return new jz({type:"optional",innerType:e})}const sY=Se("ZodNullable",(e,t)=>{rW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _L(e){return new sY({type:"nullable",innerType:e})}const iY=Se("ZodDefault",(e,t)=>{aW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lY(e,t){return new iY({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():uz(t)}})}const cY=Se("ZodPrefault",(e,t)=>{oW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uY(e,t){return new cY({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():uz(t)}})}const Pz=Se("ZodNonOptional",(e,t)=>{sW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dY(e,t){return new Pz({type:"nonoptional",innerType:e,...Qe(t)})}const fY=Se("ZodCatch",(e,t)=>{iW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pY(e,t){return new fY({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const mY=Se("ZodPipe",(e,t)=>{lW.init(e,t),Fn.init(e,t),e.in=t.in,e.out=t.out});function zE(e,t){return new mY({type:"pipe",in:e,out:t})}const hY=Se("ZodReadonly",(e,t)=>{cW.init(e,t),Fn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gY(e){return new hY({type:"readonly",innerType:e})}const Uz=Se("ZodCustom",(e,t)=>{uW.init(e,t),Fn.init(e,t)});function bY(e,t){return aK(Uz,e??(()=>!0),t)}function yY(e,t={}){return oK(Uz,e,t)}function vY(e){return sK(e)}function $z(e,t){return zE(Mz(e),t)}const wY={custom:"custom"};function EY(e){return $W($S,e)}const Jb="2025-11-25",xY=[Jb,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ys="io.modelcontextprotocol/related-task",Qb="2.0",Po=bY(e=>e!==null&&(typeof e=="object"||typeof e=="function")),zz=Bn([de(),vn().int()]),Fz=de(),SY=Ea({ttl:Bn([vn(),Iz()]).optional(),pollInterval:vn().optional()}),FS=Ea({taskId:de()}),_Y=Ea({progressToken:zz.optional(),[ys]:FS.optional()}),Sa=Ea({task:SY.optional(),_meta:_Y.optional()}),Fr=Pe({method:de(),params:Sa.optional()}),Ul=Ea({_meta:Pe({[ys]:tt(FS)}).passthrough().optional()}),oo=Pe({method:de(),params:Ul.optional()}),qr=Ea({_meta:Ea({[ys]:FS.optional()}).optional()}),ey=Bn([de(),vn().int()]),Bz=Pe({jsonrpc:et(Qb),id:ey,...Fr.shape}).strict(),FE=e=>Bz.safeParse(e).success,Hz=Pe({jsonrpc:et(Qb),...oo.shape}).strict(),TY=e=>Hz.safeParse(e).success,Vz=Pe({jsonrpc:et(Qb),id:ey,result:qr}).strict(),ff=e=>Vz.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 Gz=Pe({jsonrpc:et(Qb),id:ey,error:Pe({code:vn().int(),message:de(),data:tt(gr())})}).strict(),NY=e=>Gz.safeParse(e).success,Sg=Bn([Bz,Hz,Vz,Gz]),Kc=qr.strict(),kY=Ul.extend({requestId:ey,reason:de().optional()}),BS=oo.extend({method:et("notifications/cancelled"),params:kY}),CY=Pe({src:de(),mimeType:de().optional(),sizes:Fe(de()).optional()}),yp=Pe({icons:Fe(CY).optional()}),Cu=Pe({name:de(),title:de().optional()}),Wz=Cu.extend({...Cu.shape,...yp.shape,version:de(),websiteUrl:de().optional()}),RY=zS(Pe({applyDefaults:Dn().optional()}),br(de(),gr())),AY=$z(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,zS(Pe({form:RY.optional(),url:Po.optional()}),br(de(),gr()).optional())),IY=Pe({list:tt(Pe({}).passthrough()),cancel:tt(Pe({}).passthrough()),requests:tt(Pe({sampling:tt(Pe({createMessage:tt(Pe({}).passthrough())}).passthrough()),elicitation:tt(Pe({create:tt(Pe({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),OY=Pe({list:tt(Pe({}).passthrough()),cancel:tt(Pe({}).passthrough()),requests:tt(Pe({tools:tt(Pe({call:tt(Pe({}).passthrough())}).passthrough())}).passthrough())}).passthrough(),DY=Pe({experimental:br(de(),Po).optional(),sampling:Pe({context:Po.optional(),tools:Po.optional()}).optional(),elicitation:AY.optional(),roots:Pe({listChanged:Dn().optional()}).optional(),tasks:tt(IY)}),LY=Sa.extend({protocolVersion:de(),capabilities:DY,clientInfo:Wz}),MY=Fr.extend({method:et("initialize"),params:LY}),jY=Pe({experimental:br(de(),Po).optional(),logging:Po.optional(),completions:Po.optional(),prompts:tt(Pe({listChanged:tt(Dn())})),resources:Pe({subscribe:Dn().optional(),listChanged:Dn().optional()}).optional(),tools:Pe({listChanged:Dn().optional()}).optional(),tasks:tt(OY)}).passthrough(),Kz=qr.extend({protocolVersion:de(),capabilities:jY,serverInfo:Wz,instructions:de().optional()}),Yz=oo.extend({method:et("notifications/initialized")}),PY=e=>Yz.safeParse(e).success,HS=Fr.extend({method:et("ping")}),UY=Pe({progress:vn(),total:tt(vn()),message:tt(de())}),$Y=Pe({...Ul.shape,...UY.shape,progressToken:zz}),VS=oo.extend({method:et("notifications/progress"),params:$Y}),zY=Sa.extend({cursor:Fz.optional()}),vp=Fr.extend({params:zY.optional()}),wp=qr.extend({nextCursor:tt(Fz)}),Ep=Pe({taskId:de(),status:ao(["working","input_required","completed","failed","cancelled"]),ttl:Bn([vn(),Iz()]),createdAt:de(),lastUpdatedAt:de(),pollInterval:tt(vn()),statusMessage:tt(de())}),Gf=qr.extend({task:Ep}),FY=Ul.merge(Ep),Zg=oo.extend({method:et("notifications/tasks/status"),params:FY}),GS=Fr.extend({method:et("tasks/get"),params:Sa.extend({taskId:de()})}),WS=qr.merge(Ep),KS=Fr.extend({method:et("tasks/result"),params:Sa.extend({taskId:de()})}),YS=vp.extend({method:et("tasks/list")}),ZS=wp.extend({tasks:Fe(Ep)}),BY=Fr.extend({method:et("tasks/cancel"),params:Sa.extend({taskId:de()})}),HY=qr.merge(Ep),Zz=Pe({uri:de(),mimeType:tt(de()),_meta:br(de(),gr()).optional()}),qz=Zz.extend({text:de()}),qS=de().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xz=Zz.extend({blob:qS}),xp=ao(["user","assistant"]),Bu=Pe({audience:Fe(xp).optional(),priority:vn().min(0).max(1).optional(),lastModified:Cz({offset:!0}).optional()}),Jz=Pe({...Cu.shape,...yp.shape,uri:de(),description:tt(de()),mimeType:tt(de()),annotations:Bu.optional(),_meta:tt(Ea({}))}),VY=Pe({...Cu.shape,...yp.shape,uriTemplate:de(),description:tt(de()),mimeType:tt(de()),annotations:Bu.optional(),_meta:tt(Ea({}))}),GY=vp.extend({method:et("resources/list")}),Qz=wp.extend({resources:Fe(Jz)}),WY=vp.extend({method:et("resources/templates/list")}),e2=wp.extend({resourceTemplates:Fe(VY)}),XS=Sa.extend({uri:de()}),KY=XS,YY=Fr.extend({method:et("resources/read"),params:KY}),t2=qr.extend({contents:Fe(Bn([qz,Xz]))}),n2=oo.extend({method:et("notifications/resources/list_changed")}),ZY=XS,qY=Fr.extend({method:et("resources/subscribe"),params:ZY}),XY=XS,JY=Fr.extend({method:et("resources/unsubscribe"),params:XY}),QY=Ul.extend({uri:de()}),eZ=oo.extend({method:et("notifications/resources/updated"),params:QY}),tZ=Pe({name:de(),description:tt(de()),required:tt(Dn())}),nZ=Pe({...Cu.shape,...yp.shape,description:tt(de()),arguments:tt(Fe(tZ)),_meta:tt(Ea({}))}),rZ=vp.extend({method:et("prompts/list")}),r2=wp.extend({prompts:Fe(nZ)}),aZ=Sa.extend({name:de(),arguments:br(de(),de()).optional()}),oZ=Fr.extend({method:et("prompts/get"),params:aZ}),JS=Pe({type:et("text"),text:de(),annotations:Bu.optional(),_meta:br(de(),gr()).optional()}),QS=Pe({type:et("image"),data:qS,mimeType:de(),annotations:Bu.optional(),_meta:br(de(),gr()).optional()}),e_=Pe({type:et("audio"),data:qS,mimeType:de(),annotations:Bu.optional(),_meta:br(de(),gr()).optional()}),sZ=Pe({type:et("tool_use"),name:de(),id:de(),input:Pe({}).passthrough(),_meta:tt(Pe({}).passthrough())}).passthrough(),iZ=Pe({type:et("resource"),resource:Bn([qz,Xz]),annotations:Bu.optional(),_meta:br(de(),gr()).optional()}),lZ=Jz.extend({type:et("resource_link")}),t_=Bn([JS,QS,e_,lZ,iZ]),cZ=Pe({role:xp,content:t_}),a2=qr.extend({description:tt(de()),messages:Fe(cZ)}),o2=oo.extend({method:et("notifications/prompts/list_changed")}),uZ=Pe({title:de().optional(),readOnlyHint:Dn().optional(),destructiveHint:Dn().optional(),idempotentHint:Dn().optional(),openWorldHint:Dn().optional()}),dZ=Pe({taskSupport:ao(["required","optional","forbidden"]).optional()}),s2=Pe({...Cu.shape,...yp.shape,description:de().optional(),inputSchema:Pe({type:et("object"),properties:br(de(),Po).optional(),required:Fe(de()).optional()}).catchall(gr()),outputSchema:Pe({type:et("object"),properties:br(de(),Po).optional(),required:Fe(de()).optional()}).catchall(gr()).optional(),annotations:tt(uZ),execution:tt(dZ),_meta:br(de(),gr()).optional()}),fZ=vp.extend({method:et("tools/list")}),i2=wp.extend({tools:Fe(s2)}),ty=qr.extend({content:Fe(t_).default([]),structuredContent:br(de(),gr()).optional(),isError:tt(Dn())});ty.or(qr.extend({toolResult:gr()}));const pZ=Sa.extend({name:de(),arguments:tt(br(de(),gr()))}),mZ=Fr.extend({method:et("tools/call"),params:pZ}),l2=oo.extend({method:et("notifications/tools/list_changed")}),hZ=Pe({autoRefresh:Dn().default(!0),debounceMs:vn().int().nonnegative().default(300)}),c2=ao(["debug","info","notice","warning","error","critical","alert","emergency"]),gZ=Sa.extend({level:c2}),bZ=Fr.extend({method:et("logging/setLevel"),params:gZ}),yZ=Ul.extend({level:c2,logger:de().optional(),data:gr()}),vZ=oo.extend({method:et("notifications/message"),params:yZ}),wZ=Pe({name:de().optional()}),EZ=Pe({hints:tt(Fe(wZ)),costPriority:tt(vn().min(0).max(1)),speedPriority:tt(vn().min(0).max(1)),intelligencePriority:tt(vn().min(0).max(1))}),xZ=Pe({mode:tt(ao(["auto","required","none"]))}),SZ=Pe({type:et("tool_result"),toolUseId:de().describe("The unique identifier for the corresponding tool call."),content:Fe(t_).default([]),structuredContent:Pe({}).passthrough().optional(),isError:tt(Dn()),_meta:tt(Pe({}).passthrough())}).passthrough(),_Z=Lz("type",[JS,QS,e_]),qg=Lz("type",[JS,QS,e_,sZ,SZ]),TZ=Pe({role:xp,content:Bn([qg,Fe(qg)]),_meta:tt(Pe({}).passthrough())}).passthrough(),NZ=Sa.extend({messages:Fe(TZ),modelPreferences:EZ.optional(),systemPrompt:de().optional(),includeContext:ao(["none","thisServer","allServers"]).optional(),temperature:vn().optional(),maxTokens:vn().int(),stopSequences:Fe(de()).optional(),metadata:Po.optional(),tools:tt(Fe(s2)),toolChoice:tt(xZ)}),n_=Fr.extend({method:et("sampling/createMessage"),params:NZ}),r_=qr.extend({model:de(),stopReason:tt(ao(["endTurn","stopSequence","maxTokens"]).or(de())),role:xp,content:_Z}),kZ=qr.extend({model:de(),stopReason:tt(ao(["endTurn","stopSequence","maxTokens","toolUse"]).or(de())),role:xp,content:Bn([qg,Fe(qg)])}),CZ=Pe({type:et("boolean"),title:de().optional(),description:de().optional(),default:Dn().optional()}),RZ=Pe({type:et("string"),title:de().optional(),description:de().optional(),minLength:vn().optional(),maxLength:vn().optional(),format:ao(["email","uri","date","date-time"]).optional(),default:de().optional()}),AZ=Pe({type:ao(["number","integer"]),title:de().optional(),description:de().optional(),minimum:vn().optional(),maximum:vn().optional(),default:vn().optional()}),IZ=Pe({type:et("string"),title:de().optional(),description:de().optional(),enum:Fe(de()),default:de().optional()}),OZ=Pe({type:et("string"),title:de().optional(),description:de().optional(),oneOf:Fe(Pe({const:de(),title:de()})),default:de().optional()}),DZ=Pe({type:et("string"),title:de().optional(),description:de().optional(),enum:Fe(de()),enumNames:Fe(de()).optional(),default:de().optional()}),LZ=Bn([IZ,OZ]),MZ=Pe({type:et("array"),title:de().optional(),description:de().optional(),minItems:vn().optional(),maxItems:vn().optional(),items:Pe({type:et("string"),enum:Fe(de())}),default:Fe(de()).optional()}),jZ=Pe({type:et("array"),title:de().optional(),description:de().optional(),minItems:vn().optional(),maxItems:vn().optional(),items:Pe({anyOf:Fe(Pe({const:de(),title:de()}))}),default:Fe(de()).optional()}),PZ=Bn([MZ,jZ]),UZ=Bn([DZ,LZ,PZ]),$Z=Bn([UZ,CZ,RZ,AZ]),zZ=Sa.extend({mode:et("form").optional(),message:de(),requestedSchema:Pe({type:et("object"),properties:br(de(),$Z),required:Fe(de()).optional()})}),FZ=Sa.extend({mode:et("url"),message:de(),elicitationId:de(),url:de().url()}),BZ=Bn([zZ,FZ]),a_=Fr.extend({method:et("elicitation/create"),params:BZ}),HZ=Ul.extend({elicitationId:de()}),VZ=oo.extend({method:et("notifications/elicitation/complete"),params:HZ}),u2=qr.extend({action:ao(["accept","decline","cancel"]),content:$z(e=>e===null?void 0:e,br(de(),Bn([de(),vn(),Dn(),Fe(de())])).optional())}),GZ=Pe({type:et("ref/resource"),uri:de()}),WZ=Pe({type:et("ref/prompt"),name:de()}),KZ=Sa.extend({ref:Bn([WZ,GZ]),argument:Pe({name:de(),value:de()}),context:Pe({arguments:br(de(),de()).optional()}).optional()}),YZ=Fr.extend({method:et("completion/complete"),params:KZ}),d2=qr.extend({completion:Ea({values:Fe(de()).max(100),total:tt(vn().int()),hasMore:tt(Dn())})}),ZZ=Pe({uri:de().startsWith("file://"),name:de().optional(),_meta:br(de(),gr()).optional()}),f2=Fr.extend({method:et("roots/list")}),qZ=qr.extend({roots:Fe(ZZ)}),XZ=oo.extend({method:et("notifications/roots/list_changed")});Bn([HS,MY,YZ,bZ,oZ,rZ,GY,WY,YY,qY,JY,mZ,fZ,GS,KS,YS]);Bn([BS,VS,Yz,XZ,Zg]);Bn([Kc,r_,kZ,u2,qZ,WS,ZS,Gf]);Bn([HS,n_,a_,f2,GS,KS,YS]);Bn([BS,VS,vZ,eZ,n2,l2,o2,Zg,VZ]);Bn([Kc,Kz,d2,a2,r2,Qz,e2,t2,ty,i2,WS,ZS,Gf]);class ut extends Error{constructor(t,n,r){super(`MCP error ${t}: ${n}`),this.code=t,this.data=r,this.name="McpError"}static fromError(t,n,r){if(t===wt.UrlElicitationRequired&&r){const a=r;if(a.elicitations)return new JZ(a.elicitations,n)}return new ut(t,n,r)}}class JZ extends ut{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 gu,p2=(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])}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(r){Re.error("Error in notification handler:",r)}})}async refreshToolsCache(){if(this.client)try{Re.debug("[Auto] Refreshing tools cache due to list_changed notification");const t=await this.client.listTools();this.toolsCache=t.tools??[],Re.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(t){Re.warn("[Auto] Failed to refresh tools cache:",t)}}async onResourcesListChanged(){Re.debug("[Auto] Resources list changed - clients should re-fetch if needed")}async onPromptsListChanged(){Re.debug("[Auto] Prompts list changed - clients should re-fetch if needed")}async setRoots(t){this.rootsCache=[...t],this.client&&(Re.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(f2,async(t,n)=>(Re.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){Re.debug("setupSamplingHandler: No client available");return}if(!this.opts.samplingCallback){Re.debug("setupSamplingHandler: No sampling callback provided");return}Re.debug("setupSamplingHandler: Setting up sampling request handler"),this.client.setRequestHandler(n_,async(t,n)=>(Re.debug("Server requested sampling, forwarding to callback"),await this.opts.samplingCallback(t.params))),Re.debug("setupSamplingHandler: Sampling handler registered successfully")}setupElicitationHandler(){if(!this.client){Re.debug("setupElicitationHandler: No client available");return}if(!this.opts.elicitationCallback){Re.debug("setupElicitationHandler: No elicitation callback provided");return}Re.debug("setupElicitationHandler: Setting up elicitation request handler"),this.client.setRequestHandler(a_,async(t,n)=>(Re.debug("Server requested elicitation, forwarding to callback"),await this.opts.elicitationCallback(t.params))),Re.debug("setupElicitationHandler: Elicitation handler registered successfully")}async disconnect(){if(!this.connected){Re.debug("Not connected to MCP implementation");return}Re.debug("Disconnecting from MCP implementation"),await this.cleanupResources(),this.connected=!1,Re.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");Re.debug("Caching server capabilities & tools");const n=this.client.getServerCapabilities();this.capabilitiesCache=n||null;const r=this.client.getServerVersion();this.serverInfoCache=r||null;const a=await this.client.listTools(void 0,t);return this.toolsCache=a.tools??[],Re.debug(`Fetched ${this.toolsCache.length} tools from server`),Re.debug("Server capabilities:",n),Re.debug("Server info:",r),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,r){if(!this.client)throw new Error("MCP client is not connected");const a=r?{...r}:void 0;a?.resetTimeoutOnProgress&&!a.onprogress&&(a.onprogress=()=>{},Re.debug(`[BaseConnector] Added onprogress callback for tool '${t}' to enable progressToken`)),Re.debug(`Calling tool '${t}' with args`,n);const s=await this.client.callTool({name:t,arguments:n},void 0,a);return Re.debug(`Tool '${t}' returned`,s),s}async listResources(t,n){if(!this.client)throw new Error("MCP client is not connected");return Re.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 Re.debug("Server does not advertise resources capability, skipping"),{resources:[]};try{Re.debug("Listing all resources (with auto-pagination)");const n=[];let r;do{const a=await this.client.listResources({cursor:r},t);n.push(...a.resources||[]),r=a.nextCursor}while(r);return{resources:n}}catch(n){if(n.code===-32601)return Re.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 Re.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 Re.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 Re.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 Re.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 Re.debug("Server does not advertise prompts capability, skipping"),{prompts:[]};try{return Re.debug("Listing prompts"),await this.client.listPrompts()}catch(t){if(t.code===-32601)return Re.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 Re.debug(`Getting prompt ${t}`),await this.client.getPrompt({name:t,arguments:n})}async request(t,n=null,r){if(!this.client)throw new Error("MCP client is not connected");return Re.debug(`Sending raw request '${t}' with params`,n),await this.client.request({method:t,params:n??{}},void 0,r)}async cleanupResources(){const t=[];if(this.client)try{typeof this.client.close=="function"&&await this.client.close()}catch(n){const r=`Error closing client: ${n}`;Re.warn(r),t.push(r)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(n){const r=`Error stopping connection manager: ${n}`;Re.warn(r),t.push(r)}finally{this.connectionManager=null}this.toolsCache=null,t.length&&Re.warn(`Resource cleanup finished with ${t.length} issue(s)`)}},Ge(gu,"BaseConnector"),gu),QZ={},m2=typeof globalThis.Deno<"u";function eq(e){return m2?globalThis.Deno.env.get(e):QZ[e]}Ge(eq,"getEnv");function tq(){return m2?globalThis.Deno.cwd():process.cwd()}Ge(tq,"getCwd");function h2(){return globalThis.crypto.randomUUID()}Ge(h2,"generateUUID");function ny(e){return!!e._zod}function bi(e,t){return ny(e)?pz(e,t):e.safeParse(t)}function g2(e){var t,n;if(!e)return;let r;if(ny(e)?r=(n=(t=e._zod)===null||t===void 0?void 0:t.def)===null||n===void 0?void 0:n.shape:r=e.shape,!!r){if(typeof r=="function")try{return r()}catch{return}return r}}function nq(e){var t;if(ny(e)){const i=(t=e._zod)===null||t===void 0?void 0:t.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}const r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const a=e.value;if(a!==void 0)return a}function ol(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function TL(e){const t=g2(e),n=t?.method;if(!n)throw new Error("Schema is missing a method literal");const r=nq(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function NL(e,t){const n=bi(e,t);if(!n.success)throw n.error;return n.data}const rq=6e4;class aq{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(BS,n=>{this._oncancel(n)}),this.setNotificationHandler(VS,n=>{this._onprogress(n)}),this.setRequestHandler(HS,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(GS,async(n,r)=>{const a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new ut(wt.InvalidParams,"Failed to retrieve task: Task not found");return{...a}}),this.setRequestHandler(KS,async(n,r)=>{const a=async()=>{var s;const i=n.params.taskId;if(this._taskMessageQueue){let u;for(;u=await this._taskMessageQueue.dequeue(i,r.sessionId);){if(u.type==="response"||u.type==="error"){const f=u.message,m=f.id,h=this._requestResolvers.get(m);if(h)if(this._requestResolvers.delete(m),u.type==="response")h(f);else{const b=f,y=new ut(b.error.code,b.error.message,b.error.data);h(y)}else{const b=u.type==="response"?"Response":"Error";this._onerror(new Error(`${b} handler missing for request ${m}`))}continue}await((s=this._transport)===null||s===void 0?void 0:s.send(u.message,{relatedRequestId:r.requestId}))}}const c=await this._taskStore.getTask(i,r.sessionId);if(!c)throw new ut(wt.InvalidParams,`Task not found: ${i}`);if(!ol(c.status))return await this._waitForTaskUpdate(i,r.signal),await a();if(ol(c.status)){const u=await this._taskStore.getTaskResult(i,r.sessionId);return this._clearTaskQueue(i),{...u,_meta:{...u._meta,[ys]:{taskId:i}}}}return await a()};return await a()}),this.setRequestHandler(YS,async(n,r)=>{var a;try{const{tasks:s,nextCursor:i}=await this._taskStore.listTasks((a=n.params)===null||a===void 0?void 0:a.cursor,r.sessionId);return{tasks:s,nextCursor:i,_meta:{}}}catch(s){throw new ut(wt.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(BY,async(n,r)=>{try{const a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new ut(wt.InvalidParams,`Task not found: ${n.params.taskId}`);if(ol(a.status))throw new ut(wt.InvalidParams,`Cannot cancel task in terminal status: ${a.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);const s=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!s)throw new ut(wt.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...s}}catch(a){throw a instanceof ut?a:new ut(wt.InvalidRequest,`Failed to cancel task: ${a instanceof Error?a.message:String(a)}`)}}))}async _oncancel(t){const n=this._requestHandlerAbortControllers.get(t.params.requestId);n?.abort(t.params.reason)}_setupTimeout(t,n,r,a,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(a,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),ut.fromError(wt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});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,r,a;this._transport=t;const s=(n=this.transport)===null||n===void 0?void 0:n.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};const i=(r=this.transport)===null||r===void 0?void 0:r.onerror;this._transport.onerror=u=>{i?.(u),this._onerror(u)};const c=(a=this._transport)===null||a===void 0?void 0:a.onmessage;this._transport.onmessage=(u,f)=>{c?.(u,f),ff(u)||NY(u)?this._onresponse(u):FE(u)?this._onrequest(u,f):TY(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 r=ut.fromError(wt.ConnectionClosed,"Connection closed");this._transport=void 0,(t=this.onclose)===null||t===void 0||t.call(this);for(const a of n.values())a(r)}_onerror(t){var n;(n=this.onerror)===null||n===void 0||n.call(this,t)}_onnotification(t){var n;const r=(n=this._notificationHandlers.get(t.method))!==null&&n!==void 0?n:this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(t,n){var r,a,s,i,c,u;const f=(r=this._requestHandlers.get(t.method))!==null&&r!==void 0?r:this.fallbackRequestHandler,m=this._transport,h=(i=(s=(a=t.params)===null||a===void 0?void 0:a._meta)===null||s===void 0?void 0:s[ys])===null||i===void 0?void 0:i.taskId;if(f===void 0){const w={jsonrpc:"2.0",id:t.id,error:{code:wt.MethodNotFound,message:"Method not found"}};h&&this._taskMessageQueue?this._enqueueTaskMessage(h,{type:"error",message:w,timestamp:Date.now()},m?.sessionId).catch(_=>this._onerror(new Error(`Failed to enqueue error response: ${_}`))):m?.send(w).catch(_=>this._onerror(new Error(`Failed to send an error response: ${_}`)));return}const b=new AbortController;this._requestHandlerAbortControllers.set(t.id,b);const y=(c=t.params)===null||c===void 0?void 0:c.task,x=this._taskStore?this.requestTaskStore(t,m?.sessionId):void 0,E={signal:b.signal,sessionId:m?.sessionId,_meta:(u=t.params)===null||u===void 0?void 0:u._meta,sendNotification:async w=>{const _={relatedRequestId:t.id};h&&(_.relatedTask={taskId:h}),await this.notification(w,_)},sendRequest:async(w,_,S)=>{var T,R;const C={...S,relatedRequestId:t.id};h&&!C.relatedTask&&(C.relatedTask={taskId:h});const I=(R=(T=C.relatedTask)===null||T===void 0?void 0:T.taskId)!==null&&R!==void 0?R:h;return I&&x&&await x.updateTaskStatus(I,"input_required"),await this.request(w,_,C)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:h,taskStore:x,taskRequestedTtl:y?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{y&&this.assertTaskHandlerCapability(t.method)}).then(()=>f(t,E)).then(async w=>{if(b.signal.aborted)return;const _={result:w,jsonrpc:"2.0",id:t.id};h&&this._taskMessageQueue?await this._enqueueTaskMessage(h,{type:"response",message:_,timestamp:Date.now()},m?.sessionId):await m?.send(_)},async w=>{var _;if(b.signal.aborted)return;const S={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(w.code)?w.code:wt.InternalError,message:(_=w.message)!==null&&_!==void 0?_:"Internal error",...w.data!==void 0&&{data:w.data}}};h&&this._taskMessageQueue?await this._enqueueTaskMessage(h,{type:"error",message:S,timestamp:Date.now()},m?.sessionId):await m?.send(S)}).catch(w=>this._onerror(new Error(`Failed to send response: ${w}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...r}=t.params,a=Number(n),s=this._progressHandlers.get(a);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(a),c=this._timeoutInfo.get(a);if(c&&i&&c.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(u){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),i(u);return}s(r)}_onresponse(t){const n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),ff(t))r(t);else{const i=new ut(t.error.code,t.error.message,t.error.data);r(i)}return}const a=this._responseHandlers.get(n);if(a===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 s=!1;if(ff(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const c=i.task;typeof c.taskId=="string"&&(s=!0,this._taskProgressTokens.set(c.taskId,n))}}if(s||this._progressHandlers.delete(n),ff(t))a(t);else{const i=ut.fromError(t.error.code,t.error.message,t.error.data);a(i)}}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,r){var a,s,i,c;const{task:u}=r??{};if(!u){try{yield{type:"result",result:await this.request(t,n,r)}}catch(m){yield{type:"error",error:m instanceof ut?m:new ut(wt.InternalError,String(m))}}return}let f;try{const m=await this.request(t,Gf,r);if(m.task)f=m.task.taskId,yield{type:"taskCreated",task:m.task};else throw new ut(wt.InternalError,"Task creation did not return a task");for(;;){const h=await this.getTask({taskId:f},r);if(yield{type:"taskStatus",task:h},ol(h.status)){h.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:f},n,r)}:h.status==="failed"?yield{type:"error",error:new ut(wt.InternalError,`Task ${f} failed`)}:h.status==="cancelled"&&(yield{type:"error",error:new ut(wt.InternalError,`Task ${f} was cancelled`)});return}if(h.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:f},n,r)};return}const b=(i=(a=h.pollInterval)!==null&&a!==void 0?a:(s=this._options)===null||s===void 0?void 0:s.defaultTaskPollInterval)!==null&&i!==void 0?i:1e3;await new Promise(y=>setTimeout(y,b)),(c=r?.signal)===null||c===void 0||c.throwIfAborted()}}catch(m){yield{type:"error",error:m instanceof ut?m:new ut(wt.InternalError,String(m))}}}request(t,n,r){const{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i,task:c,relatedTask:u}=r??{};return new Promise((f,m)=>{var h,b,y,x,E,w,_;const S=j=>{m(j)};if(!this._transport){S(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(j){S(j);return}(b=r?.signal)===null||b===void 0||b.throwIfAborted();const T=this._requestMessageId++,R={...t,jsonrpc:"2.0",id:T};r?.onprogress&&(this._progressHandlers.set(T,r.onprogress),R.params={...t.params,_meta:{...((y=t.params)===null||y===void 0?void 0:y._meta)||{},progressToken:T}}),c&&(R.params={...R.params,task:c}),u&&(R.params={...R.params,_meta:{...((x=R.params)===null||x===void 0?void 0:x._meta)||{},[ys]:u}});const C=j=>{var U;this._responseHandlers.delete(T),this._progressHandlers.delete(T),this._cleanupTimeout(T),(U=this._transport)===null||U===void 0||U.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:T,reason:String(j)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(W=>this._onerror(new Error(`Failed to send cancellation: ${W}`)));const B=j instanceof ut?j:new ut(wt.RequestTimeout,String(j));m(B)};this._responseHandlers.set(T,j=>{var U;if(!(!((U=r?.signal)===null||U===void 0)&&U.aborted)){if(j instanceof Error)return m(j);try{const B=bi(n,j.result);B.success?f(B.data):m(B.error)}catch(B){m(B)}}}),(E=r?.signal)===null||E===void 0||E.addEventListener("abort",()=>{var j;C((j=r?.signal)===null||j===void 0?void 0:j.reason)});const I=(w=r?.timeout)!==null&&w!==void 0?w:rq,A=()=>C(ut.fromError(wt.RequestTimeout,"Request timed out",{timeout:I}));this._setupTimeout(T,I,r?.maxTotalTimeout,A,(_=r?.resetTimeoutOnProgress)!==null&&_!==void 0?_:!1);const O=u?.taskId;if(O){const j=U=>{const B=this._responseHandlers.get(T);B?B(U):this._onerror(new Error(`Response handler missing for side-channeled request ${T}`))};this._requestResolvers.set(T,j),this._enqueueTaskMessage(O,{type:"request",message:R,timestamp:Date.now()}).catch(U=>{this._cleanupTimeout(T),m(U)})}else this._transport.send(R,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(j=>{this._cleanupTimeout(T),m(j)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},WS,n)}async getTaskResult(t,n,r){return this.request({method:"tasks/result",params:t},n,r)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},ZS,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},HY,n)}async notification(t,n){var r,a,s,i,c;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const u=(r=n?.relatedTask)===null||r===void 0?void 0:r.taskId;if(u){const b={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((a=t.params)===null||a===void 0?void 0:a._meta)||{},[ys]:n.relatedTask}}};await this._enqueueTaskMessage(u,{type:"notification",message:b,timestamp:Date.now()});return}if(((i=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).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 b,y;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let x={...t,jsonrpc:"2.0"};n?.relatedTask&&(x={...x,params:{...x.params,_meta:{...((b=x.params)===null||b===void 0?void 0:b._meta)||{},[ys]:n.relatedTask}}}),(y=this._transport)===null||y===void 0||y.send(x,n).catch(E=>this._onerror(E))});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)||{},[ys]:n.relatedTask}}}),await this._transport.send(h,n)}setRequestHandler(t,n){const r=TL(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(a,s)=>{const i=NL(t,a);return Promise.resolve(n(i,s))})}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 r=TL(t);this._notificationHandlers.set(r,a=>{const s=NL(t,a);return Promise.resolve(n(s))})}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,r){var a;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const s=(a=this._options)===null||a===void 0?void 0:a.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r,s)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(t,n);for(const a of r)if(a.type==="request"&&FE(a.message)){const s=a.message.id,i=this._requestResolvers.get(s);i?(i(new ut(wt.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var r,a,s;let i=(a=(r=this._options)===null||r===void 0?void 0:r.defaultTaskPollInterval)!==null&&a!==void 0?a:1e3;try{const c=await((s=this._taskStore)===null||s===void 0?void 0:s.getTask(t));c?.pollInterval&&(i=c.pollInterval)}catch{}return new Promise((c,u)=>{if(n.aborted){u(new ut(wt.InvalidRequest,"Request cancelled"));return}const f=setTimeout(c,i);n.addEventListener("abort",()=>{clearTimeout(f),u(new ut(wt.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async a=>{if(!t)throw new Error("No request provided");return await r.createTask(a,t.id,{method:t.method,params:t.params},n)},getTask:async a=>{const s=await r.getTask(a,n);if(!s)throw new ut(wt.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(a,s,i)=>{await r.storeTaskResult(a,s,i,n);const c=await r.getTask(a,n);if(c){const u=Zg.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ol(c.status)&&this._cleanupTaskProgressHandler(a)}},getTaskResult:a=>r.getTaskResult(a,n),updateTaskStatus:async(a,s,i)=>{const c=await r.getTask(a,n);if(!c)throw new ut(wt.InvalidParams,`Task "${a}" not found - it may have been cleaned up`);if(ol(c.status))throw new ut(wt.InvalidParams,`Cannot update task "${a}" from terminal status "${c.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(a,s,i,n);const u=await r.getTask(a,n);if(u){const f=Zg.parse({method:"notifications/tasks/status",params:u});await this.notification(f),ol(u.status)&&this._cleanupTaskProgressHandler(a)}},listTasks:a=>r.listTasks(a,n)}}}function kL(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oq(e,t){const n={...e};for(const r in t){const a=r,s=t[a];if(s===void 0)continue;const i=n[a];kL(i)&&kL(s)?n[a]={...i,...s}:n[a]=s}return n}var ph={exports:{}},hw={},ps={},sl={},gw={},bw={},yw={},CL;function Xg(){return CL||(CL=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(S){if(super(),!e.IDENTIFIER.test(S))throw new Error("CodeGen: name must be a valid identifier");this.str=S}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(S){super(),this._items=typeof S=="string"?[S]:S}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const S=this._items[0];return S===""||S==='""'}get str(){var S;return(S=this._str)!==null&&S!==void 0?S:this._str=this._items.reduce((T,R)=>`${T}${R}`,"")}get names(){var S;return(S=this._names)!==null&&S!==void 0?S:this._names=this._items.reduce((T,R)=>(R instanceof n&&(T[R.str]=(T[R.str]||0)+1),T),{})}}e._Code=r,e.nil=new r("");function a(_,...S){const T=[_[0]];let R=0;for(;R<S.length;)c(T,S[R]),T.push(_[++R]);return new r(T)}e._=a;const s=new r("+");function i(_,...S){const T=[y(_[0])];let R=0;for(;R<S.length;)T.push(s),c(T,S[R]),T.push(s,y(_[++R]));return u(T),new r(T)}e.str=i;function c(_,S){S instanceof r?_.push(...S._items):S instanceof n?_.push(S):_.push(h(S))}e.addCodeArg=c;function u(_){let S=1;for(;S<_.length-1;){if(_[S]===s){const T=f(_[S-1],_[S+1]);if(T!==void 0){_.splice(S-1,3,T);continue}_[S++]="+"}S++}}function f(_,S){if(S==='""')return _;if(_==='""')return S;if(typeof _=="string")return S instanceof n||_[_.length-1]!=='"'?void 0:typeof S!="string"?`${_.slice(0,-1)}${S}"`:S[0]==='"'?_.slice(0,-1)+S.slice(1):void 0;if(typeof S=="string"&&S[0]==='"'&&!(_ instanceof n))return`"${_}${S.slice(1)}`}function m(_,S){return S.emptyStr()?_:_.emptyStr()?S:i`${_}${S}`}e.strConcat=m;function h(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:y(Array.isArray(_)?_.join(","):_)}function b(_){return new r(y(_))}e.stringify=b;function y(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=y;function x(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new r(`.${_}`):a`[${_}]`}e.getProperty=x;function E(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new r(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=E;function w(_){return new r(_.toString())}e.regexpCode=w})(yw)),yw}var vw={},RL;function AL(){return RL||(RL=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Xg();class n extends Error{constructor(f){super(`CodeGen: "code" for ${f} not defined`),this.value=f.value}}var r;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class a{constructor({prefixes:f,parent:m}={}){this._names={},this._prefixes=f,this._parent=m}toName(f){return f instanceof t.Name?f:this.name(f)}name(f){return new t.Name(this._newName(f))}_newName(f){const m=this._names[f]||this._nameGroup(f);return`${f}${m.index++}`}_nameGroup(f){var m,h;if(!((h=(m=this._parent)===null||m===void 0?void 0:m._prefixes)===null||h===void 0)&&h.has(f)||this._prefixes&&!this._prefixes.has(f))throw new Error(`CodeGen: prefix "${f}" is not allowed in this scope`);return this._names[f]={prefix:f,index:0}}}e.Scope=a;class s extends t.Name{constructor(f,m){super(m),this.prefix=f}setValue(f,{property:m,itemIndex:h}){this.value=f,this.scopePath=(0,t._)`.${new t.Name(m)}[${h}]`}}e.ValueScopeName=s;const i=(0,t._)`\n`;class c extends a{constructor(f){super(f),this._values={},this._scope=f.scope,this.opts={...f,_n:f.lines?i:t.nil}}get(){return this._scope}name(f){return new s(f,this._newName(f))}value(f,m){var h;if(m.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const b=this.toName(f),{prefix:y}=b,x=(h=m.key)!==null&&h!==void 0?h:m.ref;let E=this._values[y];if(E){const S=E.get(x);if(S)return S}else E=this._values[y]=new Map;E.set(x,b);const w=this._scope[y]||(this._scope[y]=[]),_=w.length;return w[_]=m.ref,b.setValue(m,{property:y,itemIndex:_}),b}getValue(f,m){const h=this._values[f];if(h)return h.get(m)}scopeRefs(f,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._)`${f}${h.scopePath}`})}scopeCode(f=this._values,m,h){return this._reduceValues(f,b=>{if(b.value===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return b.value.code},m,h)}_reduceValues(f,m,h={},b){let y=t.nil;for(const x in f){const E=f[x];if(!E)continue;const w=h[x]=h[x]||new Map;E.forEach(_=>{if(w.has(_))return;w.set(_,r.Started);let S=m(_);if(S){const T=this.opts.es5?e.varKinds.var:e.varKinds.const;y=(0,t._)`${y}${T} ${_} = ${S};${this.opts._n}`}else if(S=b?.(_))y=(0,t._)`${y}${S}${this.opts._n}`;else throw new n(_);w.set(_,r.Completed)})}return y}}e.ValueScope=c})(vw)),vw}var IL;function Mt(){return IL||(IL=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=Xg(),n=AL();var r=Xg();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var a=AL();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return a.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 s{optimizeNodes(){return this}optimizeNames(L,M){return this}}class i extends s{constructor(L,M,z){super(),this.varKind=L,this.name=M,this.rhs=z}render({es5:L,_n:M}){const z=L?n.varKinds.var:this.varKind,G=this.rhs===void 0?"":` = ${this.rhs}`;return`${z} ${this.name}${G};`+M}optimizeNames(L,M){if(L[this.name.str])return this.rhs&&(this.rhs=ee(this.rhs,L,M)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends s{constructor(L,M,z){super(),this.lhs=L,this.rhs=M,this.sideEffects=z}render({_n:L}){return`${this.lhs} = ${this.rhs};`+L}optimizeNames(L,M){if(!(this.lhs instanceof t.Name&&!L[this.lhs.str]&&!this.sideEffects))return this.rhs=ee(this.rhs,L,M),this}get names(){const L=this.lhs instanceof t.Name?{}:{...this.lhs.names};return J(L,this.rhs)}}class u extends c{constructor(L,M,z,G){super(L,z,G),this.op=M}render({_n:L}){return`${this.lhs} ${this.op}= ${this.rhs};`+L}}class f extends s{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`${this.label}:`+L}}class m extends s{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`break${this.label?` ${this.label}`:""};`+L}}class h extends s{constructor(L){super(),this.error=L}render({_n:L}){return`throw ${this.error};`+L}get names(){return this.error.names}}class b extends s{constructor(L){super(),this.code=L}render({_n:L}){return`${this.code};`+L}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(L,M){return this.code=ee(this.code,L,M),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class y extends s{constructor(L=[]){super(),this.nodes=L}render(L){return this.nodes.reduce((M,z)=>M+z.render(L),"")}optimizeNodes(){const{nodes:L}=this;let M=L.length;for(;M--;){const z=L[M].optimizeNodes();Array.isArray(z)?L.splice(M,1,...z):z?L[M]=z:L.splice(M,1)}return L.length>0?this:void 0}optimizeNames(L,M){const{nodes:z}=this;let G=z.length;for(;G--;){const q=z[G];q.optimizeNames(L,M)||(re(L,q.names),z.splice(G,1))}return z.length>0?this:void 0}get names(){return this.nodes.reduce((L,M)=>W(L,M.names),{})}}class x extends y{render(L){return"{"+L._n+super.render(L)+"}"+L._n}}class E extends y{}class w extends x{}w.kind="else";class _ extends x{constructor(L,M){super(M),this.condition=L}render(L){let M=`if(${this.condition})`+super.render(L);return this.else&&(M+="else "+this.else.render(L)),M}optimizeNodes(){super.optimizeNodes();const L=this.condition;if(L===!0)return this.nodes;let M=this.else;if(M){const z=M.optimizeNodes();M=this.else=Array.isArray(z)?new w(z):z}if(M)return L===!1?M instanceof _?M:M.nodes:this.nodes.length?this:new _(F(L),M instanceof _?[M]:M.nodes);if(!(L===!1||!this.nodes.length))return this}optimizeNames(L,M){var z;if(this.else=(z=this.else)===null||z===void 0?void 0:z.optimizeNames(L,M),!!(super.optimizeNames(L,M)||this.else))return this.condition=ee(this.condition,L,M),this}get names(){const L=super.names;return J(L,this.condition),this.else&&W(L,this.else.names),L}}_.kind="if";class S extends x{}S.kind="for";class T extends S{constructor(L){super(),this.iteration=L}render(L){return`for(${this.iteration})`+super.render(L)}optimizeNames(L,M){if(super.optimizeNames(L,M))return this.iteration=ee(this.iteration,L,M),this}get names(){return W(super.names,this.iteration.names)}}class R extends S{constructor(L,M,z,G){super(),this.varKind=L,this.name=M,this.from=z,this.to=G}render(L){const M=L.es5?n.varKinds.var:this.varKind,{name:z,from:G,to:q}=this;return`for(${M} ${z}=${G}; ${z}<${q}; ${z}++)`+super.render(L)}get names(){const L=J(super.names,this.from);return J(L,this.to)}}class C extends S{constructor(L,M,z,G){super(),this.loop=L,this.varKind=M,this.name=z,this.iterable=G}render(L){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(L)}optimizeNames(L,M){if(super.optimizeNames(L,M))return this.iterable=ee(this.iterable,L,M),this}get names(){return W(super.names,this.iterable.names)}}class I extends x{constructor(L,M,z){super(),this.name=L,this.args=M,this.async=z}render(L){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(L)}}I.kind="func";class A extends y{render(L){return"return "+super.render(L)}}A.kind="return";class O extends x{render(L){let M="try"+super.render(L);return this.catch&&(M+=this.catch.render(L)),this.finally&&(M+=this.finally.render(L)),M}optimizeNodes(){var L,M;return super.optimizeNodes(),(L=this.catch)===null||L===void 0||L.optimizeNodes(),(M=this.finally)===null||M===void 0||M.optimizeNodes(),this}optimizeNames(L,M){var z,G;return super.optimizeNames(L,M),(z=this.catch)===null||z===void 0||z.optimizeNames(L,M),(G=this.finally)===null||G===void 0||G.optimizeNames(L,M),this}get names(){const L=super.names;return this.catch&&W(L,this.catch.names),this.finally&&W(L,this.finally.names),L}}class j extends x{constructor(L){super(),this.error=L}render(L){return`catch(${this.error})`+super.render(L)}}j.kind="catch";class U extends x{render(L){return"finally"+super.render(L)}}U.kind="finally";class B{constructor(L,M={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...M,_n:M.lines?`
23
23
  `:""},this._extScope=L,this._scope=new n.Scope({parent:L}),this._nodes=[new E]}toString(){return this._root.render(this.opts)}name(L){return this._scope.name(L)}scopeName(L){return this._extScope.name(L)}scopeValue(L,M){const z=this._extScope.value(L,M);return(this._values[z.prefix]||(this._values[z.prefix]=new Set)).add(z),z}getScopeValue(L,M){return this._extScope.getValue(L,M)}scopeRefs(L){return this._extScope.scopeRefs(L,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(L,M,z,G){const q=this._scope.toName(M);return z!==void 0&&G&&(this._constants[q.str]=z),this._leafNode(new i(L,q,z)),q}const(L,M,z){return this._def(n.varKinds.const,L,M,z)}let(L,M,z){return this._def(n.varKinds.let,L,M,z)}var(L,M,z){return this._def(n.varKinds.var,L,M,z)}assign(L,M,z){return this._leafNode(new c(L,M,z))}add(L,M){return this._leafNode(new u(L,e.operators.ADD,M))}code(L){return typeof L=="function"?L():L!==t.nil&&this._leafNode(new b(L)),this}object(...L){const M=["{"];for(const[z,G]of L)M.length>1&&M.push(","),M.push(z),(z!==G||this.opts.es5)&&(M.push(":"),(0,t.addCodeArg)(M,G));return M.push("}"),new t._Code(M)}if(L,M,z){if(this._blockNode(new _(L)),M&&z)this.code(M).else().code(z).endIf();else if(M)this.code(M).endIf();else if(z)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(L){return this._elseNode(new _(L))}else(){return this._elseNode(new w)}endIf(){return this._endBlockNode(_,w)}_for(L,M){return this._blockNode(L),M&&this.code(M).endFor(),this}for(L,M){return this._for(new T(L),M)}forRange(L,M,z,G,q=this.opts.es5?n.varKinds.var:n.varKinds.let){const ae=this._scope.toName(L);return this._for(new R(q,ae,M,z),()=>G(ae))}forOf(L,M,z,G=n.varKinds.const){const q=this._scope.toName(L);if(this.opts.es5){const ae=M instanceof t.Name?M:this.var("_arr",M);return this.forRange("_i",0,(0,t._)`${ae}.length`,ie=>{this.var(q,(0,t._)`${ae}[${ie}]`),z(q)})}return this._for(new C("of",G,q,M),()=>z(q))}forIn(L,M,z,G=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(L,(0,t._)`Object.keys(${M})`,z);const q=this._scope.toName(L);return this._for(new C("in",G,q,M),()=>z(q))}endFor(){return this._endBlockNode(S)}label(L){return this._leafNode(new f(L))}break(L){return this._leafNode(new m(L))}return(L){const M=new A;if(this._blockNode(M),this.code(L),M.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(L,M,z){if(!M&&!z)throw new Error('CodeGen: "try" without "catch" and "finally"');const G=new O;if(this._blockNode(G),this.code(L),M){const q=this.name("e");this._currNode=G.catch=new j(q),M(q)}return z&&(this._currNode=G.finally=new U,this.code(z)),this._endBlockNode(j,U)}throw(L){return this._leafNode(new h(L))}block(L,M){return this._blockStarts.push(this._nodes.length),L&&this.code(L).endBlock(M),this}endBlock(L){const M=this._blockStarts.pop();if(M===void 0)throw new Error("CodeGen: not in self-balancing block");const z=this._nodes.length-M;if(z<0||L!==void 0&&z!==L)throw new Error(`CodeGen: wrong number of nodes: ${z} vs ${L} expected`);return this._nodes.length=M,this}func(L,M=t.nil,z,G){return this._blockNode(new I(L,M,z)),G&&this.code(G).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,M){const z=this._currNode;if(z instanceof L||M&&z instanceof M)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${M?`${L.kind}/${M.kind}`:L.kind}"`)}_elseNode(L){const M=this._currNode;if(!(M instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=M.else=L,this}get _root(){return this._nodes[0]}get _currNode(){const L=this._nodes;return L[L.length-1]}set _currNode(L){const M=this._nodes;M[M.length-1]=L}}e.CodeGen=B;function W($,L){for(const M in L)$[M]=($[M]||0)+(L[M]||0);return $}function J($,L){return L instanceof t._CodeOrName?W($,L.names):$}function ee($,L,M){if($ instanceof t.Name)return z($);if(!G($))return $;return new t._Code($._items.reduce((q,ae)=>(ae instanceof t.Name&&(ae=z(ae)),ae instanceof t._Code?q.push(...ae._items):q.push(ae),q),[]));function z(q){const ae=M[q.str];return ae===void 0||L[q.str]!==1?q:(delete L[q.str],ae)}function G(q){return q instanceof t._Code&&q._items.some(ae=>ae instanceof t.Name&&L[ae.str]===1&&M[ae.str]!==void 0)}}function re($,L){for(const M in L)$[M]=($[M]||0)-(L[M]||0)}function F($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:(0,t._)`!${H($)}`}e.not=F;const K=D(e.operators.AND);function V(...$){return $.reduce(K)}e.and=V;const ne=D(e.operators.OR);function te(...$){return $.reduce(ne)}e.or=te;function D($){return(L,M)=>L===t.nil?M:M===t.nil?L:(0,t._)`${H(L)} ${$} ${H(M)}`}function H($){return $ instanceof t.Name?$:(0,t._)`(${$})`}})(bw)),bw}var At={},OL;function on(){if(OL)return At;OL=1,Object.defineProperty(At,"__esModule",{value:!0}),At.checkStrictMode=At.getErrorPath=At.Type=At.useFunc=At.setEvaluated=At.evaluatedPropsToName=At.mergeEvaluated=At.eachItem=At.unescapeJsonPointer=At.escapeJsonPointer=At.escapeFragment=At.unescapeFragment=At.schemaRefOrVal=At.schemaHasRulesButRef=At.schemaHasRules=At.checkUnknownRules=At.alwaysValidSchema=At.toHash=void 0;const e=Mt(),t=Xg();function n(C){const I={};for(const A of C)I[A]=!0;return I}At.toHash=n;function r(C,I){return typeof I=="boolean"?I:Object.keys(I).length===0?!0:(a(C,I),!s(I,C.self.RULES.all))}At.alwaysValidSchema=r;function a(C,I=C.schema){const{opts:A,self:O}=C;if(!A.strictSchema||typeof I=="boolean")return;const j=O.RULES.keywords;for(const U in I)j[U]||R(C,`unknown keyword: "${U}"`)}At.checkUnknownRules=a;function s(C,I){if(typeof C=="boolean")return!C;for(const A in C)if(I[A])return!0;return!1}At.schemaHasRules=s;function i(C,I){if(typeof C=="boolean")return!C;for(const A in C)if(A!=="$ref"&&I.all[A])return!0;return!1}At.schemaHasRulesButRef=i;function c({topSchemaRef:C,schemaPath:I},A,O,j){if(!j){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,e._)`${A}`}return(0,e._)`${C}${I}${(0,e.getProperty)(O)}`}At.schemaRefOrVal=c;function u(C){return h(decodeURIComponent(C))}At.unescapeFragment=u;function f(C){return encodeURIComponent(m(C))}At.escapeFragment=f;function m(C){return typeof C=="number"?`${C}`:C.replace(/~/g,"~0").replace(/\//g,"~1")}At.escapeJsonPointer=m;function h(C){return C.replace(/~1/g,"/").replace(/~0/g,"~")}At.unescapeJsonPointer=h;function b(C,I){if(Array.isArray(C))for(const A of C)I(A);else I(C)}At.eachItem=b;function y({mergeNames:C,mergeToName:I,mergeValues:A,resultToName:O}){return(j,U,B,W)=>{const J=B===void 0?U:B instanceof e.Name?(U instanceof e.Name?C(j,U,B):I(j,U,B),B):U instanceof e.Name?(I(j,B,U),U):A(U,B);return W===e.Name&&!(J instanceof e.Name)?O(j,J):J}}At.mergeEvaluated={props:y({mergeNames:(C,I,A)=>C.if((0,e._)`${A} !== true && ${I} !== undefined`,()=>{C.if((0,e._)`${I} === true`,()=>C.assign(A,!0),()=>C.assign(A,(0,e._)`${A} || {}`).code((0,e._)`Object.assign(${A}, ${I})`))}),mergeToName:(C,I,A)=>C.if((0,e._)`${A} !== true`,()=>{I===!0?C.assign(A,!0):(C.assign(A,(0,e._)`${A} || {}`),E(C,A,I))}),mergeValues:(C,I)=>C===!0?!0:{...C,...I},resultToName:x}),items:y({mergeNames:(C,I,A)=>C.if((0,e._)`${A} !== true && ${I} !== undefined`,()=>C.assign(A,(0,e._)`${I} === true ? true : ${A} > ${I} ? ${A} : ${I}`)),mergeToName:(C,I,A)=>C.if((0,e._)`${A} !== true`,()=>C.assign(A,I===!0?!0:(0,e._)`${A} > ${I} ? ${A} : ${I}`)),mergeValues:(C,I)=>C===!0?!0:Math.max(C,I),resultToName:(C,I)=>C.var("items",I)})};function x(C,I){if(I===!0)return C.var("props",!0);const A=C.var("props",(0,e._)`{}`);return I!==void 0&&E(C,A,I),A}At.evaluatedPropsToName=x;function E(C,I,A){Object.keys(A).forEach(O=>C.assign((0,e._)`${I}${(0,e.getProperty)(O)}`,!0))}At.setEvaluated=E;const w={};function _(C,I){return C.scopeValue("func",{ref:I,code:w[I.code]||(w[I.code]=new t._Code(I.code))})}At.useFunc=_;var S;(function(C){C[C.Num=0]="Num",C[C.Str=1]="Str"})(S||(At.Type=S={}));function T(C,I,A){if(C instanceof e.Name){const O=I===S.Num;return A?O?(0,e._)`"[" + ${C} + "]"`:(0,e._)`"['" + ${C} + "']"`:O?(0,e._)`"/" + ${C}`:(0,e._)`"/" + ${C}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,e.getProperty)(C).toString():"/"+m(C)}At.getErrorPath=T;function R(C,I,A=C.opts.strictSchema){if(A){if(I=`strict mode: ${I}`,A===!0)throw new Error(I);C.self.logger.warn(I)}}return At.checkStrictMode=R,At}var mh={},DL;function ji(){if(DL)return mh;DL=1,Object.defineProperty(mh,"__esModule",{value:!0});const e=Mt(),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 mh.default=t,mh}var LL;function ry(){return LL||(LL=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=Mt(),n=on(),r=ji();e.keywordError={message:({keyword:w})=>(0,t.str)`must pass "${w}" keyword validation`},e.keyword$DataError={message:({keyword:w,schemaType:_})=>_?(0,t.str)`"${w}" keyword must be ${_} ($data)`:(0,t.str)`"${w}" keyword is invalid ($data)`};function a(w,_=e.keywordError,S,T){const{it:R}=w,{gen:C,compositeRule:I,allErrors:A}=R,O=h(w,_,S);T??(I||A)?u(C,O):f(R,(0,t._)`[${O}]`)}e.reportError=a;function s(w,_=e.keywordError,S){const{it:T}=w,{gen:R,compositeRule:C,allErrors:I}=T,A=h(w,_,S);u(R,A),C||I||f(T,r.default.vErrors)}e.reportExtraError=s;function i(w,_){w.assign(r.default.errors,_),w.if((0,t._)`${r.default.vErrors} !== null`,()=>w.if(_,()=>w.assign((0,t._)`${r.default.vErrors}.length`,_),()=>w.assign(r.default.vErrors,null)))}e.resetErrorsCount=i;function c({gen:w,keyword:_,schemaValue:S,data:T,errsCount:R,it:C}){if(R===void 0)throw new Error("ajv implementation error");const I=w.name("err");w.forRange("i",R,r.default.errors,A=>{w.const(I,(0,t._)`${r.default.vErrors}[${A}]`),w.if((0,t._)`${I}.instancePath === undefined`,()=>w.assign((0,t._)`${I}.instancePath`,(0,t.strConcat)(r.default.instancePath,C.errorPath))),w.assign((0,t._)`${I}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${_}`),C.opts.verbose&&(w.assign((0,t._)`${I}.schema`,S),w.assign((0,t._)`${I}.data`,T))})}e.extendErrors=c;function u(w,_){const S=w.const("err",_);w.if((0,t._)`${r.default.vErrors} === null`,()=>w.assign(r.default.vErrors,(0,t._)`[${S}]`),(0,t._)`${r.default.vErrors}.push(${S})`),w.code((0,t._)`${r.default.errors}++`)}function f(w,_){const{gen:S,validateName:T,schemaEnv:R}=w;R.$async?S.throw((0,t._)`new ${w.ValidationError}(${_})`):(S.assign((0,t._)`${T}.errors`,_),S.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(w,_,S){const{createErrors:T}=w.it;return T===!1?(0,t._)`{}`:b(w,_,S)}function b(w,_,S={}){const{gen:T,it:R}=w,C=[y(R,S),x(w,S)];return E(w,_,C),T.object(...C)}function y({errorPath:w},{instancePath:_}){const S=_?(0,t.str)`${w}${(0,n.getErrorPath)(_,n.Type.Str)}`:w;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,S)]}function x({keyword:w,it:{errSchemaPath:_}},{schemaPath:S,parentSchema:T}){let R=T?_:(0,t.str)`${_}/${w}`;return S&&(R=(0,t.str)`${R}${(0,n.getErrorPath)(S,n.Type.Str)}`),[m.schemaPath,R]}function E(w,{params:_,message:S},T){const{keyword:R,data:C,schemaValue:I,it:A}=w,{opts:O,propertyName:j,topSchemaRef:U,schemaPath:B}=A;T.push([m.keyword,R],[m.params,typeof _=="function"?_(w):_||(0,t._)`{}`]),O.messages&&T.push([m.message,typeof S=="function"?S(w):S]),O.verbose&&T.push([m.schema,I],[m.parentSchema,(0,t._)`${U}${B}`],[r.default.data,C]),j&&T.push([m.propertyName,j])}})(gw)),gw}var ML;function sq(){if(ML)return sl;ML=1,Object.defineProperty(sl,"__esModule",{value:!0}),sl.boolOrEmptySchema=sl.topBoolOrEmptySchema=void 0;const e=ry(),t=Mt(),n=ji(),r={message:"boolean schema is false"};function a(c){const{gen:u,schema:f,validateName:m}=c;f===!1?i(c,!1):typeof f=="object"&&f.$async===!0?u.return(n.default.data):(u.assign((0,t._)`${m}.errors`,null),u.return(!0))}sl.topBoolOrEmptySchema=a;function s(c,u){const{gen:f,schema:m}=c;m===!1?(f.var(u,!1),i(c)):f.var(u,!0)}sl.boolOrEmptySchema=s;function i(c,u){const{gen:f,data:m}=c,h={gen:f,keyword:"false schema",data:m,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,e.reportError)(h,r,void 0,u)}return sl}var Dr={},il={},jL;function b2(){if(jL)return il;jL=1,Object.defineProperty(il,"__esModule",{value:!0}),il.getRules=il.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function n(a){return typeof a=="string"&&t.has(a)}il.isJSONType=n;function r(){const a={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...a,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},a.number,a.string,a.array,a.object],post:{rules:[]},all:{},keywords:{}}}return il.getRules=r,il}var ms={},PL;function y2(){if(PL)return ms;PL=1,Object.defineProperty(ms,"__esModule",{value:!0}),ms.shouldUseRule=ms.shouldUseGroup=ms.schemaHasRulesForType=void 0;function e({schema:r,self:a},s){const i=a.RULES.types[s];return i&&i!==!0&&t(r,i)}ms.schemaHasRulesForType=e;function t(r,a){return a.rules.some(s=>n(r,s))}ms.shouldUseGroup=t;function n(r,a){var s;return r[a.keyword]!==void 0||((s=a.definition.implements)===null||s===void 0?void 0:s.some(i=>r[i]!==void 0))}return ms.shouldUseRule=n,ms}var UL;function Jg(){if(UL)return Dr;UL=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.reportTypeError=Dr.checkDataTypes=Dr.checkDataType=Dr.coerceAndCheckDataType=Dr.getJSONTypes=Dr.getSchemaTypes=Dr.DataType=void 0;const e=b2(),t=y2(),n=ry(),r=Mt(),a=on();var s;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(s||(Dr.DataType=s={}));function i(S){const T=c(S.type);if(T.includes("null")){if(S.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!T.length&&S.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');S.nullable===!0&&T.push("null")}return T}Dr.getSchemaTypes=i;function c(S){const T=Array.isArray(S)?S:S?[S]:[];if(T.every(e.isJSONType))return T;throw new Error("type must be JSONType or JSONType[]: "+T.join(","))}Dr.getJSONTypes=c;function u(S,T){const{gen:R,data:C,opts:I}=S,A=m(T,I.coerceTypes),O=T.length>0&&!(A.length===0&&T.length===1&&(0,t.schemaHasRulesForType)(S,T[0]));if(O){const j=x(T,C,I.strictNumbers,s.Wrong);R.if(j,()=>{A.length?h(S,T,A):w(S)})}return O}Dr.coerceAndCheckDataType=u;const f=new Set(["string","number","integer","boolean","null"]);function m(S,T){return T?S.filter(R=>f.has(R)||T==="array"&&R==="array"):[]}function h(S,T,R){const{gen:C,data:I,opts:A}=S,O=C.let("dataType",(0,r._)`typeof ${I}`),j=C.let("coerced",(0,r._)`undefined`);A.coerceTypes==="array"&&C.if((0,r._)`${O} == 'object' && Array.isArray(${I}) && ${I}.length == 1`,()=>C.assign(I,(0,r._)`${I}[0]`).assign(O,(0,r._)`typeof ${I}`).if(x(T,I,A.strictNumbers),()=>C.assign(j,I))),C.if((0,r._)`${j} !== undefined`);for(const B of R)(f.has(B)||B==="array"&&A.coerceTypes==="array")&&U(B);C.else(),w(S),C.endIf(),C.if((0,r._)`${j} !== undefined`,()=>{C.assign(I,j),b(S,j)});function U(B){switch(B){case"string":C.elseIf((0,r._)`${O} == "number" || ${O} == "boolean"`).assign(j,(0,r._)`"" + ${I}`).elseIf((0,r._)`${I} === null`).assign(j,(0,r._)`""`);return;case"number":C.elseIf((0,r._)`${O} == "boolean" || ${I} === null
24
24
  || (${O} == "string" && ${I} && ${I} == +${I})`).assign(j,(0,r._)`+${I}`);return;case"integer":C.elseIf((0,r._)`${O} === "boolean" || ${I} === null
25
25
  || (${O} === "string" && ${I} && ${I} == +${I} && !(${I} % 1))`).assign(j,(0,r._)`+${I}`);return;case"boolean":C.elseIf((0,r._)`${I} === "false" || ${I} === 0 || ${I} === null`).assign(j,!1).elseIf((0,r._)`${I} === "true" || ${I} === 1`).assign(j,!0);return;case"null":C.elseIf((0,r._)`${I} === "" || ${I} === 0 || ${I} === false`),C.assign(j,null);return;case"array":C.elseIf((0,r._)`${O} === "string" || ${O} === "number"
26
26
  || ${O} === "boolean" || ${I} === null`).assign(j,(0,r._)`[${I}]`)}}}function b({gen:S,parentData:T,parentDataProperty:R},C){S.if((0,r._)`${T} !== undefined`,()=>S.assign((0,r._)`${T}[${R}]`,C))}function y(S,T,R,C=s.Correct){const I=C===s.Correct?r.operators.EQ:r.operators.NEQ;let A;switch(S){case"null":return(0,r._)`${T} ${I} null`;case"array":A=(0,r._)`Array.isArray(${T})`;break;case"object":A=(0,r._)`${T} && typeof ${T} == "object" && !Array.isArray(${T})`;break;case"integer":A=O((0,r._)`!(${T} % 1) && !isNaN(${T})`);break;case"number":A=O();break;default:return(0,r._)`typeof ${T} ${I} ${S}`}return C===s.Correct?A:(0,r.not)(A);function O(j=r.nil){return(0,r.and)((0,r._)`typeof ${T} == "number"`,j,R?(0,r._)`isFinite(${T})`:r.nil)}}Dr.checkDataType=y;function x(S,T,R,C){if(S.length===1)return y(S[0],T,R,C);let I;const A=(0,a.toHash)(S);if(A.array&&A.object){const O=(0,r._)`typeof ${T} != "object"`;I=A.null?O:(0,r._)`!${T} || ${O}`,delete A.null,delete A.array,delete A.object}else I=r.nil;A.number&&delete A.integer;for(const O in A)I=(0,r.and)(I,y(O,T,R,C));return I}Dr.checkDataTypes=x;const E={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:T})=>typeof S=="string"?(0,r._)`{type: ${S}}`:(0,r._)`{type: ${T}}`};function w(S){const T=_(S);(0,n.reportError)(T,E)}Dr.reportTypeError=w;function _(S){const{gen:T,data:R,schema:C}=S,I=(0,a.schemaRefOrVal)(S,C,"type");return{gen:T,keyword:"type",data:R,schema:C.type,schemaCode:I,schemaValue:I,parentSchema:C,params:{},it:S}}return Dr}var rf={},$L;function iq(){if($L)return rf;$L=1,Object.defineProperty(rf,"__esModule",{value:!0}),rf.assignDefaults=void 0;const e=Mt(),t=on();function n(a,s){const{properties:i,items:c}=a.schema;if(s==="object"&&i)for(const u in i)r(a,u,i[u].default);else s==="array"&&Array.isArray(c)&&c.forEach((u,f)=>r(a,f,u.default))}rf.assignDefaults=n;function r(a,s,i){const{gen:c,compositeRule:u,data:f,opts:m}=a;if(i===void 0)return;const h=(0,e._)`${f}${(0,e.getProperty)(s)}`;if(u){(0,t.checkStrictMode)(a,`default is ignored for: ${h}`);return}let b=(0,e._)`${h} === undefined`;m.useDefaults==="empty"&&(b=(0,e._)`${b} || ${h} === null || ${h} === ""`),c.if(b,(0,e._)`${h} = ${(0,e.stringify)(i)}`)}return rf}var uo={},yn={},zL;function To(){if(zL)return yn;zL=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.validateUnion=yn.validateArray=yn.usePattern=yn.callValidateCode=yn.schemaProperties=yn.allSchemaProperties=yn.noPropertyInData=yn.propertyInData=yn.isOwnProperty=yn.hasPropFunc=yn.reportMissingProp=yn.checkMissingProp=yn.checkReportMissingProp=void 0;const e=Mt(),t=on(),n=ji(),r=on();function a(S,T){const{gen:R,data:C,it:I}=S;R.if(m(R,C,T,I.opts.ownProperties),()=>{S.setParams({missingProperty:(0,e._)`${T}`},!0),S.error()})}yn.checkReportMissingProp=a;function s({gen:S,data:T,it:{opts:R}},C,I){return(0,e.or)(...C.map(A=>(0,e.and)(m(S,T,A,R.ownProperties),(0,e._)`${I} = ${A}`)))}yn.checkMissingProp=s;function i(S,T){S.setParams({missingProperty:T},!0),S.error()}yn.reportMissingProp=i;function c(S){return S.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}yn.hasPropFunc=c;function u(S,T,R){return(0,e._)`${c(S)}.call(${T}, ${R})`}yn.isOwnProperty=u;function f(S,T,R,C){const I=(0,e._)`${T}${(0,e.getProperty)(R)} !== undefined`;return C?(0,e._)`${I} && ${u(S,T,R)}`:I}yn.propertyInData=f;function m(S,T,R,C){const I=(0,e._)`${T}${(0,e.getProperty)(R)} === undefined`;return C?(0,e.or)(I,(0,e.not)(u(S,T,R))):I}yn.noPropertyInData=m;function h(S){return S?Object.keys(S).filter(T=>T!=="__proto__"):[]}yn.allSchemaProperties=h;function b(S,T){return h(T).filter(R=>!(0,t.alwaysValidSchema)(S,T[R]))}yn.schemaProperties=b;function y({schemaCode:S,data:T,it:{gen:R,topSchemaRef:C,schemaPath:I,errorPath:A},it:O},j,U,B){const W=B?(0,e._)`${S}, ${T}, ${C}${I}`:T,J=[[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&&J.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const ee=(0,e._)`${W}, ${R.object(...J)}`;return U!==e.nil?(0,e._)`${j}.call(${U}, ${ee})`:(0,e._)`${j}(${ee})`}yn.callValidateCode=y;const x=(0,e._)`new RegExp`;function E({gen:S,it:{opts:T}},R){const C=T.unicodeRegExp?"u":"",{regExp:I}=T.code,A=I(R,C);return S.scopeValue("pattern",{key:A.toString(),ref:A,code:(0,e._)`${I.code==="new RegExp"?x:(0,r.useFunc)(S,I)}(${R}, ${C})`})}yn.usePattern=E;function w(S){const{gen:T,data:R,keyword:C,it:I}=S,A=T.name("valid");if(I.allErrors){const j=T.let("valid",!0);return O(()=>T.assign(j,!1)),j}return T.var(A,!0),O(()=>T.break()),A;function O(j){const U=T.const("len",(0,e._)`${R}.length`);T.forRange("i",0,U,B=>{S.subschema({keyword:C,dataProp:B,dataPropType:t.Type.Num},A),T.if((0,e.not)(A),j)})}}yn.validateArray=w;function _(S){const{gen:T,schema:R,keyword:C,it:I}=S;if(!Array.isArray(R))throw new Error("ajv implementation error");if(R.some(U=>(0,t.alwaysValidSchema)(I,U))&&!I.opts.unevaluated)return;const O=T.let("valid",!1),j=T.name("_valid");T.block(()=>R.forEach((U,B)=>{const W=S.subschema({keyword:C,schemaProp:B,compositeRule:!0},j);T.assign(O,(0,e._)`${O} || ${j}`),S.mergeValidEvaluated(W,j)||T.if((0,e.not)(O))})),S.result(O,()=>S.reset(),()=>S.error(!0))}return yn.validateUnion=_,yn}var FL;function lq(){if(FL)return uo;FL=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.validateKeywordUsage=uo.validSchemaType=uo.funcKeywordCode=uo.macroKeywordCode=void 0;const e=Mt(),t=ji(),n=To(),r=ry();function a(b,y){const{gen:x,keyword:E,schema:w,parentSchema:_,it:S}=b,T=y.macro.call(S.self,w,_,S),R=f(x,E,T);S.opts.validateSchema!==!1&&S.self.validateSchema(T,!0);const C=x.name("valid");b.subschema({schema:T,schemaPath:e.nil,errSchemaPath:`${S.errSchemaPath}/${E}`,topSchemaRef:R,compositeRule:!0},C),b.pass(C,()=>b.error(!0))}uo.macroKeywordCode=a;function s(b,y){var x;const{gen:E,keyword:w,schema:_,parentSchema:S,$data:T,it:R}=b;u(R,y);const C=!T&&y.compile?y.compile.call(R.self,_,S,R):y.validate,I=f(E,w,C),A=E.let("valid");b.block$data(A,O),b.ok((x=y.valid)!==null&&x!==void 0?x:A);function O(){if(y.errors===!1)B(),y.modifying&&i(b),W(()=>b.error());else{const J=y.async?j():U();y.modifying&&i(b),W(()=>c(b,J))}}function j(){const J=E.let("ruleErrs",null);return E.try(()=>B((0,e._)`await `),ee=>E.assign(A,!1).if((0,e._)`${ee} instanceof ${R.ValidationError}`,()=>E.assign(J,(0,e._)`${ee}.errors`),()=>E.throw(ee))),J}function U(){const J=(0,e._)`${I}.errors`;return E.assign(J,null),B(e.nil),J}function B(J=y.async?(0,e._)`await `:e.nil){const ee=R.opts.passContext?t.default.this:t.default.self,re=!("compile"in y&&!T||y.schema===!1);E.assign(A,(0,e._)`${J}${(0,n.callValidateCode)(b,I,ee,re)}`,y.modifying)}function W(J){var ee;E.if((0,e.not)((ee=y.valid)!==null&&ee!==void 0?ee:A),J)}}uo.funcKeywordCode=s;function i(b){const{gen:y,data:x,it:E}=b;y.if(E.parentData,()=>y.assign(x,(0,e._)`${E.parentData}[${E.parentDataProperty}]`))}function c(b,y){const{gen:x}=b;x.if((0,e._)`Array.isArray(${y})`,()=>{x.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${y} : ${t.default.vErrors}.concat(${y})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,r.extendErrors)(b)},()=>b.error())}function u({schemaEnv:b},y){if(y.async&&!b.$async)throw new Error("async keyword in sync schema")}function f(b,y,x){if(x===void 0)throw new Error(`keyword "${y}" failed to compile`);return b.scopeValue("keyword",typeof x=="function"?{ref:x}:{ref:x,code:(0,e.stringify)(x)})}function m(b,y,x=!1){return!y.length||y.some(E=>E==="array"?Array.isArray(b):E==="object"?b&&typeof b=="object"&&!Array.isArray(b):typeof b==E||x&&typeof b>"u")}uo.validSchemaType=m;function h({schema:b,opts:y,self:x,errSchemaPath:E},w,_){if(Array.isArray(w.keyword)?!w.keyword.includes(_):w.keyword!==_)throw new Error("ajv implementation error");const S=w.dependencies;if(S?.some(T=>!Object.prototype.hasOwnProperty.call(b,T)))throw new Error(`parent schema must have dependencies of ${_}: ${S.join(",")}`);if(w.validateSchema&&!w.validateSchema(b[_])){const R=`keyword "${_}" value is invalid at path "${E}": `+x.errorsText(w.validateSchema.errors);if(y.validateSchema==="log")x.logger.error(R);else throw new Error(R)}}return uo.validateKeywordUsage=h,uo}var hs={},BL;function cq(){if(BL)return hs;BL=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.extendSubschemaMode=hs.extendSubschemaData=hs.getSubschema=void 0;const e=Mt(),t=on();function n(s,{keyword:i,schemaProp:c,schema:u,schemaPath:f,errSchemaPath:m,topSchemaRef:h}){if(i!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const b=s.schema[i];return c===void 0?{schema:b,schemaPath:(0,e._)`${s.schemaPath}${(0,e.getProperty)(i)}`,errSchemaPath:`${s.errSchemaPath}/${i}`}:{schema:b[c],schemaPath:(0,e._)`${s.schemaPath}${(0,e.getProperty)(i)}${(0,e.getProperty)(c)}`,errSchemaPath:`${s.errSchemaPath}/${i}/${(0,t.escapeFragment)(c)}`}}if(u!==void 0){if(f===void 0||m===void 0||h===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:f,topSchemaRef:h,errSchemaPath:m}}throw new Error('either "keyword" or "schema" must be passed')}hs.getSubschema=n;function r(s,i,{dataProp:c,dataPropType:u,data:f,dataTypes:m,propertyName:h}){if(f!==void 0&&c!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:b}=i;if(c!==void 0){const{errorPath:x,dataPathArr:E,opts:w}=i,_=b.let("data",(0,e._)`${i.data}${(0,e.getProperty)(c)}`,!0);y(_),s.errorPath=(0,e.str)`${x}${(0,t.getErrorPath)(c,u,w.jsPropertySyntax)}`,s.parentDataProperty=(0,e._)`${c}`,s.dataPathArr=[...E,s.parentDataProperty]}if(f!==void 0){const x=f instanceof e.Name?f:b.let("data",f,!0);y(x),h!==void 0&&(s.propertyName=h)}m&&(s.dataTypes=m);function y(x){s.data=x,s.dataLevel=i.dataLevel+1,s.dataTypes=[],i.definedProperties=new Set,s.parentData=i.data,s.dataNames=[...i.dataNames,x]}}hs.extendSubschemaData=r;function a(s,{jtdDiscriminator:i,jtdMetadata:c,compositeRule:u,createErrors:f,allErrors:m}){u!==void 0&&(s.compositeRule=u),f!==void 0&&(s.createErrors=f),m!==void 0&&(s.allErrors=m),s.jtdDiscriminator=i,s.jtdMetadata=c}return hs.extendSubschemaMode=a,hs}var na={},ww,HL;function v2(){return HL||(HL=1,ww=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 r,a,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(a=r;a--!==0;)if(!e(t[a],n[a]))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(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(a=r;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[a]))return!1;for(a=r;a--!==0;){var i=s[a];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}),ww}var Ew={exports:{}},VL;function uq(){if(VL)return Ew.exports;VL=1;var e=Ew.exports=function(r,a,s){typeof a=="function"&&(s=a,a={}),s=a.cb||s;var i=typeof s=="function"?s:s.pre||function(){},c=s.post||function(){};t(a,i,c,r,"",r)};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(r,a,s,i,c,u,f,m,h,b){if(i&&typeof i=="object"&&!Array.isArray(i)){a(i,c,u,f,m,h,b);for(var y in i){var x=i[y];if(Array.isArray(x)){if(y in e.arrayKeywords)for(var E=0;E<x.length;E++)t(r,a,s,x[E],c+"/"+y+"/"+E,u,c,y,i,E)}else if(y in e.propsKeywords){if(x&&typeof x=="object")for(var w in x)t(r,a,s,x[w],c+"/"+y+"/"+n(w),u,c,y,i,w)}else(y in e.keywords||r.allKeys&&!(y in e.skipKeywords))&&t(r,a,s,x,c+"/"+y,u,c,y,i)}s(i,c,u,f,m,h,b)}}function n(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}return Ew.exports}var GL;function ay(){if(GL)return na;GL=1,Object.defineProperty(na,"__esModule",{value:!0}),na.getSchemaRefs=na.resolveUrl=na.normalizeId=na._getFullPath=na.getFullPath=na.inlineRef=void 0;const e=on(),t=v2(),n=uq(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function a(E,w=!0){return typeof E=="boolean"?!0:w===!0?!i(E):w?c(E)<=w:!1}na.inlineRef=a;const s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(E){for(const w in E){if(s.has(w))return!0;const _=E[w];if(Array.isArray(_)&&_.some(i)||typeof _=="object"&&i(_))return!0}return!1}function c(E){let w=0;for(const _ in E){if(_==="$ref")return 1/0;if(w++,!r.has(_)&&(typeof E[_]=="object"&&(0,e.eachItem)(E[_],S=>w+=c(S)),w===1/0))return 1/0}return w}function u(E,w="",_){_!==!1&&(w=h(w));const S=E.parse(w);return f(E,S)}na.getFullPath=u;function f(E,w){return E.serialize(w).split("#")[0]+"#"}na._getFullPath=f;const m=/#\/?$/;function h(E){return E?E.replace(m,""):""}na.normalizeId=h;function b(E,w,_){return _=h(_),E.resolve(w,_)}na.resolveUrl=b;const y=/^[a-z_][-a-z0-9._]*$/i;function x(E,w){if(typeof E=="boolean")return{};const{schemaId:_,uriResolver:S}=this.opts,T=h(E[_]||w),R={"":T},C=u(S,T,!1),I={},A=new Set;return n(E,{allKeys:!0},(U,B,W,J)=>{if(J===void 0)return;const ee=C+B;let re=R[J];typeof U[_]=="string"&&(re=F.call(this,U[_])),K.call(this,U.$anchor),K.call(this,U.$dynamicAnchor),R[B]=re;function F(V){const ne=this.opts.uriResolver.resolve;if(V=h(re?ne(re,V):V),A.has(V))throw j(V);A.add(V);let te=this.refs[V];return typeof te=="string"&&(te=this.refs[te]),typeof te=="object"?O(U,te.schema,V):V!==h(ee)&&(V[0]==="#"?(O(U,I[V],V),I[V]=U):this.refs[V]=ee),V}function K(V){if(typeof V=="string"){if(!y.test(V))throw new Error(`invalid anchor "${V}"`);F.call(this,`#${V}`)}}}),I;function O(U,B,W){if(B!==void 0&&!t(U,B))throw j(W)}function j(U){return new Error(`reference "${U}" resolves to more than one schema`)}}return na.getSchemaRefs=x,na}var WL;function oy(){if(WL)return ps;WL=1,Object.defineProperty(ps,"__esModule",{value:!0}),ps.getData=ps.KeywordCxt=ps.validateFunctionCode=void 0;const e=sq(),t=Jg(),n=y2(),r=Jg(),a=iq(),s=lq(),i=cq(),c=Mt(),u=ji(),f=ay(),m=on(),h=ry();function b(X){if(C(X)&&(A(X),R(X))){w(X);return}y(X,()=>(0,e.topBoolOrEmptySchema)(X))}ps.validateFunctionCode=b;function y({gen:X,validateName:Z,schema:se,schemaEnv:me,opts:le},Te){le.code.es5?X.func(Z,(0,c._)`${u.default.data}, ${u.default.valCxt}`,me.$async,()=>{X.code((0,c._)`"use strict"; ${S(se,le)}`),E(X,le),X.code(Te)}):X.func(Z,(0,c._)`${u.default.data}, ${x(le)}`,me.$async,()=>X.code(S(se,le)).code(Te))}function x(X){return(0,c._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${X.dynamicRef?(0,c._)`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function E(X,Z){X.if(u.default.valCxt,()=>{X.var(u.default.instancePath,(0,c._)`${u.default.valCxt}.${u.default.instancePath}`),X.var(u.default.parentData,(0,c._)`${u.default.valCxt}.${u.default.parentData}`),X.var(u.default.parentDataProperty,(0,c._)`${u.default.valCxt}.${u.default.parentDataProperty}`),X.var(u.default.rootData,(0,c._)`${u.default.valCxt}.${u.default.rootData}`),Z.dynamicRef&&X.var(u.default.dynamicAnchors,(0,c._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{X.var(u.default.instancePath,(0,c._)`""`),X.var(u.default.parentData,(0,c._)`undefined`),X.var(u.default.parentDataProperty,(0,c._)`undefined`),X.var(u.default.rootData,u.default.data),Z.dynamicRef&&X.var(u.default.dynamicAnchors,(0,c._)`{}`)})}function w(X){const{schema:Z,opts:se,gen:me}=X;y(X,()=>{se.$comment&&Z.$comment&&J(X),U(X),me.let(u.default.vErrors,null),me.let(u.default.errors,0),se.unevaluated&&_(X),O(X),ee(X)})}function _(X){const{gen:Z,validateName:se}=X;X.evaluated=Z.const("evaluated",(0,c._)`${se}.evaluated`),Z.if((0,c._)`${X.evaluated}.dynamicProps`,()=>Z.assign((0,c._)`${X.evaluated}.props`,(0,c._)`undefined`)),Z.if((0,c._)`${X.evaluated}.dynamicItems`,()=>Z.assign((0,c._)`${X.evaluated}.items`,(0,c._)`undefined`))}function S(X,Z){const se=typeof X=="object"&&X[Z.schemaId];return se&&(Z.code.source||Z.code.process)?(0,c._)`/*# sourceURL=${se} */`:c.nil}function T(X,Z){if(C(X)&&(A(X),R(X))){I(X,Z);return}(0,e.boolOrEmptySchema)(X,Z)}function R({schema:X,self:Z}){if(typeof X=="boolean")return!X;for(const se in X)if(Z.RULES.all[se])return!0;return!1}function C(X){return typeof X.schema!="boolean"}function I(X,Z){const{schema:se,gen:me,opts:le}=X;le.$comment&&se.$comment&&J(X),B(X),W(X);const Te=me.const("_errs",u.default.errors);O(X,Te),me.var(Z,(0,c._)`${Te} === ${u.default.errors}`)}function A(X){(0,m.checkUnknownRules)(X),j(X)}function O(X,Z){if(X.opts.jtd)return F(X,[],!1,Z);const se=(0,t.getSchemaTypes)(X.schema),me=(0,t.coerceAndCheckDataType)(X,se);F(X,se,!me,Z)}function j(X){const{schema:Z,errSchemaPath:se,opts:me,self:le}=X;Z.$ref&&me.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(Z,le.RULES)&&le.logger.warn(`$ref: keywords ignored in schema at path "${se}"`)}function U(X){const{schema:Z,opts:se}=X;Z.default!==void 0&&se.useDefaults&&se.strictSchema&&(0,m.checkStrictMode)(X,"default is ignored in the schema root")}function B(X){const Z=X.schema[X.opts.schemaId];Z&&(X.baseId=(0,f.resolveUrl)(X.opts.uriResolver,X.baseId,Z))}function W(X){if(X.schema.$async&&!X.schemaEnv.$async)throw new Error("async schema in sync schema")}function J({gen:X,schemaEnv:Z,schema:se,errSchemaPath:me,opts:le}){const Te=se.$comment;if(le.$comment===!0)X.code((0,c._)`${u.default.self}.logger.log(${Te})`);else if(typeof le.$comment=="function"){const Be=(0,c.str)`${me}/$comment`,Ee=X.scopeValue("root",{ref:Z.root});X.code((0,c._)`${u.default.self}.opts.$comment(${Te}, ${Be}, ${Ee}.schema)`)}}function ee(X){const{gen:Z,schemaEnv:se,validateName:me,ValidationError:le,opts:Te}=X;se.$async?Z.if((0,c._)`${u.default.errors} === 0`,()=>Z.return(u.default.data),()=>Z.throw((0,c._)`new ${le}(${u.default.vErrors})`)):(Z.assign((0,c._)`${me}.errors`,u.default.vErrors),Te.unevaluated&&re(X),Z.return((0,c._)`${u.default.errors} === 0`))}function re({gen:X,evaluated:Z,props:se,items:me}){se instanceof c.Name&&X.assign((0,c._)`${Z}.props`,se),me instanceof c.Name&&X.assign((0,c._)`${Z}.items`,me)}function F(X,Z,se,me){const{gen:le,schema:Te,data:Be,allErrors:Ee,opts:_e,self:Ue}=X,{RULES:fe}=Ue;if(Te.$ref&&(_e.ignoreKeywordsWithRef||!(0,m.schemaHasRulesButRef)(Te,fe))){le.block(()=>G(X,"$ref",fe.all.$ref.definition));return}_e.jtd||V(X,Z),le.block(()=>{for(const ze of fe.rules)Ae(ze);Ae(fe.post)});function Ae(ze){(0,n.shouldUseGroup)(Te,ze)&&(ze.type?(le.if((0,r.checkDataType)(ze.type,Be,_e.strictNumbers)),K(X,ze),Z.length===1&&Z[0]===ze.type&&se&&(le.else(),(0,r.reportTypeError)(X)),le.endIf()):K(X,ze),Ee||le.if((0,c._)`${u.default.errors} === ${me||0}`))}}function K(X,Z){const{gen:se,schema:me,opts:{useDefaults:le}}=X;le&&(0,a.assignDefaults)(X,Z.type),se.block(()=>{for(const Te of Z.rules)(0,n.shouldUseRule)(me,Te)&&G(X,Te.keyword,Te.definition,Z.type)})}function V(X,Z){X.schemaEnv.meta||!X.opts.strictTypes||(ne(X,Z),X.opts.allowUnionTypes||te(X,Z),D(X,X.dataTypes))}function ne(X,Z){if(Z.length){if(!X.dataTypes.length){X.dataTypes=Z;return}Z.forEach(se=>{$(X.dataTypes,se)||M(X,`type "${se}" not allowed by context "${X.dataTypes.join(",")}"`)}),L(X,Z)}}function te(X,Z){Z.length>1&&!(Z.length===2&&Z.includes("null"))&&M(X,"use allowUnionTypes to allow union type keyword")}function D(X,Z){const se=X.self.RULES.all;for(const me in se){const le=se[me];if(typeof le=="object"&&(0,n.shouldUseRule)(X.schema,le)){const{type:Te}=le.definition;Te.length&&!Te.some(Be=>H(Z,Be))&&M(X,`missing type "${Te.join(",")}" for keyword "${me}"`)}}}function H(X,Z){return X.includes(Z)||Z==="number"&&X.includes("integer")}function $(X,Z){return X.includes(Z)||Z==="integer"&&X.includes("number")}function L(X,Z){const se=[];for(const me of X.dataTypes)$(Z,me)?se.push(me):Z.includes("integer")&&me==="number"&&se.push("integer");X.dataTypes=se}function M(X,Z){const se=X.schemaEnv.baseId+X.errSchemaPath;Z+=` at "${se}" (strictTypes)`,(0,m.checkStrictMode)(X,Z,X.opts.strictTypes)}class z{constructor(Z,se,me){if((0,s.validateKeywordUsage)(Z,se,me),this.gen=Z.gen,this.allErrors=Z.allErrors,this.keyword=me,this.data=Z.data,this.schema=Z.schema[me],this.$data=se.$data&&Z.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,m.schemaRefOrVal)(Z,this.schema,me,this.$data),this.schemaType=se.schemaType,this.parentSchema=Z.schema,this.params={},this.it=Z,this.def=se,this.$data)this.schemaCode=Z.gen.const("vSchema",ie(this.$data,Z));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,se.schemaType,se.allowUndefined))throw new Error(`${me} value must be ${JSON.stringify(se.schemaType)}`);("code"in se?se.trackErrors:se.errors!==!1)&&(this.errsCount=Z.gen.const("_errs",u.default.errors))}result(Z,se,me){this.failResult((0,c.not)(Z),se,me)}failResult(Z,se,me){this.gen.if(Z),me?me():this.error(),se?(this.gen.else(),se(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(Z,se){this.failResult((0,c.not)(Z),void 0,se)}fail(Z){if(Z===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(Z),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(Z){if(!this.$data)return this.fail(Z);const{schemaCode:se}=this;this.fail((0,c._)`${se} !== undefined && (${(0,c.or)(this.invalid$data(),Z)})`)}error(Z,se,me){if(se){this.setParams(se),this._error(Z,me),this.setParams({});return}this._error(Z,me)}_error(Z,se){(Z?h.reportExtraError:h.reportError)(this,this.def.error,se)}$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(Z){this.allErrors||this.gen.if(Z)}setParams(Z,se){se?Object.assign(this.params,Z):this.params=Z}block$data(Z,se,me=c.nil){this.gen.block(()=>{this.check$data(Z,me),se()})}check$data(Z=c.nil,se=c.nil){if(!this.$data)return;const{gen:me,schemaCode:le,schemaType:Te,def:Be}=this;me.if((0,c.or)((0,c._)`${le} === undefined`,se)),Z!==c.nil&&me.assign(Z,!0),(Te.length||Be.validateSchema)&&(me.elseIf(this.invalid$data()),this.$dataError(),Z!==c.nil&&me.assign(Z,!1)),me.else()}invalid$data(){const{gen:Z,schemaCode:se,schemaType:me,def:le,it:Te}=this;return(0,c.or)(Be(),Ee());function Be(){if(me.length){if(!(se instanceof c.Name))throw new Error("ajv implementation error");const _e=Array.isArray(me)?me:[me];return(0,c._)`${(0,r.checkDataTypes)(_e,se,Te.opts.strictNumbers,r.DataType.Wrong)}`}return c.nil}function Ee(){if(le.validateSchema){const _e=Z.scopeValue("validate$data",{ref:le.validateSchema});return(0,c._)`!${_e}(${se})`}return c.nil}}subschema(Z,se){const me=(0,i.getSubschema)(this.it,Z);(0,i.extendSubschemaData)(me,this.it,Z),(0,i.extendSubschemaMode)(me,Z);const le={...this.it,...me,items:void 0,props:void 0};return T(le,se),le}mergeEvaluated(Z,se){const{it:me,gen:le}=this;me.opts.unevaluated&&(me.props!==!0&&Z.props!==void 0&&(me.props=m.mergeEvaluated.props(le,Z.props,me.props,se)),me.items!==!0&&Z.items!==void 0&&(me.items=m.mergeEvaluated.items(le,Z.items,me.items,se)))}mergeValidEvaluated(Z,se){const{it:me,gen:le}=this;if(me.opts.unevaluated&&(me.props!==!0||me.items!==!0))return le.if(se,()=>this.mergeEvaluated(Z,c.Name)),!0}}ps.KeywordCxt=z;function G(X,Z,se,me){const le=new z(X,se,Z);"code"in se?se.code(le,me):le.$data&&se.validate?(0,s.funcKeywordCode)(le,se):"macro"in se?(0,s.macroKeywordCode)(le,se):(se.compile||se.validate)&&(0,s.funcKeywordCode)(le,se)}const q=/^\/(?:[^~]|~0|~1)*$/,ae=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ie(X,{dataLevel:Z,dataNames:se,dataPathArr:me}){let le,Te;if(X==="")return u.default.rootData;if(X[0]==="/"){if(!q.test(X))throw new Error(`Invalid JSON-pointer: ${X}`);le=X,Te=u.default.rootData}else{const Ue=ae.exec(X);if(!Ue)throw new Error(`Invalid JSON-pointer: ${X}`);const fe=+Ue[1];if(le=Ue[2],le==="#"){if(fe>=Z)throw new Error(_e("property/index",fe));return me[Z-fe]}if(fe>Z)throw new Error(_e("data",fe));if(Te=se[Z-fe],!le)return Te}let Be=Te;const Ee=le.split("/");for(const Ue of Ee)Ue&&(Te=(0,c._)`${Te}${(0,c.getProperty)((0,m.unescapeJsonPointer)(Ue))}`,Be=(0,c._)`${Be} && ${Te}`);return Be;function _e(Ue,fe){return`Cannot access ${Ue} ${fe} levels up, current level is ${Z}`}}return ps.getData=ie,ps}var hh={},KL;function o_(){if(KL)return hh;KL=1,Object.defineProperty(hh,"__esModule",{value:!0});class e extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return hh.default=e,hh}var gh={},YL;function sy(){if(YL)return gh;YL=1,Object.defineProperty(gh,"__esModule",{value:!0});const e=ay();class t extends Error{constructor(r,a,s,i){super(i||`can't resolve reference ${s} from id ${a}`),this.missingRef=(0,e.resolveUrl)(r,a,s),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(r,this.missingRef))}}return gh.default=t,gh}var La={},ZL;function s_(){if(ZL)return La;ZL=1,Object.defineProperty(La,"__esModule",{value:!0}),La.resolveSchema=La.getCompilingSchema=La.resolveRef=La.compileSchema=La.SchemaEnv=void 0;const e=Mt(),t=o_(),n=ji(),r=ay(),a=on(),s=oy();class i{constructor(_){var S;this.refs={},this.dynamicAnchors={};let T;typeof _.schema=="object"&&(T=_.schema),this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(S=_.baseId)!==null&&S!==void 0?S:(0,r.normalizeId)(T?.[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=T?.$async,this.refs={}}}La.SchemaEnv=i;function c(w){const _=m.call(this,w);if(_)return _;const S=(0,r.getFullPath)(this.opts.uriResolver,w.root.baseId),{es5:T,lines:R}=this.opts.code,{ownProperties:C}=this.opts,I=new e.CodeGen(this.scope,{es5:T,lines:R,ownProperties:C});let A;w.$async&&(A=I.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const O=I.scopeName("validate");w.validateName=O;const j={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:w.schema,code:(0,e.stringify)(w.schema)}:{ref:w.schema}),validateName:O,ValidationError:A,schema:w.schema,schemaEnv:w,rootId:S,baseId:w.baseId||S,schemaPath:e.nil,errSchemaPath:w.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,e._)`""`,opts:this.opts,self:this};let U;try{this._compilations.add(w),(0,s.validateFunctionCode)(j),I.optimize(this.opts.code.optimize);const B=I.toString();U=`${I.scopeRefs(n.default.scope)}return ${B}`,this.opts.code.process&&(U=this.opts.code.process(U,w));const J=new Function(`${n.default.self}`,`${n.default.scope}`,U)(this,this.scope.get());if(this.scope.value(O,{ref:J}),J.errors=null,J.schema=w.schema,J.schemaEnv=w,w.$async&&(J.$async=!0),this.opts.code.source===!0&&(J.source={validateName:O,validateCode:B,scopeValues:I._values}),this.opts.unevaluated){const{props:ee,items:re}=j;J.evaluated={props:ee instanceof e.Name?void 0:ee,items:re instanceof e.Name?void 0:re,dynamicProps:ee instanceof e.Name,dynamicItems:re instanceof e.Name},J.source&&(J.source.evaluated=(0,e.stringify)(J.evaluated))}return w.validate=J,w}catch(B){throw delete w.validate,delete w.validateName,U&&this.logger.error("Error compiling schema, function code:",U),B}finally{this._compilations.delete(w)}}La.compileSchema=c;function u(w,_,S){var T;S=(0,r.resolveUrl)(this.opts.uriResolver,_,S);const R=w.refs[S];if(R)return R;let C=b.call(this,w,S);if(C===void 0){const I=(T=w.localRefs)===null||T===void 0?void 0:T[S],{schemaId:A}=this.opts;I&&(C=new i({schema:I,schemaId:A,root:w,baseId:_}))}if(C!==void 0)return w.refs[S]=f.call(this,C)}La.resolveRef=u;function f(w){return(0,r.inlineRef)(w.schema,this.opts.inlineRefs)?w.schema:w.validate?w:c.call(this,w)}function m(w){for(const _ of this._compilations)if(h(_,w))return _}La.getCompilingSchema=m;function h(w,_){return w.schema===_.schema&&w.root===_.root&&w.baseId===_.baseId}function b(w,_){let S;for(;typeof(S=this.refs[_])=="string";)_=S;return S||this.schemas[_]||y.call(this,w,_)}function y(w,_){const S=this.opts.uriResolver.parse(_),T=(0,r._getFullPath)(this.opts.uriResolver,S);let R=(0,r.getFullPath)(this.opts.uriResolver,w.baseId,void 0);if(Object.keys(w.schema).length>0&&T===R)return E.call(this,S,w);const C=(0,r.normalizeId)(T),I=this.refs[C]||this.schemas[C];if(typeof I=="string"){const A=y.call(this,w,I);return typeof A?.schema!="object"?void 0:E.call(this,S,A)}if(typeof I?.schema=="object"){if(I.validate||c.call(this,I),C===(0,r.normalizeId)(_)){const{schema:A}=I,{schemaId:O}=this.opts,j=A[O];return j&&(R=(0,r.resolveUrl)(this.opts.uriResolver,R,j)),new i({schema:A,schemaId:O,root:w,baseId:R})}return E.call(this,S,I)}}La.resolveSchema=y;const x=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function E(w,{baseId:_,schema:S,root:T}){var R;if(((R=w.fragment)===null||R===void 0?void 0:R[0])!=="/")return;for(const A of w.fragment.slice(1).split("/")){if(typeof S=="boolean")return;const O=S[(0,a.unescapeFragment)(A)];if(O===void 0)return;S=O;const j=typeof S=="object"&&S[this.opts.schemaId];!x.has(A)&&j&&(_=(0,r.resolveUrl)(this.opts.uriResolver,_,j))}let C;if(typeof S!="boolean"&&S.$ref&&!(0,a.schemaHasRulesButRef)(S,this.RULES)){const A=(0,r.resolveUrl)(this.opts.uriResolver,_,S.$ref);C=y.call(this,T,A)}const{schemaId:I}=this.opts;if(C=C||new i({schema:S,schemaId:I,root:T,baseId:_}),C.schema!==C.root.schema)return C}return La}const dq="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",fq="Meta-schema for $data reference (JSON AnySchema extension proposal)",pq="object",mq=["$data"],hq={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},gq=!1,bq={$id:dq,description:fq,type:pq,required:mq,properties:hq,additionalProperties:gq};var bh={},af={exports:{}},xw,qL;function w2(){if(qL)return xw;qL=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(b){let y="",x=0,E=0;for(E=0;E<b.length;E++)if(x=b[E].charCodeAt(0),x!==48){if(!(x>=48&&x<=57||x>=65&&x<=70||x>=97&&x<=102))return"";y+=b[E];break}for(E+=1;E<b.length;E++){if(x=b[E].charCodeAt(0),!(x>=48&&x<=57||x>=65&&x<=70||x>=97&&x<=102))return"";y+=b[E]}return y}const r=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function a(b){return b.length=0,!0}function s(b,y,x){if(b.length){const E=n(b);if(E!=="")y.push(E);else return x.error=!0,!1;b.length=0}return!0}function i(b){let y=0;const x={error:!1,address:"",zone:""},E=[],w=[];let _=!1,S=!1,T=s;for(let R=0;R<b.length;R++){const C=b[R];if(!(C==="["||C==="]"))if(C===":"){if(_===!0&&(S=!0),!T(w,E,x))break;if(++y>7){x.error=!0;break}R>0&&b[R-1]===":"&&(_=!0),E.push(":");continue}else if(C==="%"){if(!T(w,E,x))break;T=a}else{w.push(C);continue}}return w.length&&(T===a?x.zone=w.join(""):S?E.push(w.join("")):E.push(n(w))),x.address=E.join(""),x}function c(b){if(u(b,":")<2)return{host:b,isIPV6:!1};const y=i(b);if(y.error)return{host:b,isIPV6:!1};{let x=y.address,E=y.address;return y.zone&&(x+="%"+y.zone,E+="%25"+y.zone),{host:x,isIPV6:!0,escapedHost:E}}}function u(b,y){let x=0;for(let E=0;E<b.length;E++)b[E]===y&&x++;return x}function f(b){let y=b;const x=[];let E=-1,w=0;for(;w=y.length;){if(w===1){if(y===".")break;if(y==="/"){x.push("/");break}else{x.push(y);break}}else if(w===2){if(y[0]==="."){if(y[1]===".")break;if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"&&(y[1]==="."||y[1]==="/")){x.push("/");break}}else if(w===3&&y==="/.."){x.length!==0&&x.pop(),x.push("/");break}if(y[0]==="."){if(y[1]==="."){if(y[2]==="/"){y=y.slice(3);continue}}else if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"&&y[1]==="."){if(y[2]==="/"){y=y.slice(2);continue}else if(y[2]==="."&&y[3]==="/"){y=y.slice(3),x.length!==0&&x.pop();continue}}if((E=y.indexOf("/",1))===-1){x.push(y);break}else x.push(y.slice(0,E)),y=y.slice(E)}return x.join("")}function m(b,y){const x=y!==!0?escape:unescape;return b.scheme!==void 0&&(b.scheme=x(b.scheme)),b.userinfo!==void 0&&(b.userinfo=x(b.userinfo)),b.host!==void 0&&(b.host=x(b.host)),b.path!==void 0&&(b.path=x(b.path)),b.query!==void 0&&(b.query=x(b.query)),b.fragment!==void 0&&(b.fragment=x(b.fragment)),b}function h(b){const y=[];if(b.userinfo!==void 0&&(y.push(b.userinfo),y.push("@")),b.host!==void 0){let x=unescape(b.host);if(!t(x)){const E=c(x);E.isIPV6===!0?x=`[${E.escapedHost}]`:x=b.host}y.push(x)}return(typeof b.port=="number"||typeof b.port=="string")&&(y.push(":"),y.push(String(b.port))),y.length?y.join(""):void 0}return xw={nonSimpleDomain:r,recomposeAuthority:h,normalizeComponentEncoding:m,removeDotSegments:f,isIPv4:t,isUUID:e,normalizeIPv6:c,stringArrayToHexStripped:n},xw}var Sw,XL;function yq(){if(XL)return Sw;XL=1;const{isUUID:e}=w2(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(C){return n.indexOf(C)!==-1}function a(C){return C.secure===!0?!0:C.secure===!1?!1:C.scheme?C.scheme.length===3&&(C.scheme[0]==="w"||C.scheme[0]==="W")&&(C.scheme[1]==="s"||C.scheme[1]==="S")&&(C.scheme[2]==="s"||C.scheme[2]==="S"):!1}function s(C){return C.host||(C.error=C.error||"HTTP URIs must have a host."),C}function i(C){const I=String(C.scheme).toLowerCase()==="https";return(C.port===(I?443:80)||C.port==="")&&(C.port=void 0),C.path||(C.path="/"),C}function c(C){return C.secure=a(C),C.resourceName=(C.path||"/")+(C.query?"?"+C.query:""),C.path=void 0,C.query=void 0,C}function u(C){if((C.port===(a(C)?443:80)||C.port==="")&&(C.port=void 0),typeof C.secure=="boolean"&&(C.scheme=C.secure?"wss":"ws",C.secure=void 0),C.resourceName){const[I,A]=C.resourceName.split("?");C.path=I&&I!=="/"?I:void 0,C.query=A,C.resourceName=void 0}return C.fragment=void 0,C}function f(C,I){if(!C.path)return C.error="URN can not be parsed",C;const A=C.path.match(t);if(A){const O=I.scheme||C.scheme||"urn";C.nid=A[1].toLowerCase(),C.nss=A[2];const j=`${O}:${I.nid||C.nid}`,U=R(j);C.path=void 0,U&&(C=U.parse(C,I))}else C.error=C.error||"URN can not be parsed.";return C}function m(C,I){if(C.nid===void 0)throw new Error("URN without nid cannot be serialized");const A=I.scheme||C.scheme||"urn",O=C.nid.toLowerCase(),j=`${A}:${I.nid||O}`,U=R(j);U&&(C=U.serialize(C,I));const B=C,W=C.nss;return B.path=`${O||I.nid}:${W}`,I.skipEscape=!0,B}function h(C,I){const A=C;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 b(C){const I=C;return I.nss=(C.uuid||"").toLowerCase(),I}const y={scheme:"http",domainHost:!0,parse:s,serialize:i},x={scheme:"https",domainHost:y.domainHost,parse:s,serialize:i},E={scheme:"ws",domainHost:!0,parse:c,serialize:u},w={scheme:"wss",domainHost:E.domainHost,parse:E.parse,serialize:E.serialize},T={http:y,https:x,ws:E,wss:w,urn:{scheme:"urn",parse:f,serialize:m,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:h,serialize:b,skipNormalize:!0}};Object.setPrototypeOf(T,null);function R(C){return C&&(T[C]||T[C.toLowerCase()])||void 0}return Sw={wsIsSecure:a,SCHEMES:T,isValidSchemeName:r,getSchemeHandler:R},Sw}var JL;function vq(){if(JL)return af.exports;JL=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:a,nonSimpleDomain:s}=w2(),{SCHEMES:i,getSchemeHandler:c}=yq();function u(w,_){return typeof w=="string"?w=b(x(w,_),_):typeof w=="object"&&(w=x(b(w,_),_)),w}function f(w,_,S){const T=S?Object.assign({scheme:"null"},S):{scheme:"null"},R=m(x(w,T),x(_,T),T,!0);return T.skipEscape=!0,b(R,T)}function m(w,_,S,T){const R={};return T||(w=x(b(w,S),S),_=x(b(_,S),S)),S=S||{},!S.tolerant&&_.scheme?(R.scheme=_.scheme,R.userinfo=_.userinfo,R.host=_.host,R.port=_.port,R.path=t(_.path||""),R.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(R.userinfo=_.userinfo,R.host=_.host,R.port=_.port,R.path=t(_.path||""),R.query=_.query):(_.path?(_.path[0]==="/"?R.path=t(_.path):((w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)&&!w.path?R.path="/"+_.path:w.path?R.path=w.path.slice(0,w.path.lastIndexOf("/")+1)+_.path:R.path=_.path,R.path=t(R.path)),R.query=_.query):(R.path=w.path,_.query!==void 0?R.query=_.query:R.query=w.query),R.userinfo=w.userinfo,R.host=w.host,R.port=w.port),R.scheme=w.scheme),R.fragment=_.fragment,R}function h(w,_,S){return typeof w=="string"?(w=unescape(w),w=b(r(x(w,S),!0),{...S,skipEscape:!0})):typeof w=="object"&&(w=b(r(w,!0),{...S,skipEscape:!0})),typeof _=="string"?(_=unescape(_),_=b(r(x(_,S),!0),{...S,skipEscape:!0})):typeof _=="object"&&(_=b(r(_,!0),{...S,skipEscape:!0})),w.toLowerCase()===_.toLowerCase()}function b(w,_){const S={host:w.host,scheme:w.scheme,userinfo:w.userinfo,port:w.port,path:w.path,query:w.query,nid:w.nid,nss:w.nss,uuid:w.uuid,fragment:w.fragment,reference:w.reference,resourceName:w.resourceName,secure:w.secure,error:""},T=Object.assign({},_),R=[],C=c(T.scheme||S.scheme);C&&C.serialize&&C.serialize(S,T),S.path!==void 0&&(T.skipEscape?S.path=unescape(S.path):(S.path=escape(S.path),S.scheme!==void 0&&(S.path=S.path.split("%3A").join(":")))),T.reference!=="suffix"&&S.scheme&&R.push(S.scheme,":");const I=n(S);if(I!==void 0&&(T.reference!=="suffix"&&R.push("//"),R.push(I),S.path&&S.path[0]!=="/"&&R.push("/")),S.path!==void 0){let A=S.path;!T.absolutePath&&(!C||!C.absolutePath)&&(A=t(A)),I===void 0&&A[0]==="/"&&A[1]==="/"&&(A="/%2F"+A.slice(2)),R.push(A)}return S.query!==void 0&&R.push("?",S.query),S.fragment!==void 0&&R.push("#",S.fragment),R.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function x(w,_){const S=Object.assign({},_),T={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let R=!1;S.reference==="suffix"&&(S.scheme?w=S.scheme+":"+w:w="//"+w);const C=w.match(y);if(C){if(T.scheme=C[1],T.userinfo=C[3],T.host=C[4],T.port=parseInt(C[5],10),T.path=C[6]||"",T.query=C[7],T.fragment=C[8],isNaN(T.port)&&(T.port=C[5]),T.host)if(a(T.host)===!1){const O=e(T.host);T.host=O.host.toLowerCase(),R=O.isIPV6}else R=!0;T.scheme===void 0&&T.userinfo===void 0&&T.host===void 0&&T.port===void 0&&T.query===void 0&&!T.path?T.reference="same-document":T.scheme===void 0?T.reference="relative":T.fragment===void 0?T.reference="absolute":T.reference="uri",S.reference&&S.reference!=="suffix"&&S.reference!==T.reference&&(T.error=T.error||"URI is not a "+S.reference+" reference.");const I=c(S.scheme||T.scheme);if(!S.unicodeSupport&&(!I||!I.unicodeSupport)&&T.host&&(S.domainHost||I&&I.domainHost)&&R===!1&&s(T.host))try{T.host=URL.domainToASCII(T.host.toLowerCase())}catch(A){T.error=T.error||"Host's domain name can not be converted to ASCII: "+A}(!I||I&&!I.skipNormalize)&&(w.indexOf("%")!==-1&&(T.scheme!==void 0&&(T.scheme=unescape(T.scheme)),T.host!==void 0&&(T.host=unescape(T.host))),T.path&&(T.path=escape(unescape(T.path))),T.fragment&&(T.fragment=encodeURI(decodeURIComponent(T.fragment)))),I&&I.parse&&I.parse(T,S)}else T.error=T.error||"URI can not be parsed.";return T}const E={SCHEMES:i,normalize:u,resolve:f,resolveComponent:m,equal:h,serialize:b,parse:x};return af.exports=E,af.exports.default=E,af.exports.fastUri=E,af.exports}var QL;function wq(){if(QL)return bh;QL=1,Object.defineProperty(bh,"__esModule",{value:!0});const e=vq();return e.code='require("ajv/dist/runtime/uri").default',bh.default=e,bh}var eM;function Eq(){return eM||(eM=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=oy();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Mt();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 r=o_(),a=sy(),s=b2(),i=s_(),c=Mt(),u=ay(),f=Jg(),m=on(),h=bq,b=wq(),y=(te,D)=>new RegExp(te,D);y.code="new RegExp";const x=["removeAdditional","useDefaults","coerceTypes"],E=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),w={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."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},S=200;function T(te){var D,H,$,L,M,z,G,q,ae,ie,X,Z,se,me,le,Te,Be,Ee,_e,Ue,fe,Ae,ze,we,at;const lt=te.strict,gt=(D=te.code)===null||D===void 0?void 0:D.optimize,Ct=gt===!0||gt===void 0?1:gt||0,Le=($=(H=te.code)===null||H===void 0?void 0:H.regExp)!==null&&$!==void 0?$:y,$e=(L=te.uriResolver)!==null&&L!==void 0?L:b.default;return{strictSchema:(z=(M=te.strictSchema)!==null&&M!==void 0?M:lt)!==null&&z!==void 0?z:!0,strictNumbers:(q=(G=te.strictNumbers)!==null&&G!==void 0?G:lt)!==null&&q!==void 0?q:!0,strictTypes:(ie=(ae=te.strictTypes)!==null&&ae!==void 0?ae:lt)!==null&&ie!==void 0?ie:"log",strictTuples:(Z=(X=te.strictTuples)!==null&&X!==void 0?X:lt)!==null&&Z!==void 0?Z:"log",strictRequired:(me=(se=te.strictRequired)!==null&&se!==void 0?se:lt)!==null&&me!==void 0?me:!1,code:te.code?{...te.code,optimize:Ct,regExp:Le}:{optimize:Ct,regExp:Le},loopRequired:(le=te.loopRequired)!==null&&le!==void 0?le:S,loopEnum:(Te=te.loopEnum)!==null&&Te!==void 0?Te:S,meta:(Be=te.meta)!==null&&Be!==void 0?Be:!0,messages:(Ee=te.messages)!==null&&Ee!==void 0?Ee:!0,inlineRefs:(_e=te.inlineRefs)!==null&&_e!==void 0?_e:!0,schemaId:(Ue=te.schemaId)!==null&&Ue!==void 0?Ue:"$id",addUsedSchema:(fe=te.addUsedSchema)!==null&&fe!==void 0?fe:!0,validateSchema:(Ae=te.validateSchema)!==null&&Ae!==void 0?Ae:!0,validateFormats:(ze=te.validateFormats)!==null&&ze!==void 0?ze:!0,unicodeRegExp:(we=te.unicodeRegExp)!==null&&we!==void 0?we:!0,int32range:(at=te.int32range)!==null&&at!==void 0?at:!0,uriResolver:$e}}class R{constructor(D={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,D=this.opts={...D,...T(D)};const{es5:H,lines:$}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:E,es5:H,lines:$}),this.logger=W(D.logger);const L=D.validateFormats;D.validateFormats=!1,this.RULES=(0,s.getRules)(),C.call(this,w,D,"NOT SUPPORTED"),C.call(this,_,D,"DEPRECATED","warn"),this._metaOpts=U.call(this),D.formats&&O.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),D.keywords&&j.call(this,D.keywords),typeof D.meta=="object"&&this.addMetaSchema(D.meta),A.call(this),D.validateFormats=L}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:D,meta:H,schemaId:$}=this.opts;let L=h;$==="id"&&(L={...h},L.id=L.$id,delete L.$id),H&&D&&this.addMetaSchema(L,L[$],!1)}defaultMeta(){const{meta:D,schemaId:H}=this.opts;return this.opts.defaultMeta=typeof D=="object"?D[H]||D:void 0}validate(D,H){let $;if(typeof D=="string"){if($=this.getSchema(D),!$)throw new Error(`no schema with key or ref "${D}"`)}else $=this.compile(D);const L=$(H);return"$async"in $||(this.errors=$.errors),L}compile(D,H){const $=this._addSchema(D,H);return $.validate||this._compileSchemaEnv($)}compileAsync(D,H){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:$}=this.opts;return L.call(this,D,H);async function L(ie,X){await M.call(this,ie.$schema);const Z=this._addSchema(ie,X);return Z.validate||z.call(this,Z)}async function M(ie){ie&&!this.getSchema(ie)&&await L.call(this,{$ref:ie},!0)}async function z(ie){try{return this._compileSchemaEnv(ie)}catch(X){if(!(X instanceof a.default))throw X;return G.call(this,X),await q.call(this,X.missingSchema),z.call(this,ie)}}function G({missingSchema:ie,missingRef:X}){if(this.refs[ie])throw new Error(`AnySchema ${ie} is loaded but ${X} cannot be resolved`)}async function q(ie){const X=await ae.call(this,ie);this.refs[ie]||await M.call(this,X.$schema),this.refs[ie]||this.addSchema(X,ie,H)}async function ae(ie){const X=this._loading[ie];if(X)return X;try{return await(this._loading[ie]=$(ie))}finally{delete this._loading[ie]}}}addSchema(D,H,$,L=this.opts.validateSchema){if(Array.isArray(D)){for(const z of D)this.addSchema(z,void 0,$,L);return this}let M;if(typeof D=="object"){const{schemaId:z}=this.opts;if(M=D[z],M!==void 0&&typeof M!="string")throw new Error(`schema ${z} must be string`)}return H=(0,u.normalizeId)(H||M),this._checkUnique(H),this.schemas[H]=this._addSchema(D,$,H,L,!0),this}addMetaSchema(D,H,$=this.opts.validateSchema){return this.addSchema(D,H,!0,$),this}validateSchema(D,H){if(typeof D=="boolean")return!0;let $;if($=D.$schema,$!==void 0&&typeof $!="string")throw new Error("$schema must be a string");if($=$||this.opts.defaultMeta||this.defaultMeta(),!$)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const L=this.validate($,D);if(!L&&H){const M="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(M);else throw new Error(M)}return L}getSchema(D){let H;for(;typeof(H=I.call(this,D))=="string";)D=H;if(H===void 0){const{schemaId:$}=this.opts,L=new i.SchemaEnv({schema:{},schemaId:$});if(H=i.resolveSchema.call(this,L,D),!H)return;this.refs[D]=H}return H.validate||this._compileSchemaEnv(H)}removeSchema(D){if(D instanceof RegExp)return this._removeAllSchemas(this.schemas,D),this._removeAllSchemas(this.refs,D),this;switch(typeof D){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const H=I.call(this,D);return typeof H=="object"&&this._cache.delete(H.schema),delete this.schemas[D],delete this.refs[D],this}case"object":{const H=D;this._cache.delete(H);let $=D[this.opts.schemaId];return $&&($=(0,u.normalizeId)($),delete this.schemas[$],delete this.refs[$]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(D){for(const H of D)this.addKeyword(H);return this}addKeyword(D,H){let $;if(typeof D=="string")$=D,typeof H=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),H.keyword=$);else if(typeof D=="object"&&H===void 0){if(H=D,$=H.keyword,Array.isArray($)&&!$.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(ee.call(this,$,H),!H)return(0,m.eachItem)($,M=>re.call(this,M)),this;K.call(this,H);const L={...H,type:(0,f.getJSONTypes)(H.type),schemaType:(0,f.getJSONTypes)(H.schemaType)};return(0,m.eachItem)($,L.type.length===0?M=>re.call(this,M,L):M=>L.type.forEach(z=>re.call(this,M,L,z))),this}getKeyword(D){const H=this.RULES.all[D];return typeof H=="object"?H.definition:!!H}removeKeyword(D){const{RULES:H}=this;delete H.keywords[D],delete H.all[D];for(const $ of H.rules){const L=$.rules.findIndex(M=>M.keyword===D);L>=0&&$.rules.splice(L,1)}return this}addFormat(D,H){return typeof H=="string"&&(H=new RegExp(H)),this.formats[D]=H,this}errorsText(D=this.errors,{separator:H=", ",dataVar:$="data"}={}){return!D||D.length===0?"No errors":D.map(L=>`${$}${L.instancePath} ${L.message}`).reduce((L,M)=>L+H+M)}$dataMetaSchema(D,H){const $=this.RULES.all;D=JSON.parse(JSON.stringify(D));for(const L of H){const M=L.split("/").slice(1);let z=D;for(const G of M)z=z[G];for(const G in $){const q=$[G];if(typeof q!="object")continue;const{$data:ae}=q.definition,ie=z[G];ae&&ie&&(z[G]=ne(ie))}}return D}_removeAllSchemas(D,H){for(const $ in D){const L=D[$];(!H||H.test($))&&(typeof L=="string"?delete D[$]:L&&!L.meta&&(this._cache.delete(L.schema),delete D[$]))}}_addSchema(D,H,$,L=this.opts.validateSchema,M=this.opts.addUsedSchema){let z;const{schemaId:G}=this.opts;if(typeof D=="object")z=D[G];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof D!="boolean")throw new Error("schema must be object or boolean")}let q=this._cache.get(D);if(q!==void 0)return q;$=(0,u.normalizeId)(z||$);const ae=u.getSchemaRefs.call(this,D,$);return q=new i.SchemaEnv({schema:D,schemaId:G,meta:H,baseId:$,localRefs:ae}),this._cache.set(q.schema,q),M&&!$.startsWith("#")&&($&&this._checkUnique($),this.refs[$]=q),L&&this.validateSchema(D,!0),q}_checkUnique(D){if(this.schemas[D]||this.refs[D])throw new Error(`schema with key or id "${D}" already exists`)}_compileSchemaEnv(D){if(D.meta?this._compileMetaSchema(D):i.compileSchema.call(this,D),!D.validate)throw new Error("ajv implementation error");return D.validate}_compileMetaSchema(D){const H=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,D)}finally{this.opts=H}}}R.ValidationError=r.default,R.MissingRefError=a.default,e.default=R;function C(te,D,H,$="error"){for(const L in te){const M=L;M in D&&this.logger[$](`${H}: option ${L}. ${te[M]}`)}}function I(te){return te=(0,u.normalizeId)(te),this.schemas[te]||this.refs[te]}function A(){const te=this.opts.schemas;if(te)if(Array.isArray(te))this.addSchema(te);else for(const D in te)this.addSchema(te[D],D)}function O(){for(const te in this.opts.formats){const D=this.opts.formats[te];D&&this.addFormat(te,D)}}function j(te){if(Array.isArray(te)){this.addVocabulary(te);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const D in te){const H=te[D];H.keyword||(H.keyword=D),this.addKeyword(H)}}function U(){const te={...this.opts};for(const D of x)delete te[D];return te}const B={log(){},warn(){},error(){}};function W(te){if(te===!1)return B;if(te===void 0)return console;if(te.log&&te.warn&&te.error)return te;throw new Error("logger must implement log, warn and error methods")}const J=/^[a-z_$][a-z0-9_$:-]*$/i;function ee(te,D){const{RULES:H}=this;if((0,m.eachItem)(te,$=>{if(H.keywords[$])throw new Error(`Keyword ${$} is already defined`);if(!J.test($))throw new Error(`Keyword ${$} has invalid name`)}),!!D&&D.$data&&!("code"in D||"validate"in D))throw new Error('$data keyword must have "code" or "validate" function')}function re(te,D,H){var $;const L=D?.post;if(H&&L)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:M}=this;let z=L?M.post:M.rules.find(({type:q})=>q===H);if(z||(z={type:H,rules:[]},M.rules.push(z)),M.keywords[te]=!0,!D)return;const G={keyword:te,definition:{...D,type:(0,f.getJSONTypes)(D.type),schemaType:(0,f.getJSONTypes)(D.schemaType)}};D.before?F.call(this,z,G,D.before):z.rules.push(G),M.all[te]=G,($=D.implements)===null||$===void 0||$.forEach(q=>this.addKeyword(q))}function F(te,D,H){const $=te.rules.findIndex(L=>L.keyword===H);$>=0?te.rules.splice($,0,D):(te.rules.push(D),this.logger.warn(`rule ${H} is not defined`))}function K(te){let{metaSchema:D}=te;D!==void 0&&(te.$data&&this.opts.$data&&(D=ne(D)),te.validateSchema=this.compile(D,!0))}const V={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ne(te){return{anyOf:[te,V]}}})(hw)),hw}var yh={},vh={},wh={},tM;function xq(){if(tM)return wh;tM=1,Object.defineProperty(wh,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return wh.default=e,wh}var ci={},nM;function Sq(){if(nM)return ci;nM=1,Object.defineProperty(ci,"__esModule",{value:!0}),ci.callRef=ci.getValidate=void 0;const e=sy(),t=To(),n=Mt(),r=ji(),a=s_(),s=on(),i={keyword:"$ref",schemaType:"string",code(f){const{gen:m,schema:h,it:b}=f,{baseId:y,schemaEnv:x,validateName:E,opts:w,self:_}=b,{root:S}=x;if((h==="#"||h==="#/")&&y===S.baseId)return R();const T=a.resolveRef.call(_,S,y,h);if(T===void 0)throw new e.default(b.opts.uriResolver,y,h);if(T instanceof a.SchemaEnv)return C(T);return I(T);function R(){if(x===S)return u(f,E,x,x.$async);const A=m.scopeValue("root",{ref:S});return u(f,(0,n._)`${A}.validate`,S,S.$async)}function C(A){const O=c(f,A);u(f,O,A,A.$async)}function I(A){const O=m.scopeValue("schema",w.code.source===!0?{ref:A,code:(0,n.stringify)(A)}:{ref:A}),j=m.name("valid"),U=f.subschema({schema:A,dataTypes:[],schemaPath:n.nil,topSchemaRef:O,errSchemaPath:h},j);f.mergeEvaluated(U),f.ok(j)}}};function c(f,m){const{gen:h}=f;return m.validate?h.scopeValue("validate",{ref:m.validate}):(0,n._)`${h.scopeValue("wrapper",{ref:m})}.validate`}ci.getValidate=c;function u(f,m,h,b){const{gen:y,it:x}=f,{allErrors:E,schemaEnv:w,opts:_}=x,S=_.passContext?r.default.this:n.nil;b?T():R();function T(){if(!w.$async)throw new Error("async schema referenced by sync schema");const A=y.let("valid");y.try(()=>{y.code((0,n._)`await ${(0,t.callValidateCode)(f,m,S)}`),I(m),E||y.assign(A,!0)},O=>{y.if((0,n._)`!(${O} instanceof ${x.ValidationError})`,()=>y.throw(O)),C(O),E||y.assign(A,!1)}),f.ok(A)}function R(){f.result((0,t.callValidateCode)(f,m,S),()=>I(m),()=>C(m))}function C(A){const O=(0,n._)`${A}.errors`;y.assign(r.default.vErrors,(0,n._)`${r.default.vErrors} === null ? ${O} : ${r.default.vErrors}.concat(${O})`),y.assign(r.default.errors,(0,n._)`${r.default.vErrors}.length`)}function I(A){var O;if(!x.opts.unevaluated)return;const j=(O=h?.validate)===null||O===void 0?void 0:O.evaluated;if(x.props!==!0)if(j&&!j.dynamicProps)j.props!==void 0&&(x.props=s.mergeEvaluated.props(y,j.props,x.props));else{const U=y.var("props",(0,n._)`${A}.evaluated.props`);x.props=s.mergeEvaluated.props(y,U,x.props,n.Name)}if(x.items!==!0)if(j&&!j.dynamicItems)j.items!==void 0&&(x.items=s.mergeEvaluated.items(y,j.items,x.items));else{const U=y.var("items",(0,n._)`${A}.evaluated.items`);x.items=s.mergeEvaluated.items(y,U,x.items,n.Name)}}}return ci.callRef=u,ci.default=i,ci}var rM;function _q(){if(rM)return vh;rM=1,Object.defineProperty(vh,"__esModule",{value:!0});const e=xq(),t=Sq(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return vh.default=n,vh}var Eh={},xh={},aM;function Tq(){if(aM)return xh;aM=1,Object.defineProperty(xh,"__esModule",{value:!0});const e=Mt(),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}},r={message:({keyword:s,schemaCode:i})=>(0,e.str)`must be ${n[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>(0,e._)`{comparison: ${n[s].okStr}, limit: ${i}}`},a={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:r,code(s){const{keyword:i,data:c,schemaCode:u}=s;s.fail$data((0,e._)`${c} ${n[i].fail} ${u} || isNaN(${c})`)}};return xh.default=a,xh}var Sh={},oM;function Nq(){if(oM)return Sh;oM=1,Object.defineProperty(Sh,"__esModule",{value:!0});const e=Mt(),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must be multiple of ${r}`,params:({schemaCode:r})=>(0,e._)`{multipleOf: ${r}}`},code(r){const{gen:a,data:s,schemaCode:i,it:c}=r,u=c.opts.multipleOfPrecision,f=a.let("res"),m=u?(0,e._)`Math.abs(Math.round(${f}) - ${f}) > 1e-${u}`:(0,e._)`${f} !== parseInt(${f})`;r.fail$data((0,e._)`(${i} === 0 || (${f} = ${s}/${i}, ${m}))`)}};return Sh.default=n,Sh}var _h={},Th={},sM;function kq(){if(sM)return Th;sM=1,Object.defineProperty(Th,"__esModule",{value:!0});function e(t){const n=t.length;let r=0,a=0,s;for(;a<n;)r++,s=t.charCodeAt(a++),s>=55296&&s<=56319&&a<n&&(s=t.charCodeAt(a),(s&64512)===56320&&a++);return r}return Th.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Th}var iM;function Cq(){if(iM)return _h;iM=1,Object.defineProperty(_h,"__esModule",{value:!0});const e=Mt(),t=on(),n=kq(),a={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){const c=s==="maxLength"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${i} characters`},params:({schemaCode:s})=>(0,e._)`{limit: ${s}}`},code(s){const{keyword:i,data:c,schemaCode:u,it:f}=s,m=i==="maxLength"?e.operators.GT:e.operators.LT,h=f.opts.unicode===!1?(0,e._)`${c}.length`:(0,e._)`${(0,t.useFunc)(s.gen,n.default)}(${c})`;s.fail$data((0,e._)`${h} ${m} ${u}`)}};return _h.default=a,_h}var Nh={},lM;function Rq(){if(lM)return Nh;lM=1,Object.defineProperty(Nh,"__esModule",{value:!0});const e=To(),t=Mt(),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:a})=>(0,t.str)`must match pattern "${a}"`,params:({schemaCode:a})=>(0,t._)`{pattern: ${a}}`},code(a){const{data:s,$data:i,schema:c,schemaCode:u,it:f}=a,m=f.opts.unicodeRegExp?"u":"",h=i?(0,t._)`(new RegExp(${u}, ${m}))`:(0,e.usePattern)(a,c);a.fail$data((0,t._)`!${h}.test(${s})`)}};return Nh.default=r,Nh}var kh={},cM;function Aq(){if(cM)return kh;cM=1,Object.defineProperty(kh,"__esModule",{value:!0});const e=Mt(),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:a}){const s=r==="maxProperties"?"more":"fewer";return(0,e.str)`must NOT have ${s} than ${a} properties`},params:({schemaCode:r})=>(0,e._)`{limit: ${r}}`},code(r){const{keyword:a,data:s,schemaCode:i}=r,c=a==="maxProperties"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`Object.keys(${s}).length ${c} ${i}`)}};return kh.default=n,kh}var Ch={},uM;function Iq(){if(uM)return Ch;uM=1,Object.defineProperty(Ch,"__esModule",{value:!0});const e=To(),t=Mt(),n=on(),a={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,t.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,t._)`{missingProperty: ${s}}`},code(s){const{gen:i,schema:c,schemaCode:u,data:f,$data:m,it:h}=s,{opts:b}=h;if(!m&&c.length===0)return;const y=c.length>=b.loopRequired;if(h.allErrors?x():E(),b.strictRequired){const S=s.parentSchema.properties,{definedProperties:T}=s.it;for(const R of c)if(S?.[R]===void 0&&!T.has(R)){const C=h.schemaEnv.baseId+h.errSchemaPath,I=`required property "${R}" is not defined at "${C}" (strictRequired)`;(0,n.checkStrictMode)(h,I,h.opts.strictRequired)}}function x(){if(y||m)s.block$data(t.nil,w);else for(const S of c)(0,e.checkReportMissingProp)(s,S)}function E(){const S=i.let("missing");if(y||m){const T=i.let("valid",!0);s.block$data(T,()=>_(S,T)),s.ok(T)}else i.if((0,e.checkMissingProp)(s,c,S)),(0,e.reportMissingProp)(s,S),i.else()}function w(){i.forOf("prop",u,S=>{s.setParams({missingProperty:S}),i.if((0,e.noPropertyInData)(i,f,S,b.ownProperties),()=>s.error())})}function _(S,T){s.setParams({missingProperty:S}),i.forOf(S,u,()=>{i.assign(T,(0,e.propertyInData)(i,f,S,b.ownProperties)),i.if((0,t.not)(T),()=>{s.error(),i.break()})},t.nil)}}};return Ch.default=a,Ch}var Rh={},dM;function Oq(){if(dM)return Rh;dM=1,Object.defineProperty(Rh,"__esModule",{value:!0});const e=Mt(),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:a}){const s=r==="maxItems"?"more":"fewer";return(0,e.str)`must NOT have ${s} than ${a} items`},params:({schemaCode:r})=>(0,e._)`{limit: ${r}}`},code(r){const{keyword:a,data:s,schemaCode:i}=r,c=a==="maxItems"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`${s}.length ${c} ${i}`)}};return Rh.default=n,Rh}var Ah={},Ih={},fM;function i_(){if(fM)return Ih;fM=1,Object.defineProperty(Ih,"__esModule",{value:!0});const e=v2();return e.code='require("ajv/dist/runtime/equal").default',Ih.default=e,Ih}var pM;function Dq(){if(pM)return Ah;pM=1,Object.defineProperty(Ah,"__esModule",{value:!0});const e=Jg(),t=Mt(),n=on(),r=i_(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:c}})=>(0,t.str)`must NOT have duplicate items (items ## ${c} and ${i} are identical)`,params:({params:{i,j:c}})=>(0,t._)`{i: ${i}, j: ${c}}`},code(i){const{gen:c,data:u,$data:f,schema:m,parentSchema:h,schemaCode:b,it:y}=i;if(!f&&!m)return;const x=c.let("valid"),E=h.items?(0,e.getSchemaTypes)(h.items):[];i.block$data(x,w,(0,t._)`${b} === false`),i.ok(x);function w(){const R=c.let("i",(0,t._)`${u}.length`),C=c.let("j");i.setParams({i:R,j:C}),c.assign(x,!0),c.if((0,t._)`${R} > 1`,()=>(_()?S:T)(R,C))}function _(){return E.length>0&&!E.some(R=>R==="object"||R==="array")}function S(R,C){const I=c.name("item"),A=(0,e.checkDataTypes)(E,I,y.opts.strictNumbers,e.DataType.Wrong),O=c.const("indices",(0,t._)`{}`);c.for((0,t._)`;${R}--;`,()=>{c.let(I,(0,t._)`${u}[${R}]`),c.if(A,(0,t._)`continue`),E.length>1&&c.if((0,t._)`typeof ${I} == "string"`,(0,t._)`${I} += "_"`),c.if((0,t._)`typeof ${O}[${I}] == "number"`,()=>{c.assign(C,(0,t._)`${O}[${I}]`),i.error(),c.assign(x,!1).break()}).code((0,t._)`${O}[${I}] = ${R}`)})}function T(R,C){const I=(0,n.useFunc)(c,r.default),A=c.name("outer");c.label(A).for((0,t._)`;${R}--;`,()=>c.for((0,t._)`${C} = ${R}; ${C}--;`,()=>c.if((0,t._)`${I}(${u}[${R}], ${u}[${C}])`,()=>{i.error(),c.assign(x,!1).break(A)})))}}};return Ah.default=s,Ah}var Oh={},mM;function Lq(){if(mM)return Oh;mM=1,Object.defineProperty(Oh,"__esModule",{value:!0});const e=Mt(),t=on(),n=i_(),a={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,e._)`{allowedValue: ${s}}`},code(s){const{gen:i,data:c,$data:u,schemaCode:f,schema:m}=s;u||m&&typeof m=="object"?s.fail$data((0,e._)`!${(0,t.useFunc)(i,n.default)}(${c}, ${f})`):s.fail((0,e._)`${m} !== ${c}`)}};return Oh.default=a,Oh}var Dh={},hM;function Mq(){if(hM)return Dh;hM=1,Object.defineProperty(Dh,"__esModule",{value:!0});const e=Mt(),t=on(),n=i_(),a={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,e._)`{allowedValues: ${s}}`},code(s){const{gen:i,data:c,$data:u,schema:f,schemaCode:m,it:h}=s;if(!u&&f.length===0)throw new Error("enum must have non-empty array");const b=f.length>=h.opts.loopEnum;let y;const x=()=>y??(y=(0,t.useFunc)(i,n.default));let E;if(b||u)E=i.let("valid"),s.block$data(E,w);else{if(!Array.isArray(f))throw new Error("ajv implementation error");const S=i.const("vSchema",m);E=(0,e.or)(...f.map((T,R)=>_(S,R)))}s.pass(E);function w(){i.assign(E,!1),i.forOf("v",m,S=>i.if((0,e._)`${x()}(${c}, ${S})`,()=>i.assign(E,!0).break()))}function _(S,T){const R=f[T];return typeof R=="object"&&R!==null?(0,e._)`${x()}(${c}, ${S}[${T}])`:(0,e._)`${c} === ${R}`}}};return Dh.default=a,Dh}var gM;function jq(){if(gM)return Eh;gM=1,Object.defineProperty(Eh,"__esModule",{value:!0});const e=Tq(),t=Nq(),n=Cq(),r=Rq(),a=Aq(),s=Iq(),i=Oq(),c=Dq(),u=Lq(),f=Mq(),m=[e.default,t.default,n.default,r.default,a.default,s.default,i.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,f.default];return Eh.default=m,Eh}var Lh={},kc={},bM;function E2(){if(bM)return kc;bM=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.validateAdditionalItems=void 0;const e=Mt(),t=on(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],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{parentSchema:i,it:c}=s,{items:u}=i;if(!Array.isArray(u)){(0,t.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}a(s,u)}};function a(s,i){const{gen:c,schema:u,data:f,keyword:m,it:h}=s;h.items=!0;const b=c.const("len",(0,e._)`${f}.length`);if(u===!1)s.setParams({len:i.length}),s.pass((0,e._)`${b} <= ${i.length}`);else if(typeof u=="object"&&!(0,t.alwaysValidSchema)(h,u)){const x=c.var("valid",(0,e._)`${b} <= ${i.length}`);c.if((0,e.not)(x),()=>y(x)),s.ok(x)}function y(x){c.forRange("i",i.length,b,E=>{s.subschema({keyword:m,dataProp:E,dataPropType:t.Type.Num},x),h.allErrors||c.if((0,e.not)(x),()=>c.break())})}}return kc.validateAdditionalItems=a,kc.default=r,kc}var Mh={},Cc={},yM;function x2(){if(yM)return Cc;yM=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.validateTuple=void 0;const e=Mt(),t=on(),n=To(),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(s){const{schema:i,it:c}=s;if(Array.isArray(i))return a(s,"additionalItems",i);c.items=!0,!(0,t.alwaysValidSchema)(c,i)&&s.ok((0,n.validateArray)(s))}};function a(s,i,c=s.schema){const{gen:u,parentSchema:f,data:m,keyword:h,it:b}=s;E(f),b.opts.unevaluated&&c.length&&b.items!==!0&&(b.items=t.mergeEvaluated.items(u,c.length,b.items));const y=u.name("valid"),x=u.const("len",(0,e._)`${m}.length`);c.forEach((w,_)=>{(0,t.alwaysValidSchema)(b,w)||(u.if((0,e._)`${x} > ${_}`,()=>s.subschema({keyword:h,schemaProp:_,dataProp:_},y)),s.ok(y))});function E(w){const{opts:_,errSchemaPath:S}=b,T=c.length,R=T===w.minItems&&(T===w.maxItems||w[i]===!1);if(_.strictTuples&&!R){const C=`"${h}" is ${T}-tuple, but minItems or maxItems/${i} are not specified or different at path "${S}"`;(0,t.checkStrictMode)(b,C,_.strictTuples)}}}return Cc.validateTuple=a,Cc.default=r,Cc}var vM;function Pq(){if(vM)return Mh;vM=1,Object.defineProperty(Mh,"__esModule",{value:!0});const e=x2(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,e.validateTuple)(n,"items")};return Mh.default=t,Mh}var jh={},wM;function Uq(){if(wM)return jh;wM=1,Object.defineProperty(jh,"__esModule",{value:!0});const e=Mt(),t=on(),n=To(),r=E2(),s={keyword:"items",type:"array",schemaType:["object","boolean"],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{schema:c,parentSchema:u,it:f}=i,{prefixItems:m}=u;f.items=!0,!(0,t.alwaysValidSchema)(f,c)&&(m?(0,r.validateAdditionalItems)(i,m):i.ok((0,n.validateArray)(i)))}};return jh.default=s,jh}var Ph={},EM;function $q(){if(EM)return Ph;EM=1,Object.defineProperty(Ph,"__esModule",{value:!0});const e=Mt(),t=on(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:a,max:s}})=>s===void 0?(0,e.str)`must contain at least ${a} valid item(s)`:(0,e.str)`must contain at least ${a} and no more than ${s} valid item(s)`,params:({params:{min:a,max:s}})=>s===void 0?(0,e._)`{minContains: ${a}}`:(0,e._)`{minContains: ${a}, maxContains: ${s}}`},code(a){const{gen:s,schema:i,parentSchema:c,data:u,it:f}=a;let m,h;const{minContains:b,maxContains:y}=c;f.opts.next?(m=b===void 0?1:b,h=y):m=1;const x=s.const("len",(0,e._)`${u}.length`);if(a.setParams({min:m,max:h}),h===void 0&&m===0){(0,t.checkStrictMode)(f,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&m>h){(0,t.checkStrictMode)(f,'"minContains" > "maxContains" is always invalid'),a.fail();return}if((0,t.alwaysValidSchema)(f,i)){let T=(0,e._)`${x} >= ${m}`;h!==void 0&&(T=(0,e._)`${T} && ${x} <= ${h}`),a.pass(T);return}f.items=!0;const E=s.name("valid");h===void 0&&m===1?_(E,()=>s.if(E,()=>s.break())):m===0?(s.let(E,!0),h!==void 0&&s.if((0,e._)`${u}.length > 0`,w)):(s.let(E,!1),w()),a.result(E,()=>a.reset());function w(){const T=s.name("_valid"),R=s.let("count",0);_(T,()=>s.if(T,()=>S(R)))}function _(T,R){s.forRange("i",0,x,C=>{a.subschema({keyword:"contains",dataProp:C,dataPropType:t.Type.Num,compositeRule:!0},T),R()})}function S(T){s.code((0,e._)`${T}++`),h===void 0?s.if((0,e._)`${T} >= ${m}`,()=>s.assign(E,!0).break()):(s.if((0,e._)`${T} > ${h}`,()=>s.assign(E,!1).break()),m===1?s.assign(E,!0):s.if((0,e._)`${T} >= ${m}`,()=>s.assign(E,!0)))}}};return Ph.default=r,Ph}var _w={},xM;function zq(){return xM||(xM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Mt(),n=on(),r=To();e.error={message:({params:{property:u,depsCount:f,deps:m}})=>{const h=f===1?"property":"properties";return(0,t.str)`must have ${h} ${m} when property ${u} is present`},params:({params:{property:u,depsCount:f,deps:m,missingProperty:h}})=>(0,t._)`{property: ${u},
27
27
  missingProperty: ${h},
28
28
  depsCount: ${f},
29
- deps: ${m}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[f,m]=s(u);i(u,f),c(u,m)}};function s({schema:u}){const f={},m={};for(const h in u){if(h==="__proto__")continue;const b=Array.isArray(u[h])?f:m;b[h]=u[h]}return[f,m]}function i(u,f=u.schema){const{gen:m,data:h,it:b}=u;if(Object.keys(f).length===0)return;const y=m.let("missing");for(const x in f){const E=f[x];if(E.length===0)continue;const w=(0,r.propertyInData)(m,h,x,b.opts.ownProperties);u.setParams({property:x,depsCount:E.length,deps:E.join(", ")}),b.allErrors?m.if(w,()=>{for(const _ of E)(0,r.checkReportMissingProp)(u,_)}):(m.if((0,t._)`${w} && (${(0,r.checkMissingProp)(u,E,y)})`),(0,r.reportMissingProp)(u,y),m.else())}}e.validatePropertyDeps=i;function c(u,f=u.schema){const{gen:m,data:h,keyword:b,it:y}=u,x=m.name("valid");for(const E in f)(0,n.alwaysValidSchema)(y,f[E])||(m.if((0,r.propertyInData)(m,h,E,y.opts.ownProperties),()=>{const w=u.subschema({keyword:b,schemaProp:E},x);u.mergeValidEvaluated(w,x)},()=>m.var(x,!0)),u.ok(x))}e.validateSchemaDeps=c,e.default=a})(_w)),_w}var Uh={},SM;function Fq(){if(SM)return Uh;SM=1,Object.defineProperty(Uh,"__esModule",{value:!0});const e=Mt(),t=on(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:a})=>(0,e._)`{propertyName: ${a.propertyName}}`},code(a){const{gen:s,schema:i,data:c,it:u}=a;if((0,t.alwaysValidSchema)(u,i))return;const f=s.name("valid");s.forIn("key",c,m=>{a.setParams({propertyName:m}),a.subschema({keyword:"propertyNames",data:m,dataTypes:["string"],propertyName:m,compositeRule:!0},f),s.if((0,e.not)(f),()=>{a.error(!0),u.allErrors||s.break()})}),a.ok(f)}};return Uh.default=r,Uh}var $h={},_M;function S2(){if(_M)return $h;_M=1,Object.defineProperty($h,"__esModule",{value:!0});const e=To(),t=Mt(),n=ji(),r=on(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,t._)`{additionalProperty: ${i.additionalProperty}}`},code(i){const{gen:c,schema:u,parentSchema:f,data:m,errsCount:h,it:b}=i;if(!h)throw new Error("ajv implementation error");const{allErrors:y,opts:x}=b;if(b.props=!0,x.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(b,u))return;const E=(0,e.allSchemaProperties)(f.properties),w=(0,e.allSchemaProperties)(f.patternProperties);_(),i.ok((0,t._)`${h} === ${n.default.errors}`);function _(){c.forIn("key",m,I=>{!E.length&&!w.length?R(I):c.if(S(I),()=>R(I))})}function S(I){let A;if(E.length>8){const O=(0,r.schemaRefOrVal)(b,f.properties,"properties");A=(0,e.isOwnProperty)(c,O,I)}else E.length?A=(0,t.or)(...E.map(O=>(0,t._)`${I} === ${O}`)):A=t.nil;return w.length&&(A=(0,t.or)(A,...w.map(O=>(0,t._)`${(0,e.usePattern)(i,O)}.test(${I})`))),(0,t.not)(A)}function T(I){c.code((0,t._)`delete ${m}[${I}]`)}function R(I){if(x.removeAdditional==="all"||x.removeAdditional&&u===!1){T(I);return}if(u===!1){i.setParams({additionalProperty:I}),i.error(),y||c.break();return}if(typeof u=="object"&&!(0,r.alwaysValidSchema)(b,u)){const A=c.name("valid");x.removeAdditional==="failing"?(C(I,A,!1),c.if((0,t.not)(A),()=>{i.reset(),T(I)})):(C(I,A),y||c.if((0,t.not)(A),()=>c.break()))}}function C(I,A,O){const j={keyword:"additionalProperties",dataProp:I,dataPropType:r.Type.Str};O===!1&&Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(j,A)}}};return $h.default=s,$h}var zh={},TM;function Bq(){if(TM)return zh;TM=1,Object.defineProperty(zh,"__esModule",{value:!0});const e=oy(),t=To(),n=on(),r=S2(),a={keyword:"properties",type:"object",schemaType:"object",code(s){const{gen:i,schema:c,parentSchema:u,data:f,it:m}=s;m.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&r.default.code(new e.KeywordCxt(m,r.default,"additionalProperties"));const h=(0,t.allSchemaProperties)(c);for(const w of h)m.definedProperties.add(w);m.opts.unevaluated&&h.length&&m.props!==!0&&(m.props=n.mergeEvaluated.props(i,(0,n.toHash)(h),m.props));const b=h.filter(w=>!(0,n.alwaysValidSchema)(m,c[w]));if(b.length===0)return;const y=i.name("valid");for(const w of b)x(w)?E(w):(i.if((0,t.propertyInData)(i,f,w,m.opts.ownProperties)),E(w),m.allErrors||i.else().var(y,!0),i.endIf()),s.it.definedProperties.add(w),s.ok(y);function x(w){return m.opts.useDefaults&&!m.compositeRule&&c[w].default!==void 0}function E(w){s.subschema({keyword:"properties",schemaProp:w,dataProp:w},y)}}};return zh.default=a,zh}var Fh={},NM;function Hq(){if(NM)return Fh;NM=1,Object.defineProperty(Fh,"__esModule",{value:!0});const e=To(),t=Mt(),n=on(),r=on(),a={keyword:"patternProperties",type:"object",schemaType:"object",code(s){const{gen:i,schema:c,data:u,parentSchema:f,it:m}=s,{opts:h}=m,b=(0,e.allSchemaProperties)(c),y=b.filter(R=>(0,n.alwaysValidSchema)(m,c[R]));if(b.length===0||y.length===b.length&&(!m.opts.unevaluated||m.props===!0))return;const x=h.strictSchema&&!h.allowMatchingProperties&&f.properties,E=i.name("valid");m.props!==!0&&!(m.props instanceof t.Name)&&(m.props=(0,r.evaluatedPropsToName)(i,m.props));const{props:w}=m;_();function _(){for(const R of b)x&&S(R),m.allErrors?T(R):(i.var(E,!0),T(R),i.if(E))}function S(R){for(const C in x)new RegExp(R).test(C)&&(0,n.checkStrictMode)(m,`property ${C} matches pattern ${R} (use allowMatchingProperties)`)}function T(R){i.forIn("key",u,C=>{i.if((0,t._)`${(0,e.usePattern)(s,R)}.test(${C})`,()=>{const I=y.includes(R);I||s.subschema({keyword:"patternProperties",schemaProp:R,dataProp:C,dataPropType:r.Type.Str},E),m.opts.unevaluated&&w!==!0?i.assign((0,t._)`${w}[${C}]`,!0):!I&&!m.allErrors&&i.if((0,t.not)(E),()=>i.break())})})}}};return Fh.default=a,Fh}var Bh={},kM;function Vq(){if(kM)return Bh;kM=1,Object.defineProperty(Bh,"__esModule",{value:!0});const e=on(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:r,schema:a,it:s}=n;if((0,e.alwaysValidSchema)(s,a)){n.fail();return}const i=r.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),n.failResult(i,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return Bh.default=t,Bh}var Hh={},CM;function Gq(){if(CM)return Hh;CM=1,Object.defineProperty(Hh,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:To().validateUnion,error:{message:"must match a schema in anyOf"}};return Hh.default=t,Hh}var Vh={},RM;function Wq(){if(RM)return Vh;RM=1,Object.defineProperty(Vh,"__esModule",{value:!0});const e=Mt(),t=on(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:a})=>(0,e._)`{passingSchemas: ${a.passing}}`},code(a){const{gen:s,schema:i,parentSchema:c,it:u}=a;if(!Array.isArray(i))throw new Error("ajv implementation error");if(u.opts.discriminator&&c.discriminator)return;const f=i,m=s.let("valid",!1),h=s.let("passing",null),b=s.name("_valid");a.setParams({passing:h}),s.block(y),a.result(m,()=>a.reset(),()=>a.error(!0));function y(){f.forEach((x,E)=>{let w;(0,t.alwaysValidSchema)(u,x)?s.var(b,!0):w=a.subschema({keyword:"oneOf",schemaProp:E,compositeRule:!0},b),E>0&&s.if((0,e._)`${b} && ${m}`).assign(m,!1).assign(h,(0,e._)`[${h}, ${E}]`).else(),s.if(b,()=>{s.assign(m,!0),s.assign(h,E),w&&a.mergeEvaluated(w,e.Name)})})}}};return Vh.default=r,Vh}var Gh={},AM;function Kq(){if(AM)return Gh;AM=1,Object.defineProperty(Gh,"__esModule",{value:!0});const e=on(),t={keyword:"allOf",schemaType:"array",code(n){const{gen:r,schema:a,it:s}=n;if(!Array.isArray(a))throw new Error("ajv implementation error");const i=r.name("valid");a.forEach((c,u)=>{if((0,e.alwaysValidSchema)(s,c))return;const f=n.subschema({keyword:"allOf",schemaProp:u},i);n.ok(i),n.mergeEvaluated(f)})}};return Gh.default=t,Gh}var Wh={},IM;function Yq(){if(IM)return Wh;IM=1,Object.defineProperty(Wh,"__esModule",{value:!0});const e=Mt(),t=on(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,e.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,e._)`{failingKeyword: ${s.ifClause}}`},code(s){const{gen:i,parentSchema:c,it:u}=s;c.then===void 0&&c.else===void 0&&(0,t.checkStrictMode)(u,'"if" without "then" and "else" is ignored');const f=a(u,"then"),m=a(u,"else");if(!f&&!m)return;const h=i.let("valid",!0),b=i.name("_valid");if(y(),s.reset(),f&&m){const E=i.let("ifClause");s.setParams({ifClause:E}),i.if(b,x("then",E),x("else",E))}else f?i.if(b,x("then")):i.if((0,e.not)(b),x("else"));s.pass(h,()=>s.error(!0));function y(){const E=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},b);s.mergeEvaluated(E)}function x(E,w){return()=>{const _=s.subschema({keyword:E},b);i.assign(h,b),s.mergeValidEvaluated(_,h),w?i.assign(w,(0,e._)`${E}`):s.setParams({ifClause:E})}}}};function a(s,i){const c=s.schema[i];return c!==void 0&&!(0,t.alwaysValidSchema)(s,c)}return Wh.default=r,Wh}var Kh={},OM;function Zq(){if(OM)return Kh;OM=1,Object.defineProperty(Kh,"__esModule",{value:!0});const e=on(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:r,it:a}){r.if===void 0&&(0,e.checkStrictMode)(a,`"${n}" without "if" is ignored`)}};return Kh.default=t,Kh}var DM;function qq(){if(DM)return Lh;DM=1,Object.defineProperty(Lh,"__esModule",{value:!0});const e=E2(),t=Pq(),n=x2(),r=Uq(),a=$q(),s=zq(),i=Fq(),c=S2(),u=Bq(),f=Hq(),m=Vq(),h=Gq(),b=Wq(),y=Kq(),x=Yq(),E=Zq();function w(_=!1){const S=[m.default,h.default,b.default,y.default,x.default,E.default,i.default,c.default,s.default,u.default,f.default];return _?S.push(t.default,r.default):S.push(e.default,n.default),S.push(a.default),S}return Lh.default=w,Lh}var Yh={},Zh={},LM;function Xq(){if(LM)return Zh;LM=1,Object.defineProperty(Zh,"__esModule",{value:!0});const e=Mt(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must match format "${r}"`,params:({schemaCode:r})=>(0,e._)`{format: ${r}}`},code(r,a){const{gen:s,data:i,$data:c,schema:u,schemaCode:f,it:m}=r,{opts:h,errSchemaPath:b,schemaEnv:y,self:x}=m;if(!h.validateFormats)return;c?E():w();function E(){const _=s.scopeValue("formats",{ref:x.formats,code:h.code.formats}),S=s.const("fDef",(0,e._)`${_}[${f}]`),T=s.let("fType"),R=s.let("format");s.if((0,e._)`typeof ${S} == "object" && !(${S} instanceof RegExp)`,()=>s.assign(T,(0,e._)`${S}.type || "string"`).assign(R,(0,e._)`${S}.validate`),()=>s.assign(T,(0,e._)`"string"`).assign(R,S)),r.fail$data((0,e.or)(C(),I()));function C(){return h.strictSchema===!1?e.nil:(0,e._)`${f} && !${R}`}function I(){const A=y.$async?(0,e._)`(${S}.async ? await ${R}(${i}) : ${R}(${i}))`:(0,e._)`${R}(${i})`,O=(0,e._)`(typeof ${R} == "function" ? ${A} : ${R}.test(${i}))`;return(0,e._)`${R} && ${R} !== true && ${T} === ${a} && !${O}`}}function w(){const _=x.formats[u];if(!_){C();return}if(_===!0)return;const[S,T,R]=I(_);S===a&&r.pass(A());function C(){if(h.strictSchema===!1){x.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${u}" ignored in schema at path "${b}"`}}function I(O){const j=O instanceof RegExp?(0,e.regexpCode)(O):h.code.formats?(0,e._)`${h.code.formats}${(0,e.getProperty)(u)}`:void 0,U=s.scopeValue("formats",{key:u,ref:O,code:j});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,e._)`${U}.validate`]:["string",O,U]}function A(){if(typeof _=="object"&&!(_ instanceof RegExp)&&_.async){if(!y.$async)throw new Error("async format in sync schema");return(0,e._)`await ${R}(${i})`}return typeof T=="function"?(0,e._)`${R}(${i})`:(0,e._)`${R}.test(${i})`}}}};return Zh.default=n,Zh}var MM;function Jq(){if(MM)return Yh;MM=1,Object.defineProperty(Yh,"__esModule",{value:!0});const t=[Xq().default];return Yh.default=t,Yh}var ll={},jM;function Qq(){return jM||(jM=1,Object.defineProperty(ll,"__esModule",{value:!0}),ll.contentVocabulary=ll.metadataVocabulary=void 0,ll.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ll.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ll}var PM;function eX(){if(PM)return yh;PM=1,Object.defineProperty(yh,"__esModule",{value:!0});const e=_q(),t=jq(),n=qq(),r=Jq(),a=Qq(),s=[e.default,t.default,(0,n.default)(),r.default,a.metadataVocabulary,a.contentVocabulary];return yh.default=s,yh}var qh={},of={},UM;function tX(){if(UM)return of;UM=1,Object.defineProperty(of,"__esModule",{value:!0}),of.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(of.DiscrError=e={})),of}var $M;function nX(){if($M)return qh;$M=1,Object.defineProperty(qh,"__esModule",{value:!0});const e=Mt(),t=tX(),n=s_(),r=sy(),a=on(),i={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:f}})=>(0,e._)`{error: ${c}, tag: ${f}, tagValue: ${u}}`},code(c){const{gen:u,data:f,schema:m,parentSchema:h,it:b}=c,{oneOf:y}=h;if(!b.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(!y)throw new Error("discriminator: requires oneOf keyword");const E=u.let("valid",!1),w=u.const("tag",(0,e._)`${f}${(0,e.getProperty)(x)}`);u.if((0,e._)`typeof ${w} == "string"`,()=>_(),()=>c.error(!1,{discrError:t.DiscrError.Tag,tag:w,tagName:x})),c.ok(E);function _(){const R=T();u.if(!1);for(const C in R)u.elseIf((0,e._)`${w} === ${C}`),u.assign(E,S(R[C]));u.else(),c.error(!1,{discrError:t.DiscrError.Mapping,tag:w,tagName:x}),u.endIf()}function S(R){const C=u.name("valid"),I=c.subschema({keyword:"oneOf",schemaProp:R},C);return c.mergeEvaluated(I,e.Name),C}function T(){var R;const C={},I=O(h);let A=!0;for(let B=0;B<y.length;B++){let W=y[B];if(W?.$ref&&!(0,a.schemaHasRulesButRef)(W,b.self.RULES)){const ee=W.$ref;if(W=n.resolveRef.call(b.self,b.schemaEnv.root,b.baseId,ee),W instanceof n.SchemaEnv&&(W=W.schema),W===void 0)throw new r.default(b.opts.uriResolver,b.baseId,ee)}const J=(R=W?.properties)===null||R===void 0?void 0:R[x];if(typeof J!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${x}"`);A=A&&(I||O(W)),j(J,B)}if(!A)throw new Error(`discriminator: "${x}" must be required`);return C;function O({required:B}){return Array.isArray(B)&&B.includes(x)}function j(B,W){if(B.const)U(B.const,W);else if(B.enum)for(const J of B.enum)U(J,W);else throw new Error(`discriminator: "properties/${x}" must have "const" or "enum"`)}function U(B,W){if(typeof B!="string"||B in C)throw new Error(`discriminator: "${x}" values must be unique strings`);C[B]=W}}}};return qh.default=i,qh}const rX="http://json-schema.org/draft-07/schema#",aX="http://json-schema.org/draft-07/schema#",oX="Core schema meta-schema",sX={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:[]}},iX=["object","boolean"],lX={$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:"#"}},cX={$schema:rX,$id:aX,title:oX,definitions:sX,type:iX,properties:lX,default:!0};var zM;function _2(){return zM||(zM=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=Eq(),r=eX(),a=nX(),s=cX,i=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(x=>this.addVocabulary(x)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const x=this.opts.$data?this.$dataMetaSchema(s,i):s;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 f=oy();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return f.KeywordCxt}});var m=Mt();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=o_();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var b=sy();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return b.default}})})(ph,ph.exports)),ph.exports}var uX=_2(),Xh={exports:{}},Tw={},FM;function dX(){return FM||(FM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(B,W){return{validate:B,compare:W}}e.fullFormats={date:t(s,i),time:t(u(!0),f),"date-time":t(b(!0),y),"iso-time":t(u(),m),"iso-date-time":t(b(),x),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"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:U,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:T,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$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"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,y),"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 r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(B){const W=r.exec(B);if(!W)return!1;const J=+W[1],ee=+W[2],re=+W[3];return ee>=1&&ee<=12&&re>=1&&re<=(ee===2&&n(J)?29:a[ee])}function i(B,W){if(B&&W)return B>W?1:B<W?-1:0}const c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(B){return function(J){const ee=c.exec(J);if(!ee)return!1;const re=+ee[1],F=+ee[2],K=+ee[3],V=ee[4],ne=ee[5]==="-"?-1:1,te=+(ee[6]||0),D=+(ee[7]||0);if(te>23||D>59||B&&!V)return!1;if(re<=23&&F<=59&&K<60)return!0;const H=F-D*ne,$=re-te*ne-(H<0?1:0);return($===23||$===-1)&&(H===59||H===-1)&&K<61}}function f(B,W){if(!(B&&W))return;const J=new Date("2020-01-01T"+B).valueOf(),ee=new Date("2020-01-01T"+W).valueOf();if(J&&ee)return J-ee}function m(B,W){if(!(B&&W))return;const J=c.exec(B),ee=c.exec(W);if(J&&ee)return B=J[1]+J[2]+J[3],W=ee[1]+ee[2]+ee[3],B>W?1:B<W?-1:0}const h=/t|\s/i;function b(B){const W=u(B);return function(ee){const re=ee.split(h);return re.length===2&&s(re[0])&&W(re[1])}}function y(B,W){if(!(B&&W))return;const J=new Date(B).valueOf(),ee=new Date(W).valueOf();if(J&&ee)return J-ee}function x(B,W){if(!(B&&W))return;const[J,ee]=B.split(h),[re,F]=W.split(h),K=i(J,re);if(K!==void 0)return K||f(ee,F)}const E=/\/|:/,w=/^(?:[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 _(B){return E.test(B)&&w.test(B)}const S=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function T(B){return S.lastIndex=0,S.test(B)}const R=-2147483648,C=2**31-1;function I(B){return Number.isInteger(B)&&B<=C&&B>=R}function A(B){return Number.isInteger(B)}function O(){return!0}const j=/[^\\]\\Z/;function U(B){if(j.test(B))return!1;try{return new RegExp(B),!0}catch{return!1}}})(Tw)),Tw}var Nw={},BM;function fX(){return BM||(BM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=_2(),n=Mt(),r=n.operators,a={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},s={message:({keyword:c,schemaCode:u})=>(0,n.str)`should be ${a[c].okStr} ${u}`,params:({keyword:c,schemaCode:u})=>(0,n._)`{comparison: ${a[c].okStr}, limit: ${u}}`};e.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:s,code(c){const{gen:u,data:f,schemaCode:m,keyword:h,it:b}=c,{opts:y,self:x}=b;if(!y.validateFormats)return;const E=new t.KeywordCxt(b,x.RULES.all.format.definition,"format");E.$data?w():_();function w(){const T=u.scopeValue("formats",{ref:x.formats,code:y.code.formats}),R=u.const("fmt",(0,n._)`${T}[${E.schemaCode}]`);c.fail$data((0,n.or)((0,n._)`typeof ${R} != "object"`,(0,n._)`${R} instanceof RegExp`,(0,n._)`typeof ${R}.compare != "function"`,S(R)))}function _(){const T=E.schema,R=x.formats[T];if(!R||R===!0)return;if(typeof R!="object"||R instanceof RegExp||typeof R.compare!="function")throw new Error(`"${h}": format "${T}" does not define "compare" function`);const C=u.scopeValue("formats",{key:T,ref:R,code:y.code.formats?(0,n._)`${y.code.formats}${(0,n.getProperty)(T)}`:void 0});c.fail$data(S(C))}function S(T){return(0,n._)`${T}.compare(${f}, ${m}) ${a[h].fail} 0`}},dependencies:["format"]};const i=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=i})(Nw)),Nw}var HM;function pX(){return HM||(HM=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=dX(),r=fX(),a=Mt(),s=new a.Name("fullFormats"),i=new a.Name("fastFormats"),c=(f,m={keywords:!0})=>{if(Array.isArray(m))return u(f,m,n.fullFormats,s),f;const[h,b]=m.mode==="fast"?[n.fastFormats,i]:[n.fullFormats,s],y=m.formats||n.formatNames;return u(f,y,h,b),m.keywords&&(0,r.default)(f),f};c.get=(f,m="full")=>{const b=(m==="fast"?n.fastFormats:n.fullFormats)[f];if(!b)throw new Error(`Unknown format "${f}"`);return b};function u(f,m,h,b){var y,x;(y=(x=f.opts.code).formats)!==null&&y!==void 0||(x.formats=(0,a._)`require("ajv-formats/dist/formats").${b}`);for(const E of m)f.addFormat(E,h[E])}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c})(Xh,Xh.exports)),Xh.exports}var mX=pX();const hX=bp(mX);function gX(){const e=new uX.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return hX(e),e}class bX{constructor(t){this._ajv=t??gX()}getValidator(t){var n;const r="$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 a=>r(a)?{valid:!0,data:a,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class yX{constructor(t){this._client=t}async*callToolStream(t,n=ty,r){var a;const s=this._client,i={...r,task:(a=r?.task)!==null&&a!==void 0?a:s.isToolTask(t.name)?{}:void 0},c=s.requestStream({method:"tools/call",params:t},n,i),u=s.getToolOutputValidator(t.name);for await(const f of c){if(f.type==="result"&&u){const m=f.result;if(!m.structuredContent&&!m.isError){yield{type:"error",error:new ut(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 ut(wt.InvalidParams,`Structured content does not match the tool's output schema: ${h.errorMessage}`)};return}}catch(h){if(h instanceof ut){yield{type:"error",error:h};return}yield{type:"error",error:new ut(wt.InvalidParams,`Failed to validate structured content: ${h instanceof Error?h.message:String(h)}`)};return}}yield f}}async getTask(t,n){return this._client.getTask({taskId:t},n)}async getTaskResult(t,n,r){return this._client.getTaskResult({taskId:t},n,r)}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,r){return this._client.requestStream(t,n,r)}}function vX(e,t,n){var r;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!(!((r=e.tools)===null||r===void 0)&&r.call))throw new Error(`${n} does not support task creation for tools/call (required for ${t})`);break}}function wX(e,t,n){var r,a;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!(!((r=e.sampling)===null||r===void 0)&&r.createMessage))throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!(!((a=e.elicitation)===null||a===void 0)&&a.create))throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break}}function _g(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){const n=t,r=e.properties;for(const a of Object.keys(r)){const s=r[a];n[a]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(n[a]=s.default),n[a]!==void 0&&_g(s,n[a])}}if(Array.isArray(e.anyOf))for(const n of e.anyOf)typeof n!="boolean"&&_g(n,t);if(Array.isArray(e.oneOf))for(const n of e.oneOf)typeof n!="boolean"&&_g(n,t)}}function EX(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 VM extends aq{constructor(t,n){var r,a;super(n),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(r=n?.capabilities)!==null&&r!==void 0?r:{},this._jsonSchemaValidator=(a=n?.jsonSchemaValidator)!==null&&a!==void 0?a:new bX,n?.listChanged&&(this._pendingListChangedConfig=n.listChanged)}_setupListChangedHandlers(t){var n,r,a,s,i,c;t.tools&&(!((r=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tools)===null||r===void 0)&&r.listChanged)&&this._setupListChangedHandler("tools",u2,t.tools,async()=>(await this.listTools()).tools),t.prompts&&(!((s=(a=this._serverCapabilities)===null||a===void 0?void 0:a.prompts)===null||s===void 0)&&s.listChanged)&&this._setupListChangedHandler("prompts",i2,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&(!((c=(i=this._serverCapabilities)===null||i===void 0?void 0:i.resources)===null||c===void 0)&&c.listChanged)&&this._setupListChangedHandler("resources",a2,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new yX(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=oq(this._capabilities,t)}setRequestHandler(t,n){var r,a,s;const i=g2(t),c=i?.method;if(!c)throw new Error("Schema is missing a method literal");let u;if(ny(c)){const m=c,h=(r=m._zod)===null||r===void 0?void 0:r.def;u=(a=h?.value)!==null&&a!==void 0?a:m.value}else{const m=c,h=m._def;u=(s=h?.value)!==null&&s!==void 0?s:m.value}if(typeof u!="string")throw new Error("Schema method literal must be a string");const f=u;if(f==="elicitation/create"){const m=async(h,b)=>{var y,x,E;const w=bi(a_,h);if(!w.success){const j=w.error instanceof Error?w.error.message:String(w.error);throw new ut(wt.InvalidParams,`Invalid elicitation request: ${j}`)}const{params:_}=w.data,S=(y=_.mode)!==null&&y!==void 0?y:"form",{supportsFormMode:T,supportsUrlMode:R}=EX(this._capabilities.elicitation);if(S==="form"&&!T)throw new ut(wt.InvalidParams,"Client does not support form-mode elicitation requests");if(S==="url"&&!R)throw new ut(wt.InvalidParams,"Client does not support URL-mode elicitation requests");const C=await Promise.resolve(n(h,b));if(_.task){const j=bi(Gf,C);if(!j.success){const U=j.error instanceof Error?j.error.message:String(j.error);throw new ut(wt.InvalidParams,`Invalid task creation result: ${U}`)}return j.data}const I=bi(f2,C);if(!I.success){const j=I.error instanceof Error?I.error.message:String(I.error);throw new ut(wt.InvalidParams,`Invalid elicitation result: ${j}`)}const A=I.data,O=S==="form"?_.requestedSchema:void 0;if(S==="form"&&A.action==="accept"&&A.content&&O&&!((E=(x=this._capabilities.elicitation)===null||x===void 0?void 0:x.form)===null||E===void 0)&&E.applyDefaults)try{_g(O,A.content)}catch{}return A};return super.setRequestHandler(t,m)}if(f==="sampling/createMessage"){const m=async(h,b)=>{const y=bi(n_,h);if(!y.success){const _=y.error instanceof Error?y.error.message:String(y.error);throw new ut(wt.InvalidParams,`Invalid sampling request: ${_}`)}const{params:x}=y.data,E=await Promise.resolve(n(h,b));if(x.task){const _=bi(Gf,E);if(!_.success){const S=_.error instanceof Error?_.error.message:String(_.error);throw new ut(wt.InvalidParams,`Invalid task creation result: ${S}`)}return _.data}const w=bi(r_,E);if(!w.success){const _=w.error instanceof Error?w.error.message:String(w.error);throw new ut(wt.InvalidParams,`Invalid sampling result: ${_}`)}return w.data};return super.setRequestHandler(t,m)}return super.setRequestHandler(t,n)}assertCapability(t,n){var r;if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r[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 r=await this.request({method:"initialize",params:{protocolVersion:Jb,capabilities:this._capabilities,clientInfo:this._clientInfo}},Zz,n);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!TY.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var n,r,a,s,i;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(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.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(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.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(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.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,r;vX((r=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tasks)===null||r===void 0?void 0:r.requests,t,"Server")}assertTaskHandlerCapability(t){var n;this._capabilities&&wX((n=this._capabilities.tasks)===null||n===void 0?void 0:n.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Kc,t)}async complete(t,n){return this.request({method:"completion/complete",params:t},p2,n)}async setLoggingLevel(t,n){return this.request({method:"logging/setLevel",params:{level:t}},Kc,n)}async getPrompt(t,n){return this.request({method:"prompts/get",params:t},s2,n)}async listPrompts(t,n){return this.request({method:"prompts/list",params:t},o2,n)}async listResources(t,n){return this.request({method:"resources/list",params:t},t2,n)}async listResourceTemplates(t,n){return this.request({method:"resources/templates/list",params:t},n2,n)}async readResource(t,n){return this.request({method:"resources/read",params:t},r2,n)}async subscribeResource(t,n){return this.request({method:"resources/subscribe",params:t},Kc,n)}async unsubscribeResource(t,n){return this.request({method:"resources/unsubscribe",params:t},Kc,n)}async callTool(t,n=ty,r){if(this.isToolTaskRequired(t.name))throw new ut(wt.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const a=await this.request({method:"tools/call",params:t},n,r),s=this.getToolOutputValidator(t.name);if(s){if(!a.structuredContent&&!a.isError)throw new ut(wt.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(a.structuredContent)try{const i=s(a.structuredContent);if(!i.valid)throw new ut(wt.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof ut?i:new ut(wt.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return a}isToolTask(t){var n,r,a,s;return!((s=(a=(r=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tasks)===null||r===void 0?void 0:r.requests)===null||a===void 0?void 0:a.tools)===null||s===void 0)&&s.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 r of t){if(r.outputSchema){const s=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,s)}const a=(n=r.execution)===null||n===void 0?void 0:n.taskSupport;(a==="required"||a==="optional")&&this._cachedKnownTaskTools.add(r.name),a==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,n){const r=await this.request({method:"tools/list",params:t},c2,n);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(t,n,r,a){const s=yZ.safeParse(r);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof r.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:i,debounceMs:c}=s.data,{onChanged:u}=r,f=async()=>{if(!i){u(null,null);return}try{const h=await a();u(null,h)}catch(h){const b=h instanceof Error?h:new Error(String(h));u(b,null)}},m=()=>{if(c){const h=this._listChangedDebounceTimers.get(t);h&&clearTimeout(h);const b=setTimeout(f,c);this._listChangedDebounceTimers.set(t,b)}else f()};this.setNotificationHandler(n,m)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Qg(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function T2(e=fetch,t){return t?async(n,r)=>{const a={...t,...r,headers:r?.headers?{...Qg(t.headers),...Qg(r.headers)}:t.headers};return e(n,a)}:e}let l_;l_=globalThis.crypto;async function xX(e){return(await l_).getRandomValues(new Uint8Array(e))}async function SX(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let n="";const r=await xX(e);for(let a=0;a<e;a++){const s=r[a]%t.length;n+=t[s]}return n}async function _X(e){return await SX(e)}async function TX(e){const t=await(await l_).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function NX(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await _X(e),n=await TX(t);return{code_verifier:t,code_challenge:n}}const jr=DK().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:SY.custom,message:"URL must be parseable",fatal:!0}),aG}).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"}),kX=Ea({resource:de().url(),authorization_servers:Fe(jr).optional(),jwks_uri:de().url().optional(),scopes_supported:Fe(de()).optional(),bearer_methods_supported:Fe(de()).optional(),resource_signing_alg_values_supported:Fe(de()).optional(),resource_name:de().optional(),resource_documentation:de().optional(),resource_policy_uri:de().url().optional(),resource_tos_uri:de().url().optional(),tls_client_certificate_bound_access_tokens:Dn().optional(),authorization_details_types_supported:Fe(de()).optional(),dpop_signing_alg_values_supported:Fe(de()).optional(),dpop_bound_access_tokens_required:Dn().optional()}),N2=Ea({issuer:de(),authorization_endpoint:jr,token_endpoint:jr,registration_endpoint:jr.optional(),scopes_supported:Fe(de()).optional(),response_types_supported:Fe(de()),response_modes_supported:Fe(de()).optional(),grant_types_supported:Fe(de()).optional(),token_endpoint_auth_methods_supported:Fe(de()).optional(),token_endpoint_auth_signing_alg_values_supported:Fe(de()).optional(),service_documentation:jr.optional(),revocation_endpoint:jr.optional(),revocation_endpoint_auth_methods_supported:Fe(de()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Fe(de()).optional(),introspection_endpoint:de().optional(),introspection_endpoint_auth_methods_supported:Fe(de()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Fe(de()).optional(),code_challenge_methods_supported:Fe(de()).optional(),client_id_metadata_document_supported:Dn().optional()}),CX=Ea({issuer:de(),authorization_endpoint:jr,token_endpoint:jr,userinfo_endpoint:jr.optional(),jwks_uri:jr,registration_endpoint:jr.optional(),scopes_supported:Fe(de()).optional(),response_types_supported:Fe(de()),response_modes_supported:Fe(de()).optional(),grant_types_supported:Fe(de()).optional(),acr_values_supported:Fe(de()).optional(),subject_types_supported:Fe(de()),id_token_signing_alg_values_supported:Fe(de()),id_token_encryption_alg_values_supported:Fe(de()).optional(),id_token_encryption_enc_values_supported:Fe(de()).optional(),userinfo_signing_alg_values_supported:Fe(de()).optional(),userinfo_encryption_alg_values_supported:Fe(de()).optional(),userinfo_encryption_enc_values_supported:Fe(de()).optional(),request_object_signing_alg_values_supported:Fe(de()).optional(),request_object_encryption_alg_values_supported:Fe(de()).optional(),request_object_encryption_enc_values_supported:Fe(de()).optional(),token_endpoint_auth_methods_supported:Fe(de()).optional(),token_endpoint_auth_signing_alg_values_supported:Fe(de()).optional(),display_values_supported:Fe(de()).optional(),claim_types_supported:Fe(de()).optional(),claims_supported:Fe(de()).optional(),service_documentation:de().optional(),claims_locales_supported:Fe(de()).optional(),ui_locales_supported:Fe(de()).optional(),claims_parameter_supported:Dn().optional(),request_parameter_supported:Dn().optional(),request_uri_parameter_supported:Dn().optional(),require_request_uri_registration:Dn().optional(),op_policy_uri:jr.optional(),op_tos_uri:jr.optional(),client_id_metadata_document_supported:Dn().optional()}),RX=Pe({...CX.shape,...N2.pick({code_challenge_methods_supported:!0}).shape}),AX=Pe({access_token:de(),id_token:de().optional(),token_type:de(),expires_in:_Y().optional(),scope:de().optional(),refresh_token:de().optional()}).strip(),IX=Pe({error:de(),error_description:de().optional(),error_uri:de().optional()}),GM=jr.optional().or(et("").transform(()=>{})),OX=Pe({redirect_uris:Fe(jr),token_endpoint_auth_method:de().optional(),grant_types:Fe(de()).optional(),response_types:Fe(de()).optional(),client_name:de().optional(),client_uri:jr.optional(),logo_uri:GM,scope:de().optional(),contacts:Fe(de()).optional(),tos_uri:GM,policy_uri:de().optional(),jwks_uri:jr.optional(),jwks:QK().optional(),software_id:de().optional(),software_version:de().optional(),software_statement:de().optional()}).strip(),DX=Pe({client_id:de(),client_secret:de().optional(),client_id_issued_at:vn().optional(),client_secret_expires_at:vn().optional()}).strip(),LX=OX.merge(DX);Pe({error:de(),error_description:de().optional()}).strip();Pe({token:de(),token_type_hint:de().optional()}).strip();function MX(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function jX({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),r=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;const a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return a.startsWith(s)}class Cr 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 BE extends Cr{}BE.errorCode="invalid_request";class eb extends Cr{}eb.errorCode="invalid_client";class tb extends Cr{}tb.errorCode="invalid_grant";class nb extends Cr{}nb.errorCode="unauthorized_client";class HE extends Cr{}HE.errorCode="unsupported_grant_type";class VE extends Cr{}VE.errorCode="invalid_scope";class GE extends Cr{}GE.errorCode="access_denied";class Ru extends Cr{}Ru.errorCode="server_error";class WE extends Cr{}WE.errorCode="temporarily_unavailable";class KE extends Cr{}KE.errorCode="unsupported_response_type";class YE extends Cr{}YE.errorCode="unsupported_token_type";class ZE extends Cr{}ZE.errorCode="invalid_token";class qE extends Cr{}qE.errorCode="method_not_allowed";class XE extends Cr{}XE.errorCode="too_many_requests";class rb extends Cr{}rb.errorCode="invalid_client_metadata";class JE extends Cr{}JE.errorCode="insufficient_scope";class QE extends Cr{}QE.errorCode="invalid_target";const PX={[BE.errorCode]:BE,[eb.errorCode]:eb,[tb.errorCode]:tb,[nb.errorCode]:nb,[HE.errorCode]:HE,[VE.errorCode]:VE,[GE.errorCode]:GE,[Ru.errorCode]:Ru,[WE.errorCode]:WE,[KE.errorCode]:KE,[YE.errorCode]:YE,[ZE.errorCode]:ZE,[qE.errorCode]:qE,[XE.errorCode]:XE,[rb.errorCode]:rb,[JE.errorCode]:JE,[QE.errorCode]:QE};class Ja extends Error{constructor(t){super(t??"Unauthorized")}}function UX(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const kw="code",Cw="S256";function k2(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&&UX(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 $X(e,t,n,r){const{client_id:a,client_secret:s}=t;switch(e){case"client_secret_basic":zX(a,s,n);return;case"client_secret_post":FX(a,s,r);return;case"none":BX(a,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function zX(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const r=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${r}`)}function FX(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function BX(e,t){t.set("client_id",e)}async function c_(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=IX.parse(JSON.parse(n)),{error:a,error_description:s,error_uri:i}=r,c=PX[a]||Ru;return new c(s||"",i)}catch(r){const a=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new Ru(a)}}async function Es(e,t){var n,r;try{return await Rw(e,t)}catch(a){if(a instanceof eb||a instanceof nb)return await((n=e.invalidateCredentials)===null||n===void 0?void 0:n.call(e,"all")),await Rw(e,t);if(a instanceof tb)return await((r=e.invalidateCredentials)===null||r===void 0?void 0:r.call(e,"tokens")),await Rw(e,t);throw a}}async function Rw(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:a,fetchFn:s}){var i,c;let u,f;try{u=await A2(t,{resourceMetadataUrl:a},s),u.authorization_servers&&u.authorization_servers.length>0&&(f=u.authorization_servers[0])}catch{}f||(f=new URL("/",t));const m=await R2(t,e,u),h=await O2(f,{fetchFn:s});let b=await Promise.resolve(e.clientInformation());if(!b){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const S=h?.client_id_metadata_document_supported===!0,T=e.clientMetadataUrl;if(T&&!C2(T))throw new rb(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${T}`);if(S&&T)b={client_id:T},await((i=e.saveClientInformation)===null||i===void 0?void 0:i.call(e,b));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const C=await U2(f,{metadata:h,clientMetadata:e.clientMetadata,fetchFn:s});await e.saveClientInformation(C),b=C}}const y=!e.redirectUrl;if(n!==void 0||y){const S=await P2(e,f,{metadata:h,resource:m,authorizationCode:n,fetchFn:s});return await e.saveTokens(S),"AUTHORIZED"}const x=await e.tokens();if(x?.refresh_token)try{const S=await j2(f,{metadata:h,clientInformation:b,refreshToken:x.refresh_token,resource:m,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(S),"AUTHORIZED"}catch(S){if(!(!(S instanceof Cr)||S instanceof Ru))throw S}const E=e.state?await e.state():void 0,{authorizationUrl:w,codeVerifier:_}=await D2(f,{metadata:h,clientInformation:b,state:E,redirectUrl:e.redirectUrl,scope:r||((c=u?.scopes_supported)===null||c===void 0?void 0:c.join(" "))||e.clientMetadata.scope,resource:m});return await e.saveCodeVerifier(_),await e.redirectToAuthorization(w),"REDIRECT"}function C2(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function R2(e,t,n){const r=MX(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!jX({requestedResource:r,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Wf(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const a=Aw(e,"resource_metadata")||void 0;let s;if(a)try{s=new URL(a)}catch{}const i=Aw(e,"scope")||void 0,c=Aw(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:c}}function Aw(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),a=n.match(r);return a?a[1]||a[2]:null}async function A2(e,t,n=fetch){var r,a;const s=await GX(e,"oauth-protected-resource",n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!s||s.status===404)throw await((r=s?.body)===null||r===void 0?void 0:r.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await((a=s.body)===null||a===void 0?void 0:a.cancel()),new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return kX.parse(await s.json())}async function u_(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?u_(e,void 0,n):void 0;throw r}}function HX(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function WM(e,t,n=fetch){return await u_(e,{"MCP-Protocol-Version":t},n)}function VX(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function GX(e,t,n,r){var a,s;const i=new URL(e),c=(a=r?.protocolVersion)!==null&&a!==void 0?a:Jb;let u;if(r?.metadataUrl)u=new URL(r.metadataUrl);else{const m=HX(t,i.pathname);u=new URL(m,(s=r?.metadataServerUrl)!==null&&s!==void 0?s:i),u.search=i.search}let f=await WM(u,c,n);if(!r?.metadataUrl&&VX(f,i.pathname)){const m=new URL(`/.well-known/${t}`,i);f=await WM(m,c,n)}return f}function I2(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function O2(e,{fetchFn:t=fetch,protocolVersion:n=Jb}={}){var r;const a={"MCP-Protocol-Version":n,Accept:"application/json"},s=I2(e);for(const{url:i,type:c}of s){const u=await u_(i,a,t);if(u){if(!u.ok){if(await((r=u.body)===null||r===void 0?void 0:r.cancel()),u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${c==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return c==="oauth"?N2.parse(await u.json()):RX.parse(await u.json())}}}async function D2(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:s,resource:i}){let c;if(t){if(c=new URL(t.authorization_endpoint),!t.response_types_supported.includes(kw))throw new Error(`Incompatible auth server: does not support response type ${kw}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Cw))throw new Error(`Incompatible auth server: does not support code challenge method ${Cw}`)}else c=new URL("/authorize",e);const u=await NX(),f=u.code_verifier,m=u.code_challenge;return c.searchParams.set("response_type",kw),c.searchParams.set("client_id",n.client_id),c.searchParams.set("code_challenge",m),c.searchParams.set("code_challenge_method",Cw),c.searchParams.set("redirect_uri",String(r)),s&&c.searchParams.set("state",s),a&&c.searchParams.set("scope",a),a?.includes("offline_access")&&c.searchParams.append("prompt","consent"),i&&c.searchParams.set("resource",i.href),{authorizationUrl:c,codeVerifier:f}}function L2(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function M2(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:a,resource:s,fetchFn:i}){var c;const u=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),f=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&n.set("resource",s.href),a)await a(f,n,u,t);else if(r){const h=(c=t?.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],b=k2(r,h);$X(b,r,f,n)}const m=await(i??fetch)(u,{method:"POST",headers:f,body:n});if(!m.ok)throw await c_(m);return AX.parse(await m.json())}async function j2(e,{metadata:t,clientInformation:n,refreshToken:r,resource:a,addClientAuthentication:s,fetchFn:i}){const c=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),u=await M2(e,{metadata:t,tokenRequestParams:c,clientInformation:n,addClientAuthentication:s,resource:a,fetchFn:i});return{refresh_token:r,...u}}async function P2(e,t,{metadata:n,resource:r,authorizationCode:a,fetchFn:s}={}){const i=e.clientMetadata.scope;let c;if(e.prepareTokenRequest&&(c=await e.prepareTokenRequest(i)),!c){if(!a)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const f=await e.codeVerifier();c=L2(a,f,e.redirectUrl)}const u=await e.clientInformation();return M2(t,{metadata:n,tokenRequestParams:c,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:s})}async function U2(e,{metadata:t,clientMetadata:n,fetchFn:r}){let a;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(t.registration_endpoint)}else a=new URL("/register",e);const s=await(r??fetch)(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok)throw await c_(s);return LX.parse(await s.json())}const KM=Object.freeze(Object.defineProperty({__proto__:null,UnauthorizedError:Ja,auth:Es,buildDiscoveryUrls:I2,discoverAuthorizationServerMetadata:O2,discoverOAuthProtectedResourceMetadata:A2,extractWWWAuthenticateParams:Wf,fetchToken:P2,isHttpsUrl:C2,parseErrorResponse:c_,prepareAuthorizationCodeRequest:L2,refreshAuthorization:j2,registerClient:U2,selectClientAuthMethod:k2,selectResourceURL:R2,startAuthorization:D2},Symbol.toStringTag,{value:"Module"}));class YM 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 Iw(e){}function $2(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=Iw,onError:n=Iw,onRetry:r=Iw,onComment:a}=e;let s="",i=!0,c,u="",f="";function m(E){const w=i?E.replace(/^\xEF\xBB\xBF/,""):E,[_,S]=WX(`${s}${w}`);for(const T of _)h(T);s=S,i=!1}function h(E){if(E===""){y();return}if(E.startsWith(":")){a&&a(E.slice(E.startsWith(": ")?2:1));return}const w=E.indexOf(":");if(w!==-1){const _=E.slice(0,w),S=E[w+1]===" "?2:1,T=E.slice(w+S);b(_,T,E);return}b(E,"",E)}function b(E,w,_){switch(E){case"event":f=w;break;case"data":u=`${u}${w}
29
+ deps: ${m}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[f,m]=s(u);i(u,f),c(u,m)}};function s({schema:u}){const f={},m={};for(const h in u){if(h==="__proto__")continue;const b=Array.isArray(u[h])?f:m;b[h]=u[h]}return[f,m]}function i(u,f=u.schema){const{gen:m,data:h,it:b}=u;if(Object.keys(f).length===0)return;const y=m.let("missing");for(const x in f){const E=f[x];if(E.length===0)continue;const w=(0,r.propertyInData)(m,h,x,b.opts.ownProperties);u.setParams({property:x,depsCount:E.length,deps:E.join(", ")}),b.allErrors?m.if(w,()=>{for(const _ of E)(0,r.checkReportMissingProp)(u,_)}):(m.if((0,t._)`${w} && (${(0,r.checkMissingProp)(u,E,y)})`),(0,r.reportMissingProp)(u,y),m.else())}}e.validatePropertyDeps=i;function c(u,f=u.schema){const{gen:m,data:h,keyword:b,it:y}=u,x=m.name("valid");for(const E in f)(0,n.alwaysValidSchema)(y,f[E])||(m.if((0,r.propertyInData)(m,h,E,y.opts.ownProperties),()=>{const w=u.subschema({keyword:b,schemaProp:E},x);u.mergeValidEvaluated(w,x)},()=>m.var(x,!0)),u.ok(x))}e.validateSchemaDeps=c,e.default=a})(_w)),_w}var Uh={},SM;function Fq(){if(SM)return Uh;SM=1,Object.defineProperty(Uh,"__esModule",{value:!0});const e=Mt(),t=on(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:a})=>(0,e._)`{propertyName: ${a.propertyName}}`},code(a){const{gen:s,schema:i,data:c,it:u}=a;if((0,t.alwaysValidSchema)(u,i))return;const f=s.name("valid");s.forIn("key",c,m=>{a.setParams({propertyName:m}),a.subschema({keyword:"propertyNames",data:m,dataTypes:["string"],propertyName:m,compositeRule:!0},f),s.if((0,e.not)(f),()=>{a.error(!0),u.allErrors||s.break()})}),a.ok(f)}};return Uh.default=r,Uh}var $h={},_M;function S2(){if(_M)return $h;_M=1,Object.defineProperty($h,"__esModule",{value:!0});const e=To(),t=Mt(),n=ji(),r=on(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,t._)`{additionalProperty: ${i.additionalProperty}}`},code(i){const{gen:c,schema:u,parentSchema:f,data:m,errsCount:h,it:b}=i;if(!h)throw new Error("ajv implementation error");const{allErrors:y,opts:x}=b;if(b.props=!0,x.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(b,u))return;const E=(0,e.allSchemaProperties)(f.properties),w=(0,e.allSchemaProperties)(f.patternProperties);_(),i.ok((0,t._)`${h} === ${n.default.errors}`);function _(){c.forIn("key",m,I=>{!E.length&&!w.length?R(I):c.if(S(I),()=>R(I))})}function S(I){let A;if(E.length>8){const O=(0,r.schemaRefOrVal)(b,f.properties,"properties");A=(0,e.isOwnProperty)(c,O,I)}else E.length?A=(0,t.or)(...E.map(O=>(0,t._)`${I} === ${O}`)):A=t.nil;return w.length&&(A=(0,t.or)(A,...w.map(O=>(0,t._)`${(0,e.usePattern)(i,O)}.test(${I})`))),(0,t.not)(A)}function T(I){c.code((0,t._)`delete ${m}[${I}]`)}function R(I){if(x.removeAdditional==="all"||x.removeAdditional&&u===!1){T(I);return}if(u===!1){i.setParams({additionalProperty:I}),i.error(),y||c.break();return}if(typeof u=="object"&&!(0,r.alwaysValidSchema)(b,u)){const A=c.name("valid");x.removeAdditional==="failing"?(C(I,A,!1),c.if((0,t.not)(A),()=>{i.reset(),T(I)})):(C(I,A),y||c.if((0,t.not)(A),()=>c.break()))}}function C(I,A,O){const j={keyword:"additionalProperties",dataProp:I,dataPropType:r.Type.Str};O===!1&&Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(j,A)}}};return $h.default=s,$h}var zh={},TM;function Bq(){if(TM)return zh;TM=1,Object.defineProperty(zh,"__esModule",{value:!0});const e=oy(),t=To(),n=on(),r=S2(),a={keyword:"properties",type:"object",schemaType:"object",code(s){const{gen:i,schema:c,parentSchema:u,data:f,it:m}=s;m.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&r.default.code(new e.KeywordCxt(m,r.default,"additionalProperties"));const h=(0,t.allSchemaProperties)(c);for(const w of h)m.definedProperties.add(w);m.opts.unevaluated&&h.length&&m.props!==!0&&(m.props=n.mergeEvaluated.props(i,(0,n.toHash)(h),m.props));const b=h.filter(w=>!(0,n.alwaysValidSchema)(m,c[w]));if(b.length===0)return;const y=i.name("valid");for(const w of b)x(w)?E(w):(i.if((0,t.propertyInData)(i,f,w,m.opts.ownProperties)),E(w),m.allErrors||i.else().var(y,!0),i.endIf()),s.it.definedProperties.add(w),s.ok(y);function x(w){return m.opts.useDefaults&&!m.compositeRule&&c[w].default!==void 0}function E(w){s.subschema({keyword:"properties",schemaProp:w,dataProp:w},y)}}};return zh.default=a,zh}var Fh={},NM;function Hq(){if(NM)return Fh;NM=1,Object.defineProperty(Fh,"__esModule",{value:!0});const e=To(),t=Mt(),n=on(),r=on(),a={keyword:"patternProperties",type:"object",schemaType:"object",code(s){const{gen:i,schema:c,data:u,parentSchema:f,it:m}=s,{opts:h}=m,b=(0,e.allSchemaProperties)(c),y=b.filter(R=>(0,n.alwaysValidSchema)(m,c[R]));if(b.length===0||y.length===b.length&&(!m.opts.unevaluated||m.props===!0))return;const x=h.strictSchema&&!h.allowMatchingProperties&&f.properties,E=i.name("valid");m.props!==!0&&!(m.props instanceof t.Name)&&(m.props=(0,r.evaluatedPropsToName)(i,m.props));const{props:w}=m;_();function _(){for(const R of b)x&&S(R),m.allErrors?T(R):(i.var(E,!0),T(R),i.if(E))}function S(R){for(const C in x)new RegExp(R).test(C)&&(0,n.checkStrictMode)(m,`property ${C} matches pattern ${R} (use allowMatchingProperties)`)}function T(R){i.forIn("key",u,C=>{i.if((0,t._)`${(0,e.usePattern)(s,R)}.test(${C})`,()=>{const I=y.includes(R);I||s.subschema({keyword:"patternProperties",schemaProp:R,dataProp:C,dataPropType:r.Type.Str},E),m.opts.unevaluated&&w!==!0?i.assign((0,t._)`${w}[${C}]`,!0):!I&&!m.allErrors&&i.if((0,t.not)(E),()=>i.break())})})}}};return Fh.default=a,Fh}var Bh={},kM;function Vq(){if(kM)return Bh;kM=1,Object.defineProperty(Bh,"__esModule",{value:!0});const e=on(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:r,schema:a,it:s}=n;if((0,e.alwaysValidSchema)(s,a)){n.fail();return}const i=r.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),n.failResult(i,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return Bh.default=t,Bh}var Hh={},CM;function Gq(){if(CM)return Hh;CM=1,Object.defineProperty(Hh,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:To().validateUnion,error:{message:"must match a schema in anyOf"}};return Hh.default=t,Hh}var Vh={},RM;function Wq(){if(RM)return Vh;RM=1,Object.defineProperty(Vh,"__esModule",{value:!0});const e=Mt(),t=on(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:a})=>(0,e._)`{passingSchemas: ${a.passing}}`},code(a){const{gen:s,schema:i,parentSchema:c,it:u}=a;if(!Array.isArray(i))throw new Error("ajv implementation error");if(u.opts.discriminator&&c.discriminator)return;const f=i,m=s.let("valid",!1),h=s.let("passing",null),b=s.name("_valid");a.setParams({passing:h}),s.block(y),a.result(m,()=>a.reset(),()=>a.error(!0));function y(){f.forEach((x,E)=>{let w;(0,t.alwaysValidSchema)(u,x)?s.var(b,!0):w=a.subschema({keyword:"oneOf",schemaProp:E,compositeRule:!0},b),E>0&&s.if((0,e._)`${b} && ${m}`).assign(m,!1).assign(h,(0,e._)`[${h}, ${E}]`).else(),s.if(b,()=>{s.assign(m,!0),s.assign(h,E),w&&a.mergeEvaluated(w,e.Name)})})}}};return Vh.default=r,Vh}var Gh={},AM;function Kq(){if(AM)return Gh;AM=1,Object.defineProperty(Gh,"__esModule",{value:!0});const e=on(),t={keyword:"allOf",schemaType:"array",code(n){const{gen:r,schema:a,it:s}=n;if(!Array.isArray(a))throw new Error("ajv implementation error");const i=r.name("valid");a.forEach((c,u)=>{if((0,e.alwaysValidSchema)(s,c))return;const f=n.subschema({keyword:"allOf",schemaProp:u},i);n.ok(i),n.mergeEvaluated(f)})}};return Gh.default=t,Gh}var Wh={},IM;function Yq(){if(IM)return Wh;IM=1,Object.defineProperty(Wh,"__esModule",{value:!0});const e=Mt(),t=on(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,e.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,e._)`{failingKeyword: ${s.ifClause}}`},code(s){const{gen:i,parentSchema:c,it:u}=s;c.then===void 0&&c.else===void 0&&(0,t.checkStrictMode)(u,'"if" without "then" and "else" is ignored');const f=a(u,"then"),m=a(u,"else");if(!f&&!m)return;const h=i.let("valid",!0),b=i.name("_valid");if(y(),s.reset(),f&&m){const E=i.let("ifClause");s.setParams({ifClause:E}),i.if(b,x("then",E),x("else",E))}else f?i.if(b,x("then")):i.if((0,e.not)(b),x("else"));s.pass(h,()=>s.error(!0));function y(){const E=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},b);s.mergeEvaluated(E)}function x(E,w){return()=>{const _=s.subschema({keyword:E},b);i.assign(h,b),s.mergeValidEvaluated(_,h),w?i.assign(w,(0,e._)`${E}`):s.setParams({ifClause:E})}}}};function a(s,i){const c=s.schema[i];return c!==void 0&&!(0,t.alwaysValidSchema)(s,c)}return Wh.default=r,Wh}var Kh={},OM;function Zq(){if(OM)return Kh;OM=1,Object.defineProperty(Kh,"__esModule",{value:!0});const e=on(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:r,it:a}){r.if===void 0&&(0,e.checkStrictMode)(a,`"${n}" without "if" is ignored`)}};return Kh.default=t,Kh}var DM;function qq(){if(DM)return Lh;DM=1,Object.defineProperty(Lh,"__esModule",{value:!0});const e=E2(),t=Pq(),n=x2(),r=Uq(),a=$q(),s=zq(),i=Fq(),c=S2(),u=Bq(),f=Hq(),m=Vq(),h=Gq(),b=Wq(),y=Kq(),x=Yq(),E=Zq();function w(_=!1){const S=[m.default,h.default,b.default,y.default,x.default,E.default,i.default,c.default,s.default,u.default,f.default];return _?S.push(t.default,r.default):S.push(e.default,n.default),S.push(a.default),S}return Lh.default=w,Lh}var Yh={},Zh={},LM;function Xq(){if(LM)return Zh;LM=1,Object.defineProperty(Zh,"__esModule",{value:!0});const e=Mt(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must match format "${r}"`,params:({schemaCode:r})=>(0,e._)`{format: ${r}}`},code(r,a){const{gen:s,data:i,$data:c,schema:u,schemaCode:f,it:m}=r,{opts:h,errSchemaPath:b,schemaEnv:y,self:x}=m;if(!h.validateFormats)return;c?E():w();function E(){const _=s.scopeValue("formats",{ref:x.formats,code:h.code.formats}),S=s.const("fDef",(0,e._)`${_}[${f}]`),T=s.let("fType"),R=s.let("format");s.if((0,e._)`typeof ${S} == "object" && !(${S} instanceof RegExp)`,()=>s.assign(T,(0,e._)`${S}.type || "string"`).assign(R,(0,e._)`${S}.validate`),()=>s.assign(T,(0,e._)`"string"`).assign(R,S)),r.fail$data((0,e.or)(C(),I()));function C(){return h.strictSchema===!1?e.nil:(0,e._)`${f} && !${R}`}function I(){const A=y.$async?(0,e._)`(${S}.async ? await ${R}(${i}) : ${R}(${i}))`:(0,e._)`${R}(${i})`,O=(0,e._)`(typeof ${R} == "function" ? ${A} : ${R}.test(${i}))`;return(0,e._)`${R} && ${R} !== true && ${T} === ${a} && !${O}`}}function w(){const _=x.formats[u];if(!_){C();return}if(_===!0)return;const[S,T,R]=I(_);S===a&&r.pass(A());function C(){if(h.strictSchema===!1){x.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${u}" ignored in schema at path "${b}"`}}function I(O){const j=O instanceof RegExp?(0,e.regexpCode)(O):h.code.formats?(0,e._)`${h.code.formats}${(0,e.getProperty)(u)}`:void 0,U=s.scopeValue("formats",{key:u,ref:O,code:j});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,e._)`${U}.validate`]:["string",O,U]}function A(){if(typeof _=="object"&&!(_ instanceof RegExp)&&_.async){if(!y.$async)throw new Error("async format in sync schema");return(0,e._)`await ${R}(${i})`}return typeof T=="function"?(0,e._)`${R}(${i})`:(0,e._)`${R}.test(${i})`}}}};return Zh.default=n,Zh}var MM;function Jq(){if(MM)return Yh;MM=1,Object.defineProperty(Yh,"__esModule",{value:!0});const t=[Xq().default];return Yh.default=t,Yh}var ll={},jM;function Qq(){return jM||(jM=1,Object.defineProperty(ll,"__esModule",{value:!0}),ll.contentVocabulary=ll.metadataVocabulary=void 0,ll.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ll.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ll}var PM;function eX(){if(PM)return yh;PM=1,Object.defineProperty(yh,"__esModule",{value:!0});const e=_q(),t=jq(),n=qq(),r=Jq(),a=Qq(),s=[e.default,t.default,(0,n.default)(),r.default,a.metadataVocabulary,a.contentVocabulary];return yh.default=s,yh}var qh={},of={},UM;function tX(){if(UM)return of;UM=1,Object.defineProperty(of,"__esModule",{value:!0}),of.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(of.DiscrError=e={})),of}var $M;function nX(){if($M)return qh;$M=1,Object.defineProperty(qh,"__esModule",{value:!0});const e=Mt(),t=tX(),n=s_(),r=sy(),a=on(),i={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:f}})=>(0,e._)`{error: ${c}, tag: ${f}, tagValue: ${u}}`},code(c){const{gen:u,data:f,schema:m,parentSchema:h,it:b}=c,{oneOf:y}=h;if(!b.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(!y)throw new Error("discriminator: requires oneOf keyword");const E=u.let("valid",!1),w=u.const("tag",(0,e._)`${f}${(0,e.getProperty)(x)}`);u.if((0,e._)`typeof ${w} == "string"`,()=>_(),()=>c.error(!1,{discrError:t.DiscrError.Tag,tag:w,tagName:x})),c.ok(E);function _(){const R=T();u.if(!1);for(const C in R)u.elseIf((0,e._)`${w} === ${C}`),u.assign(E,S(R[C]));u.else(),c.error(!1,{discrError:t.DiscrError.Mapping,tag:w,tagName:x}),u.endIf()}function S(R){const C=u.name("valid"),I=c.subschema({keyword:"oneOf",schemaProp:R},C);return c.mergeEvaluated(I,e.Name),C}function T(){var R;const C={},I=O(h);let A=!0;for(let B=0;B<y.length;B++){let W=y[B];if(W?.$ref&&!(0,a.schemaHasRulesButRef)(W,b.self.RULES)){const ee=W.$ref;if(W=n.resolveRef.call(b.self,b.schemaEnv.root,b.baseId,ee),W instanceof n.SchemaEnv&&(W=W.schema),W===void 0)throw new r.default(b.opts.uriResolver,b.baseId,ee)}const J=(R=W?.properties)===null||R===void 0?void 0:R[x];if(typeof J!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${x}"`);A=A&&(I||O(W)),j(J,B)}if(!A)throw new Error(`discriminator: "${x}" must be required`);return C;function O({required:B}){return Array.isArray(B)&&B.includes(x)}function j(B,W){if(B.const)U(B.const,W);else if(B.enum)for(const J of B.enum)U(J,W);else throw new Error(`discriminator: "properties/${x}" must have "const" or "enum"`)}function U(B,W){if(typeof B!="string"||B in C)throw new Error(`discriminator: "${x}" values must be unique strings`);C[B]=W}}}};return qh.default=i,qh}const rX="http://json-schema.org/draft-07/schema#",aX="http://json-schema.org/draft-07/schema#",oX="Core schema meta-schema",sX={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:[]}},iX=["object","boolean"],lX={$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:"#"}},cX={$schema:rX,$id:aX,title:oX,definitions:sX,type:iX,properties:lX,default:!0};var zM;function _2(){return zM||(zM=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=Eq(),r=eX(),a=nX(),s=cX,i=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(x=>this.addVocabulary(x)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const x=this.opts.$data?this.$dataMetaSchema(s,i):s;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 f=oy();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return f.KeywordCxt}});var m=Mt();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=o_();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var b=sy();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return b.default}})})(ph,ph.exports)),ph.exports}var uX=_2(),Xh={exports:{}},Tw={},FM;function dX(){return FM||(FM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(B,W){return{validate:B,compare:W}}e.fullFormats={date:t(s,i),time:t(u(!0),f),"date-time":t(b(!0),y),"iso-time":t(u(),m),"iso-date-time":t(b(),x),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"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:U,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:T,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$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"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,y),"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 r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(B){const W=r.exec(B);if(!W)return!1;const J=+W[1],ee=+W[2],re=+W[3];return ee>=1&&ee<=12&&re>=1&&re<=(ee===2&&n(J)?29:a[ee])}function i(B,W){if(B&&W)return B>W?1:B<W?-1:0}const c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(B){return function(J){const ee=c.exec(J);if(!ee)return!1;const re=+ee[1],F=+ee[2],K=+ee[3],V=ee[4],ne=ee[5]==="-"?-1:1,te=+(ee[6]||0),D=+(ee[7]||0);if(te>23||D>59||B&&!V)return!1;if(re<=23&&F<=59&&K<60)return!0;const H=F-D*ne,$=re-te*ne-(H<0?1:0);return($===23||$===-1)&&(H===59||H===-1)&&K<61}}function f(B,W){if(!(B&&W))return;const J=new Date("2020-01-01T"+B).valueOf(),ee=new Date("2020-01-01T"+W).valueOf();if(J&&ee)return J-ee}function m(B,W){if(!(B&&W))return;const J=c.exec(B),ee=c.exec(W);if(J&&ee)return B=J[1]+J[2]+J[3],W=ee[1]+ee[2]+ee[3],B>W?1:B<W?-1:0}const h=/t|\s/i;function b(B){const W=u(B);return function(ee){const re=ee.split(h);return re.length===2&&s(re[0])&&W(re[1])}}function y(B,W){if(!(B&&W))return;const J=new Date(B).valueOf(),ee=new Date(W).valueOf();if(J&&ee)return J-ee}function x(B,W){if(!(B&&W))return;const[J,ee]=B.split(h),[re,F]=W.split(h),K=i(J,re);if(K!==void 0)return K||f(ee,F)}const E=/\/|:/,w=/^(?:[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 _(B){return E.test(B)&&w.test(B)}const S=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function T(B){return S.lastIndex=0,S.test(B)}const R=-2147483648,C=2**31-1;function I(B){return Number.isInteger(B)&&B<=C&&B>=R}function A(B){return Number.isInteger(B)}function O(){return!0}const j=/[^\\]\\Z/;function U(B){if(j.test(B))return!1;try{return new RegExp(B),!0}catch{return!1}}})(Tw)),Tw}var Nw={},BM;function fX(){return BM||(BM=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=_2(),n=Mt(),r=n.operators,a={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},s={message:({keyword:c,schemaCode:u})=>(0,n.str)`should be ${a[c].okStr} ${u}`,params:({keyword:c,schemaCode:u})=>(0,n._)`{comparison: ${a[c].okStr}, limit: ${u}}`};e.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:s,code(c){const{gen:u,data:f,schemaCode:m,keyword:h,it:b}=c,{opts:y,self:x}=b;if(!y.validateFormats)return;const E=new t.KeywordCxt(b,x.RULES.all.format.definition,"format");E.$data?w():_();function w(){const T=u.scopeValue("formats",{ref:x.formats,code:y.code.formats}),R=u.const("fmt",(0,n._)`${T}[${E.schemaCode}]`);c.fail$data((0,n.or)((0,n._)`typeof ${R} != "object"`,(0,n._)`${R} instanceof RegExp`,(0,n._)`typeof ${R}.compare != "function"`,S(R)))}function _(){const T=E.schema,R=x.formats[T];if(!R||R===!0)return;if(typeof R!="object"||R instanceof RegExp||typeof R.compare!="function")throw new Error(`"${h}": format "${T}" does not define "compare" function`);const C=u.scopeValue("formats",{key:T,ref:R,code:y.code.formats?(0,n._)`${y.code.formats}${(0,n.getProperty)(T)}`:void 0});c.fail$data(S(C))}function S(T){return(0,n._)`${T}.compare(${f}, ${m}) ${a[h].fail} 0`}},dependencies:["format"]};const i=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=i})(Nw)),Nw}var HM;function pX(){return HM||(HM=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=dX(),r=fX(),a=Mt(),s=new a.Name("fullFormats"),i=new a.Name("fastFormats"),c=(f,m={keywords:!0})=>{if(Array.isArray(m))return u(f,m,n.fullFormats,s),f;const[h,b]=m.mode==="fast"?[n.fastFormats,i]:[n.fullFormats,s],y=m.formats||n.formatNames;return u(f,y,h,b),m.keywords&&(0,r.default)(f),f};c.get=(f,m="full")=>{const b=(m==="fast"?n.fastFormats:n.fullFormats)[f];if(!b)throw new Error(`Unknown format "${f}"`);return b};function u(f,m,h,b){var y,x;(y=(x=f.opts.code).formats)!==null&&y!==void 0||(x.formats=(0,a._)`require("ajv-formats/dist/formats").${b}`);for(const E of m)f.addFormat(E,h[E])}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c})(Xh,Xh.exports)),Xh.exports}var mX=pX();const hX=bp(mX);function gX(){const e=new uX.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return hX(e),e}class bX{constructor(t){this._ajv=t??gX()}getValidator(t){var n;const r="$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 a=>r(a)?{valid:!0,data:a,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class yX{constructor(t){this._client=t}async*callToolStream(t,n=ty,r){var a;const s=this._client,i={...r,task:(a=r?.task)!==null&&a!==void 0?a:s.isToolTask(t.name)?{}:void 0},c=s.requestStream({method:"tools/call",params:t},n,i),u=s.getToolOutputValidator(t.name);for await(const f of c){if(f.type==="result"&&u){const m=f.result;if(!m.structuredContent&&!m.isError){yield{type:"error",error:new ut(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 ut(wt.InvalidParams,`Structured content does not match the tool's output schema: ${h.errorMessage}`)};return}}catch(h){if(h instanceof ut){yield{type:"error",error:h};return}yield{type:"error",error:new ut(wt.InvalidParams,`Failed to validate structured content: ${h instanceof Error?h.message:String(h)}`)};return}}yield f}}async getTask(t,n){return this._client.getTask({taskId:t},n)}async getTaskResult(t,n,r){return this._client.getTaskResult({taskId:t},n,r)}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,r){return this._client.requestStream(t,n,r)}}function vX(e,t,n){var r;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!(!((r=e.tools)===null||r===void 0)&&r.call))throw new Error(`${n} does not support task creation for tools/call (required for ${t})`);break}}function wX(e,t,n){var r,a;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!(!((r=e.sampling)===null||r===void 0)&&r.createMessage))throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!(!((a=e.elicitation)===null||a===void 0)&&a.create))throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break}}function _g(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){const n=t,r=e.properties;for(const a of Object.keys(r)){const s=r[a];n[a]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(n[a]=s.default),n[a]!==void 0&&_g(s,n[a])}}if(Array.isArray(e.anyOf))for(const n of e.anyOf)typeof n!="boolean"&&_g(n,t);if(Array.isArray(e.oneOf))for(const n of e.oneOf)typeof n!="boolean"&&_g(n,t)}}function EX(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 VM extends aq{constructor(t,n){var r,a;super(n),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(r=n?.capabilities)!==null&&r!==void 0?r:{},this._jsonSchemaValidator=(a=n?.jsonSchemaValidator)!==null&&a!==void 0?a:new bX,n?.listChanged&&(this._pendingListChangedConfig=n.listChanged)}_setupListChangedHandlers(t){var n,r,a,s,i,c;t.tools&&(!((r=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tools)===null||r===void 0)&&r.listChanged)&&this._setupListChangedHandler("tools",l2,t.tools,async()=>(await this.listTools()).tools),t.prompts&&(!((s=(a=this._serverCapabilities)===null||a===void 0?void 0:a.prompts)===null||s===void 0)&&s.listChanged)&&this._setupListChangedHandler("prompts",o2,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&(!((c=(i=this._serverCapabilities)===null||i===void 0?void 0:i.resources)===null||c===void 0)&&c.listChanged)&&this._setupListChangedHandler("resources",n2,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new yX(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=oq(this._capabilities,t)}setRequestHandler(t,n){var r,a,s;const i=g2(t),c=i?.method;if(!c)throw new Error("Schema is missing a method literal");let u;if(ny(c)){const m=c,h=(r=m._zod)===null||r===void 0?void 0:r.def;u=(a=h?.value)!==null&&a!==void 0?a:m.value}else{const m=c,h=m._def;u=(s=h?.value)!==null&&s!==void 0?s:m.value}if(typeof u!="string")throw new Error("Schema method literal must be a string");const f=u;if(f==="elicitation/create"){const m=async(h,b)=>{var y,x,E;const w=bi(a_,h);if(!w.success){const j=w.error instanceof Error?w.error.message:String(w.error);throw new ut(wt.InvalidParams,`Invalid elicitation request: ${j}`)}const{params:_}=w.data,S=(y=_.mode)!==null&&y!==void 0?y:"form",{supportsFormMode:T,supportsUrlMode:R}=EX(this._capabilities.elicitation);if(S==="form"&&!T)throw new ut(wt.InvalidParams,"Client does not support form-mode elicitation requests");if(S==="url"&&!R)throw new ut(wt.InvalidParams,"Client does not support URL-mode elicitation requests");const C=await Promise.resolve(n(h,b));if(_.task){const j=bi(Gf,C);if(!j.success){const U=j.error instanceof Error?j.error.message:String(j.error);throw new ut(wt.InvalidParams,`Invalid task creation result: ${U}`)}return j.data}const I=bi(u2,C);if(!I.success){const j=I.error instanceof Error?I.error.message:String(I.error);throw new ut(wt.InvalidParams,`Invalid elicitation result: ${j}`)}const A=I.data,O=S==="form"?_.requestedSchema:void 0;if(S==="form"&&A.action==="accept"&&A.content&&O&&!((E=(x=this._capabilities.elicitation)===null||x===void 0?void 0:x.form)===null||E===void 0)&&E.applyDefaults)try{_g(O,A.content)}catch{}return A};return super.setRequestHandler(t,m)}if(f==="sampling/createMessage"){const m=async(h,b)=>{const y=bi(n_,h);if(!y.success){const _=y.error instanceof Error?y.error.message:String(y.error);throw new ut(wt.InvalidParams,`Invalid sampling request: ${_}`)}const{params:x}=y.data,E=await Promise.resolve(n(h,b));if(x.task){const _=bi(Gf,E);if(!_.success){const S=_.error instanceof Error?_.error.message:String(_.error);throw new ut(wt.InvalidParams,`Invalid task creation result: ${S}`)}return _.data}const w=bi(r_,E);if(!w.success){const _=w.error instanceof Error?w.error.message:String(w.error);throw new ut(wt.InvalidParams,`Invalid sampling result: ${_}`)}return w.data};return super.setRequestHandler(t,m)}return super.setRequestHandler(t,n)}assertCapability(t,n){var r;if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r[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 r=await this.request({method:"initialize",params:{protocolVersion:Jb,capabilities:this._capabilities,clientInfo:this._clientInfo}},Kz,n);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!xY.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var n,r,a,s,i;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(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.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(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.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(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.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,r;vX((r=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tasks)===null||r===void 0?void 0:r.requests,t,"Server")}assertTaskHandlerCapability(t){var n;this._capabilities&&wX((n=this._capabilities.tasks)===null||n===void 0?void 0:n.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Kc,t)}async complete(t,n){return this.request({method:"completion/complete",params:t},d2,n)}async setLoggingLevel(t,n){return this.request({method:"logging/setLevel",params:{level:t}},Kc,n)}async getPrompt(t,n){return this.request({method:"prompts/get",params:t},a2,n)}async listPrompts(t,n){return this.request({method:"prompts/list",params:t},r2,n)}async listResources(t,n){return this.request({method:"resources/list",params:t},Qz,n)}async listResourceTemplates(t,n){return this.request({method:"resources/templates/list",params:t},e2,n)}async readResource(t,n){return this.request({method:"resources/read",params:t},t2,n)}async subscribeResource(t,n){return this.request({method:"resources/subscribe",params:t},Kc,n)}async unsubscribeResource(t,n){return this.request({method:"resources/unsubscribe",params:t},Kc,n)}async callTool(t,n=ty,r){if(this.isToolTaskRequired(t.name))throw new ut(wt.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const a=await this.request({method:"tools/call",params:t},n,r),s=this.getToolOutputValidator(t.name);if(s){if(!a.structuredContent&&!a.isError)throw new ut(wt.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(a.structuredContent)try{const i=s(a.structuredContent);if(!i.valid)throw new ut(wt.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof ut?i:new ut(wt.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return a}isToolTask(t){var n,r,a,s;return!((s=(a=(r=(n=this._serverCapabilities)===null||n===void 0?void 0:n.tasks)===null||r===void 0?void 0:r.requests)===null||a===void 0?void 0:a.tools)===null||s===void 0)&&s.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 r of t){if(r.outputSchema){const s=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,s)}const a=(n=r.execution)===null||n===void 0?void 0:n.taskSupport;(a==="required"||a==="optional")&&this._cachedKnownTaskTools.add(r.name),a==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,n){const r=await this.request({method:"tools/list",params:t},i2,n);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(t,n,r,a){const s=hZ.safeParse(r);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof r.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:i,debounceMs:c}=s.data,{onChanged:u}=r,f=async()=>{if(!i){u(null,null);return}try{const h=await a();u(null,h)}catch(h){const b=h instanceof Error?h:new Error(String(h));u(b,null)}},m=()=>{if(c){const h=this._listChangedDebounceTimers.get(t);h&&clearTimeout(h);const b=setTimeout(f,c);this._listChangedDebounceTimers.set(t,b)}else f()};this.setNotificationHandler(n,m)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Qg(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function T2(e=fetch,t){return t?async(n,r)=>{const a={...t,...r,headers:r?.headers?{...Qg(t.headers),...Qg(r.headers)}:t.headers};return e(n,a)}:e}let l_;l_=globalThis.crypto;async function xX(e){return(await l_).getRandomValues(new Uint8Array(e))}async function SX(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let n="";const r=await xX(e);for(let a=0;a<e;a++){const s=r[a]%t.length;n+=t[s]}return n}async function _X(e){return await SX(e)}async function TX(e){const t=await(await l_).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function NX(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await _X(e),n=await TX(t);return{code_verifier:t,code_challenge:n}}const jr=AK().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:wY.custom,message:"URL must be parseable",fatal:!0}),tG}).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"}),kX=Ea({resource:de().url(),authorization_servers:Fe(jr).optional(),jwks_uri:de().url().optional(),scopes_supported:Fe(de()).optional(),bearer_methods_supported:Fe(de()).optional(),resource_signing_alg_values_supported:Fe(de()).optional(),resource_name:de().optional(),resource_documentation:de().optional(),resource_policy_uri:de().url().optional(),resource_tos_uri:de().url().optional(),tls_client_certificate_bound_access_tokens:Dn().optional(),authorization_details_types_supported:Fe(de()).optional(),dpop_signing_alg_values_supported:Fe(de()).optional(),dpop_bound_access_tokens_required:Dn().optional()}),N2=Ea({issuer:de(),authorization_endpoint:jr,token_endpoint:jr,registration_endpoint:jr.optional(),scopes_supported:Fe(de()).optional(),response_types_supported:Fe(de()),response_modes_supported:Fe(de()).optional(),grant_types_supported:Fe(de()).optional(),token_endpoint_auth_methods_supported:Fe(de()).optional(),token_endpoint_auth_signing_alg_values_supported:Fe(de()).optional(),service_documentation:jr.optional(),revocation_endpoint:jr.optional(),revocation_endpoint_auth_methods_supported:Fe(de()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Fe(de()).optional(),introspection_endpoint:de().optional(),introspection_endpoint_auth_methods_supported:Fe(de()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Fe(de()).optional(),code_challenge_methods_supported:Fe(de()).optional(),client_id_metadata_document_supported:Dn().optional()}),CX=Ea({issuer:de(),authorization_endpoint:jr,token_endpoint:jr,userinfo_endpoint:jr.optional(),jwks_uri:jr,registration_endpoint:jr.optional(),scopes_supported:Fe(de()).optional(),response_types_supported:Fe(de()),response_modes_supported:Fe(de()).optional(),grant_types_supported:Fe(de()).optional(),acr_values_supported:Fe(de()).optional(),subject_types_supported:Fe(de()),id_token_signing_alg_values_supported:Fe(de()),id_token_encryption_alg_values_supported:Fe(de()).optional(),id_token_encryption_enc_values_supported:Fe(de()).optional(),userinfo_signing_alg_values_supported:Fe(de()).optional(),userinfo_encryption_alg_values_supported:Fe(de()).optional(),userinfo_encryption_enc_values_supported:Fe(de()).optional(),request_object_signing_alg_values_supported:Fe(de()).optional(),request_object_encryption_alg_values_supported:Fe(de()).optional(),request_object_encryption_enc_values_supported:Fe(de()).optional(),token_endpoint_auth_methods_supported:Fe(de()).optional(),token_endpoint_auth_signing_alg_values_supported:Fe(de()).optional(),display_values_supported:Fe(de()).optional(),claim_types_supported:Fe(de()).optional(),claims_supported:Fe(de()).optional(),service_documentation:de().optional(),claims_locales_supported:Fe(de()).optional(),ui_locales_supported:Fe(de()).optional(),claims_parameter_supported:Dn().optional(),request_parameter_supported:Dn().optional(),request_uri_parameter_supported:Dn().optional(),require_request_uri_registration:Dn().optional(),op_policy_uri:jr.optional(),op_tos_uri:jr.optional(),client_id_metadata_document_supported:Dn().optional()}),RX=Pe({...CX.shape,...N2.pick({code_challenge_methods_supported:!0}).shape}),AX=Pe({access_token:de(),id_token:de().optional(),token_type:de(),expires_in:EY().optional(),scope:de().optional(),refresh_token:de().optional()}).strip(),IX=Pe({error:de(),error_description:de().optional(),error_uri:de().optional()}),GM=jr.optional().or(et("").transform(()=>{})),OX=Pe({redirect_uris:Fe(jr),token_endpoint_auth_method:de().optional(),grant_types:Fe(de()).optional(),response_types:Fe(de()).optional(),client_name:de().optional(),client_uri:jr.optional(),logo_uri:GM,scope:de().optional(),contacts:Fe(de()).optional(),tos_uri:GM,policy_uri:de().optional(),jwks_uri:jr.optional(),jwks:qK().optional(),software_id:de().optional(),software_version:de().optional(),software_statement:de().optional()}).strip(),DX=Pe({client_id:de(),client_secret:de().optional(),client_id_issued_at:vn().optional(),client_secret_expires_at:vn().optional()}).strip(),LX=OX.merge(DX);Pe({error:de(),error_description:de().optional()}).strip();Pe({token:de(),token_type_hint:de().optional()}).strip();function MX(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function jX({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),r=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;const a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return a.startsWith(s)}class Cr 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 BE extends Cr{}BE.errorCode="invalid_request";class eb extends Cr{}eb.errorCode="invalid_client";class tb extends Cr{}tb.errorCode="invalid_grant";class nb extends Cr{}nb.errorCode="unauthorized_client";class HE extends Cr{}HE.errorCode="unsupported_grant_type";class VE extends Cr{}VE.errorCode="invalid_scope";class GE extends Cr{}GE.errorCode="access_denied";class Ru extends Cr{}Ru.errorCode="server_error";class WE extends Cr{}WE.errorCode="temporarily_unavailable";class KE extends Cr{}KE.errorCode="unsupported_response_type";class YE extends Cr{}YE.errorCode="unsupported_token_type";class ZE extends Cr{}ZE.errorCode="invalid_token";class qE extends Cr{}qE.errorCode="method_not_allowed";class XE extends Cr{}XE.errorCode="too_many_requests";class rb extends Cr{}rb.errorCode="invalid_client_metadata";class JE extends Cr{}JE.errorCode="insufficient_scope";class QE extends Cr{}QE.errorCode="invalid_target";const PX={[BE.errorCode]:BE,[eb.errorCode]:eb,[tb.errorCode]:tb,[nb.errorCode]:nb,[HE.errorCode]:HE,[VE.errorCode]:VE,[GE.errorCode]:GE,[Ru.errorCode]:Ru,[WE.errorCode]:WE,[KE.errorCode]:KE,[YE.errorCode]:YE,[ZE.errorCode]:ZE,[qE.errorCode]:qE,[XE.errorCode]:XE,[rb.errorCode]:rb,[JE.errorCode]:JE,[QE.errorCode]:QE};class Ja extends Error{constructor(t){super(t??"Unauthorized")}}function UX(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const kw="code",Cw="S256";function k2(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&&UX(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 $X(e,t,n,r){const{client_id:a,client_secret:s}=t;switch(e){case"client_secret_basic":zX(a,s,n);return;case"client_secret_post":FX(a,s,r);return;case"none":BX(a,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function zX(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const r=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${r}`)}function FX(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function BX(e,t){t.set("client_id",e)}async function c_(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=IX.parse(JSON.parse(n)),{error:a,error_description:s,error_uri:i}=r,c=PX[a]||Ru;return new c(s||"",i)}catch(r){const a=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new Ru(a)}}async function Es(e,t){var n,r;try{return await Rw(e,t)}catch(a){if(a instanceof eb||a instanceof nb)return await((n=e.invalidateCredentials)===null||n===void 0?void 0:n.call(e,"all")),await Rw(e,t);if(a instanceof tb)return await((r=e.invalidateCredentials)===null||r===void 0?void 0:r.call(e,"tokens")),await Rw(e,t);throw a}}async function Rw(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:a,fetchFn:s}){var i,c;let u,f;try{u=await A2(t,{resourceMetadataUrl:a},s),u.authorization_servers&&u.authorization_servers.length>0&&(f=u.authorization_servers[0])}catch{}f||(f=new URL("/",t));const m=await R2(t,e,u),h=await O2(f,{fetchFn:s});let b=await Promise.resolve(e.clientInformation());if(!b){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const S=h?.client_id_metadata_document_supported===!0,T=e.clientMetadataUrl;if(T&&!C2(T))throw new rb(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${T}`);if(S&&T)b={client_id:T},await((i=e.saveClientInformation)===null||i===void 0?void 0:i.call(e,b));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const C=await U2(f,{metadata:h,clientMetadata:e.clientMetadata,fetchFn:s});await e.saveClientInformation(C),b=C}}const y=!e.redirectUrl;if(n!==void 0||y){const S=await P2(e,f,{metadata:h,resource:m,authorizationCode:n,fetchFn:s});return await e.saveTokens(S),"AUTHORIZED"}const x=await e.tokens();if(x?.refresh_token)try{const S=await j2(f,{metadata:h,clientInformation:b,refreshToken:x.refresh_token,resource:m,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(S),"AUTHORIZED"}catch(S){if(!(!(S instanceof Cr)||S instanceof Ru))throw S}const E=e.state?await e.state():void 0,{authorizationUrl:w,codeVerifier:_}=await D2(f,{metadata:h,clientInformation:b,state:E,redirectUrl:e.redirectUrl,scope:r||((c=u?.scopes_supported)===null||c===void 0?void 0:c.join(" "))||e.clientMetadata.scope,resource:m});return await e.saveCodeVerifier(_),await e.redirectToAuthorization(w),"REDIRECT"}function C2(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function R2(e,t,n){const r=MX(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!jX({requestedResource:r,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Wf(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const a=Aw(e,"resource_metadata")||void 0;let s;if(a)try{s=new URL(a)}catch{}const i=Aw(e,"scope")||void 0,c=Aw(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:c}}function Aw(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),a=n.match(r);return a?a[1]||a[2]:null}async function A2(e,t,n=fetch){var r,a;const s=await GX(e,"oauth-protected-resource",n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!s||s.status===404)throw await((r=s?.body)===null||r===void 0?void 0:r.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw await((a=s.body)===null||a===void 0?void 0:a.cancel()),new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return kX.parse(await s.json())}async function u_(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?u_(e,void 0,n):void 0;throw r}}function HX(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function WM(e,t,n=fetch){return await u_(e,{"MCP-Protocol-Version":t},n)}function VX(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function GX(e,t,n,r){var a,s;const i=new URL(e),c=(a=r?.protocolVersion)!==null&&a!==void 0?a:Jb;let u;if(r?.metadataUrl)u=new URL(r.metadataUrl);else{const m=HX(t,i.pathname);u=new URL(m,(s=r?.metadataServerUrl)!==null&&s!==void 0?s:i),u.search=i.search}let f=await WM(u,c,n);if(!r?.metadataUrl&&VX(f,i.pathname)){const m=new URL(`/.well-known/${t}`,i);f=await WM(m,c,n)}return f}function I2(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function O2(e,{fetchFn:t=fetch,protocolVersion:n=Jb}={}){var r;const a={"MCP-Protocol-Version":n,Accept:"application/json"},s=I2(e);for(const{url:i,type:c}of s){const u=await u_(i,a,t);if(u){if(!u.ok){if(await((r=u.body)===null||r===void 0?void 0:r.cancel()),u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${c==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return c==="oauth"?N2.parse(await u.json()):RX.parse(await u.json())}}}async function D2(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:s,resource:i}){let c;if(t){if(c=new URL(t.authorization_endpoint),!t.response_types_supported.includes(kw))throw new Error(`Incompatible auth server: does not support response type ${kw}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Cw))throw new Error(`Incompatible auth server: does not support code challenge method ${Cw}`)}else c=new URL("/authorize",e);const u=await NX(),f=u.code_verifier,m=u.code_challenge;return c.searchParams.set("response_type",kw),c.searchParams.set("client_id",n.client_id),c.searchParams.set("code_challenge",m),c.searchParams.set("code_challenge_method",Cw),c.searchParams.set("redirect_uri",String(r)),s&&c.searchParams.set("state",s),a&&c.searchParams.set("scope",a),a?.includes("offline_access")&&c.searchParams.append("prompt","consent"),i&&c.searchParams.set("resource",i.href),{authorizationUrl:c,codeVerifier:f}}function L2(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function M2(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:a,resource:s,fetchFn:i}){var c;const u=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),f=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&n.set("resource",s.href),a)await a(f,n,u,t);else if(r){const h=(c=t?.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],b=k2(r,h);$X(b,r,f,n)}const m=await(i??fetch)(u,{method:"POST",headers:f,body:n});if(!m.ok)throw await c_(m);return AX.parse(await m.json())}async function j2(e,{metadata:t,clientInformation:n,refreshToken:r,resource:a,addClientAuthentication:s,fetchFn:i}){const c=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),u=await M2(e,{metadata:t,tokenRequestParams:c,clientInformation:n,addClientAuthentication:s,resource:a,fetchFn:i});return{refresh_token:r,...u}}async function P2(e,t,{metadata:n,resource:r,authorizationCode:a,fetchFn:s}={}){const i=e.clientMetadata.scope;let c;if(e.prepareTokenRequest&&(c=await e.prepareTokenRequest(i)),!c){if(!a)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const f=await e.codeVerifier();c=L2(a,f,e.redirectUrl)}const u=await e.clientInformation();return M2(t,{metadata:n,tokenRequestParams:c,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:s})}async function U2(e,{metadata:t,clientMetadata:n,fetchFn:r}){let a;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(t.registration_endpoint)}else a=new URL("/register",e);const s=await(r??fetch)(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok)throw await c_(s);return LX.parse(await s.json())}const KM=Object.freeze(Object.defineProperty({__proto__:null,UnauthorizedError:Ja,auth:Es,buildDiscoveryUrls:I2,discoverAuthorizationServerMetadata:O2,discoverOAuthProtectedResourceMetadata:A2,extractWWWAuthenticateParams:Wf,fetchToken:P2,isHttpsUrl:C2,parseErrorResponse:c_,prepareAuthorizationCodeRequest:L2,refreshAuthorization:j2,registerClient:U2,selectClientAuthMethod:k2,selectResourceURL:R2,startAuthorization:D2},Symbol.toStringTag,{value:"Module"}));class YM 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 Iw(e){}function $2(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=Iw,onError:n=Iw,onRetry:r=Iw,onComment:a}=e;let s="",i=!0,c,u="",f="";function m(E){const w=i?E.replace(/^\xEF\xBB\xBF/,""):E,[_,S]=WX(`${s}${w}`);for(const T of _)h(T);s=S,i=!1}function h(E){if(E===""){y();return}if(E.startsWith(":")){a&&a(E.slice(E.startsWith(": ")?2:1));return}const w=E.indexOf(":");if(w!==-1){const _=E.slice(0,w),S=E[w+1]===" "?2:1,T=E.slice(w+S);b(_,T,E);return}b(E,"",E)}function b(E,w,_){switch(E){case"event":f=w;break;case"data":u=`${u}${w}
30
30
  `;break;case"id":c=w.includes("\0")?void 0:w;break;case"retry":/^\d+$/.test(w)?r(parseInt(w,10)):n(new YM(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:_}));break;default:n(new YM(`Unknown field "${E.length>20?`${E.slice(0,20)}…`:E}"`,{type:"unknown-field",field:E,value:w,line:_}));break}}function y(){u.length>0&&t({id:c,event:f||void 0,data:u.endsWith(`
31
31
  `)?u.slice(0,-1):u}),c=void 0,u="",f=""}function x(E={}){s&&E.consume&&h(s),i=!0,c=void 0,u="",f="",s=""}return{feed:m,reset:x}}function WX(e){const t=[];let n="",r=0;for(;r<e.length;){const a=e.indexOf("\r",r),s=e.indexOf(`
32
32
  `,r);let i=-1;if(a!==-1&&s!==-1?i=Math.min(a,s):a!==-1?a===e.length-1?i=-1:i=a:s!==-1&&(i=s),i===-1){n=e.slice(r);break}else{const c=e.slice(r,i);t.push(c),r=i+1,e[r-1]==="\r"&&e[r]===`
33
- `&&r++}}return[t,n]}class KX extends TransformStream{constructor({onError:t,onRetry:n,onComment:r}={}){let a;super({start(s){a=$2({onEvent:i=>{s.enqueue(i)},onError(i){t==="terminate"?s.error(i):typeof t=="function"&&t(i)},onRetry:n,onComment:r})},transform(s){a.feed(s)}})}}const YX={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class pl extends Error{constructor(t,n){super(`Streamable HTTP error: ${n}`),this.code=t}}class ZX{constructor(t,n){var r;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=T2(n?.fetch,n?.requestInit),this._sessionId=n?.sessionId,this._reconnectionOptions=(r=n?.reconnectionOptions)!==null&&r!==void 0?r:YX}async _authThenStart(){var t;if(!this._authProvider)throw new Ja("No auth provider");let n;try{n=await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw(t=this.onerror)===null||t===void 0||t.call(this,r),r}if(n!=="AUTHORIZED")throw new Ja;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var t;const n={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(n.Authorization=`Bearer ${a.access_token}`)}this._sessionId&&(n["mcp-session-id"]=this._sessionId),this._protocolVersion&&(n["mcp-protocol-version"]=this._protocolVersion);const r=Qg((t=this._requestInit)===null||t===void 0?void 0:t.headers);return new Headers({...n,...r})}async _startOrAuthSse(t){var n,r,a,s;const{resumptionToken:i}=t;try{const c=await this._commonHeaders();c.set("Accept","text/event-stream"),i&&c.set("last-event-id",i);const u=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,{method:"GET",headers:c,signal:(r=this._abortController)===null||r===void 0?void 0:r.signal});if(!u.ok){if(await((a=u.body)===null||a===void 0?void 0:a.cancel()),u.status===401&&this._authProvider)return await this._authThenStart();if(u.status===405)return;throw new pl(u.status,`Failed to open SSE stream: ${u.statusText}`)}this._handleSseStream(u.body,t,!0)}catch(c){throw(s=this.onerror)===null||s===void 0||s.call(this,c),c}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const n=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(n*Math.pow(r,t),a)}_scheduleReconnection(t,n=0){var r;const a=this._reconnectionOptions.maxRetries;if(n>=a){(r=this.onerror)===null||r===void 0||r.call(this,new Error(`Maximum reconnection attempts (${a}) exceeded.`));return}const s=this._getNextReconnectionDelay(n);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(i=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(t,n+1)})},s)}_handleSseStream(t,n,r){if(!t)return;const{onresumptiontoken:a,replayMessageId:s}=n;let i,c=!1,u=!1;(async()=>{var m,h,b,y;try{const x=t.pipeThrough(new TextDecoderStream).pipeThrough(new KX({onRetry:_=>{this._serverRetryMs=_}})).getReader();for(;;){const{value:_,done:S}=await x.read();if(S)break;if(_.id&&(i=_.id,c=!0,a?.(_.id)),!!_.data&&(!_.event||_.event==="message"))try{const T=Sg.parse(JSON.parse(_.data));ff(T)&&(u=!0,s!==void 0&&(T.id=s)),(m=this.onmessage)===null||m===void 0||m.call(this,T)}catch(T){(h=this.onerror)===null||h===void 0||h.call(this,T)}}(r||c)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:s},0)}catch(x){if((b=this.onerror)===null||b===void 0||b.call(this,new Error(`SSE stream disconnected: ${x}`)),(r||c)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:s},0)}catch(_){(y=this.onerror)===null||y===void 0||y.call(this,new Error(`Failed to reconnect: ${_ instanceof Error?_.message:String(_)}`))}}})()}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 Ja("No auth provider");if(await Es(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ja("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 r,a,s,i,c,u,f;try{const{resumptionToken:m,onresumptiontoken:h}=n||{};if(m){this._startOrAuthSse({resumptionToken:m,replayMessageId:FE(t)?t.id:void 0}).catch(T=>{var R;return(R=this.onerror)===null||R===void 0?void 0:R.call(this,T)});return}const b=await this._commonHeaders();b.set("content-type","application/json"),b.set("accept","application/json, text/event-stream");const y={...this._requestInit,method:"POST",headers:b,body:JSON.stringify(t),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},x=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,y),E=x.headers.get("mcp-session-id");if(E&&(this._sessionId=E),!x.ok){const T=await x.text().catch(()=>null);if(x.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new pl(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:R,scope:C}=Wf(x);if(this._resourceMetadataUrl=R,this._scope=C,await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ja;return this._hasCompletedAuthFlow=!0,this.send(t)}if(x.status===403&&this._authProvider){const{resourceMetadataUrl:R,scope:C,error:I}=Wf(x);if(I==="insufficient_scope"){const A=x.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===A)throw new pl(403,"Server returned 403 after trying upscoping");if(C&&(this._scope=C),R&&(this._resourceMetadataUrl=R),this._lastUpscopingHeader=A??void 0,await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ja;return this.send(t)}}throw new pl(x.status,`Error POSTing to endpoint: ${T}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,x.status===202){await((s=x.body)===null||s===void 0?void 0:s.cancel()),zY(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(T=>{var R;return(R=this.onerror)===null||R===void 0?void 0:R.call(this,T)});return}const _=(Array.isArray(t)?t:[t]).filter(T=>"method"in T&&"id"in T&&T.id!==void 0).length>0,S=x.headers.get("content-type");if(_)if(S?.includes("text/event-stream"))this._handleSseStream(x.body,{onresumptiontoken:h},!1);else if(S?.includes("application/json")){const T=await x.json(),R=Array.isArray(T)?T.map(C=>Sg.parse(C)):[Sg.parse(T)];for(const C of R)(i=this.onmessage)===null||i===void 0||i.call(this,C)}else throw await((c=x.body)===null||c===void 0?void 0:c.cancel()),new pl(-1,`Unexpected content type: ${S}`);else await((u=x.body)===null||u===void 0?void 0:u.cancel())}catch(m){throw(f=this.onerror)===null||f===void 0||f.call(this,m),m}}get sessionId(){return this._sessionId}async terminateSession(){var t,n,r,a;if(this._sessionId)try{const s=await this._commonHeaders(),i={...this._requestInit,method:"DELETE",headers:s,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,i);if(await((r=c.body)===null||r===void 0?void 0:r.cancel()),!c.ok&&c.status!==405)throw new pl(c.status,`Failed to terminate session: ${c.statusText}`);this._sessionId=void 0}catch(s){throw(a=this.onerror)===null||a===void 0||a.call(this,s),s}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,n){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:n?.onresumptiontoken})}}class ZM extends Event{constructor(t,n){var r,a;super(t),this.code=(r=n?.code)!=null?r:void 0,this.message=(a=n?.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(qM(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(qM(this),n)}}function qX(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ex(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ex).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ex(e.cause)}`:e.message:`${e}`}function qM(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var z2=e=>{throw TypeError(e)},d_=(e,t,n)=>t.has(e)||z2("Cannot "+n),Bt=(e,t,n)=>(d_(e,t,"read from private field"),n?n.call(e):t.get(e)),pr=(e,t,n)=>t.has(e)?z2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Pn=(e,t,n,r)=>(d_(e,t,"write to private field"),t.set(e,n),n),bs=(e,t,n)=>(d_(e,t,"access private method"),n),ya,hl,jc,Tg,ab,_f,Yc,Tf,vi,Pc,su,Uc,pf,mo,tx,nx,rx,XM,ax,ox,mf,sx,ix;class Ng extends EventTarget{constructor(t,n){var r,a;super(),pr(this,mo),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,pr(this,ya),pr(this,hl),pr(this,jc),pr(this,Tg),pr(this,ab),pr(this,_f),pr(this,Yc),pr(this,Tf,null),pr(this,vi),pr(this,Pc),pr(this,su,null),pr(this,Uc,null),pr(this,pf,null),pr(this,nx,async s=>{var i;Bt(this,Pc).reset();const{body:c,redirected:u,status:f,headers:m}=s;if(f===204){bs(this,mo,mf).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?Pn(this,jc,new URL(s.url)):Pn(this,jc,void 0),f!==200){bs(this,mo,mf).call(this,`Non-200 status code (${f})`,f);return}if(!(m.get("content-type")||"").startsWith("text/event-stream")){bs(this,mo,mf).call(this,'Invalid content type, expected "text/event-stream"',f);return}if(Bt(this,ya)===this.CLOSED)return;Pn(this,ya,this.OPEN);const h=new Event("open");if((i=Bt(this,pf))==null||i.call(this,h),this.dispatchEvent(h),typeof c!="object"||!c||!("getReader"in c)){bs(this,mo,mf).call(this,"Invalid response body, expected a web ReadableStream",f),this.close();return}const b=new TextDecoder,y=c.getReader();let x=!0;do{const{done:E,value:w}=await y.read();w&&Bt(this,Pc).feed(b.decode(w,{stream:!E})),E&&(x=!1,Bt(this,Pc).reset(),bs(this,mo,sx).call(this))}while(x)}),pr(this,rx,s=>{Pn(this,vi,void 0),!(s.name==="AbortError"||s.type==="aborted")&&bs(this,mo,sx).call(this,ex(s))}),pr(this,ax,s=>{typeof s.id=="string"&&Pn(this,Tf,s.id);const i=new MessageEvent(s.event||"message",{data:s.data,origin:Bt(this,jc)?Bt(this,jc).origin:Bt(this,hl).origin,lastEventId:s.id||""});Bt(this,Uc)&&(!s.event||s.event==="message")&&Bt(this,Uc).call(this,i),this.dispatchEvent(i)}),pr(this,ox,s=>{Pn(this,_f,s)}),pr(this,ix,()=>{Pn(this,Yc,void 0),Bt(this,ya)===this.CONNECTING&&bs(this,mo,tx).call(this)});try{if(t instanceof URL)Pn(this,hl,t);else if(typeof t=="string")Pn(this,hl,new URL(t,XX()));else throw new Error("Invalid URL")}catch{throw qX("An invalid or illegal string was specified")}Pn(this,Pc,$2({onEvent:Bt(this,ax),onRetry:Bt(this,ox)})),Pn(this,ya,this.CONNECTING),Pn(this,_f,3e3),Pn(this,ab,(r=n?.fetch)!=null?r:globalThis.fetch),Pn(this,Tg,(a=n?.withCredentials)!=null?a:!1),bs(this,mo,tx).call(this)}get readyState(){return Bt(this,ya)}get url(){return Bt(this,hl).href}get withCredentials(){return Bt(this,Tg)}get onerror(){return Bt(this,su)}set onerror(t){Pn(this,su,t)}get onmessage(){return Bt(this,Uc)}set onmessage(t){Pn(this,Uc,t)}get onopen(){return Bt(this,pf)}set onopen(t){Pn(this,pf,t)}addEventListener(t,n,r){const a=n;super.addEventListener(t,a,r)}removeEventListener(t,n,r){const a=n;super.removeEventListener(t,a,r)}close(){Bt(this,Yc)&&clearTimeout(Bt(this,Yc)),Bt(this,ya)!==this.CLOSED&&(Bt(this,vi)&&Bt(this,vi).abort(),Pn(this,ya,this.CLOSED),Pn(this,vi,void 0))}}ya=new WeakMap,hl=new WeakMap,jc=new WeakMap,Tg=new WeakMap,ab=new WeakMap,_f=new WeakMap,Yc=new WeakMap,Tf=new WeakMap,vi=new WeakMap,Pc=new WeakMap,su=new WeakMap,Uc=new WeakMap,pf=new WeakMap,mo=new WeakSet,tx=function(){Pn(this,ya,this.CONNECTING),Pn(this,vi,new AbortController),Bt(this,ab)(Bt(this,hl),bs(this,mo,XM).call(this)).then(Bt(this,nx)).catch(Bt(this,rx))},nx=new WeakMap,rx=new WeakMap,XM=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Bt(this,Tf)?{"Last-Event-ID":Bt(this,Tf)}:void 0},cache:"no-store",signal:(e=Bt(this,vi))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},ax=new WeakMap,ox=new WeakMap,mf=function(e,t){var n;Bt(this,ya)!==this.CLOSED&&Pn(this,ya,this.CLOSED);const r=new ZM("error",{code:t,message:e});(n=Bt(this,su))==null||n.call(this,r),this.dispatchEvent(r)},sx=function(e,t){var n;if(Bt(this,ya)===this.CLOSED)return;Pn(this,ya,this.CONNECTING);const r=new ZM("error",{code:t,message:e});(n=Bt(this,su))==null||n.call(this,r),this.dispatchEvent(r),Pn(this,Yc,setTimeout(Bt(this,ix),Bt(this,_f)))},ix=new WeakMap,Ng.CONNECTING=0,Ng.OPEN=1,Ng.CLOSED=2;function XX(){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 JX extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class QX{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=T2(n?.fetch,n?.requestInit)}async _authThenStart(){var t;if(!this._authProvider)throw new Ja("No auth provider");let n;try{n=await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw(t=this.onerror)===null||t===void 0||t.call(this,r),r}if(n!=="AUTHORIZED")throw new Ja;return await this._startOrAuth()}async _commonHeaders(){var t;const n={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(n.Authorization=`Bearer ${a.access_token}`)}this._protocolVersion&&(n["mcp-protocol-version"]=this._protocolVersion);const r=Qg((t=this._requestInit)===null||t===void 0?void 0:t.headers);return new Headers({...n,...r})}_startOrAuth(){var t,n,r;const a=(r=(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&&r!==void 0?r:fetch;return new Promise((s,i)=>{this._eventSource=new Ng(this._url.href,{...this._eventSourceInit,fetch:async(c,u)=>{const f=await this._commonHeaders();f.set("Accept","text/event-stream");const m=await a(c,{...u,headers:f});if(m.status===401&&m.headers.has("www-authenticate")){const{resourceMetadataUrl:h,scope:b}=Wf(m);this._resourceMetadataUrl=h,this._scope=b}return m}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var u;if(c.code===401&&this._authProvider){this._authThenStart().then(s,i);return}const f=new JX(c.code,c.message,c);i(f),(u=this.onerror)===null||u===void 0||u.call(this,f)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var u;const f=c;try{if(this._endpoint=new URL(f.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(m){i(m),(u=this.onerror)===null||u===void 0||u.call(this,m),this.close();return}s()}),this._eventSource.onmessage=c=>{var u,f;const m=c;let h;try{h=Sg.parse(JSON.parse(m.data))}catch(b){(u=this.onerror)===null||u===void 0||u.call(this,b);return}(f=this.onmessage)===null||f===void 0||f.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 Ja("No auth provider");if(await Es(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ja("Failed to authorize")}async close(){var t,n,r;(t=this._abortController)===null||t===void 0||t.abort(),(n=this._eventSource)===null||n===void 0||n.close(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(t){var n,r,a,s;if(!this._endpoint)throw new Error("Not connected");try{const i=await this._commonHeaders();i.set("content-type","application/json");const c={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(t),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},u=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._endpoint,c);if(!u.ok){const f=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){const{resourceMetadataUrl:m,scope:h}=Wf(u);if(this._resourceMetadataUrl=m,this._scope=h,await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ja;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${f}`)}await((a=u.body)===null||a===void 0?void 0:a.cancel())}catch(i){throw(s=this.onerror)===null||s===void 0||s.call(this,i),i}}setProtocolVersion(t){this._protocolVersion=t}}var Ow,JM;function eJ(){return JM||(JM=1,Ow=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),Ow}var tJ=eJ();const QM=bp(tJ);var bu,nJ=(bu=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}get serverCapabilities(){return this.connector.serverCapabilities}get serverInfo(){return this.connector.serverInfo}async callTool(t,n,r){return this.connector.callTool(t,n,r)}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,r){return this.connector.request(t,n,r)}},Ge(bu,"MCPSession"),bu),yu,F2=(yu=class{_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),Re.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){Re.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(t){t instanceof Error&&t.name==="AbortError"?Re.debug(`${this.constructor.name} task aborted successfully`):Re.warn(`Error stopping ${this.constructor.name} task: ${t}`)}}await this._donePromise,Re.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(){Re.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),Re.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(t){this._exception=t,Re.error(`Error in ${this.constructor.name} task: ${t}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(t){Re.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 r=this._abortController.signal;if(r.aborted){t();return}const a=Ge(()=>{r.removeEventListener("abort",a),t()},"onAbort");r.addEventListener("abort",a)})}},Ge(yu,"ConnectionManager"),yu),vu,rJ=(vu=class extends F2{url;opts;_transport=null;constructor(t,n){super(),this.url=typeof t=="string"?new URL(t):t,this.opts=n}async establishConnection(){return this._transport=new QX(this.url,this.opts),Re.debug(`${this.constructor.name} connected successfully`),this._transport}async closeConnection(t){if(this._transport)try{await this._transport.close()}catch(n){Re.warn(`Error closing SSE transport: ${n}`)}finally{this._transport=null}}},Ge(vu,"SseConnectionManager"),vu),wu,ej=(wu=class extends h2{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){Re.debug("Already connected to MCP implementation");return}const t=this.baseUrl;if(this.preferSse){Re.debug(`Connecting to MCP implementation via HTTP/SSE: ${t}`),await this.connectWithSse(t);return}Re.debug(`Connecting to MCP implementation via HTTP: ${t}`);try{Re.info("🔄 Attempting streamable HTTP transport..."),await this.connectWithStreamableHttp(t),Re.info("✅ Successfully connected via streamable HTTP")}catch(n){let r="Unknown error",a=!1;if(n instanceof pl)a=n.code===401,n.code===400&&n.message.includes("Missing session ID")?(r="Server requires session ID (FastMCP compatibility) - using SSE transport",Re.warn(`⚠️ ${r}`)):n.code===404||n.code===405?(r=`Server returned ${n.code} - server likely doesn't support streamable HTTP`,Re.debug(r)):(r=`Server returned ${n.code}: ${n.message}`,Re.debug(r));else if(n instanceof Error){const s=n.toString(),i=n.message||"";a=s.includes("401")||i.includes("Unauthorized"),s.includes("Missing session ID")||s.includes("Bad Request: Missing session ID")||i.includes("FastMCP session ID error")?(r="Server requires session ID (FastMCP compatibility) - using SSE transport",Re.warn(`⚠️ ${r}`)):s.includes("405 Method Not Allowed")||s.includes("404 Not Found")?(r="Server doesn't support streamable HTTP (405/404)",Re.debug(r)):(r=`Streamable HTTP failed: ${n.message}`,Re.debug(r))}if(a){Re.info("Authentication required - skipping SSE fallback"),await this.cleanupResources();const s=new Error("Authentication required");throw s.code=401,s}Re.info("🔄 Falling back to SSE transport...");try{await this.connectWithSse(t)}catch(s){if(Re.error("Failed to connect with both transports:"),Re.error(` Streamable HTTP: ${r}`),Re.error(` SSE: ${s}`),await this.cleanupResources(),s?.message?.includes("401")||s?.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 ZX(new URL(t),{authProvider:this.opts.authProvider,requestInit:{headers:this.headers},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});let r=n;if(this.opts.wrapTransport){const s=this.baseUrl;r=this.opts.wrapTransport(r,s)}const a={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.samplingCallback?{sampling:{}}:{},...this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};Re.debug("Creating Client with capabilities:",JSON.stringify(a.capabilities,null,2)),this.client=new VM(this.clientInfo,a),this.setupRootsHandler(),Re.debug("Roots handler registered before connect");try{await this.client.connect(r,{timeout:Math.min(this.timeout,3e3)});const s=n.sessionId;s?Re.debug(`Session ID obtained: ${s}`):Re.warn("Session ID not available after connect - this may cause issues with SSE stream")}catch(s){if(s instanceof Error){const i=s.message||s.toString();if(i.includes("Missing session ID")||i.includes("Bad Request: Missing session ID")||i.includes("Mcp-Session-Id header is required")){const c=new Error(`Session ID error: ${i}. The SDK should automatically extract session ID from initialize response.`);throw c.cause=s,c}}throw s}this.streamableTransport=n,this.connectionManager={stop:Ge(async()=>{if(this.streamableTransport)try{await this.streamableTransport.terminateSession(),await this.streamableTransport.close()}catch(s){Re.warn(`Error closing Streamable HTTP transport: ${s}`)}finally{this.streamableTransport=null}},"stop")},this.connected=!0,this.transportType="streamable-http",this.setupNotificationHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),Re.debug(`Successfully connected to MCP implementation via streamable HTTP: ${t}`)}catch(n){throw await this.cleanupResources(),n}}async connectWithSse(t){try{this.connectionManager=new rJ(t,{authProvider:this.opts.authProvider,requestInit:{headers:this.headers}});let n=await this.connectionManager.start();if(this.opts.wrapTransport){const a=this.baseUrl;n=this.opts.wrapTransport(n,a)}const r={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.samplingCallback?{sampling:{}}:{},...this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};Re.debug("Creating Client with capabilities (SSE):",JSON.stringify(r.capabilities,null,2)),this.client=new VM(this.clientInfo,r),this.setupRootsHandler(),Re.debug("Roots handler registered before connect (SSE)"),await this.client.connect(n),this.connected=!0,this.transportType="sse",this.setupNotificationHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),Re.debug(`Successfully connected to MCP implementation via HTTP/SSE: ${t}`)}catch(n){throw await this.cleanupResources(),n}}get publicIdentifier(){return{type:"http",url:this.baseUrl,transport:this.transportType||"unknown"}}getTransportType(){return this.transportType}},Ge(wu,"HttpConnector"),wu),Eu,aJ=(Eu=class extends F2{url;headers;_ws=null;constructor(t,n={}){super(),this.url=t,this.headers=n}async establishConnection(){return Re.debug(`Connecting to WebSocket: ${this.url}`),new Promise((t,n)=>{const r=new QM(this.url,{headers:this.headers});this._ws=r;const a=Ge(()=>{i(),Re.debug("WebSocket connected successfully"),t(r)},"onOpen"),s=Ge(c=>{i(),Re.error(`Failed to connect to WebSocket: ${c}`),n(c)},"onError"),i=Ge(()=>{r.off("open",a),r.off("error",s)},"cleanup");r.on("open",a),r.on("error",s)})}async closeConnection(t){return Re.debug("Closing WebSocket connection"),new Promise(n=>{const r=Ge(()=>{t.off("close",r),this._ws=null,n()},"onClose");if(t.readyState===QM.CLOSED){r();return}t.on("close",r);try{t.close()}catch(a){Re.warn(`Error closing WebSocket connection: ${a}`),r()}})}},Ge(Eu,"WebSocketConnectionManager"),Eu),xu,oJ=(xu=class extends h2{url;headers;connectionManager=null;ws=null;receiverTask=null;pending=new Map;toolsCache=null;constructor(t,n={}){super(),this.url=t,this.headers={...n.headers??{}},n.authToken&&(this.headers.Authorization=`Bearer ${n.authToken}`)}async connect(){if(this.connected){Re.debug("Already connected to MCP implementation");return}Re.debug(`Connecting via WebSocket: ${this.url}`);try{this.connectionManager=new aJ(this.url,this.headers),this.ws=await this.connectionManager.start(),this.receiverTask=this.receiveLoop(),this.connected=!0,Re.debug("WebSocket connected successfully")}catch(t){throw Re.error(`Failed to connect: ${t}`),await this.cleanupResources(),t}}async disconnect(){if(!this.connected){Re.debug("Not connected to MCP implementation");return}Re.debug("Disconnecting …"),await this.cleanupResources(),this.connected=!1}sendRequest(t,n=null){if(!this.ws)throw new Error("WebSocket is not connected");const r=oz(),a=JSON.stringify({id:r,method:t,params:n??{}});return new Promise((s,i)=>{this.pending.set(r,{resolve:s,reject:i}),this.ws.send(a,c=>{c&&(this.pending.delete(r),i(c))})})}async receiveLoop(){if(!this.ws)return;const t=this.ws,n=Ge(r=>{let a;try{a=JSON.parse(r.data??r)}catch(i){Re.warn("Received non‑JSON frame",i);return}const s=a.id;if(s&&this.pending.has(s)){const{resolve:i,reject:c}=this.pending.get(s);this.pending.delete(s),"result"in a?i(a.result):"error"in a&&c(a.error)}else a.method&&!a.id?(Re.debug("Received notification",a.method,a.params),this.handleNotification(a)):Re.debug("Received unsolicited message",a)},"onMessage");return t.addEventListener?t.addEventListener("message",n):t.on("message",n),new Promise(r=>{const a=Ge(()=>{t.removeEventListener?t.removeEventListener("message",n):t.off("message",n),this.rejectAll(new Error("WebSocket closed")),r()},"onClose");t.addEventListener?t.addEventListener("close",a):t.on("close",a)})}rejectAll(t){for(const{reject:n}of this.pending.values())n(t);this.pending.clear()}async handleNotification(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({method:t.method,params:t.params})}catch(r){Re.error("Error in notification handler:",r)}}async refreshToolsCache(){try{Re.debug("[Auto] Refreshing tools cache due to list_changed notification");const t=await this.listTools();this.toolsCache=t.map(n=>n),Re.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(t){Re.warn("[Auto] Failed to refresh tools cache:",t)}}async initialize(){Re.debug("Initializing MCP session over WebSocket");const t=await this.sendRequest("initialize"),n=await this.listTools();return this.toolsCache=n.map(r=>r),Re.debug(`Initialized with ${this.toolsCache.length} tools`),t}async listTools(){return(await this.sendRequest("tools/list")).tools??[]}async callTool(t,n){return await this.sendRequest("tools/call",{name:t,arguments:n})}async listResources(){const t=await this.sendRequest("resources/list");return{resources:Array.isArray(t)?t:[]}}async readResource(t){return await this.sendRequest("resources/read",{uri:t})}async request(t,n=null){return await this.sendRequest(t,n)}get tools(){if(!this.toolsCache)throw new Error("MCP client is not initialized");return this.toolsCache}async cleanupResources(){this.receiverTask&&await this.receiverTask.catch(()=>{}),this.receiverTask=null,this.rejectAll(new Error("WebSocket disconnected")),this.connectionManager&&(await this.connectionManager.stop(),this.connectionManager=null,this.ws=null),this.toolsCache=null}get publicIdentifier(){return{type:"websocket",url:this.url}}},Ge(xu,"WebSocketConnector"),xu),Su,sJ=(Su=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}removeServer(t){this.config.mcpServers?.[t]&&(delete this.config.mcpServers[t],this.activeSessions=this.activeSessions.filter(n=>n!==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 r=this.config.mcpServers??{};if(Object.keys(r).length===0&&Re.warn("No MCP servers defined in config"),!r[t])throw new Error(`Server '${t}' not found in config`);const a=this.createConnectorFromConfig(r[t]),s=new nJ(a);return n&&await s.initialize(),this.sessions[t]=s,this.activeSessions.includes(t)||this.activeSessions.push(t),s}async createAllSessions(t=!0){const n=this.config.mcpServers??{};Object.keys(n).length===0&&Re.warn("No MCP servers defined in config");for(const r of Object.keys(n))await this.createSession(r,t);return this.sessions}getSession(t){const n=this.sessions[t];return n||null}getAllActiveSessions(){return Object.fromEntries(this.activeSessions.map(t=>[t,this.sessions[t]]))}async closeSession(t){const n=this.sessions[t];if(!n){Re.warn(`No session exists for server ${t}, nothing to close`);return}try{Re.debug(`Closing session for server ${t}`),await n.disconnect()}catch(r){Re.error(`Error closing session for server '${t}': ${r}`)}finally{delete this.sessions[t],this.activeSessions=this.activeSessions.filter(r=>r!==t)}}async closeAllSessions(){const t=Object.keys(this.sessions),n=[];for(const r of t)try{Re.debug(`Closing session for server ${r}`),await this.closeSession(r)}catch(a){const s=`Failed to close session for server '${r}': ${a}`;Re.error(s),n.push(s)}n.length?Re.error(`Encountered ${n.length} errors while closing sessions`):Re.debug("All sessions closed successfully")}},Ge(Su,"BaseMCPClient"),Su),Tl,iJ=(Tl=class extends sJ{constructor(t){super(t)}static fromDict(t){return new Tl(t)}createConnectorFromConfig(t){const{url:n,transport:r,headers:a,authToken:s,authProvider:i,wrapTransport:c,clientOptions:u,samplingCallback:f,elicitationCallback:m}=t;if(!n)throw new Error("Server URL is required");const h={headers:a,authToken:s,authProvider:i,wrapTransport:c,clientOptions:u,samplingCallback:f,elicitationCallback:m};return u?console.log("[BrowserMCPClient] Passing clientOptions to connector:",JSON.stringify(u,null,2)):console.warn("[BrowserMCPClient] No clientOptions provided to connector!"),r==="websocket"||n.startsWith("ws://")||n.startsWith("wss://")?new oJ(n,h):r==="http"||n.startsWith("http://")||n.startsWith("https://")?new ej(n,h):new ej(n,h)}},Ge(Tl,"BrowserMCPClient"),Tl);function Zc(e){const t=Ge(()=>{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(B2).join("&"),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}Ge(Zc,"sanitizeUrl");function B2([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}Ge(B2,"sanitizeParam");var _u,kg=(_u=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=Zc(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 Zc(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(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,r),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(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,r),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(),r=`${this.storageKeyPrefix}:state_${n}`,a={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(r,JSON.stringify(a)),t.searchParams.set("state",n);const s=t.toString(),i=Zc(s);return localStorage.setItem(this.getKey("last_auth_url"),i),i}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 r="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const a=window.open(n,`mcp_auth_${this.serverUrlHash}`,r);this.onPopupWindow&&this.onPopupWindow(n,r,a),!a||a.closed||typeof a.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(a.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(a){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,a)}}getLastAttemptedAuthUrl(){const t=localStorage.getItem(this.getKey("last_auth_url"));return t?Zc(t):null}clearStorage(){const t=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,n=`${this.storageKeyPrefix}:state_`,r=[];let a=0;for(let i=0;i<localStorage.length;i++){const c=localStorage.key(i);if(c){if(c.startsWith(t))r.push(c);else if(c.startsWith(n))try{const u=localStorage.getItem(c);u&&JSON.parse(u).serverUrlHash===this.serverUrlHash&&r.push(c)}catch(u){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${c} during clearStorage:`,u)}}}return[...new Set(r)].forEach(i=>{localStorage.removeItem(i),a++}),a}hashString(t){let n=0;for(let r=0;r<t.length;r++){const a=t.charCodeAt(r);n=(n<<5)-n+a,n=n&n}return Math.abs(n).toString(16)}getKey(t){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${t}`}},Ge(_u,"BrowserOAuthClientProvider"),_u);async function f_(){const e=new URLSearchParams(window.location.search),t=e.get("code"),n=e.get("state"),r=e.get("error"),a=e.get("error_description"),s="[mcp-callback]";console.log(`${s} Handling callback...`,{code:t,state:n,error:r,errorDescription:a});let i=null,c=null;const u=n?`mcp:auth:state_${n}`:null;try{if(r)throw new Error(`OAuth error: ${r} - ${a||"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 f=localStorage.getItem(u);if(!f)throw new Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{c=JSON.parse(f)}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(`${s} Re-instantiating provider for server: ${m}`),i=new kg(m,h),console.log(`${s} Calling SDK auth() to exchange code...`);const b=new URL(m).origin,y=await Es(i,{serverUrl:b,authorizationCode:t});if(y==="AUTHORIZED")if(console.log(`${s} Authorization successful via SDK auth().`),c.flowType==="redirect"&&c.returnUrl)console.log(`${s} Redirect flow complete. Returning to: ${c.returnUrl}`),localStorage.removeItem(u),window.location.href=c.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${s} 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(`${s} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(u);const E=window.location.pathname.split("/").filter(Boolean),w=E.length>0&&E[E.length-1]==="callback"?"/"+E.slice(0,-2).join("/"):"/";window.location.href=w||"/"}else throw console.warn(`${s} SDK auth() returned unexpected status: ${y}`),new Error(`Unexpected result from authentication library: ${y}`)}catch(f){console.error(`${s} Error during OAuth callback handling:`,f);const m=f instanceof Error?f.message:String(f);window.opener&&!window.opener.closed&&window.opener.postMessage({type:"mcp_auth_callback",success:!1,error:m},window.location.origin);try{document.body.innerHTML=`
33
+ `&&r++}}return[t,n]}class KX extends TransformStream{constructor({onError:t,onRetry:n,onComment:r}={}){let a;super({start(s){a=$2({onEvent:i=>{s.enqueue(i)},onError(i){t==="terminate"?s.error(i):typeof t=="function"&&t(i)},onRetry:n,onComment:r})},transform(s){a.feed(s)}})}}const YX={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class pl extends Error{constructor(t,n){super(`Streamable HTTP error: ${n}`),this.code=t}}class ZX{constructor(t,n){var r;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=T2(n?.fetch,n?.requestInit),this._sessionId=n?.sessionId,this._reconnectionOptions=(r=n?.reconnectionOptions)!==null&&r!==void 0?r:YX}async _authThenStart(){var t;if(!this._authProvider)throw new Ja("No auth provider");let n;try{n=await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw(t=this.onerror)===null||t===void 0||t.call(this,r),r}if(n!=="AUTHORIZED")throw new Ja;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var t;const n={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(n.Authorization=`Bearer ${a.access_token}`)}this._sessionId&&(n["mcp-session-id"]=this._sessionId),this._protocolVersion&&(n["mcp-protocol-version"]=this._protocolVersion);const r=Qg((t=this._requestInit)===null||t===void 0?void 0:t.headers);return new Headers({...n,...r})}async _startOrAuthSse(t){var n,r,a,s;const{resumptionToken:i}=t;try{const c=await this._commonHeaders();c.set("Accept","text/event-stream"),i&&c.set("last-event-id",i);const u=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._url,{method:"GET",headers:c,signal:(r=this._abortController)===null||r===void 0?void 0:r.signal});if(!u.ok){if(await((a=u.body)===null||a===void 0?void 0:a.cancel()),u.status===401&&this._authProvider)return await this._authThenStart();if(u.status===405)return;throw new pl(u.status,`Failed to open SSE stream: ${u.statusText}`)}this._handleSseStream(u.body,t,!0)}catch(c){throw(s=this.onerror)===null||s===void 0||s.call(this,c),c}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const n=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(n*Math.pow(r,t),a)}_scheduleReconnection(t,n=0){var r;const a=this._reconnectionOptions.maxRetries;if(n>=a){(r=this.onerror)===null||r===void 0||r.call(this,new Error(`Maximum reconnection attempts (${a}) exceeded.`));return}const s=this._getNextReconnectionDelay(n);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(i=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(t,n+1)})},s)}_handleSseStream(t,n,r){if(!t)return;const{onresumptiontoken:a,replayMessageId:s}=n;let i,c=!1,u=!1;(async()=>{var m,h,b,y;try{const x=t.pipeThrough(new TextDecoderStream).pipeThrough(new KX({onRetry:_=>{this._serverRetryMs=_}})).getReader();for(;;){const{value:_,done:S}=await x.read();if(S)break;if(_.id&&(i=_.id,c=!0,a?.(_.id)),!!_.data&&(!_.event||_.event==="message"))try{const T=Sg.parse(JSON.parse(_.data));ff(T)&&(u=!0,s!==void 0&&(T.id=s)),(m=this.onmessage)===null||m===void 0||m.call(this,T)}catch(T){(h=this.onerror)===null||h===void 0||h.call(this,T)}}(r||c)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:s},0)}catch(x){if((b=this.onerror)===null||b===void 0||b.call(this,new Error(`SSE stream disconnected: ${x}`)),(r||c)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:s},0)}catch(_){(y=this.onerror)===null||y===void 0||y.call(this,new Error(`Failed to reconnect: ${_ instanceof Error?_.message:String(_)}`))}}})()}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 Ja("No auth provider");if(await Es(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ja("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 r,a,s,i,c,u,f;try{const{resumptionToken:m,onresumptiontoken:h}=n||{};if(m){this._startOrAuthSse({resumptionToken:m,replayMessageId:FE(t)?t.id:void 0}).catch(T=>{var R;return(R=this.onerror)===null||R===void 0?void 0:R.call(this,T)});return}const b=await this._commonHeaders();b.set("content-type","application/json"),b.set("accept","application/json, text/event-stream");const y={...this._requestInit,method:"POST",headers:b,body:JSON.stringify(t),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},x=await((a=this._fetch)!==null&&a!==void 0?a:fetch)(this._url,y),E=x.headers.get("mcp-session-id");if(E&&(this._sessionId=E),!x.ok){const T=await x.text().catch(()=>null);if(x.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new pl(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:R,scope:C}=Wf(x);if(this._resourceMetadataUrl=R,this._scope=C,await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ja;return this._hasCompletedAuthFlow=!0,this.send(t)}if(x.status===403&&this._authProvider){const{resourceMetadataUrl:R,scope:C,error:I}=Wf(x);if(I==="insufficient_scope"){const A=x.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===A)throw new pl(403,"Server returned 403 after trying upscoping");if(C&&(this._scope=C),R&&(this._resourceMetadataUrl=R),this._lastUpscopingHeader=A??void 0,await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ja;return this.send(t)}}throw new pl(x.status,`Error POSTing to endpoint: ${T}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,x.status===202){await((s=x.body)===null||s===void 0?void 0:s.cancel()),PY(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(T=>{var R;return(R=this.onerror)===null||R===void 0?void 0:R.call(this,T)});return}const _=(Array.isArray(t)?t:[t]).filter(T=>"method"in T&&"id"in T&&T.id!==void 0).length>0,S=x.headers.get("content-type");if(_)if(S?.includes("text/event-stream"))this._handleSseStream(x.body,{onresumptiontoken:h},!1);else if(S?.includes("application/json")){const T=await x.json(),R=Array.isArray(T)?T.map(C=>Sg.parse(C)):[Sg.parse(T)];for(const C of R)(i=this.onmessage)===null||i===void 0||i.call(this,C)}else throw await((c=x.body)===null||c===void 0?void 0:c.cancel()),new pl(-1,`Unexpected content type: ${S}`);else await((u=x.body)===null||u===void 0?void 0:u.cancel())}catch(m){throw(f=this.onerror)===null||f===void 0||f.call(this,m),m}}get sessionId(){return this._sessionId}async terminateSession(){var t,n,r,a;if(this._sessionId)try{const s=await this._commonHeaders(),i={...this._requestInit,method:"DELETE",headers:s,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,i);if(await((r=c.body)===null||r===void 0?void 0:r.cancel()),!c.ok&&c.status!==405)throw new pl(c.status,`Failed to terminate session: ${c.statusText}`);this._sessionId=void 0}catch(s){throw(a=this.onerror)===null||a===void 0||a.call(this,s),s}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,n){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:n?.onresumptiontoken})}}class ZM extends Event{constructor(t,n){var r,a;super(t),this.code=(r=n?.code)!=null?r:void 0,this.message=(a=n?.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(qM(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(qM(this),n)}}function qX(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ex(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ex).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ex(e.cause)}`:e.message:`${e}`}function qM(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var z2=e=>{throw TypeError(e)},d_=(e,t,n)=>t.has(e)||z2("Cannot "+n),Bt=(e,t,n)=>(d_(e,t,"read from private field"),n?n.call(e):t.get(e)),pr=(e,t,n)=>t.has(e)?z2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Pn=(e,t,n,r)=>(d_(e,t,"write to private field"),t.set(e,n),n),bs=(e,t,n)=>(d_(e,t,"access private method"),n),ya,hl,jc,Tg,ab,_f,Yc,Tf,vi,Pc,su,Uc,pf,mo,tx,nx,rx,XM,ax,ox,mf,sx,ix;class Ng extends EventTarget{constructor(t,n){var r,a;super(),pr(this,mo),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,pr(this,ya),pr(this,hl),pr(this,jc),pr(this,Tg),pr(this,ab),pr(this,_f),pr(this,Yc),pr(this,Tf,null),pr(this,vi),pr(this,Pc),pr(this,su,null),pr(this,Uc,null),pr(this,pf,null),pr(this,nx,async s=>{var i;Bt(this,Pc).reset();const{body:c,redirected:u,status:f,headers:m}=s;if(f===204){bs(this,mo,mf).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?Pn(this,jc,new URL(s.url)):Pn(this,jc,void 0),f!==200){bs(this,mo,mf).call(this,`Non-200 status code (${f})`,f);return}if(!(m.get("content-type")||"").startsWith("text/event-stream")){bs(this,mo,mf).call(this,'Invalid content type, expected "text/event-stream"',f);return}if(Bt(this,ya)===this.CLOSED)return;Pn(this,ya,this.OPEN);const h=new Event("open");if((i=Bt(this,pf))==null||i.call(this,h),this.dispatchEvent(h),typeof c!="object"||!c||!("getReader"in c)){bs(this,mo,mf).call(this,"Invalid response body, expected a web ReadableStream",f),this.close();return}const b=new TextDecoder,y=c.getReader();let x=!0;do{const{done:E,value:w}=await y.read();w&&Bt(this,Pc).feed(b.decode(w,{stream:!E})),E&&(x=!1,Bt(this,Pc).reset(),bs(this,mo,sx).call(this))}while(x)}),pr(this,rx,s=>{Pn(this,vi,void 0),!(s.name==="AbortError"||s.type==="aborted")&&bs(this,mo,sx).call(this,ex(s))}),pr(this,ax,s=>{typeof s.id=="string"&&Pn(this,Tf,s.id);const i=new MessageEvent(s.event||"message",{data:s.data,origin:Bt(this,jc)?Bt(this,jc).origin:Bt(this,hl).origin,lastEventId:s.id||""});Bt(this,Uc)&&(!s.event||s.event==="message")&&Bt(this,Uc).call(this,i),this.dispatchEvent(i)}),pr(this,ox,s=>{Pn(this,_f,s)}),pr(this,ix,()=>{Pn(this,Yc,void 0),Bt(this,ya)===this.CONNECTING&&bs(this,mo,tx).call(this)});try{if(t instanceof URL)Pn(this,hl,t);else if(typeof t=="string")Pn(this,hl,new URL(t,XX()));else throw new Error("Invalid URL")}catch{throw qX("An invalid or illegal string was specified")}Pn(this,Pc,$2({onEvent:Bt(this,ax),onRetry:Bt(this,ox)})),Pn(this,ya,this.CONNECTING),Pn(this,_f,3e3),Pn(this,ab,(r=n?.fetch)!=null?r:globalThis.fetch),Pn(this,Tg,(a=n?.withCredentials)!=null?a:!1),bs(this,mo,tx).call(this)}get readyState(){return Bt(this,ya)}get url(){return Bt(this,hl).href}get withCredentials(){return Bt(this,Tg)}get onerror(){return Bt(this,su)}set onerror(t){Pn(this,su,t)}get onmessage(){return Bt(this,Uc)}set onmessage(t){Pn(this,Uc,t)}get onopen(){return Bt(this,pf)}set onopen(t){Pn(this,pf,t)}addEventListener(t,n,r){const a=n;super.addEventListener(t,a,r)}removeEventListener(t,n,r){const a=n;super.removeEventListener(t,a,r)}close(){Bt(this,Yc)&&clearTimeout(Bt(this,Yc)),Bt(this,ya)!==this.CLOSED&&(Bt(this,vi)&&Bt(this,vi).abort(),Pn(this,ya,this.CLOSED),Pn(this,vi,void 0))}}ya=new WeakMap,hl=new WeakMap,jc=new WeakMap,Tg=new WeakMap,ab=new WeakMap,_f=new WeakMap,Yc=new WeakMap,Tf=new WeakMap,vi=new WeakMap,Pc=new WeakMap,su=new WeakMap,Uc=new WeakMap,pf=new WeakMap,mo=new WeakSet,tx=function(){Pn(this,ya,this.CONNECTING),Pn(this,vi,new AbortController),Bt(this,ab)(Bt(this,hl),bs(this,mo,XM).call(this)).then(Bt(this,nx)).catch(Bt(this,rx))},nx=new WeakMap,rx=new WeakMap,XM=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Bt(this,Tf)?{"Last-Event-ID":Bt(this,Tf)}:void 0},cache:"no-store",signal:(e=Bt(this,vi))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},ax=new WeakMap,ox=new WeakMap,mf=function(e,t){var n;Bt(this,ya)!==this.CLOSED&&Pn(this,ya,this.CLOSED);const r=new ZM("error",{code:t,message:e});(n=Bt(this,su))==null||n.call(this,r),this.dispatchEvent(r)},sx=function(e,t){var n;if(Bt(this,ya)===this.CLOSED)return;Pn(this,ya,this.CONNECTING);const r=new ZM("error",{code:t,message:e});(n=Bt(this,su))==null||n.call(this,r),this.dispatchEvent(r),Pn(this,Yc,setTimeout(Bt(this,ix),Bt(this,_f)))},ix=new WeakMap,Ng.CONNECTING=0,Ng.OPEN=1,Ng.CLOSED=2;function XX(){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 JX extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class QX{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=T2(n?.fetch,n?.requestInit)}async _authThenStart(){var t;if(!this._authProvider)throw new Ja("No auth provider");let n;try{n=await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw(t=this.onerror)===null||t===void 0||t.call(this,r),r}if(n!=="AUTHORIZED")throw new Ja;return await this._startOrAuth()}async _commonHeaders(){var t;const n={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(n.Authorization=`Bearer ${a.access_token}`)}this._protocolVersion&&(n["mcp-protocol-version"]=this._protocolVersion);const r=Qg((t=this._requestInit)===null||t===void 0?void 0:t.headers);return new Headers({...n,...r})}_startOrAuth(){var t,n,r;const a=(r=(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&&r!==void 0?r:fetch;return new Promise((s,i)=>{this._eventSource=new Ng(this._url.href,{...this._eventSourceInit,fetch:async(c,u)=>{const f=await this._commonHeaders();f.set("Accept","text/event-stream");const m=await a(c,{...u,headers:f});if(m.status===401&&m.headers.has("www-authenticate")){const{resourceMetadataUrl:h,scope:b}=Wf(m);this._resourceMetadataUrl=h,this._scope=b}return m}}),this._abortController=new AbortController,this._eventSource.onerror=c=>{var u;if(c.code===401&&this._authProvider){this._authThenStart().then(s,i);return}const f=new JX(c.code,c.message,c);i(f),(u=this.onerror)===null||u===void 0||u.call(this,f)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",c=>{var u;const f=c;try{if(this._endpoint=new URL(f.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(m){i(m),(u=this.onerror)===null||u===void 0||u.call(this,m),this.close();return}s()}),this._eventSource.onmessage=c=>{var u,f;const m=c;let h;try{h=Sg.parse(JSON.parse(m.data))}catch(b){(u=this.onerror)===null||u===void 0||u.call(this,b);return}(f=this.onmessage)===null||f===void 0||f.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 Ja("No auth provider");if(await Es(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ja("Failed to authorize")}async close(){var t,n,r;(t=this._abortController)===null||t===void 0||t.abort(),(n=this._eventSource)===null||n===void 0||n.close(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(t){var n,r,a,s;if(!this._endpoint)throw new Error("Not connected");try{const i=await this._commonHeaders();i.set("content-type","application/json");const c={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(t),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},u=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._endpoint,c);if(!u.ok){const f=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){const{resourceMetadataUrl:m,scope:h}=Wf(u);if(this._resourceMetadataUrl=m,this._scope=h,await Es(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ja;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${f}`)}await((a=u.body)===null||a===void 0?void 0:a.cancel())}catch(i){throw(s=this.onerror)===null||s===void 0||s.call(this,i),i}}setProtocolVersion(t){this._protocolVersion=t}}var Ow,JM;function eJ(){return JM||(JM=1,Ow=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),Ow}var tJ=eJ();const QM=bp(tJ);var bu,nJ=(bu=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}get serverCapabilities(){return this.connector.serverCapabilities}get serverInfo(){return this.connector.serverInfo}async callTool(t,n,r){return this.connector.callTool(t,n,r)}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,r){return this.connector.request(t,n,r)}},Ge(bu,"MCPSession"),bu),yu,F2=(yu=class{_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),Re.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){Re.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(t){t instanceof Error&&t.name==="AbortError"?Re.debug(`${this.constructor.name} task aborted successfully`):Re.warn(`Error stopping ${this.constructor.name} task: ${t}`)}}await this._donePromise,Re.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(){Re.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),Re.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(t){this._exception=t,Re.error(`Error in ${this.constructor.name} task: ${t}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(t){Re.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 r=this._abortController.signal;if(r.aborted){t();return}const a=Ge(()=>{r.removeEventListener("abort",a),t()},"onAbort");r.addEventListener("abort",a)})}},Ge(yu,"ConnectionManager"),yu),vu,rJ=(vu=class extends F2{url;opts;_transport=null;constructor(t,n){super(),this.url=typeof t=="string"?new URL(t):t,this.opts=n}async establishConnection(){return this._transport=new QX(this.url,this.opts),Re.debug(`${this.constructor.name} connected successfully`),this._transport}async closeConnection(t){if(this._transport)try{await this._transport.close()}catch(n){Re.warn(`Error closing SSE transport: ${n}`)}finally{this._transport=null}}},Ge(vu,"SseConnectionManager"),vu),wu,ej=(wu=class extends p2{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){Re.debug("Already connected to MCP implementation");return}const t=this.baseUrl;if(this.preferSse){Re.debug(`Connecting to MCP implementation via HTTP/SSE: ${t}`),await this.connectWithSse(t);return}Re.debug(`Connecting to MCP implementation via HTTP: ${t}`);try{Re.info("🔄 Attempting streamable HTTP transport..."),await this.connectWithStreamableHttp(t),Re.info("✅ Successfully connected via streamable HTTP")}catch(n){let r="Unknown error",a=!1;if(n instanceof pl){const s=n;a=s.code===401,s.code===400&&s.message.includes("Missing session ID")?(r="Server requires session ID (FastMCP compatibility) - using SSE transport",Re.warn(`⚠️ ${r}`)):s.code===404||s.code===405?(r=`Server returned ${s.code} - server likely doesn't support streamable HTTP`,Re.debug(r)):(r=`Server returned ${s.code}: ${s.message}`,Re.debug(r))}else if(n instanceof Error){const s=n.toString(),i=n.message||"";a=s.includes("401")||i.includes("Unauthorized"),s.includes("Missing session ID")||s.includes("Bad Request: Missing session ID")||i.includes("FastMCP session ID error")?(r="Server requires session ID (FastMCP compatibility) - using SSE transport",Re.warn(`⚠️ ${r}`)):s.includes("405 Method Not Allowed")||s.includes("404 Not Found")?(r="Server doesn't support streamable HTTP (405/404)",Re.debug(r)):(r=`Streamable HTTP failed: ${n.message}`,Re.debug(r))}if(a){Re.info("Authentication required - skipping SSE fallback"),await this.cleanupResources();const s=new Error("Authentication required");throw s.code=401,s}Re.info("🔄 Falling back to SSE transport...");try{await this.connectWithSse(t)}catch(s){if(Re.error("Failed to connect with both transports:"),Re.error(` Streamable HTTP: ${r}`),Re.error(` SSE: ${s}`),await this.cleanupResources(),s?.message?.includes("401")||s?.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 ZX(new URL(t),{authProvider:this.opts.authProvider,requestInit:{headers:this.headers},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2}});let r=n;if(this.opts.wrapTransport){const s=this.baseUrl;r=this.opts.wrapTransport(r,s)}const a={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.samplingCallback?{sampling:{}}:{},...this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};Re.debug("Creating Client with capabilities:",JSON.stringify(a.capabilities,null,2)),this.client=new VM(this.clientInfo,a),this.setupRootsHandler(),Re.debug("Roots handler registered before connect");try{await this.client.connect(r,{timeout:Math.min(this.timeout,3e3)});const s=n.sessionId;s?Re.debug(`Session ID obtained: ${s}`):Re.warn("Session ID not available after connect - this may cause issues with SSE stream")}catch(s){if(s instanceof Error){const i=s.message||s.toString();if(i.includes("Missing session ID")||i.includes("Bad Request: Missing session ID")||i.includes("Mcp-Session-Id header is required")){const c=new Error(`Session ID error: ${i}. The SDK should automatically extract session ID from initialize response.`);throw c.cause=s,c}}throw s}this.streamableTransport=n,this.connectionManager={stop:Ge(async()=>{if(this.streamableTransport)try{await this.streamableTransport.terminateSession(),await this.streamableTransport.close()}catch(s){Re.warn(`Error closing Streamable HTTP transport: ${s}`)}finally{this.streamableTransport=null}},"stop")},this.connected=!0,this.transportType="streamable-http",this.setupNotificationHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),Re.debug(`Successfully connected to MCP implementation via streamable HTTP: ${t}`)}catch(n){throw await this.cleanupResources(),n}}async connectWithSse(t){try{this.connectionManager=new rJ(t,{authProvider:this.opts.authProvider,requestInit:{headers:this.headers}});let n=await this.connectionManager.start();if(this.opts.wrapTransport){const a=this.baseUrl;n=this.opts.wrapTransport(n,a)}const r={...this.opts.clientOptions||{},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.samplingCallback?{sampling:{}}:{},...this.opts.elicitationCallback?{elicitation:{form:{},url:{}}}:{}}};Re.debug("Creating Client with capabilities (SSE):",JSON.stringify(r.capabilities,null,2)),this.client=new VM(this.clientInfo,r),this.setupRootsHandler(),Re.debug("Roots handler registered before connect (SSE)"),await this.client.connect(n),this.connected=!0,this.transportType="sse",this.setupNotificationHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),Re.debug(`Successfully connected to MCP implementation via HTTP/SSE: ${t}`)}catch(n){throw await this.cleanupResources(),n}}get publicIdentifier(){return{type:"http",url:this.baseUrl,transport:this.transportType||"unknown"}}getTransportType(){return this.transportType}},Ge(wu,"HttpConnector"),wu),Eu,aJ=(Eu=class extends F2{url;headers;_ws=null;constructor(t,n={}){super(),this.url=t,this.headers=n}async establishConnection(){return Re.debug(`Connecting to WebSocket: ${this.url}`),new Promise((t,n)=>{const r=new QM(this.url,{headers:this.headers});this._ws=r;const a=Ge(()=>{i(),Re.debug("WebSocket connected successfully"),t(r)},"onOpen"),s=Ge(c=>{i(),Re.error(`Failed to connect to WebSocket: ${c}`),n(c)},"onError"),i=Ge(()=>{r.off("open",a),r.off("error",s)},"cleanup");r.on("open",a),r.on("error",s)})}async closeConnection(t){return Re.debug("Closing WebSocket connection"),new Promise(n=>{const r=Ge(()=>{t.off("close",r),this._ws=null,n()},"onClose");if(t.readyState===QM.CLOSED){r();return}t.on("close",r);try{t.close()}catch(a){Re.warn(`Error closing WebSocket connection: ${a}`),r()}})}},Ge(Eu,"WebSocketConnectionManager"),Eu),xu,oJ=(xu=class extends p2{url;headers;connectionManager=null;ws=null;receiverTask=null;pending=new Map;toolsCache=null;constructor(t,n={}){super(),this.url=t,this.headers={...n.headers??{}},n.authToken&&(this.headers.Authorization=`Bearer ${n.authToken}`)}async connect(){if(this.connected){Re.debug("Already connected to MCP implementation");return}Re.debug(`Connecting via WebSocket: ${this.url}`);try{this.connectionManager=new aJ(this.url,this.headers),this.ws=await this.connectionManager.start(),this.receiverTask=this.receiveLoop(),this.connected=!0,Re.debug("WebSocket connected successfully")}catch(t){throw Re.error(`Failed to connect: ${t}`),await this.cleanupResources(),t}}async disconnect(){if(!this.connected){Re.debug("Not connected to MCP implementation");return}Re.debug("Disconnecting …"),await this.cleanupResources(),this.connected=!1}sendRequest(t,n=null){if(!this.ws)throw new Error("WebSocket is not connected");const r=h2(),a=JSON.stringify({id:r,method:t,params:n??{}});return new Promise((s,i)=>{this.pending.set(r,{resolve:s,reject:i}),this.ws.send(a,c=>{c&&(this.pending.delete(r),i(c))})})}async receiveLoop(){if(!this.ws)return;const t=this.ws,n=Ge(r=>{let a;try{a=JSON.parse(r.data??r)}catch(i){Re.warn("Received non‑JSON frame",i);return}const s=a.id;if(s&&this.pending.has(s)){const{resolve:i,reject:c}=this.pending.get(s);this.pending.delete(s),"result"in a?i(a.result):"error"in a&&c(a.error)}else a.method&&!a.id?(Re.debug("Received notification",a.method,a.params),this.handleNotification(a)):Re.debug("Received unsolicited message",a)},"onMessage");return t.addEventListener?t.addEventListener("message",n):t.on("message",n),new Promise(r=>{const a=Ge(()=>{t.removeEventListener?t.removeEventListener("message",n):t.off("message",n),this.rejectAll(new Error("WebSocket closed")),r()},"onClose");t.addEventListener?t.addEventListener("close",a):t.on("close",a)})}rejectAll(t){for(const{reject:n}of this.pending.values())n(t);this.pending.clear()}async handleNotification(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({method:t.method,params:t.params})}catch(r){Re.error("Error in notification handler:",r)}}async refreshToolsCache(){try{Re.debug("[Auto] Refreshing tools cache due to list_changed notification");const t=await this.listTools();this.toolsCache=t.map(n=>n),Re.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(t){Re.warn("[Auto] Failed to refresh tools cache:",t)}}async initialize(){Re.debug("Initializing MCP session over WebSocket");const t=await this.sendRequest("initialize"),n=await this.listTools();return this.toolsCache=n.map(r=>r),Re.debug(`Initialized with ${this.toolsCache.length} tools`),t}async listTools(){return(await this.sendRequest("tools/list")).tools??[]}async callTool(t,n){return await this.sendRequest("tools/call",{name:t,arguments:n})}async listResources(){const t=await this.sendRequest("resources/list");return{resources:Array.isArray(t)?t:[]}}async readResource(t){return await this.sendRequest("resources/read",{uri:t})}async request(t,n=null){return await this.sendRequest(t,n)}get tools(){if(!this.toolsCache)throw new Error("MCP client is not initialized");return this.toolsCache}async cleanupResources(){this.receiverTask&&await this.receiverTask.catch(()=>{}),this.receiverTask=null,this.rejectAll(new Error("WebSocket disconnected")),this.connectionManager&&(await this.connectionManager.stop(),this.connectionManager=null,this.ws=null),this.toolsCache=null}get publicIdentifier(){return{type:"websocket",url:this.url}}},Ge(xu,"WebSocketConnector"),xu),Su,sJ=(Su=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}removeServer(t){this.config.mcpServers?.[t]&&(delete this.config.mcpServers[t],this.activeSessions=this.activeSessions.filter(n=>n!==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 r=this.config.mcpServers??{};if(Object.keys(r).length===0&&Re.warn("No MCP servers defined in config"),!r[t])throw new Error(`Server '${t}' not found in config`);const a=this.createConnectorFromConfig(r[t]),s=new nJ(a);return n&&await s.initialize(),this.sessions[t]=s,this.activeSessions.includes(t)||this.activeSessions.push(t),s}async createAllSessions(t=!0){const n=this.config.mcpServers??{};Object.keys(n).length===0&&Re.warn("No MCP servers defined in config");for(const r of Object.keys(n))await this.createSession(r,t);return this.sessions}getSession(t){const n=this.sessions[t];return n||null}getAllActiveSessions(){return Object.fromEntries(this.activeSessions.map(t=>[t,this.sessions[t]]))}async closeSession(t){const n=this.sessions[t];if(!n){Re.warn(`No session exists for server ${t}, nothing to close`);return}try{Re.debug(`Closing session for server ${t}`),await n.disconnect()}catch(r){Re.error(`Error closing session for server '${t}': ${r}`)}finally{delete this.sessions[t],this.activeSessions=this.activeSessions.filter(r=>r!==t)}}async closeAllSessions(){const t=Object.keys(this.sessions),n=[];for(const r of t)try{Re.debug(`Closing session for server ${r}`),await this.closeSession(r)}catch(a){const s=`Failed to close session for server '${r}': ${a}`;Re.error(s),n.push(s)}n.length?Re.error(`Encountered ${n.length} errors while closing sessions`):Re.debug("All sessions closed successfully")}},Ge(Su,"BaseMCPClient"),Su),Tl,iJ=(Tl=class extends sJ{constructor(t){super(t)}static fromDict(t){return new Tl(t)}createConnectorFromConfig(t){const{url:n,transport:r,headers:a,authToken:s,authProvider:i,wrapTransport:c,clientOptions:u,samplingCallback:f,elicitationCallback:m}=t;if(!n)throw new Error("Server URL is required");const h={headers:a,authToken:s,authProvider:i,wrapTransport:c,clientOptions:u,samplingCallback:f,elicitationCallback:m};return u?console.log("[BrowserMCPClient] Passing clientOptions to connector:",JSON.stringify(u,null,2)):console.warn("[BrowserMCPClient] No clientOptions provided to connector!"),r==="websocket"||n.startsWith("ws://")||n.startsWith("wss://")?new oJ(n,h):r==="http"||n.startsWith("http://")||n.startsWith("https://")?new ej(n,h):new ej(n,h)}},Ge(Tl,"BrowserMCPClient"),Tl);function Zc(e){const t=Ge(()=>{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(B2).join("&"),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}Ge(Zc,"sanitizeUrl");function B2([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}Ge(B2,"sanitizeParam");var _u,kg=(_u=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=Zc(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 Zc(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(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,r),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(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,r),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(),r=`${this.storageKeyPrefix}:state_${n}`,a={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(r,JSON.stringify(a)),t.searchParams.set("state",n);const s=t.toString(),i=Zc(s);return localStorage.setItem(this.getKey("last_auth_url"),i),i}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 r="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const a=window.open(n,`mcp_auth_${this.serverUrlHash}`,r);this.onPopupWindow&&this.onPopupWindow(n,r,a),!a||a.closed||typeof a.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(a.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(a){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,a)}}getLastAttemptedAuthUrl(){const t=localStorage.getItem(this.getKey("last_auth_url"));return t?Zc(t):null}clearStorage(){const t=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,n=`${this.storageKeyPrefix}:state_`,r=[];let a=0;for(let i=0;i<localStorage.length;i++){const c=localStorage.key(i);if(c){if(c.startsWith(t))r.push(c);else if(c.startsWith(n))try{const u=localStorage.getItem(c);u&&JSON.parse(u).serverUrlHash===this.serverUrlHash&&r.push(c)}catch(u){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${c} during clearStorage:`,u)}}}return[...new Set(r)].forEach(i=>{localStorage.removeItem(i),a++}),a}hashString(t){let n=0;for(let r=0;r<t.length;r++){const a=t.charCodeAt(r);n=(n<<5)-n+a,n=n&n}return Math.abs(n).toString(16)}getKey(t){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${t}`}},Ge(_u,"BrowserOAuthClientProvider"),_u);async function f_(){const e=new URLSearchParams(window.location.search),t=e.get("code"),n=e.get("state"),r=e.get("error"),a=e.get("error_description"),s="[mcp-callback]";console.log(`${s} Handling callback...`,{code:t,state:n,error:r,errorDescription:a});let i=null,c=null;const u=n?`mcp:auth:state_${n}`:null;try{if(r)throw new Error(`OAuth error: ${r} - ${a||"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 f=localStorage.getItem(u);if(!f)throw new Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{c=JSON.parse(f)}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(`${s} Re-instantiating provider for server: ${m}`),i=new kg(m,h),console.log(`${s} Calling SDK auth() to exchange code...`);const b=new URL(m).origin,y=await Es(i,{serverUrl:b,authorizationCode:t});if(y==="AUTHORIZED")if(console.log(`${s} Authorization successful via SDK auth().`),c.flowType==="redirect"&&c.returnUrl)console.log(`${s} Redirect flow complete. Returning to: ${c.returnUrl}`),localStorage.removeItem(u),window.location.href=c.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${s} 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(`${s} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(u);const E=window.location.pathname.split("/").filter(Boolean),w=E.length>0&&E[E.length-1]==="callback"?"/"+E.slice(0,-2).join("/"):"/";window.location.href=w||"/"}else throw console.warn(`${s} SDK auth() returned unexpected status: ${y}`),new Error(`Unexpected result from authentication library: ${y}`)}catch(f){console.error(`${s} Error during OAuth callback handling:`,f);const m=f instanceof Error?f.message:String(f);window.opener&&!window.opener.closed&&window.opener.postMessage({type:"mcp_auth_callback",success:!1,error:m},window.location.origin);try{document.body.innerHTML=`
34
34
  <div style="font-family: sans-serif; padding: 20px;">
35
35
  <h1>Authentication Error</h1>
36
36
  <p style="color: red; background-color: #ffebeb; border: 1px solid red; padding: 10px; border-radius: 4px;">
@@ -39,7 +39,7 @@ var W9=Object.defineProperty;var K9=(e,t,n)=>t in e?W9(e,t,{enumerable:!0,config
39
39
  <p>You can close this window or <a href="#" onclick="window.close(); return false;">click here to close</a>.</p>
40
40
  <pre style="font-size: 0.8em; color: #555; margin-top: 20px; white-space: pre-wrap;">${f instanceof Error?f.stack:""}</pre>
41
41
  </div>
42
- `}catch(h){console.error(`${s} Could not display error in callback window:`,h)}u&&localStorage.removeItem(u),i&&(localStorage.removeItem(i.getKey("code_verifier")),localStorage.removeItem(i.getKey("last_auth_url")))}}Ge(f_,"onMcpAuthorization");var Dw={exports:{}},yt={};var tj;function lJ(){if(tj)return yt;tj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),b=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,w={};function _(D,H,$){this.props=D,this.context=H,this.refs=w,this.updater=$||x}_.prototype.isReactComponent={},_.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,H,"setState")},_.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function S(){}S.prototype=_.prototype;function T(D,H,$){this.props=D,this.context=H,this.refs=w,this.updater=$||x}var R=T.prototype=new S;R.constructor=T,E(R,_.prototype),R.isPureReactComponent=!0;var C=Array.isArray;function I(){}var A={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function j(D,H,$){var L=$.ref;return{$$typeof:e,type:D,key:H,ref:L!==void 0?L:null,props:$}}function U(D,H){return j(D.type,H,D.props)}function B(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function W(D){var H={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function($){return H[$]})}var J=/\/+/g;function ee(D,H){return typeof D=="object"&&D!==null&&D.key!=null?W(""+D.key):H.toString(36)}function re(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(I,I):(D.status="pending",D.then(function(H){D.status==="pending"&&(D.status="fulfilled",D.value=H)},function(H){D.status==="pending"&&(D.status="rejected",D.reason=H)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function F(D,H,$,L,M){var z=typeof D;(z==="undefined"||z==="boolean")&&(D=null);var G=!1;if(D===null)G=!0;else switch(z){case"bigint":case"string":case"number":G=!0;break;case"object":switch(D.$$typeof){case e:case t:G=!0;break;case m:return G=D._init,F(G(D._payload),H,$,L,M)}}if(G)return M=M(D),G=L===""?"."+ee(D,0):L,C(M)?($="",G!=null&&($=G.replace(J,"$&/")+"/"),F(M,H,$,"",function(ie){return ie})):M!=null&&(B(M)&&(M=U(M,$+(M.key==null||D&&D.key===M.key?"":(""+M.key).replace(J,"$&/")+"/")+G)),H.push(M)),1;G=0;var q=L===""?".":L+":";if(C(D))for(var ae=0;ae<D.length;ae++)L=D[ae],z=q+ee(L,ae),G+=F(L,H,$,z,M);else if(ae=y(D),typeof ae=="function")for(D=ae.call(D),ae=0;!(L=D.next()).done;)L=L.value,z=q+ee(L,ae++),G+=F(L,H,$,z,M);else if(z==="object"){if(typeof D.then=="function")return F(re(D),H,$,L,M);throw H=String(D),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return G}function K(D,H,$){if(D==null)return D;var L=[],M=0;return F(D,L,"","",function(z){return H.call($,z,M++)}),L}function V(D){if(D._status===-1){var H=D._result;H=H(),H.then(function($){(D._status===0||D._status===-1)&&(D._status=1,D._result=$)},function($){(D._status===0||D._status===-1)&&(D._status=2,D._result=$)}),D._status===-1&&(D._status=0,D._result=H)}if(D._status===1)return D._result.default;throw D._result}var ne=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},te={map:K,forEach:function(D,H,$){K(D,function(){H.apply(this,arguments)},$)},count:function(D){var H=0;return K(D,function(){H++}),H},toArray:function(D){return K(D,function(H){return H})||[]},only:function(D){if(!B(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return yt.Activity=h,yt.Children=te,yt.Component=_,yt.Fragment=n,yt.Profiler=a,yt.PureComponent=T,yt.StrictMode=r,yt.Suspense=u,yt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,yt.__COMPILER_RUNTIME={__proto__:null,c:function(D){return A.H.useMemoCache(D)}},yt.cache=function(D){return function(){return D.apply(null,arguments)}},yt.cacheSignal=function(){return null},yt.cloneElement=function(D,H,$){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var L=E({},D.props),M=D.key;if(H!=null)for(z in H.key!==void 0&&(M=""+H.key),H)!O.call(H,z)||z==="key"||z==="__self"||z==="__source"||z==="ref"&&H.ref===void 0||(L[z]=H[z]);var z=arguments.length-2;if(z===1)L.children=$;else if(1<z){for(var G=Array(z),q=0;q<z;q++)G[q]=arguments[q+2];L.children=G}return j(D.type,M,L)},yt.createContext=function(D){return D={$$typeof:i,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:s,_context:D},D},yt.createElement=function(D,H,$){var L,M={},z=null;if(H!=null)for(L in H.key!==void 0&&(z=""+H.key),H)O.call(H,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&(M[L]=H[L]);var G=arguments.length-2;if(G===1)M.children=$;else if(1<G){for(var q=Array(G),ae=0;ae<G;ae++)q[ae]=arguments[ae+2];M.children=q}if(D&&D.defaultProps)for(L in G=D.defaultProps,G)M[L]===void 0&&(M[L]=G[L]);return j(D,z,M)},yt.createRef=function(){return{current:null}},yt.forwardRef=function(D){return{$$typeof:c,render:D}},yt.isValidElement=B,yt.lazy=function(D){return{$$typeof:m,_payload:{_status:-1,_result:D},_init:V}},yt.memo=function(D,H){return{$$typeof:f,type:D,compare:H===void 0?null:H}},yt.startTransition=function(D){var H=A.T,$={};A.T=$;try{var L=D(),M=A.S;M!==null&&M($,L),typeof L=="object"&&L!==null&&typeof L.then=="function"&&L.then(I,ne)}catch(z){ne(z)}finally{H!==null&&$.types!==null&&(H.types=$.types),A.T=H}},yt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},yt.use=function(D){return A.H.use(D)},yt.useActionState=function(D,H,$){return A.H.useActionState(D,H,$)},yt.useCallback=function(D,H){return A.H.useCallback(D,H)},yt.useContext=function(D){return A.H.useContext(D)},yt.useDebugValue=function(){},yt.useDeferredValue=function(D,H){return A.H.useDeferredValue(D,H)},yt.useEffect=function(D,H){return A.H.useEffect(D,H)},yt.useEffectEvent=function(D){return A.H.useEffectEvent(D)},yt.useId=function(){return A.H.useId()},yt.useImperativeHandle=function(D,H,$){return A.H.useImperativeHandle(D,H,$)},yt.useInsertionEffect=function(D,H){return A.H.useInsertionEffect(D,H)},yt.useLayoutEffect=function(D,H){return A.H.useLayoutEffect(D,H)},yt.useMemo=function(D,H){return A.H.useMemo(D,H)},yt.useOptimistic=function(D,H){return A.H.useOptimistic(D,H)},yt.useReducer=function(D,H,$){return A.H.useReducer(D,H,$)},yt.useRef=function(D){return A.H.useRef(D)},yt.useState=function(D){return A.H.useState(D)},yt.useSyncExternalStore=function(D,H,$){return A.H.useSyncExternalStore(D,H,$)},yt.useTransition=function(){return A.H.useTransition()},yt.version="19.2.0",yt}var nj;function p_(){return nj||(nj=1,Dw.exports=lJ()),Dw.exports}var v=p_();const ce=bp(v),Hu=Y9({__proto__:null,default:ce},[v]);function lx(e,t){if(!e)throw new Error(t)}Ge(lx,"assert");var cJ=3e3,uJ=5e3;function m_(e){const{url:t,enabled:n=!0,clientName:r,clientUri:a,callbackUrl:s=typeof window<"u"?Zc(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:i="mcp:auth",clientConfig:c={},customHeaders:u={},debug:f=!1,autoRetry:m=!1,autoReconnect:h=cJ,transportType:b="auto",preventAutoAuth:y=!1,useRedirectFlow:x=!1,onPopupWindow:E,timeout:w=3e4,sseReadTimeout:_=3e5,wrapTransport:S,onNotification:T,samplingCallback:R,onElicitation:C}=e,[I,A]=v.useState("discovering"),[O,j]=v.useState([]),[U,B]=v.useState([]),[W,J]=v.useState([]),[ee,re]=v.useState([]),[F,K]=v.useState(),[V,ne]=v.useState(),[te,D]=v.useState(void 0),[H,$]=v.useState([]),[L,M]=v.useState(void 0),z=v.useRef(null),G=v.useRef(null),q=v.useRef(!1),ae=v.useRef(!0),ie=v.useRef(0),X=v.useRef(null),Z=v.useRef(I),se=v.useRef(h),me=v.useRef(null);v.useEffect(()=>{Z.current=I,se.current=h},[I,h]);const le=v.useCallback((Le,$e,...bt)=>{const nt=bt.length>0?`${$e} ${bt.map(Ut=>JSON.stringify(Ut)).join(" ")}`:$e;console[Le](`[useMcp] ${nt}`),ae.current&&$(Ut=>[...Ut.slice(-100),{level:Le,message:nt,timestamp:Date.now()}])},[]),Te=v.useCallback(async(Le=!1)=>{if(Le||le("info","Disconnecting..."),q.current=!1,X.current&&clearTimeout(X.current),X.current=null,z.current)try{await z.current.closeSession("inspector-server")}catch($e){Le||le("warn","Error closing session:",$e)}z.current=null,ae.current&&!Le&&(A("discovering"),j([]),B([]),J([]),re([]),D(void 0),M(void 0))},[le]),Be=v.useCallback((Le,$e)=>{if(le("error",Le,$e??""),ae.current){A("failed"),D(Le);const bt=G.current?.getLastAttemptedAuthUrl();bt&&(M(bt),le("info","Manual authentication URL may be available.",bt))}q.current=!1},[le]),Ee=v.useCallback(async()=>{if(!n||!t){le("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag.");return}if(q.current){le("debug","Connection attempt already in progress.");return}if(!ae.current){le("debug","Connect called after unmount, aborting.");return}q.current=!0,ie.current+=1,D(void 0),M(void 0),me.current=null,A("discovering"),le("info",`Connecting attempt #${ie.current} to ${t}...`),G.current||(G.current=new kg(t,{storageKeyPrefix:i,clientName:r,clientUri:a,callbackUrl:s,preventAutoAuth:y,useRedirectFlow:x,onPopupWindow:E}),le("debug","BrowserOAuthClientProvider initialized in connect.")),z.current||(z.current=new iJ,le("debug","BrowserMCPClient initialized in connect."));const Le=Ge(async(bt,nt=!1)=>{le("info",`Attempting connection with transport: ${bt}`);try{const Ut="inspector-server",st={url:t,transport:bt==="sse"?"http":bt};if(u&&Object.keys(u).length>0&&(st.headers=u),G.current){const Et=await G.current.tokens();Et?.access_token&&(st.headers={...st.headers,Authorization:`Bearer ${Et.access_token}`})}z.current.addServer(Ut,{...st,authProvider:G.current,clientOptions:c,samplingCallback:R,elicitationCallback:C,wrapTransport:S?Et=>(console.log("[useMcp] Applying transport wrapper for server:",Ut,"url:",t),S(Et,t)):void 0});const Ie=await z.current.createSession(Ut,!1);T&&Ie.on("notification",T),await Ie.initialize(),le("info","✅ Successfully connected to MCP server"),le("info","Server info:",Ie.connector.serverInfo),le("info","Server capabilities:",Ie.connector.serverCapabilities),console.log("[useMcp] Server info:",Ie.connector.serverInfo),console.log("[useMcp] Server capabilities:",Ie.connector.serverCapabilities),A("ready"),me.current=bt,j(Ie.connector.tools||[]);const Me=await Ie.connector.listAllResources();B(Me.resources||[]);const He=await Ie.connector.listPrompts();re(He.prompts||[]);const it=Ie.connector.serverInfo,pt=Ie.connector.serverCapabilities;return it&&(console.log("[useMcp] Server info:",it),K(it)),pt&&(console.log("[useMcp] Server capabilities:",pt),ne(pt)),"success"}catch(Ut){const st=Ut,Ie=st?.message||String(Ut);if(st.code===401||Ie.includes("401")||Ie.includes("Unauthorized")){if(G.current){le("info","Authentication required. OAuth provider available.");try{const{auth:Me}=await hr(async()=>{const{auth:it}=await Promise.resolve().then(()=>KM);return{auth:it}},void 0),He=new URL(t).origin;Me(G.current,{serverUrl:He}).catch(()=>{}),setTimeout(()=>{if(ae.current){const it=G.current?.getLastAttemptedAuthUrl();it?(M(it),le("info","Manual authentication URL available:",it)):le("warn","Could not generate authentication URL")}},100)}catch(Me){le("warn","Error generating auth URL:",Me)}return ae.current&&A("pending_auth"),q.current=!1,"auth_redirect"}return u&&Object.keys(u).length>0?(Be("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."),"failed"):(Be("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."),"failed")}return Be(Ie,st instanceof Error?st:new Error(String(st))),"failed"}},"tryConnectWithTransport");let $e="failed";if(b==="sse")le("debug","Using SSE-only transport mode"),$e=await Le("sse");else if(b==="http")le("debug","Using HTTP-only transport mode"),$e=await Le("http");else{le("debug","Using auto transport mode (HTTP with SSE fallback)");const bt=await Le("http");bt==="fallback"&&ae.current&&Z.current!=="authenticating"?(le("info","HTTP failed, attempting SSE fallback..."),$e=await Le("sse")):$e=bt}($e==="success"||$e==="failed"||$e==="auth_redirect")&&(q.current=!1),le("debug",`Connection sequence finished with status: ${$e}`)},[le,Be,Te,t,i,r,a,s,c.name,c.version,u,b,y,x,E,n,w,_]),_e=v.useCallback(async(Le,$e,bt)=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot call tool "${Le}".`);le("info",`Calling tool: ${Le}`,$e);try{const Ut=z.current.getSession("inspector-server");if(!Ut)throw new Error("No active session found");const st=await Ut.connector.callTool(Le,$e||{},bt);return le("info",`Tool "${Le}" call successful:`,st),st}catch(nt){throw le("error",`Tool "${Le}" call failed:`,nt),nt}},[I]),Ue=v.useCallback(()=>{Z.current==="failed"?(le("info","Retry requested..."),Ee()):le("warn",`Retry called but state is not 'failed' (state: ${Z.current}). Ignoring.`)},[le,Ee]),fe=v.useCallback(async()=>{le("info","Manual authentication requested...");const Le=Z.current;if(Le==="failed")le("info","Attempting to reconnect and authenticate via retry..."),Ue();else if(Le==="pending_auth"){le("info","Proceeding with authentication from pending state...");try{lx(G.current,"Auth Provider not available for manual auth"),lx(t,"Server URL is required for authentication"),le("info","Clearing all OAuth state and initiating fresh flow...");const $e=`${i}:${G.current.serverUrlHash}`;Object.keys(localStorage).forEach(st=>{st.startsWith($e)&&(le("debug",`Removing stale OAuth key: ${st}`),localStorage.removeItem(st)),st.startsWith(`${i}:state_`)&&(le("debug",`Removing orphaned state: ${st}`),localStorage.removeItem(st))}),A("authenticating");const bt=new kg(t,{storageKeyPrefix:i,clientName:r,clientUri:a,callbackUrl:s,preventAutoAuth:!1,useRedirectFlow:x,onPopupWindow:E});G.current=bt,le("info","Triggering fresh OAuth authorization...");const{auth:nt}=await hr(async()=>{const{auth:st}=await Promise.resolve().then(()=>KM);return{auth:st}},void 0),Ut=new URL(t).origin;nt(bt,{serverUrl:Ut}).catch(st=>{le("info","OAuth flow initiated:",st?.message||"Redirecting...")})}catch($e){if(!ae.current)return;A("pending_auth"),le("error",`Manual authentication failed: ${$e instanceof Error?$e.message:String($e)}`)}}else if(Le==="authenticating"){le("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const $e=G.current?.getLastAttemptedAuthUrl();$e&&!L&&(M($e),le("info","Manual authentication URL retrieved:",$e))}else le("info",`Client not in a state requiring manual authentication trigger (state: ${Le}). If needed, try disconnecting and reconnecting.`)},[le,Ue,L,t,x,E,i,r,a,s]),Ae=v.useCallback(()=>{if(G.current){const Le=G.current.clearStorage();le("info",`Cleared ${Le} item(s) from localStorage for ${t}.`),M(void 0),Te()}else le("warn","Auth provider not initialized, cannot clear storage.")},[t,le,Te]),ze=v.useCallback(async()=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot list resources.`);le("info","Listing resources");try{const $e=z.current.getSession("inspector-server");if(!$e)throw new Error("No active session found");const bt=await $e.connector.listAllResources();B(bt.resources||[]),le("info","Resources listed successfully")}catch(Le){throw le("error","List resources failed:",Le),Le}},[I]),we=v.useCallback(async Le=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot read resource.`);le("info",`Reading resource: ${Le}`);try{const bt=z.current.getSession("inspector-server");if(!bt)throw new Error("No active session found");const nt=await bt.connector.readResource(Le);return le("info","Resource read successful:",nt),nt}catch($e){throw le("error","Resource read failed:",$e),$e}},[I]),at=v.useCallback(async()=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot list prompts.`);le("info","Listing prompts");try{const $e=z.current.getSession("inspector-server");if(!$e)throw new Error("No active session found");const bt=await $e.connector.listPrompts();re(bt.prompts||[]),le("info","Prompts listed successfully")}catch(Le){throw le("error","List prompts failed:",Le),Le}},[I]),lt=v.useCallback(async(Le,$e)=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot get prompt.`);le("info",`Getting prompt: ${Le}`,$e);try{const nt=z.current.getSession("inspector-server");if(!nt)throw new Error("No active session found");const Ut=await nt.connector.getPrompt(Le,$e||{});return le("info",`Prompt "${Le}" retrieved successfully:`,Ut),Ut}catch(bt){throw le("error",`Prompt "${Le}" retrieval failed:`,bt),bt}},[I]),gt=v.useRef(Ee),Ct=v.useRef(Be);return v.useEffect(()=>{gt.current=Ee,Ct.current=Be}),v.useEffect(()=>{const Le=Ge($e=>{$e.origin===window.location.origin&&$e.data?.type==="mcp_auth_callback"&&(le("info","Received auth callback message.",$e.data),X.current&&clearTimeout(X.current),X.current=null,$e.data.success?(le("info","Authentication successful via popup. Reconnecting client..."),q.current&&le("debug","Connection attempt already in progress, resetting flag to allow reconnection."),q.current=!1,setTimeout(()=>{ae.current&&(le("debug","Initiating reconnection after successful auth callback."),gt.current())},100)):Ct.current(`Authentication failed in callback: ${$e.data.error||"Unknown reason."}`))},"messageHandler");return window.addEventListener("message",Le),le("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Le),le("debug","Auth callback message listener removed."),X.current&&clearTimeout(X.current)}},[le]),v.useEffect(()=>(ae.current=!0,!n||!t?(le("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag."),A("discovering"),()=>{ae.current=!1}):(le("debug","useMcp mounted, initiating connection."),ie.current=0,(!G.current||G.current.serverUrl!==t)&&(G.current=new kg(t,{storageKeyPrefix:i,clientName:r,clientUri:a,callbackUrl:s,preventAutoAuth:y,useRedirectFlow:x,onPopupWindow:E}),le("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),Ee(),()=>{ae.current=!1,le("debug","useMcp unmounting, disconnecting."),Te(!0)})),[t,n,i,s,r,a,c.name,c.version,x]),v.useEffect(()=>{let Le=null;if(I==="failed"&&m&&ie.current>0){const $e=typeof m=="number"?m:uJ;le("info",`Connection failed, auto-retrying in ${$e}ms...`),Le=setTimeout(()=>{ae.current&&Z.current==="failed"&&Ue()},$e)}return()=>{Le&&clearTimeout(Le)}},[I,m,Ue,le]),{state:I,tools:O,resources:U,resourceTemplates:W,prompts:ee,serverInfo:F,capabilities:V,error:te,log:H,authUrl:L,client:z.current,callTool:_e,readResource:we,listResources:ze,listPrompts:at,getPrompt:lt,retry:Ue,disconnect:Te,authenticate:fe,clearStorage:Ae}}Ge(m_,"useMcp");var Tu,dJ=(Tu=class extends ce.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?ce.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"},ce.createElement("h3",{className:"font-bold mb-2"},"Widget Error"),ce.createElement("pre",{className:"text-sm whitespace-pre-wrap"},this.state.error?.message)):this.props.children}},Ge(Tu,"ErrorBoundary"),Tu),Nf="openai:set_globals";function po(e){return v.useSyncExternalStore(t=>{const n=Ge(r=>{r.detail.globals[e]!==void 0&&t()},"handleSetGlobal");return typeof window<"u"&&window.addEventListener(Nf,n),()=>{typeof window<"u"&&window.removeEventListener(Nf,n)}},()=>typeof window<"u"&&window.openai?window.openai[e]:void 0)}Ge(po,"useOpenAiGlobal");function Vu(e){const[t,n]=v.useState(()=>typeof window<"u"&&!!window.openai);v.useEffect(()=>{if(typeof window<"u"&&window.openai){n(!0);return}const O=setInterval(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},100),j=Ge(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},"handleSetGlobals");typeof window<"u"&&window.addEventListener(Nf,j);const U=setTimeout(()=>{clearInterval(O),typeof window<"u"&&window.removeEventListener(Nf,j)},5e3);return()=>{clearInterval(O),clearTimeout(U),typeof window<"u"&&window.removeEventListener(Nf,j)}},[]);const r=v.useMemo(()=>t?"openai":"mcp-ui",[t]),a=typeof window<"u"?window.location.search:"",s=v.useMemo(()=>{const O=new URLSearchParams(a);return O.has("mcpUseParams")?JSON.parse(O.get("mcpUseParams")):{toolInput:{},toolOutput:{},toolId:""}},[a]),i=r==="openai"?po("toolInput"):s.toolInput,c=r==="openai"?po("toolOutput"):s.toolOutput,u=po("toolResponseMetadata"),f=po("widgetState"),m=po("theme"),h=po("displayMode"),b=po("safeArea"),y=po("maxHeight"),x=po("userAgent"),E=po("locale"),w=v.useMemo(()=>typeof window<"u"&&window.__mcpPublicUrl?window.__mcpPublicUrl.replace(/\/mcp-use\/public$/,""):"",[]),[_,S]=v.useState(null);v.useEffect(()=>{f!==void 0&&S(f)},[f]);const T=v.useCallback(async(O,j)=>{if(!window.openai?.callTool)throw new Error("window.openai.callTool is not available");return window.openai.callTool(O,j)},[]),R=v.useCallback(async O=>{if(!window.openai?.sendFollowUpMessage)throw new Error("window.openai.sendFollowUpMessage is not available");return window.openai.sendFollowUpMessage({prompt:O})},[]),C=v.useCallback(O=>{if(!window.openai?.openExternal)throw new Error("window.openai.openExternal is not available");window.openai.openExternal({href:O})},[]),I=v.useCallback(async O=>{if(!window.openai?.requestDisplayMode)throw new Error("window.openai.requestDisplayMode is not available");return window.openai.requestDisplayMode({mode:O})},[]),A=v.useCallback(async O=>{if(!window.openai?.setWidgetState)throw new Error("window.openai.setWidgetState is not available");const U=typeof O=="function"?O(f!==void 0?f:_):O;return S(U),window.openai.setWidgetState(U)},[f,_]);return{props:i||e||{},output:c??null,metadata:u??null,state:_,setState:A,theme:m||"light",displayMode:h||"inline",safeArea:b||{insets:{top:0,bottom:0,left:0,right:0}},maxHeight:y||600,userAgent:x||{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:E||"en",mcp_url:w,callTool:T,sendFollowUpMessage:R,openExternal:C,requestDisplayMode:I,isAvailable:t}}Ge(Vu,"useWidget");function fJ(e){const{props:t}=Vu(e);return t}Ge(fJ,"useWidgetProps");function pJ(){const{theme:e}=Vu();return e}Ge(pJ,"useWidgetTheme");function mJ(e){const{state:t,setState:n}=Vu();return v.useEffect(()=>{t===null&&e!==void 0&&window.openai?.setWidgetState&&n(e)},[]),[t,n]}Ge(mJ,"useWidgetState");var rj=Ge(({children:e})=>{const{theme:t,isAvailable:n}=Vu();console.log("theme",t);const[r,a]=v.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");v.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),c=Ge(u=>{a(u.matches?"dark":"light")},"handleChange");return i.addEventListener("change",c),()=>i.removeEventListener("change",c)},[]);const s=n?t:r;return v.useLayoutEffect(()=>{typeof document>"u"||(s==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[s]),ce.createElement(ce.Fragment,null,e)},"ThemeProvider");function H2({children:e,className:t="",position:n="top-right",attachTo:r,showLabels:a=!0,debugger:s=!1,viewControls:i=!1}){const{props:c,output:u,metadata:f,state:m,theme:h,displayMode:b,safeArea:y,maxHeight:x,userAgent:E,locale:w,isAvailable:_,callTool:S,sendFollowUpMessage:T,openExternal:R,requestDisplayMode:C,setState:I}=Vu(),[A,O]=v.useState(!1),[j,U]=v.useState(!1),B=v.useRef(null),W=v.useRef(null),[J,ee]=v.useState([]),[re,F]=v.useState(""),[K,V]=v.useState("get-my-city"),[ne,te]=v.useState("{}"),[D,H]=v.useState("Test follow-up message"),[$,L]=v.useState("https://docs.mcp-use.com"),M=b==="fullscreen"&&_,z=b==="pip"&&_,G=typeof window<"u"&&window.location.pathname.includes("/inspector/api/dev-widget/");v.useEffect(()=>{const we=setTimeout(()=>{if(typeof window<"u"&&window.openai)try{const at=Object.keys(window.openai);ee(at)}catch{ee([])}else ee([])},100);return()=>{clearTimeout(we)}},[]);const q=h==="dark",ae=Ge(()=>{const we=["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[...we,"top-4","left-4"];case"top-center":return[...we,"top-4","left-1/2","-translate-x-1/2"];case"top-right":return[...we,"top-4","right-4"];case"center-left":return[...we,"top-1/2","left-4","-translate-y-1/2"];case"center-right":return[...we,"top-1/2","right-4","-translate-y-1/2"];case"bottom-left":return[...we,"bottom-4","left-4"];case"bottom-center":return[...we,"bottom-4","left-1/2","-translate-x-1/2"];case"bottom-right":return[...we,"bottom-4","right-4"];default:return[...we,"top-4","right-4"]}},"getPositionClasses"),ie=Ge(()=>{const at=y?.insets?.top?Math.max(16,y.insets.top+8):16,lt=y?.insets?.right?Math.max(16,y.insets.right+8):16,gt=y?.insets?.bottom?Math.max(16,y.insets.bottom+8):16,Ct=y?.insets?.left?Math.max(16,y.insets.left+8):16,Le={};switch(n){case"top-left":Le.top=`${at}px`,Le.left=`${Ct}px`;break;case"top-center":Le.top=`${at}px`;break;case"top-right":Le.top=`${at}px`,Le.right=`${lt}px`;break;case"center-left":Le.left=`${Ct}px`;break;case"center-right":Le.right=`${lt}px`;break;case"bottom-left":Le.bottom=`${gt}px`,Le.left=`${Ct}px`;break;case"bottom-center":Le.bottom=`${gt}px`;break;case"bottom-right":Le.bottom=`${gt}px`,Le.right=`${lt}px`;break;default:Le.top=`${at}px`,Le.right=`${lt}px`;break}return Le},"getPositionOffsetStyles");v.useEffect(()=>{if(!r)return;const we=Ge(()=>O(!0),"handleMouseEnter"),at=Ge(()=>O(!1),"handleMouseLeave");return r.addEventListener("mouseenter",we),r.addEventListener("mouseleave",at),()=>{r.removeEventListener("mouseenter",we),r.removeEventListener("mouseleave",at)}},[r]),v.useEffect(()=>{if(!j)return;const we=Ge(at=>{W.current&&!W.current.contains(at.target)&&U(!1)},"handleClickOutside");return document.addEventListener("mousedown",we),()=>{document.removeEventListener("mousedown",we)}},[j]),v.useEffect(()=>(j?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[j]);const X=Ge(()=>{U(!j)},"handleToggleOverlay"),Z=Ge(async()=>{try{F("Calling tool...");const we=ne.trim()?JSON.parse(ne):{},at=await S(K,we);F(`Success: ${JSON.stringify(at,null,2)}`)}catch(we){F(`Error: ${we.message}`)}},"handleCallTool"),se=Ge(async()=>{try{F("Sending follow-up message..."),await T(D),F("Follow-up message sent successfully")}catch(we){F(`Error: ${we.message}`)}},"handleSendFollowUpMessage"),me=Ge(()=>{try{R($),F(`Opened external link: ${$}`)}catch(we){F(`Error: ${we.message}`)}},"handleOpenExternal"),le=Ge(async we=>{try{F(`Requesting display mode: ${we}...`);const at=await C(we);F(`Display mode granted: ${at.mode}`)}catch(at){F(`Error: ${at.message}`)}},"handleRequestDisplayMode"),Te=Ge(async()=>{try{const we=m?{...m,debugTimestamp:new Date().toISOString()}:{debugTimestamp:new Date().toISOString()};F("Setting state..."),await I(we),F(`State updated: ${JSON.stringify(we,null,2)}`)}catch(we){F(`Error: ${we.message}`)}},"handleSetState"),Be=Ge(async()=>{try{await C("fullscreen")}catch(we){console.error("Failed to go fullscreen:",we)}},"handleFullscreen"),Ee=Ge(async()=>{try{await C("pip")}catch(we){console.error("Failed to go pip:",we)}},"handlePip"),_e=Ge(()=>{const we=["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[...we,"top-full","right-0","mt-2"];case"top-left":return[...we,"top-full","left-0","mt-2"];case"top-center":return[...we,"top-full","left-1/2","-translate-x-1/2","mt-2"];case"bottom-right":return[...we,"bottom-full","right-0","mb-2"];case"bottom-left":return[...we,"bottom-full","left-0","mb-2"];case"bottom-center":return[...we,"bottom-full","left-1/2","-translate-x-1/2","mb-2"];case"center-left":return[...we,"left-full","top-1/2","-translate-y-1/2","ml-2"];case"center-right":return[...we,"right-full","top-1/2","-translate-y-1/2","mr-2"];default:return[...we,"top-full","right-0","mt-2"]}},"getTooltipClasses"),Ue=Ge(({onClick:we,label:at,children:lt})=>{const[gt,Ct]=v.useState(!1),Le=_e();return ce.createElement("button",{className:`p-2 ${q?"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 ${q?"shadow-[0_2px_8px_rgba(0,0,0,0.3)]":"shadow-[0_2px_8px_rgba(0,0,0,0.2)]"} relative`,onMouseEnter:()=>Ct(!0),onMouseLeave:()=>Ct(!1),onClick:we,"aria-label":at},ce.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"},lt),a&&ce.createElement("span",{className:`${Le.join(" ")} ${gt?"opacity-100":"opacity-0"}`},at))},"IconButton"),fe=Ge(we=>{if(we===null)return"null";if(we===void 0)return"undefined";if(typeof we=="object")try{return JSON.stringify(we,null,2)}catch{return String(we)}return String(we)},"formatValue"),Ae=Ge(we=>we?`${we.device?.type||"unknown"}`:"N/A","formatUserAgent"),ze=Ge(we=>{if(!we?.insets)return"N/A";const{top:at,bottom:lt,left:gt,right:Ct}=we.insets;return`T:${at} B:${lt} L:${gt} R:${Ct}`},"formatSafeArea");return ce.createElement(ce.Fragment,null,ce.createElement("div",{ref:B,className:`${t} relative h-fit`,onMouseEnter:()=>!r&&O(!0),onMouseLeave:()=>!r&&O(!1)},ce.createElement("div",{className:ae().join(" "),style:ie()},!G&&ce.createElement(ce.Fragment,null,!M&&!z&&ce.createElement(ce.Fragment,null,(i===!0||i==="fullscreen")&&ce.createElement(Ue,{onClick:Be,label:"Fullscreen"},ce.createElement("path",{d:"M15 3h6v6"}),ce.createElement("path",{d:"m21 3-7 7"}),ce.createElement("path",{d:"m3 21 7-7"}),ce.createElement("path",{d:"M9 21H3v-6"})),(i===!0||i==="pip")&&ce.createElement(Ue,{onClick:Ee,label:"Picture in Picture"},ce.createElement("path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4"}),ce.createElement("rect",{width:"10",height:"7",x:"12",y:"13",rx:"2"}))),s&&ce.createElement(Ue,{onClick:X,label:"Debug Info"},ce.createElement("path",{d:"M12 20v-9"}),ce.createElement("path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}),ce.createElement("path",{d:"M14.12 3.88 16 2"}),ce.createElement("path",{d:"M21 21a4 4 0 0 0-3.81-4"}),ce.createElement("path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}),ce.createElement("path",{d:"M22 13h-4"}),ce.createElement("path",{d:"M3 21a4 4 0 0 1 3.81-4"}),ce.createElement("path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}),ce.createElement("path",{d:"M6 13H2"}),ce.createElement("path",{d:"m8 2 1.88 1.88"}),ce.createElement("path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"})))),e),j&&s&&ce.createElement("div",{ref:W,className:"fixed inset-0 bg-black text-white font-mono text-xs z-[10000] overflow-auto p-4",onClick:we=>{we.target===W.current&&U(!1)}},ce.createElement("button",{onClick:()=>U(!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"},"×"),ce.createElement("div",{className:"max-w-[1200px] mx-auto pt-10"},ce.createElement("h1",{className:"text-lg font-bold mb-4 border-b border-gray-700 pb-2"},"Debug Info"),ce.createElement("table",{className:"w-full border-collapse border-spacing-0"},ce.createElement("tbody",null,ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Props"),ce.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},fe(c))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Output"),ce.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},fe(u))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Metadata"),ce.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},fe(f))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"State"),ce.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},fe(m))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Theme"),ce.createElement("td",{className:"p-2"},h)),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Display Mode"),ce.createElement("td",{className:"p-2"},b)),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Locale"),ce.createElement("td",{className:"p-2"},w)),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Max Height"),ce.createElement("td",{className:"p-2"},x,"px")),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"User Agent"),ce.createElement("td",{className:"p-2"},Ae(E))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Safe Area"),ce.createElement("td",{className:"p-2"},ze(y))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"API Available"),ce.createElement("td",{className:"p-2"},_?"Yes":"No")),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"window.openai Keys"),ce.createElement("td",{className:"p-2"},J.length>0?J.join(", "):"N/A")))),ce.createElement("h2",{className:"text-base font-bold mt-8 mb-4 border-b border-gray-700 pb-2"},"Actions"),ce.createElement("div",{className:"flex flex-col gap-3"},ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("input",{type:"text",value:K,onChange:we=>V(we.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]"}),ce.createElement("input",{type:"text",value:ne,onChange:we=>te(we.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"}),ce.createElement("button",{onClick:Z,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Call Tool")),ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("input",{type:"text",value:D,onChange:we=>H(we.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"}),ce.createElement("button",{onClick:se,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")),ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("input",{type:"text",value:$,onChange:we=>L(we.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"}),ce.createElement("button",{onClick:me,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Open Link")),ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("span",{className:"w-[150px] text-xs"},"Display Mode:"),ce.createElement("button",{onClick:()=>le("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"),ce.createElement("button",{onClick:()=>le("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"),ce.createElement("button",{onClick:()=>le("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")),ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("button",{onClick:Te,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)")),re&&ce.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"},ce.createElement("div",{className:"font-bold mb-1 text-gray-400"},"Result:"),re,ce.createElement("button",{onClick:()=>F(""),className:"mt-2 py-1 px-2 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-[11px]"},"Clear"))))))}Ge(H2,"WidgetControls");function V2(){if(typeof window>"u")return"/";const t=window.location.pathname.match(/^(\/inspector\/api\/dev-widget\/[^/]+)/);return t?t[1]:"/"}Ge(V2,"getBasename");var hJ=150,gJ=5;function bJ({children:e,debugger:t=!1,viewControls:n=!1,autoSize:r=!1}){const a=V2(),s=v.useRef(null),i=v.useRef(0),c=v.useRef(null),u=v.useRef(!1),[f,m]=v.useState(null),[h,b]=v.useState(null),[y,x]=v.useState(!0);v.useEffect(()=>{let S=!0;return(async()=>{try{const T=await hr(()=>import("./index-DD94_By3.js"),[]);S&&(m(()=>T.BrowserRouter),x(!1))}catch{S&&(b(new Error(`❌ react-router-dom not installed!
42
+ `}catch(h){console.error(`${s} Could not display error in callback window:`,h)}u&&localStorage.removeItem(u),i&&(localStorage.removeItem(i.getKey("code_verifier")),localStorage.removeItem(i.getKey("last_auth_url")))}}Ge(f_,"onMcpAuthorization");var Dw={exports:{}},yt={};var tj;function lJ(){if(tj)return yt;tj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),b=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,w={};function _(D,H,$){this.props=D,this.context=H,this.refs=w,this.updater=$||x}_.prototype.isReactComponent={},_.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,H,"setState")},_.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function S(){}S.prototype=_.prototype;function T(D,H,$){this.props=D,this.context=H,this.refs=w,this.updater=$||x}var R=T.prototype=new S;R.constructor=T,E(R,_.prototype),R.isPureReactComponent=!0;var C=Array.isArray;function I(){}var A={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function j(D,H,$){var L=$.ref;return{$$typeof:e,type:D,key:H,ref:L!==void 0?L:null,props:$}}function U(D,H){return j(D.type,H,D.props)}function B(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function W(D){var H={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function($){return H[$]})}var J=/\/+/g;function ee(D,H){return typeof D=="object"&&D!==null&&D.key!=null?W(""+D.key):H.toString(36)}function re(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(I,I):(D.status="pending",D.then(function(H){D.status==="pending"&&(D.status="fulfilled",D.value=H)},function(H){D.status==="pending"&&(D.status="rejected",D.reason=H)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function F(D,H,$,L,M){var z=typeof D;(z==="undefined"||z==="boolean")&&(D=null);var G=!1;if(D===null)G=!0;else switch(z){case"bigint":case"string":case"number":G=!0;break;case"object":switch(D.$$typeof){case e:case t:G=!0;break;case m:return G=D._init,F(G(D._payload),H,$,L,M)}}if(G)return M=M(D),G=L===""?"."+ee(D,0):L,C(M)?($="",G!=null&&($=G.replace(J,"$&/")+"/"),F(M,H,$,"",function(ie){return ie})):M!=null&&(B(M)&&(M=U(M,$+(M.key==null||D&&D.key===M.key?"":(""+M.key).replace(J,"$&/")+"/")+G)),H.push(M)),1;G=0;var q=L===""?".":L+":";if(C(D))for(var ae=0;ae<D.length;ae++)L=D[ae],z=q+ee(L,ae),G+=F(L,H,$,z,M);else if(ae=y(D),typeof ae=="function")for(D=ae.call(D),ae=0;!(L=D.next()).done;)L=L.value,z=q+ee(L,ae++),G+=F(L,H,$,z,M);else if(z==="object"){if(typeof D.then=="function")return F(re(D),H,$,L,M);throw H=String(D),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return G}function K(D,H,$){if(D==null)return D;var L=[],M=0;return F(D,L,"","",function(z){return H.call($,z,M++)}),L}function V(D){if(D._status===-1){var H=D._result;H=H(),H.then(function($){(D._status===0||D._status===-1)&&(D._status=1,D._result=$)},function($){(D._status===0||D._status===-1)&&(D._status=2,D._result=$)}),D._status===-1&&(D._status=0,D._result=H)}if(D._status===1)return D._result.default;throw D._result}var ne=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},te={map:K,forEach:function(D,H,$){K(D,function(){H.apply(this,arguments)},$)},count:function(D){var H=0;return K(D,function(){H++}),H},toArray:function(D){return K(D,function(H){return H})||[]},only:function(D){if(!B(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return yt.Activity=h,yt.Children=te,yt.Component=_,yt.Fragment=n,yt.Profiler=a,yt.PureComponent=T,yt.StrictMode=r,yt.Suspense=u,yt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,yt.__COMPILER_RUNTIME={__proto__:null,c:function(D){return A.H.useMemoCache(D)}},yt.cache=function(D){return function(){return D.apply(null,arguments)}},yt.cacheSignal=function(){return null},yt.cloneElement=function(D,H,$){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var L=E({},D.props),M=D.key;if(H!=null)for(z in H.key!==void 0&&(M=""+H.key),H)!O.call(H,z)||z==="key"||z==="__self"||z==="__source"||z==="ref"&&H.ref===void 0||(L[z]=H[z]);var z=arguments.length-2;if(z===1)L.children=$;else if(1<z){for(var G=Array(z),q=0;q<z;q++)G[q]=arguments[q+2];L.children=G}return j(D.type,M,L)},yt.createContext=function(D){return D={$$typeof:i,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:s,_context:D},D},yt.createElement=function(D,H,$){var L,M={},z=null;if(H!=null)for(L in H.key!==void 0&&(z=""+H.key),H)O.call(H,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&(M[L]=H[L]);var G=arguments.length-2;if(G===1)M.children=$;else if(1<G){for(var q=Array(G),ae=0;ae<G;ae++)q[ae]=arguments[ae+2];M.children=q}if(D&&D.defaultProps)for(L in G=D.defaultProps,G)M[L]===void 0&&(M[L]=G[L]);return j(D,z,M)},yt.createRef=function(){return{current:null}},yt.forwardRef=function(D){return{$$typeof:c,render:D}},yt.isValidElement=B,yt.lazy=function(D){return{$$typeof:m,_payload:{_status:-1,_result:D},_init:V}},yt.memo=function(D,H){return{$$typeof:f,type:D,compare:H===void 0?null:H}},yt.startTransition=function(D){var H=A.T,$={};A.T=$;try{var L=D(),M=A.S;M!==null&&M($,L),typeof L=="object"&&L!==null&&typeof L.then=="function"&&L.then(I,ne)}catch(z){ne(z)}finally{H!==null&&$.types!==null&&(H.types=$.types),A.T=H}},yt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},yt.use=function(D){return A.H.use(D)},yt.useActionState=function(D,H,$){return A.H.useActionState(D,H,$)},yt.useCallback=function(D,H){return A.H.useCallback(D,H)},yt.useContext=function(D){return A.H.useContext(D)},yt.useDebugValue=function(){},yt.useDeferredValue=function(D,H){return A.H.useDeferredValue(D,H)},yt.useEffect=function(D,H){return A.H.useEffect(D,H)},yt.useEffectEvent=function(D){return A.H.useEffectEvent(D)},yt.useId=function(){return A.H.useId()},yt.useImperativeHandle=function(D,H,$){return A.H.useImperativeHandle(D,H,$)},yt.useInsertionEffect=function(D,H){return A.H.useInsertionEffect(D,H)},yt.useLayoutEffect=function(D,H){return A.H.useLayoutEffect(D,H)},yt.useMemo=function(D,H){return A.H.useMemo(D,H)},yt.useOptimistic=function(D,H){return A.H.useOptimistic(D,H)},yt.useReducer=function(D,H,$){return A.H.useReducer(D,H,$)},yt.useRef=function(D){return A.H.useRef(D)},yt.useState=function(D){return A.H.useState(D)},yt.useSyncExternalStore=function(D,H,$){return A.H.useSyncExternalStore(D,H,$)},yt.useTransition=function(){return A.H.useTransition()},yt.version="19.2.0",yt}var nj;function p_(){return nj||(nj=1,Dw.exports=lJ()),Dw.exports}var v=p_();const ce=bp(v),Hu=Y9({__proto__:null,default:ce},[v]);function lx(e,t){if(!e)throw new Error(t)}Ge(lx,"assert");var cJ=3e3,uJ=5e3;function m_(e){const{url:t,enabled:n=!0,clientName:r,clientUri:a,callbackUrl:s=typeof window<"u"?Zc(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:i="mcp:auth",clientConfig:c={},customHeaders:u={},debug:f=!1,autoRetry:m=!1,autoReconnect:h=cJ,transportType:b="auto",preventAutoAuth:y=!1,useRedirectFlow:x=!1,onPopupWindow:E,timeout:w=3e4,sseReadTimeout:_=3e5,wrapTransport:S,onNotification:T,samplingCallback:R,onElicitation:C}=e,[I,A]=v.useState("discovering"),[O,j]=v.useState([]),[U,B]=v.useState([]),[W,J]=v.useState([]),[ee,re]=v.useState([]),[F,K]=v.useState(),[V,ne]=v.useState(),[te,D]=v.useState(void 0),[H,$]=v.useState([]),[L,M]=v.useState(void 0),z=v.useRef(null),G=v.useRef(null),q=v.useRef(!1),ae=v.useRef(!0),ie=v.useRef(0),X=v.useRef(null),Z=v.useRef(I),se=v.useRef(h),me=v.useRef(null);v.useEffect(()=>{Z.current=I,se.current=h},[I,h]);const le=v.useCallback((Le,$e,...bt)=>{const nt=bt.length>0?`${$e} ${bt.map(Ut=>JSON.stringify(Ut)).join(" ")}`:$e;console[Le](`[useMcp] ${nt}`),ae.current&&$(Ut=>[...Ut.slice(-100),{level:Le,message:nt,timestamp:Date.now()}])},[]),Te=v.useCallback(async(Le=!1)=>{if(Le||le("info","Disconnecting..."),q.current=!1,X.current&&clearTimeout(X.current),X.current=null,z.current)try{await z.current.closeSession("inspector-server")}catch($e){Le||le("warn","Error closing session:",$e)}z.current=null,ae.current&&!Le&&(A("discovering"),j([]),B([]),J([]),re([]),D(void 0),M(void 0))},[le]),Be=v.useCallback((Le,$e)=>{if(le("error",Le,$e??""),ae.current){A("failed"),D(Le);const bt=G.current?.getLastAttemptedAuthUrl();bt&&(M(bt),le("info","Manual authentication URL may be available.",bt))}q.current=!1},[le]),Ee=v.useCallback(async()=>{if(!n||!t){le("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag.");return}if(q.current){le("debug","Connection attempt already in progress.");return}if(!ae.current){le("debug","Connect called after unmount, aborting.");return}q.current=!0,ie.current+=1,D(void 0),M(void 0),me.current=null,A("discovering"),le("info",`Connecting attempt #${ie.current} to ${t}...`),G.current||(G.current=new kg(t,{storageKeyPrefix:i,clientName:r,clientUri:a,callbackUrl:s,preventAutoAuth:y,useRedirectFlow:x,onPopupWindow:E}),le("debug","BrowserOAuthClientProvider initialized in connect.")),z.current||(z.current=new iJ,le("debug","BrowserMCPClient initialized in connect."));const Le=Ge(async(bt,nt=!1)=>{le("info",`Attempting connection with transport: ${bt}`);try{const Ut="inspector-server",ot={url:t,transport:bt==="sse"?"http":bt};if(u&&Object.keys(u).length>0&&(ot.headers=u),G.current){const Et=await G.current.tokens();Et?.access_token&&(ot.headers={...ot.headers,Authorization:`Bearer ${Et.access_token}`})}z.current.addServer(Ut,{...ot,authProvider:G.current,clientOptions:c,samplingCallback:R,elicitationCallback:C,wrapTransport:S?Et=>(console.log("[useMcp] Applying transport wrapper for server:",Ut,"url:",t),S(Et,t)):void 0});const Ie=await z.current.createSession(Ut,!1);T&&Ie.on("notification",T),await Ie.initialize(),le("info","✅ Successfully connected to MCP server"),le("info","Server info:",Ie.connector.serverInfo),le("info","Server capabilities:",Ie.connector.serverCapabilities),console.log("[useMcp] Server info:",Ie.connector.serverInfo),console.log("[useMcp] Server capabilities:",Ie.connector.serverCapabilities),A("ready"),me.current=bt,j(Ie.connector.tools||[]);const Me=await Ie.connector.listAllResources();B(Me.resources||[]);const He=await Ie.connector.listPrompts();re(He.prompts||[]);const it=Ie.connector.serverInfo,pt=Ie.connector.serverCapabilities;return it&&(console.log("[useMcp] Server info:",it),K(it)),pt&&(console.log("[useMcp] Server capabilities:",pt),ne(pt)),"success"}catch(Ut){const ot=Ut,Ie=ot?.message||String(Ut);if(ot.code===401||Ie.includes("401")||Ie.includes("Unauthorized")){if(G.current){le("info","Authentication required. OAuth provider available.");try{const{auth:Me}=await hr(async()=>{const{auth:it}=await Promise.resolve().then(()=>KM);return{auth:it}},void 0),He=new URL(t).origin;Me(G.current,{serverUrl:He}).catch(()=>{}),setTimeout(()=>{if(ae.current){const it=G.current?.getLastAttemptedAuthUrl();it?(M(it),le("info","Manual authentication URL available:",it)):le("warn","Could not generate authentication URL")}},100)}catch(Me){le("warn","Error generating auth URL:",Me)}return ae.current&&A("pending_auth"),q.current=!1,"auth_redirect"}return u&&Object.keys(u).length>0?(Be("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."),"failed"):(Be("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."),"failed")}return Be(Ie,ot instanceof Error?ot:new Error(String(ot))),"failed"}},"tryConnectWithTransport");let $e="failed";if(b==="sse")le("debug","Using SSE-only transport mode"),$e=await Le("sse");else if(b==="http")le("debug","Using HTTP-only transport mode"),$e=await Le("http");else{le("debug","Using auto transport mode (HTTP with SSE fallback)");const bt=await Le("http");bt==="fallback"&&ae.current&&Z.current!=="authenticating"?(le("info","HTTP failed, attempting SSE fallback..."),$e=await Le("sse")):$e=bt}($e==="success"||$e==="failed"||$e==="auth_redirect")&&(q.current=!1),le("debug",`Connection sequence finished with status: ${$e}`)},[le,Be,Te,t,i,r,a,s,c.name,c.version,u,b,y,x,E,n,w,_]),_e=v.useCallback(async(Le,$e,bt)=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot call tool "${Le}".`);le("info",`Calling tool: ${Le}`,$e);try{const Ut=z.current.getSession("inspector-server");if(!Ut)throw new Error("No active session found");const ot=await Ut.connector.callTool(Le,$e||{},bt);return le("info",`Tool "${Le}" call successful:`,ot),ot}catch(nt){throw le("error",`Tool "${Le}" call failed:`,nt),nt}},[I]),Ue=v.useCallback(()=>{Z.current==="failed"?(le("info","Retry requested..."),Ee()):le("warn",`Retry called but state is not 'failed' (state: ${Z.current}). Ignoring.`)},[le,Ee]),fe=v.useCallback(async()=>{le("info","Manual authentication requested...");const Le=Z.current;if(Le==="failed")le("info","Attempting to reconnect and authenticate via retry..."),Ue();else if(Le==="pending_auth"){le("info","Proceeding with authentication from pending state...");try{lx(G.current,"Auth Provider not available for manual auth"),lx(t,"Server URL is required for authentication"),le("info","Clearing all OAuth state and initiating fresh flow...");const $e=`${i}:${G.current.serverUrlHash}`;Object.keys(localStorage).forEach(ot=>{ot.startsWith($e)&&(le("debug",`Removing stale OAuth key: ${ot}`),localStorage.removeItem(ot)),ot.startsWith(`${i}:state_`)&&(le("debug",`Removing orphaned state: ${ot}`),localStorage.removeItem(ot))}),A("authenticating");const bt=new kg(t,{storageKeyPrefix:i,clientName:r,clientUri:a,callbackUrl:s,preventAutoAuth:!1,useRedirectFlow:x,onPopupWindow:E});G.current=bt,le("info","Triggering fresh OAuth authorization...");const{auth:nt}=await hr(async()=>{const{auth:ot}=await Promise.resolve().then(()=>KM);return{auth:ot}},void 0),Ut=new URL(t).origin;nt(bt,{serverUrl:Ut}).catch(ot=>{le("info","OAuth flow initiated:",ot instanceof Error?ot.message:"Redirecting...")})}catch($e){if(!ae.current)return;A("pending_auth"),le("error",`Manual authentication failed: ${$e instanceof Error?$e.message:String($e)}`)}}else if(Le==="authenticating"){le("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const $e=G.current?.getLastAttemptedAuthUrl();$e&&!L&&(M($e),le("info","Manual authentication URL retrieved:",$e))}else le("info",`Client not in a state requiring manual authentication trigger (state: ${Le}). If needed, try disconnecting and reconnecting.`)},[le,Ue,L,t,x,E,i,r,a,s]),Ae=v.useCallback(()=>{if(G.current){const Le=G.current.clearStorage();le("info",`Cleared ${Le} item(s) from localStorage for ${t}.`),M(void 0),Te()}else le("warn","Auth provider not initialized, cannot clear storage.")},[t,le,Te]),ze=v.useCallback(async()=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot list resources.`);le("info","Listing resources");try{const $e=z.current.getSession("inspector-server");if(!$e)throw new Error("No active session found");const bt=await $e.connector.listAllResources();B(bt.resources||[]),le("info","Resources listed successfully")}catch(Le){throw le("error","List resources failed:",Le),Le}},[I]),we=v.useCallback(async Le=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot read resource.`);le("info",`Reading resource: ${Le}`);try{const bt=z.current.getSession("inspector-server");if(!bt)throw new Error("No active session found");const nt=await bt.connector.readResource(Le);return le("info","Resource read successful:",nt),nt}catch($e){throw le("error","Resource read failed:",$e),$e}},[I]),at=v.useCallback(async()=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot list prompts.`);le("info","Listing prompts");try{const $e=z.current.getSession("inspector-server");if(!$e)throw new Error("No active session found");const bt=await $e.connector.listPrompts();re(bt.prompts||[]),le("info","Prompts listed successfully")}catch(Le){throw le("error","List prompts failed:",Le),Le}},[I]),lt=v.useCallback(async(Le,$e)=>{if(Z.current!=="ready"||!z.current)throw new Error(`MCP client is not ready (current state: ${I}). Cannot get prompt.`);le("info",`Getting prompt: ${Le}`,$e);try{const nt=z.current.getSession("inspector-server");if(!nt)throw new Error("No active session found");const Ut=await nt.connector.getPrompt(Le,$e||{});return le("info",`Prompt "${Le}" retrieved successfully:`,Ut),Ut}catch(bt){throw le("error",`Prompt "${Le}" retrieval failed:`,bt),bt}},[I]),gt=v.useRef(Ee),Ct=v.useRef(Be);return v.useEffect(()=>{gt.current=Ee,Ct.current=Be}),v.useEffect(()=>{const Le=Ge($e=>{$e.origin===window.location.origin&&$e.data?.type==="mcp_auth_callback"&&(le("info","Received auth callback message.",$e.data),X.current&&clearTimeout(X.current),X.current=null,$e.data.success?(le("info","Authentication successful via popup. Reconnecting client..."),q.current&&le("debug","Connection attempt already in progress, resetting flag to allow reconnection."),q.current=!1,setTimeout(()=>{ae.current&&(le("debug","Initiating reconnection after successful auth callback."),gt.current())},100)):Ct.current(`Authentication failed in callback: ${$e.data.error||"Unknown reason."}`))},"messageHandler");return window.addEventListener("message",Le),le("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Le),le("debug","Auth callback message listener removed."),X.current&&clearTimeout(X.current)}},[le]),v.useEffect(()=>(ae.current=!0,!n||!t?(le("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag."),A("discovering"),()=>{ae.current=!1}):(le("debug","useMcp mounted, initiating connection."),ie.current=0,(!G.current||G.current.serverUrl!==t)&&(G.current=new kg(t,{storageKeyPrefix:i,clientName:r,clientUri:a,callbackUrl:s,preventAutoAuth:y,useRedirectFlow:x,onPopupWindow:E}),le("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),Ee(),()=>{ae.current=!1,le("debug","useMcp unmounting, disconnecting."),Te(!0)})),[t,n,i,s,r,a,c.name,c.version,x]),v.useEffect(()=>{let Le=null;if(I==="failed"&&m&&ie.current>0){const $e=typeof m=="number"?m:uJ;le("info",`Connection failed, auto-retrying in ${$e}ms...`),Le=setTimeout(()=>{ae.current&&Z.current==="failed"&&Ue()},$e)}return()=>{Le&&clearTimeout(Le)}},[I,m,Ue,le]),{state:I,tools:O,resources:U,resourceTemplates:W,prompts:ee,serverInfo:F,capabilities:V,error:te,log:H,authUrl:L,client:z.current,callTool:_e,readResource:we,listResources:ze,listPrompts:at,getPrompt:lt,retry:Ue,disconnect:Te,authenticate:fe,clearStorage:Ae}}Ge(m_,"useMcp");var Tu,dJ=(Tu=class extends ce.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?ce.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"},ce.createElement("h3",{className:"font-bold mb-2"},"Widget Error"),ce.createElement("pre",{className:"text-sm whitespace-pre-wrap"},this.state.error?.message)):this.props.children}},Ge(Tu,"ErrorBoundary"),Tu),Nf="openai:set_globals";function po(e){return v.useSyncExternalStore(t=>{const n=Ge(r=>{r.detail.globals[e]!==void 0&&t()},"handleSetGlobal");return typeof window<"u"&&window.addEventListener(Nf,n),()=>{typeof window<"u"&&window.removeEventListener(Nf,n)}},()=>typeof window<"u"&&window.openai?window.openai[e]:void 0)}Ge(po,"useOpenAiGlobal");function Vu(e){const[t,n]=v.useState(()=>typeof window<"u"&&!!window.openai);v.useEffect(()=>{if(typeof window<"u"&&window.openai){n(!0);return}const O=setInterval(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},100),j=Ge(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},"handleSetGlobals");typeof window<"u"&&window.addEventListener(Nf,j);const U=setTimeout(()=>{clearInterval(O),typeof window<"u"&&window.removeEventListener(Nf,j)},5e3);return()=>{clearInterval(O),clearTimeout(U),typeof window<"u"&&window.removeEventListener(Nf,j)}},[]);const r=v.useMemo(()=>t?"openai":"mcp-ui",[t]),a=typeof window<"u"?window.location.search:"",s=v.useMemo(()=>{const O=new URLSearchParams(a);return O.has("mcpUseParams")?JSON.parse(O.get("mcpUseParams")):{toolInput:{},toolOutput:{},toolId:""}},[a]),i=r==="openai"?po("toolInput"):s.toolInput,c=r==="openai"?po("toolOutput"):s.toolOutput,u=po("toolResponseMetadata"),f=po("widgetState"),m=po("theme"),h=po("displayMode"),b=po("safeArea"),y=po("maxHeight"),x=po("userAgent"),E=po("locale"),w=v.useMemo(()=>typeof window<"u"&&window.__mcpPublicUrl?window.__mcpPublicUrl.replace(/\/mcp-use\/public$/,""):"",[]),[_,S]=v.useState(null);v.useEffect(()=>{f!==void 0&&S(f)},[f]);const T=v.useCallback(async(O,j)=>{if(!window.openai?.callTool)throw new Error("window.openai.callTool is not available");return window.openai.callTool(O,j)},[]),R=v.useCallback(async O=>{if(!window.openai?.sendFollowUpMessage)throw new Error("window.openai.sendFollowUpMessage is not available");return window.openai.sendFollowUpMessage({prompt:O})},[]),C=v.useCallback(O=>{if(!window.openai?.openExternal)throw new Error("window.openai.openExternal is not available");window.openai.openExternal({href:O})},[]),I=v.useCallback(async O=>{if(!window.openai?.requestDisplayMode)throw new Error("window.openai.requestDisplayMode is not available");return window.openai.requestDisplayMode({mode:O})},[]),A=v.useCallback(async O=>{if(!window.openai?.setWidgetState)throw new Error("window.openai.setWidgetState is not available");const U=typeof O=="function"?O(f!==void 0?f:_):O;return S(U),window.openai.setWidgetState(U)},[f,_]);return{props:i||e||{},output:c??null,metadata:u??null,state:_,setState:A,theme:m||"light",displayMode:h||"inline",safeArea:b||{insets:{top:0,bottom:0,left:0,right:0}},maxHeight:y||600,userAgent:x||{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:E||"en",mcp_url:w,callTool:T,sendFollowUpMessage:R,openExternal:C,requestDisplayMode:I,isAvailable:t}}Ge(Vu,"useWidget");function fJ(e){const{props:t}=Vu(e);return t}Ge(fJ,"useWidgetProps");function pJ(){const{theme:e}=Vu();return e}Ge(pJ,"useWidgetTheme");function mJ(e){const{state:t,setState:n}=Vu();return v.useEffect(()=>{t===null&&e!==void 0&&window.openai?.setWidgetState&&n(e)},[]),[t,n]}Ge(mJ,"useWidgetState");var rj=Ge(({children:e})=>{const{theme:t,isAvailable:n}=Vu();console.log("theme",t);const[r,a]=v.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");v.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),c=Ge(u=>{a(u.matches?"dark":"light")},"handleChange");return i.addEventListener("change",c),()=>i.removeEventListener("change",c)},[]);const s=n?t:r;return v.useLayoutEffect(()=>{typeof document>"u"||(s==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[s]),ce.createElement(ce.Fragment,null,e)},"ThemeProvider");function H2({children:e,className:t="",position:n="top-right",attachTo:r,showLabels:a=!0,debugger:s=!1,viewControls:i=!1}){const{props:c,output:u,metadata:f,state:m,theme:h,displayMode:b,safeArea:y,maxHeight:x,userAgent:E,locale:w,isAvailable:_,callTool:S,sendFollowUpMessage:T,openExternal:R,requestDisplayMode:C,setState:I}=Vu(),[A,O]=v.useState(!1),[j,U]=v.useState(!1),B=v.useRef(null),W=v.useRef(null),[J,ee]=v.useState([]),[re,F]=v.useState(""),[K,V]=v.useState("get-my-city"),[ne,te]=v.useState("{}"),[D,H]=v.useState("Test follow-up message"),[$,L]=v.useState("https://docs.mcp-use.com"),M=b==="fullscreen"&&_,z=b==="pip"&&_,G=typeof window<"u"&&window.location.pathname.includes("/inspector/api/dev-widget/");v.useEffect(()=>{const we=setTimeout(()=>{if(typeof window<"u"&&window.openai)try{const at=Object.keys(window.openai);ee(at)}catch{ee([])}else ee([])},100);return()=>{clearTimeout(we)}},[]);const q=h==="dark",ae=Ge(()=>{const we=["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[...we,"top-4","left-4"];case"top-center":return[...we,"top-4","left-1/2","-translate-x-1/2"];case"top-right":return[...we,"top-4","right-4"];case"center-left":return[...we,"top-1/2","left-4","-translate-y-1/2"];case"center-right":return[...we,"top-1/2","right-4","-translate-y-1/2"];case"bottom-left":return[...we,"bottom-4","left-4"];case"bottom-center":return[...we,"bottom-4","left-1/2","-translate-x-1/2"];case"bottom-right":return[...we,"bottom-4","right-4"];default:return[...we,"top-4","right-4"]}},"getPositionClasses"),ie=Ge(()=>{const at=y?.insets?.top?Math.max(16,y.insets.top+8):16,lt=y?.insets?.right?Math.max(16,y.insets.right+8):16,gt=y?.insets?.bottom?Math.max(16,y.insets.bottom+8):16,Ct=y?.insets?.left?Math.max(16,y.insets.left+8):16,Le={};switch(n){case"top-left":Le.top=`${at}px`,Le.left=`${Ct}px`;break;case"top-center":Le.top=`${at}px`;break;case"top-right":Le.top=`${at}px`,Le.right=`${lt}px`;break;case"center-left":Le.left=`${Ct}px`;break;case"center-right":Le.right=`${lt}px`;break;case"bottom-left":Le.bottom=`${gt}px`,Le.left=`${Ct}px`;break;case"bottom-center":Le.bottom=`${gt}px`;break;case"bottom-right":Le.bottom=`${gt}px`,Le.right=`${lt}px`;break;default:Le.top=`${at}px`,Le.right=`${lt}px`;break}return Le},"getPositionOffsetStyles");v.useEffect(()=>{if(!r)return;const we=Ge(()=>O(!0),"handleMouseEnter"),at=Ge(()=>O(!1),"handleMouseLeave");return r.addEventListener("mouseenter",we),r.addEventListener("mouseleave",at),()=>{r.removeEventListener("mouseenter",we),r.removeEventListener("mouseleave",at)}},[r]),v.useEffect(()=>{if(!j)return;const we=Ge(at=>{W.current&&!W.current.contains(at.target)&&U(!1)},"handleClickOutside");return document.addEventListener("mousedown",we),()=>{document.removeEventListener("mousedown",we)}},[j]),v.useEffect(()=>(j?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[j]);const X=Ge(()=>{U(!j)},"handleToggleOverlay"),Z=Ge(async()=>{try{F("Calling tool...");const we=ne.trim()?JSON.parse(ne):{},at=await S(K,we);F(`Success: ${JSON.stringify(at,null,2)}`)}catch(we){F(`Error: ${we.message}`)}},"handleCallTool"),se=Ge(async()=>{try{F("Sending follow-up message..."),await T(D),F("Follow-up message sent successfully")}catch(we){F(`Error: ${we.message}`)}},"handleSendFollowUpMessage"),me=Ge(()=>{try{R($),F(`Opened external link: ${$}`)}catch(we){F(`Error: ${we.message}`)}},"handleOpenExternal"),le=Ge(async we=>{try{F(`Requesting display mode: ${we}...`);const at=await C(we);F(`Display mode granted: ${at.mode}`)}catch(at){F(`Error: ${at.message}`)}},"handleRequestDisplayMode"),Te=Ge(async()=>{try{const we=m?{...m,debugTimestamp:new Date().toISOString()}:{debugTimestamp:new Date().toISOString()};F("Setting state..."),await I(we),F(`State updated: ${JSON.stringify(we,null,2)}`)}catch(we){F(`Error: ${we.message}`)}},"handleSetState"),Be=Ge(async()=>{try{await C("fullscreen")}catch(we){console.error("Failed to go fullscreen:",we)}},"handleFullscreen"),Ee=Ge(async()=>{try{await C("pip")}catch(we){console.error("Failed to go pip:",we)}},"handlePip"),_e=Ge(()=>{const we=["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[...we,"top-full","right-0","mt-2"];case"top-left":return[...we,"top-full","left-0","mt-2"];case"top-center":return[...we,"top-full","left-1/2","-translate-x-1/2","mt-2"];case"bottom-right":return[...we,"bottom-full","right-0","mb-2"];case"bottom-left":return[...we,"bottom-full","left-0","mb-2"];case"bottom-center":return[...we,"bottom-full","left-1/2","-translate-x-1/2","mb-2"];case"center-left":return[...we,"left-full","top-1/2","-translate-y-1/2","ml-2"];case"center-right":return[...we,"right-full","top-1/2","-translate-y-1/2","mr-2"];default:return[...we,"top-full","right-0","mt-2"]}},"getTooltipClasses"),Ue=Ge(({onClick:we,label:at,children:lt})=>{const[gt,Ct]=v.useState(!1),Le=_e();return ce.createElement("button",{className:`p-2 ${q?"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 ${q?"shadow-[0_2px_8px_rgba(0,0,0,0.3)]":"shadow-[0_2px_8px_rgba(0,0,0,0.2)]"} relative`,onMouseEnter:()=>Ct(!0),onMouseLeave:()=>Ct(!1),onClick:we,"aria-label":at},ce.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"},lt),a&&ce.createElement("span",{className:`${Le.join(" ")} ${gt?"opacity-100":"opacity-0"}`},at))},"IconButton"),fe=Ge(we=>{if(we===null)return"null";if(we===void 0)return"undefined";if(typeof we=="object")try{return JSON.stringify(we,null,2)}catch{return String(we)}return String(we)},"formatValue"),Ae=Ge(we=>we?`${we.device?.type||"unknown"}`:"N/A","formatUserAgent"),ze=Ge(we=>{if(!we?.insets)return"N/A";const{top:at,bottom:lt,left:gt,right:Ct}=we.insets;return`T:${at} B:${lt} L:${gt} R:${Ct}`},"formatSafeArea");return ce.createElement(ce.Fragment,null,ce.createElement("div",{ref:B,className:`${t} relative h-fit`,onMouseEnter:()=>!r&&O(!0),onMouseLeave:()=>!r&&O(!1)},ce.createElement("div",{className:ae().join(" "),style:ie()},!G&&ce.createElement(ce.Fragment,null,!M&&!z&&ce.createElement(ce.Fragment,null,(i===!0||i==="fullscreen")&&ce.createElement(Ue,{onClick:Be,label:"Fullscreen"},ce.createElement("path",{d:"M15 3h6v6"}),ce.createElement("path",{d:"m21 3-7 7"}),ce.createElement("path",{d:"m3 21 7-7"}),ce.createElement("path",{d:"M9 21H3v-6"})),(i===!0||i==="pip")&&ce.createElement(Ue,{onClick:Ee,label:"Picture in Picture"},ce.createElement("path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4"}),ce.createElement("rect",{width:"10",height:"7",x:"12",y:"13",rx:"2"}))),s&&ce.createElement(Ue,{onClick:X,label:"Debug Info"},ce.createElement("path",{d:"M12 20v-9"}),ce.createElement("path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}),ce.createElement("path",{d:"M14.12 3.88 16 2"}),ce.createElement("path",{d:"M21 21a4 4 0 0 0-3.81-4"}),ce.createElement("path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}),ce.createElement("path",{d:"M22 13h-4"}),ce.createElement("path",{d:"M3 21a4 4 0 0 1 3.81-4"}),ce.createElement("path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}),ce.createElement("path",{d:"M6 13H2"}),ce.createElement("path",{d:"m8 2 1.88 1.88"}),ce.createElement("path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"})))),e),j&&s&&ce.createElement("div",{ref:W,className:"fixed inset-0 bg-black text-white font-mono text-xs z-[10000] overflow-auto p-4",onClick:we=>{we.target===W.current&&U(!1)}},ce.createElement("button",{onClick:()=>U(!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"},"×"),ce.createElement("div",{className:"max-w-[1200px] mx-auto pt-10"},ce.createElement("h1",{className:"text-lg font-bold mb-4 border-b border-gray-700 pb-2"},"Debug Info"),ce.createElement("table",{className:"w-full border-collapse border-spacing-0"},ce.createElement("tbody",null,ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Props"),ce.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},fe(c))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Output"),ce.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},fe(u))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Metadata"),ce.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},fe(f))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"State"),ce.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},fe(m))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Theme"),ce.createElement("td",{className:"p-2"},h)),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Display Mode"),ce.createElement("td",{className:"p-2"},b)),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Locale"),ce.createElement("td",{className:"p-2"},w)),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Max Height"),ce.createElement("td",{className:"p-2"},x,"px")),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"User Agent"),ce.createElement("td",{className:"p-2"},Ae(E))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Safe Area"),ce.createElement("td",{className:"p-2"},ze(y))),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"API Available"),ce.createElement("td",{className:"p-2"},_?"Yes":"No")),ce.createElement("tr",{className:"border-b border-gray-700"},ce.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"window.openai Keys"),ce.createElement("td",{className:"p-2"},J.length>0?J.join(", "):"N/A")))),ce.createElement("h2",{className:"text-base font-bold mt-8 mb-4 border-b border-gray-700 pb-2"},"Actions"),ce.createElement("div",{className:"flex flex-col gap-3"},ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("input",{type:"text",value:K,onChange:we=>V(we.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]"}),ce.createElement("input",{type:"text",value:ne,onChange:we=>te(we.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"}),ce.createElement("button",{onClick:Z,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Call Tool")),ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("input",{type:"text",value:D,onChange:we=>H(we.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"}),ce.createElement("button",{onClick:se,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")),ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("input",{type:"text",value:$,onChange:we=>L(we.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"}),ce.createElement("button",{onClick:me,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Open Link")),ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("span",{className:"w-[150px] text-xs"},"Display Mode:"),ce.createElement("button",{onClick:()=>le("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"),ce.createElement("button",{onClick:()=>le("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"),ce.createElement("button",{onClick:()=>le("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")),ce.createElement("div",{className:"flex gap-2 items-center"},ce.createElement("button",{onClick:Te,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)")),re&&ce.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"},ce.createElement("div",{className:"font-bold mb-1 text-gray-400"},"Result:"),re,ce.createElement("button",{onClick:()=>F(""),className:"mt-2 py-1 px-2 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-[11px]"},"Clear"))))))}Ge(H2,"WidgetControls");function V2(){if(typeof window>"u")return"/";const t=window.location.pathname.match(/^(\/inspector\/api\/dev-widget\/[^/]+)/);return t?t[1]:"/"}Ge(V2,"getBasename");var hJ=150,gJ=5;function bJ({children:e,debugger:t=!1,viewControls:n=!1,autoSize:r=!1}){const a=V2(),s=v.useRef(null),i=v.useRef(0),c=v.useRef(null),u=v.useRef(!1),[f,m]=v.useState(null),[h,b]=v.useState(null),[y,x]=v.useState(!0);v.useEffect(()=>{let S=!0;return(async()=>{try{const T=await hr(()=>import("./index-CTkgGoHG.js"),[]);S&&(m(()=>T.BrowserRouter),x(!1))}catch{S&&(b(new Error(`❌ react-router-dom not installed!
43
43
 
44
44
  To use MCP widgets with McpUseProvider, you need to install:
45
45
 
@@ -54,8 +54,8 @@ This dependency is automatically included in projects created with 'create-mcp-u
54
54
  `);for(N=g=0;g<oe.length&&!oe[g].includes("DetermineComponentFrameRoot");)g++;for(;N<ge.length&&!ge[N].includes("DetermineComponentFrameRoot");)N++;if(g===oe.length||N===ge.length)for(g=oe.length-1,N=ge.length-1;1<=g&&0<=N&&oe[g]!==ge[N];)N--;for(;1<=g&&0<=N;g--,N--)if(oe[g]!==ge[N]){if(g!==1||N!==1)do if(g--,N--,0>N||oe[g]!==ge[N]){var xe=`
55
55
  `+oe[g].replace(" at new "," at ");return o.displayName&&xe.includes("<anonymous>")&&(xe=xe.replace("<anonymous>",o.displayName)),xe}while(1<=g&&0<=N);break}}}finally{le=!1,Error.prepareStackTrace=p}return(p=o?o.displayName||o.name:"")?me(p):""}function Be(o,l){switch(o.tag){case 26:case 27:case 5:return me(o.type);case 16:return me("Lazy");case 13:return o.child!==l&&l!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return Te(o.type,!1);case 11:return Te(o.type.render,!1);case 1:return Te(o.type,!0);case 31:return me("Activity");default:return""}}function Ee(o){try{var l="",p=null;do l+=Be(o,p),p=o,o=o.return;while(o);return l}catch(g){return`
56
56
  Error generating stack: `+g.message+`
57
- `+g.stack}}var _e=Object.prototype.hasOwnProperty,Ue=e.unstable_scheduleCallback,fe=e.unstable_cancelCallback,Ae=e.unstable_shouldYield,ze=e.unstable_requestPaint,we=e.unstable_now,at=e.unstable_getCurrentPriorityLevel,lt=e.unstable_ImmediatePriority,gt=e.unstable_UserBlockingPriority,Ct=e.unstable_NormalPriority,Le=e.unstable_LowPriority,$e=e.unstable_IdlePriority,bt=e.log,nt=e.unstable_setDisableYieldValue,Ut=null,st=null;function Ie(o){if(typeof bt=="function"&&nt(o),st&&typeof st.setStrictMode=="function")try{st.setStrictMode(Ut,o)}catch{}}var Me=Math.clz32?Math.clz32:pt,He=Math.log,it=Math.LN2;function pt(o){return o>>>=0,o===0?32:31-(He(o)/it|0)|0}var Et=256,xt=262144,un=4194304;function mn(o){var l=o&42;if(l!==0)return l;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ze(o,l,p){var g=o.pendingLanes;if(g===0)return 0;var N=0,k=o.suspendedLanes,P=o.pingedLanes;o=o.warmLanes;var Y=g&134217727;return Y!==0?(g=Y&~k,g!==0?N=mn(g):(P&=Y,P!==0?N=mn(P):p||(p=Y&~o,p!==0&&(N=mn(p))))):(Y=g&~k,Y!==0?N=mn(Y):P!==0?N=mn(P):p||(p=g&~o,p!==0&&(N=mn(p)))),N===0?0:l!==0&&l!==N&&(l&k)===0&&(k=N&-N,p=l&-l,k>=p||k===32&&(p&4194048)!==0)?l:N}function vt(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function jt(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pt(){var o=un;return un<<=1,(un&62914560)===0&&(un=4194304),o}function yr(o){for(var l=[],p=0;31>p;p++)l.push(o);return l}function dn(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Xn(o,l,p,g,N,k){var P=o.pendingLanes;o.pendingLanes=p,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=p,o.entangledLanes&=p,o.errorRecoveryDisabledLanes&=p,o.shellSuspendCounter=0;var Y=o.entanglements,oe=o.expirationTimes,ge=o.hiddenUpdates;for(p=P&~p;0<p;){var xe=31-Me(p),ke=1<<xe;Y[xe]=0,oe[xe]=-1;var ye=ge[xe];if(ye!==null)for(ge[xe]=null,xe=0;xe<ye.length;xe++){var ve=ye[xe];ve!==null&&(ve.lane&=-536870913)}p&=~ke}g!==0&&Jn(o,g,0),k!==0&&N===0&&o.tag!==0&&(o.suspendedLanes|=k&~(P&~l))}function Jn(o,l,p){o.pendingLanes|=l,o.suspendedLanes&=~l;var g=31-Me(l);o.entangledLanes|=l,o.entanglements[g]=o.entanglements[g]|1073741824|p&261930}function wn(o,l){var p=o.entangledLanes|=l;for(o=o.entanglements;p;){var g=31-Me(p),N=1<<g;N&l|o[g]&l&&(o[g]|=l),p&=~N}}function fn(o,l){var p=l&-l;return p=(p&42)!==0?1:la(p),(p&(o.suspendedLanes|l))!==0?0:p}function la(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Qt(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Ta(){var o=K.p;return o!==0?o:(o=window.event,o===void 0?32:ZD(o.type))}function Na(o,l){var p=K.p;try{return K.p=o,l()}finally{K.p=p}}var vr=Math.random().toString(36).slice(2),ht="__reactFiber$"+vr,Hn="__reactProps$"+vr,Qr="__reactContainer$"+vr,so="__reactEvents$"+vr,Hr="__reactListeners$"+vr,Us="__reactHandles$"+vr,Rt="__reactResources$"+vr,pn="__reactMarker$"+vr;function sn(o){delete o[ht],delete o[Hn],delete o[so],delete o[Hr],delete o[Us]}function Zt(o){var l=o[ht];if(l)return l;for(var p=o.parentNode;p;){if(l=p[Qr]||p[ht]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(o=DD(o);o!==null;){if(p=o[ht])return p;o=DD(o)}return l}o=p,p=o.parentNode}return null}function mt(o){if(o=o[ht]||o[Qr]){var l=o.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return o}return null}function nn(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o.stateNode;throw Error(r(33))}function dr(o){var l=o[Rt];return l||(l=o[Rt]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function ot(o){o[pn]=!0}var ca=new Set,Ht={};function An(o,l){hn(o,l),hn(o+"Capture",l)}function hn(o,l){for(Ht[o]=l,o=0;o<l.length;o++)ca.add(l[o])}var kn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),rr={},wr={};function Co(o){return _e.call(wr,o)?!0:_e.call(rr,o)?!1:kn.test(o)?wr[o]=!0:(rr[o]=!0,!1)}function $t(o,l,p){if(Co(l))if(p===null)o.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":o.removeAttribute(l);return;case"boolean":var g=l.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){o.removeAttribute(l);return}}o.setAttribute(l,""+p)}}function ua(o,l,p){if(p===null)o.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttribute(l,""+p)}}function Er(o,l,p,g){if(g===null)o.removeAttribute(p);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(p);return}o.setAttributeNS(l,p,""+g)}}function Vr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ro(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function ov(o,l,p){var g=Object.getOwnPropertyDescriptor(o.constructor.prototype,l);if(!o.hasOwnProperty(l)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var N=g.get,k=g.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return N.call(this)},set:function(P){p=""+P,k.call(this,P)}}),Object.defineProperty(o,l,{enumerable:g.enumerable}),{getValue:function(){return p},setValue:function(P){p=""+P},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function Kl(o){if(!o._valueTracker){var l=Ro(o)?"checked":"value";o._valueTracker=ov(o,l,""+o[l])}}function Jp(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var p=l.getValue(),g="";return o&&(g=Ro(o)?o.checked?"true":"false":o.value),o=g,o!==p?(l.setValue(o),!0):!1}function Yl(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var Zl=/[\n"\\]/g;function ea(o){return o.replace(Zl,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function sv(o,l,p,g,N,k,P,Y){o.name="",P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?o.type=P:o.removeAttribute("type"),l!=null?P==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+Vr(l)):o.value!==""+Vr(l)&&(o.value=""+Vr(l)):P!=="submit"&&P!=="reset"||o.removeAttribute("value"),l!=null?iv(o,P,Vr(l)):p!=null?iv(o,P,Vr(p)):g!=null&&o.removeAttribute("value"),N==null&&k!=null&&(o.defaultChecked=!!k),N!=null&&(o.checked=N&&typeof N!="function"&&typeof N!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?o.name=""+Vr(Y):o.removeAttribute("name")}function md(o,l,p,g,N,k,P,Y){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(o.type=k),l!=null||p!=null){if(!(k!=="submit"&&k!=="reset"||l!=null)){Kl(o);return}p=p!=null?""+Vr(p):"",l=l!=null?""+Vr(l):p,Y||l===o.value||(o.value=l),o.defaultValue=l}g=g??N,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=Y?o.checked:!!g,o.defaultChecked=!!g,P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(o.name=P),Kl(o)}function iv(o,l,p){l==="number"&&Yl(o.ownerDocument)===o||o.defaultValue===""+p||(o.defaultValue=""+p)}function $s(o,l,p,g){if(o=o.options,l){l={};for(var N=0;N<p.length;N++)l["$"+p[N]]=!0;for(p=0;p<o.length;p++)N=l.hasOwnProperty("$"+o[p].value),o[p].selected!==N&&(o[p].selected=N),N&&g&&(o[p].defaultSelected=!0)}else{for(p=""+Vr(p),l=null,N=0;N<o.length;N++){if(o[N].value===p){o[N].selected=!0,g&&(o[N].defaultSelected=!0);return}l!==null||o[N].disabled||(l=o[N])}l!==null&&(l.selected=!0)}}function w1(o,l,p){if(l!=null&&(l=""+Vr(l),l!==o.value&&(o.value=l),p==null)){o.defaultValue!==l&&(o.defaultValue=l);return}o.defaultValue=p!=null?""+Vr(p):""}function E1(o,l,p,g){if(l==null){if(g!=null){if(p!=null)throw Error(r(92));if(re(g)){if(1<g.length)throw Error(r(93));g=g[0]}p=g}p==null&&(p=""),l=p}p=Vr(l),o.defaultValue=p,g=o.textContent,g===p&&g!==""&&g!==null&&(o.value=g),Kl(o)}function Zo(o,l){if(l){var p=o.firstChild;if(p&&p===o.lastChild&&p.nodeType===3){p.nodeValue=l;return}}o.textContent=l}var F6=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function x1(o,l,p){var g=l.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?g?o.setProperty(l,""):l==="float"?o.cssFloat="":o[l]="":g?o.setProperty(l,p):typeof p!="number"||p===0||F6.has(l)?l==="float"?o.cssFloat=p:o[l]=(""+p).trim():o[l]=p+"px"}function S1(o,l,p){if(l!=null&&typeof l!="object")throw Error(r(62));if(o=o.style,p!=null){for(var g in p)!p.hasOwnProperty(g)||l!=null&&l.hasOwnProperty(g)||(g.indexOf("--")===0?o.setProperty(g,""):g==="float"?o.cssFloat="":o[g]="");for(var N in l)g=l[N],l.hasOwnProperty(N)&&p[N]!==g&&x1(o,N,g)}else for(var k in l)l.hasOwnProperty(k)&&x1(o,k,l[k])}function lv(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var B6=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),H6=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qp(o){return H6.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function qo(){}var cv=null;function uv(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var ql=null,Xl=null;function _1(o){var l=mt(o);if(l&&(o=l.stateNode)){var p=o[Hn]||null;e:switch(o=l.stateNode,l.type){case"input":if(sv(o,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),l=p.name,p.type==="radio"&&l!=null){for(p=o;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+ea(""+l)+'"][type="radio"]'),l=0;l<p.length;l++){var g=p[l];if(g!==o&&g.form===o.form){var N=g[Hn]||null;if(!N)throw Error(r(90));sv(g,N.value,N.defaultValue,N.defaultValue,N.checked,N.defaultChecked,N.type,N.name)}}for(l=0;l<p.length;l++)g=p[l],g.form===o.form&&Jp(g)}break e;case"textarea":w1(o,p.value,p.defaultValue);break e;case"select":l=p.value,l!=null&&$s(o,!!p.multiple,l,!1)}}}var dv=!1;function T1(o,l,p){if(dv)return o(l,p);dv=!0;try{var g=o(l);return g}finally{if(dv=!1,(ql!==null||Xl!==null)&&(zm(),ql&&(l=ql,o=Xl,Xl=ql=null,_1(l),o)))for(l=0;l<o.length;l++)_1(o[l])}}function hd(o,l){var p=o.stateNode;if(p===null)return null;var g=p[Hn]||null;if(g===null)return null;p=g[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(o=o.type,g=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!g;break e;default:o=!1}if(o)return null;if(p&&typeof p!="function")throw Error(r(231,l,typeof p));return p}var Xo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fv=!1;if(Xo)try{var gd={};Object.defineProperty(gd,"passive",{get:function(){fv=!0}}),window.addEventListener("test",gd,gd),window.removeEventListener("test",gd,gd)}catch{fv=!1}var zs=null,pv=null,em=null;function N1(){if(em)return em;var o,l=pv,p=l.length,g,N="value"in zs?zs.value:zs.textContent,k=N.length;for(o=0;o<p&&l[o]===N[o];o++);var P=p-o;for(g=1;g<=P&&l[p-g]===N[k-g];g++);return em=N.slice(o,1<g?1-g:void 0)}function tm(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function nm(){return!0}function k1(){return!1}function da(o){function l(p,g,N,k,P){this._reactName=p,this._targetInst=N,this.type=g,this.nativeEvent=k,this.target=P,this.currentTarget=null;for(var Y in o)o.hasOwnProperty(Y)&&(p=o[Y],this[Y]=p?p(k):k[Y]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?nm:k1,this.isPropagationStopped=k1,this}return h(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=nm)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=nm)},persist:function(){},isPersistent:nm}),l}var Hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rm=da(Hi),bd=h({},Hi,{view:0,detail:0}),V6=da(bd),mv,hv,yd,am=h({},bd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bv,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==yd&&(yd&&o.type==="mousemove"?(mv=o.screenX-yd.screenX,hv=o.screenY-yd.screenY):hv=mv=0,yd=o),mv)},movementY:function(o){return"movementY"in o?o.movementY:hv}}),C1=da(am),G6=h({},am,{dataTransfer:0}),W6=da(G6),K6=h({},bd,{relatedTarget:0}),gv=da(K6),Y6=h({},Hi,{animationName:0,elapsedTime:0,pseudoElement:0}),Z6=da(Y6),q6=h({},Hi,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),X6=da(q6),J6=h({},Hi,{data:0}),R1=da(J6),Q6={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},e8={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},t8={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function n8(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=t8[o])?!!l[o]:!1}function bv(){return n8}var r8=h({},bd,{key:function(o){if(o.key){var l=Q6[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=tm(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?e8[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bv,charCode:function(o){return o.type==="keypress"?tm(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?tm(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),a8=da(r8),o8=h({},am,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),A1=da(o8),s8=h({},bd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bv}),i8=da(s8),l8=h({},Hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),c8=da(l8),u8=h({},am,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),d8=da(u8),f8=h({},Hi,{newState:0,oldState:0}),p8=da(f8),m8=[9,13,27,32],yv=Xo&&"CompositionEvent"in window,vd=null;Xo&&"documentMode"in document&&(vd=document.documentMode);var h8=Xo&&"TextEvent"in window&&!vd,I1=Xo&&(!yv||vd&&8<vd&&11>=vd),O1=" ",D1=!1;function L1(o,l){switch(o){case"keyup":return m8.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function M1(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Jl=!1;function g8(o,l){switch(o){case"compositionend":return M1(l);case"keypress":return l.which!==32?null:(D1=!0,O1);case"textInput":return o=l.data,o===O1&&D1?null:o;default:return null}}function b8(o,l){if(Jl)return o==="compositionend"||!yv&&L1(o,l)?(o=N1(),em=pv=zs=null,Jl=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return I1&&l.locale!=="ko"?null:l.data;default:return null}}var y8={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function j1(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!y8[o.type]:l==="textarea"}function P1(o,l,p,g){ql?Xl?Xl.push(g):Xl=[g]:ql=g,l=Km(l,"onChange"),0<l.length&&(p=new rm("onChange","change",null,p,g),o.push({event:p,listeners:l}))}var wd=null,Ed=null;function v8(o){vD(o,0)}function om(o){var l=nn(o);if(Jp(l))return o}function U1(o,l){if(o==="change")return l}var $1=!1;if(Xo){var vv;if(Xo){var wv="oninput"in document;if(!wv){var z1=document.createElement("div");z1.setAttribute("oninput","return;"),wv=typeof z1.oninput=="function"}vv=wv}else vv=!1;$1=vv&&(!document.documentMode||9<document.documentMode)}function F1(){wd&&(wd.detachEvent("onpropertychange",B1),Ed=wd=null)}function B1(o){if(o.propertyName==="value"&&om(Ed)){var l=[];P1(l,Ed,o,uv(o)),T1(v8,l)}}function w8(o,l,p){o==="focusin"?(F1(),wd=l,Ed=p,wd.attachEvent("onpropertychange",B1)):o==="focusout"&&F1()}function E8(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return om(Ed)}function x8(o,l){if(o==="click")return om(l)}function S8(o,l){if(o==="input"||o==="change")return om(l)}function _8(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var ka=typeof Object.is=="function"?Object.is:_8;function xd(o,l){if(ka(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var p=Object.keys(o),g=Object.keys(l);if(p.length!==g.length)return!1;for(g=0;g<p.length;g++){var N=p[g];if(!_e.call(l,N)||!ka(o[N],l[N]))return!1}return!0}function H1(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function V1(o,l){var p=H1(o);o=0;for(var g;p;){if(p.nodeType===3){if(g=o+p.textContent.length,o<=l&&g>=l)return{node:p,offset:l-o};o=g}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=H1(p)}}function G1(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?G1(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function W1(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=Yl(o.document);l instanceof o.HTMLIFrameElement;){try{var p=typeof l.contentWindow.location.href=="string"}catch{p=!1}if(p)o=l.contentWindow;else break;l=Yl(o.document)}return l}function Ev(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var T8=Xo&&"documentMode"in document&&11>=document.documentMode,Ql=null,xv=null,Sd=null,Sv=!1;function K1(o,l,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Sv||Ql==null||Ql!==Yl(g)||(g=Ql,"selectionStart"in g&&Ev(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Sd&&xd(Sd,g)||(Sd=g,g=Km(xv,"onSelect"),0<g.length&&(l=new rm("onSelect","select",null,l,p),o.push({event:l,listeners:g}),l.target=Ql)))}function Vi(o,l){var p={};return p[o.toLowerCase()]=l.toLowerCase(),p["Webkit"+o]="webkit"+l,p["Moz"+o]="moz"+l,p}var ec={animationend:Vi("Animation","AnimationEnd"),animationiteration:Vi("Animation","AnimationIteration"),animationstart:Vi("Animation","AnimationStart"),transitionrun:Vi("Transition","TransitionRun"),transitionstart:Vi("Transition","TransitionStart"),transitioncancel:Vi("Transition","TransitionCancel"),transitionend:Vi("Transition","TransitionEnd")},_v={},Y1={};Xo&&(Y1=document.createElement("div").style,"AnimationEvent"in window||(delete ec.animationend.animation,delete ec.animationiteration.animation,delete ec.animationstart.animation),"TransitionEvent"in window||delete ec.transitionend.transition);function Gi(o){if(_v[o])return _v[o];if(!ec[o])return o;var l=ec[o],p;for(p in l)if(l.hasOwnProperty(p)&&p in Y1)return _v[o]=l[p];return o}var Z1=Gi("animationend"),q1=Gi("animationiteration"),X1=Gi("animationstart"),N8=Gi("transitionrun"),k8=Gi("transitionstart"),C8=Gi("transitioncancel"),J1=Gi("transitionend"),Q1=new Map,Tv="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Tv.push("scrollEnd");function io(o,l){Q1.set(o,l),An(l,[o])}var sm=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Fa=[],tc=0,Nv=0;function im(){for(var o=tc,l=Nv=tc=0;l<o;){var p=Fa[l];Fa[l++]=null;var g=Fa[l];Fa[l++]=null;var N=Fa[l];Fa[l++]=null;var k=Fa[l];if(Fa[l++]=null,g!==null&&N!==null){var P=g.pending;P===null?N.next=N:(N.next=P.next,P.next=N),g.pending=N}k!==0&&eI(p,N,k)}}function lm(o,l,p,g){Fa[tc++]=o,Fa[tc++]=l,Fa[tc++]=p,Fa[tc++]=g,Nv|=g,o.lanes|=g,o=o.alternate,o!==null&&(o.lanes|=g)}function kv(o,l,p,g){return lm(o,l,p,g),cm(o)}function Wi(o,l){return lm(o,null,null,l),cm(o)}function eI(o,l,p){o.lanes|=p;var g=o.alternate;g!==null&&(g.lanes|=p);for(var N=!1,k=o.return;k!==null;)k.childLanes|=p,g=k.alternate,g!==null&&(g.childLanes|=p),k.tag===22&&(o=k.stateNode,o===null||o._visibility&1||(N=!0)),o=k,k=k.return;return o.tag===3?(k=o.stateNode,N&&l!==null&&(N=31-Me(p),o=k.hiddenUpdates,g=o[N],g===null?o[N]=[l]:g.push(l),l.lane=p|536870912),k):null}function cm(o){if(50<Gd)throw Gd=0,j0=null,Error(r(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}var nc={};function R8(o,l,p,g){this.tag=o,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ca(o,l,p,g){return new R8(o,l,p,g)}function Cv(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Jo(o,l){var p=o.alternate;return p===null?(p=Ca(o.tag,l,o.key,o.mode),p.elementType=o.elementType,p.type=o.type,p.stateNode=o.stateNode,p.alternate=o,o.alternate=p):(p.pendingProps=l,p.type=o.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=o.flags&65011712,p.childLanes=o.childLanes,p.lanes=o.lanes,p.child=o.child,p.memoizedProps=o.memoizedProps,p.memoizedState=o.memoizedState,p.updateQueue=o.updateQueue,l=o.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=o.sibling,p.index=o.index,p.ref=o.ref,p.refCleanup=o.refCleanup,p}function tI(o,l){o.flags&=65011714;var p=o.alternate;return p===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=p.childLanes,o.lanes=p.lanes,o.child=p.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=p.memoizedProps,o.memoizedState=p.memoizedState,o.updateQueue=p.updateQueue,o.type=p.type,l=p.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function um(o,l,p,g,N,k){var P=0;if(g=o,typeof o=="function")Cv(o)&&(P=1);else if(typeof o=="string")P=L9(o,p,L.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case j:return o=Ca(31,p,l,N),o.elementType=j,o.lanes=k,o;case E:return Ki(p.children,N,k,l);case w:P=8,N|=24;break;case _:return o=Ca(12,p,l,N|2),o.elementType=_,o.lanes=k,o;case C:return o=Ca(13,p,l,N),o.elementType=C,o.lanes=k,o;case I:return o=Ca(19,p,l,N),o.elementType=I,o.lanes=k,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case T:P=10;break e;case S:P=9;break e;case R:P=11;break e;case A:P=14;break e;case O:P=16,g=null;break e}P=29,p=Error(r(130,o===null?"null":typeof o,"")),g=null}return l=Ca(P,p,l,N),l.elementType=o,l.type=g,l.lanes=k,l}function Ki(o,l,p,g){return o=Ca(7,o,g,l),o.lanes=p,o}function Rv(o,l,p){return o=Ca(6,o,null,l),o.lanes=p,o}function nI(o){var l=Ca(18,null,null,0);return l.stateNode=o,l}function Av(o,l,p){return l=Ca(4,o.children!==null?o.children:[],o.key,l),l.lanes=p,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}var rI=new WeakMap;function Ba(o,l){if(typeof o=="object"&&o!==null){var p=rI.get(o);return p!==void 0?p:(l={value:o,source:l,stack:Ee(l)},rI.set(o,l),l)}return{value:o,source:l,stack:Ee(l)}}var rc=[],ac=0,dm=null,_d=0,Ha=[],Va=0,Fs=null,Ao=1,Io="";function Qo(o,l){rc[ac++]=_d,rc[ac++]=dm,dm=o,_d=l}function aI(o,l,p){Ha[Va++]=Ao,Ha[Va++]=Io,Ha[Va++]=Fs,Fs=o;var g=Ao;o=Io;var N=32-Me(g)-1;g&=~(1<<N),p+=1;var k=32-Me(l)+N;if(30<k){var P=N-N%5;k=(g&(1<<P)-1).toString(32),g>>=P,N-=P,Ao=1<<32-Me(l)+N|p<<N|g,Io=k+o}else Ao=1<<k|p<<N|g,Io=o}function Iv(o){o.return!==null&&(Qo(o,1),aI(o,1,0))}function Ov(o){for(;o===dm;)dm=rc[--ac],rc[ac]=null,_d=rc[--ac],rc[ac]=null;for(;o===Fs;)Fs=Ha[--Va],Ha[Va]=null,Io=Ha[--Va],Ha[Va]=null,Ao=Ha[--Va],Ha[Va]=null}function oI(o,l){Ha[Va++]=Ao,Ha[Va++]=Io,Ha[Va++]=Fs,Ao=l.id,Io=l.overflow,Fs=o}var Rr=null,In=null,qt=!1,Bs=null,Ga=!1,Dv=Error(r(519));function Hs(o){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Td(Ba(l,o)),Dv}function sI(o){var l=o.stateNode,p=o.type,g=o.memoizedProps;switch(l[ht]=o,l[Hn]=g,p){case"dialog":Ft("cancel",l),Ft("close",l);break;case"iframe":case"object":case"embed":Ft("load",l);break;case"video":case"audio":for(p=0;p<Kd.length;p++)Ft(Kd[p],l);break;case"source":Ft("error",l);break;case"img":case"image":case"link":Ft("error",l),Ft("load",l);break;case"details":Ft("toggle",l);break;case"input":Ft("invalid",l),md(l,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Ft("invalid",l);break;case"textarea":Ft("invalid",l),E1(l,g.value,g.defaultValue,g.children)}p=g.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||l.textContent===""+p||g.suppressHydrationWarning===!0||SD(l.textContent,p)?(g.popover!=null&&(Ft("beforetoggle",l),Ft("toggle",l)),g.onScroll!=null&&Ft("scroll",l),g.onScrollEnd!=null&&Ft("scrollend",l),g.onClick!=null&&(l.onclick=qo),l=!0):l=!1,l||Hs(o,!0)}function iI(o){for(Rr=o.return;Rr;)switch(Rr.tag){case 5:case 31:case 13:Ga=!1;return;case 27:case 3:Ga=!0;return;default:Rr=Rr.return}}function oc(o){if(o!==Rr)return!1;if(!qt)return iI(o),qt=!0,!1;var l=o.tag,p;if((p=l!==3&&l!==27)&&((p=l===5)&&(p=o.type,p=!(p!=="form"&&p!=="button")||X0(o.type,o.memoizedProps)),p=!p),p&&In&&Hs(o),iI(o),l===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));In=OD(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));In=OD(o)}else l===27?(l=In,ri(o.type)?(o=nw,nw=null,In=o):In=l):In=Rr?Ka(o.stateNode.nextSibling):null;return!0}function Yi(){In=Rr=null,qt=!1}function Lv(){var o=Bs;return o!==null&&(ha===null?ha=o:ha.push.apply(ha,o),Bs=null),o}function Td(o){Bs===null?Bs=[o]:Bs.push(o)}var Mv=D(null),Zi=null,es=null;function Vs(o,l,p){$(Mv,l._currentValue),l._currentValue=p}function ts(o){o._currentValue=Mv.current,H(Mv)}function jv(o,l,p){for(;o!==null;){var g=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,g!==null&&(g.childLanes|=l)):g!==null&&(g.childLanes&l)!==l&&(g.childLanes|=l),o===p)break;o=o.return}}function Pv(o,l,p,g){var N=o.child;for(N!==null&&(N.return=o);N!==null;){var k=N.dependencies;if(k!==null){var P=N.child;k=k.firstContext;e:for(;k!==null;){var Y=k;k=N;for(var oe=0;oe<l.length;oe++)if(Y.context===l[oe]){k.lanes|=p,Y=k.alternate,Y!==null&&(Y.lanes|=p),jv(k.return,p,o),g||(P=null);break e}k=Y.next}}else if(N.tag===18){if(P=N.return,P===null)throw Error(r(341));P.lanes|=p,k=P.alternate,k!==null&&(k.lanes|=p),jv(P,p,o),P=null}else P=N.child;if(P!==null)P.return=N;else for(P=N;P!==null;){if(P===o){P=null;break}if(N=P.sibling,N!==null){N.return=P.return,P=N;break}P=P.return}N=P}}function sc(o,l,p,g){o=null;for(var N=l,k=!1;N!==null;){if(!k){if((N.flags&524288)!==0)k=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var P=N.alternate;if(P===null)throw Error(r(387));if(P=P.memoizedProps,P!==null){var Y=N.type;ka(N.pendingProps.value,P.value)||(o!==null?o.push(Y):o=[Y])}}else if(N===G.current){if(P=N.alternate,P===null)throw Error(r(387));P.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(o!==null?o.push(Jd):o=[Jd])}N=N.return}o!==null&&Pv(l,o,p,g),l.flags|=262144}function fm(o){for(o=o.firstContext;o!==null;){if(!ka(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function qi(o){Zi=o,es=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Ar(o){return lI(Zi,o)}function pm(o,l){return Zi===null&&qi(o),lI(o,l)}function lI(o,l){var p=l._currentValue;if(l={context:l,memoizedValue:p,next:null},es===null){if(o===null)throw Error(r(308));es=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else es=es.next=l;return p}var A8=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(p,g){o.push(g)}};this.abort=function(){l.aborted=!0,o.forEach(function(p){return p()})}},I8=e.unstable_scheduleCallback,O8=e.unstable_NormalPriority,ar={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uv(){return{controller:new A8,data:new Map,refCount:0}}function Nd(o){o.refCount--,o.refCount===0&&I8(O8,function(){o.controller.abort()})}var kd=null,$v=0,ic=0,lc=null;function D8(o,l){if(kd===null){var p=kd=[];$v=0,ic=B0(),lc={status:"pending",value:void 0,then:function(g){p.push(g)}}}return $v++,l.then(cI,cI),l}function cI(){if(--$v===0&&kd!==null){lc!==null&&(lc.status="fulfilled");var o=kd;kd=null,ic=0,lc=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function L8(o,l){var p=[],g={status:"pending",value:null,reason:null,then:function(N){p.push(N)}};return o.then(function(){g.status="fulfilled",g.value=l;for(var N=0;N<p.length;N++)(0,p[N])(l)},function(N){for(g.status="rejected",g.reason=N,N=0;N<p.length;N++)(0,p[N])(void 0)}),g}var uI=F.S;F.S=function(o,l){KO=we(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&D8(o,l),uI!==null&&uI(o,l)};var Xi=D(null);function zv(){var o=Xi.current;return o!==null?o:_n.pooledCache}function mm(o,l){l===null?$(Xi,Xi.current):$(Xi,l.pool)}function dI(){var o=zv();return o===null?null:{parent:ar._currentValue,pool:o}}var cc=Error(r(460)),Fv=Error(r(474)),hm=Error(r(542)),gm={then:function(){}};function fI(o){return o=o.status,o==="fulfilled"||o==="rejected"}function pI(o,l,p){switch(p=o[p],p===void 0?o.push(l):p!==l&&(l.then(qo,qo),l=p),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,hI(o),o;default:if(typeof l.status=="string")l.then(qo,qo);else{if(o=_n,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=l,o.status="pending",o.then(function(g){if(l.status==="pending"){var N=l;N.status="fulfilled",N.value=g}},function(g){if(l.status==="pending"){var N=l;N.status="rejected",N.reason=g}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,hI(o),o}throw Qi=l,cc}}function Ji(o){try{var l=o._init;return l(o._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Qi=p,cc):p}}var Qi=null;function mI(){if(Qi===null)throw Error(r(459));var o=Qi;return Qi=null,o}function hI(o){if(o===cc||o===hm)throw Error(r(483))}var uc=null,Cd=0;function bm(o){var l=Cd;return Cd+=1,uc===null&&(uc=[]),pI(uc,o,l)}function Rd(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function ym(o,l){throw l.$$typeof===b?Error(r(525)):(o=Object.prototype.toString.call(l),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function gI(o){function l(pe,ue){if(o){var he=pe.deletions;he===null?(pe.deletions=[ue],pe.flags|=16):he.push(ue)}}function p(pe,ue){if(!o)return null;for(;ue!==null;)l(pe,ue),ue=ue.sibling;return null}function g(pe){for(var ue=new Map;pe!==null;)pe.key!==null?ue.set(pe.key,pe):ue.set(pe.index,pe),pe=pe.sibling;return ue}function N(pe,ue){return pe=Jo(pe,ue),pe.index=0,pe.sibling=null,pe}function k(pe,ue,he){return pe.index=he,o?(he=pe.alternate,he!==null?(he=he.index,he<ue?(pe.flags|=67108866,ue):he):(pe.flags|=67108866,ue)):(pe.flags|=1048576,ue)}function P(pe){return o&&pe.alternate===null&&(pe.flags|=67108866),pe}function Y(pe,ue,he,Ne){return ue===null||ue.tag!==6?(ue=Rv(he,pe.mode,Ne),ue.return=pe,ue):(ue=N(ue,he),ue.return=pe,ue)}function oe(pe,ue,he,Ne){var rt=he.type;return rt===E?xe(pe,ue,he.props.children,Ne,he.key):ue!==null&&(ue.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===O&&Ji(rt)===ue.type)?(ue=N(ue,he.props),Rd(ue,he),ue.return=pe,ue):(ue=um(he.type,he.key,he.props,null,pe.mode,Ne),Rd(ue,he),ue.return=pe,ue)}function ge(pe,ue,he,Ne){return ue===null||ue.tag!==4||ue.stateNode.containerInfo!==he.containerInfo||ue.stateNode.implementation!==he.implementation?(ue=Av(he,pe.mode,Ne),ue.return=pe,ue):(ue=N(ue,he.children||[]),ue.return=pe,ue)}function xe(pe,ue,he,Ne,rt){return ue===null||ue.tag!==7?(ue=Ki(he,pe.mode,Ne,rt),ue.return=pe,ue):(ue=N(ue,he),ue.return=pe,ue)}function ke(pe,ue,he){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return ue=Rv(""+ue,pe.mode,he),ue.return=pe,ue;if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:return he=um(ue.type,ue.key,ue.props,null,pe.mode,he),Rd(he,ue),he.return=pe,he;case x:return ue=Av(ue,pe.mode,he),ue.return=pe,ue;case O:return ue=Ji(ue),ke(pe,ue,he)}if(re(ue)||W(ue))return ue=Ki(ue,pe.mode,he,null),ue.return=pe,ue;if(typeof ue.then=="function")return ke(pe,bm(ue),he);if(ue.$$typeof===T)return ke(pe,pm(pe,ue),he);ym(pe,ue)}return null}function ye(pe,ue,he,Ne){var rt=ue!==null?ue.key:null;if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return rt!==null?null:Y(pe,ue,""+he,Ne);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case y:return he.key===rt?oe(pe,ue,he,Ne):null;case x:return he.key===rt?ge(pe,ue,he,Ne):null;case O:return he=Ji(he),ye(pe,ue,he,Ne)}if(re(he)||W(he))return rt!==null?null:xe(pe,ue,he,Ne,null);if(typeof he.then=="function")return ye(pe,ue,bm(he),Ne);if(he.$$typeof===T)return ye(pe,ue,pm(pe,he),Ne);ym(pe,he)}return null}function ve(pe,ue,he,Ne,rt){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint")return pe=pe.get(he)||null,Y(ue,pe,""+Ne,rt);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case y:return pe=pe.get(Ne.key===null?he:Ne.key)||null,oe(ue,pe,Ne,rt);case x:return pe=pe.get(Ne.key===null?he:Ne.key)||null,ge(ue,pe,Ne,rt);case O:return Ne=Ji(Ne),ve(pe,ue,he,Ne,rt)}if(re(Ne)||W(Ne))return pe=pe.get(he)||null,xe(ue,pe,Ne,rt,null);if(typeof Ne.then=="function")return ve(pe,ue,he,bm(Ne),rt);if(Ne.$$typeof===T)return ve(pe,ue,he,pm(ue,Ne),rt);ym(ue,Ne)}return null}function We(pe,ue,he,Ne){for(var rt=null,rn=null,Je=ue,Tt=ue=0,Gt=null;Je!==null&&Tt<he.length;Tt++){Je.index>Tt?(Gt=Je,Je=null):Gt=Je.sibling;var an=ye(pe,Je,he[Tt],Ne);if(an===null){Je===null&&(Je=Gt);break}o&&Je&&an.alternate===null&&l(pe,Je),ue=k(an,ue,Tt),rn===null?rt=an:rn.sibling=an,rn=an,Je=Gt}if(Tt===he.length)return p(pe,Je),qt&&Qo(pe,Tt),rt;if(Je===null){for(;Tt<he.length;Tt++)Je=ke(pe,he[Tt],Ne),Je!==null&&(ue=k(Je,ue,Tt),rn===null?rt=Je:rn.sibling=Je,rn=Je);return qt&&Qo(pe,Tt),rt}for(Je=g(Je);Tt<he.length;Tt++)Gt=ve(Je,pe,Tt,he[Tt],Ne),Gt!==null&&(o&&Gt.alternate!==null&&Je.delete(Gt.key===null?Tt:Gt.key),ue=k(Gt,ue,Tt),rn===null?rt=Gt:rn.sibling=Gt,rn=Gt);return o&&Je.forEach(function(li){return l(pe,li)}),qt&&Qo(pe,Tt),rt}function ct(pe,ue,he,Ne){if(he==null)throw Error(r(151));for(var rt=null,rn=null,Je=ue,Tt=ue=0,Gt=null,an=he.next();Je!==null&&!an.done;Tt++,an=he.next()){Je.index>Tt?(Gt=Je,Je=null):Gt=Je.sibling;var li=ye(pe,Je,an.value,Ne);if(li===null){Je===null&&(Je=Gt);break}o&&Je&&li.alternate===null&&l(pe,Je),ue=k(li,ue,Tt),rn===null?rt=li:rn.sibling=li,rn=li,Je=Gt}if(an.done)return p(pe,Je),qt&&Qo(pe,Tt),rt;if(Je===null){for(;!an.done;Tt++,an=he.next())an=ke(pe,an.value,Ne),an!==null&&(ue=k(an,ue,Tt),rn===null?rt=an:rn.sibling=an,rn=an);return qt&&Qo(pe,Tt),rt}for(Je=g(Je);!an.done;Tt++,an=he.next())an=ve(Je,pe,Tt,an.value,Ne),an!==null&&(o&&an.alternate!==null&&Je.delete(an.key===null?Tt:an.key),ue=k(an,ue,Tt),rn===null?rt=an:rn.sibling=an,rn=an);return o&&Je.forEach(function(G9){return l(pe,G9)}),qt&&Qo(pe,Tt),rt}function Sn(pe,ue,he,Ne){if(typeof he=="object"&&he!==null&&he.type===E&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case y:e:{for(var rt=he.key;ue!==null;){if(ue.key===rt){if(rt=he.type,rt===E){if(ue.tag===7){p(pe,ue.sibling),Ne=N(ue,he.props.children),Ne.return=pe,pe=Ne;break e}}else if(ue.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===O&&Ji(rt)===ue.type){p(pe,ue.sibling),Ne=N(ue,he.props),Rd(Ne,he),Ne.return=pe,pe=Ne;break e}p(pe,ue);break}else l(pe,ue);ue=ue.sibling}he.type===E?(Ne=Ki(he.props.children,pe.mode,Ne,he.key),Ne.return=pe,pe=Ne):(Ne=um(he.type,he.key,he.props,null,pe.mode,Ne),Rd(Ne,he),Ne.return=pe,pe=Ne)}return P(pe);case x:e:{for(rt=he.key;ue!==null;){if(ue.key===rt)if(ue.tag===4&&ue.stateNode.containerInfo===he.containerInfo&&ue.stateNode.implementation===he.implementation){p(pe,ue.sibling),Ne=N(ue,he.children||[]),Ne.return=pe,pe=Ne;break e}else{p(pe,ue);break}else l(pe,ue);ue=ue.sibling}Ne=Av(he,pe.mode,Ne),Ne.return=pe,pe=Ne}return P(pe);case O:return he=Ji(he),Sn(pe,ue,he,Ne)}if(re(he))return We(pe,ue,he,Ne);if(W(he)){if(rt=W(he),typeof rt!="function")throw Error(r(150));return he=rt.call(he),ct(pe,ue,he,Ne)}if(typeof he.then=="function")return Sn(pe,ue,bm(he),Ne);if(he.$$typeof===T)return Sn(pe,ue,pm(pe,he),Ne);ym(pe,he)}return typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint"?(he=""+he,ue!==null&&ue.tag===6?(p(pe,ue.sibling),Ne=N(ue,he),Ne.return=pe,pe=Ne):(p(pe,ue),Ne=Rv(he,pe.mode,Ne),Ne.return=pe,pe=Ne),P(pe)):p(pe,ue)}return function(pe,ue,he,Ne){try{Cd=0;var rt=Sn(pe,ue,he,Ne);return uc=null,rt}catch(Je){if(Je===cc||Je===hm)throw Je;var rn=Ca(29,Je,null,pe.mode);return rn.lanes=Ne,rn.return=pe,rn}finally{}}}var el=gI(!0),bI=gI(!1),Gs=!1;function Bv(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hv(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Ws(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ks(o,l,p){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(ln&2)!==0){var N=g.pending;return N===null?l.next=l:(l.next=N.next,N.next=l),g.pending=l,l=cm(o),eI(o,null,p),l}return lm(o,g,l,p),cm(o)}function Ad(o,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194048)!==0)){var g=l.lanes;g&=o.pendingLanes,p|=g,l.lanes=p,wn(o,p)}}function Vv(o,l){var p=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,p===g)){var N=null,k=null;if(p=p.firstBaseUpdate,p!==null){do{var P={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};k===null?N=k=P:k=k.next=P,p=p.next}while(p!==null);k===null?N=k=l:k=k.next=l}else N=k=l;p={baseState:g.baseState,firstBaseUpdate:N,lastBaseUpdate:k,shared:g.shared,callbacks:g.callbacks},o.updateQueue=p;return}o=p.lastBaseUpdate,o===null?p.firstBaseUpdate=l:o.next=l,p.lastBaseUpdate=l}var Gv=!1;function Id(){if(Gv){var o=lc;if(o!==null)throw o}}function Od(o,l,p,g){Gv=!1;var N=o.updateQueue;Gs=!1;var k=N.firstBaseUpdate,P=N.lastBaseUpdate,Y=N.shared.pending;if(Y!==null){N.shared.pending=null;var oe=Y,ge=oe.next;oe.next=null,P===null?k=ge:P.next=ge,P=oe;var xe=o.alternate;xe!==null&&(xe=xe.updateQueue,Y=xe.lastBaseUpdate,Y!==P&&(Y===null?xe.firstBaseUpdate=ge:Y.next=ge,xe.lastBaseUpdate=oe))}if(k!==null){var ke=N.baseState;P=0,xe=ge=oe=null,Y=k;do{var ye=Y.lane&-536870913,ve=ye!==Y.lane;if(ve?(Vt&ye)===ye:(g&ye)===ye){ye!==0&&ye===ic&&(Gv=!0),xe!==null&&(xe=xe.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var We=o,ct=Y;ye=l;var Sn=p;switch(ct.tag){case 1:if(We=ct.payload,typeof We=="function"){ke=We.call(Sn,ke,ye);break e}ke=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=ct.payload,ye=typeof We=="function"?We.call(Sn,ke,ye):We,ye==null)break e;ke=h({},ke,ye);break e;case 2:Gs=!0}}ye=Y.callback,ye!==null&&(o.flags|=64,ve&&(o.flags|=8192),ve=N.callbacks,ve===null?N.callbacks=[ye]:ve.push(ye))}else ve={lane:ye,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},xe===null?(ge=xe=ve,oe=ke):xe=xe.next=ve,P|=ye;if(Y=Y.next,Y===null){if(Y=N.shared.pending,Y===null)break;ve=Y,Y=ve.next,ve.next=null,N.lastBaseUpdate=ve,N.shared.pending=null}}while(!0);xe===null&&(oe=ke),N.baseState=oe,N.firstBaseUpdate=ge,N.lastBaseUpdate=xe,k===null&&(N.shared.lanes=0),Js|=P,o.lanes=P,o.memoizedState=ke}}function yI(o,l){if(typeof o!="function")throw Error(r(191,o));o.call(l)}function vI(o,l){var p=o.callbacks;if(p!==null)for(o.callbacks=null,o=0;o<p.length;o++)yI(p[o],l)}var dc=D(null),vm=D(0);function wI(o,l){o=us,$(vm,o),$(dc,l),us=o|l.baseLanes}function Wv(){$(vm,us),$(dc,dc.current)}function Kv(){us=vm.current,H(dc),H(vm)}var Ra=D(null),Wa=null;function Ys(o){var l=o.alternate;$(Qn,Qn.current&1),$(Ra,o),Wa===null&&(l===null||dc.current!==null||l.memoizedState!==null)&&(Wa=o)}function Yv(o){$(Qn,Qn.current),$(Ra,o),Wa===null&&(Wa=o)}function EI(o){o.tag===22?($(Qn,Qn.current),$(Ra,o),Wa===null&&(Wa=o)):Zs()}function Zs(){$(Qn,Qn.current),$(Ra,Ra.current)}function Aa(o){H(Ra),Wa===o&&(Wa=null),H(Qn)}var Qn=D(0);function wm(o){for(var l=o;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||ew(p)||tw(p)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var ns=0,St=null,En=null,or=null,Em=!1,fc=!1,tl=!1,xm=0,Dd=0,pc=null,M8=0;function Kn(){throw Error(r(321))}function Zv(o,l){if(l===null)return!1;for(var p=0;p<l.length&&p<o.length;p++)if(!ka(o[p],l[p]))return!1;return!0}function qv(o,l,p,g,N,k){return ns=k,St=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,F.H=o===null||o.memoizedState===null?aO:d0,tl=!1,k=p(g,N),tl=!1,fc&&(k=SI(l,p,g,N)),xI(o),k}function xI(o){F.H=jd;var l=En!==null&&En.next!==null;if(ns=0,or=En=St=null,Em=!1,Dd=0,pc=null,l)throw Error(r(300));o===null||sr||(o=o.dependencies,o!==null&&fm(o)&&(sr=!0))}function SI(o,l,p,g){St=o;var N=0;do{if(fc&&(pc=null),Dd=0,fc=!1,25<=N)throw Error(r(301));if(N+=1,or=En=null,o.updateQueue!=null){var k=o.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}F.H=oO,k=l(p,g)}while(fc);return k}function j8(){var o=F.H,l=o.useState()[0];return l=typeof l.then=="function"?Ld(l):l,o=o.useState()[0],(En!==null?En.memoizedState:null)!==o&&(St.flags|=1024),l}function Xv(){var o=xm!==0;return xm=0,o}function Jv(o,l,p){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~p}function Qv(o){if(Em){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}Em=!1}ns=0,or=En=St=null,fc=!1,Dd=xm=0,pc=null}function ta(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return or===null?St.memoizedState=or=o:or=or.next=o,or}function er(){if(En===null){var o=St.alternate;o=o!==null?o.memoizedState:null}else o=En.next;var l=or===null?St.memoizedState:or.next;if(l!==null)or=l,En=o;else{if(o===null)throw St.alternate===null?Error(r(467)):Error(r(310));En=o,o={memoizedState:En.memoizedState,baseState:En.baseState,baseQueue:En.baseQueue,queue:En.queue,next:null},or===null?St.memoizedState=or=o:or=or.next=o}return or}function Sm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ld(o){var l=Dd;return Dd+=1,pc===null&&(pc=[]),o=pI(pc,o,l),l=St,(or===null?l.memoizedState:or.next)===null&&(l=l.alternate,F.H=l===null||l.memoizedState===null?aO:d0),o}function _m(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Ld(o);if(o.$$typeof===T)return Ar(o)}throw Error(r(438,String(o)))}function e0(o){var l=null,p=St.updateQueue;if(p!==null&&(l=p.memoCache),l==null){var g=St.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(l={data:g.data.map(function(N){return N.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),p===null&&(p=Sm(),St.updateQueue=p),p.memoCache=l,p=l.data[l.index],p===void 0)for(p=l.data[l.index]=Array(o),g=0;g<o;g++)p[g]=U;return l.index++,p}function rs(o,l){return typeof l=="function"?l(o):l}function Tm(o){var l=er();return t0(l,En,o)}function t0(o,l,p){var g=o.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=p;var N=o.baseQueue,k=g.pending;if(k!==null){if(N!==null){var P=N.next;N.next=k.next,k.next=P}l.baseQueue=N=k,g.pending=null}if(k=o.baseState,N===null)o.memoizedState=k;else{l=N.next;var Y=P=null,oe=null,ge=l,xe=!1;do{var ke=ge.lane&-536870913;if(ke!==ge.lane?(Vt&ke)===ke:(ns&ke)===ke){var ye=ge.revertLane;if(ye===0)oe!==null&&(oe=oe.next={lane:0,revertLane:0,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),ke===ic&&(xe=!0);else if((ns&ye)===ye){ge=ge.next,ye===ic&&(xe=!0);continue}else ke={lane:0,revertLane:ge.revertLane,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},oe===null?(Y=oe=ke,P=k):oe=oe.next=ke,St.lanes|=ye,Js|=ye;ke=ge.action,tl&&p(k,ke),k=ge.hasEagerState?ge.eagerState:p(k,ke)}else ye={lane:ke,revertLane:ge.revertLane,gesture:ge.gesture,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},oe===null?(Y=oe=ye,P=k):oe=oe.next=ye,St.lanes|=ke,Js|=ke;ge=ge.next}while(ge!==null&&ge!==l);if(oe===null?P=k:oe.next=Y,!ka(k,o.memoizedState)&&(sr=!0,xe&&(p=lc,p!==null)))throw p;o.memoizedState=k,o.baseState=P,o.baseQueue=oe,g.lastRenderedState=k}return N===null&&(g.lanes=0),[o.memoizedState,g.dispatch]}function n0(o){var l=er(),p=l.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=o;var g=p.dispatch,N=p.pending,k=l.memoizedState;if(N!==null){p.pending=null;var P=N=N.next;do k=o(k,P.action),P=P.next;while(P!==N);ka(k,l.memoizedState)||(sr=!0),l.memoizedState=k,l.baseQueue===null&&(l.baseState=k),p.lastRenderedState=k}return[k,g]}function _I(o,l,p){var g=St,N=er(),k=qt;if(k){if(p===void 0)throw Error(r(407));p=p()}else p=l();var P=!ka((En||N).memoizedState,p);if(P&&(N.memoizedState=p,sr=!0),N=N.queue,o0(kI.bind(null,g,N,o),[o]),N.getSnapshot!==l||P||or!==null&&or.memoizedState.tag&1){if(g.flags|=2048,mc(9,{destroy:void 0},NI.bind(null,g,N,p,l),null),_n===null)throw Error(r(349));k||(ns&127)!==0||TI(g,l,p)}return p}function TI(o,l,p){o.flags|=16384,o={getSnapshot:l,value:p},l=St.updateQueue,l===null?(l=Sm(),St.updateQueue=l,l.stores=[o]):(p=l.stores,p===null?l.stores=[o]:p.push(o))}function NI(o,l,p,g){l.value=p,l.getSnapshot=g,CI(l)&&RI(o)}function kI(o,l,p){return p(function(){CI(l)&&RI(o)})}function CI(o){var l=o.getSnapshot;o=o.value;try{var p=l();return!ka(o,p)}catch{return!0}}function RI(o){var l=Wi(o,2);l!==null&&ga(l,o,2)}function r0(o){var l=ta();if(typeof o=="function"){var p=o;if(o=p(),tl){Ie(!0);try{p()}finally{Ie(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:o},l}function AI(o,l,p,g){return o.baseState=p,t0(o,En,typeof g=="function"?g:rs)}function P8(o,l,p,g,N){if(Cm(o))throw Error(r(485));if(o=l.action,o!==null){var k={payload:N,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(P){k.listeners.push(P)}};F.T!==null?p(!0):k.isTransition=!1,g(k),p=l.pending,p===null?(k.next=l.pending=k,II(l,k)):(k.next=p.next,l.pending=p.next=k)}}function II(o,l){var p=l.action,g=l.payload,N=o.state;if(l.isTransition){var k=F.T,P={};F.T=P;try{var Y=p(N,g),oe=F.S;oe!==null&&oe(P,Y),OI(o,l,Y)}catch(ge){a0(o,l,ge)}finally{k!==null&&P.types!==null&&(k.types=P.types),F.T=k}}else try{k=p(N,g),OI(o,l,k)}catch(ge){a0(o,l,ge)}}function OI(o,l,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(g){DI(o,l,g)},function(g){return a0(o,l,g)}):DI(o,l,p)}function DI(o,l,p){l.status="fulfilled",l.value=p,LI(l),o.state=p,l=o.pending,l!==null&&(p=l.next,p===l?o.pending=null:(p=p.next,l.next=p,II(o,p)))}function a0(o,l,p){var g=o.pending;if(o.pending=null,g!==null){g=g.next;do l.status="rejected",l.reason=p,LI(l),l=l.next;while(l!==g)}o.action=null}function LI(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function MI(o,l){return l}function jI(o,l){if(qt){var p=_n.formState;if(p!==null){e:{var g=St;if(qt){if(In){t:{for(var N=In,k=Ga;N.nodeType!==8;){if(!k){N=null;break t}if(N=Ka(N.nextSibling),N===null){N=null;break t}}k=N.data,N=k==="F!"||k==="F"?N:null}if(N){In=Ka(N.nextSibling),g=N.data==="F!";break e}}Hs(g)}g=!1}g&&(l=p[0])}}return p=ta(),p.memoizedState=p.baseState=l,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:MI,lastRenderedState:l},p.queue=g,p=tO.bind(null,St,g),g.dispatch=p,g=r0(!1),k=u0.bind(null,St,!1,g.queue),g=ta(),N={state:l,dispatch:null,action:o,pending:null},g.queue=N,p=P8.bind(null,St,N,k,p),N.dispatch=p,g.memoizedState=o,[l,p,!1]}function PI(o){var l=er();return UI(l,En,o)}function UI(o,l,p){if(l=t0(o,l,MI)[0],o=Tm(rs)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var g=Ld(l)}catch(P){throw P===cc?hm:P}else g=l;l=er();var N=l.queue,k=N.dispatch;return p!==l.memoizedState&&(St.flags|=2048,mc(9,{destroy:void 0},U8.bind(null,N,p),null)),[g,k,o]}function U8(o,l){o.action=l}function $I(o){var l=er(),p=En;if(p!==null)return UI(l,p,o);er(),l=l.memoizedState,p=er();var g=p.queue.dispatch;return p.memoizedState=o,[l,g,!1]}function mc(o,l,p,g){return o={tag:o,create:p,deps:g,inst:l,next:null},l=St.updateQueue,l===null&&(l=Sm(),St.updateQueue=l),p=l.lastEffect,p===null?l.lastEffect=o.next=o:(g=p.next,p.next=o,o.next=g,l.lastEffect=o),o}function zI(){return er().memoizedState}function Nm(o,l,p,g){var N=ta();St.flags|=o,N.memoizedState=mc(1|l,{destroy:void 0},p,g===void 0?null:g)}function km(o,l,p,g){var N=er();g=g===void 0?null:g;var k=N.memoizedState.inst;En!==null&&g!==null&&Zv(g,En.memoizedState.deps)?N.memoizedState=mc(l,k,p,g):(St.flags|=o,N.memoizedState=mc(1|l,k,p,g))}function FI(o,l){Nm(8390656,8,o,l)}function o0(o,l){km(2048,8,o,l)}function $8(o){St.flags|=4;var l=St.updateQueue;if(l===null)l=Sm(),St.updateQueue=l,l.events=[o];else{var p=l.events;p===null?l.events=[o]:p.push(o)}}function BI(o){var l=er().memoizedState;return $8({ref:l,nextImpl:o}),function(){if((ln&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function HI(o,l){return km(4,2,o,l)}function VI(o,l){return km(4,4,o,l)}function GI(o,l){if(typeof l=="function"){o=o();var p=l(o);return function(){typeof p=="function"?p():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function WI(o,l,p){p=p!=null?p.concat([o]):null,km(4,4,GI.bind(null,l,o),p)}function s0(){}function KI(o,l){var p=er();l=l===void 0?null:l;var g=p.memoizedState;return l!==null&&Zv(l,g[1])?g[0]:(p.memoizedState=[o,l],o)}function YI(o,l){var p=er();l=l===void 0?null:l;var g=p.memoizedState;if(l!==null&&Zv(l,g[1]))return g[0];if(g=o(),tl){Ie(!0);try{o()}finally{Ie(!1)}}return p.memoizedState=[g,l],g}function i0(o,l,p){return p===void 0||(ns&1073741824)!==0&&(Vt&261930)===0?o.memoizedState=l:(o.memoizedState=p,o=ZO(),St.lanes|=o,Js|=o,p)}function ZI(o,l,p,g){return ka(p,l)?p:dc.current!==null?(o=i0(o,p,g),ka(o,l)||(sr=!0),o):(ns&42)===0||(ns&1073741824)!==0&&(Vt&261930)===0?(sr=!0,o.memoizedState=p):(o=ZO(),St.lanes|=o,Js|=o,l)}function qI(o,l,p,g,N){var k=K.p;K.p=k!==0&&8>k?k:8;var P=F.T,Y={};F.T=Y,u0(o,!1,l,p);try{var oe=N(),ge=F.S;if(ge!==null&&ge(Y,oe),oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var xe=L8(oe,g);Md(o,l,xe,Da(o))}else Md(o,l,g,Da(o))}catch(ke){Md(o,l,{then:function(){},status:"rejected",reason:ke},Da())}finally{K.p=k,P!==null&&Y.types!==null&&(P.types=Y.types),F.T=P}}function z8(){}function l0(o,l,p,g){if(o.tag!==5)throw Error(r(476));var N=XI(o).queue;qI(o,N,l,V,p===null?z8:function(){return JI(o),p(g)})}function XI(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:V},next:null};var p={};return l.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:p},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function JI(o){var l=XI(o);l.next===null&&(l=o.alternate.memoizedState),Md(o,l.next.queue,{},Da())}function c0(){return Ar(Jd)}function QI(){return er().memoizedState}function eO(){return er().memoizedState}function F8(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var p=Da();o=Ws(p);var g=Ks(l,o,p);g!==null&&(ga(g,l,p),Ad(g,l,p)),l={cache:Uv()},o.payload=l;return}l=l.return}}function B8(o,l,p){var g=Da();p={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Cm(o)?nO(l,p):(p=kv(o,l,p,g),p!==null&&(ga(p,o,g),rO(p,l,g)))}function tO(o,l,p){var g=Da();Md(o,l,p,g)}function Md(o,l,p,g){var N={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(Cm(o))nO(l,N);else{var k=o.alternate;if(o.lanes===0&&(k===null||k.lanes===0)&&(k=l.lastRenderedReducer,k!==null))try{var P=l.lastRenderedState,Y=k(P,p);if(N.hasEagerState=!0,N.eagerState=Y,ka(Y,P))return lm(o,l,N,0),_n===null&&im(),!1}catch{}finally{}if(p=kv(o,l,N,g),p!==null)return ga(p,o,g),rO(p,l,g),!0}return!1}function u0(o,l,p,g){if(g={lane:2,revertLane:B0(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Cm(o)){if(l)throw Error(r(479))}else l=kv(o,p,g,2),l!==null&&ga(l,o,2)}function Cm(o){var l=o.alternate;return o===St||l!==null&&l===St}function nO(o,l){fc=Em=!0;var p=o.pending;p===null?l.next=l:(l.next=p.next,p.next=l),o.pending=l}function rO(o,l,p){if((p&4194048)!==0){var g=l.lanes;g&=o.pendingLanes,p|=g,l.lanes=p,wn(o,p)}}var jd={readContext:Ar,use:_m,useCallback:Kn,useContext:Kn,useEffect:Kn,useImperativeHandle:Kn,useLayoutEffect:Kn,useInsertionEffect:Kn,useMemo:Kn,useReducer:Kn,useRef:Kn,useState:Kn,useDebugValue:Kn,useDeferredValue:Kn,useTransition:Kn,useSyncExternalStore:Kn,useId:Kn,useHostTransitionStatus:Kn,useFormState:Kn,useActionState:Kn,useOptimistic:Kn,useMemoCache:Kn,useCacheRefresh:Kn};jd.useEffectEvent=Kn;var aO={readContext:Ar,use:_m,useCallback:function(o,l){return ta().memoizedState=[o,l===void 0?null:l],o},useContext:Ar,useEffect:FI,useImperativeHandle:function(o,l,p){p=p!=null?p.concat([o]):null,Nm(4194308,4,GI.bind(null,l,o),p)},useLayoutEffect:function(o,l){return Nm(4194308,4,o,l)},useInsertionEffect:function(o,l){Nm(4,2,o,l)},useMemo:function(o,l){var p=ta();l=l===void 0?null:l;var g=o();if(tl){Ie(!0);try{o()}finally{Ie(!1)}}return p.memoizedState=[g,l],g},useReducer:function(o,l,p){var g=ta();if(p!==void 0){var N=p(l);if(tl){Ie(!0);try{p(l)}finally{Ie(!1)}}}else N=l;return g.memoizedState=g.baseState=N,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:N},g.queue=o,o=o.dispatch=B8.bind(null,St,o),[g.memoizedState,o]},useRef:function(o){var l=ta();return o={current:o},l.memoizedState=o},useState:function(o){o=r0(o);var l=o.queue,p=tO.bind(null,St,l);return l.dispatch=p,[o.memoizedState,p]},useDebugValue:s0,useDeferredValue:function(o,l){var p=ta();return i0(p,o,l)},useTransition:function(){var o=r0(!1);return o=qI.bind(null,St,o.queue,!0,!1),ta().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,p){var g=St,N=ta();if(qt){if(p===void 0)throw Error(r(407));p=p()}else{if(p=l(),_n===null)throw Error(r(349));(Vt&127)!==0||TI(g,l,p)}N.memoizedState=p;var k={value:p,getSnapshot:l};return N.queue=k,FI(kI.bind(null,g,k,o),[o]),g.flags|=2048,mc(9,{destroy:void 0},NI.bind(null,g,k,p,l),null),p},useId:function(){var o=ta(),l=_n.identifierPrefix;if(qt){var p=Io,g=Ao;p=(g&~(1<<32-Me(g)-1)).toString(32)+p,l="_"+l+"R_"+p,p=xm++,0<p&&(l+="H"+p.toString(32)),l+="_"}else p=M8++,l="_"+l+"r_"+p.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:c0,useFormState:jI,useActionState:jI,useOptimistic:function(o){var l=ta();l.memoizedState=l.baseState=o;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=p,l=u0.bind(null,St,!0,p),p.dispatch=l,[o,l]},useMemoCache:e0,useCacheRefresh:function(){return ta().memoizedState=F8.bind(null,St)},useEffectEvent:function(o){var l=ta(),p={impl:o};return l.memoizedState=p,function(){if((ln&2)!==0)throw Error(r(440));return p.impl.apply(void 0,arguments)}}},d0={readContext:Ar,use:_m,useCallback:KI,useContext:Ar,useEffect:o0,useImperativeHandle:WI,useInsertionEffect:HI,useLayoutEffect:VI,useMemo:YI,useReducer:Tm,useRef:zI,useState:function(){return Tm(rs)},useDebugValue:s0,useDeferredValue:function(o,l){var p=er();return ZI(p,En.memoizedState,o,l)},useTransition:function(){var o=Tm(rs)[0],l=er().memoizedState;return[typeof o=="boolean"?o:Ld(o),l]},useSyncExternalStore:_I,useId:QI,useHostTransitionStatus:c0,useFormState:PI,useActionState:PI,useOptimistic:function(o,l){var p=er();return AI(p,En,o,l)},useMemoCache:e0,useCacheRefresh:eO};d0.useEffectEvent=BI;var oO={readContext:Ar,use:_m,useCallback:KI,useContext:Ar,useEffect:o0,useImperativeHandle:WI,useInsertionEffect:HI,useLayoutEffect:VI,useMemo:YI,useReducer:n0,useRef:zI,useState:function(){return n0(rs)},useDebugValue:s0,useDeferredValue:function(o,l){var p=er();return En===null?i0(p,o,l):ZI(p,En.memoizedState,o,l)},useTransition:function(){var o=n0(rs)[0],l=er().memoizedState;return[typeof o=="boolean"?o:Ld(o),l]},useSyncExternalStore:_I,useId:QI,useHostTransitionStatus:c0,useFormState:$I,useActionState:$I,useOptimistic:function(o,l){var p=er();return En!==null?AI(p,En,o,l):(p.baseState=o,[o,p.queue.dispatch])},useMemoCache:e0,useCacheRefresh:eO};oO.useEffectEvent=BI;function f0(o,l,p,g){l=o.memoizedState,p=p(g,l),p=p==null?l:h({},l,p),o.memoizedState=p,o.lanes===0&&(o.updateQueue.baseState=p)}var p0={enqueueSetState:function(o,l,p){o=o._reactInternals;var g=Da(),N=Ws(g);N.payload=l,p!=null&&(N.callback=p),l=Ks(o,N,g),l!==null&&(ga(l,o,g),Ad(l,o,g))},enqueueReplaceState:function(o,l,p){o=o._reactInternals;var g=Da(),N=Ws(g);N.tag=1,N.payload=l,p!=null&&(N.callback=p),l=Ks(o,N,g),l!==null&&(ga(l,o,g),Ad(l,o,g))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var p=Da(),g=Ws(p);g.tag=2,l!=null&&(g.callback=l),l=Ks(o,g,p),l!==null&&(ga(l,o,p),Ad(l,o,p))}};function sO(o,l,p,g,N,k,P){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(g,k,P):l.prototype&&l.prototype.isPureReactComponent?!xd(p,g)||!xd(N,k):!0}function iO(o,l,p,g){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,g),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,g),l.state!==o&&p0.enqueueReplaceState(l,l.state,null)}function nl(o,l){var p=l;if("ref"in l){p={};for(var g in l)g!=="ref"&&(p[g]=l[g])}if(o=o.defaultProps){p===l&&(p=h({},p));for(var N in o)p[N]===void 0&&(p[N]=o[N])}return p}function lO(o){sm(o)}function cO(o){console.error(o)}function uO(o){sm(o)}function Rm(o,l){try{var p=o.onUncaughtError;p(l.value,{componentStack:l.stack})}catch(g){setTimeout(function(){throw g})}}function dO(o,l,p){try{var g=o.onCaughtError;g(p.value,{componentStack:p.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function m0(o,l,p){return p=Ws(p),p.tag=3,p.payload={element:null},p.callback=function(){Rm(o,l)},p}function fO(o){return o=Ws(o),o.tag=3,o}function pO(o,l,p,g){var N=p.type.getDerivedStateFromError;if(typeof N=="function"){var k=g.value;o.payload=function(){return N(k)},o.callback=function(){dO(l,p,g)}}var P=p.stateNode;P!==null&&typeof P.componentDidCatch=="function"&&(o.callback=function(){dO(l,p,g),typeof N!="function"&&(Qs===null?Qs=new Set([this]):Qs.add(this));var Y=g.stack;this.componentDidCatch(g.value,{componentStack:Y!==null?Y:""})})}function H8(o,l,p,g,N){if(p.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(l=p.alternate,l!==null&&sc(l,p,N,!0),p=Ra.current,p!==null){switch(p.tag){case 31:case 13:return Wa===null?Fm():p.alternate===null&&Yn===0&&(Yn=3),p.flags&=-257,p.flags|=65536,p.lanes=N,g===gm?p.flags|=16384:(l=p.updateQueue,l===null?p.updateQueue=new Set([g]):l.add(g),$0(o,g,N)),!1;case 22:return p.flags|=65536,g===gm?p.flags|=16384:(l=p.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([g])},p.updateQueue=l):(p=l.retryQueue,p===null?l.retryQueue=new Set([g]):p.add(g)),$0(o,g,N)),!1}throw Error(r(435,p.tag))}return $0(o,g,N),Fm(),!1}if(qt)return l=Ra.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=N,g!==Dv&&(o=Error(r(422),{cause:g}),Td(Ba(o,p)))):(g!==Dv&&(l=Error(r(423),{cause:g}),Td(Ba(l,p))),o=o.current.alternate,o.flags|=65536,N&=-N,o.lanes|=N,g=Ba(g,p),N=m0(o.stateNode,g,N),Vv(o,N),Yn!==4&&(Yn=2)),!1;var k=Error(r(520),{cause:g});if(k=Ba(k,p),Vd===null?Vd=[k]:Vd.push(k),Yn!==4&&(Yn=2),l===null)return!0;g=Ba(g,p),p=l;do{switch(p.tag){case 3:return p.flags|=65536,o=N&-N,p.lanes|=o,o=m0(p.stateNode,g,o),Vv(p,o),!1;case 1:if(l=p.type,k=p.stateNode,(p.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Qs===null||!Qs.has(k))))return p.flags|=65536,N&=-N,p.lanes|=N,N=fO(N),pO(N,o,p,g),Vv(p,N),!1}p=p.return}while(p!==null);return!1}var h0=Error(r(461)),sr=!1;function Ir(o,l,p,g){l.child=o===null?bI(l,null,p,g):el(l,o.child,p,g)}function mO(o,l,p,g,N){p=p.render;var k=l.ref;if("ref"in g){var P={};for(var Y in g)Y!=="ref"&&(P[Y]=g[Y])}else P=g;return qi(l),g=qv(o,l,p,P,k,N),Y=Xv(),o!==null&&!sr?(Jv(o,l,N),as(o,l,N)):(qt&&Y&&Iv(l),l.flags|=1,Ir(o,l,g,N),l.child)}function hO(o,l,p,g,N){if(o===null){var k=p.type;return typeof k=="function"&&!Cv(k)&&k.defaultProps===void 0&&p.compare===null?(l.tag=15,l.type=k,gO(o,l,k,g,N)):(o=um(p.type,null,g,l,l.mode,N),o.ref=l.ref,o.return=l,l.child=o)}if(k=o.child,!S0(o,N)){var P=k.memoizedProps;if(p=p.compare,p=p!==null?p:xd,p(P,g)&&o.ref===l.ref)return as(o,l,N)}return l.flags|=1,o=Jo(k,g),o.ref=l.ref,o.return=l,l.child=o}function gO(o,l,p,g,N){if(o!==null){var k=o.memoizedProps;if(xd(k,g)&&o.ref===l.ref)if(sr=!1,l.pendingProps=g=k,S0(o,N))(o.flags&131072)!==0&&(sr=!0);else return l.lanes=o.lanes,as(o,l,N)}return g0(o,l,p,g,N)}function bO(o,l,p,g){var N=g.children,k=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((l.flags&128)!==0){if(k=k!==null?k.baseLanes|p:p,o!==null){for(g=l.child=o.child,N=0;g!==null;)N=N|g.lanes|g.childLanes,g=g.sibling;g=N&~k}else g=0,l.child=null;return yO(o,l,k,p,g)}if((p&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&mm(l,k!==null?k.cachePool:null),k!==null?wI(l,k):Wv(),EI(l);else return g=l.lanes=536870912,yO(o,l,k!==null?k.baseLanes|p:p,p,g)}else k!==null?(mm(l,k.cachePool),wI(l,k),Zs(),l.memoizedState=null):(o!==null&&mm(l,null),Wv(),Zs());return Ir(o,l,N,p),l.child}function Pd(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function yO(o,l,p,g,N){var k=zv();return k=k===null?null:{parent:ar._currentValue,pool:k},l.memoizedState={baseLanes:p,cachePool:k},o!==null&&mm(l,null),Wv(),EI(l),o!==null&&sc(o,l,g,!0),l.childLanes=N,null}function Am(o,l){return l=Om({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function vO(o,l,p){return el(l,o.child,null,p),o=Am(l,l.pendingProps),o.flags|=2,Aa(l),l.memoizedState=null,o}function V8(o,l,p){var g=l.pendingProps,N=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(qt){if(g.mode==="hidden")return o=Am(l,g),l.lanes=536870912,Pd(null,o);if(Yv(l),(o=In)?(o=ID(o,Ga),o=o!==null&&o.data==="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Fs!==null?{id:Ao,overflow:Io}:null,retryLane:536870912,hydrationErrors:null},p=nI(o),p.return=l,l.child=p,Rr=l,In=null)):o=null,o===null)throw Hs(l);return l.lanes=536870912,null}return Am(l,g)}var k=o.memoizedState;if(k!==null){var P=k.dehydrated;if(Yv(l),N)if(l.flags&256)l.flags&=-257,l=vO(o,l,p);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(r(558));else if(sr||sc(o,l,p,!1),N=(p&o.childLanes)!==0,sr||N){if(g=_n,g!==null&&(P=fn(g,p),P!==0&&P!==k.retryLane))throw k.retryLane=P,Wi(o,P),ga(g,o,P),h0;Fm(),l=vO(o,l,p)}else o=k.treeContext,In=Ka(P.nextSibling),Rr=l,qt=!0,Bs=null,Ga=!1,o!==null&&oI(l,o),l=Am(l,g),l.flags|=4096;return l}return o=Jo(o.child,{mode:g.mode,children:g.children}),o.ref=l.ref,l.child=o,o.return=l,o}function Im(o,l){var p=l.ref;if(p===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(r(284));(o===null||o.ref!==p)&&(l.flags|=4194816)}}function g0(o,l,p,g,N){return qi(l),p=qv(o,l,p,g,void 0,N),g=Xv(),o!==null&&!sr?(Jv(o,l,N),as(o,l,N)):(qt&&g&&Iv(l),l.flags|=1,Ir(o,l,p,N),l.child)}function wO(o,l,p,g,N,k){return qi(l),l.updateQueue=null,p=SI(l,g,p,N),xI(o),g=Xv(),o!==null&&!sr?(Jv(o,l,k),as(o,l,k)):(qt&&g&&Iv(l),l.flags|=1,Ir(o,l,p,k),l.child)}function EO(o,l,p,g,N){if(qi(l),l.stateNode===null){var k=nc,P=p.contextType;typeof P=="object"&&P!==null&&(k=Ar(P)),k=new p(g,k),l.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=p0,l.stateNode=k,k._reactInternals=l,k=l.stateNode,k.props=g,k.state=l.memoizedState,k.refs={},Bv(l),P=p.contextType,k.context=typeof P=="object"&&P!==null?Ar(P):nc,k.state=l.memoizedState,P=p.getDerivedStateFromProps,typeof P=="function"&&(f0(l,p,P,g),k.state=l.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(P=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),P!==k.state&&p0.enqueueReplaceState(k,k.state,null),Od(l,g,k,N),Id(),k.state=l.memoizedState),typeof k.componentDidMount=="function"&&(l.flags|=4194308),g=!0}else if(o===null){k=l.stateNode;var Y=l.memoizedProps,oe=nl(p,Y);k.props=oe;var ge=k.context,xe=p.contextType;P=nc,typeof xe=="object"&&xe!==null&&(P=Ar(xe));var ke=p.getDerivedStateFromProps;xe=typeof ke=="function"||typeof k.getSnapshotBeforeUpdate=="function",Y=l.pendingProps!==Y,xe||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(Y||ge!==P)&&iO(l,k,g,P),Gs=!1;var ye=l.memoizedState;k.state=ye,Od(l,g,k,N),Id(),ge=l.memoizedState,Y||ye!==ge||Gs?(typeof ke=="function"&&(f0(l,p,ke,g),ge=l.memoizedState),(oe=Gs||sO(l,p,oe,g,ye,ge,P))?(xe||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(l.flags|=4194308)):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=g,l.memoizedState=ge),k.props=g,k.state=ge,k.context=P,g=oe):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),g=!1)}else{k=l.stateNode,Hv(o,l),P=l.memoizedProps,xe=nl(p,P),k.props=xe,ke=l.pendingProps,ye=k.context,ge=p.contextType,oe=nc,typeof ge=="object"&&ge!==null&&(oe=Ar(ge)),Y=p.getDerivedStateFromProps,(ge=typeof Y=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(P!==ke||ye!==oe)&&iO(l,k,g,oe),Gs=!1,ye=l.memoizedState,k.state=ye,Od(l,g,k,N),Id();var ve=l.memoizedState;P!==ke||ye!==ve||Gs||o!==null&&o.dependencies!==null&&fm(o.dependencies)?(typeof Y=="function"&&(f0(l,p,Y,g),ve=l.memoizedState),(xe=Gs||sO(l,p,xe,g,ye,ve,oe)||o!==null&&o.dependencies!==null&&fm(o.dependencies))?(ge||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(g,ve,oe),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(g,ve,oe)),typeof k.componentDidUpdate=="function"&&(l.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof k.componentDidUpdate!="function"||P===o.memoizedProps&&ye===o.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||P===o.memoizedProps&&ye===o.memoizedState||(l.flags|=1024),l.memoizedProps=g,l.memoizedState=ve),k.props=g,k.state=ve,k.context=oe,g=xe):(typeof k.componentDidUpdate!="function"||P===o.memoizedProps&&ye===o.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||P===o.memoizedProps&&ye===o.memoizedState||(l.flags|=1024),g=!1)}return k=g,Im(o,l),g=(l.flags&128)!==0,k||g?(k=l.stateNode,p=g&&typeof p.getDerivedStateFromError!="function"?null:k.render(),l.flags|=1,o!==null&&g?(l.child=el(l,o.child,null,N),l.child=el(l,null,p,N)):Ir(o,l,p,N),l.memoizedState=k.state,o=l.child):o=as(o,l,N),o}function xO(o,l,p,g){return Yi(),l.flags|=256,Ir(o,l,p,g),l.child}var b0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function y0(o){return{baseLanes:o,cachePool:dI()}}function v0(o,l,p){return o=o!==null?o.childLanes&~p:0,l&&(o|=Oa),o}function SO(o,l,p){var g=l.pendingProps,N=!1,k=(l.flags&128)!==0,P;if((P=k)||(P=o!==null&&o.memoizedState===null?!1:(Qn.current&2)!==0),P&&(N=!0,l.flags&=-129),P=(l.flags&32)!==0,l.flags&=-33,o===null){if(qt){if(N?Ys(l):Zs(),(o=In)?(o=ID(o,Ga),o=o!==null&&o.data!=="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Fs!==null?{id:Ao,overflow:Io}:null,retryLane:536870912,hydrationErrors:null},p=nI(o),p.return=l,l.child=p,Rr=l,In=null)):o=null,o===null)throw Hs(l);return tw(o)?l.lanes=32:l.lanes=536870912,null}var Y=g.children;return g=g.fallback,N?(Zs(),N=l.mode,Y=Om({mode:"hidden",children:Y},N),g=Ki(g,N,p,null),Y.return=l,g.return=l,Y.sibling=g,l.child=Y,g=l.child,g.memoizedState=y0(p),g.childLanes=v0(o,P,p),l.memoizedState=b0,Pd(null,g)):(Ys(l),w0(l,Y))}var oe=o.memoizedState;if(oe!==null&&(Y=oe.dehydrated,Y!==null)){if(k)l.flags&256?(Ys(l),l.flags&=-257,l=E0(o,l,p)):l.memoizedState!==null?(Zs(),l.child=o.child,l.flags|=128,l=null):(Zs(),Y=g.fallback,N=l.mode,g=Om({mode:"visible",children:g.children},N),Y=Ki(Y,N,p,null),Y.flags|=2,g.return=l,Y.return=l,g.sibling=Y,l.child=g,el(l,o.child,null,p),g=l.child,g.memoizedState=y0(p),g.childLanes=v0(o,P,p),l.memoizedState=b0,l=Pd(null,g));else if(Ys(l),tw(Y)){if(P=Y.nextSibling&&Y.nextSibling.dataset,P)var ge=P.dgst;P=ge,g=Error(r(419)),g.stack="",g.digest=P,Td({value:g,source:null,stack:null}),l=E0(o,l,p)}else if(sr||sc(o,l,p,!1),P=(p&o.childLanes)!==0,sr||P){if(P=_n,P!==null&&(g=fn(P,p),g!==0&&g!==oe.retryLane))throw oe.retryLane=g,Wi(o,g),ga(P,o,g),h0;ew(Y)||Fm(),l=E0(o,l,p)}else ew(Y)?(l.flags|=192,l.child=o.child,l=null):(o=oe.treeContext,In=Ka(Y.nextSibling),Rr=l,qt=!0,Bs=null,Ga=!1,o!==null&&oI(l,o),l=w0(l,g.children),l.flags|=4096);return l}return N?(Zs(),Y=g.fallback,N=l.mode,oe=o.child,ge=oe.sibling,g=Jo(oe,{mode:"hidden",children:g.children}),g.subtreeFlags=oe.subtreeFlags&65011712,ge!==null?Y=Jo(ge,Y):(Y=Ki(Y,N,p,null),Y.flags|=2),Y.return=l,g.return=l,g.sibling=Y,l.child=g,Pd(null,g),g=l.child,Y=o.child.memoizedState,Y===null?Y=y0(p):(N=Y.cachePool,N!==null?(oe=ar._currentValue,N=N.parent!==oe?{parent:oe,pool:oe}:N):N=dI(),Y={baseLanes:Y.baseLanes|p,cachePool:N}),g.memoizedState=Y,g.childLanes=v0(o,P,p),l.memoizedState=b0,Pd(o.child,g)):(Ys(l),p=o.child,o=p.sibling,p=Jo(p,{mode:"visible",children:g.children}),p.return=l,p.sibling=null,o!==null&&(P=l.deletions,P===null?(l.deletions=[o],l.flags|=16):P.push(o)),l.child=p,l.memoizedState=null,p)}function w0(o,l){return l=Om({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function Om(o,l){return o=Ca(22,o,null,l),o.lanes=0,o}function E0(o,l,p){return el(l,o.child,null,p),o=w0(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function _O(o,l,p){o.lanes|=l;var g=o.alternate;g!==null&&(g.lanes|=l),jv(o.return,l,p)}function x0(o,l,p,g,N,k){var P=o.memoizedState;P===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:g,tail:p,tailMode:N,treeForkCount:k}:(P.isBackwards=l,P.rendering=null,P.renderingStartTime=0,P.last=g,P.tail=p,P.tailMode=N,P.treeForkCount=k)}function TO(o,l,p){var g=l.pendingProps,N=g.revealOrder,k=g.tail;g=g.children;var P=Qn.current,Y=(P&2)!==0;if(Y?(P=P&1|2,l.flags|=128):P&=1,$(Qn,P),Ir(o,l,g,p),g=qt?_d:0,!Y&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&_O(o,p,l);else if(o.tag===19)_O(o,p,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(N){case"forwards":for(p=l.child,N=null;p!==null;)o=p.alternate,o!==null&&wm(o)===null&&(N=p),p=p.sibling;p=N,p===null?(N=l.child,l.child=null):(N=p.sibling,p.sibling=null),x0(l,!1,N,p,k,g);break;case"backwards":case"unstable_legacy-backwards":for(p=null,N=l.child,l.child=null;N!==null;){if(o=N.alternate,o!==null&&wm(o)===null){l.child=N;break}o=N.sibling,N.sibling=p,p=N,N=o}x0(l,!0,p,null,k,g);break;case"together":x0(l,!1,null,null,void 0,g);break;default:l.memoizedState=null}return l.child}function as(o,l,p){if(o!==null&&(l.dependencies=o.dependencies),Js|=l.lanes,(p&l.childLanes)===0)if(o!==null){if(sc(o,l,p,!1),(p&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(r(153));if(l.child!==null){for(o=l.child,p=Jo(o,o.pendingProps),l.child=p,p.return=l;o.sibling!==null;)o=o.sibling,p=p.sibling=Jo(o,o.pendingProps),p.return=l;p.sibling=null}return l.child}function S0(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&fm(o)))}function G8(o,l,p){switch(l.tag){case 3:q(l,l.stateNode.containerInfo),Vs(l,ar,o.memoizedState.cache),Yi();break;case 27:case 5:ie(l);break;case 4:q(l,l.stateNode.containerInfo);break;case 10:Vs(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Yv(l),null;break;case 13:var g=l.memoizedState;if(g!==null)return g.dehydrated!==null?(Ys(l),l.flags|=128,null):(p&l.child.childLanes)!==0?SO(o,l,p):(Ys(l),o=as(o,l,p),o!==null?o.sibling:null);Ys(l);break;case 19:var N=(o.flags&128)!==0;if(g=(p&l.childLanes)!==0,g||(sc(o,l,p,!1),g=(p&l.childLanes)!==0),N){if(g)return TO(o,l,p);l.flags|=128}if(N=l.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),$(Qn,Qn.current),g)break;return null;case 22:return l.lanes=0,bO(o,l,p,l.pendingProps);case 24:Vs(l,ar,o.memoizedState.cache)}return as(o,l,p)}function NO(o,l,p){if(o!==null)if(o.memoizedProps!==l.pendingProps)sr=!0;else{if(!S0(o,p)&&(l.flags&128)===0)return sr=!1,G8(o,l,p);sr=(o.flags&131072)!==0}else sr=!1,qt&&(l.flags&1048576)!==0&&aI(l,_d,l.index);switch(l.lanes=0,l.tag){case 16:e:{var g=l.pendingProps;if(o=Ji(l.elementType),l.type=o,typeof o=="function")Cv(o)?(g=nl(o,g),l.tag=1,l=EO(null,l,o,g,p)):(l.tag=0,l=g0(null,l,o,g,p));else{if(o!=null){var N=o.$$typeof;if(N===R){l.tag=11,l=mO(null,l,o,g,p);break e}else if(N===A){l.tag=14,l=hO(null,l,o,g,p);break e}}throw l=ee(o)||o,Error(r(306,l,""))}}return l;case 0:return g0(o,l,l.type,l.pendingProps,p);case 1:return g=l.type,N=nl(g,l.pendingProps),EO(o,l,g,N,p);case 3:e:{if(q(l,l.stateNode.containerInfo),o===null)throw Error(r(387));g=l.pendingProps;var k=l.memoizedState;N=k.element,Hv(o,l),Od(l,g,null,p);var P=l.memoizedState;if(g=P.cache,Vs(l,ar,g),g!==k.cache&&Pv(l,[ar],p,!0),Id(),g=P.element,k.isDehydrated)if(k={element:g,isDehydrated:!1,cache:P.cache},l.updateQueue.baseState=k,l.memoizedState=k,l.flags&256){l=xO(o,l,g,p);break e}else if(g!==N){N=Ba(Error(r(424)),l),Td(N),l=xO(o,l,g,p);break e}else{switch(o=l.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(In=Ka(o.firstChild),Rr=l,qt=!0,Bs=null,Ga=!0,p=bI(l,null,g,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Yi(),g===N){l=as(o,l,p);break e}Ir(o,l,g,p)}l=l.child}return l;case 26:return Im(o,l),o===null?(p=PD(l.type,null,l.pendingProps,null))?l.memoizedState=p:qt||(p=l.type,o=l.pendingProps,g=Ym(z.current).createElement(p),g[ht]=l,g[Hn]=o,Or(g,p,o),ot(g),l.stateNode=g):l.memoizedState=PD(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:return ie(l),o===null&&qt&&(g=l.stateNode=LD(l.type,l.pendingProps,z.current),Rr=l,Ga=!0,N=In,ri(l.type)?(nw=N,In=Ka(g.firstChild)):In=N),Ir(o,l,l.pendingProps.children,p),Im(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&qt&&((N=g=In)&&(g=E9(g,l.type,l.pendingProps,Ga),g!==null?(l.stateNode=g,Rr=l,In=Ka(g.firstChild),Ga=!1,N=!0):N=!1),N||Hs(l)),ie(l),N=l.type,k=l.pendingProps,P=o!==null?o.memoizedProps:null,g=k.children,X0(N,k)?g=null:P!==null&&X0(N,P)&&(l.flags|=32),l.memoizedState!==null&&(N=qv(o,l,j8,null,null,p),Jd._currentValue=N),Im(o,l),Ir(o,l,g,p),l.child;case 6:return o===null&&qt&&((o=p=In)&&(p=x9(p,l.pendingProps,Ga),p!==null?(l.stateNode=p,Rr=l,In=null,o=!0):o=!1),o||Hs(l)),null;case 13:return SO(o,l,p);case 4:return q(l,l.stateNode.containerInfo),g=l.pendingProps,o===null?l.child=el(l,null,g,p):Ir(o,l,g,p),l.child;case 11:return mO(o,l,l.type,l.pendingProps,p);case 7:return Ir(o,l,l.pendingProps,p),l.child;case 8:return Ir(o,l,l.pendingProps.children,p),l.child;case 12:return Ir(o,l,l.pendingProps.children,p),l.child;case 10:return g=l.pendingProps,Vs(l,l.type,g.value),Ir(o,l,g.children,p),l.child;case 9:return N=l.type._context,g=l.pendingProps.children,qi(l),N=Ar(N),g=g(N),l.flags|=1,Ir(o,l,g,p),l.child;case 14:return hO(o,l,l.type,l.pendingProps,p);case 15:return gO(o,l,l.type,l.pendingProps,p);case 19:return TO(o,l,p);case 31:return V8(o,l,p);case 22:return bO(o,l,p,l.pendingProps);case 24:return qi(l),g=Ar(ar),o===null?(N=zv(),N===null&&(N=_n,k=Uv(),N.pooledCache=k,k.refCount++,k!==null&&(N.pooledCacheLanes|=p),N=k),l.memoizedState={parent:g,cache:N},Bv(l),Vs(l,ar,N)):((o.lanes&p)!==0&&(Hv(o,l),Od(l,null,null,p),Id()),N=o.memoizedState,k=l.memoizedState,N.parent!==g?(N={parent:g,cache:g},l.memoizedState=N,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=N),Vs(l,ar,g)):(g=k.cache,Vs(l,ar,g),g!==N.cache&&Pv(l,[ar],p,!0))),Ir(o,l,l.pendingProps.children,p),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function os(o){o.flags|=4}function _0(o,l,p,g,N){if((l=(o.mode&32)!==0)&&(l=!1),l){if(o.flags|=16777216,(N&335544128)===N)if(o.stateNode.complete)o.flags|=8192;else if(QO())o.flags|=8192;else throw Qi=gm,Fv}else o.flags&=-16777217}function kO(o,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!BD(l))if(QO())o.flags|=8192;else throw Qi=gm,Fv}function Dm(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?Pt():536870912,o.lanes|=l,yc|=l)}function Ud(o,l){if(!qt)switch(o.tailMode){case"hidden":l=o.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?o.tail=null:p.sibling=null;break;case"collapsed":p=o.tail;for(var g=null;p!==null;)p.alternate!==null&&(g=p),p=p.sibling;g===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:g.sibling=null}}function On(o){var l=o.alternate!==null&&o.alternate.child===o.child,p=0,g=0;if(l)for(var N=o.child;N!==null;)p|=N.lanes|N.childLanes,g|=N.subtreeFlags&65011712,g|=N.flags&65011712,N.return=o,N=N.sibling;else for(N=o.child;N!==null;)p|=N.lanes|N.childLanes,g|=N.subtreeFlags,g|=N.flags,N.return=o,N=N.sibling;return o.subtreeFlags|=g,o.childLanes=p,l}function W8(o,l,p){var g=l.pendingProps;switch(Ov(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return On(l),null;case 1:return On(l),null;case 3:return p=l.stateNode,g=null,o!==null&&(g=o.memoizedState.cache),l.memoizedState.cache!==g&&(l.flags|=2048),ts(ar),ae(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(o===null||o.child===null)&&(oc(l)?os(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Lv())),On(l),null;case 26:var N=l.type,k=l.memoizedState;return o===null?(os(l),k!==null?(On(l),kO(l,k)):(On(l),_0(l,N,null,g,p))):k?k!==o.memoizedState?(os(l),On(l),kO(l,k)):(On(l),l.flags&=-16777217):(o=o.memoizedProps,o!==g&&os(l),On(l),_0(l,N,o,g,p)),null;case 27:if(X(l),p=z.current,N=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==g&&os(l);else{if(!g){if(l.stateNode===null)throw Error(r(166));return On(l),null}o=L.current,oc(l)?sI(l):(o=LD(N,g,p),l.stateNode=o,os(l))}return On(l),null;case 5:if(X(l),N=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==g&&os(l);else{if(!g){if(l.stateNode===null)throw Error(r(166));return On(l),null}if(k=L.current,oc(l))sI(l);else{var P=Ym(z.current);switch(k){case 1:k=P.createElementNS("http://www.w3.org/2000/svg",N);break;case 2:k=P.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;default:switch(N){case"svg":k=P.createElementNS("http://www.w3.org/2000/svg",N);break;case"math":k=P.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;case"script":k=P.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof g.is=="string"?P.createElement("select",{is:g.is}):P.createElement("select"),g.multiple?k.multiple=!0:g.size&&(k.size=g.size);break;default:k=typeof g.is=="string"?P.createElement(N,{is:g.is}):P.createElement(N)}}k[ht]=l,k[Hn]=g;e:for(P=l.child;P!==null;){if(P.tag===5||P.tag===6)k.appendChild(P.stateNode);else if(P.tag!==4&&P.tag!==27&&P.child!==null){P.child.return=P,P=P.child;continue}if(P===l)break e;for(;P.sibling===null;){if(P.return===null||P.return===l)break e;P=P.return}P.sibling.return=P.return,P=P.sibling}l.stateNode=k;e:switch(Or(k,N,g),N){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&os(l)}}return On(l),_0(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,p),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==g&&os(l);else{if(typeof g!="string"&&l.stateNode===null)throw Error(r(166));if(o=z.current,oc(l)){if(o=l.stateNode,p=l.memoizedProps,g=null,N=Rr,N!==null)switch(N.tag){case 27:case 5:g=N.memoizedProps}o[ht]=l,o=!!(o.nodeValue===p||g!==null&&g.suppressHydrationWarning===!0||SD(o.nodeValue,p)),o||Hs(l,!0)}else o=Ym(o).createTextNode(g),o[ht]=l,l.stateNode=o}return On(l),null;case 31:if(p=l.memoizedState,o===null||o.memoizedState!==null){if(g=oc(l),p!==null){if(o===null){if(!g)throw Error(r(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[ht]=l}else Yi(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;On(l),o=!1}else p=Lv(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=p),o=!0;if(!o)return l.flags&256?(Aa(l),l):(Aa(l),null);if((l.flags&128)!==0)throw Error(r(558))}return On(l),null;case 13:if(g=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(N=oc(l),g!==null&&g.dehydrated!==null){if(o===null){if(!N)throw Error(r(318));if(N=l.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(r(317));N[ht]=l}else Yi(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;On(l),N=!1}else N=Lv(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=N),N=!0;if(!N)return l.flags&256?(Aa(l),l):(Aa(l),null)}return Aa(l),(l.flags&128)!==0?(l.lanes=p,l):(p=g!==null,o=o!==null&&o.memoizedState!==null,p&&(g=l.child,N=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(N=g.alternate.memoizedState.cachePool.pool),k=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(k=g.memoizedState.cachePool.pool),k!==N&&(g.flags|=2048)),p!==o&&p&&(l.child.flags|=8192),Dm(l,l.updateQueue),On(l),null);case 4:return ae(),o===null&&W0(l.stateNode.containerInfo),On(l),null;case 10:return ts(l.type),On(l),null;case 19:if(H(Qn),g=l.memoizedState,g===null)return On(l),null;if(N=(l.flags&128)!==0,k=g.rendering,k===null)if(N)Ud(g,!1);else{if(Yn!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(k=wm(o),k!==null){for(l.flags|=128,Ud(g,!1),o=k.updateQueue,l.updateQueue=o,Dm(l,o),l.subtreeFlags=0,o=p,p=l.child;p!==null;)tI(p,o),p=p.sibling;return $(Qn,Qn.current&1|2),qt&&Qo(l,g.treeForkCount),l.child}o=o.sibling}g.tail!==null&&we()>Um&&(l.flags|=128,N=!0,Ud(g,!1),l.lanes=4194304)}else{if(!N)if(o=wm(k),o!==null){if(l.flags|=128,N=!0,o=o.updateQueue,l.updateQueue=o,Dm(l,o),Ud(g,!0),g.tail===null&&g.tailMode==="hidden"&&!k.alternate&&!qt)return On(l),null}else 2*we()-g.renderingStartTime>Um&&p!==536870912&&(l.flags|=128,N=!0,Ud(g,!1),l.lanes=4194304);g.isBackwards?(k.sibling=l.child,l.child=k):(o=g.last,o!==null?o.sibling=k:l.child=k,g.last=k)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=we(),o.sibling=null,p=Qn.current,$(Qn,N?p&1|2:p&1),qt&&Qo(l,g.treeForkCount),o):(On(l),null);case 22:case 23:return Aa(l),Kv(),g=l.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(l.flags|=8192):g&&(l.flags|=8192),g?(p&536870912)!==0&&(l.flags&128)===0&&(On(l),l.subtreeFlags&6&&(l.flags|=8192)):On(l),p=l.updateQueue,p!==null&&Dm(l,p.retryQueue),p=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),g=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(g=l.memoizedState.cachePool.pool),g!==p&&(l.flags|=2048),o!==null&&H(Xi),null;case 24:return p=null,o!==null&&(p=o.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),ts(ar),On(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function K8(o,l){switch(Ov(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return ts(ar),ae(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return X(l),null;case 31:if(l.memoizedState!==null){if(Aa(l),l.alternate===null)throw Error(r(340));Yi()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(Aa(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Yi()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return H(Qn),null;case 4:return ae(),null;case 10:return ts(l.type),null;case 22:case 23:return Aa(l),Kv(),o!==null&&H(Xi),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return ts(ar),null;case 25:return null;default:return null}}function CO(o,l){switch(Ov(l),l.tag){case 3:ts(ar),ae();break;case 26:case 27:case 5:X(l);break;case 4:ae();break;case 31:l.memoizedState!==null&&Aa(l);break;case 13:Aa(l);break;case 19:H(Qn);break;case 10:ts(l.type);break;case 22:case 23:Aa(l),Kv(),o!==null&&H(Xi);break;case 24:ts(ar)}}function $d(o,l){try{var p=l.updateQueue,g=p!==null?p.lastEffect:null;if(g!==null){var N=g.next;p=N;do{if((p.tag&o)===o){g=void 0;var k=p.create,P=p.inst;g=k(),P.destroy=g}p=p.next}while(p!==N)}}catch(Y){bn(l,l.return,Y)}}function qs(o,l,p){try{var g=l.updateQueue,N=g!==null?g.lastEffect:null;if(N!==null){var k=N.next;g=k;do{if((g.tag&o)===o){var P=g.inst,Y=P.destroy;if(Y!==void 0){P.destroy=void 0,N=l;var oe=p,ge=Y;try{ge()}catch(xe){bn(N,oe,xe)}}}g=g.next}while(g!==k)}}catch(xe){bn(l,l.return,xe)}}function RO(o){var l=o.updateQueue;if(l!==null){var p=o.stateNode;try{vI(l,p)}catch(g){bn(o,o.return,g)}}}function AO(o,l,p){p.props=nl(o.type,o.memoizedProps),p.state=o.memoizedState;try{p.componentWillUnmount()}catch(g){bn(o,l,g)}}function zd(o,l){try{var p=o.ref;if(p!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof p=="function"?o.refCleanup=p(g):p.current=g}}catch(N){bn(o,l,N)}}function Oo(o,l){var p=o.ref,g=o.refCleanup;if(p!==null)if(typeof g=="function")try{g()}catch(N){bn(o,l,N)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(N){bn(o,l,N)}else p.current=null}function IO(o){var l=o.type,p=o.memoizedProps,g=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":p.autoFocus&&g.focus();break e;case"img":p.src?g.src=p.src:p.srcSet&&(g.srcset=p.srcSet)}}catch(N){bn(o,o.return,N)}}function T0(o,l,p){try{var g=o.stateNode;h9(g,o.type,p,l),g[Hn]=l}catch(N){bn(o,o.return,N)}}function OO(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&ri(o.type)||o.tag===4}function N0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||OO(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&ri(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function k0(o,l,p){var g=o.tag;if(g===5||g===6)o=o.stateNode,l?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(o,l):(l=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,l.appendChild(o),p=p._reactRootContainer,p!=null||l.onclick!==null||(l.onclick=qo));else if(g!==4&&(g===27&&ri(o.type)&&(p=o.stateNode,l=null),o=o.child,o!==null))for(k0(o,l,p),o=o.sibling;o!==null;)k0(o,l,p),o=o.sibling}function Lm(o,l,p){var g=o.tag;if(g===5||g===6)o=o.stateNode,l?p.insertBefore(o,l):p.appendChild(o);else if(g!==4&&(g===27&&ri(o.type)&&(p=o.stateNode),o=o.child,o!==null))for(Lm(o,l,p),o=o.sibling;o!==null;)Lm(o,l,p),o=o.sibling}function DO(o){var l=o.stateNode,p=o.memoizedProps;try{for(var g=o.type,N=l.attributes;N.length;)l.removeAttributeNode(N[0]);Or(l,g,p),l[ht]=o,l[Hn]=p}catch(k){bn(o,o.return,k)}}var ss=!1,ir=!1,C0=!1,LO=typeof WeakSet=="function"?WeakSet:Set,xr=null;function Y8(o,l){if(o=o.containerInfo,Z0=th,o=W1(o),Ev(o)){if("selectionStart"in o)var p={start:o.selectionStart,end:o.selectionEnd};else e:{p=(p=o.ownerDocument)&&p.defaultView||window;var g=p.getSelection&&p.getSelection();if(g&&g.rangeCount!==0){p=g.anchorNode;var N=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{p.nodeType,k.nodeType}catch{p=null;break e}var P=0,Y=-1,oe=-1,ge=0,xe=0,ke=o,ye=null;t:for(;;){for(var ve;ke!==p||N!==0&&ke.nodeType!==3||(Y=P+N),ke!==k||g!==0&&ke.nodeType!==3||(oe=P+g),ke.nodeType===3&&(P+=ke.nodeValue.length),(ve=ke.firstChild)!==null;)ye=ke,ke=ve;for(;;){if(ke===o)break t;if(ye===p&&++ge===N&&(Y=P),ye===k&&++xe===g&&(oe=P),(ve=ke.nextSibling)!==null)break;ke=ye,ye=ke.parentNode}ke=ve}p=Y===-1||oe===-1?null:{start:Y,end:oe}}else p=null}p=p||{start:0,end:0}}else p=null;for(q0={focusedElem:o,selectionRange:p},th=!1,xr=l;xr!==null;)if(l=xr,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,xr=o;else for(;xr!==null;){switch(l=xr,k=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(p=0;p<o.length;p++)N=o[p],N.ref.impl=N.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&k!==null){o=void 0,p=l,N=k.memoizedProps,k=k.memoizedState,g=p.stateNode;try{var We=nl(p.type,N);o=g.getSnapshotBeforeUpdate(We,k),g.__reactInternalSnapshotBeforeUpdate=o}catch(ct){bn(p,p.return,ct)}}break;case 3:if((o&1024)!==0){if(o=l.stateNode.containerInfo,p=o.nodeType,p===9)Q0(o);else if(p===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Q0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=l.sibling,o!==null){o.return=l.return,xr=o;break}xr=l.return}}function MO(o,l,p){var g=p.flags;switch(p.tag){case 0:case 11:case 15:ls(o,p),g&4&&$d(5,p);break;case 1:if(ls(o,p),g&4)if(o=p.stateNode,l===null)try{o.componentDidMount()}catch(P){bn(p,p.return,P)}else{var N=nl(p.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(N,l,o.__reactInternalSnapshotBeforeUpdate)}catch(P){bn(p,p.return,P)}}g&64&&RO(p),g&512&&zd(p,p.return);break;case 3:if(ls(o,p),g&64&&(o=p.updateQueue,o!==null)){if(l=null,p.child!==null)switch(p.child.tag){case 27:case 5:l=p.child.stateNode;break;case 1:l=p.child.stateNode}try{vI(o,l)}catch(P){bn(p,p.return,P)}}break;case 27:l===null&&g&4&&DO(p);case 26:case 5:ls(o,p),l===null&&g&4&&IO(p),g&512&&zd(p,p.return);break;case 12:ls(o,p);break;case 31:ls(o,p),g&4&&UO(o,p);break;case 13:ls(o,p),g&4&&$O(o,p),g&64&&(o=p.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(p=r9.bind(null,p),S9(o,p))));break;case 22:if(g=p.memoizedState!==null||ss,!g){l=l!==null&&l.memoizedState!==null||ir,N=ss;var k=ir;ss=g,(ir=l)&&!k?cs(o,p,(p.subtreeFlags&8772)!==0):ls(o,p),ss=N,ir=k}break;case 30:break;default:ls(o,p)}}function jO(o){var l=o.alternate;l!==null&&(o.alternate=null,jO(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&sn(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var jn=null,fa=!1;function is(o,l,p){for(p=p.child;p!==null;)PO(o,l,p),p=p.sibling}function PO(o,l,p){if(st&&typeof st.onCommitFiberUnmount=="function")try{st.onCommitFiberUnmount(Ut,p)}catch{}switch(p.tag){case 26:ir||Oo(p,l),is(o,l,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:ir||Oo(p,l);var g=jn,N=fa;ri(p.type)&&(jn=p.stateNode,fa=!1),is(o,l,p),Zd(p.stateNode),jn=g,fa=N;break;case 5:ir||Oo(p,l);case 6:if(g=jn,N=fa,jn=null,is(o,l,p),jn=g,fa=N,jn!==null)if(fa)try{(jn.nodeType===9?jn.body:jn.nodeName==="HTML"?jn.ownerDocument.body:jn).removeChild(p.stateNode)}catch(k){bn(p,l,k)}else try{jn.removeChild(p.stateNode)}catch(k){bn(p,l,k)}break;case 18:jn!==null&&(fa?(o=jn,RD(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,p.stateNode),Nc(o)):RD(jn,p.stateNode));break;case 4:g=jn,N=fa,jn=p.stateNode.containerInfo,fa=!0,is(o,l,p),jn=g,fa=N;break;case 0:case 11:case 14:case 15:qs(2,p,l),ir||qs(4,p,l),is(o,l,p);break;case 1:ir||(Oo(p,l),g=p.stateNode,typeof g.componentWillUnmount=="function"&&AO(p,l,g)),is(o,l,p);break;case 21:is(o,l,p);break;case 22:ir=(g=ir)||p.memoizedState!==null,is(o,l,p),ir=g;break;default:is(o,l,p)}}function UO(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Nc(o)}catch(p){bn(l,l.return,p)}}}function $O(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Nc(o)}catch(p){bn(l,l.return,p)}}function Z8(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new LO),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new LO),l;default:throw Error(r(435,o.tag))}}function Mm(o,l){var p=Z8(o);l.forEach(function(g){if(!p.has(g)){p.add(g);var N=a9.bind(null,o,g);g.then(N,N)}})}function pa(o,l){var p=l.deletions;if(p!==null)for(var g=0;g<p.length;g++){var N=p[g],k=o,P=l,Y=P;e:for(;Y!==null;){switch(Y.tag){case 27:if(ri(Y.type)){jn=Y.stateNode,fa=!1;break e}break;case 5:jn=Y.stateNode,fa=!1;break e;case 3:case 4:jn=Y.stateNode.containerInfo,fa=!0;break e}Y=Y.return}if(jn===null)throw Error(r(160));PO(k,P,N),jn=null,fa=!1,k=N.alternate,k!==null&&(k.return=null),N.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)zO(l,o),l=l.sibling}var lo=null;function zO(o,l){var p=o.alternate,g=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:pa(l,o),ma(o),g&4&&(qs(3,o,o.return),$d(3,o),qs(5,o,o.return));break;case 1:pa(l,o),ma(o),g&512&&(ir||p===null||Oo(p,p.return)),g&64&&ss&&(o=o.updateQueue,o!==null&&(g=o.callbacks,g!==null&&(p=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=p===null?g:p.concat(g))));break;case 26:var N=lo;if(pa(l,o),ma(o),g&512&&(ir||p===null||Oo(p,p.return)),g&4){var k=p!==null?p.memoizedState:null;if(g=o.memoizedState,p===null)if(g===null)if(o.stateNode===null){e:{g=o.type,p=o.memoizedProps,N=N.ownerDocument||N;t:switch(g){case"title":k=N.getElementsByTagName("title")[0],(!k||k[pn]||k[ht]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=N.createElement(g),N.head.insertBefore(k,N.querySelector("head > title"))),Or(k,g,p),k[ht]=o,ot(k),g=k;break e;case"link":var P=zD("link","href",N).get(g+(p.href||""));if(P){for(var Y=0;Y<P.length;Y++)if(k=P[Y],k.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&k.getAttribute("rel")===(p.rel==null?null:p.rel)&&k.getAttribute("title")===(p.title==null?null:p.title)&&k.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){P.splice(Y,1);break t}}k=N.createElement(g),Or(k,g,p),N.head.appendChild(k);break;case"meta":if(P=zD("meta","content",N).get(g+(p.content||""))){for(Y=0;Y<P.length;Y++)if(k=P[Y],k.getAttribute("content")===(p.content==null?null:""+p.content)&&k.getAttribute("name")===(p.name==null?null:p.name)&&k.getAttribute("property")===(p.property==null?null:p.property)&&k.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&k.getAttribute("charset")===(p.charSet==null?null:p.charSet)){P.splice(Y,1);break t}}k=N.createElement(g),Or(k,g,p),N.head.appendChild(k);break;default:throw Error(r(468,g))}k[ht]=o,ot(k),g=k}o.stateNode=g}else FD(N,o.type,o.stateNode);else o.stateNode=$D(N,g,o.memoizedProps);else k!==g?(k===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):k.count--,g===null?FD(N,o.type,o.stateNode):$D(N,g,o.memoizedProps)):g===null&&o.stateNode!==null&&T0(o,o.memoizedProps,p.memoizedProps)}break;case 27:pa(l,o),ma(o),g&512&&(ir||p===null||Oo(p,p.return)),p!==null&&g&4&&T0(o,o.memoizedProps,p.memoizedProps);break;case 5:if(pa(l,o),ma(o),g&512&&(ir||p===null||Oo(p,p.return)),o.flags&32){N=o.stateNode;try{Zo(N,"")}catch(We){bn(o,o.return,We)}}g&4&&o.stateNode!=null&&(N=o.memoizedProps,T0(o,N,p!==null?p.memoizedProps:N)),g&1024&&(C0=!0);break;case 6:if(pa(l,o),ma(o),g&4){if(o.stateNode===null)throw Error(r(162));g=o.memoizedProps,p=o.stateNode;try{p.nodeValue=g}catch(We){bn(o,o.return,We)}}break;case 3:if(Xm=null,N=lo,lo=Zm(l.containerInfo),pa(l,o),lo=N,ma(o),g&4&&p!==null&&p.memoizedState.isDehydrated)try{Nc(l.containerInfo)}catch(We){bn(o,o.return,We)}C0&&(C0=!1,FO(o));break;case 4:g=lo,lo=Zm(o.stateNode.containerInfo),pa(l,o),ma(o),lo=g;break;case 12:pa(l,o),ma(o);break;case 31:pa(l,o),ma(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Mm(o,g)));break;case 13:pa(l,o),ma(o),o.child.flags&8192&&o.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Pm=we()),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Mm(o,g)));break;case 22:N=o.memoizedState!==null;var oe=p!==null&&p.memoizedState!==null,ge=ss,xe=ir;if(ss=ge||N,ir=xe||oe,pa(l,o),ir=xe,ss=ge,ma(o),g&8192)e:for(l=o.stateNode,l._visibility=N?l._visibility&-2:l._visibility|1,N&&(p===null||oe||ss||ir||rl(o)),p=null,l=o;;){if(l.tag===5||l.tag===26){if(p===null){oe=p=l;try{if(k=oe.stateNode,N)P=k.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none";else{Y=oe.stateNode;var ke=oe.memoizedProps.style,ye=ke!=null&&ke.hasOwnProperty("display")?ke.display:null;Y.style.display=ye==null||typeof ye=="boolean"?"":(""+ye).trim()}}catch(We){bn(oe,oe.return,We)}}}else if(l.tag===6){if(p===null){oe=l;try{oe.stateNode.nodeValue=N?"":oe.memoizedProps}catch(We){bn(oe,oe.return,We)}}}else if(l.tag===18){if(p===null){oe=l;try{var ve=oe.stateNode;N?AD(ve,!0):AD(oe.stateNode,!1)}catch(We){bn(oe,oe.return,We)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;p===l&&(p=null),l=l.return}p===l&&(p=null),l.sibling.return=l.return,l=l.sibling}g&4&&(g=o.updateQueue,g!==null&&(p=g.retryQueue,p!==null&&(g.retryQueue=null,Mm(o,p))));break;case 19:pa(l,o),ma(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Mm(o,g)));break;case 30:break;case 21:break;default:pa(l,o),ma(o)}}function ma(o){var l=o.flags;if(l&2){try{for(var p,g=o.return;g!==null;){if(OO(g)){p=g;break}g=g.return}if(p==null)throw Error(r(160));switch(p.tag){case 27:var N=p.stateNode,k=N0(o);Lm(o,k,N);break;case 5:var P=p.stateNode;p.flags&32&&(Zo(P,""),p.flags&=-33);var Y=N0(o);Lm(o,Y,P);break;case 3:case 4:var oe=p.stateNode.containerInfo,ge=N0(o);k0(o,ge,oe);break;default:throw Error(r(161))}}catch(xe){bn(o,o.return,xe)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function FO(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;FO(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),o=o.sibling}}function ls(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)MO(o,l.alternate,l),l=l.sibling}function rl(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:qs(4,l,l.return),rl(l);break;case 1:Oo(l,l.return);var p=l.stateNode;typeof p.componentWillUnmount=="function"&&AO(l,l.return,p),rl(l);break;case 27:Zd(l.stateNode);case 26:case 5:Oo(l,l.return),rl(l);break;case 22:l.memoizedState===null&&rl(l);break;case 30:rl(l);break;default:rl(l)}o=o.sibling}}function cs(o,l,p){for(p=p&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var g=l.alternate,N=o,k=l,P=k.flags;switch(k.tag){case 0:case 11:case 15:cs(N,k,p),$d(4,k);break;case 1:if(cs(N,k,p),g=k,N=g.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch(ge){bn(g,g.return,ge)}if(g=k,N=g.updateQueue,N!==null){var Y=g.stateNode;try{var oe=N.shared.hiddenCallbacks;if(oe!==null)for(N.shared.hiddenCallbacks=null,N=0;N<oe.length;N++)yI(oe[N],Y)}catch(ge){bn(g,g.return,ge)}}p&&P&64&&RO(k),zd(k,k.return);break;case 27:DO(k);case 26:case 5:cs(N,k,p),p&&g===null&&P&4&&IO(k),zd(k,k.return);break;case 12:cs(N,k,p);break;case 31:cs(N,k,p),p&&P&4&&UO(N,k);break;case 13:cs(N,k,p),p&&P&4&&$O(N,k);break;case 22:k.memoizedState===null&&cs(N,k,p),zd(k,k.return);break;case 30:break;default:cs(N,k,p)}l=l.sibling}}function R0(o,l){var p=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==p&&(o!=null&&o.refCount++,p!=null&&Nd(p))}function A0(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Nd(o))}function co(o,l,p,g){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)BO(o,l,p,g),l=l.sibling}function BO(o,l,p,g){var N=l.flags;switch(l.tag){case 0:case 11:case 15:co(o,l,p,g),N&2048&&$d(9,l);break;case 1:co(o,l,p,g);break;case 3:co(o,l,p,g),N&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Nd(o)));break;case 12:if(N&2048){co(o,l,p,g),o=l.stateNode;try{var k=l.memoizedProps,P=k.id,Y=k.onPostCommit;typeof Y=="function"&&Y(P,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(oe){bn(l,l.return,oe)}}else co(o,l,p,g);break;case 31:co(o,l,p,g);break;case 13:co(o,l,p,g);break;case 23:break;case 22:k=l.stateNode,P=l.alternate,l.memoizedState!==null?k._visibility&2?co(o,l,p,g):Fd(o,l):k._visibility&2?co(o,l,p,g):(k._visibility|=2,hc(o,l,p,g,(l.subtreeFlags&10256)!==0||!1)),N&2048&&R0(P,l);break;case 24:co(o,l,p,g),N&2048&&A0(l.alternate,l);break;default:co(o,l,p,g)}}function hc(o,l,p,g,N){for(N=N&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var k=o,P=l,Y=p,oe=g,ge=P.flags;switch(P.tag){case 0:case 11:case 15:hc(k,P,Y,oe,N),$d(8,P);break;case 23:break;case 22:var xe=P.stateNode;P.memoizedState!==null?xe._visibility&2?hc(k,P,Y,oe,N):Fd(k,P):(xe._visibility|=2,hc(k,P,Y,oe,N)),N&&ge&2048&&R0(P.alternate,P);break;case 24:hc(k,P,Y,oe,N),N&&ge&2048&&A0(P.alternate,P);break;default:hc(k,P,Y,oe,N)}l=l.sibling}}function Fd(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var p=o,g=l,N=g.flags;switch(g.tag){case 22:Fd(p,g),N&2048&&R0(g.alternate,g);break;case 24:Fd(p,g),N&2048&&A0(g.alternate,g);break;default:Fd(p,g)}l=l.sibling}}var Bd=8192;function gc(o,l,p){if(o.subtreeFlags&Bd)for(o=o.child;o!==null;)HO(o,l,p),o=o.sibling}function HO(o,l,p){switch(o.tag){case 26:gc(o,l,p),o.flags&Bd&&o.memoizedState!==null&&M9(p,lo,o.memoizedState,o.memoizedProps);break;case 5:gc(o,l,p);break;case 3:case 4:var g=lo;lo=Zm(o.stateNode.containerInfo),gc(o,l,p),lo=g;break;case 22:o.memoizedState===null&&(g=o.alternate,g!==null&&g.memoizedState!==null?(g=Bd,Bd=16777216,gc(o,l,p),Bd=g):gc(o,l,p));break;default:gc(o,l,p)}}function VO(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function Hd(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var g=l[p];xr=g,WO(g,o)}VO(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)GO(o),o=o.sibling}function GO(o){switch(o.tag){case 0:case 11:case 15:Hd(o),o.flags&2048&&qs(9,o,o.return);break;case 3:Hd(o);break;case 12:Hd(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,jm(o)):Hd(o);break;default:Hd(o)}}function jm(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var g=l[p];xr=g,WO(g,o)}VO(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:qs(8,l,l.return),jm(l);break;case 22:p=l.stateNode,p._visibility&2&&(p._visibility&=-3,jm(l));break;default:jm(l)}o=o.sibling}}function WO(o,l){for(;xr!==null;){var p=xr;switch(p.tag){case 0:case 11:case 15:qs(8,p,l);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var g=p.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:Nd(p.memoizedState.cache)}if(g=p.child,g!==null)g.return=p,xr=g;else e:for(p=o;xr!==null;){g=xr;var N=g.sibling,k=g.return;if(jO(g),g===p){xr=null;break e}if(N!==null){N.return=k,xr=N;break e}xr=k}}}var q8={getCacheForType:function(o){var l=Ar(ar),p=l.data.get(o);return p===void 0&&(p=o(),l.data.set(o,p)),p},cacheSignal:function(){return Ar(ar).controller.signal}},X8=typeof WeakMap=="function"?WeakMap:Map,ln=0,_n=null,zt=null,Vt=0,gn=0,Ia=null,Xs=!1,bc=!1,I0=!1,us=0,Yn=0,Js=0,al=0,O0=0,Oa=0,yc=0,Vd=null,ha=null,D0=!1,Pm=0,KO=0,Um=1/0,$m=null,Qs=null,fr=0,ei=null,vc=null,ds=0,L0=0,M0=null,YO=null,Gd=0,j0=null;function Da(){return(ln&2)!==0&&Vt!==0?Vt&-Vt:F.T!==null?B0():Ta()}function ZO(){if(Oa===0)if((Vt&536870912)===0||qt){var o=xt;xt<<=1,(xt&3932160)===0&&(xt=262144),Oa=o}else Oa=536870912;return o=Ra.current,o!==null&&(o.flags|=32),Oa}function ga(o,l,p){(o===_n&&(gn===2||gn===9)||o.cancelPendingCommit!==null)&&(wc(o,0),ti(o,Vt,Oa,!1)),dn(o,p),((ln&2)===0||o!==_n)&&(o===_n&&((ln&2)===0&&(al|=p),Yn===4&&ti(o,Vt,Oa,!1)),Do(o))}function qO(o,l,p){if((ln&6)!==0)throw Error(r(327));var g=!p&&(l&127)===0&&(l&o.expiredLanes)===0||vt(o,l),N=g?e9(o,l):U0(o,l,!0),k=g;do{if(N===0){bc&&!g&&ti(o,l,0,!1);break}else{if(p=o.current.alternate,k&&!J8(p)){N=U0(o,l,!1),k=!1;continue}if(N===2){if(k=l,o.errorRecoveryDisabledLanes&k)var P=0;else P=o.pendingLanes&-536870913,P=P!==0?P:P&536870912?536870912:0;if(P!==0){l=P;e:{var Y=o;N=Vd;var oe=Y.current.memoizedState.isDehydrated;if(oe&&(wc(Y,P).flags|=256),P=U0(Y,P,!1),P!==2){if(I0&&!oe){Y.errorRecoveryDisabledLanes|=k,al|=k,N=4;break e}k=ha,ha=N,k!==null&&(ha===null?ha=k:ha.push.apply(ha,k))}N=P}if(k=!1,N!==2)continue}}if(N===1){wc(o,0),ti(o,l,0,!0);break}e:{switch(g=o,k=N,k){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:ti(g,l,Oa,!Xs);break e;case 2:ha=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(N=Pm+300-we(),10<N)){if(ti(g,l,Oa,!Xs),Ze(g,0,!0)!==0)break e;ds=l,g.timeoutHandle=kD(XO.bind(null,g,p,ha,$m,D0,l,Oa,al,yc,Xs,k,"Throttled",-0,0),N);break e}XO(g,p,ha,$m,D0,l,Oa,al,yc,Xs,k,null,-0,0)}}break}while(!0);Do(o)}function XO(o,l,p,g,N,k,P,Y,oe,ge,xe,ke,ye,ve){if(o.timeoutHandle=-1,ke=l.subtreeFlags,ke&8192||(ke&16785408)===16785408){ke={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qo},HO(l,k,ke);var We=(k&62914560)===k?Pm-we():(k&4194048)===k?KO-we():0;if(We=j9(ke,We),We!==null){ds=k,o.cancelPendingCommit=We(oD.bind(null,o,l,k,p,g,N,P,Y,oe,xe,ke,null,ye,ve)),ti(o,k,P,!ge);return}}oD(o,l,k,p,g,N,P,Y,oe)}function J8(o){for(var l=o;;){var p=l.tag;if((p===0||p===11||p===15)&&l.flags&16384&&(p=l.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var g=0;g<p.length;g++){var N=p[g],k=N.getSnapshot;N=N.value;try{if(!ka(k(),N))return!1}catch{return!1}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function ti(o,l,p,g){l&=~O0,l&=~al,o.suspendedLanes|=l,o.pingedLanes&=~l,g&&(o.warmLanes|=l),g=o.expirationTimes;for(var N=l;0<N;){var k=31-Me(N),P=1<<k;g[k]=-1,N&=~P}p!==0&&Jn(o,p,l)}function zm(){return(ln&6)===0?(Wd(0),!1):!0}function P0(){if(zt!==null){if(gn===0)var o=zt.return;else o=zt,es=Zi=null,Qv(o),uc=null,Cd=0,o=zt;for(;o!==null;)CO(o.alternate,o),o=o.return;zt=null}}function wc(o,l){var p=o.timeoutHandle;p!==-1&&(o.timeoutHandle=-1,y9(p)),p=o.cancelPendingCommit,p!==null&&(o.cancelPendingCommit=null,p()),ds=0,P0(),_n=o,zt=p=Jo(o.current,null),Vt=l,gn=0,Ia=null,Xs=!1,bc=vt(o,l),I0=!1,yc=Oa=O0=al=Js=Yn=0,ha=Vd=null,D0=!1,(l&8)!==0&&(l|=l&32);var g=o.entangledLanes;if(g!==0)for(o=o.entanglements,g&=l;0<g;){var N=31-Me(g),k=1<<N;l|=o[N],g&=~k}return us=l,im(),p}function JO(o,l){St=null,F.H=jd,l===cc||l===hm?(l=mI(),gn=3):l===Fv?(l=mI(),gn=4):gn=l===h0?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Ia=l,zt===null&&(Yn=1,Rm(o,Ba(l,o.current)))}function QO(){var o=Ra.current;return o===null?!0:(Vt&4194048)===Vt?Wa===null:(Vt&62914560)===Vt||(Vt&536870912)!==0?o===Wa:!1}function eD(){var o=F.H;return F.H=jd,o===null?jd:o}function tD(){var o=F.A;return F.A=q8,o}function Fm(){Yn=4,Xs||(Vt&4194048)!==Vt&&Ra.current!==null||(bc=!0),(Js&134217727)===0&&(al&134217727)===0||_n===null||ti(_n,Vt,Oa,!1)}function U0(o,l,p){var g=ln;ln|=2;var N=eD(),k=tD();(_n!==o||Vt!==l)&&($m=null,wc(o,l)),l=!1;var P=Yn;e:do try{if(gn!==0&&zt!==null){var Y=zt,oe=Ia;switch(gn){case 8:P0(),P=6;break e;case 3:case 2:case 9:case 6:Ra.current===null&&(l=!0);var ge=gn;if(gn=0,Ia=null,Ec(o,Y,oe,ge),p&&bc){P=0;break e}break;default:ge=gn,gn=0,Ia=null,Ec(o,Y,oe,ge)}}Q8(),P=Yn;break}catch(xe){JO(o,xe)}while(!0);return l&&o.shellSuspendCounter++,es=Zi=null,ln=g,F.H=N,F.A=k,zt===null&&(_n=null,Vt=0,im()),P}function Q8(){for(;zt!==null;)nD(zt)}function e9(o,l){var p=ln;ln|=2;var g=eD(),N=tD();_n!==o||Vt!==l?($m=null,Um=we()+500,wc(o,l)):bc=vt(o,l);e:do try{if(gn!==0&&zt!==null){l=zt;var k=Ia;t:switch(gn){case 1:gn=0,Ia=null,Ec(o,l,k,1);break;case 2:case 9:if(fI(k)){gn=0,Ia=null,rD(l);break}l=function(){gn!==2&&gn!==9||_n!==o||(gn=7),Do(o)},k.then(l,l);break e;case 3:gn=7;break e;case 4:gn=5;break e;case 7:fI(k)?(gn=0,Ia=null,rD(l)):(gn=0,Ia=null,Ec(o,l,k,7));break;case 5:var P=null;switch(zt.tag){case 26:P=zt.memoizedState;case 5:case 27:var Y=zt;if(P?BD(P):Y.stateNode.complete){gn=0,Ia=null;var oe=Y.sibling;if(oe!==null)zt=oe;else{var ge=Y.return;ge!==null?(zt=ge,Bm(ge)):zt=null}break t}}gn=0,Ia=null,Ec(o,l,k,5);break;case 6:gn=0,Ia=null,Ec(o,l,k,6);break;case 8:P0(),Yn=6;break e;default:throw Error(r(462))}}t9();break}catch(xe){JO(o,xe)}while(!0);return es=Zi=null,F.H=g,F.A=N,ln=p,zt!==null?0:(_n=null,Vt=0,im(),Yn)}function t9(){for(;zt!==null&&!Ae();)nD(zt)}function nD(o){var l=NO(o.alternate,o,us);o.memoizedProps=o.pendingProps,l===null?Bm(o):zt=l}function rD(o){var l=o,p=l.alternate;switch(l.tag){case 15:case 0:l=wO(p,l,l.pendingProps,l.type,void 0,Vt);break;case 11:l=wO(p,l,l.pendingProps,l.type.render,l.ref,Vt);break;case 5:Qv(l);default:CO(p,l),l=zt=tI(l,us),l=NO(p,l,us)}o.memoizedProps=o.pendingProps,l===null?Bm(o):zt=l}function Ec(o,l,p,g){es=Zi=null,Qv(l),uc=null,Cd=0;var N=l.return;try{if(H8(o,N,l,p,Vt)){Yn=1,Rm(o,Ba(p,o.current)),zt=null;return}}catch(k){if(N!==null)throw zt=N,k;Yn=1,Rm(o,Ba(p,o.current)),zt=null;return}l.flags&32768?(qt||g===1?o=!0:bc||(Vt&536870912)!==0?o=!1:(Xs=o=!0,(g===2||g===9||g===3||g===6)&&(g=Ra.current,g!==null&&g.tag===13&&(g.flags|=16384))),aD(l,o)):Bm(l)}function Bm(o){var l=o;do{if((l.flags&32768)!==0){aD(l,Xs);return}o=l.return;var p=W8(l.alternate,l,us);if(p!==null){zt=p;return}if(l=l.sibling,l!==null){zt=l;return}zt=l=o}while(l!==null);Yn===0&&(Yn=5)}function aD(o,l){do{var p=K8(o.alternate,o);if(p!==null){p.flags&=32767,zt=p;return}if(p=o.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!l&&(o=o.sibling,o!==null)){zt=o;return}zt=o=p}while(o!==null);Yn=6,zt=null}function oD(o,l,p,g,N,k,P,Y,oe){o.cancelPendingCommit=null;do Hm();while(fr!==0);if((ln&6)!==0)throw Error(r(327));if(l!==null){if(l===o.current)throw Error(r(177));if(k=l.lanes|l.childLanes,k|=Nv,Xn(o,p,k,P,Y,oe),o===_n&&(zt=_n=null,Vt=0),vc=l,ei=o,ds=p,L0=k,M0=N,YO=g,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,o9(Ct,function(){return uD(),null})):(o.callbackNode=null,o.callbackPriority=0),g=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||g){g=F.T,F.T=null,N=K.p,K.p=2,P=ln,ln|=4;try{Y8(o,l,p)}finally{ln=P,K.p=N,F.T=g}}fr=1,sD(),iD(),lD()}}function sD(){if(fr===1){fr=0;var o=ei,l=vc,p=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||p){p=F.T,F.T=null;var g=K.p;K.p=2;var N=ln;ln|=4;try{zO(l,o);var k=q0,P=W1(o.containerInfo),Y=k.focusedElem,oe=k.selectionRange;if(P!==Y&&Y&&Y.ownerDocument&&G1(Y.ownerDocument.documentElement,Y)){if(oe!==null&&Ev(Y)){var ge=oe.start,xe=oe.end;if(xe===void 0&&(xe=ge),"selectionStart"in Y)Y.selectionStart=ge,Y.selectionEnd=Math.min(xe,Y.value.length);else{var ke=Y.ownerDocument||document,ye=ke&&ke.defaultView||window;if(ye.getSelection){var ve=ye.getSelection(),We=Y.textContent.length,ct=Math.min(oe.start,We),Sn=oe.end===void 0?ct:Math.min(oe.end,We);!ve.extend&&ct>Sn&&(P=Sn,Sn=ct,ct=P);var pe=V1(Y,ct),ue=V1(Y,Sn);if(pe&&ue&&(ve.rangeCount!==1||ve.anchorNode!==pe.node||ve.anchorOffset!==pe.offset||ve.focusNode!==ue.node||ve.focusOffset!==ue.offset)){var he=ke.createRange();he.setStart(pe.node,pe.offset),ve.removeAllRanges(),ct>Sn?(ve.addRange(he),ve.extend(ue.node,ue.offset)):(he.setEnd(ue.node,ue.offset),ve.addRange(he))}}}}for(ke=[],ve=Y;ve=ve.parentNode;)ve.nodeType===1&&ke.push({element:ve,left:ve.scrollLeft,top:ve.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Y<ke.length;Y++){var Ne=ke[Y];Ne.element.scrollLeft=Ne.left,Ne.element.scrollTop=Ne.top}}th=!!Z0,q0=Z0=null}finally{ln=N,K.p=g,F.T=p}}o.current=l,fr=2}}function iD(){if(fr===2){fr=0;var o=ei,l=vc,p=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||p){p=F.T,F.T=null;var g=K.p;K.p=2;var N=ln;ln|=4;try{MO(o,l.alternate,l)}finally{ln=N,K.p=g,F.T=p}}fr=3}}function lD(){if(fr===4||fr===3){fr=0,ze();var o=ei,l=vc,p=ds,g=YO;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?fr=5:(fr=0,vc=ei=null,cD(o,o.pendingLanes));var N=o.pendingLanes;if(N===0&&(Qs=null),Qt(p),l=l.stateNode,st&&typeof st.onCommitFiberRoot=="function")try{st.onCommitFiberRoot(Ut,l,void 0,(l.current.flags&128)===128)}catch{}if(g!==null){l=F.T,N=K.p,K.p=2,F.T=null;try{for(var k=o.onRecoverableError,P=0;P<g.length;P++){var Y=g[P];k(Y.value,{componentStack:Y.stack})}}finally{F.T=l,K.p=N}}(ds&3)!==0&&Hm(),Do(o),N=o.pendingLanes,(p&261930)!==0&&(N&42)!==0?o===j0?Gd++:(Gd=0,j0=o):Gd=0,Wd(0)}}function cD(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,Nd(l)))}function Hm(){return sD(),iD(),lD(),uD()}function uD(){if(fr!==5)return!1;var o=ei,l=L0;L0=0;var p=Qt(ds),g=F.T,N=K.p;try{K.p=32>p?32:p,F.T=null,p=M0,M0=null;var k=ei,P=ds;if(fr=0,vc=ei=null,ds=0,(ln&6)!==0)throw Error(r(331));var Y=ln;if(ln|=4,GO(k.current),BO(k,k.current,P,p),ln=Y,Wd(0,!1),st&&typeof st.onPostCommitFiberRoot=="function")try{st.onPostCommitFiberRoot(Ut,k)}catch{}return!0}finally{K.p=N,F.T=g,cD(o,l)}}function dD(o,l,p){l=Ba(p,l),l=m0(o.stateNode,l,2),o=Ks(o,l,2),o!==null&&(dn(o,2),Do(o))}function bn(o,l,p){if(o.tag===3)dD(o,o,p);else for(;l!==null;){if(l.tag===3){dD(l,o,p);break}else if(l.tag===1){var g=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Qs===null||!Qs.has(g))){o=Ba(p,o),p=fO(2),g=Ks(l,p,2),g!==null&&(pO(p,g,l,o),dn(g,2),Do(g));break}}l=l.return}}function $0(o,l,p){var g=o.pingCache;if(g===null){g=o.pingCache=new X8;var N=new Set;g.set(l,N)}else N=g.get(l),N===void 0&&(N=new Set,g.set(l,N));N.has(p)||(I0=!0,N.add(p),o=n9.bind(null,o,l,p),l.then(o,o))}function n9(o,l,p){var g=o.pingCache;g!==null&&g.delete(l),o.pingedLanes|=o.suspendedLanes&p,o.warmLanes&=~p,_n===o&&(Vt&p)===p&&(Yn===4||Yn===3&&(Vt&62914560)===Vt&&300>we()-Pm?(ln&2)===0&&wc(o,0):O0|=p,yc===Vt&&(yc=0)),Do(o)}function fD(o,l){l===0&&(l=Pt()),o=Wi(o,l),o!==null&&(dn(o,l),Do(o))}function r9(o){var l=o.memoizedState,p=0;l!==null&&(p=l.retryLane),fD(o,p)}function a9(o,l){var p=0;switch(o.tag){case 31:case 13:var g=o.stateNode,N=o.memoizedState;N!==null&&(p=N.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(l),fD(o,p)}function o9(o,l){return Ue(o,l)}var Vm=null,xc=null,z0=!1,Gm=!1,F0=!1,ni=0;function Do(o){o!==xc&&o.next===null&&(xc===null?Vm=xc=o:xc=xc.next=o),Gm=!0,z0||(z0=!0,i9())}function Wd(o,l){if(!F0&&Gm){F0=!0;do for(var p=!1,g=Vm;g!==null;){if(o!==0){var N=g.pendingLanes;if(N===0)var k=0;else{var P=g.suspendedLanes,Y=g.pingedLanes;k=(1<<31-Me(42|o)+1)-1,k&=N&~(P&~Y),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(p=!0,gD(g,k))}else k=Vt,k=Ze(g,g===_n?k:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(k&3)===0||vt(g,k)||(p=!0,gD(g,k));g=g.next}while(p);F0=!1}}function s9(){pD()}function pD(){Gm=z0=!1;var o=0;ni!==0&&b9()&&(o=ni);for(var l=we(),p=null,g=Vm;g!==null;){var N=g.next,k=mD(g,l);k===0?(g.next=null,p===null?Vm=N:p.next=N,N===null&&(xc=p)):(p=g,(o!==0||(k&3)!==0)&&(Gm=!0)),g=N}fr!==0&&fr!==5||Wd(o),ni!==0&&(ni=0)}function mD(o,l){for(var p=o.suspendedLanes,g=o.pingedLanes,N=o.expirationTimes,k=o.pendingLanes&-62914561;0<k;){var P=31-Me(k),Y=1<<P,oe=N[P];oe===-1?((Y&p)===0||(Y&g)!==0)&&(N[P]=jt(Y,l)):oe<=l&&(o.expiredLanes|=Y),k&=~Y}if(l=_n,p=Vt,p=Ze(o,o===l?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g=o.callbackNode,p===0||o===l&&(gn===2||gn===9)||o.cancelPendingCommit!==null)return g!==null&&g!==null&&fe(g),o.callbackNode=null,o.callbackPriority=0;if((p&3)===0||vt(o,p)){if(l=p&-p,l===o.callbackPriority)return l;switch(g!==null&&fe(g),Qt(p)){case 2:case 8:p=gt;break;case 32:p=Ct;break;case 268435456:p=$e;break;default:p=Ct}return g=hD.bind(null,o),p=Ue(p,g),o.callbackPriority=l,o.callbackNode=p,l}return g!==null&&g!==null&&fe(g),o.callbackPriority=2,o.callbackNode=null,2}function hD(o,l){if(fr!==0&&fr!==5)return o.callbackNode=null,o.callbackPriority=0,null;var p=o.callbackNode;if(Hm()&&o.callbackNode!==p)return null;var g=Vt;return g=Ze(o,o===_n?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g===0?null:(qO(o,g,l),mD(o,we()),o.callbackNode!=null&&o.callbackNode===p?hD.bind(null,o):null)}function gD(o,l){if(Hm())return null;qO(o,l,!0)}function i9(){v9(function(){(ln&6)!==0?Ue(lt,s9):pD()})}function B0(){if(ni===0){var o=ic;o===0&&(o=Et,Et<<=1,(Et&261888)===0&&(Et=256)),ni=o}return ni}function bD(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Qp(""+o)}function yD(o,l){var p=l.ownerDocument.createElement("input");return p.name=l.name,p.value=l.value,o.id&&p.setAttribute("form",o.id),l.parentNode.insertBefore(p,l),o=new FormData(o),p.parentNode.removeChild(p),o}function l9(o,l,p,g,N){if(l==="submit"&&p&&p.stateNode===N){var k=bD((N[Hn]||null).action),P=g.submitter;P&&(l=(l=P[Hn]||null)?bD(l.formAction):P.getAttribute("formAction"),l!==null&&(k=l,P=null));var Y=new rm("action","action",null,g,N);o.push({event:Y,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(ni!==0){var oe=P?yD(N,P):new FormData(N);l0(p,{pending:!0,data:oe,method:N.method,action:k},null,oe)}}else typeof k=="function"&&(Y.preventDefault(),oe=P?yD(N,P):new FormData(N),l0(p,{pending:!0,data:oe,method:N.method,action:k},k,oe))},currentTarget:N}]})}}for(var H0=0;H0<Tv.length;H0++){var V0=Tv[H0],c9=V0.toLowerCase(),u9=V0[0].toUpperCase()+V0.slice(1);io(c9,"on"+u9)}io(Z1,"onAnimationEnd"),io(q1,"onAnimationIteration"),io(X1,"onAnimationStart"),io("dblclick","onDoubleClick"),io("focusin","onFocus"),io("focusout","onBlur"),io(N8,"onTransitionRun"),io(k8,"onTransitionStart"),io(C8,"onTransitionCancel"),io(J1,"onTransitionEnd"),hn("onMouseEnter",["mouseout","mouseover"]),hn("onMouseLeave",["mouseout","mouseover"]),hn("onPointerEnter",["pointerout","pointerover"]),hn("onPointerLeave",["pointerout","pointerover"]),An("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),An("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),An("onBeforeInput",["compositionend","keypress","textInput","paste"]),An("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),An("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),An("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),d9=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Kd));function vD(o,l){l=(l&4)!==0;for(var p=0;p<o.length;p++){var g=o[p],N=g.event;g=g.listeners;e:{var k=void 0;if(l)for(var P=g.length-1;0<=P;P--){var Y=g[P],oe=Y.instance,ge=Y.currentTarget;if(Y=Y.listener,oe!==k&&N.isPropagationStopped())break e;k=Y,N.currentTarget=ge;try{k(N)}catch(xe){sm(xe)}N.currentTarget=null,k=oe}else for(P=0;P<g.length;P++){if(Y=g[P],oe=Y.instance,ge=Y.currentTarget,Y=Y.listener,oe!==k&&N.isPropagationStopped())break e;k=Y,N.currentTarget=ge;try{k(N)}catch(xe){sm(xe)}N.currentTarget=null,k=oe}}}}function Ft(o,l){var p=l[so];p===void 0&&(p=l[so]=new Set);var g=o+"__bubble";p.has(g)||(wD(l,o,2,!1),p.add(g))}function G0(o,l,p){var g=0;l&&(g|=4),wD(p,o,g,l)}var Wm="_reactListening"+Math.random().toString(36).slice(2);function W0(o){if(!o[Wm]){o[Wm]=!0,ca.forEach(function(p){p!=="selectionchange"&&(d9.has(p)||G0(p,!1,o),G0(p,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[Wm]||(l[Wm]=!0,G0("selectionchange",!1,l))}}function wD(o,l,p,g){switch(ZD(l)){case 2:var N=$9;break;case 8:N=z9;break;default:N=iw}p=N.bind(null,l,p,o),N=void 0,!fv||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(N=!0),g?N!==void 0?o.addEventListener(l,p,{capture:!0,passive:N}):o.addEventListener(l,p,!0):N!==void 0?o.addEventListener(l,p,{passive:N}):o.addEventListener(l,p,!1)}function K0(o,l,p,g,N){var k=g;if((l&1)===0&&(l&2)===0&&g!==null)e:for(;;){if(g===null)return;var P=g.tag;if(P===3||P===4){var Y=g.stateNode.containerInfo;if(Y===N)break;if(P===4)for(P=g.return;P!==null;){var oe=P.tag;if((oe===3||oe===4)&&P.stateNode.containerInfo===N)return;P=P.return}for(;Y!==null;){if(P=Zt(Y),P===null)return;if(oe=P.tag,oe===5||oe===6||oe===26||oe===27){g=k=P;continue e}Y=Y.parentNode}}g=g.return}T1(function(){var ge=k,xe=uv(p),ke=[];e:{var ye=Q1.get(o);if(ye!==void 0){var ve=rm,We=o;switch(o){case"keypress":if(tm(p)===0)break e;case"keydown":case"keyup":ve=a8;break;case"focusin":We="focus",ve=gv;break;case"focusout":We="blur",ve=gv;break;case"beforeblur":case"afterblur":ve=gv;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ve=C1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ve=W6;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ve=i8;break;case Z1:case q1:case X1:ve=Z6;break;case J1:ve=c8;break;case"scroll":case"scrollend":ve=V6;break;case"wheel":ve=d8;break;case"copy":case"cut":case"paste":ve=X6;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ve=A1;break;case"toggle":case"beforetoggle":ve=p8}var ct=(l&4)!==0,Sn=!ct&&(o==="scroll"||o==="scrollend"),pe=ct?ye!==null?ye+"Capture":null:ye;ct=[];for(var ue=ge,he;ue!==null;){var Ne=ue;if(he=Ne.stateNode,Ne=Ne.tag,Ne!==5&&Ne!==26&&Ne!==27||he===null||pe===null||(Ne=hd(ue,pe),Ne!=null&&ct.push(Yd(ue,Ne,he))),Sn)break;ue=ue.return}0<ct.length&&(ye=new ve(ye,We,null,p,xe),ke.push({event:ye,listeners:ct}))}}if((l&7)===0){e:{if(ye=o==="mouseover"||o==="pointerover",ve=o==="mouseout"||o==="pointerout",ye&&p!==cv&&(We=p.relatedTarget||p.fromElement)&&(Zt(We)||We[Qr]))break e;if((ve||ye)&&(ye=xe.window===xe?xe:(ye=xe.ownerDocument)?ye.defaultView||ye.parentWindow:window,ve?(We=p.relatedTarget||p.toElement,ve=ge,We=We?Zt(We):null,We!==null&&(Sn=s(We),ct=We.tag,We!==Sn||ct!==5&&ct!==27&&ct!==6)&&(We=null)):(ve=null,We=ge),ve!==We)){if(ct=C1,Ne="onMouseLeave",pe="onMouseEnter",ue="mouse",(o==="pointerout"||o==="pointerover")&&(ct=A1,Ne="onPointerLeave",pe="onPointerEnter",ue="pointer"),Sn=ve==null?ye:nn(ve),he=We==null?ye:nn(We),ye=new ct(Ne,ue+"leave",ve,p,xe),ye.target=Sn,ye.relatedTarget=he,Ne=null,Zt(xe)===ge&&(ct=new ct(pe,ue+"enter",We,p,xe),ct.target=he,ct.relatedTarget=Sn,Ne=ct),Sn=Ne,ve&&We)t:{for(ct=f9,pe=ve,ue=We,he=0,Ne=pe;Ne;Ne=ct(Ne))he++;Ne=0;for(var rt=ue;rt;rt=ct(rt))Ne++;for(;0<he-Ne;)pe=ct(pe),he--;for(;0<Ne-he;)ue=ct(ue),Ne--;for(;he--;){if(pe===ue||ue!==null&&pe===ue.alternate){ct=pe;break t}pe=ct(pe),ue=ct(ue)}ct=null}else ct=null;ve!==null&&ED(ke,ye,ve,ct,!1),We!==null&&Sn!==null&&ED(ke,Sn,We,ct,!0)}}e:{if(ye=ge?nn(ge):window,ve=ye.nodeName&&ye.nodeName.toLowerCase(),ve==="select"||ve==="input"&&ye.type==="file")var rn=U1;else if(j1(ye))if($1)rn=S8;else{rn=E8;var Je=w8}else ve=ye.nodeName,!ve||ve.toLowerCase()!=="input"||ye.type!=="checkbox"&&ye.type!=="radio"?ge&&lv(ge.elementType)&&(rn=U1):rn=x8;if(rn&&(rn=rn(o,ge))){P1(ke,rn,p,xe);break e}Je&&Je(o,ye,ge),o==="focusout"&&ge&&ye.type==="number"&&ge.memoizedProps.value!=null&&iv(ye,"number",ye.value)}switch(Je=ge?nn(ge):window,o){case"focusin":(j1(Je)||Je.contentEditable==="true")&&(Ql=Je,xv=ge,Sd=null);break;case"focusout":Sd=xv=Ql=null;break;case"mousedown":Sv=!0;break;case"contextmenu":case"mouseup":case"dragend":Sv=!1,K1(ke,p,xe);break;case"selectionchange":if(T8)break;case"keydown":case"keyup":K1(ke,p,xe)}var Tt;if(yv)e:{switch(o){case"compositionstart":var Gt="onCompositionStart";break e;case"compositionend":Gt="onCompositionEnd";break e;case"compositionupdate":Gt="onCompositionUpdate";break e}Gt=void 0}else Jl?L1(o,p)&&(Gt="onCompositionEnd"):o==="keydown"&&p.keyCode===229&&(Gt="onCompositionStart");Gt&&(I1&&p.locale!=="ko"&&(Jl||Gt!=="onCompositionStart"?Gt==="onCompositionEnd"&&Jl&&(Tt=N1()):(zs=xe,pv="value"in zs?zs.value:zs.textContent,Jl=!0)),Je=Km(ge,Gt),0<Je.length&&(Gt=new R1(Gt,o,null,p,xe),ke.push({event:Gt,listeners:Je}),Tt?Gt.data=Tt:(Tt=M1(p),Tt!==null&&(Gt.data=Tt)))),(Tt=h8?g8(o,p):b8(o,p))&&(Gt=Km(ge,"onBeforeInput"),0<Gt.length&&(Je=new R1("onBeforeInput","beforeinput",null,p,xe),ke.push({event:Je,listeners:Gt}),Je.data=Tt)),l9(ke,o,ge,p,xe)}vD(ke,l)})}function Yd(o,l,p){return{instance:o,listener:l,currentTarget:p}}function Km(o,l){for(var p=l+"Capture",g=[];o!==null;){var N=o,k=N.stateNode;if(N=N.tag,N!==5&&N!==26&&N!==27||k===null||(N=hd(o,p),N!=null&&g.unshift(Yd(o,N,k)),N=hd(o,l),N!=null&&g.push(Yd(o,N,k))),o.tag===3)return g;o=o.return}return[]}function f9(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function ED(o,l,p,g,N){for(var k=l._reactName,P=[];p!==null&&p!==g;){var Y=p,oe=Y.alternate,ge=Y.stateNode;if(Y=Y.tag,oe!==null&&oe===g)break;Y!==5&&Y!==26&&Y!==27||ge===null||(oe=ge,N?(ge=hd(p,k),ge!=null&&P.unshift(Yd(p,ge,oe))):N||(ge=hd(p,k),ge!=null&&P.push(Yd(p,ge,oe)))),p=p.return}P.length!==0&&o.push({event:l,listeners:P})}var p9=/\r\n?/g,m9=/\u0000|\uFFFD/g;function xD(o){return(typeof o=="string"?o:""+o).replace(p9,`
58
- `).replace(m9,"")}function SD(o,l){return l=xD(l),xD(o)===l}function xn(o,l,p,g,N,k){switch(p){case"children":typeof g=="string"?l==="body"||l==="textarea"&&g===""||Zo(o,g):(typeof g=="number"||typeof g=="bigint")&&l!=="body"&&Zo(o,""+g);break;case"className":ua(o,"class",g);break;case"tabIndex":ua(o,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":ua(o,p,g);break;case"style":S1(o,g,k);break;case"data":if(l!=="object"){ua(o,"data",g);break}case"src":case"href":if(g===""&&(l!=="a"||p!=="href")){o.removeAttribute(p);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(p);break}g=Qp(""+g),o.setAttribute(p,g);break;case"action":case"formAction":if(typeof g=="function"){o.setAttribute(p,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(p==="formAction"?(l!=="input"&&xn(o,l,"name",N.name,N,null),xn(o,l,"formEncType",N.formEncType,N,null),xn(o,l,"formMethod",N.formMethod,N,null),xn(o,l,"formTarget",N.formTarget,N,null)):(xn(o,l,"encType",N.encType,N,null),xn(o,l,"method",N.method,N,null),xn(o,l,"target",N.target,N,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(p);break}g=Qp(""+g),o.setAttribute(p,g);break;case"onClick":g!=null&&(o.onclick=qo);break;case"onScroll":g!=null&&Ft("scroll",o);break;case"onScrollEnd":g!=null&&Ft("scrollend",o);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(p=g.__html,p!=null){if(N.children!=null)throw Error(r(60));o.innerHTML=p}}break;case"multiple":o.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":o.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){o.removeAttribute("xlink:href");break}p=Qp(""+g),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(p,""+g):o.removeAttribute(p);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(p,""):o.removeAttribute(p);break;case"capture":case"download":g===!0?o.setAttribute(p,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(p,g):o.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?o.setAttribute(p,g):o.removeAttribute(p);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?o.removeAttribute(p):o.setAttribute(p,g);break;case"popover":Ft("beforetoggle",o),Ft("toggle",o),$t(o,"popover",g);break;case"xlinkActuate":Er(o,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Er(o,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Er(o,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Er(o,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Er(o,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Er(o,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Er(o,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Er(o,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Er(o,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":$t(o,"is",g);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=B6.get(p)||p,$t(o,p,g))}}function Y0(o,l,p,g,N,k){switch(p){case"style":S1(o,g,k);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(p=g.__html,p!=null){if(N.children!=null)throw Error(r(60));o.innerHTML=p}}break;case"children":typeof g=="string"?Zo(o,g):(typeof g=="number"||typeof g=="bigint")&&Zo(o,""+g);break;case"onScroll":g!=null&&Ft("scroll",o);break;case"onScrollEnd":g!=null&&Ft("scrollend",o);break;case"onClick":g!=null&&(o.onclick=qo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ht.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(N=p.endsWith("Capture"),l=p.slice(2,N?p.length-7:void 0),k=o[Hn]||null,k=k!=null?k[p]:null,typeof k=="function"&&o.removeEventListener(l,k,N),typeof g=="function")){typeof k!="function"&&k!==null&&(p in o?o[p]=null:o.hasAttribute(p)&&o.removeAttribute(p)),o.addEventListener(l,g,N);break e}p in o?o[p]=g:g===!0?o.setAttribute(p,""):$t(o,p,g)}}}function Or(o,l,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ft("error",o),Ft("load",o);var g=!1,N=!1,k;for(k in p)if(p.hasOwnProperty(k)){var P=p[k];if(P!=null)switch(k){case"src":g=!0;break;case"srcSet":N=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:xn(o,l,k,P,p,null)}}N&&xn(o,l,"srcSet",p.srcSet,p,null),g&&xn(o,l,"src",p.src,p,null);return;case"input":Ft("invalid",o);var Y=k=P=N=null,oe=null,ge=null;for(g in p)if(p.hasOwnProperty(g)){var xe=p[g];if(xe!=null)switch(g){case"name":N=xe;break;case"type":P=xe;break;case"checked":oe=xe;break;case"defaultChecked":ge=xe;break;case"value":k=xe;break;case"defaultValue":Y=xe;break;case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(r(137,l));break;default:xn(o,l,g,xe,p,null)}}md(o,k,Y,oe,ge,P,N,!1);return;case"select":Ft("invalid",o),g=P=k=null;for(N in p)if(p.hasOwnProperty(N)&&(Y=p[N],Y!=null))switch(N){case"value":k=Y;break;case"defaultValue":P=Y;break;case"multiple":g=Y;default:xn(o,l,N,Y,p,null)}l=k,p=P,o.multiple=!!g,l!=null?$s(o,!!g,l,!1):p!=null&&$s(o,!!g,p,!0);return;case"textarea":Ft("invalid",o),k=N=g=null;for(P in p)if(p.hasOwnProperty(P)&&(Y=p[P],Y!=null))switch(P){case"value":g=Y;break;case"defaultValue":N=Y;break;case"children":k=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(91));break;default:xn(o,l,P,Y,p,null)}E1(o,g,N,k);return;case"option":for(oe in p)if(p.hasOwnProperty(oe)&&(g=p[oe],g!=null))switch(oe){case"selected":o.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:xn(o,l,oe,g,p,null)}return;case"dialog":Ft("beforetoggle",o),Ft("toggle",o),Ft("cancel",o),Ft("close",o);break;case"iframe":case"object":Ft("load",o);break;case"video":case"audio":for(g=0;g<Kd.length;g++)Ft(Kd[g],o);break;case"image":Ft("error",o),Ft("load",o);break;case"details":Ft("toggle",o);break;case"embed":case"source":case"link":Ft("error",o),Ft("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ge in p)if(p.hasOwnProperty(ge)&&(g=p[ge],g!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:xn(o,l,ge,g,p,null)}return;default:if(lv(l)){for(xe in p)p.hasOwnProperty(xe)&&(g=p[xe],g!==void 0&&Y0(o,l,xe,g,p,void 0));return}}for(Y in p)p.hasOwnProperty(Y)&&(g=p[Y],g!=null&&xn(o,l,Y,g,p,null))}function h9(o,l,p,g){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var N=null,k=null,P=null,Y=null,oe=null,ge=null,xe=null;for(ve in p){var ke=p[ve];if(p.hasOwnProperty(ve)&&ke!=null)switch(ve){case"checked":break;case"value":break;case"defaultValue":oe=ke;default:g.hasOwnProperty(ve)||xn(o,l,ve,null,g,ke)}}for(var ye in g){var ve=g[ye];if(ke=p[ye],g.hasOwnProperty(ye)&&(ve!=null||ke!=null))switch(ye){case"type":k=ve;break;case"name":N=ve;break;case"checked":ge=ve;break;case"defaultChecked":xe=ve;break;case"value":P=ve;break;case"defaultValue":Y=ve;break;case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,l));break;default:ve!==ke&&xn(o,l,ye,ve,g,ke)}}sv(o,P,Y,oe,ge,xe,k,N);return;case"select":ve=P=Y=ye=null;for(k in p)if(oe=p[k],p.hasOwnProperty(k)&&oe!=null)switch(k){case"value":break;case"multiple":ve=oe;default:g.hasOwnProperty(k)||xn(o,l,k,null,g,oe)}for(N in g)if(k=g[N],oe=p[N],g.hasOwnProperty(N)&&(k!=null||oe!=null))switch(N){case"value":ye=k;break;case"defaultValue":Y=k;break;case"multiple":P=k;default:k!==oe&&xn(o,l,N,k,g,oe)}l=Y,p=P,g=ve,ye!=null?$s(o,!!p,ye,!1):!!g!=!!p&&(l!=null?$s(o,!!p,l,!0):$s(o,!!p,p?[]:"",!1));return;case"textarea":ve=ye=null;for(Y in p)if(N=p[Y],p.hasOwnProperty(Y)&&N!=null&&!g.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:xn(o,l,Y,null,g,N)}for(P in g)if(N=g[P],k=p[P],g.hasOwnProperty(P)&&(N!=null||k!=null))switch(P){case"value":ye=N;break;case"defaultValue":ve=N;break;case"children":break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:N!==k&&xn(o,l,P,N,g,k)}w1(o,ye,ve);return;case"option":for(var We in p)if(ye=p[We],p.hasOwnProperty(We)&&ye!=null&&!g.hasOwnProperty(We))switch(We){case"selected":o.selected=!1;break;default:xn(o,l,We,null,g,ye)}for(oe in g)if(ye=g[oe],ve=p[oe],g.hasOwnProperty(oe)&&ye!==ve&&(ye!=null||ve!=null))switch(oe){case"selected":o.selected=ye&&typeof ye!="function"&&typeof ye!="symbol";break;default:xn(o,l,oe,ye,g,ve)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ct in p)ye=p[ct],p.hasOwnProperty(ct)&&ye!=null&&!g.hasOwnProperty(ct)&&xn(o,l,ct,null,g,ye);for(ge in g)if(ye=g[ge],ve=p[ge],g.hasOwnProperty(ge)&&ye!==ve&&(ye!=null||ve!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(r(137,l));break;default:xn(o,l,ge,ye,g,ve)}return;default:if(lv(l)){for(var Sn in p)ye=p[Sn],p.hasOwnProperty(Sn)&&ye!==void 0&&!g.hasOwnProperty(Sn)&&Y0(o,l,Sn,void 0,g,ye);for(xe in g)ye=g[xe],ve=p[xe],!g.hasOwnProperty(xe)||ye===ve||ye===void 0&&ve===void 0||Y0(o,l,xe,ye,g,ve);return}}for(var pe in p)ye=p[pe],p.hasOwnProperty(pe)&&ye!=null&&!g.hasOwnProperty(pe)&&xn(o,l,pe,null,g,ye);for(ke in g)ye=g[ke],ve=p[ke],!g.hasOwnProperty(ke)||ye===ve||ye==null&&ve==null||xn(o,l,ke,ye,g,ve)}function _D(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function g9(){if(typeof performance.getEntriesByType=="function"){for(var o=0,l=0,p=performance.getEntriesByType("resource"),g=0;g<p.length;g++){var N=p[g],k=N.transferSize,P=N.initiatorType,Y=N.duration;if(k&&Y&&_D(P)){for(P=0,Y=N.responseEnd,g+=1;g<p.length;g++){var oe=p[g],ge=oe.startTime;if(ge>Y)break;var xe=oe.transferSize,ke=oe.initiatorType;xe&&_D(ke)&&(oe=oe.responseEnd,P+=xe*(oe<Y?1:(Y-ge)/(oe-ge)))}if(--g,l+=8*(k+P)/(N.duration/1e3),o++,10<o)break}}if(0<o)return l/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Z0=null,q0=null;function Ym(o){return o.nodeType===9?o:o.ownerDocument}function TD(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ND(o,l){if(o===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&l==="foreignObject"?0:o}function X0(o,l){return o==="textarea"||o==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var J0=null;function b9(){var o=window.event;return o&&o.type==="popstate"?o===J0?!1:(J0=o,!0):(J0=null,!1)}var kD=typeof setTimeout=="function"?setTimeout:void 0,y9=typeof clearTimeout=="function"?clearTimeout:void 0,CD=typeof Promise=="function"?Promise:void 0,v9=typeof queueMicrotask=="function"?queueMicrotask:typeof CD<"u"?function(o){return CD.resolve(null).then(o).catch(w9)}:kD;function w9(o){setTimeout(function(){throw o})}function ri(o){return o==="head"}function RD(o,l){var p=l,g=0;do{var N=p.nextSibling;if(o.removeChild(p),N&&N.nodeType===8)if(p=N.data,p==="/$"||p==="/&"){if(g===0){o.removeChild(N),Nc(l);return}g--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")g++;else if(p==="html")Zd(o.ownerDocument.documentElement);else if(p==="head"){p=o.ownerDocument.head,Zd(p);for(var k=p.firstChild;k;){var P=k.nextSibling,Y=k.nodeName;k[pn]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&k.rel.toLowerCase()==="stylesheet"||p.removeChild(k),k=P}}else p==="body"&&Zd(o.ownerDocument.body);p=N}while(p);Nc(l)}function AD(o,l){var p=o;o=0;do{var g=p.nextSibling;if(p.nodeType===1?l?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(l?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),g&&g.nodeType===8)if(p=g.data,p==="/$"){if(o===0)break;o--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||o++;p=g}while(p)}function Q0(o){var l=o.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var p=l;switch(l=l.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":Q0(p),sn(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}o.removeChild(p)}}function E9(o,l,p,g){for(;o.nodeType===1;){var N=p;if(o.nodeName.toLowerCase()!==l.toLowerCase()){if(!g&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(g){if(!o[pn])switch(l){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(k=o.getAttribute("rel"),k==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(k!==N.rel||o.getAttribute("href")!==(N.href==null||N.href===""?null:N.href)||o.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin)||o.getAttribute("title")!==(N.title==null?null:N.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(k=o.getAttribute("src"),(k!==(N.src==null?null:N.src)||o.getAttribute("type")!==(N.type==null?null:N.type)||o.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin))&&k&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(l==="input"&&o.type==="hidden"){var k=N.name==null?null:""+N.name;if(N.type==="hidden"&&o.getAttribute("name")===k)return o}else return o;if(o=Ka(o.nextSibling),o===null)break}return null}function x9(o,l,p){if(l==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!p||(o=Ka(o.nextSibling),o===null))return null;return o}function ID(o,l){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=Ka(o.nextSibling),o===null))return null;return o}function ew(o){return o.data==="$?"||o.data==="$~"}function tw(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function S9(o,l){var p=o.ownerDocument;if(o.data==="$~")o._reactRetry=l;else if(o.data!=="$?"||p.readyState!=="loading")l();else{var g=function(){l(),p.removeEventListener("DOMContentLoaded",g)};p.addEventListener("DOMContentLoaded",g),o._reactRetry=g}}function Ka(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return o}var nw=null;function OD(o){o=o.nextSibling;for(var l=0;o;){if(o.nodeType===8){var p=o.data;if(p==="/$"||p==="/&"){if(l===0)return Ka(o.nextSibling);l--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||l++}o=o.nextSibling}return null}function DD(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var p=o.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(l===0)return o;l--}else p!=="/$"&&p!=="/&"||l++}o=o.previousSibling}return null}function LD(o,l,p){switch(l=Ym(p),o){case"html":if(o=l.documentElement,!o)throw Error(r(452));return o;case"head":if(o=l.head,!o)throw Error(r(453));return o;case"body":if(o=l.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Zd(o){for(var l=o.attributes;l.length;)o.removeAttributeNode(l[0]);sn(o)}var Ya=new Map,MD=new Set;function Zm(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var fs=K.d;K.d={f:_9,r:T9,D:N9,C:k9,L:C9,m:R9,X:I9,S:A9,M:O9};function _9(){var o=fs.f(),l=zm();return o||l}function T9(o){var l=mt(o);l!==null&&l.tag===5&&l.type==="form"?JI(l):fs.r(o)}var Sc=typeof document>"u"?null:document;function jD(o,l,p){var g=Sc;if(g&&typeof l=="string"&&l){var N=ea(l);N='link[rel="'+o+'"][href="'+N+'"]',typeof p=="string"&&(N+='[crossorigin="'+p+'"]'),MD.has(N)||(MD.add(N),o={rel:o,crossOrigin:p,href:l},g.querySelector(N)===null&&(l=g.createElement("link"),Or(l,"link",o),ot(l),g.head.appendChild(l)))}}function N9(o){fs.D(o),jD("dns-prefetch",o,null)}function k9(o,l){fs.C(o,l),jD("preconnect",o,l)}function C9(o,l,p){fs.L(o,l,p);var g=Sc;if(g&&o&&l){var N='link[rel="preload"][as="'+ea(l)+'"]';l==="image"&&p&&p.imageSrcSet?(N+='[imagesrcset="'+ea(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(N+='[imagesizes="'+ea(p.imageSizes)+'"]')):N+='[href="'+ea(o)+'"]';var k=N;switch(l){case"style":k=_c(o);break;case"script":k=Tc(o)}Ya.has(k)||(o=h({rel:"preload",href:l==="image"&&p&&p.imageSrcSet?void 0:o,as:l},p),Ya.set(k,o),g.querySelector(N)!==null||l==="style"&&g.querySelector(qd(k))||l==="script"&&g.querySelector(Xd(k))||(l=g.createElement("link"),Or(l,"link",o),ot(l),g.head.appendChild(l)))}}function R9(o,l){fs.m(o,l);var p=Sc;if(p&&o){var g=l&&typeof l.as=="string"?l.as:"script",N='link[rel="modulepreload"][as="'+ea(g)+'"][href="'+ea(o)+'"]',k=N;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Tc(o)}if(!Ya.has(k)&&(o=h({rel:"modulepreload",href:o},l),Ya.set(k,o),p.querySelector(N)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(Xd(k)))return}g=p.createElement("link"),Or(g,"link",o),ot(g),p.head.appendChild(g)}}}function A9(o,l,p){fs.S(o,l,p);var g=Sc;if(g&&o){var N=dr(g).hoistableStyles,k=_c(o);l=l||"default";var P=N.get(k);if(!P){var Y={loading:0,preload:null};if(P=g.querySelector(qd(k)))Y.loading=5;else{o=h({rel:"stylesheet",href:o,"data-precedence":l},p),(p=Ya.get(k))&&rw(o,p);var oe=P=g.createElement("link");ot(oe),Or(oe,"link",o),oe._p=new Promise(function(ge,xe){oe.onload=ge,oe.onerror=xe}),oe.addEventListener("load",function(){Y.loading|=1}),oe.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,qm(P,l,g)}P={type:"stylesheet",instance:P,count:1,state:Y},N.set(k,P)}}}function I9(o,l){fs.X(o,l);var p=Sc;if(p&&o){var g=dr(p).hoistableScripts,N=Tc(o),k=g.get(N);k||(k=p.querySelector(Xd(N)),k||(o=h({src:o,async:!0},l),(l=Ya.get(N))&&aw(o,l),k=p.createElement("script"),ot(k),Or(k,"link",o),p.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},g.set(N,k))}}function O9(o,l){fs.M(o,l);var p=Sc;if(p&&o){var g=dr(p).hoistableScripts,N=Tc(o),k=g.get(N);k||(k=p.querySelector(Xd(N)),k||(o=h({src:o,async:!0,type:"module"},l),(l=Ya.get(N))&&aw(o,l),k=p.createElement("script"),ot(k),Or(k,"link",o),p.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},g.set(N,k))}}function PD(o,l,p,g){var N=(N=z.current)?Zm(N):null;if(!N)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(l=_c(p.href),p=dr(N).hoistableStyles,g=p.get(l),g||(g={type:"style",instance:null,count:0,state:null},p.set(l,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){o=_c(p.href);var k=dr(N).hoistableStyles,P=k.get(o);if(P||(N=N.ownerDocument||N,P={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(o,P),(k=N.querySelector(qd(o)))&&!k._p&&(P.instance=k,P.state.loading=5),Ya.has(o)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Ya.set(o,p),k||D9(N,o,p,P.state))),l&&g===null)throw Error(r(528,""));return P}if(l&&g!==null)throw Error(r(529,""));return null;case"script":return l=p.async,p=p.src,typeof p=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Tc(p),p=dr(N).hoistableScripts,g=p.get(l),g||(g={type:"script",instance:null,count:0,state:null},p.set(l,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function _c(o){return'href="'+ea(o)+'"'}function qd(o){return'link[rel="stylesheet"]['+o+"]"}function UD(o){return h({},o,{"data-precedence":o.precedence,precedence:null})}function D9(o,l,p,g){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?g.loading=1:(l=o.createElement("link"),g.preload=l,l.addEventListener("load",function(){return g.loading|=1}),l.addEventListener("error",function(){return g.loading|=2}),Or(l,"link",p),ot(l),o.head.appendChild(l))}function Tc(o){return'[src="'+ea(o)+'"]'}function Xd(o){return"script[async]"+o}function $D(o,l,p){if(l.count++,l.instance===null)switch(l.type){case"style":var g=o.querySelector('style[data-href~="'+ea(p.href)+'"]');if(g)return l.instance=g,ot(g),g;var N=h({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),ot(g),Or(g,"style",N),qm(g,p.precedence,o),l.instance=g;case"stylesheet":N=_c(p.href);var k=o.querySelector(qd(N));if(k)return l.state.loading|=4,l.instance=k,ot(k),k;g=UD(p),(N=Ya.get(N))&&rw(g,N),k=(o.ownerDocument||o).createElement("link"),ot(k);var P=k;return P._p=new Promise(function(Y,oe){P.onload=Y,P.onerror=oe}),Or(k,"link",g),l.state.loading|=4,qm(k,p.precedence,o),l.instance=k;case"script":return k=Tc(p.src),(N=o.querySelector(Xd(k)))?(l.instance=N,ot(N),N):(g=p,(N=Ya.get(k))&&(g=h({},p),aw(g,N)),o=o.ownerDocument||o,N=o.createElement("script"),ot(N),Or(N,"link",g),o.head.appendChild(N),l.instance=N);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(g=l.instance,l.state.loading|=4,qm(g,p.precedence,o));return l.instance}function qm(o,l,p){for(var g=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),N=g.length?g[g.length-1]:null,k=N,P=0;P<g.length;P++){var Y=g[P];if(Y.dataset.precedence===l)k=Y;else if(k!==N)break}k?k.parentNode.insertBefore(o,k.nextSibling):(l=p.nodeType===9?p.head:p,l.insertBefore(o,l.firstChild))}function rw(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.title==null&&(o.title=l.title)}function aw(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.integrity==null&&(o.integrity=l.integrity)}var Xm=null;function zD(o,l,p){if(Xm===null){var g=new Map,N=Xm=new Map;N.set(p,g)}else N=Xm,g=N.get(p),g||(g=new Map,N.set(p,g));if(g.has(o))return g;for(g.set(o,null),p=p.getElementsByTagName(o),N=0;N<p.length;N++){var k=p[N];if(!(k[pn]||k[ht]||o==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var P=k.getAttribute(l)||"";P=o+P;var Y=g.get(P);Y?Y.push(k):g.set(P,[k])}}return g}function FD(o,l,p){o=o.ownerDocument||o,o.head.insertBefore(p,l==="title"?o.querySelector("head > title"):null)}function L9(o,l,p){if(p===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return o=l.disabled,typeof l.precedence=="string"&&o==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function BD(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function M9(o,l,p,g){if(p.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var N=_c(g.href),k=l.querySelector(qd(N));if(k){l=k._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=Jm.bind(o),l.then(o,o)),p.state.loading|=4,p.instance=k,ot(k);return}k=l.ownerDocument||l,g=UD(g),(N=Ya.get(N))&&rw(g,N),k=k.createElement("link"),ot(k);var P=k;P._p=new Promise(function(Y,oe){P.onload=Y,P.onerror=oe}),Or(k,"link",g),p.instance=k}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(p,l),(l=p.state.preload)&&(p.state.loading&3)===0&&(o.count++,p=Jm.bind(o),l.addEventListener("load",p),l.addEventListener("error",p))}}var ow=0;function j9(o,l){return o.stylesheets&&o.count===0&&eh(o,o.stylesheets),0<o.count||0<o.imgCount?function(p){var g=setTimeout(function(){if(o.stylesheets&&eh(o,o.stylesheets),o.unsuspend){var k=o.unsuspend;o.unsuspend=null,k()}},6e4+l);0<o.imgBytes&&ow===0&&(ow=62500*g9());var N=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&eh(o,o.stylesheets),o.unsuspend)){var k=o.unsuspend;o.unsuspend=null,k()}},(o.imgBytes>ow?50:800)+l);return o.unsuspend=p,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(N)}}:null}function Jm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)eh(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Qm=null;function eh(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Qm=new Map,l.forEach(P9,o),Qm=null,Jm.call(o))}function P9(o,l){if(!(l.state.loading&4)){var p=Qm.get(o);if(p)var g=p.get(null);else{p=new Map,Qm.set(o,p);for(var N=o.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<N.length;k++){var P=N[k];(P.nodeName==="LINK"||P.getAttribute("media")!=="not all")&&(p.set(P.dataset.precedence,P),g=P)}g&&p.set(null,g)}N=l.instance,P=N.getAttribute("data-precedence"),k=p.get(P)||g,k===g&&p.set(null,N),p.set(P,N),this.count++,g=Jm.bind(this),N.addEventListener("load",g),N.addEventListener("error",g),k?k.parentNode.insertBefore(N,k.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(N,o.firstChild)),l.state.loading|=4}}var Jd={$$typeof:T,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function U9(o,l,p,g,N,k,P,Y,oe){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=yr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yr(0),this.hiddenUpdates=yr(null),this.identifierPrefix=g,this.onUncaughtError=N,this.onCaughtError=k,this.onRecoverableError=P,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=oe,this.incompleteTransitions=new Map}function HD(o,l,p,g,N,k,P,Y,oe,ge,xe,ke){return o=new U9(o,l,p,P,oe,ge,xe,ke,Y),l=1,k===!0&&(l|=24),k=Ca(3,null,null,l),o.current=k,k.stateNode=o,l=Uv(),l.refCount++,o.pooledCache=l,l.refCount++,k.memoizedState={element:g,isDehydrated:p,cache:l},Bv(k),o}function VD(o){return o?(o=nc,o):nc}function GD(o,l,p,g,N,k){N=VD(N),g.context===null?g.context=N:g.pendingContext=N,g=Ws(l),g.payload={element:p},k=k===void 0?null:k,k!==null&&(g.callback=k),p=Ks(o,g,l),p!==null&&(ga(p,o,l),Ad(p,o,l))}function WD(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var p=o.retryLane;o.retryLane=p!==0&&p<l?p:l}}function sw(o,l){WD(o,l),(o=o.alternate)&&WD(o,l)}function KD(o){if(o.tag===13||o.tag===31){var l=Wi(o,67108864);l!==null&&ga(l,o,67108864),sw(o,67108864)}}function YD(o){if(o.tag===13||o.tag===31){var l=Da();l=la(l);var p=Wi(o,l);p!==null&&ga(p,o,l),sw(o,l)}}var th=!0;function $9(o,l,p,g){var N=F.T;F.T=null;var k=K.p;try{K.p=2,iw(o,l,p,g)}finally{K.p=k,F.T=N}}function z9(o,l,p,g){var N=F.T;F.T=null;var k=K.p;try{K.p=8,iw(o,l,p,g)}finally{K.p=k,F.T=N}}function iw(o,l,p,g){if(th){var N=lw(g);if(N===null)K0(o,l,g,nh,p),qD(o,g);else if(B9(N,o,l,p,g))g.stopPropagation();else if(qD(o,g),l&4&&-1<F9.indexOf(o)){for(;N!==null;){var k=mt(N);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var P=mn(k.pendingLanes);if(P!==0){var Y=k;for(Y.pendingLanes|=2,Y.entangledLanes|=2;P;){var oe=1<<31-Me(P);Y.entanglements[1]|=oe,P&=~oe}Do(k),(ln&6)===0&&(Um=we()+500,Wd(0))}}break;case 31:case 13:Y=Wi(k,2),Y!==null&&ga(Y,k,2),zm(),sw(k,2)}if(k=lw(g),k===null&&K0(o,l,g,nh,p),k===N)break;N=k}N!==null&&g.stopPropagation()}else K0(o,l,g,null,p)}}function lw(o){return o=uv(o),cw(o)}var nh=null;function cw(o){if(nh=null,o=Zt(o),o!==null){var l=s(o);if(l===null)o=null;else{var p=l.tag;if(p===13){if(o=i(l),o!==null)return o;o=null}else if(p===31){if(o=c(l),o!==null)return o;o=null}else if(p===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null)}}return nh=o,null}function ZD(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(at()){case lt:return 2;case gt:return 8;case Ct:case Le:return 32;case $e:return 268435456;default:return 32}default:return 32}}var uw=!1,ai=null,oi=null,si=null,Qd=new Map,ef=new Map,ii=[],F9="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function qD(o,l){switch(o){case"focusin":case"focusout":ai=null;break;case"dragenter":case"dragleave":oi=null;break;case"mouseover":case"mouseout":si=null;break;case"pointerover":case"pointerout":Qd.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":ef.delete(l.pointerId)}}function tf(o,l,p,g,N,k){return o===null||o.nativeEvent!==k?(o={blockedOn:l,domEventName:p,eventSystemFlags:g,nativeEvent:k,targetContainers:[N]},l!==null&&(l=mt(l),l!==null&&KD(l)),o):(o.eventSystemFlags|=g,l=o.targetContainers,N!==null&&l.indexOf(N)===-1&&l.push(N),o)}function B9(o,l,p,g,N){switch(l){case"focusin":return ai=tf(ai,o,l,p,g,N),!0;case"dragenter":return oi=tf(oi,o,l,p,g,N),!0;case"mouseover":return si=tf(si,o,l,p,g,N),!0;case"pointerover":var k=N.pointerId;return Qd.set(k,tf(Qd.get(k)||null,o,l,p,g,N)),!0;case"gotpointercapture":return k=N.pointerId,ef.set(k,tf(ef.get(k)||null,o,l,p,g,N)),!0}return!1}function XD(o){var l=Zt(o.target);if(l!==null){var p=s(l);if(p!==null){if(l=p.tag,l===13){if(l=i(p),l!==null){o.blockedOn=l,Na(o.priority,function(){YD(p)});return}}else if(l===31){if(l=c(p),l!==null){o.blockedOn=l,Na(o.priority,function(){YD(p)});return}}else if(l===3&&p.stateNode.current.memoizedState.isDehydrated){o.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}o.blockedOn=null}function rh(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var p=lw(o.nativeEvent);if(p===null){p=o.nativeEvent;var g=new p.constructor(p.type,p);cv=g,p.target.dispatchEvent(g),cv=null}else return l=mt(p),l!==null&&KD(l),o.blockedOn=p,!1;l.shift()}return!0}function JD(o,l,p){rh(o)&&p.delete(l)}function H9(){uw=!1,ai!==null&&rh(ai)&&(ai=null),oi!==null&&rh(oi)&&(oi=null),si!==null&&rh(si)&&(si=null),Qd.forEach(JD),ef.forEach(JD)}function ah(o,l){o.blockedOn===l&&(o.blockedOn=null,uw||(uw=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,H9)))}var oh=null;function QD(o){oh!==o&&(oh=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){oh===o&&(oh=null);for(var l=0;l<o.length;l+=3){var p=o[l],g=o[l+1],N=o[l+2];if(typeof g!="function"){if(cw(g||p)===null)continue;break}var k=mt(p);k!==null&&(o.splice(l,3),l-=3,l0(k,{pending:!0,data:N,method:p.method,action:g},g,N))}}))}function Nc(o){function l(oe){return ah(oe,o)}ai!==null&&ah(ai,o),oi!==null&&ah(oi,o),si!==null&&ah(si,o),Qd.forEach(l),ef.forEach(l);for(var p=0;p<ii.length;p++){var g=ii[p];g.blockedOn===o&&(g.blockedOn=null)}for(;0<ii.length&&(p=ii[0],p.blockedOn===null);)XD(p),p.blockedOn===null&&ii.shift();if(p=(o.ownerDocument||o).$$reactFormReplay,p!=null)for(g=0;g<p.length;g+=3){var N=p[g],k=p[g+1],P=N[Hn]||null;if(typeof k=="function")P||QD(p);else if(P){var Y=null;if(k&&k.hasAttribute("formAction")){if(N=k,P=k[Hn]||null)Y=P.formAction;else if(cw(N)!==null)continue}else Y=P.action;typeof Y=="function"?p[g+1]=Y:(p.splice(g,3),g-=3),QD(p)}}}function eL(){function o(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(P){return N=P})},focusReset:"manual",scroll:"manual"})}function l(){N!==null&&(N(),N=null),g||setTimeout(p,20)}function p(){if(!g&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,N=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(p,100),function(){g=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),N!==null&&(N(),N=null)}}}function dw(o){this._internalRoot=o}sh.prototype.render=dw.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(r(409));var p=l.current,g=Da();GD(p,g,o,l,null,null)},sh.prototype.unmount=dw.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;GD(o.current,2,null,o,null,null),zm(),l[Qr]=null}};function sh(o){this._internalRoot=o}sh.prototype.unstable_scheduleHydration=function(o){if(o){var l=Ta();o={blockedOn:null,target:o,priority:l};for(var p=0;p<ii.length&&l!==0&&l<ii[p].priority;p++);ii.splice(p,0,o),p===0&&XD(o)}};var tL=t.version;if(tL!=="19.2.0")throw Error(r(527,tL,"19.2.0"));K.findDOMNode=function(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=f(l),o=o!==null?m(o):null,o=o===null?null:o.stateNode,o};var V9={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ih=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ih.isDisabled&&ih.supportsFiber)try{Ut=ih.inject(V9),st=ih}catch{}}return sf.createRoot=function(o,l){if(!a(o))throw Error(r(299));var p=!1,g="",N=lO,k=cO,P=uO;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(N=l.onUncaughtError),l.onCaughtError!==void 0&&(k=l.onCaughtError),l.onRecoverableError!==void 0&&(P=l.onRecoverableError)),l=HD(o,1,!1,null,null,p,g,null,N,k,P,eL),o[Qr]=l.current,W0(o),new dw(l)},sf.hydrateRoot=function(o,l,p){if(!a(o))throw Error(r(299));var g=!1,N="",k=lO,P=cO,Y=uO,oe=null;return p!=null&&(p.unstable_strictMode===!0&&(g=!0),p.identifierPrefix!==void 0&&(N=p.identifierPrefix),p.onUncaughtError!==void 0&&(k=p.onUncaughtError),p.onCaughtError!==void 0&&(P=p.onCaughtError),p.onRecoverableError!==void 0&&(Y=p.onRecoverableError),p.formState!==void 0&&(oe=p.formState)),l=HD(o,1,!0,l,p??null,g,N,oe,k,P,Y,eL),l.context=VD(null),p=l.current,g=Da(),g=la(g),N=Ws(g),N.callback=null,Ks(p,N,g),p=g,l.current.lanes=p,dn(l,p),Do(l),o[Qr]=l.current,W0(o),new sh(l)},sf.version="19.2.0",sf}var cj;function xJ(){if(cj)return Lw.exports;cj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Lw.exports=EJ(),Lw.exports}var SJ=xJ();const _J=bp(SJ);var uj="popstate";function TJ(e={}){function t(r,a){let{pathname:s,search:i,hash:c}=r.location;return cx("",{pathname:s,search:i,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:Kf(a)}return kJ(t,n,null,e)}function Gn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wo(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function NJ(){return Math.random().toString(36).substring(2,10)}function dj(e,t){return{usr:e.state,key:e.key,idx:t}}function cx(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Gu(t):t,state:n,key:t&&t.key||r||NJ()}}function Kf({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Gu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function kJ(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:s=!1}=r,i=a.history,c="POP",u=null,f=m();f==null&&(f=0,i.replaceState({...i.state,idx:f},""));function m(){return(i.state||{idx:null}).idx}function h(){c="POP";let w=m(),_=w==null?null:w-f;f=w,u&&u({action:c,location:E.location,delta:_})}function b(w,_){c="PUSH";let S=cx(E.location,w,_);f=m()+1;let T=dj(S,f),R=E.createHref(S);try{i.pushState(T,"",R)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(R)}s&&u&&u({action:c,location:E.location,delta:1})}function y(w,_){c="REPLACE";let S=cx(E.location,w,_);f=m();let T=dj(S,f),R=E.createHref(S);i.replaceState(T,"",R),s&&u&&u({action:c,location:E.location,delta:0})}function x(w){return CJ(w)}let E={get action(){return c},get location(){return e(a,i)},listen(w){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(uj,h),u=w,()=>{a.removeEventListener(uj,h),u=null}},createHref(w){return t(a,w)},createURL:x,encodeLocation(w){let _=x(w);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:b,replace:y,go(w){return i.go(w)}};return E}function CJ(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Gn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Kf(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function W2(e,t,n="/"){return RJ(e,t,n,!1)}function RJ(e,t,n,r){let a=typeof t=="string"?Gu(t):t,s=Cs(a.pathname||"/",n);if(s==null)return null;let i=K2(e);AJ(i);let c=null;for(let u=0;c==null&&u<i.length;++u){let f=FJ(s);c=$J(i[u],f,r)}return c}function K2(e,t=[],n=[],r="",a=!1){let s=(i,c,u=a,f)=>{let m={relativePath:f===void 0?i.path||"":f,caseSensitive:i.caseSensitive===!0,childrenIndex:c,route:i};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&u)return;Gn(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let h=Ss([r,m.relativePath]),b=n.concat(m);i.children&&i.children.length>0&&(Gn(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),K2(i.children,t,b,h,u)),!(i.path==null&&!i.index)&&t.push({path:h,score:PJ(h,i.index),routesMeta:b})};return e.forEach((i,c)=>{if(i.path===""||!i.path?.includes("?"))s(i,c);else for(let u of Y2(i.path))s(i,c,!0,u)}),t}function Y2(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return a?[s,""]:[s];let i=Y2(r.join("/")),c=[];return c.push(...i.map(u=>u===""?s:[s,u].join("/"))),a&&c.push(...i),c.map(u=>e.startsWith("/")&&u===""?"/":u)}function AJ(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:UJ(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var IJ=/^:[\w-]+$/,OJ=3,DJ=2,LJ=1,MJ=10,jJ=-2,fj=e=>e==="*";function PJ(e,t){let n=e.split("/"),r=n.length;return n.some(fj)&&(r+=jJ),t&&(r+=DJ),n.filter(a=>!fj(a)).reduce((a,s)=>a+(IJ.test(s)?OJ:s===""?LJ:MJ),r)}function UJ(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function $J(e,t,n=!1){let{routesMeta:r}=e,a={},s="/",i=[];for(let c=0;c<r.length;++c){let u=r[c],f=c===r.length-1,m=s==="/"?t:t.slice(s.length)||"/",h=ob({path:u.relativePath,caseSensitive:u.caseSensitive,end:f},m),b=u.route;if(!h&&f&&n&&!r[r.length-1].route.index&&(h=ob({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},m)),!h)return null;Object.assign(a,h.params),i.push({params:a,pathname:Ss([s,h.pathname]),pathnameBase:WJ(Ss([s,h.pathnameBase])),route:b}),h.pathnameBase!=="/"&&(s=Ss([s,h.pathnameBase]))}return i}function ob(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=zJ(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:r.reduce((f,{paramName:m,isOptional:h},b)=>{if(m==="*"){let x=c[b]||"";i=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const y=c[b];return h&&!y?f[m]=void 0:f[m]=(y||"").replace(/%2F/g,"/"),f},{}),pathname:s,pathnameBase:i,pattern:e}}function zJ(e,t=!1,n=!0){wo(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function FJ(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return wo(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Cs(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var BJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,HJ=e=>BJ.test(e);function VJ(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Gu(e):e,s;if(n)if(HJ(n))s=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),wo(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${n}`)}n.startsWith("/")?s=pj(n.substring(1),"/"):s=pj(n,t)}else s=t;return{pathname:s,search:KJ(r),hash:YJ(a)}}function pj(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Uw(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function GJ(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Z2(e){let t=GJ(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function q2(e,t,n,r=!1){let a;typeof e=="string"?a=Gu(e):(a={...e},Gn(!a.pathname||!a.pathname.includes("?"),Uw("?","pathname","search",a)),Gn(!a.pathname||!a.pathname.includes("#"),Uw("#","pathname","hash",a)),Gn(!a.search||!a.search.includes("#"),Uw("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,c;if(i==null)c=n;else{let h=t.length-1;if(!r&&i.startsWith("..")){let b=i.split("/");for(;b[0]==="..";)b.shift(),h-=1;a.pathname=b.join("/")}c=h>=0?t[h]:"/"}let u=VJ(a,c),f=i&&i!=="/"&&i.endsWith("/"),m=(s||i===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(f||m)&&(u.pathname+="/"),u}var Ss=e=>e.join("/").replace(/\/\/+/g,"/"),WJ=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),KJ=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,YJ=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ZJ(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var X2=["POST","PUT","PATCH","DELETE"];new Set(X2);var qJ=["GET",...X2];new Set(qJ);var Wu=v.createContext(null);Wu.displayName="DataRouter";var iy=v.createContext(null);iy.displayName="DataRouterState";v.createContext(!1);var J2=v.createContext({isTransitioning:!1});J2.displayName="ViewTransition";var XJ=v.createContext(new Map);XJ.displayName="Fetchers";var JJ=v.createContext(null);JJ.displayName="Await";var Go=v.createContext(null);Go.displayName="Navigation";var Sp=v.createContext(null);Sp.displayName="Location";var Ms=v.createContext({outlet:null,matches:[],isDataRoute:!1});Ms.displayName="Route";var h_=v.createContext(null);h_.displayName="RouteError";function QJ(e,{relative:t}={}){Gn(_p(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=v.useContext(Go),{hash:a,pathname:s,search:i}=Tp(e,{relative:t}),c=s;return n!=="/"&&(c=s==="/"?n:Ss([n,s])),r.createHref({pathname:c,search:i,hash:a})}function _p(){return v.useContext(Sp)!=null}function js(){return Gn(_p(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Sp).location}var Q2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function eF(e){v.useContext(Go).static||v.useLayoutEffect(e)}function Ku(){let{isDataRoute:e}=v.useContext(Ms);return e?fQ():eQ()}function eQ(){Gn(_p(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Wu),{basename:t,navigator:n}=v.useContext(Go),{matches:r}=v.useContext(Ms),{pathname:a}=js(),s=JSON.stringify(Z2(r)),i=v.useRef(!1);return eF(()=>{i.current=!0}),v.useCallback((u,f={})=>{if(wo(i.current,Q2),!i.current)return;if(typeof u=="number"){n.go(u);return}let m=q2(u,JSON.parse(s),a,f.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Ss([t,m.pathname])),(f.replace?n.replace:n.push)(m,f.state,f)},[t,n,s,a,e])}v.createContext(null);function Tp(e,{relative:t}={}){let{matches:n}=v.useContext(Ms),{pathname:r}=js(),a=JSON.stringify(Z2(n));return v.useMemo(()=>q2(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function tQ(e,t){return tF(e,t)}function tF(e,t,n,r,a){Gn(_p(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(Go),{matches:i}=v.useContext(Ms),c=i[i.length-1],u=c?c.params:{},f=c?c.pathname:"/",m=c?c.pathnameBase:"/",h=c&&c.route;{let S=h&&h.path||"";nF(f,!h||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
57
+ `+g.stack}}var _e=Object.prototype.hasOwnProperty,Ue=e.unstable_scheduleCallback,fe=e.unstable_cancelCallback,Ae=e.unstable_shouldYield,ze=e.unstable_requestPaint,we=e.unstable_now,at=e.unstable_getCurrentPriorityLevel,lt=e.unstable_ImmediatePriority,gt=e.unstable_UserBlockingPriority,Ct=e.unstable_NormalPriority,Le=e.unstable_LowPriority,$e=e.unstable_IdlePriority,bt=e.log,nt=e.unstable_setDisableYieldValue,Ut=null,ot=null;function Ie(o){if(typeof bt=="function"&&nt(o),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(Ut,o)}catch{}}var Me=Math.clz32?Math.clz32:pt,He=Math.log,it=Math.LN2;function pt(o){return o>>>=0,o===0?32:31-(He(o)/it|0)|0}var Et=256,xt=262144,un=4194304;function mn(o){var l=o&42;if(l!==0)return l;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ze(o,l,p){var g=o.pendingLanes;if(g===0)return 0;var N=0,k=o.suspendedLanes,P=o.pingedLanes;o=o.warmLanes;var Y=g&134217727;return Y!==0?(g=Y&~k,g!==0?N=mn(g):(P&=Y,P!==0?N=mn(P):p||(p=Y&~o,p!==0&&(N=mn(p))))):(Y=g&~k,Y!==0?N=mn(Y):P!==0?N=mn(P):p||(p=g&~o,p!==0&&(N=mn(p)))),N===0?0:l!==0&&l!==N&&(l&k)===0&&(k=N&-N,p=l&-l,k>=p||k===32&&(p&4194048)!==0)?l:N}function vt(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function jt(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pt(){var o=un;return un<<=1,(un&62914560)===0&&(un=4194304),o}function yr(o){for(var l=[],p=0;31>p;p++)l.push(o);return l}function dn(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Xn(o,l,p,g,N,k){var P=o.pendingLanes;o.pendingLanes=p,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=p,o.entangledLanes&=p,o.errorRecoveryDisabledLanes&=p,o.shellSuspendCounter=0;var Y=o.entanglements,oe=o.expirationTimes,ge=o.hiddenUpdates;for(p=P&~p;0<p;){var xe=31-Me(p),ke=1<<xe;Y[xe]=0,oe[xe]=-1;var ye=ge[xe];if(ye!==null)for(ge[xe]=null,xe=0;xe<ye.length;xe++){var ve=ye[xe];ve!==null&&(ve.lane&=-536870913)}p&=~ke}g!==0&&Jn(o,g,0),k!==0&&N===0&&o.tag!==0&&(o.suspendedLanes|=k&~(P&~l))}function Jn(o,l,p){o.pendingLanes|=l,o.suspendedLanes&=~l;var g=31-Me(l);o.entangledLanes|=l,o.entanglements[g]=o.entanglements[g]|1073741824|p&261930}function wn(o,l){var p=o.entangledLanes|=l;for(o=o.entanglements;p;){var g=31-Me(p),N=1<<g;N&l|o[g]&l&&(o[g]|=l),p&=~N}}function fn(o,l){var p=l&-l;return p=(p&42)!==0?1:la(p),(p&(o.suspendedLanes|l))!==0?0:p}function la(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Qt(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Ta(){var o=K.p;return o!==0?o:(o=window.event,o===void 0?32:ZD(o.type))}function Na(o,l){var p=K.p;try{return K.p=o,l()}finally{K.p=p}}var vr=Math.random().toString(36).slice(2),ht="__reactFiber$"+vr,Hn="__reactProps$"+vr,Qr="__reactContainer$"+vr,so="__reactEvents$"+vr,Hr="__reactListeners$"+vr,Us="__reactHandles$"+vr,Rt="__reactResources$"+vr,pn="__reactMarker$"+vr;function sn(o){delete o[ht],delete o[Hn],delete o[so],delete o[Hr],delete o[Us]}function Zt(o){var l=o[ht];if(l)return l;for(var p=o.parentNode;p;){if(l=p[Qr]||p[ht]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(o=DD(o);o!==null;){if(p=o[ht])return p;o=DD(o)}return l}o=p,p=o.parentNode}return null}function mt(o){if(o=o[ht]||o[Qr]){var l=o.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return o}return null}function nn(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o.stateNode;throw Error(r(33))}function dr(o){var l=o[Rt];return l||(l=o[Rt]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function st(o){o[pn]=!0}var ca=new Set,Ht={};function An(o,l){hn(o,l),hn(o+"Capture",l)}function hn(o,l){for(Ht[o]=l,o=0;o<l.length;o++)ca.add(l[o])}var kn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),rr={},wr={};function Co(o){return _e.call(wr,o)?!0:_e.call(rr,o)?!1:kn.test(o)?wr[o]=!0:(rr[o]=!0,!1)}function $t(o,l,p){if(Co(l))if(p===null)o.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":o.removeAttribute(l);return;case"boolean":var g=l.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){o.removeAttribute(l);return}}o.setAttribute(l,""+p)}}function ua(o,l,p){if(p===null)o.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttribute(l,""+p)}}function Er(o,l,p,g){if(g===null)o.removeAttribute(p);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(p);return}o.setAttributeNS(l,p,""+g)}}function Vr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ro(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function ov(o,l,p){var g=Object.getOwnPropertyDescriptor(o.constructor.prototype,l);if(!o.hasOwnProperty(l)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var N=g.get,k=g.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return N.call(this)},set:function(P){p=""+P,k.call(this,P)}}),Object.defineProperty(o,l,{enumerable:g.enumerable}),{getValue:function(){return p},setValue:function(P){p=""+P},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function Kl(o){if(!o._valueTracker){var l=Ro(o)?"checked":"value";o._valueTracker=ov(o,l,""+o[l])}}function Jp(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var p=l.getValue(),g="";return o&&(g=Ro(o)?o.checked?"true":"false":o.value),o=g,o!==p?(l.setValue(o),!0):!1}function Yl(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var Zl=/[\n"\\]/g;function ea(o){return o.replace(Zl,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function sv(o,l,p,g,N,k,P,Y){o.name="",P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?o.type=P:o.removeAttribute("type"),l!=null?P==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+Vr(l)):o.value!==""+Vr(l)&&(o.value=""+Vr(l)):P!=="submit"&&P!=="reset"||o.removeAttribute("value"),l!=null?iv(o,P,Vr(l)):p!=null?iv(o,P,Vr(p)):g!=null&&o.removeAttribute("value"),N==null&&k!=null&&(o.defaultChecked=!!k),N!=null&&(o.checked=N&&typeof N!="function"&&typeof N!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?o.name=""+Vr(Y):o.removeAttribute("name")}function md(o,l,p,g,N,k,P,Y){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(o.type=k),l!=null||p!=null){if(!(k!=="submit"&&k!=="reset"||l!=null)){Kl(o);return}p=p!=null?""+Vr(p):"",l=l!=null?""+Vr(l):p,Y||l===o.value||(o.value=l),o.defaultValue=l}g=g??N,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=Y?o.checked:!!g,o.defaultChecked=!!g,P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(o.name=P),Kl(o)}function iv(o,l,p){l==="number"&&Yl(o.ownerDocument)===o||o.defaultValue===""+p||(o.defaultValue=""+p)}function $s(o,l,p,g){if(o=o.options,l){l={};for(var N=0;N<p.length;N++)l["$"+p[N]]=!0;for(p=0;p<o.length;p++)N=l.hasOwnProperty("$"+o[p].value),o[p].selected!==N&&(o[p].selected=N),N&&g&&(o[p].defaultSelected=!0)}else{for(p=""+Vr(p),l=null,N=0;N<o.length;N++){if(o[N].value===p){o[N].selected=!0,g&&(o[N].defaultSelected=!0);return}l!==null||o[N].disabled||(l=o[N])}l!==null&&(l.selected=!0)}}function w1(o,l,p){if(l!=null&&(l=""+Vr(l),l!==o.value&&(o.value=l),p==null)){o.defaultValue!==l&&(o.defaultValue=l);return}o.defaultValue=p!=null?""+Vr(p):""}function E1(o,l,p,g){if(l==null){if(g!=null){if(p!=null)throw Error(r(92));if(re(g)){if(1<g.length)throw Error(r(93));g=g[0]}p=g}p==null&&(p=""),l=p}p=Vr(l),o.defaultValue=p,g=o.textContent,g===p&&g!==""&&g!==null&&(o.value=g),Kl(o)}function Zo(o,l){if(l){var p=o.firstChild;if(p&&p===o.lastChild&&p.nodeType===3){p.nodeValue=l;return}}o.textContent=l}var F6=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function x1(o,l,p){var g=l.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?g?o.setProperty(l,""):l==="float"?o.cssFloat="":o[l]="":g?o.setProperty(l,p):typeof p!="number"||p===0||F6.has(l)?l==="float"?o.cssFloat=p:o[l]=(""+p).trim():o[l]=p+"px"}function S1(o,l,p){if(l!=null&&typeof l!="object")throw Error(r(62));if(o=o.style,p!=null){for(var g in p)!p.hasOwnProperty(g)||l!=null&&l.hasOwnProperty(g)||(g.indexOf("--")===0?o.setProperty(g,""):g==="float"?o.cssFloat="":o[g]="");for(var N in l)g=l[N],l.hasOwnProperty(N)&&p[N]!==g&&x1(o,N,g)}else for(var k in l)l.hasOwnProperty(k)&&x1(o,k,l[k])}function lv(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var B6=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),H6=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qp(o){return H6.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function qo(){}var cv=null;function uv(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var ql=null,Xl=null;function _1(o){var l=mt(o);if(l&&(o=l.stateNode)){var p=o[Hn]||null;e:switch(o=l.stateNode,l.type){case"input":if(sv(o,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),l=p.name,p.type==="radio"&&l!=null){for(p=o;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+ea(""+l)+'"][type="radio"]'),l=0;l<p.length;l++){var g=p[l];if(g!==o&&g.form===o.form){var N=g[Hn]||null;if(!N)throw Error(r(90));sv(g,N.value,N.defaultValue,N.defaultValue,N.checked,N.defaultChecked,N.type,N.name)}}for(l=0;l<p.length;l++)g=p[l],g.form===o.form&&Jp(g)}break e;case"textarea":w1(o,p.value,p.defaultValue);break e;case"select":l=p.value,l!=null&&$s(o,!!p.multiple,l,!1)}}}var dv=!1;function T1(o,l,p){if(dv)return o(l,p);dv=!0;try{var g=o(l);return g}finally{if(dv=!1,(ql!==null||Xl!==null)&&(zm(),ql&&(l=ql,o=Xl,Xl=ql=null,_1(l),o)))for(l=0;l<o.length;l++)_1(o[l])}}function hd(o,l){var p=o.stateNode;if(p===null)return null;var g=p[Hn]||null;if(g===null)return null;p=g[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(o=o.type,g=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!g;break e;default:o=!1}if(o)return null;if(p&&typeof p!="function")throw Error(r(231,l,typeof p));return p}var Xo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fv=!1;if(Xo)try{var gd={};Object.defineProperty(gd,"passive",{get:function(){fv=!0}}),window.addEventListener("test",gd,gd),window.removeEventListener("test",gd,gd)}catch{fv=!1}var zs=null,pv=null,em=null;function N1(){if(em)return em;var o,l=pv,p=l.length,g,N="value"in zs?zs.value:zs.textContent,k=N.length;for(o=0;o<p&&l[o]===N[o];o++);var P=p-o;for(g=1;g<=P&&l[p-g]===N[k-g];g++);return em=N.slice(o,1<g?1-g:void 0)}function tm(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function nm(){return!0}function k1(){return!1}function da(o){function l(p,g,N,k,P){this._reactName=p,this._targetInst=N,this.type=g,this.nativeEvent=k,this.target=P,this.currentTarget=null;for(var Y in o)o.hasOwnProperty(Y)&&(p=o[Y],this[Y]=p?p(k):k[Y]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?nm:k1,this.isPropagationStopped=k1,this}return h(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=nm)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=nm)},persist:function(){},isPersistent:nm}),l}var Hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rm=da(Hi),bd=h({},Hi,{view:0,detail:0}),V6=da(bd),mv,hv,yd,am=h({},bd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bv,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==yd&&(yd&&o.type==="mousemove"?(mv=o.screenX-yd.screenX,hv=o.screenY-yd.screenY):hv=mv=0,yd=o),mv)},movementY:function(o){return"movementY"in o?o.movementY:hv}}),C1=da(am),G6=h({},am,{dataTransfer:0}),W6=da(G6),K6=h({},bd,{relatedTarget:0}),gv=da(K6),Y6=h({},Hi,{animationName:0,elapsedTime:0,pseudoElement:0}),Z6=da(Y6),q6=h({},Hi,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),X6=da(q6),J6=h({},Hi,{data:0}),R1=da(J6),Q6={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},e8={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},t8={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function n8(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=t8[o])?!!l[o]:!1}function bv(){return n8}var r8=h({},bd,{key:function(o){if(o.key){var l=Q6[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=tm(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?e8[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bv,charCode:function(o){return o.type==="keypress"?tm(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?tm(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),a8=da(r8),o8=h({},am,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),A1=da(o8),s8=h({},bd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bv}),i8=da(s8),l8=h({},Hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),c8=da(l8),u8=h({},am,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),d8=da(u8),f8=h({},Hi,{newState:0,oldState:0}),p8=da(f8),m8=[9,13,27,32],yv=Xo&&"CompositionEvent"in window,vd=null;Xo&&"documentMode"in document&&(vd=document.documentMode);var h8=Xo&&"TextEvent"in window&&!vd,I1=Xo&&(!yv||vd&&8<vd&&11>=vd),O1=" ",D1=!1;function L1(o,l){switch(o){case"keyup":return m8.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function M1(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Jl=!1;function g8(o,l){switch(o){case"compositionend":return M1(l);case"keypress":return l.which!==32?null:(D1=!0,O1);case"textInput":return o=l.data,o===O1&&D1?null:o;default:return null}}function b8(o,l){if(Jl)return o==="compositionend"||!yv&&L1(o,l)?(o=N1(),em=pv=zs=null,Jl=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return I1&&l.locale!=="ko"?null:l.data;default:return null}}var y8={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function j1(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!y8[o.type]:l==="textarea"}function P1(o,l,p,g){ql?Xl?Xl.push(g):Xl=[g]:ql=g,l=Km(l,"onChange"),0<l.length&&(p=new rm("onChange","change",null,p,g),o.push({event:p,listeners:l}))}var wd=null,Ed=null;function v8(o){vD(o,0)}function om(o){var l=nn(o);if(Jp(l))return o}function U1(o,l){if(o==="change")return l}var $1=!1;if(Xo){var vv;if(Xo){var wv="oninput"in document;if(!wv){var z1=document.createElement("div");z1.setAttribute("oninput","return;"),wv=typeof z1.oninput=="function"}vv=wv}else vv=!1;$1=vv&&(!document.documentMode||9<document.documentMode)}function F1(){wd&&(wd.detachEvent("onpropertychange",B1),Ed=wd=null)}function B1(o){if(o.propertyName==="value"&&om(Ed)){var l=[];P1(l,Ed,o,uv(o)),T1(v8,l)}}function w8(o,l,p){o==="focusin"?(F1(),wd=l,Ed=p,wd.attachEvent("onpropertychange",B1)):o==="focusout"&&F1()}function E8(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return om(Ed)}function x8(o,l){if(o==="click")return om(l)}function S8(o,l){if(o==="input"||o==="change")return om(l)}function _8(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var ka=typeof Object.is=="function"?Object.is:_8;function xd(o,l){if(ka(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var p=Object.keys(o),g=Object.keys(l);if(p.length!==g.length)return!1;for(g=0;g<p.length;g++){var N=p[g];if(!_e.call(l,N)||!ka(o[N],l[N]))return!1}return!0}function H1(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function V1(o,l){var p=H1(o);o=0;for(var g;p;){if(p.nodeType===3){if(g=o+p.textContent.length,o<=l&&g>=l)return{node:p,offset:l-o};o=g}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=H1(p)}}function G1(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?G1(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function W1(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=Yl(o.document);l instanceof o.HTMLIFrameElement;){try{var p=typeof l.contentWindow.location.href=="string"}catch{p=!1}if(p)o=l.contentWindow;else break;l=Yl(o.document)}return l}function Ev(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var T8=Xo&&"documentMode"in document&&11>=document.documentMode,Ql=null,xv=null,Sd=null,Sv=!1;function K1(o,l,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Sv||Ql==null||Ql!==Yl(g)||(g=Ql,"selectionStart"in g&&Ev(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Sd&&xd(Sd,g)||(Sd=g,g=Km(xv,"onSelect"),0<g.length&&(l=new rm("onSelect","select",null,l,p),o.push({event:l,listeners:g}),l.target=Ql)))}function Vi(o,l){var p={};return p[o.toLowerCase()]=l.toLowerCase(),p["Webkit"+o]="webkit"+l,p["Moz"+o]="moz"+l,p}var ec={animationend:Vi("Animation","AnimationEnd"),animationiteration:Vi("Animation","AnimationIteration"),animationstart:Vi("Animation","AnimationStart"),transitionrun:Vi("Transition","TransitionRun"),transitionstart:Vi("Transition","TransitionStart"),transitioncancel:Vi("Transition","TransitionCancel"),transitionend:Vi("Transition","TransitionEnd")},_v={},Y1={};Xo&&(Y1=document.createElement("div").style,"AnimationEvent"in window||(delete ec.animationend.animation,delete ec.animationiteration.animation,delete ec.animationstart.animation),"TransitionEvent"in window||delete ec.transitionend.transition);function Gi(o){if(_v[o])return _v[o];if(!ec[o])return o;var l=ec[o],p;for(p in l)if(l.hasOwnProperty(p)&&p in Y1)return _v[o]=l[p];return o}var Z1=Gi("animationend"),q1=Gi("animationiteration"),X1=Gi("animationstart"),N8=Gi("transitionrun"),k8=Gi("transitionstart"),C8=Gi("transitioncancel"),J1=Gi("transitionend"),Q1=new Map,Tv="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Tv.push("scrollEnd");function io(o,l){Q1.set(o,l),An(l,[o])}var sm=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Fa=[],tc=0,Nv=0;function im(){for(var o=tc,l=Nv=tc=0;l<o;){var p=Fa[l];Fa[l++]=null;var g=Fa[l];Fa[l++]=null;var N=Fa[l];Fa[l++]=null;var k=Fa[l];if(Fa[l++]=null,g!==null&&N!==null){var P=g.pending;P===null?N.next=N:(N.next=P.next,P.next=N),g.pending=N}k!==0&&eI(p,N,k)}}function lm(o,l,p,g){Fa[tc++]=o,Fa[tc++]=l,Fa[tc++]=p,Fa[tc++]=g,Nv|=g,o.lanes|=g,o=o.alternate,o!==null&&(o.lanes|=g)}function kv(o,l,p,g){return lm(o,l,p,g),cm(o)}function Wi(o,l){return lm(o,null,null,l),cm(o)}function eI(o,l,p){o.lanes|=p;var g=o.alternate;g!==null&&(g.lanes|=p);for(var N=!1,k=o.return;k!==null;)k.childLanes|=p,g=k.alternate,g!==null&&(g.childLanes|=p),k.tag===22&&(o=k.stateNode,o===null||o._visibility&1||(N=!0)),o=k,k=k.return;return o.tag===3?(k=o.stateNode,N&&l!==null&&(N=31-Me(p),o=k.hiddenUpdates,g=o[N],g===null?o[N]=[l]:g.push(l),l.lane=p|536870912),k):null}function cm(o){if(50<Gd)throw Gd=0,j0=null,Error(r(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}var nc={};function R8(o,l,p,g){this.tag=o,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ca(o,l,p,g){return new R8(o,l,p,g)}function Cv(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Jo(o,l){var p=o.alternate;return p===null?(p=Ca(o.tag,l,o.key,o.mode),p.elementType=o.elementType,p.type=o.type,p.stateNode=o.stateNode,p.alternate=o,o.alternate=p):(p.pendingProps=l,p.type=o.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=o.flags&65011712,p.childLanes=o.childLanes,p.lanes=o.lanes,p.child=o.child,p.memoizedProps=o.memoizedProps,p.memoizedState=o.memoizedState,p.updateQueue=o.updateQueue,l=o.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=o.sibling,p.index=o.index,p.ref=o.ref,p.refCleanup=o.refCleanup,p}function tI(o,l){o.flags&=65011714;var p=o.alternate;return p===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=p.childLanes,o.lanes=p.lanes,o.child=p.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=p.memoizedProps,o.memoizedState=p.memoizedState,o.updateQueue=p.updateQueue,o.type=p.type,l=p.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function um(o,l,p,g,N,k){var P=0;if(g=o,typeof o=="function")Cv(o)&&(P=1);else if(typeof o=="string")P=L9(o,p,L.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case j:return o=Ca(31,p,l,N),o.elementType=j,o.lanes=k,o;case E:return Ki(p.children,N,k,l);case w:P=8,N|=24;break;case _:return o=Ca(12,p,l,N|2),o.elementType=_,o.lanes=k,o;case C:return o=Ca(13,p,l,N),o.elementType=C,o.lanes=k,o;case I:return o=Ca(19,p,l,N),o.elementType=I,o.lanes=k,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case T:P=10;break e;case S:P=9;break e;case R:P=11;break e;case A:P=14;break e;case O:P=16,g=null;break e}P=29,p=Error(r(130,o===null?"null":typeof o,"")),g=null}return l=Ca(P,p,l,N),l.elementType=o,l.type=g,l.lanes=k,l}function Ki(o,l,p,g){return o=Ca(7,o,g,l),o.lanes=p,o}function Rv(o,l,p){return o=Ca(6,o,null,l),o.lanes=p,o}function nI(o){var l=Ca(18,null,null,0);return l.stateNode=o,l}function Av(o,l,p){return l=Ca(4,o.children!==null?o.children:[],o.key,l),l.lanes=p,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}var rI=new WeakMap;function Ba(o,l){if(typeof o=="object"&&o!==null){var p=rI.get(o);return p!==void 0?p:(l={value:o,source:l,stack:Ee(l)},rI.set(o,l),l)}return{value:o,source:l,stack:Ee(l)}}var rc=[],ac=0,dm=null,_d=0,Ha=[],Va=0,Fs=null,Ao=1,Io="";function Qo(o,l){rc[ac++]=_d,rc[ac++]=dm,dm=o,_d=l}function aI(o,l,p){Ha[Va++]=Ao,Ha[Va++]=Io,Ha[Va++]=Fs,Fs=o;var g=Ao;o=Io;var N=32-Me(g)-1;g&=~(1<<N),p+=1;var k=32-Me(l)+N;if(30<k){var P=N-N%5;k=(g&(1<<P)-1).toString(32),g>>=P,N-=P,Ao=1<<32-Me(l)+N|p<<N|g,Io=k+o}else Ao=1<<k|p<<N|g,Io=o}function Iv(o){o.return!==null&&(Qo(o,1),aI(o,1,0))}function Ov(o){for(;o===dm;)dm=rc[--ac],rc[ac]=null,_d=rc[--ac],rc[ac]=null;for(;o===Fs;)Fs=Ha[--Va],Ha[Va]=null,Io=Ha[--Va],Ha[Va]=null,Ao=Ha[--Va],Ha[Va]=null}function oI(o,l){Ha[Va++]=Ao,Ha[Va++]=Io,Ha[Va++]=Fs,Ao=l.id,Io=l.overflow,Fs=o}var Rr=null,In=null,qt=!1,Bs=null,Ga=!1,Dv=Error(r(519));function Hs(o){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Td(Ba(l,o)),Dv}function sI(o){var l=o.stateNode,p=o.type,g=o.memoizedProps;switch(l[ht]=o,l[Hn]=g,p){case"dialog":Ft("cancel",l),Ft("close",l);break;case"iframe":case"object":case"embed":Ft("load",l);break;case"video":case"audio":for(p=0;p<Kd.length;p++)Ft(Kd[p],l);break;case"source":Ft("error",l);break;case"img":case"image":case"link":Ft("error",l),Ft("load",l);break;case"details":Ft("toggle",l);break;case"input":Ft("invalid",l),md(l,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Ft("invalid",l);break;case"textarea":Ft("invalid",l),E1(l,g.value,g.defaultValue,g.children)}p=g.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||l.textContent===""+p||g.suppressHydrationWarning===!0||SD(l.textContent,p)?(g.popover!=null&&(Ft("beforetoggle",l),Ft("toggle",l)),g.onScroll!=null&&Ft("scroll",l),g.onScrollEnd!=null&&Ft("scrollend",l),g.onClick!=null&&(l.onclick=qo),l=!0):l=!1,l||Hs(o,!0)}function iI(o){for(Rr=o.return;Rr;)switch(Rr.tag){case 5:case 31:case 13:Ga=!1;return;case 27:case 3:Ga=!0;return;default:Rr=Rr.return}}function oc(o){if(o!==Rr)return!1;if(!qt)return iI(o),qt=!0,!1;var l=o.tag,p;if((p=l!==3&&l!==27)&&((p=l===5)&&(p=o.type,p=!(p!=="form"&&p!=="button")||X0(o.type,o.memoizedProps)),p=!p),p&&In&&Hs(o),iI(o),l===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));In=OD(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));In=OD(o)}else l===27?(l=In,ri(o.type)?(o=nw,nw=null,In=o):In=l):In=Rr?Ka(o.stateNode.nextSibling):null;return!0}function Yi(){In=Rr=null,qt=!1}function Lv(){var o=Bs;return o!==null&&(ha===null?ha=o:ha.push.apply(ha,o),Bs=null),o}function Td(o){Bs===null?Bs=[o]:Bs.push(o)}var Mv=D(null),Zi=null,es=null;function Vs(o,l,p){$(Mv,l._currentValue),l._currentValue=p}function ts(o){o._currentValue=Mv.current,H(Mv)}function jv(o,l,p){for(;o!==null;){var g=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,g!==null&&(g.childLanes|=l)):g!==null&&(g.childLanes&l)!==l&&(g.childLanes|=l),o===p)break;o=o.return}}function Pv(o,l,p,g){var N=o.child;for(N!==null&&(N.return=o);N!==null;){var k=N.dependencies;if(k!==null){var P=N.child;k=k.firstContext;e:for(;k!==null;){var Y=k;k=N;for(var oe=0;oe<l.length;oe++)if(Y.context===l[oe]){k.lanes|=p,Y=k.alternate,Y!==null&&(Y.lanes|=p),jv(k.return,p,o),g||(P=null);break e}k=Y.next}}else if(N.tag===18){if(P=N.return,P===null)throw Error(r(341));P.lanes|=p,k=P.alternate,k!==null&&(k.lanes|=p),jv(P,p,o),P=null}else P=N.child;if(P!==null)P.return=N;else for(P=N;P!==null;){if(P===o){P=null;break}if(N=P.sibling,N!==null){N.return=P.return,P=N;break}P=P.return}N=P}}function sc(o,l,p,g){o=null;for(var N=l,k=!1;N!==null;){if(!k){if((N.flags&524288)!==0)k=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var P=N.alternate;if(P===null)throw Error(r(387));if(P=P.memoizedProps,P!==null){var Y=N.type;ka(N.pendingProps.value,P.value)||(o!==null?o.push(Y):o=[Y])}}else if(N===G.current){if(P=N.alternate,P===null)throw Error(r(387));P.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(o!==null?o.push(Jd):o=[Jd])}N=N.return}o!==null&&Pv(l,o,p,g),l.flags|=262144}function fm(o){for(o=o.firstContext;o!==null;){if(!ka(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function qi(o){Zi=o,es=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Ar(o){return lI(Zi,o)}function pm(o,l){return Zi===null&&qi(o),lI(o,l)}function lI(o,l){var p=l._currentValue;if(l={context:l,memoizedValue:p,next:null},es===null){if(o===null)throw Error(r(308));es=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else es=es.next=l;return p}var A8=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(p,g){o.push(g)}};this.abort=function(){l.aborted=!0,o.forEach(function(p){return p()})}},I8=e.unstable_scheduleCallback,O8=e.unstable_NormalPriority,ar={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uv(){return{controller:new A8,data:new Map,refCount:0}}function Nd(o){o.refCount--,o.refCount===0&&I8(O8,function(){o.controller.abort()})}var kd=null,$v=0,ic=0,lc=null;function D8(o,l){if(kd===null){var p=kd=[];$v=0,ic=B0(),lc={status:"pending",value:void 0,then:function(g){p.push(g)}}}return $v++,l.then(cI,cI),l}function cI(){if(--$v===0&&kd!==null){lc!==null&&(lc.status="fulfilled");var o=kd;kd=null,ic=0,lc=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function L8(o,l){var p=[],g={status:"pending",value:null,reason:null,then:function(N){p.push(N)}};return o.then(function(){g.status="fulfilled",g.value=l;for(var N=0;N<p.length;N++)(0,p[N])(l)},function(N){for(g.status="rejected",g.reason=N,N=0;N<p.length;N++)(0,p[N])(void 0)}),g}var uI=F.S;F.S=function(o,l){KO=we(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&D8(o,l),uI!==null&&uI(o,l)};var Xi=D(null);function zv(){var o=Xi.current;return o!==null?o:_n.pooledCache}function mm(o,l){l===null?$(Xi,Xi.current):$(Xi,l.pool)}function dI(){var o=zv();return o===null?null:{parent:ar._currentValue,pool:o}}var cc=Error(r(460)),Fv=Error(r(474)),hm=Error(r(542)),gm={then:function(){}};function fI(o){return o=o.status,o==="fulfilled"||o==="rejected"}function pI(o,l,p){switch(p=o[p],p===void 0?o.push(l):p!==l&&(l.then(qo,qo),l=p),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,hI(o),o;default:if(typeof l.status=="string")l.then(qo,qo);else{if(o=_n,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=l,o.status="pending",o.then(function(g){if(l.status==="pending"){var N=l;N.status="fulfilled",N.value=g}},function(g){if(l.status==="pending"){var N=l;N.status="rejected",N.reason=g}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,hI(o),o}throw Qi=l,cc}}function Ji(o){try{var l=o._init;return l(o._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Qi=p,cc):p}}var Qi=null;function mI(){if(Qi===null)throw Error(r(459));var o=Qi;return Qi=null,o}function hI(o){if(o===cc||o===hm)throw Error(r(483))}var uc=null,Cd=0;function bm(o){var l=Cd;return Cd+=1,uc===null&&(uc=[]),pI(uc,o,l)}function Rd(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function ym(o,l){throw l.$$typeof===b?Error(r(525)):(o=Object.prototype.toString.call(l),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function gI(o){function l(pe,ue){if(o){var he=pe.deletions;he===null?(pe.deletions=[ue],pe.flags|=16):he.push(ue)}}function p(pe,ue){if(!o)return null;for(;ue!==null;)l(pe,ue),ue=ue.sibling;return null}function g(pe){for(var ue=new Map;pe!==null;)pe.key!==null?ue.set(pe.key,pe):ue.set(pe.index,pe),pe=pe.sibling;return ue}function N(pe,ue){return pe=Jo(pe,ue),pe.index=0,pe.sibling=null,pe}function k(pe,ue,he){return pe.index=he,o?(he=pe.alternate,he!==null?(he=he.index,he<ue?(pe.flags|=67108866,ue):he):(pe.flags|=67108866,ue)):(pe.flags|=1048576,ue)}function P(pe){return o&&pe.alternate===null&&(pe.flags|=67108866),pe}function Y(pe,ue,he,Ne){return ue===null||ue.tag!==6?(ue=Rv(he,pe.mode,Ne),ue.return=pe,ue):(ue=N(ue,he),ue.return=pe,ue)}function oe(pe,ue,he,Ne){var rt=he.type;return rt===E?xe(pe,ue,he.props.children,Ne,he.key):ue!==null&&(ue.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===O&&Ji(rt)===ue.type)?(ue=N(ue,he.props),Rd(ue,he),ue.return=pe,ue):(ue=um(he.type,he.key,he.props,null,pe.mode,Ne),Rd(ue,he),ue.return=pe,ue)}function ge(pe,ue,he,Ne){return ue===null||ue.tag!==4||ue.stateNode.containerInfo!==he.containerInfo||ue.stateNode.implementation!==he.implementation?(ue=Av(he,pe.mode,Ne),ue.return=pe,ue):(ue=N(ue,he.children||[]),ue.return=pe,ue)}function xe(pe,ue,he,Ne,rt){return ue===null||ue.tag!==7?(ue=Ki(he,pe.mode,Ne,rt),ue.return=pe,ue):(ue=N(ue,he),ue.return=pe,ue)}function ke(pe,ue,he){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return ue=Rv(""+ue,pe.mode,he),ue.return=pe,ue;if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:return he=um(ue.type,ue.key,ue.props,null,pe.mode,he),Rd(he,ue),he.return=pe,he;case x:return ue=Av(ue,pe.mode,he),ue.return=pe,ue;case O:return ue=Ji(ue),ke(pe,ue,he)}if(re(ue)||W(ue))return ue=Ki(ue,pe.mode,he,null),ue.return=pe,ue;if(typeof ue.then=="function")return ke(pe,bm(ue),he);if(ue.$$typeof===T)return ke(pe,pm(pe,ue),he);ym(pe,ue)}return null}function ye(pe,ue,he,Ne){var rt=ue!==null?ue.key:null;if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return rt!==null?null:Y(pe,ue,""+he,Ne);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case y:return he.key===rt?oe(pe,ue,he,Ne):null;case x:return he.key===rt?ge(pe,ue,he,Ne):null;case O:return he=Ji(he),ye(pe,ue,he,Ne)}if(re(he)||W(he))return rt!==null?null:xe(pe,ue,he,Ne,null);if(typeof he.then=="function")return ye(pe,ue,bm(he),Ne);if(he.$$typeof===T)return ye(pe,ue,pm(pe,he),Ne);ym(pe,he)}return null}function ve(pe,ue,he,Ne,rt){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint")return pe=pe.get(he)||null,Y(ue,pe,""+Ne,rt);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case y:return pe=pe.get(Ne.key===null?he:Ne.key)||null,oe(ue,pe,Ne,rt);case x:return pe=pe.get(Ne.key===null?he:Ne.key)||null,ge(ue,pe,Ne,rt);case O:return Ne=Ji(Ne),ve(pe,ue,he,Ne,rt)}if(re(Ne)||W(Ne))return pe=pe.get(he)||null,xe(ue,pe,Ne,rt,null);if(typeof Ne.then=="function")return ve(pe,ue,he,bm(Ne),rt);if(Ne.$$typeof===T)return ve(pe,ue,he,pm(ue,Ne),rt);ym(ue,Ne)}return null}function We(pe,ue,he,Ne){for(var rt=null,rn=null,Je=ue,Tt=ue=0,Gt=null;Je!==null&&Tt<he.length;Tt++){Je.index>Tt?(Gt=Je,Je=null):Gt=Je.sibling;var an=ye(pe,Je,he[Tt],Ne);if(an===null){Je===null&&(Je=Gt);break}o&&Je&&an.alternate===null&&l(pe,Je),ue=k(an,ue,Tt),rn===null?rt=an:rn.sibling=an,rn=an,Je=Gt}if(Tt===he.length)return p(pe,Je),qt&&Qo(pe,Tt),rt;if(Je===null){for(;Tt<he.length;Tt++)Je=ke(pe,he[Tt],Ne),Je!==null&&(ue=k(Je,ue,Tt),rn===null?rt=Je:rn.sibling=Je,rn=Je);return qt&&Qo(pe,Tt),rt}for(Je=g(Je);Tt<he.length;Tt++)Gt=ve(Je,pe,Tt,he[Tt],Ne),Gt!==null&&(o&&Gt.alternate!==null&&Je.delete(Gt.key===null?Tt:Gt.key),ue=k(Gt,ue,Tt),rn===null?rt=Gt:rn.sibling=Gt,rn=Gt);return o&&Je.forEach(function(li){return l(pe,li)}),qt&&Qo(pe,Tt),rt}function ct(pe,ue,he,Ne){if(he==null)throw Error(r(151));for(var rt=null,rn=null,Je=ue,Tt=ue=0,Gt=null,an=he.next();Je!==null&&!an.done;Tt++,an=he.next()){Je.index>Tt?(Gt=Je,Je=null):Gt=Je.sibling;var li=ye(pe,Je,an.value,Ne);if(li===null){Je===null&&(Je=Gt);break}o&&Je&&li.alternate===null&&l(pe,Je),ue=k(li,ue,Tt),rn===null?rt=li:rn.sibling=li,rn=li,Je=Gt}if(an.done)return p(pe,Je),qt&&Qo(pe,Tt),rt;if(Je===null){for(;!an.done;Tt++,an=he.next())an=ke(pe,an.value,Ne),an!==null&&(ue=k(an,ue,Tt),rn===null?rt=an:rn.sibling=an,rn=an);return qt&&Qo(pe,Tt),rt}for(Je=g(Je);!an.done;Tt++,an=he.next())an=ve(Je,pe,Tt,an.value,Ne),an!==null&&(o&&an.alternate!==null&&Je.delete(an.key===null?Tt:an.key),ue=k(an,ue,Tt),rn===null?rt=an:rn.sibling=an,rn=an);return o&&Je.forEach(function(G9){return l(pe,G9)}),qt&&Qo(pe,Tt),rt}function Sn(pe,ue,he,Ne){if(typeof he=="object"&&he!==null&&he.type===E&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case y:e:{for(var rt=he.key;ue!==null;){if(ue.key===rt){if(rt=he.type,rt===E){if(ue.tag===7){p(pe,ue.sibling),Ne=N(ue,he.props.children),Ne.return=pe,pe=Ne;break e}}else if(ue.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===O&&Ji(rt)===ue.type){p(pe,ue.sibling),Ne=N(ue,he.props),Rd(Ne,he),Ne.return=pe,pe=Ne;break e}p(pe,ue);break}else l(pe,ue);ue=ue.sibling}he.type===E?(Ne=Ki(he.props.children,pe.mode,Ne,he.key),Ne.return=pe,pe=Ne):(Ne=um(he.type,he.key,he.props,null,pe.mode,Ne),Rd(Ne,he),Ne.return=pe,pe=Ne)}return P(pe);case x:e:{for(rt=he.key;ue!==null;){if(ue.key===rt)if(ue.tag===4&&ue.stateNode.containerInfo===he.containerInfo&&ue.stateNode.implementation===he.implementation){p(pe,ue.sibling),Ne=N(ue,he.children||[]),Ne.return=pe,pe=Ne;break e}else{p(pe,ue);break}else l(pe,ue);ue=ue.sibling}Ne=Av(he,pe.mode,Ne),Ne.return=pe,pe=Ne}return P(pe);case O:return he=Ji(he),Sn(pe,ue,he,Ne)}if(re(he))return We(pe,ue,he,Ne);if(W(he)){if(rt=W(he),typeof rt!="function")throw Error(r(150));return he=rt.call(he),ct(pe,ue,he,Ne)}if(typeof he.then=="function")return Sn(pe,ue,bm(he),Ne);if(he.$$typeof===T)return Sn(pe,ue,pm(pe,he),Ne);ym(pe,he)}return typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint"?(he=""+he,ue!==null&&ue.tag===6?(p(pe,ue.sibling),Ne=N(ue,he),Ne.return=pe,pe=Ne):(p(pe,ue),Ne=Rv(he,pe.mode,Ne),Ne.return=pe,pe=Ne),P(pe)):p(pe,ue)}return function(pe,ue,he,Ne){try{Cd=0;var rt=Sn(pe,ue,he,Ne);return uc=null,rt}catch(Je){if(Je===cc||Je===hm)throw Je;var rn=Ca(29,Je,null,pe.mode);return rn.lanes=Ne,rn.return=pe,rn}finally{}}}var el=gI(!0),bI=gI(!1),Gs=!1;function Bv(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hv(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Ws(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ks(o,l,p){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(ln&2)!==0){var N=g.pending;return N===null?l.next=l:(l.next=N.next,N.next=l),g.pending=l,l=cm(o),eI(o,null,p),l}return lm(o,g,l,p),cm(o)}function Ad(o,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194048)!==0)){var g=l.lanes;g&=o.pendingLanes,p|=g,l.lanes=p,wn(o,p)}}function Vv(o,l){var p=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,p===g)){var N=null,k=null;if(p=p.firstBaseUpdate,p!==null){do{var P={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};k===null?N=k=P:k=k.next=P,p=p.next}while(p!==null);k===null?N=k=l:k=k.next=l}else N=k=l;p={baseState:g.baseState,firstBaseUpdate:N,lastBaseUpdate:k,shared:g.shared,callbacks:g.callbacks},o.updateQueue=p;return}o=p.lastBaseUpdate,o===null?p.firstBaseUpdate=l:o.next=l,p.lastBaseUpdate=l}var Gv=!1;function Id(){if(Gv){var o=lc;if(o!==null)throw o}}function Od(o,l,p,g){Gv=!1;var N=o.updateQueue;Gs=!1;var k=N.firstBaseUpdate,P=N.lastBaseUpdate,Y=N.shared.pending;if(Y!==null){N.shared.pending=null;var oe=Y,ge=oe.next;oe.next=null,P===null?k=ge:P.next=ge,P=oe;var xe=o.alternate;xe!==null&&(xe=xe.updateQueue,Y=xe.lastBaseUpdate,Y!==P&&(Y===null?xe.firstBaseUpdate=ge:Y.next=ge,xe.lastBaseUpdate=oe))}if(k!==null){var ke=N.baseState;P=0,xe=ge=oe=null,Y=k;do{var ye=Y.lane&-536870913,ve=ye!==Y.lane;if(ve?(Vt&ye)===ye:(g&ye)===ye){ye!==0&&ye===ic&&(Gv=!0),xe!==null&&(xe=xe.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var We=o,ct=Y;ye=l;var Sn=p;switch(ct.tag){case 1:if(We=ct.payload,typeof We=="function"){ke=We.call(Sn,ke,ye);break e}ke=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=ct.payload,ye=typeof We=="function"?We.call(Sn,ke,ye):We,ye==null)break e;ke=h({},ke,ye);break e;case 2:Gs=!0}}ye=Y.callback,ye!==null&&(o.flags|=64,ve&&(o.flags|=8192),ve=N.callbacks,ve===null?N.callbacks=[ye]:ve.push(ye))}else ve={lane:ye,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},xe===null?(ge=xe=ve,oe=ke):xe=xe.next=ve,P|=ye;if(Y=Y.next,Y===null){if(Y=N.shared.pending,Y===null)break;ve=Y,Y=ve.next,ve.next=null,N.lastBaseUpdate=ve,N.shared.pending=null}}while(!0);xe===null&&(oe=ke),N.baseState=oe,N.firstBaseUpdate=ge,N.lastBaseUpdate=xe,k===null&&(N.shared.lanes=0),Js|=P,o.lanes=P,o.memoizedState=ke}}function yI(o,l){if(typeof o!="function")throw Error(r(191,o));o.call(l)}function vI(o,l){var p=o.callbacks;if(p!==null)for(o.callbacks=null,o=0;o<p.length;o++)yI(p[o],l)}var dc=D(null),vm=D(0);function wI(o,l){o=us,$(vm,o),$(dc,l),us=o|l.baseLanes}function Wv(){$(vm,us),$(dc,dc.current)}function Kv(){us=vm.current,H(dc),H(vm)}var Ra=D(null),Wa=null;function Ys(o){var l=o.alternate;$(Qn,Qn.current&1),$(Ra,o),Wa===null&&(l===null||dc.current!==null||l.memoizedState!==null)&&(Wa=o)}function Yv(o){$(Qn,Qn.current),$(Ra,o),Wa===null&&(Wa=o)}function EI(o){o.tag===22?($(Qn,Qn.current),$(Ra,o),Wa===null&&(Wa=o)):Zs()}function Zs(){$(Qn,Qn.current),$(Ra,Ra.current)}function Aa(o){H(Ra),Wa===o&&(Wa=null),H(Qn)}var Qn=D(0);function wm(o){for(var l=o;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||ew(p)||tw(p)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var ns=0,St=null,En=null,or=null,Em=!1,fc=!1,tl=!1,xm=0,Dd=0,pc=null,M8=0;function Kn(){throw Error(r(321))}function Zv(o,l){if(l===null)return!1;for(var p=0;p<l.length&&p<o.length;p++)if(!ka(o[p],l[p]))return!1;return!0}function qv(o,l,p,g,N,k){return ns=k,St=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,F.H=o===null||o.memoizedState===null?aO:d0,tl=!1,k=p(g,N),tl=!1,fc&&(k=SI(l,p,g,N)),xI(o),k}function xI(o){F.H=jd;var l=En!==null&&En.next!==null;if(ns=0,or=En=St=null,Em=!1,Dd=0,pc=null,l)throw Error(r(300));o===null||sr||(o=o.dependencies,o!==null&&fm(o)&&(sr=!0))}function SI(o,l,p,g){St=o;var N=0;do{if(fc&&(pc=null),Dd=0,fc=!1,25<=N)throw Error(r(301));if(N+=1,or=En=null,o.updateQueue!=null){var k=o.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}F.H=oO,k=l(p,g)}while(fc);return k}function j8(){var o=F.H,l=o.useState()[0];return l=typeof l.then=="function"?Ld(l):l,o=o.useState()[0],(En!==null?En.memoizedState:null)!==o&&(St.flags|=1024),l}function Xv(){var o=xm!==0;return xm=0,o}function Jv(o,l,p){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~p}function Qv(o){if(Em){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}Em=!1}ns=0,or=En=St=null,fc=!1,Dd=xm=0,pc=null}function ta(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return or===null?St.memoizedState=or=o:or=or.next=o,or}function er(){if(En===null){var o=St.alternate;o=o!==null?o.memoizedState:null}else o=En.next;var l=or===null?St.memoizedState:or.next;if(l!==null)or=l,En=o;else{if(o===null)throw St.alternate===null?Error(r(467)):Error(r(310));En=o,o={memoizedState:En.memoizedState,baseState:En.baseState,baseQueue:En.baseQueue,queue:En.queue,next:null},or===null?St.memoizedState=or=o:or=or.next=o}return or}function Sm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ld(o){var l=Dd;return Dd+=1,pc===null&&(pc=[]),o=pI(pc,o,l),l=St,(or===null?l.memoizedState:or.next)===null&&(l=l.alternate,F.H=l===null||l.memoizedState===null?aO:d0),o}function _m(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Ld(o);if(o.$$typeof===T)return Ar(o)}throw Error(r(438,String(o)))}function e0(o){var l=null,p=St.updateQueue;if(p!==null&&(l=p.memoCache),l==null){var g=St.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(l={data:g.data.map(function(N){return N.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),p===null&&(p=Sm(),St.updateQueue=p),p.memoCache=l,p=l.data[l.index],p===void 0)for(p=l.data[l.index]=Array(o),g=0;g<o;g++)p[g]=U;return l.index++,p}function rs(o,l){return typeof l=="function"?l(o):l}function Tm(o){var l=er();return t0(l,En,o)}function t0(o,l,p){var g=o.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=p;var N=o.baseQueue,k=g.pending;if(k!==null){if(N!==null){var P=N.next;N.next=k.next,k.next=P}l.baseQueue=N=k,g.pending=null}if(k=o.baseState,N===null)o.memoizedState=k;else{l=N.next;var Y=P=null,oe=null,ge=l,xe=!1;do{var ke=ge.lane&-536870913;if(ke!==ge.lane?(Vt&ke)===ke:(ns&ke)===ke){var ye=ge.revertLane;if(ye===0)oe!==null&&(oe=oe.next={lane:0,revertLane:0,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),ke===ic&&(xe=!0);else if((ns&ye)===ye){ge=ge.next,ye===ic&&(xe=!0);continue}else ke={lane:0,revertLane:ge.revertLane,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},oe===null?(Y=oe=ke,P=k):oe=oe.next=ke,St.lanes|=ye,Js|=ye;ke=ge.action,tl&&p(k,ke),k=ge.hasEagerState?ge.eagerState:p(k,ke)}else ye={lane:ke,revertLane:ge.revertLane,gesture:ge.gesture,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},oe===null?(Y=oe=ye,P=k):oe=oe.next=ye,St.lanes|=ke,Js|=ke;ge=ge.next}while(ge!==null&&ge!==l);if(oe===null?P=k:oe.next=Y,!ka(k,o.memoizedState)&&(sr=!0,xe&&(p=lc,p!==null)))throw p;o.memoizedState=k,o.baseState=P,o.baseQueue=oe,g.lastRenderedState=k}return N===null&&(g.lanes=0),[o.memoizedState,g.dispatch]}function n0(o){var l=er(),p=l.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=o;var g=p.dispatch,N=p.pending,k=l.memoizedState;if(N!==null){p.pending=null;var P=N=N.next;do k=o(k,P.action),P=P.next;while(P!==N);ka(k,l.memoizedState)||(sr=!0),l.memoizedState=k,l.baseQueue===null&&(l.baseState=k),p.lastRenderedState=k}return[k,g]}function _I(o,l,p){var g=St,N=er(),k=qt;if(k){if(p===void 0)throw Error(r(407));p=p()}else p=l();var P=!ka((En||N).memoizedState,p);if(P&&(N.memoizedState=p,sr=!0),N=N.queue,o0(kI.bind(null,g,N,o),[o]),N.getSnapshot!==l||P||or!==null&&or.memoizedState.tag&1){if(g.flags|=2048,mc(9,{destroy:void 0},NI.bind(null,g,N,p,l),null),_n===null)throw Error(r(349));k||(ns&127)!==0||TI(g,l,p)}return p}function TI(o,l,p){o.flags|=16384,o={getSnapshot:l,value:p},l=St.updateQueue,l===null?(l=Sm(),St.updateQueue=l,l.stores=[o]):(p=l.stores,p===null?l.stores=[o]:p.push(o))}function NI(o,l,p,g){l.value=p,l.getSnapshot=g,CI(l)&&RI(o)}function kI(o,l,p){return p(function(){CI(l)&&RI(o)})}function CI(o){var l=o.getSnapshot;o=o.value;try{var p=l();return!ka(o,p)}catch{return!0}}function RI(o){var l=Wi(o,2);l!==null&&ga(l,o,2)}function r0(o){var l=ta();if(typeof o=="function"){var p=o;if(o=p(),tl){Ie(!0);try{p()}finally{Ie(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:o},l}function AI(o,l,p,g){return o.baseState=p,t0(o,En,typeof g=="function"?g:rs)}function P8(o,l,p,g,N){if(Cm(o))throw Error(r(485));if(o=l.action,o!==null){var k={payload:N,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(P){k.listeners.push(P)}};F.T!==null?p(!0):k.isTransition=!1,g(k),p=l.pending,p===null?(k.next=l.pending=k,II(l,k)):(k.next=p.next,l.pending=p.next=k)}}function II(o,l){var p=l.action,g=l.payload,N=o.state;if(l.isTransition){var k=F.T,P={};F.T=P;try{var Y=p(N,g),oe=F.S;oe!==null&&oe(P,Y),OI(o,l,Y)}catch(ge){a0(o,l,ge)}finally{k!==null&&P.types!==null&&(k.types=P.types),F.T=k}}else try{k=p(N,g),OI(o,l,k)}catch(ge){a0(o,l,ge)}}function OI(o,l,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(g){DI(o,l,g)},function(g){return a0(o,l,g)}):DI(o,l,p)}function DI(o,l,p){l.status="fulfilled",l.value=p,LI(l),o.state=p,l=o.pending,l!==null&&(p=l.next,p===l?o.pending=null:(p=p.next,l.next=p,II(o,p)))}function a0(o,l,p){var g=o.pending;if(o.pending=null,g!==null){g=g.next;do l.status="rejected",l.reason=p,LI(l),l=l.next;while(l!==g)}o.action=null}function LI(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function MI(o,l){return l}function jI(o,l){if(qt){var p=_n.formState;if(p!==null){e:{var g=St;if(qt){if(In){t:{for(var N=In,k=Ga;N.nodeType!==8;){if(!k){N=null;break t}if(N=Ka(N.nextSibling),N===null){N=null;break t}}k=N.data,N=k==="F!"||k==="F"?N:null}if(N){In=Ka(N.nextSibling),g=N.data==="F!";break e}}Hs(g)}g=!1}g&&(l=p[0])}}return p=ta(),p.memoizedState=p.baseState=l,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:MI,lastRenderedState:l},p.queue=g,p=tO.bind(null,St,g),g.dispatch=p,g=r0(!1),k=u0.bind(null,St,!1,g.queue),g=ta(),N={state:l,dispatch:null,action:o,pending:null},g.queue=N,p=P8.bind(null,St,N,k,p),N.dispatch=p,g.memoizedState=o,[l,p,!1]}function PI(o){var l=er();return UI(l,En,o)}function UI(o,l,p){if(l=t0(o,l,MI)[0],o=Tm(rs)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var g=Ld(l)}catch(P){throw P===cc?hm:P}else g=l;l=er();var N=l.queue,k=N.dispatch;return p!==l.memoizedState&&(St.flags|=2048,mc(9,{destroy:void 0},U8.bind(null,N,p),null)),[g,k,o]}function U8(o,l){o.action=l}function $I(o){var l=er(),p=En;if(p!==null)return UI(l,p,o);er(),l=l.memoizedState,p=er();var g=p.queue.dispatch;return p.memoizedState=o,[l,g,!1]}function mc(o,l,p,g){return o={tag:o,create:p,deps:g,inst:l,next:null},l=St.updateQueue,l===null&&(l=Sm(),St.updateQueue=l),p=l.lastEffect,p===null?l.lastEffect=o.next=o:(g=p.next,p.next=o,o.next=g,l.lastEffect=o),o}function zI(){return er().memoizedState}function Nm(o,l,p,g){var N=ta();St.flags|=o,N.memoizedState=mc(1|l,{destroy:void 0},p,g===void 0?null:g)}function km(o,l,p,g){var N=er();g=g===void 0?null:g;var k=N.memoizedState.inst;En!==null&&g!==null&&Zv(g,En.memoizedState.deps)?N.memoizedState=mc(l,k,p,g):(St.flags|=o,N.memoizedState=mc(1|l,k,p,g))}function FI(o,l){Nm(8390656,8,o,l)}function o0(o,l){km(2048,8,o,l)}function $8(o){St.flags|=4;var l=St.updateQueue;if(l===null)l=Sm(),St.updateQueue=l,l.events=[o];else{var p=l.events;p===null?l.events=[o]:p.push(o)}}function BI(o){var l=er().memoizedState;return $8({ref:l,nextImpl:o}),function(){if((ln&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function HI(o,l){return km(4,2,o,l)}function VI(o,l){return km(4,4,o,l)}function GI(o,l){if(typeof l=="function"){o=o();var p=l(o);return function(){typeof p=="function"?p():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function WI(o,l,p){p=p!=null?p.concat([o]):null,km(4,4,GI.bind(null,l,o),p)}function s0(){}function KI(o,l){var p=er();l=l===void 0?null:l;var g=p.memoizedState;return l!==null&&Zv(l,g[1])?g[0]:(p.memoizedState=[o,l],o)}function YI(o,l){var p=er();l=l===void 0?null:l;var g=p.memoizedState;if(l!==null&&Zv(l,g[1]))return g[0];if(g=o(),tl){Ie(!0);try{o()}finally{Ie(!1)}}return p.memoizedState=[g,l],g}function i0(o,l,p){return p===void 0||(ns&1073741824)!==0&&(Vt&261930)===0?o.memoizedState=l:(o.memoizedState=p,o=ZO(),St.lanes|=o,Js|=o,p)}function ZI(o,l,p,g){return ka(p,l)?p:dc.current!==null?(o=i0(o,p,g),ka(o,l)||(sr=!0),o):(ns&42)===0||(ns&1073741824)!==0&&(Vt&261930)===0?(sr=!0,o.memoizedState=p):(o=ZO(),St.lanes|=o,Js|=o,l)}function qI(o,l,p,g,N){var k=K.p;K.p=k!==0&&8>k?k:8;var P=F.T,Y={};F.T=Y,u0(o,!1,l,p);try{var oe=N(),ge=F.S;if(ge!==null&&ge(Y,oe),oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var xe=L8(oe,g);Md(o,l,xe,Da(o))}else Md(o,l,g,Da(o))}catch(ke){Md(o,l,{then:function(){},status:"rejected",reason:ke},Da())}finally{K.p=k,P!==null&&Y.types!==null&&(P.types=Y.types),F.T=P}}function z8(){}function l0(o,l,p,g){if(o.tag!==5)throw Error(r(476));var N=XI(o).queue;qI(o,N,l,V,p===null?z8:function(){return JI(o),p(g)})}function XI(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:V},next:null};var p={};return l.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:p},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function JI(o){var l=XI(o);l.next===null&&(l=o.alternate.memoizedState),Md(o,l.next.queue,{},Da())}function c0(){return Ar(Jd)}function QI(){return er().memoizedState}function eO(){return er().memoizedState}function F8(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var p=Da();o=Ws(p);var g=Ks(l,o,p);g!==null&&(ga(g,l,p),Ad(g,l,p)),l={cache:Uv()},o.payload=l;return}l=l.return}}function B8(o,l,p){var g=Da();p={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Cm(o)?nO(l,p):(p=kv(o,l,p,g),p!==null&&(ga(p,o,g),rO(p,l,g)))}function tO(o,l,p){var g=Da();Md(o,l,p,g)}function Md(o,l,p,g){var N={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(Cm(o))nO(l,N);else{var k=o.alternate;if(o.lanes===0&&(k===null||k.lanes===0)&&(k=l.lastRenderedReducer,k!==null))try{var P=l.lastRenderedState,Y=k(P,p);if(N.hasEagerState=!0,N.eagerState=Y,ka(Y,P))return lm(o,l,N,0),_n===null&&im(),!1}catch{}finally{}if(p=kv(o,l,N,g),p!==null)return ga(p,o,g),rO(p,l,g),!0}return!1}function u0(o,l,p,g){if(g={lane:2,revertLane:B0(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Cm(o)){if(l)throw Error(r(479))}else l=kv(o,p,g,2),l!==null&&ga(l,o,2)}function Cm(o){var l=o.alternate;return o===St||l!==null&&l===St}function nO(o,l){fc=Em=!0;var p=o.pending;p===null?l.next=l:(l.next=p.next,p.next=l),o.pending=l}function rO(o,l,p){if((p&4194048)!==0){var g=l.lanes;g&=o.pendingLanes,p|=g,l.lanes=p,wn(o,p)}}var jd={readContext:Ar,use:_m,useCallback:Kn,useContext:Kn,useEffect:Kn,useImperativeHandle:Kn,useLayoutEffect:Kn,useInsertionEffect:Kn,useMemo:Kn,useReducer:Kn,useRef:Kn,useState:Kn,useDebugValue:Kn,useDeferredValue:Kn,useTransition:Kn,useSyncExternalStore:Kn,useId:Kn,useHostTransitionStatus:Kn,useFormState:Kn,useActionState:Kn,useOptimistic:Kn,useMemoCache:Kn,useCacheRefresh:Kn};jd.useEffectEvent=Kn;var aO={readContext:Ar,use:_m,useCallback:function(o,l){return ta().memoizedState=[o,l===void 0?null:l],o},useContext:Ar,useEffect:FI,useImperativeHandle:function(o,l,p){p=p!=null?p.concat([o]):null,Nm(4194308,4,GI.bind(null,l,o),p)},useLayoutEffect:function(o,l){return Nm(4194308,4,o,l)},useInsertionEffect:function(o,l){Nm(4,2,o,l)},useMemo:function(o,l){var p=ta();l=l===void 0?null:l;var g=o();if(tl){Ie(!0);try{o()}finally{Ie(!1)}}return p.memoizedState=[g,l],g},useReducer:function(o,l,p){var g=ta();if(p!==void 0){var N=p(l);if(tl){Ie(!0);try{p(l)}finally{Ie(!1)}}}else N=l;return g.memoizedState=g.baseState=N,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:N},g.queue=o,o=o.dispatch=B8.bind(null,St,o),[g.memoizedState,o]},useRef:function(o){var l=ta();return o={current:o},l.memoizedState=o},useState:function(o){o=r0(o);var l=o.queue,p=tO.bind(null,St,l);return l.dispatch=p,[o.memoizedState,p]},useDebugValue:s0,useDeferredValue:function(o,l){var p=ta();return i0(p,o,l)},useTransition:function(){var o=r0(!1);return o=qI.bind(null,St,o.queue,!0,!1),ta().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,p){var g=St,N=ta();if(qt){if(p===void 0)throw Error(r(407));p=p()}else{if(p=l(),_n===null)throw Error(r(349));(Vt&127)!==0||TI(g,l,p)}N.memoizedState=p;var k={value:p,getSnapshot:l};return N.queue=k,FI(kI.bind(null,g,k,o),[o]),g.flags|=2048,mc(9,{destroy:void 0},NI.bind(null,g,k,p,l),null),p},useId:function(){var o=ta(),l=_n.identifierPrefix;if(qt){var p=Io,g=Ao;p=(g&~(1<<32-Me(g)-1)).toString(32)+p,l="_"+l+"R_"+p,p=xm++,0<p&&(l+="H"+p.toString(32)),l+="_"}else p=M8++,l="_"+l+"r_"+p.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:c0,useFormState:jI,useActionState:jI,useOptimistic:function(o){var l=ta();l.memoizedState=l.baseState=o;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=p,l=u0.bind(null,St,!0,p),p.dispatch=l,[o,l]},useMemoCache:e0,useCacheRefresh:function(){return ta().memoizedState=F8.bind(null,St)},useEffectEvent:function(o){var l=ta(),p={impl:o};return l.memoizedState=p,function(){if((ln&2)!==0)throw Error(r(440));return p.impl.apply(void 0,arguments)}}},d0={readContext:Ar,use:_m,useCallback:KI,useContext:Ar,useEffect:o0,useImperativeHandle:WI,useInsertionEffect:HI,useLayoutEffect:VI,useMemo:YI,useReducer:Tm,useRef:zI,useState:function(){return Tm(rs)},useDebugValue:s0,useDeferredValue:function(o,l){var p=er();return ZI(p,En.memoizedState,o,l)},useTransition:function(){var o=Tm(rs)[0],l=er().memoizedState;return[typeof o=="boolean"?o:Ld(o),l]},useSyncExternalStore:_I,useId:QI,useHostTransitionStatus:c0,useFormState:PI,useActionState:PI,useOptimistic:function(o,l){var p=er();return AI(p,En,o,l)},useMemoCache:e0,useCacheRefresh:eO};d0.useEffectEvent=BI;var oO={readContext:Ar,use:_m,useCallback:KI,useContext:Ar,useEffect:o0,useImperativeHandle:WI,useInsertionEffect:HI,useLayoutEffect:VI,useMemo:YI,useReducer:n0,useRef:zI,useState:function(){return n0(rs)},useDebugValue:s0,useDeferredValue:function(o,l){var p=er();return En===null?i0(p,o,l):ZI(p,En.memoizedState,o,l)},useTransition:function(){var o=n0(rs)[0],l=er().memoizedState;return[typeof o=="boolean"?o:Ld(o),l]},useSyncExternalStore:_I,useId:QI,useHostTransitionStatus:c0,useFormState:$I,useActionState:$I,useOptimistic:function(o,l){var p=er();return En!==null?AI(p,En,o,l):(p.baseState=o,[o,p.queue.dispatch])},useMemoCache:e0,useCacheRefresh:eO};oO.useEffectEvent=BI;function f0(o,l,p,g){l=o.memoizedState,p=p(g,l),p=p==null?l:h({},l,p),o.memoizedState=p,o.lanes===0&&(o.updateQueue.baseState=p)}var p0={enqueueSetState:function(o,l,p){o=o._reactInternals;var g=Da(),N=Ws(g);N.payload=l,p!=null&&(N.callback=p),l=Ks(o,N,g),l!==null&&(ga(l,o,g),Ad(l,o,g))},enqueueReplaceState:function(o,l,p){o=o._reactInternals;var g=Da(),N=Ws(g);N.tag=1,N.payload=l,p!=null&&(N.callback=p),l=Ks(o,N,g),l!==null&&(ga(l,o,g),Ad(l,o,g))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var p=Da(),g=Ws(p);g.tag=2,l!=null&&(g.callback=l),l=Ks(o,g,p),l!==null&&(ga(l,o,p),Ad(l,o,p))}};function sO(o,l,p,g,N,k,P){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(g,k,P):l.prototype&&l.prototype.isPureReactComponent?!xd(p,g)||!xd(N,k):!0}function iO(o,l,p,g){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,g),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,g),l.state!==o&&p0.enqueueReplaceState(l,l.state,null)}function nl(o,l){var p=l;if("ref"in l){p={};for(var g in l)g!=="ref"&&(p[g]=l[g])}if(o=o.defaultProps){p===l&&(p=h({},p));for(var N in o)p[N]===void 0&&(p[N]=o[N])}return p}function lO(o){sm(o)}function cO(o){console.error(o)}function uO(o){sm(o)}function Rm(o,l){try{var p=o.onUncaughtError;p(l.value,{componentStack:l.stack})}catch(g){setTimeout(function(){throw g})}}function dO(o,l,p){try{var g=o.onCaughtError;g(p.value,{componentStack:p.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function m0(o,l,p){return p=Ws(p),p.tag=3,p.payload={element:null},p.callback=function(){Rm(o,l)},p}function fO(o){return o=Ws(o),o.tag=3,o}function pO(o,l,p,g){var N=p.type.getDerivedStateFromError;if(typeof N=="function"){var k=g.value;o.payload=function(){return N(k)},o.callback=function(){dO(l,p,g)}}var P=p.stateNode;P!==null&&typeof P.componentDidCatch=="function"&&(o.callback=function(){dO(l,p,g),typeof N!="function"&&(Qs===null?Qs=new Set([this]):Qs.add(this));var Y=g.stack;this.componentDidCatch(g.value,{componentStack:Y!==null?Y:""})})}function H8(o,l,p,g,N){if(p.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(l=p.alternate,l!==null&&sc(l,p,N,!0),p=Ra.current,p!==null){switch(p.tag){case 31:case 13:return Wa===null?Fm():p.alternate===null&&Yn===0&&(Yn=3),p.flags&=-257,p.flags|=65536,p.lanes=N,g===gm?p.flags|=16384:(l=p.updateQueue,l===null?p.updateQueue=new Set([g]):l.add(g),$0(o,g,N)),!1;case 22:return p.flags|=65536,g===gm?p.flags|=16384:(l=p.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([g])},p.updateQueue=l):(p=l.retryQueue,p===null?l.retryQueue=new Set([g]):p.add(g)),$0(o,g,N)),!1}throw Error(r(435,p.tag))}return $0(o,g,N),Fm(),!1}if(qt)return l=Ra.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=N,g!==Dv&&(o=Error(r(422),{cause:g}),Td(Ba(o,p)))):(g!==Dv&&(l=Error(r(423),{cause:g}),Td(Ba(l,p))),o=o.current.alternate,o.flags|=65536,N&=-N,o.lanes|=N,g=Ba(g,p),N=m0(o.stateNode,g,N),Vv(o,N),Yn!==4&&(Yn=2)),!1;var k=Error(r(520),{cause:g});if(k=Ba(k,p),Vd===null?Vd=[k]:Vd.push(k),Yn!==4&&(Yn=2),l===null)return!0;g=Ba(g,p),p=l;do{switch(p.tag){case 3:return p.flags|=65536,o=N&-N,p.lanes|=o,o=m0(p.stateNode,g,o),Vv(p,o),!1;case 1:if(l=p.type,k=p.stateNode,(p.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Qs===null||!Qs.has(k))))return p.flags|=65536,N&=-N,p.lanes|=N,N=fO(N),pO(N,o,p,g),Vv(p,N),!1}p=p.return}while(p!==null);return!1}var h0=Error(r(461)),sr=!1;function Ir(o,l,p,g){l.child=o===null?bI(l,null,p,g):el(l,o.child,p,g)}function mO(o,l,p,g,N){p=p.render;var k=l.ref;if("ref"in g){var P={};for(var Y in g)Y!=="ref"&&(P[Y]=g[Y])}else P=g;return qi(l),g=qv(o,l,p,P,k,N),Y=Xv(),o!==null&&!sr?(Jv(o,l,N),as(o,l,N)):(qt&&Y&&Iv(l),l.flags|=1,Ir(o,l,g,N),l.child)}function hO(o,l,p,g,N){if(o===null){var k=p.type;return typeof k=="function"&&!Cv(k)&&k.defaultProps===void 0&&p.compare===null?(l.tag=15,l.type=k,gO(o,l,k,g,N)):(o=um(p.type,null,g,l,l.mode,N),o.ref=l.ref,o.return=l,l.child=o)}if(k=o.child,!S0(o,N)){var P=k.memoizedProps;if(p=p.compare,p=p!==null?p:xd,p(P,g)&&o.ref===l.ref)return as(o,l,N)}return l.flags|=1,o=Jo(k,g),o.ref=l.ref,o.return=l,l.child=o}function gO(o,l,p,g,N){if(o!==null){var k=o.memoizedProps;if(xd(k,g)&&o.ref===l.ref)if(sr=!1,l.pendingProps=g=k,S0(o,N))(o.flags&131072)!==0&&(sr=!0);else return l.lanes=o.lanes,as(o,l,N)}return g0(o,l,p,g,N)}function bO(o,l,p,g){var N=g.children,k=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((l.flags&128)!==0){if(k=k!==null?k.baseLanes|p:p,o!==null){for(g=l.child=o.child,N=0;g!==null;)N=N|g.lanes|g.childLanes,g=g.sibling;g=N&~k}else g=0,l.child=null;return yO(o,l,k,p,g)}if((p&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&mm(l,k!==null?k.cachePool:null),k!==null?wI(l,k):Wv(),EI(l);else return g=l.lanes=536870912,yO(o,l,k!==null?k.baseLanes|p:p,p,g)}else k!==null?(mm(l,k.cachePool),wI(l,k),Zs(),l.memoizedState=null):(o!==null&&mm(l,null),Wv(),Zs());return Ir(o,l,N,p),l.child}function Pd(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function yO(o,l,p,g,N){var k=zv();return k=k===null?null:{parent:ar._currentValue,pool:k},l.memoizedState={baseLanes:p,cachePool:k},o!==null&&mm(l,null),Wv(),EI(l),o!==null&&sc(o,l,g,!0),l.childLanes=N,null}function Am(o,l){return l=Om({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function vO(o,l,p){return el(l,o.child,null,p),o=Am(l,l.pendingProps),o.flags|=2,Aa(l),l.memoizedState=null,o}function V8(o,l,p){var g=l.pendingProps,N=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(qt){if(g.mode==="hidden")return o=Am(l,g),l.lanes=536870912,Pd(null,o);if(Yv(l),(o=In)?(o=ID(o,Ga),o=o!==null&&o.data==="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Fs!==null?{id:Ao,overflow:Io}:null,retryLane:536870912,hydrationErrors:null},p=nI(o),p.return=l,l.child=p,Rr=l,In=null)):o=null,o===null)throw Hs(l);return l.lanes=536870912,null}return Am(l,g)}var k=o.memoizedState;if(k!==null){var P=k.dehydrated;if(Yv(l),N)if(l.flags&256)l.flags&=-257,l=vO(o,l,p);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(r(558));else if(sr||sc(o,l,p,!1),N=(p&o.childLanes)!==0,sr||N){if(g=_n,g!==null&&(P=fn(g,p),P!==0&&P!==k.retryLane))throw k.retryLane=P,Wi(o,P),ga(g,o,P),h0;Fm(),l=vO(o,l,p)}else o=k.treeContext,In=Ka(P.nextSibling),Rr=l,qt=!0,Bs=null,Ga=!1,o!==null&&oI(l,o),l=Am(l,g),l.flags|=4096;return l}return o=Jo(o.child,{mode:g.mode,children:g.children}),o.ref=l.ref,l.child=o,o.return=l,o}function Im(o,l){var p=l.ref;if(p===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(r(284));(o===null||o.ref!==p)&&(l.flags|=4194816)}}function g0(o,l,p,g,N){return qi(l),p=qv(o,l,p,g,void 0,N),g=Xv(),o!==null&&!sr?(Jv(o,l,N),as(o,l,N)):(qt&&g&&Iv(l),l.flags|=1,Ir(o,l,p,N),l.child)}function wO(o,l,p,g,N,k){return qi(l),l.updateQueue=null,p=SI(l,g,p,N),xI(o),g=Xv(),o!==null&&!sr?(Jv(o,l,k),as(o,l,k)):(qt&&g&&Iv(l),l.flags|=1,Ir(o,l,p,k),l.child)}function EO(o,l,p,g,N){if(qi(l),l.stateNode===null){var k=nc,P=p.contextType;typeof P=="object"&&P!==null&&(k=Ar(P)),k=new p(g,k),l.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=p0,l.stateNode=k,k._reactInternals=l,k=l.stateNode,k.props=g,k.state=l.memoizedState,k.refs={},Bv(l),P=p.contextType,k.context=typeof P=="object"&&P!==null?Ar(P):nc,k.state=l.memoizedState,P=p.getDerivedStateFromProps,typeof P=="function"&&(f0(l,p,P,g),k.state=l.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(P=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),P!==k.state&&p0.enqueueReplaceState(k,k.state,null),Od(l,g,k,N),Id(),k.state=l.memoizedState),typeof k.componentDidMount=="function"&&(l.flags|=4194308),g=!0}else if(o===null){k=l.stateNode;var Y=l.memoizedProps,oe=nl(p,Y);k.props=oe;var ge=k.context,xe=p.contextType;P=nc,typeof xe=="object"&&xe!==null&&(P=Ar(xe));var ke=p.getDerivedStateFromProps;xe=typeof ke=="function"||typeof k.getSnapshotBeforeUpdate=="function",Y=l.pendingProps!==Y,xe||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(Y||ge!==P)&&iO(l,k,g,P),Gs=!1;var ye=l.memoizedState;k.state=ye,Od(l,g,k,N),Id(),ge=l.memoizedState,Y||ye!==ge||Gs?(typeof ke=="function"&&(f0(l,p,ke,g),ge=l.memoizedState),(oe=Gs||sO(l,p,oe,g,ye,ge,P))?(xe||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(l.flags|=4194308)):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=g,l.memoizedState=ge),k.props=g,k.state=ge,k.context=P,g=oe):(typeof k.componentDidMount=="function"&&(l.flags|=4194308),g=!1)}else{k=l.stateNode,Hv(o,l),P=l.memoizedProps,xe=nl(p,P),k.props=xe,ke=l.pendingProps,ye=k.context,ge=p.contextType,oe=nc,typeof ge=="object"&&ge!==null&&(oe=Ar(ge)),Y=p.getDerivedStateFromProps,(ge=typeof Y=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(P!==ke||ye!==oe)&&iO(l,k,g,oe),Gs=!1,ye=l.memoizedState,k.state=ye,Od(l,g,k,N),Id();var ve=l.memoizedState;P!==ke||ye!==ve||Gs||o!==null&&o.dependencies!==null&&fm(o.dependencies)?(typeof Y=="function"&&(f0(l,p,Y,g),ve=l.memoizedState),(xe=Gs||sO(l,p,xe,g,ye,ve,oe)||o!==null&&o.dependencies!==null&&fm(o.dependencies))?(ge||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(g,ve,oe),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(g,ve,oe)),typeof k.componentDidUpdate=="function"&&(l.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof k.componentDidUpdate!="function"||P===o.memoizedProps&&ye===o.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||P===o.memoizedProps&&ye===o.memoizedState||(l.flags|=1024),l.memoizedProps=g,l.memoizedState=ve),k.props=g,k.state=ve,k.context=oe,g=xe):(typeof k.componentDidUpdate!="function"||P===o.memoizedProps&&ye===o.memoizedState||(l.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||P===o.memoizedProps&&ye===o.memoizedState||(l.flags|=1024),g=!1)}return k=g,Im(o,l),g=(l.flags&128)!==0,k||g?(k=l.stateNode,p=g&&typeof p.getDerivedStateFromError!="function"?null:k.render(),l.flags|=1,o!==null&&g?(l.child=el(l,o.child,null,N),l.child=el(l,null,p,N)):Ir(o,l,p,N),l.memoizedState=k.state,o=l.child):o=as(o,l,N),o}function xO(o,l,p,g){return Yi(),l.flags|=256,Ir(o,l,p,g),l.child}var b0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function y0(o){return{baseLanes:o,cachePool:dI()}}function v0(o,l,p){return o=o!==null?o.childLanes&~p:0,l&&(o|=Oa),o}function SO(o,l,p){var g=l.pendingProps,N=!1,k=(l.flags&128)!==0,P;if((P=k)||(P=o!==null&&o.memoizedState===null?!1:(Qn.current&2)!==0),P&&(N=!0,l.flags&=-129),P=(l.flags&32)!==0,l.flags&=-33,o===null){if(qt){if(N?Ys(l):Zs(),(o=In)?(o=ID(o,Ga),o=o!==null&&o.data!=="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Fs!==null?{id:Ao,overflow:Io}:null,retryLane:536870912,hydrationErrors:null},p=nI(o),p.return=l,l.child=p,Rr=l,In=null)):o=null,o===null)throw Hs(l);return tw(o)?l.lanes=32:l.lanes=536870912,null}var Y=g.children;return g=g.fallback,N?(Zs(),N=l.mode,Y=Om({mode:"hidden",children:Y},N),g=Ki(g,N,p,null),Y.return=l,g.return=l,Y.sibling=g,l.child=Y,g=l.child,g.memoizedState=y0(p),g.childLanes=v0(o,P,p),l.memoizedState=b0,Pd(null,g)):(Ys(l),w0(l,Y))}var oe=o.memoizedState;if(oe!==null&&(Y=oe.dehydrated,Y!==null)){if(k)l.flags&256?(Ys(l),l.flags&=-257,l=E0(o,l,p)):l.memoizedState!==null?(Zs(),l.child=o.child,l.flags|=128,l=null):(Zs(),Y=g.fallback,N=l.mode,g=Om({mode:"visible",children:g.children},N),Y=Ki(Y,N,p,null),Y.flags|=2,g.return=l,Y.return=l,g.sibling=Y,l.child=g,el(l,o.child,null,p),g=l.child,g.memoizedState=y0(p),g.childLanes=v0(o,P,p),l.memoizedState=b0,l=Pd(null,g));else if(Ys(l),tw(Y)){if(P=Y.nextSibling&&Y.nextSibling.dataset,P)var ge=P.dgst;P=ge,g=Error(r(419)),g.stack="",g.digest=P,Td({value:g,source:null,stack:null}),l=E0(o,l,p)}else if(sr||sc(o,l,p,!1),P=(p&o.childLanes)!==0,sr||P){if(P=_n,P!==null&&(g=fn(P,p),g!==0&&g!==oe.retryLane))throw oe.retryLane=g,Wi(o,g),ga(P,o,g),h0;ew(Y)||Fm(),l=E0(o,l,p)}else ew(Y)?(l.flags|=192,l.child=o.child,l=null):(o=oe.treeContext,In=Ka(Y.nextSibling),Rr=l,qt=!0,Bs=null,Ga=!1,o!==null&&oI(l,o),l=w0(l,g.children),l.flags|=4096);return l}return N?(Zs(),Y=g.fallback,N=l.mode,oe=o.child,ge=oe.sibling,g=Jo(oe,{mode:"hidden",children:g.children}),g.subtreeFlags=oe.subtreeFlags&65011712,ge!==null?Y=Jo(ge,Y):(Y=Ki(Y,N,p,null),Y.flags|=2),Y.return=l,g.return=l,g.sibling=Y,l.child=g,Pd(null,g),g=l.child,Y=o.child.memoizedState,Y===null?Y=y0(p):(N=Y.cachePool,N!==null?(oe=ar._currentValue,N=N.parent!==oe?{parent:oe,pool:oe}:N):N=dI(),Y={baseLanes:Y.baseLanes|p,cachePool:N}),g.memoizedState=Y,g.childLanes=v0(o,P,p),l.memoizedState=b0,Pd(o.child,g)):(Ys(l),p=o.child,o=p.sibling,p=Jo(p,{mode:"visible",children:g.children}),p.return=l,p.sibling=null,o!==null&&(P=l.deletions,P===null?(l.deletions=[o],l.flags|=16):P.push(o)),l.child=p,l.memoizedState=null,p)}function w0(o,l){return l=Om({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function Om(o,l){return o=Ca(22,o,null,l),o.lanes=0,o}function E0(o,l,p){return el(l,o.child,null,p),o=w0(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function _O(o,l,p){o.lanes|=l;var g=o.alternate;g!==null&&(g.lanes|=l),jv(o.return,l,p)}function x0(o,l,p,g,N,k){var P=o.memoizedState;P===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:g,tail:p,tailMode:N,treeForkCount:k}:(P.isBackwards=l,P.rendering=null,P.renderingStartTime=0,P.last=g,P.tail=p,P.tailMode=N,P.treeForkCount=k)}function TO(o,l,p){var g=l.pendingProps,N=g.revealOrder,k=g.tail;g=g.children;var P=Qn.current,Y=(P&2)!==0;if(Y?(P=P&1|2,l.flags|=128):P&=1,$(Qn,P),Ir(o,l,g,p),g=qt?_d:0,!Y&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&_O(o,p,l);else if(o.tag===19)_O(o,p,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(N){case"forwards":for(p=l.child,N=null;p!==null;)o=p.alternate,o!==null&&wm(o)===null&&(N=p),p=p.sibling;p=N,p===null?(N=l.child,l.child=null):(N=p.sibling,p.sibling=null),x0(l,!1,N,p,k,g);break;case"backwards":case"unstable_legacy-backwards":for(p=null,N=l.child,l.child=null;N!==null;){if(o=N.alternate,o!==null&&wm(o)===null){l.child=N;break}o=N.sibling,N.sibling=p,p=N,N=o}x0(l,!0,p,null,k,g);break;case"together":x0(l,!1,null,null,void 0,g);break;default:l.memoizedState=null}return l.child}function as(o,l,p){if(o!==null&&(l.dependencies=o.dependencies),Js|=l.lanes,(p&l.childLanes)===0)if(o!==null){if(sc(o,l,p,!1),(p&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(r(153));if(l.child!==null){for(o=l.child,p=Jo(o,o.pendingProps),l.child=p,p.return=l;o.sibling!==null;)o=o.sibling,p=p.sibling=Jo(o,o.pendingProps),p.return=l;p.sibling=null}return l.child}function S0(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&fm(o)))}function G8(o,l,p){switch(l.tag){case 3:q(l,l.stateNode.containerInfo),Vs(l,ar,o.memoizedState.cache),Yi();break;case 27:case 5:ie(l);break;case 4:q(l,l.stateNode.containerInfo);break;case 10:Vs(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Yv(l),null;break;case 13:var g=l.memoizedState;if(g!==null)return g.dehydrated!==null?(Ys(l),l.flags|=128,null):(p&l.child.childLanes)!==0?SO(o,l,p):(Ys(l),o=as(o,l,p),o!==null?o.sibling:null);Ys(l);break;case 19:var N=(o.flags&128)!==0;if(g=(p&l.childLanes)!==0,g||(sc(o,l,p,!1),g=(p&l.childLanes)!==0),N){if(g)return TO(o,l,p);l.flags|=128}if(N=l.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),$(Qn,Qn.current),g)break;return null;case 22:return l.lanes=0,bO(o,l,p,l.pendingProps);case 24:Vs(l,ar,o.memoizedState.cache)}return as(o,l,p)}function NO(o,l,p){if(o!==null)if(o.memoizedProps!==l.pendingProps)sr=!0;else{if(!S0(o,p)&&(l.flags&128)===0)return sr=!1,G8(o,l,p);sr=(o.flags&131072)!==0}else sr=!1,qt&&(l.flags&1048576)!==0&&aI(l,_d,l.index);switch(l.lanes=0,l.tag){case 16:e:{var g=l.pendingProps;if(o=Ji(l.elementType),l.type=o,typeof o=="function")Cv(o)?(g=nl(o,g),l.tag=1,l=EO(null,l,o,g,p)):(l.tag=0,l=g0(null,l,o,g,p));else{if(o!=null){var N=o.$$typeof;if(N===R){l.tag=11,l=mO(null,l,o,g,p);break e}else if(N===A){l.tag=14,l=hO(null,l,o,g,p);break e}}throw l=ee(o)||o,Error(r(306,l,""))}}return l;case 0:return g0(o,l,l.type,l.pendingProps,p);case 1:return g=l.type,N=nl(g,l.pendingProps),EO(o,l,g,N,p);case 3:e:{if(q(l,l.stateNode.containerInfo),o===null)throw Error(r(387));g=l.pendingProps;var k=l.memoizedState;N=k.element,Hv(o,l),Od(l,g,null,p);var P=l.memoizedState;if(g=P.cache,Vs(l,ar,g),g!==k.cache&&Pv(l,[ar],p,!0),Id(),g=P.element,k.isDehydrated)if(k={element:g,isDehydrated:!1,cache:P.cache},l.updateQueue.baseState=k,l.memoizedState=k,l.flags&256){l=xO(o,l,g,p);break e}else if(g!==N){N=Ba(Error(r(424)),l),Td(N),l=xO(o,l,g,p);break e}else{switch(o=l.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(In=Ka(o.firstChild),Rr=l,qt=!0,Bs=null,Ga=!0,p=bI(l,null,g,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Yi(),g===N){l=as(o,l,p);break e}Ir(o,l,g,p)}l=l.child}return l;case 26:return Im(o,l),o===null?(p=PD(l.type,null,l.pendingProps,null))?l.memoizedState=p:qt||(p=l.type,o=l.pendingProps,g=Ym(z.current).createElement(p),g[ht]=l,g[Hn]=o,Or(g,p,o),st(g),l.stateNode=g):l.memoizedState=PD(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:return ie(l),o===null&&qt&&(g=l.stateNode=LD(l.type,l.pendingProps,z.current),Rr=l,Ga=!0,N=In,ri(l.type)?(nw=N,In=Ka(g.firstChild)):In=N),Ir(o,l,l.pendingProps.children,p),Im(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&qt&&((N=g=In)&&(g=E9(g,l.type,l.pendingProps,Ga),g!==null?(l.stateNode=g,Rr=l,In=Ka(g.firstChild),Ga=!1,N=!0):N=!1),N||Hs(l)),ie(l),N=l.type,k=l.pendingProps,P=o!==null?o.memoizedProps:null,g=k.children,X0(N,k)?g=null:P!==null&&X0(N,P)&&(l.flags|=32),l.memoizedState!==null&&(N=qv(o,l,j8,null,null,p),Jd._currentValue=N),Im(o,l),Ir(o,l,g,p),l.child;case 6:return o===null&&qt&&((o=p=In)&&(p=x9(p,l.pendingProps,Ga),p!==null?(l.stateNode=p,Rr=l,In=null,o=!0):o=!1),o||Hs(l)),null;case 13:return SO(o,l,p);case 4:return q(l,l.stateNode.containerInfo),g=l.pendingProps,o===null?l.child=el(l,null,g,p):Ir(o,l,g,p),l.child;case 11:return mO(o,l,l.type,l.pendingProps,p);case 7:return Ir(o,l,l.pendingProps,p),l.child;case 8:return Ir(o,l,l.pendingProps.children,p),l.child;case 12:return Ir(o,l,l.pendingProps.children,p),l.child;case 10:return g=l.pendingProps,Vs(l,l.type,g.value),Ir(o,l,g.children,p),l.child;case 9:return N=l.type._context,g=l.pendingProps.children,qi(l),N=Ar(N),g=g(N),l.flags|=1,Ir(o,l,g,p),l.child;case 14:return hO(o,l,l.type,l.pendingProps,p);case 15:return gO(o,l,l.type,l.pendingProps,p);case 19:return TO(o,l,p);case 31:return V8(o,l,p);case 22:return bO(o,l,p,l.pendingProps);case 24:return qi(l),g=Ar(ar),o===null?(N=zv(),N===null&&(N=_n,k=Uv(),N.pooledCache=k,k.refCount++,k!==null&&(N.pooledCacheLanes|=p),N=k),l.memoizedState={parent:g,cache:N},Bv(l),Vs(l,ar,N)):((o.lanes&p)!==0&&(Hv(o,l),Od(l,null,null,p),Id()),N=o.memoizedState,k=l.memoizedState,N.parent!==g?(N={parent:g,cache:g},l.memoizedState=N,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=N),Vs(l,ar,g)):(g=k.cache,Vs(l,ar,g),g!==N.cache&&Pv(l,[ar],p,!0))),Ir(o,l,l.pendingProps.children,p),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function os(o){o.flags|=4}function _0(o,l,p,g,N){if((l=(o.mode&32)!==0)&&(l=!1),l){if(o.flags|=16777216,(N&335544128)===N)if(o.stateNode.complete)o.flags|=8192;else if(QO())o.flags|=8192;else throw Qi=gm,Fv}else o.flags&=-16777217}function kO(o,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!BD(l))if(QO())o.flags|=8192;else throw Qi=gm,Fv}function Dm(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?Pt():536870912,o.lanes|=l,yc|=l)}function Ud(o,l){if(!qt)switch(o.tailMode){case"hidden":l=o.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?o.tail=null:p.sibling=null;break;case"collapsed":p=o.tail;for(var g=null;p!==null;)p.alternate!==null&&(g=p),p=p.sibling;g===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:g.sibling=null}}function On(o){var l=o.alternate!==null&&o.alternate.child===o.child,p=0,g=0;if(l)for(var N=o.child;N!==null;)p|=N.lanes|N.childLanes,g|=N.subtreeFlags&65011712,g|=N.flags&65011712,N.return=o,N=N.sibling;else for(N=o.child;N!==null;)p|=N.lanes|N.childLanes,g|=N.subtreeFlags,g|=N.flags,N.return=o,N=N.sibling;return o.subtreeFlags|=g,o.childLanes=p,l}function W8(o,l,p){var g=l.pendingProps;switch(Ov(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return On(l),null;case 1:return On(l),null;case 3:return p=l.stateNode,g=null,o!==null&&(g=o.memoizedState.cache),l.memoizedState.cache!==g&&(l.flags|=2048),ts(ar),ae(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(o===null||o.child===null)&&(oc(l)?os(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Lv())),On(l),null;case 26:var N=l.type,k=l.memoizedState;return o===null?(os(l),k!==null?(On(l),kO(l,k)):(On(l),_0(l,N,null,g,p))):k?k!==o.memoizedState?(os(l),On(l),kO(l,k)):(On(l),l.flags&=-16777217):(o=o.memoizedProps,o!==g&&os(l),On(l),_0(l,N,o,g,p)),null;case 27:if(X(l),p=z.current,N=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==g&&os(l);else{if(!g){if(l.stateNode===null)throw Error(r(166));return On(l),null}o=L.current,oc(l)?sI(l):(o=LD(N,g,p),l.stateNode=o,os(l))}return On(l),null;case 5:if(X(l),N=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==g&&os(l);else{if(!g){if(l.stateNode===null)throw Error(r(166));return On(l),null}if(k=L.current,oc(l))sI(l);else{var P=Ym(z.current);switch(k){case 1:k=P.createElementNS("http://www.w3.org/2000/svg",N);break;case 2:k=P.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;default:switch(N){case"svg":k=P.createElementNS("http://www.w3.org/2000/svg",N);break;case"math":k=P.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;case"script":k=P.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof g.is=="string"?P.createElement("select",{is:g.is}):P.createElement("select"),g.multiple?k.multiple=!0:g.size&&(k.size=g.size);break;default:k=typeof g.is=="string"?P.createElement(N,{is:g.is}):P.createElement(N)}}k[ht]=l,k[Hn]=g;e:for(P=l.child;P!==null;){if(P.tag===5||P.tag===6)k.appendChild(P.stateNode);else if(P.tag!==4&&P.tag!==27&&P.child!==null){P.child.return=P,P=P.child;continue}if(P===l)break e;for(;P.sibling===null;){if(P.return===null||P.return===l)break e;P=P.return}P.sibling.return=P.return,P=P.sibling}l.stateNode=k;e:switch(Or(k,N,g),N){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&os(l)}}return On(l),_0(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,p),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==g&&os(l);else{if(typeof g!="string"&&l.stateNode===null)throw Error(r(166));if(o=z.current,oc(l)){if(o=l.stateNode,p=l.memoizedProps,g=null,N=Rr,N!==null)switch(N.tag){case 27:case 5:g=N.memoizedProps}o[ht]=l,o=!!(o.nodeValue===p||g!==null&&g.suppressHydrationWarning===!0||SD(o.nodeValue,p)),o||Hs(l,!0)}else o=Ym(o).createTextNode(g),o[ht]=l,l.stateNode=o}return On(l),null;case 31:if(p=l.memoizedState,o===null||o.memoizedState!==null){if(g=oc(l),p!==null){if(o===null){if(!g)throw Error(r(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[ht]=l}else Yi(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;On(l),o=!1}else p=Lv(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=p),o=!0;if(!o)return l.flags&256?(Aa(l),l):(Aa(l),null);if((l.flags&128)!==0)throw Error(r(558))}return On(l),null;case 13:if(g=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(N=oc(l),g!==null&&g.dehydrated!==null){if(o===null){if(!N)throw Error(r(318));if(N=l.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(r(317));N[ht]=l}else Yi(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;On(l),N=!1}else N=Lv(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=N),N=!0;if(!N)return l.flags&256?(Aa(l),l):(Aa(l),null)}return Aa(l),(l.flags&128)!==0?(l.lanes=p,l):(p=g!==null,o=o!==null&&o.memoizedState!==null,p&&(g=l.child,N=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(N=g.alternate.memoizedState.cachePool.pool),k=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(k=g.memoizedState.cachePool.pool),k!==N&&(g.flags|=2048)),p!==o&&p&&(l.child.flags|=8192),Dm(l,l.updateQueue),On(l),null);case 4:return ae(),o===null&&W0(l.stateNode.containerInfo),On(l),null;case 10:return ts(l.type),On(l),null;case 19:if(H(Qn),g=l.memoizedState,g===null)return On(l),null;if(N=(l.flags&128)!==0,k=g.rendering,k===null)if(N)Ud(g,!1);else{if(Yn!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(k=wm(o),k!==null){for(l.flags|=128,Ud(g,!1),o=k.updateQueue,l.updateQueue=o,Dm(l,o),l.subtreeFlags=0,o=p,p=l.child;p!==null;)tI(p,o),p=p.sibling;return $(Qn,Qn.current&1|2),qt&&Qo(l,g.treeForkCount),l.child}o=o.sibling}g.tail!==null&&we()>Um&&(l.flags|=128,N=!0,Ud(g,!1),l.lanes=4194304)}else{if(!N)if(o=wm(k),o!==null){if(l.flags|=128,N=!0,o=o.updateQueue,l.updateQueue=o,Dm(l,o),Ud(g,!0),g.tail===null&&g.tailMode==="hidden"&&!k.alternate&&!qt)return On(l),null}else 2*we()-g.renderingStartTime>Um&&p!==536870912&&(l.flags|=128,N=!0,Ud(g,!1),l.lanes=4194304);g.isBackwards?(k.sibling=l.child,l.child=k):(o=g.last,o!==null?o.sibling=k:l.child=k,g.last=k)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=we(),o.sibling=null,p=Qn.current,$(Qn,N?p&1|2:p&1),qt&&Qo(l,g.treeForkCount),o):(On(l),null);case 22:case 23:return Aa(l),Kv(),g=l.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(l.flags|=8192):g&&(l.flags|=8192),g?(p&536870912)!==0&&(l.flags&128)===0&&(On(l),l.subtreeFlags&6&&(l.flags|=8192)):On(l),p=l.updateQueue,p!==null&&Dm(l,p.retryQueue),p=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),g=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(g=l.memoizedState.cachePool.pool),g!==p&&(l.flags|=2048),o!==null&&H(Xi),null;case 24:return p=null,o!==null&&(p=o.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),ts(ar),On(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function K8(o,l){switch(Ov(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return ts(ar),ae(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return X(l),null;case 31:if(l.memoizedState!==null){if(Aa(l),l.alternate===null)throw Error(r(340));Yi()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(Aa(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Yi()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return H(Qn),null;case 4:return ae(),null;case 10:return ts(l.type),null;case 22:case 23:return Aa(l),Kv(),o!==null&&H(Xi),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return ts(ar),null;case 25:return null;default:return null}}function CO(o,l){switch(Ov(l),l.tag){case 3:ts(ar),ae();break;case 26:case 27:case 5:X(l);break;case 4:ae();break;case 31:l.memoizedState!==null&&Aa(l);break;case 13:Aa(l);break;case 19:H(Qn);break;case 10:ts(l.type);break;case 22:case 23:Aa(l),Kv(),o!==null&&H(Xi);break;case 24:ts(ar)}}function $d(o,l){try{var p=l.updateQueue,g=p!==null?p.lastEffect:null;if(g!==null){var N=g.next;p=N;do{if((p.tag&o)===o){g=void 0;var k=p.create,P=p.inst;g=k(),P.destroy=g}p=p.next}while(p!==N)}}catch(Y){bn(l,l.return,Y)}}function qs(o,l,p){try{var g=l.updateQueue,N=g!==null?g.lastEffect:null;if(N!==null){var k=N.next;g=k;do{if((g.tag&o)===o){var P=g.inst,Y=P.destroy;if(Y!==void 0){P.destroy=void 0,N=l;var oe=p,ge=Y;try{ge()}catch(xe){bn(N,oe,xe)}}}g=g.next}while(g!==k)}}catch(xe){bn(l,l.return,xe)}}function RO(o){var l=o.updateQueue;if(l!==null){var p=o.stateNode;try{vI(l,p)}catch(g){bn(o,o.return,g)}}}function AO(o,l,p){p.props=nl(o.type,o.memoizedProps),p.state=o.memoizedState;try{p.componentWillUnmount()}catch(g){bn(o,l,g)}}function zd(o,l){try{var p=o.ref;if(p!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof p=="function"?o.refCleanup=p(g):p.current=g}}catch(N){bn(o,l,N)}}function Oo(o,l){var p=o.ref,g=o.refCleanup;if(p!==null)if(typeof g=="function")try{g()}catch(N){bn(o,l,N)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(N){bn(o,l,N)}else p.current=null}function IO(o){var l=o.type,p=o.memoizedProps,g=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":p.autoFocus&&g.focus();break e;case"img":p.src?g.src=p.src:p.srcSet&&(g.srcset=p.srcSet)}}catch(N){bn(o,o.return,N)}}function T0(o,l,p){try{var g=o.stateNode;h9(g,o.type,p,l),g[Hn]=l}catch(N){bn(o,o.return,N)}}function OO(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&ri(o.type)||o.tag===4}function N0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||OO(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&ri(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function k0(o,l,p){var g=o.tag;if(g===5||g===6)o=o.stateNode,l?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(o,l):(l=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,l.appendChild(o),p=p._reactRootContainer,p!=null||l.onclick!==null||(l.onclick=qo));else if(g!==4&&(g===27&&ri(o.type)&&(p=o.stateNode,l=null),o=o.child,o!==null))for(k0(o,l,p),o=o.sibling;o!==null;)k0(o,l,p),o=o.sibling}function Lm(o,l,p){var g=o.tag;if(g===5||g===6)o=o.stateNode,l?p.insertBefore(o,l):p.appendChild(o);else if(g!==4&&(g===27&&ri(o.type)&&(p=o.stateNode),o=o.child,o!==null))for(Lm(o,l,p),o=o.sibling;o!==null;)Lm(o,l,p),o=o.sibling}function DO(o){var l=o.stateNode,p=o.memoizedProps;try{for(var g=o.type,N=l.attributes;N.length;)l.removeAttributeNode(N[0]);Or(l,g,p),l[ht]=o,l[Hn]=p}catch(k){bn(o,o.return,k)}}var ss=!1,ir=!1,C0=!1,LO=typeof WeakSet=="function"?WeakSet:Set,xr=null;function Y8(o,l){if(o=o.containerInfo,Z0=th,o=W1(o),Ev(o)){if("selectionStart"in o)var p={start:o.selectionStart,end:o.selectionEnd};else e:{p=(p=o.ownerDocument)&&p.defaultView||window;var g=p.getSelection&&p.getSelection();if(g&&g.rangeCount!==0){p=g.anchorNode;var N=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{p.nodeType,k.nodeType}catch{p=null;break e}var P=0,Y=-1,oe=-1,ge=0,xe=0,ke=o,ye=null;t:for(;;){for(var ve;ke!==p||N!==0&&ke.nodeType!==3||(Y=P+N),ke!==k||g!==0&&ke.nodeType!==3||(oe=P+g),ke.nodeType===3&&(P+=ke.nodeValue.length),(ve=ke.firstChild)!==null;)ye=ke,ke=ve;for(;;){if(ke===o)break t;if(ye===p&&++ge===N&&(Y=P),ye===k&&++xe===g&&(oe=P),(ve=ke.nextSibling)!==null)break;ke=ye,ye=ke.parentNode}ke=ve}p=Y===-1||oe===-1?null:{start:Y,end:oe}}else p=null}p=p||{start:0,end:0}}else p=null;for(q0={focusedElem:o,selectionRange:p},th=!1,xr=l;xr!==null;)if(l=xr,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,xr=o;else for(;xr!==null;){switch(l=xr,k=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(p=0;p<o.length;p++)N=o[p],N.ref.impl=N.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&k!==null){o=void 0,p=l,N=k.memoizedProps,k=k.memoizedState,g=p.stateNode;try{var We=nl(p.type,N);o=g.getSnapshotBeforeUpdate(We,k),g.__reactInternalSnapshotBeforeUpdate=o}catch(ct){bn(p,p.return,ct)}}break;case 3:if((o&1024)!==0){if(o=l.stateNode.containerInfo,p=o.nodeType,p===9)Q0(o);else if(p===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Q0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=l.sibling,o!==null){o.return=l.return,xr=o;break}xr=l.return}}function MO(o,l,p){var g=p.flags;switch(p.tag){case 0:case 11:case 15:ls(o,p),g&4&&$d(5,p);break;case 1:if(ls(o,p),g&4)if(o=p.stateNode,l===null)try{o.componentDidMount()}catch(P){bn(p,p.return,P)}else{var N=nl(p.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(N,l,o.__reactInternalSnapshotBeforeUpdate)}catch(P){bn(p,p.return,P)}}g&64&&RO(p),g&512&&zd(p,p.return);break;case 3:if(ls(o,p),g&64&&(o=p.updateQueue,o!==null)){if(l=null,p.child!==null)switch(p.child.tag){case 27:case 5:l=p.child.stateNode;break;case 1:l=p.child.stateNode}try{vI(o,l)}catch(P){bn(p,p.return,P)}}break;case 27:l===null&&g&4&&DO(p);case 26:case 5:ls(o,p),l===null&&g&4&&IO(p),g&512&&zd(p,p.return);break;case 12:ls(o,p);break;case 31:ls(o,p),g&4&&UO(o,p);break;case 13:ls(o,p),g&4&&$O(o,p),g&64&&(o=p.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(p=r9.bind(null,p),S9(o,p))));break;case 22:if(g=p.memoizedState!==null||ss,!g){l=l!==null&&l.memoizedState!==null||ir,N=ss;var k=ir;ss=g,(ir=l)&&!k?cs(o,p,(p.subtreeFlags&8772)!==0):ls(o,p),ss=N,ir=k}break;case 30:break;default:ls(o,p)}}function jO(o){var l=o.alternate;l!==null&&(o.alternate=null,jO(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&sn(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var jn=null,fa=!1;function is(o,l,p){for(p=p.child;p!==null;)PO(o,l,p),p=p.sibling}function PO(o,l,p){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(Ut,p)}catch{}switch(p.tag){case 26:ir||Oo(p,l),is(o,l,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:ir||Oo(p,l);var g=jn,N=fa;ri(p.type)&&(jn=p.stateNode,fa=!1),is(o,l,p),Zd(p.stateNode),jn=g,fa=N;break;case 5:ir||Oo(p,l);case 6:if(g=jn,N=fa,jn=null,is(o,l,p),jn=g,fa=N,jn!==null)if(fa)try{(jn.nodeType===9?jn.body:jn.nodeName==="HTML"?jn.ownerDocument.body:jn).removeChild(p.stateNode)}catch(k){bn(p,l,k)}else try{jn.removeChild(p.stateNode)}catch(k){bn(p,l,k)}break;case 18:jn!==null&&(fa?(o=jn,RD(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,p.stateNode),Nc(o)):RD(jn,p.stateNode));break;case 4:g=jn,N=fa,jn=p.stateNode.containerInfo,fa=!0,is(o,l,p),jn=g,fa=N;break;case 0:case 11:case 14:case 15:qs(2,p,l),ir||qs(4,p,l),is(o,l,p);break;case 1:ir||(Oo(p,l),g=p.stateNode,typeof g.componentWillUnmount=="function"&&AO(p,l,g)),is(o,l,p);break;case 21:is(o,l,p);break;case 22:ir=(g=ir)||p.memoizedState!==null,is(o,l,p),ir=g;break;default:is(o,l,p)}}function UO(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Nc(o)}catch(p){bn(l,l.return,p)}}}function $O(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Nc(o)}catch(p){bn(l,l.return,p)}}function Z8(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new LO),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new LO),l;default:throw Error(r(435,o.tag))}}function Mm(o,l){var p=Z8(o);l.forEach(function(g){if(!p.has(g)){p.add(g);var N=a9.bind(null,o,g);g.then(N,N)}})}function pa(o,l){var p=l.deletions;if(p!==null)for(var g=0;g<p.length;g++){var N=p[g],k=o,P=l,Y=P;e:for(;Y!==null;){switch(Y.tag){case 27:if(ri(Y.type)){jn=Y.stateNode,fa=!1;break e}break;case 5:jn=Y.stateNode,fa=!1;break e;case 3:case 4:jn=Y.stateNode.containerInfo,fa=!0;break e}Y=Y.return}if(jn===null)throw Error(r(160));PO(k,P,N),jn=null,fa=!1,k=N.alternate,k!==null&&(k.return=null),N.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)zO(l,o),l=l.sibling}var lo=null;function zO(o,l){var p=o.alternate,g=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:pa(l,o),ma(o),g&4&&(qs(3,o,o.return),$d(3,o),qs(5,o,o.return));break;case 1:pa(l,o),ma(o),g&512&&(ir||p===null||Oo(p,p.return)),g&64&&ss&&(o=o.updateQueue,o!==null&&(g=o.callbacks,g!==null&&(p=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=p===null?g:p.concat(g))));break;case 26:var N=lo;if(pa(l,o),ma(o),g&512&&(ir||p===null||Oo(p,p.return)),g&4){var k=p!==null?p.memoizedState:null;if(g=o.memoizedState,p===null)if(g===null)if(o.stateNode===null){e:{g=o.type,p=o.memoizedProps,N=N.ownerDocument||N;t:switch(g){case"title":k=N.getElementsByTagName("title")[0],(!k||k[pn]||k[ht]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=N.createElement(g),N.head.insertBefore(k,N.querySelector("head > title"))),Or(k,g,p),k[ht]=o,st(k),g=k;break e;case"link":var P=zD("link","href",N).get(g+(p.href||""));if(P){for(var Y=0;Y<P.length;Y++)if(k=P[Y],k.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&k.getAttribute("rel")===(p.rel==null?null:p.rel)&&k.getAttribute("title")===(p.title==null?null:p.title)&&k.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){P.splice(Y,1);break t}}k=N.createElement(g),Or(k,g,p),N.head.appendChild(k);break;case"meta":if(P=zD("meta","content",N).get(g+(p.content||""))){for(Y=0;Y<P.length;Y++)if(k=P[Y],k.getAttribute("content")===(p.content==null?null:""+p.content)&&k.getAttribute("name")===(p.name==null?null:p.name)&&k.getAttribute("property")===(p.property==null?null:p.property)&&k.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&k.getAttribute("charset")===(p.charSet==null?null:p.charSet)){P.splice(Y,1);break t}}k=N.createElement(g),Or(k,g,p),N.head.appendChild(k);break;default:throw Error(r(468,g))}k[ht]=o,st(k),g=k}o.stateNode=g}else FD(N,o.type,o.stateNode);else o.stateNode=$D(N,g,o.memoizedProps);else k!==g?(k===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):k.count--,g===null?FD(N,o.type,o.stateNode):$D(N,g,o.memoizedProps)):g===null&&o.stateNode!==null&&T0(o,o.memoizedProps,p.memoizedProps)}break;case 27:pa(l,o),ma(o),g&512&&(ir||p===null||Oo(p,p.return)),p!==null&&g&4&&T0(o,o.memoizedProps,p.memoizedProps);break;case 5:if(pa(l,o),ma(o),g&512&&(ir||p===null||Oo(p,p.return)),o.flags&32){N=o.stateNode;try{Zo(N,"")}catch(We){bn(o,o.return,We)}}g&4&&o.stateNode!=null&&(N=o.memoizedProps,T0(o,N,p!==null?p.memoizedProps:N)),g&1024&&(C0=!0);break;case 6:if(pa(l,o),ma(o),g&4){if(o.stateNode===null)throw Error(r(162));g=o.memoizedProps,p=o.stateNode;try{p.nodeValue=g}catch(We){bn(o,o.return,We)}}break;case 3:if(Xm=null,N=lo,lo=Zm(l.containerInfo),pa(l,o),lo=N,ma(o),g&4&&p!==null&&p.memoizedState.isDehydrated)try{Nc(l.containerInfo)}catch(We){bn(o,o.return,We)}C0&&(C0=!1,FO(o));break;case 4:g=lo,lo=Zm(o.stateNode.containerInfo),pa(l,o),ma(o),lo=g;break;case 12:pa(l,o),ma(o);break;case 31:pa(l,o),ma(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Mm(o,g)));break;case 13:pa(l,o),ma(o),o.child.flags&8192&&o.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Pm=we()),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Mm(o,g)));break;case 22:N=o.memoizedState!==null;var oe=p!==null&&p.memoizedState!==null,ge=ss,xe=ir;if(ss=ge||N,ir=xe||oe,pa(l,o),ir=xe,ss=ge,ma(o),g&8192)e:for(l=o.stateNode,l._visibility=N?l._visibility&-2:l._visibility|1,N&&(p===null||oe||ss||ir||rl(o)),p=null,l=o;;){if(l.tag===5||l.tag===26){if(p===null){oe=p=l;try{if(k=oe.stateNode,N)P=k.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none";else{Y=oe.stateNode;var ke=oe.memoizedProps.style,ye=ke!=null&&ke.hasOwnProperty("display")?ke.display:null;Y.style.display=ye==null||typeof ye=="boolean"?"":(""+ye).trim()}}catch(We){bn(oe,oe.return,We)}}}else if(l.tag===6){if(p===null){oe=l;try{oe.stateNode.nodeValue=N?"":oe.memoizedProps}catch(We){bn(oe,oe.return,We)}}}else if(l.tag===18){if(p===null){oe=l;try{var ve=oe.stateNode;N?AD(ve,!0):AD(oe.stateNode,!1)}catch(We){bn(oe,oe.return,We)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;p===l&&(p=null),l=l.return}p===l&&(p=null),l.sibling.return=l.return,l=l.sibling}g&4&&(g=o.updateQueue,g!==null&&(p=g.retryQueue,p!==null&&(g.retryQueue=null,Mm(o,p))));break;case 19:pa(l,o),ma(o),g&4&&(g=o.updateQueue,g!==null&&(o.updateQueue=null,Mm(o,g)));break;case 30:break;case 21:break;default:pa(l,o),ma(o)}}function ma(o){var l=o.flags;if(l&2){try{for(var p,g=o.return;g!==null;){if(OO(g)){p=g;break}g=g.return}if(p==null)throw Error(r(160));switch(p.tag){case 27:var N=p.stateNode,k=N0(o);Lm(o,k,N);break;case 5:var P=p.stateNode;p.flags&32&&(Zo(P,""),p.flags&=-33);var Y=N0(o);Lm(o,Y,P);break;case 3:case 4:var oe=p.stateNode.containerInfo,ge=N0(o);k0(o,ge,oe);break;default:throw Error(r(161))}}catch(xe){bn(o,o.return,xe)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function FO(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;FO(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),o=o.sibling}}function ls(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)MO(o,l.alternate,l),l=l.sibling}function rl(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:qs(4,l,l.return),rl(l);break;case 1:Oo(l,l.return);var p=l.stateNode;typeof p.componentWillUnmount=="function"&&AO(l,l.return,p),rl(l);break;case 27:Zd(l.stateNode);case 26:case 5:Oo(l,l.return),rl(l);break;case 22:l.memoizedState===null&&rl(l);break;case 30:rl(l);break;default:rl(l)}o=o.sibling}}function cs(o,l,p){for(p=p&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var g=l.alternate,N=o,k=l,P=k.flags;switch(k.tag){case 0:case 11:case 15:cs(N,k,p),$d(4,k);break;case 1:if(cs(N,k,p),g=k,N=g.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch(ge){bn(g,g.return,ge)}if(g=k,N=g.updateQueue,N!==null){var Y=g.stateNode;try{var oe=N.shared.hiddenCallbacks;if(oe!==null)for(N.shared.hiddenCallbacks=null,N=0;N<oe.length;N++)yI(oe[N],Y)}catch(ge){bn(g,g.return,ge)}}p&&P&64&&RO(k),zd(k,k.return);break;case 27:DO(k);case 26:case 5:cs(N,k,p),p&&g===null&&P&4&&IO(k),zd(k,k.return);break;case 12:cs(N,k,p);break;case 31:cs(N,k,p),p&&P&4&&UO(N,k);break;case 13:cs(N,k,p),p&&P&4&&$O(N,k);break;case 22:k.memoizedState===null&&cs(N,k,p),zd(k,k.return);break;case 30:break;default:cs(N,k,p)}l=l.sibling}}function R0(o,l){var p=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==p&&(o!=null&&o.refCount++,p!=null&&Nd(p))}function A0(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Nd(o))}function co(o,l,p,g){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)BO(o,l,p,g),l=l.sibling}function BO(o,l,p,g){var N=l.flags;switch(l.tag){case 0:case 11:case 15:co(o,l,p,g),N&2048&&$d(9,l);break;case 1:co(o,l,p,g);break;case 3:co(o,l,p,g),N&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Nd(o)));break;case 12:if(N&2048){co(o,l,p,g),o=l.stateNode;try{var k=l.memoizedProps,P=k.id,Y=k.onPostCommit;typeof Y=="function"&&Y(P,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(oe){bn(l,l.return,oe)}}else co(o,l,p,g);break;case 31:co(o,l,p,g);break;case 13:co(o,l,p,g);break;case 23:break;case 22:k=l.stateNode,P=l.alternate,l.memoizedState!==null?k._visibility&2?co(o,l,p,g):Fd(o,l):k._visibility&2?co(o,l,p,g):(k._visibility|=2,hc(o,l,p,g,(l.subtreeFlags&10256)!==0||!1)),N&2048&&R0(P,l);break;case 24:co(o,l,p,g),N&2048&&A0(l.alternate,l);break;default:co(o,l,p,g)}}function hc(o,l,p,g,N){for(N=N&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var k=o,P=l,Y=p,oe=g,ge=P.flags;switch(P.tag){case 0:case 11:case 15:hc(k,P,Y,oe,N),$d(8,P);break;case 23:break;case 22:var xe=P.stateNode;P.memoizedState!==null?xe._visibility&2?hc(k,P,Y,oe,N):Fd(k,P):(xe._visibility|=2,hc(k,P,Y,oe,N)),N&&ge&2048&&R0(P.alternate,P);break;case 24:hc(k,P,Y,oe,N),N&&ge&2048&&A0(P.alternate,P);break;default:hc(k,P,Y,oe,N)}l=l.sibling}}function Fd(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var p=o,g=l,N=g.flags;switch(g.tag){case 22:Fd(p,g),N&2048&&R0(g.alternate,g);break;case 24:Fd(p,g),N&2048&&A0(g.alternate,g);break;default:Fd(p,g)}l=l.sibling}}var Bd=8192;function gc(o,l,p){if(o.subtreeFlags&Bd)for(o=o.child;o!==null;)HO(o,l,p),o=o.sibling}function HO(o,l,p){switch(o.tag){case 26:gc(o,l,p),o.flags&Bd&&o.memoizedState!==null&&M9(p,lo,o.memoizedState,o.memoizedProps);break;case 5:gc(o,l,p);break;case 3:case 4:var g=lo;lo=Zm(o.stateNode.containerInfo),gc(o,l,p),lo=g;break;case 22:o.memoizedState===null&&(g=o.alternate,g!==null&&g.memoizedState!==null?(g=Bd,Bd=16777216,gc(o,l,p),Bd=g):gc(o,l,p));break;default:gc(o,l,p)}}function VO(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function Hd(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var g=l[p];xr=g,WO(g,o)}VO(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)GO(o),o=o.sibling}function GO(o){switch(o.tag){case 0:case 11:case 15:Hd(o),o.flags&2048&&qs(9,o,o.return);break;case 3:Hd(o);break;case 12:Hd(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,jm(o)):Hd(o);break;default:Hd(o)}}function jm(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var g=l[p];xr=g,WO(g,o)}VO(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:qs(8,l,l.return),jm(l);break;case 22:p=l.stateNode,p._visibility&2&&(p._visibility&=-3,jm(l));break;default:jm(l)}o=o.sibling}}function WO(o,l){for(;xr!==null;){var p=xr;switch(p.tag){case 0:case 11:case 15:qs(8,p,l);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var g=p.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:Nd(p.memoizedState.cache)}if(g=p.child,g!==null)g.return=p,xr=g;else e:for(p=o;xr!==null;){g=xr;var N=g.sibling,k=g.return;if(jO(g),g===p){xr=null;break e}if(N!==null){N.return=k,xr=N;break e}xr=k}}}var q8={getCacheForType:function(o){var l=Ar(ar),p=l.data.get(o);return p===void 0&&(p=o(),l.data.set(o,p)),p},cacheSignal:function(){return Ar(ar).controller.signal}},X8=typeof WeakMap=="function"?WeakMap:Map,ln=0,_n=null,zt=null,Vt=0,gn=0,Ia=null,Xs=!1,bc=!1,I0=!1,us=0,Yn=0,Js=0,al=0,O0=0,Oa=0,yc=0,Vd=null,ha=null,D0=!1,Pm=0,KO=0,Um=1/0,$m=null,Qs=null,fr=0,ei=null,vc=null,ds=0,L0=0,M0=null,YO=null,Gd=0,j0=null;function Da(){return(ln&2)!==0&&Vt!==0?Vt&-Vt:F.T!==null?B0():Ta()}function ZO(){if(Oa===0)if((Vt&536870912)===0||qt){var o=xt;xt<<=1,(xt&3932160)===0&&(xt=262144),Oa=o}else Oa=536870912;return o=Ra.current,o!==null&&(o.flags|=32),Oa}function ga(o,l,p){(o===_n&&(gn===2||gn===9)||o.cancelPendingCommit!==null)&&(wc(o,0),ti(o,Vt,Oa,!1)),dn(o,p),((ln&2)===0||o!==_n)&&(o===_n&&((ln&2)===0&&(al|=p),Yn===4&&ti(o,Vt,Oa,!1)),Do(o))}function qO(o,l,p){if((ln&6)!==0)throw Error(r(327));var g=!p&&(l&127)===0&&(l&o.expiredLanes)===0||vt(o,l),N=g?e9(o,l):U0(o,l,!0),k=g;do{if(N===0){bc&&!g&&ti(o,l,0,!1);break}else{if(p=o.current.alternate,k&&!J8(p)){N=U0(o,l,!1),k=!1;continue}if(N===2){if(k=l,o.errorRecoveryDisabledLanes&k)var P=0;else P=o.pendingLanes&-536870913,P=P!==0?P:P&536870912?536870912:0;if(P!==0){l=P;e:{var Y=o;N=Vd;var oe=Y.current.memoizedState.isDehydrated;if(oe&&(wc(Y,P).flags|=256),P=U0(Y,P,!1),P!==2){if(I0&&!oe){Y.errorRecoveryDisabledLanes|=k,al|=k,N=4;break e}k=ha,ha=N,k!==null&&(ha===null?ha=k:ha.push.apply(ha,k))}N=P}if(k=!1,N!==2)continue}}if(N===1){wc(o,0),ti(o,l,0,!0);break}e:{switch(g=o,k=N,k){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:ti(g,l,Oa,!Xs);break e;case 2:ha=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(N=Pm+300-we(),10<N)){if(ti(g,l,Oa,!Xs),Ze(g,0,!0)!==0)break e;ds=l,g.timeoutHandle=kD(XO.bind(null,g,p,ha,$m,D0,l,Oa,al,yc,Xs,k,"Throttled",-0,0),N);break e}XO(g,p,ha,$m,D0,l,Oa,al,yc,Xs,k,null,-0,0)}}break}while(!0);Do(o)}function XO(o,l,p,g,N,k,P,Y,oe,ge,xe,ke,ye,ve){if(o.timeoutHandle=-1,ke=l.subtreeFlags,ke&8192||(ke&16785408)===16785408){ke={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qo},HO(l,k,ke);var We=(k&62914560)===k?Pm-we():(k&4194048)===k?KO-we():0;if(We=j9(ke,We),We!==null){ds=k,o.cancelPendingCommit=We(oD.bind(null,o,l,k,p,g,N,P,Y,oe,xe,ke,null,ye,ve)),ti(o,k,P,!ge);return}}oD(o,l,k,p,g,N,P,Y,oe)}function J8(o){for(var l=o;;){var p=l.tag;if((p===0||p===11||p===15)&&l.flags&16384&&(p=l.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var g=0;g<p.length;g++){var N=p[g],k=N.getSnapshot;N=N.value;try{if(!ka(k(),N))return!1}catch{return!1}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function ti(o,l,p,g){l&=~O0,l&=~al,o.suspendedLanes|=l,o.pingedLanes&=~l,g&&(o.warmLanes|=l),g=o.expirationTimes;for(var N=l;0<N;){var k=31-Me(N),P=1<<k;g[k]=-1,N&=~P}p!==0&&Jn(o,p,l)}function zm(){return(ln&6)===0?(Wd(0),!1):!0}function P0(){if(zt!==null){if(gn===0)var o=zt.return;else o=zt,es=Zi=null,Qv(o),uc=null,Cd=0,o=zt;for(;o!==null;)CO(o.alternate,o),o=o.return;zt=null}}function wc(o,l){var p=o.timeoutHandle;p!==-1&&(o.timeoutHandle=-1,y9(p)),p=o.cancelPendingCommit,p!==null&&(o.cancelPendingCommit=null,p()),ds=0,P0(),_n=o,zt=p=Jo(o.current,null),Vt=l,gn=0,Ia=null,Xs=!1,bc=vt(o,l),I0=!1,yc=Oa=O0=al=Js=Yn=0,ha=Vd=null,D0=!1,(l&8)!==0&&(l|=l&32);var g=o.entangledLanes;if(g!==0)for(o=o.entanglements,g&=l;0<g;){var N=31-Me(g),k=1<<N;l|=o[N],g&=~k}return us=l,im(),p}function JO(o,l){St=null,F.H=jd,l===cc||l===hm?(l=mI(),gn=3):l===Fv?(l=mI(),gn=4):gn=l===h0?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Ia=l,zt===null&&(Yn=1,Rm(o,Ba(l,o.current)))}function QO(){var o=Ra.current;return o===null?!0:(Vt&4194048)===Vt?Wa===null:(Vt&62914560)===Vt||(Vt&536870912)!==0?o===Wa:!1}function eD(){var o=F.H;return F.H=jd,o===null?jd:o}function tD(){var o=F.A;return F.A=q8,o}function Fm(){Yn=4,Xs||(Vt&4194048)!==Vt&&Ra.current!==null||(bc=!0),(Js&134217727)===0&&(al&134217727)===0||_n===null||ti(_n,Vt,Oa,!1)}function U0(o,l,p){var g=ln;ln|=2;var N=eD(),k=tD();(_n!==o||Vt!==l)&&($m=null,wc(o,l)),l=!1;var P=Yn;e:do try{if(gn!==0&&zt!==null){var Y=zt,oe=Ia;switch(gn){case 8:P0(),P=6;break e;case 3:case 2:case 9:case 6:Ra.current===null&&(l=!0);var ge=gn;if(gn=0,Ia=null,Ec(o,Y,oe,ge),p&&bc){P=0;break e}break;default:ge=gn,gn=0,Ia=null,Ec(o,Y,oe,ge)}}Q8(),P=Yn;break}catch(xe){JO(o,xe)}while(!0);return l&&o.shellSuspendCounter++,es=Zi=null,ln=g,F.H=N,F.A=k,zt===null&&(_n=null,Vt=0,im()),P}function Q8(){for(;zt!==null;)nD(zt)}function e9(o,l){var p=ln;ln|=2;var g=eD(),N=tD();_n!==o||Vt!==l?($m=null,Um=we()+500,wc(o,l)):bc=vt(o,l);e:do try{if(gn!==0&&zt!==null){l=zt;var k=Ia;t:switch(gn){case 1:gn=0,Ia=null,Ec(o,l,k,1);break;case 2:case 9:if(fI(k)){gn=0,Ia=null,rD(l);break}l=function(){gn!==2&&gn!==9||_n!==o||(gn=7),Do(o)},k.then(l,l);break e;case 3:gn=7;break e;case 4:gn=5;break e;case 7:fI(k)?(gn=0,Ia=null,rD(l)):(gn=0,Ia=null,Ec(o,l,k,7));break;case 5:var P=null;switch(zt.tag){case 26:P=zt.memoizedState;case 5:case 27:var Y=zt;if(P?BD(P):Y.stateNode.complete){gn=0,Ia=null;var oe=Y.sibling;if(oe!==null)zt=oe;else{var ge=Y.return;ge!==null?(zt=ge,Bm(ge)):zt=null}break t}}gn=0,Ia=null,Ec(o,l,k,5);break;case 6:gn=0,Ia=null,Ec(o,l,k,6);break;case 8:P0(),Yn=6;break e;default:throw Error(r(462))}}t9();break}catch(xe){JO(o,xe)}while(!0);return es=Zi=null,F.H=g,F.A=N,ln=p,zt!==null?0:(_n=null,Vt=0,im(),Yn)}function t9(){for(;zt!==null&&!Ae();)nD(zt)}function nD(o){var l=NO(o.alternate,o,us);o.memoizedProps=o.pendingProps,l===null?Bm(o):zt=l}function rD(o){var l=o,p=l.alternate;switch(l.tag){case 15:case 0:l=wO(p,l,l.pendingProps,l.type,void 0,Vt);break;case 11:l=wO(p,l,l.pendingProps,l.type.render,l.ref,Vt);break;case 5:Qv(l);default:CO(p,l),l=zt=tI(l,us),l=NO(p,l,us)}o.memoizedProps=o.pendingProps,l===null?Bm(o):zt=l}function Ec(o,l,p,g){es=Zi=null,Qv(l),uc=null,Cd=0;var N=l.return;try{if(H8(o,N,l,p,Vt)){Yn=1,Rm(o,Ba(p,o.current)),zt=null;return}}catch(k){if(N!==null)throw zt=N,k;Yn=1,Rm(o,Ba(p,o.current)),zt=null;return}l.flags&32768?(qt||g===1?o=!0:bc||(Vt&536870912)!==0?o=!1:(Xs=o=!0,(g===2||g===9||g===3||g===6)&&(g=Ra.current,g!==null&&g.tag===13&&(g.flags|=16384))),aD(l,o)):Bm(l)}function Bm(o){var l=o;do{if((l.flags&32768)!==0){aD(l,Xs);return}o=l.return;var p=W8(l.alternate,l,us);if(p!==null){zt=p;return}if(l=l.sibling,l!==null){zt=l;return}zt=l=o}while(l!==null);Yn===0&&(Yn=5)}function aD(o,l){do{var p=K8(o.alternate,o);if(p!==null){p.flags&=32767,zt=p;return}if(p=o.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!l&&(o=o.sibling,o!==null)){zt=o;return}zt=o=p}while(o!==null);Yn=6,zt=null}function oD(o,l,p,g,N,k,P,Y,oe){o.cancelPendingCommit=null;do Hm();while(fr!==0);if((ln&6)!==0)throw Error(r(327));if(l!==null){if(l===o.current)throw Error(r(177));if(k=l.lanes|l.childLanes,k|=Nv,Xn(o,p,k,P,Y,oe),o===_n&&(zt=_n=null,Vt=0),vc=l,ei=o,ds=p,L0=k,M0=N,YO=g,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,o9(Ct,function(){return uD(),null})):(o.callbackNode=null,o.callbackPriority=0),g=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||g){g=F.T,F.T=null,N=K.p,K.p=2,P=ln,ln|=4;try{Y8(o,l,p)}finally{ln=P,K.p=N,F.T=g}}fr=1,sD(),iD(),lD()}}function sD(){if(fr===1){fr=0;var o=ei,l=vc,p=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||p){p=F.T,F.T=null;var g=K.p;K.p=2;var N=ln;ln|=4;try{zO(l,o);var k=q0,P=W1(o.containerInfo),Y=k.focusedElem,oe=k.selectionRange;if(P!==Y&&Y&&Y.ownerDocument&&G1(Y.ownerDocument.documentElement,Y)){if(oe!==null&&Ev(Y)){var ge=oe.start,xe=oe.end;if(xe===void 0&&(xe=ge),"selectionStart"in Y)Y.selectionStart=ge,Y.selectionEnd=Math.min(xe,Y.value.length);else{var ke=Y.ownerDocument||document,ye=ke&&ke.defaultView||window;if(ye.getSelection){var ve=ye.getSelection(),We=Y.textContent.length,ct=Math.min(oe.start,We),Sn=oe.end===void 0?ct:Math.min(oe.end,We);!ve.extend&&ct>Sn&&(P=Sn,Sn=ct,ct=P);var pe=V1(Y,ct),ue=V1(Y,Sn);if(pe&&ue&&(ve.rangeCount!==1||ve.anchorNode!==pe.node||ve.anchorOffset!==pe.offset||ve.focusNode!==ue.node||ve.focusOffset!==ue.offset)){var he=ke.createRange();he.setStart(pe.node,pe.offset),ve.removeAllRanges(),ct>Sn?(ve.addRange(he),ve.extend(ue.node,ue.offset)):(he.setEnd(ue.node,ue.offset),ve.addRange(he))}}}}for(ke=[],ve=Y;ve=ve.parentNode;)ve.nodeType===1&&ke.push({element:ve,left:ve.scrollLeft,top:ve.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Y<ke.length;Y++){var Ne=ke[Y];Ne.element.scrollLeft=Ne.left,Ne.element.scrollTop=Ne.top}}th=!!Z0,q0=Z0=null}finally{ln=N,K.p=g,F.T=p}}o.current=l,fr=2}}function iD(){if(fr===2){fr=0;var o=ei,l=vc,p=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||p){p=F.T,F.T=null;var g=K.p;K.p=2;var N=ln;ln|=4;try{MO(o,l.alternate,l)}finally{ln=N,K.p=g,F.T=p}}fr=3}}function lD(){if(fr===4||fr===3){fr=0,ze();var o=ei,l=vc,p=ds,g=YO;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?fr=5:(fr=0,vc=ei=null,cD(o,o.pendingLanes));var N=o.pendingLanes;if(N===0&&(Qs=null),Qt(p),l=l.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(Ut,l,void 0,(l.current.flags&128)===128)}catch{}if(g!==null){l=F.T,N=K.p,K.p=2,F.T=null;try{for(var k=o.onRecoverableError,P=0;P<g.length;P++){var Y=g[P];k(Y.value,{componentStack:Y.stack})}}finally{F.T=l,K.p=N}}(ds&3)!==0&&Hm(),Do(o),N=o.pendingLanes,(p&261930)!==0&&(N&42)!==0?o===j0?Gd++:(Gd=0,j0=o):Gd=0,Wd(0)}}function cD(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,Nd(l)))}function Hm(){return sD(),iD(),lD(),uD()}function uD(){if(fr!==5)return!1;var o=ei,l=L0;L0=0;var p=Qt(ds),g=F.T,N=K.p;try{K.p=32>p?32:p,F.T=null,p=M0,M0=null;var k=ei,P=ds;if(fr=0,vc=ei=null,ds=0,(ln&6)!==0)throw Error(r(331));var Y=ln;if(ln|=4,GO(k.current),BO(k,k.current,P,p),ln=Y,Wd(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(Ut,k)}catch{}return!0}finally{K.p=N,F.T=g,cD(o,l)}}function dD(o,l,p){l=Ba(p,l),l=m0(o.stateNode,l,2),o=Ks(o,l,2),o!==null&&(dn(o,2),Do(o))}function bn(o,l,p){if(o.tag===3)dD(o,o,p);else for(;l!==null;){if(l.tag===3){dD(l,o,p);break}else if(l.tag===1){var g=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Qs===null||!Qs.has(g))){o=Ba(p,o),p=fO(2),g=Ks(l,p,2),g!==null&&(pO(p,g,l,o),dn(g,2),Do(g));break}}l=l.return}}function $0(o,l,p){var g=o.pingCache;if(g===null){g=o.pingCache=new X8;var N=new Set;g.set(l,N)}else N=g.get(l),N===void 0&&(N=new Set,g.set(l,N));N.has(p)||(I0=!0,N.add(p),o=n9.bind(null,o,l,p),l.then(o,o))}function n9(o,l,p){var g=o.pingCache;g!==null&&g.delete(l),o.pingedLanes|=o.suspendedLanes&p,o.warmLanes&=~p,_n===o&&(Vt&p)===p&&(Yn===4||Yn===3&&(Vt&62914560)===Vt&&300>we()-Pm?(ln&2)===0&&wc(o,0):O0|=p,yc===Vt&&(yc=0)),Do(o)}function fD(o,l){l===0&&(l=Pt()),o=Wi(o,l),o!==null&&(dn(o,l),Do(o))}function r9(o){var l=o.memoizedState,p=0;l!==null&&(p=l.retryLane),fD(o,p)}function a9(o,l){var p=0;switch(o.tag){case 31:case 13:var g=o.stateNode,N=o.memoizedState;N!==null&&(p=N.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(l),fD(o,p)}function o9(o,l){return Ue(o,l)}var Vm=null,xc=null,z0=!1,Gm=!1,F0=!1,ni=0;function Do(o){o!==xc&&o.next===null&&(xc===null?Vm=xc=o:xc=xc.next=o),Gm=!0,z0||(z0=!0,i9())}function Wd(o,l){if(!F0&&Gm){F0=!0;do for(var p=!1,g=Vm;g!==null;){if(o!==0){var N=g.pendingLanes;if(N===0)var k=0;else{var P=g.suspendedLanes,Y=g.pingedLanes;k=(1<<31-Me(42|o)+1)-1,k&=N&~(P&~Y),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(p=!0,gD(g,k))}else k=Vt,k=Ze(g,g===_n?k:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(k&3)===0||vt(g,k)||(p=!0,gD(g,k));g=g.next}while(p);F0=!1}}function s9(){pD()}function pD(){Gm=z0=!1;var o=0;ni!==0&&b9()&&(o=ni);for(var l=we(),p=null,g=Vm;g!==null;){var N=g.next,k=mD(g,l);k===0?(g.next=null,p===null?Vm=N:p.next=N,N===null&&(xc=p)):(p=g,(o!==0||(k&3)!==0)&&(Gm=!0)),g=N}fr!==0&&fr!==5||Wd(o),ni!==0&&(ni=0)}function mD(o,l){for(var p=o.suspendedLanes,g=o.pingedLanes,N=o.expirationTimes,k=o.pendingLanes&-62914561;0<k;){var P=31-Me(k),Y=1<<P,oe=N[P];oe===-1?((Y&p)===0||(Y&g)!==0)&&(N[P]=jt(Y,l)):oe<=l&&(o.expiredLanes|=Y),k&=~Y}if(l=_n,p=Vt,p=Ze(o,o===l?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g=o.callbackNode,p===0||o===l&&(gn===2||gn===9)||o.cancelPendingCommit!==null)return g!==null&&g!==null&&fe(g),o.callbackNode=null,o.callbackPriority=0;if((p&3)===0||vt(o,p)){if(l=p&-p,l===o.callbackPriority)return l;switch(g!==null&&fe(g),Qt(p)){case 2:case 8:p=gt;break;case 32:p=Ct;break;case 268435456:p=$e;break;default:p=Ct}return g=hD.bind(null,o),p=Ue(p,g),o.callbackPriority=l,o.callbackNode=p,l}return g!==null&&g!==null&&fe(g),o.callbackPriority=2,o.callbackNode=null,2}function hD(o,l){if(fr!==0&&fr!==5)return o.callbackNode=null,o.callbackPriority=0,null;var p=o.callbackNode;if(Hm()&&o.callbackNode!==p)return null;var g=Vt;return g=Ze(o,o===_n?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),g===0?null:(qO(o,g,l),mD(o,we()),o.callbackNode!=null&&o.callbackNode===p?hD.bind(null,o):null)}function gD(o,l){if(Hm())return null;qO(o,l,!0)}function i9(){v9(function(){(ln&6)!==0?Ue(lt,s9):pD()})}function B0(){if(ni===0){var o=ic;o===0&&(o=Et,Et<<=1,(Et&261888)===0&&(Et=256)),ni=o}return ni}function bD(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Qp(""+o)}function yD(o,l){var p=l.ownerDocument.createElement("input");return p.name=l.name,p.value=l.value,o.id&&p.setAttribute("form",o.id),l.parentNode.insertBefore(p,l),o=new FormData(o),p.parentNode.removeChild(p),o}function l9(o,l,p,g,N){if(l==="submit"&&p&&p.stateNode===N){var k=bD((N[Hn]||null).action),P=g.submitter;P&&(l=(l=P[Hn]||null)?bD(l.formAction):P.getAttribute("formAction"),l!==null&&(k=l,P=null));var Y=new rm("action","action",null,g,N);o.push({event:Y,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(ni!==0){var oe=P?yD(N,P):new FormData(N);l0(p,{pending:!0,data:oe,method:N.method,action:k},null,oe)}}else typeof k=="function"&&(Y.preventDefault(),oe=P?yD(N,P):new FormData(N),l0(p,{pending:!0,data:oe,method:N.method,action:k},k,oe))},currentTarget:N}]})}}for(var H0=0;H0<Tv.length;H0++){var V0=Tv[H0],c9=V0.toLowerCase(),u9=V0[0].toUpperCase()+V0.slice(1);io(c9,"on"+u9)}io(Z1,"onAnimationEnd"),io(q1,"onAnimationIteration"),io(X1,"onAnimationStart"),io("dblclick","onDoubleClick"),io("focusin","onFocus"),io("focusout","onBlur"),io(N8,"onTransitionRun"),io(k8,"onTransitionStart"),io(C8,"onTransitionCancel"),io(J1,"onTransitionEnd"),hn("onMouseEnter",["mouseout","mouseover"]),hn("onMouseLeave",["mouseout","mouseover"]),hn("onPointerEnter",["pointerout","pointerover"]),hn("onPointerLeave",["pointerout","pointerover"]),An("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),An("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),An("onBeforeInput",["compositionend","keypress","textInput","paste"]),An("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),An("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),An("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kd="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),d9=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Kd));function vD(o,l){l=(l&4)!==0;for(var p=0;p<o.length;p++){var g=o[p],N=g.event;g=g.listeners;e:{var k=void 0;if(l)for(var P=g.length-1;0<=P;P--){var Y=g[P],oe=Y.instance,ge=Y.currentTarget;if(Y=Y.listener,oe!==k&&N.isPropagationStopped())break e;k=Y,N.currentTarget=ge;try{k(N)}catch(xe){sm(xe)}N.currentTarget=null,k=oe}else for(P=0;P<g.length;P++){if(Y=g[P],oe=Y.instance,ge=Y.currentTarget,Y=Y.listener,oe!==k&&N.isPropagationStopped())break e;k=Y,N.currentTarget=ge;try{k(N)}catch(xe){sm(xe)}N.currentTarget=null,k=oe}}}}function Ft(o,l){var p=l[so];p===void 0&&(p=l[so]=new Set);var g=o+"__bubble";p.has(g)||(wD(l,o,2,!1),p.add(g))}function G0(o,l,p){var g=0;l&&(g|=4),wD(p,o,g,l)}var Wm="_reactListening"+Math.random().toString(36).slice(2);function W0(o){if(!o[Wm]){o[Wm]=!0,ca.forEach(function(p){p!=="selectionchange"&&(d9.has(p)||G0(p,!1,o),G0(p,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[Wm]||(l[Wm]=!0,G0("selectionchange",!1,l))}}function wD(o,l,p,g){switch(ZD(l)){case 2:var N=$9;break;case 8:N=z9;break;default:N=iw}p=N.bind(null,l,p,o),N=void 0,!fv||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(N=!0),g?N!==void 0?o.addEventListener(l,p,{capture:!0,passive:N}):o.addEventListener(l,p,!0):N!==void 0?o.addEventListener(l,p,{passive:N}):o.addEventListener(l,p,!1)}function K0(o,l,p,g,N){var k=g;if((l&1)===0&&(l&2)===0&&g!==null)e:for(;;){if(g===null)return;var P=g.tag;if(P===3||P===4){var Y=g.stateNode.containerInfo;if(Y===N)break;if(P===4)for(P=g.return;P!==null;){var oe=P.tag;if((oe===3||oe===4)&&P.stateNode.containerInfo===N)return;P=P.return}for(;Y!==null;){if(P=Zt(Y),P===null)return;if(oe=P.tag,oe===5||oe===6||oe===26||oe===27){g=k=P;continue e}Y=Y.parentNode}}g=g.return}T1(function(){var ge=k,xe=uv(p),ke=[];e:{var ye=Q1.get(o);if(ye!==void 0){var ve=rm,We=o;switch(o){case"keypress":if(tm(p)===0)break e;case"keydown":case"keyup":ve=a8;break;case"focusin":We="focus",ve=gv;break;case"focusout":We="blur",ve=gv;break;case"beforeblur":case"afterblur":ve=gv;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ve=C1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ve=W6;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ve=i8;break;case Z1:case q1:case X1:ve=Z6;break;case J1:ve=c8;break;case"scroll":case"scrollend":ve=V6;break;case"wheel":ve=d8;break;case"copy":case"cut":case"paste":ve=X6;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ve=A1;break;case"toggle":case"beforetoggle":ve=p8}var ct=(l&4)!==0,Sn=!ct&&(o==="scroll"||o==="scrollend"),pe=ct?ye!==null?ye+"Capture":null:ye;ct=[];for(var ue=ge,he;ue!==null;){var Ne=ue;if(he=Ne.stateNode,Ne=Ne.tag,Ne!==5&&Ne!==26&&Ne!==27||he===null||pe===null||(Ne=hd(ue,pe),Ne!=null&&ct.push(Yd(ue,Ne,he))),Sn)break;ue=ue.return}0<ct.length&&(ye=new ve(ye,We,null,p,xe),ke.push({event:ye,listeners:ct}))}}if((l&7)===0){e:{if(ye=o==="mouseover"||o==="pointerover",ve=o==="mouseout"||o==="pointerout",ye&&p!==cv&&(We=p.relatedTarget||p.fromElement)&&(Zt(We)||We[Qr]))break e;if((ve||ye)&&(ye=xe.window===xe?xe:(ye=xe.ownerDocument)?ye.defaultView||ye.parentWindow:window,ve?(We=p.relatedTarget||p.toElement,ve=ge,We=We?Zt(We):null,We!==null&&(Sn=s(We),ct=We.tag,We!==Sn||ct!==5&&ct!==27&&ct!==6)&&(We=null)):(ve=null,We=ge),ve!==We)){if(ct=C1,Ne="onMouseLeave",pe="onMouseEnter",ue="mouse",(o==="pointerout"||o==="pointerover")&&(ct=A1,Ne="onPointerLeave",pe="onPointerEnter",ue="pointer"),Sn=ve==null?ye:nn(ve),he=We==null?ye:nn(We),ye=new ct(Ne,ue+"leave",ve,p,xe),ye.target=Sn,ye.relatedTarget=he,Ne=null,Zt(xe)===ge&&(ct=new ct(pe,ue+"enter",We,p,xe),ct.target=he,ct.relatedTarget=Sn,Ne=ct),Sn=Ne,ve&&We)t:{for(ct=f9,pe=ve,ue=We,he=0,Ne=pe;Ne;Ne=ct(Ne))he++;Ne=0;for(var rt=ue;rt;rt=ct(rt))Ne++;for(;0<he-Ne;)pe=ct(pe),he--;for(;0<Ne-he;)ue=ct(ue),Ne--;for(;he--;){if(pe===ue||ue!==null&&pe===ue.alternate){ct=pe;break t}pe=ct(pe),ue=ct(ue)}ct=null}else ct=null;ve!==null&&ED(ke,ye,ve,ct,!1),We!==null&&Sn!==null&&ED(ke,Sn,We,ct,!0)}}e:{if(ye=ge?nn(ge):window,ve=ye.nodeName&&ye.nodeName.toLowerCase(),ve==="select"||ve==="input"&&ye.type==="file")var rn=U1;else if(j1(ye))if($1)rn=S8;else{rn=E8;var Je=w8}else ve=ye.nodeName,!ve||ve.toLowerCase()!=="input"||ye.type!=="checkbox"&&ye.type!=="radio"?ge&&lv(ge.elementType)&&(rn=U1):rn=x8;if(rn&&(rn=rn(o,ge))){P1(ke,rn,p,xe);break e}Je&&Je(o,ye,ge),o==="focusout"&&ge&&ye.type==="number"&&ge.memoizedProps.value!=null&&iv(ye,"number",ye.value)}switch(Je=ge?nn(ge):window,o){case"focusin":(j1(Je)||Je.contentEditable==="true")&&(Ql=Je,xv=ge,Sd=null);break;case"focusout":Sd=xv=Ql=null;break;case"mousedown":Sv=!0;break;case"contextmenu":case"mouseup":case"dragend":Sv=!1,K1(ke,p,xe);break;case"selectionchange":if(T8)break;case"keydown":case"keyup":K1(ke,p,xe)}var Tt;if(yv)e:{switch(o){case"compositionstart":var Gt="onCompositionStart";break e;case"compositionend":Gt="onCompositionEnd";break e;case"compositionupdate":Gt="onCompositionUpdate";break e}Gt=void 0}else Jl?L1(o,p)&&(Gt="onCompositionEnd"):o==="keydown"&&p.keyCode===229&&(Gt="onCompositionStart");Gt&&(I1&&p.locale!=="ko"&&(Jl||Gt!=="onCompositionStart"?Gt==="onCompositionEnd"&&Jl&&(Tt=N1()):(zs=xe,pv="value"in zs?zs.value:zs.textContent,Jl=!0)),Je=Km(ge,Gt),0<Je.length&&(Gt=new R1(Gt,o,null,p,xe),ke.push({event:Gt,listeners:Je}),Tt?Gt.data=Tt:(Tt=M1(p),Tt!==null&&(Gt.data=Tt)))),(Tt=h8?g8(o,p):b8(o,p))&&(Gt=Km(ge,"onBeforeInput"),0<Gt.length&&(Je=new R1("onBeforeInput","beforeinput",null,p,xe),ke.push({event:Je,listeners:Gt}),Je.data=Tt)),l9(ke,o,ge,p,xe)}vD(ke,l)})}function Yd(o,l,p){return{instance:o,listener:l,currentTarget:p}}function Km(o,l){for(var p=l+"Capture",g=[];o!==null;){var N=o,k=N.stateNode;if(N=N.tag,N!==5&&N!==26&&N!==27||k===null||(N=hd(o,p),N!=null&&g.unshift(Yd(o,N,k)),N=hd(o,l),N!=null&&g.push(Yd(o,N,k))),o.tag===3)return g;o=o.return}return[]}function f9(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function ED(o,l,p,g,N){for(var k=l._reactName,P=[];p!==null&&p!==g;){var Y=p,oe=Y.alternate,ge=Y.stateNode;if(Y=Y.tag,oe!==null&&oe===g)break;Y!==5&&Y!==26&&Y!==27||ge===null||(oe=ge,N?(ge=hd(p,k),ge!=null&&P.unshift(Yd(p,ge,oe))):N||(ge=hd(p,k),ge!=null&&P.push(Yd(p,ge,oe)))),p=p.return}P.length!==0&&o.push({event:l,listeners:P})}var p9=/\r\n?/g,m9=/\u0000|\uFFFD/g;function xD(o){return(typeof o=="string"?o:""+o).replace(p9,`
58
+ `).replace(m9,"")}function SD(o,l){return l=xD(l),xD(o)===l}function xn(o,l,p,g,N,k){switch(p){case"children":typeof g=="string"?l==="body"||l==="textarea"&&g===""||Zo(o,g):(typeof g=="number"||typeof g=="bigint")&&l!=="body"&&Zo(o,""+g);break;case"className":ua(o,"class",g);break;case"tabIndex":ua(o,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":ua(o,p,g);break;case"style":S1(o,g,k);break;case"data":if(l!=="object"){ua(o,"data",g);break}case"src":case"href":if(g===""&&(l!=="a"||p!=="href")){o.removeAttribute(p);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(p);break}g=Qp(""+g),o.setAttribute(p,g);break;case"action":case"formAction":if(typeof g=="function"){o.setAttribute(p,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(p==="formAction"?(l!=="input"&&xn(o,l,"name",N.name,N,null),xn(o,l,"formEncType",N.formEncType,N,null),xn(o,l,"formMethod",N.formMethod,N,null),xn(o,l,"formTarget",N.formTarget,N,null)):(xn(o,l,"encType",N.encType,N,null),xn(o,l,"method",N.method,N,null),xn(o,l,"target",N.target,N,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){o.removeAttribute(p);break}g=Qp(""+g),o.setAttribute(p,g);break;case"onClick":g!=null&&(o.onclick=qo);break;case"onScroll":g!=null&&Ft("scroll",o);break;case"onScrollEnd":g!=null&&Ft("scrollend",o);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(p=g.__html,p!=null){if(N.children!=null)throw Error(r(60));o.innerHTML=p}}break;case"multiple":o.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":o.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){o.removeAttribute("xlink:href");break}p=Qp(""+g),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(p,""+g):o.removeAttribute(p);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(p,""):o.removeAttribute(p);break;case"capture":case"download":g===!0?o.setAttribute(p,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?o.setAttribute(p,g):o.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?o.setAttribute(p,g):o.removeAttribute(p);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?o.removeAttribute(p):o.setAttribute(p,g);break;case"popover":Ft("beforetoggle",o),Ft("toggle",o),$t(o,"popover",g);break;case"xlinkActuate":Er(o,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Er(o,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Er(o,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Er(o,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Er(o,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Er(o,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Er(o,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Er(o,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Er(o,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":$t(o,"is",g);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=B6.get(p)||p,$t(o,p,g))}}function Y0(o,l,p,g,N,k){switch(p){case"style":S1(o,g,k);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(p=g.__html,p!=null){if(N.children!=null)throw Error(r(60));o.innerHTML=p}}break;case"children":typeof g=="string"?Zo(o,g):(typeof g=="number"||typeof g=="bigint")&&Zo(o,""+g);break;case"onScroll":g!=null&&Ft("scroll",o);break;case"onScrollEnd":g!=null&&Ft("scrollend",o);break;case"onClick":g!=null&&(o.onclick=qo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ht.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(N=p.endsWith("Capture"),l=p.slice(2,N?p.length-7:void 0),k=o[Hn]||null,k=k!=null?k[p]:null,typeof k=="function"&&o.removeEventListener(l,k,N),typeof g=="function")){typeof k!="function"&&k!==null&&(p in o?o[p]=null:o.hasAttribute(p)&&o.removeAttribute(p)),o.addEventListener(l,g,N);break e}p in o?o[p]=g:g===!0?o.setAttribute(p,""):$t(o,p,g)}}}function Or(o,l,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ft("error",o),Ft("load",o);var g=!1,N=!1,k;for(k in p)if(p.hasOwnProperty(k)){var P=p[k];if(P!=null)switch(k){case"src":g=!0;break;case"srcSet":N=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:xn(o,l,k,P,p,null)}}N&&xn(o,l,"srcSet",p.srcSet,p,null),g&&xn(o,l,"src",p.src,p,null);return;case"input":Ft("invalid",o);var Y=k=P=N=null,oe=null,ge=null;for(g in p)if(p.hasOwnProperty(g)){var xe=p[g];if(xe!=null)switch(g){case"name":N=xe;break;case"type":P=xe;break;case"checked":oe=xe;break;case"defaultChecked":ge=xe;break;case"value":k=xe;break;case"defaultValue":Y=xe;break;case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(r(137,l));break;default:xn(o,l,g,xe,p,null)}}md(o,k,Y,oe,ge,P,N,!1);return;case"select":Ft("invalid",o),g=P=k=null;for(N in p)if(p.hasOwnProperty(N)&&(Y=p[N],Y!=null))switch(N){case"value":k=Y;break;case"defaultValue":P=Y;break;case"multiple":g=Y;default:xn(o,l,N,Y,p,null)}l=k,p=P,o.multiple=!!g,l!=null?$s(o,!!g,l,!1):p!=null&&$s(o,!!g,p,!0);return;case"textarea":Ft("invalid",o),k=N=g=null;for(P in p)if(p.hasOwnProperty(P)&&(Y=p[P],Y!=null))switch(P){case"value":g=Y;break;case"defaultValue":N=Y;break;case"children":k=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(91));break;default:xn(o,l,P,Y,p,null)}E1(o,g,N,k);return;case"option":for(oe in p)if(p.hasOwnProperty(oe)&&(g=p[oe],g!=null))switch(oe){case"selected":o.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:xn(o,l,oe,g,p,null)}return;case"dialog":Ft("beforetoggle",o),Ft("toggle",o),Ft("cancel",o),Ft("close",o);break;case"iframe":case"object":Ft("load",o);break;case"video":case"audio":for(g=0;g<Kd.length;g++)Ft(Kd[g],o);break;case"image":Ft("error",o),Ft("load",o);break;case"details":Ft("toggle",o);break;case"embed":case"source":case"link":Ft("error",o),Ft("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ge in p)if(p.hasOwnProperty(ge)&&(g=p[ge],g!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:xn(o,l,ge,g,p,null)}return;default:if(lv(l)){for(xe in p)p.hasOwnProperty(xe)&&(g=p[xe],g!==void 0&&Y0(o,l,xe,g,p,void 0));return}}for(Y in p)p.hasOwnProperty(Y)&&(g=p[Y],g!=null&&xn(o,l,Y,g,p,null))}function h9(o,l,p,g){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var N=null,k=null,P=null,Y=null,oe=null,ge=null,xe=null;for(ve in p){var ke=p[ve];if(p.hasOwnProperty(ve)&&ke!=null)switch(ve){case"checked":break;case"value":break;case"defaultValue":oe=ke;default:g.hasOwnProperty(ve)||xn(o,l,ve,null,g,ke)}}for(var ye in g){var ve=g[ye];if(ke=p[ye],g.hasOwnProperty(ye)&&(ve!=null||ke!=null))switch(ye){case"type":k=ve;break;case"name":N=ve;break;case"checked":ge=ve;break;case"defaultChecked":xe=ve;break;case"value":P=ve;break;case"defaultValue":Y=ve;break;case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,l));break;default:ve!==ke&&xn(o,l,ye,ve,g,ke)}}sv(o,P,Y,oe,ge,xe,k,N);return;case"select":ve=P=Y=ye=null;for(k in p)if(oe=p[k],p.hasOwnProperty(k)&&oe!=null)switch(k){case"value":break;case"multiple":ve=oe;default:g.hasOwnProperty(k)||xn(o,l,k,null,g,oe)}for(N in g)if(k=g[N],oe=p[N],g.hasOwnProperty(N)&&(k!=null||oe!=null))switch(N){case"value":ye=k;break;case"defaultValue":Y=k;break;case"multiple":P=k;default:k!==oe&&xn(o,l,N,k,g,oe)}l=Y,p=P,g=ve,ye!=null?$s(o,!!p,ye,!1):!!g!=!!p&&(l!=null?$s(o,!!p,l,!0):$s(o,!!p,p?[]:"",!1));return;case"textarea":ve=ye=null;for(Y in p)if(N=p[Y],p.hasOwnProperty(Y)&&N!=null&&!g.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:xn(o,l,Y,null,g,N)}for(P in g)if(N=g[P],k=p[P],g.hasOwnProperty(P)&&(N!=null||k!=null))switch(P){case"value":ye=N;break;case"defaultValue":ve=N;break;case"children":break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:N!==k&&xn(o,l,P,N,g,k)}w1(o,ye,ve);return;case"option":for(var We in p)if(ye=p[We],p.hasOwnProperty(We)&&ye!=null&&!g.hasOwnProperty(We))switch(We){case"selected":o.selected=!1;break;default:xn(o,l,We,null,g,ye)}for(oe in g)if(ye=g[oe],ve=p[oe],g.hasOwnProperty(oe)&&ye!==ve&&(ye!=null||ve!=null))switch(oe){case"selected":o.selected=ye&&typeof ye!="function"&&typeof ye!="symbol";break;default:xn(o,l,oe,ye,g,ve)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ct in p)ye=p[ct],p.hasOwnProperty(ct)&&ye!=null&&!g.hasOwnProperty(ct)&&xn(o,l,ct,null,g,ye);for(ge in g)if(ye=g[ge],ve=p[ge],g.hasOwnProperty(ge)&&ye!==ve&&(ye!=null||ve!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(r(137,l));break;default:xn(o,l,ge,ye,g,ve)}return;default:if(lv(l)){for(var Sn in p)ye=p[Sn],p.hasOwnProperty(Sn)&&ye!==void 0&&!g.hasOwnProperty(Sn)&&Y0(o,l,Sn,void 0,g,ye);for(xe in g)ye=g[xe],ve=p[xe],!g.hasOwnProperty(xe)||ye===ve||ye===void 0&&ve===void 0||Y0(o,l,xe,ye,g,ve);return}}for(var pe in p)ye=p[pe],p.hasOwnProperty(pe)&&ye!=null&&!g.hasOwnProperty(pe)&&xn(o,l,pe,null,g,ye);for(ke in g)ye=g[ke],ve=p[ke],!g.hasOwnProperty(ke)||ye===ve||ye==null&&ve==null||xn(o,l,ke,ye,g,ve)}function _D(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function g9(){if(typeof performance.getEntriesByType=="function"){for(var o=0,l=0,p=performance.getEntriesByType("resource"),g=0;g<p.length;g++){var N=p[g],k=N.transferSize,P=N.initiatorType,Y=N.duration;if(k&&Y&&_D(P)){for(P=0,Y=N.responseEnd,g+=1;g<p.length;g++){var oe=p[g],ge=oe.startTime;if(ge>Y)break;var xe=oe.transferSize,ke=oe.initiatorType;xe&&_D(ke)&&(oe=oe.responseEnd,P+=xe*(oe<Y?1:(Y-ge)/(oe-ge)))}if(--g,l+=8*(k+P)/(N.duration/1e3),o++,10<o)break}}if(0<o)return l/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Z0=null,q0=null;function Ym(o){return o.nodeType===9?o:o.ownerDocument}function TD(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ND(o,l){if(o===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&l==="foreignObject"?0:o}function X0(o,l){return o==="textarea"||o==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var J0=null;function b9(){var o=window.event;return o&&o.type==="popstate"?o===J0?!1:(J0=o,!0):(J0=null,!1)}var kD=typeof setTimeout=="function"?setTimeout:void 0,y9=typeof clearTimeout=="function"?clearTimeout:void 0,CD=typeof Promise=="function"?Promise:void 0,v9=typeof queueMicrotask=="function"?queueMicrotask:typeof CD<"u"?function(o){return CD.resolve(null).then(o).catch(w9)}:kD;function w9(o){setTimeout(function(){throw o})}function ri(o){return o==="head"}function RD(o,l){var p=l,g=0;do{var N=p.nextSibling;if(o.removeChild(p),N&&N.nodeType===8)if(p=N.data,p==="/$"||p==="/&"){if(g===0){o.removeChild(N),Nc(l);return}g--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")g++;else if(p==="html")Zd(o.ownerDocument.documentElement);else if(p==="head"){p=o.ownerDocument.head,Zd(p);for(var k=p.firstChild;k;){var P=k.nextSibling,Y=k.nodeName;k[pn]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&k.rel.toLowerCase()==="stylesheet"||p.removeChild(k),k=P}}else p==="body"&&Zd(o.ownerDocument.body);p=N}while(p);Nc(l)}function AD(o,l){var p=o;o=0;do{var g=p.nextSibling;if(p.nodeType===1?l?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(l?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),g&&g.nodeType===8)if(p=g.data,p==="/$"){if(o===0)break;o--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||o++;p=g}while(p)}function Q0(o){var l=o.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var p=l;switch(l=l.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":Q0(p),sn(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}o.removeChild(p)}}function E9(o,l,p,g){for(;o.nodeType===1;){var N=p;if(o.nodeName.toLowerCase()!==l.toLowerCase()){if(!g&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(g){if(!o[pn])switch(l){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(k=o.getAttribute("rel"),k==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(k!==N.rel||o.getAttribute("href")!==(N.href==null||N.href===""?null:N.href)||o.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin)||o.getAttribute("title")!==(N.title==null?null:N.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(k=o.getAttribute("src"),(k!==(N.src==null?null:N.src)||o.getAttribute("type")!==(N.type==null?null:N.type)||o.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin))&&k&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(l==="input"&&o.type==="hidden"){var k=N.name==null?null:""+N.name;if(N.type==="hidden"&&o.getAttribute("name")===k)return o}else return o;if(o=Ka(o.nextSibling),o===null)break}return null}function x9(o,l,p){if(l==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!p||(o=Ka(o.nextSibling),o===null))return null;return o}function ID(o,l){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=Ka(o.nextSibling),o===null))return null;return o}function ew(o){return o.data==="$?"||o.data==="$~"}function tw(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function S9(o,l){var p=o.ownerDocument;if(o.data==="$~")o._reactRetry=l;else if(o.data!=="$?"||p.readyState!=="loading")l();else{var g=function(){l(),p.removeEventListener("DOMContentLoaded",g)};p.addEventListener("DOMContentLoaded",g),o._reactRetry=g}}function Ka(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return o}var nw=null;function OD(o){o=o.nextSibling;for(var l=0;o;){if(o.nodeType===8){var p=o.data;if(p==="/$"||p==="/&"){if(l===0)return Ka(o.nextSibling);l--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||l++}o=o.nextSibling}return null}function DD(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var p=o.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(l===0)return o;l--}else p!=="/$"&&p!=="/&"||l++}o=o.previousSibling}return null}function LD(o,l,p){switch(l=Ym(p),o){case"html":if(o=l.documentElement,!o)throw Error(r(452));return o;case"head":if(o=l.head,!o)throw Error(r(453));return o;case"body":if(o=l.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Zd(o){for(var l=o.attributes;l.length;)o.removeAttributeNode(l[0]);sn(o)}var Ya=new Map,MD=new Set;function Zm(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var fs=K.d;K.d={f:_9,r:T9,D:N9,C:k9,L:C9,m:R9,X:I9,S:A9,M:O9};function _9(){var o=fs.f(),l=zm();return o||l}function T9(o){var l=mt(o);l!==null&&l.tag===5&&l.type==="form"?JI(l):fs.r(o)}var Sc=typeof document>"u"?null:document;function jD(o,l,p){var g=Sc;if(g&&typeof l=="string"&&l){var N=ea(l);N='link[rel="'+o+'"][href="'+N+'"]',typeof p=="string"&&(N+='[crossorigin="'+p+'"]'),MD.has(N)||(MD.add(N),o={rel:o,crossOrigin:p,href:l},g.querySelector(N)===null&&(l=g.createElement("link"),Or(l,"link",o),st(l),g.head.appendChild(l)))}}function N9(o){fs.D(o),jD("dns-prefetch",o,null)}function k9(o,l){fs.C(o,l),jD("preconnect",o,l)}function C9(o,l,p){fs.L(o,l,p);var g=Sc;if(g&&o&&l){var N='link[rel="preload"][as="'+ea(l)+'"]';l==="image"&&p&&p.imageSrcSet?(N+='[imagesrcset="'+ea(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(N+='[imagesizes="'+ea(p.imageSizes)+'"]')):N+='[href="'+ea(o)+'"]';var k=N;switch(l){case"style":k=_c(o);break;case"script":k=Tc(o)}Ya.has(k)||(o=h({rel:"preload",href:l==="image"&&p&&p.imageSrcSet?void 0:o,as:l},p),Ya.set(k,o),g.querySelector(N)!==null||l==="style"&&g.querySelector(qd(k))||l==="script"&&g.querySelector(Xd(k))||(l=g.createElement("link"),Or(l,"link",o),st(l),g.head.appendChild(l)))}}function R9(o,l){fs.m(o,l);var p=Sc;if(p&&o){var g=l&&typeof l.as=="string"?l.as:"script",N='link[rel="modulepreload"][as="'+ea(g)+'"][href="'+ea(o)+'"]',k=N;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Tc(o)}if(!Ya.has(k)&&(o=h({rel:"modulepreload",href:o},l),Ya.set(k,o),p.querySelector(N)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(Xd(k)))return}g=p.createElement("link"),Or(g,"link",o),st(g),p.head.appendChild(g)}}}function A9(o,l,p){fs.S(o,l,p);var g=Sc;if(g&&o){var N=dr(g).hoistableStyles,k=_c(o);l=l||"default";var P=N.get(k);if(!P){var Y={loading:0,preload:null};if(P=g.querySelector(qd(k)))Y.loading=5;else{o=h({rel:"stylesheet",href:o,"data-precedence":l},p),(p=Ya.get(k))&&rw(o,p);var oe=P=g.createElement("link");st(oe),Or(oe,"link",o),oe._p=new Promise(function(ge,xe){oe.onload=ge,oe.onerror=xe}),oe.addEventListener("load",function(){Y.loading|=1}),oe.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,qm(P,l,g)}P={type:"stylesheet",instance:P,count:1,state:Y},N.set(k,P)}}}function I9(o,l){fs.X(o,l);var p=Sc;if(p&&o){var g=dr(p).hoistableScripts,N=Tc(o),k=g.get(N);k||(k=p.querySelector(Xd(N)),k||(o=h({src:o,async:!0},l),(l=Ya.get(N))&&aw(o,l),k=p.createElement("script"),st(k),Or(k,"link",o),p.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},g.set(N,k))}}function O9(o,l){fs.M(o,l);var p=Sc;if(p&&o){var g=dr(p).hoistableScripts,N=Tc(o),k=g.get(N);k||(k=p.querySelector(Xd(N)),k||(o=h({src:o,async:!0,type:"module"},l),(l=Ya.get(N))&&aw(o,l),k=p.createElement("script"),st(k),Or(k,"link",o),p.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},g.set(N,k))}}function PD(o,l,p,g){var N=(N=z.current)?Zm(N):null;if(!N)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(l=_c(p.href),p=dr(N).hoistableStyles,g=p.get(l),g||(g={type:"style",instance:null,count:0,state:null},p.set(l,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){o=_c(p.href);var k=dr(N).hoistableStyles,P=k.get(o);if(P||(N=N.ownerDocument||N,P={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(o,P),(k=N.querySelector(qd(o)))&&!k._p&&(P.instance=k,P.state.loading=5),Ya.has(o)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Ya.set(o,p),k||D9(N,o,p,P.state))),l&&g===null)throw Error(r(528,""));return P}if(l&&g!==null)throw Error(r(529,""));return null;case"script":return l=p.async,p=p.src,typeof p=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Tc(p),p=dr(N).hoistableScripts,g=p.get(l),g||(g={type:"script",instance:null,count:0,state:null},p.set(l,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function _c(o){return'href="'+ea(o)+'"'}function qd(o){return'link[rel="stylesheet"]['+o+"]"}function UD(o){return h({},o,{"data-precedence":o.precedence,precedence:null})}function D9(o,l,p,g){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?g.loading=1:(l=o.createElement("link"),g.preload=l,l.addEventListener("load",function(){return g.loading|=1}),l.addEventListener("error",function(){return g.loading|=2}),Or(l,"link",p),st(l),o.head.appendChild(l))}function Tc(o){return'[src="'+ea(o)+'"]'}function Xd(o){return"script[async]"+o}function $D(o,l,p){if(l.count++,l.instance===null)switch(l.type){case"style":var g=o.querySelector('style[data-href~="'+ea(p.href)+'"]');if(g)return l.instance=g,st(g),g;var N=h({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),st(g),Or(g,"style",N),qm(g,p.precedence,o),l.instance=g;case"stylesheet":N=_c(p.href);var k=o.querySelector(qd(N));if(k)return l.state.loading|=4,l.instance=k,st(k),k;g=UD(p),(N=Ya.get(N))&&rw(g,N),k=(o.ownerDocument||o).createElement("link"),st(k);var P=k;return P._p=new Promise(function(Y,oe){P.onload=Y,P.onerror=oe}),Or(k,"link",g),l.state.loading|=4,qm(k,p.precedence,o),l.instance=k;case"script":return k=Tc(p.src),(N=o.querySelector(Xd(k)))?(l.instance=N,st(N),N):(g=p,(N=Ya.get(k))&&(g=h({},p),aw(g,N)),o=o.ownerDocument||o,N=o.createElement("script"),st(N),Or(N,"link",g),o.head.appendChild(N),l.instance=N);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(g=l.instance,l.state.loading|=4,qm(g,p.precedence,o));return l.instance}function qm(o,l,p){for(var g=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),N=g.length?g[g.length-1]:null,k=N,P=0;P<g.length;P++){var Y=g[P];if(Y.dataset.precedence===l)k=Y;else if(k!==N)break}k?k.parentNode.insertBefore(o,k.nextSibling):(l=p.nodeType===9?p.head:p,l.insertBefore(o,l.firstChild))}function rw(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.title==null&&(o.title=l.title)}function aw(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.integrity==null&&(o.integrity=l.integrity)}var Xm=null;function zD(o,l,p){if(Xm===null){var g=new Map,N=Xm=new Map;N.set(p,g)}else N=Xm,g=N.get(p),g||(g=new Map,N.set(p,g));if(g.has(o))return g;for(g.set(o,null),p=p.getElementsByTagName(o),N=0;N<p.length;N++){var k=p[N];if(!(k[pn]||k[ht]||o==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var P=k.getAttribute(l)||"";P=o+P;var Y=g.get(P);Y?Y.push(k):g.set(P,[k])}}return g}function FD(o,l,p){o=o.ownerDocument||o,o.head.insertBefore(p,l==="title"?o.querySelector("head > title"):null)}function L9(o,l,p){if(p===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return o=l.disabled,typeof l.precedence=="string"&&o==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function BD(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function M9(o,l,p,g){if(p.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var N=_c(g.href),k=l.querySelector(qd(N));if(k){l=k._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=Jm.bind(o),l.then(o,o)),p.state.loading|=4,p.instance=k,st(k);return}k=l.ownerDocument||l,g=UD(g),(N=Ya.get(N))&&rw(g,N),k=k.createElement("link"),st(k);var P=k;P._p=new Promise(function(Y,oe){P.onload=Y,P.onerror=oe}),Or(k,"link",g),p.instance=k}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(p,l),(l=p.state.preload)&&(p.state.loading&3)===0&&(o.count++,p=Jm.bind(o),l.addEventListener("load",p),l.addEventListener("error",p))}}var ow=0;function j9(o,l){return o.stylesheets&&o.count===0&&eh(o,o.stylesheets),0<o.count||0<o.imgCount?function(p){var g=setTimeout(function(){if(o.stylesheets&&eh(o,o.stylesheets),o.unsuspend){var k=o.unsuspend;o.unsuspend=null,k()}},6e4+l);0<o.imgBytes&&ow===0&&(ow=62500*g9());var N=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&eh(o,o.stylesheets),o.unsuspend)){var k=o.unsuspend;o.unsuspend=null,k()}},(o.imgBytes>ow?50:800)+l);return o.unsuspend=p,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(N)}}:null}function Jm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)eh(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Qm=null;function eh(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Qm=new Map,l.forEach(P9,o),Qm=null,Jm.call(o))}function P9(o,l){if(!(l.state.loading&4)){var p=Qm.get(o);if(p)var g=p.get(null);else{p=new Map,Qm.set(o,p);for(var N=o.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<N.length;k++){var P=N[k];(P.nodeName==="LINK"||P.getAttribute("media")!=="not all")&&(p.set(P.dataset.precedence,P),g=P)}g&&p.set(null,g)}N=l.instance,P=N.getAttribute("data-precedence"),k=p.get(P)||g,k===g&&p.set(null,N),p.set(P,N),this.count++,g=Jm.bind(this),N.addEventListener("load",g),N.addEventListener("error",g),k?k.parentNode.insertBefore(N,k.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(N,o.firstChild)),l.state.loading|=4}}var Jd={$$typeof:T,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function U9(o,l,p,g,N,k,P,Y,oe){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=yr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yr(0),this.hiddenUpdates=yr(null),this.identifierPrefix=g,this.onUncaughtError=N,this.onCaughtError=k,this.onRecoverableError=P,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=oe,this.incompleteTransitions=new Map}function HD(o,l,p,g,N,k,P,Y,oe,ge,xe,ke){return o=new U9(o,l,p,P,oe,ge,xe,ke,Y),l=1,k===!0&&(l|=24),k=Ca(3,null,null,l),o.current=k,k.stateNode=o,l=Uv(),l.refCount++,o.pooledCache=l,l.refCount++,k.memoizedState={element:g,isDehydrated:p,cache:l},Bv(k),o}function VD(o){return o?(o=nc,o):nc}function GD(o,l,p,g,N,k){N=VD(N),g.context===null?g.context=N:g.pendingContext=N,g=Ws(l),g.payload={element:p},k=k===void 0?null:k,k!==null&&(g.callback=k),p=Ks(o,g,l),p!==null&&(ga(p,o,l),Ad(p,o,l))}function WD(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var p=o.retryLane;o.retryLane=p!==0&&p<l?p:l}}function sw(o,l){WD(o,l),(o=o.alternate)&&WD(o,l)}function KD(o){if(o.tag===13||o.tag===31){var l=Wi(o,67108864);l!==null&&ga(l,o,67108864),sw(o,67108864)}}function YD(o){if(o.tag===13||o.tag===31){var l=Da();l=la(l);var p=Wi(o,l);p!==null&&ga(p,o,l),sw(o,l)}}var th=!0;function $9(o,l,p,g){var N=F.T;F.T=null;var k=K.p;try{K.p=2,iw(o,l,p,g)}finally{K.p=k,F.T=N}}function z9(o,l,p,g){var N=F.T;F.T=null;var k=K.p;try{K.p=8,iw(o,l,p,g)}finally{K.p=k,F.T=N}}function iw(o,l,p,g){if(th){var N=lw(g);if(N===null)K0(o,l,g,nh,p),qD(o,g);else if(B9(N,o,l,p,g))g.stopPropagation();else if(qD(o,g),l&4&&-1<F9.indexOf(o)){for(;N!==null;){var k=mt(N);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var P=mn(k.pendingLanes);if(P!==0){var Y=k;for(Y.pendingLanes|=2,Y.entangledLanes|=2;P;){var oe=1<<31-Me(P);Y.entanglements[1]|=oe,P&=~oe}Do(k),(ln&6)===0&&(Um=we()+500,Wd(0))}}break;case 31:case 13:Y=Wi(k,2),Y!==null&&ga(Y,k,2),zm(),sw(k,2)}if(k=lw(g),k===null&&K0(o,l,g,nh,p),k===N)break;N=k}N!==null&&g.stopPropagation()}else K0(o,l,g,null,p)}}function lw(o){return o=uv(o),cw(o)}var nh=null;function cw(o){if(nh=null,o=Zt(o),o!==null){var l=s(o);if(l===null)o=null;else{var p=l.tag;if(p===13){if(o=i(l),o!==null)return o;o=null}else if(p===31){if(o=c(l),o!==null)return o;o=null}else if(p===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null)}}return nh=o,null}function ZD(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(at()){case lt:return 2;case gt:return 8;case Ct:case Le:return 32;case $e:return 268435456;default:return 32}default:return 32}}var uw=!1,ai=null,oi=null,si=null,Qd=new Map,ef=new Map,ii=[],F9="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function qD(o,l){switch(o){case"focusin":case"focusout":ai=null;break;case"dragenter":case"dragleave":oi=null;break;case"mouseover":case"mouseout":si=null;break;case"pointerover":case"pointerout":Qd.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":ef.delete(l.pointerId)}}function tf(o,l,p,g,N,k){return o===null||o.nativeEvent!==k?(o={blockedOn:l,domEventName:p,eventSystemFlags:g,nativeEvent:k,targetContainers:[N]},l!==null&&(l=mt(l),l!==null&&KD(l)),o):(o.eventSystemFlags|=g,l=o.targetContainers,N!==null&&l.indexOf(N)===-1&&l.push(N),o)}function B9(o,l,p,g,N){switch(l){case"focusin":return ai=tf(ai,o,l,p,g,N),!0;case"dragenter":return oi=tf(oi,o,l,p,g,N),!0;case"mouseover":return si=tf(si,o,l,p,g,N),!0;case"pointerover":var k=N.pointerId;return Qd.set(k,tf(Qd.get(k)||null,o,l,p,g,N)),!0;case"gotpointercapture":return k=N.pointerId,ef.set(k,tf(ef.get(k)||null,o,l,p,g,N)),!0}return!1}function XD(o){var l=Zt(o.target);if(l!==null){var p=s(l);if(p!==null){if(l=p.tag,l===13){if(l=i(p),l!==null){o.blockedOn=l,Na(o.priority,function(){YD(p)});return}}else if(l===31){if(l=c(p),l!==null){o.blockedOn=l,Na(o.priority,function(){YD(p)});return}}else if(l===3&&p.stateNode.current.memoizedState.isDehydrated){o.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}o.blockedOn=null}function rh(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var p=lw(o.nativeEvent);if(p===null){p=o.nativeEvent;var g=new p.constructor(p.type,p);cv=g,p.target.dispatchEvent(g),cv=null}else return l=mt(p),l!==null&&KD(l),o.blockedOn=p,!1;l.shift()}return!0}function JD(o,l,p){rh(o)&&p.delete(l)}function H9(){uw=!1,ai!==null&&rh(ai)&&(ai=null),oi!==null&&rh(oi)&&(oi=null),si!==null&&rh(si)&&(si=null),Qd.forEach(JD),ef.forEach(JD)}function ah(o,l){o.blockedOn===l&&(o.blockedOn=null,uw||(uw=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,H9)))}var oh=null;function QD(o){oh!==o&&(oh=o,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){oh===o&&(oh=null);for(var l=0;l<o.length;l+=3){var p=o[l],g=o[l+1],N=o[l+2];if(typeof g!="function"){if(cw(g||p)===null)continue;break}var k=mt(p);k!==null&&(o.splice(l,3),l-=3,l0(k,{pending:!0,data:N,method:p.method,action:g},g,N))}}))}function Nc(o){function l(oe){return ah(oe,o)}ai!==null&&ah(ai,o),oi!==null&&ah(oi,o),si!==null&&ah(si,o),Qd.forEach(l),ef.forEach(l);for(var p=0;p<ii.length;p++){var g=ii[p];g.blockedOn===o&&(g.blockedOn=null)}for(;0<ii.length&&(p=ii[0],p.blockedOn===null);)XD(p),p.blockedOn===null&&ii.shift();if(p=(o.ownerDocument||o).$$reactFormReplay,p!=null)for(g=0;g<p.length;g+=3){var N=p[g],k=p[g+1],P=N[Hn]||null;if(typeof k=="function")P||QD(p);else if(P){var Y=null;if(k&&k.hasAttribute("formAction")){if(N=k,P=k[Hn]||null)Y=P.formAction;else if(cw(N)!==null)continue}else Y=P.action;typeof Y=="function"?p[g+1]=Y:(p.splice(g,3),g-=3),QD(p)}}}function eL(){function o(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(P){return N=P})},focusReset:"manual",scroll:"manual"})}function l(){N!==null&&(N(),N=null),g||setTimeout(p,20)}function p(){if(!g&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,N=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(p,100),function(){g=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),N!==null&&(N(),N=null)}}}function dw(o){this._internalRoot=o}sh.prototype.render=dw.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(r(409));var p=l.current,g=Da();GD(p,g,o,l,null,null)},sh.prototype.unmount=dw.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;GD(o.current,2,null,o,null,null),zm(),l[Qr]=null}};function sh(o){this._internalRoot=o}sh.prototype.unstable_scheduleHydration=function(o){if(o){var l=Ta();o={blockedOn:null,target:o,priority:l};for(var p=0;p<ii.length&&l!==0&&l<ii[p].priority;p++);ii.splice(p,0,o),p===0&&XD(o)}};var tL=t.version;if(tL!=="19.2.0")throw Error(r(527,tL,"19.2.0"));K.findDOMNode=function(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=f(l),o=o!==null?m(o):null,o=o===null?null:o.stateNode,o};var V9={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ih=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ih.isDisabled&&ih.supportsFiber)try{Ut=ih.inject(V9),ot=ih}catch{}}return sf.createRoot=function(o,l){if(!a(o))throw Error(r(299));var p=!1,g="",N=lO,k=cO,P=uO;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(N=l.onUncaughtError),l.onCaughtError!==void 0&&(k=l.onCaughtError),l.onRecoverableError!==void 0&&(P=l.onRecoverableError)),l=HD(o,1,!1,null,null,p,g,null,N,k,P,eL),o[Qr]=l.current,W0(o),new dw(l)},sf.hydrateRoot=function(o,l,p){if(!a(o))throw Error(r(299));var g=!1,N="",k=lO,P=cO,Y=uO,oe=null;return p!=null&&(p.unstable_strictMode===!0&&(g=!0),p.identifierPrefix!==void 0&&(N=p.identifierPrefix),p.onUncaughtError!==void 0&&(k=p.onUncaughtError),p.onCaughtError!==void 0&&(P=p.onCaughtError),p.onRecoverableError!==void 0&&(Y=p.onRecoverableError),p.formState!==void 0&&(oe=p.formState)),l=HD(o,1,!0,l,p??null,g,N,oe,k,P,Y,eL),l.context=VD(null),p=l.current,g=Da(),g=la(g),N=Ws(g),N.callback=null,Ks(p,N,g),p=g,l.current.lanes=p,dn(l,p),Do(l),o[Qr]=l.current,W0(o),new sh(l)},sf.version="19.2.0",sf}var cj;function xJ(){if(cj)return Lw.exports;cj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Lw.exports=EJ(),Lw.exports}var SJ=xJ();const _J=bp(SJ);var uj="popstate";function TJ(e={}){function t(r,a){let{pathname:s,search:i,hash:c}=r.location;return cx("",{pathname:s,search:i,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:Kf(a)}return kJ(t,n,null,e)}function Gn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wo(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function NJ(){return Math.random().toString(36).substring(2,10)}function dj(e,t){return{usr:e.state,key:e.key,idx:t}}function cx(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Gu(t):t,state:n,key:t&&t.key||r||NJ()}}function Kf({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Gu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function kJ(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:s=!1}=r,i=a.history,c="POP",u=null,f=m();f==null&&(f=0,i.replaceState({...i.state,idx:f},""));function m(){return(i.state||{idx:null}).idx}function h(){c="POP";let w=m(),_=w==null?null:w-f;f=w,u&&u({action:c,location:E.location,delta:_})}function b(w,_){c="PUSH";let S=cx(E.location,w,_);f=m()+1;let T=dj(S,f),R=E.createHref(S);try{i.pushState(T,"",R)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(R)}s&&u&&u({action:c,location:E.location,delta:1})}function y(w,_){c="REPLACE";let S=cx(E.location,w,_);f=m();let T=dj(S,f),R=E.createHref(S);i.replaceState(T,"",R),s&&u&&u({action:c,location:E.location,delta:0})}function x(w){return CJ(w)}let E={get action(){return c},get location(){return e(a,i)},listen(w){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(uj,h),u=w,()=>{a.removeEventListener(uj,h),u=null}},createHref(w){return t(a,w)},createURL:x,encodeLocation(w){let _=x(w);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:b,replace:y,go(w){return i.go(w)}};return E}function CJ(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Gn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Kf(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function W2(e,t,n="/"){return RJ(e,t,n,!1)}function RJ(e,t,n,r){let a=typeof t=="string"?Gu(t):t,s=Cs(a.pathname||"/",n);if(s==null)return null;let i=K2(e);AJ(i);let c=null;for(let u=0;c==null&&u<i.length;++u){let f=FJ(s);c=$J(i[u],f,r)}return c}function K2(e,t=[],n=[],r="",a=!1){let s=(i,c,u=a,f)=>{let m={relativePath:f===void 0?i.path||"":f,caseSensitive:i.caseSensitive===!0,childrenIndex:c,route:i};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&u)return;Gn(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let h=Ss([r,m.relativePath]),b=n.concat(m);i.children&&i.children.length>0&&(Gn(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),K2(i.children,t,b,h,u)),!(i.path==null&&!i.index)&&t.push({path:h,score:PJ(h,i.index),routesMeta:b})};return e.forEach((i,c)=>{if(i.path===""||!i.path?.includes("?"))s(i,c);else for(let u of Y2(i.path))s(i,c,!0,u)}),t}function Y2(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return a?[s,""]:[s];let i=Y2(r.join("/")),c=[];return c.push(...i.map(u=>u===""?s:[s,u].join("/"))),a&&c.push(...i),c.map(u=>e.startsWith("/")&&u===""?"/":u)}function AJ(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:UJ(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var IJ=/^:[\w-]+$/,OJ=3,DJ=2,LJ=1,MJ=10,jJ=-2,fj=e=>e==="*";function PJ(e,t){let n=e.split("/"),r=n.length;return n.some(fj)&&(r+=jJ),t&&(r+=DJ),n.filter(a=>!fj(a)).reduce((a,s)=>a+(IJ.test(s)?OJ:s===""?LJ:MJ),r)}function UJ(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function $J(e,t,n=!1){let{routesMeta:r}=e,a={},s="/",i=[];for(let c=0;c<r.length;++c){let u=r[c],f=c===r.length-1,m=s==="/"?t:t.slice(s.length)||"/",h=ob({path:u.relativePath,caseSensitive:u.caseSensitive,end:f},m),b=u.route;if(!h&&f&&n&&!r[r.length-1].route.index&&(h=ob({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},m)),!h)return null;Object.assign(a,h.params),i.push({params:a,pathname:Ss([s,h.pathname]),pathnameBase:WJ(Ss([s,h.pathnameBase])),route:b}),h.pathnameBase!=="/"&&(s=Ss([s,h.pathnameBase]))}return i}function ob(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=zJ(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:r.reduce((f,{paramName:m,isOptional:h},b)=>{if(m==="*"){let x=c[b]||"";i=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const y=c[b];return h&&!y?f[m]=void 0:f[m]=(y||"").replace(/%2F/g,"/"),f},{}),pathname:s,pathnameBase:i,pattern:e}}function zJ(e,t=!1,n=!0){wo(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function FJ(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return wo(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Cs(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var BJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,HJ=e=>BJ.test(e);function VJ(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?Gu(e):e,s;if(n)if(HJ(n))s=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),wo(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${n}`)}n.startsWith("/")?s=pj(n.substring(1),"/"):s=pj(n,t)}else s=t;return{pathname:s,search:KJ(r),hash:YJ(a)}}function pj(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Uw(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function GJ(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Z2(e){let t=GJ(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function q2(e,t,n,r=!1){let a;typeof e=="string"?a=Gu(e):(a={...e},Gn(!a.pathname||!a.pathname.includes("?"),Uw("?","pathname","search",a)),Gn(!a.pathname||!a.pathname.includes("#"),Uw("#","pathname","hash",a)),Gn(!a.search||!a.search.includes("#"),Uw("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,c;if(i==null)c=n;else{let h=t.length-1;if(!r&&i.startsWith("..")){let b=i.split("/");for(;b[0]==="..";)b.shift(),h-=1;a.pathname=b.join("/")}c=h>=0?t[h]:"/"}let u=VJ(a,c),f=i&&i!=="/"&&i.endsWith("/"),m=(s||i===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(f||m)&&(u.pathname+="/"),u}var Ss=e=>e.join("/").replace(/\/\/+/g,"/"),WJ=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),KJ=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,YJ=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ZJ(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var X2=["POST","PUT","PATCH","DELETE"];new Set(X2);var qJ=["GET",...X2];new Set(qJ);var Wu=v.createContext(null);Wu.displayName="DataRouter";var iy=v.createContext(null);iy.displayName="DataRouterState";v.createContext(!1);var J2=v.createContext({isTransitioning:!1});J2.displayName="ViewTransition";var XJ=v.createContext(new Map);XJ.displayName="Fetchers";var JJ=v.createContext(null);JJ.displayName="Await";var Go=v.createContext(null);Go.displayName="Navigation";var Sp=v.createContext(null);Sp.displayName="Location";var Ms=v.createContext({outlet:null,matches:[],isDataRoute:!1});Ms.displayName="Route";var h_=v.createContext(null);h_.displayName="RouteError";function QJ(e,{relative:t}={}){Gn(_p(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=v.useContext(Go),{hash:a,pathname:s,search:i}=Tp(e,{relative:t}),c=s;return n!=="/"&&(c=s==="/"?n:Ss([n,s])),r.createHref({pathname:c,search:i,hash:a})}function _p(){return v.useContext(Sp)!=null}function js(){return Gn(_p(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Sp).location}var Q2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function eF(e){v.useContext(Go).static||v.useLayoutEffect(e)}function Ku(){let{isDataRoute:e}=v.useContext(Ms);return e?fQ():eQ()}function eQ(){Gn(_p(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Wu),{basename:t,navigator:n}=v.useContext(Go),{matches:r}=v.useContext(Ms),{pathname:a}=js(),s=JSON.stringify(Z2(r)),i=v.useRef(!1);return eF(()=>{i.current=!0}),v.useCallback((u,f={})=>{if(wo(i.current,Q2),!i.current)return;if(typeof u=="number"){n.go(u);return}let m=q2(u,JSON.parse(s),a,f.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Ss([t,m.pathname])),(f.replace?n.replace:n.push)(m,f.state,f)},[t,n,s,a,e])}v.createContext(null);function Tp(e,{relative:t}={}){let{matches:n}=v.useContext(Ms),{pathname:r}=js(),a=JSON.stringify(Z2(n));return v.useMemo(()=>q2(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function tQ(e,t){return tF(e,t)}function tF(e,t,n,r,a){Gn(_p(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(Go),{matches:i}=v.useContext(Ms),c=i[i.length-1],u=c?c.params:{},f=c?c.pathname:"/",m=c?c.pathnameBase:"/",h=c&&c.route;{let S=h&&h.path||"";nF(f,!h||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
59
 
60
60
  Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let b=js(),y;if(t){let S=typeof t=="string"?Gu(t):t;Gn(m==="/"||S.pathname?.startsWith(m),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${S.pathname}" was given in the \`location\` prop.`),y=S}else y=b;let x=y.pathname||"/",E=x;if(m!=="/"){let S=m.replace(/^\//,"").split("/");E="/"+x.replace(/^\//,"").split("/").slice(S.length).join("/")}let w=W2(e,{pathname:E});wo(h||w!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),wo(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=sQ(w&&w.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:Ss([m,s.encodeLocation?s.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?m:Ss([m,s.encodeLocation?s.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),i,n,r,a);return t&&_?v.createElement(Sp.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},_):_}function nQ(){let e=dQ(),t=ZJ(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:s},"ErrorBoundary")," or"," ",v.createElement("code",{style:s},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:a},n):null,i)}var rQ=v.createElement(nQ,null),aQ=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?v.createElement(Ms.Provider,{value:this.props.routeContext},v.createElement(h_.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function oQ({routeContext:e,match:t,children:n}){let r=v.useContext(Wu);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Ms.Provider,{value:e},n)}function sQ(e,t=[],n=null,r=null,a=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,i=n?.errors;if(i!=null){let m=s.findIndex(h=>h.route.id&&i?.[h.route.id]!==void 0);Gn(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,m+1))}let c=!1,u=-1;if(n)for(let m=0;m<s.length;m++){let h=s[m];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=m),h.route.id){let{loaderData:b,errors:y}=n,x=h.route.loader&&!b.hasOwnProperty(h.route.id)&&(!y||y[h.route.id]===void 0);if(h.route.lazy||x){c=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}let f=n&&r?(m,h)=>{r(m,{location:n.location,params:n.matches?.[0]?.params??{},errorInfo:h})}:void 0;return s.reduceRight((m,h,b)=>{let y,x=!1,E=null,w=null;n&&(y=i&&h.route.id?i[h.route.id]:void 0,E=h.route.errorElement||rQ,c&&(u<0&&b===0?(nF("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,w=null):u===b&&(x=!0,w=h.route.hydrateFallbackElement||null)));let _=t.concat(s.slice(0,b+1)),S=()=>{let T;return y?T=E:x?T=w:h.route.Component?T=v.createElement(h.route.Component,null):h.route.element?T=h.route.element:T=m,v.createElement(oQ,{match:h,routeContext:{outlet:m,matches:_,isDataRoute:n!=null},children:T})};return n&&(h.route.ErrorBoundary||h.route.errorElement||b===0)?v.createElement(aQ,{location:n.location,revalidation:n.revalidation,component:E,error:y,children:S(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:f}):S()},null)}function g_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function iQ(e){let t=v.useContext(Wu);return Gn(t,g_(e)),t}function lQ(e){let t=v.useContext(iy);return Gn(t,g_(e)),t}function cQ(e){let t=v.useContext(Ms);return Gn(t,g_(e)),t}function b_(e){let t=cQ(e),n=t.matches[t.matches.length-1];return Gn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function uQ(){return b_("useRouteId")}function dQ(){let e=v.useContext(h_),t=lQ("useRouteError"),n=b_("useRouteError");return e!==void 0?e:t.errors?.[n]}function fQ(){let{router:e}=iQ("useNavigate"),t=b_("useNavigate"),n=v.useRef(!1);return eF(()=>{n.current=!0}),v.useCallback(async(a,s={})=>{wo(n.current,Q2),n.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var mj={};function nF(e,t,n){!t&&!mj[e]&&(mj[e]=!0,wo(!1,n))}v.memo(pQ);function pQ({routes:e,future:t,state:n,unstable_onError:r}){return tF(e,void 0,n,r,t)}function ux(e){Gn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function mQ({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:s=!1}){Gn(!_p(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),c=v.useMemo(()=>({basename:i,navigator:a,static:s,future:{}}),[i,a,s]);typeof n=="string"&&(n=Gu(n));let{pathname:u="/",search:f="",hash:m="",state:h=null,key:b="default"}=n,y=v.useMemo(()=>{let x=Cs(u,i);return x==null?null:{location:{pathname:x,search:f,hash:m,state:h,key:b},navigationType:r}},[i,u,f,m,h,b,r]);return wo(y!=null,`<Router basename="${i}"> is not able to match the URL "${u}${f}${m}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:v.createElement(Go.Provider,{value:c},v.createElement(Sp.Provider,{children:t,value:y}))}function hQ({children:e,location:t}){return tQ(dx(e),t)}function dx(e,t=[]){let n=[];return v.Children.forEach(e,(r,a)=>{if(!v.isValidElement(r))return;let s=[...t,a];if(r.type===v.Fragment){n.push.apply(n,dx(r.props.children,s));return}Gn(r.type===ux,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Gn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=dx(r.props.children,s)),n.push(i)}),n}var Cg="get",Rg="application/x-www-form-urlencoded";function ly(e){return e!=null&&typeof e.tagName=="string"}function gQ(e){return ly(e)&&e.tagName.toLowerCase()==="button"}function bQ(e){return ly(e)&&e.tagName.toLowerCase()==="form"}function yQ(e){return ly(e)&&e.tagName.toLowerCase()==="input"}function vQ(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function wQ(e,t){return e.button===0&&(!t||t==="_self")&&!vQ(e)}var Jh=null;function EQ(){if(Jh===null)try{new FormData(document.createElement("form"),0),Jh=!1}catch{Jh=!0}return Jh}var xQ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $w(e){return e!=null&&!xQ.has(e)?(wo(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Rg}"`),null):e}function SQ(e,t){let n,r,a,s,i;if(bQ(e)){let c=e.getAttribute("action");r=c?Cs(c,t):null,n=e.getAttribute("method")||Cg,a=$w(e.getAttribute("enctype"))||Rg,s=new FormData(e)}else if(gQ(e)||yQ(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(r=u?Cs(u,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||Cg,a=$w(e.getAttribute("formenctype"))||$w(c.getAttribute("enctype"))||Rg,s=new FormData(c,e),!EQ()){let{name:f,type:m,value:h}=e;if(m==="image"){let b=f?`${f}.`:"";s.append(`${b}x`,"0"),s.append(`${b}y`,"0")}else f&&s.append(f,h)}}else{if(ly(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Cg,r=null,a=Rg,i=e}return s&&a==="text/plain"&&(i=s,s=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:s,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function y_(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _Q(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&Cs(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function TQ(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function NQ(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function kQ(e,t,n){let r=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let i=await TQ(s,n);return i.links?i.links():[]}return[]}));return IQ(r.flat(1).filter(NQ).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function hj(e,t,n,r,a,s){let i=(u,f)=>n[f]?u.route.id!==n[f].route.id:!0,c=(u,f)=>n[f].pathname!==u.pathname||n[f].route.path?.endsWith("*")&&n[f].params["*"]!==u.params["*"];return s==="assets"?t.filter((u,f)=>i(u,f)||c(u,f)):s==="data"?t.filter((u,f)=>{let m=r.routes[u.route.id];if(!m||!m.hasLoader)return!1;if(i(u,f)||c(u,f))return!0;if(u.route.shouldRevalidate){let h=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function CQ(e,t,{includeHydrateFallback:n}={}){return RQ(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function RQ(e){return[...new Set(e)]}function AQ(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function IQ(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let s=JSON.stringify(AQ(a));return n.has(s)||(n.add(s),r.push({key:s,link:a})),r},[])}function rF(){let e=v.useContext(Wu);return y_(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function OQ(){let e=v.useContext(iy);return y_(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var v_=v.createContext(void 0);v_.displayName="FrameworkContext";function aF(){let e=v.useContext(v_);return y_(e,"You must render this element inside a <HydratedRouter> element"),e}function DQ(e,t){let n=v.useContext(v_),[r,a]=v.useState(!1),[s,i]=v.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:f,onMouseLeave:m,onTouchStart:h}=t,b=v.useRef(null);v.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let E=_=>{_.forEach(S=>{i(S.isIntersecting)})},w=new IntersectionObserver(E,{threshold:.5});return b.current&&w.observe(b.current),()=>{w.disconnect()}}},[e]),v.useEffect(()=>{if(r){let E=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(E)}}},[r]);let y=()=>{a(!0)},x=()=>{a(!1),i(!1)};return n?e!=="intent"?[s,b,{}]:[s,b,{onFocus:lf(c,y),onBlur:lf(u,x),onMouseEnter:lf(f,y),onMouseLeave:lf(m,x),onTouchStart:lf(h,y)}]:[!1,b,{}]}function lf(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function LQ({page:e,...t}){let{router:n}=rF(),r=v.useMemo(()=>W2(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?v.createElement(jQ,{page:e,matches:r,...t}):null}function MQ(e){let{manifest:t,routeModules:n}=aF(),[r,a]=v.useState([]);return v.useEffect(()=>{let s=!1;return kQ(e,t,n).then(i=>{s||a(i)}),()=>{s=!0}},[e,t,n]),r}function jQ({page:e,matches:t,...n}){let r=js(),{manifest:a,routeModules:s}=aF(),{basename:i}=rF(),{loaderData:c,matches:u}=OQ(),f=v.useMemo(()=>hj(e,t,u,a,r,"data"),[e,t,u,a,r]),m=v.useMemo(()=>hj(e,t,u,a,r,"assets"),[e,t,u,a,r]),h=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let x=new Set,E=!1;if(t.forEach(_=>{let S=a.routes[_.route.id];!S||!S.hasLoader||(!f.some(T=>T.route.id===_.route.id)&&_.route.id in c&&s[_.route.id]?.shouldRevalidate||S.hasClientLoader?E=!0:x.add(_.route.id))}),x.size===0)return[];let w=_Q(e,i,"data");return E&&x.size>0&&w.searchParams.set("_routes",t.filter(_=>x.has(_.route.id)).map(_=>_.route.id).join(",")),[w.pathname+w.search]},[i,c,r,a,f,t,e,s]),b=v.useMemo(()=>CQ(m,a),[m,a]),y=MQ(m);return v.createElement(v.Fragment,null,h.map(x=>v.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),b.map(x=>v.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),y.map(({key:x,link:E})=>v.createElement("link",{key:x,nonce:n.nonce,...E})))}function PQ(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var oF=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{oF&&(window.__reactRouterVersion="7.9.6")}catch{}function UQ({basename:e,children:t,window:n}){let r=v.useRef();r.current==null&&(r.current=TJ({window:n,v5Compat:!0}));let a=r.current,[s,i]=v.useState({action:a.action,location:a.location}),c=v.useCallback(u=>{v.startTransition(()=>i(u))},[i]);return v.useLayoutEffect(()=>a.listen(c),[a,c]),v.createElement(mQ,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}var sF=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,iF=v.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:s,replace:i,state:c,target:u,to:f,preventScrollReset:m,viewTransition:h,...b},y){let{basename:x}=v.useContext(Go),E=typeof f=="string"&&sF.test(f),w,_=!1;if(typeof f=="string"&&E&&(w=f,oF))try{let j=new URL(window.location.href),U=f.startsWith("//")?new URL(j.protocol+f):new URL(f),B=Cs(U.pathname,x);U.origin===j.origin&&B!=null?f=B+U.search+U.hash:_=!0}catch{wo(!1,`<Link to="${f}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let S=QJ(f,{relative:a}),[T,R,C]=DQ(r,b),I=BQ(f,{replace:i,state:c,target:u,preventScrollReset:m,relative:a,viewTransition:h});function A(j){t&&t(j),j.defaultPrevented||I(j)}let O=v.createElement("a",{...b,...C,href:w||S,onClick:_||s?t:A,ref:PQ(y,R),target:u,"data-discover":!E&&n==="render"?"true":void 0});return T&&!E?v.createElement(v.Fragment,null,O,v.createElement(LQ,{page:S})):O});iF.displayName="Link";var $Q=v.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:s,to:i,viewTransition:c,children:u,...f},m){let h=Tp(i,{relative:f.relative}),b=js(),y=v.useContext(iy),{navigator:x,basename:E}=v.useContext(Go),w=y!=null&&KQ(h)&&c===!0,_=x.encodeLocation?x.encodeLocation(h).pathname:h.pathname,S=b.pathname,T=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(S=S.toLowerCase(),T=T?T.toLowerCase():null,_=_.toLowerCase()),T&&E&&(T=Cs(T,E)||T);const R=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let C=S===_||!a&&S.startsWith(_)&&S.charAt(R)==="/",I=T!=null&&(T===_||!a&&T.startsWith(_)&&T.charAt(_.length)==="/"),A={isActive:C,isPending:I,isTransitioning:w},O=C?t:void 0,j;typeof r=="function"?j=r(A):j=[r,C?"active":null,I?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let U=typeof s=="function"?s(A):s;return v.createElement(iF,{...f,"aria-current":O,className:j,ref:m,style:U,to:i,viewTransition:c},typeof u=="function"?u(A):u)});$Q.displayName="NavLink";var zQ=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:s,method:i=Cg,action:c,onSubmit:u,relative:f,preventScrollReset:m,viewTransition:h,...b},y)=>{let x=GQ(),E=WQ(c,{relative:f}),w=i.toLowerCase()==="get"?"get":"post",_=typeof c=="string"&&sF.test(c),S=T=>{if(u&&u(T),T.defaultPrevented)return;T.preventDefault();let R=T.nativeEvent.submitter,C=R?.getAttribute("formmethod")||i;x(R||T.currentTarget,{fetcherKey:t,method:C,navigate:n,replace:a,state:s,relative:f,preventScrollReset:m,viewTransition:h})};return v.createElement("form",{ref:y,method:w,action:E,onSubmit:r?u:S,...b,"data-discover":!_&&e==="render"?"true":void 0})});zQ.displayName="Form";function FQ(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lF(e){let t=v.useContext(Wu);return Gn(t,FQ(e)),t}function BQ(e,{target:t,replace:n,state:r,preventScrollReset:a,relative:s,viewTransition:i}={}){let c=Ku(),u=js(),f=Tp(e,{relative:s});return v.useCallback(m=>{if(wQ(m,t)){m.preventDefault();let h=n!==void 0?n:Kf(u)===Kf(f);c(e,{replace:h,state:r,preventScrollReset:a,relative:s,viewTransition:i})}},[u,c,f,n,r,t,e,a,s,i])}var HQ=0,VQ=()=>`__${String(++HQ)}__`;function GQ(){let{router:e}=lF("useSubmit"),{basename:t}=v.useContext(Go),n=uQ();return v.useCallback(async(r,a={})=>{let{action:s,method:i,encType:c,formData:u,body:f}=SQ(r,t);if(a.navigate===!1){let m=a.fetcherKey||VQ();await e.fetch(m,n,a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:f,formMethod:a.method||i,formEncType:a.encType||c,flushSync:a.flushSync})}else await e.navigate(a.action||s,{preventScrollReset:a.preventScrollReset,formData:u,body:f,formMethod:a.method||i,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,n])}function WQ(e,{relative:t}={}){let{basename:n}=v.useContext(Go),r=v.useContext(Ms);Gn(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),s={...Tp(e||".",{relative:t})},i=js();if(e==null){s.search=i.search;let c=new URLSearchParams(s.search),u=c.getAll("index");if(u.some(m=>m==="")){c.delete("index"),u.filter(h=>h).forEach(h=>c.append("index",h));let m=c.toString();s.search=m?`?${m}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Ss([n,s.pathname])),Kf(s)}function KQ(e,{relative:t}={}){let n=v.useContext(J2);Gn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=lF("useViewTransitionState"),a=Tp(e,{relative:t});if(!n.isTransitioning)return!1;let s=Cs(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Cs(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ob(a.pathname,i)!=null||ob(a.pathname,s)!=null}var Yu=G2();const cF=bp(Yu);function gj(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fo(...e){return t=>{let n=!1;const r=e.map(a=>{const s=gj(a,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():gj(e[a],null)}}}}function Jt(...e){return v.useCallback(Fo(...e),e)}var YQ=Symbol.for("react.lazy"),sb=Hu[" use ".trim().toString()];function ZQ(e){return typeof e=="object"&&e!==null&&"then"in e}function uF(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===YQ&&"_payload"in e&&ZQ(e._payload)}function dF(e){const t=qQ(e),n=v.forwardRef((r,a)=>{let{children:s,...i}=r;uF(s)&&typeof sb=="function"&&(s=sb(s._payload));const c=v.Children.toArray(s),u=c.find(JQ);if(u){const f=u.props.children,m=c.map(h=>h===u?v.Children.count(f)>1?v.Children.only(null):v.isValidElement(f)?f.props.children:null:h);return d.jsx(t,{...i,ref:a,children:v.isValidElement(f)?v.cloneElement(f,void 0,m):null})}return d.jsx(t,{...i,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}var fF=dF("Slot");function qQ(e){const t=v.forwardRef((n,r)=>{let{children:a,...s}=n;if(uF(a)&&typeof sb=="function"&&(a=sb(a._payload)),v.isValidElement(a)){const i=eee(a),c=QQ(s,a.props);return a.type!==v.Fragment&&(c.ref=r?Fo(r,i):i),v.cloneElement(a,c)}return v.Children.count(a)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var XQ=Symbol("radix.slottable");function JQ(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===XQ}function QQ(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const u=s(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function eee(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pF(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=pF(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function mF(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=pF(e))&&(r&&(r+=" "),r+=t);return r}const bj=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yj=mF,hF=(e,t)=>n=>{var r;if(t?.variants==null)return yj(e,n?.class,n?.className);const{variants:a,defaultVariants:s}=t,i=Object.keys(a).map(f=>{const m=n?.[f],h=s?.[f];if(m===null)return null;const b=bj(m)||bj(h);return a[f][b]}),c=n&&Object.entries(n).reduce((f,m)=>{let[h,b]=m;return b===void 0||(f[h]=b),f},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:h,className:b,...y}=m;return Object.entries(y).every(x=>{let[E,w]=x;return Array.isArray(w)?w.includes({...s,...c}[E]):{...s,...c}[E]===w})?[...f,h,b]:f},[]);return yj(e,i,u,n?.class,n?.className)},tee=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},nee=(e,t)=>({classGroupId:e,validator:t}),gF=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ib="-",vj=[],ree="arbitrary..",aee=e=>{const t=see(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return oee(i);const c=i.split(ib),u=c[0]===""&&c.length>1?1:0;return bF(c,u,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const u=r[i],f=n[i];return u?f?tee(f,u):u:f||vj}return n[i]||vj}}},bF=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],s=n.nextPart.get(a);if(s){const f=bF(e,t+1,s);if(f)return f}const i=n.validators;if(i===null)return;const c=t===0?e.join(ib):e.slice(t).join(ib),u=i.length;for(let f=0;f<u;f++){const m=i[f];if(m.validator(c))return m.classGroupId}},oee=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?ree+r:void 0})(),see=e=>{const{theme:t,classGroups:n}=e;return iee(n,t)},iee=(e,t)=>{const n=gF();for(const r in e){const a=e[r];w_(a,n,r,t)}return n},w_=(e,t,n,r)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];lee(i,t,n,r)}},lee=(e,t,n,r)=>{if(typeof e=="string"){cee(e,t,n);return}if(typeof e=="function"){uee(e,t,n,r);return}dee(e,t,n,r)},cee=(e,t,n)=>{const r=e===""?t:yF(t,e);r.classGroupId=n},uee=(e,t,n,r)=>{if(fee(e)){w_(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(nee(n,e))},dee=(e,t,n,r)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[c,u]=a[i];w_(u,yF(t,c),n,r)}},yF=(e,t)=>{let n=e;const r=t.split(ib),a=r.length;for(let s=0;s<a;s++){const i=r[s];let c=n.nextPart.get(i);c||(c=gF(),n.nextPart.set(i,c)),n=c}return n},fee=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,pee=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const a=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return a(s,i),i},set(s,i){s in n?n[s]=i:a(s,i)}}},fx="!",wj=":",mee=[],Ej=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),hee=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const s=[];let i=0,c=0,u=0,f;const m=a.length;for(let E=0;E<m;E++){const w=a[E];if(i===0&&c===0){if(w===wj){s.push(a.slice(u,E)),u=E+1;continue}if(w==="/"){f=E;continue}}w==="["?i++:w==="]"?i--:w==="("?c++:w===")"&&c--}const h=s.length===0?a:a.slice(u);let b=h,y=!1;h.endsWith(fx)?(b=h.slice(0,-1),y=!0):h.startsWith(fx)&&(b=h.slice(1),y=!0);const x=f&&f>u?f-u:void 0;return Ej(s,y,b,x)};if(t){const a=t+wj,s=r;r=i=>i.startsWith(a)?s(i.slice(a.length)):Ej(mee,!1,i,void 0,!0)}if(n){const a=r;r=s=>n({className:s,parseClassName:a})}return r},gee=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let s=0;s<n.length;s++){const i=n[s],c=i[0]==="[",u=t.has(i);c||u?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(i)):a.push(i)}return a.length>0&&(a.sort(),r.push(...a)),r}},bee=e=>({cache:pee(e.cacheSize),parseClassName:hee(e),sortModifiers:gee(e),...aee(e)}),yee=/\s+/,vee=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],c=e.trim().split(yee);let u="";for(let f=c.length-1;f>=0;f-=1){const m=c[f],{isExternal:h,modifiers:b,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:E}=n(m);if(h){u=m+(u.length>0?" "+u:u);continue}let w=!!E,_=r(w?x.substring(0,E):x);if(!_){if(!w){u=m+(u.length>0?" "+u:u);continue}if(_=r(x),!_){u=m+(u.length>0?" "+u:u);continue}w=!1}const S=b.length===0?"":b.length===1?b[0]:s(b).join(":"),T=y?S+fx:S,R=T+_;if(i.indexOf(R)>-1)continue;i.push(R);const C=a(_,w);for(let I=0;I<C.length;++I){const A=C[I];i.push(T+A)}u=m+(u.length>0?" "+u:u)}return u},wee=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=vF(n))&&(a&&(a+=" "),a+=r);return a},vF=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=vF(e[r]))&&(n&&(n+=" "),n+=t);return n},Eee=(e,...t)=>{let n,r,a,s;const i=u=>{const f=t.reduce((m,h)=>h(m),e());return n=bee(f),r=n.cache.get,a=n.cache.set,s=c,c(u)},c=u=>{const f=r(u);if(f)return f;const m=vee(u,n);return a(u,m),m};return s=i,(...u)=>s(wee(...u))},xee=[],mr=e=>{const t=n=>n[e]||xee;return t.isThemeGetter=!0,t},wF=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,EF=/^\((?:(\w[\w-]*):)?(.+)\)$/i,See=/^\d+\/\d+$/,_ee=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Tee=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Nee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Cee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rc=e=>See.test(e),It=e=>!!e&&!Number.isNaN(Number(e)),ui=e=>!!e&&Number.isInteger(Number(e)),zw=e=>e.endsWith("%")&&It(e.slice(0,-1)),gs=e=>_ee.test(e),Ree=()=>!0,Aee=e=>Tee.test(e)&&!Nee.test(e),xF=()=>!1,Iee=e=>kee.test(e),Oee=e=>Cee.test(e),Dee=e=>!Ke(e)&&!Ye(e),Lee=e=>Zu(e,TF,xF),Ke=e=>wF.test(e),cl=e=>Zu(e,NF,Aee),Fw=e=>Zu(e,$ee,It),xj=e=>Zu(e,SF,xF),Mee=e=>Zu(e,_F,Oee),Qh=e=>Zu(e,kF,Iee),Ye=e=>EF.test(e),cf=e=>qu(e,NF),jee=e=>qu(e,zee),Sj=e=>qu(e,SF),Pee=e=>qu(e,TF),Uee=e=>qu(e,_F),eg=e=>qu(e,kF,!0),Zu=(e,t,n)=>{const r=wF.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},qu=(e,t,n=!1)=>{const r=EF.exec(e);return r?r[1]?t(r[1]):n:!1},SF=e=>e==="position"||e==="percentage",_F=e=>e==="image"||e==="url",TF=e=>e==="length"||e==="size"||e==="bg-size",NF=e=>e==="length",$ee=e=>e==="number",zee=e=>e==="family-name",kF=e=>e==="shadow",Fee=()=>{const e=mr("color"),t=mr("font"),n=mr("text"),r=mr("font-weight"),a=mr("tracking"),s=mr("leading"),i=mr("breakpoint"),c=mr("container"),u=mr("spacing"),f=mr("radius"),m=mr("shadow"),h=mr("inset-shadow"),b=mr("text-shadow"),y=mr("drop-shadow"),x=mr("blur"),E=mr("perspective"),w=mr("aspect"),_=mr("ease"),S=mr("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...R(),Ye,Ke],I=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],O=()=>[Ye,Ke,u],j=()=>[Rc,"full","auto",...O()],U=()=>[ui,"none","subgrid",Ye,Ke],B=()=>["auto",{span:["full",ui,Ye,Ke]},ui,Ye,Ke],W=()=>[ui,"auto",Ye,Ke],J=()=>["auto","min","max","fr",Ye,Ke],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...O()],K=()=>[Rc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],V=()=>[e,Ye,Ke],ne=()=>[...R(),Sj,xj,{position:[Ye,Ke]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",Pee,Lee,{size:[Ye,Ke]}],H=()=>[zw,cf,cl],$=()=>["","none","full",f,Ye,Ke],L=()=>["",It,cf,cl],M=()=>["solid","dashed","dotted","double"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[It,zw,Sj,xj],q=()=>["","none",x,Ye,Ke],ae=()=>["none",It,Ye,Ke],ie=()=>["none",It,Ye,Ke],X=()=>[It,Ye,Ke],Z=()=>[Rc,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[gs],breakpoint:[gs],color:[Ree],container:[gs],"drop-shadow":[gs],ease:["in","out","in-out"],font:[Dee],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[gs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[gs],shadow:[gs],spacing:["px",It],text:[gs],"text-shadow":[gs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rc,Ke,Ye,w]}],container:["container"],columns:[{columns:[It,Ke,Ye,c]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:j()}],"inset-x":[{"inset-x":j()}],"inset-y":[{"inset-y":j()}],start:[{start:j()}],end:[{end:j()}],top:[{top:j()}],right:[{right:j()}],bottom:[{bottom:j()}],left:[{left:j()}],visibility:["visible","invisible","collapse"],z:[{z:[ui,"auto",Ye,Ke]}],basis:[{basis:[Rc,"full","auto",c,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[It,Rc,"auto","initial","none",Ke]}],grow:[{grow:["",It,Ye,Ke]}],shrink:[{shrink:["",It,Ye,Ke]}],order:[{order:[ui,"first","last","none",Ye,Ke]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[c,"screen",...K()]}],"min-w":[{"min-w":[c,"screen","none",...K()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",n,cf,cl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,Fw]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zw,Ke]}],"font-family":[{font:[jee,Ke,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Ye,Ke]}],"line-clamp":[{"line-clamp":[It,"none",Ye,Fw]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",Ye,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:[It,"from-font","auto",Ye,cl]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[It,"auto",Ye,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ye,Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ye,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ui,Ye,Ke],radial:["",Ye,Ke],conic:[ui,Ye,Ke]},Uee,Mee]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":L()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...M(),"hidden","none"]}],"divide-style":[{divide:[...M(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...M(),"none","hidden"]}],"outline-offset":[{"outline-offset":[It,Ye,Ke]}],"outline-w":[{outline:["",It,cf,cl]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",m,eg,Qh]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",h,eg,Qh]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[It,cl]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",b,eg,Qh]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[It,Ye,Ke]}],"mix-blend":[{"mix-blend":[...z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":z()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[It]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Ye,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[It]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Ke]}],filter:[{filter:["","none",Ye,Ke]}],blur:[{blur:q()}],brightness:[{brightness:[It,Ye,Ke]}],contrast:[{contrast:[It,Ye,Ke]}],"drop-shadow":[{"drop-shadow":["","none",y,eg,Qh]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",It,Ye,Ke]}],"hue-rotate":[{"hue-rotate":[It,Ye,Ke]}],invert:[{invert:["",It,Ye,Ke]}],saturate:[{saturate:[It,Ye,Ke]}],sepia:[{sepia:["",It,Ye,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Ke]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[It,Ye,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[It,Ye,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",It,Ye,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[It,Ye,Ke]}],"backdrop-invert":[{"backdrop-invert":["",It,Ye,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[It,Ye,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[It,Ye,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",It,Ye,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ye,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[It,"initial",Ye,Ke]}],ease:[{ease:["linear","initial",_,Ye,Ke]}],delay:[{delay:[It,Ye,Ke]}],animate:[{animate:["none",S,Ye,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[E,Ye,Ke]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:X()}],"skew-x":[{"skew-x":X()}],"skew-y":[{"skew-y":X()}],transform:[{transform:[Ye,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Z()}],"translate-x":[{"translate-x":Z()}],"translate-y":[{"translate-y":Z()}],"translate-z":[{"translate-z":Z()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ye,Ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ye,Ke]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[It,cf,cl,Fw]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Bee=Eee(Fee);function Oe(...e){return Bee(mF(e))}const Hee=hF("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function kr({className:e,variant:t,asChild:n=!1,...r}){const a=n?fF:"span";return d.jsx(a,{"data-slot":"badge",className:Oe(Hee({variant:t}),e),...r})}const Vee=hF("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-full gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-full px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function De({className:e,variant:t,size:n,asChild:r=!1,...a}){const s=r?fF:"button";return d.jsx(s,{"data-slot":"button",className:Oe(Vee({variant:t,size:n,className:e})),...a})}function Ve(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function Gee(e,t){const n=v.createContext(t),r=s=>{const{children:i,...c}=s,u=v.useMemo(()=>c,Object.values(c));return d.jsx(n.Provider,{value:u,children:i})};r.displayName=e+"Provider";function a(s){const i=v.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,a]}function No(e,t=[]){let n=[];function r(s,i){const c=v.createContext(i),u=n.length;n=[...n,i];const f=h=>{const{scope:b,children:y,...x}=h,E=b?.[e]?.[u]||c,w=v.useMemo(()=>x,Object.values(x));return d.jsx(E.Provider,{value:w,children:y})};f.displayName=s+"Provider";function m(h,b){const y=b?.[e]?.[u]||c,x=v.useContext(y);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[f,m]}const a=()=>{const s=n.map(i=>v.createContext(i));return function(c){const u=c?.[e]||s;return v.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return a.scopeName=e,[r,Wee(a,...t)]}function Wee(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(s){const i=r.reduce((c,{useScope:u,scopeName:f})=>{const h=u(s)[`__scope${f}`];return{...c,...h}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Zr=globalThis?.document?v.useLayoutEffect:()=>{},Kee=Hu[" useInsertionEffect ".trim().toString()]||Zr;function Rs({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,s,i]=Yee({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:a;{const m=v.useRef(e!==void 0);v.useEffect(()=>{const h=m.current;h!==c&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=c},[c,r])}const f=v.useCallback(m=>{if(c){const h=Zee(m)?m(e):m;h!==e&&i.current?.(h)}else s(m)},[c,e,s,i]);return[u,f]}function Yee({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),a=v.useRef(n),s=v.useRef(t);return Kee(()=>{s.current=t},[t]),v.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}function Zee(e){return typeof e=="function"}function Nl(e){const t=qee(e),n=v.forwardRef((r,a)=>{const{children:s,...i}=r,c=v.Children.toArray(s),u=c.find(Jee);if(u){const f=u.props.children,m=c.map(h=>h===u?v.Children.count(f)>1?v.Children.only(null):v.isValidElement(f)?f.props.children:null:h);return d.jsx(t,{...i,ref:a,children:v.isValidElement(f)?v.cloneElement(f,void 0,m):null})}return d.jsx(t,{...i,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function qee(e){const t=v.forwardRef((n,r)=>{const{children:a,...s}=n;if(v.isValidElement(a)){const i=ete(a),c=Qee(s,a.props);return a.type!==v.Fragment&&(c.ref=r?Fo(r,i):i),v.cloneElement(a,c)}return v.Children.count(a)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var CF=Symbol("radix.slottable");function Xee(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=CF,t}function Jee(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===CF}function Qee(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const u=s(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function ete(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_t=tte.reduce((e,t)=>{const n=Nl(`Primitive.${t}`),r=v.forwardRef((a,s)=>{const{asChild:i,...c}=a,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function RF(e,t){e&&Yu.flushSync(()=>e.dispatchEvent(t))}function E_(e){const t=e+"CollectionProvider",[n,r]=No(t),[a,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=E=>{const{scope:w,children:_}=E,S=ce.useRef(null),T=ce.useRef(new Map).current;return d.jsx(a,{scope:w,itemMap:T,collectionRef:S,children:_})};i.displayName=t;const c=e+"CollectionSlot",u=Nl(c),f=ce.forwardRef((E,w)=>{const{scope:_,children:S}=E,T=s(c,_),R=Jt(w,T.collectionRef);return d.jsx(u,{ref:R,children:S})});f.displayName=c;const m=e+"CollectionItemSlot",h="data-radix-collection-item",b=Nl(m),y=ce.forwardRef((E,w)=>{const{scope:_,children:S,...T}=E,R=ce.useRef(null),C=Jt(w,R),I=s(m,_);return ce.useEffect(()=>(I.itemMap.set(R,{ref:R,...T}),()=>void I.itemMap.delete(R))),d.jsx(b,{[h]:"",ref:C,children:S})});y.displayName=m;function x(E){const w=s(e+"CollectionConsumer",E);return ce.useCallback(()=>{const S=w.collectionRef.current;if(!S)return[];const T=Array.from(S.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((I,A)=>T.indexOf(I.ref.current)-T.indexOf(A.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:i,Slot:f,ItemSlot:y},x,r]}var nte=v.createContext(void 0);function x_(e){const t=v.useContext(nte);return e||t||"ltr"}function Bo(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function rte(e,t=globalThis?.document){const n=Bo(e);v.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ate="DismissableLayer",px="dismissableLayer.update",ote="dismissableLayer.pointerDownOutside",ste="dismissableLayer.focusOutside",_j,AF=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xu=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:c,...u}=e,f=v.useContext(AF),[m,h]=v.useState(null),b=m?.ownerDocument??globalThis?.document,[,y]=v.useState({}),x=Jt(t,A=>h(A)),E=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),_=E.indexOf(w),S=m?E.indexOf(m):-1,T=f.layersWithOutsidePointerEventsDisabled.size>0,R=S>=_,C=cte(A=>{const O=A.target,j=[...f.branches].some(U=>U.contains(O));!R||j||(a?.(A),i?.(A),A.defaultPrevented||c?.())},b),I=ute(A=>{const O=A.target;[...f.branches].some(U=>U.contains(O))||(s?.(A),i?.(A),A.defaultPrevented||c?.())},b);return rte(A=>{S===f.layers.size-1&&(r?.(A),!A.defaultPrevented&&c&&(A.preventDefault(),c()))},b),v.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(_j=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),Tj(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=_j)}},[m,b,n,f]),v.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),Tj())},[m,f]),v.useEffect(()=>{const A=()=>y({});return document.addEventListener(px,A),()=>document.removeEventListener(px,A)},[]),d.jsx(_t.div,{...u,ref:x,style:{pointerEvents:T?R?"auto":"none":void 0,...e.style},onFocusCapture:Ve(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Ve(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Ve(e.onPointerDownCapture,C.onPointerDownCapture)})});Xu.displayName=ate;var ite="DismissableLayerBranch",lte=v.forwardRef((e,t)=>{const n=v.useContext(AF),r=v.useRef(null),a=Jt(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),d.jsx(_t.div,{...e,ref:a})});lte.displayName=ite;function cte(e,t=globalThis?.document){const n=Bo(e),r=v.useRef(!1),a=v.useRef(()=>{});return v.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let u=function(){IF(ote,n,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=u,t.addEventListener("click",a.current,{once:!0})):u()}else t.removeEventListener("click",a.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ute(e,t=globalThis?.document){const n=Bo(e),r=v.useRef(!1);return v.useEffect(()=>{const a=s=>{s.target&&!r.current&&IF(ste,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Tj(){const e=new CustomEvent(px);document.dispatchEvent(e)}function IF(e,t,n,{discrete:r}){const a=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?RF(a,s):a.dispatchEvent(s)}var Bw=0;function cy(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Nj()),document.body.insertAdjacentElement("beforeend",e[1]??Nj()),Bw++,()=>{Bw===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Bw--}},[])}function Nj(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Hw="focusScope.autoFocusOnMount",Vw="focusScope.autoFocusOnUnmount",kj={bubbles:!1,cancelable:!0},dte="FocusScope",Np=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[c,u]=v.useState(null),f=Bo(a),m=Bo(s),h=v.useRef(null),b=Jt(t,E=>u(E)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let E=function(T){if(y.paused||!c)return;const R=T.target;c.contains(R)?h.current=R:fi(h.current,{select:!0})},w=function(T){if(y.paused||!c)return;const R=T.relatedTarget;R!==null&&(c.contains(R)||fi(h.current,{select:!0}))},_=function(T){if(document.activeElement===document.body)for(const C of T)C.removedNodes.length>0&&fi(c)};document.addEventListener("focusin",E),document.addEventListener("focusout",w);const S=new MutationObserver(_);return c&&S.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",w),S.disconnect()}}},[r,c,y.paused]),v.useEffect(()=>{if(c){Rj.add(y);const E=document.activeElement;if(!c.contains(E)){const _=new CustomEvent(Hw,kj);c.addEventListener(Hw,f),c.dispatchEvent(_),_.defaultPrevented||(fte(bte(OF(c)),{select:!0}),document.activeElement===E&&fi(c))}return()=>{c.removeEventListener(Hw,f),setTimeout(()=>{const _=new CustomEvent(Vw,kj);c.addEventListener(Vw,m),c.dispatchEvent(_),_.defaultPrevented||fi(E??document.body,{select:!0}),c.removeEventListener(Vw,m),Rj.remove(y)},0)}}},[c,f,m,y]);const x=v.useCallback(E=>{if(!n&&!r||y.paused)return;const w=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,_=document.activeElement;if(w&&_){const S=E.currentTarget,[T,R]=pte(S);T&&R?!E.shiftKey&&_===R?(E.preventDefault(),n&&fi(T,{select:!0})):E.shiftKey&&_===T&&(E.preventDefault(),n&&fi(R,{select:!0})):_===S&&E.preventDefault()}},[n,r,y.paused]);return d.jsx(_t.div,{tabIndex:-1,...i,ref:b,onKeyDown:x})});Np.displayName=dte;function fte(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(fi(r,{select:t}),document.activeElement!==n)return}function pte(e){const t=OF(e),n=Cj(t,e),r=Cj(t.reverse(),e);return[n,r]}function OF(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Cj(e,t){for(const n of e)if(!mte(n,{upTo:t}))return n}function mte(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function hte(e){return e instanceof HTMLInputElement&&"select"in e}function fi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hte(e)&&t&&e.select()}}var Rj=gte();function gte(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Aj(e,t),e.unshift(t)},remove(t){e=Aj(e,t),e[0]?.resume()}}}function Aj(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bte(e){return e.filter(t=>t.tagName!=="A")}var yte=Hu[" useId ".trim().toString()]||(()=>{}),vte=0;function $r(e){const[t,n]=v.useState(yte());return Zr(()=>{n(r=>r??String(vte++))},[e]),t?`radix-${t}`:""}const wte=["top","right","bottom","left"],Ci=Math.min,Ua=Math.max,lb=Math.round,tg=Math.floor,Uo=e=>({x:e,y:e}),Ete={left:"right",right:"left",bottom:"top",top:"bottom"},xte={start:"end",end:"start"};function mx(e,t,n){return Ua(e,Ci(t,n))}function As(e,t){return typeof e=="function"?e(t):e}function Is(e){return e.split("-")[0]}function Ju(e){return e.split("-")[1]}function S_(e){return e==="x"?"y":"x"}function __(e){return e==="y"?"height":"width"}const Ste=new Set(["top","bottom"]);function jo(e){return Ste.has(Is(e))?"y":"x"}function T_(e){return S_(jo(e))}function _te(e,t,n){n===void 0&&(n=!1);const r=Ju(e),a=T_(e),s=__(a);let i=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=cb(i)),[i,cb(i)]}function Tte(e){const t=cb(e);return[hx(e),t,hx(t)]}function hx(e){return e.replace(/start|end/g,t=>xte[t])}const Ij=["left","right"],Oj=["right","left"],Nte=["top","bottom"],kte=["bottom","top"];function Cte(e,t,n){switch(e){case"top":case"bottom":return n?t?Oj:Ij:t?Ij:Oj;case"left":case"right":return t?Nte:kte;default:return[]}}function Rte(e,t,n,r){const a=Ju(e);let s=Cte(Is(e),n==="start",r);return a&&(s=s.map(i=>i+"-"+a),t&&(s=s.concat(s.map(hx)))),s}function cb(e){return e.replace(/left|right|bottom|top/g,t=>Ete[t])}function Ate(e){return{top:0,right:0,bottom:0,left:0,...e}}function DF(e){return typeof e!="number"?Ate(e):{top:e,right:e,bottom:e,left:e}}function ub(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function Dj(e,t,n){let{reference:r,floating:a}=e;const s=jo(t),i=T_(t),c=__(i),u=Is(t),f=s==="y",m=r.x+r.width/2-a.width/2,h=r.y+r.height/2-a.height/2,b=r[c]/2-a[c]/2;let y;switch(u){case"top":y={x:m,y:r.y-a.height};break;case"bottom":y={x:m,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:h};break;case"left":y={x:r.x-a.width,y:h};break;default:y={x:r.x,y:r.y}}switch(Ju(t)){case"start":y[i]-=b*(n&&f?-1:1);break;case"end":y[i]+=b*(n&&f?-1:1);break}return y}const Ite=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:m,y:h}=Dj(f,r,u),b=r,y={},x=0;for(let E=0;E<c.length;E++){const{name:w,fn:_}=c[E],{x:S,y:T,data:R,reset:C}=await _({x:m,y:h,initialPlacement:r,placement:b,strategy:a,middlewareData:y,rects:f,platform:i,elements:{reference:e,floating:t}});m=S??m,h=T??h,y={...y,[w]:{...y[w],...R}},C&&x<=50&&(x++,typeof C=="object"&&(C.placement&&(b=C.placement),C.rects&&(f=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):C.rects),{x:m,y:h}=Dj(f,b,u)),E=-1)}return{x:m,y:h,placement:b,strategy:a,middlewareData:y}};async function Yf(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:s,rects:i,elements:c,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:h="floating",altBoundary:b=!1,padding:y=0}=As(t,e),x=DF(y),w=c[b?h==="floating"?"reference":"floating":h],_=ub(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:m,strategy:u})),S=h==="floating"?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),R=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},C=ub(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:S,offsetParent:T,strategy:u}):S);return{top:(_.top-C.top+x.top)/R.y,bottom:(C.bottom-_.bottom+x.bottom)/R.y,left:(_.left-C.left+x.left)/R.x,right:(C.right-_.right+x.right)/R.x}}const Ote=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:s,platform:i,elements:c,middlewareData:u}=t,{element:f,padding:m=0}=As(e,t)||{};if(f==null)return{};const h=DF(m),b={x:n,y:r},y=T_(a),x=__(y),E=await i.getDimensions(f),w=y==="y",_=w?"top":"left",S=w?"bottom":"right",T=w?"clientHeight":"clientWidth",R=s.reference[x]+s.reference[y]-b[y]-s.floating[x],C=b[y]-s.reference[y],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let A=I?I[T]:0;(!A||!await(i.isElement==null?void 0:i.isElement(I)))&&(A=c.floating[T]||s.floating[x]);const O=R/2-C/2,j=A/2-E[x]/2-1,U=Ci(h[_],j),B=Ci(h[S],j),W=U,J=A-E[x]-B,ee=A/2-E[x]/2+O,re=mx(W,ee,J),F=!u.arrow&&Ju(a)!=null&&ee!==re&&s.reference[x]/2-(ee<W?U:B)-E[x]/2<0,K=F?ee<W?ee-W:ee-J:0;return{[y]:b[y]+K,data:{[y]:re,centerOffset:ee-re-K,...F&&{alignmentOffset:K}},reset:F}}}),Dte=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:s,rects:i,initialPlacement:c,platform:u,elements:f}=t,{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:b,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:E=!0,...w}=As(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const _=Is(a),S=jo(c),T=Is(c)===c,R=await(u.isRTL==null?void 0:u.isRTL(f.floating)),C=b||(T||!E?[cb(c)]:Tte(c)),I=x!=="none";!b&&I&&C.push(...Rte(c,E,x,R));const A=[c,...C],O=await Yf(t,w),j=[];let U=((r=s.flip)==null?void 0:r.overflows)||[];if(m&&j.push(O[_]),h){const ee=_te(a,i,R);j.push(O[ee[0]],O[ee[1]])}if(U=[...U,{placement:a,overflows:j}],!j.every(ee=>ee<=0)){var B,W;const ee=(((B=s.flip)==null?void 0:B.index)||0)+1,re=A[ee];if(re&&(!(h==="alignment"?S!==jo(re):!1)||U.every(V=>jo(V.placement)===S?V.overflows[0]>0:!0)))return{data:{index:ee,overflows:U},reset:{placement:re}};let F=(W=U.filter(K=>K.overflows[0]<=0).sort((K,V)=>K.overflows[1]-V.overflows[1])[0])==null?void 0:W.placement;if(!F)switch(y){case"bestFit":{var J;const K=(J=U.filter(V=>{if(I){const ne=jo(V.placement);return ne===S||ne==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(ne=>ne>0).reduce((ne,te)=>ne+te,0)]).sort((V,ne)=>V[1]-ne[1])[0])==null?void 0:J[0];K&&(F=K);break}case"initialPlacement":F=c;break}if(a!==F)return{reset:{placement:F}}}return{}}}};function Lj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mj(e){return wte.some(t=>e[t]>=0)}const Lte=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=As(e,t);switch(r){case"referenceHidden":{const s=await Yf(t,{...a,elementContext:"reference"}),i=Lj(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Mj(i)}}}case"escaped":{const s=await Yf(t,{...a,altBoundary:!0}),i=Lj(s,n.floating);return{data:{escapedOffsets:i,escaped:Mj(i)}}}default:return{}}}}},LF=new Set(["left","top"]);async function Mte(e,t){const{placement:n,platform:r,elements:a}=e,s=await(r.isRTL==null?void 0:r.isRTL(a.floating)),i=Is(n),c=Ju(n),u=jo(n)==="y",f=LF.has(i)?-1:1,m=s&&u?-1:1,h=As(t,e);let{mainAxis:b,crossAxis:y,alignmentAxis:x}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof x=="number"&&(y=c==="end"?x*-1:x),u?{x:y*m,y:b*f}:{x:b*f,y:y*m}}const jte=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:s,placement:i,middlewareData:c}=t,u=await Mte(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:a+u.x,y:s+u.y,data:{...u,placement:i}}}}},Pte=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:_,y:S}=w;return{x:_,y:S}}},...u}=As(e,t),f={x:n,y:r},m=await Yf(t,u),h=jo(Is(a)),b=S_(h);let y=f[b],x=f[h];if(s){const w=b==="y"?"top":"left",_=b==="y"?"bottom":"right",S=y+m[w],T=y-m[_];y=mx(S,y,T)}if(i){const w=h==="y"?"top":"left",_=h==="y"?"bottom":"right",S=x+m[w],T=x-m[_];x=mx(S,x,T)}const E=c.fn({...t,[b]:y,[h]:x});return{...E,data:{x:E.x-n,y:E.y-r,enabled:{[b]:s,[h]:i}}}}}},Ute=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:u=!0,crossAxis:f=!0}=As(e,t),m={x:n,y:r},h=jo(a),b=S_(h);let y=m[b],x=m[h];const E=As(c,t),w=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:0,crossAxis:0,...E};if(u){const T=b==="y"?"height":"width",R=s.reference[b]-s.floating[T]+w.mainAxis,C=s.reference[b]+s.reference[T]-w.mainAxis;y<R?y=R:y>C&&(y=C)}if(f){var _,S;const T=b==="y"?"width":"height",R=LF.has(Is(a)),C=s.reference[h]-s.floating[T]+(R&&((_=i.offset)==null?void 0:_[h])||0)+(R?0:w.crossAxis),I=s.reference[h]+s.reference[T]+(R?0:((S=i.offset)==null?void 0:S[h])||0)-(R?w.crossAxis:0);x<C?x=C:x>I&&(x=I)}return{[b]:y,[h]:x}}}},$te=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:s,platform:i,elements:c}=t,{apply:u=()=>{},...f}=As(e,t),m=await Yf(t,f),h=Is(a),b=Ju(a),y=jo(a)==="y",{width:x,height:E}=s.floating;let w,_;h==="top"||h==="bottom"?(w=h,_=b===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(_=h,w=b==="end"?"top":"bottom");const S=E-m.top-m.bottom,T=x-m.left-m.right,R=Ci(E-m[w],S),C=Ci(x-m[_],T),I=!t.middlewareData.shift;let A=R,O=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(A=S),I&&!b){const U=Ua(m.left,0),B=Ua(m.right,0),W=Ua(m.top,0),J=Ua(m.bottom,0);y?O=x-2*(U!==0||B!==0?U+B:Ua(m.left,m.right)):A=E-2*(W!==0||J!==0?W+J:Ua(m.top,m.bottom))}await u({...t,availableWidth:O,availableHeight:A});const j=await i.getDimensions(c.floating);return x!==j.width||E!==j.height?{reset:{rects:!0}}:{}}}};function uy(){return typeof window<"u"}function Qu(e){return MF(e)?(e.nodeName||"").toLowerCase():"#document"}function $a(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Wo(e){var t;return(t=(MF(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function MF(e){return uy()?e instanceof Node||e instanceof $a(e).Node:!1}function Eo(e){return uy()?e instanceof Element||e instanceof $a(e).Element:!1}function Ho(e){return uy()?e instanceof HTMLElement||e instanceof $a(e).HTMLElement:!1}function jj(e){return!uy()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $a(e).ShadowRoot}const zte=new Set(["inline","contents"]);function kp(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=xo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!zte.has(a)}const Fte=new Set(["table","td","th"]);function Bte(e){return Fte.has(Qu(e))}const Hte=[":popover-open",":modal"];function dy(e){return Hte.some(t=>{try{return e.matches(t)}catch{return!1}})}const Vte=["transform","translate","scale","rotate","perspective"],Gte=["transform","translate","scale","rotate","perspective","filter"],Wte=["paint","layout","strict","content"];function N_(e){const t=k_(),n=Eo(e)?xo(e):e;return Vte.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Gte.some(r=>(n.willChange||"").includes(r))||Wte.some(r=>(n.contain||"").includes(r))}function Kte(e){let t=Ri(e);for(;Ho(t)&&!Au(t);){if(N_(t))return t;if(dy(t))return null;t=Ri(t)}return null}function k_(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Yte=new Set(["html","body","#document"]);function Au(e){return Yte.has(Qu(e))}function xo(e){return $a(e).getComputedStyle(e)}function fy(e){return Eo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ri(e){if(Qu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jj(e)&&e.host||Wo(e);return jj(t)?t.host:t}function jF(e){const t=Ri(e);return Au(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ho(t)&&kp(t)?t:jF(t)}function Zf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=jF(e),s=a===((r=e.ownerDocument)==null?void 0:r.body),i=$a(a);if(s){const c=gx(i);return t.concat(i,i.visualViewport||[],kp(a)?a:[],c&&n?Zf(c):[])}return t.concat(a,Zf(a,[],n))}function gx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function PF(e){const t=xo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Ho(e),s=a?e.offsetWidth:n,i=a?e.offsetHeight:r,c=lb(n)!==s||lb(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function C_(e){return Eo(e)?e:e.contextElement}function iu(e){const t=C_(e);if(!Ho(t))return Uo(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:s}=PF(t);let i=(s?lb(n.width):n.width)/r,c=(s?lb(n.height):n.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Zte=Uo(0);function UF(e){const t=$a(e);return!k_()||!t.visualViewport?Zte:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qte(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==$a(e)?!1:t}function kl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=C_(e);let i=Uo(1);t&&(r?Eo(r)&&(i=iu(r)):i=iu(e));const c=qte(s,n,r)?UF(s):Uo(0);let u=(a.left+c.x)/i.x,f=(a.top+c.y)/i.y,m=a.width/i.x,h=a.height/i.y;if(s){const b=$a(s),y=r&&Eo(r)?$a(r):r;let x=b,E=gx(x);for(;E&&r&&y!==x;){const w=iu(E),_=E.getBoundingClientRect(),S=xo(E),T=_.left+(E.clientLeft+parseFloat(S.paddingLeft))*w.x,R=_.top+(E.clientTop+parseFloat(S.paddingTop))*w.y;u*=w.x,f*=w.y,m*=w.x,h*=w.y,u+=T,f+=R,x=$a(E),E=gx(x)}}return ub({width:m,height:h,x:u,y:f})}function py(e,t){const n=fy(e).scrollLeft;return t?t.left+n:kl(Wo(e)).left+n}function $F(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-py(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function Xte(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const s=a==="fixed",i=Wo(r),c=t?dy(t.floating):!1;if(r===i||c&&s)return n;let u={scrollLeft:0,scrollTop:0},f=Uo(1);const m=Uo(0),h=Ho(r);if((h||!h&&!s)&&((Qu(r)!=="body"||kp(i))&&(u=fy(r)),Ho(r))){const y=kl(r);f=iu(r),m.x=y.x+r.clientLeft,m.y=y.y+r.clientTop}const b=i&&!h&&!s?$F(i,u):Uo(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+m.x+b.x,y:n.y*f.y-u.scrollTop*f.y+m.y+b.y}}function Jte(e){return Array.from(e.getClientRects())}function Qte(e){const t=Wo(e),n=fy(e),r=e.ownerDocument.body,a=Ua(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ua(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+py(e);const c=-n.scrollTop;return xo(r).direction==="rtl"&&(i+=Ua(t.clientWidth,r.clientWidth)-a),{width:a,height:s,x:i,y:c}}const Pj=25;function ene(e,t){const n=$a(e),r=Wo(e),a=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,u=0;if(a){s=a.width,i=a.height;const m=k_();(!m||m&&t==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const f=py(r);if(f<=0){const m=r.ownerDocument,h=m.body,b=getComputedStyle(h),y=m.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,x=Math.abs(r.clientWidth-h.clientWidth-y);x<=Pj&&(s-=x)}else f<=Pj&&(s+=f);return{width:s,height:i,x:c,y:u}}const tne=new Set(["absolute","fixed"]);function nne(e,t){const n=kl(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,s=Ho(e)?iu(e):Uo(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,u=a*s.x,f=r*s.y;return{width:i,height:c,x:u,y:f}}function Uj(e,t,n){let r;if(t==="viewport")r=ene(e,n);else if(t==="document")r=Qte(Wo(e));else if(Eo(t))r=nne(t,n);else{const a=UF(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return ub(r)}function zF(e,t){const n=Ri(e);return n===t||!Eo(n)||Au(n)?!1:xo(n).position==="fixed"||zF(n,t)}function rne(e,t){const n=t.get(e);if(n)return n;let r=Zf(e,[],!1).filter(c=>Eo(c)&&Qu(c)!=="body"),a=null;const s=xo(e).position==="fixed";let i=s?Ri(e):e;for(;Eo(i)&&!Au(i);){const c=xo(i),u=N_(i);!u&&c.position==="fixed"&&(a=null),(s?!u&&!a:!u&&c.position==="static"&&!!a&&tne.has(a.position)||kp(i)&&!u&&zF(e,i))?r=r.filter(m=>m!==i):a=c,i=Ri(i)}return t.set(e,r),r}function ane(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const i=[...n==="clippingAncestors"?dy(t)?[]:rne(t,this._c):[].concat(n),r],c=i[0],u=i.reduce((f,m)=>{const h=Uj(t,m,a);return f.top=Ua(h.top,f.top),f.right=Ci(h.right,f.right),f.bottom=Ci(h.bottom,f.bottom),f.left=Ua(h.left,f.left),f},Uj(t,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function one(e){const{width:t,height:n}=PF(e);return{width:t,height:n}}function sne(e,t,n){const r=Ho(t),a=Wo(t),s=n==="fixed",i=kl(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const u=Uo(0);function f(){u.x=py(a)}if(r||!r&&!s)if((Qu(t)!=="body"||kp(a))&&(c=fy(t)),r){const y=kl(t,!0,s,t);u.x=y.x+t.clientLeft,u.y=y.y+t.clientTop}else a&&f();s&&!r&&a&&f();const m=a&&!r&&!s?$F(a,c):Uo(0),h=i.left+c.scrollLeft-u.x-m.x,b=i.top+c.scrollTop-u.y-m.y;return{x:h,y:b,width:i.width,height:i.height}}function Gw(e){return xo(e).position==="static"}function $j(e,t){if(!Ho(e)||xo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Wo(e)===n&&(n=n.ownerDocument.body),n}function FF(e,t){const n=$a(e);if(dy(e))return n;if(!Ho(e)){let a=Ri(e);for(;a&&!Au(a);){if(Eo(a)&&!Gw(a))return a;a=Ri(a)}return n}let r=$j(e,t);for(;r&&Bte(r)&&Gw(r);)r=$j(r,t);return r&&Au(r)&&Gw(r)&&!N_(r)?n:r||Kte(e)||n}const ine=async function(e){const t=this.getOffsetParent||FF,n=this.getDimensions,r=await n(e.floating);return{reference:sne(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lne(e){return xo(e).direction==="rtl"}const cne={convertOffsetParentRelativeRectToViewportRelativeRect:Xte,getDocumentElement:Wo,getClippingRect:ane,getOffsetParent:FF,getElementRects:ine,getClientRects:Jte,getDimensions:one,getScale:iu,isElement:Eo,isRTL:lne};function BF(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function une(e,t){let n=null,r;const a=Wo(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),s();const f=e.getBoundingClientRect(),{left:m,top:h,width:b,height:y}=f;if(c||t(),!b||!y)return;const x=tg(h),E=tg(a.clientWidth-(m+b)),w=tg(a.clientHeight-(h+y)),_=tg(m),T={rootMargin:-x+"px "+-E+"px "+-w+"px "+-_+"px",threshold:Ua(0,Ci(1,u))||1};let R=!0;function C(I){const A=I[0].intersectionRatio;if(A!==u){if(!R)return i();A?i(!1,A):r=setTimeout(()=>{i(!1,1e-7)},1e3)}A===1&&!BF(f,e.getBoundingClientRect())&&i(),R=!1}try{n=new IntersectionObserver(C,{...T,root:a.ownerDocument})}catch{n=new IntersectionObserver(C,T)}n.observe(e)}return i(!0),s}function dne(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=C_(e),m=a||s?[...f?Zf(f):[],...Zf(t)]:[];m.forEach(_=>{a&&_.addEventListener("scroll",n,{passive:!0}),s&&_.addEventListener("resize",n)});const h=f&&c?une(f,n):null;let b=-1,y=null;i&&(y=new ResizeObserver(_=>{let[S]=_;S&&S.target===f&&y&&(y.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=y)==null||T.observe(t)})),n()}),f&&!u&&y.observe(f),y.observe(t));let x,E=u?kl(e):null;u&&w();function w(){const _=kl(e);E&&!BF(E,_)&&n(),E=_,x=requestAnimationFrame(w)}return n(),()=>{var _;m.forEach(S=>{a&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),h?.(),(_=y)==null||_.disconnect(),y=null,u&&cancelAnimationFrame(x)}}const fne=jte,pne=Pte,mne=Dte,hne=$te,gne=Lte,zj=Ote,bne=Ute,yne=(e,t,n)=>{const r=new Map,a={platform:cne,...n},s={...a.platform,_c:r};return Ite(e,t,{...a,platform:s})};var vne=typeof document<"u",wne=function(){},Ag=vne?v.useLayoutEffect:wne;function db(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!db(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const s=a[r];if(!(s==="_owner"&&e.$$typeof)&&!db(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function HF(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fj(e,t){const n=HF(e);return Math.round(t*n)/n}function Ww(e){const t=v.useRef(e);return Ag(()=>{t.current=e}),t}function Ene(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:u,open:f}=e,[m,h]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,y]=v.useState(r);db(b,r)||y(r);const[x,E]=v.useState(null),[w,_]=v.useState(null),S=v.useCallback(V=>{V!==I.current&&(I.current=V,E(V))},[]),T=v.useCallback(V=>{V!==A.current&&(A.current=V,_(V))},[]),R=s||x,C=i||w,I=v.useRef(null),A=v.useRef(null),O=v.useRef(m),j=u!=null,U=Ww(u),B=Ww(a),W=Ww(f),J=v.useCallback(()=>{if(!I.current||!A.current)return;const V={placement:t,strategy:n,middleware:b};B.current&&(V.platform=B.current),yne(I.current,A.current,V).then(ne=>{const te={...ne,isPositioned:W.current!==!1};ee.current&&!db(O.current,te)&&(O.current=te,Yu.flushSync(()=>{h(te)}))})},[b,t,n,B,W]);Ag(()=>{f===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,h(V=>({...V,isPositioned:!1})))},[f]);const ee=v.useRef(!1);Ag(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Ag(()=>{if(R&&(I.current=R),C&&(A.current=C),R&&C){if(U.current)return U.current(R,C,J);J()}},[R,C,J,U,j]);const re=v.useMemo(()=>({reference:I,floating:A,setReference:S,setFloating:T}),[S,T]),F=v.useMemo(()=>({reference:R,floating:C}),[R,C]),K=v.useMemo(()=>{const V={position:n,left:0,top:0};if(!F.floating)return V;const ne=Fj(F.floating,m.x),te=Fj(F.floating,m.y);return c?{...V,transform:"translate("+ne+"px, "+te+"px)",...HF(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ne,top:te}},[n,c,F.floating,m.x,m.y]);return v.useMemo(()=>({...m,update:J,refs:re,elements:F,floatingStyles:K}),[m,J,re,F,K])}const xne=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?zj({element:r.current,padding:a}).fn(n):{}:r?zj({element:r,padding:a}).fn(n):{}}}},Sne=(e,t)=>({...fne(e),options:[e,t]}),_ne=(e,t)=>({...pne(e),options:[e,t]}),Tne=(e,t)=>({...bne(e),options:[e,t]}),Nne=(e,t)=>({...mne(e),options:[e,t]}),kne=(e,t)=>({...hne(e),options:[e,t]}),Cne=(e,t)=>({...gne(e),options:[e,t]}),Rne=(e,t)=>({...xne(e),options:[e,t]});var Ane="Arrow",VF=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...s}=e;return d.jsx(_t.svg,{...s,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});VF.displayName=Ane;var Ine=VF;function R_(e){const[t,n]=v.useState(void 0);return Zr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let i,c;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;i=f.inlineSize,c=f.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var A_="Popper",[GF,Pi]=No(A_),[One,WF]=GF(A_),KF=e=>{const{__scopePopper:t,children:n}=e,[r,a]=v.useState(null);return d.jsx(One,{scope:t,anchor:r,onAnchorChange:a,children:n})};KF.displayName=A_;var YF="PopperAnchor",ZF=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,s=WF(YF,n),i=v.useRef(null),c=Jt(t,i),u=v.useRef(null);return v.useEffect(()=>{const f=u.current;u.current=r?.current||i.current,f!==u.current&&s.onAnchorChange(u.current)}),r?null:d.jsx(_t.div,{...a,ref:c})});ZF.displayName=YF;var I_="PopperContent",[Dne,Lne]=GF(I_),qF=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:s="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:b=!1,updatePositionStrategy:y="optimized",onPlaced:x,...E}=e,w=WF(I_,n),[_,S]=v.useState(null),T=Jt(t,G=>S(G)),[R,C]=v.useState(null),I=R_(R),A=I?.width??0,O=I?.height??0,j=r+(s!=="center"?"-"+s:""),U=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},B=Array.isArray(f)?f:[f],W=B.length>0,J={padding:U,boundary:B.filter(jne),altBoundary:W},{refs:ee,floatingStyles:re,placement:F,isPositioned:K,middlewareData:V}=Ene({strategy:"fixed",placement:j,whileElementsMounted:(...G)=>dne(...G,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[Sne({mainAxis:a+O,alignmentAxis:i}),u&&_ne({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Tne():void 0,...J}),u&&Nne({...J}),kne({...J,apply:({elements:G,rects:q,availableWidth:ae,availableHeight:ie})=>{const{width:X,height:Z}=q.reference,se=G.floating.style;se.setProperty("--radix-popper-available-width",`${ae}px`),se.setProperty("--radix-popper-available-height",`${ie}px`),se.setProperty("--radix-popper-anchor-width",`${X}px`),se.setProperty("--radix-popper-anchor-height",`${Z}px`)}}),R&&Rne({element:R,padding:c}),Pne({arrowWidth:A,arrowHeight:O}),b&&Cne({strategy:"referenceHidden",...J})]}),[ne,te]=QF(F),D=Bo(x);Zr(()=>{K&&D?.()},[K,D]);const H=V.arrow?.x,$=V.arrow?.y,L=V.arrow?.centerOffset!==0,[M,z]=v.useState();return Zr(()=>{_&&z(window.getComputedStyle(_).zIndex)},[_]),d.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...re,transform:K?re.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:M,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(Dne,{scope:n,placedSide:ne,onArrowChange:C,arrowX:H,arrowY:$,shouldHideArrow:L,children:d.jsx(_t.div,{"data-side":ne,"data-align":te,...E,ref:T,style:{...E.style,animation:K?void 0:"none"}})})})});qF.displayName=I_;var XF="PopperArrow",Mne={top:"bottom",right:"left",bottom:"top",left:"right"},JF=v.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,s=Lne(XF,r),i=Mne[s.placedSide];return d.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:d.jsx(Ine,{...a,ref:n,style:{...a.style,display:"block"}})})});JF.displayName=XF;function jne(e){return e!==null}var Pne=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,i=a.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[f,m]=QF(n),h={start:"0%",center:"50%",end:"100%"}[m],b=(a.arrow?.x??0)+c/2,y=(a.arrow?.y??0)+u/2;let x="",E="";return f==="bottom"?(x=i?h:`${b}px`,E=`${-u}px`):f==="top"?(x=i?h:`${b}px`,E=`${r.floating.height+u}px`):f==="right"?(x=`${-u}px`,E=i?h:`${y}px`):f==="left"&&(x=`${r.floating.width+u}px`,E=i?h:`${y}px`),{data:{x,y:E}}}});function QF(e){const[t,n="center"]=e.split("-");return[t,n]}var my=KF,Cp=ZF,hy=qF,gy=JF,Une="Portal",ed=v.forwardRef((e,t)=>{const{container:n,...r}=e,[a,s]=v.useState(!1);Zr(()=>s(!0),[]);const i=n||a&&globalThis?.document?.body;return i?cF.createPortal(d.jsx(_t.div,{...r,ref:t}),i):null});ed.displayName=Une;function $ne(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var za=e=>{const{present:t,children:n}=e,r=zne(t),a=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Jt(r.ref,Fne(a));return typeof n=="function"||r.isPresent?v.cloneElement(a,{ref:s}):null};za.displayName="Presence";function zne(e){const[t,n]=v.useState(),r=v.useRef(null),a=v.useRef(e),s=v.useRef("none"),i=e?"mounted":"unmounted",[c,u]=$ne(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const f=ng(r.current);s.current=c==="mounted"?f:"none"},[c]),Zr(()=>{const f=r.current,m=a.current;if(m!==e){const b=s.current,y=ng(f);e?u("MOUNT"):y==="none"||f?.display==="none"?u("UNMOUNT"):u(m&&b!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,u]),Zr(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,h=y=>{const E=ng(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&E&&(u("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},b=y=>{y.target===t&&(s.current=ng(r.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:v.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function ng(e){return e?.animationName||"none"}function Fne(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Kw="rovingFocusGroup.onEntryFocus",Bne={bubbles:!1,cancelable:!0},Rp="RovingFocusGroup",[bx,e4,Hne]=E_(Rp),[Vne,t4]=No(Rp,[Hne]),[Gne,Wne]=Vne(Rp),n4=v.forwardRef((e,t)=>d.jsx(bx.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(bx.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Kne,{...e,ref:t})})}));n4.displayName=Rp;var Kne=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...h}=e,b=v.useRef(null),y=Jt(t,b),x=x_(s),[E,w]=Rs({prop:i,defaultProp:c??null,onChange:u,caller:Rp}),[_,S]=v.useState(!1),T=Bo(f),R=e4(n),C=v.useRef(!1),[I,A]=v.useState(0);return v.useEffect(()=>{const O=b.current;if(O)return O.addEventListener(Kw,T),()=>O.removeEventListener(Kw,T)},[T]),d.jsx(Gne,{scope:n,orientation:r,dir:x,loop:a,currentTabStopId:E,onItemFocus:v.useCallback(O=>w(O),[w]),onItemShiftTab:v.useCallback(()=>S(!0),[]),onFocusableItemAdd:v.useCallback(()=>A(O=>O+1),[]),onFocusableItemRemove:v.useCallback(()=>A(O=>O-1),[]),children:d.jsx(_t.div,{tabIndex:_||I===0?-1:0,"data-orientation":r,...h,ref:y,style:{outline:"none",...e.style},onMouseDown:Ve(e.onMouseDown,()=>{C.current=!0}),onFocus:Ve(e.onFocus,O=>{const j=!C.current;if(O.target===O.currentTarget&&j&&!_){const U=new CustomEvent(Kw,Bne);if(O.currentTarget.dispatchEvent(U),!U.defaultPrevented){const B=R().filter(F=>F.focusable),W=B.find(F=>F.active),J=B.find(F=>F.id===E),re=[W,J,...B].filter(Boolean).map(F=>F.ref.current);o4(re,m)}}C.current=!1}),onBlur:Ve(e.onBlur,()=>S(!1))})})}),r4="RovingFocusGroupItem",a4=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:s,children:i,...c}=e,u=$r(),f=s||u,m=Wne(r4,n),h=m.currentTabStopId===f,b=e4(n),{onFocusableItemAdd:y,onFocusableItemRemove:x,currentTabStopId:E}=m;return v.useEffect(()=>{if(r)return y(),()=>x()},[r,y,x]),d.jsx(bx.ItemSlot,{scope:n,id:f,focusable:r,active:a,children:d.jsx(_t.span,{tabIndex:h?0:-1,"data-orientation":m.orientation,...c,ref:t,onMouseDown:Ve(e.onMouseDown,w=>{r?m.onItemFocus(f):w.preventDefault()}),onFocus:Ve(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:Ve(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){m.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const _=qne(w,m.orientation,m.dir);if(_!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let T=b().filter(R=>R.focusable).map(R=>R.ref.current);if(_==="last")T.reverse();else if(_==="prev"||_==="next"){_==="prev"&&T.reverse();const R=T.indexOf(w.currentTarget);T=m.loop?Xne(T,R+1):T.slice(R+1)}setTimeout(()=>o4(T))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:E!=null}):i})})});a4.displayName=r4;var Yne={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zne(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qne(e,t,n){const r=Zne(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Yne[r]}function o4(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Xne(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Jne=n4,Qne=a4,ere=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ac=new WeakMap,rg=new WeakMap,ag={},Yw=0,s4=function(e){return e&&(e.host||s4(e.parentNode))},tre=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=s4(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},nre=function(e,t,n,r){var a=tre(t,Array.isArray(e)?e:[e]);ag[n]||(ag[n]=new WeakMap);var s=ag[n],i=[],c=new Set,u=new Set(a),f=function(h){!h||c.has(h)||(c.add(h),f(h.parentNode))};a.forEach(f);var m=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(b){if(c.has(b))m(b);else try{var y=b.getAttribute(r),x=y!==null&&y!=="false",E=(Ac.get(b)||0)+1,w=(s.get(b)||0)+1;Ac.set(b,E),s.set(b,w),i.push(b),E===1&&x&&rg.set(b,!0),w===1&&b.setAttribute(n,"true"),x||b.setAttribute(r,"true")}catch(_){console.error("aria-hidden: cannot operate on ",b,_)}})};return m(t),c.clear(),Yw++,function(){i.forEach(function(h){var b=Ac.get(h)-1,y=s.get(h)-1;Ac.set(h,b),s.set(h,y),b||(rg.has(h)||h.removeAttribute(r),rg.delete(h)),y||h.removeAttribute(n)}),Yw--,Yw||(Ac=new WeakMap,Ac=new WeakMap,rg=new WeakMap,ag={})}},by=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=ere(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),nre(r,a,n,"aria-hidden")):function(){return null}},Mo=function(){return Mo=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Mo.apply(this,arguments)};function i4(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function rre(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,s;r<a;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Ig="right-scroll-bar-position",Og="width-before-scroll-bar",are="with-scroll-bars-hidden",ore="--removed-body-scroll-bar-size";function Zw(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function sre(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var ire=typeof window<"u"?v.useLayoutEffect:v.useEffect,Bj=new WeakMap;function lre(e,t){var n=sre(null,function(r){return e.forEach(function(a){return Zw(a,r)})});return ire(function(){var r=Bj.get(n);if(r){var a=new Set(r),s=new Set(e),i=n.current;a.forEach(function(c){s.has(c)||Zw(c,null)}),s.forEach(function(c){a.has(c)||Zw(c,i)})}Bj.set(n,e)},[e]),n}function cre(e){return e}function ure(e,t){t===void 0&&(t=cre);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(s),i=n}var u=function(){var m=i;i=[],m.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(m){i.push(m),f()},filter:function(m){return i=i.filter(m),n}}}};return a}function dre(e){e===void 0&&(e={});var t=ure(null);return t.options=Mo({async:!0,ssr:!1},e),t}var l4=function(e){var t=e.sideCar,n=i4(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,Mo({},n))};l4.isSideCarExport=!0;function fre(e,t){return e.useMedium(t),l4}var c4=dre(),qw=function(){},yy=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:qw,onWheelCapture:qw,onTouchMoveCapture:qw}),a=r[0],s=r[1],i=e.forwardProps,c=e.children,u=e.className,f=e.removeScrollBar,m=e.enabled,h=e.shards,b=e.sideCar,y=e.noRelative,x=e.noIsolation,E=e.inert,w=e.allowPinchZoom,_=e.as,S=_===void 0?"div":_,T=e.gapMode,R=i4(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=b,I=lre([n,t]),A=Mo(Mo({},R),a);return v.createElement(v.Fragment,null,m&&v.createElement(C,{sideCar:c4,removeScrollBar:f,shards:h,noRelative:y,noIsolation:x,inert:E,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:T}),i?v.cloneElement(v.Children.only(c),Mo(Mo({},A),{ref:I})):v.createElement(S,Mo({},A,{className:u,ref:I}),c))});yy.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};yy.classNames={fullWidth:Og,zeroRight:Ig};var pre=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function mre(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=pre();return t&&e.setAttribute("nonce",t),e}function hre(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gre(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var bre=function(){var e=0,t=null;return{add:function(n){e==0&&(t=mre())&&(hre(t,n),gre(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},yre=function(){var e=bre();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},u4=function(){var e=yre(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},vre={left:0,top:0,right:0,gap:0},Xw=function(e){return parseInt(e||"",10)||0},wre=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[Xw(n),Xw(r),Xw(a)]},Ere=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return vre;var t=wre(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},xre=u4(),lu="data-scroll-locked",Sre=function(e,t,n,r){var a=e.left,s=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
61
61
  .`.concat(are,` {
@@ -97,7 +97,7 @@ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}
97
97
  `)},Hj=function(){var e=parseInt(document.body.getAttribute(lu)||"0",10);return isFinite(e)?e:0},_re=function(){v.useEffect(function(){return document.body.setAttribute(lu,(Hj()+1).toString()),function(){var e=Hj()-1;e<=0?document.body.removeAttribute(lu):document.body.setAttribute(lu,e.toString())}},[])},Tre=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;_re();var s=v.useMemo(function(){return Ere(a)},[a]);return v.createElement(xre,{styles:Sre(s,!t,a,n?"":"!important")})},yx=!1;if(typeof window<"u")try{var og=Object.defineProperty({},"passive",{get:function(){return yx=!0,!0}});window.addEventListener("test",og,og),window.removeEventListener("test",og,og)}catch{yx=!1}var Ic=yx?{passive:!1}:!1,Nre=function(e){return e.tagName==="TEXTAREA"},d4=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Nre(e)&&n[t]==="visible")},kre=function(e){return d4(e,"overflowY")},Cre=function(e){return d4(e,"overflowX")},Vj=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=f4(e,r);if(a){var s=p4(e,r),i=s[1],c=s[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Rre=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Are=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},f4=function(e,t){return e==="v"?kre(t):Cre(t)},p4=function(e,t){return e==="v"?Rre(t):Are(t)},Ire=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ore=function(e,t,n,r,a){var s=Ire(e,window.getComputedStyle(t).direction),i=s*r,c=n.target,u=t.contains(c),f=!1,m=i>0,h=0,b=0;do{if(!c)break;var y=p4(e,c),x=y[0],E=y[1],w=y[2],_=E-w-s*x;(x||_)&&f4(e,c)&&(h+=_,b+=x);var S=c.parentNode;c=S&&S.nodeType===Node.DOCUMENT_FRAGMENT_NODE?S.host:S}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(m&&Math.abs(h)<1||!m&&Math.abs(b)<1)&&(f=!0),f},sg=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Gj=function(e){return[e.deltaX,e.deltaY]},Wj=function(e){return e&&"current"in e?e.current:e},Dre=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Lre=function(e){return`
98
98
  .block-interactivity-`.concat(e,` {pointer-events: none;}
99
99
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
100
- `)},Mre=0,Oc=[];function jre(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),a=v.useState(Mre++)[0],s=v.useState(u4)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var E=rre([e.lockRef.current],(e.shards||[]).map(Wj),!0).filter(Boolean);return E.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),E.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=v.useCallback(function(E,w){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!i.current.allowPinchZoom;var _=sg(E),S=n.current,T="deltaX"in E?E.deltaX:S[0]-_[0],R="deltaY"in E?E.deltaY:S[1]-_[1],C,I=E.target,A=Math.abs(T)>Math.abs(R)?"h":"v";if("touches"in E&&A==="h"&&I.type==="range")return!1;var O=Vj(A,I);if(!O)return!0;if(O?C=A:(C=A==="v"?"h":"v",O=Vj(A,I)),!O)return!1;if(!r.current&&"changedTouches"in E&&(T||R)&&(r.current=C),!C)return!0;var j=r.current||C;return Ore(j,w,E,j==="h"?T:R)},[]),u=v.useCallback(function(E){var w=E;if(!(!Oc.length||Oc[Oc.length-1]!==s)){var _="deltaY"in w?Gj(w):sg(w),S=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&Dre(C.delta,_)})[0];if(S&&S.should){w.cancelable&&w.preventDefault();return}if(!S){var T=(i.current.shards||[]).map(Wj).filter(Boolean).filter(function(C){return C.contains(w.target)}),R=T.length>0?c(w,T[0]):!i.current.noIsolation;R&&w.cancelable&&w.preventDefault()}}},[]),f=v.useCallback(function(E,w,_,S){var T={name:E,delta:w,target:_,should:S,shadowParent:Pre(_)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(R){return R!==T})},1)},[]),m=v.useCallback(function(E){n.current=sg(E),r.current=void 0},[]),h=v.useCallback(function(E){f(E.type,Gj(E),E.target,c(E,e.lockRef.current))},[]),b=v.useCallback(function(E){f(E.type,sg(E),E.target,c(E,e.lockRef.current))},[]);v.useEffect(function(){return Oc.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:b}),document.addEventListener("wheel",u,Ic),document.addEventListener("touchmove",u,Ic),document.addEventListener("touchstart",m,Ic),function(){Oc=Oc.filter(function(E){return E!==s}),document.removeEventListener("wheel",u,Ic),document.removeEventListener("touchmove",u,Ic),document.removeEventListener("touchstart",m,Ic)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(s,{styles:Lre(a)}):null,y?v.createElement(Tre,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Pre(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Ure=fre(c4,jre);var Ap=v.forwardRef(function(e,t){return v.createElement(yy,Mo({},e,{ref:t,sideCar:Ure}))});Ap.classNames=yy.classNames;var vx=["Enter"," "],$re=["ArrowDown","PageUp","Home"],m4=["ArrowUp","PageDown","End"],zre=[...$re,...m4],Fre={ltr:[...vx,"ArrowRight"],rtl:[...vx,"ArrowLeft"]},Bre={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ip="Menu",[qf,Hre,Vre]=E_(Ip),[$l,h4]=No(Ip,[Vre,Pi,t4]),vy=Pi(),g4=t4(),[Gre,zl]=$l(Ip),[Wre,Op]=$l(Ip),b4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:s,modal:i=!0}=e,c=vy(t),[u,f]=v.useState(null),m=v.useRef(!1),h=Bo(s),b=x_(a);return v.useEffect(()=>{const y=()=>{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",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),d.jsx(my,{...c,children:d.jsx(Gre,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:f,children:d.jsx(Wre,{scope:t,onClose:v.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:b,modal:i,children:r})})})};b4.displayName=Ip;var Kre="MenuAnchor",O_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=vy(n);return d.jsx(Cp,{...a,...r,ref:t})});O_.displayName=Kre;var D_="MenuPortal",[Yre,y4]=$l(D_,{forceMount:void 0}),v4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,s=zl(D_,t);return d.jsx(Yre,{scope:t,forceMount:n,children:d.jsx(za,{present:n||s.open,children:d.jsx(ed,{asChild:!0,container:a,children:r})})})};v4.displayName=D_;var to="MenuContent",[Zre,L_]=$l(to),w4=v.forwardRef((e,t)=>{const n=y4(to,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,s=zl(to,e.__scopeMenu),i=Op(to,e.__scopeMenu);return d.jsx(qf.Provider,{scope:e.__scopeMenu,children:d.jsx(za,{present:r||s.open,children:d.jsx(qf.Slot,{scope:e.__scopeMenu,children:i.modal?d.jsx(qre,{...a,ref:t}):d.jsx(Xre,{...a,ref:t})})})})}),qre=v.forwardRef((e,t)=>{const n=zl(to,e.__scopeMenu),r=v.useRef(null),a=Jt(t,r);return v.useEffect(()=>{const s=r.current;if(s)return by(s)},[]),d.jsx(M_,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ve(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Xre=v.forwardRef((e,t)=>{const n=zl(to,e.__scopeMenu);return d.jsx(M_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Jre=Nl("MenuContent.ScrollLock"),M_=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:b,onDismiss:y,disableOutsideScroll:x,...E}=e,w=zl(to,n),_=Op(to,n),S=vy(n),T=g4(n),R=Hre(n),[C,I]=v.useState(null),A=v.useRef(null),O=Jt(t,A,w.onContentChange),j=v.useRef(0),U=v.useRef(""),B=v.useRef(0),W=v.useRef(null),J=v.useRef("right"),ee=v.useRef(0),re=x?Ap:v.Fragment,F=x?{as:Jre,allowPinchZoom:!0}:void 0,K=ne=>{const te=U.current+ne,D=R().filter(G=>!G.disabled),H=document.activeElement,$=D.find(G=>G.ref.current===H)?.textValue,L=D.map(G=>G.textValue),M=uae(L,te,$),z=D.find(G=>G.textValue===M)?.ref.current;(function G(q){U.current=q,window.clearTimeout(j.current),q!==""&&(j.current=window.setTimeout(()=>G(""),1e3))})(te),z&&setTimeout(()=>z.focus())};v.useEffect(()=>()=>window.clearTimeout(j.current),[]),cy();const V=v.useCallback(ne=>J.current===W.current?.side&&fae(ne,W.current?.area),[]);return d.jsx(Zre,{scope:n,searchRef:U,onItemEnter:v.useCallback(ne=>{V(ne)&&ne.preventDefault()},[V]),onItemLeave:v.useCallback(ne=>{V(ne)||(A.current?.focus(),I(null))},[V]),onTriggerLeave:v.useCallback(ne=>{V(ne)&&ne.preventDefault()},[V]),pointerGraceTimerRef:B,onPointerGraceIntentChange:v.useCallback(ne=>{W.current=ne},[]),children:d.jsx(re,{...F,children:d.jsx(Np,{asChild:!0,trapped:a,onMountAutoFocus:Ve(s,ne=>{ne.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:d.jsx(Xu,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:b,onDismiss:y,children:d.jsx(Jne,{asChild:!0,...T,dir:_.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:I,onEntryFocus:Ve(u,ne=>{_.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(hy,{role:"menu","aria-orientation":"vertical","data-state":j4(w.open),"data-radix-menu-content":"",dir:_.dir,...S,...E,ref:O,style:{outline:"none",...E.style},onKeyDown:Ve(E.onKeyDown,ne=>{const D=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,H=ne.ctrlKey||ne.altKey||ne.metaKey,$=ne.key.length===1;D&&(ne.key==="Tab"&&ne.preventDefault(),!H&&$&&K(ne.key));const L=A.current;if(ne.target!==L||!zre.includes(ne.key))return;ne.preventDefault();const z=R().filter(G=>!G.disabled).map(G=>G.ref.current);m4.includes(ne.key)&&z.reverse(),lae(z)}),onBlur:Ve(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(j.current),U.current="")}),onPointerMove:Ve(e.onPointerMove,Xf(ne=>{const te=ne.target,D=ee.current!==ne.clientX;if(ne.currentTarget.contains(te)&&D){const H=ne.clientX>ee.current?"right":"left";J.current=H,ee.current=ne.clientX}}))})})})})})})});w4.displayName=to;var Qre="MenuGroup",j_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(_t.div,{role:"group",...r,ref:t})});j_.displayName=Qre;var eae="MenuLabel",E4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(_t.div,{...r,ref:t})});E4.displayName=eae;var fb="MenuItem",Kj="menu.itemSelect",wy=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,s=v.useRef(null),i=Op(fb,e.__scopeMenu),c=L_(fb,e.__scopeMenu),u=Jt(t,s),f=v.useRef(!1),m=()=>{const h=s.current;if(!n&&h){const b=new CustomEvent(Kj,{bubbles:!0,cancelable:!0});h.addEventListener(Kj,y=>r?.(y),{once:!0}),RF(h,b),b.defaultPrevented?f.current=!1:i.onClose()}};return d.jsx(x4,{...a,ref:u,disabled:n,onClick:Ve(e.onClick,m),onPointerDown:h=>{e.onPointerDown?.(h),f.current=!0},onPointerUp:Ve(e.onPointerUp,h=>{f.current||h.currentTarget?.click()}),onKeyDown:Ve(e.onKeyDown,h=>{const b=c.searchRef.current!=="";n||b&&h.key===" "||vx.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});wy.displayName=fb;var x4=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...s}=e,i=L_(fb,n),c=g4(n),u=v.useRef(null),f=Jt(t,u),[m,h]=v.useState(!1),[b,y]=v.useState("");return v.useEffect(()=>{const x=u.current;x&&y((x.textContent??"").trim())},[s.children]),d.jsx(qf.ItemSlot,{scope:n,disabled:r,textValue:a??b,children:d.jsx(Qne,{asChild:!0,...c,focusable:!r,children:d.jsx(_t.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:f,onPointerMove:Ve(e.onPointerMove,Xf(x=>{r?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ve(e.onPointerLeave,Xf(x=>i.onItemLeave(x))),onFocus:Ve(e.onFocus,()=>h(!0)),onBlur:Ve(e.onBlur,()=>h(!1))})})})}),tae="MenuCheckboxItem",S4=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return d.jsx(C4,{scope:e.__scopeMenu,checked:n,children:d.jsx(wy,{role:"menuitemcheckbox","aria-checked":pb(n)?"mixed":n,...a,ref:t,"data-state":U_(n),onSelect:Ve(a.onSelect,()=>r?.(pb(n)?!0:!n),{checkForDefaultPrevented:!1})})})});S4.displayName=tae;var _4="MenuRadioGroup",[nae,rae]=$l(_4,{value:void 0,onValueChange:()=>{}}),T4=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,s=Bo(r);return d.jsx(nae,{scope:e.__scopeMenu,value:n,onValueChange:s,children:d.jsx(j_,{...a,ref:t})})});T4.displayName=_4;var N4="MenuRadioItem",k4=v.forwardRef((e,t)=>{const{value:n,...r}=e,a=rae(N4,e.__scopeMenu),s=n===a.value;return d.jsx(C4,{scope:e.__scopeMenu,checked:s,children:d.jsx(wy,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":U_(s),onSelect:Ve(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});k4.displayName=N4;var P_="MenuItemIndicator",[C4,aae]=$l(P_,{checked:!1}),R4=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,s=aae(P_,n);return d.jsx(za,{present:r||pb(s.checked)||s.checked===!0,children:d.jsx(_t.span,{...a,ref:t,"data-state":U_(s.checked)})})});R4.displayName=P_;var oae="MenuSeparator",A4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(_t.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});A4.displayName=oae;var sae="MenuArrow",I4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=vy(n);return d.jsx(gy,{...a,...r,ref:t})});I4.displayName=sae;var iae="MenuSub",[Uve,O4]=$l(iae),hf="MenuSubTrigger",D4=v.forwardRef((e,t)=>{const n=zl(hf,e.__scopeMenu),r=Op(hf,e.__scopeMenu),a=O4(hf,e.__scopeMenu),s=L_(hf,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=s,f={__scopeMenu:e.__scopeMenu},m=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>m,[m]),v.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),u(null)}},[c,u]),d.jsx(O_,{asChild:!0,...f,children:d.jsx(x4,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":j4(n.open),...e,ref:Fo(t,a.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ve(e.onPointerMove,Xf(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ve(e.onPointerLeave,Xf(h=>{m();const b=n.content?.getBoundingClientRect();if(b){const y=n.content?.dataset.side,x=y==="right",E=x?-5:5,w=b[x?"left":"right"],_=b[x?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+E,y:h.clientY},{x:w,y:b.top},{x:_,y:b.top},{x:_,y:b.bottom},{x:w,y:b.bottom}],side:y}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ve(e.onKeyDown,h=>{const b=s.searchRef.current!=="";e.disabled||b&&h.key===" "||Fre[r.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});D4.displayName=hf;var L4="MenuSubContent",M4=v.forwardRef((e,t)=>{const n=y4(to,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,s=zl(to,e.__scopeMenu),i=Op(to,e.__scopeMenu),c=O4(L4,e.__scopeMenu),u=v.useRef(null),f=Jt(t,u);return d.jsx(qf.Provider,{scope:e.__scopeMenu,children:d.jsx(za,{present:r||s.open,children:d.jsx(qf.Slot,{scope:e.__scopeMenu,children:d.jsx(M_,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:f,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{i.isUsingKeyboardRef.current&&u.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ve(e.onFocusOutside,m=>{m.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ve(e.onEscapeKeyDown,m=>{i.onClose(),m.preventDefault()}),onKeyDown:Ve(e.onKeyDown,m=>{const h=m.currentTarget.contains(m.target),b=Bre[i.dir].includes(m.key);h&&b&&(s.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});M4.displayName=L4;function j4(e){return e?"open":"closed"}function pb(e){return e==="indeterminate"}function U_(e){return pb(e)?"indeterminate":e?"checked":"unchecked"}function lae(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function cae(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function uae(e,t,n){const a=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=cae(e,Math.max(s,0));a.length===1&&(i=i.filter(f=>f!==n));const u=i.find(f=>f.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function dae(e,t){const{x:n,y:r}=e;let a=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const c=t[s],u=t[i],f=c.x,m=c.y,h=u.x,b=u.y;m>r!=b>r&&n<(h-f)*(r-m)/(b-m)+f&&(a=!a)}return a}function fae(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return dae(n,t)}function Xf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var pae=b4,mae=O_,hae=v4,gae=w4,bae=j_,yae=E4,vae=wy,wae=S4,Eae=T4,xae=k4,Sae=R4,_ae=A4,Tae=I4,Nae=D4,kae=M4,Ey="DropdownMenu",[Cae]=No(Ey,[h4]),ia=h4(),[Rae,P4]=Cae(Ey),U4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:s,onOpenChange:i,modal:c=!0}=e,u=ia(t),f=v.useRef(null),[m,h]=Rs({prop:a,defaultProp:s??!1,onChange:i,caller:Ey});return d.jsx(Rae,{scope:t,triggerId:$r(),triggerRef:f,contentId:$r(),open:m,onOpenChange:h,onOpenToggle:v.useCallback(()=>h(b=>!b),[h]),modal:c,children:d.jsx(pae,{...u,open:m,onOpenChange:h,dir:r,modal:c,children:n})})};U4.displayName=Ey;var $4="DropdownMenuTrigger",z4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,s=P4($4,n),i=ia(n);return d.jsx(mae,{asChild:!0,...i,children:d.jsx(_t.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:Fo(t,s.triggerRef),onPointerDown:Ve(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:Ve(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});z4.displayName=$4;var Aae="DropdownMenuPortal",F4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ia(t);return d.jsx(hae,{...r,...n})};F4.displayName=Aae;var B4="DropdownMenuContent",H4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=P4(B4,n),s=ia(n),i=v.useRef(!1);return d.jsx(gae,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...r,ref:t,onCloseAutoFocus:Ve(e.onCloseAutoFocus,c=>{i.current||a.triggerRef.current?.focus(),i.current=!1,c.preventDefault()}),onInteractOutside:Ve(e.onInteractOutside,c=>{const u=c.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,m=u.button===2||f;(!a.modal||m)&&(i.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)"}})});H4.displayName=B4;var Iae="DropdownMenuGroup",Oae=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(bae,{...a,...r,ref:t})});Oae.displayName=Iae;var Dae="DropdownMenuLabel",V4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(yae,{...a,...r,ref:t})});V4.displayName=Dae;var Lae="DropdownMenuItem",G4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(vae,{...a,...r,ref:t})});G4.displayName=Lae;var Mae="DropdownMenuCheckboxItem",W4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(wae,{...a,...r,ref:t})});W4.displayName=Mae;var jae="DropdownMenuRadioGroup",Pae=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(Eae,{...a,...r,ref:t})});Pae.displayName=jae;var Uae="DropdownMenuRadioItem",K4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(xae,{...a,...r,ref:t})});K4.displayName=Uae;var $ae="DropdownMenuItemIndicator",zae=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(Sae,{...a,...r,ref:t})});zae.displayName=$ae;var Fae="DropdownMenuSeparator",Y4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(_ae,{...a,...r,ref:t})});Y4.displayName=Fae;var Bae="DropdownMenuArrow",Hae=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(Tae,{...a,...r,ref:t})});Hae.displayName=Bae;var Vae="DropdownMenuSubTrigger",Z4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(Nae,{...a,...r,ref:t})});Z4.displayName=Vae;var Gae="DropdownMenuSubContent",q4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(kae,{...a,...r,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)"}})});q4.displayName=Gae;var Wae=U4,Kae=z4,Yae=F4,X4=H4,J4=V4,Q4=G4,Zae=W4,qae=K4,e3=Y4,Xae=Z4,Jae=q4;const wx=Wae,Ex=Kae;Xae.displayName;Jae.displayName;function mb({ref:e,className:t,sideOffset:n=4,...r}){return d.jsx(Yae,{children:d.jsx(X4,{ref:e,sideOffset:n,className:Oe("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),...r})})}mb.displayName=X4.displayName;function xs({ref:e,className:t,inset:n,...r}){return d.jsx(Q4,{ref:e,className:Oe("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),...r})}xs.displayName=Q4.displayName;Zae.displayName;qae.displayName;function xx({ref:e,className:t,inset:n,...r}){return d.jsx(J4,{ref:e,className:Oe("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...r})}xx.displayName=J4.displayName;function gf({ref:e,className:t,...n}){return d.jsx(e3,{ref:e,className:Oe("-mx-1 my-1 h-px bg-muted",t),...n})}gf.displayName=e3.displayName;var Qae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ps=Qae.reduce((e,t)=>{const n=dF(`Primitive.${t}`),r=v.forwardRef((a,s)=>{const{asChild:i,...c}=a,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),eoe="Label",t3=v.forwardRef((e,t)=>d.jsx(Ps.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));t3.displayName=eoe;var toe=t3;function Wt({className:e,...t}){return d.jsx(toe,{"data-slot":"label",className:Oe("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 td({message:e,className:t="",vertical:n,noBorder:r}){return d.jsx("div",{className:Oe(`mt-2 rounded-md p-6 ${t}`,!r&&"border"),children:d.jsxs("p",{className:Oe("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[d.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:d.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:d.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[d.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"}),d.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),d.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),e]})})}function n3({className:e,color:t,children:n,grayscaled:r=!1}){const a=v.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return r?0:.2},[t,r]),s=v.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return r?.3:.4},[t,r]),i=v.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=v.useMemo(()=>t||`oklch(${Math.min(s,1)} ${a} ${i})`,[i,a,s]),u=v.useMemo(()=>`oklch(${Math.min(s*2,1)} ${a} ${i})`,[i,a,s,t]),f=v.useMemo(()=>Math.floor(Math.random()*360),[i]),m=v.useMemo(()=>"1000%",[]);return d.jsx("section",{className:Oe("relative w-full h-full overflow-hidden",e),style:{background:`${u}`},children:d.jsxs("div",{className:"isolate relative w-full h-full",children:[d.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${f}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${m})`}}),n&&d.jsx("div",{className:"relative z-10 w-full h-full",children:n})]})})}function $_(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xy="Switch",[noe]=No(xy),[roe,aoe]=noe(xy),r3=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:s,required:i,disabled:c,value:u="on",onCheckedChange:f,form:m,...h}=e,[b,y]=v.useState(null),x=Jt(t,T=>y(T)),E=v.useRef(!1),w=b?m||!!b.closest("form"):!0,[_,S]=Rs({prop:a,defaultProp:s??!1,onChange:f,caller:xy});return d.jsxs(roe,{scope:n,checked:_,disabled:c,children:[d.jsx(_t.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":i3(_),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:x,onClick:Ve(e.onClick,T=>{S(R=>!R),w&&(E.current=T.isPropagationStopped(),E.current||T.stopPropagation())})}),w&&d.jsx(s3,{control:b,bubbles:!E.current,name:r,value:u,checked:_,required:i,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});r3.displayName=xy;var a3="SwitchThumb",o3=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=aoe(a3,n);return d.jsx(_t.span,{"data-state":i3(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});o3.displayName=a3;var ooe="SwitchBubbleInput",s3=v.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},s)=>{const i=v.useRef(null),c=Jt(i,s),u=$_(n),f=R_(t);return v.useEffect(()=>{const m=i.current;if(!m)return;const h=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==n&&y){const x=new Event("click",{bubbles:r});y.call(m,n),m.dispatchEvent(x)}},[u,n,r]),d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});s3.displayName=ooe;function i3(e){return e?"checked":"unchecked"}var l3=r3,soe=o3;function Sy({ref:e,className:t,...n}){return d.jsx(l3,{className:Oe("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:d.jsx(soe,{className:Oe("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")})})}Sy.displayName=l3.displayName;var c3=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"}),ioe="VisuallyHidden",u3=v.forwardRef((e,t)=>d.jsx(_t.span,{...e,ref:t,style:{...c3,...e.style}}));u3.displayName=ioe;var loe=u3,[_y]=No("Tooltip",[Pi]),Ty=Pi(),d3="TooltipProvider",coe=700,Sx="tooltip.open",[uoe,z_]=_y(d3),f3=e=>{const{__scopeTooltip:t,delayDuration:n=coe,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:s}=e,i=v.useRef(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),d.jsx(uoe,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),i.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(f=>{c.current=f},[]),disableHoverableContent:a,children:s})};f3.displayName=d3;var Jf="Tooltip",[doe,Dp]=_y(Jf),p3=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:s,disableHoverableContent:i,delayDuration:c}=e,u=z_(Jf,e.__scopeTooltip),f=Ty(t),[m,h]=v.useState(null),b=$r(),y=v.useRef(0),x=i??u.disableHoverableContent,E=c??u.delayDuration,w=v.useRef(!1),[_,S]=Rs({prop:r,defaultProp:a??!1,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(Sx))):u.onClose(),s?.(A)},caller:Jf}),T=v.useMemo(()=>_?w.current?"delayed-open":"instant-open":"closed",[_]),R=v.useCallback(()=>{window.clearTimeout(y.current),y.current=0,w.current=!1,S(!0)},[S]),C=v.useCallback(()=>{window.clearTimeout(y.current),y.current=0,S(!1)},[S]),I=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{w.current=!0,S(!0),y.current=0},E)},[E,S]);return v.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),d.jsx(my,{...f,children:d.jsx(doe,{scope:t,contentId:b,open:_,stateAttribute:T,trigger:m,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{u.isOpenDelayedRef.current?I():R()},[u.isOpenDelayedRef,I,R]),onTriggerLeave:v.useCallback(()=>{x?C():(window.clearTimeout(y.current),y.current=0)},[C,x]),onOpen:R,onClose:C,disableHoverableContent:x,children:n})})};p3.displayName=Jf;var _x="TooltipTrigger",m3=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Dp(_x,n),s=z_(_x,n),i=Ty(n),c=v.useRef(null),u=Jt(t,c,a.onTriggerChange),f=v.useRef(!1),m=v.useRef(!1),h=v.useCallback(()=>f.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),d.jsx(Cp,{asChild:!0,...i,children:d.jsx(_t.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:u,onPointerMove:Ve(e.onPointerMove,b=>{b.pointerType!=="touch"&&!m.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{a.onTriggerLeave(),m.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ve(e.onFocus,()=>{f.current||a.onOpen()}),onBlur:Ve(e.onBlur,a.onClose),onClick:Ve(e.onClick,a.onClose)})})});m3.displayName=_x;var F_="TooltipPortal",[foe,poe]=_y(F_,{forceMount:void 0}),h3=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,s=Dp(F_,t);return d.jsx(foe,{scope:t,forceMount:n,children:d.jsx(za,{present:n||s.open,children:d.jsx(ed,{asChild:!0,container:a,children:r})})})};h3.displayName=F_;var Iu="TooltipContent",g3=v.forwardRef((e,t)=>{const n=poe(Iu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...s}=e,i=Dp(Iu,e.__scopeTooltip);return d.jsx(za,{present:r||i.open,children:i.disableHoverableContent?d.jsx(b3,{side:a,...s,ref:t}):d.jsx(moe,{side:a,...s,ref:t})})}),moe=v.forwardRef((e,t)=>{const n=Dp(Iu,e.__scopeTooltip),r=z_(Iu,e.__scopeTooltip),a=v.useRef(null),s=Jt(t,a),[i,c]=v.useState(null),{trigger:u,onClose:f}=n,m=a.current,{onPointerInTransitChange:h}=r,b=v.useCallback(()=>{c(null),h(!1)},[h]),y=v.useCallback((x,E)=>{const w=x.currentTarget,_={x:x.clientX,y:x.clientY},S=yoe(_,w.getBoundingClientRect()),T=voe(_,S),R=woe(E.getBoundingClientRect()),C=xoe([...T,...R]);c(C),h(!0)},[h]);return v.useEffect(()=>()=>b(),[b]),v.useEffect(()=>{if(u&&m){const x=w=>y(w,m),E=w=>y(w,u);return u.addEventListener("pointerleave",x),m.addEventListener("pointerleave",E),()=>{u.removeEventListener("pointerleave",x),m.removeEventListener("pointerleave",E)}}},[u,m,y,b]),v.useEffect(()=>{if(i){const x=E=>{const w=E.target,_={x:E.clientX,y:E.clientY},S=u?.contains(w)||m?.contains(w),T=!Eoe(_,i);S?b():T&&(b(),f())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,m,i,f,b]),d.jsx(b3,{...e,ref:s})}),[hoe,goe]=_y(Jf,{isInside:!1}),boe=Xee("TooltipContent"),b3=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:i,...c}=e,u=Dp(Iu,n),f=Ty(n),{onClose:m}=u;return v.useEffect(()=>(document.addEventListener(Sx,m),()=>document.removeEventListener(Sx,m)),[m]),v.useEffect(()=>{if(u.trigger){const h=b=>{b.target?.contains(u.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,m]),d.jsx(Xu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:d.jsxs(hy,{"data-state":u.stateAttribute,...f,...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:[d.jsx(boe,{children:r}),d.jsx(hoe,{scope:n,isInside:!0,children:d.jsx(loe,{id:u.contentId,role:"tooltip",children:a||r})})]})})});g3.displayName=Iu;var y3="TooltipArrow",v3=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Ty(n);return goe(y3,n).isInside?null:d.jsx(gy,{...a,...r,ref:t})});v3.displayName=y3;function yoe(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,a,s)){case s:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function voe(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function woe(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function Eoe(e,t){const{x:n,y:r}=e;let a=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const c=t[s],u=t[i],f=c.x,m=c.y,h=u.x,b=u.y;m>r!=b>r&&n<(h-f)*(r-m)/(b-m)+f&&(a=!a)}return a}function xoe(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Soe(t)}function Soe(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))n.pop();else break}n.push(a)}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 _oe=f3,Toe=p3,Noe=m3,koe=h3,Coe=g3,Roe=v3;function w3({delayDuration:e=0,...t}){return d.jsx(_oe,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ot({...e}){return d.jsx(w3,{children:d.jsx(Toe,{"data-slot":"tooltip",...e})})}function Dt({...e}){return d.jsx(Noe,{"data-slot":"tooltip-trigger",...e})}function Lt({className:e,sideOffset:t=0,children:n,...r}){return d.jsx(koe,{children:d.jsxs(Coe,{"data-slot":"tooltip-content",sideOffset:t,className:Oe("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),...r,children:[n,d.jsx(Roe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class Aoe{name="mcp_inspector_open";properties;constructor(t){this.properties={server_url:t.serverUrl,connection_count:t.connectionCount}}}class Yj{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 Zj{name="mcp_resource_read";properties;constructor(t){this.properties={resource_uri:t.resourceUri,server_id:t.serverId,success:t.success,error:t.error}}}class qj{name="mcp_prompt_call";properties;constructor(t){this.properties={prompt_name:t.promptName,server_id:t.serverId,success:t.success,error:t.error}}}class Xj{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 Ioe{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 Ooe{name="mcp_server_removed";properties;constructor(t){this.properties={server_id:t.serverId}}}class Doe{name="mcp_command_palette_open";properties;constructor(t){this.properties={trigger:t.trigger}}}class Loe{name="mcp_tool_saved";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId}}}function Jw(){try{return"0.12.0-canary.5"}catch{return"0.0.0"}}var Moe={};function Qw(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class Jj{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,r=setTimeout(()=>n.abort(),this.timeout),a=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(r),!a.ok)throw new Error(`HTTP error! status: ${a.status}`)}catch{}}}function di(e){return`mcp_inspector_telemetry_${e}`}class Tr{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=Qw(),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 Jj(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new Jj(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(di("disabled"))==="true"||typeof process<"u"&&Moe?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(di("source")):null}static getInstance(){return Tr.instance||(Tr.instance=new Tr),Tr.instance}setSource(t){this._source=t,typeof localStorage<"u"&&localStorage.setItem(di("source"),t)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!Qw())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const t=localStorage.getItem(di("user_id"));if(t)this._currUserId=t;else{const n=this.generateUserId();localStorage.setItem(di("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(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&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:Jw(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(n)}catch{}if(this._scarfClient)try{const n={};n.mcp_use_version=Jw(),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&&Qw())try{const n=Jw();let r=!1,a=!1;const s=localStorage.getItem(di("download_version"));if(s?n>s&&(r=!0,a=!1,localStorage.setItem(di("download_version"),n)):(r=!0,a=!0,localStorage.setItem(di("download_version"),n)),r){const i={...t||{}};i.mcp_use_version=n,i.user_id=this.userId,i.event="package_download",i.first_download=a,i.language="typescript",i.source=this._source,i.package="inspector",await this._scarfClient.logEvent(i)}}catch{}}async trackInspectorOpen(t){const n=new Aoe(t);await this.capture(n)}}const joe={model:"stub-model",stopReason:"endTurn",role:"assistant",content:{type:"text",text:"positive"}};function Poe({requestId:e,serverName:t,onViewDetails:n,onApprove:r,onDeny:a}){return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"Sampling Request Received"}),d.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["New request from ",t]})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:s=>{s.stopPropagation(),n()},children:"View Details"}),d.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:s=>{s.stopPropagation(),r(joe)},children:"Approve"}),d.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:s=>{s.stopPropagation(),a()},children:"Deny"})]})]})}function Uoe({requestId:e,serverName:t,mode:n,message:r,url:a,onViewDetails:s,onOpenUrl:i,onCancel:c}){return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"Elicitation Request Received"}),d.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["From ",t,": ",r]}),n==="url"&&a&&d.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono",children:a})]}),d.jsxs("div",{className:"flex gap-2 flex-wrap",children:[d.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:"View Details"}),n==="url"&&i&&d.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:"Open URL"}),d.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 ig=()=>{},lg=()=>{},cg=()=>{},ug=()=>{},E3=v.createContext(null);function B_(){const e=v.use(E3);if(!e)throw new Error("useMcpContext must be used within a McpProvider");return e}function $oe({url:e,name:t,proxyConfig:n,transportType:r,connectionId:a,onUpdate:s,onRemove:i}){const c=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=e,f={};if(n?.proxyAddress){const L=new URL(n.proxyAddress),M=new URL(e);u=`${L.origin}${L.pathname}${M.pathname}${M.search}`,f["X-Target-URL"]=e}n?.customHeaders&&(f={...f,...n.customHeaders});const[m,h]=v.useState([]),b=v.useRef(0),[y,x]=v.useState([]),E=v.useRef(0),w=v.useMemo(()=>m.map(L=>({id:L.id,request:L.request,timestamp:L.timestamp,serverName:L.serverName})),[m]),_=v.useMemo(()=>y.map(L=>({id:L.id,request:L.request,timestamp:L.timestamp,serverName:L.serverName})),[y]),S=v.useRef(null),[T,R]=v.useState(!1),C=v.useRef(!1);v.useEffect(()=>{typeof window<"u"&&!C.current&&(C.current=!0,hr(()=>import("./transport-wrapper-browser-BI4dDu3b.js"),[]).then(L=>{S.current=L.wrapTransportForLogging,R(!0),console.log("[McpContext] Transport wrapper loaded")}).catch(L=>{console.error("[McpContext] Failed to load transport wrapper:",L)}))},[]);const I=v.useMemo(()=>{if(!(!T||!S.current))return(L,M)=>{const z=a;return console.log("[McpContext] Applying transport wrapper, serverId:",z,"from connector:",M),S.current(L,z)}},[T,a]),A=`mcp-inspector-notifications-${a}`,O=500,[j,U]=v.useState([]);v.useEffect(()=>{try{const L=localStorage.getItem(A);if(L){const M=JSON.parse(L);Array.isArray(M)&&U(M)}}catch(L){console.error("Failed to load notifications from localStorage:",L)}},[A]),v.useEffect(()=>{try{localStorage.setItem(A,JSON.stringify(j))}catch(L){console.error("Failed to save notifications to localStorage:",L)}},[j,A]);const B=v.useCallback(L=>{U(M=>M.map(z=>z.id===L?{...z,read:!0}:z))},[]),W=v.useCallback(()=>{U(L=>L.map(M=>({...M,read:!0})))},[]),J=v.useCallback(()=>{U([])},[]),ee=v.useCallback(L=>{U(M=>{const z=[L,...M];return z.length>O?z.slice(0,O):z})},[]),re=v.useCallback((L,M)=>{h(z=>{const G=z.find(q=>q.id===L);return G?(G.resolve(M),z.filter(q=>q.id!==L)):z})},[]),F=v.useCallback((L,M)=>{h(z=>{const G=z.find(q=>q.id===L);return G?(G.reject(new Error(M||"User rejected sampling request")),z.filter(q=>q.id!==L)):z})},[]),K=v.useCallback((L,M)=>{x(z=>{const G=z.find(q=>q.id===L);return G?(G.resolve(M),z.filter(q=>q.id!==L)):z})},[]),V=v.useCallback((L,M)=>{x(z=>{const G=z.find(q=>q.id===L);return G?(G.reject(new Error(M||"User rejected elicitation request")),z.filter(q=>q.id!==L)):z})},[]),ne=v.useCallback(async L=>new Promise((M,z)=>{const G=`sampling-${b.current++}`,q={id:G,request:{params:L},timestamp:Date.now(),serverName:t,resolve:M,reject:z};h(ae=>[...ae,q]),typeof window<"u"&&hr(async()=>{const{toast:ae}=await Promise.resolve().then(()=>oP);return{toast:ae}},void 0).then(({toast:ae})=>{const ie=ae(d.jsx(Poe,{requestId:G,serverName:t,onViewDetails:()=>{const X=new globalThis.CustomEvent("navigate-to-sampling",{detail:{requestId:G}});window.dispatchEvent(X),ae.dismiss(ie)},onApprove:X=>{h(Z=>{const se=Z.find(me=>me.id===G);return se?(se.resolve(X),ae.success("Sampling request approved"),Z.filter(me=>me.id!==G)):Z}),ae.dismiss(ie)},onDeny:()=>{h(X=>{const Z=X.find(se=>se.id===G);return Z?(Z.reject(new Error("User denied sampling request from toast")),ae.error("Sampling request denied"),X.filter(se=>se.id!==G)):X}),ae.dismiss(ie)}}),{duration:5e3})})}),[t]),te=v.useCallback(async L=>new Promise((M,z)=>{const G=`elicitation-${E.current++}`,q={id:G,request:L,timestamp:Date.now(),serverName:t,resolve:M,reject:z};x(ae=>[...ae,q]),typeof window<"u"&&hr(async()=>{const{toast:ae}=await Promise.resolve().then(()=>oP);return{toast:ae}},void 0).then(({toast:ae})=>{const ie=ae(d.jsx(Uoe,{requestId:G,serverName:t,mode:L.mode||"form",message:L.message,url:L.mode==="url"?L.url:void 0,onViewDetails:()=>{const X=new globalThis.CustomEvent("navigate-to-elicitation",{detail:{requestId:G}});window.dispatchEvent(X),ae.dismiss(ie)},onOpenUrl:L.mode==="url"?()=>{window.open(L.url,"_blank"),ae.dismiss(ie)}:void 0,onCancel:()=>{x(X=>{const Z=X.find(se=>se.id===G);return Z?(Z.reject(new Error("User cancelled elicitation request from toast")),ae.error("Elicitation request cancelled"),X.filter(se=>se.id!==G)):X}),ae.dismiss(ie)}}),{duration:5e3})})}),[t]),D=m_({url:u,callbackUrl:c,customHeaders:Object.keys(f).length>0?f:void 0,transportType:r||"http",preventAutoAuth:!0,useRedirectFlow:!0,enabled:T,wrapTransport:I,onNotification:L=>{ee({id:globalThis.crypto.randomUUID(),method:L.method,params:L.params,timestamp:Date.now(),read:!1})},samplingCallback:ne,onElicitation:te}),H=v.useRef(s),$=v.useRef(null);return v.useEffect(()=>{H.current=s},[s]),v.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{D.state==="ready"&&D.serverInfo&&console.log("[McpContext] Server info available:",D.serverInfo);const L=j.filter(G=>!G.read).length,M={id:a,url:e,name:D.serverInfo?.name||t,state:D.state,tools:D.tools,resources:D.resources,prompts:D.prompts,error:D.error??null,authUrl:D.authUrl??null,customHeaders:f,transportType:r,proxyConfig:n,serverInfo:D.serverInfo,capabilities:D.capabilities,notifications:j,unreadNotificationCount:L,markNotificationRead:B,markAllNotificationsRead:W,clearNotifications:J,pendingSamplingRequests:w,approveSampling:re,rejectSampling:F,pendingElicitationRequests:_,approveElicitation:K,rejectElicitation:V,callTool:D.callTool,readResource:D.readResource,listPrompts:D.listPrompts,getPrompt:D.getPrompt,authenticate:D.authenticate,retry:D.retry,clearStorage:D.clearStorage,disconnect:D.disconnect,client:D.client},z=$.current;(!z||z.state!==M.state||z.error!==M.error||z.authUrl!==M.authUrl||z.name!==M.name||z.tools.length!==M.tools.length||z.resources.length!==M.resources.length||z.prompts.length!==M.prompts.length||z.serverInfo!==M.serverInfo||z.capabilities!==M.capabilities||z.notifications.length!==M.notifications.length||z.unreadNotificationCount!==M.unreadNotificationCount||z.pendingSamplingRequests.length!==M.pendingSamplingRequests.length||z.pendingElicitationRequests.length!==M.pendingElicitationRequests.length||!z.client)&&($.current=M,H.current(M))});else{const L=j.filter(G=>!G.read).length,M={id:a,url:e,name:D.serverInfo?.name||t,state:D.state,tools:D.tools,resources:D.resources,prompts:D.prompts,error:D.error??null,authUrl:D.authUrl??null,customHeaders:f,transportType:r,proxyConfig:n,serverInfo:D.serverInfo,capabilities:D.capabilities,notifications:j,unreadNotificationCount:L,markNotificationRead:B,markAllNotificationsRead:W,clearNotifications:J,pendingSamplingRequests:w,approveSampling:re,rejectSampling:F,pendingElicitationRequests:_,approveElicitation:K,rejectElicitation:V,callTool:D.callTool,readResource:D.readResource,listPrompts:D.listPrompts,getPrompt:D.getPrompt,authenticate:D.authenticate,retry:D.retry,clearStorage:D.clearStorage,disconnect:D.disconnect,client:D.client},z=$.current;(!z||z.state!==M.state||z.error!==M.error||z.authUrl!==M.authUrl||z.name!==M.name||z.tools.length!==M.tools.length||z.resources.length!==M.resources.length||z.prompts.length!==M.prompts.length||z.serverInfo!==M.serverInfo||z.capabilities!==M.capabilities||z.notifications.length!==M.notifications.length||z.unreadNotificationCount!==M.unreadNotificationCount||z.pendingSamplingRequests.length!==M.pendingSamplingRequests.length||z.pendingElicitationRequests.length!==M.pendingElicitationRequests.length||!z.client)&&($.current=M,H.current(M))}},[e,t,r,n,f,a,D.state,D.tools,D.resources,D.prompts,D.error,D.authUrl,D.serverInfo,D.capabilities,D.client,j,B,W,J,D.callTool,D.readResource,D.listPrompts,D.getPrompt,D.authenticate,D.retry,D.clearStorage,m,re,F,_,K,V]),null}function zoe({children:e}){const[t,n]=v.useState([]),[r,a]=v.useState(!1),[s,i]=v.useState(!0),[c,u]=v.useState([]);v.useEffect(()=>{try{const w=localStorage.getItem("mcp-inspector-connections");if(w){const S=JSON.parse(w);Array.isArray(S)&&(u(S),n(S.map(T=>({id:T.id||T.url,url:T.url,name:T.name||"MCP Server",state:"discovering",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:T.proxyConfig?.customHeaders,transportType:T.transportType,proxyConfig:T.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:ig,rejectSampling:lg,pendingElicitationRequests:[],approveElicitation:cg,rejectElicitation:ug,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}))))}const _=localStorage.getItem("mcp-inspector-auto-connect");_!==null&&i(_==="true")}catch(w){console.error("Failed to load connections from localStorage:",w)}finally{a(!0)}},[]),v.useEffect(()=>{r&&localStorage.setItem("mcp-inspector-connections",JSON.stringify(c))},[c,r]),v.useEffect(()=>{r&&localStorage.setItem("mcp-inspector-auto-connect",String(s))},[s,r]);const f=v.useCallback((w,_,S,T)=>{const R=c.find(A=>A.url===w),C=t.find(A=>A.url===w);if(R&&C){if(JSON.stringify(R.proxyConfig)!==JSON.stringify(S)&&S){u(O=>O.filter(j=>j.url!==w)),n(O=>O.filter(j=>j.url!==w)),setTimeout(()=>{const O={id:w,url:w,name:_||R.name||"MCP Server",proxyConfig:S,transportType:T||R.transportType};u(j=>[...j,O]),n(j=>[...j,{id:w,url:w,name:_||R.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:S?.customHeaders,transportType:T||R.transportType,proxyConfig:S,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:ig,rejectSampling:lg,pendingElicitationRequests:[],approveElicitation:cg,rejectElicitation:ug,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},10);return}return}if(R&&!C){(S||T)&&u(A=>A.map(O=>O.url===w?{...O,proxyConfig:S||O.proxyConfig,transportType:T||O.transportType,name:_||O.name}:O)),n(A=>[...A,{id:R.id||w,url:w,name:_||R.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:S?.customHeaders||R.proxyConfig?.customHeaders,transportType:T||R.transportType,proxyConfig:S||R.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:ig,rejectSampling:lg,pendingElicitationRequests:[],approveElicitation:cg,rejectElicitation:ug,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}]);return}const I={id:w,url:w,name:_||"MCP Server",proxyConfig:S,transportType:T};u(A=>[...A,I]),n(A=>[...A,{id:w,url:w,name:_||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:S?.customHeaders,transportType:T,proxyConfig:S,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:ig,rejectSampling:lg,pendingElicitationRequests:[],approveElicitation:cg,rejectElicitation:ug,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},[c,t]),m=v.useCallback(w=>{const _=t.find(T=>T.id===w);_&&(console.log(`[McpContext] Cleaning up connection: ${w}`),_.disconnect&&(console.log(`[McpContext] Disconnecting from server: ${w}`),_.disconnect()),_.clearStorage&&(console.log(`[McpContext] Clearing OAuth storage for connection: ${w}`),_.clearStorage())),u(T=>T.filter(R=>R.id!==w)),n(T=>T.filter(R=>R.id!==w));const S=localStorage.getItem("mcp-inspector-connections");if(S)try{const R=JSON.parse(S).filter(C=>(C.id||C.url)!==w);localStorage.setItem("mcp-inspector-connections",JSON.stringify(R))}catch(T){console.error("Failed to update localStorage on remove:",T)}Tr.getInstance().capture(new Ooe({serverId:w}))},[t]),h=v.useCallback((w,_)=>{u(S=>S.map(T=>T.id===w||T.url===w?{...T,..._}:T)),n(S=>S.map(T=>T.id===w?{...T,..._}:T))},[]),b=v.useCallback(w=>{n(_=>{const S=_.findIndex(C=>C.id===w.id);if(S===-1)return _;const T=_[S];if(T.state===w.state&&T.tools===w.tools&&T.resources===w.resources&&T.prompts===w.prompts&&T.error===w.error&&T.serverInfo===w.serverInfo&&T.client===w.client&&T.notifications===w.notifications&&T.unreadNotificationCount===w.unreadNotificationCount&&T.pendingSamplingRequests.length===w.pendingSamplingRequests.length&&T.pendingElicitationRequests.length===w.pendingElicitationRequests.length)return _;const R=[..._];return R[S]=w,R})},[]),y=v.useCallback(w=>{console.log("Connect requested for:",w)},[]),x=v.useCallback(w=>{console.log("Disconnect requested for:",w)},[]),E=v.useMemo(()=>({connections:t,addConnection:f,removeConnection:m,updateConnectionConfig:h,autoConnect:s,setAutoConnect:i,connectServer:y,disconnectServer:x,configLoaded:r}),[t,f,m,h,s,y,x,r]);return d.jsxs(E3.Provider,{value:E,children:[e,r&&s&&c.map(w=>{const _=`${w.id||w.url}-${w.proxyConfig?.proxyAddress?"proxy":"direct"}`;return console.warn("[McpContext] Rendering McpConnectionWrapper with key:",_,"proxyConfig:",w.proxyConfig),d.jsx($oe,{url:w.url,name:w.name,proxyConfig:w.proxyConfig,transportType:w.transportType,connectionId:w.id||w.url,onUpdate:b,onRemove:()=>m(w.id||w.url)},_)})]})}const Foe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Boe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Qj=e=>{const t=Boe(e);return t.charAt(0).toUpperCase()+t.slice(1)},x3=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Hoe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Voe={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 Goe=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:s,iconNode:i,...c},u)=>v.createElement("svg",{ref:u,...Voe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:x3("lucide",a),...!s&&!Hoe(c)&&{"aria-hidden":"true"},...c},[...i.map(([f,m])=>v.createElement(f,m)),...Array.isArray(s)?s:[s]]));const Xe=(e,t)=>{const n=v.forwardRef(({className:r,...a},s)=>v.createElement(Goe,{ref:s,iconNode:t,className:x3(`lucide-${Foe(Qj(e))}`,`lucide-${e}`,r),...a}));return n.displayName=Qj(e),n};const Woe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],Koe=Xe("arrow-down-to-line",Woe);const Yoe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],Zoe=Xe("arrow-up-from-line",Yoe);const qoe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Xoe=Xe("arrow-up",qoe);const Joe=[["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"}]],H_=Xe("bell",Joe);const Qoe=[["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"}]],S3=Xe("brush",Qoe);const ese=[["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"}]],tse=Xe("bug",ese);const nse=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],oa=Xe("check",nse);const rse=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Fl=Xe("chevron-down",rse);const ase=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ose=Xe("chevron-right",ase);const sse=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],V_=Xe("chevron-left",sse);const ise=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],lse=Xe("chevron-up",ise);const cse=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],use=Xe("chevrons-up-down",cse);const dse=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],eP=Xe("circle-minus",dse);const fse=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ou=Xe("clock",fse);const pse=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],G_=Xe("code",pse);const mse=[["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"}]],hse=Xe("cog",mse);const gse=[["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"}]],bse=Xe("command",gse);const yse=[["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"}]],zr=Xe("copy",yse);const vse=[["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"}]],Ny=Xe("database",vse);const wse=[["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"}]],Lp=Xe("download",wse);const Ese=[["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"}]],xse=Xe("ellipsis-vertical",Ese);const Sse=[["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"}]],Tx=Xe("external-link",Sse);const _se=[["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"}]],_3=Xe("eye-off",_se);const Tse=[["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"}]],Nx=Xe("eye",Tse);const Nse=[["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"}]],kse=Xe("file-code",Nse);const Cse=[["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"}]],Rse=Xe("file-image",Cse);const Ase=[["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"}]],W_=Xe("file-text",Ase);const Ise=[["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"}]],Ose=Xe("file",Ise);const Dse=[["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"}]],Lse=Xe("folder-open",Dse);const Mse=[["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"}]],jse=Xe("globe",Mse);const Pse=[["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"}]],Use=Xe("grip-vertical",Pse);const $se=[["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"}]],T3=Xe("hash",$se);const zse=[["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"}]],hb=Xe("history",zse);const Fse=[["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"}]],N3=Xe("key",Fse);const Bse=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ai=Xe("loader-circle",Bse);const Hse=[["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"}]],K_=Xe("maximize-2",Hse);const Vse=[["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"}]],Y_=Xe("maximize",Vse);const Gse=[["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"}]],Wse=Xe("message-circle",Gse);const Kse=[["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"}]],Qf=Xe("message-square",Kse);const Yse=[["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"}]],Zse=Xe("minimize",Yse);const qse=[["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"}]],tP=Xe("monitor",qse);const Xse=[["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"}]],Jse=Xe("moon",Xse);const Qse=[["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"}]],eie=Xe("picture-in-picture",Qse);const tie=[["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"}]],k3=Xe("play",tie);const nie=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],C3=Xe("plus",nie);const rie=[["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"}]],nP=Xe("rotate-ccw",rie);const aie=[["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"}]],Z_=Xe("save",aie);const oie=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],nd=Xe("search",oie);const sie=[["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"}]],iie=Xe("send",sie);const lie=[["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"}]],cie=Xe("server",lie);const uie=[["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"}]],cu=Xe("settings",uie);const die=[["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"}]],fie=Xe("shield",die);const pie=[["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"}]],mie=Xe("sparkles",pie);const hie=[["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"}]],R3=Xe("square-check-big",hie);const gie=[["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"}]],bie=Xe("square-pen",gie);const yie=[["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"}]],vie=Xe("sun-dim",yie);const wie=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],eE=Xe("terminal",wie);const Eie=[["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"}]],Ii=Xe("trash-2",Eie);const xie=[["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"}]],Sie=Xe("trash",xie);const _ie=[["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"}]],Cl=Xe("wrench",_ie);const Tie=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ko=Xe("x",Tie);const Nie=[["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"}]],ep=Xe("zap",Nie);function kie(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 Cie=e=>{switch(e){case"success":return Iie;case"info":return Die;case"warning":return Oie;case"error":return Lie;default:return null}},Rie=Array(12).fill(0),Aie=({visible:e,className:t})=>ce.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ce.createElement("div",{className:"sonner-spinner"},Rie.map((n,r)=>ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Iie=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Oie=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ce.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"})),Die=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Lie=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Mie=ce.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"},ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),jie=()=>{const[e,t]=ce.useState(document.hidden);return ce.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let kx=1;class Pie{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:r,...a}=t,s=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:kx++,i=this.toasts.find(u=>u.id===s),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(u=>u.id===s?(this.publish({...u,...t,id:s,title:r}),{...u,...t,id:s,dismissible:c,title:r}):u):this.addToast({title:r,...a,dismissible:c,id:s}),s},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(r=>r({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 r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let s=r!==void 0,i;const c=a.then(async f=>{if(i=["resolve",f],ce.isValidElement(f))s=!1,this.create({id:r,type:"default",message:f});else if($ie(f)&&!f.ok){s=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${f.status}`):n.error,b=typeof n.description=="function"?await n.description(`HTTP error! status: ${f.status}`):n.description,x=typeof h=="object"&&!ce.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:b,...x})}else if(f instanceof Error){s=!1;const h=typeof n.error=="function"?await n.error(f):n.error,b=typeof n.description=="function"?await n.description(f):n.description,x=typeof h=="object"&&!ce.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:b,...x})}else if(n.success!==void 0){s=!1;const h=typeof n.success=="function"?await n.success(f):n.success,b=typeof n.description=="function"?await n.description(f):n.description,x=typeof h=="object"&&!ce.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:b,...x})}}).catch(async f=>{if(i=["reject",f],n.error!==void 0){s=!1;const m=typeof n.error=="function"?await n.error(f):n.error,h=typeof n.description=="function"?await n.description(f):n.description,y=typeof m=="object"&&!ce.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:h,...y})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((f,m)=>c.then(()=>i[0]==="reject"?m(i[1]):f(i[1])).catch(m));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(t,n)=>{const r=n?.id||kx++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ba=new Pie,Uie=(e,t)=>{const n=t?.id||kx++;return ba.addToast({title:e,...t,id:n}),n},$ie=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",zie=Uie,Fie=()=>ba.toasts,Bie=()=>ba.getActiveToasts(),Xt=Object.assign(zie,{success:ba.success,info:ba.info,warning:ba.warning,error:ba.error,custom:ba.custom,message:ba.message,promise:ba.promise,dismiss:ba.dismiss,loading:ba.loading},{getHistory:Fie,getToasts:Bie});kie("[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 dg(e){return e.label!==void 0}const Hie=3,Vie="24px",Gie="16px",rP=4e3,Wie=356,Kie=14,Yie=45,Zie=200;function Lo(...e){return e.filter(Boolean).join(" ")}function qie(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const Xie=e=>{var t,n,r,a,s,i,c,u,f;const{invert:m,toast:h,unstyled:b,interacting:y,setHeights:x,visibleToasts:E,heights:w,index:_,toasts:S,expanded:T,removeToast:R,defaultRichColors:C,closeButton:I,style:A,cancelButtonStyle:O,actionButtonStyle:j,className:U="",descriptionClassName:B="",duration:W,position:J,gap:ee,expandByDefault:re,classNames:F,icons:K,closeButtonAriaLabel:V="Close toast"}=e,[ne,te]=ce.useState(null),[D,H]=ce.useState(null),[$,L]=ce.useState(!1),[M,z]=ce.useState(!1),[G,q]=ce.useState(!1),[ae,ie]=ce.useState(!1),[X,Z]=ce.useState(!1),[se,me]=ce.useState(0),[le,Te]=ce.useState(0),Be=ce.useRef(h.duration||W||rP),Ee=ce.useRef(null),_e=ce.useRef(null),Ue=_===0,fe=_+1<=E,Ae=h.type,ze=h.dismissible!==!1,we=h.className||"",at=h.descriptionClassName||"",lt=ce.useMemo(()=>w.findIndex(Ze=>Ze.toastId===h.id)||0,[w,h.id]),gt=ce.useMemo(()=>{var Ze;return(Ze=h.closeButton)!=null?Ze:I},[h.closeButton,I]),Ct=ce.useMemo(()=>h.duration||W||rP,[h.duration,W]),Le=ce.useRef(0),$e=ce.useRef(0),bt=ce.useRef(0),nt=ce.useRef(null),[Ut,st]=J.split("-"),Ie=ce.useMemo(()=>w.reduce((Ze,vt,jt)=>jt>=lt?Ze:Ze+vt.height,0),[w,lt]),Me=jie(),He=h.invert||m,it=Ae==="loading";$e.current=ce.useMemo(()=>lt*ee+Ie,[lt,Ie]),ce.useEffect(()=>{Be.current=Ct},[Ct]),ce.useEffect(()=>{L(!0)},[]),ce.useEffect(()=>{const Ze=_e.current;if(Ze){const vt=Ze.getBoundingClientRect().height;return Te(vt),x(jt=>[{toastId:h.id,height:vt,position:h.position},...jt]),()=>x(jt=>jt.filter(Pt=>Pt.toastId!==h.id))}},[x,h.id]),ce.useLayoutEffect(()=>{if(!$)return;const Ze=_e.current,vt=Ze.style.height;Ze.style.height="auto";const jt=Ze.getBoundingClientRect().height;Ze.style.height=vt,Te(jt),x(Pt=>Pt.find(dn=>dn.toastId===h.id)?Pt.map(dn=>dn.toastId===h.id?{...dn,height:jt}:dn):[{toastId:h.id,height:jt,position:h.position},...Pt])},[$,h.title,h.description,x,h.id,h.jsx,h.action,h.cancel]);const pt=ce.useCallback(()=>{z(!0),me($e.current),x(Ze=>Ze.filter(vt=>vt.toastId!==h.id)),setTimeout(()=>{R(h)},Zie)},[h,R,x,$e]);ce.useEffect(()=>{if(h.promise&&Ae==="loading"||h.duration===1/0||h.type==="loading")return;let Ze;return T||y||Me?(()=>{if(bt.current<Le.current){const Pt=new Date().getTime()-Le.current;Be.current=Be.current-Pt}bt.current=new Date().getTime()})():(()=>{Be.current!==1/0&&(Le.current=new Date().getTime(),Ze=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),pt()},Be.current))})(),()=>clearTimeout(Ze)},[T,y,h,Ae,Me,pt]),ce.useEffect(()=>{h.delete&&(pt(),h.onDismiss==null||h.onDismiss.call(h,h))},[pt,h.delete]);function Et(){var Ze;if(K?.loading){var vt;return ce.createElement("div",{className:Lo(F?.loader,h==null||(vt=h.classNames)==null?void 0:vt.loader,"sonner-loader"),"data-visible":Ae==="loading"},K.loading)}return ce.createElement(Aie,{className:Lo(F?.loader,h==null||(Ze=h.classNames)==null?void 0:Ze.loader),visible:Ae==="loading"})}const xt=h.icon||K?.[Ae]||Cie(Ae);var un,mn;return ce.createElement("li",{tabIndex:0,ref:_e,className:Lo(U,we,F?.toast,h==null||(t=h.classNames)==null?void 0:t.toast,F?.default,F?.[Ae],h==null||(n=h.classNames)==null?void 0:n[Ae]),"data-sonner-toast":"","data-rich-colors":(un=h.richColors)!=null?un:C,"data-styled":!(h.jsx||h.unstyled||b),"data-mounted":$,"data-promise":!!h.promise,"data-swiped":X,"data-removed":M,"data-visible":fe,"data-y-position":Ut,"data-x-position":st,"data-index":_,"data-front":Ue,"data-swiping":G,"data-dismissible":ze,"data-type":Ae,"data-invert":He,"data-swipe-out":ae,"data-swipe-direction":D,"data-expanded":!!(T||re&&$),"data-testid":h.testId,style:{"--index":_,"--toasts-before":_,"--z-index":S.length-_,"--offset":`${M?se:$e.current}px`,"--initial-height":re?"auto":`${le}px`,...A,...h.style},onDragEnd:()=>{q(!1),te(null),nt.current=null},onPointerDown:Ze=>{Ze.button!==2&&(it||!ze||(Ee.current=new Date,me($e.current),Ze.target.setPointerCapture(Ze.pointerId),Ze.target.tagName!=="BUTTON"&&(q(!0),nt.current={x:Ze.clientX,y:Ze.clientY})))},onPointerUp:()=>{var Ze,vt,jt;if(ae||!ze)return;nt.current=null;const Pt=Number(((Ze=_e.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),yr=Number(((vt=_e.current)==null?void 0:vt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),dn=new Date().getTime()-((jt=Ee.current)==null?void 0:jt.getTime()),Xn=ne==="x"?Pt:yr,Jn=Math.abs(Xn)/dn;if(Math.abs(Xn)>=Yie||Jn>.11){me($e.current),h.onDismiss==null||h.onDismiss.call(h,h),H(ne==="x"?Pt>0?"right":"left":yr>0?"down":"up"),pt(),ie(!0);return}else{var wn,fn;(wn=_e.current)==null||wn.style.setProperty("--swipe-amount-x","0px"),(fn=_e.current)==null||fn.style.setProperty("--swipe-amount-y","0px")}Z(!1),q(!1),te(null)},onPointerMove:Ze=>{var vt,jt,Pt;if(!nt.current||!ze||((vt=window.getSelection())==null?void 0:vt.toString().length)>0)return;const dn=Ze.clientY-nt.current.y,Xn=Ze.clientX-nt.current.x;var Jn;const wn=(Jn=e.swipeDirections)!=null?Jn:qie(J);!ne&&(Math.abs(Xn)>1||Math.abs(dn)>1)&&te(Math.abs(Xn)>Math.abs(dn)?"x":"y");let fn={x:0,y:0};const la=Qt=>1/(1.5+Math.abs(Qt)/20);if(ne==="y"){if(wn.includes("top")||wn.includes("bottom"))if(wn.includes("top")&&dn<0||wn.includes("bottom")&&dn>0)fn.y=dn;else{const Qt=dn*la(dn);fn.y=Math.abs(Qt)<Math.abs(dn)?Qt:dn}}else if(ne==="x"&&(wn.includes("left")||wn.includes("right")))if(wn.includes("left")&&Xn<0||wn.includes("right")&&Xn>0)fn.x=Xn;else{const Qt=Xn*la(Xn);fn.x=Math.abs(Qt)<Math.abs(Xn)?Qt:Xn}(Math.abs(fn.x)>0||Math.abs(fn.y)>0)&&Z(!0),(jt=_e.current)==null||jt.style.setProperty("--swipe-amount-x",`${fn.x}px`),(Pt=_e.current)==null||Pt.style.setProperty("--swipe-amount-y",`${fn.y}px`)}},gt&&!h.jsx&&Ae!=="loading"?ce.createElement("button",{"aria-label":V,"data-disabled":it,"data-close-button":!0,onClick:it||!ze?()=>{}:()=>{pt(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Lo(F?.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(mn=K?.close)!=null?mn:Mie):null,(Ae||h.icon||h.promise)&&h.icon!==null&&(K?.[Ae]!==null||h.icon)?ce.createElement("div",{"data-icon":"",className:Lo(F?.icon,h==null||(a=h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Et():null,h.type!=="loading"?xt:null):null,ce.createElement("div",{"data-content":"",className:Lo(F?.content,h==null||(s=h.classNames)==null?void 0:s.content)},ce.createElement("div",{"data-title":"",className:Lo(F?.title,h==null||(i=h.classNames)==null?void 0:i.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?ce.createElement("div",{"data-description":"",className:Lo(B,at,F?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),ce.isValidElement(h.cancel)?h.cancel:h.cancel&&dg(h.cancel)?ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:Ze=>{dg(h.cancel)&&ze&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Ze),pt())},className:Lo(F?.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,ce.isValidElement(h.action)?h.action:h.action&&dg(h.action)?ce.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||j,onClick:Ze=>{dg(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Ze),!Ze.defaultPrevented&&pt())},className:Lo(F?.actionButton,h==null||(f=h.classNames)==null?void 0:f.actionButton)},h.action.label):null)};function aP(){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 Jie(e,t){const n={};return[e,t].forEach((r,a)=>{const s=a===1,i=s?"--mobile-offset":"--offset",c=s?Gie:Vie;function u(f){["top","right","bottom","left"].forEach(m=>{n[`${i}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${i}-${f}`]=c:n[`${i}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):u(c)}),n}const A3=ce.forwardRef(function(t,n){const{id:r,invert:a,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:c,closeButton:u,className:f,offset:m,mobileOffset:h,theme:b="light",richColors:y,duration:x,style:E,visibleToasts:w=Hie,toastOptions:_,dir:S=aP(),gap:T=Kie,icons:R,containerAriaLabel:C="Notifications"}=t,[I,A]=ce.useState([]),O=ce.useMemo(()=>r?I.filter($=>$.toasterId===r):I.filter($=>!$.toasterId),[I,r]),j=ce.useMemo(()=>Array.from(new Set([s].concat(O.filter($=>$.position).map($=>$.position)))),[O,s]),[U,B]=ce.useState([]),[W,J]=ce.useState(!1),[ee,re]=ce.useState(!1),[F,K]=ce.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=ce.useRef(null),ne=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=ce.useRef(null),D=ce.useRef(!1),H=ce.useCallback($=>{A(L=>{var M;return(M=L.find(z=>z.id===$.id))!=null&&M.delete||ba.dismiss($.id),L.filter(({id:z})=>z!==$.id)})},[]);return ce.useEffect(()=>ba.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{A(L=>L.map(M=>M.id===$.id?{...M,delete:!0}:M))});return}setTimeout(()=>{cF.flushSync(()=>{A(L=>{const M=L.findIndex(z=>z.id===$.id);return M!==-1?[...L.slice(0,M),{...L[M],...$},...L.slice(M+1)]:[$,...L]})})})}),[I]),ce.useEffect(()=>{if(b!=="system"){K(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:L})=>{K(L?"dark":"light")})}catch{$.addListener(({matches:M})=>{try{K(M?"dark":"light")}catch(z){console.error(z)}})}},[b]),ce.useEffect(()=>{I.length<=1&&J(!1)},[I]),ce.useEffect(()=>{const $=L=>{var M;if(i.every(q=>L[q]||L.code===q)){var G;J(!0),(G=V.current)==null||G.focus()}L.code==="Escape"&&(document.activeElement===V.current||(M=V.current)!=null&&M.contains(document.activeElement))&&J(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),ce.useEffect(()=>{if(V.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,D.current=!1)}},[V.current]),ce.createElement("section",{ref:n,"aria-label":`${C} ${ne}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},j.map(($,L)=>{var M;const[z,G]=$.split("-");return O.length?ce.createElement("ol",{key:$,dir:S==="auto"?aP():S,tabIndex:-1,ref:V,className:f,"data-sonner-toaster":!0,"data-sonner-theme":F,"data-y-position":z,"data-x-position":G,style:{"--front-toast-height":`${((M=U[0])==null?void 0:M.height)||0}px`,"--width":`${Wie}px`,"--gap":`${T}px`,...E,...Jie(m,h)},onBlur:q=>{D.current&&!q.currentTarget.contains(q.relatedTarget)&&(D.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||D.current||(D.current=!0,te.current=q.relatedTarget)},onMouseEnter:()=>J(!0),onMouseMove:()=>J(!0),onMouseLeave:()=>{ee||J(!1)},onDragEnd:()=>J(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||re(!0)},onPointerUp:()=>re(!1)},O.filter(q=>!q.position&&L===0||q.position===$).map((q,ae)=>{var ie,X;return ce.createElement(Xie,{key:q.id,icons:R,index:ae,toast:q,defaultRichColors:y,duration:(ie=_?.duration)!=null?ie:x,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:a,visibleToasts:w,closeButton:(X=_?.closeButton)!=null?X:u,interacting:ee,position:$,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,closeButtonAriaLabel:_?.closeButtonAriaLabel,removeToast:H,toasts:O.filter(Z=>Z.position==q.position),heights:U.filter(Z=>Z.position==q.position),setHeights:B,expandByDefault:c,gap:T,expanded:W,swipeDirections:t.swipeDirections})})):null}))}),oP=Object.freeze(Object.defineProperty({__proto__:null,Toaster:A3,toast:Xt},Symbol.toStringTag,{value:"Module"}));var ky="Dialog",[I3]=No(ky),[Qie,ko]=I3(ky),O3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:s,modal:i=!0}=e,c=v.useRef(null),u=v.useRef(null),[f,m]=Rs({prop:r,defaultProp:a??!1,onChange:s,caller:ky});return d.jsx(Qie,{scope:t,triggerRef:c,contentRef:u,contentId:$r(),titleId:$r(),descriptionId:$r(),open:f,onOpenChange:m,onOpenToggle:v.useCallback(()=>m(h=>!h),[m]),modal:i,children:n})};O3.displayName=ky;var D3="DialogTrigger",L3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(D3,n),s=Jt(t,a.triggerRef);return d.jsx(_t.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":J_(a.open),...r,ref:s,onClick:Ve(e.onClick,a.onOpenToggle)})});L3.displayName=D3;var q_="DialogPortal",[ele,M3]=I3(q_,{forceMount:void 0}),j3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,s=ko(q_,t);return d.jsx(ele,{scope:t,forceMount:n,children:v.Children.map(r,i=>d.jsx(za,{present:n||s.open,children:d.jsx(ed,{asChild:!0,container:a,children:i})}))})};j3.displayName=q_;var gb="DialogOverlay",P3=v.forwardRef((e,t)=>{const n=M3(gb,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,s=ko(gb,e.__scopeDialog);return s.modal?d.jsx(za,{present:r||s.open,children:d.jsx(nle,{...a,ref:t})}):null});P3.displayName=gb;var tle=Nl("DialogOverlay.RemoveScroll"),nle=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(gb,n);return d.jsx(Ap,{as:tle,allowPinchZoom:!0,shards:[a.contentRef],children:d.jsx(_t.div,{"data-state":J_(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Rl="DialogContent",U3=v.forwardRef((e,t)=>{const n=M3(Rl,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,s=ko(Rl,e.__scopeDialog);return d.jsx(za,{present:r||s.open,children:s.modal?d.jsx(rle,{...a,ref:t}):d.jsx(ale,{...a,ref:t})})});U3.displayName=Rl;var rle=v.forwardRef((e,t)=>{const n=ko(Rl,e.__scopeDialog),r=v.useRef(null),a=Jt(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return by(s)},[]),d.jsx($3,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ve(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ve(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&s.preventDefault()}),onFocusOutside:Ve(e.onFocusOutside,s=>s.preventDefault())})}),ale=v.forwardRef((e,t)=>{const n=ko(Rl,e.__scopeDialog),r=v.useRef(!1),a=v.useRef(!1);return d.jsx($3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),$3=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:s,...i}=e,c=ko(Rl,n),u=v.useRef(null),f=Jt(t,u);return cy(),d.jsxs(d.Fragment,{children:[d.jsx(Np,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:s,children:d.jsx(Xu,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":J_(c.open),...i,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(ole,{titleId:c.titleId}),d.jsx(ile,{contentRef:u,descriptionId:c.descriptionId})]})]})}),X_="DialogTitle",z3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(X_,n);return d.jsx(_t.h2,{id:a.titleId,...r,ref:t})});z3.displayName=X_;var F3="DialogDescription",B3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(F3,n);return d.jsx(_t.p,{id:a.descriptionId,...r,ref:t})});B3.displayName=F3;var H3="DialogClose",V3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(H3,n);return d.jsx(_t.button,{type:"button",...r,ref:t,onClick:Ve(e.onClick,()=>a.onOpenChange(!1))})});V3.displayName=H3;function J_(e){return e?"open":"closed"}var G3="DialogTitleWarning",[$ve,W3]=Gee(G3,{contentName:Rl,titleName:X_,docsSlug:"dialog"}),ole=({titleId:e})=>{const t=W3(G3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
100
+ `)},Mre=0,Oc=[];function jre(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),a=v.useState(Mre++)[0],s=v.useState(u4)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var E=rre([e.lockRef.current],(e.shards||[]).map(Wj),!0).filter(Boolean);return E.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),E.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=v.useCallback(function(E,w){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!i.current.allowPinchZoom;var _=sg(E),S=n.current,T="deltaX"in E?E.deltaX:S[0]-_[0],R="deltaY"in E?E.deltaY:S[1]-_[1],C,I=E.target,A=Math.abs(T)>Math.abs(R)?"h":"v";if("touches"in E&&A==="h"&&I.type==="range")return!1;var O=Vj(A,I);if(!O)return!0;if(O?C=A:(C=A==="v"?"h":"v",O=Vj(A,I)),!O)return!1;if(!r.current&&"changedTouches"in E&&(T||R)&&(r.current=C),!C)return!0;var j=r.current||C;return Ore(j,w,E,j==="h"?T:R)},[]),u=v.useCallback(function(E){var w=E;if(!(!Oc.length||Oc[Oc.length-1]!==s)){var _="deltaY"in w?Gj(w):sg(w),S=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&Dre(C.delta,_)})[0];if(S&&S.should){w.cancelable&&w.preventDefault();return}if(!S){var T=(i.current.shards||[]).map(Wj).filter(Boolean).filter(function(C){return C.contains(w.target)}),R=T.length>0?c(w,T[0]):!i.current.noIsolation;R&&w.cancelable&&w.preventDefault()}}},[]),f=v.useCallback(function(E,w,_,S){var T={name:E,delta:w,target:_,should:S,shadowParent:Pre(_)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(R){return R!==T})},1)},[]),m=v.useCallback(function(E){n.current=sg(E),r.current=void 0},[]),h=v.useCallback(function(E){f(E.type,Gj(E),E.target,c(E,e.lockRef.current))},[]),b=v.useCallback(function(E){f(E.type,sg(E),E.target,c(E,e.lockRef.current))},[]);v.useEffect(function(){return Oc.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:b}),document.addEventListener("wheel",u,Ic),document.addEventListener("touchmove",u,Ic),document.addEventListener("touchstart",m,Ic),function(){Oc=Oc.filter(function(E){return E!==s}),document.removeEventListener("wheel",u,Ic),document.removeEventListener("touchmove",u,Ic),document.removeEventListener("touchstart",m,Ic)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(s,{styles:Lre(a)}):null,y?v.createElement(Tre,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Pre(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Ure=fre(c4,jre);var Ap=v.forwardRef(function(e,t){return v.createElement(yy,Mo({},e,{ref:t,sideCar:Ure}))});Ap.classNames=yy.classNames;var vx=["Enter"," "],$re=["ArrowDown","PageUp","Home"],m4=["ArrowUp","PageDown","End"],zre=[...$re,...m4],Fre={ltr:[...vx,"ArrowRight"],rtl:[...vx,"ArrowLeft"]},Bre={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ip="Menu",[qf,Hre,Vre]=E_(Ip),[$l,h4]=No(Ip,[Vre,Pi,t4]),vy=Pi(),g4=t4(),[Gre,zl]=$l(Ip),[Wre,Op]=$l(Ip),b4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:s,modal:i=!0}=e,c=vy(t),[u,f]=v.useState(null),m=v.useRef(!1),h=Bo(s),b=x_(a);return v.useEffect(()=>{const y=()=>{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",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),d.jsx(my,{...c,children:d.jsx(Gre,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:f,children:d.jsx(Wre,{scope:t,onClose:v.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:b,modal:i,children:r})})})};b4.displayName=Ip;var Kre="MenuAnchor",O_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=vy(n);return d.jsx(Cp,{...a,...r,ref:t})});O_.displayName=Kre;var D_="MenuPortal",[Yre,y4]=$l(D_,{forceMount:void 0}),v4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,s=zl(D_,t);return d.jsx(Yre,{scope:t,forceMount:n,children:d.jsx(za,{present:n||s.open,children:d.jsx(ed,{asChild:!0,container:a,children:r})})})};v4.displayName=D_;var to="MenuContent",[Zre,L_]=$l(to),w4=v.forwardRef((e,t)=>{const n=y4(to,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,s=zl(to,e.__scopeMenu),i=Op(to,e.__scopeMenu);return d.jsx(qf.Provider,{scope:e.__scopeMenu,children:d.jsx(za,{present:r||s.open,children:d.jsx(qf.Slot,{scope:e.__scopeMenu,children:i.modal?d.jsx(qre,{...a,ref:t}):d.jsx(Xre,{...a,ref:t})})})})}),qre=v.forwardRef((e,t)=>{const n=zl(to,e.__scopeMenu),r=v.useRef(null),a=Jt(t,r);return v.useEffect(()=>{const s=r.current;if(s)return by(s)},[]),d.jsx(M_,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ve(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Xre=v.forwardRef((e,t)=>{const n=zl(to,e.__scopeMenu);return d.jsx(M_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Jre=Nl("MenuContent.ScrollLock"),M_=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:b,onDismiss:y,disableOutsideScroll:x,...E}=e,w=zl(to,n),_=Op(to,n),S=vy(n),T=g4(n),R=Hre(n),[C,I]=v.useState(null),A=v.useRef(null),O=Jt(t,A,w.onContentChange),j=v.useRef(0),U=v.useRef(""),B=v.useRef(0),W=v.useRef(null),J=v.useRef("right"),ee=v.useRef(0),re=x?Ap:v.Fragment,F=x?{as:Jre,allowPinchZoom:!0}:void 0,K=ne=>{const te=U.current+ne,D=R().filter(G=>!G.disabled),H=document.activeElement,$=D.find(G=>G.ref.current===H)?.textValue,L=D.map(G=>G.textValue),M=uae(L,te,$),z=D.find(G=>G.textValue===M)?.ref.current;(function G(q){U.current=q,window.clearTimeout(j.current),q!==""&&(j.current=window.setTimeout(()=>G(""),1e3))})(te),z&&setTimeout(()=>z.focus())};v.useEffect(()=>()=>window.clearTimeout(j.current),[]),cy();const V=v.useCallback(ne=>J.current===W.current?.side&&fae(ne,W.current?.area),[]);return d.jsx(Zre,{scope:n,searchRef:U,onItemEnter:v.useCallback(ne=>{V(ne)&&ne.preventDefault()},[V]),onItemLeave:v.useCallback(ne=>{V(ne)||(A.current?.focus(),I(null))},[V]),onTriggerLeave:v.useCallback(ne=>{V(ne)&&ne.preventDefault()},[V]),pointerGraceTimerRef:B,onPointerGraceIntentChange:v.useCallback(ne=>{W.current=ne},[]),children:d.jsx(re,{...F,children:d.jsx(Np,{asChild:!0,trapped:a,onMountAutoFocus:Ve(s,ne=>{ne.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:d.jsx(Xu,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:b,onDismiss:y,children:d.jsx(Jne,{asChild:!0,...T,dir:_.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:I,onEntryFocus:Ve(u,ne=>{_.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(hy,{role:"menu","aria-orientation":"vertical","data-state":j4(w.open),"data-radix-menu-content":"",dir:_.dir,...S,...E,ref:O,style:{outline:"none",...E.style},onKeyDown:Ve(E.onKeyDown,ne=>{const D=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,H=ne.ctrlKey||ne.altKey||ne.metaKey,$=ne.key.length===1;D&&(ne.key==="Tab"&&ne.preventDefault(),!H&&$&&K(ne.key));const L=A.current;if(ne.target!==L||!zre.includes(ne.key))return;ne.preventDefault();const z=R().filter(G=>!G.disabled).map(G=>G.ref.current);m4.includes(ne.key)&&z.reverse(),lae(z)}),onBlur:Ve(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(j.current),U.current="")}),onPointerMove:Ve(e.onPointerMove,Xf(ne=>{const te=ne.target,D=ee.current!==ne.clientX;if(ne.currentTarget.contains(te)&&D){const H=ne.clientX>ee.current?"right":"left";J.current=H,ee.current=ne.clientX}}))})})})})})})});w4.displayName=to;var Qre="MenuGroup",j_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(_t.div,{role:"group",...r,ref:t})});j_.displayName=Qre;var eae="MenuLabel",E4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(_t.div,{...r,ref:t})});E4.displayName=eae;var fb="MenuItem",Kj="menu.itemSelect",wy=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,s=v.useRef(null),i=Op(fb,e.__scopeMenu),c=L_(fb,e.__scopeMenu),u=Jt(t,s),f=v.useRef(!1),m=()=>{const h=s.current;if(!n&&h){const b=new CustomEvent(Kj,{bubbles:!0,cancelable:!0});h.addEventListener(Kj,y=>r?.(y),{once:!0}),RF(h,b),b.defaultPrevented?f.current=!1:i.onClose()}};return d.jsx(x4,{...a,ref:u,disabled:n,onClick:Ve(e.onClick,m),onPointerDown:h=>{e.onPointerDown?.(h),f.current=!0},onPointerUp:Ve(e.onPointerUp,h=>{f.current||h.currentTarget?.click()}),onKeyDown:Ve(e.onKeyDown,h=>{const b=c.searchRef.current!=="";n||b&&h.key===" "||vx.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});wy.displayName=fb;var x4=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...s}=e,i=L_(fb,n),c=g4(n),u=v.useRef(null),f=Jt(t,u),[m,h]=v.useState(!1),[b,y]=v.useState("");return v.useEffect(()=>{const x=u.current;x&&y((x.textContent??"").trim())},[s.children]),d.jsx(qf.ItemSlot,{scope:n,disabled:r,textValue:a??b,children:d.jsx(Qne,{asChild:!0,...c,focusable:!r,children:d.jsx(_t.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:f,onPointerMove:Ve(e.onPointerMove,Xf(x=>{r?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ve(e.onPointerLeave,Xf(x=>i.onItemLeave(x))),onFocus:Ve(e.onFocus,()=>h(!0)),onBlur:Ve(e.onBlur,()=>h(!1))})})})}),tae="MenuCheckboxItem",S4=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return d.jsx(C4,{scope:e.__scopeMenu,checked:n,children:d.jsx(wy,{role:"menuitemcheckbox","aria-checked":pb(n)?"mixed":n,...a,ref:t,"data-state":U_(n),onSelect:Ve(a.onSelect,()=>r?.(pb(n)?!0:!n),{checkForDefaultPrevented:!1})})})});S4.displayName=tae;var _4="MenuRadioGroup",[nae,rae]=$l(_4,{value:void 0,onValueChange:()=>{}}),T4=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,s=Bo(r);return d.jsx(nae,{scope:e.__scopeMenu,value:n,onValueChange:s,children:d.jsx(j_,{...a,ref:t})})});T4.displayName=_4;var N4="MenuRadioItem",k4=v.forwardRef((e,t)=>{const{value:n,...r}=e,a=rae(N4,e.__scopeMenu),s=n===a.value;return d.jsx(C4,{scope:e.__scopeMenu,checked:s,children:d.jsx(wy,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":U_(s),onSelect:Ve(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});k4.displayName=N4;var P_="MenuItemIndicator",[C4,aae]=$l(P_,{checked:!1}),R4=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,s=aae(P_,n);return d.jsx(za,{present:r||pb(s.checked)||s.checked===!0,children:d.jsx(_t.span,{...a,ref:t,"data-state":U_(s.checked)})})});R4.displayName=P_;var oae="MenuSeparator",A4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(_t.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});A4.displayName=oae;var sae="MenuArrow",I4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=vy(n);return d.jsx(gy,{...a,...r,ref:t})});I4.displayName=sae;var iae="MenuSub",[Uve,O4]=$l(iae),hf="MenuSubTrigger",D4=v.forwardRef((e,t)=>{const n=zl(hf,e.__scopeMenu),r=Op(hf,e.__scopeMenu),a=O4(hf,e.__scopeMenu),s=L_(hf,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=s,f={__scopeMenu:e.__scopeMenu},m=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>m,[m]),v.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),u(null)}},[c,u]),d.jsx(O_,{asChild:!0,...f,children:d.jsx(x4,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":j4(n.open),...e,ref:Fo(t,a.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ve(e.onPointerMove,Xf(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ve(e.onPointerLeave,Xf(h=>{m();const b=n.content?.getBoundingClientRect();if(b){const y=n.content?.dataset.side,x=y==="right",E=x?-5:5,w=b[x?"left":"right"],_=b[x?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+E,y:h.clientY},{x:w,y:b.top},{x:_,y:b.top},{x:_,y:b.bottom},{x:w,y:b.bottom}],side:y}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ve(e.onKeyDown,h=>{const b=s.searchRef.current!=="";e.disabled||b&&h.key===" "||Fre[r.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});D4.displayName=hf;var L4="MenuSubContent",M4=v.forwardRef((e,t)=>{const n=y4(to,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,s=zl(to,e.__scopeMenu),i=Op(to,e.__scopeMenu),c=O4(L4,e.__scopeMenu),u=v.useRef(null),f=Jt(t,u);return d.jsx(qf.Provider,{scope:e.__scopeMenu,children:d.jsx(za,{present:r||s.open,children:d.jsx(qf.Slot,{scope:e.__scopeMenu,children:d.jsx(M_,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:f,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{i.isUsingKeyboardRef.current&&u.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ve(e.onFocusOutside,m=>{m.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ve(e.onEscapeKeyDown,m=>{i.onClose(),m.preventDefault()}),onKeyDown:Ve(e.onKeyDown,m=>{const h=m.currentTarget.contains(m.target),b=Bre[i.dir].includes(m.key);h&&b&&(s.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});M4.displayName=L4;function j4(e){return e?"open":"closed"}function pb(e){return e==="indeterminate"}function U_(e){return pb(e)?"indeterminate":e?"checked":"unchecked"}function lae(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function cae(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function uae(e,t,n){const a=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=cae(e,Math.max(s,0));a.length===1&&(i=i.filter(f=>f!==n));const u=i.find(f=>f.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function dae(e,t){const{x:n,y:r}=e;let a=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const c=t[s],u=t[i],f=c.x,m=c.y,h=u.x,b=u.y;m>r!=b>r&&n<(h-f)*(r-m)/(b-m)+f&&(a=!a)}return a}function fae(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return dae(n,t)}function Xf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var pae=b4,mae=O_,hae=v4,gae=w4,bae=j_,yae=E4,vae=wy,wae=S4,Eae=T4,xae=k4,Sae=R4,_ae=A4,Tae=I4,Nae=D4,kae=M4,Ey="DropdownMenu",[Cae]=No(Ey,[h4]),ia=h4(),[Rae,P4]=Cae(Ey),U4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:s,onOpenChange:i,modal:c=!0}=e,u=ia(t),f=v.useRef(null),[m,h]=Rs({prop:a,defaultProp:s??!1,onChange:i,caller:Ey});return d.jsx(Rae,{scope:t,triggerId:$r(),triggerRef:f,contentId:$r(),open:m,onOpenChange:h,onOpenToggle:v.useCallback(()=>h(b=>!b),[h]),modal:c,children:d.jsx(pae,{...u,open:m,onOpenChange:h,dir:r,modal:c,children:n})})};U4.displayName=Ey;var $4="DropdownMenuTrigger",z4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,s=P4($4,n),i=ia(n);return d.jsx(mae,{asChild:!0,...i,children:d.jsx(_t.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:Fo(t,s.triggerRef),onPointerDown:Ve(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:Ve(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});z4.displayName=$4;var Aae="DropdownMenuPortal",F4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ia(t);return d.jsx(hae,{...r,...n})};F4.displayName=Aae;var B4="DropdownMenuContent",H4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=P4(B4,n),s=ia(n),i=v.useRef(!1);return d.jsx(gae,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...r,ref:t,onCloseAutoFocus:Ve(e.onCloseAutoFocus,c=>{i.current||a.triggerRef.current?.focus(),i.current=!1,c.preventDefault()}),onInteractOutside:Ve(e.onInteractOutside,c=>{const u=c.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,m=u.button===2||f;(!a.modal||m)&&(i.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)"}})});H4.displayName=B4;var Iae="DropdownMenuGroup",Oae=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(bae,{...a,...r,ref:t})});Oae.displayName=Iae;var Dae="DropdownMenuLabel",V4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(yae,{...a,...r,ref:t})});V4.displayName=Dae;var Lae="DropdownMenuItem",G4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(vae,{...a,...r,ref:t})});G4.displayName=Lae;var Mae="DropdownMenuCheckboxItem",W4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(wae,{...a,...r,ref:t})});W4.displayName=Mae;var jae="DropdownMenuRadioGroup",Pae=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(Eae,{...a,...r,ref:t})});Pae.displayName=jae;var Uae="DropdownMenuRadioItem",K4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(xae,{...a,...r,ref:t})});K4.displayName=Uae;var $ae="DropdownMenuItemIndicator",zae=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(Sae,{...a,...r,ref:t})});zae.displayName=$ae;var Fae="DropdownMenuSeparator",Y4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(_ae,{...a,...r,ref:t})});Y4.displayName=Fae;var Bae="DropdownMenuArrow",Hae=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(Tae,{...a,...r,ref:t})});Hae.displayName=Bae;var Vae="DropdownMenuSubTrigger",Z4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(Nae,{...a,...r,ref:t})});Z4.displayName=Vae;var Gae="DropdownMenuSubContent",q4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=ia(n);return d.jsx(kae,{...a,...r,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)"}})});q4.displayName=Gae;var Wae=U4,Kae=z4,Yae=F4,X4=H4,J4=V4,Q4=G4,Zae=W4,qae=K4,e3=Y4,Xae=Z4,Jae=q4;const wx=Wae,Ex=Kae;Xae.displayName;Jae.displayName;function mb({ref:e,className:t,sideOffset:n=4,...r}){return d.jsx(Yae,{children:d.jsx(X4,{ref:e,sideOffset:n,className:Oe("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),...r})})}mb.displayName=X4.displayName;function xs({ref:e,className:t,inset:n,...r}){return d.jsx(Q4,{ref:e,className:Oe("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),...r})}xs.displayName=Q4.displayName;Zae.displayName;qae.displayName;function xx({ref:e,className:t,inset:n,...r}){return d.jsx(J4,{ref:e,className:Oe("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...r})}xx.displayName=J4.displayName;function gf({ref:e,className:t,...n}){return d.jsx(e3,{ref:e,className:Oe("-mx-1 my-1 h-px bg-muted",t),...n})}gf.displayName=e3.displayName;var Qae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ps=Qae.reduce((e,t)=>{const n=dF(`Primitive.${t}`),r=v.forwardRef((a,s)=>{const{asChild:i,...c}=a,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),eoe="Label",t3=v.forwardRef((e,t)=>d.jsx(Ps.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));t3.displayName=eoe;var toe=t3;function Wt({className:e,...t}){return d.jsx(toe,{"data-slot":"label",className:Oe("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 td({message:e,className:t="",vertical:n,noBorder:r}){return d.jsx("div",{className:Oe(`mt-2 rounded-md p-6 ${t}`,!r&&"border"),children:d.jsxs("p",{className:Oe("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[d.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:d.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:d.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[d.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"}),d.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),d.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),e]})})}function n3({className:e,color:t,children:n,grayscaled:r=!1}){const a=v.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return r?0:.2},[t,r]),s=v.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return r?.3:.4},[t,r]),i=v.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=v.useMemo(()=>t||`oklch(${Math.min(s,1)} ${a} ${i})`,[i,a,s]),u=v.useMemo(()=>`oklch(${Math.min(s*2,1)} ${a} ${i})`,[i,a,s,t]),f=v.useMemo(()=>Math.floor(Math.random()*360),[i]),m=v.useMemo(()=>"1000%",[]);return d.jsx("section",{className:Oe("relative w-full h-full overflow-hidden",e),style:{background:`${u}`},children:d.jsxs("div",{className:"isolate relative w-full h-full",children:[d.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${f}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${m})`}}),n&&d.jsx("div",{className:"relative z-10 w-full h-full",children:n})]})})}function $_(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xy="Switch",[noe]=No(xy),[roe,aoe]=noe(xy),r3=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:s,required:i,disabled:c,value:u="on",onCheckedChange:f,form:m,...h}=e,[b,y]=v.useState(null),x=Jt(t,T=>y(T)),E=v.useRef(!1),w=b?m||!!b.closest("form"):!0,[_,S]=Rs({prop:a,defaultProp:s??!1,onChange:f,caller:xy});return d.jsxs(roe,{scope:n,checked:_,disabled:c,children:[d.jsx(_t.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":i3(_),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:x,onClick:Ve(e.onClick,T=>{S(R=>!R),w&&(E.current=T.isPropagationStopped(),E.current||T.stopPropagation())})}),w&&d.jsx(s3,{control:b,bubbles:!E.current,name:r,value:u,checked:_,required:i,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});r3.displayName=xy;var a3="SwitchThumb",o3=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=aoe(a3,n);return d.jsx(_t.span,{"data-state":i3(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});o3.displayName=a3;var ooe="SwitchBubbleInput",s3=v.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},s)=>{const i=v.useRef(null),c=Jt(i,s),u=$_(n),f=R_(t);return v.useEffect(()=>{const m=i.current;if(!m)return;const h=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==n&&y){const x=new Event("click",{bubbles:r});y.call(m,n),m.dispatchEvent(x)}},[u,n,r]),d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});s3.displayName=ooe;function i3(e){return e?"checked":"unchecked"}var l3=r3,soe=o3;function Sy({ref:e,className:t,...n}){return d.jsx(l3,{className:Oe("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:d.jsx(soe,{className:Oe("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")})})}Sy.displayName=l3.displayName;var c3=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"}),ioe="VisuallyHidden",u3=v.forwardRef((e,t)=>d.jsx(_t.span,{...e,ref:t,style:{...c3,...e.style}}));u3.displayName=ioe;var loe=u3,[_y]=No("Tooltip",[Pi]),Ty=Pi(),d3="TooltipProvider",coe=700,Sx="tooltip.open",[uoe,z_]=_y(d3),f3=e=>{const{__scopeTooltip:t,delayDuration:n=coe,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:s}=e,i=v.useRef(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),d.jsx(uoe,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),i.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(f=>{c.current=f},[]),disableHoverableContent:a,children:s})};f3.displayName=d3;var Jf="Tooltip",[doe,Dp]=_y(Jf),p3=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:s,disableHoverableContent:i,delayDuration:c}=e,u=z_(Jf,e.__scopeTooltip),f=Ty(t),[m,h]=v.useState(null),b=$r(),y=v.useRef(0),x=i??u.disableHoverableContent,E=c??u.delayDuration,w=v.useRef(!1),[_,S]=Rs({prop:r,defaultProp:a??!1,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(Sx))):u.onClose(),s?.(A)},caller:Jf}),T=v.useMemo(()=>_?w.current?"delayed-open":"instant-open":"closed",[_]),R=v.useCallback(()=>{window.clearTimeout(y.current),y.current=0,w.current=!1,S(!0)},[S]),C=v.useCallback(()=>{window.clearTimeout(y.current),y.current=0,S(!1)},[S]),I=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{w.current=!0,S(!0),y.current=0},E)},[E,S]);return v.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),d.jsx(my,{...f,children:d.jsx(doe,{scope:t,contentId:b,open:_,stateAttribute:T,trigger:m,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{u.isOpenDelayedRef.current?I():R()},[u.isOpenDelayedRef,I,R]),onTriggerLeave:v.useCallback(()=>{x?C():(window.clearTimeout(y.current),y.current=0)},[C,x]),onOpen:R,onClose:C,disableHoverableContent:x,children:n})})};p3.displayName=Jf;var _x="TooltipTrigger",m3=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Dp(_x,n),s=z_(_x,n),i=Ty(n),c=v.useRef(null),u=Jt(t,c,a.onTriggerChange),f=v.useRef(!1),m=v.useRef(!1),h=v.useCallback(()=>f.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),d.jsx(Cp,{asChild:!0,...i,children:d.jsx(_t.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:u,onPointerMove:Ve(e.onPointerMove,b=>{b.pointerType!=="touch"&&!m.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{a.onTriggerLeave(),m.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ve(e.onFocus,()=>{f.current||a.onOpen()}),onBlur:Ve(e.onBlur,a.onClose),onClick:Ve(e.onClick,a.onClose)})})});m3.displayName=_x;var F_="TooltipPortal",[foe,poe]=_y(F_,{forceMount:void 0}),h3=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,s=Dp(F_,t);return d.jsx(foe,{scope:t,forceMount:n,children:d.jsx(za,{present:n||s.open,children:d.jsx(ed,{asChild:!0,container:a,children:r})})})};h3.displayName=F_;var Iu="TooltipContent",g3=v.forwardRef((e,t)=>{const n=poe(Iu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...s}=e,i=Dp(Iu,e.__scopeTooltip);return d.jsx(za,{present:r||i.open,children:i.disableHoverableContent?d.jsx(b3,{side:a,...s,ref:t}):d.jsx(moe,{side:a,...s,ref:t})})}),moe=v.forwardRef((e,t)=>{const n=Dp(Iu,e.__scopeTooltip),r=z_(Iu,e.__scopeTooltip),a=v.useRef(null),s=Jt(t,a),[i,c]=v.useState(null),{trigger:u,onClose:f}=n,m=a.current,{onPointerInTransitChange:h}=r,b=v.useCallback(()=>{c(null),h(!1)},[h]),y=v.useCallback((x,E)=>{const w=x.currentTarget,_={x:x.clientX,y:x.clientY},S=yoe(_,w.getBoundingClientRect()),T=voe(_,S),R=woe(E.getBoundingClientRect()),C=xoe([...T,...R]);c(C),h(!0)},[h]);return v.useEffect(()=>()=>b(),[b]),v.useEffect(()=>{if(u&&m){const x=w=>y(w,m),E=w=>y(w,u);return u.addEventListener("pointerleave",x),m.addEventListener("pointerleave",E),()=>{u.removeEventListener("pointerleave",x),m.removeEventListener("pointerleave",E)}}},[u,m,y,b]),v.useEffect(()=>{if(i){const x=E=>{const w=E.target,_={x:E.clientX,y:E.clientY},S=u?.contains(w)||m?.contains(w),T=!Eoe(_,i);S?b():T&&(b(),f())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,m,i,f,b]),d.jsx(b3,{...e,ref:s})}),[hoe,goe]=_y(Jf,{isInside:!1}),boe=Xee("TooltipContent"),b3=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:i,...c}=e,u=Dp(Iu,n),f=Ty(n),{onClose:m}=u;return v.useEffect(()=>(document.addEventListener(Sx,m),()=>document.removeEventListener(Sx,m)),[m]),v.useEffect(()=>{if(u.trigger){const h=b=>{b.target?.contains(u.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,m]),d.jsx(Xu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:d.jsxs(hy,{"data-state":u.stateAttribute,...f,...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:[d.jsx(boe,{children:r}),d.jsx(hoe,{scope:n,isInside:!0,children:d.jsx(loe,{id:u.contentId,role:"tooltip",children:a||r})})]})})});g3.displayName=Iu;var y3="TooltipArrow",v3=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Ty(n);return goe(y3,n).isInside?null:d.jsx(gy,{...a,...r,ref:t})});v3.displayName=y3;function yoe(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,a,s)){case s:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function voe(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function woe(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function Eoe(e,t){const{x:n,y:r}=e;let a=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const c=t[s],u=t[i],f=c.x,m=c.y,h=u.x,b=u.y;m>r!=b>r&&n<(h-f)*(r-m)/(b-m)+f&&(a=!a)}return a}function xoe(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Soe(t)}function Soe(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))n.pop();else break}n.push(a)}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 _oe=f3,Toe=p3,Noe=m3,koe=h3,Coe=g3,Roe=v3;function w3({delayDuration:e=0,...t}){return d.jsx(_oe,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ot({...e}){return d.jsx(w3,{children:d.jsx(Toe,{"data-slot":"tooltip",...e})})}function Dt({...e}){return d.jsx(Noe,{"data-slot":"tooltip-trigger",...e})}function Lt({className:e,sideOffset:t=0,children:n,...r}){return d.jsx(koe,{children:d.jsxs(Coe,{"data-slot":"tooltip-content",sideOffset:t,className:Oe("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),...r,children:[n,d.jsx(Roe,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class Aoe{name="mcp_inspector_open";properties;constructor(t){this.properties={server_url:t.serverUrl,connection_count:t.connectionCount}}}class Yj{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 Zj{name="mcp_resource_read";properties;constructor(t){this.properties={resource_uri:t.resourceUri,server_id:t.serverId,success:t.success,error:t.error}}}class qj{name="mcp_prompt_call";properties;constructor(t){this.properties={prompt_name:t.promptName,server_id:t.serverId,success:t.success,error:t.error}}}class Xj{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 Ioe{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 Ooe{name="mcp_server_removed";properties;constructor(t){this.properties={server_id:t.serverId}}}class Doe{name="mcp_command_palette_open";properties;constructor(t){this.properties={trigger:t.trigger}}}class Loe{name="mcp_tool_saved";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId}}}function Jw(){try{return"0.12.0-canary.6"}catch{return"0.0.0"}}var Moe={};function Qw(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class Jj{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,r=setTimeout(()=>n.abort(),this.timeout),a=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(r),!a.ok)throw new Error(`HTTP error! status: ${a.status}`)}catch{}}}function di(e){return`mcp_inspector_telemetry_${e}`}class Tr{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=Qw(),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 Jj(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new Jj(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(di("disabled"))==="true"||typeof process<"u"&&Moe?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(di("source")):null}static getInstance(){return Tr.instance||(Tr.instance=new Tr),Tr.instance}setSource(t){this._source=t,typeof localStorage<"u"&&localStorage.setItem(di("source"),t)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!Qw())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const t=localStorage.getItem(di("user_id"));if(t)this._currUserId=t;else{const n=this.generateUserId();localStorage.setItem(di("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(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&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:Jw(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(n)}catch{}if(this._scarfClient)try{const n={};n.mcp_use_version=Jw(),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&&Qw())try{const n=Jw();let r=!1,a=!1;const s=localStorage.getItem(di("download_version"));if(s?n>s&&(r=!0,a=!1,localStorage.setItem(di("download_version"),n)):(r=!0,a=!0,localStorage.setItem(di("download_version"),n)),r){const i={...t||{}};i.mcp_use_version=n,i.user_id=this.userId,i.event="package_download",i.first_download=a,i.language="typescript",i.source=this._source,i.package="inspector",await this._scarfClient.logEvent(i)}}catch{}}async trackInspectorOpen(t){const n=new Aoe(t);await this.capture(n)}}const joe={model:"stub-model",stopReason:"endTurn",role:"assistant",content:{type:"text",text:"positive"}};function Poe({requestId:e,serverName:t,onViewDetails:n,onApprove:r,onDeny:a}){return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"Sampling Request Received"}),d.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["New request from ",t]})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:s=>{s.stopPropagation(),n()},children:"View Details"}),d.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:s=>{s.stopPropagation(),r(joe)},children:"Approve"}),d.jsx("button",{className:"px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground",onClick:s=>{s.stopPropagation(),a()},children:"Deny"})]})]})}function Uoe({requestId:e,serverName:t,mode:n,message:r,url:a,onViewDetails:s,onOpenUrl:i,onCancel:c}){return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"Elicitation Request Received"}),d.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["From ",t,": ",r]}),n==="url"&&a&&d.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono",children:a})]}),d.jsxs("div",{className:"flex gap-2 flex-wrap",children:[d.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:"View Details"}),n==="url"&&i&&d.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:"Open URL"}),d.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 ig=()=>{},lg=()=>{},cg=()=>{},ug=()=>{},E3=v.createContext(null);function B_(){const e=v.use(E3);if(!e)throw new Error("useMcpContext must be used within a McpProvider");return e}function $oe({url:e,name:t,proxyConfig:n,transportType:r,connectionId:a,onUpdate:s,onRemove:i}){const c=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=e,f={};if(n?.proxyAddress){const L=new URL(n.proxyAddress),M=new URL(e);u=`${L.origin}${L.pathname}${M.pathname}${M.search}`,f["X-Target-URL"]=e}n?.customHeaders&&(f={...f,...n.customHeaders});const[m,h]=v.useState([]),b=v.useRef(0),[y,x]=v.useState([]),E=v.useRef(0),w=v.useMemo(()=>m.map(L=>({id:L.id,request:L.request,timestamp:L.timestamp,serverName:L.serverName})),[m]),_=v.useMemo(()=>y.map(L=>({id:L.id,request:L.request,timestamp:L.timestamp,serverName:L.serverName})),[y]),S=v.useRef(null),[T,R]=v.useState(!1),C=v.useRef(!1);v.useEffect(()=>{typeof window<"u"&&!C.current&&(C.current=!0,hr(()=>import("./transport-wrapper-browser-BI4dDu3b.js"),[]).then(L=>{S.current=L.wrapTransportForLogging,R(!0),console.log("[McpContext] Transport wrapper loaded")}).catch(L=>{console.error("[McpContext] Failed to load transport wrapper:",L)}))},[]);const I=v.useMemo(()=>{if(!(!T||!S.current))return(L,M)=>{const z=a;return console.log("[McpContext] Applying transport wrapper, serverId:",z,"from connector:",M),S.current(L,z)}},[T,a]),A=`mcp-inspector-notifications-${a}`,O=500,[j,U]=v.useState([]);v.useEffect(()=>{try{const L=localStorage.getItem(A);if(L){const M=JSON.parse(L);Array.isArray(M)&&U(M)}}catch(L){console.error("Failed to load notifications from localStorage:",L)}},[A]),v.useEffect(()=>{try{localStorage.setItem(A,JSON.stringify(j))}catch(L){console.error("Failed to save notifications to localStorage:",L)}},[j,A]);const B=v.useCallback(L=>{U(M=>M.map(z=>z.id===L?{...z,read:!0}:z))},[]),W=v.useCallback(()=>{U(L=>L.map(M=>({...M,read:!0})))},[]),J=v.useCallback(()=>{U([])},[]),ee=v.useCallback(L=>{U(M=>{const z=[L,...M];return z.length>O?z.slice(0,O):z})},[]),re=v.useCallback((L,M)=>{h(z=>{const G=z.find(q=>q.id===L);return G?(G.resolve(M),z.filter(q=>q.id!==L)):z})},[]),F=v.useCallback((L,M)=>{h(z=>{const G=z.find(q=>q.id===L);return G?(G.reject(new Error(M||"User rejected sampling request")),z.filter(q=>q.id!==L)):z})},[]),K=v.useCallback((L,M)=>{x(z=>{const G=z.find(q=>q.id===L);return G?(G.resolve(M),z.filter(q=>q.id!==L)):z})},[]),V=v.useCallback((L,M)=>{x(z=>{const G=z.find(q=>q.id===L);return G?(G.reject(new Error(M||"User rejected elicitation request")),z.filter(q=>q.id!==L)):z})},[]),ne=v.useCallback(async L=>new Promise((M,z)=>{const G=`sampling-${b.current++}`,q={id:G,request:{params:L},timestamp:Date.now(),serverName:t,resolve:M,reject:z};h(ae=>[...ae,q]),typeof window<"u"&&hr(async()=>{const{toast:ae}=await Promise.resolve().then(()=>oP);return{toast:ae}},void 0).then(({toast:ae})=>{const ie=ae(d.jsx(Poe,{requestId:G,serverName:t,onViewDetails:()=>{const X=new globalThis.CustomEvent("navigate-to-sampling",{detail:{requestId:G}});window.dispatchEvent(X),ae.dismiss(ie)},onApprove:X=>{h(Z=>{const se=Z.find(me=>me.id===G);return se?(se.resolve(X),ae.success("Sampling request approved"),Z.filter(me=>me.id!==G)):Z}),ae.dismiss(ie)},onDeny:()=>{h(X=>{const Z=X.find(se=>se.id===G);return Z?(Z.reject(new Error("User denied sampling request from toast")),ae.error("Sampling request denied"),X.filter(se=>se.id!==G)):X}),ae.dismiss(ie)}}),{duration:5e3})})}),[t]),te=v.useCallback(async L=>new Promise((M,z)=>{const G=`elicitation-${E.current++}`,q={id:G,request:L,timestamp:Date.now(),serverName:t,resolve:M,reject:z};x(ae=>[...ae,q]),typeof window<"u"&&hr(async()=>{const{toast:ae}=await Promise.resolve().then(()=>oP);return{toast:ae}},void 0).then(({toast:ae})=>{const ie=ae(d.jsx(Uoe,{requestId:G,serverName:t,mode:L.mode||"form",message:L.message,url:L.mode==="url"?L.url:void 0,onViewDetails:()=>{const X=new globalThis.CustomEvent("navigate-to-elicitation",{detail:{requestId:G}});window.dispatchEvent(X),ae.dismiss(ie)},onOpenUrl:L.mode==="url"?()=>{window.open(L.url,"_blank"),ae.dismiss(ie)}:void 0,onCancel:()=>{x(X=>{const Z=X.find(se=>se.id===G);return Z?(Z.reject(new Error("User cancelled elicitation request from toast")),ae.error("Elicitation request cancelled"),X.filter(se=>se.id!==G)):X}),ae.dismiss(ie)}}),{duration:5e3})})}),[t]),D=m_({url:u,callbackUrl:c,customHeaders:Object.keys(f).length>0?f:void 0,transportType:r||"http",preventAutoAuth:!0,useRedirectFlow:!0,enabled:T,wrapTransport:I,onNotification:L=>{ee({id:globalThis.crypto.randomUUID(),method:L.method,params:L.params,timestamp:Date.now(),read:!1})},samplingCallback:ne,onElicitation:te}),H=v.useRef(s),$=v.useRef(null);return v.useEffect(()=>{H.current=s},[s]),v.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{D.state==="ready"&&D.serverInfo&&console.log("[McpContext] Server info available:",D.serverInfo);const L=j.filter(G=>!G.read).length,M={id:a,url:e,name:D.serverInfo?.name||t,state:D.state,tools:D.tools,resources:D.resources,prompts:D.prompts,error:D.error??null,authUrl:D.authUrl??null,customHeaders:f,transportType:r,proxyConfig:n,serverInfo:D.serverInfo,capabilities:D.capabilities,notifications:j,unreadNotificationCount:L,markNotificationRead:B,markAllNotificationsRead:W,clearNotifications:J,pendingSamplingRequests:w,approveSampling:re,rejectSampling:F,pendingElicitationRequests:_,approveElicitation:K,rejectElicitation:V,callTool:D.callTool,readResource:D.readResource,listPrompts:D.listPrompts,getPrompt:D.getPrompt,authenticate:D.authenticate,retry:D.retry,clearStorage:D.clearStorage,disconnect:D.disconnect,client:D.client},z=$.current;(!z||z.state!==M.state||z.error!==M.error||z.authUrl!==M.authUrl||z.name!==M.name||z.tools.length!==M.tools.length||z.resources.length!==M.resources.length||z.prompts.length!==M.prompts.length||z.serverInfo!==M.serverInfo||z.capabilities!==M.capabilities||z.notifications.length!==M.notifications.length||z.unreadNotificationCount!==M.unreadNotificationCount||z.pendingSamplingRequests.length!==M.pendingSamplingRequests.length||z.pendingElicitationRequests.length!==M.pendingElicitationRequests.length||!z.client)&&($.current=M,H.current(M))});else{const L=j.filter(G=>!G.read).length,M={id:a,url:e,name:D.serverInfo?.name||t,state:D.state,tools:D.tools,resources:D.resources,prompts:D.prompts,error:D.error??null,authUrl:D.authUrl??null,customHeaders:f,transportType:r,proxyConfig:n,serverInfo:D.serverInfo,capabilities:D.capabilities,notifications:j,unreadNotificationCount:L,markNotificationRead:B,markAllNotificationsRead:W,clearNotifications:J,pendingSamplingRequests:w,approveSampling:re,rejectSampling:F,pendingElicitationRequests:_,approveElicitation:K,rejectElicitation:V,callTool:D.callTool,readResource:D.readResource,listPrompts:D.listPrompts,getPrompt:D.getPrompt,authenticate:D.authenticate,retry:D.retry,clearStorage:D.clearStorage,disconnect:D.disconnect,client:D.client},z=$.current;(!z||z.state!==M.state||z.error!==M.error||z.authUrl!==M.authUrl||z.name!==M.name||z.tools.length!==M.tools.length||z.resources.length!==M.resources.length||z.prompts.length!==M.prompts.length||z.serverInfo!==M.serverInfo||z.capabilities!==M.capabilities||z.notifications.length!==M.notifications.length||z.unreadNotificationCount!==M.unreadNotificationCount||z.pendingSamplingRequests.length!==M.pendingSamplingRequests.length||z.pendingElicitationRequests.length!==M.pendingElicitationRequests.length||!z.client)&&($.current=M,H.current(M))}},[e,t,r,n,f,a,D.state,D.tools,D.resources,D.prompts,D.error,D.authUrl,D.serverInfo,D.capabilities,D.client,j,B,W,J,D.callTool,D.readResource,D.listPrompts,D.getPrompt,D.authenticate,D.retry,D.clearStorage,m,re,F,_,K,V]),null}function zoe({children:e}){const[t,n]=v.useState([]),[r,a]=v.useState(!1),[s,i]=v.useState(!0),[c,u]=v.useState([]);v.useEffect(()=>{try{const w=localStorage.getItem("mcp-inspector-connections");if(w){const S=JSON.parse(w);Array.isArray(S)&&(u(S),n(S.map(T=>({id:T.id||T.url,url:T.url,name:T.name||"MCP Server",state:"discovering",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:T.proxyConfig?.customHeaders,transportType:T.transportType,proxyConfig:T.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:ig,rejectSampling:lg,pendingElicitationRequests:[],approveElicitation:cg,rejectElicitation:ug,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}))))}const _=localStorage.getItem("mcp-inspector-auto-connect");_!==null&&i(_==="true")}catch(w){console.error("Failed to load connections from localStorage:",w)}finally{a(!0)}},[]),v.useEffect(()=>{r&&localStorage.setItem("mcp-inspector-connections",JSON.stringify(c))},[c,r]),v.useEffect(()=>{r&&localStorage.setItem("mcp-inspector-auto-connect",String(s))},[s,r]);const f=v.useCallback((w,_,S,T)=>{const R=c.find(A=>A.url===w),C=t.find(A=>A.url===w);if(R&&C){if(JSON.stringify(R.proxyConfig)!==JSON.stringify(S)&&S){u(O=>O.filter(j=>j.url!==w)),n(O=>O.filter(j=>j.url!==w)),setTimeout(()=>{const O={id:w,url:w,name:_||R.name||"MCP Server",proxyConfig:S,transportType:T||R.transportType};u(j=>[...j,O]),n(j=>[...j,{id:w,url:w,name:_||R.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:S?.customHeaders,transportType:T||R.transportType,proxyConfig:S,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:ig,rejectSampling:lg,pendingElicitationRequests:[],approveElicitation:cg,rejectElicitation:ug,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},10);return}return}if(R&&!C){(S||T)&&u(A=>A.map(O=>O.url===w?{...O,proxyConfig:S||O.proxyConfig,transportType:T||O.transportType,name:_||O.name}:O)),n(A=>[...A,{id:R.id||w,url:w,name:_||R.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:S?.customHeaders||R.proxyConfig?.customHeaders,transportType:T||R.transportType,proxyConfig:S||R.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:ig,rejectSampling:lg,pendingElicitationRequests:[],approveElicitation:cg,rejectElicitation:ug,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}]);return}const I={id:w,url:w,name:_||"MCP Server",proxyConfig:S,transportType:T};u(A=>[...A,I]),n(A=>[...A,{id:w,url:w,name:_||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:S?.customHeaders,transportType:T,proxyConfig:S,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},pendingSamplingRequests:[],approveSampling:ig,rejectSampling:lg,pendingElicitationRequests:[],approveElicitation:cg,rejectElicitation:ug,callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},[c,t]),m=v.useCallback(w=>{const _=t.find(T=>T.id===w);_&&(console.log(`[McpContext] Cleaning up connection: ${w}`),_.disconnect&&(console.log(`[McpContext] Disconnecting from server: ${w}`),_.disconnect()),_.clearStorage&&(console.log(`[McpContext] Clearing OAuth storage for connection: ${w}`),_.clearStorage())),u(T=>T.filter(R=>R.id!==w)),n(T=>T.filter(R=>R.id!==w));const S=localStorage.getItem("mcp-inspector-connections");if(S)try{const R=JSON.parse(S).filter(C=>(C.id||C.url)!==w);localStorage.setItem("mcp-inspector-connections",JSON.stringify(R))}catch(T){console.error("Failed to update localStorage on remove:",T)}Tr.getInstance().capture(new Ooe({serverId:w}))},[t]),h=v.useCallback((w,_)=>{u(S=>S.map(T=>T.id===w||T.url===w?{...T,..._}:T)),n(S=>S.map(T=>T.id===w?{...T,..._}:T))},[]),b=v.useCallback(w=>{n(_=>{const S=_.findIndex(C=>C.id===w.id);if(S===-1)return _;const T=_[S];if(T.state===w.state&&T.tools===w.tools&&T.resources===w.resources&&T.prompts===w.prompts&&T.error===w.error&&T.serverInfo===w.serverInfo&&T.client===w.client&&T.notifications===w.notifications&&T.unreadNotificationCount===w.unreadNotificationCount&&T.pendingSamplingRequests.length===w.pendingSamplingRequests.length&&T.pendingElicitationRequests.length===w.pendingElicitationRequests.length)return _;const R=[..._];return R[S]=w,R})},[]),y=v.useCallback(w=>{console.log("Connect requested for:",w)},[]),x=v.useCallback(w=>{console.log("Disconnect requested for:",w)},[]),E=v.useMemo(()=>({connections:t,addConnection:f,removeConnection:m,updateConnectionConfig:h,autoConnect:s,setAutoConnect:i,connectServer:y,disconnectServer:x,configLoaded:r}),[t,f,m,h,s,y,x,r]);return d.jsxs(E3.Provider,{value:E,children:[e,r&&s&&c.map(w=>{const _=`${w.id||w.url}-${w.proxyConfig?.proxyAddress?"proxy":"direct"}`;return console.warn("[McpContext] Rendering McpConnectionWrapper with key:",_,"proxyConfig:",w.proxyConfig),d.jsx($oe,{url:w.url,name:w.name,proxyConfig:w.proxyConfig,transportType:w.transportType,connectionId:w.id||w.url,onUpdate:b,onRemove:()=>m(w.id||w.url)},_)})]})}const Foe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Boe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Qj=e=>{const t=Boe(e);return t.charAt(0).toUpperCase()+t.slice(1)},x3=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Hoe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Voe={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 Goe=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:s,iconNode:i,...c},u)=>v.createElement("svg",{ref:u,...Voe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:x3("lucide",a),...!s&&!Hoe(c)&&{"aria-hidden":"true"},...c},[...i.map(([f,m])=>v.createElement(f,m)),...Array.isArray(s)?s:[s]]));const Xe=(e,t)=>{const n=v.forwardRef(({className:r,...a},s)=>v.createElement(Goe,{ref:s,iconNode:t,className:x3(`lucide-${Foe(Qj(e))}`,`lucide-${e}`,r),...a}));return n.displayName=Qj(e),n};const Woe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],Koe=Xe("arrow-down-to-line",Woe);const Yoe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],Zoe=Xe("arrow-up-from-line",Yoe);const qoe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Xoe=Xe("arrow-up",qoe);const Joe=[["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"}]],H_=Xe("bell",Joe);const Qoe=[["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"}]],S3=Xe("brush",Qoe);const ese=[["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"}]],tse=Xe("bug",ese);const nse=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],oa=Xe("check",nse);const rse=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Fl=Xe("chevron-down",rse);const ase=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ose=Xe("chevron-right",ase);const sse=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],V_=Xe("chevron-left",sse);const ise=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],lse=Xe("chevron-up",ise);const cse=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],use=Xe("chevrons-up-down",cse);const dse=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],eP=Xe("circle-minus",dse);const fse=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ou=Xe("clock",fse);const pse=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],G_=Xe("code",pse);const mse=[["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"}]],hse=Xe("cog",mse);const gse=[["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"}]],bse=Xe("command",gse);const yse=[["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"}]],zr=Xe("copy",yse);const vse=[["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"}]],Ny=Xe("database",vse);const wse=[["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"}]],Lp=Xe("download",wse);const Ese=[["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"}]],xse=Xe("ellipsis-vertical",Ese);const Sse=[["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"}]],Tx=Xe("external-link",Sse);const _se=[["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"}]],_3=Xe("eye-off",_se);const Tse=[["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"}]],Nx=Xe("eye",Tse);const Nse=[["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"}]],kse=Xe("file-code",Nse);const Cse=[["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"}]],Rse=Xe("file-image",Cse);const Ase=[["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"}]],W_=Xe("file-text",Ase);const Ise=[["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"}]],Ose=Xe("file",Ise);const Dse=[["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"}]],Lse=Xe("folder-open",Dse);const Mse=[["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"}]],jse=Xe("globe",Mse);const Pse=[["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"}]],Use=Xe("grip-vertical",Pse);const $se=[["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"}]],T3=Xe("hash",$se);const zse=[["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"}]],hb=Xe("history",zse);const Fse=[["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"}]],N3=Xe("key",Fse);const Bse=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ai=Xe("loader-circle",Bse);const Hse=[["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"}]],K_=Xe("maximize-2",Hse);const Vse=[["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"}]],Y_=Xe("maximize",Vse);const Gse=[["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"}]],Wse=Xe("message-circle",Gse);const Kse=[["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"}]],Qf=Xe("message-square",Kse);const Yse=[["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"}]],Zse=Xe("minimize",Yse);const qse=[["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"}]],tP=Xe("monitor",qse);const Xse=[["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"}]],Jse=Xe("moon",Xse);const Qse=[["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"}]],eie=Xe("picture-in-picture",Qse);const tie=[["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"}]],k3=Xe("play",tie);const nie=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],C3=Xe("plus",nie);const rie=[["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"}]],nP=Xe("rotate-ccw",rie);const aie=[["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"}]],Z_=Xe("save",aie);const oie=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],nd=Xe("search",oie);const sie=[["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"}]],iie=Xe("send",sie);const lie=[["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"}]],cie=Xe("server",lie);const uie=[["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"}]],cu=Xe("settings",uie);const die=[["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"}]],fie=Xe("shield",die);const pie=[["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"}]],mie=Xe("sparkles",pie);const hie=[["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"}]],R3=Xe("square-check-big",hie);const gie=[["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"}]],bie=Xe("square-pen",gie);const yie=[["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"}]],vie=Xe("sun-dim",yie);const wie=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],eE=Xe("terminal",wie);const Eie=[["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"}]],Ii=Xe("trash-2",Eie);const xie=[["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"}]],Sie=Xe("trash",xie);const _ie=[["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"}]],Cl=Xe("wrench",_ie);const Tie=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ko=Xe("x",Tie);const Nie=[["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"}]],ep=Xe("zap",Nie);function kie(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 Cie=e=>{switch(e){case"success":return Iie;case"info":return Die;case"warning":return Oie;case"error":return Lie;default:return null}},Rie=Array(12).fill(0),Aie=({visible:e,className:t})=>ce.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ce.createElement("div",{className:"sonner-spinner"},Rie.map((n,r)=>ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Iie=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Oie=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ce.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"})),Die=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Lie=ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ce.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"})),Mie=ce.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"},ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),jie=()=>{const[e,t]=ce.useState(document.hidden);return ce.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let kx=1;class Pie{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:r,...a}=t,s=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:kx++,i=this.toasts.find(u=>u.id===s),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(u=>u.id===s?(this.publish({...u,...t,id:s,title:r}),{...u,...t,id:s,dismissible:c,title:r}):u):this.addToast({title:r,...a,dismissible:c,id:s}),s},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(r=>r({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 r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let s=r!==void 0,i;const c=a.then(async f=>{if(i=["resolve",f],ce.isValidElement(f))s=!1,this.create({id:r,type:"default",message:f});else if($ie(f)&&!f.ok){s=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${f.status}`):n.error,b=typeof n.description=="function"?await n.description(`HTTP error! status: ${f.status}`):n.description,x=typeof h=="object"&&!ce.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:b,...x})}else if(f instanceof Error){s=!1;const h=typeof n.error=="function"?await n.error(f):n.error,b=typeof n.description=="function"?await n.description(f):n.description,x=typeof h=="object"&&!ce.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:b,...x})}else if(n.success!==void 0){s=!1;const h=typeof n.success=="function"?await n.success(f):n.success,b=typeof n.description=="function"?await n.description(f):n.description,x=typeof h=="object"&&!ce.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:b,...x})}}).catch(async f=>{if(i=["reject",f],n.error!==void 0){s=!1;const m=typeof n.error=="function"?await n.error(f):n.error,h=typeof n.description=="function"?await n.description(f):n.description,y=typeof m=="object"&&!ce.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:h,...y})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((f,m)=>c.then(()=>i[0]==="reject"?m(i[1]):f(i[1])).catch(m));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(t,n)=>{const r=n?.id||kx++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ba=new Pie,Uie=(e,t)=>{const n=t?.id||kx++;return ba.addToast({title:e,...t,id:n}),n},$ie=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",zie=Uie,Fie=()=>ba.toasts,Bie=()=>ba.getActiveToasts(),Xt=Object.assign(zie,{success:ba.success,info:ba.info,warning:ba.warning,error:ba.error,custom:ba.custom,message:ba.message,promise:ba.promise,dismiss:ba.dismiss,loading:ba.loading},{getHistory:Fie,getToasts:Bie});kie("[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 dg(e){return e.label!==void 0}const Hie=3,Vie="24px",Gie="16px",rP=4e3,Wie=356,Kie=14,Yie=45,Zie=200;function Lo(...e){return e.filter(Boolean).join(" ")}function qie(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const Xie=e=>{var t,n,r,a,s,i,c,u,f;const{invert:m,toast:h,unstyled:b,interacting:y,setHeights:x,visibleToasts:E,heights:w,index:_,toasts:S,expanded:T,removeToast:R,defaultRichColors:C,closeButton:I,style:A,cancelButtonStyle:O,actionButtonStyle:j,className:U="",descriptionClassName:B="",duration:W,position:J,gap:ee,expandByDefault:re,classNames:F,icons:K,closeButtonAriaLabel:V="Close toast"}=e,[ne,te]=ce.useState(null),[D,H]=ce.useState(null),[$,L]=ce.useState(!1),[M,z]=ce.useState(!1),[G,q]=ce.useState(!1),[ae,ie]=ce.useState(!1),[X,Z]=ce.useState(!1),[se,me]=ce.useState(0),[le,Te]=ce.useState(0),Be=ce.useRef(h.duration||W||rP),Ee=ce.useRef(null),_e=ce.useRef(null),Ue=_===0,fe=_+1<=E,Ae=h.type,ze=h.dismissible!==!1,we=h.className||"",at=h.descriptionClassName||"",lt=ce.useMemo(()=>w.findIndex(Ze=>Ze.toastId===h.id)||0,[w,h.id]),gt=ce.useMemo(()=>{var Ze;return(Ze=h.closeButton)!=null?Ze:I},[h.closeButton,I]),Ct=ce.useMemo(()=>h.duration||W||rP,[h.duration,W]),Le=ce.useRef(0),$e=ce.useRef(0),bt=ce.useRef(0),nt=ce.useRef(null),[Ut,ot]=J.split("-"),Ie=ce.useMemo(()=>w.reduce((Ze,vt,jt)=>jt>=lt?Ze:Ze+vt.height,0),[w,lt]),Me=jie(),He=h.invert||m,it=Ae==="loading";$e.current=ce.useMemo(()=>lt*ee+Ie,[lt,Ie]),ce.useEffect(()=>{Be.current=Ct},[Ct]),ce.useEffect(()=>{L(!0)},[]),ce.useEffect(()=>{const Ze=_e.current;if(Ze){const vt=Ze.getBoundingClientRect().height;return Te(vt),x(jt=>[{toastId:h.id,height:vt,position:h.position},...jt]),()=>x(jt=>jt.filter(Pt=>Pt.toastId!==h.id))}},[x,h.id]),ce.useLayoutEffect(()=>{if(!$)return;const Ze=_e.current,vt=Ze.style.height;Ze.style.height="auto";const jt=Ze.getBoundingClientRect().height;Ze.style.height=vt,Te(jt),x(Pt=>Pt.find(dn=>dn.toastId===h.id)?Pt.map(dn=>dn.toastId===h.id?{...dn,height:jt}:dn):[{toastId:h.id,height:jt,position:h.position},...Pt])},[$,h.title,h.description,x,h.id,h.jsx,h.action,h.cancel]);const pt=ce.useCallback(()=>{z(!0),me($e.current),x(Ze=>Ze.filter(vt=>vt.toastId!==h.id)),setTimeout(()=>{R(h)},Zie)},[h,R,x,$e]);ce.useEffect(()=>{if(h.promise&&Ae==="loading"||h.duration===1/0||h.type==="loading")return;let Ze;return T||y||Me?(()=>{if(bt.current<Le.current){const Pt=new Date().getTime()-Le.current;Be.current=Be.current-Pt}bt.current=new Date().getTime()})():(()=>{Be.current!==1/0&&(Le.current=new Date().getTime(),Ze=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),pt()},Be.current))})(),()=>clearTimeout(Ze)},[T,y,h,Ae,Me,pt]),ce.useEffect(()=>{h.delete&&(pt(),h.onDismiss==null||h.onDismiss.call(h,h))},[pt,h.delete]);function Et(){var Ze;if(K?.loading){var vt;return ce.createElement("div",{className:Lo(F?.loader,h==null||(vt=h.classNames)==null?void 0:vt.loader,"sonner-loader"),"data-visible":Ae==="loading"},K.loading)}return ce.createElement(Aie,{className:Lo(F?.loader,h==null||(Ze=h.classNames)==null?void 0:Ze.loader),visible:Ae==="loading"})}const xt=h.icon||K?.[Ae]||Cie(Ae);var un,mn;return ce.createElement("li",{tabIndex:0,ref:_e,className:Lo(U,we,F?.toast,h==null||(t=h.classNames)==null?void 0:t.toast,F?.default,F?.[Ae],h==null||(n=h.classNames)==null?void 0:n[Ae]),"data-sonner-toast":"","data-rich-colors":(un=h.richColors)!=null?un:C,"data-styled":!(h.jsx||h.unstyled||b),"data-mounted":$,"data-promise":!!h.promise,"data-swiped":X,"data-removed":M,"data-visible":fe,"data-y-position":Ut,"data-x-position":ot,"data-index":_,"data-front":Ue,"data-swiping":G,"data-dismissible":ze,"data-type":Ae,"data-invert":He,"data-swipe-out":ae,"data-swipe-direction":D,"data-expanded":!!(T||re&&$),"data-testid":h.testId,style:{"--index":_,"--toasts-before":_,"--z-index":S.length-_,"--offset":`${M?se:$e.current}px`,"--initial-height":re?"auto":`${le}px`,...A,...h.style},onDragEnd:()=>{q(!1),te(null),nt.current=null},onPointerDown:Ze=>{Ze.button!==2&&(it||!ze||(Ee.current=new Date,me($e.current),Ze.target.setPointerCapture(Ze.pointerId),Ze.target.tagName!=="BUTTON"&&(q(!0),nt.current={x:Ze.clientX,y:Ze.clientY})))},onPointerUp:()=>{var Ze,vt,jt;if(ae||!ze)return;nt.current=null;const Pt=Number(((Ze=_e.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),yr=Number(((vt=_e.current)==null?void 0:vt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),dn=new Date().getTime()-((jt=Ee.current)==null?void 0:jt.getTime()),Xn=ne==="x"?Pt:yr,Jn=Math.abs(Xn)/dn;if(Math.abs(Xn)>=Yie||Jn>.11){me($e.current),h.onDismiss==null||h.onDismiss.call(h,h),H(ne==="x"?Pt>0?"right":"left":yr>0?"down":"up"),pt(),ie(!0);return}else{var wn,fn;(wn=_e.current)==null||wn.style.setProperty("--swipe-amount-x","0px"),(fn=_e.current)==null||fn.style.setProperty("--swipe-amount-y","0px")}Z(!1),q(!1),te(null)},onPointerMove:Ze=>{var vt,jt,Pt;if(!nt.current||!ze||((vt=window.getSelection())==null?void 0:vt.toString().length)>0)return;const dn=Ze.clientY-nt.current.y,Xn=Ze.clientX-nt.current.x;var Jn;const wn=(Jn=e.swipeDirections)!=null?Jn:qie(J);!ne&&(Math.abs(Xn)>1||Math.abs(dn)>1)&&te(Math.abs(Xn)>Math.abs(dn)?"x":"y");let fn={x:0,y:0};const la=Qt=>1/(1.5+Math.abs(Qt)/20);if(ne==="y"){if(wn.includes("top")||wn.includes("bottom"))if(wn.includes("top")&&dn<0||wn.includes("bottom")&&dn>0)fn.y=dn;else{const Qt=dn*la(dn);fn.y=Math.abs(Qt)<Math.abs(dn)?Qt:dn}}else if(ne==="x"&&(wn.includes("left")||wn.includes("right")))if(wn.includes("left")&&Xn<0||wn.includes("right")&&Xn>0)fn.x=Xn;else{const Qt=Xn*la(Xn);fn.x=Math.abs(Qt)<Math.abs(Xn)?Qt:Xn}(Math.abs(fn.x)>0||Math.abs(fn.y)>0)&&Z(!0),(jt=_e.current)==null||jt.style.setProperty("--swipe-amount-x",`${fn.x}px`),(Pt=_e.current)==null||Pt.style.setProperty("--swipe-amount-y",`${fn.y}px`)}},gt&&!h.jsx&&Ae!=="loading"?ce.createElement("button",{"aria-label":V,"data-disabled":it,"data-close-button":!0,onClick:it||!ze?()=>{}:()=>{pt(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Lo(F?.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(mn=K?.close)!=null?mn:Mie):null,(Ae||h.icon||h.promise)&&h.icon!==null&&(K?.[Ae]!==null||h.icon)?ce.createElement("div",{"data-icon":"",className:Lo(F?.icon,h==null||(a=h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Et():null,h.type!=="loading"?xt:null):null,ce.createElement("div",{"data-content":"",className:Lo(F?.content,h==null||(s=h.classNames)==null?void 0:s.content)},ce.createElement("div",{"data-title":"",className:Lo(F?.title,h==null||(i=h.classNames)==null?void 0:i.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?ce.createElement("div",{"data-description":"",className:Lo(B,at,F?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),ce.isValidElement(h.cancel)?h.cancel:h.cancel&&dg(h.cancel)?ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:Ze=>{dg(h.cancel)&&ze&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Ze),pt())},className:Lo(F?.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,ce.isValidElement(h.action)?h.action:h.action&&dg(h.action)?ce.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||j,onClick:Ze=>{dg(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Ze),!Ze.defaultPrevented&&pt())},className:Lo(F?.actionButton,h==null||(f=h.classNames)==null?void 0:f.actionButton)},h.action.label):null)};function aP(){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 Jie(e,t){const n={};return[e,t].forEach((r,a)=>{const s=a===1,i=s?"--mobile-offset":"--offset",c=s?Gie:Vie;function u(f){["top","right","bottom","left"].forEach(m=>{n[`${i}-${m}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${i}-${f}`]=c:n[`${i}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):u(c)}),n}const A3=ce.forwardRef(function(t,n){const{id:r,invert:a,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:c,closeButton:u,className:f,offset:m,mobileOffset:h,theme:b="light",richColors:y,duration:x,style:E,visibleToasts:w=Hie,toastOptions:_,dir:S=aP(),gap:T=Kie,icons:R,containerAriaLabel:C="Notifications"}=t,[I,A]=ce.useState([]),O=ce.useMemo(()=>r?I.filter($=>$.toasterId===r):I.filter($=>!$.toasterId),[I,r]),j=ce.useMemo(()=>Array.from(new Set([s].concat(O.filter($=>$.position).map($=>$.position)))),[O,s]),[U,B]=ce.useState([]),[W,J]=ce.useState(!1),[ee,re]=ce.useState(!1),[F,K]=ce.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=ce.useRef(null),ne=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=ce.useRef(null),D=ce.useRef(!1),H=ce.useCallback($=>{A(L=>{var M;return(M=L.find(z=>z.id===$.id))!=null&&M.delete||ba.dismiss($.id),L.filter(({id:z})=>z!==$.id)})},[]);return ce.useEffect(()=>ba.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{A(L=>L.map(M=>M.id===$.id?{...M,delete:!0}:M))});return}setTimeout(()=>{cF.flushSync(()=>{A(L=>{const M=L.findIndex(z=>z.id===$.id);return M!==-1?[...L.slice(0,M),{...L[M],...$},...L.slice(M+1)]:[$,...L]})})})}),[I]),ce.useEffect(()=>{if(b!=="system"){K(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:L})=>{K(L?"dark":"light")})}catch{$.addListener(({matches:M})=>{try{K(M?"dark":"light")}catch(z){console.error(z)}})}},[b]),ce.useEffect(()=>{I.length<=1&&J(!1)},[I]),ce.useEffect(()=>{const $=L=>{var M;if(i.every(q=>L[q]||L.code===q)){var G;J(!0),(G=V.current)==null||G.focus()}L.code==="Escape"&&(document.activeElement===V.current||(M=V.current)!=null&&M.contains(document.activeElement))&&J(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),ce.useEffect(()=>{if(V.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,D.current=!1)}},[V.current]),ce.createElement("section",{ref:n,"aria-label":`${C} ${ne}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},j.map(($,L)=>{var M;const[z,G]=$.split("-");return O.length?ce.createElement("ol",{key:$,dir:S==="auto"?aP():S,tabIndex:-1,ref:V,className:f,"data-sonner-toaster":!0,"data-sonner-theme":F,"data-y-position":z,"data-x-position":G,style:{"--front-toast-height":`${((M=U[0])==null?void 0:M.height)||0}px`,"--width":`${Wie}px`,"--gap":`${T}px`,...E,...Jie(m,h)},onBlur:q=>{D.current&&!q.currentTarget.contains(q.relatedTarget)&&(D.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||D.current||(D.current=!0,te.current=q.relatedTarget)},onMouseEnter:()=>J(!0),onMouseMove:()=>J(!0),onMouseLeave:()=>{ee||J(!1)},onDragEnd:()=>J(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||re(!0)},onPointerUp:()=>re(!1)},O.filter(q=>!q.position&&L===0||q.position===$).map((q,ae)=>{var ie,X;return ce.createElement(Xie,{key:q.id,icons:R,index:ae,toast:q,defaultRichColors:y,duration:(ie=_?.duration)!=null?ie:x,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:a,visibleToasts:w,closeButton:(X=_?.closeButton)!=null?X:u,interacting:ee,position:$,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,closeButtonAriaLabel:_?.closeButtonAriaLabel,removeToast:H,toasts:O.filter(Z=>Z.position==q.position),heights:U.filter(Z=>Z.position==q.position),setHeights:B,expandByDefault:c,gap:T,expanded:W,swipeDirections:t.swipeDirections})})):null}))}),oP=Object.freeze(Object.defineProperty({__proto__:null,Toaster:A3,toast:Xt},Symbol.toStringTag,{value:"Module"}));var ky="Dialog",[I3]=No(ky),[Qie,ko]=I3(ky),O3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:s,modal:i=!0}=e,c=v.useRef(null),u=v.useRef(null),[f,m]=Rs({prop:r,defaultProp:a??!1,onChange:s,caller:ky});return d.jsx(Qie,{scope:t,triggerRef:c,contentRef:u,contentId:$r(),titleId:$r(),descriptionId:$r(),open:f,onOpenChange:m,onOpenToggle:v.useCallback(()=>m(h=>!h),[m]),modal:i,children:n})};O3.displayName=ky;var D3="DialogTrigger",L3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(D3,n),s=Jt(t,a.triggerRef);return d.jsx(_t.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":J_(a.open),...r,ref:s,onClick:Ve(e.onClick,a.onOpenToggle)})});L3.displayName=D3;var q_="DialogPortal",[ele,M3]=I3(q_,{forceMount:void 0}),j3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,s=ko(q_,t);return d.jsx(ele,{scope:t,forceMount:n,children:v.Children.map(r,i=>d.jsx(za,{present:n||s.open,children:d.jsx(ed,{asChild:!0,container:a,children:i})}))})};j3.displayName=q_;var gb="DialogOverlay",P3=v.forwardRef((e,t)=>{const n=M3(gb,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,s=ko(gb,e.__scopeDialog);return s.modal?d.jsx(za,{present:r||s.open,children:d.jsx(nle,{...a,ref:t})}):null});P3.displayName=gb;var tle=Nl("DialogOverlay.RemoveScroll"),nle=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(gb,n);return d.jsx(Ap,{as:tle,allowPinchZoom:!0,shards:[a.contentRef],children:d.jsx(_t.div,{"data-state":J_(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Rl="DialogContent",U3=v.forwardRef((e,t)=>{const n=M3(Rl,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,s=ko(Rl,e.__scopeDialog);return d.jsx(za,{present:r||s.open,children:s.modal?d.jsx(rle,{...a,ref:t}):d.jsx(ale,{...a,ref:t})})});U3.displayName=Rl;var rle=v.forwardRef((e,t)=>{const n=ko(Rl,e.__scopeDialog),r=v.useRef(null),a=Jt(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return by(s)},[]),d.jsx($3,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ve(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ve(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&s.preventDefault()}),onFocusOutside:Ve(e.onFocusOutside,s=>s.preventDefault())})}),ale=v.forwardRef((e,t)=>{const n=ko(Rl,e.__scopeDialog),r=v.useRef(!1),a=v.useRef(!1);return d.jsx($3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),$3=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:s,...i}=e,c=ko(Rl,n),u=v.useRef(null),f=Jt(t,u);return cy(),d.jsxs(d.Fragment,{children:[d.jsx(Np,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:s,children:d.jsx(Xu,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":J_(c.open),...i,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(ole,{titleId:c.titleId}),d.jsx(ile,{contentRef:u,descriptionId:c.descriptionId})]})]})}),X_="DialogTitle",z3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(X_,n);return d.jsx(_t.h2,{id:a.titleId,...r,ref:t})});z3.displayName=X_;var F3="DialogDescription",B3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(F3,n);return d.jsx(_t.p,{id:a.descriptionId,...r,ref:t})});B3.displayName=F3;var H3="DialogClose",V3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ko(H3,n);return d.jsx(_t.button,{type:"button",...r,ref:t,onClick:Ve(e.onClick,()=>a.onOpenChange(!1))})});V3.displayName=H3;function J_(e){return e?"open":"closed"}var G3="DialogTitleWarning",[$ve,W3]=Gee(G3,{contentName:Rl,titleName:X_,docsSlug:"dialog"}),ole=({titleId:e})=>{const t=W3(G3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
101
101
 
102
102
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
103
103
 
@@ -124,7 +124,7 @@ Example: https://${e.url}`}e.proxyConfig?.customHeaders&&(s={...s,...e.proxyConf
124
124
  `;)n++;if(n>=e.length)return{shouldSkip:!1,newPos:0};n++;let r=Nr(e,n);if(r>=e.length||e[r]!=='"'&&e[r]!=="'")return{shouldSkip:!1,newPos:0};let a=e[r],s=r+1;for(;s<e.length&&e[s]!==a&&e[s]!==`
125
125
  `;){if(e[s]==="\\"&&s+1<e.length){s+=2;continue}s++}if(s>=e.length||e[s]!==a)return{shouldSkip:!1,newPos:0};let i=Nr(e,s+1);return i<e.length&&e[i]!==`
126
126
  `&&e[i]!=="\r"?{shouldSkip:!0,newPos:n}:{shouldSkip:!1,newPos:0}}function KH(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.type===be.link)return!0;if(n.type===be.textFormatted){var r=n;if(r.children&&KH(r.children))return!0}}return!1}function fS(e){for(var t="",n=0,r=e.length;n<r;n++){var a=e[n],s=a.type;if(s===be.text)t+=a.text;else if(s===be.image){var i=a;i.alt&&(t+=i.alt)}else if(s===be.textFormatted){var c=a;c.children&&(t+=fS(c.children))}else if(s===be.link){var u=a;u.children&&(t+=fS(u.children))}}return t}var xhe=new Set([" "," ","\r",`
127
- `,"\f","\v"]);function Vl(e,t,n,r,a){for(var s=[],i=[],c=[],u=t,f=t,m=a.disableAutoLink||r.inAnchor,h=!1,b=!!r.inAnchor,y=!!a.disableParsingRawHTML,x=function(Jn,wn){if(y)return!1;if(!b){var fn=SE(e,u,r,a,"<");if(fn)return E(u),s.push(fn),u=fn.endPos,f=u,!0}var la=By(e,u,r,a);if(la)return E(u),s.push(la),u=la.endPos,f=u,!0;var Qt=$u(e,u);if(!Qt)return!1;var Ta=u+(Qt.isClosing?2:1);if(Ta>=e.length||_r(e[Ta]))return!1;var Na=e.indexOf(">",u+1);if(Na!==-1){var vr=u+1,ht=Na-vr;if(ht>=7){var Hn=cn(e,"http://",vr);if(Hn||cn(e,"https://",vr)){for(var Qr=vr;Qr<Na;Qr++)if(_r(e[Qr]))return!1}}}var so=Ce(e,Ta);if(Ll(so)&&Ta+1<e.length&&e[Ta+1]===":"||Qt.isClosing&&Qt.attrs.trim().length)return!1;if(Qt.attrs.length)for(var Hr=!1,Us="",Rt=0;Rt<Qt.attrs.length;Rt++){var pn=Qt.attrs[Rt];if(Hr&&pn===Us)Hr=!1;else if(!Hr&&(pn==='"'||pn==="'"))Hr=!0,Us=pn;else if(pn==="*"||pn==="#"||pn==="!"){for(var sn=Rt+1;sn<Qt.attrs.length&&Qt.attrs[sn]!=="="&&Qt.attrs[sn]!==" "&&Qt.attrs[sn]!==" ";)sn++;if(sn<Qt.attrs.length&&Qt.attrs[sn]==="=")return!1}}var Zt={type:be.htmlBlock,tag:Qt.tagName,attrs:{},children:[],text:e.slice(u,Qt.endPos),noInnerParse:!0,endPos:Qt.endPos};return E(u),s.push(Zt),u=Zt.endPos,f=u,!0},E=function(Jn){if(Jn>f){var wn=e.slice(f,Jn);s.push({type:be.text,text:h?zy(wn):wn}),f=Jn,h=!1}};u<n;){var w=Ce(e,u),_=she(w,m);if(_===0){for(w===gg&&(h=!0),u++;u<n&&(w=Ce(e,u),!(w>=So));){w===gg&&(h=!0);var S=Db[w];if(S!==0){if(m&&S===1&&(w===tu||w===nu||w===yi)){u++;continue}break}u++}continue}if(w===Qa){for(var T=u,R=0;u+R<n&&Ce(e,u+R)===Qa;)R++;if(R>0){for(var C=u+R,I=-1,A=C;A<n;){for(;A<n&&Ce(e,A)!==Qa;)A++;if(A>=n)break;for(var O=0;A+O<n&&Ce(e,A+O)===Qa;)O++;O>R&&(O=R);var j=A+O;if(O===R&&(A<=C||Ce(e,A-1)!==Qa)&&(j>=n||Ce(e,j)!==Qa)){I=A,A=j;break}A++}if(I!==-1){for(var U=e.slice(C,I),B=!1,W=0;W<U.length;W++){var J=Ce(U,W);if(J===Ln||J===Kr){B=!0;break}}var ee=U;if(B&&(ee=U.replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ")),ee.length>0){var re=Ce(ee,0),F=Ce(ee,ee.length-1);if(re===dt&&F===dt){for(var K=1;K<ee.length-1;K++)if(Ce(ee,K)!==dt){ee=ee.slice(1,ee.length-1);break}}}E(T),s.push({type:be.codeInline,text:ee}),u=A,f=u;continue}u=C;continue}}if(!b&&!m&&(w===tu||w===nu||w===yi)){var V=null,ne=u+1<n?Ce(e,u+1):0,te=u+2<n?Ce(e,u+2):0,D=u+3<n?Ce(e,u+3):0,H=u+4<n?Ce(e,u+4):0,$=u+5<n?Ce(e,u+5):0;if(w===nu&&ne===wE&&te===wE&&D===TU?V="h":w===yi&&ne===yi&&te===yi&&D===jH?V="w":w===tu&&ne===wE&&te===TU&&D===WT&&H===kb&&$===kb&&(V="f"),V){var L=SE(e,u,r,a,V);if(L){E(u),s.push(L),u=L.endPos,f=u;continue}}}if(!b&&!m&&w===VT){var M=SE(e,u,r,a,"@");if(M&&"emailStart"in M){for(var{emailStart:z,endPos:G}=M,q=[],j=i.length-1;j>=0;j--){var ae=i[j];ae.sourcePos>=z&&ae.sourcePos<G&&(ae.nodeIndex>=0&&ae.nodeIndex<s.length&&(s.splice(ae.nodeIndex,1),q.push(ae.nodeIndex)),i.splice(j,1))}if(z<f){for(var A=s.length-1;A>=0;A--)if(s[A].type===be.text){s.splice(A,1),q.push(A);break}f=z}if(q.length){q.sort(function(Jn,wn){return Jn-wn});for(var ie=0,X=0;X<i.length;X++){for(var ae=i[X];ie<q.length&&q[ie]<ae.nodeIndex;)ie++;ae.nodeIndex-=ie}}E(z),s.push(M),u=G,f=u;continue}}if(!(w===$y&&x())){if(w===Tb){if(u+1<n&&Ce(e,u+1)===Ln){for(var Z=u+2;Z<n&&Ce(e,Z)===dt;)Z++;if(Z>=n){u++;continue}for(E(u),s.push({type:be.breakLine}),u+=2;u<n&&Ce(e,u)===dt;)u++;f=u;continue}var se=u+1<n?e[u+1]:"";if(se&&"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".indexOf(se)!==-1){E(u),s.push({type:be.text,text:se==="&"?"&​":se}),u+=2,f=u;continue}}if(w===Hl){if(!b){if(u+1<n&&e[u+1]==="^"){for(var me=u+2;me<n&&e[me]!=="]";)me++;if(me<n){var le=e.slice(u+2,me);E(u),s.push({type:be.footnoteReference,target:`#${a.slugify(le)}`,text:le}),u=me+1,f=u;continue}}if(r.inList&&u+2<n&&Ce(e,u+2)===Nb){var Te=Ce(e,u+1);if(Te===dt||Te===NU||Te===kU){E(u),s.push({type:be.gfmTask,completed:Te===NU||Te===kU}),u+=3,f=u;continue}}}var Be=!1;if(u>t&&e[u-1]==="!"){for(var Ee=0,_e=u-2;_e>=t&&e[_e]==="\\";_e--)Ee++;if((Ee&1)===0&&(Be=!0,f<u-1&&E(u-1),s.length>0&&s[s.length-1].type===be.text)){var Ue=s[s.length-1];Ue.text.endsWith("!")&&(Ue.text=Ue.text.slice(0,-1),!Ue.text&&s.pop())}}Be||E(u),f=u+1,(!b||Be)&&c.push({type:Be?"image":"link",pos:Be?u-1:u,resultIdx:s.length,inAnchor:b}),u++;continue}if(w===Nb&&c.length>0){var fe=c[c.length-1],Ae=fe.pos+(fe.type==="image"?2:1),ze=u;E(u);var we=u+1,at=tN(s,fe),lt=fe.type==="link"&&KH(at),gt=!1;if(!lt&&we<n&&e[we]==="("){var Ct=Nhe(e,we+1);if(Ct){IU(s,i,c,fe,Ae,ze,a.sanitizer(Mb(Ct.target),"a","href"),Ct.title?Mb(Ct.title):void 0),u=Ct.endPos,f=u;continue}}var Le=r.refs||{},$e=null,bt=u;if(we<n&&e[we]==="["){for(var nt=we+1,A=nt;A<n&&e[A]!=="]";)A++;A<n&&($e=e.slice(nt,A),bt=A,gt=!0)}(!gt||$e==="")&&($e=e.slice(Ae,ze));var Ut=ZH($e);if(!lt&&Le&&Le[Ut]){var st=Le[Ut];IU(s,i,c,fe,Ae,ze,st.target,st.title),u=bt+1,f=u;continue}var Ie=fe.resultIdx;c.pop(),s.length=Ie,fe.type==="image"&&s.push({type:be.text,text:"!"}),s.push({type:be.text,text:"["},...at,{type:be.text,text:"]"});for(var W=0;W<i.length;W++)i[W].nodeIndex>=Ie&&i[W].nodeIndex++;u++,f=u;continue}if(w===HT||w===Uy||w===Fp||w===ju){var Me=e[u],He=u,it=du(e,u,Me);if((Me==="~"||Me==="=")&&it!==2){u++;continue}var pt=He+it,Et=RU(e,He,pt,n,0),xt=RU(e,He,pt,t,1),un=Et,mn=xt;if(Me==="_"&&Et&&xt){if(He>0){var Ze=e[He-1],vt=Ce(Ze);un=Ub(vt,Ze)}if(pt<n){var jt=e[pt],Pt=Ce(jt);mn=Ub(Pt,jt)}}E(He),i.push({nodeIndex:s.length,type:Me,length:it,canOpen:un,canClose:mn,active:!0,sourcePos:He,inAnchor:b}),s.push({type:be.text,text:e.slice(He,He+it)}),u=He+it,f=u;continue}if(w===Ln){for(var _e=u-1,yr=0;_e>=f&&Ce(e,_e)===dt;)yr++,_e--;if(yr>=2){for(var Z=u+1;Z<n&&Ce(e,Z)===dt;)Z++;if(Z>=n){E(_e+1),u=n,f=n;continue}for(E(_e+1),s.push({type:be.breakLine}),u++;u<n&&Ce(e,u)===dt;)u++;f=u;continue}var dn=u>f?Ce(e,u-1):0,Te=u+1<n?Ce(e,u+1):0,Xn=u>f&&dn===dt&&Te===dt?u-1:u;E(Xn),s.push({type:be.text,text:`
127
+ `,"\f","\v"]);function Vl(e,t,n,r,a){for(var s=[],i=[],c=[],u=t,f=t,m=a.disableAutoLink||r.inAnchor,h=!1,b=!!r.inAnchor,y=!!a.disableParsingRawHTML,x=function(Jn,wn){if(y)return!1;if(!b){var fn=SE(e,u,r,a,"<");if(fn)return E(u),s.push(fn),u=fn.endPos,f=u,!0}var la=By(e,u,r,a);if(la)return E(u),s.push(la),u=la.endPos,f=u,!0;var Qt=$u(e,u);if(!Qt)return!1;var Ta=u+(Qt.isClosing?2:1);if(Ta>=e.length||_r(e[Ta]))return!1;var Na=e.indexOf(">",u+1);if(Na!==-1){var vr=u+1,ht=Na-vr;if(ht>=7){var Hn=cn(e,"http://",vr);if(Hn||cn(e,"https://",vr)){for(var Qr=vr;Qr<Na;Qr++)if(_r(e[Qr]))return!1}}}var so=Ce(e,Ta);if(Ll(so)&&Ta+1<e.length&&e[Ta+1]===":"||Qt.isClosing&&Qt.attrs.trim().length)return!1;if(Qt.attrs.length)for(var Hr=!1,Us="",Rt=0;Rt<Qt.attrs.length;Rt++){var pn=Qt.attrs[Rt];if(Hr&&pn===Us)Hr=!1;else if(!Hr&&(pn==='"'||pn==="'"))Hr=!0,Us=pn;else if(pn==="*"||pn==="#"||pn==="!"){for(var sn=Rt+1;sn<Qt.attrs.length&&Qt.attrs[sn]!=="="&&Qt.attrs[sn]!==" "&&Qt.attrs[sn]!==" ";)sn++;if(sn<Qt.attrs.length&&Qt.attrs[sn]==="=")return!1}}var Zt={type:be.htmlBlock,tag:Qt.tagName,attrs:{},children:[],text:e.slice(u,Qt.endPos),noInnerParse:!0,endPos:Qt.endPos};return E(u),s.push(Zt),u=Zt.endPos,f=u,!0},E=function(Jn){if(Jn>f){var wn=e.slice(f,Jn);s.push({type:be.text,text:h?zy(wn):wn}),f=Jn,h=!1}};u<n;){var w=Ce(e,u),_=she(w,m);if(_===0){for(w===gg&&(h=!0),u++;u<n&&(w=Ce(e,u),!(w>=So));){w===gg&&(h=!0);var S=Db[w];if(S!==0){if(m&&S===1&&(w===tu||w===nu||w===yi)){u++;continue}break}u++}continue}if(w===Qa){for(var T=u,R=0;u+R<n&&Ce(e,u+R)===Qa;)R++;if(R>0){for(var C=u+R,I=-1,A=C;A<n;){for(;A<n&&Ce(e,A)!==Qa;)A++;if(A>=n)break;for(var O=0;A+O<n&&Ce(e,A+O)===Qa;)O++;O>R&&(O=R);var j=A+O;if(O===R&&(A<=C||Ce(e,A-1)!==Qa)&&(j>=n||Ce(e,j)!==Qa)){I=A,A=j;break}A++}if(I!==-1){for(var U=e.slice(C,I),B=!1,W=0;W<U.length;W++){var J=Ce(U,W);if(J===Ln||J===Kr){B=!0;break}}var ee=U;if(B&&(ee=U.replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ")),ee.length>0){var re=Ce(ee,0),F=Ce(ee,ee.length-1);if(re===dt&&F===dt){for(var K=1;K<ee.length-1;K++)if(Ce(ee,K)!==dt){ee=ee.slice(1,ee.length-1);break}}}E(T),s.push({type:be.codeInline,text:ee}),u=A,f=u;continue}u=C;continue}}if(!b&&!m&&(w===tu||w===nu||w===yi)){var V=null,ne=u+1<n?Ce(e,u+1):0,te=u+2<n?Ce(e,u+2):0,D=u+3<n?Ce(e,u+3):0,H=u+4<n?Ce(e,u+4):0,$=u+5<n?Ce(e,u+5):0;if(w===nu&&ne===wE&&te===wE&&D===TU?V="h":w===yi&&ne===yi&&te===yi&&D===jH?V="w":w===tu&&ne===wE&&te===TU&&D===WT&&H===kb&&$===kb&&(V="f"),V){var L=SE(e,u,r,a,V);if(L){E(u),s.push(L),u=L.endPos,f=u;continue}}}if(!b&&!m&&w===VT){var M=SE(e,u,r,a,"@");if(M&&"emailStart"in M){for(var{emailStart:z,endPos:G}=M,q=[],j=i.length-1;j>=0;j--){var ae=i[j];ae.sourcePos>=z&&ae.sourcePos<G&&(ae.nodeIndex>=0&&ae.nodeIndex<s.length&&(s.splice(ae.nodeIndex,1),q.push(ae.nodeIndex)),i.splice(j,1))}if(z<f){for(var A=s.length-1;A>=0;A--)if(s[A].type===be.text){s.splice(A,1),q.push(A);break}f=z}if(q.length){q.sort(function(Jn,wn){return Jn-wn});for(var ie=0,X=0;X<i.length;X++){for(var ae=i[X];ie<q.length&&q[ie]<ae.nodeIndex;)ie++;ae.nodeIndex-=ie}}E(z),s.push(M),u=G,f=u;continue}}if(!(w===$y&&x())){if(w===Tb){if(u+1<n&&Ce(e,u+1)===Ln){for(var Z=u+2;Z<n&&Ce(e,Z)===dt;)Z++;if(Z>=n){u++;continue}for(E(u),s.push({type:be.breakLine}),u+=2;u<n&&Ce(e,u)===dt;)u++;f=u;continue}var se=u+1<n?e[u+1]:"";if(se&&"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".indexOf(se)!==-1){E(u),s.push({type:be.text,text:se==="&"?"&​":se}),u+=2,f=u;continue}}if(w===Hl){if(!b){if(u+1<n&&e[u+1]==="^"){for(var me=u+2;me<n&&e[me]!=="]";)me++;if(me<n){var le=e.slice(u+2,me);E(u),s.push({type:be.footnoteReference,target:`#${a.slugify(le)}`,text:le}),u=me+1,f=u;continue}}if(r.inList&&u+2<n&&Ce(e,u+2)===Nb){var Te=Ce(e,u+1);if(Te===dt||Te===NU||Te===kU){E(u),s.push({type:be.gfmTask,completed:Te===NU||Te===kU}),u+=3,f=u;continue}}}var Be=!1;if(u>t&&e[u-1]==="!"){for(var Ee=0,_e=u-2;_e>=t&&e[_e]==="\\";_e--)Ee++;if((Ee&1)===0&&(Be=!0,f<u-1&&E(u-1),s.length>0&&s[s.length-1].type===be.text)){var Ue=s[s.length-1];Ue.text.endsWith("!")&&(Ue.text=Ue.text.slice(0,-1),!Ue.text&&s.pop())}}Be||E(u),f=u+1,(!b||Be)&&c.push({type:Be?"image":"link",pos:Be?u-1:u,resultIdx:s.length,inAnchor:b}),u++;continue}if(w===Nb&&c.length>0){var fe=c[c.length-1],Ae=fe.pos+(fe.type==="image"?2:1),ze=u;E(u);var we=u+1,at=tN(s,fe),lt=fe.type==="link"&&KH(at),gt=!1;if(!lt&&we<n&&e[we]==="("){var Ct=Nhe(e,we+1);if(Ct){IU(s,i,c,fe,Ae,ze,a.sanitizer(Mb(Ct.target),"a","href"),Ct.title?Mb(Ct.title):void 0),u=Ct.endPos,f=u;continue}}var Le=r.refs||{},$e=null,bt=u;if(we<n&&e[we]==="["){for(var nt=we+1,A=nt;A<n&&e[A]!=="]";)A++;A<n&&($e=e.slice(nt,A),bt=A,gt=!0)}(!gt||$e==="")&&($e=e.slice(Ae,ze));var Ut=ZH($e);if(!lt&&Le&&Le[Ut]){var ot=Le[Ut];IU(s,i,c,fe,Ae,ze,ot.target,ot.title),u=bt+1,f=u;continue}var Ie=fe.resultIdx;c.pop(),s.length=Ie,fe.type==="image"&&s.push({type:be.text,text:"!"}),s.push({type:be.text,text:"["},...at,{type:be.text,text:"]"});for(var W=0;W<i.length;W++)i[W].nodeIndex>=Ie&&i[W].nodeIndex++;u++,f=u;continue}if(w===HT||w===Uy||w===Fp||w===ju){var Me=e[u],He=u,it=du(e,u,Me);if((Me==="~"||Me==="=")&&it!==2){u++;continue}var pt=He+it,Et=RU(e,He,pt,n,0),xt=RU(e,He,pt,t,1),un=Et,mn=xt;if(Me==="_"&&Et&&xt){if(He>0){var Ze=e[He-1],vt=Ce(Ze);un=Ub(vt,Ze)}if(pt<n){var jt=e[pt],Pt=Ce(jt);mn=Ub(Pt,jt)}}E(He),i.push({nodeIndex:s.length,type:Me,length:it,canOpen:un,canClose:mn,active:!0,sourcePos:He,inAnchor:b}),s.push({type:be.text,text:e.slice(He,He+it)}),u=He+it,f=u;continue}if(w===Ln){for(var _e=u-1,yr=0;_e>=f&&Ce(e,_e)===dt;)yr++,_e--;if(yr>=2){for(var Z=u+1;Z<n&&Ce(e,Z)===dt;)Z++;if(Z>=n){E(_e+1),u=n,f=n;continue}for(E(_e+1),s.push({type:be.breakLine}),u++;u<n&&Ce(e,u)===dt;)u++;f=u;continue}var dn=u>f?Ce(e,u-1):0,Te=u+1<n?Ce(e,u+1):0,Xn=u>f&&dn===dt&&Te===dt?u-1:u;E(Xn),s.push({type:be.text,text:`
128
128
  `}),f=u+1,u>t&&dn===dt&&f<n&&Ce(e,f)===dt&&f++,u=f;continue}for(w===gg&&(h=!0),u++;u<n;){var w=Ce(e,u);if(w>=So)break;w===gg&&(h=!0);var S=Db[w];if(S===0){u++;continue}if(S===1&&(w===tu||w===nu||w===yi)&&m){u++;continue}break}}}if(E(u),i.length&&nV(s,i),c.length){c.sort(function(Jn,wn){return Jn.resultIdx-wn.resultIdx});for(var A=0;A<c.length;A++)s.splice(c[A].resultIdx+A,0,{type:be.text,text:c[A].type==="image"?"![":"["})}return s}function She(e,t,n,r,a){for(var s=!1,i=0;i<t.length;i++)if(t[i].sourcePos>=r&&t[i].sourcePos<a){s=!0;break}if(s){for(var c=tN(e,n),u=[],i=0;i<t.length;i++){var f=t[i];f.sourcePos>=r&&f.sourcePos<a&&u.push({nodeIndex:f.nodeIndex-n.resultIdx,type:f.type,length:f.length,canOpen:f.canOpen,canClose:f.canClose,active:f.active,sourcePos:f.sourcePos,inAnchor:f.inAnchor})}nV(c,u),e.length=n.resultIdx;for(var m=0;m<c.length;m++)e.push(c[m]);for(var h=[],i=0;i<t.length;i++)(t[i].sourcePos<r||t[i].sourcePos>=a)&&h.push(t[i]);t.length=0;for(var m=0;m<h.length;m++)t.push(h[m])}}function _he(e,t,n,r){return e.type==="link"?{type:be.link,target:n,title:r,children:t}:{type:be.image,target:n||"",alt:fS(t),title:r}}function tN(e,t){return e.slice(t.resultIdx)}function IU(e,t,n,r,a,s,i,c){She(e,t,r,a,s);var u=tN(e,r);n.pop(),e.length=r.resultIdx,e.push(_he(r,u,i,c))}function The(e,t,n){let r=Nr(e,t),a=r<e.length&&e[r]==="<";a&&r++;let s=r;if(a&&r<e.length&&e[r]===">")return{target:"",endPos:r+1,hadSpace:!1};let i,c;var u=!1;if(a){for(c=r;c<e.length&&e[c]!==">";){let h=e[c];if(h===`
129
129
  `||h==="\r"||h==="<")return null;if(h==="\\"){c+=2;continue}c++}if(c>=e.length||e[c]!==">")return null;c++;let f=s;for(;f<c-1&&_r(e[f]);)f++;let m=c-1;for(;m>f&&_r(e[m-1]);)m--;i=e.slice(f,m),r=c}else{let f=0;for(c=r;c<e.length;){let m=e[c];if(m===" "||m===" "||m===`
130
130
  `){u=!0;break}if(m==="("){if(c>0&&e[c-1]==="\\"){c++;continue}f++,c++;continue}if(m===")"){if(c>0&&e[c-1]==="\\"){c++;continue}if(f===0)break;f--,c++;continue}c++}i=e.slice(s,c),r=c}return{target:i,endPos:r,hadSpace:u}}function OU(e,t,n,r){let a=t,s=0;for(;a<e.length;){let c=e[a];if(_r(c))a++;else if(c===`
@@ -155,8 +155,8 @@ Example: https://${e.url}`}e.proxyConfig?.customHeaders&&(s={...s,...e.proxyConf
155
155
  `||i==="\r"||i==="/")break;if(i==="-"||i==="_"||Ll(c)||c>=48&&c<=57)r++;else return!1}let s=0;for(;r<n;){let i=e[r],c=Ce(e,r);if(s===1)i==='"'&&(s=0),r++;else if(s===2)i==="'"&&(s=0),r++;else if(i==='"')s=1,r++;else if(i==="'")s=2,r++;else{if(i===">")return!0;if(i==="/"&&r+1<n&&e[r+1]===">")return!0;if(c===10||c===13)return!1;r++}}return!1}function $U(e,t,n,r,a,s,i,c,u,f,m,h){let b=r,y=!1;for(;b<e.length;){let x=qe(e,b),E=tn(e,b,x),w=E.spaceEquivalent;if(_o(e,b,x)){y=!0,b=en(e,x);continue}let _=e.slice(b+E.charCount,x);if(w<=a&&mi(_,E,s,i,c,a,u))break;if(w>=n){if(h&&y){let T=hS(e,b,x,E,_,f,m);if(T){b=T,y=!1;continue}}let S=$g(e,b,x,E,n-1,n,t,y,f,m,void 0);if(S.processed){b=S.newPos,y=S.wasBlank;continue}}else break}return b}function zU(e,t,n,r){let a=nN(e,n,r,{inline:!1,list:!0});if(a.length>0)return!t&&a.length===1&&a[0].type===be.paragraph?a[0].children:a;let s=Fy(n,!0,()=>Vl(e,0,e.length,n,r));return t&&s.length>0?[{type:be.paragraph,children:s}]:s}function eV(e,t,n,r){let a=khe(e,0);if(!(a&&(a.endPos>=e.length||e[a.endPos]===" ")))return zU(e,t,n,r);let s=a.endPos<e.length?a.endPos+1:a.endPos,i=e.slice(s),c=zU(i,t,n,r),u=[a];return a.endPos<e.length&&u.push({type:be.text,text:" "}),u.push(...c),u}function FU(e,t){if(!e[0])return!1;let n=e[0].indexOf(t);if(n===-1)return!1;let r=n+t.length;if(r>=e[0].length)return!1;let a=e[0][r];return a?Ce(a)===Fme:!1}function tV(e,t,n){if(e.length===0)return!1;let r=e[e.length-1],a=t.trim();if(!cn(a,"=")&&!cn(a,"-")||a.length<1||!/^[=-]+[ \t]*$/.test(a))return!1;let s=[],i="";if(r.type===be.paragraph){let u=r;s=u.children,i=u.children.map(f=>f.type===be.text?f.text:"").join("").trim()}else if(r.type===be.text){let u=[],f=e.length-1;for(;f>=0&&e[f].type===be.text;)u.unshift(e[f]),f--;u.length>0&&(s=u,i=u.map(m=>m.text).join("").trim())}if(!i)return!1;let c=a[0]==="="?1:2;if(r.type===be.paragraph)e.pop();else if(r.type===be.text)for(;e.length>0&&e[e.length-1].type===be.text;)e.pop();return e.push(jb(c,s,i,n.slugify)),!0}function $g(e,t,n,r,a,s,i,c,u,f,m,h){let b=r.spaceEquivalent,y=e.slice(t+r.charCount,n);if(b>=a+4){let _=Pg(e,t);if(_){let S=_,T=mS(S.text||"",s);return i.push({...S,text:T}),{processed:!0,newPos:S.endPos,wasBlank:!1}}}let x=b-(s-1);if(b+1>=s&&x<=3){let _=t+r.charCount;if(_<n){let S=e[_];if(S==="`"||S==="~"){let T=aN(e,_,u,f);if(T){let R=T,C=mS(R.text||"",s-1);return i.push({...R,text:C,endPos:R.endPos}),{processed:!0,newPos:R.endPos,wasBlank:!1}}}}}if(y.length>0&&(y[0]==="-"||y[0]==="*"||y[0]==="+"||y[0]>="0"&&y[0]<="9")&&/^([-*+]|\d{1,9}[.)])\s+/.test(y)){let _=Bp(y,0,y.length,u,f);return i.push({type:be.text,text:`
156
156
  `},..._),{processed:!0,newPos:en(e,n),wasBlank:!1}}let E=ihe(e,t,i,y,u,f);if(E!==null)return{processed:!0,newPos:E,wasBlank:!1};let w=nN(y,u,f,{inline:!1,list:!0});if(w.length>0){if(m&&w[0].type===be.paragraph){let _=w[0];i.push({type:be.text,text:`
157
157
  `},..._.children),w.length>1&&i.push(...w.slice(1))}else if(!c&&w[0].type===be.paragraph&&i.length>0){let _=i[i.length-1],S=w[0];_.type===be.paragraph?_.children.push({type:be.text,text:`
158
- `},...S.children):_.type===be.heading?i.push(...S.children):vf(i)?i.push(...w):i.push({type:be.text,text:" "},...S.children),w.length>1&&i.push(...w.slice(1))}else i.push(...w);return{processed:!0,newPos:en(e,n),wasBlank:!1}}if(c){let _=Fy(u,!0,()=>Vl(y,0,y.length,u,f));i.push({type:be.paragraph,children:_})}else Ug(y,i,u,f);return{processed:!0,newPos:en(e,n),wasBlank:!1}}function gS(e,t,n,r){if(n.inline)return null;var a=n.inList;if(n.inList=!0,t>0){var s=Ce(e,t-1);if(s!==Ln&&s!==Kr)return n.inList=a,null}var i=qe(e,t),c=tn(e,t,i);if(c.spaceEquivalent>3&&!n.inList)return n.inList=a,null;var u=e.slice(t,i),f=c.charCount,m=u.slice(f),h=_E(m);if(!h)return n.inList=a,null;var{match:b,ordered:y,listItemRegex:x}=h,E=c.spaceEquivalent,w=y?parseInt(b[1],10):void 0,_=y?b[2]:void 0,S=y?void 0:b[1],T=y?b[3]==="":b[2]==="";function R(Rt,pn){if(Rt===0)return!0;var sn=Ce(e,Rt-1);if(sn!==Ln)return!1;if(!pn)return!0;for(var Zt=Rt-2;Zt>=0;){var mt=Ce(e,Zt);if(mt!==dt&&mt!==Kt)break;Zt--}return Zt<0||Ce(e,Zt)===Ln}if(T&&!R(t,!0))return n.inList=a,null;if(y&&w!==1&&!R(t,!1)||!y&&FU(b,S))return null;var C=b.index||0,I=y?C+b[1].length+b[2].length+1:T?C+b[1].length:C+b[1].length+1,A=t+f+I,O=zb(e,A,i,E,I),j=O.contentStartColumn,U=E+C+b[1].length,B=y?U+b[2].length+1:T?U:U+1,W=[],J=[];function ee(Rt,pn,sn){return sn?Rt>=pn:Rt>pn}function re(){return W[W.length-1]}function F(){return J[J.length-1]??j}function K(Rt,pn){let sn=JH(pn),Zt=n.inList;n.inList=!0;let mt=gS(e,Rt,n,r);return n.inList=Zt,mt?(sn.push(mt),mt):null}for(var V=en(e,i),ne=V,te=!1;ne<e.length;){var D=qe(e,ne),H=e.slice(ne,D);if(H.trim()===""){for(var $=en(e,D);$<e.length;){var L=Ce(e,$);if(L!==Ln){if(!xhe.has(e[$]))break}$++}var M=qe(e,$),z=e.slice($,M),G=tn(e,$,M),q=z.slice(G.charCount);if(mi(q,G,y,S,_,E,x))te=!0;else{var ae=hS(e,$,M,G,q,n,r);if(ae){for(var ie=ae;ie<e.length&&Ce(e,ie)===Ln;)ie++;if(ie<e.length){var X=qe(e,ie),Z=e.slice(ie,X),se=tn(e,ie,X),me=Z.slice(se.charCount);mi(me,se,y,S,_,E,x)&&(te=!0)}}}break}var le=tn(e,ne,D),Te=H.slice(le.charCount),Be=_E(Te);if(!Be)break;var Ee=Be.match;if(y){if(Ee[2]!==_)break}else if(Ee[1]!==S)break;ne=en(e,D)}var _e=y?b[3]:b[2];_e=_e.trimStart();for(var Ue=t+f+(b.index||0),fe=y?Ue+b[1].length+b[2].length:Ue+b[1].length,Ae=fe;Ae<e.length;){var L=Ce(e,Ae);if(L!==dt&&L!==Kt)break;Ae++}for(var ze=0,we=fe;we<i;){var L=Ce(e,we);if(L===Kt)ze+=4-ze%4;else if(L===dt)ze++;else break;we++}var at=!1;if(fe<e.length&&Ce(e,fe)===Kt){for(var lt=1,gt=fe+1;gt<e.length&&Ce(e,gt)===Kt;)lt++,gt++;lt>=2&&(_e=" "+_e,at=!0)}y||(T=T&&ze===0),ze>=4&&!at&&(_e=" ".repeat(ze-1)+_e.trimStart()),_e.trim();let Ct=te;if(!te&&V<e.length)for(var Le=V;Le<e.length;){var $e=qe(e,Le),bt=e.slice(Le,$e);if(_o(e,Le,$e)){for(var nt=en(e,$e);nt<e.length;){var Ut=qe(e,nt);if(_o(e,nt,Ut))nt=en(e,Ut);else break}if(nt<e.length){var st=tn(e,nt,e.length),Ie=st.spaceEquivalent;if(Ie>=E){for(var Me=e.slice(nt,qe(e,nt)),He=Me.slice(st.charCount).match(x),it=He&&(y?He[2]===_:He[1]===S),pt=null,Et=V;Et<Le;Et=qe(e,Et)+1){var xt=qe(e,Et),un=tn(e,Et,xt),mn=e.slice(Et,xt).slice(un.charCount).match(x),Ze=mn&&un.spaceEquivalent>E&&un.spaceEquivalent>=j&&(y?mn[2]===_:mn[1]===S);if(Ze){var vt=un.spaceEquivalent+1,jt=y?vt+mn[1].length+mn[2].length+1:vt+mn[1].length+1,Pt=Et+un.charCount+mn[0].length,yr=zb(e,Pt,xt,vt,jt-vt);pt=yr.contentStartColumn;break}}var dn=ze>=5?B:j;!it&&Ie>=dn&&(pt===null||Ie+1<pt)&&(Ct=!0)}}break}var Xn=tn(e,Le,$e),Jn=Xn.spaceEquivalent,wn=bt.slice(Xn.charCount),fn=wn.match(x),la=fn&&(y?fn[2]===_:fn[1]===S);if(la&&Jn<=E)break;Le=en(e,$e)}var Qt=_e;if(cn(_e,"```")||cn(_e,"~~~")){var Ta=y?b[1].length+b[2].length+1:b[1].length+1,Na=QH(e,_e,V,Ta);Qt=Na.content,V=Na.endPos}var vr=!T&&_e.trim()===""&&ze>0&&ze<5;if(vr&&!Ct)for(var t=V;t<e.length;){var i=qe(e,t),u=e.slice(t,i);if(u.trim()==="")break;var c=tn(e,t,i);if(c.spaceEquivalent<B)break;var m=u.slice(c.charCount);if(c.spaceEquivalent<=E&&mi(m,c,y,S,_,E,x))break;Qt+=`
159
- `+m,V=t=en(e,i)}if(W.push(eV(Qt,Ct,n,r)),J.push(j),Ct&&(ze>=5||vr)){let Rt=re();V=$U(e,Rt,B,V,E,y,S,_,x,n,r,!0)}else if(!Ct){let Rt=B-1;for(;V<e.length;){let pn=qe(e,V),sn=e.slice(V,pn),Zt=tn(e,V,pn),mt=Zt.spaceEquivalent,nn=sn.slice(Zt.charCount);if(sn.trim()===""||mt<=E&&mi(nn,Zt,y,S,_,E,x)||MU(nn)&&mt>E||mt<Rt)break;let dr=re(),ot=$g(e,V,pn,Zt,Rt,j,dr,!1,n,r,!0);if(ot.processed)V=ot.newPos;else break}}for(var ht=!1;V<e.length;){let Rt=qe(e,V),pn=e.slice(V,Rt),sn=tn(e,V,Rt),Zt=sn.charCount,mt=sn.spaceEquivalent;if(pn.trim()==="")te=!0,ht=!0,V=en(e,Rt);else if(mt<E){let nn=pn.slice(Zt);if(nn.startsWith("<")&&UU(e,V,Zt,E,mt,r))break;let dr=nn.trim();if(dr.length>0&&W.length>0&&!cp(dr[0])&&!mi(nn,sn,y,S,_,E,x)){let ot=re();if(ot.length>0){let ca=ot[ot.length-1];if(ca.type===be.paragraph||ca.type===be.text){Ug(nn,ot,n,r),ht=!1,V=en(e,Rt);continue}}}break}else{let nn=pn.slice(Zt);if(W.length>0){let Ht=J[W.length-1]||j;if(mt+1>=Ht&&!mi(nn,sn,y,S,_,E,x)){let An=re();if(An.length>0&&tV(An,nn,r)){V=en(e,Rt);continue}}}if($b(e,V))break;if(ht){let Ht=hS(e,V,Rt,sn,nn,n,r);if(Ht){V=Ht,ht=!1;continue}}if(mt<=E){if(nn.startsWith("<")&&UU(e,V,Zt,E,mt,r))break;if(!mi(nn,sn,y,S,_,E,x)){if(mt===E&&!ht){let Ht=nn.trim();if(Ht.length>0&&!cp(Ht[0])){let An=Hp(e,V,n,r);if(An&&An.type!==be.paragraph)break;let hn=re();if(hn.length>0&&!vf(hn)){Ug(nn,hn,n,r,!1),ht=!1,V=en(e,Rt);continue}}}break}}if(jU(W,T,ht,_e))break;let dr=_E(nn),ot=dr?dr.match:null,ca=ot&&(y?ot[2]===_:ot[1]===S);if(ca&&mt>3&&ht)break;if(ca&&mt<=E+3){if(mt>=4&&ht)break;if(mt===E){let Ht=y?ot[3]:ot[2];if(Ht=Ht.trimStart(),V=bg(e,W,J,Ht,V,Rt,mt,Zt,ot,y,te,n,r).newCurrentPos,ht=!1,Ht.trim()===""){let An=W[W.length-1],hn=F();V=$U(e,An,hn,V,E,y,S,_,x,n,r)}continue}if(mt>E){if(ht){let kn=y?ot[3]:ot[2];kn=kn.trimStart(),V=bg(e,W,J,kn,V,Rt,mt,Zt,ot,y,te,n,r).newCurrentPos,ht=!1;continue}let Ht=re(),An=mt+1,hn=ee(An,F(),vf(Ht));if(hn){let kn=K(V,Ht);if(kn){V=kn.endPos,ht=!1;continue}}if(!hn&&ca){let kn=y?ot[3]:ot[2];if(kn=kn.trimStart(),!te){let rr=en(e,Rt);for(;rr<e.length;){let wr=qe(e,rr),Co=e.slice(rr,wr),$t=tn(e,rr,wr),ua=$t.spaceEquivalent;if(Co.trim()===""){let Er=en(e,wr);if(Er<e.length){let Vr=tn(e,Er,e.length).spaceEquivalent,Ro=mt+(y?ot[1].length+ot[2].length+1:ot[1].length+1);if(Vr+1>Ro)break}break}else if(ua<=E){let Er=Co.slice($t.charCount).match(x);if(Er&&(y?Er[2]===_:Er[1]===S)&&ua<=E)break}rr=en(e,wr)}}V=bg(e,W,J,kn,V,Rt,mt,Zt,ot,y,te,n,r).newCurrentPos,ht=!1;continue}else if(!hn&&!ca)break;{let kn=re(),rr=kn.length===0;if(rr&&jU(W,T,ht,_e))break;let wr=kn.some($t=>$t.type===be.codeBlock||$t.type===be.paragraph||$t.type===be.blockQuote||$t.type===be.orderedList||$t.type===be.unorderedList||$t.type===be.heading),Co=rr&&W.length===1?B:j;if(wr?mt>=Co:mt>Co){let $t=$g(e,V,Rt,sn,Co,j,re(),ht,n,r,void 0);if($t.processed){ht=$t.wasBlank,V=$t.newPos;continue}}else break}}else if(mt===E){if(!y&&ot&&FU(ot,ot[1]))break;let Ht=y?ot[3]:ot[2];Ht=Ht.trimStart(),V=bg(e,W,J,Ht,V,Rt,E,Zt,ot,y,te,n,r).newCurrentPos,ht=!1}}else if(mt>E){let Ht=re();if(MU(nn)){let hn=mt+1;if(ee(hn,F(),vf(Ht))){let kn=K(V,Ht);if(kn){V=kn.endPos,ht=!1;continue}}if(mt-E>3){let kn=Ht.length>0?Ht[Ht.length-1]:null;if(kn&&(kn.type===be.paragraph||kn.type===be.text)){Ug(nn,Ht,n,r),ht=!1,V=en(e,Rt);continue}}else break}else{let hn=K(V,Ht);if(hn){V=hn.endPos,ht=!1;continue}}let An=j;if(vf(Ht)?mt>=An-1:mt>An-1){let hn=$g(e,V,Rt,sn,An-1,j,re(),ht,n,r,void 0);if(hn.processed){ht=hn.wasBlank,V=hn.newPos;continue}}else break}else break}}if(te&&W.length>1&&W[0].length>0&&W[0][0].type!==be.paragraph){for(var Hn=1;Hn<W.length;Hn++)if(W[Hn].length>0&&W[Hn][0].type===be.paragraph){for(var Qr=!1,so=0;so<W[0].length;so++){var Hr=W[0][so].type;if(Hr===be.codeBlock||Hr===be.heading||Hr===be.blockQuote||Hr===be.orderedList||Hr===be.unorderedList||Hr===be.htmlBlock||Hr===be.breakThematic){Qr=!0;break}}Qr||(W[0]=[{type:be.paragraph,children:W[0]}]);break}}let Us=y?{type:be.orderedList,items:W,ordered:!0,start:w}:{type:be.unorderedList,items:W,ordered:!1};return n.inList=a,{...Us,endPos:V}}function Ohe(e,t,n,r){if(n.inline)return null;let a=[],s=t;for(;s<e.length;){let x=qe(e,s);if(_o(e,s,x))break;let E=e.slice(s,x).trim();if(!(E.indexOf("|")!==-1||a.length>=3&&E&&!cp(E[0])))break;a.push(E),s=en(e,x)}if(a.length<2)return null;let i=x=>x[0]==="|"&&x[x.length-1]==="|"?x.slice(1,-1):x,c=x=>{let E=[],w="",_=!1;for(let S=0;S<x.length;S++){let T=x[S];T==="\\"&&S+1<x.length&&x[S+1]==="|"?(w+="|",S++):T==="`"?(_=!_,w+=T):T==="|"&&!_?(E.push(w.trim()),w=""):w+=T}return E.push(w.trim()),E},u=c(i(a[0]));if(!u.length)return null;let f=c(i(a[1]));if(f.length!==u.length||f.some(x=>!/^:?-+:?$/.test(x)))return null;let m=f.map(x=>{let E=x[0]===":",w=x[x.length-1]===":";return E&&w?"center":E?"left":w?"right":null}),h=x=>Fy(n,!0,()=>x.map(E=>Vl(E,0,E.length,n,r))),b=h(u),y=a.slice(2).map(x=>{let E=x.indexOf("|")!==-1?c(i(x)):[x.trim()],w=u.length;for(;E.length<w;)E.push("");return E.length=w,h(E)});return{type:be.table,header:b,cells:y,align:m,endPos:s}}var Dhe=["div","p","section","article","aside","nav","header","footer","main","h1","h2","h3","h4","h5","h6","blockquote","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","td","th","form","fieldset","hr","pre","details","summary","figure","figcaption"],Lhe=new Set(["pre","script","style","textarea"]);function Pf(e){return Dhe.indexOf(e.toLowerCase())!==-1}function up(e){return Lhe.has(e)}function _o(e,t,n){for(var r=t;r<n;r++){let a=Ce(e,r);if(a!==dt&&a!==Kt&&a!==Kr)return!1}return!0}function Fy(e,t,n){let r=e.inline;e.inline=t;try{return n()}finally{e.inline=r}}function TE(e,t,n){for(var r=t;r<n;){var a=qe(e,r);if(_o(e,r,a))return r;r=a+(a<n?1:0)}return n}function NE(e,t,n){return{type:be.htmlComment,text:e,endPos:t,...n}}function Dc(e,t,n,r,a,s,i,c){var u=t;if(c&&c.forceBlock&&t&&!s){var f=new RegExp("^<"+e.toLowerCase()+"(\\s[^>]*)?>$","i");f.test(t.trim())&&(u="")}return{type:be.htmlBlock,tag:e,attrs:r||{},rawAttrs:a,children:[],text:u,noInnerParse:!0,isClosingTag:s,canInterruptParagraph:i,endPos:n}}function Uf(e){let t=WH.test(e),n=GH.test(e),r=phe.test(e);return t||n&&!r}function BU(e,t,n,r,a,s,i,c,u,f){if(!c.inHTML&&!c.inline&&!qT(a,`
158
+ `},...S.children):_.type===be.heading?i.push(...S.children):vf(i)?i.push(...w):i.push({type:be.text,text:" "},...S.children),w.length>1&&i.push(...w.slice(1))}else i.push(...w);return{processed:!0,newPos:en(e,n),wasBlank:!1}}if(c){let _=Fy(u,!0,()=>Vl(y,0,y.length,u,f));i.push({type:be.paragraph,children:_})}else Ug(y,i,u,f);return{processed:!0,newPos:en(e,n),wasBlank:!1}}function gS(e,t,n,r){if(n.inline)return null;var a=n.inList;if(n.inList=!0,t>0){var s=Ce(e,t-1);if(s!==Ln&&s!==Kr)return n.inList=a,null}var i=qe(e,t),c=tn(e,t,i);if(c.spaceEquivalent>3&&!n.inList)return n.inList=a,null;var u=e.slice(t,i),f=c.charCount,m=u.slice(f),h=_E(m);if(!h)return n.inList=a,null;var{match:b,ordered:y,listItemRegex:x}=h,E=c.spaceEquivalent,w=y?parseInt(b[1],10):void 0,_=y?b[2]:void 0,S=y?void 0:b[1],T=y?b[3]==="":b[2]==="";function R(Rt,pn){if(Rt===0)return!0;var sn=Ce(e,Rt-1);if(sn!==Ln)return!1;if(!pn)return!0;for(var Zt=Rt-2;Zt>=0;){var mt=Ce(e,Zt);if(mt!==dt&&mt!==Kt)break;Zt--}return Zt<0||Ce(e,Zt)===Ln}if(T&&!R(t,!0))return n.inList=a,null;if(y&&w!==1&&!R(t,!1)||!y&&FU(b,S))return null;var C=b.index||0,I=y?C+b[1].length+b[2].length+1:T?C+b[1].length:C+b[1].length+1,A=t+f+I,O=zb(e,A,i,E,I),j=O.contentStartColumn,U=E+C+b[1].length,B=y?U+b[2].length+1:T?U:U+1,W=[],J=[];function ee(Rt,pn,sn){return sn?Rt>=pn:Rt>pn}function re(){return W[W.length-1]}function F(){return J[J.length-1]??j}function K(Rt,pn){let sn=JH(pn),Zt=n.inList;n.inList=!0;let mt=gS(e,Rt,n,r);return n.inList=Zt,mt?(sn.push(mt),mt):null}for(var V=en(e,i),ne=V,te=!1;ne<e.length;){var D=qe(e,ne),H=e.slice(ne,D);if(H.trim()===""){for(var $=en(e,D);$<e.length;){var L=Ce(e,$);if(L!==Ln){if(!xhe.has(e[$]))break}$++}var M=qe(e,$),z=e.slice($,M),G=tn(e,$,M),q=z.slice(G.charCount);if(mi(q,G,y,S,_,E,x))te=!0;else{var ae=hS(e,$,M,G,q,n,r);if(ae){for(var ie=ae;ie<e.length&&Ce(e,ie)===Ln;)ie++;if(ie<e.length){var X=qe(e,ie),Z=e.slice(ie,X),se=tn(e,ie,X),me=Z.slice(se.charCount);mi(me,se,y,S,_,E,x)&&(te=!0)}}}break}var le=tn(e,ne,D),Te=H.slice(le.charCount),Be=_E(Te);if(!Be)break;var Ee=Be.match;if(y){if(Ee[2]!==_)break}else if(Ee[1]!==S)break;ne=en(e,D)}var _e=y?b[3]:b[2];_e=_e.trimStart();for(var Ue=t+f+(b.index||0),fe=y?Ue+b[1].length+b[2].length:Ue+b[1].length,Ae=fe;Ae<e.length;){var L=Ce(e,Ae);if(L!==dt&&L!==Kt)break;Ae++}for(var ze=0,we=fe;we<i;){var L=Ce(e,we);if(L===Kt)ze+=4-ze%4;else if(L===dt)ze++;else break;we++}var at=!1;if(fe<e.length&&Ce(e,fe)===Kt){for(var lt=1,gt=fe+1;gt<e.length&&Ce(e,gt)===Kt;)lt++,gt++;lt>=2&&(_e=" "+_e,at=!0)}y||(T=T&&ze===0),ze>=4&&!at&&(_e=" ".repeat(ze-1)+_e.trimStart()),_e.trim();let Ct=te;if(!te&&V<e.length)for(var Le=V;Le<e.length;){var $e=qe(e,Le),bt=e.slice(Le,$e);if(_o(e,Le,$e)){for(var nt=en(e,$e);nt<e.length;){var Ut=qe(e,nt);if(_o(e,nt,Ut))nt=en(e,Ut);else break}if(nt<e.length){var ot=tn(e,nt,e.length),Ie=ot.spaceEquivalent;if(Ie>=E){for(var Me=e.slice(nt,qe(e,nt)),He=Me.slice(ot.charCount).match(x),it=He&&(y?He[2]===_:He[1]===S),pt=null,Et=V;Et<Le;Et=qe(e,Et)+1){var xt=qe(e,Et),un=tn(e,Et,xt),mn=e.slice(Et,xt).slice(un.charCount).match(x),Ze=mn&&un.spaceEquivalent>E&&un.spaceEquivalent>=j&&(y?mn[2]===_:mn[1]===S);if(Ze){var vt=un.spaceEquivalent+1,jt=y?vt+mn[1].length+mn[2].length+1:vt+mn[1].length+1,Pt=Et+un.charCount+mn[0].length,yr=zb(e,Pt,xt,vt,jt-vt);pt=yr.contentStartColumn;break}}var dn=ze>=5?B:j;!it&&Ie>=dn&&(pt===null||Ie+1<pt)&&(Ct=!0)}}break}var Xn=tn(e,Le,$e),Jn=Xn.spaceEquivalent,wn=bt.slice(Xn.charCount),fn=wn.match(x),la=fn&&(y?fn[2]===_:fn[1]===S);if(la&&Jn<=E)break;Le=en(e,$e)}var Qt=_e;if(cn(_e,"```")||cn(_e,"~~~")){var Ta=y?b[1].length+b[2].length+1:b[1].length+1,Na=QH(e,_e,V,Ta);Qt=Na.content,V=Na.endPos}var vr=!T&&_e.trim()===""&&ze>0&&ze<5;if(vr&&!Ct)for(var t=V;t<e.length;){var i=qe(e,t),u=e.slice(t,i);if(u.trim()==="")break;var c=tn(e,t,i);if(c.spaceEquivalent<B)break;var m=u.slice(c.charCount);if(c.spaceEquivalent<=E&&mi(m,c,y,S,_,E,x))break;Qt+=`
159
+ `+m,V=t=en(e,i)}if(W.push(eV(Qt,Ct,n,r)),J.push(j),Ct&&(ze>=5||vr)){let Rt=re();V=$U(e,Rt,B,V,E,y,S,_,x,n,r,!0)}else if(!Ct){let Rt=B-1;for(;V<e.length;){let pn=qe(e,V),sn=e.slice(V,pn),Zt=tn(e,V,pn),mt=Zt.spaceEquivalent,nn=sn.slice(Zt.charCount);if(sn.trim()===""||mt<=E&&mi(nn,Zt,y,S,_,E,x)||MU(nn)&&mt>E||mt<Rt)break;let dr=re(),st=$g(e,V,pn,Zt,Rt,j,dr,!1,n,r,!0);if(st.processed)V=st.newPos;else break}}for(var ht=!1;V<e.length;){let Rt=qe(e,V),pn=e.slice(V,Rt),sn=tn(e,V,Rt),Zt=sn.charCount,mt=sn.spaceEquivalent;if(pn.trim()==="")te=!0,ht=!0,V=en(e,Rt);else if(mt<E){let nn=pn.slice(Zt);if(nn.startsWith("<")&&UU(e,V,Zt,E,mt,r))break;let dr=nn.trim();if(dr.length>0&&W.length>0&&!cp(dr[0])&&!mi(nn,sn,y,S,_,E,x)){let st=re();if(st.length>0){let ca=st[st.length-1];if(ca.type===be.paragraph||ca.type===be.text){Ug(nn,st,n,r),ht=!1,V=en(e,Rt);continue}}}break}else{let nn=pn.slice(Zt);if(W.length>0){let Ht=J[W.length-1]||j;if(mt+1>=Ht&&!mi(nn,sn,y,S,_,E,x)){let An=re();if(An.length>0&&tV(An,nn,r)){V=en(e,Rt);continue}}}if($b(e,V))break;if(ht){let Ht=hS(e,V,Rt,sn,nn,n,r);if(Ht){V=Ht,ht=!1;continue}}if(mt<=E){if(nn.startsWith("<")&&UU(e,V,Zt,E,mt,r))break;if(!mi(nn,sn,y,S,_,E,x)){if(mt===E&&!ht){let Ht=nn.trim();if(Ht.length>0&&!cp(Ht[0])){let An=Hp(e,V,n,r);if(An&&An.type!==be.paragraph)break;let hn=re();if(hn.length>0&&!vf(hn)){Ug(nn,hn,n,r,!1),ht=!1,V=en(e,Rt);continue}}}break}}if(jU(W,T,ht,_e))break;let dr=_E(nn),st=dr?dr.match:null,ca=st&&(y?st[2]===_:st[1]===S);if(ca&&mt>3&&ht)break;if(ca&&mt<=E+3){if(mt>=4&&ht)break;if(mt===E){let Ht=y?st[3]:st[2];if(Ht=Ht.trimStart(),V=bg(e,W,J,Ht,V,Rt,mt,Zt,st,y,te,n,r).newCurrentPos,ht=!1,Ht.trim()===""){let An=W[W.length-1],hn=F();V=$U(e,An,hn,V,E,y,S,_,x,n,r)}continue}if(mt>E){if(ht){let kn=y?st[3]:st[2];kn=kn.trimStart(),V=bg(e,W,J,kn,V,Rt,mt,Zt,st,y,te,n,r).newCurrentPos,ht=!1;continue}let Ht=re(),An=mt+1,hn=ee(An,F(),vf(Ht));if(hn){let kn=K(V,Ht);if(kn){V=kn.endPos,ht=!1;continue}}if(!hn&&ca){let kn=y?st[3]:st[2];if(kn=kn.trimStart(),!te){let rr=en(e,Rt);for(;rr<e.length;){let wr=qe(e,rr),Co=e.slice(rr,wr),$t=tn(e,rr,wr),ua=$t.spaceEquivalent;if(Co.trim()===""){let Er=en(e,wr);if(Er<e.length){let Vr=tn(e,Er,e.length).spaceEquivalent,Ro=mt+(y?st[1].length+st[2].length+1:st[1].length+1);if(Vr+1>Ro)break}break}else if(ua<=E){let Er=Co.slice($t.charCount).match(x);if(Er&&(y?Er[2]===_:Er[1]===S)&&ua<=E)break}rr=en(e,wr)}}V=bg(e,W,J,kn,V,Rt,mt,Zt,st,y,te,n,r).newCurrentPos,ht=!1;continue}else if(!hn&&!ca)break;{let kn=re(),rr=kn.length===0;if(rr&&jU(W,T,ht,_e))break;let wr=kn.some($t=>$t.type===be.codeBlock||$t.type===be.paragraph||$t.type===be.blockQuote||$t.type===be.orderedList||$t.type===be.unorderedList||$t.type===be.heading),Co=rr&&W.length===1?B:j;if(wr?mt>=Co:mt>Co){let $t=$g(e,V,Rt,sn,Co,j,re(),ht,n,r,void 0);if($t.processed){ht=$t.wasBlank,V=$t.newPos;continue}}else break}}else if(mt===E){if(!y&&st&&FU(st,st[1]))break;let Ht=y?st[3]:st[2];Ht=Ht.trimStart(),V=bg(e,W,J,Ht,V,Rt,E,Zt,st,y,te,n,r).newCurrentPos,ht=!1}}else if(mt>E){let Ht=re();if(MU(nn)){let hn=mt+1;if(ee(hn,F(),vf(Ht))){let kn=K(V,Ht);if(kn){V=kn.endPos,ht=!1;continue}}if(mt-E>3){let kn=Ht.length>0?Ht[Ht.length-1]:null;if(kn&&(kn.type===be.paragraph||kn.type===be.text)){Ug(nn,Ht,n,r),ht=!1,V=en(e,Rt);continue}}else break}else{let hn=K(V,Ht);if(hn){V=hn.endPos,ht=!1;continue}}let An=j;if(vf(Ht)?mt>=An-1:mt>An-1){let hn=$g(e,V,Rt,sn,An-1,j,re(),ht,n,r,void 0);if(hn.processed){ht=hn.wasBlank,V=hn.newPos;continue}}else break}else break}}if(te&&W.length>1&&W[0].length>0&&W[0][0].type!==be.paragraph){for(var Hn=1;Hn<W.length;Hn++)if(W[Hn].length>0&&W[Hn][0].type===be.paragraph){for(var Qr=!1,so=0;so<W[0].length;so++){var Hr=W[0][so].type;if(Hr===be.codeBlock||Hr===be.heading||Hr===be.blockQuote||Hr===be.orderedList||Hr===be.unorderedList||Hr===be.htmlBlock||Hr===be.breakThematic){Qr=!0;break}}Qr||(W[0]=[{type:be.paragraph,children:W[0]}]);break}}let Us=y?{type:be.orderedList,items:W,ordered:!0,start:w}:{type:be.unorderedList,items:W,ordered:!1};return n.inList=a,{...Us,endPos:V}}function Ohe(e,t,n,r){if(n.inline)return null;let a=[],s=t;for(;s<e.length;){let x=qe(e,s);if(_o(e,s,x))break;let E=e.slice(s,x).trim();if(!(E.indexOf("|")!==-1||a.length>=3&&E&&!cp(E[0])))break;a.push(E),s=en(e,x)}if(a.length<2)return null;let i=x=>x[0]==="|"&&x[x.length-1]==="|"?x.slice(1,-1):x,c=x=>{let E=[],w="",_=!1;for(let S=0;S<x.length;S++){let T=x[S];T==="\\"&&S+1<x.length&&x[S+1]==="|"?(w+="|",S++):T==="`"?(_=!_,w+=T):T==="|"&&!_?(E.push(w.trim()),w=""):w+=T}return E.push(w.trim()),E},u=c(i(a[0]));if(!u.length)return null;let f=c(i(a[1]));if(f.length!==u.length||f.some(x=>!/^:?-+:?$/.test(x)))return null;let m=f.map(x=>{let E=x[0]===":",w=x[x.length-1]===":";return E&&w?"center":E?"left":w?"right":null}),h=x=>Fy(n,!0,()=>x.map(E=>Vl(E,0,E.length,n,r))),b=h(u),y=a.slice(2).map(x=>{let E=x.indexOf("|")!==-1?c(i(x)):[x.trim()],w=u.length;for(;E.length<w;)E.push("");return E.length=w,h(E)});return{type:be.table,header:b,cells:y,align:m,endPos:s}}var Dhe=["div","p","section","article","aside","nav","header","footer","main","h1","h2","h3","h4","h5","h6","blockquote","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","td","th","form","fieldset","hr","pre","details","summary","figure","figcaption"],Lhe=new Set(["pre","script","style","textarea"]);function Pf(e){return Dhe.indexOf(e.toLowerCase())!==-1}function up(e){return Lhe.has(e)}function _o(e,t,n){for(var r=t;r<n;r++){let a=Ce(e,r);if(a!==dt&&a!==Kt&&a!==Kr)return!1}return!0}function Fy(e,t,n){let r=e.inline;e.inline=t;try{return n()}finally{e.inline=r}}function TE(e,t,n){for(var r=t;r<n;){var a=qe(e,r);if(_o(e,r,a))return r;r=a+(a<n?1:0)}return n}function NE(e,t,n){return{type:be.htmlComment,text:e,endPos:t,...n}}function Dc(e,t,n,r,a,s,i,c){var u=t;if(c&&c.forceBlock&&t&&!s){var f=new RegExp("^<"+e.toLowerCase()+"(\\s[^>]*)?>$","i");f.test(t.trim())&&(u="")}return{type:be.htmlBlock,tag:e,attrs:r||{},rawAttrs:a,children:[],text:u,noInnerParse:!0,isClosingTag:s,canInterruptParagraph:i,endPos:n}}function Uf(e){let t=WH.test(e),n=GH.test(e),r=phe.test(e);return t||n&&!r}function BU(e,t,n,r,a,s,i,c,u,f){if(!c.inHTML&&!c.inline&&!qT(a,`
160
160
  `)){let M=s,z=i.length;for(;M<z;){let G=qe(i,M);if(_o(i,M,G))break;let q=i.slice(M,G).trim();if(q.length>0&&cp(q[0])){let ae=By(i,M,c,f);if(ae){M=ae.endPos;continue}let ie=$u(i,M);if(ie){M=ie.endPos;continue}return null}M=en(i,G)}}let m=t,h=up(m);var b=!h&&!jf(t),y=void 0;if(a){var x=a.indexOf(">");if(x!==-1){var E=a.slice(0,x+1);E.indexOf(`
161
161
  `)!==-1&&(y=E);for(var w=x,_=1;_<x;_++){var S=E[_];if(S===" "||S===" "||S===`
162
162
  `||S===">"){w=_;break}}n=E.slice(w,x)}}var T=n.replace(/^[\s\n\r\t]+/,""),R=gl(T,t,e,f),C={...R},I=!1,A=!1;if(b&&r.length>0){var O="</"+m,j=r.indexOf(O);if(j>=0){for(var U=j+O.length;U<r.length&&(r[U]===" "||r[U]===" ");)U++;if(U<r.length&&r[U]===">"){var B=r.slice(0,j);Uf(B)?(r=B,A=!0):I=!0}}if(!A){var W=r.length-1;if(r[W]===`
@@ -170,13 +170,13 @@ Example: https://${e.url}`}e.proxyConfig?.customHeaders&&(s={...s,...e.proxyConf
170
170
  `&&(re=re.slice(1));let $s=b.tagLower||b.tagName.toLowerCase();return Dc(b.tagName,re,ee,gl(b.whitespaceBeforeAttrs+b.attrs,$s,b.tagName,r),b.whitespaceBeforeAttrs+b.attrs,!0,!1)}}var G=e.slice(t,b.endPos);return{type:be.htmlSelfClosing,tag:b.tagName,attrs:{},endPos:b.endPos,isClosingTag:!0,rawText:G}}var q=t+(b.isClosing?2:1);if(q<e.length){var ae=e[q];if(ae===" "||ae===" "||ae===`
171
171
  `||ae==="\r")return null}var ie=b.tagLower,X=jf(b.tagName);let Z=b.tagName.length>0&&b.tagName[0]>="A"&&b.tagName[0]<="Z";if(b.isSelfClosing||X&&ie!=="a"){if(b.hasNewline&&!Z||!n.inHTML&&!n.inline&&!Z)return null;var se=b.attrs.replace(/\/\s*$/,""),me=gl(se,ie,b.tagName,r),G=n.inline?e.slice(t,b.endPos):void 0;let ea={type:be.htmlSelfClosing,tag:b.tagName,attrs:me,endPos:b.endPos};return G!==void 0&&(ea.rawText=G),ea}if(n.inline){var le=b.attrs.replace(/\/\s*$/,""),Te=b.whitespaceBeforeAttrs+le,Be=gl(le,ie,b.tagName,r),Ee={...Be},_e=b.endPos,Ue=[];if(!jf(b.tagName)){var fe=dhe(e,b.endPos,ie);if(fe!==null){var Ae=e.slice(b.endPos,fe[0]);Ae&&(n.inHTML&&VH.test(Ae)||Uf(Ae)?Ue=rN(Ae,{...n,inline:!1,inHTML:!0,inAnchor:n.inAnchor||ie==="a"},r):Ue=Vl(Ae,0,Ae.length,{...n,inline:!0,inAnchor:n.inAnchor||ie==="a"},r)),_e=fe[1]}}return{type:be.htmlBlock,tag:b.tagName,attrs:Ee,rawAttrs:Te,children:Ue,noInnerParse:!1,endPos:_e}}if(!n.inline){for(var y=e.length,x=qe(e,t),ze=b.tagLower,we=up(ze),at=!we&&Pf(b.tagName),lt=!1,gt=t;gt<b.endPos;){if(e[gt]===">"){lt=!0;break}gt++}for(var M=b.endPos;M<x&&(e[M]===" "||e[M]===" ");)M++;var Ct=M>=x||e[M]===`
172
172
  `||e[M]==="\r"||at&&M<x||!lt;if(we&&lt&&!b.isClosing){var{tagName:Le,endPos:$e,attrs:bt}=b,nt=$e;e[nt]===`
173
- `&&nt++;for(var Ut=nt,st=nt,Ie=1,Me=ze.length+1;Ie>0;){var He=e.indexOf("<",nt);if(He===-1){st=y,nt=y;break}var it=-1,pt=-1;if(e[He+1]==="/")pt=He;else if(He+Me+1<=y&&(e[He+1]===ze[0]||e[He+1]===Le[0])){var Et=e.substring(He+1,He+Me);Et.toLowerCase()===ze&&(e[He+Me]===" "||e[He+Me]===">")&&(it=He)}if(it===-1&&pt===-1){nt=He+1;continue}if(it!==-1&&(pt===-1||it<pt))nt=it+Me+1,Ie++;else{for(var xt=pt+2;xt<y;){var un=e[xt];if(un!==" "&&un!==" "&&un!==`
173
+ `&&nt++;for(var Ut=nt,ot=nt,Ie=1,Me=ze.length+1;Ie>0;){var He=e.indexOf("<",nt);if(He===-1){ot=y,nt=y;break}var it=-1,pt=-1;if(e[He+1]==="/")pt=He;else if(He+Me+1<=y&&(e[He+1]===ze[0]||e[He+1]===Le[0])){var Et=e.substring(He+1,He+Me);Et.toLowerCase()===ze&&(e[He+Me]===" "||e[He+Me]===">")&&(it=He)}if(it===-1&&pt===-1){nt=He+1;continue}if(it!==-1&&(pt===-1||it<pt))nt=it+Me+1,Ie++;else{for(var xt=pt+2;xt<y;){var un=e[xt];if(un!==" "&&un!==" "&&un!==`
174
174
  `&&un!=="\r")break;xt++}if(xt+ze.length>y)break;var mn=e.substring(xt,xt+ze.length);if(mn.toLowerCase()!==ze){nt=xt;continue}for(xt+=ze.length;xt<y;){var Ze=e[xt];if(Ze!==" "&&Ze!==" "&&Ze!==`
175
- `&&Ze!=="\r")break;xt++}if(xt>=y||e[xt]!==">"){nt=xt;continue}var vt=xt+1,jt=qe(e,vt);st=jt,nt=jt+1,Ie--}}for(var Pt=0;nt+Pt<y&&e[nt+Pt]===`
176
- `;)Pt++;var yr=e.slice(t,nt+Pt),dn=e.slice(Ut,st),Xn=nt+Pt;return BU(b.tagName,b.tagName,bt,dn,yr,Xn,e,n,!1,r)}if(Ct||!lt){var W=at?"type6":"type7",J=b.endPos,ee=TE(e,x+1,y);if(W==="type6"&&!b.isClosing){var Jn="</"+(b.tagLower||b.tagName.toLowerCase()),wn=e.indexOf(Jn,J);if(wn!==-1){for(var fn=wn+Jn.length;fn<y&&(e[fn]===" "||e[fn]===" ");)fn++;if(fn<y&&e[fn]===">"){var la=e.slice(J,wn),Qt=Uf(la);if(Qt){var Ta=qe(e,fn+1);ee=Ta}}}}var re=e.slice(J,ee),Na=b.whitespaceBeforeAttrs+b.attrs,F=b.isClosing;if(W==="type7"&&re.trim()===""){var vr=e.slice(t,b.endPos),ht=vr.indexOf(`
175
+ `&&Ze!=="\r")break;xt++}if(xt>=y||e[xt]!==">"){nt=xt;continue}var vt=xt+1,jt=qe(e,vt);ot=jt,nt=jt+1,Ie--}}for(var Pt=0;nt+Pt<y&&e[nt+Pt]===`
176
+ `;)Pt++;var yr=e.slice(t,nt+Pt),dn=e.slice(Ut,ot),Xn=nt+Pt;return BU(b.tagName,b.tagName,bt,dn,yr,Xn,e,n,!1,r)}if(Ct||!lt){var W=at?"type6":"type7",J=b.endPos,ee=TE(e,x+1,y);if(W==="type6"&&!b.isClosing){var Jn="</"+(b.tagLower||b.tagName.toLowerCase()),wn=e.indexOf(Jn,J);if(wn!==-1){for(var fn=wn+Jn.length;fn<y&&(e[fn]===" "||e[fn]===" ");)fn++;if(fn<y&&e[fn]===">"){var la=e.slice(J,wn),Qt=Uf(la);if(Qt){var Ta=qe(e,fn+1);ee=Ta}}}}var re=e.slice(J,ee),Na=b.whitespaceBeforeAttrs+b.attrs,F=b.isClosing;if(W==="type7"&&re.trim()===""){var vr=e.slice(t,b.endPos),ht=vr.indexOf(`
177
177
  `)!==-1;if(ht)return null;var Hn=b.endPos,V=qe(e,Hn);V<e.length&&V++;var ne=e.slice(t,V);return Dc(b.tagName,ne,ee,{},void 0,F,!1,r)}var Qr=b.hasNewline,so=!lt;if((Qr||so)&&W==="type7"){var Hr=b.endPos,Us=e.slice(t,Hr),Rt=re,te=Us+Rt;return Dc(b.tagName,te,ee,{},void 0,F,!1,r)}let Zo=b.tagLower||b.tagName.toLowerCase();var pn=gl(Na,Zo,b.tagName,r),sn={...pn};if(W==="type6"){var Zt=re,mt=re.indexOf("</"+Zo);if(mt>=0){for(var M=mt+2+b.tagName.length;M<re.length&&(re[M]===" "||re[M]===" ");)M++;M<re.length&&re[M]===">"&&(Zt=re.slice(0,mt))}if(Uf(Zt))return BU(b.tagName,b.tagName,Na,Zt,e.slice(t,b.endPos),ee,e,n,!1,r)}var nn=re;nn.length>0&&nn[0]===`
178
178
  `&&(nn=nn.slice(1));for(var dr=nn.split(`
179
- `),ot=1/0,ca=0;ca<dr.length;ca++){var Ht=dr[ca];if(Ht.trim().length!==0){for(var w=0;w<Ht.length&&(Ht[w]===" "||Ht[w]===" ");)w++;w<ot&&(ot=w)}}if(ot>0&&ot<1/0){for(var An=[],hn=0;hn<dr.length;hn++){var kn=dr[hn];kn.trim().length===0?An.push(kn):An.push(kn.slice(ot))}nn=An.join(`
179
+ `),st=1/0,ca=0;ca<dr.length;ca++){var Ht=dr[ca];if(Ht.trim().length!==0){for(var w=0;w<Ht.length&&(Ht[w]===" "||Ht[w]===" ");)w++;w<st&&(st=w)}}if(st>0&&st<1/0){for(var An=[],hn=0;hn<dr.length;hn++){var kn=dr[hn];kn.trim().length===0?An.push(kn):An.push(kn.slice(st))}nn=An.join(`
180
180
  `)}return Dc(b.tagName,nn,ee,sn,Na,F,W==="type6",r)}}if(n.inline)return null;var rr=dS(e,t+1);if(!rr)return null;var wr=rr.tagName;if(!jf(wr))return null;let Co=rr.tagLower;for(var $t=rr.nextPos,ua=e.length;$t<ua&&_r(e[$t]);)$t++;for(var Er=$t;$t<ua&&e[$t]!==">";)$t++;if($t>=ua)return null;let Vr=e.slice(Er,$t).trim(),Ro=$t+1;for(;Ro<ua&&_r(e[Ro]);)Ro++;let ov="</"+Co+">",Kl=e.toLowerCase().indexOf(ov,Ro);if(Kl!==-1&&e.slice(Ro,Kl).trim())return null;$t++;let Jp=$t;for(;$t<ua&&_r(e[$t]);)$t++;$t<ua&&e[$t]===`
181
181
  `&&$t++;let Yl=gl(Vr,wr,wr,r);return{type:be.htmlSelfClosing,tag:wr,attrs:Yl,endPos:Jp}}function Mhe(e,t){if(e[t]!=="<")return null;var n=e.length,r=!1,a=t+1;t+1<n&&e[t+1]==="/"&&(r=!0,a=t+2);var s=dS(e,a);if(!s)return null;var{tagName:i,tagLower:c,nextPos:u}=s;if(u<n){var f=e[u];if(f===">"||f==="/"){var m=f===">"?u+1:u+2;if(f==="/"&&(u+1>=n||e[u+1]!==">"))return null;var h=f==="/",b=Pf(i),y=!up(c)&&!b;return{kind:"tag",tagNameLower:c,tagName:i,isClosing:r,isSelfClosing:h,hasNewline:!1,type6Candidate:b,type7Candidate:y,endPos:m,attrs:"",whitespaceBeforeAttrs:""}}}for(var x=u,E=!1;u<n;){var w=e[u],_=Ce(e,u);if(!(w===" "||w===" "))if(_===10||_===13)E=!0;else break;u++}for(var S=e.slice(x,u),T=u,R=0,C=!1,I=!1,A=0;T<n;){var O=e[T],_=Ce(e,T);if(A===1){if(O==='"'){if(T+1<n&&e[T+1]==='"')return null;A=0}T++}else if(A===2)O==="'"&&(A=0),T++;else if(O==='"')A=1,T++;else if(O==="'")A=2,T++;else if(O==="{"||O==="}"&&R>0)R+=O==="{"?1:-1,T++;else if(O===">"&&R===0){if(T>u){for(var j=T-1;j>=u;){var U=e[j];if(U!==" "&&U!==" ")break;j--}j>=u&&e[j]==="/"&&(C=!0,I=j<T-1)}T++;break}else{if(O==="*"||O==="#"||O==="!"){for(var B=T+1;B<n;){var W=e[B];if(W==="="||W===" "||W===" "||W===`
182
182
  `||W==="\r"||W===">")break;B++}if(B<n&&e[B]==="=")return null}(_===10||_===13)&&(E=!0),T++}}if(T>n||e[T-1]!==">"||A===1||A===2||R>0||I)return null;var J=T-1;C&&J--;for(var ee=e.slice(u,J),re=C,F=-1,K=!1,V="",ne=!1,te=0;te<ee.length;te++){var w=ee[te];if(K)w===V&&(K=!1,F=te,V="",ne=!1);else if(w==='"'||w==="'")K=!0,V=w,ne=!1;else if(w==="=")ne=!0;else if(F!==-1&&te===F+1){var _=w.charCodeAt(0);if(Ll(_))return null}else{if(ne&&!K&&(w==="*"||w==="#"||w==="!"))return null;_r(w)&&(ne=!1)}}var D=Pf(i),H=!up(c)&&!D;return{kind:"tag",tagNameLower:c,tagName:i,isClosing:r,isSelfClosing:re,hasNewline:E,type6Candidate:D,type7Candidate:H,endPos:T,attrs:ee,whitespaceBeforeAttrs:S}}function zg(e,t){if(t>=e.length||e[t]!=="<")return null;var n=e.length;if(t+1>=n)return null;var r=e[t+1];if(r==="!"){if(t+4<=n&&e.slice(t,t+4)==="<!--"){var a=t+4;if(a<n&&e[a]===">")return{kind:"comment",hasNewline:!1,endPos:a+1,text:e.slice(t,a+1),raw:!0};if(a+1<n&&e[a]==="-"&&e[a+1]===">")return{kind:"comment",hasNewline:!1,endPos:a+2,text:e.slice(t,a+2),raw:!0};for(;a+2<n;){if(e.slice(a,a+3)==="-->")return{kind:"comment",hasNewline:!1,endPos:a+3,text:e.slice(t,a+3),raw:!0};a++}return null}if(t+9<=n&&e.slice(t,t+9)==="<![CDATA["){for(var a=t+9;a+2<n;){if(e.slice(a,a+3)==="]]>")return{kind:"cdata",hasNewline:!1,endPos:a+3,text:e.slice(t,a+3),raw:!0};a++}return null}if(t+2<n&&Ll(e.charCodeAt(t+2))){for(var a=t+2;a<n&&e[a]!==">";)a++;return a>=n?null:{kind:"declaration",hasNewline:!1,endPos:a+1,text:e.slice(t,a+1),raw:!0}}return null}if(r==="?"){for(var a=t+2;a+1<n;){if(e.slice(a,a+2)==="?>")return{kind:"pi",hasNewline:!1,endPos:a+2,text:e.slice(t,a+2),raw:!0};a++}return null}return Mhe(e,t)}function jhe(e,t,n){let r=e.length,a=t,s=a<r&&e[a]==="<";s&&a++;let i=a,c=i;if(i>=r){if(!s)return null;c=i}else{if(n>0&&i<r&&e[i]===`
@@ -1664,7 +1664,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1664
1664
  <\/script>
1665
1665
  </body>
1666
1666
  </html>`,XV=1,p$=2,JV=3,m$=4,QV=5,h$=Symbol.for("quilt.threads.serialize"),Jbe=Symbol.for("quilt.threads.transferable");class Qbe extends AbortController{constructor(...t){super();const n=t.find(r=>r.aborted);if(n)this.abort(n.reason);else{const r=s=>this.abort(s.target.reason),a={signal:this.signal};for(const s of t)s.addEventListener("abort",r,a)}}}class g$ extends Error{constructor(){super("You attempted to call a function on a closed thread.")}}let eye="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function e6(e=21){let t="",n=crypto.getRandomValues(new Uint8Array(e));for(let r=0;r<e;r++)t+=eye[63&n[r]];return t}var wf,Bc,Ef,Hg,CS,t6;class tye{constructor(){bo(this,CS),bo(this,wf,new Map),bo(this,Bc,new Map),bo(this,Ef,new Map),bo(this,Hg,new WeakMap)}get(t){return Un(this,Bc).get(t)}release(t){const n=Un(this,Bc).get(t);return n&&(Un(this,Bc).delete(t),Un(this,wf).delete(n)),!!n}serialize(t){let n=Un(this,wf).get(t);return n==null&&(n=e6(),Un(this,wf).set(t,n),Un(this,Bc).set(n,t)),n}deserialize(t,n){var r,a;let s=(r=Un(this,Ef).get(t))==null?void 0:r.deref();return s||(s=(...i)=>{if(!Un(this,Ef).has(t))throw new Error("You attempted to call a function that was already revoked.");return n.call((c,u,f)=>{n.messages.send([JV,c,t,u],f)},i)},(a=Mr(this,CS,t6).call(this,n))==null||a.register(s,t),Un(this,Ef).set(t,new WeakRef(s)),s)}}wf=new WeakMap,Bc=new WeakMap,Ef=new WeakMap,Hg=new WeakMap,CS=new WeakSet,t6=function(e){let t=Un(this,Hg).get(e);if(!(typeof FinalizationRegistry>"u"))return t||(t=new FinalizationRegistry(n=>{e.messages.send([QV,n])}),Un(this,Hg).set(e,t)),t};function nye(e){return e!=null&&(Symbol.asyncIterator in e||Symbol.iterator in e)&&typeof e.next=="function"}function b$(e){if(e==null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t==null||t===Object.prototype}const RE="_@f",y$="_@i";var Ff,Bf,Xa,Vg,hi;class rye{constructor(t){bo(this,Xa),bo(this,Ff),bo(this,Bf),NS(this,Ff,t?.serialize),NS(this,Bf,t?.deserialize)}serialize(t,n,r){return Mr(this,Xa,Vg).call(this,t,n,r)}deserialize(t,n){return Mr(this,Xa,hi).call(this,t,n)}}Ff=new WeakMap,Bf=new WeakMap,Xa=new WeakSet,Vg=function(e,t,n,r=new Map,a=!1){if(e==null)return e;if(r.has(e))return r.get(e);if(r.set(e,void 0),typeof e=="object"){if(Un(this,Ff)&&!a){const c=Un(this,Ff).call(this,e,u=>Mr(this,Xa,Vg).call(this,u,t,n,r,!0),t,n);if(c!==void 0)return r.set(e,c),c}if(e[Jbe])return n?.push(e),r.set(e,e),e;const s=c=>Mr(this,Xa,Vg).call(this,c,t,n,r);if(typeof e[h$]=="function"){const c=e[h$]({serialize:s});return r.set(e,c),c}if(Array.isArray(e)){const c=e.map(u=>s(u));return r.set(e,c),c}if(e instanceof Map){const c=[...e.entries()].map(([f,m])=>[s(f),s(m)]),u=new Map(c);return r.set(e,u),u}if(e instanceof Set){const c=[...e].map(f=>s(f)),u=new Set(c);return r.set(e,u),u}const i=nye(e);if(b$(e)||i){const c={};for(const u of Object.keys(e))c[u]=s(e[u]);return i&&(c.next??(c.next=s(e.next.bind(e))),c.return??(c.return=s(e.return.bind(e))),c.throw??(c.throw=s(e.throw.bind(e))),c[y$]=!0),r.set(e,c),c}}if(typeof e=="function"){const s=t.functions.serialize(e,t,n),i={[RE]:s};return r.set(e,i),i}return r.set(e,e),e},hi=function(e,t,n=!1){if(e==null)return e;if(typeof e=="object"){if(Un(this,Bf)&&!n){const a=Un(this,Bf).call(this,e,s=>Mr(this,Xa,hi).call(this,s,t,!0),t);if(a!==void 0)return a}if(e==null)return e;if(Array.isArray(e))return e.map(a=>Mr(this,Xa,hi).call(this,a,t));if(e instanceof Map)return new Map([...e].map(([a,s])=>[Mr(this,Xa,hi).call(this,a,t),Mr(this,Xa,hi).call(this,s,t)]));if(e instanceof Set)return new Set([...e].map(a=>Mr(this,Xa,hi).call(this,a,t)));if(RE in e)return t.functions.deserialize(e[RE],t);if(!b$(e))return e;const r={};for(const a of Object.keys(e))a===y$?r[Symbol.asyncIterator]=()=>r:r[a]=Mr(this,Xa,hi).call(this,e[a],t);return r}return e};var Hc,El,gi,RS,n6,AS,r6;class aye{constructor(t,{imports:n,exports:r,functions:a=new tye,serialization:s=new rye,signal:i}={}){bo(this,gi),bo(this,Hc),bo(this,El,new Map);var c,u,f,m;this.messages=t,NS(this,Hc,i?new Qbe(i):new AbortController),this.exports=r??{},this.imports=oye(Mr(this,gi,n6).bind(this),n),this.functions=a,this.serialization=s,(u=(c=this.functions).start)==null||u.call(c,this),(m=(f=this.serialization).start)==null||m.call(f,this),this.signal.addEventListener("abort",()=>{for(const h of Un(this,El).keys())Mr(this,gi,AS).call(this,h,void 0,new g$);Un(this,El).clear()},{once:!0}),t.listen(async h=>{if(!(Array.isArray(h)&&typeof h[0]=="number"))return;const b=h;switch(b[0]){case XV:{const[,y,x,E]=b,w=this.exports[x]??(()=>{throw new Error(`No '${x}' method is exported from this thread`)});await Mr(this,gi,RS).call(this,w,E,(_,S,T)=>{this.messages.send([p$,y,_,S],T)});break}case JV:{const[,y,x,E]=b,w=this.functions.get(x,this)??sye;await Mr(this,gi,RS).call(this,w,E,(_,S,T)=>{this.messages.send([m$,y,_,S],T)});break}case p$:case m$:{Mr(this,gi,AS).call(this,...b.slice(1));break}case QV:{const y=b[1];this.functions.release(y,this);break}}},{signal:this.signal})}get signal(){return Un(this,Hc).signal}get closed(){return Un(this,Hc).signal.aborted}close(){Un(this,Hc).abort()}call(t,n){if(this.closed)return Promise.reject(new g$);const r=[],a=this.serialization.serialize(n,this,r),s=e6(),i=Mr(this,gi,r6).call(this,s);return t(s,a,r),i}}Hc=new WeakMap,El=new WeakMap,gi=new WeakSet,RS=async function(e,t,n){try{const r=this.functions.call?await this.functions.call(e,t,this):await e(...this.serialization.deserialize(t,this)),a=[],s=this.serialization.serialize(r,this,a);n(s,void 0,a)}catch(r){n(void 0,this.serialization.serialize(r,this))}},n6=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,r,a)=>{this.messages.send([XV,n,e,r],a)},t)}catch(n){return Promise.reject(n)}}},AS=function(...e){const t=e[0],n=Un(this,El).get(t);n&&(n(...e),Un(this,El).delete(t))},r6=function(e){const t=new Promise((n,r)=>{Un(this,El).set(e,(a,s,i)=>{i==null?n(this.serialization.deserialize(s,this)):r(this.serialization.deserialize(i,this))})});return Object.defineProperty(t,Symbol.asyncIterator,{async*value(){const n=await t;Object.defineProperty(n,Symbol.asyncIterator,{value:()=>n}),yield*n}}),t};function oye(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 r=new Map;n=new Proxy({},{get(a,s){if(r.has(s))return r.get(s);const i=e(s);return r.set(s,i),i}})}else{n={};for(const r of t)Object.defineProperty(n,r,{value:e(r),writable:!1,configurable:!0,enumerable:!0})}return n}function sye(){throw new Error("You attempted to call a function that is not stored. It may have already been released.")}const iye="quilt.threads.ping",v$="quilt.threads.pong";function lye(e,{targetOrigin:t="*"}={}){let n=!1;const r=function(s,i){e.postMessage(s,t,i)},a=new Promise(s=>{const i=new AbortController;globalThis.window.addEventListener("message",c=>{c.source===e&&c.data===v$&&(n=!0,i.abort(),s())},{signal:i.signal}),i.signal.addEventListener("abort",()=>s(),{once:!0}),r(iye)});return{send(s,i){return n?r(s,i):a.then(()=>{if(n)return r(s,i)})},listen(s,{signal:i}){self.addEventListener("message",c=>{c.source===e&&c.data!==v$&&s(c.data)},{signal:i})}}}class cye extends aye{constructor(t,{targetOrigin:n="*",...r}={}){super(lye(t.contentWindow,{targetOrigin:n}),r),this.iframe=t}}const a6=ce.forwardRef(({content:e,children:t,...n},r)=>d.jsx("span",{ref:r,...n,children:e||t}));a6.displayName="UIText";const o6=ce.forwardRef(({label:e,onPress:t,onClick:n,children:r,...a},s)=>d.jsx("button",{ref:s,onClick:i=>{t&&t(),n&&n(i)},style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},...a,children:e||r}));o6.displayName="UIButton";const s6=ce.forwardRef(({direction:e="vertical",spacing:t="8",align:n="stretch",justify:r="flex-start",children:a,...s},i)=>d.jsx("div",{ref:i,style:{display:"flex",flexDirection:e==="horizontal"?"row":"column",gap:`${t}px`,alignItems:n,justifyContent:r},...s,children:a}));s6.displayName="UIStack";const i6=ce.forwardRef(({src:e,alt:t,width:n,height:r,children:a,...s},i)=>d.jsx("img",{ref:i,src:e,alt:t,width:n,height:r,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},...s}));i6.displayName="UIImage";const m1={name:"basic",elements:[{tagName:"ui-text",component:a6,propMapping:{content:"content"},eventMapping:{}},{tagName:"ui-button",component:o6,propMapping:{label:"label"},eventMapping:{press:"onPress"}},{tagName:"ui-stack",component:s6,propMapping:{direction:"direction",spacing:"spacing",align:"align",justify:"justify"},eventMapping:{}},{tagName:"ui-image",component:i6,propMapping:{src:"src",alt:"alt",width:"width",height:"height"},eventMapping:{}}]},uye=({receiver:e})=>{const t=v.useRef(null);return v.useEffect(()=>{if(t.current)return e.connect(t.current),()=>{e.disconnect()}},[e]),d.jsx("div",{ref:t,"data-testid":"standard-dom-renderer-container"})},dye=({resource:e,library:t,remoteElements:n=[],onUIAction:r})=>{const a=v.useRef(null),s=v.useRef(null),[i,c]=v.useState(null),u=v.useMemo(()=>(e.mimeType||"").includes("framework=react")?"react":"webcomponents",[e.mimeType]),f=`${t?.name}-${u}`,{receiver:m,components:h}=v.useMemo(()=>{switch(u){case"react":{const y=new Bbe,x=t||m1,E=new Map;return x&&x.elements.forEach(w=>{const _=Ybe(w.component);E.set(w.tagName,_)}),{receiver:y,components:E}}case"webcomponents":default:return{receiver:new Hbe,components:null}}},[e,t,n]);v.useEffect(()=>{function y(x){var E;if(a.current&&x.source===a.current.contentWindow){const w=x.data;if(!w)return;(E=r?.(w))==null||E.catch(_=>{console.error("Error handling UI action result in RemoteDOMResourceRenderer:",_)})}}return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[r]),v.useEffect(()=>{const y=s.current;return s.current=null,()=>{y?.close()}},[f]);const b=()=>{const y=a.current;if(!y||s.current)return;const x=new cye(y);s.current=x;const{code:E,error:w}=Dbe(e);if(w){c(w);return}if(E&&m!=null&&m.connection){const _={code:E,remoteElements:n,useReactRenderer:u==="react",componentLibrary:t?.name};x.imports.render(_,m.connection).catch(S=>console.error("Error calling remote render:",S))}};return i?d.jsx("p",{className:"text-red-500",children:i}):d.jsxs(d.Fragment,{children:[d.jsx("iframe",{ref:a,srcDoc:Xbe,sandbox:"allow-scripts",style:{display:"none"},title:"Remote DOM Sandbox",onLoad:b},f),u==="react"&&h?d.jsx(qbe,{receiver:m,components:h}):d.jsx(uye,{receiver:m})]})};function fye(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 h1=e=>{const{resource:t,onUIAction:n,supportedContentTypes:r,htmlProps:a,remoteDomProps:s}=e,i=fye(t);if(r&&i&&!r.includes(i))return d.jsxs("p",{className:"text-red-500",children:["Unsupported content type: ",i,"."]});switch(i){case"rawHtml":case"externalUrl":return d.jsx(GV,{resource:t,onUIAction:n,...a});case"remoteDom":return d.jsx(dye,{resource:t,onUIAction:n,library:s?.library||m1,...s});default:return d.jsx("p",{className:"text-red-500",children:"Unsupported resource type."})}};h1.displayName="UIResourceRenderer";const pye={tagName:"ui-button",remoteAttributes:["label"],remoteEvents:["click","press"]},mye={tagName:"ui-text",remoteAttributes:["content"]},hye={tagName:"ui-stack",remoteAttributes:["direction","spacing","align","justify"]},gye={tagName:"ui-image",remoteAttributes:["src","alt","width","height"]},bye=v.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://")?d.jsx("div",{className:"my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card",children:d.jsx(h1,{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 w$({toolName:e,toolArgs:t,result:n,serverId:r,readResource:a}){const[s,i]=v.useState(null),c=v.useMemo(()=>{if(typeof n=="string")try{return JSON.parse(n)}catch(h){return console.error("[ToolResultRenderer] Failed to parse result:",h),n}return n},[n]),u=v.useMemo(()=>!!(c?.content&&Array.isArray(c.content)&&c.content.some(h=>h.type==="resource"&&h.resource?.uri?.startsWith("ui://")&&h.resource?.mimeType==="text/html+skybridge")),[c]),f=v.useMemo(()=>u&&c.content.find(b=>b.type==="resource"&&b.resource?.uri?.startsWith("ui://")&&b.resource?.mimeType==="text/html+skybridge")?.resource||null,[u,c]);if(v.useEffect(()=>{(()=>{f&&i(f)})()},[f]),u&&s&&r&&a)return d.jsx(c1,{componentUrl:s.uri,toolName:e,toolArgs:t,toolResult:c,serverId:r,readResource:a,noWrapper:!0,className:"my-4",showConsole:!1});if(u&&!s)return d.jsx("div",{className:"my-4 p-4 bg-blue-50/30 dark:bg-blue-950/20 border border-blue-200/50 dark:border-blue-800/50 rounded-lg",children:d.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-400",children:"Loading component..."})});const m=[];if(c?.content&&Array.isArray(c.content))for(const h of c.content)h.type==="resource"&&h.resource?.uri?.startsWith("ui://")&&h.resource?.mimeType!=="text/html+skybridge"&&m.push(h.resource);return m.length>0?d.jsx(d.Fragment,{children:m.map(h=>d.jsx(bye,{resource:h},`${e}-mcp-ui-${h.uri}`))}):null}function yye({content:e,timestamp:t}){return!e||e.length===0?null:d.jsx("div",{className:"flex items-start gap-3 justify-end group/user-message",children:d.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-end",children:[d.jsx("div",{className:"bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words",children:d.jsx("p",{className:"text-base leading-7 font-sans text-start break-words",children:e})}),t&&d.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:new Date(t).toLocaleTimeString()})]})})}const vye=v.memo(({messages:e,isLoading:t,serverId:n,readResource:r})=>{const a=v.useRef(null);v.useEffect(()=>{e.length>0&&a.current&&a.current.scrollIntoView({behavior:t?"auto":"smooth",block:"start"})},[e.length,t]);const s=t&&(()=>{if(e.length===0)return!0;const c=e[e.length-1];if(c.role==="user")return!0;if(c.role==="assistant"){const u=typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.map(m=>typeof m=="string"?m:m.text||JSON.stringify(m)).join(""):JSON.stringify(c.content);return!(u&&u.trim().length>0)}return!1})(),i=c=>{if(!t)return!1;const u=e[e.length-1];return c.id===u.id&&u.role==="assistant"};return d.jsxs("div",{className:"space-y-6 max-w-3xl mx-auto px-2",children:[e.map(c=>{const u=typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.map(f=>typeof f=="string"?f:f.text||JSON.stringify(f)).join(""):JSON.stringify(c.content);return c.role==="user"?d.jsx(yye,{content:u,timestamp:c.timestamp},c.id):c.role==="assistant"?d.jsx("div",{className:"space-y-4",children:c.parts&&c.parts.length>0?c.parts.map((f,m)=>{const h=f.type==="text"?`${c.id}-text-${m}-${f.text?.slice(0,20)}`:`${c.id}-tool-${f.toolInvocation?.toolName}-${m}`;return f.type==="text"?d.jsx(r$,{content:f.text||"",timestamp:m===c.parts.length-1?c.timestamp:void 0,_isStreaming:i(c)},h):f.type==="tool-invocation"&&f.toolInvocation?d.jsxs("div",{children:[d.jsx(a$,{toolName:f.toolInvocation.toolName,args:f.toolInvocation.args,result:f.toolInvocation.result,state:f.toolInvocation.result?"result":"call"}),f.toolInvocation.result&&d.jsx(w$,{toolName:f.toolInvocation.toolName,toolArgs:f.toolInvocation.args,result:f.toolInvocation.result,serverId:n,readResource:r})]},h):null}):d.jsxs(d.Fragment,{children:[d.jsx(r$,{content:u,timestamp:c.timestamp,_isStreaming:i(c)}),c.toolCalls&&c.toolCalls.length>0&&d.jsx("div",{className:"space-y-2",children:c.toolCalls.map(f=>{const m=`${c.id}-${f.toolName}-${JSON.stringify(f.args).slice(0,50)}`;return d.jsxs("div",{children:[d.jsx(a$,{toolName:f.toolName,args:f.args,result:f.result,state:f.result?"result":"call"}),f.result&&d.jsx(w$,{toolName:f.toolName,toolArgs:f.args,result:f.result,serverId:n,readResource:r})]},m)})})]})},c.id):null}),s&&d.jsx("div",{className:"flex items-start gap-3",children:d.jsx("div",{className:"flex-1",children:d.jsx("div",{className:"rounded-lg p-4 max-w-fit",children:d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("span",{className:"text-sm",children:d.jsx(Pme,{duration:2,spread:1,children:"Thinking..."})})})})})}),d.jsx("div",{ref:a})]})});function l6(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(16)}function wye({mcpServerUrl:e,llmConfig:t,authConfig:n,isConnected:r}){const[a,s]=v.useState([]),[i,c]=v.useState(!1),u=v.useCallback(async m=>{if(!m.trim()||!t||!r)return;const h={id:`user-${Date.now()}`,role:"user",content:m.trim(),timestamp:Date.now()};s(b=>[...b,h]),c(!0);try{let b=n;if(n?.type==="oauth")try{const R="mcp:auth",C=l6(e),I=`${R}_${C}_tokens`,A=localStorage.getItem(I);if(A){const O=JSON.parse(A);b={...n,oauthTokens:O}}else console.warn("No OAuth tokens found in localStorage for key:",I)}catch(R){console.warn("Failed to retrieve OAuth tokens:",R)}const y=await fetch("/inspector/api/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mcpServerUrl:e,llmConfig:t,authConfig:b,messages:[...a,h].map(R=>({role:R.role,content:R.content}))})});if(!y.ok)throw new Error(`HTTP error! status: ${y.status}`);const x=`assistant-${Date.now()}`;let E="";const w=[];s(R=>[...R,{id:x,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);const _=y.body?.getReader(),S=new TextDecoder;if(!_)throw new Error("No response body");let T="";for(;;){const{done:R,value:C}=await _.read();if(R)break;T+=S.decode(C,{stream:!0});const I=T.split(`
1667
- `);T=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"){E+=O.content;const j=w[w.length-1];j&&j.type==="text"?j.text=E:w.push({type:"text",text:E}),console.log("[Parts after text]",w.length,"parts, text length:",E.length),s(U=>U.map(B=>B.id===x?{...B,parts:[...w]}:B))}else if(O.type==="tool-call")E&&(E=""),w.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",w.length,"parts, tool:",O.toolName),s(j=>j.map(U=>U.id===x?{...U,parts:[...w]}:U));else if(O.type==="tool-result"){const j=w.find(U=>U.type==="tool-invocation"&&U.toolInvocation?.toolName===O.toolName&&!U.toolInvocation?.result);j&&j.toolInvocation?(j.toolInvocation.result=O.result,j.toolInvocation.state="result",console.log("[Parts after tool-result]",w.length,"parts, updated:",O.toolName),s(U=>U.map(B=>B.id===x?{...B,parts:[...w]}:B))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",w.length),s(j=>j.map(U=>U.id===x?{...U,parts:[...w],content:""}:U));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,A)}}}catch(b){let y="Unknown error occurred";if(b instanceof Error){y=b.message;const E=b;E.status&&(y=`HTTP ${E.status}: ${y}`),(E.code===401||y.includes("401")||y.includes("Unauthorized"))&&(y="Authentication failed (401). Check your Authorization header in the connection settings.")}const x={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${y}`,timestamp:Date.now()};s(E=>[...E,x])}finally{c(!1)}},[t,r,e,a,n]),f=v.useCallback(()=>{s([])},[]);return{messages:a,isLoading:i,sendMessage:u,clearMessages:f}}function Eye({connection:e,llmConfig:t,isConnected:n,readResource:r}){const[a,s]=v.useState([]),[i,c]=v.useState(!1),u=v.useRef(null),f=v.useRef(null),m=v.useRef(null),h=v.useCallback(async y=>{if(!y.trim()||!t||!n)return;const x={id:`user-${Date.now()}`,role:"user",content:y.trim(),timestamp:Date.now()};s(_=>[..._,x]),c(!0),u.current=new AbortController;const E=Date.now();let w=0;try{const _=`assistant-${Date.now()}`;let S="";const T=[];if(s(R=>[...R,{id:_,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 R;if(t.provider==="openai"){const{ChatOpenAI:C}=await hr(async()=>{const{ChatOpenAI:I}=await import("./index-BzY2KYX6.js");return{ChatOpenAI:I}},__vite__mapDeps([5,6,7,3,8,9]));R=new C({model:t.model,apiKey:t.apiKey})}else if(t.provider==="anthropic"){const{ChatAnthropic:C}=await hr(async()=>{const{ChatAnthropic:I}=await import("./index-BHtVf3QS.js");return{ChatAnthropic:I}},__vite__mapDeps([10,7,6,3]));R=new C({model:t.model,apiKey:t.apiKey})}else if(t.provider==="google"){const{ChatGoogleGenerativeAI:C}=await hr(async()=>{const{ChatGoogleGenerativeAI:I}=await import("./index-CSbVdovT.js");return{ChatGoogleGenerativeAI:I}},__vite__mapDeps([11,7,6,3,9]));R=new C({model:t.model,apiKey:t.apiKey})}else throw new Error(`Unsupported LLM provider: ${t.provider}`);m.current={instance:R,provider:t.provider,model:t.model,apiKey:t.apiKey}}if(!f.current||f.current.llm!==m.current.instance){const{MCPAgent:R}=await hr(async()=>{const{MCPAgent:C}=await import("./browser-BX0wEGkA.js");return{MCPAgent:C}},__vite__mapDeps([12,8,6,7,3,2,4,9]));f.current=new R({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 f.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",f.current.conversationHistory?.length);for await(const R of f.current.streamEvents(y,10,!1,void 0)){if(u.current?.signal.aborted)break;if(R.event==="on_chat_model_stream"&&R.data?.chunk?.text){const C=R.data.chunk.text;if(typeof C=="string"&&C.length>0){S+=C;const I=T[T.length-1];I&&I.type==="text"?I.text=S:T.push({type:"text",text:S}),s(A=>A.map(O=>O.id===_?{...O,parts:[...T]}:O))}}else if(R.event==="on_tool_start"){S&&(S="");let C={};R.data?.input?C=R.data.input:R.data?.tool_input?C=R.data.tool_input:R.data&&(C=R.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:R.name,eventData:R.data,extractedArgs:C}),w++,T.push({type:"tool-invocation",toolInvocation:{toolName:R.name||"unknown",args:C,state:"pending"}}),s(I=>I.map(A=>A.id===_?{...A,parts:[...T]}:A))}else if(R.event==="on_tool_end"){const C=T.find(I=>I.type==="tool-invocation"&&I.toolInvocation?.toolName===R.name&&!I.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:R.name,hasToolPart:!!C,output:R.data?.output}),C&&C.toolInvocation){let I=R.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}C.toolInvocation.result=I,C.toolInvocation.state="result";const A=I?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:R.name,hasMeta:!!I?._meta,hasStructuredContent:!!I?.structuredContent,appsSdkUri:A}),A&&typeof A=="string"&&r){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",A);try{const O=await r(A);console.log("[useChatMessagesClientSide] Resource fetched:",O);const j=I?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const U=O.contents.map(W=>({type:"resource",resource:W}));console.log("[useChatMessagesClientSide] Created MCP resources:",U);const B={...I,content:[...I.content||[],...U],structuredContent:j};C.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)}}s(O=>O.map(j=>j.id===_?{...j,parts:[...T]}:j))}}}s(R=>R.map(C=>C.id===_?{...C,parts:[...T],content:""}:C)),t&&Tr.getInstance().capture(new Xj({serverId:e.url,provider:t.provider,model:t.model,messageCount:a.length+1,toolCallsCount:w,success:!0,executionMode:"client-side",duration:Date.now()-E})).catch(()=>{})}catch(_){console.error("Client-side agent error:",_);let S="Unknown error occurred";if(_ instanceof Error){S=_.message;const R=_;R.status&&(S=`HTTP ${R.status}: ${S}`),(R.code===401||S.includes("401")||S.includes("Unauthorized"))&&(S="Authentication failed (401). Check your Authorization header in the connection settings.")}t&&Tr.getInstance().capture(new Xj({serverId:e.url,provider:t.provider,model:t.model,messageCount:a.length+1,toolCallsCount:w,success:!1,executionMode:"client-side",duration:Date.now()-E,error:S})).catch(()=>{});const T={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${S}`,timestamp:Date.now()};s(R=>[...R,T])}finally{c(!1),u.current=null}},[e,t,n,a,r]),b=v.useCallback(()=>{s([]),f.current&&f.current.clearConversationHistory()},[]);return{messages:a,isLoading:i,sendMessage:h,clearMessages:b}}const E$={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function c6({mcpServerUrl:e}){const[t,n]=v.useState(null),[r,a]=v.useState(null),[s,i]=v.useState(!1),[c,u]=v.useState("openai"),[f,m]=v.useState(""),[h,b]=v.useState(E$.openai),y=v.useCallback(()=>{const j=localStorage.getItem("mcp-inspector-api-keys");if(j)try{return JSON.parse(j)}catch(U){return console.error("Failed to load API keys:",U),{}}return{}},[]),x=v.useCallback(j=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(j))},[]),[E,w]=v.useState("none"),[_,S]=v.useState(""),[T,R]=v.useState(""),[C,I]=v.useState("");v.useEffect(()=>{const j=localStorage.getItem("mcp-inspector-llm-config"),U=y();if(j)try{const B=JSON.parse(j);n(B),u(B.provider),m(U[B.provider]||B.apiKey||""),b(B.model)}catch(B){console.error("Failed to load LLM config:",B)}},[y]),v.useEffect(()=>{const j=localStorage.getItem("mcp-inspector-auth-config");if(j)try{const U=JSON.parse(j);a(U),w(U.type),U.username&&S(U.username),U.password&&R(U.password),U.token&&I(U.token)}catch(U){console.error("Failed to load auth config:",U)}else try{const U="mcp:auth",B=l6(e),W=`${U}_${B}_tokens`;localStorage.getItem(W)&&(a({type:"oauth"}),w("oauth"))}catch(U){console.error("Failed to check for OAuth tokens:",U)}},[e]),v.useEffect(()=>{b(E$[c]);const j=y();m(j[c]||"")},[c,y]);const A=v.useCallback(()=>{if(!f.trim())return;const j=y();j[c]=f,x(j);const U={provider:c,apiKey:f,model:h},B={type:E,...E==="basic"&&{username:_.trim(),password:T.trim()},...E==="bearer"&&{token:C.trim()}};n(U),a(B),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(U)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(B)),i(!1)},[c,f,h,E,_,T,C,y,x]),O=v.useCallback(()=>{n(null),a(null);const j=y();delete j[c],x(j),m(""),S(""),R(""),I(""),w("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,y,x]);return{llmConfig:t,authConfig:r,configDialogOpen:s,setConfigDialogOpen:i,tempProvider:c,setTempProvider:u,tempApiKey:f,setTempApiKey:m,tempModel:h,setTempModel:b,tempAuthType:E,saveLLMConfig:A,clearConfig:O}}function xye({connection:e,isConnected:t,useClientSide:n=!0,readResource:r}){const[a,s]=v.useState(""),i=v.useRef(null),{llmConfig:c,authConfig:u,configDialogOpen:f,setConfigDialogOpen:m,tempProvider:h,setTempProvider:b,tempApiKey:y,setTempApiKey:x,tempModel:E,setTempModel:w,saveLLMConfig:_,clearConfig:S}=c6({mcpServerUrl:e.url}),T={connection:e,llmConfig:c,isConnected:t,readResource:r},R=wye({mcpServerUrl:e.url,llmConfig:c,authConfig:u,isConnected:t}),C=Eye(T),{messages:I,isLoading:A,sendMessage:O,clearMessages:j}=n?C:R;iH({onNewChat:j}),v.useEffect(()=>{c&&I.length===0&&i.current&&i.current.focus()},[c,I.length]),v.useEffect(()=>{!A&&I.length>0&&i.current&&i.current.focus()},[A,I.length]);const U=v.useCallback(()=>{a.trim()&&(O(a),s(""))},[a,O]),B=v.useCallback(J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),U())},[U]),W=v.useCallback(()=>{S(),j()},[S,j]);return c&&I.length===0?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("div",{className:"absolute top-4 right-4 z-10",children:d.jsx(nS,{open:f,onOpenChange:m,tempProvider:h,tempModel:E,tempApiKey:y,onProviderChange:b,onModelChange:w,onApiKeyChange:x,onSave:_,onClear:W,showClearButton:!0,buttonLabel:"Change API Key"})}),d.jsx(Mme,{mcpServerUrl:e.url,inputValue:a,isConnected:t,isLoading:A,textareaRef:i,llmConfig:c,onInputChange:s,onKeyDown:B,onSubmit:J=>{J.preventDefault(),U()},onConfigDialogOpenChange:m})]}):d.jsxs("div",{className:"flex flex-col h-full relative",children:[d.jsx(Ome,{llmConfig:c,hasMessages:I.length>0,configDialogOpen:f,onConfigDialogOpenChange:m,onClearChat:j,tempProvider:h,tempModel:E,tempApiKey:y,onProviderChange:b,onModelChange:w,onApiKeyChange:x,onSaveConfig:_,onClearConfig:W}),d.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?d.jsx(vye,{messages:I,isLoading:A,serverId:e.url,readResource:r}):d.jsx(jme,{onConfigureClick:()=>m(!0)})}),c&&d.jsx(Dme,{inputValue:a,isConnected:t,isLoading:A,textareaRef:i,onInputChange:s,onKeyDown:B,onSendMessage:U})]})}const ev=v.createContext(null);ev.displayName="PanelGroupContext";const qn={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"},g1=10,_l=v.useLayoutEffect,x$=Hu.useId,Sye=typeof x$=="function"?x$:()=>null;let _ye=0;function b1(e=null){const t=Sye(),n=v.useRef(e||t||null);return n.current===null&&(n.current=""+_ye++),e??n.current}function u6({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:a,forwardedRef:s,id:i,maxSize:c,minSize:u,onCollapse:f,onExpand:m,onResize:h,order:b,style:y,tagName:x="div",...E}){const w=v.useContext(ev);if(w===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:_,expandPanel:S,getPanelSize:T,getPanelStyle:R,groupId:C,isPanelCollapsed:I,reevaluatePanelConstraints:A,registerPanel:O,resizePanel:j,unregisterPanel:U}=w,B=b1(i),W=v.useRef({callbacks:{onCollapse:f,onExpand:m,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:a,maxSize:c,minSize:u},id:B,idIsFromProps:i!==void 0,order:b});v.useRef({didLogMissingDefaultSizeWarning:!1}),_l(()=>{const{callbacks:ee,constraints:re}=W.current,F={...re};W.current.id=B,W.current.idIsFromProps=i!==void 0,W.current.order=b,ee.onCollapse=f,ee.onExpand=m,ee.onResize=h,re.collapsedSize=n,re.collapsible=r,re.defaultSize=a,re.maxSize=c,re.minSize=u,(F.collapsedSize!==re.collapsedSize||F.collapsible!==re.collapsible||F.maxSize!==re.maxSize||F.minSize!==re.minSize)&&A(W.current,F)}),_l(()=>{const ee=W.current;return O(ee),()=>{U(ee)}},[b,B,O,U]),v.useImperativeHandle(s,()=>({collapse:()=>{_(W.current)},expand:ee=>{S(W.current,ee)},getId(){return B},getSize(){return T(W.current)},isCollapsed(){return I(W.current)},isExpanded(){return!I(W.current)},resize:ee=>{j(W.current,ee)}}),[_,S,T,I,B,j]);const J=R(W.current,a);return v.createElement(x,{...E,children:e,className:t,id:B,style:{...J,...y},[qn.groupId]:C,[qn.panel]:"",[qn.panelCollapsible]:r||void 0,[qn.panelId]:B,[qn.panelSize]:parseFloat(""+J.flexGrow).toFixed(1)})}const d6=v.forwardRef((e,t)=>v.createElement(u6,{...e,forwardedRef:t}));u6.displayName="Panel";d6.displayName="forwardRef(Panel)";let IS=null,Gg=-1,wi=null;function Tye(e,t,n){const r=(t&g6)!==0,a=(t&b6)!==0,s=(t&y6)!==0,i=(t&v6)!==0;if(t){if(r)return s?"se-resize":i?"ne-resize":"e-resize";if(a)return s?"sw-resize":i?"nw-resize":"w-resize";if(s)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Nye(){wi!==null&&(document.head.removeChild(wi),IS=null,wi=null,Gg=-1)}function AE(e,t,n){var r,a;const s=Tye(e,t);if(IS!==s){if(IS=s,wi===null&&(wi=document.createElement("style"),document.head.appendChild(wi)),Gg>=0){var i;(i=wi.sheet)===null||i===void 0||i.removeRule(Gg)}Gg=(r=(a=wi.sheet)===null||a===void 0?void 0:a.insertRule(`*{cursor: ${s} !important;}`))!==null&&r!==void 0?r:-1}}function f6(e){return e.type==="keydown"}function p6(e){return e.type.startsWith("pointer")}function m6(e){return e.type.startsWith("mouse")}function tv(e){if(p6(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(m6(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function kye(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Cye(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 Rye(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:T$(e),b:T$(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;kt(r,"Stacking order can only be calculated for elements with a common ancestor");const a={a:_$(S$(n.a)),b:_$(S$(n.b))};if(a.a===a.b){const s=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let c=s.length;for(;c--;){const u=s[c];if(u===i.a)return 1;if(u===i.b)return-1}}return Math.sign(a.a-a.b)}const Aye=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Iye(e){var t;const n=getComputedStyle((t=h6(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Oye(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Iye(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"||Aye.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function S$(e){let t=e.length;for(;t--;){const n=e[t];if(kt(n,"Missing node"),Oye(n))return n}return null}function _$(e){return e&&Number(getComputedStyle(e).zIndex)||0}function T$(e){const t=[];for(;e;)t.push(e),e=h6(e);return t}function h6(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const g6=1,b6=2,y6=4,v6=8,Dye=kye()==="coarse";let yo=[],pu=!1,Ei=new Map,nv=new Map;const hp=new Set;function Lye(e,t,n,r,a){var s;const{ownerDocument:i}=t,c={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:a},u=(s=Ei.get(i))!==null&&s!==void 0?s:0;return Ei.set(i,u+1),hp.add(c),Bb(),function(){var m;nv.delete(e),hp.delete(c);const h=(m=Ei.get(i))!==null&&m!==void 0?m:1;if(Ei.set(i,h-1),Bb(),h===1&&Ei.delete(i),yo.includes(c)){const b=yo.indexOf(c);b>=0&&yo.splice(b,1),rv(),a("up",!0,null)}}}function Mye(e){const{target:t}=e,{x:n,y:r}=tv(e);pu=!0,y1({target:t,x:n,y:r}),Bb(),yo.length>0&&(Hb("down",e),rv(),e.preventDefault(),w6(t)||e.stopImmediatePropagation())}function IE(e){const{x:t,y:n}=tv(e);if(pu&&e.type!=="pointerleave"&&e.buttons===0&&(pu=!1,Hb("up",e)),!pu){const{target:r}=e;y1({target:r,x:t,y:n})}Hb("move",e),rv(),yo.length>0&&e.preventDefault()}function OE(e){const{target:t}=e,{x:n,y:r}=tv(e);nv.clear(),pu=!1,yo.length>0&&(e.preventDefault(),w6(t)||e.stopImmediatePropagation()),Hb("up",e),y1({target:t,x:n,y:r}),rv(),Bb()}function w6(e){let t=e;for(;t;){if(t.hasAttribute(qn.resizeHandle))return!0;t=t.parentElement}return!1}function y1({target:e,x:t,y:n}){yo.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),hp.forEach(a=>{const{element:s,hitAreaMargins:i}=a,c=s.getBoundingClientRect(),{bottom:u,left:f,right:m,top:h}=c,b=Dye?i.coarse:i.fine;if(t>=f-b&&t<=m+b&&n>=h-b&&n<=u+b){if(r!==null&&document.contains(r)&&s!==r&&!s.contains(r)&&!r.contains(s)&&Rye(r,s)>0){let x=r,E=!1;for(;x&&!x.contains(s);){if(Cye(x.getBoundingClientRect(),c)){E=!0;break}x=x.parentElement}if(E)return}yo.push(a)}})}function DE(e,t){nv.set(e,t)}function rv(){let e=!1,t=!1;yo.forEach(r=>{const{direction:a}=r;a==="horizontal"?e=!0:t=!0});let n=0;nv.forEach(r=>{n|=r}),e&&t?AE("intersection",n):e?AE("horizontal",n):t?AE("vertical",n):Nye()}let LE;function Bb(){var e;(e=LE)===null||e===void 0||e.abort(),LE=new AbortController;const t={capture:!0,signal:LE.signal};hp.size&&(pu?(yo.length>0&&Ei.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("contextmenu",OE,t),a.addEventListener("pointerleave",IE,t),a.addEventListener("pointermove",IE,t))}),Ei.forEach((n,r)=>{const{body:a}=r;a.addEventListener("pointerup",OE,t),a.addEventListener("pointercancel",OE,t)})):Ei.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("pointerdown",Mye,t),a.addEventListener("pointermove",IE,t))}))}function Hb(e,t){hp.forEach(n=>{const{setResizeHandlerState:r}=n,a=yo.includes(n);r(e,a,t)})}function jye(){const[e,t]=v.useState(0);return v.useCallback(()=>t(n=>n+1),[])}function kt(e,t){if(!e)throw console.error(t),Error(t)}function Ml(e,t,n=g1){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function ws(e,t,n=g1){return Ml(e,t,n)===0}function Pa(e,t,n){return Ml(e,t,n)===0}function Pye(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const a=e[r],s=t[r];if(!Pa(a,s,n))return!1}return!0}function au({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];kt(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:s,maxSize:i=100,minSize:c=0}=r;if(Ml(n,c)<0)if(s){const u=(a+c)/2;Ml(n,u)<0?n=a:n=c}else n=c;return n=Math.min(i,n),n=parseFloat(n.toFixed(g1)),n}function xf({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:s}){if(Pa(e,0))return t;const i=[...t],[c,u]=r;kt(c!=null,"Invalid first pivot index"),kt(u!=null,"Invalid second pivot index");let f=0;if(s==="keyboard"){{const h=e<0?u:c,b=n[h];kt(b,`Panel constraints not found for index ${h}`);const{collapsedSize:y=0,collapsible:x,minSize:E=0}=b;if(x){const w=t[h];if(kt(w!=null,`Previous layout not found for panel index ${h}`),Pa(w,y)){const _=E-w;Ml(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const h=e<0?c:u,b=n[h];kt(b,`No panel constraints found for index ${h}`);const{collapsedSize:y=0,collapsible:x,minSize:E=0}=b;if(x){const w=t[h];if(kt(w!=null,`Previous layout not found for panel index ${h}`),Pa(w,E)){const _=w-y;Ml(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}}{const h=e<0?1:-1;let b=e<0?u:c,y=0;for(;;){const E=t[b];kt(E!=null,`Previous layout not found for panel index ${b}`);const _=au({panelConstraints:n,panelIndex:b,size:100})-E;if(y+=_,b+=h,b<0||b>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-x:x}{let b=e<0?c:u;for(;b>=0&&b<n.length;){const y=Math.abs(e)-Math.abs(f),x=t[b];kt(x!=null,`Previous layout not found for panel index ${b}`);const E=x-y,w=au({panelConstraints:n,panelIndex:b,size:E});if(!Pa(x,w)&&(f+=x-w,i[b]=w,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?b--:b++}}if(Pye(a,i))return a;{const h=e<0?u:c,b=t[h];kt(b!=null,`Previous layout not found for panel index ${h}`);const y=b+f,x=au({panelConstraints:n,panelIndex:h,size:y});if(i[h]=x,!Pa(x,y)){let E=y-x,_=e<0?u:c;for(;_>=0&&_<n.length;){const S=i[_];kt(S!=null,`Previous layout not found for panel index ${_}`);const T=S+E,R=au({panelConstraints:n,panelIndex:_,size:T});if(Pa(S,R)||(E-=R-S,i[_]=R),Pa(E,0))break;e>0?_--:_++}}}const m=i.reduce((h,b)=>b+h,0);return Pa(m,100)?i:a}function Uye({layout:e,panelsArray:t,pivotIndices:n}){let r=0,a=100,s=0,i=0;const c=n[0];kt(c!=null,"No pivot index found"),t.forEach((h,b)=>{const{constraints:y}=h,{maxSize:x=100,minSize:E=0}=y;b===c?(r=E,a=x):(s+=E,i+=x)});const u=Math.min(a,100-s),f=Math.max(r,100-i),m=e[c];return{valueMax:u,valueMin:f,valueNow:m}}function gp(e,t=document){return Array.from(t.querySelectorAll(`[${qn.resizeHandleId}][data-panel-group-id="${e}"]`))}function E6(e,t,n=document){const a=gp(e,n).findIndex(s=>s.getAttribute(qn.resizeHandleId)===t);return a??null}function x6(e,t,n){const r=E6(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function $ye(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function S6(e,t=document){if($ye(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function av(e,t=document){const n=t.querySelector(`[${qn.resizeHandleId}="${e}"]`);return n||null}function zye(e,t,n,r=document){var a,s,i,c;const u=av(t,r),f=gp(e,r),m=u?f.indexOf(u):-1,h=(a=(s=n[m])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null,b=(i=(c=n[m+1])===null||c===void 0?void 0:c.id)!==null&&i!==void 0?i:null;return[h,b]}function Fye({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:a,panelGroupElement:s,setLayout:i}){v.useRef({didWarnAboutMissingResizeHandle:!1}),_l(()=>{if(!s)return;const c=gp(n,s);for(let u=0;u<a.length-1;u++){const{valueMax:f,valueMin:m,valueNow:h}=Uye({layout:r,panelsArray:a,pivotIndices:[u,u+1]}),b=c[u];if(b!=null){const y=a[u];kt(y,`No panel data found for index "${u}"`),b.setAttribute("aria-controls",y.id),b.setAttribute("aria-valuemax",""+Math.round(f)),b.setAttribute("aria-valuemin",""+Math.round(m)),b.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((u,f)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[n,r,a,s]),v.useEffect(()=>{if(!s)return;const c=t.current;kt(c,"Eager values not found");const{panelDataArray:u}=c,f=S6(n,s);kt(f!=null,`No group found for id "${n}"`);const m=gp(n,s);kt(m,`No resize handles found for group id "${n}"`);const h=m.map(b=>{const y=b.getAttribute(qn.resizeHandleId);kt(y,"Resize handle element has no handle id attribute");const[x,E]=zye(n,y,u,s);if(x==null||E==null)return()=>{};const w=_=>{if(!_.defaultPrevented)switch(_.key){case"Enter":{_.preventDefault();const S=u.findIndex(T=>T.id===x);if(S>=0){const T=u[S];kt(T,`No panel data found for index ${S}`);const R=r[S],{collapsedSize:C=0,collapsible:I,minSize:A=0}=T.constraints;if(R!=null&&I){const O=xf({delta:Pa(R,C)?A-C:C-R,initialLayout:r,panelConstraints:u.map(j=>j.constraints),pivotIndices:x6(n,y,s),prevLayout:r,trigger:"keyboard"});r!==O&&i(O)}}break}}};return b.addEventListener("keydown",w),()=>{b.removeEventListener("keydown",w)}});return()=>{h.forEach(b=>b())}},[s,e,t,n,r,a,i])}function N$(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 _6(e,t){const n=e==="horizontal",{x:r,y:a}=tv(t);return n?r:a}function Bye(e,t,n,r,a){const s=n==="horizontal",i=av(t,a);kt(i,`No resize handle element found for id "${t}"`);const c=i.getAttribute(qn.groupId);kt(c,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=r;const f=_6(n,e),m=S6(c,a);kt(m,`No group element found for id "${c}"`);const h=m.getBoundingClientRect(),b=s?h.width:h.height;return(f-u)/b*100}function Hye(e,t,n,r,a,s){if(f6(e)){const i=n==="horizontal";let c=0;e.shiftKey?c=100:a!=null?c=a:c=10;let u=0;switch(e.key){case"ArrowDown":u=i?0:c;break;case"ArrowLeft":u=i?-c:0;break;case"ArrowRight":u=i?c:0;break;case"ArrowUp":u=i?0:-c;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return r==null?0:Bye(e,t,n,r,s)}function Vye({panelDataArray:e}){const t=Array(e.length),n=e.map(s=>s.constraints);let r=0,a=100;for(let s=0;s<e.length;s++){const i=n[s];kt(i,`Panel constraints not found for index ${s}`);const{defaultSize:c}=i;c!=null&&(r++,t[s]=c,a-=c)}for(let s=0;s<e.length;s++){const i=n[s];kt(i,`Panel constraints not found for index ${s}`);const{defaultSize:c}=i;if(c!=null)continue;const u=e.length-r,f=a/u;r++,t[s]=f,a-=f}return t}function Lc(e,t,n){t.forEach((r,a)=>{const s=e[a];kt(s,`Panel data not found for index ${a}`);const{callbacks:i,constraints:c,id:u}=s,{collapsedSize:f=0,collapsible:m}=c,h=n[u];if(h==null||r!==h){n[u]=r;const{onCollapse:b,onExpand:y,onResize:x}=i;x&&x(r,h),m&&(b||y)&&(y&&(h==null||ws(h,f))&&!ws(r,f)&&y(),b&&(h==null||!ws(h,f))&&ws(r,f)&&b())}})}function Eg(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 Gye({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:a,precision:s=3}){const i=n[a];let c;return i==null?c=e!=null?e.toFixed(s):"1":r.length===1?c="1":c=i.toFixed(s),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Wye(e,t=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...a)},t)}}function k$(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 T6(e){return`react-resizable-panels:${e}`}function N6(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:a,order:s}=t;return a?r:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function k6(e,t){try{const n=T6(e),r=t.getItem(n);if(r){const a=JSON.parse(r);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function Kye(e,t,n){var r,a;const s=(r=k6(e,n))!==null&&r!==void 0?r:{},i=N6(t);return(a=s[i])!==null&&a!==void 0?a:null}function Yye(e,t,n,r,a){var s;const i=T6(e),c=N6(t),u=(s=k6(e,a))!==null&&s!==void 0?s:{};u[c]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{a.setItem(i,JSON.stringify(u))}catch(f){console.error(f)}}function C$({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((s,i)=>s+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!Pa(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const i=n[s];kt(i!=null,`No layout data found for index ${s}`);const c=100/r*i;n[s]=c}let a=0;for(let s=0;s<t.length;s++){const i=n[s];kt(i!=null,`No layout data found for index ${s}`);const c=au({panelConstraints:t,panelIndex:s,size:i});i!=c&&(a+=i-c,n[s]=c)}if(!Pa(a,0))for(let s=0;s<t.length;s++){const i=n[s];kt(i!=null,`No layout data found for index ${s}`);const c=i+a,u=au({panelConstraints:t,panelIndex:s,size:c});if(i!==u&&(a-=u-i,n[s]=u,Pa(a,0)))break}return n}const Zye=100,Sf={getItem:e=>(k$(Sf),Sf.getItem(e)),setItem:(e,t)=>{k$(Sf),Sf.setItem(e,t)}},R$={};function C6({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:a,id:s=null,onLayout:i=null,keyboardResizeBy:c=null,storage:u=Sf,style:f,tagName:m="div",...h}){const b=b1(s),y=v.useRef(null),[x,E]=v.useState(null),[w,_]=v.useState([]),S=jye(),T=v.useRef({}),R=v.useRef(new Map),C=v.useRef(0),I=v.useRef({autoSaveId:e,direction:r,dragState:x,id:b,keyboardResizeBy:c,onLayout:i,storage:u}),A=v.useRef({layout:w,panelDataArray:[],panelDataArrayChanged:!1});v.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),v.useImperativeHandle(a,()=>({getId:()=>I.current.id,getLayout:()=>{const{layout:$}=A.current;return $},setLayout:$=>{const{onLayout:L}=I.current,{layout:M,panelDataArray:z}=A.current,G=C$({layout:$,panelConstraints:z.map(q=>q.constraints)});N$(M,G)||(_(G),A.current.layout=G,L&&L(G),Lc(z,G,T.current))}}),[]),_l(()=>{I.current.autoSaveId=e,I.current.direction=r,I.current.dragState=x,I.current.id=b,I.current.onLayout=i,I.current.storage=u}),Fye({committedValuesRef:I,eagerValuesRef:A,groupId:b,layout:w,panelDataArray:A.current.panelDataArray,setLayout:_,panelGroupElement:y.current}),v.useEffect(()=>{const{panelDataArray:$}=A.current;if(e){if(w.length===0||w.length!==$.length)return;let L=R$[e];L==null&&(L=Wye(Yye,Zye),R$[e]=L);const M=[...$],z=new Map(R.current);L(e,M,z,w,u)}},[e,w,u]),v.useEffect(()=>{});const O=v.useCallback($=>{const{onLayout:L}=I.current,{layout:M,panelDataArray:z}=A.current;if($.constraints.collapsible){const G=z.map(X=>X.constraints),{collapsedSize:q=0,panelSize:ae,pivotIndices:ie}=fl(z,$,M);if(kt(ae!=null,`Panel size not found for panel "${$.id}"`),!ws(ae,q)){R.current.set($.id,ae);const Z=Vc(z,$)===z.length-1?ae-q:q-ae,se=xf({delta:Z,initialLayout:M,panelConstraints:G,pivotIndices:ie,prevLayout:M,trigger:"imperative-api"});Eg(M,se)||(_(se),A.current.layout=se,L&&L(se),Lc(z,se,T.current))}}},[]),j=v.useCallback(($,L)=>{const{onLayout:M}=I.current,{layout:z,panelDataArray:G}=A.current;if($.constraints.collapsible){const q=G.map(me=>me.constraints),{collapsedSize:ae=0,panelSize:ie=0,minSize:X=0,pivotIndices:Z}=fl(G,$,z),se=L??X;if(ws(ie,ae)){const me=R.current.get($.id),le=me!=null&&me>=se?me:se,Be=Vc(G,$)===G.length-1?ie-le:le-ie,Ee=xf({delta:Be,initialLayout:z,panelConstraints:q,pivotIndices:Z,prevLayout:z,trigger:"imperative-api"});Eg(z,Ee)||(_(Ee),A.current.layout=Ee,M&&M(Ee),Lc(G,Ee,T.current))}}},[]),U=v.useCallback($=>{const{layout:L,panelDataArray:M}=A.current,{panelSize:z}=fl(M,$,L);return kt(z!=null,`Panel size not found for panel "${$.id}"`),z},[]),B=v.useCallback(($,L)=>{const{panelDataArray:M}=A.current,z=Vc(M,$);return Gye({defaultSize:L,dragState:x,layout:w,panelData:M,panelIndex:z})},[x,w]),W=v.useCallback($=>{const{layout:L,panelDataArray:M}=A.current,{collapsedSize:z=0,collapsible:G,panelSize:q}=fl(M,$,L);return kt(q!=null,`Panel size not found for panel "${$.id}"`),G===!0&&ws(q,z)},[]),J=v.useCallback($=>{const{layout:L,panelDataArray:M}=A.current,{collapsedSize:z=0,collapsible:G,panelSize:q}=fl(M,$,L);return kt(q!=null,`Panel size not found for panel "${$.id}"`),!G||Ml(q,z)>0},[]),ee=v.useCallback($=>{const{panelDataArray:L}=A.current;L.push($),L.sort((M,z)=>{const G=M.order,q=z.order;return G==null&&q==null?0:G==null?-1:q==null?1:G-q}),A.current.panelDataArrayChanged=!0,S()},[S]);_l(()=>{if(A.current.panelDataArrayChanged){A.current.panelDataArrayChanged=!1;const{autoSaveId:$,onLayout:L,storage:M}=I.current,{layout:z,panelDataArray:G}=A.current;let q=null;if($){const ie=Kye($,G,M);ie&&(R.current=new Map(Object.entries(ie.expandToSizes)),q=ie.layout)}q==null&&(q=Vye({panelDataArray:G}));const ae=C$({layout:q,panelConstraints:G.map(ie=>ie.constraints)});N$(z,ae)||(_(ae),A.current.layout=ae,L&&L(ae),Lc(G,ae,T.current))}}),_l(()=>{const $=A.current;return()=>{$.layout=[]}},[]);const re=v.useCallback($=>{let L=!1;const M=y.current;return M&&window.getComputedStyle(M,null).getPropertyValue("direction")==="rtl"&&(L=!0),function(G){G.preventDefault();const q=y.current;if(!q)return()=>null;const{direction:ae,dragState:ie,id:X,keyboardResizeBy:Z,onLayout:se}=I.current,{layout:me,panelDataArray:le}=A.current,{initialLayout:Te}=ie??{},Be=x6(X,$,q);let Ee=Hye(G,$,ae,ie,Z,q);const _e=ae==="horizontal";_e&&L&&(Ee=-Ee);const Ue=le.map(ze=>ze.constraints),fe=xf({delta:Ee,initialLayout:Te??me,panelConstraints:Ue,pivotIndices:Be,prevLayout:me,trigger:f6(G)?"keyboard":"mouse-or-touch"}),Ae=!Eg(me,fe);(p6(G)||m6(G))&&C.current!=Ee&&(C.current=Ee,!Ae&&Ee!==0?_e?DE($,Ee<0?g6:b6):DE($,Ee<0?y6:v6):DE($,0)),Ae&&(_(fe),A.current.layout=fe,se&&se(fe),Lc(le,fe,T.current))}},[]),F=v.useCallback(($,L)=>{const{onLayout:M}=I.current,{layout:z,panelDataArray:G}=A.current,q=G.map(me=>me.constraints),{panelSize:ae,pivotIndices:ie}=fl(G,$,z);kt(ae!=null,`Panel size not found for panel "${$.id}"`);const Z=Vc(G,$)===G.length-1?ae-L:L-ae,se=xf({delta:Z,initialLayout:z,panelConstraints:q,pivotIndices:ie,prevLayout:z,trigger:"imperative-api"});Eg(z,se)||(_(se),A.current.layout=se,M&&M(se),Lc(G,se,T.current))},[]),K=v.useCallback(($,L)=>{const{layout:M,panelDataArray:z}=A.current,{collapsedSize:G=0,collapsible:q}=L,{collapsedSize:ae=0,collapsible:ie,maxSize:X=100,minSize:Z=0}=$.constraints,{panelSize:se}=fl(z,$,M);se!=null&&(q&&ie&&ws(se,G)?ws(G,ae)||F($,ae):se<Z?F($,Z):se>X&&F($,X))},[F]),V=v.useCallback(($,L)=>{const{direction:M}=I.current,{layout:z}=A.current;if(!y.current)return;const G=av($,y.current);kt(G,`Drag handle element not found for id "${$}"`);const q=_6(M,L);E({dragHandleId:$,dragHandleRect:G.getBoundingClientRect(),initialCursorPosition:q,initialLayout:z})},[]),ne=v.useCallback(()=>{E(null)},[]),te=v.useCallback($=>{const{panelDataArray:L}=A.current,M=Vc(L,$);M>=0&&(L.splice(M,1),delete T.current[$.id],A.current.panelDataArrayChanged=!0,S())},[S]),D=v.useMemo(()=>({collapsePanel:O,direction:r,dragState:x,expandPanel:j,getPanelSize:U,getPanelStyle:B,groupId:b,isPanelCollapsed:W,isPanelExpanded:J,reevaluatePanelConstraints:K,registerPanel:ee,registerResizeHandle:re,resizePanel:F,startDragging:V,stopDragging:ne,unregisterPanel:te,panelGroupElement:y.current}),[O,x,r,j,U,B,b,W,J,K,ee,re,F,V,ne,te]),H={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return v.createElement(ev.Provider,{value:D},v.createElement(m,{...h,children:t,className:n,id:s,ref:y,style:{...H,...f},[qn.group]:"",[qn.groupDirection]:r,[qn.groupId]:b}))}const R6=v.forwardRef((e,t)=>v.createElement(C6,{...e,forwardedRef:t}));C6.displayName="PanelGroup";R6.displayName="forwardRef(PanelGroup)";function Vc(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function fl(e,t,n){const r=Vc(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:s}}function qye({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){v.useEffect(()=>{if(e||n==null||r==null)return;const a=av(t,r);if(a==null)return;const s=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const c=a.getAttribute(qn.groupId);kt(c,`No group element found for id "${c}"`);const u=gp(c,r),f=E6(c,t,r);kt(f!==null,`No resize element found for id "${t}"`);const m=i.shiftKey?f>0?f-1:u.length-1:f+1<u.length?f+1:0;u[m].focus();break}}};return a.addEventListener("keydown",s),()=>{a.removeEventListener("keydown",s)}},[r,e,t,n])}function A6({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:a,onBlur:s,onClick:i,onDragging:c,onFocus:u,onPointerDown:f,onPointerUp:m,style:h={},tabIndex:b=0,tagName:y="div",...x}){var E,w;const _=v.useRef(null),S=v.useRef({onClick:i,onDragging:c,onPointerDown:f,onPointerUp:m});v.useEffect(()=>{S.current.onClick=i,S.current.onDragging=c,S.current.onPointerDown=f,S.current.onPointerUp=m});const T=v.useContext(ev);if(T===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:R,groupId:C,registerResizeHandle:I,startDragging:A,stopDragging:O,panelGroupElement:j}=T,U=b1(a),[B,W]=v.useState("inactive"),[J,ee]=v.useState(!1),[re,F]=v.useState(null),K=v.useRef({state:B});_l(()=>{K.current.state=B}),v.useEffect(()=>{if(n)F(null);else{const D=I(U);F(()=>D)}},[n,U,I]);const V=(E=r?.coarse)!==null&&E!==void 0?E:15,ne=(w=r?.fine)!==null&&w!==void 0?w:5;v.useEffect(()=>{if(n||re==null)return;const D=_.current;kt(D,"Element ref not attached");let H=!1;return Lye(U,D,R,{coarse:V,fine:ne},(L,M,z)=>{if(!M){W("inactive");return}switch(L){case"down":{W("drag"),H=!1,kt(z,'Expected event to be defined for "down" action'),A(U,z);const{onDragging:G,onPointerDown:q}=S.current;G?.(!0),q?.();break}case"move":{const{state:G}=K.current;H=!0,G!=="drag"&&W("hover"),kt(z,'Expected event to be defined for "move" action'),re(z);break}case"up":{W("hover"),O();const{onClick:G,onDragging:q,onPointerUp:ae}=S.current;q?.(!1),ae?.(),H||G?.();break}}})},[V,R,n,ne,I,U,re,A,O]),qye({disabled:n,handleId:U,resizeHandler:re,panelGroupElement:j});const te={touchAction:"none",userSelect:"none"};return v.createElement(y,{...x,children:e,className:t,id:a,onBlur:()=>{ee(!1),s?.()},onFocus:()=>{ee(!0),u?.()},ref:_,role:"separator",style:{...te,...h},tabIndex:b,[qn.groupDirection]:R,[qn.groupId]:C,[qn.resizeHandle]:"",[qn.resizeHandleActive]:B==="drag"?"pointer":J?"keyboard":void 0,[qn.resizeHandleEnabled]:!n,[qn.resizeHandleId]:U,[qn.resizeHandleState]:B})}A6.displayName="PanelResizeHandle";function aa({className:e,...t}){return d.jsx(R6,{"data-slot":"resizable-panel-group",className:Oe("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function Rn({...e}){return d.jsx(d6,{"data-slot":"resizable-panel",...e})}function vo({withHandle:e,className:t,...n}){return d.jsx(A6,{"data-slot":"resizable-handle",className:Oe("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&&d.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:d.jsx(Use,{className:"size-2.5"})})})}function Xp({className:e,...t}){return d.jsx("kbd",{"data-slot":"kbd",className:Oe("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 Xye({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:r,onSearchExpand:a,onSearchChange:s,onSearchBlur:i,onClearAll:c,searchInputRef:u}){return d.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[d.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?d.jsx(Tn,{ref:u,placeholder:"Search notifications...",value:t,onChange:f=>s(f.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Notifications"}),d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,disabled:r===0,className:"h-8 w-8 p-0",children:d.jsx(Ii,{className:"h-4 w-4"})})}),d.jsx(Lt,{side:"bottom",children:"Clear all"})]})})]})}function Bi({id:e,isSelected:t,isFocused:n,icon:r,title:a,description:s,metadata:i,onClick:c,className:u}){return d.jsx("button",{id:e,type:"button",onClick:c,className:Oe("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:d.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[r&&d.jsx("div",{className:"flex-shrink-0 mt-1",children:d.jsx("div",{className:Oe("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:r})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"flex items-center gap-2 mb-1",children:d.jsx("h3",{className:Oe("font-medium truncate font-mono text-sm"),children:a})}),s&&d.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:s})]})]})})}function Jye({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:r,formatRelativeTime:a,listRef:s}){return e.length===0?d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No notifications yet"})}):d.jsx("div",{ref:s,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((i,c)=>d.jsx(Bi,{id:`notification-${i.id}`,isSelected:t?.id===i.id,isFocused:r===c,title:d.jsxs("span",{className:"flex items-center gap-3",children:[i.method,!i.read&&d.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const u=a(i.timestamp),f=i.params&&Object.keys(i.params).length>0?Object.keys(i.params).length:0,m=f>0?` | ${f} param${f>1?"s":""}`:"";return u+m})(),onClick:()=>n(i)},i.id))})}function Qye({notification:e,previewMode:t,onTogglePreview:n,onCopy:r,onDownload:a,onFullscreen:s,isCopied:i=!1,onClose:c}){return e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.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:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(Ou,{className:"h-3 w-3 text-gray-400"}),d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.formatRelativeTime(e.timestamp)})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsxs(De,{variant:"ghost",size:"sm",onClick:n,className:t?"":"text-purple-600 dark:text-purple-400",children:[t?d.jsx(G_,{className:"h-4 w-4 mr-1"}):d.jsx(S3,{className:"h-4 w-4 mr-1"}),t?"JSON":"Formatted"]}),d.jsx(De,{variant:"ghost",size:"sm",onClick:r,children:i?d.jsx(oa,{className:"h-4 w-4"}):d.jsx(zr,{className:"h-4 w-4"})}),d.jsx(De,{variant:"ghost",size:"sm",onClick:a,children:d.jsx(Lp,{className:"h-4 w-4"})}),d.jsx(De,{variant:"ghost",size:"sm",onClick:s,children:d.jsx(Y_,{className:"h-4 w-4"})}),c&&d.jsx(De,{variant:"ghost",size:"sm",onClick:c,children:d.jsx(Ko,{className:"h-4 w-4"})})]})]}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{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`})})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(H_,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a notification to view details"})]})}function Vb(e){const n=Date.now()-e,r=Math.floor(n/1e3),a=Math.floor(r/60),s=Math.floor(a/60),i=Math.floor(s/24);return r<60?"just now":a<60?`${a}m ago`:s<24?`${s}h ago`:i<7?`${i}d ago`:new Date(e).toLocaleDateString()}function eve({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:r,clearNotifications:a,serverId:s,isConnected:i}){const[c,u]=v.useState(null),[f,m]=v.useState(""),[h,b]=v.useState(-1),[y,x]=v.useState(!0),[E,w]=v.useState(!1),[_,S]=v.useState(!0),[T,R]=v.useState(!1),C=v.useRef(null),I=v.useRef(null),A=v.useRef(null),O=v.useRef(!1);v.useEffect(()=>{y&&e.length>0&&C.current&&!O.current&&(C.current.scrollTop=0)},[e.length,y]),v.useEffect(()=>{const K=C.current;if(!K)return;const V=()=>{K.scrollTop>0&&(O.current=!0,x(!1))};return K.addEventListener("scroll",V),()=>K.removeEventListener("scroll",V)},[]),v.useEffect(()=>{e.length===0&&(O.current=!1,x(!0))},[e.length]),v.useEffect(()=>{c&&!c.read&&n(c.id)},[c,n]),v.useEffect(()=>{E&&A.current&&A.current.focus()},[E]);const j=v.useCallback(()=>{f.trim()||w(!1)},[f]),U=v.useMemo(()=>{if(!f.trim())return e;const K=f.toLowerCase();return e.filter(V=>V.method.toLowerCase().includes(K)||JSON.stringify(V.params||{}).toLowerCase().includes(K))},[e,f]);v.useEffect(()=>{b(-1)},[f]),v.useEffect(()=>{const K=V=>{const ne=V.target;if(ne.tagName==="INPUT"||ne.tagName==="TEXTAREA"||ne.contentEditable==="true"||V.metaKey||V.ctrlKey||V.altKey)return;const D=U;if(V.key==="ArrowDown")V.preventDefault(),b(H=>{const $=H+1;return $>=D.length?0:$});else if(V.key==="ArrowUp")V.preventDefault(),b(H=>{const $=H-1;return $<0?D.length-1:$});else if(V.key==="Enter"&&h>=0){V.preventDefault();const H=U[h];H&&B(H)}};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[h,U]),v.useEffect(()=>{if(h>=0){const K=`notification-${U[h]?.id}`,V=document.getElementById(K);V&&V.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,U]);const B=v.useCallback(K=>{u(K)},[]),W=v.useCallback(()=>{window.confirm("Are you sure you want to clear all notifications? This cannot be undone.")&&(a(),u(null))},[a]),J=v.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)),R(!0),setTimeout(()=>R(!1),2e3)}catch(K){console.error("[NotificationsTab] Failed to copy notification:",K)}},[c]),ee=v.useCallback(()=>{if(c)try{const K=new globalThis.Blob([JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)],{type:"application/json"}),V=URL.createObjectURL(K),ne=document.createElement("a");ne.href=V,ne.download=`notification-${Date.now()}.json`,document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(V)}catch(K){console.error("[NotificationsTab] Failed to download notification:",K)}},[c]),re=v.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(K){console.error("[NotificationsTab] Failed to toggle fullscreen:",K)}},[]),F=c?{method:c.method,params:c.params,timestamp:c.timestamp,read:c.read,formatRelativeTime:Vb}:null;return i?d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:40,minSize:30,children:d.jsx(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:d.jsxs(Rn,{defaultSize:75,minSize:30,children:[d.jsx(Xye,{isSearchExpanded:E,searchQuery:f,filteredNotificationsCount:U.length,notificationsCount:e.length,onSearchExpand:()=>w(!0),onSearchChange:m,onSearchBlur:j,onClearAll:W,searchInputRef:A}),d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(Jye,{notifications:U,selectedNotification:c,onNotificationSelect:B,focusedIndex:h,formatRelativeTime:Vb,listRef:C})})]})})}),d.jsx(vo,{}),d.jsx(Rn,{defaultSize:60,minSize:40,children:d.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:d.jsx(Qye,{notification:F,previewMode:_,onTogglePreview:()=>S(!_),onCopy:J,onDownload:ee,onFullscreen:re,onClose:()=>u(null),isCopied:T})})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(H_,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function I6({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:r,secondaryTabTitle:a,primaryCount:s,secondaryCount:i,secondaryIcon:c,primaryIcon:u,searchPlaceholder:f="Search...",onSearchExpand:m,onSearchChange:h,onSearchBlur:b,onTabSwitch:y,searchInputRef:x,primaryTabName:E}){const w=e===E;return d.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[d.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?d.jsx(Tn,{ref:x,placeholder:f,value:n,onChange:_=>h(_.target.value),onBlur:b,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:w?r:a}),w&&d.jsxs(d.Fragment,{children:[d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:s}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})]})}),d.jsxs(De,{variant:"ghost",size:"sm",onClick:y,className:"gap-2 flex-shrink-0",children:[w?d.jsx(c,{}):d.jsx(u,{}),d.jsx("span",{className:"hidden sm:inline",children:w?a:r}),w&&i>0&&d.jsx(kr,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:i})]})]})}function A$({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:r}){return e.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(Qf,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):d.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((a,s)=>d.jsx(Bi,{id:`prompt-${a.name}`,isSelected:t?.name===a.name,isFocused:r===s,icon:d.jsx(Qf,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.arguments&&a.arguments.length>0&&d.jsxs(kr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[a.arguments.length," args"]}),onClick:()=>n(a)},a.name))})}function I$({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:r,savedPromptsCount:a,onSearchExpand:s,onSearchChange:i,onSearchBlur:c,onTabSwitch:u,searchInputRef:f}){return d.jsx(I6,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:r,secondaryCount:a,primaryIcon:Qf,secondaryIcon:Ou,searchPlaceholder:"Search prompts...",onSearchExpand:s,onSearchChange:i,onSearchBlur:c,onTabSwitch:u,searchInputRef:f})}function O$({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:r,focusedIndex:a}){return e.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(Ou,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),d.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):d.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((s,i)=>d.jsx(Bi,{id:`saved-prompt-${s.id}`,isSelected:t?.id===s.id,isFocused:a===i,icon:d.jsx(Ou,{className:"h-4 w-4"}),title:s.name,description:`${s.promptName} - ${new Date(s.savedAt).toLocaleString()}`,onClick:()=>n(s)},s.id))})}function tve({selectedPrompt:e,promptArgs:t,onArgChange:n}){const r=e?.arguments||[];if(!(r.length>0))return d.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const s=i=>{const c=i.name,u=t[c],f=typeof u=="string"?u:JSON.stringify(u);return i.type==="boolean"?d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:c,className:"text-sm font-medium",children:[c,i.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{id:c,type:"checkbox",checked:!!u,onChange:m=>n(c,m.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:i.description})]})]},c):i.type==="number"?d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:c,className:"text-sm font-medium",children:[c,i.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsx(Tn,{id:c,type:"number",value:Number(u)||0,onChange:m=>n(c,Number(m.target.value)),placeholder:i.description||`Enter ${c}`}),i.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i.description})]},c):i.type==="array"||i.type==="object"?d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:c,className:"text-sm font-medium",children:[c,i.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsx(Dl,{id:c,value:f,onChange:m=>{try{const h=JSON.parse(m.target.value);n(c,h)}catch{n(c,m.target.value)}},placeholder:i.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),i.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i.description})]},c):d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:c,className:"text-sm font-medium",children:[c,i.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsx(Tn,{id:c,value:f,onChange:m=>n(c,m.target.value),placeholder:i.description||`Enter ${c}`}),i.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i.description})]},c)};return d.jsx("div",{className:"space-y-4",children:r.map(i=>s(i))})}function D$({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:r,onArgChange:a,onExecute:s,onSave:i}){return v.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&e&&!n&&r&&(u.preventDefault(),s())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n,r,s]),e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:d.jsxs("div",{children:[d.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[d.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),d.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[d.jsx(De,{onClick:s,disabled:n||!r,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?d.jsxs(d.Fragment,{children:[d.jsx(Vo,{className:"mr-2"}),d.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):d.jsxs(d.Fragment,{children:[d.jsx(k3,{className:"h-4 w-4 sm:mr-2"}),d.jsx("span",{className:"hidden sm:inline",children:"Execute"}),d.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:"⌘↵"})]})}),d.jsxs(De,{variant:"outline",onClick:i,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[d.jsx(Z_,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),e.description&&d.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:d.jsx(tve,{selectedPrompt:e,promptArgs:t,onArgChange:a})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),d.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 nve(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 L$({results:e,copiedResult:t,onCopy:n}){return d.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:d.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:e.length>0?d.jsx("div",{className:"space-y-4 flex-1 h-full",children:e.map((r,a)=>{const s=r.error||nve(r.result);return d.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[d.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[d.jsx("h3",{className:"text-sm font-medium",children:"Response"}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(Ou,{className:"h-3 w-3 text-gray-400"}),d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(r.timestamp).toLocaleTimeString()})]}),r.duration!==void 0&&d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(ep,{className:"h-3 w-3 text-gray-400"}),d.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[r.duration,"ms"]})]}),d.jsx("div",{className:"flex gap-2 ml-auto",children:d.jsx(De,{variant:"ghost",size:"sm",onClick:()=>n(a,r.result),className:"h-6 px-2",children:t===a?d.jsx(oa,{className:"h-4 w-4"}):d.jsx(zr,{className:"h-4 w-4"})})})]}),s?d.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:[d.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),d.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:s})]}):d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{data:r.result,filename:`prompt-result-${r.promptName}-${Date.now()}.json`})})]},a)})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function v1({serverIds:e,onCountChange:t,onClearRef:n}={}){const[r,a]=v.useState([]),s=v.useRef(null),[i,c]=v.useState(new Set),[u]=v.useState(""),f=y=>{c(x=>{const E=new Set(x);return E.has(y)?E.delete(y):E.add(y),E})},m=async()=>{a([]),c(new Set),t?.(0);try{const y=new URLSearchParams;e&&e.length>0&&y.set("serverIds",e.join(","));const x=await fetch(`/inspector/api/rpc/log?${y.toString()}`,{method:"DELETE"});x.ok||console.warn("[RPC Logger] Failed to clear server buffer:",x.status)}catch(y){console.warn("[RPC Logger] Error clearing server buffer:",y)}},h=v.useMemo(()=>!e||e.length===0?"":[...e].sort().join(","),[e]);v.useEffect(()=>(n&&(n.current=m),()=>{n&&(n.current=null)}),[n,m]),v.useEffect(()=>{t?.(r.length)},[r.length,t]),v.useEffect(()=>{let y=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 E=`/inspector/api/rpc/stream?${x.toString()}`;console.log("[RPC Logger] Connecting to SSE stream:",E),y=new globalThis.EventSource(E),y.onopen=()=>{console.log("[RPC Logger] SSE connection opened")},y.onmessage=w=>{try{const _=JSON.parse(w.data);if(!_||_.type!=="rpc")return;const{serverId:S,direction:T,message:R,timestamp:C}=_,I=R,A=typeof I?.method=="string"?I.method:I?.result!==void 0?"result":I?.error!==void 0?"error":"unknown",O={id:`${C??Date.now()}-${Math.random().toString(36).slice(2)}`,serverId:typeof S=="string"?S:"unknown",direction:typeof T=="string"?T.toUpperCase():"",method:A,timestamp:C??new Date().toISOString(),payload:R};console.log("[RPC Logger] Received RPC event:",{method:A,direction:T,serverId:S}),a(j=>{const U=[O,...j].slice(0,1e3);return t?.(U.length),U})}catch(_){console.error("[RPC Logger] Error parsing SSE message:",_)}},y.onerror=w=>{console.error("[RPC Logger] SSE connection error:",w);try{y?.close()}catch{}}}catch(x){console.error("[RPC Logger] Failed to create SSE connection:",x)}return()=>{try{y?.close(),console.log("[RPC Logger] SSE connection closed")}catch{}}},[h]);const b=v.useMemo(()=>{let y=r;if(e&&e.length>0){const x=new Set(e);y=y.filter(E=>x.has(E.serverId))}if(u.trim()){const x=u.toLowerCase();y=y.filter(E=>E.serverId.toLowerCase().includes(x)||E.method.toLowerCase().includes(x)||E.direction.toLowerCase().includes(x)||JSON.stringify(E.payload).toLowerCase().includes(x))}return y},[r,u,e]);return d.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:d.jsx("div",{ref:s,className:"flex-1 min-h-0 overflow-y-auto",children:b.length===0?d.jsxs("div",{className:"text-center py-8",children:[d.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages yet"}),d.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:"JSON-RPC messages will appear here"})]}):b.map(y=>{const x=i.has(y.id);return d.jsxs("div",{className:"group hover:bg-muted/50 transition-all duration-200 overflow-hidden",children:[d.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>f(y.id),children:[d.jsx("div",{className:"flex-shrink-0",children:x?d.jsx(Fl,{className:"h-3 w-3 text-muted-foreground transition-transform"}):d.jsx(ose,{className:"h-3 w-3 text-muted-foreground transition-transform"})}),d.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[d.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:new Date(y.timestamp).toLocaleTimeString()}),d.jsx("span",{className:`flex items-center justify-center px-1 py-0.5 rounded ${y.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:y.direction==="RECEIVE"?"Incoming":"Outgoing",children:y.direction==="RECEIVE"?d.jsx(Koe,{className:"h-3 w-3"}):d.jsx(Zoe,{className:"h-3 w-3"})}),d.jsx("span",{className:"text-xs font-mono text-foreground truncate",children:y.method})]})]}),x&&d.jsx("div",{className:"border-t bg-muted/20",children:d.jsx("div",{className:"p-3",children:d.jsx("div",{className:"max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2",children:d.jsx(nr,{data:y.payload})})})})]},y.id)})})})}const M$="mcp-inspector-saved-prompts";function O6({ref:e,prompts:t,callPrompt:n,serverId:r,isConnected:a}){const[s,i]=v.useState(null),[c,u]=v.useState(null),{selectedPromptName:f,setSelectedPromptName:m}=Bl(),[h,b]=v.useState({}),[y,x]=v.useState([]),[E,w]=v.useState(!1),[_,S]=v.useState(null),[T,R]=v.useState(""),[C,I]=v.useState("prompts"),[A,O]=v.useState([]),[j,U]=v.useState(!1),[B,W]=v.useState(""),[J,ee]=v.useState(!1),[re,F]=v.useState(-1),K=v.useRef(null),[V,ne]=v.useState(!1),[te,D]=v.useState("list"),[H,$]=v.useState(0),[L,M]=v.useState(!0),z=v.useRef(null),G=v.useRef(null);v.useEffect(()=>{const Ee=()=>{ne(window.innerWidth<1024)};return Ee(),window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)},[]),v.useEffect(()=>{D(s?"detail":"list")},[s]),v.useEffect(()=>{V&&y.length>0&&!E&&D("response")},[y,E,V]),v.useImperativeHandle(e,()=>({focusSearch:()=>{ee(!0),setTimeout(()=>{K.current&&K.current.focus()},0)},blurSearch:()=>{R(""),ee(!1),K.current&&K.current.blur()}})),v.useEffect(()=>{try{const Ee=localStorage.getItem(M$);if(Ee){const _e=JSON.parse(Ee);O(_e)}}catch(Ee){console.error("[PromptsTab] Failed to load saved prompts:",Ee)}},[]);const q=v.useCallback(Ee=>{try{localStorage.setItem(M$,JSON.stringify(Ee))}catch(_e){console.error("[PromptsTab] Failed to save prompts:",_e)}},[]);v.useEffect(()=>{J&&K.current&&K.current.focus()},[J]);const ae=v.useCallback(()=>{T.trim()||ee(!1)},[T]),ie=v.useMemo(()=>{if(!T.trim())return t;const Ee=T.toLowerCase();return t.filter(_e=>_e.name.toLowerCase().includes(Ee)||_e.description?.toLowerCase().includes(Ee))},[t,T]),X=v.useCallback(Ee=>{i(Ee);const _e={};Ee.arguments&&Ee.arguments.forEach(Ue=>{Ue.default!==void 0?_e[Ue.name]=Ue.default:Ue.type==="string"?_e[Ue.name]="":Ue.type==="number"?_e[Ue.name]=0:Ue.type==="boolean"?_e[Ue.name]=!1:Ue.type==="array"?_e[Ue.name]=[]:Ue.type==="object"&&(_e[Ue.name]={})}),b(_e)},[]),Z=v.useCallback(Ee=>{const _e=t.find(Ue=>Ue.name===Ee.promptName);_e&&(i(_e),b(Ee.args),u(Ee))},[t]);v.useEffect(()=>{F(-1)},[T,C]),v.useEffect(()=>{const Ee=_e=>{const Ue=_e.target;if(Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.contentEditable==="true"||_e.metaKey||_e.ctrlKey||_e.altKey)return;const Ae=C==="prompts"?ie:A;if(_e.key==="ArrowDown")_e.preventDefault(),F(ze=>{const we=ze+1;return we>=Ae.length?0:we});else if(_e.key==="ArrowUp")_e.preventDefault(),F(ze=>{const we=ze-1;return we<0?Ae.length-1:we});else if(_e.key==="Enter"&&re>=0)if(_e.preventDefault(),C==="prompts"){const ze=ie[re];ze&&X(ze)}else{const ze=A[re];ze&&Z(ze)}};return document.addEventListener("keydown",Ee),()=>document.removeEventListener("keydown",Ee)},[re,ie,A,C,X,Z]),v.useEffect(()=>{if(re>=0){const Ee=C==="prompts"?`prompt-${ie[re]?.name}`:`saved-prompt-${A[re]?.id}`,_e=document.getElementById(Ee);_e&&_e.scrollIntoView({behavior:"smooth",block:"nearest"})}},[re,ie,A,C]),v.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:f,promptsCount:t.length,currentSelectedPrompt:s?.name}),f&&t.length>0){const Ee=t.find(_e=>_e.name===f);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:f,promptFound:!!Ee,promptName:Ee?.name,shouldSelect:Ee&&s?.name!==Ee.name}),Ee&&s?.name!==Ee.name){console.warn("[PromptsTab] Selecting prompt:",Ee.name),m(null);const _e=setTimeout(()=>{X(Ee);const Ue=document.getElementById(`prompt-${Ee.name}`);Ue&&(console.warn("[PromptsTab] Scrolling to prompt element"),Ue.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(_e)}}},[f,t,s,X,m]);const se=v.useCallback((Ee,_e)=>{b(Ue=>({...Ue,[Ee]:_e}))},[]),me=v.useCallback(async()=>{if(!s||E)return;w(!0);const Ee=Date.now();try{const _e=await n(s.name,h),Ue=Date.now()-Ee;Tr.getInstance().capture(new qj({promptName:s.name,serverId:r,success:!0})).catch(()=>{}),x(Ae=>[{promptName:s.name,args:h,result:_e,timestamp:Ee,duration:Ue},...Ae])}catch(_e){Tr.getInstance().capture(new qj({promptName:s.name,serverId:r,success:!1,error:_e instanceof Error?_e.message:"Unknown error"})).catch(()=>{});const fe={promptName:s.name,args:h,result:null,error:_e instanceof Error?_e.message:String(_e),timestamp:Ee,duration:Date.now()-Ee};x(Ae=>[fe,...Ae])}finally{w(!1)}},[s,h,E,n,r]),le=v.useCallback(async(Ee,_e)=>{try{await navigator.clipboard.writeText(JSON.stringify(_e,null,2)),S(Ee),setTimeout(()=>S(null),2e3)}catch(Ue){console.error("[PromptsTab] Failed to copy result:",Ue)}},[]),Te=v.useCallback(()=>{s&&(W(""),U(!0))},[s]),Be=v.useCallback(Ee=>{q(A.filter(_e=>_e.id!==Ee)),c?.id===Ee&&u(null)},[A,q,c]);return V?d.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[te!=="list"&&d.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[d.jsx(De,{variant:"ghost",size:"sm",onClick:()=>{te==="response"?D("detail"):(i(null),D("list"))},className:"p-0 h-8 w-8",children:d.jsx(V_,{className:"h-4 w-4"})}),d.jsxs("div",{className:"flex items-center text-sm font-medium",children:[d.jsx("button",{onClick:()=>{i(null),D("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),te!=="list"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("button",{onClick:()=>{te==="response"&&D("detail")},className:te==="detail"?"text-foreground hover:underline":te==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),te==="response"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),d.jsx("div",{className:"flex-1 relative overflow-hidden",children:d.jsxs(Oy,{initial:!1,mode:"popLayout",children:[te==="list"&&d.jsxs(wa.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:[d.jsx(I$,{activeTab:C,isSearchExpanded:J,searchQuery:T,filteredPromptsCount:ie.length,savedPromptsCount:A.length,onSearchExpand:()=>ee(!0),onSearchChange:R,onSearchBlur:ae,onTabSwitch:()=>I(C==="prompts"?"saved":"prompts"),searchInputRef:K}),C==="prompts"?d.jsx(A$,{prompts:ie,selectedPrompt:s,onPromptSelect:X,focusedIndex:re}):d.jsx(O$,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:Z,onDeletePrompt:Be,focusedIndex:re})]},"list"),te==="detail"&&d.jsx(wa.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:d.jsx(D$,{selectedPrompt:s,promptArgs:h,isExecuting:E,isConnected:a,onArgChange:se,onExecute:me,onSave:Te})},"detail"),te==="response"&&d.jsx(wa.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:d.jsx(L$,{results:y,copiedResult:_,onCopy:le})},"response")]})})]}):d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:33,className:"flex flex-col h-full relative",children:d.jsxs(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[d.jsx(Rn,{defaultSize:75,minSize:30,children:d.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[d.jsx(I$,{activeTab:C,isSearchExpanded:J,searchQuery:T,filteredPromptsCount:ie.length,savedPromptsCount:A.length,onSearchExpand:()=>ee(!0),onSearchChange:R,onSearchBlur:ae,onTabSwitch:()=>I(C==="prompts"?"saved":"prompts"),searchInputRef:K}),C==="prompts"?d.jsx(A$,{prompts:ie,selectedPrompt:s,onPromptSelect:X,focusedIndex:re}):d.jsx(O$,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:Z,onDeletePrompt:Be,focusedIndex:re})]})}),d.jsx(vo,{withHandle:!0}),d.jsxs(Rn,{ref:z,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>M(!0),onExpand:()=>M(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[d.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),L?(z.current?.resize(25),M(!1)):(z.current?.resize(5),M(!0))},children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),H>0&&d.jsx(kr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:H}),H>0&&!L&&d.jsx(De,{variant:"ghost",size:"sm",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),G.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:d.jsx(Ii,{className:"h-3.5 w-3.5"})})]}),d.jsx(Fl,{className:`h-4 w-4 text-muted-foreground transition-transform ${L?"rotate-180":""}`})]}),!L&&d.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:d.jsx(v1,{serverIds:[r],onCountChange:$,onClearRef:G})})]})]})}),d.jsx(vo,{withHandle:!0}),d.jsx(Rn,{defaultSize:67,children:d.jsxs(aa,{direction:"vertical",children:[d.jsx(Rn,{defaultSize:40,children:d.jsx(D$,{selectedPrompt:s,promptArgs:h,isExecuting:E,isConnected:a,onArgChange:se,onExecute:me,onSave:Te})}),d.jsx(vo,{withHandle:!0}),d.jsx(Rn,{defaultSize:50,children:d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(L$,{results:y,copiedResult:_,onCopy:le})})})]})})]})}O6.displayName="PromptsTab";function mu(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 rve(e){return{uri:e.uri,mimeType:e.mimeType,text:e.text,blob:e.blob}}function D6({resource:e,onUIAction:t,className:n}){const r=async s=>t?.(s),a=rve(e);return d.jsx("div",{className:n,children:d.jsx(h1,{resource:a,onUIAction:r,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:[mye,pye,hye,gye],library:m1}})})}function ave(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(`
1667
+ `);T=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"){E+=O.content;const j=w[w.length-1];j&&j.type==="text"?j.text=E:w.push({type:"text",text:E}),console.log("[Parts after text]",w.length,"parts, text length:",E.length),s(U=>U.map(B=>B.id===x?{...B,parts:[...w]}:B))}else if(O.type==="tool-call")E&&(E=""),w.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",w.length,"parts, tool:",O.toolName),s(j=>j.map(U=>U.id===x?{...U,parts:[...w]}:U));else if(O.type==="tool-result"){const j=w.find(U=>U.type==="tool-invocation"&&U.toolInvocation?.toolName===O.toolName&&!U.toolInvocation?.result);j&&j.toolInvocation?(j.toolInvocation.result=O.result,j.toolInvocation.state="result",console.log("[Parts after tool-result]",w.length,"parts, updated:",O.toolName),s(U=>U.map(B=>B.id===x?{...B,parts:[...w]}:B))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",w.length),s(j=>j.map(U=>U.id===x?{...U,parts:[...w],content:""}:U));else if(O.type==="error")throw new Error(O.message||"Streaming error")}catch(O){console.error("Failed to parse streaming event:",O,A)}}}catch(b){let y="Unknown error occurred";if(b instanceof Error){y=b.message;const E=b;E.status&&(y=`HTTP ${E.status}: ${y}`),(E.code===401||y.includes("401")||y.includes("Unauthorized"))&&(y="Authentication failed (401). Check your Authorization header in the connection settings.")}const x={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${y}`,timestamp:Date.now()};s(E=>[...E,x])}finally{c(!1)}},[t,r,e,a,n]),f=v.useCallback(()=>{s([])},[]);return{messages:a,isLoading:i,sendMessage:u,clearMessages:f}}function Eye({connection:e,llmConfig:t,isConnected:n,readResource:r}){const[a,s]=v.useState([]),[i,c]=v.useState(!1),u=v.useRef(null),f=v.useRef(null),m=v.useRef(null),h=v.useCallback(async y=>{if(!y.trim()||!t||!n)return;const x={id:`user-${Date.now()}`,role:"user",content:y.trim(),timestamp:Date.now()};s(_=>[..._,x]),c(!0),u.current=new AbortController;const E=Date.now();let w=0;try{const _=`assistant-${Date.now()}`;let S="";const T=[];if(s(R=>[...R,{id:_,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 R;if(t.provider==="openai"){const{ChatOpenAI:C}=await hr(async()=>{const{ChatOpenAI:I}=await import("./index-DOX6bDm6.js");return{ChatOpenAI:I}},__vite__mapDeps([5,6,7,3,8,9]));R=new C({model:t.model,apiKey:t.apiKey})}else if(t.provider==="anthropic"){const{ChatAnthropic:C}=await hr(async()=>{const{ChatAnthropic:I}=await import("./index-DtG5fMwI.js");return{ChatAnthropic:I}},__vite__mapDeps([10,7,6,3]));R=new C({model:t.model,apiKey:t.apiKey})}else if(t.provider==="google"){const{ChatGoogleGenerativeAI:C}=await hr(async()=>{const{ChatGoogleGenerativeAI:I}=await import("./index-Cf0O1YbZ.js");return{ChatGoogleGenerativeAI:I}},__vite__mapDeps([11,7,6,3,9]));R=new C({model:t.model,apiKey:t.apiKey})}else throw new Error(`Unsupported LLM provider: ${t.provider}`);m.current={instance:R,provider:t.provider,model:t.model,apiKey:t.apiKey}}if(!f.current||f.current.llm!==m.current.instance){const{MCPAgent:R}=await hr(async()=>{const{MCPAgent:C}=await import("./browser-B12tbDYW.js");return{MCPAgent:C}},__vite__mapDeps([12,8,6,7,3,2,4,9]));f.current=new R({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 f.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",f.current.conversationHistory?.length);for await(const R of f.current.streamEvents(y,10,!1,void 0)){if(u.current?.signal.aborted)break;if(R.event==="on_chat_model_stream"&&R.data?.chunk?.text){const C=R.data.chunk.text;if(typeof C=="string"&&C.length>0){S+=C;const I=T[T.length-1];I&&I.type==="text"?I.text=S:T.push({type:"text",text:S}),s(A=>A.map(O=>O.id===_?{...O,parts:[...T]}:O))}}else if(R.event==="on_tool_start"){S&&(S="");let C={};R.data?.input?C=R.data.input:R.data?.tool_input?C=R.data.tool_input:R.data&&(C=R.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:R.name,eventData:R.data,extractedArgs:C}),w++,T.push({type:"tool-invocation",toolInvocation:{toolName:R.name||"unknown",args:C,state:"pending"}}),s(I=>I.map(A=>A.id===_?{...A,parts:[...T]}:A))}else if(R.event==="on_tool_end"){const C=T.find(I=>I.type==="tool-invocation"&&I.toolInvocation?.toolName===R.name&&!I.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:R.name,hasToolPart:!!C,output:R.data?.output}),C&&C.toolInvocation){let I=R.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}C.toolInvocation.result=I,C.toolInvocation.state="result";const A=I?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:R.name,hasMeta:!!I?._meta,hasStructuredContent:!!I?.structuredContent,appsSdkUri:A}),A&&typeof A=="string"&&r){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",A);try{const O=await r(A);console.log("[useChatMessagesClientSide] Resource fetched:",O);const j=I?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const U=O.contents.map(W=>({type:"resource",resource:W}));console.log("[useChatMessagesClientSide] Created MCP resources:",U);const B={...I,content:[...I.content||[],...U],structuredContent:j};C.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)}}s(O=>O.map(j=>j.id===_?{...j,parts:[...T]}:j))}}}s(R=>R.map(C=>C.id===_?{...C,parts:[...T],content:""}:C)),t&&Tr.getInstance().capture(new Xj({serverId:e.url,provider:t.provider,model:t.model,messageCount:a.length+1,toolCallsCount:w,success:!0,executionMode:"client-side",duration:Date.now()-E})).catch(()=>{})}catch(_){console.error("Client-side agent error:",_);let S="Unknown error occurred";if(_ instanceof Error){S=_.message;const R=_;R.status&&(S=`HTTP ${R.status}: ${S}`),(R.code===401||S.includes("401")||S.includes("Unauthorized"))&&(S="Authentication failed (401). Check your Authorization header in the connection settings.")}t&&Tr.getInstance().capture(new Xj({serverId:e.url,provider:t.provider,model:t.model,messageCount:a.length+1,toolCallsCount:w,success:!1,executionMode:"client-side",duration:Date.now()-E,error:S})).catch(()=>{});const T={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${S}`,timestamp:Date.now()};s(R=>[...R,T])}finally{c(!1),u.current=null}},[e,t,n,a,r]),b=v.useCallback(()=>{s([]),f.current&&f.current.clearConversationHistory()},[]);return{messages:a,isLoading:i,sendMessage:h,clearMessages:b}}const E$={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function c6({mcpServerUrl:e}){const[t,n]=v.useState(null),[r,a]=v.useState(null),[s,i]=v.useState(!1),[c,u]=v.useState("openai"),[f,m]=v.useState(""),[h,b]=v.useState(E$.openai),y=v.useCallback(()=>{const j=localStorage.getItem("mcp-inspector-api-keys");if(j)try{return JSON.parse(j)}catch(U){return console.error("Failed to load API keys:",U),{}}return{}},[]),x=v.useCallback(j=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(j))},[]),[E,w]=v.useState("none"),[_,S]=v.useState(""),[T,R]=v.useState(""),[C,I]=v.useState("");v.useEffect(()=>{const j=localStorage.getItem("mcp-inspector-llm-config"),U=y();if(j)try{const B=JSON.parse(j);n(B),u(B.provider),m(U[B.provider]||B.apiKey||""),b(B.model)}catch(B){console.error("Failed to load LLM config:",B)}},[y]),v.useEffect(()=>{const j=localStorage.getItem("mcp-inspector-auth-config");if(j)try{const U=JSON.parse(j);a(U),w(U.type),U.username&&S(U.username),U.password&&R(U.password),U.token&&I(U.token)}catch(U){console.error("Failed to load auth config:",U)}else try{const U="mcp:auth",B=l6(e),W=`${U}_${B}_tokens`;localStorage.getItem(W)&&(a({type:"oauth"}),w("oauth"))}catch(U){console.error("Failed to check for OAuth tokens:",U)}},[e]),v.useEffect(()=>{b(E$[c]);const j=y();m(j[c]||"")},[c,y]);const A=v.useCallback(()=>{if(!f.trim())return;const j=y();j[c]=f,x(j);const U={provider:c,apiKey:f,model:h},B={type:E,...E==="basic"&&{username:_.trim(),password:T.trim()},...E==="bearer"&&{token:C.trim()}};n(U),a(B),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(U)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(B)),i(!1)},[c,f,h,E,_,T,C,y,x]),O=v.useCallback(()=>{n(null),a(null);const j=y();delete j[c],x(j),m(""),S(""),R(""),I(""),w("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,y,x]);return{llmConfig:t,authConfig:r,configDialogOpen:s,setConfigDialogOpen:i,tempProvider:c,setTempProvider:u,tempApiKey:f,setTempApiKey:m,tempModel:h,setTempModel:b,tempAuthType:E,saveLLMConfig:A,clearConfig:O}}function xye({connection:e,isConnected:t,useClientSide:n=!0,readResource:r}){const[a,s]=v.useState(""),i=v.useRef(null),{llmConfig:c,authConfig:u,configDialogOpen:f,setConfigDialogOpen:m,tempProvider:h,setTempProvider:b,tempApiKey:y,setTempApiKey:x,tempModel:E,setTempModel:w,saveLLMConfig:_,clearConfig:S}=c6({mcpServerUrl:e.url}),T={connection:e,llmConfig:c,isConnected:t,readResource:r},R=wye({mcpServerUrl:e.url,llmConfig:c,authConfig:u,isConnected:t}),C=Eye(T),{messages:I,isLoading:A,sendMessage:O,clearMessages:j}=n?C:R;iH({onNewChat:j}),v.useEffect(()=>{c&&I.length===0&&i.current&&i.current.focus()},[c,I.length]),v.useEffect(()=>{!A&&I.length>0&&i.current&&i.current.focus()},[A,I.length]);const U=v.useCallback(()=>{a.trim()&&(O(a),s(""))},[a,O]),B=v.useCallback(J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),U())},[U]),W=v.useCallback(()=>{S(),j()},[S,j]);return c&&I.length===0?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("div",{className:"absolute top-4 right-4 z-10",children:d.jsx(nS,{open:f,onOpenChange:m,tempProvider:h,tempModel:E,tempApiKey:y,onProviderChange:b,onModelChange:w,onApiKeyChange:x,onSave:_,onClear:W,showClearButton:!0,buttonLabel:"Change API Key"})}),d.jsx(Mme,{mcpServerUrl:e.url,inputValue:a,isConnected:t,isLoading:A,textareaRef:i,llmConfig:c,onInputChange:s,onKeyDown:B,onSubmit:J=>{J.preventDefault(),U()},onConfigDialogOpenChange:m})]}):d.jsxs("div",{className:"flex flex-col h-full relative",children:[d.jsx(Ome,{llmConfig:c,hasMessages:I.length>0,configDialogOpen:f,onConfigDialogOpenChange:m,onClearChat:j,tempProvider:h,tempModel:E,tempApiKey:y,onProviderChange:b,onModelChange:w,onApiKeyChange:x,onSaveConfig:_,onClearConfig:W}),d.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?d.jsx(vye,{messages:I,isLoading:A,serverId:e.url,readResource:r}):d.jsx(jme,{onConfigureClick:()=>m(!0)})}),c&&d.jsx(Dme,{inputValue:a,isConnected:t,isLoading:A,textareaRef:i,onInputChange:s,onKeyDown:B,onSendMessage:U})]})}const ev=v.createContext(null);ev.displayName="PanelGroupContext";const qn={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"},g1=10,_l=v.useLayoutEffect,x$=Hu.useId,Sye=typeof x$=="function"?x$:()=>null;let _ye=0;function b1(e=null){const t=Sye(),n=v.useRef(e||t||null);return n.current===null&&(n.current=""+_ye++),e??n.current}function u6({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:a,forwardedRef:s,id:i,maxSize:c,minSize:u,onCollapse:f,onExpand:m,onResize:h,order:b,style:y,tagName:x="div",...E}){const w=v.useContext(ev);if(w===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:_,expandPanel:S,getPanelSize:T,getPanelStyle:R,groupId:C,isPanelCollapsed:I,reevaluatePanelConstraints:A,registerPanel:O,resizePanel:j,unregisterPanel:U}=w,B=b1(i),W=v.useRef({callbacks:{onCollapse:f,onExpand:m,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:a,maxSize:c,minSize:u},id:B,idIsFromProps:i!==void 0,order:b});v.useRef({didLogMissingDefaultSizeWarning:!1}),_l(()=>{const{callbacks:ee,constraints:re}=W.current,F={...re};W.current.id=B,W.current.idIsFromProps=i!==void 0,W.current.order=b,ee.onCollapse=f,ee.onExpand=m,ee.onResize=h,re.collapsedSize=n,re.collapsible=r,re.defaultSize=a,re.maxSize=c,re.minSize=u,(F.collapsedSize!==re.collapsedSize||F.collapsible!==re.collapsible||F.maxSize!==re.maxSize||F.minSize!==re.minSize)&&A(W.current,F)}),_l(()=>{const ee=W.current;return O(ee),()=>{U(ee)}},[b,B,O,U]),v.useImperativeHandle(s,()=>({collapse:()=>{_(W.current)},expand:ee=>{S(W.current,ee)},getId(){return B},getSize(){return T(W.current)},isCollapsed(){return I(W.current)},isExpanded(){return!I(W.current)},resize:ee=>{j(W.current,ee)}}),[_,S,T,I,B,j]);const J=R(W.current,a);return v.createElement(x,{...E,children:e,className:t,id:B,style:{...J,...y},[qn.groupId]:C,[qn.panel]:"",[qn.panelCollapsible]:r||void 0,[qn.panelId]:B,[qn.panelSize]:parseFloat(""+J.flexGrow).toFixed(1)})}const d6=v.forwardRef((e,t)=>v.createElement(u6,{...e,forwardedRef:t}));u6.displayName="Panel";d6.displayName="forwardRef(Panel)";let IS=null,Gg=-1,wi=null;function Tye(e,t,n){const r=(t&g6)!==0,a=(t&b6)!==0,s=(t&y6)!==0,i=(t&v6)!==0;if(t){if(r)return s?"se-resize":i?"ne-resize":"e-resize";if(a)return s?"sw-resize":i?"nw-resize":"w-resize";if(s)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Nye(){wi!==null&&(document.head.removeChild(wi),IS=null,wi=null,Gg=-1)}function AE(e,t,n){var r,a;const s=Tye(e,t);if(IS!==s){if(IS=s,wi===null&&(wi=document.createElement("style"),document.head.appendChild(wi)),Gg>=0){var i;(i=wi.sheet)===null||i===void 0||i.removeRule(Gg)}Gg=(r=(a=wi.sheet)===null||a===void 0?void 0:a.insertRule(`*{cursor: ${s} !important;}`))!==null&&r!==void 0?r:-1}}function f6(e){return e.type==="keydown"}function p6(e){return e.type.startsWith("pointer")}function m6(e){return e.type.startsWith("mouse")}function tv(e){if(p6(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(m6(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function kye(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Cye(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 Rye(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:T$(e),b:T$(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;kt(r,"Stacking order can only be calculated for elements with a common ancestor");const a={a:_$(S$(n.a)),b:_$(S$(n.b))};if(a.a===a.b){const s=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let c=s.length;for(;c--;){const u=s[c];if(u===i.a)return 1;if(u===i.b)return-1}}return Math.sign(a.a-a.b)}const Aye=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Iye(e){var t;const n=getComputedStyle((t=h6(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Oye(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Iye(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"||Aye.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function S$(e){let t=e.length;for(;t--;){const n=e[t];if(kt(n,"Missing node"),Oye(n))return n}return null}function _$(e){return e&&Number(getComputedStyle(e).zIndex)||0}function T$(e){const t=[];for(;e;)t.push(e),e=h6(e);return t}function h6(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const g6=1,b6=2,y6=4,v6=8,Dye=kye()==="coarse";let yo=[],pu=!1,Ei=new Map,nv=new Map;const hp=new Set;function Lye(e,t,n,r,a){var s;const{ownerDocument:i}=t,c={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:a},u=(s=Ei.get(i))!==null&&s!==void 0?s:0;return Ei.set(i,u+1),hp.add(c),Bb(),function(){var m;nv.delete(e),hp.delete(c);const h=(m=Ei.get(i))!==null&&m!==void 0?m:1;if(Ei.set(i,h-1),Bb(),h===1&&Ei.delete(i),yo.includes(c)){const b=yo.indexOf(c);b>=0&&yo.splice(b,1),rv(),a("up",!0,null)}}}function Mye(e){const{target:t}=e,{x:n,y:r}=tv(e);pu=!0,y1({target:t,x:n,y:r}),Bb(),yo.length>0&&(Hb("down",e),rv(),e.preventDefault(),w6(t)||e.stopImmediatePropagation())}function IE(e){const{x:t,y:n}=tv(e);if(pu&&e.type!=="pointerleave"&&e.buttons===0&&(pu=!1,Hb("up",e)),!pu){const{target:r}=e;y1({target:r,x:t,y:n})}Hb("move",e),rv(),yo.length>0&&e.preventDefault()}function OE(e){const{target:t}=e,{x:n,y:r}=tv(e);nv.clear(),pu=!1,yo.length>0&&(e.preventDefault(),w6(t)||e.stopImmediatePropagation()),Hb("up",e),y1({target:t,x:n,y:r}),rv(),Bb()}function w6(e){let t=e;for(;t;){if(t.hasAttribute(qn.resizeHandle))return!0;t=t.parentElement}return!1}function y1({target:e,x:t,y:n}){yo.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),hp.forEach(a=>{const{element:s,hitAreaMargins:i}=a,c=s.getBoundingClientRect(),{bottom:u,left:f,right:m,top:h}=c,b=Dye?i.coarse:i.fine;if(t>=f-b&&t<=m+b&&n>=h-b&&n<=u+b){if(r!==null&&document.contains(r)&&s!==r&&!s.contains(r)&&!r.contains(s)&&Rye(r,s)>0){let x=r,E=!1;for(;x&&!x.contains(s);){if(Cye(x.getBoundingClientRect(),c)){E=!0;break}x=x.parentElement}if(E)return}yo.push(a)}})}function DE(e,t){nv.set(e,t)}function rv(){let e=!1,t=!1;yo.forEach(r=>{const{direction:a}=r;a==="horizontal"?e=!0:t=!0});let n=0;nv.forEach(r=>{n|=r}),e&&t?AE("intersection",n):e?AE("horizontal",n):t?AE("vertical",n):Nye()}let LE;function Bb(){var e;(e=LE)===null||e===void 0||e.abort(),LE=new AbortController;const t={capture:!0,signal:LE.signal};hp.size&&(pu?(yo.length>0&&Ei.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("contextmenu",OE,t),a.addEventListener("pointerleave",IE,t),a.addEventListener("pointermove",IE,t))}),Ei.forEach((n,r)=>{const{body:a}=r;a.addEventListener("pointerup",OE,t),a.addEventListener("pointercancel",OE,t)})):Ei.forEach((n,r)=>{const{body:a}=r;n>0&&(a.addEventListener("pointerdown",Mye,t),a.addEventListener("pointermove",IE,t))}))}function Hb(e,t){hp.forEach(n=>{const{setResizeHandlerState:r}=n,a=yo.includes(n);r(e,a,t)})}function jye(){const[e,t]=v.useState(0);return v.useCallback(()=>t(n=>n+1),[])}function kt(e,t){if(!e)throw console.error(t),Error(t)}function Ml(e,t,n=g1){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function ws(e,t,n=g1){return Ml(e,t,n)===0}function Pa(e,t,n){return Ml(e,t,n)===0}function Pye(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const a=e[r],s=t[r];if(!Pa(a,s,n))return!1}return!0}function au({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];kt(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:s,maxSize:i=100,minSize:c=0}=r;if(Ml(n,c)<0)if(s){const u=(a+c)/2;Ml(n,u)<0?n=a:n=c}else n=c;return n=Math.min(i,n),n=parseFloat(n.toFixed(g1)),n}function xf({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:s}){if(Pa(e,0))return t;const i=[...t],[c,u]=r;kt(c!=null,"Invalid first pivot index"),kt(u!=null,"Invalid second pivot index");let f=0;if(s==="keyboard"){{const h=e<0?u:c,b=n[h];kt(b,`Panel constraints not found for index ${h}`);const{collapsedSize:y=0,collapsible:x,minSize:E=0}=b;if(x){const w=t[h];if(kt(w!=null,`Previous layout not found for panel index ${h}`),Pa(w,y)){const _=E-w;Ml(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const h=e<0?c:u,b=n[h];kt(b,`No panel constraints found for index ${h}`);const{collapsedSize:y=0,collapsible:x,minSize:E=0}=b;if(x){const w=t[h];if(kt(w!=null,`Previous layout not found for panel index ${h}`),Pa(w,E)){const _=w-y;Ml(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}}{const h=e<0?1:-1;let b=e<0?u:c,y=0;for(;;){const E=t[b];kt(E!=null,`Previous layout not found for panel index ${b}`);const _=au({panelConstraints:n,panelIndex:b,size:100})-E;if(y+=_,b+=h,b<0||b>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-x:x}{let b=e<0?c:u;for(;b>=0&&b<n.length;){const y=Math.abs(e)-Math.abs(f),x=t[b];kt(x!=null,`Previous layout not found for panel index ${b}`);const E=x-y,w=au({panelConstraints:n,panelIndex:b,size:E});if(!Pa(x,w)&&(f+=x-w,i[b]=w,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?b--:b++}}if(Pye(a,i))return a;{const h=e<0?u:c,b=t[h];kt(b!=null,`Previous layout not found for panel index ${h}`);const y=b+f,x=au({panelConstraints:n,panelIndex:h,size:y});if(i[h]=x,!Pa(x,y)){let E=y-x,_=e<0?u:c;for(;_>=0&&_<n.length;){const S=i[_];kt(S!=null,`Previous layout not found for panel index ${_}`);const T=S+E,R=au({panelConstraints:n,panelIndex:_,size:T});if(Pa(S,R)||(E-=R-S,i[_]=R),Pa(E,0))break;e>0?_--:_++}}}const m=i.reduce((h,b)=>b+h,0);return Pa(m,100)?i:a}function Uye({layout:e,panelsArray:t,pivotIndices:n}){let r=0,a=100,s=0,i=0;const c=n[0];kt(c!=null,"No pivot index found"),t.forEach((h,b)=>{const{constraints:y}=h,{maxSize:x=100,minSize:E=0}=y;b===c?(r=E,a=x):(s+=E,i+=x)});const u=Math.min(a,100-s),f=Math.max(r,100-i),m=e[c];return{valueMax:u,valueMin:f,valueNow:m}}function gp(e,t=document){return Array.from(t.querySelectorAll(`[${qn.resizeHandleId}][data-panel-group-id="${e}"]`))}function E6(e,t,n=document){const a=gp(e,n).findIndex(s=>s.getAttribute(qn.resizeHandleId)===t);return a??null}function x6(e,t,n){const r=E6(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function $ye(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function S6(e,t=document){if($ye(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function av(e,t=document){const n=t.querySelector(`[${qn.resizeHandleId}="${e}"]`);return n||null}function zye(e,t,n,r=document){var a,s,i,c;const u=av(t,r),f=gp(e,r),m=u?f.indexOf(u):-1,h=(a=(s=n[m])===null||s===void 0?void 0:s.id)!==null&&a!==void 0?a:null,b=(i=(c=n[m+1])===null||c===void 0?void 0:c.id)!==null&&i!==void 0?i:null;return[h,b]}function Fye({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:a,panelGroupElement:s,setLayout:i}){v.useRef({didWarnAboutMissingResizeHandle:!1}),_l(()=>{if(!s)return;const c=gp(n,s);for(let u=0;u<a.length-1;u++){const{valueMax:f,valueMin:m,valueNow:h}=Uye({layout:r,panelsArray:a,pivotIndices:[u,u+1]}),b=c[u];if(b!=null){const y=a[u];kt(y,`No panel data found for index "${u}"`),b.setAttribute("aria-controls",y.id),b.setAttribute("aria-valuemax",""+Math.round(f)),b.setAttribute("aria-valuemin",""+Math.round(m)),b.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((u,f)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[n,r,a,s]),v.useEffect(()=>{if(!s)return;const c=t.current;kt(c,"Eager values not found");const{panelDataArray:u}=c,f=S6(n,s);kt(f!=null,`No group found for id "${n}"`);const m=gp(n,s);kt(m,`No resize handles found for group id "${n}"`);const h=m.map(b=>{const y=b.getAttribute(qn.resizeHandleId);kt(y,"Resize handle element has no handle id attribute");const[x,E]=zye(n,y,u,s);if(x==null||E==null)return()=>{};const w=_=>{if(!_.defaultPrevented)switch(_.key){case"Enter":{_.preventDefault();const S=u.findIndex(T=>T.id===x);if(S>=0){const T=u[S];kt(T,`No panel data found for index ${S}`);const R=r[S],{collapsedSize:C=0,collapsible:I,minSize:A=0}=T.constraints;if(R!=null&&I){const O=xf({delta:Pa(R,C)?A-C:C-R,initialLayout:r,panelConstraints:u.map(j=>j.constraints),pivotIndices:x6(n,y,s),prevLayout:r,trigger:"keyboard"});r!==O&&i(O)}}break}}};return b.addEventListener("keydown",w),()=>{b.removeEventListener("keydown",w)}});return()=>{h.forEach(b=>b())}},[s,e,t,n,r,a,i])}function N$(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 _6(e,t){const n=e==="horizontal",{x:r,y:a}=tv(t);return n?r:a}function Bye(e,t,n,r,a){const s=n==="horizontal",i=av(t,a);kt(i,`No resize handle element found for id "${t}"`);const c=i.getAttribute(qn.groupId);kt(c,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=r;const f=_6(n,e),m=S6(c,a);kt(m,`No group element found for id "${c}"`);const h=m.getBoundingClientRect(),b=s?h.width:h.height;return(f-u)/b*100}function Hye(e,t,n,r,a,s){if(f6(e)){const i=n==="horizontal";let c=0;e.shiftKey?c=100:a!=null?c=a:c=10;let u=0;switch(e.key){case"ArrowDown":u=i?0:c;break;case"ArrowLeft":u=i?-c:0;break;case"ArrowRight":u=i?c:0;break;case"ArrowUp":u=i?0:-c;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return r==null?0:Bye(e,t,n,r,s)}function Vye({panelDataArray:e}){const t=Array(e.length),n=e.map(s=>s.constraints);let r=0,a=100;for(let s=0;s<e.length;s++){const i=n[s];kt(i,`Panel constraints not found for index ${s}`);const{defaultSize:c}=i;c!=null&&(r++,t[s]=c,a-=c)}for(let s=0;s<e.length;s++){const i=n[s];kt(i,`Panel constraints not found for index ${s}`);const{defaultSize:c}=i;if(c!=null)continue;const u=e.length-r,f=a/u;r++,t[s]=f,a-=f}return t}function Lc(e,t,n){t.forEach((r,a)=>{const s=e[a];kt(s,`Panel data not found for index ${a}`);const{callbacks:i,constraints:c,id:u}=s,{collapsedSize:f=0,collapsible:m}=c,h=n[u];if(h==null||r!==h){n[u]=r;const{onCollapse:b,onExpand:y,onResize:x}=i;x&&x(r,h),m&&(b||y)&&(y&&(h==null||ws(h,f))&&!ws(r,f)&&y(),b&&(h==null||!ws(h,f))&&ws(r,f)&&b())}})}function Eg(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 Gye({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:a,precision:s=3}){const i=n[a];let c;return i==null?c=e!=null?e.toFixed(s):"1":r.length===1?c="1":c=i.toFixed(s),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Wye(e,t=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...a)},t)}}function k$(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 T6(e){return`react-resizable-panels:${e}`}function N6(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:a,order:s}=t;return a?r:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function k6(e,t){try{const n=T6(e),r=t.getItem(n);if(r){const a=JSON.parse(r);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function Kye(e,t,n){var r,a;const s=(r=k6(e,n))!==null&&r!==void 0?r:{},i=N6(t);return(a=s[i])!==null&&a!==void 0?a:null}function Yye(e,t,n,r,a){var s;const i=T6(e),c=N6(t),u=(s=k6(e,a))!==null&&s!==void 0?s:{};u[c]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{a.setItem(i,JSON.stringify(u))}catch(f){console.error(f)}}function C$({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((s,i)=>s+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!Pa(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const i=n[s];kt(i!=null,`No layout data found for index ${s}`);const c=100/r*i;n[s]=c}let a=0;for(let s=0;s<t.length;s++){const i=n[s];kt(i!=null,`No layout data found for index ${s}`);const c=au({panelConstraints:t,panelIndex:s,size:i});i!=c&&(a+=i-c,n[s]=c)}if(!Pa(a,0))for(let s=0;s<t.length;s++){const i=n[s];kt(i!=null,`No layout data found for index ${s}`);const c=i+a,u=au({panelConstraints:t,panelIndex:s,size:c});if(i!==u&&(a-=u-i,n[s]=u,Pa(a,0)))break}return n}const Zye=100,Sf={getItem:e=>(k$(Sf),Sf.getItem(e)),setItem:(e,t)=>{k$(Sf),Sf.setItem(e,t)}},R$={};function C6({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:a,id:s=null,onLayout:i=null,keyboardResizeBy:c=null,storage:u=Sf,style:f,tagName:m="div",...h}){const b=b1(s),y=v.useRef(null),[x,E]=v.useState(null),[w,_]=v.useState([]),S=jye(),T=v.useRef({}),R=v.useRef(new Map),C=v.useRef(0),I=v.useRef({autoSaveId:e,direction:r,dragState:x,id:b,keyboardResizeBy:c,onLayout:i,storage:u}),A=v.useRef({layout:w,panelDataArray:[],panelDataArrayChanged:!1});v.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),v.useImperativeHandle(a,()=>({getId:()=>I.current.id,getLayout:()=>{const{layout:$}=A.current;return $},setLayout:$=>{const{onLayout:L}=I.current,{layout:M,panelDataArray:z}=A.current,G=C$({layout:$,panelConstraints:z.map(q=>q.constraints)});N$(M,G)||(_(G),A.current.layout=G,L&&L(G),Lc(z,G,T.current))}}),[]),_l(()=>{I.current.autoSaveId=e,I.current.direction=r,I.current.dragState=x,I.current.id=b,I.current.onLayout=i,I.current.storage=u}),Fye({committedValuesRef:I,eagerValuesRef:A,groupId:b,layout:w,panelDataArray:A.current.panelDataArray,setLayout:_,panelGroupElement:y.current}),v.useEffect(()=>{const{panelDataArray:$}=A.current;if(e){if(w.length===0||w.length!==$.length)return;let L=R$[e];L==null&&(L=Wye(Yye,Zye),R$[e]=L);const M=[...$],z=new Map(R.current);L(e,M,z,w,u)}},[e,w,u]),v.useEffect(()=>{});const O=v.useCallback($=>{const{onLayout:L}=I.current,{layout:M,panelDataArray:z}=A.current;if($.constraints.collapsible){const G=z.map(X=>X.constraints),{collapsedSize:q=0,panelSize:ae,pivotIndices:ie}=fl(z,$,M);if(kt(ae!=null,`Panel size not found for panel "${$.id}"`),!ws(ae,q)){R.current.set($.id,ae);const Z=Vc(z,$)===z.length-1?ae-q:q-ae,se=xf({delta:Z,initialLayout:M,panelConstraints:G,pivotIndices:ie,prevLayout:M,trigger:"imperative-api"});Eg(M,se)||(_(se),A.current.layout=se,L&&L(se),Lc(z,se,T.current))}}},[]),j=v.useCallback(($,L)=>{const{onLayout:M}=I.current,{layout:z,panelDataArray:G}=A.current;if($.constraints.collapsible){const q=G.map(me=>me.constraints),{collapsedSize:ae=0,panelSize:ie=0,minSize:X=0,pivotIndices:Z}=fl(G,$,z),se=L??X;if(ws(ie,ae)){const me=R.current.get($.id),le=me!=null&&me>=se?me:se,Be=Vc(G,$)===G.length-1?ie-le:le-ie,Ee=xf({delta:Be,initialLayout:z,panelConstraints:q,pivotIndices:Z,prevLayout:z,trigger:"imperative-api"});Eg(z,Ee)||(_(Ee),A.current.layout=Ee,M&&M(Ee),Lc(G,Ee,T.current))}}},[]),U=v.useCallback($=>{const{layout:L,panelDataArray:M}=A.current,{panelSize:z}=fl(M,$,L);return kt(z!=null,`Panel size not found for panel "${$.id}"`),z},[]),B=v.useCallback(($,L)=>{const{panelDataArray:M}=A.current,z=Vc(M,$);return Gye({defaultSize:L,dragState:x,layout:w,panelData:M,panelIndex:z})},[x,w]),W=v.useCallback($=>{const{layout:L,panelDataArray:M}=A.current,{collapsedSize:z=0,collapsible:G,panelSize:q}=fl(M,$,L);return kt(q!=null,`Panel size not found for panel "${$.id}"`),G===!0&&ws(q,z)},[]),J=v.useCallback($=>{const{layout:L,panelDataArray:M}=A.current,{collapsedSize:z=0,collapsible:G,panelSize:q}=fl(M,$,L);return kt(q!=null,`Panel size not found for panel "${$.id}"`),!G||Ml(q,z)>0},[]),ee=v.useCallback($=>{const{panelDataArray:L}=A.current;L.push($),L.sort((M,z)=>{const G=M.order,q=z.order;return G==null&&q==null?0:G==null?-1:q==null?1:G-q}),A.current.panelDataArrayChanged=!0,S()},[S]);_l(()=>{if(A.current.panelDataArrayChanged){A.current.panelDataArrayChanged=!1;const{autoSaveId:$,onLayout:L,storage:M}=I.current,{layout:z,panelDataArray:G}=A.current;let q=null;if($){const ie=Kye($,G,M);ie&&(R.current=new Map(Object.entries(ie.expandToSizes)),q=ie.layout)}q==null&&(q=Vye({panelDataArray:G}));const ae=C$({layout:q,panelConstraints:G.map(ie=>ie.constraints)});N$(z,ae)||(_(ae),A.current.layout=ae,L&&L(ae),Lc(G,ae,T.current))}}),_l(()=>{const $=A.current;return()=>{$.layout=[]}},[]);const re=v.useCallback($=>{let L=!1;const M=y.current;return M&&window.getComputedStyle(M,null).getPropertyValue("direction")==="rtl"&&(L=!0),function(G){G.preventDefault();const q=y.current;if(!q)return()=>null;const{direction:ae,dragState:ie,id:X,keyboardResizeBy:Z,onLayout:se}=I.current,{layout:me,panelDataArray:le}=A.current,{initialLayout:Te}=ie??{},Be=x6(X,$,q);let Ee=Hye(G,$,ae,ie,Z,q);const _e=ae==="horizontal";_e&&L&&(Ee=-Ee);const Ue=le.map(ze=>ze.constraints),fe=xf({delta:Ee,initialLayout:Te??me,panelConstraints:Ue,pivotIndices:Be,prevLayout:me,trigger:f6(G)?"keyboard":"mouse-or-touch"}),Ae=!Eg(me,fe);(p6(G)||m6(G))&&C.current!=Ee&&(C.current=Ee,!Ae&&Ee!==0?_e?DE($,Ee<0?g6:b6):DE($,Ee<0?y6:v6):DE($,0)),Ae&&(_(fe),A.current.layout=fe,se&&se(fe),Lc(le,fe,T.current))}},[]),F=v.useCallback(($,L)=>{const{onLayout:M}=I.current,{layout:z,panelDataArray:G}=A.current,q=G.map(me=>me.constraints),{panelSize:ae,pivotIndices:ie}=fl(G,$,z);kt(ae!=null,`Panel size not found for panel "${$.id}"`);const Z=Vc(G,$)===G.length-1?ae-L:L-ae,se=xf({delta:Z,initialLayout:z,panelConstraints:q,pivotIndices:ie,prevLayout:z,trigger:"imperative-api"});Eg(z,se)||(_(se),A.current.layout=se,M&&M(se),Lc(G,se,T.current))},[]),K=v.useCallback(($,L)=>{const{layout:M,panelDataArray:z}=A.current,{collapsedSize:G=0,collapsible:q}=L,{collapsedSize:ae=0,collapsible:ie,maxSize:X=100,minSize:Z=0}=$.constraints,{panelSize:se}=fl(z,$,M);se!=null&&(q&&ie&&ws(se,G)?ws(G,ae)||F($,ae):se<Z?F($,Z):se>X&&F($,X))},[F]),V=v.useCallback(($,L)=>{const{direction:M}=I.current,{layout:z}=A.current;if(!y.current)return;const G=av($,y.current);kt(G,`Drag handle element not found for id "${$}"`);const q=_6(M,L);E({dragHandleId:$,dragHandleRect:G.getBoundingClientRect(),initialCursorPosition:q,initialLayout:z})},[]),ne=v.useCallback(()=>{E(null)},[]),te=v.useCallback($=>{const{panelDataArray:L}=A.current,M=Vc(L,$);M>=0&&(L.splice(M,1),delete T.current[$.id],A.current.panelDataArrayChanged=!0,S())},[S]),D=v.useMemo(()=>({collapsePanel:O,direction:r,dragState:x,expandPanel:j,getPanelSize:U,getPanelStyle:B,groupId:b,isPanelCollapsed:W,isPanelExpanded:J,reevaluatePanelConstraints:K,registerPanel:ee,registerResizeHandle:re,resizePanel:F,startDragging:V,stopDragging:ne,unregisterPanel:te,panelGroupElement:y.current}),[O,x,r,j,U,B,b,W,J,K,ee,re,F,V,ne,te]),H={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return v.createElement(ev.Provider,{value:D},v.createElement(m,{...h,children:t,className:n,id:s,ref:y,style:{...H,...f},[qn.group]:"",[qn.groupDirection]:r,[qn.groupId]:b}))}const R6=v.forwardRef((e,t)=>v.createElement(C6,{...e,forwardedRef:t}));C6.displayName="PanelGroup";R6.displayName="forwardRef(PanelGroup)";function Vc(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function fl(e,t,n){const r=Vc(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:s}}function qye({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){v.useEffect(()=>{if(e||n==null||r==null)return;const a=av(t,r);if(a==null)return;const s=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const c=a.getAttribute(qn.groupId);kt(c,`No group element found for id "${c}"`);const u=gp(c,r),f=E6(c,t,r);kt(f!==null,`No resize element found for id "${t}"`);const m=i.shiftKey?f>0?f-1:u.length-1:f+1<u.length?f+1:0;u[m].focus();break}}};return a.addEventListener("keydown",s),()=>{a.removeEventListener("keydown",s)}},[r,e,t,n])}function A6({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:a,onBlur:s,onClick:i,onDragging:c,onFocus:u,onPointerDown:f,onPointerUp:m,style:h={},tabIndex:b=0,tagName:y="div",...x}){var E,w;const _=v.useRef(null),S=v.useRef({onClick:i,onDragging:c,onPointerDown:f,onPointerUp:m});v.useEffect(()=>{S.current.onClick=i,S.current.onDragging=c,S.current.onPointerDown=f,S.current.onPointerUp=m});const T=v.useContext(ev);if(T===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:R,groupId:C,registerResizeHandle:I,startDragging:A,stopDragging:O,panelGroupElement:j}=T,U=b1(a),[B,W]=v.useState("inactive"),[J,ee]=v.useState(!1),[re,F]=v.useState(null),K=v.useRef({state:B});_l(()=>{K.current.state=B}),v.useEffect(()=>{if(n)F(null);else{const D=I(U);F(()=>D)}},[n,U,I]);const V=(E=r?.coarse)!==null&&E!==void 0?E:15,ne=(w=r?.fine)!==null&&w!==void 0?w:5;v.useEffect(()=>{if(n||re==null)return;const D=_.current;kt(D,"Element ref not attached");let H=!1;return Lye(U,D,R,{coarse:V,fine:ne},(L,M,z)=>{if(!M){W("inactive");return}switch(L){case"down":{W("drag"),H=!1,kt(z,'Expected event to be defined for "down" action'),A(U,z);const{onDragging:G,onPointerDown:q}=S.current;G?.(!0),q?.();break}case"move":{const{state:G}=K.current;H=!0,G!=="drag"&&W("hover"),kt(z,'Expected event to be defined for "move" action'),re(z);break}case"up":{W("hover"),O();const{onClick:G,onDragging:q,onPointerUp:ae}=S.current;q?.(!1),ae?.(),H||G?.();break}}})},[V,R,n,ne,I,U,re,A,O]),qye({disabled:n,handleId:U,resizeHandler:re,panelGroupElement:j});const te={touchAction:"none",userSelect:"none"};return v.createElement(y,{...x,children:e,className:t,id:a,onBlur:()=>{ee(!1),s?.()},onFocus:()=>{ee(!0),u?.()},ref:_,role:"separator",style:{...te,...h},tabIndex:b,[qn.groupDirection]:R,[qn.groupId]:C,[qn.resizeHandle]:"",[qn.resizeHandleActive]:B==="drag"?"pointer":J?"keyboard":void 0,[qn.resizeHandleEnabled]:!n,[qn.resizeHandleId]:U,[qn.resizeHandleState]:B})}A6.displayName="PanelResizeHandle";function aa({className:e,...t}){return d.jsx(R6,{"data-slot":"resizable-panel-group",className:Oe("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function Rn({...e}){return d.jsx(d6,{"data-slot":"resizable-panel",...e})}function vo({withHandle:e,className:t,...n}){return d.jsx(A6,{"data-slot":"resizable-handle",className:Oe("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&&d.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:d.jsx(Use,{className:"size-2.5"})})})}function Xp({className:e,...t}){return d.jsx("kbd",{"data-slot":"kbd",className:Oe("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 Xye({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:r,onSearchExpand:a,onSearchChange:s,onSearchBlur:i,onClearAll:c,searchInputRef:u}){return d.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[d.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?d.jsx(Tn,{ref:u,placeholder:"Search notifications...",value:t,onChange:f=>s(f.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Notifications"}),d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,disabled:r===0,className:"h-8 w-8 p-0",children:d.jsx(Ii,{className:"h-4 w-4"})})}),d.jsx(Lt,{side:"bottom",children:"Clear all"})]})})]})}function Bi({id:e,isSelected:t,isFocused:n,icon:r,title:a,description:s,metadata:i,onClick:c,className:u}){return d.jsx("button",{id:e,type:"button",onClick:c,className:Oe("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:d.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[r&&d.jsx("div",{className:"flex-shrink-0 mt-1",children:d.jsx("div",{className:Oe("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:r})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"flex items-center gap-2 mb-1",children:d.jsx("h3",{className:Oe("font-medium truncate font-mono text-sm"),children:a})}),s&&d.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:s})]})]})})}function Jye({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:r,formatRelativeTime:a,listRef:s}){return e.length===0?d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No notifications yet"})}):d.jsx("div",{ref:s,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((i,c)=>d.jsx(Bi,{id:`notification-${i.id}`,isSelected:t?.id===i.id,isFocused:r===c,title:d.jsxs("span",{className:"flex items-center gap-3",children:[i.method,!i.read&&d.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const u=a(i.timestamp),f=i.params&&Object.keys(i.params).length>0?Object.keys(i.params).length:0,m=f>0?` | ${f} param${f>1?"s":""}`:"";return u+m})(),onClick:()=>n(i)},i.id))})}function Qye({notification:e,previewMode:t,onTogglePreview:n,onCopy:r,onDownload:a,onFullscreen:s,isCopied:i=!1,onClose:c}){return e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.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:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(Ou,{className:"h-3 w-3 text-gray-400"}),d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.formatRelativeTime(e.timestamp)})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsxs(De,{variant:"ghost",size:"sm",onClick:n,className:t?"":"text-purple-600 dark:text-purple-400",children:[t?d.jsx(G_,{className:"h-4 w-4 mr-1"}):d.jsx(S3,{className:"h-4 w-4 mr-1"}),t?"JSON":"Formatted"]}),d.jsx(De,{variant:"ghost",size:"sm",onClick:r,children:i?d.jsx(oa,{className:"h-4 w-4"}):d.jsx(zr,{className:"h-4 w-4"})}),d.jsx(De,{variant:"ghost",size:"sm",onClick:a,children:d.jsx(Lp,{className:"h-4 w-4"})}),d.jsx(De,{variant:"ghost",size:"sm",onClick:s,children:d.jsx(Y_,{className:"h-4 w-4"})}),c&&d.jsx(De,{variant:"ghost",size:"sm",onClick:c,children:d.jsx(Ko,{className:"h-4 w-4"})})]})]}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{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`})})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(H_,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a notification to view details"})]})}function Vb(e){const n=Date.now()-e,r=Math.floor(n/1e3),a=Math.floor(r/60),s=Math.floor(a/60),i=Math.floor(s/24);return r<60?"just now":a<60?`${a}m ago`:s<24?`${s}h ago`:i<7?`${i}d ago`:new Date(e).toLocaleDateString()}function eve({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:r,clearNotifications:a,serverId:s,isConnected:i}){const[c,u]=v.useState(null),[f,m]=v.useState(""),[h,b]=v.useState(-1),[y,x]=v.useState(!0),[E,w]=v.useState(!1),[_,S]=v.useState(!0),[T,R]=v.useState(!1),C=v.useRef(null),I=v.useRef(null),A=v.useRef(null),O=v.useRef(!1);v.useEffect(()=>{y&&e.length>0&&C.current&&!O.current&&(C.current.scrollTop=0)},[e.length,y]),v.useEffect(()=>{const K=C.current;if(!K)return;const V=()=>{K.scrollTop>0&&(O.current=!0,x(!1))};return K.addEventListener("scroll",V),()=>K.removeEventListener("scroll",V)},[]),v.useEffect(()=>{e.length===0&&(O.current=!1,x(!0))},[e.length]),v.useEffect(()=>{c&&!c.read&&n(c.id)},[c,n]),v.useEffect(()=>{E&&A.current&&A.current.focus()},[E]);const j=v.useCallback(()=>{f.trim()||w(!1)},[f]),U=v.useMemo(()=>{if(!f.trim())return e;const K=f.toLowerCase();return e.filter(V=>V.method.toLowerCase().includes(K)||JSON.stringify(V.params||{}).toLowerCase().includes(K))},[e,f]);v.useEffect(()=>{b(-1)},[f]),v.useEffect(()=>{const K=V=>{const ne=V.target;if(ne.tagName==="INPUT"||ne.tagName==="TEXTAREA"||ne.contentEditable==="true"||V.metaKey||V.ctrlKey||V.altKey)return;const D=U;if(V.key==="ArrowDown")V.preventDefault(),b(H=>{const $=H+1;return $>=D.length?0:$});else if(V.key==="ArrowUp")V.preventDefault(),b(H=>{const $=H-1;return $<0?D.length-1:$});else if(V.key==="Enter"&&h>=0){V.preventDefault();const H=U[h];H&&B(H)}};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[h,U]),v.useEffect(()=>{if(h>=0){const K=`notification-${U[h]?.id}`,V=document.getElementById(K);V&&V.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,U]);const B=v.useCallback(K=>{u(K)},[]),W=v.useCallback(()=>{window.confirm("Are you sure you want to clear all notifications? This cannot be undone.")&&(a(),u(null))},[a]),J=v.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)),R(!0),setTimeout(()=>R(!1),2e3)}catch(K){console.error("[NotificationsTab] Failed to copy notification:",K)}},[c]),ee=v.useCallback(()=>{if(c)try{const K=new globalThis.Blob([JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)],{type:"application/json"}),V=URL.createObjectURL(K),ne=document.createElement("a");ne.href=V,ne.download=`notification-${Date.now()}.json`,document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(V)}catch(K){console.error("[NotificationsTab] Failed to download notification:",K)}},[c]),re=v.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(K){console.error("[NotificationsTab] Failed to toggle fullscreen:",K)}},[]),F=c?{method:c.method,params:c.params,timestamp:c.timestamp,read:c.read,formatRelativeTime:Vb}:null;return i?d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:40,minSize:30,children:d.jsx(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:d.jsxs(Rn,{defaultSize:75,minSize:30,children:[d.jsx(Xye,{isSearchExpanded:E,searchQuery:f,filteredNotificationsCount:U.length,notificationsCount:e.length,onSearchExpand:()=>w(!0),onSearchChange:m,onSearchBlur:j,onClearAll:W,searchInputRef:A}),d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(Jye,{notifications:U,selectedNotification:c,onNotificationSelect:B,focusedIndex:h,formatRelativeTime:Vb,listRef:C})})]})})}),d.jsx(vo,{}),d.jsx(Rn,{defaultSize:60,minSize:40,children:d.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:d.jsx(Qye,{notification:F,previewMode:_,onTogglePreview:()=>S(!_),onCopy:J,onDownload:ee,onFullscreen:re,onClose:()=>u(null),isCopied:T})})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(H_,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function I6({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:r,secondaryTabTitle:a,primaryCount:s,secondaryCount:i,secondaryIcon:c,primaryIcon:u,searchPlaceholder:f="Search...",onSearchExpand:m,onSearchChange:h,onSearchBlur:b,onTabSwitch:y,searchInputRef:x,primaryTabName:E}){const w=e===E;return d.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[d.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?d.jsx(Tn,{ref:x,placeholder:f,value:n,onChange:_=>h(_.target.value),onBlur:b,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:w?r:a}),w&&d.jsxs(d.Fragment,{children:[d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:s}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})]})}),d.jsxs(De,{variant:"ghost",size:"sm",onClick:y,className:"gap-2 flex-shrink-0",children:[w?d.jsx(c,{}):d.jsx(u,{}),d.jsx("span",{className:"hidden sm:inline",children:w?a:r}),w&&i>0&&d.jsx(kr,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:i})]})]})}function A$({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:r}){return e.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(Qf,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):d.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((a,s)=>d.jsx(Bi,{id:`prompt-${a.name}`,isSelected:t?.name===a.name,isFocused:r===s,icon:d.jsx(Qf,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.arguments&&a.arguments.length>0&&d.jsxs(kr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[a.arguments.length," args"]}),onClick:()=>n(a)},a.name))})}function I$({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:r,savedPromptsCount:a,onSearchExpand:s,onSearchChange:i,onSearchBlur:c,onTabSwitch:u,searchInputRef:f}){return d.jsx(I6,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:r,secondaryCount:a,primaryIcon:Qf,secondaryIcon:Ou,searchPlaceholder:"Search prompts...",onSearchExpand:s,onSearchChange:i,onSearchBlur:c,onTabSwitch:u,searchInputRef:f})}function O$({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:r,focusedIndex:a}){return e.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(Ou,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),d.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):d.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((s,i)=>d.jsx(Bi,{id:`saved-prompt-${s.id}`,isSelected:t?.id===s.id,isFocused:a===i,icon:d.jsx(Ou,{className:"h-4 w-4"}),title:s.name,description:`${s.promptName} - ${new Date(s.savedAt).toLocaleString()}`,onClick:()=>n(s)},s.id))})}function tve({selectedPrompt:e,promptArgs:t,onArgChange:n}){const r=e?.arguments||[];if(!(r.length>0))return d.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const s=i=>{const c=i.name,u=t[c],f=typeof u=="string"?u:JSON.stringify(u);return i.type==="boolean"?d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:c,className:"text-sm font-medium",children:[c,i.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("input",{id:c,type:"checkbox",checked:!!u,onChange:m=>n(c,m.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),d.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:i.description})]})]},c):i.type==="number"?d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:c,className:"text-sm font-medium",children:[c,i.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsx(Tn,{id:c,type:"number",value:Number(u)||0,onChange:m=>n(c,Number(m.target.value)),placeholder:i.description||`Enter ${c}`}),i.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i.description})]},c):i.type==="array"||i.type==="object"?d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:c,className:"text-sm font-medium",children:[c,i.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsx(Dl,{id:c,value:f,onChange:m=>{try{const h=JSON.parse(m.target.value);n(c,h)}catch{n(c,m.target.value)}},placeholder:i.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),i.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i.description})]},c):d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:c,className:"text-sm font-medium",children:[c,i.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsx(Tn,{id:c,value:f,onChange:m=>n(c,m.target.value),placeholder:i.description||`Enter ${c}`}),i.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i.description})]},c)};return d.jsx("div",{className:"space-y-4",children:r.map(i=>s(i))})}function D$({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:r,onArgChange:a,onExecute:s,onSave:i}){return v.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&e&&!n&&r&&(u.preventDefault(),s())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n,r,s]),e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:d.jsxs("div",{children:[d.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[d.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),d.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[d.jsx(De,{onClick:s,disabled:n||!r,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?d.jsxs(d.Fragment,{children:[d.jsx(Vo,{className:"mr-2"}),d.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):d.jsxs(d.Fragment,{children:[d.jsx(k3,{className:"h-4 w-4 sm:mr-2"}),d.jsx("span",{className:"hidden sm:inline",children:"Execute"}),d.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:"⌘↵"})]})}),d.jsxs(De,{variant:"outline",onClick:i,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[d.jsx(Z_,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),e.description&&d.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:d.jsx(tve,{selectedPrompt:e,promptArgs:t,onArgChange:a})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),d.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 nve(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 L$({results:e,copiedResult:t,onCopy:n}){return d.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:d.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:e.length>0?d.jsx("div",{className:"space-y-4 flex-1 h-full",children:e.map((r,a)=>{const s=r.error||nve(r.result);return d.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[d.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[d.jsx("h3",{className:"text-sm font-medium",children:"Response"}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(Ou,{className:"h-3 w-3 text-gray-400"}),d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(r.timestamp).toLocaleTimeString()})]}),r.duration!==void 0&&d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(ep,{className:"h-3 w-3 text-gray-400"}),d.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[r.duration,"ms"]})]}),d.jsx("div",{className:"flex gap-2 ml-auto",children:d.jsx(De,{variant:"ghost",size:"sm",onClick:()=>n(a,r.result),className:"h-6 px-2",children:t===a?d.jsx(oa,{className:"h-4 w-4"}):d.jsx(zr,{className:"h-4 w-4"})})})]}),s?d.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:[d.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),d.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:s})]}):d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{data:r.result,filename:`prompt-result-${r.promptName}-${Date.now()}.json`})})]},a)})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function v1({serverIds:e,onCountChange:t,onClearRef:n}={}){const[r,a]=v.useState([]),s=v.useRef(null),[i,c]=v.useState(new Set),[u]=v.useState(""),f=y=>{c(x=>{const E=new Set(x);return E.has(y)?E.delete(y):E.add(y),E})},m=async()=>{a([]),c(new Set),t?.(0);try{const y=new URLSearchParams;e&&e.length>0&&y.set("serverIds",e.join(","));const x=await fetch(`/inspector/api/rpc/log?${y.toString()}`,{method:"DELETE"});x.ok||console.warn("[RPC Logger] Failed to clear server buffer:",x.status)}catch(y){console.warn("[RPC Logger] Error clearing server buffer:",y)}},h=v.useMemo(()=>!e||e.length===0?"":[...e].sort().join(","),[e]);v.useEffect(()=>(n&&(n.current=m),()=>{n&&(n.current=null)}),[n,m]),v.useEffect(()=>{t?.(r.length)},[r.length,t]),v.useEffect(()=>{let y=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 E=`/inspector/api/rpc/stream?${x.toString()}`;console.log("[RPC Logger] Connecting to SSE stream:",E),y=new globalThis.EventSource(E),y.onopen=()=>{console.log("[RPC Logger] SSE connection opened")},y.onmessage=w=>{try{const _=JSON.parse(w.data);if(!_||_.type!=="rpc")return;const{serverId:S,direction:T,message:R,timestamp:C}=_,I=R,A=typeof I?.method=="string"?I.method:I?.result!==void 0?"result":I?.error!==void 0?"error":"unknown",O={id:`${C??Date.now()}-${Math.random().toString(36).slice(2)}`,serverId:typeof S=="string"?S:"unknown",direction:typeof T=="string"?T.toUpperCase():"",method:A,timestamp:C??new Date().toISOString(),payload:R};console.log("[RPC Logger] Received RPC event:",{method:A,direction:T,serverId:S}),a(j=>{const U=[O,...j].slice(0,1e3);return t?.(U.length),U})}catch(_){console.error("[RPC Logger] Error parsing SSE message:",_)}},y.onerror=w=>{console.error("[RPC Logger] SSE connection error:",w);try{y?.close()}catch{}}}catch(x){console.error("[RPC Logger] Failed to create SSE connection:",x)}return()=>{try{y?.close(),console.log("[RPC Logger] SSE connection closed")}catch{}}},[h]);const b=v.useMemo(()=>{let y=r;if(e&&e.length>0){const x=new Set(e);y=y.filter(E=>x.has(E.serverId))}if(u.trim()){const x=u.toLowerCase();y=y.filter(E=>E.serverId.toLowerCase().includes(x)||E.method.toLowerCase().includes(x)||E.direction.toLowerCase().includes(x)||JSON.stringify(E.payload).toLowerCase().includes(x))}return y},[r,u,e]);return d.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:d.jsx("div",{ref:s,className:"flex-1 min-h-0 overflow-y-auto",children:b.length===0?d.jsxs("div",{className:"text-center py-8",children:[d.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages yet"}),d.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:"JSON-RPC messages will appear here"})]}):b.map(y=>{const x=i.has(y.id);return d.jsxs("div",{className:"group hover:bg-muted/50 transition-all duration-200 overflow-hidden",children:[d.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>f(y.id),children:[d.jsx("div",{className:"flex-shrink-0",children:x?d.jsx(Fl,{className:"h-3 w-3 text-muted-foreground transition-transform"}):d.jsx(ose,{className:"h-3 w-3 text-muted-foreground transition-transform"})}),d.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[d.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:new Date(y.timestamp).toLocaleTimeString()}),d.jsx("span",{className:`flex items-center justify-center px-1 py-0.5 rounded ${y.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:y.direction==="RECEIVE"?"Incoming":"Outgoing",children:y.direction==="RECEIVE"?d.jsx(Koe,{className:"h-3 w-3"}):d.jsx(Zoe,{className:"h-3 w-3"})}),d.jsx("span",{className:"text-xs font-mono text-foreground truncate",children:y.method})]})]}),x&&d.jsx("div",{className:"border-t bg-muted/20",children:d.jsx("div",{className:"p-3",children:d.jsx("div",{className:"max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2",children:d.jsx(nr,{data:y.payload})})})})]},y.id)})})})}const M$="mcp-inspector-saved-prompts";function O6({ref:e,prompts:t,callPrompt:n,serverId:r,isConnected:a}){const[s,i]=v.useState(null),[c,u]=v.useState(null),{selectedPromptName:f,setSelectedPromptName:m}=Bl(),[h,b]=v.useState({}),[y,x]=v.useState([]),[E,w]=v.useState(!1),[_,S]=v.useState(null),[T,R]=v.useState(""),[C,I]=v.useState("prompts"),[A,O]=v.useState([]),[j,U]=v.useState(!1),[B,W]=v.useState(""),[J,ee]=v.useState(!1),[re,F]=v.useState(-1),K=v.useRef(null),[V,ne]=v.useState(!1),[te,D]=v.useState("list"),[H,$]=v.useState(0),[L,M]=v.useState(!0),z=v.useRef(null),G=v.useRef(null);v.useEffect(()=>{const Ee=()=>{ne(window.innerWidth<1024)};return Ee(),window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)},[]),v.useEffect(()=>{D(s?"detail":"list")},[s]),v.useEffect(()=>{V&&y.length>0&&!E&&D("response")},[y,E,V]),v.useImperativeHandle(e,()=>({focusSearch:()=>{ee(!0),setTimeout(()=>{K.current&&K.current.focus()},0)},blurSearch:()=>{R(""),ee(!1),K.current&&K.current.blur()}})),v.useEffect(()=>{try{const Ee=localStorage.getItem(M$);if(Ee){const _e=JSON.parse(Ee);O(_e)}}catch(Ee){console.error("[PromptsTab] Failed to load saved prompts:",Ee)}},[]);const q=v.useCallback(Ee=>{try{localStorage.setItem(M$,JSON.stringify(Ee))}catch(_e){console.error("[PromptsTab] Failed to save prompts:",_e)}},[]);v.useEffect(()=>{J&&K.current&&K.current.focus()},[J]);const ae=v.useCallback(()=>{T.trim()||ee(!1)},[T]),ie=v.useMemo(()=>{if(!T.trim())return t;const Ee=T.toLowerCase();return t.filter(_e=>_e.name.toLowerCase().includes(Ee)||_e.description?.toLowerCase().includes(Ee))},[t,T]),X=v.useCallback(Ee=>{i(Ee);const _e={};Ee.arguments&&Ee.arguments.forEach(Ue=>{Ue.default!==void 0?_e[Ue.name]=Ue.default:Ue.type==="string"?_e[Ue.name]="":Ue.type==="number"?_e[Ue.name]=0:Ue.type==="boolean"?_e[Ue.name]=!1:Ue.type==="array"?_e[Ue.name]=[]:Ue.type==="object"&&(_e[Ue.name]={})}),b(_e)},[]),Z=v.useCallback(Ee=>{const _e=t.find(Ue=>Ue.name===Ee.promptName);_e&&(i(_e),b(Ee.args),u(Ee))},[t]);v.useEffect(()=>{F(-1)},[T,C]),v.useEffect(()=>{const Ee=_e=>{const Ue=_e.target;if(Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.contentEditable==="true"||_e.metaKey||_e.ctrlKey||_e.altKey)return;const Ae=C==="prompts"?ie:A;if(_e.key==="ArrowDown")_e.preventDefault(),F(ze=>{const we=ze+1;return we>=Ae.length?0:we});else if(_e.key==="ArrowUp")_e.preventDefault(),F(ze=>{const we=ze-1;return we<0?Ae.length-1:we});else if(_e.key==="Enter"&&re>=0)if(_e.preventDefault(),C==="prompts"){const ze=ie[re];ze&&X(ze)}else{const ze=A[re];ze&&Z(ze)}};return document.addEventListener("keydown",Ee),()=>document.removeEventListener("keydown",Ee)},[re,ie,A,C,X,Z]),v.useEffect(()=>{if(re>=0){const Ee=C==="prompts"?`prompt-${ie[re]?.name}`:`saved-prompt-${A[re]?.id}`,_e=document.getElementById(Ee);_e&&_e.scrollIntoView({behavior:"smooth",block:"nearest"})}},[re,ie,A,C]),v.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:f,promptsCount:t.length,currentSelectedPrompt:s?.name}),f&&t.length>0){const Ee=t.find(_e=>_e.name===f);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:f,promptFound:!!Ee,promptName:Ee?.name,shouldSelect:Ee&&s?.name!==Ee.name}),Ee&&s?.name!==Ee.name){console.warn("[PromptsTab] Selecting prompt:",Ee.name),m(null);const _e=setTimeout(()=>{X(Ee);const Ue=document.getElementById(`prompt-${Ee.name}`);Ue&&(console.warn("[PromptsTab] Scrolling to prompt element"),Ue.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(_e)}}},[f,t,s,X,m]);const se=v.useCallback((Ee,_e)=>{b(Ue=>({...Ue,[Ee]:_e}))},[]),me=v.useCallback(async()=>{if(!s||E)return;w(!0);const Ee=Date.now();try{const _e=await n(s.name,h),Ue=Date.now()-Ee;Tr.getInstance().capture(new qj({promptName:s.name,serverId:r,success:!0})).catch(()=>{}),x(Ae=>[{promptName:s.name,args:h,result:_e,timestamp:Ee,duration:Ue},...Ae])}catch(_e){Tr.getInstance().capture(new qj({promptName:s.name,serverId:r,success:!1,error:_e instanceof Error?_e.message:"Unknown error"})).catch(()=>{});const fe={promptName:s.name,args:h,result:null,error:_e instanceof Error?_e.message:String(_e),timestamp:Ee,duration:Date.now()-Ee};x(Ae=>[fe,...Ae])}finally{w(!1)}},[s,h,E,n,r]),le=v.useCallback(async(Ee,_e)=>{try{await navigator.clipboard.writeText(JSON.stringify(_e,null,2)),S(Ee),setTimeout(()=>S(null),2e3)}catch(Ue){console.error("[PromptsTab] Failed to copy result:",Ue)}},[]),Te=v.useCallback(()=>{s&&(W(""),U(!0))},[s]),Be=v.useCallback(Ee=>{q(A.filter(_e=>_e.id!==Ee)),c?.id===Ee&&u(null)},[A,q,c]);return V?d.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[te!=="list"&&d.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[d.jsx(De,{variant:"ghost",size:"sm",onClick:()=>{te==="response"?D("detail"):(i(null),D("list"))},className:"p-0 h-8 w-8",children:d.jsx(V_,{className:"h-4 w-4"})}),d.jsxs("div",{className:"flex items-center text-sm font-medium",children:[d.jsx("button",{onClick:()=>{i(null),D("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),te!=="list"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("button",{onClick:()=>{te==="response"&&D("detail")},className:te==="detail"?"text-foreground hover:underline":te==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),te==="response"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),d.jsx("div",{className:"flex-1 relative overflow-hidden",children:d.jsxs(Oy,{initial:!1,mode:"popLayout",children:[te==="list"&&d.jsxs(wa.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:[d.jsx(I$,{activeTab:C,isSearchExpanded:J,searchQuery:T,filteredPromptsCount:ie.length,savedPromptsCount:A.length,onSearchExpand:()=>ee(!0),onSearchChange:R,onSearchBlur:ae,onTabSwitch:()=>I(C==="prompts"?"saved":"prompts"),searchInputRef:K}),C==="prompts"?d.jsx(A$,{prompts:ie,selectedPrompt:s,onPromptSelect:X,focusedIndex:re}):d.jsx(O$,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:Z,onDeletePrompt:Be,focusedIndex:re})]},"list"),te==="detail"&&d.jsx(wa.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:d.jsx(D$,{selectedPrompt:s,promptArgs:h,isExecuting:E,isConnected:a,onArgChange:se,onExecute:me,onSave:Te})},"detail"),te==="response"&&d.jsx(wa.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:d.jsx(L$,{results:y,copiedResult:_,onCopy:le})},"response")]})})]}):d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:33,className:"flex flex-col h-full relative",children:d.jsxs(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[d.jsx(Rn,{defaultSize:75,minSize:30,children:d.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[d.jsx(I$,{activeTab:C,isSearchExpanded:J,searchQuery:T,filteredPromptsCount:ie.length,savedPromptsCount:A.length,onSearchExpand:()=>ee(!0),onSearchChange:R,onSearchBlur:ae,onTabSwitch:()=>I(C==="prompts"?"saved":"prompts"),searchInputRef:K}),C==="prompts"?d.jsx(A$,{prompts:ie,selectedPrompt:s,onPromptSelect:X,focusedIndex:re}):d.jsx(O$,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:Z,onDeletePrompt:Be,focusedIndex:re})]})}),d.jsx(vo,{withHandle:!0}),d.jsxs(Rn,{ref:z,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>M(!0),onExpand:()=>M(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[d.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),L?(z.current?.resize(25),M(!1)):(z.current?.resize(5),M(!0))},children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),H>0&&d.jsx(kr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:H}),H>0&&!L&&d.jsx(De,{variant:"ghost",size:"sm",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),G.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:d.jsx(Ii,{className:"h-3.5 w-3.5"})})]}),d.jsx(Fl,{className:`h-4 w-4 text-muted-foreground transition-transform ${L?"rotate-180":""}`})]}),!L&&d.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:d.jsx(v1,{serverIds:[r],onCountChange:$,onClearRef:G})})]})]})}),d.jsx(vo,{withHandle:!0}),d.jsx(Rn,{defaultSize:67,children:d.jsxs(aa,{direction:"vertical",children:[d.jsx(Rn,{defaultSize:40,children:d.jsx(D$,{selectedPrompt:s,promptArgs:h,isExecuting:E,isConnected:a,onArgChange:se,onExecute:me,onSave:Te})}),d.jsx(vo,{withHandle:!0}),d.jsx(Rn,{defaultSize:50,children:d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(L$,{results:y,copiedResult:_,onCopy:le})})})]})})]})}O6.displayName="PromptsTab";function mu(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 rve(e){return{uri:e.uri,mimeType:e.mimeType,text:e.text,blob:e.blob}}function D6({resource:e,onUIAction:t,className:n}){const r=async s=>t?.(s),a=rve(e);return d.jsx("div",{className:n,children:d.jsx(h1,{resource:a,onUIAction:r,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:[mye,pye,hye,gye],library:m1}})})}function ave(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(`
1668
1668
  `)}return"An error occurred"}function j$({result:e,isLoading:t,previewMode:n,serverId:r,readResource:a,onTogglePreview:s,onCopy:i,onDownload:c,onFullscreen:u,isCopied:f=!1}){let m=[],h;if(e?.resourceAnnotations&&(m=Object.keys(e.resourceAnnotations).filter(w=>w.startsWith("openai/")),h=e.resourceAnnotations["openai/outputTemplate"]),e?.result?.contents?.[0]?._meta){const w=e.result.contents[0]._meta,_=Object.keys(w).filter(S=>S.startsWith("openai/"));_.length>0&&(m=[...m,..._]),!h&&w["openai/outputTemplate"]&&(h=w["openai/outputTemplate"]),!h&&e.uri&&e.uri.startsWith("ui://widget/")&&(h=e.uri)}const b=!!(m.length>0&&h&&typeof h=="string"&&r&&a);if(t)return d.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:d.jsx(Vo,{className:"size-5"})});if(!e)return d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),d.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});const y=e.error||ave(e.result);if(y)return d.jsx("div",{className:"p-4",children:d.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[d.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),d.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:y})]})});const x=e?.result?.contents&&Array.isArray(e.result.contents)&&e.result.contents.some(w=>w.mimeType&&mu(w)),E=x?e.result.contents.filter(w=>w.mimeType&&mu(w)):[];return d.jsxs("div",{className:"flex flex-col h-full",children:[d.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:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(Ou,{className:"h-3 w-3 text-gray-400"}),d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),(()=>{const w=e?.duration??e.result?.duration??e.result?.metrics?.durationMs;return w!==void 0?d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(ep,{className:"h-3 w-3 text-gray-400"}),d.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[w,"ms"]})]}):null})(),x&&d.jsx(kr,{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"}),b&&d.jsx(kr,{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"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[(x||b)&&d.jsxs(De,{variant:"ghost",size:"sm",onClick:s,className:n?"":"text-purple-600 dark:text-purple-400",children:[n?d.jsx(G_,{className:"h-4 w-4 mr-1"}):d.jsx(S3,{className:"h-4 w-4 mr-1"}),n?"JSON":b?"Component":"Preview"]}),d.jsx(De,{variant:"ghost",size:"sm",onClick:i,children:f?d.jsx(oa,{className:"h-4 w-4"}):d.jsx(zr,{className:"h-4 w-4"})}),d.jsx(De,{variant:"ghost",size:"sm",onClick:c,children:d.jsx(Lp,{className:"h-4 w-4"})}),d.jsx(De,{variant:"ghost",size:"sm",onClick:u,children:d.jsx(Y_,{className:"h-4 w-4"})})]})]}),d.jsx("div",{className:"flex-1 overflow-y-auto",children:b&&r&&a&&h?n?d.jsx("div",{className:"flex-1 h-full",children:d.jsx(c1,{componentUrl:h,toolName:e.uri,toolArgs:{},toolResult:e.result,serverId:r,readResource:a,className:"w-full h-full relative flex p-4"})}):d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})}):x?n?d.jsxs("div",{className:"space-y-0 h-full",children:[E.map((w,_)=>d.jsx("div",{className:"mx-0 size-full",children:d.jsx("div",{className:"w-full h-full",children:d.jsx(D6,{resource:w,className:"w-full h-full"})})},`mcp-ui-${w.uri||`resource-${Date.now()}-${Math.random()}`}`)),(()=>{if(e.result.contents&&Array.isArray(e.result.contents)){const w=e.result.contents.filter(_=>!(_.mimeType&&mu(_)));if(w.length>0)return d.jsx("div",{className:"px-4",children:d.jsx(nr,{data:w,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-non-ui-${Date.now()}.json`})})}return null})()]}):d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-mcp-ui-${Date.now()}.json`})}):d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]})}function ove(e,t){if(!e&&!t)return d.jsx(Ose,{className:"h-5 w-5"});const n=(e||t||"").toLowerCase();return n.includes("image")?d.jsx(Rse,{className:"h-5 w-5"}):n.includes("json")||n.includes("javascript")||n.includes("typescript")?d.jsx(kse,{className:"h-5 w-5"}):n.includes("html")||n.includes("xml")?d.jsx(jse,{className:"h-5 w-5"}):n.includes("database")||n.includes("sql")?d.jsx(Ny,{className:"h-5 w-5"}):d.jsx(W_,{className:"h-5 w-5"})}function P$({resources:e,selectedResource:t,onResourceSelect:n,focusedIndex:r}){return e.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(Ny,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):d.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((a,s)=>{const i=ove(a.mimeType,a.uri),c=[a.description,a.mimeType&&d.jsx("span",{className:"font-mono",children:a.mimeType},"mime")].filter(Boolean);return d.jsx(Bi,{id:`resource-${a.uri}`,isSelected:t?.uri===a.uri,isFocused:r===s,icon:i,title:a.name,description:c.length>0?d.jsxs("span",{className:"flex flex-col gap-1",children:[a.description&&d.jsx("span",{children:a.description}),a.mimeType&&d.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:a.mimeType})]}):void 0,onClick:()=>n(a)},a.uri)})})}function U$({isSearchExpanded:e,searchQuery:t,filteredResourcesCount:n,onSearchExpand:r,onSearchChange:a,onSearchBlur:s,searchInputRef:i}){return d.jsx("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:d.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?d.jsx(Tn,{ref:i,placeholder:"Search resources...",value:t,onChange:c=>a(c.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})})})}function L6({ref:e,resources:t,readResource:n,serverId:r,isConnected:a}){const[s,i]=v.useState(null),{selectedResourceUri:c,setSelectedResourceUri:u}=Bl(),[f,m]=v.useState(null),[h,b]=v.useState(!1),[y,x]=v.useState(""),[E]=v.useState("resources"),[w,_]=v.useState(!0),[S,T]=v.useState(!1),[R,C]=v.useState(-1),[I,A]=v.useState(!1),O=v.useRef(null),j=v.useRef(null),[U,B]=v.useState(!1),[W,J]=v.useState("list"),[ee,re]=v.useState(0),[F,K]=v.useState(!0),V=v.useRef(null),ne=v.useRef(null);v.useEffect(()=>{const z=()=>{B(window.innerWidth<1024)};return z(),window.addEventListener("resize",z),()=>window.removeEventListener("resize",z)},[]),v.useEffect(()=>{J(s?"detail":"list")},[s]),v.useImperativeHandle(e,()=>({focusSearch:()=>{T(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{x(""),T(!1),O.current&&O.current.blur()}})),v.useEffect(()=>{S&&O.current&&O.current.focus()},[S]);const te=v.useCallback(()=>{y.trim()||T(!1)},[y]),D=v.useMemo(()=>{if(!y)return t;const z=y.toLowerCase();return t.filter(G=>G.name.toLowerCase().includes(z)||G.description?.toLowerCase().includes(z)||G.uri.toLowerCase().includes(z))},[t,y]),H=v.useCallback(async z=>{if(i(z),a){b(!0);const G=Date.now();try{const q=await n(z.uri);Tr.getInstance().capture(new Zj({resourceUri:z.uri,serverId:r,success:!0})).catch(()=>{}),m({uri:z.uri,result:q,timestamp:G,resourceAnnotations:z.annotations})}catch(q){Tr.getInstance().capture(new Zj({resourceUri:z.uri,serverId:r,success:!1,error:q instanceof Error?q.message:"Unknown error"})).catch(()=>{}),m({uri:z.uri,result:null,error:q instanceof Error?q.message:"Unknown error",timestamp:G,resourceAnnotations:z.annotations})}finally{b(!1)}}},[n,r,a]);v.useEffect(()=>{C(-1)},[y,E]),v.useEffect(()=>{const z=G=>{const q=G.target;if(q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.contentEditable==="true"||G.metaKey||G.ctrlKey||G.altKey)return;const ie=D;if(G.key==="ArrowDown")G.preventDefault(),C(X=>{const Z=X+1;return Z>=ie.length?0:Z});else if(G.key==="ArrowUp")G.preventDefault(),C(X=>{const Z=X-1;return Z<0?ie.length-1:Z});else if(G.key==="Enter"&&R>=0){G.preventDefault();const X=D[R];X&&H(X)}};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[R,D,H]),v.useEffect(()=>{if(R>=0){const z=`resource-${D[R]?.uri}`,G=document.getElementById(z);G&&G.scrollIntoView({behavior:"smooth",block:"nearest"})}},[R,D]),v.useEffect(()=>{if(c&&t.length>0){const z=t.find(G=>G.uri===c);z&&s?.uri!==z.uri&&(u(null),setTimeout(()=>{H(z);const G=document.getElementById(`resource-${z.uri}`);G&&G.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,t,s,H,u]);const $=v.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify(f.result,null,2)),A(!0),setTimeout(()=>A(!1),2e3)}catch(z){console.error("[ResourcesTab] Failed to copy result:",z)}},[f]),L=v.useCallback(()=>{if(f)try{const z=new globalThis.Blob([JSON.stringify(f.result,null,2)],{type:"application/json"}),G=URL.createObjectURL(z),q=document.createElement("a");q.href=G,q.download=`resource-${Date.now()}.json`,document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(G)}catch(z){console.error("[ResourcesTab] Failed to download result:",z)}},[f]),M=v.useCallback(async()=>{if(j.current)try{document.fullscreenElement?await document.exitFullscreen():await j.current.requestFullscreen()}catch(z){console.error("[ResourcesTab] Failed to toggle fullscreen:",z)}},[]);return U?d.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[W!=="list"&&d.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[d.jsx(De,{variant:"ghost",size:"sm",onClick:()=>{i(null),J("list")},className:"p-0 h-8 w-8",children:d.jsx(V_,{className:"h-4 w-4"})}),d.jsxs("div",{className:"flex items-center text-sm font-medium",children:[d.jsx("button",{onClick:()=>{i(null),J("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Resources"}),W==="detail"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("span",{className:"text-foreground",children:"Content"})]})]})]}),d.jsx("div",{className:"flex-1 relative overflow-hidden",children:d.jsxs(Oy,{initial:!1,mode:"popLayout",children:[W==="list"&&d.jsxs(wa.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:[d.jsx(U$,{activeTab:E,isSearchExpanded:S,searchQuery:y,filteredResourcesCount:D.length,onSearchExpand:()=>T(!0),onSearchChange:x,onSearchBlur:te,onTabSwitch:()=>{},searchInputRef:O}),d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(P$,{resources:D,selectedResource:s,onResourceSelect:H,focusedIndex:R})})]},"list"),W==="detail"&&d.jsx(wa.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:d.jsx("div",{ref:j,className:"h-full",children:d.jsx(j$,{result:f,isLoading:h,previewMode:w,serverId:r,readResource:n,onTogglePreview:()=>_(!w),onCopy:$,onDownload:L,onFullscreen:M,isCopied:I})})},"detail")]})})]}):d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:25,children:d.jsxs(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[d.jsx(Rn,{defaultSize:75,minSize:30,children:d.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[d.jsx(U$,{activeTab:E,isSearchExpanded:S,searchQuery:y,filteredResourcesCount:D.length,onSearchExpand:()=>T(!0),onSearchChange:x,onSearchBlur:te,onTabSwitch:()=>{},searchInputRef:O}),d.jsx(P$,{resources:D,selectedResource:s,onResourceSelect:H,focusedIndex:R})]})}),d.jsx(vo,{withHandle:!0}),d.jsxs(Rn,{ref:V,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>K(!0),onExpand:()=>K(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[d.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:z=>{z.preventDefault(),z.stopPropagation(),F?(V.current?.resize(25),K(!1)):(V.current?.resize(5),K(!0))},children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),ee>0&&d.jsx(kr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:ee}),ee>0&&!F&&d.jsx(De,{variant:"ghost",size:"sm",onClick:z=>{z.preventDefault(),z.stopPropagation(),ne.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:d.jsx(Ii,{className:"h-3.5 w-3.5"})})]}),d.jsx(Fl,{className:`h-4 w-4 text-muted-foreground transition-transform ${F?"":"rotate-180"}`})]}),!F&&d.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:d.jsx(v1,{serverIds:[r],onCountChange:re,onClearRef:ne})})]})]})}),d.jsx(vo,{}),d.jsx(Rn,{defaultSize:50,children:d.jsx(aa,{direction:"vertical",children:d.jsx(Rn,{defaultSize:70,children:d.jsx("div",{ref:j,className:"h-full bg-white dark:bg-zinc-900",children:d.jsx(j$,{result:f,isLoading:h,previewMode:w,serverId:r,readResource:n,onTogglePreview:()=>_(!w),onCopy:$,onDownload:L,onFullscreen:M,isCopied:I})})})})})]})}L6.displayName="ResourcesTab";function $$({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:r,focusedIndex:a}){if(e.length===0)return d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(Ny,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),d.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const s=(i,c)=>{i.stopPropagation(),c()};return d.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((i,c)=>d.jsxs("div",{className:"relative group",children:[d.jsx(Bi,{id:`saved-${i.id}`,isSelected:t?.id===i.id,isFocused:a===c,icon:d.jsx(hb,{className:"h-4 w-4"}),title:i.name,description:i.toolName,metadata:d.jsx("div",{className:"flex flex-col gap-1",children:d.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(i.savedAt).toLocaleString()})}),onClick:()=>n(i)}),d.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"secondary",size:"sm",onClick:u=>s(u,()=>r(i.id)),className:"h-8 w-8 p-0",children:d.jsx(Ii,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:d.jsx("p",{children:"Delete saved request"})})]})})]},i.id))})}function z$({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:r,onSave:a,onCancel:s}){return e?d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:s,children:d.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:i=>i.stopPropagation(),children:[d.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx(Wt,{htmlFor:"request-name",children:"Request Name (optional)"}),d.jsx(Tn,{id:"request-name",value:t,onChange:i=>r(i.target.value),placeholder:n,className:"mt-2",onKeyDown:i=>{i.key==="Enter"&&a()},autoFocus:!0})]}),d.jsxs("div",{className:"flex justify-end gap-2",children:[d.jsx(De,{variant:"outline",onClick:s,children:"Cancel"}),d.jsxs(De,{onClick:a,children:[d.jsx(Z_,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function M6(e,t){if(!e?.$ref)return e;const n=e.$ref;if(n.startsWith("#/")){const r=n.substring(2).split("/");let a=t;for(const s of r)if(a&&typeof a=="object"&&s in a)a=a[s];else return console.warn(`Could not resolve $ref: ${n}`),e;return a}return e}function sve(e,t){if(e.anyOf&&Array.isArray(e.anyOf)){const n=e.anyOf.find(r=>r.type!=="null");if(n)return{...M6(n,t),nullable:!0}}return e}function ive(e){return Array.isArray(e.enum)?e.enum:null}function F$({selectedTool:e,toolArgs:t,onArgChange:n}){const r=e?.inputSchema?.properties||{},a=e?.inputSchema?.required||[];return Object.keys(r).length>0?d.jsx("div",{className:"space-y-4",children:Object.entries(r).map(([i,c])=>{const u=e?.inputSchema||{};let f=sve(c,u);f=M6(f,u);const m=ive(f),h=f.type==="string"&&m!==null,b=f;b.required=a.includes(i);const y=t[i];let x="";return y!=null&&(typeof y=="string"?x=y:typeof y=="object"&&y!==null?x=JSON.stringify(y,null,2):x=String(y)),b.type==="object"||b.type==="array"?d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:i,className:"text-sm font-medium",children:[i,b?.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsx(Dl,{id:i,value:x,onChange:w=>n(i,w.target.value),placeholder:b?.description||`Enter ${i}`,className:"min-h-[100px]"}),b?.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:b.description})]},i):h&&m?d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:i,className:"text-sm font-medium",children:[i,b.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsxs(_s,{value:String(t[i]||""),onValueChange:w=>n(i,w),children:[d.jsx(Ns,{id:i,className:"w-full",children:d.jsx(Ts,{placeholder:b.description||"Select an option"})}),d.jsx(ks,{children:m.map((w,_)=>d.jsx(Pr,{value:w,children:b.enumNames?.[_]||w},w))})]}),b.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:b.description})]},i):d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:i,className:"text-sm font-medium",children:[i,b?.required&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),d.jsx(Tn,{id:i,value:x,onChange:w=>n(i,w.target.value),placeholder:b?.description||`Enter ${i}`}),b?.description&&d.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:b.description})]},i)})}):d.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function B$({selectedTool:e,toolArgs:t,isExecuting:n,isConnected:r,onArgChange:a,onExecute:s,onSave:i,onCancel:c}){const[u,f]=v.useState(!1),[m,h]=v.useState(()=>{if(typeof window<"u"){const E=localStorage.getItem("mcp-inspector-show-tool-metadata");return E?JSON.parse(E):!1}return!1}),[b,y]=v.useState(!1);v.useEffect(()=>{typeof window<"u"&&localStorage.setItem("mcp-inspector-show-tool-metadata",JSON.stringify(m))},[m]);const x=()=>{if(!e)return;const E={name:e.name,description:e.description||"",_meta:e._meta};navigator.clipboard.writeText(JSON.stringify(E,null,2)),y(!0),setTimeout(()=>y(!1),2e3)};return v.useEffect(()=>{const E=w=>{(w.metaKey||w.ctrlKey)&&w.key==="Enter"&&e&&!n&&r&&(w.preventDefault(),s()),w.key==="Escape"&&n&&c&&(w.preventDefault(),c())};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[e,n,r,s,c]),e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("div",{className:"flex-shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-4 sm:pr-4",children:d.jsxs("div",{children:[d.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[d.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),d.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsxs(De,{variant:m?"default":"outline",onClick:()=>h(!m),disabled:n,size:"sm",className:"lg:size-default gap-2",title:"Toggle tool metadata",children:[d.jsx(G_,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Metadata"})]})}),d.jsx(Lt,{children:d.jsx("p",{children:"Show tool definition metadata"})})]}),d.jsxs(De,{variant:"outline",onClick:i,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[d.jsx(Z_,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),n&&c?d.jsxs(Ot,{open:u?void 0:!1,children:[d.jsx(Dt,{asChild:!0,children:d.jsx("div",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),className:"relative",children:d.jsx(De,{onClick:c,variant:u?"destructive":"default",size:"sm",className:"lg:size-default gap-2 transition-all",children:u?d.jsxs(d.Fragment,{children:[d.jsx(Ko,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Cancel"}),d.jsx("span",{className:"hidden sm:inline text-[12px] border border-current p-1 rounded-full ml-2",children:"Esc"})]}):d.jsxs(d.Fragment,{children:[d.jsx(Vo,{className:"mr-2"}),d.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]})})})}),d.jsx(Lt,{children:d.jsx("p",{children:"Hover to cancel (or press Esc)"})})]}):d.jsx(De,{onClick:s,disabled:n||!r,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?d.jsxs(d.Fragment,{children:[d.jsx(Vo,{className:"mr-2"}),d.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):d.jsxs(d.Fragment,{children:[d.jsx(k3,{className:"h-4 w-4 sm:mr-2"}),d.jsx("span",{className:"hidden sm:inline",children:"Execute"}),d.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&&d.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),m?d.jsxs("div",{className:"flex-1 overflow-hidden flex gap-4 px-3 sm:px-6 pb-4",children:[d.jsx("div",{className:"flex-1 min-w-0 overflow-y-auto",children:d.jsx(F$,{selectedTool:e,toolArgs:t,onArgChange:a})}),d.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:[d.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-zinc-200 dark:border-zinc-800 flex-shrink-0",children:[d.jsx("h4",{className:"text-sm font-medium",children:"Tool Definition"}),d.jsx(De,{variant:"ghost",size:"sm",onClick:x,className:"h-7 w-7 p-0",title:"Copy metadata",children:b?d.jsx(oa,{className:"h-3.5 w-3.5 text-green-600"}):d.jsx(zr,{className:"h-3.5 w-3.5"})})]}),d.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:d.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)})})]})]}):d.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:d.jsx(F$,{selectedTool:e,toolArgs:t,onArgChange:a})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),d.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 H$(e){const n=Date.now()-e,r=Math.floor(n/1e3),a=Math.floor(r/60),s=Math.floor(a/60),i=Math.floor(s/24);return r<10?"now":r<60?`${r}s ago`:a<60?`${a}m ago`:s<24?`${s}h ago`:`${i}d ago`}function lve(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(`
1669
1669
  `)}return"An error occurred"}function cve(e){try{return JSON.parse(e),!0}catch{return!1}}function uve({content:e}){return!Array.isArray(e)||e.length===0?d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content"}):d.jsx("div",{className:"space-y-4",children:e.map((t,n)=>{if(t.type==="text"){const r=t.text||"";if(cve(r))try{const a=JSON.parse(r);return d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content (JSON)"}),d.jsx(nr,{data:a,filename:`content-${n}.json`})]},n)}catch{}return d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content"}),d.jsx("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words",children:r})]},n)}if(t.type==="image")return d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Image Content"}),d.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[d.jsx("img",{src:`data:${t.mimeType||"image/png"};base64,${t.data}`,alt:"Result",className:"max-w-full rounded"}),t.annotations&&d.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:d.jsx(nr,{data:t.annotations,filename:`image-annotations-${n}.json`})})]})]},n);if(t.type==="audio")return d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Audio Content"}),d.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[d.jsx("audio",{controls:!0,src:`data:${t.mimeType||"audio/wav"};base64,${t.data}`,className:"w-full"}),t.annotations&&d.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:d.jsx(nr,{data:t.annotations,filename:`audio-annotations-${n}.json`})})]})]},n);if(t.type==="resource_link")return d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Resource Link"}),d.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[d.jsxs("div",{className:"font-mono text-sm break-all",children:[d.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",t.uri]}),t.name&&d.jsxs("div",{className:"text-sm",children:[d.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Name:"})," ",t.name]}),t.description&&d.jsxs("div",{className:"text-sm",children:[d.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Description:"})," ",t.description]}),t.mimeType&&d.jsxs("div",{className:"text-sm",children:[d.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",t.mimeType]}),t.annotations&&d.jsxs("div",{className:"mt-2",children:[d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),d.jsx(nr,{data:t.annotations,filename:`resource-link-annotations-${n}.json`})]})]})]},n);if(t.type==="resource"){const r=t.resource||{};return d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Embedded Resource"}),d.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[d.jsxs("div",{className:"font-mono text-sm break-all",children:[d.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",r.uri]}),r.mimeType&&d.jsxs("div",{className:"text-sm",children:[d.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",r.mimeType]}),r.text&&d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Content:"}),d.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:r.text})]}),r.blob&&d.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["[Binary content: ",r.blob.length||0," bytes]"]}),r.annotations&&d.jsxs("div",{className:"mt-2",children:[d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),d.jsx(nr,{data:r.annotations,filename:`resource-annotations-${n}.json`})]})]})]},n)}return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Unknown Content Type: ",t.type||"N/A"]}),d.jsx(nr,{data:t,filename:`content-${n}.json`})]},n)})})}function V$({results:e,copiedResult:t,previewMode:n,serverId:r,readResource:a,onCopy:s,onTogglePreview:i,onMaximize:c,isMaximized:u=!1}){const[f,m]=v.useState(0),[h,b]=v.useState(""),[y,x]=v.useState(!0),E=e[0],w=E?e.filter(ee=>ee.toolName===E.toolName):[],_=w[f]||w[0],S=e.findIndex(ee=>ee===_);v.useEffect(()=>{w.length>0&&f>=w.length&&m(0)},[w.length,f]),v.useEffect(()=>{const ee=()=>{_&&b(H$(_.timestamp))};ee();const re=setInterval(ee,1e3);return()=>clearInterval(re)},[_]);const T=v.useMemo(()=>_?.args,[_?.timestamp,f]),R=v.useMemo(()=>_?.result,[_?.timestamp,f]),C=v.useCallback(ee=>a(ee),[a]);if(e.length===0)return d.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:d.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})});const I=_.toolMeta?.["openai/outputTemplate"],A=!!(I&&typeof I=="string"&&_.appsSdkResource),O=I,j=_.result?.content||[],U=j.filter(ee=>ee.type==="resource"&&mu(ee.resource)),B=U.length>0,W=!!(j&&j.length>0||_.result?.structuredContent),J=!B&&!A&&W;return d.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:d.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:d.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[d.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${B||A||J?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[d.jsx("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),_.duration!==void 0&&d.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[d.jsx(ep,{className:"h-3 w-3 text-gray-400"}),d.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[_.duration,"ms"]})]}),A&&d.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[d.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",O||"No URI"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:()=>i(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),d.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),d.jsx("button",{onClick:()=>i(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),B&&!A&&d.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[d.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",U[0]?.resource?.uri||"No URI"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:()=>i(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),d.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),d.jsx("button",{onClick:()=>i(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),J&&d.jsxs("div",{className:"flex items-center gap-2 sm:ml-4",children:[d.jsx("button",{onClick:()=>x(!0),className:`text-xs font-medium ${y?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Formatted"}),d.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),d.jsx("button",{onClick:()=>x(!1),className:`text-xs font-medium ${y?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw"})]}),d.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(A||B)&&c&&d.jsx(De,{variant:"ghost",size:"sm",onClick:c,title:u?"Restore":"Maximize",children:u?d.jsx(Zse,{className:"h-4 w-4"}):d.jsx(Y_,{className:"h-4 w-4"})}),w.length>1&&d.jsxs(_s,{value:f.toString(),onValueChange:ee=>m(parseInt(ee)),children:[d.jsx(Ns,{size:"sm",className:"w-[140px] h-8 text-xs",children:d.jsx(Ts,{children:d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(hb,{className:"h-3 w-3"}),d.jsx("span",{children:h})]})})}),d.jsx(ks,{children:w.map((ee,re)=>d.jsx(Pr,{value:re.toString(),children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(hb,{className:"h-3 w-3"}),d.jsx("span",{children:H$(ee.timestamp)}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",new Date(ee.timestamp).toLocaleTimeString(),")"]})]})},re))})]}),d.jsx(De,{variant:"ghost",size:"sm",onClick:()=>s(S,_.result),children:t===S?d.jsx(oa,{className:"h-4 w-4"}):d.jsx(zr,{className:"h-4 w-4"})})]})]}),(()=>{const ee=_.error||lve(_.result);return ee?d.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:[d.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),d.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:ee})]}):(()=>{if(A){const re=_.appsSdkResource;return re.isLoading?d.jsx(d.Fragment,{}):re.error?d.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:[d.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),d.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:re.error})]}):n?d.jsx("div",{className:"flex-1",children:d.jsx(c1,{componentUrl:O,toolName:_.toolName,toolArgs:T,toolResult:R,serverId:r,readResource:C,className:"w-full h-full relative p-4"})}):d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{data:_.result,filename:`tool-result-${_.toolName}-${Date.now()}.json`})})}if(B)return n?d.jsxs("div",{className:"space-y-0 h-full",children:[U.map((re,F)=>d.jsx("div",{className:"mx-0 size-full",children:d.jsx(D6,{resource:re.resource,onUIAction:K=>{},className:"w-full h-full relative"})},F)),j.filter(re=>!(re.type==="resource"&&mu(re.resource))).length>0&&d.jsx("div",{className:"px-4",children:d.jsx(nr,{data:j.filter(re=>!(re.type==="resource"&&mu(re.resource))),filename:`tool-result-${_.toolName}-non-ui-${Date.now()}.json`})})]}):d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{data:_.result,filename:`tool-result-${_.toolName}-mcp-ui-${Date.now()}.json`})});if(J&&y){const re=_.result?.structuredContent;return d.jsxs("div",{className:"px-4 pt-4 space-y-4",children:[re&&d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Structured Content"}),d.jsx(nr,{data:re,filename:`structured-content-${_.toolName}-${Date.now()}.json`})]}),j&&j.length>0&&d.jsx(uve,{content:j}),!re&&(!j||j.length===0)&&d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content to display"})]})}return d.jsx("div",{className:"px-4 pt-4",children:d.jsx(nr,{data:_.result,filename:`tool-result-${_.toolName}-${Date.now()}.json`})})})()})()]})})})}function G$({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:r}){return e.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(Cl,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):d.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((a,s)=>d.jsx(Bi,{id:`tool-${a.name}`,isSelected:t?.name===a.name,isFocused:r===s,icon:d.jsx(Cl,{className:"h-4 w-4"}),title:a.name,description:a.description,metadata:a.inputSchema?.properties&&d.jsxs(kr,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(a.inputSchema.properties).length," params"]}),onClick:()=>n(a)},a.name))})}function W$({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredToolsCount:r,savedRequestsCount:a,onSearchExpand:s,onSearchChange:i,onSearchBlur:c,onTabSwitch:u,searchInputRef:f}){return d.jsx(I6,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:r,secondaryCount:a,primaryIcon:Cl,secondaryIcon:Ny,searchPlaceholder:"Search tools...",onSearchExpand:s,onSearchChange:i,onSearchBlur:c,onTabSwitch:u,searchInputRef:f})}const K$="mcp-inspector-saved-requests";function j6({ref:e,tools:t,callTool:n,readResource:r,serverId:a,isConnected:s}){const[i,c]=v.useState(null),[u,f]=v.useState(null),{selectedToolName:m,setSelectedToolName:h}=Bl(),[b,y]=v.useState({}),[x,E]=v.useState([]),[w,_]=v.useState(!1),[S,T]=v.useState(null),[R,C]=v.useState(null),[I,A]=v.useState(""),[O,j]=v.useState("tools"),[U,B]=v.useState([]),[W,J]=v.useState(!1),[ee,re]=v.useState(""),[F,K]=v.useState(!0),[V,ne]=v.useState(!1),[te,D]=v.useState(-1),H=v.useRef(null),[$,L]=v.useState(!1),[M,z]=v.useState("list"),[G,q]=v.useState(!1),[ae,ie]=v.useState(0),[X,Z]=v.useState(!0),[se,me]=v.useState(void 0),le=v.useRef(null),Te=v.useRef(null),Be=v.useRef(null),Ee=v.useRef(null),_e=v.useRef(null);v.useEffect(()=>{const Ie=()=>{L(window.innerWidth<1024)};return Ie(),window.addEventListener("resize",Ie),()=>window.removeEventListener("resize",Ie)},[]),v.useEffect(()=>{z(i?"detail":"list")},[i]),v.useEffect(()=>{$&&x.length>0&&!w&&z("response")},[x,w,$]),v.useImperativeHandle(e,()=>({focusSearch:()=>{ne(!0),setTimeout(()=>{H.current&&H.current.focus()},0)},blurSearch:()=>{A(""),ne(!1),H.current&&H.current.blur()}})),v.useEffect(()=>{try{const Ie=localStorage.getItem(K$);Ie&&B(JSON.parse(Ie))}catch(Ie){console.error("[ToolsTab] Failed to load saved requests:",Ie)}},[]);const Ue=v.useCallback(Ie=>{try{localStorage.setItem(K$,JSON.stringify(Ie)),B(Ie)}catch(Me){console.error("[ToolsTab] Failed to save requests:",Me)}},[]),fe=v.useMemo(()=>{if(!I.trim())return t;const Ie=I.toLowerCase();return t.filter(Me=>Me.name.toLowerCase().includes(Ie)||Me.description?.toLowerCase().includes(Ie))},[t,I]),Ae=v.useCallback(Ie=>{c(Ie);const Me={};Ie.inputSchema?.properties&&Object.entries(Ie.inputSchema.properties).forEach(([He,it])=>{const pt=it;pt.default!==void 0?Me[He]=pt.default:pt.type==="string"?Me[He]="":pt.type==="number"?Me[He]=0:pt.type==="boolean"?Me[He]=!1:pt.type==="array"?Me[He]="[]":pt.type==="object"&&(Me[He]="{}")}),y(Me)},[]),ze=v.useCallback(Ie=>{const Me=t.find(He=>He.name===Ie.toolName);Me&&(c(Me),y(Ie.args),f(Ie))},[t]);v.useEffect(()=>{V&&H.current&&H.current.focus()},[V]);const we=v.useCallback(()=>{I.trim()||ne(!1)},[I]);v.useEffect(()=>{O!=="tools"&&ne(!1)},[O]),v.useEffect(()=>{D(-1)},[I,O]),v.useEffect(()=>{const Ie=Me=>{const He=Me.target;if(He.tagName==="INPUT"||He.tagName==="TEXTAREA"||He.contentEditable==="true"||Me.metaKey||Me.ctrlKey||Me.altKey)return;const pt=O==="tools"?fe:U;if(Me.key==="ArrowDown")Me.preventDefault(),D(Et=>{const xt=Et+1;return xt>=pt.length?0:xt});else if(Me.key==="ArrowUp")Me.preventDefault(),D(Et=>{const xt=Et-1;return xt<0?pt.length-1:xt});else if(Me.key==="Enter"&&te>=0)if(Me.preventDefault(),O==="tools"){const Et=fe[te];Et&&Ae(Et)}else{const Et=U[te];Et&&ze(Et)}};return document.addEventListener("keydown",Ie),()=>document.removeEventListener("keydown",Ie)},[te,fe,U,O,Ae,ze]),v.useEffect(()=>{if(te>=0){const Ie=O==="tools"?`tool-${fe[te]?.name}`:`saved-${U[te]?.id}`,Me=document.getElementById(Ie);Me&&Me.scrollIntoView({behavior:"smooth",block:"nearest"})}},[te,fe,U,O]),v.useEffect(()=>{if(m&&t.length>0){const Ie=t.find(Me=>Me.name===m);if(Ie&&i?.name!==Ie.name){h(null);const Me=setTimeout(()=>{Ae(Ie);const He=document.getElementById(`tool-${Ie.name}`);He&&He.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Me)}}},[m,t,i,Ae,h]);const at=v.useCallback((Ie,Me)=>{y(He=>{const it={...He};if(i?.inputSchema?.properties?.[Ie]){const Et=i.inputSchema.properties[Ie].type;if(Et==="object"||Et==="array")it[Ie]=Me;else if(Et==="string")it[Ie]=Me;else try{it[Ie]=JSON.parse(Me)}catch{it[Ie]=Me}}else it[Ie]=Me;return it})},[i]),lt=v.useCallback(async()=>{if(!i||w)return;const Ie=new AbortController;C(Ie),_(!0);const Me=Date.now();try{const He={...b};i.inputSchema?.properties&&Object.entries(i.inputSchema.properties).forEach(([Ze,vt])=>{const Pt=vt.type,yr=He[Ze];if((Pt==="object"||Pt==="array")&&typeof yr=="string")try{He[Ze]=JSON.parse(yr)}catch{}});const it=await n(i.name,He,{timeout:6e5,resetTimeoutOnProgress:!0,signal:Ie.signal}),pt=Date.now()-Me;Tr.getInstance().capture(new Yj({toolName:i.name,serverId:a,success:!0,duration:pt})).catch(()=>{});const xt=i?._meta||i?.metadata,un=xt?.["openai/outputTemplate"];let mn;if(un&&typeof un=="string"){const Ze={toolName:i.name,args:b,result:it,timestamp:Me,duration:pt,toolMeta:xt,appsSdkResource:{uri:un,resourceData:null,isLoading:!0}};E([Ze]);try{const vt=await r(un);let jt=null;if(it?.structuredContent)jt=it.structuredContent;else if(Array.isArray(it)&&it[0]){const Pt=it[0];Pt.output?.value?.structuredContent?jt=Pt.output.value.structuredContent:Pt.structuredContent?jt=Pt.structuredContent:Pt.output?.value&&(jt=Pt.output.value)}jt||(jt=it),mn={uri:un,resourceData:{...vt,structuredContent:jt},isLoading:!1}}catch(vt){mn={uri:un,resourceData:null,isLoading:!1,error:vt instanceof Error?vt.message:String(vt)}}E(vt=>vt.map((jt,Pt)=>Pt===0?{...jt,appsSdkResource:mn}:jt))}else E(Ze=>[{toolName:i.name,args:b,result:it,timestamp:Me,duration:pt,toolMeta:xt},...Ze])}catch(He){const it=Date.now()-Me;Tr.getInstance().capture(new Yj({toolName:i.name,serverId:a,success:!1,duration:it,error:He instanceof Error?He.message:String(He)})).catch(()=>{});const Et=i?._meta||i?.metadata,xt={toolName:i.name,args:b,result:null,error:He instanceof Error?He.message:String(He),timestamp:Me,duration:it,toolMeta:Et},un=Et?.["openai/outputTemplate"];E(un?[xt]:mn=>[xt,...mn])}finally{_(!1)}},[i,b,w,n,r,a]),gt=v.useCallback(async(Ie,Me)=>{try{await navigator.clipboard.writeText(JSON.stringify(Me,null,2)),T(Ie),setTimeout(()=>T(null),2e3)}catch(He){console.error("[ToolsTab] Failed to copy result:",He)}},[]),Ct=v.useCallback(Ie=>{E(Me=>Me.filter((He,it)=>it!==Ie))},[]),Le=v.useMemo(()=>i?x.filter(Ie=>Ie.toolName===i.name):[],[x,i]),$e=v.useCallback(Ie=>{const Me=Le[Ie];if(Me){const He=window.open("","_blank","width=800,height=600");He&&(He.document.write(`
1670
1670
  <html>
@@ -1680,4 +1680,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1680
1680
  <pre>${JSON.stringify(Me.result,null,2)}</pre>
1681
1681
  </body>
1682
1682
  </html>
1683
- `),He.document.close())}},[x]),bt=v.useCallback(()=>{G?(le.current&&le.current.expand(),Te.current&&Te.current.expand(),q(!1)):(le.current&&le.current.collapse(),Te.current&&Te.current.collapse(),q(!0))},[G]),nt=v.useCallback(()=>{i&&(re(""),J(!0))},[i]),Ut=v.useCallback(()=>{if(!i)return;const Ie={id:`${Date.now()}-${Math.random()}`,name:ee.trim()||`${i.name} - ${new Date().toLocaleString()}`,toolName:i.name,args:b,savedAt:Date.now(),serverId:i._serverId,serverName:i._serverName};Ue([...U,Ie]),Tr.getInstance().capture(new Loe({toolName:i.name,serverId:a})).catch(()=>{}),J(!1),re("")},[i,ee,b,U,Ue,a]),st=v.useCallback(Ie=>{Ue(U.filter(Me=>Me.id!==Ie)),u?.id===Ie&&f(null)},[U,Ue,u]);return $?d.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[M!=="list"&&d.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[d.jsx(De,{variant:"ghost",size:"sm",onClick:()=>{M==="response"?z("detail"):(c(null),z("list"))},className:"p-0 h-8 w-8",children:d.jsx(V_,{className:"h-4 w-4"})}),d.jsxs("div",{className:"flex items-center text-sm font-medium",children:[d.jsx("button",{onClick:()=>{c(null),z("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Tools"}),M==="detail"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("button",{onClick:()=>{z("response")},className:M==="detail"?"text-foreground hover:underline":M==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),M==="response"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),d.jsx("div",{className:"flex-1 relative overflow-hidden",children:d.jsxs(Oy,{initial:!1,mode:"popLayout",children:[M==="list"&&d.jsxs(wa.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:[d.jsx(W$,{activeTab:O,isSearchExpanded:V,searchQuery:I,filteredToolsCount:fe.length,savedRequestsCount:U.length,onSearchExpand:()=>ne(!0),onSearchChange:A,onSearchBlur:we,onTabSwitch:()=>j(O==="tools"?"saved":"tools"),searchInputRef:H}),O==="tools"?d.jsx(G$,{tools:fe,selectedTool:i,onToolSelect:Ae,focusedIndex:te}):d.jsx($$,{savedRequests:U,selectedRequest:u,onLoadRequest:ze,onDeleteRequest:st,focusedIndex:te})]},"list"),M==="detail"&&d.jsx(wa.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:d.jsx(B$,{selectedTool:i,toolArgs:b,isExecuting:w,isConnected:s,onArgChange:at,onExecute:lt,onSave:nt})},"detail"),M==="response"&&d.jsx(wa.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:d.jsx(V$,{results:Le,copiedResult:S,previewMode:F,serverId:a,readResource:r,onCopy:gt,onDelete:Ct,onFullscreen:$e,onTogglePreview:()=>K(!F)})},"response")]})}),d.jsx(z$,{isOpen:W,requestName:ee,defaultPlaceholder:`${i?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:re,onSave:Ut,onCancel:()=>J(!1)})]}):d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{ref:le,defaultSize:33,collapsible:!0,className:"flex flex-col h-full relative",children:d.jsxs(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[d.jsx(Rn,{defaultSize:75,minSize:30,children:d.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[d.jsx(W$,{activeTab:O,isSearchExpanded:V,searchQuery:I,filteredToolsCount:fe.length,savedRequestsCount:U.length,onSearchExpand:()=>ne(!0),onSearchChange:A,onSearchBlur:we,onTabSwitch:()=>j(O==="tools"?"saved":"tools"),searchInputRef:H}),O==="tools"?d.jsx(G$,{tools:fe,selectedTool:i,onToolSelect:Ae,focusedIndex:te}):d.jsx($$,{savedRequests:U,selectedRequest:u,onLoadRequest:ze,onDeleteRequest:st,focusedIndex:te})]})}),d.jsx(vo,{withHandle:!0}),d.jsxs(Rn,{ref:Ee,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:[d.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:Ie=>{Ie.preventDefault(),Ie.stopPropagation(),X?(Ee.current?.resize(25),Z(!1)):(Ee.current?.resize(5),Z(!0))},children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),ae>0&&d.jsx(kr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:ae}),ae>0&&!X&&d.jsx(De,{variant:"ghost",size:"sm",onClick:Ie=>{Ie.preventDefault(),Ie.stopPropagation(),_e.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:d.jsx(Ii,{className:"h-3.5 w-3.5"})})]}),d.jsx(Fl,{className:`h-4 w-4 text-muted-foreground transition-transform ${X?"":"rotate-180"}`})]}),!X&&d.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:d.jsx(v1,{serverIds:[a],onCountChange:ie,onClearRef:_e})})]})]})}),d.jsx(vo,{withHandle:!0}),d.jsx(Rn,{defaultSize:67,children:d.jsxs(aa,{direction:"vertical",children:[d.jsx(Rn,{ref:Te,defaultSize:40,collapsible:!0,children:d.jsx(B$,{selectedTool:i,toolArgs:b,isExecuting:w,isConnected:s,onArgChange:at,onExecute:lt,onSave:nt,onCancel:()=>{R&&R.abort()}})}),d.jsx(vo,{withHandle:!0}),d.jsx(Rn,{ref:Be,defaultSize:60,children:d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(V$,{results:Le,copiedResult:S,previewMode:F,serverId:a,readResource:r,onCopy:gt,onDelete:Ct,onFullscreen:$e,onTogglePreview:()=>K(!F),onMaximize:bt,isMaximized:G})})})]})}),d.jsx(z$,{isOpen:W,requestName:ee,defaultPlaceholder:`${i?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:re,onSave:Ut,onCancel:()=>J(!1)})]})}j6.displayName="ToolsTab";function dve({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:r,onSearchExpand:a,onSearchChange:s,onSearchBlur:i,onRejectAll:c,searchInputRef:u}){return d.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[d.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?d.jsx(Tn,{ref:u,placeholder:"Search requests...",value:t,onChange:f=>s(f.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Sampling"}),d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,disabled:r===0,className:"h-8 w-8 p-0",children:d.jsx(Ii,{className:"h-4 w-4"})})}),d.jsx(Lt,{side:"bottom",children:"Reject all"})]})})]})}function fve({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:r,formatRelativeTime:a,listRef:s}){return e.length===0?d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No sampling requests"})}):d.jsx("div",{ref:s,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((i,c)=>{const u=i.request.params?.messages?.length||0,f=i.request.params?.maxTokens;return d.jsx(Bi,{id:`sampling-request-${i.id}`,isSelected:t?.id===i.id,isFocused:r===c,title:d.jsxs("span",{className:"flex items-center gap-3",children:[i.serverName,d.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const m=a(i.timestamp),h=[];u>0&&h.push(`${u} message${u>1?"s":""}`),f&&h.push(`max ${f} tokens`);const b=h.length>0?` | ${h.join(", ")}`:"";return m+b})(),onClick:()=>n(i)},i.id)})})}function pve({llmConfig:e}){const t=v.useRef(null);return{generateResponse:v.useCallback(async({request:r})=>{if(!e)throw new Error("LLM config is not available");const a=r.params||{},s=a.maxTokens,i=a.temperature;a.modelPreferences;const c=a.messages||[];if(console.log("[useSamplingLLM] Request structure:",{hasParams:!!a,messagesCount:c.length,messages:c,params:a}),c.length===0)throw new Error("No messages found in sampling request");const u=[],{HumanMessage:f,AIMessage:m}=await hr(async()=>{const{HumanMessage:x,AIMessage:E}=await import("./index-Dpg6KEQB.js").then(w=>w.bE);return{HumanMessage:x,AIMessage:E}},[]);for(const x of c){if(!x||!x.role){console.warn("Skipping invalid message:",x);continue}const E=Array.isArray(x.content)?x.content[0]:x.content;if(!E){console.warn("Skipping message with no content:",x);continue}E.type==="text"&&E.text?x.role==="user"?u.push(new f(E.text)):x.role==="assistant"&&u.push(new m(E.text)):console.warn("Skipping message with unsupported content type:",E)}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 E={model:e.model,apiKey:e.apiKey};if(s!==void 0&&(E.maxTokens=s),i!==void 0?E.temperature=i:e.temperature!==void 0&&(E.temperature=e.temperature),e.provider==="openai"){const{ChatOpenAI:w}=await hr(async()=>{const{ChatOpenAI:_}=await import("./index-BzY2KYX6.js");return{ChatOpenAI:_}},__vite__mapDeps([5,6,7,3,8,9]));x=new w(E)}else if(e.provider==="anthropic"){const{ChatAnthropic:w}=await hr(async()=>{const{ChatAnthropic:_}=await import("./index-BHtVf3QS.js");return{ChatAnthropic:_}},__vite__mapDeps([10,7,6,3]));x=new w(E)}else if(e.provider==="google"){const{ChatGoogleGenerativeAI:w}=await hr(async()=>{const{ChatGoogleGenerativeAI:_}=await import("./index-CSbVdovT.js");return{ChatGoogleGenerativeAI:_}},__vite__mapDeps([11,7,6,3,9]));x=new w(E)}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 mve({request:e,onApprove:t,onReject:n,onClose:r,previewMode:a,onTogglePreview:s,isCopied:i,onCopy:c,onDownload:u,onFullscreen:f,llmConfig:m}){const[h,b]=v.useState("manual"),[y,x]=v.useState("stub-model"),[E,w]=v.useState("endTurn"),[_,S]=v.useState("assistant"),[T,R]=v.useState("text"),[C,I]=v.useState("positive"),[A,O]=v.useState(""),[j,U]=v.useState("image/png"),[B,W]=v.useState(!1),[J,ee]=v.useState(null),{generateResponse:re,isAvailable:F}=pve({llmConfig:m});v.useEffect(()=>{e&&(x("stub-model"),w("endTurn"),S("assistant"),R("text"),I("positive"),O(""),U("image/png"),ee(null))},[e?.id]);const K=async()=>{if(!(!e||!F)){W(!0),ee(null);try{const D=await re({request:e.request});x(D.model||m?.model||"stub-model"),w(D.stopReason||"endTurn"),S(D.role||"assistant");const H=Array.isArray(D.content)?D.content[0]:D.content;H.type==="text"?(R("text"),I(H.text||"")):H.type==="image"&&(R("image"),O(H.data||""),U(H.mimeType||"image/png"))}catch(D){const H=D instanceof Error?D.message:"Failed to generate response";ee(H),Xt.error("LLM Generation Failed",{description:H})}finally{W(!1)}}},V=v.useMemo(()=>{const D={model:y,stopReason:E,role:_,content:{type:T}};return T==="text"?D.content.text=C:T==="image"&&(D.content.data=A,D.content.mimeType=j),D},[y,E,_,T,C,A,j]),ne=()=>{if(!e)return;const D=r_.safeParse(V);if(!D.success){Xt.error("Invalid response",{description:`Validation failed: ${D.error.message}`});return}t(e.id,D.data),r(),hr(()=>Promise.resolve().then(()=>Hu),void 0).then(H=>{const $=Xt(H.createElement("div",{className:"space-y-3"},H.createElement("div",null,H.createElement("strong",null,"Sampling Response Sent"),H.createElement("p",{className:"text-sm text-muted-foreground mt-1"},"The tool will continue executing.")),H.createElement("div",{className:"flex gap-2"},H.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($)}},"View Tool Result"))),{duration:5e3})})},te=()=>{e&&(n(e.id,"User rejected sampling request"),r())};return e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"flex items-center justify-between p-4 border-b dark:border-zinc-700",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.serverName}),d.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleString()})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0",children:i?d.jsx(oa,{className:"h-4 w-4 text-green-600"}):d.jsx(zr,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Copy request"})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:d.jsx(Lp,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Download request"})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:f,className:"h-8 w-8 p-0",children:d.jsx(K_,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Fullscreen"})]}),d.jsx(De,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:d.jsx(Ko,{className:"h-4 w-4"})})]})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Request"}),d.jsx("div",{className:"bg-muted rounded-lg p-3 max-h-64 overflow-auto",children:d.jsx(nr,{data:e.request})})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Response"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Wt,{htmlFor:`responseMode-${e.id}`,className:"text-xs text-gray-500 dark:text-gray-400",children:"Mode:"}),d.jsxs(_s,{value:h,onValueChange:D=>b(D),children:[d.jsx(Ns,{id:`responseMode-${e.id}`,className:"w-32 h-8 text-xs",children:d.jsx(Ts,{})}),d.jsxs(ks,{children:[d.jsx(Pr,{value:"manual",children:"Manual"}),d.jsx(Pr,{value:"llm",children:"LLM"})]})]})]})]}),h==="llm"&&d.jsxs("div",{className:"space-y-2 p-3 bg-muted rounded-lg",children:[F?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(De,{onClick:K,disabled:B,size:"sm",className:"flex items-center gap-2",children:B?d.jsxs(d.Fragment,{children:[d.jsx(Ai,{className:"h-4 w-4 animate-spin"}),"Generating..."]}):d.jsxs(d.Fragment,{children:[d.jsx(mie,{className:"h-4 w-4"}),"Generate with LLM"]})}),d.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Using ",m?.provider," (",m?.model,")"]})]}):d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"LLM not configured. Please configure LLM in the Chat tab."}),J&&d.jsx("div",{className:"text-xs text-red-600 dark:text-red-400",children:J})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`model-${e.id}`,children:"Model"}),d.jsx(Tn,{id:`model-${e.id}`,value:y,onChange:D=>x(D.target.value),placeholder:"stub-model",disabled:h==="llm"&&B})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`stopReason-${e.id}`,children:"Stop Reason"}),d.jsx(Tn,{id:`stopReason-${e.id}`,value:E,onChange:D=>w(D.target.value),placeholder:"endTurn",disabled:h==="llm"&&B})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`role-${e.id}`,children:"Role"}),d.jsxs(_s,{value:_,onValueChange:D=>S(D),disabled:h==="llm"&&B,children:[d.jsx(Ns,{id:`role-${e.id}`,children:d.jsx(Ts,{})}),d.jsxs(ks,{children:[d.jsx(Pr,{value:"assistant",children:"assistant"}),d.jsx(Pr,{value:"user",children:"user"})]})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`contentType-${e.id}`,children:"Content Type"}),d.jsxs(_s,{value:T,onValueChange:D=>R(D),disabled:h==="llm"&&B,children:[d.jsx(Ns,{id:`contentType-${e.id}`,children:d.jsx(Ts,{})}),d.jsxs(ks,{children:[d.jsx(Pr,{value:"text",children:"text"}),d.jsx(Pr,{value:"image",children:"image"})]})]})]}),T==="text"&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`text-${e.id}`,children:"Text Content"}),d.jsx(Dl,{id:`text-${e.id}`,value:C,onChange:D=>I(D.target.value),placeholder:"Enter response text...",rows:6,disabled:h==="llm"&&B})]}),T==="image"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`imageData-${e.id}`,children:"Base64 Image Data"}),d.jsx(Dl,{id:`imageData-${e.id}`,value:A,onChange:D=>O(D.target.value),placeholder:"Base64 encoded image data...",rows:4,disabled:h==="llm"&&B})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`mimeType-${e.id}`,children:"MIME Type"}),d.jsx(Tn,{id:`mimeType-${e.id}`,value:j,onChange:D=>U(D.target.value),placeholder:"image/png",disabled:h==="llm"&&B})]})]})]})]}),d.jsxs("div",{className:"flex gap-2 p-4 border-t dark:border-zinc-700",children:[d.jsx(De,{onClick:ne,className:"flex-1",disabled:h==="llm"&&B,children:"Approve"}),d.jsx(De,{onClick:te,variant:"outline",className:"flex-1",disabled:h==="llm"&&B,children:"Reject"})]})]}):d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a sampling request to view details"})})}function hve({pendingRequests:e,onApprove:t,onReject:n,serverId:r,isConnected:a,mcpServerUrl:s}){const{selectedSamplingRequestId:i,setSelectedSamplingRequestId:c}=Bl(),{llmConfig:u}=c6({mcpServerUrl:s}),[f,m]=v.useState(null),[h,b]=v.useState(""),[y,x]=v.useState(-1),[E,w]=v.useState(!0),[_,S]=v.useState(!1),[T,R]=v.useState(!0),[C,I]=v.useState(!1),A=v.useRef(null),O=v.useRef(null),j=v.useRef(null),U=v.useRef(!1);v.useEffect(()=>{if(console.log("[SamplingTab] Auto-selection check:",{selectedSamplingRequestId:i,pendingRequestsCount:e.length,currentSelectedId:f?.id}),i&&e.length>0){const V=e.find(ne=>ne.id===i);console.log("[SamplingTab] Found request for auto-selection:",!!V,V?.id),V&&(console.log("[SamplingTab] Auto-selecting request:",V.id),c(null),m(V),setTimeout(()=>{const ne=document.getElementById(`sampling-request-${V.id}`);console.log("[SamplingTab] Scrolling to element:",!!ne),ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[i,e,c]),v.useEffect(()=>{const V=ne=>{const D=ne.detail.requestId;console.log("[SamplingTab] Custom navigate event received:",D);const H=e.find($=>$.id===D);H&&(console.log("[SamplingTab] Selecting request from event:",D),m(H),setTimeout(()=>{const $=document.getElementById(`sampling-request-${D}`);$&&$.scrollIntoView({behavior:"smooth",block:"nearest"})},200))};return window.addEventListener("navigate-to-sampling",V),()=>window.removeEventListener("navigate-to-sampling",V)},[e]),v.useEffect(()=>{E&&e.length>0&&A.current&&!U.current&&(A.current.scrollTop=0)},[e.length,E]),v.useEffect(()=>{const V=A.current;if(!V)return;const ne=()=>{V.scrollTop>0&&(U.current=!0,w(!1))};return V.addEventListener("scroll",ne),()=>V.removeEventListener("scroll",ne)},[]),v.useEffect(()=>{e.length===0&&(U.current=!1,w(!0))},[e.length]),v.useEffect(()=>{_&&j.current&&j.current.focus()},[_]);const B=v.useCallback(()=>{h.trim()||S(!1)},[h]),W=v.useMemo(()=>{if(!h.trim())return e;const V=h.toLowerCase();return e.filter(ne=>ne.serverName.toLowerCase().includes(V)||JSON.stringify(ne.request||{}).toLowerCase().includes(V))},[e,h]);v.useEffect(()=>{x(-1)},[h]),v.useEffect(()=>{const V=ne=>{const te=ne.target;if(te.tagName==="INPUT"||te.tagName==="TEXTAREA"||te.contentEditable==="true"||ne.metaKey||ne.ctrlKey||ne.altKey)return;const H=W;if(ne.key==="ArrowDown")ne.preventDefault(),x($=>{const L=$+1;return L>=H.length?0:L});else if(ne.key==="ArrowUp")ne.preventDefault(),x($=>{const L=$-1;return L<0?H.length-1:L});else if(ne.key==="Enter"&&y>=0){ne.preventDefault();const $=W[y];$&&J($)}};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[y,W]),v.useEffect(()=>{if(y>=0){const V=`sampling-request-${W[y]?.id}`,ne=document.getElementById(V);ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})}},[y,W]);const J=v.useCallback(V=>{m(V)},[]),ee=v.useCallback(()=>{window.confirm("Are you sure you want to reject all sampling requests? This cannot be undone.")&&(e.forEach(V=>{n(V.id,"User rejected all requests")}),m(null))},[e,n]),re=v.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify({id:f.id,serverName:f.serverName,timestamp:f.timestamp,request:f.request},null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch(V){console.error("[SamplingTab] Failed to copy request:",V)}},[f]),F=v.useCallback(()=>{if(f)try{const V=new globalThis.Blob([JSON.stringify({id:f.id,serverName:f.serverName,timestamp:f.timestamp,request:f.request},null,2)],{type:"application/json"}),ne=URL.createObjectURL(V),te=document.createElement("a");te.href=ne,te.download=`sampling-request-${Date.now()}.json`,document.body.appendChild(te),te.click(),document.body.removeChild(te),URL.revokeObjectURL(ne)}catch(V){console.error("[SamplingTab] Failed to download request:",V)}},[f]),K=v.useCallback(async()=>{if(O.current)try{document.fullscreenElement?await document.exitFullscreen():await O.current.requestFullscreen()}catch(V){console.error("[SamplingTab] Failed to toggle fullscreen:",V)}},[]);return a?d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:40,minSize:30,children:d.jsx(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:d.jsxs(Rn,{defaultSize:75,minSize:30,children:[d.jsx(dve,{isSearchExpanded:_,searchQuery:h,filteredRequestsCount:W.length,requestsCount:e.length,onSearchExpand:()=>S(!0),onSearchChange:b,onSearchBlur:B,onRejectAll:ee,searchInputRef:j}),d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(fve,{requests:W,selectedRequest:f,onRequestSelect:J,focusedIndex:y,formatRelativeTime:Vb,listRef:A})})]})})}),d.jsx(vo,{}),d.jsx(Rn,{defaultSize:60,minSize:40,children:d.jsx("div",{ref:O,className:"h-full bg-white dark:bg-zinc-900",children:d.jsx(mve,{request:f,onApprove:t,onReject:n,onClose:()=>m(null),previewMode:T,onTogglePreview:()=>R(!T),isCopied:C,onCopy:re,onDownload:F,onFullscreen:K,llmConfig:u})})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(T3,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function gve({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:r,onSearchExpand:a,onSearchChange:s,onSearchBlur:i,onCancelAll:c,searchInputRef:u}){return d.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[d.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?d.jsx(Tn,{ref:u,placeholder:"Search requests...",value:t,onChange:f=>s(f.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Elicitation"}),d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,disabled:r===0,className:"h-8 w-8 p-0",children:d.jsx(Ko,{className:"h-4 w-4"})})}),d.jsx(Lt,{side:"bottom",children:"Cancel all"})]})})]})}function bve({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:r,formatRelativeTime:a,listRef:s}){return e.length===0?d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No elicitation requests"})}):d.jsx("div",{ref:s,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((i,c)=>{const u=i.request.mode||"form",f=u==="form"&&"requestedSchema"in i.request&&i.request.requestedSchema;return d.jsx(Bi,{id:`elicitation-request-${i.id}`,isSelected:t?.id===i.id,isFocused:r===c,title:d.jsxs("span",{className:"flex items-center gap-3",children:[i.serverName,d.jsx(kr,{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=a(i.timestamp),h=[];f&&h.push("with schema"),u==="url"&&h.push("external action");const b=h.length>0?` | ${h.join(", ")}`:"";return m+b})(),onClick:()=>n(i)},i.id)})})}function yve({request:e,onApprove:t,onReject:n,onClose:r,previewMode:a,onTogglePreview:s,isCopied:i,onCopy:c,onDownload:u,onFullscreen:f}){const[m,h]=v.useState({}),[b,y]=v.useState(!1),x=e?.request.mode||"form",E=x==="form",w=x==="url";v.useEffect(()=>{if(e&&E&&"requestedSchema"in e.request){const A=e.request.requestedSchema,O={};if(A?.type==="object"&&A.properties)for(const[j,U]of Object.entries(A.properties)){const B=U;B.default!==void 0?O[j]=B.default:B.type==="boolean"?O[j]=!1:B.type==="number"||B.type==="integer"?O[j]=0:O[j]=""}h(O)}y(!1)},[e?.id,E]);const _=(A,O)=>{h(j=>({...j,[A]:O}))},S=()=>{if(e){if(E){if("requestedSchema"in e.request){const A=e.request.requestedSchema;if(A?.required){const O=A.required.filter(j=>m[j]===void 0||m[j]===""||m[j]===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 w&&t(e.id,{action:"accept"});r(),hr(()=>Promise.resolve().then(()=>Hu),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 j=new globalThis.CustomEvent("navigate-to-tool-result",{detail:{toolName:null}});window.dispatchEvent(j),Xt.dismiss(O)}},"View Tool Result"))),{duration:5e3})})}},T=()=>{e&&(t(e.id,{action:"decline"}),r())},R=()=>{e&&(n(e.id,"User cancelled elicitation request"),r())},C=()=>{e&&w&&"url"in e.request&&(window.open(e.request.url,"_blank"),y(!0))},I=v.useMemo(()=>{if(!e||!E||!("requestedSchema"in e.request))return null;const A=e.request.requestedSchema;if(!A||A.type!=="object"||!A.properties)return d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No form schema available"});const O=A.properties,j=A.required||[];return d.jsx("div",{className:"space-y-4",children:Object.entries(O).map(([U,B])=>{const W=B,J=j.includes(U),ee=W.type||"string",re=W.title||U,F=W.description;return d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:`field-${U}`,children:[re,J&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),F&&d.jsx("p",{className:"text-xs text-muted-foreground",children:F}),ee==="boolean"?d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(pp,{id:`field-${U}`,checked:m[U]||!1,onCheckedChange:K=>_(U,K)}),d.jsx(Wt,{htmlFor:`field-${U}`,className:"text-sm font-normal cursor-pointer",children:W.title||U})]}):ee==="number"||ee==="integer"?d.jsx(Tn,{id:`field-${U}`,type:"number",value:m[U]||"",onChange:K=>_(U,ee==="integer"?parseInt(K.target.value,10):parseFloat(K.target.value)),placeholder:W.default?.toString()||""}):W.enum?d.jsxs("select",{id:`field-${U}`,value:m[U]||"",onChange:K=>_(U,K.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:[d.jsx("option",{value:"",children:"Select..."}),W.enum.map(K=>d.jsx("option",{value:K,children:K},K))]}):ee==="string"&&(W.format==="textarea"||W.maxLength>100)?d.jsx(Dl,{id:`field-${U}`,value:m[U]||"",onChange:K=>_(U,K.target.value),placeholder:W.default||"",rows:4}):d.jsx(Tn,{id:`field-${U}`,type:"text",value:m[U]||"",onChange:K=>_(U,K.target.value),placeholder:W.default||""})]},U)})})},[e,m,E]);return e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"flex items-center justify-between p-4 border-b dark:border-zinc-700",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.serverName}),d.jsx(kr,{variant:"outline",className:w?"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}),d.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleString()})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0",children:i?d.jsx(oa,{className:"h-4 w-4 text-green-600"}):d.jsx(zr,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Copy request"})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:d.jsx(Lp,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Download request"})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:f,className:"h-8 w-8 p-0",children:d.jsx(K_,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Fullscreen"})]}),d.jsx(De,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:d.jsx(Ko,{className:"h-4 w-4"})})]})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Message"}),d.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:e.request.message})]}),w&&"url"in e.request&&d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"External Action Required"}),d.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:"This request requires you to complete an action at an external URL:"}),d.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background rounded border",children:[d.jsx("code",{className:"flex-1 text-xs font-mono break-all",children:e.request.url}),d.jsxs(De,{size:"sm",variant:"outline",onClick:C,className:"flex items-center gap-2",children:[d.jsx(Tx,{className:"h-4 w-4"}),"Open URL"]})]}),d.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[d.jsx(pp,{id:"url-completed",checked:b,onCheckedChange:A=>y(!!A)}),d.jsx(Wt,{htmlFor:"url-completed",className:"text-sm font-normal cursor-pointer",children:"I have completed the required action"})]})]})]}),E&&d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Form Data"}),I]}),E&&"requestedSchema"in e.request&&e.request.requestedSchema&&d.jsxs("details",{className:"space-y-2",children:[d.jsx("summary",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 cursor-pointer",children:"Schema (for reference)"}),d.jsx("div",{className:"bg-muted rounded-lg p-3 max-h-64 overflow-auto",children:d.jsx(nr,{data:e.request.requestedSchema})})]})]}),d.jsxs("div",{className:"flex gap-2 p-4 border-t dark:border-zinc-700",children:[d.jsx(De,{onClick:S,className:"flex-1",children:"Accept"}),d.jsx(De,{onClick:T,variant:"outline",className:"flex-1",children:"Decline"}),d.jsx(De,{onClick:R,variant:"outline",className:"flex-1",children:"Cancel"})]})]}):d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select an elicitation request to view details"})})}function vve({pendingRequests:e=[],onApprove:t,onReject:n,serverId:r,isConnected:a}){const{selectedElicitationRequestId:s,setSelectedElicitationRequestId:i}=Bl(),[c,u]=v.useState(null),[f,m]=v.useState(""),[h,b]=v.useState(-1),[y,x]=v.useState(!0),[E,w]=v.useState(!1),[_,S]=v.useState(!0),[T,R]=v.useState(!1),C=v.useRef(null),I=v.useRef(null),A=v.useRef(null),O=v.useRef(!1);v.useEffect(()=>{if(console.log("[ElicitationTab] Auto-selection check:",{selectedElicitationRequestId:s,pendingRequestsCount:e.length,currentSelectedId:c?.id}),s&&e.length>0){const F=e.find(K=>K.id===s);console.log("[ElicitationTab] Found request for auto-selection:",!!F,F?.id),F&&(console.log("[ElicitationTab] Auto-selecting request:",F.id),i(null),u(F),setTimeout(()=>{const K=document.getElementById(`elicitation-request-${F.id}`);console.log("[ElicitationTab] Scrolling to element:",!!K),K&&K.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[s,e,i]),v.useEffect(()=>{const F=K=>{const ne=K.detail.requestId;console.log("[ElicitationTab] Custom navigate event received:",ne);const te=e.find(D=>D.id===ne);te&&(console.log("[ElicitationTab] Selecting request from event:",ne),u(te),setTimeout(()=>{const D=document.getElementById(`elicitation-request-${ne}`);D&&D.scrollIntoView({behavior:"smooth",block:"nearest"})},200))};return window.addEventListener("navigate-to-elicitation",F),()=>window.removeEventListener("navigate-to-elicitation",F)},[e]),v.useEffect(()=>{y&&e.length>0&&C.current&&!O.current&&(C.current.scrollTop=0)},[e.length,y]),v.useEffect(()=>{const F=C.current;if(!F)return;const K=()=>{F.scrollTop>0&&(O.current=!0,x(!1))};return F.addEventListener("scroll",K),()=>F.removeEventListener("scroll",K)},[]),v.useEffect(()=>{e.length===0&&(O.current=!1,x(!0))},[e.length]),v.useEffect(()=>{E&&A.current&&A.current.focus()},[E]);const j=v.useCallback(()=>{f.trim()||w(!1)},[f]),U=v.useMemo(()=>{if(!f.trim())return e;const F=f.toLowerCase();return e.filter(K=>K.serverName.toLowerCase().includes(F)||K.request.message.toLowerCase().includes(F)||JSON.stringify(K.request||{}).toLowerCase().includes(F))},[e,f]);v.useEffect(()=>{b(-1)},[f]),v.useEffect(()=>{const F=K=>{const V=K.target;if(V.tagName==="INPUT"||V.tagName==="TEXTAREA"||V.contentEditable==="true"||K.metaKey||K.ctrlKey||K.altKey)return;const te=U;if(K.key==="ArrowDown")K.preventDefault(),b(D=>{const H=D+1;return H>=te.length?0:H});else if(K.key==="ArrowUp")K.preventDefault(),b(D=>{const H=D-1;return H<0?te.length-1:H});else if(K.key==="Enter"&&h>=0){K.preventDefault();const D=U[h];D&&B(D)}};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[h,U]),v.useEffect(()=>{if(h>=0){const F=`elicitation-request-${U[h]?.id}`,K=document.getElementById(F);K&&K.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,U]);const B=v.useCallback(F=>{u(F)},[]),W=v.useCallback(()=>{window.confirm("Are you sure you want to cancel all elicitation requests? This cannot be undone.")&&(e.forEach(F=>{n(F.id,"User cancelled all requests")}),u(null))},[e,n]),J=v.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)),R(!0),setTimeout(()=>R(!1),2e3)}catch(F){console.error("[ElicitationTab] Failed to copy request:",F)}},[c]),ee=v.useCallback(()=>{if(c)try{const F=new globalThis.Blob([JSON.stringify({id:c.id,serverName:c.serverName,timestamp:c.timestamp,request:c.request},null,2)],{type:"application/json"}),K=URL.createObjectURL(F),V=document.createElement("a");V.href=K,V.download=`elicitation-request-${Date.now()}.json`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(K)}catch(F){console.error("[ElicitationTab] Failed to download request:",F)}},[c]),re=v.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(F){console.error("[ElicitationTab] Failed to toggle fullscreen:",F)}},[]);return a?d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:40,minSize:30,children:d.jsx(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:d.jsxs(Rn,{defaultSize:75,minSize:30,children:[d.jsx(gve,{isSearchExpanded:E,searchQuery:f,filteredRequestsCount:U.length,requestsCount:e.length,onSearchExpand:()=>w(!0),onSearchChange:m,onSearchBlur:j,onCancelAll:W,searchInputRef:A}),d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(bve,{requests:U,selectedRequest:c,onRequestSelect:B,focusedIndex:h,formatRelativeTime:Vb,listRef:C})})]})})}),d.jsx(vo,{}),d.jsx(Rn,{defaultSize:60,minSize:40,children:d.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:d.jsx(yve,{request:c,onApprove:t,onReject:n,onClose:()=>u(null),previewMode:_,onTogglePreview:()=>S(!_),isCopied:T,onCopy:J,onDownload:ee,onFullscreen:re})})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(R3,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function wve({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:a,children:s}){return e?d.jsxs(d.Fragment,{children:[d.jsx("div",{style:{display:t==="tools"?"block":"none"},className:"h-full",children:d.jsx(j6,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state==="ready"})}),d.jsx("div",{style:{display:t==="prompts"?"block":"none"},className:"h-full",children:d.jsx(O6,{ref:r,prompts:e.prompts,callPrompt:e.getPrompt,serverId:e.id,isConnected:e.state==="ready"})}),d.jsx("div",{style:{display:t==="resources"?"block":"none"},className:"h-full",children:d.jsx(L6,{ref:a,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state==="ready"})}),d.jsx("div",{style:{display:t==="chat"?"block":"none"},className:"h-full",children:d.jsx(xye,{connection:e,isConnected:e.state==="ready",readResource:e.readResource},e.id)}),d.jsx("div",{style:{display:t==="sampling"?"block":"none"},className:"h-full",children:d.jsx(hve,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state==="ready",mcpServerUrl:e.url})}),d.jsx("div",{style:{display:t==="elicitation"?"block":"none"},className:"h-full",children:d.jsx(vve,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state==="ready"})}),d.jsx("div",{style:{display:t==="notifications"?"block":"none"},className:"h-full",children:d.jsx(eve,{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"&&d.jsx(d.Fragment,{children:s})]}):d.jsx(d.Fragment,{children:s})}function Y$({className:e}){return d.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:[d.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"}),d.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}const P6=v.createContext(void 0);function U6(){const e=v.use(P6);if(!e)throw new Error("useTabs must be used within a TabsProvider");return e}const $6=v.createContext(void 0);function Eve(){return v.use($6)}function OS({ref:e,children:t,defaultValue:n,value:r,onValueChange:a,className:s,...i}){const[c,u]=v.useState(n||""),f=r!==void 0,m=v.useCallback(b=>{f||u(b),a?.(b)},[f,a]),h=f?r:c;return d.jsx(P6,{value:{activeValue:h,handleValueChange:m},children:d.jsx("div",{ref:e,className:Oe("flex flex-col gap-2",s),...i,children:t})})}OS.displayName="Tabs";function DS({ref:e,children:t,className:n,variant:r="default",...a}){const{activeValue:s}=U6(),[i,c]=v.useState({width:0,left:0}),u=v.useRef(null),f=v.useRef(null),m=v.useRef(null),b=v.Children.toArray(t).findIndex(E=>v.isValidElement(E)&&E.props.value===s),y=v.useCallback(()=>{const E=u.current;if(!E)return;const _=E.querySelectorAll("button")[b];if(_){const S=E.getBoundingClientRect(),T=_.getBoundingClientRect();c({width:T.width,left:T.left-S.left})}},[b]),x=v.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(y,16)},[y]);return v.useEffect(()=>{const E=setTimeout(y,10);return()=>clearTimeout(E)},[y]),v.useEffect(()=>{const E=u.current;return E?(f.current=new ResizeObserver(()=>{x()}),f.current.observe(E),E.querySelectorAll("button").forEach(_=>{f.current&&f.current.observe(_)}),()=>{f.current&&f.current.disconnect(),m.current&&clearTimeout(m.current)}):void 0},[x]),v.useEffect(()=>{const E=()=>{x()};return window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[x]),v.useEffect(()=>{const E=u.current;if(!E)return;const w=E.querySelector("[data-width]");w&&(w.style.width=`${i.width}px`,w.style.left=`${i.left}px`)},[i]),d.jsx($6,{value:{variant:r},children:d.jsxs("div",{ref:u,className:Oe("relative flex bg-none",r==="default"&&"p-1 rounded-full border border-zinc-300 dark:border-zinc-600",r==="underline"&&"border-b border-zinc-200 dark:border-zinc-700",n),...a,children:[t,d.jsx("span",{className:Oe("absolute transition-all duration-200 ease-out z-0",r==="default"&&"bg-white dark:bg-zinc-700 rounded-full h-[calc(100%-8px)] top-1 border border-zinc-300 dark:border-zinc-600",r==="underline"&&"bottom-0 h-0.5 bg-black dark:bg-white"),"data-width":i.width,"data-left":i.left})]})})}DS.displayName="TabsList";function LS({ref:e,children:t,value:n,className:r,disabled:a,icon:s,...i}){const{activeValue:c,handleValueChange:u}=U6(),m=Eve()?.variant||"default",h=c===n;return d.jsxs("button",{ref:e,disabled:a,onClick:()=>u(n),className:Oe("relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors 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",m==="default"&&"rounded-md px-4 py-2.5",m==="underline"&&"px-6 py-3 border-b-2 border-transparent",h&&"text-foreground",!h&&"text-muted-foreground hover:text-foreground",r),...i,children:[s&&d.jsx(s,{className:"mr-2 h-4 w-4"}),t]})}LS.displayName="TabsTrigger";function Z$({className:e}){const{theme:t,setTheme:n}=Jy(),r=v.useRef(null),[a,s]=v.useState(!1);v.useEffect(()=>{s(!0)},[]);const i=()=>t==="system"?"light":t==="light"?"dark":"system",c=()=>t==="system"?d.jsx(tP,{className:"size-4"}):t==="light"?d.jsx(vie,{className:"size-5"}):d.jsx(Jse,{className:"size-4"}),u=()=>t==="system"?"Switch to light mode":t==="light"?"Switch to dark mode":"Switch to system mode",f=async()=>{if(!r.current)return;const m=i();if(typeof document<"u"&&"startViewTransition"in document){await document.startViewTransition(()=>{Yu.flushSync(()=>{n(m)})}).ready;const{top:h,left:b,width:y,height:x}=r.current.getBoundingClientRect(),E=h+x/2,w=b+y/2,_=window.innerWidth-b,S=window.innerHeight-h,T=Math.hypot(Math.max(b,_),Math.max(h,S));document.documentElement.animate({clipPath:[`circle(0px at ${w}px ${E}px)`,`circle(${T}px at ${w}px ${E}px)`]},{duration:700,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})}else n(m)};return a?d.jsx("button",{ref:r,onClick:f,className:Oe(e),"aria-label":u(),title:`Current: ${t==="system"?"Auto":t==="light"?"Light":"Dark"}`,children:c()}):d.jsx("button",{ref:r,className:Oe(e),"aria-label":"Toggle theme",children:d.jsx(tP,{className:"size-4"})})}function q$({className:e,state:t="collapsed",href:n="https://mcp-use.com"}){const[r,a]=v.useState(!1),s=.2,i=.7,c=.6,u=4,f=s+i+c,m=0,h=s/f,b=(s+i)/f,y=1;return d.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:Oe("flex items-center transition-opacity -my-3",t==="expanded"?"space-x-2":"",e),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[d.jsx("div",{className:"relative",children:d.jsxs(wa.svg,{viewBox:"0 0 303 303",initial:"rest",animate:r?"hover":"rest",className:Oe("text-foreground",t==="expanded"?"size-[40px]":"size-[20px]"),children:[d.jsxs(wa.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:f,times:[m,h,b,y],ease:"easeInOut"}}},fill:"currentColor",fillRule:"nonzero",stroke:"currentColor",strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",children:[d.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"}),d.jsx("circle",{cx:"70.3",cy:"232.3",r:"50"}),d.jsx("circle",{cx:"232.3",cy:"70.3",r:"50"})]}),d.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx(xve,{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:b,T3:y},total:f}),d.jsx(X$,{cx:70.3,cy:232.3,r:50,times:{T0:m,T1:h,T2:b,T3:y},total:f}),d.jsx(X$,{cx:232.3,cy:70.3,r:50,times:{T0:m,T1:h,T2:b,T3:y},total:f})]})]})}),t==="expanded"&&d.jsxs("div",{className:"font-ubuntu flex flex-col items-start -space-y-1 mr-3",children:[d.jsx("h1",{className:"text-xl font-medium",children:"mcp-use"}),d.jsx("span",{className:"text-lg text-muted-foreground tracking-wide font-sans font-light",children:"Inspector"})]})]})}function xve({d:e,times:t,total:n}){const{T0:r,T1:a,T2:s,T3:i}=t;return d.jsx(wa.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[r,a,s,i],ease:"easeInOut"}}}})}function X$({cx:e,cy:t,r:n,times:r,total:a}){const{T0:s,T1:i,T2:c,T3:u}=r;return d.jsx(wa.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:a,times:[s,i,c,u],ease:"easeInOut"}}}})}function z6({ref:e,shimmerColor:t,shimmerSize:n="0.05em",shimmerDuration:r="3s",borderRadius:a="100px",background:s,className:i,children:c,...u}){const{resolvedTheme:f}=Jy(),m=f==="dark"?"#000000":"#ffffff",h=f==="dark"?"rgba(255, 255, 255, 1)":"rgba(0, 0, 0, 1)",b=t||m,y=s||h;return d.jsxs("button",{style:{"--spread":"90deg","--shimmer-color":b,"--radius":a,"--speed":r,"--cut":n,"--bg":y},className:Oe("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",f==="dark"?"border-black/10 text-black":"border-white/10 text-white",i),ref:e,...u,children:[d.jsx("div",{className:Oe("-z-30 blur-[2px]","[container-type:size] absolute inset-0 overflow-visible"),children:d.jsx("div",{className:"animate-shimmer-slide absolute inset-0 [aspect-ratio:1] h-[100cqh] [border-radius:0] [mask:none]",children:d.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,d.jsx("div",{className:Oe("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",f==="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]")}),d.jsx("div",{className:Oe("absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] [background:var(--bg)]")})]})}z6.displayName="ShimmerButton";function J$({status:e}){const t=s=>{switch(s){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:s}}},{color:n,ringColor:r,tooltip:a}=t(e);return d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsxs("div",{className:"relative",children:[d.jsx("div",{className:`absolute w-2 h-2 rounded-full ${r} animate-ping`}),d.jsx("div",{className:`relative w-2 h-2 rounded-full ${n}`})]})}),d.jsx(Lt,{children:d.jsx("p",{children:a})})]})}function Q$({connections:e,selectedServer:t,onServerSelect:n,onOpenConnectionOptions:r,mobileMode:a=!1}){const s=Ku(),i=c=>{const u=e.find(f=>f.id===c);if(!u||u.state!=="ready"){Xt.error("Server is not connected and cannot be inspected");return}n(c)};return a?d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("div",{className:"relative",children:d.jsxs(wx,{children:[d.jsx(Ex,{asChild:!0,children:d.jsxs(De,{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?d.jsx(vl,{serverUrl:t.url,serverName:t.name,size:"md"}):d.jsx(cie,{className:"h-5 w-5"}),d.jsx(Fl,{className:"h-4 w-4"})]})}),d.jsxs(mb,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[d.jsx(xx,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>s("/"),children:"MCP Servers"}),d.jsx(gf,{}),e.length===0?d.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=>d.jsxs(xs,{onClick:()=>i(c.id),className:"flex items-center gap-3",children:[d.jsx(vl,{serverUrl:c.url,serverName:c.name,size:"sm"}),d.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[d.jsx("div",{className:"font-medium",children:c.name}),d.jsx(J$,{status:c.state})]}),d.jsx(De,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:u=>{u.stopPropagation(),r(c.id)},children:d.jsx(cu,{className:"h-3 w-3"})})]},c.id)),d.jsx(gf,{}),d.jsx(xs,{onClick:()=>s("/"),children:d.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})}):d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("div",{className:"relative",children:d.jsxs(wx,{children:[d.jsx(Ex,{asChild:!0,children:d.jsxs(z6,{className:Oe("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&&d.jsx(vl,{serverUrl:t.url,serverName:t.name,size:"md",className:"mr-2"}),d.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[d.jsx("span",{className:"truncate",children:t?t.name:"Select server to inspect"}),t&&d.jsx("div",{className:"flex items-center gap-2",children:t.error&&t.state!=="ready"?d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.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"})}),d.jsx(Lt,{children:d.jsx("p",{className:"max-w-xs",children:t.error})})]}):d.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&&d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx("button",{type:"button",onClick:()=>{r(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:d.jsx(cu,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:d.jsx("p",{children:"Edit connection settings"})})]}),d.jsxs(mb,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[d.jsx(xx,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>s("/"),children:"MCP Servers"}),d.jsx(gf,{}),e.length===0?d.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=>d.jsxs(xs,{onClick:()=>i(c.id),className:"flex items-center gap-3",children:[d.jsx(vl,{serverUrl:c.url,serverName:c.name,size:"sm"}),d.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[d.jsx("div",{className:"font-medium",children:c.name}),d.jsx(J$,{status:c.state})]}),d.jsx(De,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:u=>{u.stopPropagation(),r(c.id)},children:d.jsx(cu,{className:"h-3 w-3"})})]},c.id)),d.jsx(gf,{}),d.jsx(xs,{onClick:()=>s("/"),children:d.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})})}const ez=[{id:"tools",label:"Tools",icon:Cl},{id:"prompts",label:"Prompts",icon:Qf},{id:"resources",label:"Resources",icon:Lse},{id:"chat",label:"Chat",icon:Wse},{id:"sampling",label:"Sampling",icon:T3},{id:"elicitation",label:"Elicitation",icon:R3},{id:"notifications",label:"Notifications",icon:H_}];function tz(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 Sve({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:a,onCommandPaletteOpen:s,onOpenConnectionOptions:i}){const{tunnelUrl:c}=Bl(),u=t&&c,[f,m]=v.useState(!1),h=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 d.jsxs("header",{className:"w-full mx-auto",children:[d.jsxs("div",{className:"flex lg:hidden flex-col gap-3",children:[d.jsxs("div",{className:"flex items-center justify-between w-full",children:[d.jsx("div",{className:"flex-1 flex justify-start",children:d.jsx(Q$,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:i,mobileMode:!0})}),d.jsx("div",{className:"flex-shrink-0 flex justify-center",children:d.jsx("div",{className:"scale-150",children:d.jsx(q$,{state:"collapsed"})})}),d.jsxs("div",{className:"flex-1 flex justify-end items-center gap-2",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",asChild:!0,children:d.jsx("a",{href:"https://github.com/mcp-use/mcp-use",target:"_blank",rel:"noopener noreferrer",className:"p-2","aria-label":"GitHub",children:d.jsx(Y$,{className:"h-4 w-4"})})})}),d.jsx(Lt,{children:d.jsx("p",{children:"Give us a star ⭐"})})]}),d.jsx(Z$,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})]})]}),t&&d.jsx("div",{className:"w-full",children:d.jsx(OS,{value:n,onValueChange:b=>a(b),children:d.jsx(DS,{className:"w-full justify-center",children:ez.map(b=>{const y=tz(b.id,t);return d.jsxs(LS,{value:b.id,icon:b.icon,className:"[&>svg]:mr-0 flex-1 flex-row gap-2 relative",children:[y>0&&d.jsx("span",{className:Oe(n===b.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:y}),d.jsx("span",{className:"sr-only",children:b.label})]},b.id)})})})})]}),d.jsxs("div",{className:"hidden lg:flex items-center justify-between gap-3",children:[d.jsxs("div",{className:"flex items-center flex-wrap gap-2 md:space-x-6 space-x-2",children:[d.jsx(Q$,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:i}),t&&d.jsx(OS,{value:n,onValueChange:b=>a(b),children:d.jsx(DS,{className:"overflow-x-auto",children:ez.map(b=>{const y=tz(b.id,t);return d.jsx(LS,{value:b.id,icon:b.icon,className:"[&>svg]:mr-0 lg:[&>svg]:mr-2 relative",children:d.jsxs("div",{className:"items-center gap-2 hidden lg:flex",children:[b.label,y>0&&d.jsx("span",{className:Oe(n===b.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:y})]})},b.id)})})}),u&&d.jsxs(DH,{children:[d.jsx(LH,{asChild:!0,children:d.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:[d.jsx(ep,{className:"size-4 text-purple-600 dark:text-purple-400 animate-pulse"}),d.jsx("span",{className:"text-xs font-medium text-purple-700 dark:text-purple-300 hidden lg:inline",children:"Tunnel"})]})}),d.jsx(FT,{className:"w-[calc(100vw-2rem)] sm:w-96",align:"start",children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsxs("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:[d.jsx(ep,{className:"size-4 text-purple-600 dark:text-purple-400"}),"Tunnel URL"]}),d.jsxs("div",{className:"flex items-center gap-2 p-2 py-0 bg-muted rounded-full",children:[d.jsxs("code",{className:"flex-1 text-[10px] font-mono",children:[c,"/mcp"]}),d.jsx(De,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:h,children:f?d.jsx(oa,{className:"size-3.5 text-green-600"}):d.jsx(zr,{className:"size-3.5"})})]})]}),d.jsxs("div",{children:[d.jsx("h5",{className:"font-semibold text-sm mb-2",children:"Use in ChatGPT"}),d.jsxs("ol",{className:"space-y-2 text-xs text-muted-foreground",children:[d.jsxs("li",{className:"flex gap-2",children:[d.jsx("span",{className:"font-semibold text-foreground",children:"1."}),d.jsxs("span",{children:["Enable"," ",d.jsx("span",{className:"font-medium text-foreground",children:"dev mode"})," ","from settings"]})]}),d.jsxs("li",{className:"flex gap-2",children:[d.jsx("span",{className:"font-semibold text-foreground",children:"2."}),d.jsxs("span",{children:["In"," ",d.jsx("span",{className:"font-medium text-foreground",children:"App & Connectors"})," ","click on"," ",d.jsx("span",{className:"font-medium text-foreground",children:"create"})]})]}),d.jsxs("li",{className:"flex gap-2",children:[d.jsx("span",{className:"font-semibold text-foreground",children:"3."}),d.jsx("span",{children:"Use the tunnel URL in the input"})]})]})]})]})})]})]}),d.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{children:d.jsx(Z$,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})}),d.jsx(Lt,{children:d.jsx("p",{children:"Toggle theme"})})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsxs(De,{variant:"ghost",className:"hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full px-1 -mx-3 flex gap-1",onClick:s,children:[d.jsx(bse,{className:"size-4"}),d.jsx("span",{className:"text-base font-mono hidden sm:inline",children:"K"})]})}),d.jsx(Lt,{children:d.jsx("p",{children:"Command Palette"})})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",asChild:!0,children:d.jsxs("a",{href:"https://github.com/mcp-use/mcp-use",className:"flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",children:[d.jsx(Y$,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Github"})]})})}),d.jsx(Lt,{children:d.jsx("p",{children:"Give us a star ⭐"})})]}),d.jsx(q$,{state:"expanded"})]})]})]})}function _ve({children:e}){const t=Ku(),n=js(),{connections:r,addConnection:a,removeConnection:s,updateConnectionConfig:i,configLoaded:c}=B_(),{selectedServerId:u,setSelectedServerId:f,activeTab:m,setActiveTab:h,navigateToItem:b,setTunnelUrl:y}=Bl(),[x,E]=v.useState(!1),[w,_]=v.useState(null),S=$pe();v.useEffect(()=>{const K=new URLSearchParams(n.search).get("tunnelUrl");y(K)},[n.search,y]),v.useEffect(()=>{const F=ne=>{const D=ne.detail.requestId;u&&b(u,"sampling",D)},K=ne=>{const D=ne.detail.requestId;u&&b(u,"elicitation",D)},V=ne=>{const D=ne.detail.toolName;u&&D?b(u,"tools",D):u&&h("tools")};return window.addEventListener("navigate-to-sampling",F),window.addEventListener("navigate-to-elicitation",K),window.addEventListener("navigate-to-tool-result",V),()=>{window.removeEventListener("navigate-to-sampling",F),window.removeEventListener("navigate-to-elicitation",K),window.removeEventListener("navigate-to-tool-result",V)}},[u,h,b]);const T=v.useRef(null),R=v.useRef(null),C=v.useRef(null),{isAutoConnecting:I}=Upe({connections:r,addConnection:a,removeConnection:s,configLoaded:c}),A=v.useCallback(F=>{Tr.getInstance().capture(new Doe({trigger:F})).catch(()=>{}),E(!0)},[]),O=F=>{const K=r.find(D=>D.id===F);if(!K||K.state!=="ready"){Xt.error("Server is not connected and cannot be inspected");return}f(F);const ne=new URLSearchParams(n.search).get("tunnelUrl"),te=ne?`/?server=${encodeURIComponent(F)}&tunnelUrl=${encodeURIComponent(ne)}`:`/?server=${encodeURIComponent(F)}`;t(te)},j=v.useCallback(F=>{_(F)},[]),U=v.useCallback(F=>{w&&(F.url!==w?(s(w),a(F.url,F.name,F.proxyConfig,F.transportType)):i(w,{name:F.name,proxyConfig:F.proxyConfig,transportType:F.transportType}),_(null),Xt.success("Connection settings updated"))},[w,s,a,i]),B=(F,K,V)=>{if(console.warn("[Layout] handleCommandPaletteNavigate called:",{tab:F,itemName:K,serverId:V}),V){const ne=r.find($=>$.id===V);if(console.warn("[Layout] Server lookup:",{serverId:V,serverFound:!!ne,serverState:ne?.state}),!ne||ne.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:V,tab:F,itemName:K}),b(V,F,K);const D=new URLSearchParams(n.search).get("tunnelUrl"),H=D?`/?server=${encodeURIComponent(V)}&tunnelUrl=${encodeURIComponent(D)}`:`/?server=${encodeURIComponent(V)}`;console.warn("[Layout] Navigating to:",H),t(H)}else console.warn("[Layout] No serverId, just updating tab to:",F),h(F)},W=r.find(F=>F.id===u),J=W?W.tools.map(F=>({...F,_serverId:W.id})):r.flatMap(F=>F.state==="ready"?F.tools.map(K=>({...K,_serverId:F.id,_serverName:F.name})):[]),ee=W?W.prompts.map(F=>({...F,_serverId:W.id})):r.flatMap(F=>F.state==="ready"?F.prompts.map(K=>({...K,_serverId:F.id,_serverName:F.name})):[]),re=W?W.resources.map(F=>({...F,_serverId:W.id})):r.flatMap(F=>F.state==="ready"?F.resources.map(K=>({...K,_serverId:F.id,_serverName:F.name})):[]);return v.useEffect(()=>{const K=new URLSearchParams(n.search).get("server"),V=K?decodeURIComponent(K):null;V!==u&&f(V)},[n.search,u,f]),v.useEffect(()=>{const K=new URLSearchParams(n.search).get("server");if(!K)return;const V=decodeURIComponent(K),ne=r.find(te=>te.id===V);if(!ne){const te=setTimeout(()=>t("/"),3e3);return()=>clearTimeout(te)}if(ne.state==="failed"){const te=setTimeout(()=>t("/"),2e3);return()=>clearTimeout(te)}},[n.search,t,r]),iH({onCommandPalette:()=>A("keyboard"),onToolsTab:()=>{W&&h("tools")},onPromptsTab:()=>{W&&h("prompts")},onResourcesTab:()=>{W&&h("resources")},onChatTab:()=>{W&&h("chat")},onHome:()=>{t("/")},onFocusSearch:()=>{m==="tools"&&T.current?T.current.focusSearch():m==="prompts"&&R.current?R.current.focusSearch():m==="resources"&&C.current&&C.current.focusSearch()},onBlurSearch:()=>{m==="tools"&&T.current?T.current.blurSearch():m==="prompts"&&R.current?R.current.blurSearch():m==="resources"&&C.current&&C.current.blurSearch()}}),I?d.jsx("div",{className:"h-screen bg-white dark:bg-zinc-900 flex items-center justify-center",children:d.jsxs("div",{className:"flex flex-col items-center gap-4",children:[d.jsx(Vo,{className:"h-8 w-8 text-zinc-600 dark:text-zinc-400"}),d.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Connecting to MCP server..."})]})}):d.jsx(w3,{children:d.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:[d.jsx(Sve,{connections:r,selectedServer:W,activeTab:m,onServerSelect:O,onTabChange:h,onCommandPaletteOpen:()=>A("button"),onOpenConnectionOptions:j}),d.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:d.jsx(wve,{selectedServer:W,activeTab:m,toolsSearchRef:T,promptsSearchRef:R,resourcesSearchRef:C,children:e})}),d.jsx(fme,{isOpen:x,onOpenChange:E,tools:J,prompts:ee,resources:re,savedRequests:S,connections:r,onNavigate:B,onServerSelect:O}),d.jsx(_B,{connection:w&&r.find(F=>F.id===w)||null,open:w!==null,onOpenChange:F=>{F||_(null)},onConnect:U})]})})}function Tve(){const[e,t]=v.useState("processing"),[n,r]=v.useState("");return v.useEffect(()=>{console.log("[OAuthCallback] Component mounted, handling authorization..."),console.log("[OAuthCallback] Current URL:",window.location.href),f_().then(()=>{console.log("[OAuthCallback] Authorization successful"),t("success")}).catch(a=>{console.error("[OAuthCallback] Authorization failed:",a),t("error"),r(a instanceof Error?a.message:String(a))})},[]),e==="processing"?d.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:d.jsxs("div",{className:"flex flex-col items-center gap-4",children:[d.jsx(Ai,{className:"h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400"}),d.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Completing authentication..."})]})}):e==="error"?d.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:d.jsxs("div",{className:"max-w-md p-6",children:[d.jsx("h1",{className:"text-xl font-semibold text-red-600 dark:text-red-400 mb-2",children:"Authentication Error"}),d.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mb-4",children:n}),d.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-500",children:"You can close this window and try again."})]})}):d.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:d.jsxs("div",{className:"max-w-md p-6",children:[d.jsx("h1",{className:"text-xl font-semibold text-green-600 dark:text-green-400 mb-2",children:"Authentication Successful!"}),d.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Redirecting you back..."})]})})}var Nve=(e,t,n,r,a,s,i,c)=>{let u=document.documentElement,f=["light","dark"];function m(y){(Array.isArray(e)?e:[e]).forEach(x=>{let E=x==="class",w=E&&s?a.map(_=>s[_]||_):a;E?(u.classList.remove(...w),u.classList.add(s&&s[y]?s[y]:y)):u.setAttribute(x,y)}),h(y)}function h(y){c&&f.includes(y)&&(u.style.colorScheme=y)}function b(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)m(r);else try{let y=localStorage.getItem(t)||n,x=i&&y==="system"?b():y;m(x)}catch{}},kve=v.createContext(void 0),Cve={setTheme:e=>{},themes:[]},Rve=()=>{var e;return(e=v.useContext(kve))!=null?e:Cve};v.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:a,defaultTheme:s,value:i,themes:c,nonce:u,scriptProps:f})=>{let m=JSON.stringify([n,t,s,e,c,i,r,a]).slice(1,-1);return v.createElement("script",{...f,suppressHydrationWarning:!0,nonce:typeof window>"u"?u:"",dangerouslySetInnerHTML:{__html:`(${Nve.toString()})(${m})`}})});function Ave({...e}){const{theme:t="system"}=Rve();return d.jsx(A3,{theme:t,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...e})}function Ive(){return d.jsx(tbe,{children:d.jsx(zoe,{children:d.jsxs(Ppe,{children:[d.jsx(UQ,{basename:"/inspector",children:d.jsxs(hQ,{children:[d.jsx(ux,{path:"/oauth/callback",element:d.jsx(Tve,{})}),d.jsx(ux,{path:"/",element:d.jsx(_ve,{children:d.jsx(jpe,{})})})]})}),d.jsx(Ave,{position:"top-center"})]})})})}const nz=new URLSearchParams(window.location.search);if(nz.has("code")||nz.has("error"))try{f_()}catch(e){console.error("[inspector] OAuth callback error:",e)}const rz=document.getElementById("root");rz?_J.createRoot(rz).render(d.jsx(Ive,{})):console.error("[inspector] Root element not found");export{mW as $,de as A,SY as B,Bn as C,Dn as D,vn as E,Fe as F,Dz as G,h2 as H,kg as I,ej as J,iJ as K,cz as L,nJ as M,f_ as N,ce as R,oJ as W,Fn as Z,Ge as _,hr as a,Hu as b,Yu as c,jve as d,Dve as e,dh as f,bp as g,oG as h,Pve as i,Mi as j,YW as k,Z7 as l,oW as m,hG as n,yG as o,Mve as p,KW as q,v as r,Y7 as s,Lve as t,uG as u,Ni as v,QK as w,Re as x,Pe as y,oz as z};
1683
+ `),He.document.close())}},[x]),bt=v.useCallback(()=>{G?(le.current&&le.current.expand(),Te.current&&Te.current.expand(),q(!1)):(le.current&&le.current.collapse(),Te.current&&Te.current.collapse(),q(!0))},[G]),nt=v.useCallback(()=>{i&&(re(""),J(!0))},[i]),Ut=v.useCallback(()=>{if(!i)return;const Ie={id:`${Date.now()}-${Math.random()}`,name:ee.trim()||`${i.name} - ${new Date().toLocaleString()}`,toolName:i.name,args:b,savedAt:Date.now(),serverId:i._serverId,serverName:i._serverName};Ue([...U,Ie]),Tr.getInstance().capture(new Loe({toolName:i.name,serverId:a})).catch(()=>{}),J(!1),re("")},[i,ee,b,U,Ue,a]),ot=v.useCallback(Ie=>{Ue(U.filter(Me=>Me.id!==Ie)),u?.id===Ie&&f(null)},[U,Ue,u]);return $?d.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[M!=="list"&&d.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[d.jsx(De,{variant:"ghost",size:"sm",onClick:()=>{M==="response"?z("detail"):(c(null),z("list"))},className:"p-0 h-8 w-8",children:d.jsx(V_,{className:"h-4 w-4"})}),d.jsxs("div",{className:"flex items-center text-sm font-medium",children:[d.jsx("button",{onClick:()=>{c(null),z("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Tools"}),M==="detail"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("button",{onClick:()=>{z("response")},className:M==="detail"?"text-foreground hover:underline":M==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),M==="response"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),d.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),d.jsx("div",{className:"flex-1 relative overflow-hidden",children:d.jsxs(Oy,{initial:!1,mode:"popLayout",children:[M==="list"&&d.jsxs(wa.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:[d.jsx(W$,{activeTab:O,isSearchExpanded:V,searchQuery:I,filteredToolsCount:fe.length,savedRequestsCount:U.length,onSearchExpand:()=>ne(!0),onSearchChange:A,onSearchBlur:we,onTabSwitch:()=>j(O==="tools"?"saved":"tools"),searchInputRef:H}),O==="tools"?d.jsx(G$,{tools:fe,selectedTool:i,onToolSelect:Ae,focusedIndex:te}):d.jsx($$,{savedRequests:U,selectedRequest:u,onLoadRequest:ze,onDeleteRequest:ot,focusedIndex:te})]},"list"),M==="detail"&&d.jsx(wa.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:d.jsx(B$,{selectedTool:i,toolArgs:b,isExecuting:w,isConnected:s,onArgChange:at,onExecute:lt,onSave:nt})},"detail"),M==="response"&&d.jsx(wa.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:d.jsx(V$,{results:Le,copiedResult:S,previewMode:F,serverId:a,readResource:r,onCopy:gt,onDelete:Ct,onFullscreen:$e,onTogglePreview:()=>K(!F)})},"response")]})}),d.jsx(z$,{isOpen:W,requestName:ee,defaultPlaceholder:`${i?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:re,onSave:Ut,onCancel:()=>J(!1)})]}):d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{ref:le,defaultSize:33,collapsible:!0,className:"flex flex-col h-full relative",children:d.jsxs(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[d.jsx(Rn,{defaultSize:75,minSize:30,children:d.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[d.jsx(W$,{activeTab:O,isSearchExpanded:V,searchQuery:I,filteredToolsCount:fe.length,savedRequestsCount:U.length,onSearchExpand:()=>ne(!0),onSearchChange:A,onSearchBlur:we,onTabSwitch:()=>j(O==="tools"?"saved":"tools"),searchInputRef:H}),O==="tools"?d.jsx(G$,{tools:fe,selectedTool:i,onToolSelect:Ae,focusedIndex:te}):d.jsx($$,{savedRequests:U,selectedRequest:u,onLoadRequest:ze,onDeleteRequest:ot,focusedIndex:te})]})}),d.jsx(vo,{withHandle:!0}),d.jsxs(Rn,{ref:Ee,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:[d.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:Ie=>{Ie.preventDefault(),Ie.stopPropagation(),X?(Ee.current?.resize(25),Z(!1)):(Ee.current?.resize(5),Z(!0))},children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),ae>0&&d.jsx(kr,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:ae}),ae>0&&!X&&d.jsx(De,{variant:"ghost",size:"sm",onClick:Ie=>{Ie.preventDefault(),Ie.stopPropagation(),_e.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:d.jsx(Ii,{className:"h-3.5 w-3.5"})})]}),d.jsx(Fl,{className:`h-4 w-4 text-muted-foreground transition-transform ${X?"":"rotate-180"}`})]}),!X&&d.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:d.jsx(v1,{serverIds:[a],onCountChange:ie,onClearRef:_e})})]})]})}),d.jsx(vo,{withHandle:!0}),d.jsx(Rn,{defaultSize:67,children:d.jsxs(aa,{direction:"vertical",children:[d.jsx(Rn,{ref:Te,defaultSize:40,collapsible:!0,children:d.jsx(B$,{selectedTool:i,toolArgs:b,isExecuting:w,isConnected:s,onArgChange:at,onExecute:lt,onSave:nt,onCancel:()=>{R&&R.abort()}})}),d.jsx(vo,{withHandle:!0}),d.jsx(Rn,{ref:Be,defaultSize:60,children:d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(V$,{results:Le,copiedResult:S,previewMode:F,serverId:a,readResource:r,onCopy:gt,onDelete:Ct,onFullscreen:$e,onTogglePreview:()=>K(!F),onMaximize:bt,isMaximized:G})})})]})}),d.jsx(z$,{isOpen:W,requestName:ee,defaultPlaceholder:`${i?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:re,onSave:Ut,onCancel:()=>J(!1)})]})}j6.displayName="ToolsTab";function dve({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:r,onSearchExpand:a,onSearchChange:s,onSearchBlur:i,onRejectAll:c,searchInputRef:u}){return d.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[d.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?d.jsx(Tn,{ref:u,placeholder:"Search requests...",value:t,onChange:f=>s(f.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Sampling"}),d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,disabled:r===0,className:"h-8 w-8 p-0",children:d.jsx(Ii,{className:"h-4 w-4"})})}),d.jsx(Lt,{side:"bottom",children:"Reject all"})]})})]})}function fve({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:r,formatRelativeTime:a,listRef:s}){return e.length===0?d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No sampling requests"})}):d.jsx("div",{ref:s,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((i,c)=>{const u=i.request.params?.messages?.length||0,f=i.request.params?.maxTokens;return d.jsx(Bi,{id:`sampling-request-${i.id}`,isSelected:t?.id===i.id,isFocused:r===c,title:d.jsxs("span",{className:"flex items-center gap-3",children:[i.serverName,d.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const m=a(i.timestamp),h=[];u>0&&h.push(`${u} message${u>1?"s":""}`),f&&h.push(`max ${f} tokens`);const b=h.length>0?` | ${h.join(", ")}`:"";return m+b})(),onClick:()=>n(i)},i.id)})})}function pve({llmConfig:e}){const t=v.useRef(null);return{generateResponse:v.useCallback(async({request:r})=>{if(!e)throw new Error("LLM config is not available");const a=r.params||{},s=a.maxTokens,i=a.temperature;a.modelPreferences;const c=a.messages||[];if(console.log("[useSamplingLLM] Request structure:",{hasParams:!!a,messagesCount:c.length,messages:c,params:a}),c.length===0)throw new Error("No messages found in sampling request");const u=[],{HumanMessage:f,AIMessage:m}=await hr(async()=>{const{HumanMessage:x,AIMessage:E}=await import("./index-rCecp17x.js").then(w=>w.bE);return{HumanMessage:x,AIMessage:E}},[]);for(const x of c){if(!x||!x.role){console.warn("Skipping invalid message:",x);continue}const E=Array.isArray(x.content)?x.content[0]:x.content;if(!E){console.warn("Skipping message with no content:",x);continue}E.type==="text"&&E.text?x.role==="user"?u.push(new f(E.text)):x.role==="assistant"&&u.push(new m(E.text)):console.warn("Skipping message with unsupported content type:",E)}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 E={model:e.model,apiKey:e.apiKey};if(s!==void 0&&(E.maxTokens=s),i!==void 0?E.temperature=i:e.temperature!==void 0&&(E.temperature=e.temperature),e.provider==="openai"){const{ChatOpenAI:w}=await hr(async()=>{const{ChatOpenAI:_}=await import("./index-DOX6bDm6.js");return{ChatOpenAI:_}},__vite__mapDeps([5,6,7,3,8,9]));x=new w(E)}else if(e.provider==="anthropic"){const{ChatAnthropic:w}=await hr(async()=>{const{ChatAnthropic:_}=await import("./index-DtG5fMwI.js");return{ChatAnthropic:_}},__vite__mapDeps([10,7,6,3]));x=new w(E)}else if(e.provider==="google"){const{ChatGoogleGenerativeAI:w}=await hr(async()=>{const{ChatGoogleGenerativeAI:_}=await import("./index-Cf0O1YbZ.js");return{ChatGoogleGenerativeAI:_}},__vite__mapDeps([11,7,6,3,9]));x=new w(E)}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 mve({request:e,onApprove:t,onReject:n,onClose:r,previewMode:a,onTogglePreview:s,isCopied:i,onCopy:c,onDownload:u,onFullscreen:f,llmConfig:m}){const[h,b]=v.useState("manual"),[y,x]=v.useState("stub-model"),[E,w]=v.useState("endTurn"),[_,S]=v.useState("assistant"),[T,R]=v.useState("text"),[C,I]=v.useState("positive"),[A,O]=v.useState(""),[j,U]=v.useState("image/png"),[B,W]=v.useState(!1),[J,ee]=v.useState(null),{generateResponse:re,isAvailable:F}=pve({llmConfig:m});v.useEffect(()=>{e&&(x("stub-model"),w("endTurn"),S("assistant"),R("text"),I("positive"),O(""),U("image/png"),ee(null))},[e?.id]);const K=async()=>{if(!(!e||!F)){W(!0),ee(null);try{const D=await re({request:e.request});x(D.model||m?.model||"stub-model"),w(D.stopReason||"endTurn"),S(D.role||"assistant");const H=Array.isArray(D.content)?D.content[0]:D.content;H.type==="text"?(R("text"),I(H.text||"")):H.type==="image"&&(R("image"),O(H.data||""),U(H.mimeType||"image/png"))}catch(D){const H=D instanceof Error?D.message:"Failed to generate response";ee(H),Xt.error("LLM Generation Failed",{description:H})}finally{W(!1)}}},V=v.useMemo(()=>{const D={model:y,stopReason:E,role:_,content:{type:T}};return T==="text"?D.content.text=C:T==="image"&&(D.content.data=A,D.content.mimeType=j),D},[y,E,_,T,C,A,j]),ne=()=>{if(!e)return;const D=r_.safeParse(V);if(!D.success){Xt.error("Invalid response",{description:`Validation failed: ${D.error.message}`});return}t(e.id,D.data),r(),hr(()=>Promise.resolve().then(()=>Hu),void 0).then(H=>{const $=Xt(H.createElement("div",{className:"space-y-3"},H.createElement("div",null,H.createElement("strong",null,"Sampling Response Sent"),H.createElement("p",{className:"text-sm text-muted-foreground mt-1"},"The tool will continue executing.")),H.createElement("div",{className:"flex gap-2"},H.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($)}},"View Tool Result"))),{duration:5e3})})},te=()=>{e&&(n(e.id,"User rejected sampling request"),r())};return e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"flex items-center justify-between p-4 border-b dark:border-zinc-700",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.serverName}),d.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleString()})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0",children:i?d.jsx(oa,{className:"h-4 w-4 text-green-600"}):d.jsx(zr,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Copy request"})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:d.jsx(Lp,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Download request"})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:f,className:"h-8 w-8 p-0",children:d.jsx(K_,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Fullscreen"})]}),d.jsx(De,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:d.jsx(Ko,{className:"h-4 w-4"})})]})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Request"}),d.jsx("div",{className:"bg-muted rounded-lg p-3 max-h-64 overflow-auto",children:d.jsx(nr,{data:e.request})})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Response"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Wt,{htmlFor:`responseMode-${e.id}`,className:"text-xs text-gray-500 dark:text-gray-400",children:"Mode:"}),d.jsxs(_s,{value:h,onValueChange:D=>b(D),children:[d.jsx(Ns,{id:`responseMode-${e.id}`,className:"w-32 h-8 text-xs",children:d.jsx(Ts,{})}),d.jsxs(ks,{children:[d.jsx(Pr,{value:"manual",children:"Manual"}),d.jsx(Pr,{value:"llm",children:"LLM"})]})]})]})]}),h==="llm"&&d.jsxs("div",{className:"space-y-2 p-3 bg-muted rounded-lg",children:[F?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(De,{onClick:K,disabled:B,size:"sm",className:"flex items-center gap-2",children:B?d.jsxs(d.Fragment,{children:[d.jsx(Ai,{className:"h-4 w-4 animate-spin"}),"Generating..."]}):d.jsxs(d.Fragment,{children:[d.jsx(mie,{className:"h-4 w-4"}),"Generate with LLM"]})}),d.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Using ",m?.provider," (",m?.model,")"]})]}):d.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"LLM not configured. Please configure LLM in the Chat tab."}),J&&d.jsx("div",{className:"text-xs text-red-600 dark:text-red-400",children:J})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`model-${e.id}`,children:"Model"}),d.jsx(Tn,{id:`model-${e.id}`,value:y,onChange:D=>x(D.target.value),placeholder:"stub-model",disabled:h==="llm"&&B})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`stopReason-${e.id}`,children:"Stop Reason"}),d.jsx(Tn,{id:`stopReason-${e.id}`,value:E,onChange:D=>w(D.target.value),placeholder:"endTurn",disabled:h==="llm"&&B})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`role-${e.id}`,children:"Role"}),d.jsxs(_s,{value:_,onValueChange:D=>S(D),disabled:h==="llm"&&B,children:[d.jsx(Ns,{id:`role-${e.id}`,children:d.jsx(Ts,{})}),d.jsxs(ks,{children:[d.jsx(Pr,{value:"assistant",children:"assistant"}),d.jsx(Pr,{value:"user",children:"user"})]})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`contentType-${e.id}`,children:"Content Type"}),d.jsxs(_s,{value:T,onValueChange:D=>R(D),disabled:h==="llm"&&B,children:[d.jsx(Ns,{id:`contentType-${e.id}`,children:d.jsx(Ts,{})}),d.jsxs(ks,{children:[d.jsx(Pr,{value:"text",children:"text"}),d.jsx(Pr,{value:"image",children:"image"})]})]})]}),T==="text"&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`text-${e.id}`,children:"Text Content"}),d.jsx(Dl,{id:`text-${e.id}`,value:C,onChange:D=>I(D.target.value),placeholder:"Enter response text...",rows:6,disabled:h==="llm"&&B})]}),T==="image"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`imageData-${e.id}`,children:"Base64 Image Data"}),d.jsx(Dl,{id:`imageData-${e.id}`,value:A,onChange:D=>O(D.target.value),placeholder:"Base64 encoded image data...",rows:4,disabled:h==="llm"&&B})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Wt,{htmlFor:`mimeType-${e.id}`,children:"MIME Type"}),d.jsx(Tn,{id:`mimeType-${e.id}`,value:j,onChange:D=>U(D.target.value),placeholder:"image/png",disabled:h==="llm"&&B})]})]})]})]}),d.jsxs("div",{className:"flex gap-2 p-4 border-t dark:border-zinc-700",children:[d.jsx(De,{onClick:ne,className:"flex-1",disabled:h==="llm"&&B,children:"Approve"}),d.jsx(De,{onClick:te,variant:"outline",className:"flex-1",disabled:h==="llm"&&B,children:"Reject"})]})]}):d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a sampling request to view details"})})}function hve({pendingRequests:e,onApprove:t,onReject:n,serverId:r,isConnected:a,mcpServerUrl:s}){const{selectedSamplingRequestId:i,setSelectedSamplingRequestId:c}=Bl(),{llmConfig:u}=c6({mcpServerUrl:s}),[f,m]=v.useState(null),[h,b]=v.useState(""),[y,x]=v.useState(-1),[E,w]=v.useState(!0),[_,S]=v.useState(!1),[T,R]=v.useState(!0),[C,I]=v.useState(!1),A=v.useRef(null),O=v.useRef(null),j=v.useRef(null),U=v.useRef(!1);v.useEffect(()=>{if(console.log("[SamplingTab] Auto-selection check:",{selectedSamplingRequestId:i,pendingRequestsCount:e.length,currentSelectedId:f?.id}),i&&e.length>0){const V=e.find(ne=>ne.id===i);console.log("[SamplingTab] Found request for auto-selection:",!!V,V?.id),V&&(console.log("[SamplingTab] Auto-selecting request:",V.id),c(null),m(V),setTimeout(()=>{const ne=document.getElementById(`sampling-request-${V.id}`);console.log("[SamplingTab] Scrolling to element:",!!ne),ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[i,e,c]),v.useEffect(()=>{const V=ne=>{const D=ne.detail.requestId;console.log("[SamplingTab] Custom navigate event received:",D);const H=e.find($=>$.id===D);H&&(console.log("[SamplingTab] Selecting request from event:",D),m(H),setTimeout(()=>{const $=document.getElementById(`sampling-request-${D}`);$&&$.scrollIntoView({behavior:"smooth",block:"nearest"})},200))};return window.addEventListener("navigate-to-sampling",V),()=>window.removeEventListener("navigate-to-sampling",V)},[e]),v.useEffect(()=>{E&&e.length>0&&A.current&&!U.current&&(A.current.scrollTop=0)},[e.length,E]),v.useEffect(()=>{const V=A.current;if(!V)return;const ne=()=>{V.scrollTop>0&&(U.current=!0,w(!1))};return V.addEventListener("scroll",ne),()=>V.removeEventListener("scroll",ne)},[]),v.useEffect(()=>{e.length===0&&(U.current=!1,w(!0))},[e.length]),v.useEffect(()=>{_&&j.current&&j.current.focus()},[_]);const B=v.useCallback(()=>{h.trim()||S(!1)},[h]),W=v.useMemo(()=>{if(!h.trim())return e;const V=h.toLowerCase();return e.filter(ne=>ne.serverName.toLowerCase().includes(V)||JSON.stringify(ne.request||{}).toLowerCase().includes(V))},[e,h]);v.useEffect(()=>{x(-1)},[h]),v.useEffect(()=>{const V=ne=>{const te=ne.target;if(te.tagName==="INPUT"||te.tagName==="TEXTAREA"||te.contentEditable==="true"||ne.metaKey||ne.ctrlKey||ne.altKey)return;const H=W;if(ne.key==="ArrowDown")ne.preventDefault(),x($=>{const L=$+1;return L>=H.length?0:L});else if(ne.key==="ArrowUp")ne.preventDefault(),x($=>{const L=$-1;return L<0?H.length-1:L});else if(ne.key==="Enter"&&y>=0){ne.preventDefault();const $=W[y];$&&J($)}};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[y,W]),v.useEffect(()=>{if(y>=0){const V=`sampling-request-${W[y]?.id}`,ne=document.getElementById(V);ne&&ne.scrollIntoView({behavior:"smooth",block:"nearest"})}},[y,W]);const J=v.useCallback(V=>{m(V)},[]),ee=v.useCallback(()=>{window.confirm("Are you sure you want to reject all sampling requests? This cannot be undone.")&&(e.forEach(V=>{n(V.id,"User rejected all requests")}),m(null))},[e,n]),re=v.useCallback(async()=>{if(f)try{await navigator.clipboard.writeText(JSON.stringify({id:f.id,serverName:f.serverName,timestamp:f.timestamp,request:f.request},null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch(V){console.error("[SamplingTab] Failed to copy request:",V)}},[f]),F=v.useCallback(()=>{if(f)try{const V=new globalThis.Blob([JSON.stringify({id:f.id,serverName:f.serverName,timestamp:f.timestamp,request:f.request},null,2)],{type:"application/json"}),ne=URL.createObjectURL(V),te=document.createElement("a");te.href=ne,te.download=`sampling-request-${Date.now()}.json`,document.body.appendChild(te),te.click(),document.body.removeChild(te),URL.revokeObjectURL(ne)}catch(V){console.error("[SamplingTab] Failed to download request:",V)}},[f]),K=v.useCallback(async()=>{if(O.current)try{document.fullscreenElement?await document.exitFullscreen():await O.current.requestFullscreen()}catch(V){console.error("[SamplingTab] Failed to toggle fullscreen:",V)}},[]);return a?d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:40,minSize:30,children:d.jsx(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:d.jsxs(Rn,{defaultSize:75,minSize:30,children:[d.jsx(dve,{isSearchExpanded:_,searchQuery:h,filteredRequestsCount:W.length,requestsCount:e.length,onSearchExpand:()=>S(!0),onSearchChange:b,onSearchBlur:B,onRejectAll:ee,searchInputRef:j}),d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(fve,{requests:W,selectedRequest:f,onRequestSelect:J,focusedIndex:y,formatRelativeTime:Vb,listRef:A})})]})})}),d.jsx(vo,{}),d.jsx(Rn,{defaultSize:60,minSize:40,children:d.jsx("div",{ref:O,className:"h-full bg-white dark:bg-zinc-900",children:d.jsx(mve,{request:f,onApprove:t,onReject:n,onClose:()=>m(null),previewMode:T,onTogglePreview:()=>R(!T),isCopied:C,onCopy:re,onDownload:F,onFullscreen:K,llmConfig:u})})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(T3,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function gve({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:r,onSearchExpand:a,onSearchChange:s,onSearchBlur:i,onCancelAll:c,searchInputRef:u}){return d.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[d.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?d.jsx(Tn,{ref:u,placeholder:"Search requests...",value:t,onChange:f=>s(f.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Elicitation"}),d.jsx(kr,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:d.jsx(nd,{className:"h-4 w-4"})})}),d.jsxs(Lt,{side:"bottom",className:"flex gap-2",children:["Search",d.jsx(Xp,{children:"F"})]})]})]})}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,disabled:r===0,className:"h-8 w-8 p-0",children:d.jsx(Ko,{className:"h-4 w-4"})})}),d.jsx(Lt,{side:"bottom",children:"Cancel all"})]})})]})}function bve({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:r,formatRelativeTime:a,listRef:s}){return e.length===0?d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx(td,{vertical:!0,noBorder:!0,message:"No elicitation requests"})}):d.jsx("div",{ref:s,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((i,c)=>{const u=i.request.mode||"form",f=u==="form"&&"requestedSchema"in i.request&&i.request.requestedSchema;return d.jsx(Bi,{id:`elicitation-request-${i.id}`,isSelected:t?.id===i.id,isFocused:r===c,title:d.jsxs("span",{className:"flex items-center gap-3",children:[i.serverName,d.jsx(kr,{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=a(i.timestamp),h=[];f&&h.push("with schema"),u==="url"&&h.push("external action");const b=h.length>0?` | ${h.join(", ")}`:"";return m+b})(),onClick:()=>n(i)},i.id)})})}function yve({request:e,onApprove:t,onReject:n,onClose:r,previewMode:a,onTogglePreview:s,isCopied:i,onCopy:c,onDownload:u,onFullscreen:f}){const[m,h]=v.useState({}),[b,y]=v.useState(!1),x=e?.request.mode||"form",E=x==="form",w=x==="url";v.useEffect(()=>{if(e&&E&&"requestedSchema"in e.request){const A=e.request.requestedSchema,O={};if(A?.type==="object"&&A.properties)for(const[j,U]of Object.entries(A.properties)){const B=U;B.default!==void 0?O[j]=B.default:B.type==="boolean"?O[j]=!1:B.type==="number"||B.type==="integer"?O[j]=0:O[j]=""}h(O)}y(!1)},[e?.id,E]);const _=(A,O)=>{h(j=>({...j,[A]:O}))},S=()=>{if(e){if(E){if("requestedSchema"in e.request){const A=e.request.requestedSchema;if(A?.required){const O=A.required.filter(j=>m[j]===void 0||m[j]===""||m[j]===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 w&&t(e.id,{action:"accept"});r(),hr(()=>Promise.resolve().then(()=>Hu),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 j=new globalThis.CustomEvent("navigate-to-tool-result",{detail:{toolName:null}});window.dispatchEvent(j),Xt.dismiss(O)}},"View Tool Result"))),{duration:5e3})})}},T=()=>{e&&(t(e.id,{action:"decline"}),r())},R=()=>{e&&(n(e.id,"User cancelled elicitation request"),r())},C=()=>{e&&w&&"url"in e.request&&(window.open(e.request.url,"_blank"),y(!0))},I=v.useMemo(()=>{if(!e||!E||!("requestedSchema"in e.request))return null;const A=e.request.requestedSchema;if(!A||A.type!=="object"||!A.properties)return d.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No form schema available"});const O=A.properties,j=A.required||[];return d.jsx("div",{className:"space-y-4",children:Object.entries(O).map(([U,B])=>{const W=B,J=j.includes(U),ee=W.type||"string",re=W.title||U,F=W.description;return d.jsxs("div",{className:"space-y-2",children:[d.jsxs(Wt,{htmlFor:`field-${U}`,children:[re,J&&d.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),F&&d.jsx("p",{className:"text-xs text-muted-foreground",children:F}),ee==="boolean"?d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx(pp,{id:`field-${U}`,checked:m[U]||!1,onCheckedChange:K=>_(U,K)}),d.jsx(Wt,{htmlFor:`field-${U}`,className:"text-sm font-normal cursor-pointer",children:W.title||U})]}):ee==="number"||ee==="integer"?d.jsx(Tn,{id:`field-${U}`,type:"number",value:m[U]||"",onChange:K=>_(U,ee==="integer"?parseInt(K.target.value,10):parseFloat(K.target.value)),placeholder:W.default?.toString()||""}):W.enum?d.jsxs("select",{id:`field-${U}`,value:m[U]||"",onChange:K=>_(U,K.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:[d.jsx("option",{value:"",children:"Select..."}),W.enum.map(K=>d.jsx("option",{value:K,children:K},K))]}):ee==="string"&&(W.format==="textarea"||W.maxLength>100)?d.jsx(Dl,{id:`field-${U}`,value:m[U]||"",onChange:K=>_(U,K.target.value),placeholder:W.default||"",rows:4}):d.jsx(Tn,{id:`field-${U}`,type:"text",value:m[U]||"",onChange:K=>_(U,K.target.value),placeholder:W.default||""})]},U)})})},[e,m,E]);return e?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"flex items-center justify-between p-4 border-b dark:border-zinc-700",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.serverName}),d.jsx(kr,{variant:"outline",className:w?"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}),d.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleString()})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:c,className:"h-8 w-8 p-0",children:i?d.jsx(oa,{className:"h-4 w-4 text-green-600"}):d.jsx(zr,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Copy request"})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:d.jsx(Lp,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Download request"})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",onClick:f,className:"h-8 w-8 p-0",children:d.jsx(K_,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:"Fullscreen"})]}),d.jsx(De,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:d.jsx(Ko,{className:"h-4 w-4"})})]})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Message"}),d.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:e.request.message})]}),w&&"url"in e.request&&d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"External Action Required"}),d.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:"This request requires you to complete an action at an external URL:"}),d.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background rounded border",children:[d.jsx("code",{className:"flex-1 text-xs font-mono break-all",children:e.request.url}),d.jsxs(De,{size:"sm",variant:"outline",onClick:C,className:"flex items-center gap-2",children:[d.jsx(Tx,{className:"h-4 w-4"}),"Open URL"]})]}),d.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[d.jsx(pp,{id:"url-completed",checked:b,onCheckedChange:A=>y(!!A)}),d.jsx(Wt,{htmlFor:"url-completed",className:"text-sm font-normal cursor-pointer",children:"I have completed the required action"})]})]})]}),E&&d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Form Data"}),I]}),E&&"requestedSchema"in e.request&&e.request.requestedSchema&&d.jsxs("details",{className:"space-y-2",children:[d.jsx("summary",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 cursor-pointer",children:"Schema (for reference)"}),d.jsx("div",{className:"bg-muted rounded-lg p-3 max-h-64 overflow-auto",children:d.jsx(nr,{data:e.request.requestedSchema})})]})]}),d.jsxs("div",{className:"flex gap-2 p-4 border-t dark:border-zinc-700",children:[d.jsx(De,{onClick:S,className:"flex-1",children:"Accept"}),d.jsx(De,{onClick:T,variant:"outline",className:"flex-1",children:"Decline"}),d.jsx(De,{onClick:R,variant:"outline",className:"flex-1",children:"Cancel"})]})]}):d.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select an elicitation request to view details"})})}function vve({pendingRequests:e=[],onApprove:t,onReject:n,serverId:r,isConnected:a}){const{selectedElicitationRequestId:s,setSelectedElicitationRequestId:i}=Bl(),[c,u]=v.useState(null),[f,m]=v.useState(""),[h,b]=v.useState(-1),[y,x]=v.useState(!0),[E,w]=v.useState(!1),[_,S]=v.useState(!0),[T,R]=v.useState(!1),C=v.useRef(null),I=v.useRef(null),A=v.useRef(null),O=v.useRef(!1);v.useEffect(()=>{if(console.log("[ElicitationTab] Auto-selection check:",{selectedElicitationRequestId:s,pendingRequestsCount:e.length,currentSelectedId:c?.id}),s&&e.length>0){const F=e.find(K=>K.id===s);console.log("[ElicitationTab] Found request for auto-selection:",!!F,F?.id),F&&(console.log("[ElicitationTab] Auto-selecting request:",F.id),i(null),u(F),setTimeout(()=>{const K=document.getElementById(`elicitation-request-${F.id}`);console.log("[ElicitationTab] Scrolling to element:",!!K),K&&K.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[s,e,i]),v.useEffect(()=>{const F=K=>{const ne=K.detail.requestId;console.log("[ElicitationTab] Custom navigate event received:",ne);const te=e.find(D=>D.id===ne);te&&(console.log("[ElicitationTab] Selecting request from event:",ne),u(te),setTimeout(()=>{const D=document.getElementById(`elicitation-request-${ne}`);D&&D.scrollIntoView({behavior:"smooth",block:"nearest"})},200))};return window.addEventListener("navigate-to-elicitation",F),()=>window.removeEventListener("navigate-to-elicitation",F)},[e]),v.useEffect(()=>{y&&e.length>0&&C.current&&!O.current&&(C.current.scrollTop=0)},[e.length,y]),v.useEffect(()=>{const F=C.current;if(!F)return;const K=()=>{F.scrollTop>0&&(O.current=!0,x(!1))};return F.addEventListener("scroll",K),()=>F.removeEventListener("scroll",K)},[]),v.useEffect(()=>{e.length===0&&(O.current=!1,x(!0))},[e.length]),v.useEffect(()=>{E&&A.current&&A.current.focus()},[E]);const j=v.useCallback(()=>{f.trim()||w(!1)},[f]),U=v.useMemo(()=>{if(!f.trim())return e;const F=f.toLowerCase();return e.filter(K=>K.serverName.toLowerCase().includes(F)||K.request.message.toLowerCase().includes(F)||JSON.stringify(K.request||{}).toLowerCase().includes(F))},[e,f]);v.useEffect(()=>{b(-1)},[f]),v.useEffect(()=>{const F=K=>{const V=K.target;if(V.tagName==="INPUT"||V.tagName==="TEXTAREA"||V.contentEditable==="true"||K.metaKey||K.ctrlKey||K.altKey)return;const te=U;if(K.key==="ArrowDown")K.preventDefault(),b(D=>{const H=D+1;return H>=te.length?0:H});else if(K.key==="ArrowUp")K.preventDefault(),b(D=>{const H=D-1;return H<0?te.length-1:H});else if(K.key==="Enter"&&h>=0){K.preventDefault();const D=U[h];D&&B(D)}};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[h,U]),v.useEffect(()=>{if(h>=0){const F=`elicitation-request-${U[h]?.id}`,K=document.getElementById(F);K&&K.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,U]);const B=v.useCallback(F=>{u(F)},[]),W=v.useCallback(()=>{window.confirm("Are you sure you want to cancel all elicitation requests? This cannot be undone.")&&(e.forEach(F=>{n(F.id,"User cancelled all requests")}),u(null))},[e,n]),J=v.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)),R(!0),setTimeout(()=>R(!1),2e3)}catch(F){console.error("[ElicitationTab] Failed to copy request:",F)}},[c]),ee=v.useCallback(()=>{if(c)try{const F=new globalThis.Blob([JSON.stringify({id:c.id,serverName:c.serverName,timestamp:c.timestamp,request:c.request},null,2)],{type:"application/json"}),K=URL.createObjectURL(F),V=document.createElement("a");V.href=K,V.download=`elicitation-request-${Date.now()}.json`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(K)}catch(F){console.error("[ElicitationTab] Failed to download request:",F)}},[c]),re=v.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(F){console.error("[ElicitationTab] Failed to toggle fullscreen:",F)}},[]);return a?d.jsxs(aa,{direction:"horizontal",className:"h-full",children:[d.jsx(Rn,{defaultSize:40,minSize:30,children:d.jsx(aa,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:d.jsxs(Rn,{defaultSize:75,minSize:30,children:[d.jsx(gve,{isSearchExpanded:E,searchQuery:f,filteredRequestsCount:U.length,requestsCount:e.length,onSearchExpand:()=>w(!0),onSearchChange:m,onSearchBlur:j,onCancelAll:W,searchInputRef:A}),d.jsx("div",{className:"flex flex-col h-full",children:d.jsx(bve,{requests:U,selectedRequest:c,onRequestSelect:B,focusedIndex:h,formatRelativeTime:Vb,listRef:C})})]})})}),d.jsx(vo,{}),d.jsx(Rn,{defaultSize:60,minSize:40,children:d.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:d.jsx(yve,{request:c,onApprove:t,onReject:n,onClose:()=>u(null),previewMode:_,onTogglePreview:()=>S(!_),isCopied:T,onCopy:J,onDownload:ee,onFullscreen:re})})})]}):d.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[d.jsx(R3,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),d.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function wve({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:a,children:s}){return e?d.jsxs(d.Fragment,{children:[d.jsx("div",{style:{display:t==="tools"?"block":"none"},className:"h-full",children:d.jsx(j6,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state==="ready"})}),d.jsx("div",{style:{display:t==="prompts"?"block":"none"},className:"h-full",children:d.jsx(O6,{ref:r,prompts:e.prompts,callPrompt:e.getPrompt,serverId:e.id,isConnected:e.state==="ready"})}),d.jsx("div",{style:{display:t==="resources"?"block":"none"},className:"h-full",children:d.jsx(L6,{ref:a,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state==="ready"})}),d.jsx("div",{style:{display:t==="chat"?"block":"none"},className:"h-full",children:d.jsx(xye,{connection:e,isConnected:e.state==="ready",readResource:e.readResource},e.id)}),d.jsx("div",{style:{display:t==="sampling"?"block":"none"},className:"h-full",children:d.jsx(hve,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state==="ready",mcpServerUrl:e.url})}),d.jsx("div",{style:{display:t==="elicitation"?"block":"none"},className:"h-full",children:d.jsx(vve,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state==="ready"})}),d.jsx("div",{style:{display:t==="notifications"?"block":"none"},className:"h-full",children:d.jsx(eve,{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"&&d.jsx(d.Fragment,{children:s})]}):d.jsx(d.Fragment,{children:s})}function Y$({className:e}){return d.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:[d.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"}),d.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}const P6=v.createContext(void 0);function U6(){const e=v.use(P6);if(!e)throw new Error("useTabs must be used within a TabsProvider");return e}const $6=v.createContext(void 0);function Eve(){return v.use($6)}function OS({ref:e,children:t,defaultValue:n,value:r,onValueChange:a,className:s,...i}){const[c,u]=v.useState(n||""),f=r!==void 0,m=v.useCallback(b=>{f||u(b),a?.(b)},[f,a]),h=f?r:c;return d.jsx(P6,{value:{activeValue:h,handleValueChange:m},children:d.jsx("div",{ref:e,className:Oe("flex flex-col gap-2",s),...i,children:t})})}OS.displayName="Tabs";function DS({ref:e,children:t,className:n,variant:r="default",...a}){const{activeValue:s}=U6(),[i,c]=v.useState({width:0,left:0}),u=v.useRef(null),f=v.useRef(null),m=v.useRef(null),b=v.Children.toArray(t).findIndex(E=>v.isValidElement(E)&&E.props.value===s),y=v.useCallback(()=>{const E=u.current;if(!E)return;const _=E.querySelectorAll("button")[b];if(_){const S=E.getBoundingClientRect(),T=_.getBoundingClientRect();c({width:T.width,left:T.left-S.left})}},[b]),x=v.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(y,16)},[y]);return v.useEffect(()=>{const E=setTimeout(y,10);return()=>clearTimeout(E)},[y]),v.useEffect(()=>{const E=u.current;return E?(f.current=new ResizeObserver(()=>{x()}),f.current.observe(E),E.querySelectorAll("button").forEach(_=>{f.current&&f.current.observe(_)}),()=>{f.current&&f.current.disconnect(),m.current&&clearTimeout(m.current)}):void 0},[x]),v.useEffect(()=>{const E=()=>{x()};return window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[x]),v.useEffect(()=>{const E=u.current;if(!E)return;const w=E.querySelector("[data-width]");w&&(w.style.width=`${i.width}px`,w.style.left=`${i.left}px`)},[i]),d.jsx($6,{value:{variant:r},children:d.jsxs("div",{ref:u,className:Oe("relative flex bg-none",r==="default"&&"p-1 rounded-full border border-zinc-300 dark:border-zinc-600",r==="underline"&&"border-b border-zinc-200 dark:border-zinc-700",n),...a,children:[t,d.jsx("span",{className:Oe("absolute transition-all duration-200 ease-out z-0",r==="default"&&"bg-white dark:bg-zinc-700 rounded-full h-[calc(100%-8px)] top-1 border border-zinc-300 dark:border-zinc-600",r==="underline"&&"bottom-0 h-0.5 bg-black dark:bg-white"),"data-width":i.width,"data-left":i.left})]})})}DS.displayName="TabsList";function LS({ref:e,children:t,value:n,className:r,disabled:a,icon:s,...i}){const{activeValue:c,handleValueChange:u}=U6(),m=Eve()?.variant||"default",h=c===n;return d.jsxs("button",{ref:e,disabled:a,onClick:()=>u(n),className:Oe("relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors 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",m==="default"&&"rounded-md px-4 py-2.5",m==="underline"&&"px-6 py-3 border-b-2 border-transparent",h&&"text-foreground",!h&&"text-muted-foreground hover:text-foreground",r),...i,children:[s&&d.jsx(s,{className:"mr-2 h-4 w-4"}),t]})}LS.displayName="TabsTrigger";function Z$({className:e}){const{theme:t,setTheme:n}=Jy(),r=v.useRef(null),[a,s]=v.useState(!1);v.useEffect(()=>{s(!0)},[]);const i=()=>t==="system"?"light":t==="light"?"dark":"system",c=()=>t==="system"?d.jsx(tP,{className:"size-4"}):t==="light"?d.jsx(vie,{className:"size-5"}):d.jsx(Jse,{className:"size-4"}),u=()=>t==="system"?"Switch to light mode":t==="light"?"Switch to dark mode":"Switch to system mode",f=async()=>{if(!r.current)return;const m=i();if(typeof document<"u"&&"startViewTransition"in document){await document.startViewTransition(()=>{Yu.flushSync(()=>{n(m)})}).ready;const{top:h,left:b,width:y,height:x}=r.current.getBoundingClientRect(),E=h+x/2,w=b+y/2,_=window.innerWidth-b,S=window.innerHeight-h,T=Math.hypot(Math.max(b,_),Math.max(h,S));document.documentElement.animate({clipPath:[`circle(0px at ${w}px ${E}px)`,`circle(${T}px at ${w}px ${E}px)`]},{duration:700,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})}else n(m)};return a?d.jsx("button",{ref:r,onClick:f,className:Oe(e),"aria-label":u(),title:`Current: ${t==="system"?"Auto":t==="light"?"Light":"Dark"}`,children:c()}):d.jsx("button",{ref:r,className:Oe(e),"aria-label":"Toggle theme",children:d.jsx(tP,{className:"size-4"})})}function q$({className:e,state:t="collapsed",href:n="https://mcp-use.com"}){const[r,a]=v.useState(!1),s=.2,i=.7,c=.6,u=4,f=s+i+c,m=0,h=s/f,b=(s+i)/f,y=1;return d.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:Oe("flex items-center transition-opacity -my-3",t==="expanded"?"space-x-2":"",e),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[d.jsx("div",{className:"relative",children:d.jsxs(wa.svg,{viewBox:"0 0 303 303",initial:"rest",animate:r?"hover":"rest",className:Oe("text-foreground",t==="expanded"?"size-[40px]":"size-[20px]"),children:[d.jsxs(wa.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:f,times:[m,h,b,y],ease:"easeInOut"}}},fill:"currentColor",fillRule:"nonzero",stroke:"currentColor",strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",children:[d.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"}),d.jsx("circle",{cx:"70.3",cy:"232.3",r:"50"}),d.jsx("circle",{cx:"232.3",cy:"70.3",r:"50"})]}),d.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx(xve,{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:b,T3:y},total:f}),d.jsx(X$,{cx:70.3,cy:232.3,r:50,times:{T0:m,T1:h,T2:b,T3:y},total:f}),d.jsx(X$,{cx:232.3,cy:70.3,r:50,times:{T0:m,T1:h,T2:b,T3:y},total:f})]})]})}),t==="expanded"&&d.jsxs("div",{className:"font-ubuntu flex flex-col items-start -space-y-1 mr-3",children:[d.jsx("h1",{className:"text-xl font-medium",children:"mcp-use"}),d.jsx("span",{className:"text-lg text-muted-foreground tracking-wide font-sans font-light",children:"Inspector"})]})]})}function xve({d:e,times:t,total:n}){const{T0:r,T1:a,T2:s,T3:i}=t;return d.jsx(wa.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[r,a,s,i],ease:"easeInOut"}}}})}function X$({cx:e,cy:t,r:n,times:r,total:a}){const{T0:s,T1:i,T2:c,T3:u}=r;return d.jsx(wa.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:a,times:[s,i,c,u],ease:"easeInOut"}}}})}function z6({ref:e,shimmerColor:t,shimmerSize:n="0.05em",shimmerDuration:r="3s",borderRadius:a="100px",background:s,className:i,children:c,...u}){const{resolvedTheme:f}=Jy(),m=f==="dark"?"#000000":"#ffffff",h=f==="dark"?"rgba(255, 255, 255, 1)":"rgba(0, 0, 0, 1)",b=t||m,y=s||h;return d.jsxs("button",{style:{"--spread":"90deg","--shimmer-color":b,"--radius":a,"--speed":r,"--cut":n,"--bg":y},className:Oe("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",f==="dark"?"border-black/10 text-black":"border-white/10 text-white",i),ref:e,...u,children:[d.jsx("div",{className:Oe("-z-30 blur-[2px]","[container-type:size] absolute inset-0 overflow-visible"),children:d.jsx("div",{className:"animate-shimmer-slide absolute inset-0 [aspect-ratio:1] h-[100cqh] [border-radius:0] [mask:none]",children:d.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,d.jsx("div",{className:Oe("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",f==="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]")}),d.jsx("div",{className:Oe("absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] [background:var(--bg)]")})]})}z6.displayName="ShimmerButton";function J$({status:e}){const t=s=>{switch(s){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:s}}},{color:n,ringColor:r,tooltip:a}=t(e);return d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsxs("div",{className:"relative",children:[d.jsx("div",{className:`absolute w-2 h-2 rounded-full ${r} animate-ping`}),d.jsx("div",{className:`relative w-2 h-2 rounded-full ${n}`})]})}),d.jsx(Lt,{children:d.jsx("p",{children:a})})]})}function Q$({connections:e,selectedServer:t,onServerSelect:n,onOpenConnectionOptions:r,mobileMode:a=!1}){const s=Ku(),i=c=>{const u=e.find(f=>f.id===c);if(!u||u.state!=="ready"){Xt.error("Server is not connected and cannot be inspected");return}n(c)};return a?d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("div",{className:"relative",children:d.jsxs(wx,{children:[d.jsx(Ex,{asChild:!0,children:d.jsxs(De,{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?d.jsx(vl,{serverUrl:t.url,serverName:t.name,size:"md"}):d.jsx(cie,{className:"h-5 w-5"}),d.jsx(Fl,{className:"h-4 w-4"})]})}),d.jsxs(mb,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[d.jsx(xx,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>s("/"),children:"MCP Servers"}),d.jsx(gf,{}),e.length===0?d.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=>d.jsxs(xs,{onClick:()=>i(c.id),className:"flex items-center gap-3",children:[d.jsx(vl,{serverUrl:c.url,serverName:c.name,size:"sm"}),d.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[d.jsx("div",{className:"font-medium",children:c.name}),d.jsx(J$,{status:c.state})]}),d.jsx(De,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:u=>{u.stopPropagation(),r(c.id)},children:d.jsx(cu,{className:"h-3 w-3"})})]},c.id)),d.jsx(gf,{}),d.jsx(xs,{onClick:()=>s("/"),children:d.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})}):d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("div",{className:"relative",children:d.jsxs(wx,{children:[d.jsx(Ex,{asChild:!0,children:d.jsxs(z6,{className:Oe("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&&d.jsx(vl,{serverUrl:t.url,serverName:t.name,size:"md",className:"mr-2"}),d.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[d.jsx("span",{className:"truncate",children:t?t.name:"Select server to inspect"}),t&&d.jsx("div",{className:"flex items-center gap-2",children:t.error&&t.state!=="ready"?d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.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"})}),d.jsx(Lt,{children:d.jsx("p",{className:"max-w-xs",children:t.error})})]}):d.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&&d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx("button",{type:"button",onClick:()=>{r(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:d.jsx(cu,{className:"h-4 w-4"})})}),d.jsx(Lt,{children:d.jsx("p",{children:"Edit connection settings"})})]}),d.jsxs(mb,{className:"w-[calc(100vw-2rem)] sm:w-[300px]",align:"start",children:[d.jsx(xx,{className:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:()=>s("/"),children:"MCP Servers"}),d.jsx(gf,{}),e.length===0?d.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=>d.jsxs(xs,{onClick:()=>i(c.id),className:"flex items-center gap-3",children:[d.jsx(vl,{serverUrl:c.url,serverName:c.name,size:"sm"}),d.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[d.jsx("div",{className:"font-medium",children:c.name}),d.jsx(J$,{status:c.state})]}),d.jsx(De,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800",onClick:u=>{u.stopPropagation(),r(c.id)},children:d.jsx(cu,{className:"h-3 w-3"})})]},c.id)),d.jsx(gf,{}),d.jsx(xs,{onClick:()=>s("/"),children:d.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"+ Add new server"})})]})]})})})}const ez=[{id:"tools",label:"Tools",icon:Cl},{id:"prompts",label:"Prompts",icon:Qf},{id:"resources",label:"Resources",icon:Lse},{id:"chat",label:"Chat",icon:Wse},{id:"sampling",label:"Sampling",icon:T3},{id:"elicitation",label:"Elicitation",icon:R3},{id:"notifications",label:"Notifications",icon:H_}];function tz(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 Sve({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:a,onCommandPaletteOpen:s,onOpenConnectionOptions:i}){const{tunnelUrl:c}=Bl(),u=t&&c,[f,m]=v.useState(!1),h=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 d.jsxs("header",{className:"w-full mx-auto",children:[d.jsxs("div",{className:"flex lg:hidden flex-col gap-3",children:[d.jsxs("div",{className:"flex items-center justify-between w-full",children:[d.jsx("div",{className:"flex-1 flex justify-start",children:d.jsx(Q$,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:i,mobileMode:!0})}),d.jsx("div",{className:"flex-shrink-0 flex justify-center",children:d.jsx("div",{className:"scale-150",children:d.jsx(q$,{state:"collapsed"})})}),d.jsxs("div",{className:"flex-1 flex justify-end items-center gap-2",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",asChild:!0,children:d.jsx("a",{href:"https://github.com/mcp-use/mcp-use",target:"_blank",rel:"noopener noreferrer",className:"p-2","aria-label":"GitHub",children:d.jsx(Y$,{className:"h-4 w-4"})})})}),d.jsx(Lt,{children:d.jsx("p",{children:"Give us a star ⭐"})})]}),d.jsx(Z$,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})]})]}),t&&d.jsx("div",{className:"w-full",children:d.jsx(OS,{value:n,onValueChange:b=>a(b),children:d.jsx(DS,{className:"w-full justify-center",children:ez.map(b=>{const y=tz(b.id,t);return d.jsxs(LS,{value:b.id,icon:b.icon,className:"[&>svg]:mr-0 flex-1 flex-row gap-2 relative",children:[y>0&&d.jsx("span",{className:Oe(n===b.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:y}),d.jsx("span",{className:"sr-only",children:b.label})]},b.id)})})})})]}),d.jsxs("div",{className:"hidden lg:flex items-center justify-between gap-3",children:[d.jsxs("div",{className:"flex items-center flex-wrap gap-2 md:space-x-6 space-x-2",children:[d.jsx(Q$,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:i}),t&&d.jsx(OS,{value:n,onValueChange:b=>a(b),children:d.jsx(DS,{className:"overflow-x-auto",children:ez.map(b=>{const y=tz(b.id,t);return d.jsx(LS,{value:b.id,icon:b.icon,className:"[&>svg]:mr-0 lg:[&>svg]:mr-2 relative",children:d.jsxs("div",{className:"items-center gap-2 hidden lg:flex",children:[b.label,y>0&&d.jsx("span",{className:Oe(n===b.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:y})]})},b.id)})})}),u&&d.jsxs(DH,{children:[d.jsx(LH,{asChild:!0,children:d.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:[d.jsx(ep,{className:"size-4 text-purple-600 dark:text-purple-400 animate-pulse"}),d.jsx("span",{className:"text-xs font-medium text-purple-700 dark:text-purple-300 hidden lg:inline",children:"Tunnel"})]})}),d.jsx(FT,{className:"w-[calc(100vw-2rem)] sm:w-96",align:"start",children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsxs("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:[d.jsx(ep,{className:"size-4 text-purple-600 dark:text-purple-400"}),"Tunnel URL"]}),d.jsxs("div",{className:"flex items-center gap-2 p-2 py-0 bg-muted rounded-full",children:[d.jsxs("code",{className:"flex-1 text-[10px] font-mono",children:[c,"/mcp"]}),d.jsx(De,{variant:"ghost",size:"sm",className:"h-7 px-2",onClick:h,children:f?d.jsx(oa,{className:"size-3.5 text-green-600"}):d.jsx(zr,{className:"size-3.5"})})]})]}),d.jsxs("div",{children:[d.jsx("h5",{className:"font-semibold text-sm mb-2",children:"Use in ChatGPT"}),d.jsxs("ol",{className:"space-y-2 text-xs text-muted-foreground",children:[d.jsxs("li",{className:"flex gap-2",children:[d.jsx("span",{className:"font-semibold text-foreground",children:"1."}),d.jsxs("span",{children:["Enable"," ",d.jsx("span",{className:"font-medium text-foreground",children:"dev mode"})," ","from settings"]})]}),d.jsxs("li",{className:"flex gap-2",children:[d.jsx("span",{className:"font-semibold text-foreground",children:"2."}),d.jsxs("span",{children:["In"," ",d.jsx("span",{className:"font-medium text-foreground",children:"App & Connectors"})," ","click on"," ",d.jsx("span",{className:"font-medium text-foreground",children:"create"})]})]}),d.jsxs("li",{className:"flex gap-2",children:[d.jsx("span",{className:"font-semibold text-foreground",children:"3."}),d.jsx("span",{children:"Use the tunnel URL in the input"})]})]})]})]})})]})]}),d.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[d.jsxs(Ot,{children:[d.jsx(Dt,{children:d.jsx(Z$,{className:"p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors cursor-pointer"})}),d.jsx(Lt,{children:d.jsx("p",{children:"Toggle theme"})})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsxs(De,{variant:"ghost",className:"hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full px-1 -mx-3 flex gap-1",onClick:s,children:[d.jsx(bse,{className:"size-4"}),d.jsx("span",{className:"text-base font-mono hidden sm:inline",children:"K"})]})}),d.jsx(Lt,{children:d.jsx("p",{children:"Command Palette"})})]}),d.jsxs(Ot,{children:[d.jsx(Dt,{asChild:!0,children:d.jsx(De,{variant:"ghost",size:"sm",asChild:!0,children:d.jsxs("a",{href:"https://github.com/mcp-use/mcp-use",className:"flex items-center gap-2",target:"_blank",rel:"noopener noreferrer",children:[d.jsx(Y$,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Github"})]})})}),d.jsx(Lt,{children:d.jsx("p",{children:"Give us a star ⭐"})})]}),d.jsx(q$,{state:"expanded"})]})]})]})}function _ve({children:e}){const t=Ku(),n=js(),{connections:r,addConnection:a,removeConnection:s,updateConnectionConfig:i,configLoaded:c}=B_(),{selectedServerId:u,setSelectedServerId:f,activeTab:m,setActiveTab:h,navigateToItem:b,setTunnelUrl:y}=Bl(),[x,E]=v.useState(!1),[w,_]=v.useState(null),S=$pe();v.useEffect(()=>{const K=new URLSearchParams(n.search).get("tunnelUrl");y(K)},[n.search,y]),v.useEffect(()=>{const F=ne=>{const D=ne.detail.requestId;u&&b(u,"sampling",D)},K=ne=>{const D=ne.detail.requestId;u&&b(u,"elicitation",D)},V=ne=>{const D=ne.detail.toolName;u&&D?b(u,"tools",D):u&&h("tools")};return window.addEventListener("navigate-to-sampling",F),window.addEventListener("navigate-to-elicitation",K),window.addEventListener("navigate-to-tool-result",V),()=>{window.removeEventListener("navigate-to-sampling",F),window.removeEventListener("navigate-to-elicitation",K),window.removeEventListener("navigate-to-tool-result",V)}},[u,h,b]);const T=v.useRef(null),R=v.useRef(null),C=v.useRef(null),{isAutoConnecting:I}=Upe({connections:r,addConnection:a,removeConnection:s,configLoaded:c}),A=v.useCallback(F=>{Tr.getInstance().capture(new Doe({trigger:F})).catch(()=>{}),E(!0)},[]),O=F=>{const K=r.find(D=>D.id===F);if(!K||K.state!=="ready"){Xt.error("Server is not connected and cannot be inspected");return}f(F);const ne=new URLSearchParams(n.search).get("tunnelUrl"),te=ne?`/?server=${encodeURIComponent(F)}&tunnelUrl=${encodeURIComponent(ne)}`:`/?server=${encodeURIComponent(F)}`;t(te)},j=v.useCallback(F=>{_(F)},[]),U=v.useCallback(F=>{w&&(F.url!==w?(s(w),a(F.url,F.name,F.proxyConfig,F.transportType)):i(w,{name:F.name,proxyConfig:F.proxyConfig,transportType:F.transportType}),_(null),Xt.success("Connection settings updated"))},[w,s,a,i]),B=(F,K,V)=>{if(console.warn("[Layout] handleCommandPaletteNavigate called:",{tab:F,itemName:K,serverId:V}),V){const ne=r.find($=>$.id===V);if(console.warn("[Layout] Server lookup:",{serverId:V,serverFound:!!ne,serverState:ne?.state}),!ne||ne.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:V,tab:F,itemName:K}),b(V,F,K);const D=new URLSearchParams(n.search).get("tunnelUrl"),H=D?`/?server=${encodeURIComponent(V)}&tunnelUrl=${encodeURIComponent(D)}`:`/?server=${encodeURIComponent(V)}`;console.warn("[Layout] Navigating to:",H),t(H)}else console.warn("[Layout] No serverId, just updating tab to:",F),h(F)},W=r.find(F=>F.id===u),J=W?W.tools.map(F=>({...F,_serverId:W.id})):r.flatMap(F=>F.state==="ready"?F.tools.map(K=>({...K,_serverId:F.id,_serverName:F.name})):[]),ee=W?W.prompts.map(F=>({...F,_serverId:W.id})):r.flatMap(F=>F.state==="ready"?F.prompts.map(K=>({...K,_serverId:F.id,_serverName:F.name})):[]),re=W?W.resources.map(F=>({...F,_serverId:W.id})):r.flatMap(F=>F.state==="ready"?F.resources.map(K=>({...K,_serverId:F.id,_serverName:F.name})):[]);return v.useEffect(()=>{const K=new URLSearchParams(n.search).get("server"),V=K?decodeURIComponent(K):null;V!==u&&f(V)},[n.search,u,f]),v.useEffect(()=>{const K=new URLSearchParams(n.search).get("server");if(!K)return;const V=decodeURIComponent(K),ne=r.find(te=>te.id===V);if(!ne){const te=setTimeout(()=>t("/"),3e3);return()=>clearTimeout(te)}if(ne.state==="failed"){const te=setTimeout(()=>t("/"),2e3);return()=>clearTimeout(te)}},[n.search,t,r]),iH({onCommandPalette:()=>A("keyboard"),onToolsTab:()=>{W&&h("tools")},onPromptsTab:()=>{W&&h("prompts")},onResourcesTab:()=>{W&&h("resources")},onChatTab:()=>{W&&h("chat")},onHome:()=>{t("/")},onFocusSearch:()=>{m==="tools"&&T.current?T.current.focusSearch():m==="prompts"&&R.current?R.current.focusSearch():m==="resources"&&C.current&&C.current.focusSearch()},onBlurSearch:()=>{m==="tools"&&T.current?T.current.blurSearch():m==="prompts"&&R.current?R.current.blurSearch():m==="resources"&&C.current&&C.current.blurSearch()}}),I?d.jsx("div",{className:"h-screen bg-white dark:bg-zinc-900 flex items-center justify-center",children:d.jsxs("div",{className:"flex flex-col items-center gap-4",children:[d.jsx(Vo,{className:"h-8 w-8 text-zinc-600 dark:text-zinc-400"}),d.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Connecting to MCP server..."})]})}):d.jsx(w3,{children:d.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:[d.jsx(Sve,{connections:r,selectedServer:W,activeTab:m,onServerSelect:O,onTabChange:h,onCommandPaletteOpen:()=>A("button"),onOpenConnectionOptions:j}),d.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:d.jsx(wve,{selectedServer:W,activeTab:m,toolsSearchRef:T,promptsSearchRef:R,resourcesSearchRef:C,children:e})}),d.jsx(fme,{isOpen:x,onOpenChange:E,tools:J,prompts:ee,resources:re,savedRequests:S,connections:r,onNavigate:B,onServerSelect:O}),d.jsx(_B,{connection:w&&r.find(F=>F.id===w)||null,open:w!==null,onOpenChange:F=>{F||_(null)},onConnect:U})]})})}function Tve(){const[e,t]=v.useState("processing"),[n,r]=v.useState("");return v.useEffect(()=>{console.log("[OAuthCallback] Component mounted, handling authorization..."),console.log("[OAuthCallback] Current URL:",window.location.href),f_().then(()=>{console.log("[OAuthCallback] Authorization successful"),t("success")}).catch(a=>{console.error("[OAuthCallback] Authorization failed:",a),t("error"),r(a instanceof Error?a.message:String(a))})},[]),e==="processing"?d.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:d.jsxs("div",{className:"flex flex-col items-center gap-4",children:[d.jsx(Ai,{className:"h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400"}),d.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Completing authentication..."})]})}):e==="error"?d.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:d.jsxs("div",{className:"max-w-md p-6",children:[d.jsx("h1",{className:"text-xl font-semibold text-red-600 dark:text-red-400 mb-2",children:"Authentication Error"}),d.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mb-4",children:n}),d.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-500",children:"You can close this window and try again."})]})}):d.jsx("div",{className:"h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900",children:d.jsxs("div",{className:"max-w-md p-6",children:[d.jsx("h1",{className:"text-xl font-semibold text-green-600 dark:text-green-400 mb-2",children:"Authentication Successful!"}),d.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Redirecting you back..."})]})})}var Nve=(e,t,n,r,a,s,i,c)=>{let u=document.documentElement,f=["light","dark"];function m(y){(Array.isArray(e)?e:[e]).forEach(x=>{let E=x==="class",w=E&&s?a.map(_=>s[_]||_):a;E?(u.classList.remove(...w),u.classList.add(s&&s[y]?s[y]:y)):u.setAttribute(x,y)}),h(y)}function h(y){c&&f.includes(y)&&(u.style.colorScheme=y)}function b(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)m(r);else try{let y=localStorage.getItem(t)||n,x=i&&y==="system"?b():y;m(x)}catch{}},kve=v.createContext(void 0),Cve={setTheme:e=>{},themes:[]},Rve=()=>{var e;return(e=v.useContext(kve))!=null?e:Cve};v.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:a,defaultTheme:s,value:i,themes:c,nonce:u,scriptProps:f})=>{let m=JSON.stringify([n,t,s,e,c,i,r,a]).slice(1,-1);return v.createElement("script",{...f,suppressHydrationWarning:!0,nonce:typeof window>"u"?u:"",dangerouslySetInnerHTML:{__html:`(${Nve.toString()})(${m})`}})});function Ave({...e}){const{theme:t="system"}=Rve();return d.jsx(A3,{theme:t,className:"toaster group",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...e})}function Ive(){return d.jsx(tbe,{children:d.jsx(zoe,{children:d.jsxs(Ppe,{children:[d.jsx(UQ,{basename:"/inspector",children:d.jsxs(hQ,{children:[d.jsx(ux,{path:"/oauth/callback",element:d.jsx(Tve,{})}),d.jsx(ux,{path:"/",element:d.jsx(_ve,{children:d.jsx(jpe,{})})})]})}),d.jsx(Ave,{position:"top-center"})]})})})}const nz=new URLSearchParams(window.location.search);if(nz.has("code")||nz.has("error"))try{f_()}catch(e){console.error("[inspector] OAuth callback error:",e)}const rz=document.getElementById("root");rz?_J.createRoot(rz).render(d.jsx(Ive,{})):console.error("[inspector] Root element not found");export{dW as $,de as A,wY as B,Bn as C,Dn as D,vn as E,Fe as F,Iz as G,p2 as H,kg as I,ej as J,iJ as K,iz as L,nJ as M,f_ as N,ce as R,oJ as W,Fn as Z,Ge as _,hr as a,Hu as b,Yu as c,jve as d,Dve as e,dh as f,bp as g,nG as h,Pve as i,Mi as j,GW as k,W7 as l,nW as m,fG as n,hG as o,Mve as p,VW as q,v as r,G7 as s,Lve as t,iG as u,Ni as v,qK as w,Re as x,Pe as y,h2 as z};