@mcp-use/inspector 0.9.2-canary.0 → 0.9.2

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,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-BLNV88kr.js","assets/util-t-trnxQI.js","assets/__vite-browser-external-DFygW7-s.js","assets/index-DRz5BQNA.js","assets/path-C9FudP8b.js","assets/index-xDfIuUbb.js","assets/index-CfggrBpX.js","assets/index-DXXLN07H.js","assets/embeddings-BR1y6hIf.js","assets/index-CQJrixEA.js","assets/index-MYH_v2_l.js","assets/browser-BPHOo4ze.js"])))=>i.map(i=>d[i]);
2
- var eX=Object.defineProperty;var tX=(e,t,n)=>t in e?eX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var wh=(e,t,n)=>tX(e,typeof t!="symbol"?t+"":t,n);function nX(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(a,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();function wp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function M_e(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function a(){var r=!1;try{r=this instanceof a}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}),n}var U0={exports:{}},nf={};var iM;function rX(){if(iM)return nf;iM=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,r,i){var s=null;if(i!==void 0&&(s=""+i),r.key!==void 0&&(s=""+r.key),"key"in r){i={};for(var c in r)c!=="key"&&(i[c]=r[c])}else i=r;return r=i.ref,{$$typeof:e,type:a,key:s,ref:r!==void 0?r:null,props:i}}return nf.Fragment=t,nf.jsx=n,nf.jsxs=n,nf}var oM;function aX(){return oM||(oM=1,U0.exports=rX()),U0.exports}var p=aX();const iX="modulepreload",oX=function(e){return"/inspector/"+e},sM={},di=function(t,n,a){let r=Promise.resolve();if(n&&n.length>0){let u=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=s?.nonce||s?.getAttribute("nonce");r=u(n.map(d=>{if(d=oX(d),d in sM)return;sM[d]=!0;const m=d.endsWith(".css"),h=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":iX,m||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),m)return new Promise((v,S)=>{g.addEventListener("load",v),g.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return r.then(s=>{for(const c of s||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};var sX=Object.defineProperty,Ge=(e,t)=>sX(e,"name",{value:t,configurable:!0}),lM=(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')}),Dc={};async function a2(){if(typeof process<"u")try{const e=await di(()=>import("./__vite-browser-external-DFygW7-s.js").then(n=>n.o),[]),t=await di(()=>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(a2,"getNodeModules");var Ta=null;function i2(){if(typeof lM<"u")try{Ta=lM("winston")}catch{}}Ge(i2,"loadWinstonSync");async function o2(){return Ta||(Ta=await di(()=>import("./winston-BLNV88kr.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4]))),Ta}Ge(o2,"getWinston");var oE="mcp-use";function eb(){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(eb,"isNodeJSEnvironment");var mu,lX=(mu=class{_level;name;constructor(t=oE,n="info"){this.name=t,this._level=n}shouldLog(t){const n=["error","warn","info","http","verbose","debug","silly"],a=n.indexOf(this._level);return n.indexOf(t)<=a}formatMessage(t,n){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${t}: ${n}`}error(t){this.shouldLog("error")&&console.error(this.formatMessage("error",t))}warn(t){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",t))}info(t){this.shouldLog("info")&&console.info(this.formatMessage("info",t))}debug(t){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",t))}http(t){this.shouldLog("http")&&console.log(this.formatMessage("http",t))}verbose(t){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",t))}silly(t){this.shouldLog("silly")&&console.log(this.formatMessage("silly",t))}get level(){return this._level}set level(t){this._level=t}},Ge(mu,"SimpleConsoleLogger"),mu);function Ag(e){switch((typeof process<"u"&&Dc?e:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}Ge(Ag,"resolveLevel");var go,s2=(go=class{static get(t=oE){if(!eb()){if(!this.simpleInstances[t]){const n=typeof process<"u"&&Dc?.DEBUG||void 0;this.simpleInstances[t]=new lX(t,Ag(n))}return this.simpleInstances[t]}if(!this.instances[t]){if(!Ta)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:n,format:a}=Ta,{combine:r,timestamp:i,label:s,colorize:c,splat:u}=a;this.instances[t]=n({level:Ag(Dc.DEBUG),format:r(c(),u(),s({label:t}),i({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})}return this.instances[t]}static getFormatter(){if(!Ta)throw new Error("Winston not loaded");const{format:t}=Ta,{printf:n}=t,a=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s}: ${c}`),r=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`),i=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return a;case"detailed":return r;case"emoji":return i;default:return a}}static async configure(t={}){const{level:n,console:a=!0,file:r,format:i="minimal"}=t,s=typeof process<"u"&&Dc?.DEBUG||void 0,c=n??Ag(s);if(this.currentFormat=i,!eb()){Object.values(this.simpleInstances).forEach(y=>{y.level=c});return}if(await o2(),!Ta)throw new Error("Failed to load winston");const u=this.get();u.level=c;const d=u;if(d.clear(),a&&d.add(new Ta.transports.Console),r){const{fs:y,path:_}=await a2();if(y&&_){const x=_.dirname(_.resolve(r));y.existsSync(x)||y.mkdirSync(x,{recursive:!0}),d.add(new Ta.transports.File({filename:r}))}}const{format:m}=Ta,{combine:h,timestamp:g,label:v,colorize:S,splat:w}=m;Object.values(this.instances).forEach(y=>{y&&"format"in y&&(y.level=c,y.format=h(S(),w(),v({label:oE}),g({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(t){let n;t===2||t===!0?n="debug":n="info",Object.values(this.simpleInstances).forEach(a=>{a.level=n}),Object.values(this.instances).forEach(a=>{a&&(a.level=n)}),typeof process<"u"&&Dc&&(Dc.DEBUG=t?t===!0?"2":String(t):"0")}static setFormat(t){this.currentFormat=t,this.configure({format:t})}},Ge(go,"Logger"),wh(go,"instances",{}),wh(go,"simpleInstances",{}),wh(go,"currentFormat","minimal"),go);eb()&&(i2(),Ta&&s2.configure());var De=s2.get();const l2=Object.freeze({status:"aborted"});function me(e,t,n){function a(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const d=s.prototype,m=Object.keys(d);for(let h=0;h<m.length;h++){const g=m[h];g in c||(c[g]=d[g].bind(c))}}const r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(c){var u;const d=n?.Parent?new i:this;a(d,c),(u=d._zod).deferred??(u.deferred=[]);for(const m of d._zod.deferred)m();return d}return Object.defineProperty(s,"init",{value:a}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}const c2=Symbol("zod_brand");class bl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class av extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const tb={};function Zr(e){return e&&Object.assign(tb,e),tb}function cX(e){return e}function uX(e){return e}function dX(e){}function fX(e){throw new Error}function pX(e){}function u_(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,r])=>t.indexOf(+a)===-1).map(([a,r])=>r)}function je(e,t="|"){return e.map(n=>ut(n)).join(t)}function nb(e,t){return typeof t=="bigint"?t.toString():t}function Sp(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ml(e){return e==null}function iv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function u2(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let r=(a.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(a)){const u=a.match(/\d?e-(\d?)/);u?.[1]&&(r=Number.parseInt(u[1]))}const i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return s%c/10**i}const cM=Symbol("evaluating");function $t(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==cM)return a===void 0&&(a=cM,a=n()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function mX(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Cs(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Oo(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function hX(e){return Oo(e._zod.def)}function gX(e,t){return t?t.reduce((n,a)=>n?.[a],e):e}function bX(e){const t=Object.keys(e),n=t.map(a=>e[a]);return Promise.all(n).then(a=>{const r={};for(let i=0;i<t.length;i++)r[t[i]]=a[i];return r})}function vX(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let a=0;a<e;a++)n+=t[Math.floor(Math.random()*t.length)];return n}function sE(e){return JSON.stringify(e)}function d2(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const d_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ku(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const f2=Sp(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function El(e){if(ku(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ku(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ov(e){return El(e)?{...e}:Array.isArray(e)?[...e]:e}function yX(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const wX=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},rb=new Set(["string","number","symbol"]),p2=new Set(["string","number","bigint","boolean","symbol","undefined"]);function xo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qa(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(a._zod.parent=e),a}function Ae(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 SX(e){let t;return new Proxy({},{get(n,a,r){return t??(t=e()),Reflect.get(t,a,r)},set(n,a,r,i){return t??(t=e()),Reflect.set(t,a,r,i)},has(n,a){return t??(t=e()),Reflect.has(t,a)},deleteProperty(n,a){return t??(t=e()),Reflect.deleteProperty(t,a)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,a){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(n,a,r){return t??(t=e()),Reflect.defineProperty(t,a,r)}})}function ut(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function m2(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const h2={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]},g2={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function b2(e,t){const n=e._zod.def,a=Oo(e._zod.def,{get shape(){const r={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=n.shape[i])}return Cs(this,"shape",r),r},checks:[]});return qa(e,a)}function v2(e,t){const n=e._zod.def,a=Oo(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return Cs(this,"shape",r),r},checks:[]});return qa(e,a)}function y2(e,t){if(!El(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const r=Oo(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Cs(this,"shape",i),i},checks:[]});return qa(e,r)}function w2(e,t){if(!El(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const a={...e._zod.def.shape,...t};return Cs(this,"shape",a),a},checks:e._zod.def.checks};return qa(e,n)}function S2(e,t){const n=Oo(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return Cs(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return qa(e,n)}function E2(e,t,n){const a=Oo(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)i[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return Cs(this,"shape",i),i},checks:[]});return qa(t,a)}function x2(e,t,n){const a=Oo(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return Cs(this,"shape",i),i},checks:[]});return qa(t,a)}function dl(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 fi(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function pf(e){return typeof e=="string"?e:e?.message}function bi(e,t,n){const a={...e,path:e.path??[]};if(!e.message){const r=pf(e.inst?._zod.def?.error?.(e))??pf(t?.error?.(e))??pf(n.customError?.(e))??pf(n.localeError?.(e))??"Invalid input";a.message=r}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function sv(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function lv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Tu(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}function EX(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function _2(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function k2(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function xX(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return _2(t+n)}function _X(e){return k2(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function kX(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let a=0;a<t.length;a+=2)n[a/2]=Number.parseInt(t.slice(a,a+2),16);return n}function TX(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class NX{constructor(...t){}}const T2=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:g2,Class:NX,NUMBER_FORMAT_RANGES:h2,aborted:dl,allowsEval:f2,assert:pX,assertEqual:cX,assertIs:dX,assertNever:fX,assertNotEqual:uX,assignProp:Cs,base64ToUint8Array:_2,base64urlToUint8Array:xX,cached:Sp,captureStackTrace:d_,cleanEnum:EX,cleanRegex:iv,clone:qa,cloneDef:hX,createTransparentProxy:SX,defineLazy:$t,esc:sE,escapeRegex:xo,extend:y2,finalizeIssue:bi,floatSafeRemainder:u2,getElementAtPath:gX,getEnumValues:u_,getLengthableOrigin:lv,getParsedType:wX,getSizableOrigin:sv,hexToUint8Array:kX,isObject:ku,isPlainObject:El,issue:Tu,joinValues:je,jsonStringifyReplacer:nb,merge:S2,mergeDefs:Oo,normalizeParams:Ae,nullish:Ml,numKeys:yX,objectClone:mX,omit:v2,optionalKeys:m2,partial:E2,pick:b2,prefixIssues:fi,primitiveTypes:p2,promiseAllObject:bX,propertyKeyTypes:rb,randomString:vX,required:x2,safeExtend:w2,shallowClone:ov,slugify:d2,stringifyPrimitive:ut,uint8ArrayToBase64:k2,uint8ArrayToBase64url:_X,uint8ArrayToHex:TX,unwrapMessage:pf},Symbol.toStringTag,{value:"Module"})),N2=(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,nb,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},f_=me("$ZodError",N2),Ia=me("$ZodError",N2,{Parent:Error});function p_(e,t=n=>n.message){const n={},a=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):a.push(t(r));return{formErrors:a,fieldErrors:n}}function m_(e,t=n=>n.message){const n={_errors:[]},a=r=>{for(const i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>a({issues:s}));else if(i.code==="invalid_key")a({issues:i.issues});else if(i.code==="invalid_element")a({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(i))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return a(e),n}function R2(e,t=n=>n.message){const n={errors:[]},a=(r,i=[])=>{var s,c;for(const u of r.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>a({issues:d},u.path));else if(u.code==="invalid_key")a({issues:u.issues},u.path);else if(u.code==="invalid_element")a({issues:u.issues},u.path);else{const d=[...i,...u.path];if(d.length===0){n.errors.push(t(u));continue}let m=n,h=0;for(;h<d.length;){const g=d[h],v=h===d.length-1;typeof g=="string"?(m.properties??(m.properties={}),(s=m.properties)[g]??(s[g]={errors:[]}),m=m.properties[g]):(m.items??(m.items=[]),(c=m.items)[g]??(c[g]={errors:[]}),m=m.items[g]),v&&m.errors.push(t(u)),h++}}};return a(e),n}function C2(e){const t=[],n=e.map(a=>typeof a=="object"?a.key:a);for(const a of n)typeof a=="number"?t.push(`[${a}]`):typeof a=="symbol"?t.push(`[${JSON.stringify(String(a))}]`):/[^\w$]/.test(a)?t.push(`[${JSON.stringify(a)}]`):(t.length&&t.push("."),t.push(a));return t.join("")}function A2(e){const t=[],n=[...e.issues].sort((a,r)=>(a.path??[]).length-(r.path??[]).length);for(const a of n)t.push(`✖ ${a.message}`),a.path?.length&&t.push(` → at ${C2(a.path)}`);return t.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/winston-D_OHtP4E.js","assets/util-t-trnxQI.js","assets/__vite-browser-external-DFygW7-s.js","assets/index-DRz5BQNA.js","assets/path-C9FudP8b.js","assets/index-Dwx0D9tm.js","assets/index-BxlzAdRz.js","assets/index-CejJnjhQ.js","assets/embeddings-Cd_IFijr.js","assets/index-FfhUz5GP.js","assets/index-BDueMm07.js","assets/browser-BaWfMf0m.js"])))=>i.map(i=>d[i]);
2
+ var eX=Object.defineProperty;var tX=(e,t,n)=>t in e?eX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var wh=(e,t,n)=>tX(e,typeof t!="symbol"?t+"":t,n);function nX(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(a,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();function wp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function M_e(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function a(){var r=!1;try{r=this instanceof a}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}),n}var U0={exports:{}},nf={};var iM;function rX(){if(iM)return nf;iM=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,r,i){var s=null;if(i!==void 0&&(s=""+i),r.key!==void 0&&(s=""+r.key),"key"in r){i={};for(var c in r)c!=="key"&&(i[c]=r[c])}else i=r;return r=i.ref,{$$typeof:e,type:a,key:s,ref:r!==void 0?r:null,props:i}}return nf.Fragment=t,nf.jsx=n,nf.jsxs=n,nf}var oM;function aX(){return oM||(oM=1,U0.exports=rX()),U0.exports}var p=aX();const iX="modulepreload",oX=function(e){return"/inspector/"+e},sM={},di=function(t,n,a){let r=Promise.resolve();if(n&&n.length>0){let u=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=s?.nonce||s?.getAttribute("nonce");r=u(n.map(d=>{if(d=oX(d),d in sM)return;sM[d]=!0;const m=d.endsWith(".css"),h=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":iX,m||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),m)return new Promise((v,S)=>{g.addEventListener("load",v),g.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return r.then(s=>{for(const c of s||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};var sX=Object.defineProperty,Ge=(e,t)=>sX(e,"name",{value:t,configurable:!0}),lM=(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')}),Dc={};async function a2(){if(typeof process<"u")try{const e=await di(()=>import("./__vite-browser-external-DFygW7-s.js").then(n=>n.o),[]),t=await di(()=>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(a2,"getNodeModules");var Ta=null;function i2(){if(typeof lM<"u")try{Ta=lM("winston")}catch{}}Ge(i2,"loadWinstonSync");async function o2(){return Ta||(Ta=await di(()=>import("./winston-D_OHtP4E.js").then(e=>e.w),__vite__mapDeps([0,1,2,3,4]))),Ta}Ge(o2,"getWinston");var oE="mcp-use";function eb(){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(eb,"isNodeJSEnvironment");var mu,lX=(mu=class{_level;name;constructor(t=oE,n="info"){this.name=t,this._level=n}shouldLog(t){const n=["error","warn","info","http","verbose","debug","silly"],a=n.indexOf(this._level);return n.indexOf(t)<=a}formatMessage(t,n){return`${new Date().toLocaleTimeString("en-US",{hour12:!1})} [${this.name}] ${t}: ${n}`}error(t){this.shouldLog("error")&&console.error(this.formatMessage("error",t))}warn(t){this.shouldLog("warn")&&console.warn(this.formatMessage("warn",t))}info(t){this.shouldLog("info")&&console.info(this.formatMessage("info",t))}debug(t){this.shouldLog("debug")&&console.debug(this.formatMessage("debug",t))}http(t){this.shouldLog("http")&&console.log(this.formatMessage("http",t))}verbose(t){this.shouldLog("verbose")&&console.log(this.formatMessage("verbose",t))}silly(t){this.shouldLog("silly")&&console.log(this.formatMessage("silly",t))}get level(){return this._level}set level(t){this._level=t}},Ge(mu,"SimpleConsoleLogger"),mu);function Ag(e){switch((typeof process<"u"&&Dc?e:void 0)?.trim()){case"2":return"debug";case"1":return"info";default:return"info"}}Ge(Ag,"resolveLevel");var go,s2=(go=class{static get(t=oE){if(!eb()){if(!this.simpleInstances[t]){const n=typeof process<"u"&&Dc?.DEBUG||void 0;this.simpleInstances[t]=new lX(t,Ag(n))}return this.simpleInstances[t]}if(!this.instances[t]){if(!Ta)throw new Error("Winston not loaded - call Logger.configure() first");const{createLogger:n,format:a}=Ta,{combine:r,timestamp:i,label:s,colorize:c,splat:u}=a;this.instances[t]=n({level:Ag(Dc.DEBUG),format:r(c(),u(),s({label:t}),i({format:"HH:mm:ss"}),this.getFormatter()),transports:[]})}return this.instances[t]}static getFormatter(){if(!Ta)throw new Error("Winston not loaded");const{format:t}=Ta,{printf:n}=t,a=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s}: ${c}`),r=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`),i=n(({level:s,message:c,label:u,timestamp:d})=>`${d} [${u}] ${s.toUpperCase()}: ${c}`);switch(this.currentFormat){case"minimal":return a;case"detailed":return r;case"emoji":return i;default:return a}}static async configure(t={}){const{level:n,console:a=!0,file:r,format:i="minimal"}=t,s=typeof process<"u"&&Dc?.DEBUG||void 0,c=n??Ag(s);if(this.currentFormat=i,!eb()){Object.values(this.simpleInstances).forEach(y=>{y.level=c});return}if(await o2(),!Ta)throw new Error("Failed to load winston");const u=this.get();u.level=c;const d=u;if(d.clear(),a&&d.add(new Ta.transports.Console),r){const{fs:y,path:_}=await a2();if(y&&_){const x=_.dirname(_.resolve(r));y.existsSync(x)||y.mkdirSync(x,{recursive:!0}),d.add(new Ta.transports.File({filename:r}))}}const{format:m}=Ta,{combine:h,timestamp:g,label:v,colorize:S,splat:w}=m;Object.values(this.instances).forEach(y=>{y&&"format"in y&&(y.level=c,y.format=h(S(),w(),v({label:oE}),g({format:"HH:mm:ss"}),this.getFormatter()))})}static setDebug(t){let n;t===2||t===!0?n="debug":n="info",Object.values(this.simpleInstances).forEach(a=>{a.level=n}),Object.values(this.instances).forEach(a=>{a&&(a.level=n)}),typeof process<"u"&&Dc&&(Dc.DEBUG=t?t===!0?"2":String(t):"0")}static setFormat(t){this.currentFormat=t,this.configure({format:t})}},Ge(go,"Logger"),wh(go,"instances",{}),wh(go,"simpleInstances",{}),wh(go,"currentFormat","minimal"),go);eb()&&(i2(),Ta&&s2.configure());var De=s2.get();const l2=Object.freeze({status:"aborted"});function me(e,t,n){function a(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const d=s.prototype,m=Object.keys(d);for(let h=0;h<m.length;h++){const g=m[h];g in c||(c[g]=d[g].bind(c))}}const r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(c){var u;const d=n?.Parent?new i:this;a(d,c),(u=d._zod).deferred??(u.deferred=[]);for(const m of d._zod.deferred)m();return d}return Object.defineProperty(s,"init",{value:a}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}const c2=Symbol("zod_brand");class bl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class av extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const tb={};function Zr(e){return e&&Object.assign(tb,e),tb}function cX(e){return e}function uX(e){return e}function dX(e){}function fX(e){throw new Error}function pX(e){}function u_(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,r])=>t.indexOf(+a)===-1).map(([a,r])=>r)}function je(e,t="|"){return e.map(n=>ut(n)).join(t)}function nb(e,t){return typeof t=="bigint"?t.toString():t}function Sp(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ml(e){return e==null}function iv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function u2(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let r=(a.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(a)){const u=a.match(/\d?e-(\d?)/);u?.[1]&&(r=Number.parseInt(u[1]))}const i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return s%c/10**i}const cM=Symbol("evaluating");function $t(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==cM)return a===void 0&&(a=cM,a=n()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function mX(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Cs(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Oo(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function hX(e){return Oo(e._zod.def)}function gX(e,t){return t?t.reduce((n,a)=>n?.[a],e):e}function bX(e){const t=Object.keys(e),n=t.map(a=>e[a]);return Promise.all(n).then(a=>{const r={};for(let i=0;i<t.length;i++)r[t[i]]=a[i];return r})}function vX(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let a=0;a<e;a++)n+=t[Math.floor(Math.random()*t.length)];return n}function sE(e){return JSON.stringify(e)}function d2(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const d_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ku(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const f2=Sp(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function El(e){if(ku(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ku(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ov(e){return El(e)?{...e}:Array.isArray(e)?[...e]:e}function yX(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const wX=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},rb=new Set(["string","number","symbol"]),p2=new Set(["string","number","bigint","boolean","symbol","undefined"]);function xo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qa(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(a._zod.parent=e),a}function Ae(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 SX(e){let t;return new Proxy({},{get(n,a,r){return t??(t=e()),Reflect.get(t,a,r)},set(n,a,r,i){return t??(t=e()),Reflect.set(t,a,r,i)},has(n,a){return t??(t=e()),Reflect.has(t,a)},deleteProperty(n,a){return t??(t=e()),Reflect.deleteProperty(t,a)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,a){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(n,a,r){return t??(t=e()),Reflect.defineProperty(t,a,r)}})}function ut(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function m2(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const h2={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]},g2={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function b2(e,t){const n=e._zod.def,a=Oo(e._zod.def,{get shape(){const r={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(r[i]=n.shape[i])}return Cs(this,"shape",r),r},checks:[]});return qa(e,a)}function v2(e,t){const n=e._zod.def,a=Oo(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete r[i]}return Cs(this,"shape",r),r},checks:[]});return qa(e,a)}function y2(e,t){if(!El(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const r=Oo(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Cs(this,"shape",i),i},checks:[]});return qa(e,r)}function w2(e,t){if(!El(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const a={...e._zod.def.shape,...t};return Cs(this,"shape",a),a},checks:e._zod.def.checks};return qa(e,n)}function S2(e,t){const n=Oo(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return Cs(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return qa(e,n)}function E2(e,t,n){const a=Oo(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)i[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return Cs(this,"shape",i),i},checks:[]});return qa(t,a)}function x2(e,t,n){const a=Oo(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return Cs(this,"shape",i),i},checks:[]});return qa(t,a)}function dl(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 fi(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function pf(e){return typeof e=="string"?e:e?.message}function bi(e,t,n){const a={...e,path:e.path??[]};if(!e.message){const r=pf(e.inst?._zod.def?.error?.(e))??pf(t?.error?.(e))??pf(n.customError?.(e))??pf(n.localeError?.(e))??"Invalid input";a.message=r}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function sv(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function lv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Tu(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}function EX(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function _2(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function k2(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function xX(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return _2(t+n)}function _X(e){return k2(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function kX(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let a=0;a<t.length;a+=2)n[a/2]=Number.parseInt(t.slice(a,a+2),16);return n}function TX(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class NX{constructor(...t){}}const T2=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:g2,Class:NX,NUMBER_FORMAT_RANGES:h2,aborted:dl,allowsEval:f2,assert:pX,assertEqual:cX,assertIs:dX,assertNever:fX,assertNotEqual:uX,assignProp:Cs,base64ToUint8Array:_2,base64urlToUint8Array:xX,cached:Sp,captureStackTrace:d_,cleanEnum:EX,cleanRegex:iv,clone:qa,cloneDef:hX,createTransparentProxy:SX,defineLazy:$t,esc:sE,escapeRegex:xo,extend:y2,finalizeIssue:bi,floatSafeRemainder:u2,getElementAtPath:gX,getEnumValues:u_,getLengthableOrigin:lv,getParsedType:wX,getSizableOrigin:sv,hexToUint8Array:kX,isObject:ku,isPlainObject:El,issue:Tu,joinValues:je,jsonStringifyReplacer:nb,merge:S2,mergeDefs:Oo,normalizeParams:Ae,nullish:Ml,numKeys:yX,objectClone:mX,omit:v2,optionalKeys:m2,partial:E2,pick:b2,prefixIssues:fi,primitiveTypes:p2,promiseAllObject:bX,propertyKeyTypes:rb,randomString:vX,required:x2,safeExtend:w2,shallowClone:ov,slugify:d2,stringifyPrimitive:ut,uint8ArrayToBase64:k2,uint8ArrayToBase64url:_X,uint8ArrayToHex:TX,unwrapMessage:pf},Symbol.toStringTag,{value:"Module"})),N2=(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,nb,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},f_=me("$ZodError",N2),Ia=me("$ZodError",N2,{Parent:Error});function p_(e,t=n=>n.message){const n={},a=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):a.push(t(r));return{formErrors:a,fieldErrors:n}}function m_(e,t=n=>n.message){const n={_errors:[]},a=r=>{for(const i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>a({issues:s}));else if(i.code==="invalid_key")a({issues:i.issues});else if(i.code==="invalid_element")a({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(i))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return a(e),n}function R2(e,t=n=>n.message){const n={errors:[]},a=(r,i=[])=>{var s,c;for(const u of r.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>a({issues:d},u.path));else if(u.code==="invalid_key")a({issues:u.issues},u.path);else if(u.code==="invalid_element")a({issues:u.issues},u.path);else{const d=[...i,...u.path];if(d.length===0){n.errors.push(t(u));continue}let m=n,h=0;for(;h<d.length;){const g=d[h],v=h===d.length-1;typeof g=="string"?(m.properties??(m.properties={}),(s=m.properties)[g]??(s[g]={errors:[]}),m=m.properties[g]):(m.items??(m.items=[]),(c=m.items)[g]??(c[g]={errors:[]}),m=m.items[g]),v&&m.errors.push(t(u)),h++}}};return a(e),n}function C2(e){const t=[],n=e.map(a=>typeof a=="object"?a.key:a);for(const a of n)typeof a=="number"?t.push(`[${a}]`):typeof a=="symbol"?t.push(`[${JSON.stringify(String(a))}]`):/[^\w$]/.test(a)?t.push(`[${JSON.stringify(a)}]`):(t.length&&t.push("."),t.push(a));return t.join("")}function A2(e){const t=[],n=[...e.issues].sort((a,r)=>(a.path??[]).length-(r.path??[]).length);for(const a of n)t.push(`✖ ${a.message}`),a.path?.length&&t.push(` → at ${C2(a.path)}`);return t.join(`
3
3
  `)}const Ep=e=>(t,n,a,r)=>{const i=a?Object.assign(a,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new bl;if(s.issues.length){const c=new(r?.Err??e)(s.issues.map(u=>bi(u,i,Zr())));throw d_(c,r?.callee),c}return s.value},lE=Ep(Ia),xp=e=>async(t,n,a,r)=>{const i=a?Object.assign(a,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const c=new(r?.Err??e)(s.issues.map(u=>bi(u,i,Zr())));throw d_(c,r?.callee),c}return s.value},cE=xp(Ia),_p=e=>(t,n,a)=>{const r=a?{...a,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new bl;return i.issues.length?{success:!1,error:new(e??f_)(i.issues.map(s=>bi(s,r,Zr())))}:{success:!0,data:i.value}},h_=_p(Ia),kp=e=>async(t,n,a)=>{const r=a?Object.assign(a,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>bi(s,r,Zr())))}:{success:!0,data:i.value}},I2=kp(Ia),g_=e=>(t,n,a)=>{const r=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ep(e)(t,n,r)},RX=g_(Ia),b_=e=>(t,n,a)=>Ep(e)(t,n,a),CX=b_(Ia),v_=e=>async(t,n,a)=>{const r=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return xp(e)(t,n,r)},AX=v_(Ia),y_=e=>async(t,n,a)=>xp(e)(t,n,a),IX=y_(Ia),w_=e=>(t,n,a)=>{const r=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return _p(e)(t,n,r)},OX=w_(Ia),S_=e=>(t,n,a)=>_p(e)(t,n,a),DX=S_(Ia),E_=e=>async(t,n,a)=>{const r=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return kp(e)(t,n,r)},$X=E_(Ia),x_=e=>async(t,n,a)=>kp(e)(t,n,a),LX=x_(Ia),O2=/^[cC][^\s-]{8,}$/,D2=/^[0-9a-z]+$/,$2=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,L2=/^[0-9a-vA-V]{20}$/,M2=/^[A-Za-z0-9]{27}$/,j2=/^[a-zA-Z0-9_-]{21}$/,P2=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MX=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,U2=/^([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})$/,Nu=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)$/,jX=Nu(4),PX=Nu(6),UX=Nu(7),z2=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,zX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,FX=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,F2=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,BX=F2,HX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,VX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function B2(){return new RegExp(VX,"u")}const H2=/^(?:(?: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])$/,V2=/^(([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}|:))$/,G2=e=>{const t=xo(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},W2=/^((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])$/,K2=/^(([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])$/,Z2=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,__=/^[A-Za-z0-9_-]*$/,Y2=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,X2=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,q2=/^\+(?:[0-9]){6,14}[0-9]$/,J2="(?:(?:\\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])))",Q2=new RegExp(`^${J2}$`);function eF(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 tF(e){return new RegExp(`^${eF(e)}$`)}function nF(e){const t=eF({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${J2}T(?:${a})$`)}const rF=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},aF=/^-?\d+n?$/,iF=/^-?\d+$/,oF=/^-?\d+(?:\.\d+)?/,sF=/^(?:true|false)$/i,lF=/^null$/i,cF=/^undefined$/i,uF=/^[^A-Z]*$/,dF=/^[^a-z]*$/,fF=/^[0-9a-fA-F]*$/;function Tp(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Np(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const GX=/^[0-9a-fA-F]{32}$/,WX=Tp(22,"=="),KX=Np(22),ZX=/^[0-9a-fA-F]{40}$/,YX=Tp(27,"="),XX=Np(27),qX=/^[0-9a-fA-F]{64}$/,JX=Tp(43,"="),QX=Np(43),eq=/^[0-9a-fA-F]{96}$/,tq=Tp(64,""),nq=Np(64),rq=/^[0-9a-fA-F]{128}$/,aq=Tp(86,"=="),iq=Np(86),k_=Object.freeze(Object.defineProperty({__proto__:null,base64:Z2,base64url:__,bigint:aF,boolean:sF,browserEmail:HX,cidrv4:W2,cidrv6:K2,cuid:O2,cuid2:D2,date:Q2,datetime:nF,domain:X2,duration:P2,e164:q2,email:z2,emoji:B2,extendedDuration:MX,guid:U2,hex:fF,hostname:Y2,html5Email:zX,idnEmail:BX,integer:iF,ipv4:H2,ipv6:V2,ksuid:M2,lowercase:uF,mac:G2,md5_base64:WX,md5_base64url:KX,md5_hex:GX,nanoid:j2,null:lF,number:oF,rfc5322Email:FX,sha1_base64:YX,sha1_base64url:XX,sha1_hex:ZX,sha256_base64:JX,sha256_base64url:QX,sha256_hex:qX,sha384_base64:tq,sha384_base64url:nq,sha384_hex:eq,sha512_base64:aq,sha512_base64url:iq,sha512_hex:rq,string:rF,time:tF,ulid:$2,undefined:cF,unicodeEmail:F2,uppercase:dF,uuid:Nu,uuid4:jX,uuid6:PX,uuid7:UX,xid:L2},Symbol.toStringTag,{value:"Module"})),jn=me("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),pF={number:"number",bigint:"bigint",object:"date"},T_=me("$ZodCheckLessThan",(e,t)=>{jn.init(e,t);const n=pF[typeof t.value];e._zod.onattach.push(a=>{const r=a._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),N_=me("$ZodCheckGreaterThan",(e,t)=>{jn.init(e,t);const n=pF[typeof t.value];e._zod.onattach.push(a=>{const r=a._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mF=me("$ZodCheckMultipleOf",(e,t)=>{jn.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):u2(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})}}),hF=me("$ZodCheckNumberFormat",(e,t)=>{jn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),a=n?"int":"number",[r,i]=h2[t.format];e._zod.onattach.push(s=>{const c=s._zod.bag;c.format=t.format,c.minimum=r,c.maximum=i,n&&(c.pattern=iF)}),e._zod.check=s=>{const c=s.value;if(n){if(!Number.isInteger(c)){s.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort});return}}c<r&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inst:e})}}),gF=me("$ZodCheckBigIntFormat",(e,t)=>{jn.init(e,t);const[n,a]=g2[t.format];e._zod.onattach.push(r=>{const i=r._zod.bag;i.format=t.format,i.minimum=n,i.maximum=a}),e._zod.check=r=>{const i=r.value;i<n&&r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>a&&r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:a,inst:e})}}),bF=me("$ZodCheckMaxSize",(e,t)=>{var n;jn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ml(r)&&r.size!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const r=a.value;r.size<=t.maximum||a.issues.push({origin:sv(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),vF=me("$ZodCheckMinSize",(e,t)=>{var n;jn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ml(r)&&r.size!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const r=a.value;r.size>=t.minimum||a.issues.push({origin:sv(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yF=me("$ZodCheckSizeEquals",(e,t)=>{var n;jn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ml(r)&&r.size!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=a=>{const r=a.value,i=r.size;if(i===t.size)return;const s=i>t.size;a.issues.push({origin:sv(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),wF=me("$ZodCheckMaxLength",(e,t)=>{var n;jn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ml(r)&&r.length!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const r=a.value;if(r.length<=t.maximum)return;const s=lv(r);a.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),SF=me("$ZodCheckMinLength",(e,t)=>{var n;jn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ml(r)&&r.length!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const r=a.value;if(r.length>=t.minimum)return;const s=lv(r);a.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),EF=me("$ZodCheckLengthEquals",(e,t)=>{var n;jn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const r=a.value;return!Ml(r)&&r.length!==void 0}),e._zod.onattach.push(a=>{const r=a._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=a=>{const r=a.value,i=r.length;if(i===t.length)return;const s=lv(r),c=i>t.length;a.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Rp=me("$ZodCheckStringFormat",(e,t)=>{var n,a;jn.init(e,t),e._zod.onattach.push(r=>{const i=r._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),xF=me("$ZodCheckRegex",(e,t)=>{Rp.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})}}),_F=me("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=uF),Rp.init(e,t)}),kF=me("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dF),Rp.init(e,t)}),TF=me("$ZodCheckIncludes",(e,t)=>{jn.init(e,t);const n=xo(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(a)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),NF=me("$ZodCheckStartsWith",(e,t)=>{jn.init(e,t);const n=new RegExp(`^${xo(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const r=a._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),RF=me("$ZodCheckEndsWith",(e,t)=>{jn.init(e,t);const n=new RegExp(`.*${xo(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const r=a._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}});function uM(e,t,n){e.issues.length&&t.issues.push(...fi(n,e.issues))}const CF=me("$ZodCheckProperty",(e,t)=>{jn.init(e,t),e._zod.check=n=>{const a=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(a instanceof Promise)return a.then(r=>uM(r,n,t.property));uM(a,n,t.property)}}),AF=me("$ZodCheckMimeType",(e,t)=>{jn.init(e,t);const n=new Set(t.mime);e._zod.onattach.push(a=>{a._zod.bag.mime=t.mime}),e._zod.check=a=>{n.has(a.value.type)||a.issues.push({code:"invalid_value",values:t.mime,input:a.value.type,inst:e,continue:!t.abort})}}),IF=me("$ZodCheckOverwrite",(e,t)=>{jn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class OF{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
4
4
  `).filter(s=>s),r=Math.min(...a.map(s=>s.length-s.trimStart().length)),i=a.map(s=>s.slice(r)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this?.args,r=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,r.join(`
5
5
  `))}}const DF={major:4,minor:1,patch:13},ht=me("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=DF;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const r of a)for(const i of r._zod.onattach)i(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const r=(s,c,u)=>{let d=dl(s),m;for(const h of c){if(h._zod.def.when){if(!h._zod.def.when(s))continue}else if(d)continue;const g=s.issues.length,v=h._zod.check(s);if(v instanceof Promise&&u?.async===!1)throw new bl;if(m||v instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await v,s.issues.length!==g&&(d||(d=dl(s,g)))});else{if(s.issues.length===g)continue;d||(d=dl(s,g))}}return m?m.then(()=>s):s},i=(s,c,u)=>{if(dl(s))return s.aborted=!0,s;const d=r(c,a,u);if(d instanceof Promise){if(u.async===!1)throw new bl;return d.then(m=>e._zod.parse(m,u))}return e._zod.parse(d,u)};e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){const d=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(m=>i(m,s,c)):i(d,s,c)}const u=e._zod.parse(s,c);if(u instanceof Promise){if(c.async===!1)throw new bl;return u.then(d=>r(d,a,c))}return r(u,a,c)}}e["~standard"]={validate:r=>{try{const i=h_(e,r);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return I2(e,r).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Cp=me("$ZodString",(e,t)=>{ht.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??rF(e._zod.bag),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Sn=me("$ZodStringFormat",(e,t)=>{Rp.init(e,t),Cp.init(e,t)}),$F=me("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=U2),Sn.init(e,t)}),LF=me("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Nu(a))}else t.pattern??(t.pattern=Nu());Sn.init(e,t)}),MF=me("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=z2),Sn.init(e,t)}),jF=me("$ZodURL",(e,t)=>{Sn.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),r=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),PF=me("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=B2()),Sn.init(e,t)}),UF=me("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=j2),Sn.init(e,t)}),zF=me("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=O2),Sn.init(e,t)}),FF=me("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=D2),Sn.init(e,t)}),BF=me("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$2),Sn.init(e,t)}),HF=me("$ZodXID",(e,t)=>{t.pattern??(t.pattern=L2),Sn.init(e,t)}),VF=me("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=M2),Sn.init(e,t)}),GF=me("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nF(t)),Sn.init(e,t)}),WF=me("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Q2),Sn.init(e,t)}),KF=me("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=tF(t)),Sn.init(e,t)}),ZF=me("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=P2),Sn.init(e,t)}),YF=me("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=H2),Sn.init(e,t),e._zod.bag.format="ipv4"}),XF=me("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=V2),Sn.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})}}}),qF=me("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=G2(t.delimiter)),Sn.init(e,t),e._zod.bag.format="mac"}),JF=me("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=W2),Sn.init(e,t)}),QF=me("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=K2),Sn.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[r,i]=a;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function R_(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const e3=me("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Z2),Sn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{R_(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function t3(e){if(!__.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return R_(n)}const n3=me("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=__),Sn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{t3(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),r3=me("$ZodE164",(e,t)=>{t.pattern??(t.pattern=q2),Sn.init(e,t)});function a3(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const r=JSON.parse(atob(a));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}const i3=me("$ZodJWT",(e,t)=>{Sn.init(e,t),e._zod.check=n=>{a3(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),o3=me("$ZodCustomStringFormat",(e,t)=>{Sn.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),C_=me("$ZodNumber",(e,t)=>{ht.init(e,t),e._zod.pattern=e._zod.bag.pattern??oF,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;const i=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}}),s3=me("$ZodNumberFormat",(e,t)=>{hF.init(e,t),C_.init(e,t)}),A_=me("$ZodBoolean",(e,t)=>{ht.init(e,t),e._zod.pattern=sF,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),I_=me("$ZodBigInt",(e,t)=>{ht.init(e,t),e._zod.pattern=aF,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),l3=me("$ZodBigIntFormat",(e,t)=>{gF.init(e,t),I_.init(e,t)}),c3=me("$ZodSymbol",(e,t)=>{ht.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),u3=me("$ZodUndefined",(e,t)=>{ht.init(e,t),e._zod.pattern=cF,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,a)=>{const r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),d3=me("$ZodNull",(e,t)=>{ht.init(e,t),e._zod.pattern=lF,e._zod.values=new Set([null]),e._zod.parse=(n,a)=>{const r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),f3=me("$ZodAny",(e,t)=>{ht.init(e,t),e._zod.parse=n=>n}),p3=me("$ZodUnknown",(e,t)=>{ht.init(e,t),e._zod.parse=n=>n}),m3=me("$ZodNever",(e,t)=>{ht.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),h3=me("$ZodVoid",(e,t)=>{ht.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),g3=me("$ZodDate",(e,t)=>{ht.init(e,t),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}const r=n.value,i=r instanceof Date;return i&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}});function dM(e,t,n){e.issues.length&&t.issues.push(...fi(n,e.issues)),t.value[n]=e.value}const b3=me("$ZodArray",(e,t)=>{ht.init(e,t),e._zod.parse=(n,a)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const i=[];for(let s=0;s<r.length;s++){const c=r[s],u=t.element._zod.run({value:c,issues:[]},a);u instanceof Promise?i.push(u.then(d=>dM(d,n,s))):dM(u,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function ab(e,t,n,a){e.issues.length&&t.issues.push(...fi(n,e.issues)),e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function v3(e){const t=Object.keys(e.shape);for(const a of t)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=m2(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function y3(e,t,n,a,r,i){const s=[],c=r.keySet,u=r.catchall._zod,d=u.def.type;for(const m in t){if(c.has(m))continue;if(d==="never"){s.push(m);continue}const h=u.run({value:t[m],issues:[]},a);h instanceof Promise?e.push(h.then(g=>ab(g,n,m,t))):ab(h,n,m,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const w3=me("$ZodObject",(e,t)=>{if(ht.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}const a=Sp(()=>v3(t));$t(e._zod,"propValues",()=>{const c=t.shape,u={};for(const d in c){const m=c[d]._zod;if(m.values){u[d]??(u[d]=new Set);for(const h of m.values)u[d].add(h)}}return u});const r=ku,i=t.catchall;let s;e._zod.parse=(c,u)=>{s??(s=a.value);const d=c.value;if(!r(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value={};const m=[],h=s.shape;for(const g of s.keys){const S=h[g]._zod.run({value:d[g],issues:[]},u);S instanceof Promise?m.push(S.then(w=>ab(w,c,g,d))):ab(S,c,g,d)}return i?y3(m,d,c,u,a.value,e):m.length?Promise.all(m).then(()=>c):c}}),S3=me("$ZodObjectJIT",(e,t)=>{w3.init(e,t);const n=e._zod.parse,a=Sp(()=>v3(t)),r=g=>{const v=new OF(["shape","payload","ctx"]),S=a.value,w=k=>{const C=sE(k);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};v.write("const input = payload.value;");const y=Object.create(null);let _=0;for(const k of S.keys)y[k]=`key_${_++}`;v.write("const newResult = {};");for(const k of S.keys){const C=y[k],R=sE(k);v.write(`const ${C} = ${w(k)};`),v.write(`
@@ -41,7 +41,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
41
41
  <p>You can close this window or <a href="#" onclick="window.close(); return false;">click here to close</a>.</p>
42
42
  <pre style="font-size: 0.8em; color: #555; margin-top: 20px; white-space: pre-wrap;">${d instanceof Error?d.stack:""}</pre>
43
43
  </div>
44
- `}catch(h){console.error(`${i} Could not display error in callback window:`,h)}u&&localStorage.removeItem(u),s&&(localStorage.removeItem(s.getKey("code_verifier")),localStorage.removeItem(s.getKey("last_auth_url")))}}Ge(hT,"onMcpAuthorization");var aS={exports:{}},mt={};var nP;function Tae(){if(nP)return mt;nP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function v(P){return P===null||typeof P!="object"?null:(P=g&&P[g]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,y={};function _(P,B,z){this.props=P,this.context=B,this.refs=y,this.updater=z||S}_.prototype.isReactComponent={},_.prototype.setState=function(P,B){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,B,"setState")},_.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function x(){}x.prototype=_.prototype;function k(P,B,z){this.props=P,this.context=B,this.refs=y,this.updater=z||S}var C=k.prototype=new x;C.constructor=k,w(C,_.prototype),C.isPureReactComponent=!0;var R=Array.isArray;function I(){}var A={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function M(P,B,z){var $=z.ref;return{$$typeof:e,type:P,key:B,ref:$!==void 0?$:null,props:z}}function U(P,B){return M(P.type,B,P.props)}function F(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function H(P){var B={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(z){return B[z]})}var te=/\/+/g;function q(P,B){return typeof P=="object"&&P!==null&&P.key!=null?H(""+P.key):B.toString(36)}function ie(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(I,I):(P.status="pending",P.then(function(B){P.status==="pending"&&(P.status="fulfilled",P.value=B)},function(B){P.status==="pending"&&(P.status="rejected",P.reason=B)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function G(P,B,z,$,j){var V=typeof P;(V==="undefined"||V==="boolean")&&(P=null);var K=!1;if(P===null)K=!0;else switch(V){case"bigint":case"string":case"number":K=!0;break;case"object":switch(P.$$typeof){case e:case t:K=!0;break;case m:return K=P._init,G(K(P._payload),B,z,$,j)}}if(K)return j=j(P),K=$===""?"."+q(P,0):$,R(j)?(z="",K!=null&&(z=K.replace(te,"$&/")+"/"),G(j,B,z,"",function(le){return le})):j!=null&&(F(j)&&(j=U(j,z+(j.key==null||P&&P.key===j.key?"":(""+j.key).replace(te,"$&/")+"/")+K)),B.push(j)),1;K=0;var X=$===""?".":$+":";if(R(P))for(var se=0;se<P.length;se++)$=P[se],V=X+q($,se),K+=G($,B,z,V,j);else if(se=v(P),typeof se=="function")for(P=se.call(P),se=0;!($=P.next()).done;)$=$.value,V=X+q($,se++),K+=G($,B,z,V,j);else if(V==="object"){if(typeof P.then=="function")return G(ie(P),B,z,$,j);throw B=String(P),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return K}function Q(P,B,z){if(P==null)return P;var $=[],j=0;return G(P,$,"","",function(V){return B.call(z,V,j++)}),$}function W(P){if(P._status===-1){var B=P._result;B=B(),B.then(function(z){(P._status===0||P._status===-1)&&(P._status=1,P._result=z)},function(z){(P._status===0||P._status===-1)&&(P._status=2,P._result=z)}),P._status===-1&&(P._status=0,P._result=B)}if(P._status===1)return P._result.default;throw P._result}var oe=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},ne={map:Q,forEach:function(P,B,z){Q(P,function(){B.apply(this,arguments)},z)},count:function(P){var B=0;return Q(P,function(){B++}),B},toArray:function(P){return Q(P,function(B){return B})||[]},only:function(P){if(!F(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return mt.Activity=h,mt.Children=ne,mt.Component=_,mt.Fragment=n,mt.Profiler=r,mt.PureComponent=k,mt.StrictMode=a,mt.Suspense=u,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,mt.__COMPILER_RUNTIME={__proto__:null,c:function(P){return A.H.useMemoCache(P)}},mt.cache=function(P){return function(){return P.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(P,B,z){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var $=w({},P.props),j=P.key;if(B!=null)for(V in B.key!==void 0&&(j=""+B.key),B)!O.call(B,V)||V==="key"||V==="__self"||V==="__source"||V==="ref"&&B.ref===void 0||($[V]=B[V]);var V=arguments.length-2;if(V===1)$.children=z;else if(1<V){for(var K=Array(V),X=0;X<V;X++)K[X]=arguments[X+2];$.children=K}return M(P.type,j,$)},mt.createContext=function(P){return P={$$typeof:s,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:i,_context:P},P},mt.createElement=function(P,B,z){var $,j={},V=null;if(B!=null)for($ in B.key!==void 0&&(V=""+B.key),B)O.call(B,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(j[$]=B[$]);var K=arguments.length-2;if(K===1)j.children=z;else if(1<K){for(var X=Array(K),se=0;se<K;se++)X[se]=arguments[se+2];j.children=X}if(P&&P.defaultProps)for($ in K=P.defaultProps,K)j[$]===void 0&&(j[$]=K[$]);return M(P,V,j)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(P){return{$$typeof:c,render:P}},mt.isValidElement=F,mt.lazy=function(P){return{$$typeof:m,_payload:{_status:-1,_result:P},_init:W}},mt.memo=function(P,B){return{$$typeof:d,type:P,compare:B===void 0?null:B}},mt.startTransition=function(P){var B=A.T,z={};A.T=z;try{var $=P(),j=A.S;j!==null&&j(z,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(I,oe)}catch(V){oe(V)}finally{B!==null&&z.types!==null&&(B.types=z.types),A.T=B}},mt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},mt.use=function(P){return A.H.use(P)},mt.useActionState=function(P,B,z){return A.H.useActionState(P,B,z)},mt.useCallback=function(P,B){return A.H.useCallback(P,B)},mt.useContext=function(P){return A.H.useContext(P)},mt.useDebugValue=function(){},mt.useDeferredValue=function(P,B){return A.H.useDeferredValue(P,B)},mt.useEffect=function(P,B){return A.H.useEffect(P,B)},mt.useEffectEvent=function(P){return A.H.useEffectEvent(P)},mt.useId=function(){return A.H.useId()},mt.useImperativeHandle=function(P,B,z){return A.H.useImperativeHandle(P,B,z)},mt.useInsertionEffect=function(P,B){return A.H.useInsertionEffect(P,B)},mt.useLayoutEffect=function(P,B){return A.H.useLayoutEffect(P,B)},mt.useMemo=function(P,B){return A.H.useMemo(P,B)},mt.useOptimistic=function(P,B){return A.H.useOptimistic(P,B)},mt.useReducer=function(P,B,z){return A.H.useReducer(P,B,z)},mt.useRef=function(P){return A.H.useRef(P)},mt.useState=function(P){return A.H.useState(P)},mt.useSyncExternalStore=function(P,B,z){return A.H.useSyncExternalStore(P,B,z)},mt.useTransition=function(){return A.H.useTransition()},mt.version="19.2.0",mt}var rP;function gT(){return rP||(rP=1,aS.exports=Tae()),aS.exports}var E=gT();const ue=wp(E),Av=nX({__proto__:null,default:ue},[E]);function jE(e,t){if(!e)throw new Error(t)}Ge(jE,"assert");var Nae=3e3,Rae=5e3;function bT(e){const{url:t,enabled:n=!0,clientName:a,clientUri:r,callbackUrl:i=typeof window<"u"?Gc(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:s="mcp:auth",clientConfig:c={},customHeaders:u={},debug:d=!1,autoRetry:m=!1,autoReconnect:h=Nae,transportType:g="auto",preventAutoAuth:v=!1,useRedirectFlow:S=!1,onPopupWindow:w,timeout:y=3e4,sseReadTimeout:_=3e5,wrapTransport:x,onNotification:k,samplingCallback:C}=e,[R,I]=E.useState("discovering"),[A,O]=E.useState([]),[M,U]=E.useState([]),[F,H]=E.useState([]),[te,q]=E.useState([]),[ie,G]=E.useState(),[Q,W]=E.useState(),[oe,ne]=E.useState(void 0),[P,B]=E.useState([]),[z,$]=E.useState(void 0),j=E.useRef(null),V=E.useRef(null),K=E.useRef(!1),X=E.useRef(!0),se=E.useRef(0),le=E.useRef(null),J=E.useRef(R),ee=E.useRef(h),ce=E.useRef(null);E.useEffect(()=>{J.current=R,ee.current=h},[R,h]);const re=E.useCallback((Pe,Le,...Qe)=>{const en=Qe.length>0?`${Le} ${Qe.map(ke=>JSON.stringify(ke)).join(" ")}`:Le;console[Pe](`[useMcp] ${en}`),X.current&&B(ke=>[...ke.slice(-100),{level:Pe,message:en,timestamp:Date.now()}])},[]),ye=E.useCallback(async(Pe=!1)=>{if(Pe||re("info","Disconnecting..."),K.current=!1,le.current&&clearTimeout(le.current),le.current=null,j.current)try{await j.current.closeSession("inspector-server")}catch(Le){Pe||re("warn","Error closing session:",Le)}j.current=null,X.current&&!Pe&&(I("discovering"),O([]),U([]),H([]),q([]),ne(void 0),$(void 0))},[re]),Te=E.useCallback((Pe,Le)=>{if(re("error",Pe,Le??""),X.current){I("failed"),ne(Pe);const Qe=V.current?.getLastAttemptedAuthUrl();Qe&&($(Qe),re("info","Manual authentication URL may be available.",Qe))}K.current=!1},[re]),He=E.useCallback(async()=>{if(!n||!t){re("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag.");return}if(K.current){re("debug","Connection attempt already in progress.");return}if(!X.current){re("debug","Connect called after unmount, aborting.");return}K.current=!0,se.current+=1,ne(void 0),$(void 0),ce.current=null,I("discovering"),re("info",`Connecting attempt #${se.current} to ${t}...`),V.current||(V.current=new Lg(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:v,useRedirectFlow:S,onPopupWindow:w}),re("debug","BrowserOAuthClientProvider initialized in connect.")),j.current||(j.current=new kae,re("debug","BrowserMCPClient initialized in connect."));const Pe=Ge(async(Qe,en=!1)=>{re("info",`Attempting connection with transport: ${Qe}`);try{const ke="inspector-server",Ie={url:t,transport:Qe==="sse"?"http":Qe};if(u&&Object.keys(u).length>0&&(Ie.headers=u),V.current){const Lt=await V.current.tokens();Lt?.access_token&&(Ie.headers={...Ie.headers,Authorization:`Bearer ${Lt.access_token}`})}j.current.addServer(ke,{...Ie,authProvider:V.current,clientOptions:c,samplingCallback:C,wrapTransport:x?Lt=>(console.log("[useMcp] Applying transport wrapper for server:",ke,"url:",t),x(Lt,t)):void 0});const ze=await j.current.createSession(ke,!1);k&&ze.on("notification",k),await ze.initialize(),re("info","✅ Successfully connected to MCP server"),re("info","Server info:",ze.connector.serverInfo),re("info","Server capabilities:",ze.connector.serverCapabilities),console.log("[useMcp] Server info:",ze.connector.serverInfo),console.log("[useMcp] Server capabilities:",ze.connector.serverCapabilities),I("ready"),ce.current=Qe,O(ze.connector.tools||[]);const gt=await ze.connector.listAllResources();U(gt.resources||[]);const nt=await ze.connector.listPrompts();q(nt.prompts||[]);const et=ze.connector.serverInfo,Ct=ze.connector.serverCapabilities;return et&&(console.log("[useMcp] Server info:",et),G(et)),Ct&&(console.log("[useMcp] Server capabilities:",Ct),W(Ct)),"success"}catch(ke){const Ie=ke?.message||String(ke);if(ke.code===401||Ie.includes("401")||Ie.includes("Unauthorized")){if(V.current){re("info","Authentication required. OAuth provider available.");try{const{auth:ze}=await di(async()=>{const{auth:nt}=await Promise.resolve().then(()=>Zj);return{auth:nt}},void 0),gt=new URL(t).origin;ze(V.current,{serverUrl:gt}).catch(()=>{}),setTimeout(()=>{if(X.current){const nt=V.current?.getLastAttemptedAuthUrl();nt?($(nt),re("info","Manual authentication URL available:",nt)):re("warn","Could not generate authentication URL")}},100)}catch(ze){re("warn","Error generating auth URL:",ze)}return X.current&&I("pending_auth"),K.current=!1,"auth_redirect"}return u&&Object.keys(u).length>0?(Te("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."),"failed"):(Te("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."),"failed")}return Te(Ie,ke),"failed"}},"tryConnectWithTransport");let Le="failed";if(g==="sse")re("debug","Using SSE-only transport mode"),Le=await Pe("sse");else if(g==="http")re("debug","Using HTTP-only transport mode"),Le=await Pe("http");else{re("debug","Using auto transport mode (HTTP with SSE fallback)");const Qe=await Pe("http");Qe==="fallback"&&X.current&&J.current!=="authenticating"?(re("info","HTTP failed, attempting SSE fallback..."),Le=await Pe("sse")):Le=Qe}(Le==="success"||Le==="failed"||Le==="auth_redirect")&&(K.current=!1),re("debug",`Connection sequence finished with status: ${Le}`)},[re,Te,ye,t,s,a,r,i,c.name,c.version,u,g,v,S,w,n,y,_]),_e=E.useCallback(async(Pe,Le,Qe)=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot call tool "${Pe}".`);re("info",`Calling tool: ${Pe}`,Le);try{const ke=j.current.getSession("inspector-server");if(!ke)throw new Error("No active session found");const Ie=await ke.connector.callTool(Pe,Le||{},Qe);return re("info",`Tool "${Pe}" call successful:`,Ie),Ie}catch(en){throw re("error",`Tool "${Pe}" call failed:`,en),en}},[R]),Se=E.useCallback(()=>{J.current==="failed"?(re("info","Retry requested..."),He()):re("warn",`Retry called but state is not 'failed' (state: ${J.current}). Ignoring.`)},[re,He]),Ue=E.useCallback(async()=>{re("info","Manual authentication requested...");const Pe=J.current;if(Pe==="failed")re("info","Attempting to reconnect and authenticate via retry..."),Se();else if(Pe==="pending_auth"){re("info","Proceeding with authentication from pending state...");try{jE(V.current,"Auth Provider not available for manual auth"),jE(t,"Server URL is required for authentication"),re("info","Clearing all OAuth state and initiating fresh flow...");const Le=`${s}:${V.current.serverUrlHash}`;Object.keys(localStorage).forEach(Ie=>{Ie.startsWith(Le)&&(re("debug",`Removing stale OAuth key: ${Ie}`),localStorage.removeItem(Ie)),Ie.startsWith(`${s}:state_`)&&(re("debug",`Removing orphaned state: ${Ie}`),localStorage.removeItem(Ie))}),I("authenticating");const Qe=new Lg(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:!1,useRedirectFlow:S,onPopupWindow:w});V.current=Qe,re("info","Triggering fresh OAuth authorization...");const{auth:en}=await di(async()=>{const{auth:Ie}=await Promise.resolve().then(()=>Zj);return{auth:Ie}},void 0),ke=new URL(t).origin;en(Qe,{serverUrl:ke}).catch(Ie=>{re("info","OAuth flow initiated:",Ie?.message||"Redirecting...")})}catch(Le){if(!X.current)return;I("pending_auth"),re("error",`Manual authentication failed: ${Le instanceof Error?Le.message:String(Le)}`)}}else if(Pe==="authenticating"){re("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const Le=V.current?.getLastAttemptedAuthUrl();Le&&!z&&($(Le),re("info","Manual authentication URL retrieved:",Le))}else re("info",`Client not in a state requiring manual authentication trigger (state: ${Pe}). If needed, try disconnecting and reconnecting.`)},[re,Se,z,t,S,w,s,a,r,i]),pe=E.useCallback(()=>{if(V.current){const Pe=V.current.clearStorage();re("info",`Cleared ${Pe} item(s) from localStorage for ${t}.`),$(void 0),ye()}else re("warn","Auth provider not initialized, cannot clear storage.")},[t,re,ye]),$e=E.useCallback(async()=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot list resources.`);re("info","Listing resources");try{const Le=j.current.getSession("inspector-server");if(!Le)throw new Error("No active session found");const Qe=await Le.connector.listAllResources();U(Qe.resources||[]),re("info","Resources listed successfully")}catch(Pe){throw re("error","List resources failed:",Pe),Pe}},[R]),Be=E.useCallback(async Pe=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot read resource.`);re("info",`Reading resource: ${Pe}`);try{const Qe=j.current.getSession("inspector-server");if(!Qe)throw new Error("No active session found");const en=await Qe.connector.readResource(Pe);return re("info","Resource read successful:",en),en}catch(Le){throw re("error","Resource read failed:",Le),Le}},[R]),Ee=E.useCallback(async()=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot list prompts.`);re("info","Listing prompts");try{const Le=j.current.getSession("inspector-server");if(!Le)throw new Error("No active session found");const Qe=await Le.connector.listPrompts();q(Qe.prompts||[]),re("info","Prompts listed successfully")}catch(Pe){throw re("error","List prompts failed:",Pe),Pe}},[R]),ot=E.useCallback(async(Pe,Le)=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot get prompt.`);re("info",`Getting prompt: ${Pe}`,Le);try{const en=j.current.getSession("inspector-server");if(!en)throw new Error("No active session found");const ke=await en.connector.getPrompt(Pe,Le||{});return re("info",`Prompt "${Pe}" retrieved successfully:`,ke),ke}catch(Qe){throw re("error",`Prompt "${Pe}" retrieval failed:`,Qe),Qe}},[R]),at=E.useRef(He),pt=E.useRef(Te);return E.useEffect(()=>{at.current=He,pt.current=Te}),E.useEffect(()=>{const Pe=Ge(Le=>{Le.origin===window.location.origin&&Le.data?.type==="mcp_auth_callback"&&(re("info","Received auth callback message.",Le.data),le.current&&clearTimeout(le.current),le.current=null,Le.data.success?(re("info","Authentication successful via popup. Reconnecting client..."),K.current&&re("debug","Connection attempt already in progress, resetting flag to allow reconnection."),K.current=!1,setTimeout(()=>{X.current&&(re("debug","Initiating reconnection after successful auth callback."),at.current())},100)):pt.current(`Authentication failed in callback: ${Le.data.error||"Unknown reason."}`))},"messageHandler");return window.addEventListener("message",Pe),re("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Pe),re("debug","Auth callback message listener removed."),le.current&&clearTimeout(le.current)}},[re]),E.useEffect(()=>(X.current=!0,!n||!t?(re("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag."),I("discovering"),()=>{X.current=!1}):(re("debug","useMcp mounted, initiating connection."),se.current=0,(!V.current||V.current.serverUrl!==t)&&(V.current=new Lg(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:v,useRedirectFlow:S,onPopupWindow:w}),re("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),He(),()=>{X.current=!1,re("debug","useMcp unmounting, disconnecting."),ye(!0)})),[t,n,s,i,a,r,c.name,c.version,S]),E.useEffect(()=>{let Pe=null;if(R==="failed"&&m&&se.current>0){const Le=typeof m=="number"?m:Rae;re("info",`Connection failed, auto-retrying in ${Le}ms...`),Pe=setTimeout(()=>{X.current&&J.current==="failed"&&Se()},Le)}return()=>{Pe&&clearTimeout(Pe)}},[R,m,Se,re]),{state:R,tools:A,resources:M,resourceTemplates:F,prompts:te,serverInfo:ie,capabilities:Q,error:oe,log:P,authUrl:z,client:j.current,callTool:_e,readResource:Be,listResources:$e,listPrompts:Ee,getPrompt:ot,retry:Se,disconnect:ye,authenticate:Ue,clearStorage:pe}}Ge(bT,"useMcp");var _u,Cae=(_u=class extends ue.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Widget Error:",t,n)}render(){return this.state.hasError?ue.createElement("div",{className:"p-4 border border-red-500 bg-red-50 text-red-900 rounded-md dark:bg-red-900/20 dark:text-red-100"},ue.createElement("h3",{className:"font-bold mb-2"},"Widget Error"),ue.createElement("pre",{className:"text-sm whitespace-pre-wrap"},this.state.error?.message)):this.props.children}},Ge(_u,"ErrorBoundary"),_u),Cf="openai:set_globals";function ii(e){return E.useSyncExternalStore(t=>{const n=Ge(a=>{a.detail.globals[e]!==void 0&&t()},"handleSetGlobal");return typeof window<"u"&&window.addEventListener(Cf,n),()=>{typeof window<"u"&&window.removeEventListener(Cf,n)}},()=>typeof window<"u"&&window.openai?window.openai[e]:void 0)}Ge(ii,"useOpenAiGlobal");function Vu(e){const[t,n]=E.useState(()=>typeof window<"u"&&!!window.openai);E.useEffect(()=>{if(typeof window<"u"&&window.openai){n(!0);return}const O=setInterval(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},100),M=Ge(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},"handleSetGlobals");typeof window<"u"&&window.addEventListener(Cf,M);const U=setTimeout(()=>{clearInterval(O),typeof window<"u"&&window.removeEventListener(Cf,M)},5e3);return()=>{clearInterval(O),clearTimeout(U),typeof window<"u"&&window.removeEventListener(Cf,M)}},[]);const a=E.useMemo(()=>t?"openai":"mcp-ui",[t]),r=typeof window<"u"?window.location.search:"",i=E.useMemo(()=>{const O=new URLSearchParams(r);return O.has("mcpUseParams")?JSON.parse(O.get("mcpUseParams")):{toolInput:{},toolOutput:{},toolId:""}},[r]),s=a==="openai"?ii("toolInput"):i.toolInput,c=a==="openai"?ii("toolOutput"):i.toolOutput,u=ii("toolResponseMetadata"),d=ii("widgetState"),m=ii("theme"),h=ii("displayMode"),g=ii("safeArea"),v=ii("maxHeight"),S=ii("userAgent"),w=ii("locale"),y=E.useMemo(()=>typeof window<"u"&&window.__mcpPublicUrl?window.__mcpPublicUrl.replace(/\/mcp-use\/public$/,""):"",[]),[_,x]=E.useState(null);E.useEffect(()=>{d!==void 0&&x(d)},[d]);const k=E.useCallback(async(O,M)=>{if(!window.openai?.callTool)throw new Error("window.openai.callTool is not available");return window.openai.callTool(O,M)},[]),C=E.useCallback(async O=>{if(!window.openai?.sendFollowUpMessage)throw new Error("window.openai.sendFollowUpMessage is not available");return window.openai.sendFollowUpMessage({prompt:O})},[]),R=E.useCallback(O=>{if(!window.openai?.openExternal)throw new Error("window.openai.openExternal is not available");window.openai.openExternal({href:O})},[]),I=E.useCallback(async O=>{if(!window.openai?.requestDisplayMode)throw new Error("window.openai.requestDisplayMode is not available");return window.openai.requestDisplayMode({mode:O})},[]),A=E.useCallback(async O=>{if(!window.openai?.setWidgetState)throw new Error("window.openai.setWidgetState is not available");const U=typeof O=="function"?O(d!==void 0?d:_):O;return x(U),window.openai.setWidgetState(U)},[d,_]);return{props:s||e||{},output:c??null,metadata:u??null,state:_,setState:A,theme:m||"light",displayMode:h||"inline",safeArea:g||{insets:{top:0,bottom:0,left:0,right:0}},maxHeight:v||600,userAgent:S||{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:w||"en",mcp_url:y,callTool:k,sendFollowUpMessage:C,openExternal:R,requestDisplayMode:I,isAvailable:t}}Ge(Vu,"useWidget");function Aae(e){const{props:t}=Vu(e);return t}Ge(Aae,"useWidgetProps");function Iae(){const{theme:e}=Vu();return e}Ge(Iae,"useWidgetTheme");function Oae(e){const{state:t,setState:n}=Vu();return E.useEffect(()=>{t===null&&e!==void 0&&window.openai?.setWidgetState&&n(e)},[]),[t,n]}Ge(Oae,"useWidgetState");var aP=Ge(({children:e})=>{const{theme:t,isAvailable:n}=Vu();console.log("theme",t);const[a,r]=E.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");E.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),c=Ge(u=>{r(u.matches?"dark":"light")},"handleChange");return s.addEventListener("change",c),()=>s.removeEventListener("change",c)},[]);const i=n?t:a;return E.useLayoutEffect(()=>{typeof document>"u"||(i==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[i]),ue.createElement(ue.Fragment,null,e)},"ThemeProvider");function eH({children:e,className:t="",position:n="top-right",attachTo:a,showLabels:r=!0,debugger:i=!1,viewControls:s=!1}){const{props:c,output:u,metadata:d,state:m,theme:h,displayMode:g,safeArea:v,maxHeight:S,userAgent:w,locale:y,isAvailable:_,callTool:x,sendFollowUpMessage:k,openExternal:C,requestDisplayMode:R,setState:I}=Vu(),[A,O]=E.useState(!1),[M,U]=E.useState(!1),F=E.useRef(null),H=E.useRef(null),[te,q]=E.useState([]),[ie,G]=E.useState(""),[Q,W]=E.useState("get-my-city"),[oe,ne]=E.useState("{}"),[P,B]=E.useState("Test follow-up message"),[z,$]=E.useState("https://docs.mcp-use.com"),j=g==="fullscreen"&&_,V=g==="pip"&&_,K=typeof window<"u"&&window.location.pathname.includes("/inspector/api/dev-widget/");E.useEffect(()=>{const Ee=setTimeout(()=>{if(typeof window<"u"&&window.openai)try{const ot=Object.keys(window.openai);q(ot)}catch{q([])}else q([])},100);return()=>{clearTimeout(Ee)}},[]);const X=h==="dark",se=Ge(()=>{const Ee=["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[...Ee,"top-4","left-4"];case"top-center":return[...Ee,"top-4","left-1/2","-translate-x-1/2"];case"top-right":return[...Ee,"top-4","right-4"];case"center-left":return[...Ee,"top-1/2","left-4","-translate-y-1/2"];case"center-right":return[...Ee,"top-1/2","right-4","-translate-y-1/2"];case"bottom-left":return[...Ee,"bottom-4","left-4"];case"bottom-center":return[...Ee,"bottom-4","left-1/2","-translate-x-1/2"];case"bottom-right":return[...Ee,"bottom-4","right-4"];default:return[...Ee,"top-4","right-4"]}},"getPositionClasses"),le=Ge(()=>{const ot=v?.insets?.top?Math.max(16,v.insets.top+8):16,at=v?.insets?.right?Math.max(16,v.insets.right+8):16,pt=v?.insets?.bottom?Math.max(16,v.insets.bottom+8):16,Pe=v?.insets?.left?Math.max(16,v.insets.left+8):16,Le={};switch(n){case"top-left":Le.top=`${ot}px`,Le.left=`${Pe}px`;break;case"top-center":Le.top=`${ot}px`;break;case"top-right":Le.top=`${ot}px`,Le.right=`${at}px`;break;case"center-left":Le.left=`${Pe}px`;break;case"center-right":Le.right=`${at}px`;break;case"bottom-left":Le.bottom=`${pt}px`,Le.left=`${Pe}px`;break;case"bottom-center":Le.bottom=`${pt}px`;break;case"bottom-right":Le.bottom=`${pt}px`,Le.right=`${at}px`;break;default:Le.top=`${ot}px`,Le.right=`${at}px`;break}return Le},"getPositionOffsetStyles");E.useEffect(()=>{if(!a)return;const Ee=Ge(()=>O(!0),"handleMouseEnter"),ot=Ge(()=>O(!1),"handleMouseLeave");return a.addEventListener("mouseenter",Ee),a.addEventListener("mouseleave",ot),()=>{a.removeEventListener("mouseenter",Ee),a.removeEventListener("mouseleave",ot)}},[a]),E.useEffect(()=>{if(!M)return;const Ee=Ge(ot=>{H.current&&!H.current.contains(ot.target)&&U(!1)},"handleClickOutside");return document.addEventListener("mousedown",Ee),()=>{document.removeEventListener("mousedown",Ee)}},[M]),E.useEffect(()=>(M?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[M]);const J=Ge(()=>{U(!M)},"handleToggleOverlay"),ee=Ge(async()=>{try{G("Calling tool...");const Ee=oe.trim()?JSON.parse(oe):{},ot=await x(Q,Ee);G(`Success: ${JSON.stringify(ot,null,2)}`)}catch(Ee){G(`Error: ${Ee.message}`)}},"handleCallTool"),ce=Ge(async()=>{try{G("Sending follow-up message..."),await k(P),G("Follow-up message sent successfully")}catch(Ee){G(`Error: ${Ee.message}`)}},"handleSendFollowUpMessage"),re=Ge(()=>{try{C(z),G(`Opened external link: ${z}`)}catch(Ee){G(`Error: ${Ee.message}`)}},"handleOpenExternal"),ye=Ge(async Ee=>{try{G(`Requesting display mode: ${Ee}...`);const ot=await R(Ee);G(`Display mode granted: ${ot.mode}`)}catch(ot){G(`Error: ${ot.message}`)}},"handleRequestDisplayMode"),Te=Ge(async()=>{try{const Ee=m?{...m,debugTimestamp:new Date().toISOString()}:{debugTimestamp:new Date().toISOString()};G("Setting state..."),await I(Ee),G(`State updated: ${JSON.stringify(Ee,null,2)}`)}catch(Ee){G(`Error: ${Ee.message}`)}},"handleSetState"),He=Ge(async()=>{try{await R("fullscreen")}catch(Ee){console.error("Failed to go fullscreen:",Ee)}},"handleFullscreen"),_e=Ge(async()=>{try{await R("pip")}catch(Ee){console.error("Failed to go pip:",Ee)}},"handlePip"),Se=Ge(()=>{const Ee=["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[...Ee,"top-full","right-0","mt-2"];case"top-left":return[...Ee,"top-full","left-0","mt-2"];case"top-center":return[...Ee,"top-full","left-1/2","-translate-x-1/2","mt-2"];case"bottom-right":return[...Ee,"bottom-full","right-0","mb-2"];case"bottom-left":return[...Ee,"bottom-full","left-0","mb-2"];case"bottom-center":return[...Ee,"bottom-full","left-1/2","-translate-x-1/2","mb-2"];case"center-left":return[...Ee,"left-full","top-1/2","-translate-y-1/2","ml-2"];case"center-right":return[...Ee,"right-full","top-1/2","-translate-y-1/2","mr-2"];default:return[...Ee,"top-full","right-0","mt-2"]}},"getTooltipClasses"),Ue=Ge(({onClick:Ee,label:ot,children:at})=>{const[pt,Pe]=E.useState(!1),Le=Se();return ue.createElement("button",{className:`p-2 ${X?"bg-white/10 hover:bg-white/20":"bg-black/70 hover:bg-black/90"} text-white border-none rounded-lg cursor-pointer flex items-center justify-center w-8 h-8 transition-colors duration-200 backdrop-blur-md ${X?"shadow-[0_2px_8px_rgba(0,0,0,0.3)]":"shadow-[0_2px_8px_rgba(0,0,0,0.2)]"} relative`,onMouseEnter:()=>Pe(!0),onMouseLeave:()=>Pe(!1),onClick:Ee,"aria-label":ot},ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"block"},at),r&&ue.createElement("span",{className:`${Le.join(" ")} ${pt?"opacity-100":"opacity-0"}`},ot))},"IconButton"),pe=Ge(Ee=>{if(Ee===null)return"null";if(Ee===void 0)return"undefined";if(typeof Ee=="object")try{return JSON.stringify(Ee,null,2)}catch{return String(Ee)}return String(Ee)},"formatValue"),$e=Ge(Ee=>Ee?`${Ee.device?.type||"unknown"}`:"N/A","formatUserAgent"),Be=Ge(Ee=>{if(!Ee?.insets)return"N/A";const{top:ot,bottom:at,left:pt,right:Pe}=Ee.insets;return`T:${ot} B:${at} L:${pt} R:${Pe}`},"formatSafeArea");return ue.createElement(ue.Fragment,null,ue.createElement("div",{ref:F,className:`${t} relative h-fit`,onMouseEnter:()=>!a&&O(!0),onMouseLeave:()=>!a&&O(!1)},ue.createElement("div",{className:se().join(" "),style:le()},!K&&ue.createElement(ue.Fragment,null,!j&&!V&&ue.createElement(ue.Fragment,null,(s===!0||s==="fullscreen")&&ue.createElement(Ue,{onClick:He,label:"Fullscreen"},ue.createElement("path",{d:"M15 3h6v6"}),ue.createElement("path",{d:"m21 3-7 7"}),ue.createElement("path",{d:"m3 21 7-7"}),ue.createElement("path",{d:"M9 21H3v-6"})),(s===!0||s==="pip")&&ue.createElement(Ue,{onClick:_e,label:"Picture in Picture"},ue.createElement("path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4"}),ue.createElement("rect",{width:"10",height:"7",x:"12",y:"13",rx:"2"}))),i&&ue.createElement(Ue,{onClick:J,label:"Debug Info"},ue.createElement("path",{d:"M12 20v-9"}),ue.createElement("path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}),ue.createElement("path",{d:"M14.12 3.88 16 2"}),ue.createElement("path",{d:"M21 21a4 4 0 0 0-3.81-4"}),ue.createElement("path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}),ue.createElement("path",{d:"M22 13h-4"}),ue.createElement("path",{d:"M3 21a4 4 0 0 1 3.81-4"}),ue.createElement("path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}),ue.createElement("path",{d:"M6 13H2"}),ue.createElement("path",{d:"m8 2 1.88 1.88"}),ue.createElement("path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"})))),e),M&&i&&ue.createElement("div",{ref:H,className:"fixed inset-0 bg-black text-white font-mono text-xs z-[10000] overflow-auto p-4",onClick:Ee=>{Ee.target===H.current&&U(!1)}},ue.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"},"×"),ue.createElement("div",{className:"max-w-[1200px] mx-auto pt-10"},ue.createElement("h1",{className:"text-lg font-bold mb-4 border-b border-gray-700 pb-2"},"Debug Info"),ue.createElement("table",{className:"w-full border-collapse border-spacing-0"},ue.createElement("tbody",null,ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Props"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(c))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Output"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(u))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Metadata"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(d))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"State"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(m))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Theme"),ue.createElement("td",{className:"p-2"},h)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Display Mode"),ue.createElement("td",{className:"p-2"},g)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Locale"),ue.createElement("td",{className:"p-2"},y)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Max Height"),ue.createElement("td",{className:"p-2"},S,"px")),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"User Agent"),ue.createElement("td",{className:"p-2"},$e(w))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Safe Area"),ue.createElement("td",{className:"p-2"},Be(v))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"API Available"),ue.createElement("td",{className:"p-2"},_?"Yes":"No")),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"window.openai Keys"),ue.createElement("td",{className:"p-2"},te.length>0?te.join(", "):"N/A")))),ue.createElement("h2",{className:"text-base font-bold mt-8 mb-4 border-b border-gray-700 pb-2"},"Actions"),ue.createElement("div",{className:"flex flex-col gap-3"},ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:Q,onChange:Ee=>W(Ee.target.value),placeholder:"Tool name",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs w-[150px]"}),ue.createElement("input",{type:"text",value:oe,onChange:Ee=>ne(Ee.target.value),placeholder:'{"key": "value"}',className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:ee,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Call Tool")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:P,onChange:Ee=>B(Ee.target.value),placeholder:"Follow-up message",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:ce,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Send Follow-Up")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:z,onChange:Ee=>$(Ee.target.value),placeholder:"External URL",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:re,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Open Link")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("span",{className:"w-[150px] text-xs"},"Display Mode:"),ue.createElement("button",{onClick:()=>ye("inline"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Inline"),ue.createElement("button",{onClick:()=>ye("pip"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"PiP"),ue.createElement("button",{onClick:()=>ye("fullscreen"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Fullscreen")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("button",{onClick: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)")),ie&&ue.createElement("div",{className:"mt-2 p-2 bg-[#1a1a1a] border border-gray-700 rounded whitespace-pre-wrap break-all text-[11px] max-h-[200px] overflow-auto"},ue.createElement("div",{className:"font-bold mb-1 text-gray-400"},"Result:"),ie,ue.createElement("button",{onClick:()=>G(""),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(eH,"WidgetControls");function tH(){if(typeof window>"u")return"/";const t=window.location.pathname.match(/^(\/inspector\/api\/dev-widget\/[^/]+)/);return t?t[1]:"/"}Ge(tH,"getBasename");var Dae=150,$ae=5;function Lae({children:e,debugger:t=!1,viewControls:n=!1,autoSize:a=!1}){const r=tH(),i=E.useRef(null),s=E.useRef(0),c=E.useRef(null),u=E.useRef(!1),[d,m]=E.useState(null),[h,g]=E.useState(null),[v,S]=E.useState(!0);E.useEffect(()=>{let x=!0;return(async()=>{try{const k=await di(()=>import("./index-DiHsIl7y.js"),[]);x&&(m(()=>k.BrowserRouter),S(!1))}catch{x&&(g(new Error(`❌ react-router-dom not installed!
44
+ `}catch(h){console.error(`${i} Could not display error in callback window:`,h)}u&&localStorage.removeItem(u),s&&(localStorage.removeItem(s.getKey("code_verifier")),localStorage.removeItem(s.getKey("last_auth_url")))}}Ge(hT,"onMcpAuthorization");var aS={exports:{}},mt={};var nP;function Tae(){if(nP)return mt;nP=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function v(P){return P===null||typeof P!="object"?null:(P=g&&P[g]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,y={};function _(P,B,z){this.props=P,this.context=B,this.refs=y,this.updater=z||S}_.prototype.isReactComponent={},_.prototype.setState=function(P,B){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,B,"setState")},_.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function x(){}x.prototype=_.prototype;function k(P,B,z){this.props=P,this.context=B,this.refs=y,this.updater=z||S}var C=k.prototype=new x;C.constructor=k,w(C,_.prototype),C.isPureReactComponent=!0;var R=Array.isArray;function I(){}var A={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function M(P,B,z){var $=z.ref;return{$$typeof:e,type:P,key:B,ref:$!==void 0?$:null,props:z}}function U(P,B){return M(P.type,B,P.props)}function F(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function H(P){var B={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(z){return B[z]})}var te=/\/+/g;function q(P,B){return typeof P=="object"&&P!==null&&P.key!=null?H(""+P.key):B.toString(36)}function ie(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(I,I):(P.status="pending",P.then(function(B){P.status==="pending"&&(P.status="fulfilled",P.value=B)},function(B){P.status==="pending"&&(P.status="rejected",P.reason=B)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function G(P,B,z,$,j){var V=typeof P;(V==="undefined"||V==="boolean")&&(P=null);var K=!1;if(P===null)K=!0;else switch(V){case"bigint":case"string":case"number":K=!0;break;case"object":switch(P.$$typeof){case e:case t:K=!0;break;case m:return K=P._init,G(K(P._payload),B,z,$,j)}}if(K)return j=j(P),K=$===""?"."+q(P,0):$,R(j)?(z="",K!=null&&(z=K.replace(te,"$&/")+"/"),G(j,B,z,"",function(le){return le})):j!=null&&(F(j)&&(j=U(j,z+(j.key==null||P&&P.key===j.key?"":(""+j.key).replace(te,"$&/")+"/")+K)),B.push(j)),1;K=0;var X=$===""?".":$+":";if(R(P))for(var se=0;se<P.length;se++)$=P[se],V=X+q($,se),K+=G($,B,z,V,j);else if(se=v(P),typeof se=="function")for(P=se.call(P),se=0;!($=P.next()).done;)$=$.value,V=X+q($,se++),K+=G($,B,z,V,j);else if(V==="object"){if(typeof P.then=="function")return G(ie(P),B,z,$,j);throw B=String(P),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return K}function Q(P,B,z){if(P==null)return P;var $=[],j=0;return G(P,$,"","",function(V){return B.call(z,V,j++)}),$}function W(P){if(P._status===-1){var B=P._result;B=B(),B.then(function(z){(P._status===0||P._status===-1)&&(P._status=1,P._result=z)},function(z){(P._status===0||P._status===-1)&&(P._status=2,P._result=z)}),P._status===-1&&(P._status=0,P._result=B)}if(P._status===1)return P._result.default;throw P._result}var oe=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},ne={map:Q,forEach:function(P,B,z){Q(P,function(){B.apply(this,arguments)},z)},count:function(P){var B=0;return Q(P,function(){B++}),B},toArray:function(P){return Q(P,function(B){return B})||[]},only:function(P){if(!F(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return mt.Activity=h,mt.Children=ne,mt.Component=_,mt.Fragment=n,mt.Profiler=r,mt.PureComponent=k,mt.StrictMode=a,mt.Suspense=u,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,mt.__COMPILER_RUNTIME={__proto__:null,c:function(P){return A.H.useMemoCache(P)}},mt.cache=function(P){return function(){return P.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(P,B,z){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var $=w({},P.props),j=P.key;if(B!=null)for(V in B.key!==void 0&&(j=""+B.key),B)!O.call(B,V)||V==="key"||V==="__self"||V==="__source"||V==="ref"&&B.ref===void 0||($[V]=B[V]);var V=arguments.length-2;if(V===1)$.children=z;else if(1<V){for(var K=Array(V),X=0;X<V;X++)K[X]=arguments[X+2];$.children=K}return M(P.type,j,$)},mt.createContext=function(P){return P={$$typeof:s,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:i,_context:P},P},mt.createElement=function(P,B,z){var $,j={},V=null;if(B!=null)for($ in B.key!==void 0&&(V=""+B.key),B)O.call(B,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(j[$]=B[$]);var K=arguments.length-2;if(K===1)j.children=z;else if(1<K){for(var X=Array(K),se=0;se<K;se++)X[se]=arguments[se+2];j.children=X}if(P&&P.defaultProps)for($ in K=P.defaultProps,K)j[$]===void 0&&(j[$]=K[$]);return M(P,V,j)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(P){return{$$typeof:c,render:P}},mt.isValidElement=F,mt.lazy=function(P){return{$$typeof:m,_payload:{_status:-1,_result:P},_init:W}},mt.memo=function(P,B){return{$$typeof:d,type:P,compare:B===void 0?null:B}},mt.startTransition=function(P){var B=A.T,z={};A.T=z;try{var $=P(),j=A.S;j!==null&&j(z,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(I,oe)}catch(V){oe(V)}finally{B!==null&&z.types!==null&&(B.types=z.types),A.T=B}},mt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},mt.use=function(P){return A.H.use(P)},mt.useActionState=function(P,B,z){return A.H.useActionState(P,B,z)},mt.useCallback=function(P,B){return A.H.useCallback(P,B)},mt.useContext=function(P){return A.H.useContext(P)},mt.useDebugValue=function(){},mt.useDeferredValue=function(P,B){return A.H.useDeferredValue(P,B)},mt.useEffect=function(P,B){return A.H.useEffect(P,B)},mt.useEffectEvent=function(P){return A.H.useEffectEvent(P)},mt.useId=function(){return A.H.useId()},mt.useImperativeHandle=function(P,B,z){return A.H.useImperativeHandle(P,B,z)},mt.useInsertionEffect=function(P,B){return A.H.useInsertionEffect(P,B)},mt.useLayoutEffect=function(P,B){return A.H.useLayoutEffect(P,B)},mt.useMemo=function(P,B){return A.H.useMemo(P,B)},mt.useOptimistic=function(P,B){return A.H.useOptimistic(P,B)},mt.useReducer=function(P,B,z){return A.H.useReducer(P,B,z)},mt.useRef=function(P){return A.H.useRef(P)},mt.useState=function(P){return A.H.useState(P)},mt.useSyncExternalStore=function(P,B,z){return A.H.useSyncExternalStore(P,B,z)},mt.useTransition=function(){return A.H.useTransition()},mt.version="19.2.0",mt}var rP;function gT(){return rP||(rP=1,aS.exports=Tae()),aS.exports}var E=gT();const ue=wp(E),Av=nX({__proto__:null,default:ue},[E]);function jE(e,t){if(!e)throw new Error(t)}Ge(jE,"assert");var Nae=3e3,Rae=5e3;function bT(e){const{url:t,enabled:n=!0,clientName:a,clientUri:r,callbackUrl:i=typeof window<"u"?Gc(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:s="mcp:auth",clientConfig:c={},customHeaders:u={},debug:d=!1,autoRetry:m=!1,autoReconnect:h=Nae,transportType:g="auto",preventAutoAuth:v=!1,useRedirectFlow:S=!1,onPopupWindow:w,timeout:y=3e4,sseReadTimeout:_=3e5,wrapTransport:x,onNotification:k,samplingCallback:C}=e,[R,I]=E.useState("discovering"),[A,O]=E.useState([]),[M,U]=E.useState([]),[F,H]=E.useState([]),[te,q]=E.useState([]),[ie,G]=E.useState(),[Q,W]=E.useState(),[oe,ne]=E.useState(void 0),[P,B]=E.useState([]),[z,$]=E.useState(void 0),j=E.useRef(null),V=E.useRef(null),K=E.useRef(!1),X=E.useRef(!0),se=E.useRef(0),le=E.useRef(null),J=E.useRef(R),ee=E.useRef(h),ce=E.useRef(null);E.useEffect(()=>{J.current=R,ee.current=h},[R,h]);const re=E.useCallback((Pe,Le,...Qe)=>{const en=Qe.length>0?`${Le} ${Qe.map(ke=>JSON.stringify(ke)).join(" ")}`:Le;console[Pe](`[useMcp] ${en}`),X.current&&B(ke=>[...ke.slice(-100),{level:Pe,message:en,timestamp:Date.now()}])},[]),ye=E.useCallback(async(Pe=!1)=>{if(Pe||re("info","Disconnecting..."),K.current=!1,le.current&&clearTimeout(le.current),le.current=null,j.current)try{await j.current.closeSession("inspector-server")}catch(Le){Pe||re("warn","Error closing session:",Le)}j.current=null,X.current&&!Pe&&(I("discovering"),O([]),U([]),H([]),q([]),ne(void 0),$(void 0))},[re]),Te=E.useCallback((Pe,Le)=>{if(re("error",Pe,Le??""),X.current){I("failed"),ne(Pe);const Qe=V.current?.getLastAttemptedAuthUrl();Qe&&($(Qe),re("info","Manual authentication URL may be available.",Qe))}K.current=!1},[re]),He=E.useCallback(async()=>{if(!n||!t){re("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag.");return}if(K.current){re("debug","Connection attempt already in progress.");return}if(!X.current){re("debug","Connect called after unmount, aborting.");return}K.current=!0,se.current+=1,ne(void 0),$(void 0),ce.current=null,I("discovering"),re("info",`Connecting attempt #${se.current} to ${t}...`),V.current||(V.current=new Lg(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:v,useRedirectFlow:S,onPopupWindow:w}),re("debug","BrowserOAuthClientProvider initialized in connect.")),j.current||(j.current=new kae,re("debug","BrowserMCPClient initialized in connect."));const Pe=Ge(async(Qe,en=!1)=>{re("info",`Attempting connection with transport: ${Qe}`);try{const ke="inspector-server",Ie={url:t,transport:Qe==="sse"?"http":Qe};if(u&&Object.keys(u).length>0&&(Ie.headers=u),V.current){const Lt=await V.current.tokens();Lt?.access_token&&(Ie.headers={...Ie.headers,Authorization:`Bearer ${Lt.access_token}`})}j.current.addServer(ke,{...Ie,authProvider:V.current,clientOptions:c,samplingCallback:C,wrapTransport:x?Lt=>(console.log("[useMcp] Applying transport wrapper for server:",ke,"url:",t),x(Lt,t)):void 0});const ze=await j.current.createSession(ke,!1);k&&ze.on("notification",k),await ze.initialize(),re("info","✅ Successfully connected to MCP server"),re("info","Server info:",ze.connector.serverInfo),re("info","Server capabilities:",ze.connector.serverCapabilities),console.log("[useMcp] Server info:",ze.connector.serverInfo),console.log("[useMcp] Server capabilities:",ze.connector.serverCapabilities),I("ready"),ce.current=Qe,O(ze.connector.tools||[]);const gt=await ze.connector.listAllResources();U(gt.resources||[]);const nt=await ze.connector.listPrompts();q(nt.prompts||[]);const et=ze.connector.serverInfo,Ct=ze.connector.serverCapabilities;return et&&(console.log("[useMcp] Server info:",et),G(et)),Ct&&(console.log("[useMcp] Server capabilities:",Ct),W(Ct)),"success"}catch(ke){const Ie=ke?.message||String(ke);if(ke.code===401||Ie.includes("401")||Ie.includes("Unauthorized")){if(V.current){re("info","Authentication required. OAuth provider available.");try{const{auth:ze}=await di(async()=>{const{auth:nt}=await Promise.resolve().then(()=>Zj);return{auth:nt}},void 0),gt=new URL(t).origin;ze(V.current,{serverUrl:gt}).catch(()=>{}),setTimeout(()=>{if(X.current){const nt=V.current?.getLastAttemptedAuthUrl();nt?($(nt),re("info","Manual authentication URL available:",nt)):re("warn","Could not generate authentication URL")}},100)}catch(ze){re("warn","Error generating auth URL:",ze)}return X.current&&I("pending_auth"),K.current=!1,"auth_redirect"}return u&&Object.keys(u).length>0?(Te("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."),"failed"):(Te("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."),"failed")}return Te(Ie,ke),"failed"}},"tryConnectWithTransport");let Le="failed";if(g==="sse")re("debug","Using SSE-only transport mode"),Le=await Pe("sse");else if(g==="http")re("debug","Using HTTP-only transport mode"),Le=await Pe("http");else{re("debug","Using auto transport mode (HTTP with SSE fallback)");const Qe=await Pe("http");Qe==="fallback"&&X.current&&J.current!=="authenticating"?(re("info","HTTP failed, attempting SSE fallback..."),Le=await Pe("sse")):Le=Qe}(Le==="success"||Le==="failed"||Le==="auth_redirect")&&(K.current=!1),re("debug",`Connection sequence finished with status: ${Le}`)},[re,Te,ye,t,s,a,r,i,c.name,c.version,u,g,v,S,w,n,y,_]),_e=E.useCallback(async(Pe,Le,Qe)=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot call tool "${Pe}".`);re("info",`Calling tool: ${Pe}`,Le);try{const ke=j.current.getSession("inspector-server");if(!ke)throw new Error("No active session found");const Ie=await ke.connector.callTool(Pe,Le||{},Qe);return re("info",`Tool "${Pe}" call successful:`,Ie),Ie}catch(en){throw re("error",`Tool "${Pe}" call failed:`,en),en}},[R]),Se=E.useCallback(()=>{J.current==="failed"?(re("info","Retry requested..."),He()):re("warn",`Retry called but state is not 'failed' (state: ${J.current}). Ignoring.`)},[re,He]),Ue=E.useCallback(async()=>{re("info","Manual authentication requested...");const Pe=J.current;if(Pe==="failed")re("info","Attempting to reconnect and authenticate via retry..."),Se();else if(Pe==="pending_auth"){re("info","Proceeding with authentication from pending state...");try{jE(V.current,"Auth Provider not available for manual auth"),jE(t,"Server URL is required for authentication"),re("info","Clearing all OAuth state and initiating fresh flow...");const Le=`${s}:${V.current.serverUrlHash}`;Object.keys(localStorage).forEach(Ie=>{Ie.startsWith(Le)&&(re("debug",`Removing stale OAuth key: ${Ie}`),localStorage.removeItem(Ie)),Ie.startsWith(`${s}:state_`)&&(re("debug",`Removing orphaned state: ${Ie}`),localStorage.removeItem(Ie))}),I("authenticating");const Qe=new Lg(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:!1,useRedirectFlow:S,onPopupWindow:w});V.current=Qe,re("info","Triggering fresh OAuth authorization...");const{auth:en}=await di(async()=>{const{auth:Ie}=await Promise.resolve().then(()=>Zj);return{auth:Ie}},void 0),ke=new URL(t).origin;en(Qe,{serverUrl:ke}).catch(Ie=>{re("info","OAuth flow initiated:",Ie?.message||"Redirecting...")})}catch(Le){if(!X.current)return;I("pending_auth"),re("error",`Manual authentication failed: ${Le instanceof Error?Le.message:String(Le)}`)}}else if(Pe==="authenticating"){re("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const Le=V.current?.getLastAttemptedAuthUrl();Le&&!z&&($(Le),re("info","Manual authentication URL retrieved:",Le))}else re("info",`Client not in a state requiring manual authentication trigger (state: ${Pe}). If needed, try disconnecting and reconnecting.`)},[re,Se,z,t,S,w,s,a,r,i]),pe=E.useCallback(()=>{if(V.current){const Pe=V.current.clearStorage();re("info",`Cleared ${Pe} item(s) from localStorage for ${t}.`),$(void 0),ye()}else re("warn","Auth provider not initialized, cannot clear storage.")},[t,re,ye]),$e=E.useCallback(async()=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot list resources.`);re("info","Listing resources");try{const Le=j.current.getSession("inspector-server");if(!Le)throw new Error("No active session found");const Qe=await Le.connector.listAllResources();U(Qe.resources||[]),re("info","Resources listed successfully")}catch(Pe){throw re("error","List resources failed:",Pe),Pe}},[R]),Be=E.useCallback(async Pe=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot read resource.`);re("info",`Reading resource: ${Pe}`);try{const Qe=j.current.getSession("inspector-server");if(!Qe)throw new Error("No active session found");const en=await Qe.connector.readResource(Pe);return re("info","Resource read successful:",en),en}catch(Le){throw re("error","Resource read failed:",Le),Le}},[R]),Ee=E.useCallback(async()=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot list prompts.`);re("info","Listing prompts");try{const Le=j.current.getSession("inspector-server");if(!Le)throw new Error("No active session found");const Qe=await Le.connector.listPrompts();q(Qe.prompts||[]),re("info","Prompts listed successfully")}catch(Pe){throw re("error","List prompts failed:",Pe),Pe}},[R]),ot=E.useCallback(async(Pe,Le)=>{if(J.current!=="ready"||!j.current)throw new Error(`MCP client is not ready (current state: ${R}). Cannot get prompt.`);re("info",`Getting prompt: ${Pe}`,Le);try{const en=j.current.getSession("inspector-server");if(!en)throw new Error("No active session found");const ke=await en.connector.getPrompt(Pe,Le||{});return re("info",`Prompt "${Pe}" retrieved successfully:`,ke),ke}catch(Qe){throw re("error",`Prompt "${Pe}" retrieval failed:`,Qe),Qe}},[R]),at=E.useRef(He),pt=E.useRef(Te);return E.useEffect(()=>{at.current=He,pt.current=Te}),E.useEffect(()=>{const Pe=Ge(Le=>{Le.origin===window.location.origin&&Le.data?.type==="mcp_auth_callback"&&(re("info","Received auth callback message.",Le.data),le.current&&clearTimeout(le.current),le.current=null,Le.data.success?(re("info","Authentication successful via popup. Reconnecting client..."),K.current&&re("debug","Connection attempt already in progress, resetting flag to allow reconnection."),K.current=!1,setTimeout(()=>{X.current&&(re("debug","Initiating reconnection after successful auth callback."),at.current())},100)):pt.current(`Authentication failed in callback: ${Le.data.error||"Unknown reason."}`))},"messageHandler");return window.addEventListener("message",Pe),re("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Pe),re("debug","Auth callback message listener removed."),le.current&&clearTimeout(le.current)}},[re]),E.useEffect(()=>(X.current=!0,!n||!t?(re("debug",n?"No server URL provided, skipping connection.":"Connection disabled via enabled flag."),I("discovering"),()=>{X.current=!1}):(re("debug","useMcp mounted, initiating connection."),se.current=0,(!V.current||V.current.serverUrl!==t)&&(V.current=new Lg(t,{storageKeyPrefix:s,clientName:a,clientUri:r,callbackUrl:i,preventAutoAuth:v,useRedirectFlow:S,onPopupWindow:w}),re("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),He(),()=>{X.current=!1,re("debug","useMcp unmounting, disconnecting."),ye(!0)})),[t,n,s,i,a,r,c.name,c.version,S]),E.useEffect(()=>{let Pe=null;if(R==="failed"&&m&&se.current>0){const Le=typeof m=="number"?m:Rae;re("info",`Connection failed, auto-retrying in ${Le}ms...`),Pe=setTimeout(()=>{X.current&&J.current==="failed"&&Se()},Le)}return()=>{Pe&&clearTimeout(Pe)}},[R,m,Se,re]),{state:R,tools:A,resources:M,resourceTemplates:F,prompts:te,serverInfo:ie,capabilities:Q,error:oe,log:P,authUrl:z,client:j.current,callTool:_e,readResource:Be,listResources:$e,listPrompts:Ee,getPrompt:ot,retry:Se,disconnect:ye,authenticate:Ue,clearStorage:pe}}Ge(bT,"useMcp");var _u,Cae=(_u=class extends ue.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Widget Error:",t,n)}render(){return this.state.hasError?ue.createElement("div",{className:"p-4 border border-red-500 bg-red-50 text-red-900 rounded-md dark:bg-red-900/20 dark:text-red-100"},ue.createElement("h3",{className:"font-bold mb-2"},"Widget Error"),ue.createElement("pre",{className:"text-sm whitespace-pre-wrap"},this.state.error?.message)):this.props.children}},Ge(_u,"ErrorBoundary"),_u),Cf="openai:set_globals";function ii(e){return E.useSyncExternalStore(t=>{const n=Ge(a=>{a.detail.globals[e]!==void 0&&t()},"handleSetGlobal");return typeof window<"u"&&window.addEventListener(Cf,n),()=>{typeof window<"u"&&window.removeEventListener(Cf,n)}},()=>typeof window<"u"&&window.openai?window.openai[e]:void 0)}Ge(ii,"useOpenAiGlobal");function Vu(e){const[t,n]=E.useState(()=>typeof window<"u"&&!!window.openai);E.useEffect(()=>{if(typeof window<"u"&&window.openai){n(!0);return}const O=setInterval(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},100),M=Ge(()=>{typeof window<"u"&&window.openai&&(n(!0),clearInterval(O))},"handleSetGlobals");typeof window<"u"&&window.addEventListener(Cf,M);const U=setTimeout(()=>{clearInterval(O),typeof window<"u"&&window.removeEventListener(Cf,M)},5e3);return()=>{clearInterval(O),clearTimeout(U),typeof window<"u"&&window.removeEventListener(Cf,M)}},[]);const a=E.useMemo(()=>t?"openai":"mcp-ui",[t]),r=typeof window<"u"?window.location.search:"",i=E.useMemo(()=>{const O=new URLSearchParams(r);return O.has("mcpUseParams")?JSON.parse(O.get("mcpUseParams")):{toolInput:{},toolOutput:{},toolId:""}},[r]),s=a==="openai"?ii("toolInput"):i.toolInput,c=a==="openai"?ii("toolOutput"):i.toolOutput,u=ii("toolResponseMetadata"),d=ii("widgetState"),m=ii("theme"),h=ii("displayMode"),g=ii("safeArea"),v=ii("maxHeight"),S=ii("userAgent"),w=ii("locale"),y=E.useMemo(()=>typeof window<"u"&&window.__mcpPublicUrl?window.__mcpPublicUrl.replace(/\/mcp-use\/public$/,""):"",[]),[_,x]=E.useState(null);E.useEffect(()=>{d!==void 0&&x(d)},[d]);const k=E.useCallback(async(O,M)=>{if(!window.openai?.callTool)throw new Error("window.openai.callTool is not available");return window.openai.callTool(O,M)},[]),C=E.useCallback(async O=>{if(!window.openai?.sendFollowUpMessage)throw new Error("window.openai.sendFollowUpMessage is not available");return window.openai.sendFollowUpMessage({prompt:O})},[]),R=E.useCallback(O=>{if(!window.openai?.openExternal)throw new Error("window.openai.openExternal is not available");window.openai.openExternal({href:O})},[]),I=E.useCallback(async O=>{if(!window.openai?.requestDisplayMode)throw new Error("window.openai.requestDisplayMode is not available");return window.openai.requestDisplayMode({mode:O})},[]),A=E.useCallback(async O=>{if(!window.openai?.setWidgetState)throw new Error("window.openai.setWidgetState is not available");const U=typeof O=="function"?O(d!==void 0?d:_):O;return x(U),window.openai.setWidgetState(U)},[d,_]);return{props:s||e||{},output:c??null,metadata:u??null,state:_,setState:A,theme:m||"light",displayMode:h||"inline",safeArea:g||{insets:{top:0,bottom:0,left:0,right:0}},maxHeight:v||600,userAgent:S||{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:w||"en",mcp_url:y,callTool:k,sendFollowUpMessage:C,openExternal:R,requestDisplayMode:I,isAvailable:t}}Ge(Vu,"useWidget");function Aae(e){const{props:t}=Vu(e);return t}Ge(Aae,"useWidgetProps");function Iae(){const{theme:e}=Vu();return e}Ge(Iae,"useWidgetTheme");function Oae(e){const{state:t,setState:n}=Vu();return E.useEffect(()=>{t===null&&e!==void 0&&window.openai?.setWidgetState&&n(e)},[]),[t,n]}Ge(Oae,"useWidgetState");var aP=Ge(({children:e})=>{const{theme:t,isAvailable:n}=Vu();console.log("theme",t);const[a,r]=E.useState(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");E.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),c=Ge(u=>{r(u.matches?"dark":"light")},"handleChange");return s.addEventListener("change",c),()=>s.removeEventListener("change",c)},[]);const i=n?t:a;return E.useLayoutEffect(()=>{typeof document>"u"||(i==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"))},[i]),ue.createElement(ue.Fragment,null,e)},"ThemeProvider");function eH({children:e,className:t="",position:n="top-right",attachTo:a,showLabels:r=!0,debugger:i=!1,viewControls:s=!1}){const{props:c,output:u,metadata:d,state:m,theme:h,displayMode:g,safeArea:v,maxHeight:S,userAgent:w,locale:y,isAvailable:_,callTool:x,sendFollowUpMessage:k,openExternal:C,requestDisplayMode:R,setState:I}=Vu(),[A,O]=E.useState(!1),[M,U]=E.useState(!1),F=E.useRef(null),H=E.useRef(null),[te,q]=E.useState([]),[ie,G]=E.useState(""),[Q,W]=E.useState("get-my-city"),[oe,ne]=E.useState("{}"),[P,B]=E.useState("Test follow-up message"),[z,$]=E.useState("https://docs.mcp-use.com"),j=g==="fullscreen"&&_,V=g==="pip"&&_,K=typeof window<"u"&&window.location.pathname.includes("/inspector/api/dev-widget/");E.useEffect(()=>{const Ee=setTimeout(()=>{if(typeof window<"u"&&window.openai)try{const ot=Object.keys(window.openai);q(ot)}catch{q([])}else q([])},100);return()=>{clearTimeout(Ee)}},[]);const X=h==="dark",se=Ge(()=>{const Ee=["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[...Ee,"top-4","left-4"];case"top-center":return[...Ee,"top-4","left-1/2","-translate-x-1/2"];case"top-right":return[...Ee,"top-4","right-4"];case"center-left":return[...Ee,"top-1/2","left-4","-translate-y-1/2"];case"center-right":return[...Ee,"top-1/2","right-4","-translate-y-1/2"];case"bottom-left":return[...Ee,"bottom-4","left-4"];case"bottom-center":return[...Ee,"bottom-4","left-1/2","-translate-x-1/2"];case"bottom-right":return[...Ee,"bottom-4","right-4"];default:return[...Ee,"top-4","right-4"]}},"getPositionClasses"),le=Ge(()=>{const ot=v?.insets?.top?Math.max(16,v.insets.top+8):16,at=v?.insets?.right?Math.max(16,v.insets.right+8):16,pt=v?.insets?.bottom?Math.max(16,v.insets.bottom+8):16,Pe=v?.insets?.left?Math.max(16,v.insets.left+8):16,Le={};switch(n){case"top-left":Le.top=`${ot}px`,Le.left=`${Pe}px`;break;case"top-center":Le.top=`${ot}px`;break;case"top-right":Le.top=`${ot}px`,Le.right=`${at}px`;break;case"center-left":Le.left=`${Pe}px`;break;case"center-right":Le.right=`${at}px`;break;case"bottom-left":Le.bottom=`${pt}px`,Le.left=`${Pe}px`;break;case"bottom-center":Le.bottom=`${pt}px`;break;case"bottom-right":Le.bottom=`${pt}px`,Le.right=`${at}px`;break;default:Le.top=`${ot}px`,Le.right=`${at}px`;break}return Le},"getPositionOffsetStyles");E.useEffect(()=>{if(!a)return;const Ee=Ge(()=>O(!0),"handleMouseEnter"),ot=Ge(()=>O(!1),"handleMouseLeave");return a.addEventListener("mouseenter",Ee),a.addEventListener("mouseleave",ot),()=>{a.removeEventListener("mouseenter",Ee),a.removeEventListener("mouseleave",ot)}},[a]),E.useEffect(()=>{if(!M)return;const Ee=Ge(ot=>{H.current&&!H.current.contains(ot.target)&&U(!1)},"handleClickOutside");return document.addEventListener("mousedown",Ee),()=>{document.removeEventListener("mousedown",Ee)}},[M]),E.useEffect(()=>(M?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[M]);const J=Ge(()=>{U(!M)},"handleToggleOverlay"),ee=Ge(async()=>{try{G("Calling tool...");const Ee=oe.trim()?JSON.parse(oe):{},ot=await x(Q,Ee);G(`Success: ${JSON.stringify(ot,null,2)}`)}catch(Ee){G(`Error: ${Ee.message}`)}},"handleCallTool"),ce=Ge(async()=>{try{G("Sending follow-up message..."),await k(P),G("Follow-up message sent successfully")}catch(Ee){G(`Error: ${Ee.message}`)}},"handleSendFollowUpMessage"),re=Ge(()=>{try{C(z),G(`Opened external link: ${z}`)}catch(Ee){G(`Error: ${Ee.message}`)}},"handleOpenExternal"),ye=Ge(async Ee=>{try{G(`Requesting display mode: ${Ee}...`);const ot=await R(Ee);G(`Display mode granted: ${ot.mode}`)}catch(ot){G(`Error: ${ot.message}`)}},"handleRequestDisplayMode"),Te=Ge(async()=>{try{const Ee=m?{...m,debugTimestamp:new Date().toISOString()}:{debugTimestamp:new Date().toISOString()};G("Setting state..."),await I(Ee),G(`State updated: ${JSON.stringify(Ee,null,2)}`)}catch(Ee){G(`Error: ${Ee.message}`)}},"handleSetState"),He=Ge(async()=>{try{await R("fullscreen")}catch(Ee){console.error("Failed to go fullscreen:",Ee)}},"handleFullscreen"),_e=Ge(async()=>{try{await R("pip")}catch(Ee){console.error("Failed to go pip:",Ee)}},"handlePip"),Se=Ge(()=>{const Ee=["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[...Ee,"top-full","right-0","mt-2"];case"top-left":return[...Ee,"top-full","left-0","mt-2"];case"top-center":return[...Ee,"top-full","left-1/2","-translate-x-1/2","mt-2"];case"bottom-right":return[...Ee,"bottom-full","right-0","mb-2"];case"bottom-left":return[...Ee,"bottom-full","left-0","mb-2"];case"bottom-center":return[...Ee,"bottom-full","left-1/2","-translate-x-1/2","mb-2"];case"center-left":return[...Ee,"left-full","top-1/2","-translate-y-1/2","ml-2"];case"center-right":return[...Ee,"right-full","top-1/2","-translate-y-1/2","mr-2"];default:return[...Ee,"top-full","right-0","mt-2"]}},"getTooltipClasses"),Ue=Ge(({onClick:Ee,label:ot,children:at})=>{const[pt,Pe]=E.useState(!1),Le=Se();return ue.createElement("button",{className:`p-2 ${X?"bg-white/10 hover:bg-white/20":"bg-black/70 hover:bg-black/90"} text-white border-none rounded-lg cursor-pointer flex items-center justify-center w-8 h-8 transition-colors duration-200 backdrop-blur-md ${X?"shadow-[0_2px_8px_rgba(0,0,0,0.3)]":"shadow-[0_2px_8px_rgba(0,0,0,0.2)]"} relative`,onMouseEnter:()=>Pe(!0),onMouseLeave:()=>Pe(!1),onClick:Ee,"aria-label":ot},ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"block"},at),r&&ue.createElement("span",{className:`${Le.join(" ")} ${pt?"opacity-100":"opacity-0"}`},ot))},"IconButton"),pe=Ge(Ee=>{if(Ee===null)return"null";if(Ee===void 0)return"undefined";if(typeof Ee=="object")try{return JSON.stringify(Ee,null,2)}catch{return String(Ee)}return String(Ee)},"formatValue"),$e=Ge(Ee=>Ee?`${Ee.device?.type||"unknown"}`:"N/A","formatUserAgent"),Be=Ge(Ee=>{if(!Ee?.insets)return"N/A";const{top:ot,bottom:at,left:pt,right:Pe}=Ee.insets;return`T:${ot} B:${at} L:${pt} R:${Pe}`},"formatSafeArea");return ue.createElement(ue.Fragment,null,ue.createElement("div",{ref:F,className:`${t} relative h-fit`,onMouseEnter:()=>!a&&O(!0),onMouseLeave:()=>!a&&O(!1)},ue.createElement("div",{className:se().join(" "),style:le()},!K&&ue.createElement(ue.Fragment,null,!j&&!V&&ue.createElement(ue.Fragment,null,(s===!0||s==="fullscreen")&&ue.createElement(Ue,{onClick:He,label:"Fullscreen"},ue.createElement("path",{d:"M15 3h6v6"}),ue.createElement("path",{d:"m21 3-7 7"}),ue.createElement("path",{d:"m3 21 7-7"}),ue.createElement("path",{d:"M9 21H3v-6"})),(s===!0||s==="pip")&&ue.createElement(Ue,{onClick:_e,label:"Picture in Picture"},ue.createElement("path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4"}),ue.createElement("rect",{width:"10",height:"7",x:"12",y:"13",rx:"2"}))),i&&ue.createElement(Ue,{onClick:J,label:"Debug Info"},ue.createElement("path",{d:"M12 20v-9"}),ue.createElement("path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}),ue.createElement("path",{d:"M14.12 3.88 16 2"}),ue.createElement("path",{d:"M21 21a4 4 0 0 0-3.81-4"}),ue.createElement("path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}),ue.createElement("path",{d:"M22 13h-4"}),ue.createElement("path",{d:"M3 21a4 4 0 0 1 3.81-4"}),ue.createElement("path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}),ue.createElement("path",{d:"M6 13H2"}),ue.createElement("path",{d:"m8 2 1.88 1.88"}),ue.createElement("path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"})))),e),M&&i&&ue.createElement("div",{ref:H,className:"fixed inset-0 bg-black text-white font-mono text-xs z-[10000] overflow-auto p-4",onClick:Ee=>{Ee.target===H.current&&U(!1)}},ue.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"},"×"),ue.createElement("div",{className:"max-w-[1200px] mx-auto pt-10"},ue.createElement("h1",{className:"text-lg font-bold mb-4 border-b border-gray-700 pb-2"},"Debug Info"),ue.createElement("table",{className:"w-full border-collapse border-spacing-0"},ue.createElement("tbody",null,ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Props"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(c))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Output"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(u))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Metadata"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(d))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"State"),ue.createElement("td",{className:"p-2 whitespace-pre-wrap break-all"},pe(m))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Theme"),ue.createElement("td",{className:"p-2"},h)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Display Mode"),ue.createElement("td",{className:"p-2"},g)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Locale"),ue.createElement("td",{className:"p-2"},y)),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Max Height"),ue.createElement("td",{className:"p-2"},S,"px")),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"User Agent"),ue.createElement("td",{className:"p-2"},$e(w))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"Safe Area"),ue.createElement("td",{className:"p-2"},Be(v))),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"API Available"),ue.createElement("td",{className:"p-2"},_?"Yes":"No")),ue.createElement("tr",{className:"border-b border-gray-700"},ue.createElement("td",{className:"p-2 font-bold w-[200px] align-top"},"window.openai Keys"),ue.createElement("td",{className:"p-2"},te.length>0?te.join(", "):"N/A")))),ue.createElement("h2",{className:"text-base font-bold mt-8 mb-4 border-b border-gray-700 pb-2"},"Actions"),ue.createElement("div",{className:"flex flex-col gap-3"},ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:Q,onChange:Ee=>W(Ee.target.value),placeholder:"Tool name",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs w-[150px]"}),ue.createElement("input",{type:"text",value:oe,onChange:Ee=>ne(Ee.target.value),placeholder:'{"key": "value"}',className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:ee,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Call Tool")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:P,onChange:Ee=>B(Ee.target.value),placeholder:"Follow-up message",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:ce,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Send Follow-Up")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("input",{type:"text",value:z,onChange:Ee=>$(Ee.target.value),placeholder:"External URL",className:"py-1.5 px-2 bg-[#1a1a1a] text-white border border-gray-700 rounded font-mono text-xs flex-1"}),ue.createElement("button",{onClick:re,className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs"},"Open Link")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("span",{className:"w-[150px] text-xs"},"Display Mode:"),ue.createElement("button",{onClick:()=>ye("inline"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Inline"),ue.createElement("button",{onClick:()=>ye("pip"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"PiP"),ue.createElement("button",{onClick:()=>ye("fullscreen"),className:"py-1.5 px-3 bg-gray-800 text-white border border-gray-600 rounded cursor-pointer font-mono text-xs flex-1"},"Fullscreen")),ue.createElement("div",{className:"flex gap-2 items-center"},ue.createElement("button",{onClick: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)")),ie&&ue.createElement("div",{className:"mt-2 p-2 bg-[#1a1a1a] border border-gray-700 rounded whitespace-pre-wrap break-all text-[11px] max-h-[200px] overflow-auto"},ue.createElement("div",{className:"font-bold mb-1 text-gray-400"},"Result:"),ie,ue.createElement("button",{onClick:()=>G(""),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(eH,"WidgetControls");function tH(){if(typeof window>"u")return"/";const t=window.location.pathname.match(/^(\/inspector\/api\/dev-widget\/[^/]+)/);return t?t[1]:"/"}Ge(tH,"getBasename");var Dae=150,$ae=5;function Lae({children:e,debugger:t=!1,viewControls:n=!1,autoSize:a=!1}){const r=tH(),i=E.useRef(null),s=E.useRef(0),c=E.useRef(null),u=E.useRef(!1),[d,m]=E.useState(null),[h,g]=E.useState(null),[v,S]=E.useState(!0);E.useEffect(()=>{let x=!0;return(async()=>{try{const k=await di(()=>import("./index-BaFuUxbj.js"),[]);x&&(m(()=>k.BrowserRouter),S(!1))}catch{x&&(g(new Error(`❌ react-router-dom not installed!
45
45
 
46
46
  To use MCP widgets with McpUseProvider, you need to install:
47
47
 
@@ -99,7 +99,7 @@ Please change the parent <Route path="${x}"> to <Route path="${x==="/"?"*":`${x}
99
99
  `)},VP=function(){var e=parseInt(document.body.getAttribute(ru)||"0",10);return isFinite(e)?e:0},Bce=function(){E.useEffect(function(){return document.body.setAttribute(ru,(VP()+1).toString()),function(){var e=VP()-1;e<=0?document.body.removeAttribute(ru):document.body.setAttribute(ru,e.toString())}},[])},Hce=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,r=a===void 0?"margin":a;Bce();var i=E.useMemo(function(){return Uce(r)},[r]);return E.createElement(zce,{styles:Fce(i,!t,r,n?"":"!important")})},KE=!1;if(typeof window<"u")try{var bg=Object.defineProperty({},"passive",{get:function(){return KE=!0,!0}});window.addEventListener("test",bg,bg),window.removeEventListener("test",bg,bg)}catch{KE=!1}var Cc=KE?{passive:!1}:!1,Vce=function(e){return e.tagName==="TEXTAREA"},EV=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Vce(e)&&n[t]==="visible")},Gce=function(e){return EV(e,"overflowY")},Wce=function(e){return EV(e,"overflowX")},GP=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var r=xV(e,a);if(r){var i=_V(e,a),s=i[1],c=i[2];if(s>c)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},Kce=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},Zce=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},xV=function(e,t){return e==="v"?Gce(t):Wce(t)},_V=function(e,t){return e==="v"?Kce(t):Zce(t)},Yce=function(e,t){return e==="h"&&t==="rtl"?-1:1},Xce=function(e,t,n,a,r){var i=Yce(e,window.getComputedStyle(t).direction),s=i*a,c=n.target,u=t.contains(c),d=!1,m=s>0,h=0,g=0;do{if(!c)break;var v=_V(e,c),S=v[0],w=v[1],y=v[2],_=w-y-i*S;(S||_)&&xV(e,c)&&(h+=_,g+=S);var x=c.parentNode;c=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(m&&Math.abs(h)<1||!m&&Math.abs(g)<1)&&(d=!0),d},vg=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},WP=function(e){return[e.deltaX,e.deltaY]},KP=function(e){return e&&"current"in e?e.current:e},qce=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Jce=function(e){return`
100
100
  .block-interactivity-`.concat(e,` {pointer-events: none;}
101
101
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
102
- `)},Qce=0,Ac=[];function eue(e){var t=E.useRef([]),n=E.useRef([0,0]),a=E.useRef(),r=E.useState(Qce++)[0],i=E.useState(SV)[0],s=E.useRef(e);E.useEffect(function(){s.current=e},[e]),E.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var w=Sce([e.lockRef.current],(e.shards||[]).map(KP),!0).filter(Boolean);return w.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),w.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var c=E.useCallback(function(w,y){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!s.current.allowPinchZoom;var _=vg(w),x=n.current,k="deltaX"in w?w.deltaX:x[0]-_[0],C="deltaY"in w?w.deltaY:x[1]-_[1],R,I=w.target,A=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in w&&A==="h"&&I.type==="range")return!1;var O=GP(A,I);if(!O)return!0;if(O?R=A:(R=A==="v"?"h":"v",O=GP(A,I)),!O)return!1;if(!a.current&&"changedTouches"in w&&(k||C)&&(a.current=R),!R)return!0;var M=a.current||R;return Xce(M,y,w,M==="h"?k:C)},[]),u=E.useCallback(function(w){var y=w;if(!(!Ac.length||Ac[Ac.length-1]!==i)){var _="deltaY"in y?WP(y):vg(y),x=t.current.filter(function(R){return R.name===y.type&&(R.target===y.target||y.target===R.shadowParent)&&qce(R.delta,_)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var k=(s.current.shards||[]).map(KP).filter(Boolean).filter(function(R){return R.contains(y.target)}),C=k.length>0?c(y,k[0]):!s.current.noIsolation;C&&y.cancelable&&y.preventDefault()}}},[]),d=E.useCallback(function(w,y,_,x){var k={name:w,delta:y,target:_,should:x,shadowParent:tue(_)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),m=E.useCallback(function(w){n.current=vg(w),a.current=void 0},[]),h=E.useCallback(function(w){d(w.type,WP(w),w.target,c(w,e.lockRef.current))},[]),g=E.useCallback(function(w){d(w.type,vg(w),w.target,c(w,e.lockRef.current))},[]);E.useEffect(function(){return Ac.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Cc),document.addEventListener("touchmove",u,Cc),document.addEventListener("touchstart",m,Cc),function(){Ac=Ac.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,Cc),document.removeEventListener("touchmove",u,Cc),document.removeEventListener("touchstart",m,Cc)}},[]);var v=e.removeScrollBar,S=e.inert;return E.createElement(E.Fragment,null,S?E.createElement(i,{styles:Jce(r)}):null,v?E.createElement(Hce,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function tue(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const nue=Ace(wV,eue);var Hp=E.forwardRef(function(e,t){return E.createElement(Bv,Di({},e,{ref:t,sideCar:nue}))});Hp.classNames=Bv.classNames;var ZE=["Enter"," "],rue=["ArrowDown","PageUp","Home"],kV=["ArrowUp","PageDown","End"],aue=[...rue,...kV],iue={ltr:[...ZE,"ArrowRight"],rtl:[...ZE,"ArrowLeft"]},oue={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Vp="Menu",[ep,sue,lue]=_T(Vp),[Pl,TV]=_i(Vp,[lue,Os,fV]),Hv=Os(),NV=fV(),[cue,Ul]=Pl(Vp),[uue,Gp]=Pl(Vp),RV=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:i,modal:s=!0}=e,c=Hv(t),[u,d]=E.useState(null),m=E.useRef(!1),h=zi(i),g=kT(r);return E.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),p.jsx(Pv,{...c,children:p.jsx(cue,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:d,children:p.jsx(uue,{scope:t,onClose:E.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:g,modal:s,children:a})})})};RV.displayName=Vp;var due="MenuAnchor",LT=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Hv(n);return p.jsx(Fp,{...r,...a,ref:t})});LT.displayName=due;var MT="MenuPortal",[fue,CV]=Pl(MT,{forceMount:void 0}),AV=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,i=Ul(MT,t);return p.jsx(fue,{scope:t,forceMount:n,children:p.jsx(Da,{present:n||i.open,children:p.jsx(ed,{asChild:!0,container:r,children:a})})})};AV.displayName=MT;var Za="MenuContent",[pue,jT]=Pl(Za),IV=E.forwardRef((e,t)=>{const n=CV(Za,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,i=Ul(Za,e.__scopeMenu),s=Gp(Za,e.__scopeMenu);return p.jsx(ep.Provider,{scope:e.__scopeMenu,children:p.jsx(Da,{present:a||i.open,children:p.jsx(ep.Slot,{scope:e.__scopeMenu,children:s.modal?p.jsx(mue,{...r,ref:t}):p.jsx(hue,{...r,ref:t})})})})}),mue=E.forwardRef((e,t)=>{const n=Ul(Za,e.__scopeMenu),a=E.useRef(null),r=Vt(t,a);return E.useEffect(()=>{const i=a.current;if(i)return Fv(i)},[]),p.jsx(PT,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),hue=E.forwardRef((e,t)=>{const n=Ul(Za,e.__scopeMenu);return p.jsx(PT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),gue=kl("MenuContent.ScrollLock"),PT=E.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:S,...w}=e,y=Ul(Za,n),_=Gp(Za,n),x=Hv(n),k=NV(n),C=sue(n),[R,I]=E.useState(null),A=E.useRef(null),O=Vt(t,A,y.onContentChange),M=E.useRef(0),U=E.useRef(""),F=E.useRef(0),H=E.useRef(null),te=E.useRef("right"),q=E.useRef(0),ie=S?Hp:E.Fragment,G=S?{as:gue,allowPinchZoom:!0}:void 0,Q=oe=>{const ne=U.current+oe,P=C().filter(K=>!K.disabled),B=document.activeElement,z=P.find(K=>K.ref.current===B)?.textValue,$=P.map(K=>K.textValue),j=Rue($,ne,z),V=P.find(K=>K.textValue===j)?.ref.current;(function K(X){U.current=X,window.clearTimeout(M.current),X!==""&&(M.current=window.setTimeout(()=>K(""),1e3))})(ne),V&&setTimeout(()=>V.focus())};E.useEffect(()=>()=>window.clearTimeout(M.current),[]),Dv();const W=E.useCallback(oe=>te.current===H.current?.side&&Aue(oe,H.current?.area),[]);return p.jsx(pue,{scope:n,searchRef:U,onItemEnter:E.useCallback(oe=>{W(oe)&&oe.preventDefault()},[W]),onItemLeave:E.useCallback(oe=>{W(oe)||(A.current?.focus(),I(null))},[W]),onTriggerLeave:E.useCallback(oe=>{W(oe)&&oe.preventDefault()},[W]),pointerGraceTimerRef:F,onPointerGraceIntentChange:E.useCallback(oe=>{H.current=oe},[]),children:p.jsx(ie,{...G,children:p.jsx(Up,{asChild:!0,trapped:r,onMountAutoFocus:Ve(i,oe=>{oe.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:p.jsx(qu,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:p.jsx(gce,{asChild:!0,...k,dir:_.dir,orientation:"vertical",loop:a,currentTabStopId:R,onCurrentTabStopIdChange:I,onEntryFocus:Ve(u,oe=>{_.isUsingKeyboardRef.current||oe.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(Uv,{role:"menu","aria-orientation":"vertical","data-state":KV(y.open),"data-radix-menu-content":"",dir:_.dir,...x,...w,ref:O,style:{outline:"none",...w.style},onKeyDown:Ve(w.onKeyDown,oe=>{const P=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,B=oe.ctrlKey||oe.altKey||oe.metaKey,z=oe.key.length===1;P&&(oe.key==="Tab"&&oe.preventDefault(),!B&&z&&Q(oe.key));const $=A.current;if(oe.target!==$||!aue.includes(oe.key))return;oe.preventDefault();const V=C().filter(K=>!K.disabled).map(K=>K.ref.current);kV.includes(oe.key)&&V.reverse(),Tue(V)}),onBlur:Ve(e.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout(M.current),U.current="")}),onPointerMove:Ve(e.onPointerMove,tp(oe=>{const ne=oe.target,P=q.current!==oe.clientX;if(oe.currentTarget.contains(ne)&&P){const B=oe.clientX>q.current?"right":"left";te.current=B,q.current=oe.clientX}}))})})})})})})});IV.displayName=Za;var bue="MenuGroup",UT=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return p.jsx(yt.div,{role:"group",...a,ref:t})});UT.displayName=bue;var vue="MenuLabel",OV=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return p.jsx(yt.div,{...a,ref:t})});OV.displayName=vue;var Tb="MenuItem",ZP="menu.itemSelect",Vv=E.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,i=E.useRef(null),s=Gp(Tb,e.__scopeMenu),c=jT(Tb,e.__scopeMenu),u=Vt(t,i),d=E.useRef(!1),m=()=>{const h=i.current;if(!n&&h){const g=new CustomEvent(ZP,{bubbles:!0,cancelable:!0});h.addEventListener(ZP,v=>a?.(v),{once:!0}),zH(h,g),g.defaultPrevented?d.current=!1:s.onClose()}};return p.jsx(DV,{...r,ref:u,disabled:n,onClick:Ve(e.onClick,m),onPointerDown:h=>{e.onPointerDown?.(h),d.current=!0},onPointerUp:Ve(e.onPointerUp,h=>{d.current||h.currentTarget?.click()}),onKeyDown:Ve(e.onKeyDown,h=>{const g=c.searchRef.current!=="";n||g&&h.key===" "||ZE.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Vv.displayName=Tb;var DV=E.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...i}=e,s=jT(Tb,n),c=NV(n),u=E.useRef(null),d=Vt(t,u),[m,h]=E.useState(!1),[g,v]=E.useState("");return E.useEffect(()=>{const S=u.current;S&&v((S.textContent??"").trim())},[i.children]),p.jsx(ep.ItemSlot,{scope:n,disabled:a,textValue:r??g,children:p.jsx(bce,{asChild:!0,...c,focusable:!a,children:p.jsx(yt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...i,ref:d,onPointerMove:Ve(e.onPointerMove,tp(S=>{a?s.onItemLeave(S):(s.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ve(e.onPointerLeave,tp(S=>s.onItemLeave(S))),onFocus:Ve(e.onFocus,()=>h(!0)),onBlur:Ve(e.onBlur,()=>h(!1))})})})}),yue="MenuCheckboxItem",$V=E.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return p.jsx(UV,{scope:e.__scopeMenu,checked:n,children:p.jsx(Vv,{role:"menuitemcheckbox","aria-checked":Nb(n)?"mixed":n,...r,ref:t,"data-state":FT(n),onSelect:Ve(r.onSelect,()=>a?.(Nb(n)?!0:!n),{checkForDefaultPrevented:!1})})})});$V.displayName=yue;var LV="MenuRadioGroup",[wue,Sue]=Pl(LV,{value:void 0,onValueChange:()=>{}}),MV=E.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,i=zi(a);return p.jsx(wue,{scope:e.__scopeMenu,value:n,onValueChange:i,children:p.jsx(UT,{...r,ref:t})})});MV.displayName=LV;var jV="MenuRadioItem",PV=E.forwardRef((e,t)=>{const{value:n,...a}=e,r=Sue(jV,e.__scopeMenu),i=n===r.value;return p.jsx(UV,{scope:e.__scopeMenu,checked:i,children:p.jsx(Vv,{role:"menuitemradio","aria-checked":i,...a,ref:t,"data-state":FT(i),onSelect:Ve(a.onSelect,()=>r.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});PV.displayName=jV;var zT="MenuItemIndicator",[UV,Eue]=Pl(zT,{checked:!1}),zV=E.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,i=Eue(zT,n);return p.jsx(Da,{present:a||Nb(i.checked)||i.checked===!0,children:p.jsx(yt.span,{...r,ref:t,"data-state":FT(i.checked)})})});zV.displayName=zT;var xue="MenuSeparator",FV=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return p.jsx(yt.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});FV.displayName=xue;var _ue="MenuArrow",BV=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Hv(n);return p.jsx(zv,{...r,...a,ref:t})});BV.displayName=_ue;var kue="MenuSub",[j_e,HV]=Pl(kue),vf="MenuSubTrigger",VV=E.forwardRef((e,t)=>{const n=Ul(vf,e.__scopeMenu),a=Gp(vf,e.__scopeMenu),r=HV(vf,e.__scopeMenu),i=jT(vf,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=i,d={__scopeMenu:e.__scopeMenu},m=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return E.useEffect(()=>m,[m]),E.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),u(null)}},[c,u]),p.jsx(LT,{asChild:!0,...d,children:p.jsx(DV,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":KV(n.open),...e,ref:Ui(t,r.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ve(e.onPointerMove,tp(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ve(e.onPointerLeave,tp(h=>{m();const g=n.content?.getBoundingClientRect();if(g){const v=n.content?.dataset.side,S=v==="right",w=S?-5:5,y=g[S?"left":"right"],_=g[S?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+w,y:h.clientY},{x:y,y:g.top},{x:_,y:g.top},{x:_,y:g.bottom},{x:y,y:g.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ve(e.onKeyDown,h=>{const g=i.searchRef.current!=="";e.disabled||g&&h.key===" "||iue[a.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});VV.displayName=vf;var GV="MenuSubContent",WV=E.forwardRef((e,t)=>{const n=CV(Za,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,i=Ul(Za,e.__scopeMenu),s=Gp(Za,e.__scopeMenu),c=HV(GV,e.__scopeMenu),u=E.useRef(null),d=Vt(t,u);return p.jsx(ep.Provider,{scope:e.__scopeMenu,children:p.jsx(Da,{present:a||i.open,children:p.jsx(ep.Slot,{scope:e.__scopeMenu,children:p.jsx(PT,{id:c.contentId,"aria-labelledby":c.triggerId,...r,ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{s.isUsingKeyboardRef.current&&u.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ve(e.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ve(e.onEscapeKeyDown,m=>{s.onClose(),m.preventDefault()}),onKeyDown:Ve(e.onKeyDown,m=>{const h=m.currentTarget.contains(m.target),g=oue[s.dir].includes(m.key);h&&g&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});WV.displayName=GV;function KV(e){return e?"open":"closed"}function Nb(e){return e==="indeterminate"}function FT(e){return Nb(e)?"indeterminate":e?"checked":"unchecked"}function Tue(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Nue(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function Rue(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=Nue(e,Math.max(i,0));r.length===1&&(s=s.filter(d=>d!==n));const u=s.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return u!==n?u:void 0}function Cue(e,t){const{x:n,y:a}=e;let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,m=c.y,h=u.x,g=u.y;m>a!=g>a&&n<(h-d)*(a-m)/(g-m)+d&&(r=!r)}return r}function Aue(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Cue(n,t)}function tp(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Iue=RV,Oue=LT,Due=AV,$ue=IV,Lue=UT,Mue=OV,jue=Vv,Pue=$V,Uue=MV,zue=PV,Fue=zV,Bue=FV,Hue=BV,Vue=VV,Gue=WV,Gv="DropdownMenu",[Wue]=_i(Gv,[TV]),qr=TV(),[Kue,ZV]=Wue(Gv),YV=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,u=qr(t),d=E.useRef(null),[m,h]=ko({prop:r,defaultProp:i??!1,onChange:s,caller:Gv});return p.jsx(Kue,{scope:t,triggerId:Cr(),triggerRef:d,contentId:Cr(),open:m,onOpenChange:h,onOpenToggle:E.useCallback(()=>h(g=>!g),[h]),modal:c,children:p.jsx(Iue,{...u,open:m,onOpenChange:h,dir:a,modal:c,children:n})})};YV.displayName=Gv;var XV="DropdownMenuTrigger",qV=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,i=ZV(XV,n),s=qr(n);return p.jsx(Oue,{asChild:!0,...s,children:p.jsx(yt.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...r,ref:Ui(t,i.triggerRef),onPointerDown:Ve(e.onPointerDown,c=>{!a&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:Ve(e.onKeyDown,c=>{a||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});qV.displayName=XV;var Zue="DropdownMenuPortal",JV=e=>{const{__scopeDropdownMenu:t,...n}=e,a=qr(t);return p.jsx(Due,{...a,...n})};JV.displayName=Zue;var QV="DropdownMenuContent",e9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ZV(QV,n),i=qr(n),s=E.useRef(!1);return p.jsx($ue,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...a,ref:t,onCloseAutoFocus:Ve(e.onCloseAutoFocus,c=>{s.current||r.triggerRef.current?.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Ve(e.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,m=u.button===2||d;(!r.modal||m)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});e9.displayName=QV;var Yue="DropdownMenuGroup",Xue=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Lue,{...r,...a,ref:t})});Xue.displayName=Yue;var que="DropdownMenuLabel",t9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Mue,{...r,...a,ref:t})});t9.displayName=que;var Jue="DropdownMenuItem",n9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(jue,{...r,...a,ref:t})});n9.displayName=Jue;var Que="DropdownMenuCheckboxItem",r9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Pue,{...r,...a,ref:t})});r9.displayName=Que;var ede="DropdownMenuRadioGroup",tde=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Uue,{...r,...a,ref:t})});tde.displayName=ede;var nde="DropdownMenuRadioItem",a9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(zue,{...r,...a,ref:t})});a9.displayName=nde;var rde="DropdownMenuItemIndicator",ade=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Fue,{...r,...a,ref:t})});ade.displayName=rde;var ide="DropdownMenuSeparator",i9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Bue,{...r,...a,ref:t})});i9.displayName=ide;var ode="DropdownMenuArrow",sde=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Hue,{...r,...a,ref:t})});sde.displayName=ode;var lde="DropdownMenuSubTrigger",o9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Vue,{...r,...a,ref:t})});o9.displayName=lde;var cde="DropdownMenuSubContent",s9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Gue,{...r,...a,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});s9.displayName=cde;var ude=YV,dde=qV,fde=JV,l9=e9,c9=t9,u9=n9,pde=r9,mde=a9,d9=i9,hde=o9,gde=s9;const YE=ude,XE=dde;hde.displayName;gde.displayName;function Rb({ref:e,className:t,sideOffset:n=4,...a}){return p.jsx(fde,{children:p.jsx(l9,{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),...a})})}Rb.displayName=l9.displayName;function wo({ref:e,className:t,inset:n,...a}){return p.jsx(u9,{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),...a})}wo.displayName=u9.displayName;pde.displayName;mde.displayName;function qE({ref:e,className:t,inset:n,...a}){return p.jsx(c9,{ref:e,className:Oe("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...a})}qE.displayName=c9.displayName;function yf({ref:e,className:t,...n}){return p.jsx(d9,{ref:e,className:Oe("-mx-1 my-1 h-px bg-muted",t),...n})}yf.displayName=d9.displayName;var bde=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lo=bde.reduce((e,t)=>{const n=EH(`Primitive.${t}`),a=E.forwardRef((r,i)=>{const{asChild:s,...c}=r,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(u,{...c,ref:i})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),vde="Label",f9=E.forwardRef((e,t)=>p.jsx(Lo.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));f9.displayName=vde;var yde=f9;function In({className:e,...t}){return p.jsx(yde,{"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 Wv({message:e,className:t="",vertical:n,noBorder:a}){return p.jsx("div",{className:Oe(`mt-2 rounded-md p-6 ${t}`,!a&&"border"),children:p.jsxs("p",{className:Oe("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[p.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:p.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:p.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[p.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"}),p.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),p.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),e]})})}function p9({className:e,color:t,children:n,grayscaled:a=!1}){const r=E.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return a?0:.2},[t,a]),i=E.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return a?.3:.4},[t,a]),s=E.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=E.useMemo(()=>t||`oklch(${Math.min(i,1)} ${r} ${s})`,[s,r,i]),u=E.useMemo(()=>`oklch(${Math.min(i*2,1)} ${r} ${s})`,[s,r,i,t]),d=E.useMemo(()=>Math.floor(Math.random()*360),[s]),m=E.useMemo(()=>"1000%",[]);return p.jsx("section",{className:Oe("relative w-full h-full overflow-hidden",e),style:{background:`${u}`},children:p.jsxs("div",{className:"isolate relative w-full h-full",children:[p.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${d}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${m})`}}),n&&p.jsx("div",{className:"relative z-10 w-full h-full",children:n})]})})}function BT(e){const t=E.useRef({value:e,previous:e});return E.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Kv="Switch",[wde]=_i(Kv),[Sde,Ede]=wde(Kv),m9=E.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:r,defaultChecked:i,required:s,disabled:c,value:u="on",onCheckedChange:d,form:m,...h}=e,[g,v]=E.useState(null),S=Vt(t,k=>v(k)),w=E.useRef(!1),y=g?m||!!g.closest("form"):!0,[_,x]=ko({prop:r,defaultProp:i??!1,onChange:d,caller:Kv});return p.jsxs(Sde,{scope:n,checked:_,disabled:c,children:[p.jsx(yt.button,{type:"button",role:"switch","aria-checked":_,"aria-required":s,"data-state":v9(_),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:S,onClick:Ve(e.onClick,k=>{x(C=>!C),y&&(w.current=k.isPropagationStopped(),w.current||k.stopPropagation())})}),y&&p.jsx(b9,{control:g,bubbles:!w.current,name:a,value:u,checked:_,required:s,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});m9.displayName=Kv;var h9="SwitchThumb",g9=E.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,r=Ede(h9,n);return p.jsx(yt.span,{"data-state":v9(r.checked),"data-disabled":r.disabled?"":void 0,...a,ref:t})});g9.displayName=h9;var xde="SwitchBubbleInput",b9=E.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...r},i)=>{const s=E.useRef(null),c=Vt(s,i),u=BT(n),d=OT(t);return E.useEffect(()=>{const m=s.current;if(!m)return;const h=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==n&&v){const S=new Event("click",{bubbles:a});v.call(m,n),m.dispatchEvent(S)}},[u,n,a]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:c,style:{...r.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});b9.displayName=xde;function v9(e){return e?"checked":"unchecked"}var y9=m9,_de=g9;function Zv({ref:e,className:t,...n}){return p.jsx(y9,{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:p.jsx(_de,{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")})})}Zv.displayName=y9.displayName;var w9=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"}),kde="VisuallyHidden",S9=E.forwardRef((e,t)=>p.jsx(yt.span,{...e,ref:t,style:{...w9,...e.style}}));S9.displayName=kde;var Tde=S9,[Yv]=_i("Tooltip",[Os]),Xv=Os(),E9="TooltipProvider",Nde=700,JE="tooltip.open",[Rde,HT]=Yv(E9),x9=e=>{const{__scopeTooltip:t,delayDuration:n=Nde,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:i}=e,s=E.useRef(!0),c=E.useRef(!1),u=E.useRef(0);return E.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),p.jsx(Rde,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:E.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:E.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:E.useCallback(d=>{c.current=d},[]),disableHoverableContent:r,children:i})};x9.displayName=E9;var np="Tooltip",[Cde,Wp]=Yv(np),_9=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:i,disableHoverableContent:s,delayDuration:c}=e,u=HT(np,e.__scopeTooltip),d=Xv(t),[m,h]=E.useState(null),g=Cr(),v=E.useRef(0),S=s??u.disableHoverableContent,w=c??u.delayDuration,y=E.useRef(!1),[_,x]=ko({prop:a,defaultProp:r??!1,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(JE))):u.onClose(),i?.(A)},caller:np}),k=E.useMemo(()=>_?y.current?"delayed-open":"instant-open":"closed",[_]),C=E.useCallback(()=>{window.clearTimeout(v.current),v.current=0,y.current=!1,x(!0)},[x]),R=E.useCallback(()=>{window.clearTimeout(v.current),v.current=0,x(!1)},[x]),I=E.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{y.current=!0,x(!0),v.current=0},w)},[w,x]);return E.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),p.jsx(Pv,{...d,children:p.jsx(Cde,{scope:t,contentId:g,open:_,stateAttribute:k,trigger:m,onTriggerChange:h,onTriggerEnter:E.useCallback(()=>{u.isOpenDelayedRef.current?I():C()},[u.isOpenDelayedRef,I,C]),onTriggerLeave:E.useCallback(()=>{S?R():(window.clearTimeout(v.current),v.current=0)},[R,S]),onOpen:C,onClose:R,disableHoverableContent:S,children:n})})};_9.displayName=np;var QE="TooltipTrigger",k9=E.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Wp(QE,n),i=HT(QE,n),s=Xv(n),c=E.useRef(null),u=Vt(t,c,r.onTriggerChange),d=E.useRef(!1),m=E.useRef(!1),h=E.useCallback(()=>d.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),p.jsx(Fp,{asChild:!0,...s,children:p.jsx(yt.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:u,onPointerMove:Ve(e.onPointerMove,g=>{g.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{r.onTriggerLeave(),m.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ve(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:Ve(e.onBlur,r.onClose),onClick:Ve(e.onClick,r.onClose)})})});k9.displayName=QE;var VT="TooltipPortal",[Ade,Ide]=Yv(VT,{forceMount:void 0}),T9=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,i=Wp(VT,t);return p.jsx(Ade,{scope:t,forceMount:n,children:p.jsx(Da,{present:n||i.open,children:p.jsx(ed,{asChild:!0,container:r,children:a})})})};T9.displayName=VT;var Du="TooltipContent",N9=E.forwardRef((e,t)=>{const n=Ide(Du,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...i}=e,s=Wp(Du,e.__scopeTooltip);return p.jsx(Da,{present:a||s.open,children:s.disableHoverableContent?p.jsx(R9,{side:r,...i,ref:t}):p.jsx(Ode,{side:r,...i,ref:t})})}),Ode=E.forwardRef((e,t)=>{const n=Wp(Du,e.__scopeTooltip),a=HT(Du,e.__scopeTooltip),r=E.useRef(null),i=Vt(t,r),[s,c]=E.useState(null),{trigger:u,onClose:d}=n,m=r.current,{onPointerInTransitChange:h}=a,g=E.useCallback(()=>{c(null),h(!1)},[h]),v=E.useCallback((S,w)=>{const y=S.currentTarget,_={x:S.clientX,y:S.clientY},x=Mde(_,y.getBoundingClientRect()),k=jde(_,x),C=Pde(w.getBoundingClientRect()),R=zde([...k,...C]);c(R),h(!0)},[h]);return E.useEffect(()=>()=>g(),[g]),E.useEffect(()=>{if(u&&m){const S=y=>v(y,m),w=y=>v(y,u);return u.addEventListener("pointerleave",S),m.addEventListener("pointerleave",w),()=>{u.removeEventListener("pointerleave",S),m.removeEventListener("pointerleave",w)}}},[u,m,v,g]),E.useEffect(()=>{if(s){const S=w=>{const y=w.target,_={x:w.clientX,y:w.clientY},x=u?.contains(y)||m?.contains(y),k=!Ude(_,s);x?g():k&&(g(),d())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[u,m,s,d,g]),p.jsx(R9,{...e,ref:i})}),[Dde,$de]=Yv(np,{isInside:!1}),Lde=hse("TooltipContent"),R9=E.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:s,...c}=e,u=Wp(Du,n),d=Xv(n),{onClose:m}=u;return E.useEffect(()=>(document.addEventListener(JE,m),()=>document.removeEventListener(JE,m)),[m]),E.useEffect(()=>{if(u.trigger){const h=g=>{g.target?.contains(u.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,m]),p.jsx(qu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:p.jsxs(Uv,{"data-state":u.stateAttribute,...d,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(Lde,{children:a}),p.jsx(Dde,{scope:n,isInside:!0,children:p.jsx(Tde,{id:u.contentId,role:"tooltip",children:r||a})})]})})});N9.displayName=Du;var C9="TooltipArrow",A9=E.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Xv(n);return $de(C9,n).isInside?null:p.jsx(zv,{...r,...a,ref:t})});A9.displayName=C9;function Mde(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,a,r,i)){case i:return"left";case r:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function jde(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function Pde(e){const{top:t,right:n,bottom:a,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:a},{x:r,y:a}]}function Ude(e,t){const{x:n,y:a}=e;let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,m=c.y,h=u.x,g=u.y;m>a!=g>a&&n<(h-d)*(a-m)/(g-m)+d&&(r=!r)}return r}function zde(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),Fde(t)}function Fde(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const r=e[a];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(r.y-s.y)>=(i.y-s.y)*(r.x-s.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const r=e[a];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(r.y-s.y)>=(i.y-s.y)*(r.x-s.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Bde=x9,Hde=_9,Vde=k9,Gde=T9,Wde=N9,Kde=A9;function I9({delayDuration:e=0,...t}){return p.jsx(Bde,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function vn({...e}){return p.jsx(I9,{children:p.jsx(Hde,{"data-slot":"tooltip",...e})})}function yn({...e}){return p.jsx(Vde,{"data-slot":"tooltip-trigger",...e})}function wn({className:e,sideOffset:t=0,children:n,...a}){return p.jsx(Gde,{children:p.jsxs(Wde,{"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),...a,children:[n,p.jsx(Kde,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class Zde{name="mcp_inspector_open";properties;constructor(t){this.properties={server_url:t.serverUrl,connection_count:t.connectionCount}}}class YP{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 XP{name="mcp_resource_read";properties;constructor(t){this.properties={resource_uri:t.resourceUri,server_id:t.serverId,success:t.success,error:t.error}}}class qP{name="mcp_prompt_call";properties;constructor(t){this.properties={prompt_name:t.promptName,server_id:t.serverId,success:t.success,error:t.error}}}class JP{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 Yde{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 Xde{name="mcp_server_removed";properties;constructor(t){this.properties={server_id:t.serverId}}}class qde{name="mcp_command_palette_open";properties;constructor(t){this.properties={trigger:t.trigger}}}class Jde{name="mcp_tool_saved";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId}}}function xS(){try{return"0.9.2-canary.0"}catch{return"0.0.0"}}var Qde={};function _S(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class QP{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,a=setTimeout(()=>n.abort(),this.timeout),r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(a),!r.ok)throw new Error(`HTTP error! status: ${r.status}`)}catch{}}}function cs(e){return`mcp_inspector_telemetry_${e}`}class br{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=_S(),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 QP(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new QP(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(cs("disabled"))==="true"||typeof process<"u"&&Qde?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(cs("source")):null}static getInstance(){return br.instance||(br.instance=new br),br.instance}setSource(t){this._source=t,typeof localStorage<"u"&&localStorage.setItem(cs("source"),t)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!_S())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const t=localStorage.getItem(cs("user_id"));if(t)this._currUserId=t;else{const n=this.generateUserId();localStorage.setItem(cs("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:xS(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(n)}catch{}if(this._scarfClient)try{const n={};n.mcp_use_version=xS(),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&&_S())try{const n=xS();let a=!1,r=!1;const i=localStorage.getItem(cs("download_version"));if(i?n>i&&(a=!0,r=!1,localStorage.setItem(cs("download_version"),n)):(a=!0,r=!0,localStorage.setItem(cs("download_version"),n)),a){const s={...t||{}};s.mcp_use_version=n,s.user_id=this.userId,s.event="package_download",s.first_download=r,s.language="typescript",s.source=this._source,s.package="inspector",await this._scarfClient.logEvent(s)}}catch{}}async trackInspectorOpen(t){const n=new Zde(t);await this.capture(n)}}const O9=E.createContext(null);function GT(){const e=E.use(O9);if(!e)throw new Error("useMcpContext must be used within a McpProvider");return e}function efe({url:e,name:t,proxyConfig:n,transportType:a,connectionId:r,onUpdate:i,onRemove:s}){const c=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=e,d={};if(n?.proxyAddress){const U=new URL(n.proxyAddress),F=new URL(e);u=`${U.origin}${U.pathname}${F.pathname}${F.search}`,d["X-Target-URL"]=e}n?.customHeaders&&(d={...d,...n.customHeaders});const m=E.useRef(null),[h,g]=E.useState(!1),v=E.useRef(!1);E.useEffect(()=>{typeof window<"u"&&!v.current&&(v.current=!0,di(()=>import("./transport-wrapper-browser-BI4dDu3b.js"),[]).then(U=>{m.current=U.wrapTransportForLogging,g(!0),console.log("[McpContext] Transport wrapper loaded")}).catch(U=>{console.error("[McpContext] Failed to load transport wrapper:",U)}))},[]);const S=E.useMemo(()=>{if(!(!h||!m.current))return(U,F)=>{const H=r;return console.log("[McpContext] Applying transport wrapper, serverId:",H,"from connector:",F),m.current(U,H)}},[h,r]),w=`mcp-inspector-notifications-${r}`,y=500,[_,x]=E.useState([]);E.useEffect(()=>{try{const U=localStorage.getItem(w);if(U){const F=JSON.parse(U);Array.isArray(F)&&x(F)}}catch(U){console.error("Failed to load notifications from localStorage:",U)}},[w]),E.useEffect(()=>{try{localStorage.setItem(w,JSON.stringify(_))}catch(U){console.error("Failed to save notifications to localStorage:",U)}},[_,w]);const k=E.useCallback(U=>{x(F=>F.map(H=>H.id===U?{...H,read:!0}:H))},[]),C=E.useCallback(()=>{x(U=>U.map(F=>({...F,read:!0})))},[]),R=E.useCallback(()=>{x([])},[]),I=E.useCallback(U=>{x(F=>{const H=[U,...F];return H.length>y?H.slice(0,y):H})},[]),A=bT({url:u,callbackUrl:c,customHeaders:Object.keys(d).length>0?d:void 0,transportType:a||"http",preventAutoAuth:!0,useRedirectFlow:!0,enabled:h,wrapTransport:S,onNotification:U=>{I({id:globalThis.crypto.randomUUID(),method:U.method,params:U.params,timestamp:Date.now(),read:!1})}}),O=E.useRef(i),M=E.useRef(null);return E.useEffect(()=>{O.current=i},[i]),E.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{A.state==="ready"&&A.serverInfo&&console.log("[McpContext] Server info available:",A.serverInfo);const U=_.filter(te=>!te.read).length,F={id:r,url:e,name:A.serverInfo?.name||t,state:A.state,tools:A.tools,resources:A.resources,prompts:A.prompts,error:A.error??null,authUrl:A.authUrl??null,customHeaders:d,transportType:a,proxyConfig:n,serverInfo:A.serverInfo,capabilities:A.capabilities,notifications:_,unreadNotificationCount:U,markNotificationRead:k,markAllNotificationsRead:C,clearNotifications:R,callTool:A.callTool,readResource:A.readResource,listPrompts:A.listPrompts,getPrompt:A.getPrompt,authenticate:A.authenticate,retry:A.retry,clearStorage:A.clearStorage,disconnect:A.disconnect,client:A.client},H=M.current;(!H||H.state!==F.state||H.error!==F.error||H.authUrl!==F.authUrl||H.name!==F.name||H.tools.length!==F.tools.length||H.resources.length!==F.resources.length||H.prompts.length!==F.prompts.length||H.serverInfo!==F.serverInfo||H.capabilities!==F.capabilities||H.notifications.length!==F.notifications.length||H.unreadNotificationCount!==F.unreadNotificationCount||!H.client)&&(M.current=F,O.current(F))});else{const U=_.filter(te=>!te.read).length,F={id:r,url:e,name:A.serverInfo?.name||t,state:A.state,tools:A.tools,resources:A.resources,prompts:A.prompts,error:A.error??null,authUrl:A.authUrl??null,customHeaders:d,transportType:a,proxyConfig:n,serverInfo:A.serverInfo,capabilities:A.capabilities,notifications:_,unreadNotificationCount:U,markNotificationRead:k,markAllNotificationsRead:C,clearNotifications:R,callTool:A.callTool,readResource:A.readResource,listPrompts:A.listPrompts,getPrompt:A.getPrompt,authenticate:A.authenticate,retry:A.retry,clearStorage:A.clearStorage,disconnect:A.disconnect,client:A.client},H=M.current;(!H||H.state!==F.state||H.error!==F.error||H.authUrl!==F.authUrl||H.name!==F.name||H.tools.length!==F.tools.length||H.resources.length!==F.resources.length||H.prompts.length!==F.prompts.length||H.serverInfo!==F.serverInfo||H.capabilities!==F.capabilities||H.notifications.length!==F.notifications.length||H.unreadNotificationCount!==F.unreadNotificationCount||!H.client)&&(M.current=F,O.current(F))}},[e,t,a,n,d,r,A.state,A.tools,A.resources,A.prompts,A.error,A.authUrl,A.serverInfo,A.capabilities,A.client,_,k,C,R,A.callTool,A.readResource,A.listPrompts,A.getPrompt,A.authenticate,A.retry,A.clearStorage]),null}function tfe({children:e}){const[t,n]=E.useState([]),[a,r]=E.useState(!1),[i,s]=E.useState(!0),[c,u]=E.useState([]);E.useEffect(()=>{try{const y=localStorage.getItem("mcp-inspector-connections");if(y){const x=JSON.parse(y);Array.isArray(x)&&(u(x),n(x.map(k=>({id:k.id||k.url,url:k.url,name:k.name||"MCP Server",state:"discovering",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:k.proxyConfig?.customHeaders,transportType:k.transportType,proxyConfig:k.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}))))}const _=localStorage.getItem("mcp-inspector-auto-connect");_!==null&&s(_==="true")}catch(y){console.error("Failed to load connections from localStorage:",y)}finally{r(!0)}},[]),E.useEffect(()=>{a&&localStorage.setItem("mcp-inspector-connections",JSON.stringify(c))},[c,a]),E.useEffect(()=>{a&&localStorage.setItem("mcp-inspector-auto-connect",String(i))},[i,a]);const d=E.useCallback((y,_,x,k)=>{const C=c.find(A=>A.url===y),R=t.find(A=>A.url===y);if(C&&R){if(JSON.stringify(C.proxyConfig)!==JSON.stringify(x)&&x){u(O=>O.filter(M=>M.url!==y)),n(O=>O.filter(M=>M.url!==y)),setTimeout(()=>{const O={id:y,url:y,name:_||C.name||"MCP Server",proxyConfig:x,transportType:k||C.transportType};u(M=>[...M,O]),n(M=>[...M,{id:y,url:y,name:_||C.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:x?.customHeaders,transportType:k||C.transportType,proxyConfig:x,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},10);return}return}if(C&&!R){(x||k)&&u(A=>A.map(O=>O.url===y?{...O,proxyConfig:x||O.proxyConfig,transportType:k||O.transportType,name:_||O.name}:O)),n(A=>[...A,{id:C.id||y,url:y,name:_||C.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:x?.customHeaders||C.proxyConfig?.customHeaders,transportType:k||C.transportType,proxyConfig:x||C.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}]);return}const I={id:y,url:y,name:_||"MCP Server",proxyConfig:x,transportType:k};u(A=>[...A,I]),n(A=>[...A,{id:y,url:y,name:_||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:x?.customHeaders,transportType:k,proxyConfig:x,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},[c,t]),m=E.useCallback(y=>{const _=t.find(k=>k.id===y);_&&(console.log(`[McpContext] Cleaning up connection: ${y}`),_.disconnect&&(console.log(`[McpContext] Disconnecting from server: ${y}`),_.disconnect()),_.clearStorage&&(console.log(`[McpContext] Clearing OAuth storage for connection: ${y}`),_.clearStorage())),u(k=>k.filter(C=>C.id!==y)),n(k=>k.filter(C=>C.id!==y));const x=localStorage.getItem("mcp-inspector-connections");if(x)try{const C=JSON.parse(x).filter(R=>(R.id||R.url)!==y);localStorage.setItem("mcp-inspector-connections",JSON.stringify(C))}catch(k){console.error("Failed to update localStorage on remove:",k)}br.getInstance().capture(new Xde({serverId:y}))},[t]),h=E.useCallback((y,_)=>{u(x=>x.map(k=>k.id===y||k.url===y?{...k,..._}:k)),n(x=>x.map(k=>k.id===y?{...k,..._}:k))},[]),g=E.useCallback(y=>{n(_=>{const x=_.findIndex(R=>R.id===y.id);if(x===-1)return _;const k=_[x];if(k.state===y.state&&k.tools===y.tools&&k.resources===y.resources&&k.prompts===y.prompts&&k.error===y.error&&k.serverInfo===y.serverInfo&&k.client===y.client&&k.notifications===y.notifications&&k.unreadNotificationCount===y.unreadNotificationCount)return _;const C=[..._];return C[x]=y,C})},[]),v=E.useCallback(y=>{console.log("Connect requested for:",y)},[]),S=E.useCallback(y=>{console.log("Disconnect requested for:",y)},[]),w=E.useMemo(()=>({connections:t,addConnection:d,removeConnection:m,updateConnectionConfig:h,autoConnect:i,setAutoConnect:s,connectServer:v,disconnectServer:S,configLoaded:a}),[t,d,m,h,i,v,S,a]);return p.jsxs(O9.Provider,{value:w,children:[e,a&&i&&c.map(y=>{const _=`${y.id||y.url}-${y.proxyConfig?.proxyAddress?"proxy":"direct"}`;return console.warn("[McpContext] Rendering McpConnectionWrapper with key:",_,"proxyConfig:",y.proxyConfig),p.jsx(efe,{url:y.url,name:y.name,proxyConfig:y.proxyConfig,transportType:y.transportType,connectionId:y.id||y.url,onUpdate:g,onRemove:()=>m(y.id||y.url)},_)})]})}const nfe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rfe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),eU=e=>{const t=rfe(e);return t.charAt(0).toUpperCase()+t.slice(1)},D9=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),afe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var ife={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 ofe=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:i,iconNode:s,...c},u)=>E.createElement("svg",{ref:u,...ife,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:D9("lucide",r),...!i&&!afe(c)&&{"aria-hidden":"true"},...c},[...s.map(([d,m])=>E.createElement(d,m)),...Array.isArray(i)?i:[i]]));const Je=(e,t)=>{const n=E.forwardRef(({className:a,...r},i)=>E.createElement(ofe,{ref:i,iconNode:t,className:D9(`lucide-${nfe(eU(e))}`,`lucide-${e}`,a),...r}));return n.displayName=eU(e),n};const sfe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],lfe=Je("arrow-down-to-line",sfe);const cfe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],ufe=Je("arrow-up-from-line",cfe);const dfe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ffe=Je("arrow-up",dfe);const pfe=[["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"}]],WT=Je("bell",pfe);const mfe=[["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"}]],$9=Je("brush",mfe);const hfe=[["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"}]],gfe=Je("bug",hfe);const bfe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Xa=Je("check",bfe);const vfe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zl=Je("chevron-down",vfe);const yfe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wfe=Je("chevron-right",yfe);const Sfe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],KT=Je("chevron-left",Sfe);const Efe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xfe=Je("chevron-up",Efe);const _fe=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],kfe=Je("chevrons-up-down",_fe);const Tfe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],tU=Je("circle-minus",Tfe);const Nfe=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$u=Je("clock",Nfe);const Rfe=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],L9=Je("code",Rfe);const Cfe=[["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"}]],Afe=Je("cog",Cfe);const Ife=[["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"}]],Ofe=Je("command",Ife);const Dfe=[["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"}]],ua=Je("copy",Dfe);const $fe=[["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"}]],qv=Je("database",$fe);const Lfe=[["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"}]],ZT=Je("download",Lfe);const Mfe=[["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"}]],jfe=Je("ellipsis-vertical",Mfe);const Pfe=[["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"}]],nU=Je("external-link",Pfe);const Ufe=[["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"}]],M9=Je("eye-off",Ufe);const zfe=[["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"}]],ex=Je("eye",zfe);const Ffe=[["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"}]],Bfe=Je("file-code",Ffe);const Hfe=[["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"}]],Vfe=Je("file-image",Hfe);const Gfe=[["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"}]],YT=Je("file-text",Gfe);const Wfe=[["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"}]],Kfe=Je("file",Wfe);const Zfe=[["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"}]],Yfe=Je("folder-open",Zfe);const Xfe=[["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"}]],qfe=Je("globe",Xfe);const Jfe=[["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"}]],Qfe=Je("grip-vertical",Jfe);const epe=[["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"}]],Cb=Je("history",epe);const tpe=[["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"}]],j9=Je("key",tpe);const npe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Nl=Je("loader-circle",npe);const rpe=[["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"}]],ape=Je("maximize-2",rpe);const ipe=[["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"}]],XT=Je("maximize",ipe);const ope=[["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"}]],spe=Je("message-circle",ope);const lpe=[["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"}]],rp=Je("message-square",lpe);const cpe=[["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"}]],upe=Je("minimize",cpe);const dpe=[["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"}]],rU=Je("monitor",dpe);const fpe=[["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"}]],ppe=Je("moon",fpe);const mpe=[["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"}]],hpe=Je("picture-in-picture",mpe);const gpe=[["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"}]],P9=Je("play",gpe);const bpe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],U9=Je("plus",bpe);const vpe=[["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"}]],aU=Je("rotate-ccw",vpe);const ype=[["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"}]],qT=Je("save",ype);const wpe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Jv=Je("search",wpe);const Spe=[["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"}]],Epe=Je("send",Spe);const xpe=[["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"}]],_pe=Je("server",xpe);const kpe=[["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"}]],au=Je("settings",kpe);const Tpe=[["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"}]],Npe=Je("shield",Tpe);const Rpe=[["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"}]],Cpe=Je("square-pen",Rpe);const Ape=[["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"}]],Ipe=Je("sun-dim",Ape);const Ope=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],kS=Je("terminal",Ope);const Dpe=[["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"}]],Rl=Je("trash-2",Dpe);const $pe=[["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"}]],Lpe=Je("trash",$pe);const Mpe=[["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=Je("wrench",Mpe);const jpe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],td=Je("x",jpe);const Ppe=[["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"}]],ap=Je("zap",Ppe);function Upe(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 zpe=e=>{switch(e){case"success":return Hpe;case"info":return Gpe;case"warning":return Vpe;case"error":return Wpe;default:return null}},Fpe=Array(12).fill(0),Bpe=({visible:e,className:t})=>ue.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ue.createElement("div",{className:"sonner-spinner"},Fpe.map((n,a)=>ue.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),Hpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Vpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Gpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Wpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Kpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ue.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ue.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Zpe=()=>{const[e,t]=ue.useState(document.hidden);return ue.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let tx=1;class Ype{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:a,...r}=t,i=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:tx++,s=this.toasts.find(u=>u.id===i),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(u=>u.id===i?(this.publish({...u,...t,id:i,title:a}),{...u,...t,id:i,dismissible:c,title:a}):u):this.addToast({title:a,...r,dismissible:c,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(a=>a({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let a;n.loading!==void 0&&(a=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const r=Promise.resolve(t instanceof Function?t():t);let i=a!==void 0,s;const c=r.then(async d=>{if(s=["resolve",d],ue.isValidElement(d))i=!1,this.create({id:a,type:"default",message:d});else if(qpe(d)&&!d.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,g=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,S=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...S})}else if(d instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,g=typeof n.description=="function"?await n.description(d):n.description,S=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...S})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(d):n.success,g=typeof n.description=="function"?await n.description(d):n.description,S=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"success",description:g,...S})}}).catch(async d=>{if(s=["reject",d],n.error!==void 0){i=!1;const m=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description,v=typeof m=="object"&&!ue.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:h,...v})}}).finally(()=>{i&&(this.dismiss(a),a=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((d,m)=>c.then(()=>s[0]==="reject"?m(s[1]):d(s[1])).catch(m));return typeof a!="string"&&typeof a!="number"?{unwrap:u}:Object.assign(a,{unwrap:u})},this.custom=(t,n)=>{const a=n?.id||tx++;return this.create({jsx:t(a),id:a,...n}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const sa=new Ype,Xpe=(e,t)=>{const n=t?.id||tx++;return sa.addToast({title:e,...t,id:n}),n},qpe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Jpe=Xpe,Qpe=()=>sa.toasts,eme=()=>sa.getActiveToasts(),bn=Object.assign(Jpe,{success:sa.success,info:sa.info,warning:sa.warning,error:sa.error,custom:sa.custom,message:sa.message,promise:sa.promise,dismiss:sa.dismiss,loading:sa.loading},{getHistory:Qpe,getToasts:eme});Upe("[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 yg(e){return e.label!==void 0}const tme=3,nme="24px",rme="16px",iU=4e3,ame=356,ime=14,ome=45,sme=200;function Oi(...e){return e.filter(Boolean).join(" ")}function lme(e){const[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}const cme=e=>{var t,n,a,r,i,s,c,u,d;const{invert:m,toast:h,unstyled:g,interacting:v,setHeights:S,visibleToasts:w,heights:y,index:_,toasts:x,expanded:k,removeToast:C,defaultRichColors:R,closeButton:I,style:A,cancelButtonStyle:O,actionButtonStyle:M,className:U="",descriptionClassName:F="",duration:H,position:te,gap:q,expandByDefault:ie,classNames:G,icons:Q,closeButtonAriaLabel:W="Close toast"}=e,[oe,ne]=ue.useState(null),[P,B]=ue.useState(null),[z,$]=ue.useState(!1),[j,V]=ue.useState(!1),[K,X]=ue.useState(!1),[se,le]=ue.useState(!1),[J,ee]=ue.useState(!1),[ce,re]=ue.useState(0),[ye,Te]=ue.useState(0),He=ue.useRef(h.duration||H||iU),_e=ue.useRef(null),Se=ue.useRef(null),Ue=_===0,pe=_+1<=w,$e=h.type,Be=h.dismissible!==!1,Ee=h.className||"",ot=h.descriptionClassName||"",at=ue.useMemo(()=>y.findIndex(qe=>qe.toastId===h.id)||0,[y,h.id]),pt=ue.useMemo(()=>{var qe;return(qe=h.closeButton)!=null?qe:I},[h.closeButton,I]),Pe=ue.useMemo(()=>h.duration||H||iU,[h.duration,H]),Le=ue.useRef(0),Qe=ue.useRef(0),en=ue.useRef(0),ke=ue.useRef(null),[Ie,ze]=te.split("-"),gt=ue.useMemo(()=>y.reduce((qe,Yt,xn)=>xn>=at?qe:qe+Yt.height,0),[y,at]),nt=Zpe(),et=h.invert||m,Ct=$e==="loading";Qe.current=ue.useMemo(()=>at*q+gt,[at,gt]),ue.useEffect(()=>{He.current=Pe},[Pe]),ue.useEffect(()=>{$(!0)},[]),ue.useEffect(()=>{const qe=Se.current;if(qe){const Yt=qe.getBoundingClientRect().height;return Te(Yt),S(xn=>[{toastId:h.id,height:Yt,position:h.position},...xn]),()=>S(xn=>xn.filter(_n=>_n.toastId!==h.id))}},[S,h.id]),ue.useLayoutEffect(()=>{if(!z)return;const qe=Se.current,Yt=qe.style.height;qe.style.height="auto";const xn=qe.getBoundingClientRect().height;qe.style.height=Yt,Te(xn),S(_n=>_n.find(an=>an.toastId===h.id)?_n.map(an=>an.toastId===h.id?{...an,height:xn}:an):[{toastId:h.id,height:xn,position:h.position},..._n])},[z,h.title,h.description,S,h.id,h.jsx,h.action,h.cancel]);const Lt=ue.useCallback(()=>{V(!0),re(Qe.current),S(qe=>qe.filter(Yt=>Yt.toastId!==h.id)),setTimeout(()=>{C(h)},sme)},[h,C,S,Qe]);ue.useEffect(()=>{if(h.promise&&$e==="loading"||h.duration===1/0||h.type==="loading")return;let qe;return k||v||nt?(()=>{if(en.current<Le.current){const _n=new Date().getTime()-Le.current;He.current=He.current-_n}en.current=new Date().getTime()})():(()=>{He.current!==1/0&&(Le.current=new Date().getTime(),qe=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),Lt()},He.current))})(),()=>clearTimeout(qe)},[k,v,h,$e,nt,Lt]),ue.useEffect(()=>{h.delete&&(Lt(),h.onDismiss==null||h.onDismiss.call(h,h))},[Lt,h.delete]);function En(){var qe;if(Q?.loading){var Yt;return ue.createElement("div",{className:Oi(G?.loader,h==null||(Yt=h.classNames)==null?void 0:Yt.loader,"sonner-loader"),"data-visible":$e==="loading"},Q.loading)}return ue.createElement(Bpe,{className:Oi(G?.loader,h==null||(qe=h.classNames)==null?void 0:qe.loader),visible:$e==="loading"})}const _t=h.icon||Q?.[$e]||zpe($e);var Zt,Ft;return ue.createElement("li",{tabIndex:0,ref:Se,className:Oi(U,Ee,G?.toast,h==null||(t=h.classNames)==null?void 0:t.toast,G?.default,G?.[$e],h==null||(n=h.classNames)==null?void 0:n[$e]),"data-sonner-toast":"","data-rich-colors":(Zt=h.richColors)!=null?Zt:R,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":z,"data-promise":!!h.promise,"data-swiped":J,"data-removed":j,"data-visible":pe,"data-y-position":Ie,"data-x-position":ze,"data-index":_,"data-front":Ue,"data-swiping":K,"data-dismissible":Be,"data-type":$e,"data-invert":et,"data-swipe-out":se,"data-swipe-direction":P,"data-expanded":!!(k||ie&&z),"data-testid":h.testId,style:{"--index":_,"--toasts-before":_,"--z-index":x.length-_,"--offset":`${j?ce:Qe.current}px`,"--initial-height":ie?"auto":`${ye}px`,...A,...h.style},onDragEnd:()=>{X(!1),ne(null),ke.current=null},onPointerDown:qe=>{qe.button!==2&&(Ct||!Be||(_e.current=new Date,re(Qe.current),qe.target.setPointerCapture(qe.pointerId),qe.target.tagName!=="BUTTON"&&(X(!0),ke.current={x:qe.clientX,y:qe.clientY})))},onPointerUp:()=>{var qe,Yt,xn;if(se||!Be)return;ke.current=null;const _n=Number(((qe=Se.current)==null?void 0:qe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Fr=Number(((Yt=Se.current)==null?void 0:Yt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),an=new Date().getTime()-((xn=_e.current)==null?void 0:xn.getTime()),Gn=oe==="x"?_n:Fr,Wn=Math.abs(Gn)/an;if(Math.abs(Gn)>=ome||Wn>.11){re(Qe.current),h.onDismiss==null||h.onDismiss.call(h,h),B(oe==="x"?_n>0?"right":"left":Fr>0?"down":"up"),Lt(),le(!0);return}else{var fn,on;(fn=Se.current)==null||fn.style.setProperty("--swipe-amount-x","0px"),(on=Se.current)==null||on.style.setProperty("--swipe-amount-y","0px")}ee(!1),X(!1),ne(null)},onPointerMove:qe=>{var Yt,xn,_n;if(!ke.current||!Be||((Yt=window.getSelection())==null?void 0:Yt.toString().length)>0)return;const an=qe.clientY-ke.current.y,Gn=qe.clientX-ke.current.x;var Wn;const fn=(Wn=e.swipeDirections)!=null?Wn:lme(te);!oe&&(Math.abs(Gn)>1||Math.abs(an)>1)&&ne(Math.abs(Gn)>Math.abs(an)?"x":"y");let on={x:0,y:0};const Jr=Gt=>1/(1.5+Math.abs(Gt)/20);if(oe==="y"){if(fn.includes("top")||fn.includes("bottom"))if(fn.includes("top")&&an<0||fn.includes("bottom")&&an>0)on.y=an;else{const Gt=an*Jr(an);on.y=Math.abs(Gt)<Math.abs(an)?Gt:an}}else if(oe==="x"&&(fn.includes("left")||fn.includes("right")))if(fn.includes("left")&&Gn<0||fn.includes("right")&&Gn>0)on.x=Gn;else{const Gt=Gn*Jr(Gn);on.x=Math.abs(Gt)<Math.abs(Gn)?Gt:Gn}(Math.abs(on.x)>0||Math.abs(on.y)>0)&&ee(!0),(xn=Se.current)==null||xn.style.setProperty("--swipe-amount-x",`${on.x}px`),(_n=Se.current)==null||_n.style.setProperty("--swipe-amount-y",`${on.y}px`)}},pt&&!h.jsx&&$e!=="loading"?ue.createElement("button",{"aria-label":W,"data-disabled":Ct,"data-close-button":!0,onClick:Ct||!Be?()=>{}:()=>{Lt(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Oi(G?.closeButton,h==null||(a=h.classNames)==null?void 0:a.closeButton)},(Ft=Q?.close)!=null?Ft:Kpe):null,($e||h.icon||h.promise)&&h.icon!==null&&(Q?.[$e]!==null||h.icon)?ue.createElement("div",{"data-icon":"",className:Oi(G?.icon,h==null||(r=h.classNames)==null?void 0:r.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||En():null,h.type!=="loading"?_t:null):null,ue.createElement("div",{"data-content":"",className:Oi(G?.content,h==null||(i=h.classNames)==null?void 0:i.content)},ue.createElement("div",{"data-title":"",className:Oi(G?.title,h==null||(s=h.classNames)==null?void 0:s.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?ue.createElement("div",{"data-description":"",className:Oi(F,ot,G?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),ue.isValidElement(h.cancel)?h.cancel:h.cancel&&yg(h.cancel)?ue.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:qe=>{yg(h.cancel)&&Be&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,qe),Lt())},className:Oi(G?.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,ue.isValidElement(h.action)?h.action:h.action&&yg(h.action)?ue.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||M,onClick:qe=>{yg(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,qe),!qe.defaultPrevented&&Lt())},className:Oi(G?.actionButton,h==null||(d=h.classNames)==null?void 0:d.actionButton)},h.action.label):null)};function oU(){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 ume(e,t){const n={};return[e,t].forEach((a,r)=>{const i=r===1,s=i?"--mobile-offset":"--offset",c=i?rme:nme;function u(d){["top","right","bottom","left"].forEach(m=>{n[`${s}-${m}`]=typeof d=="number"?`${d}px`:d})}typeof a=="number"||typeof a=="string"?u(a):typeof a=="object"?["top","right","bottom","left"].forEach(d=>{a[d]===void 0?n[`${s}-${d}`]=c:n[`${s}-${d}`]=typeof a[d]=="number"?`${a[d]}px`:a[d]}):u(c)}),n}const dme=ue.forwardRef(function(t,n){const{id:a,invert:r,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:c,closeButton:u,className:d,offset:m,mobileOffset:h,theme:g="light",richColors:v,duration:S,style:w,visibleToasts:y=tme,toastOptions:_,dir:x=oU(),gap:k=ime,icons:C,containerAriaLabel:R="Notifications"}=t,[I,A]=ue.useState([]),O=ue.useMemo(()=>a?I.filter(z=>z.toasterId===a):I.filter(z=>!z.toasterId),[I,a]),M=ue.useMemo(()=>Array.from(new Set([i].concat(O.filter(z=>z.position).map(z=>z.position)))),[O,i]),[U,F]=ue.useState([]),[H,te]=ue.useState(!1),[q,ie]=ue.useState(!1),[G,Q]=ue.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=ue.useRef(null),oe=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),ne=ue.useRef(null),P=ue.useRef(!1),B=ue.useCallback(z=>{A($=>{var j;return(j=$.find(V=>V.id===z.id))!=null&&j.delete||sa.dismiss(z.id),$.filter(({id:V})=>V!==z.id)})},[]);return ue.useEffect(()=>sa.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{A($=>$.map(j=>j.id===z.id?{...j,delete:!0}:j))});return}setTimeout(()=>{wH.flushSync(()=>{A($=>{const j=$.findIndex(V=>V.id===z.id);return j!==-1?[...$.slice(0,j),{...$[j],...z},...$.slice(j+1)]:[z,...$]})})})}),[I]),ue.useEffect(()=>{if(g!=="system"){Q(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Q("dark"):Q("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:$})=>{Q($?"dark":"light")})}catch{z.addListener(({matches:j})=>{try{Q(j?"dark":"light")}catch(V){console.error(V)}})}},[g]),ue.useEffect(()=>{I.length<=1&&te(!1)},[I]),ue.useEffect(()=>{const z=$=>{var j;if(s.every(X=>$[X]||$.code===X)){var K;te(!0),(K=W.current)==null||K.focus()}$.code==="Escape"&&(document.activeElement===W.current||(j=W.current)!=null&&j.contains(document.activeElement))&&te(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),ue.useEffect(()=>{if(W.current)return()=>{ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null,P.current=!1)}},[W.current]),ue.createElement("section",{ref:n,"aria-label":`${R} ${oe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((z,$)=>{var j;const[V,K]=z.split("-");return O.length?ue.createElement("ol",{key:z,dir:x==="auto"?oU():x,tabIndex:-1,ref:W,className:d,"data-sonner-toaster":!0,"data-sonner-theme":G,"data-y-position":V,"data-x-position":K,style:{"--front-toast-height":`${((j=U[0])==null?void 0:j.height)||0}px`,"--width":`${ame}px`,"--gap":`${k}px`,...w,...ume(m,h)},onBlur:X=>{P.current&&!X.currentTarget.contains(X.relatedTarget)&&(P.current=!1,ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||P.current||(P.current=!0,ne.current=X.relatedTarget)},onMouseEnter:()=>te(!0),onMouseMove:()=>te(!0),onMouseLeave:()=>{q||te(!1)},onDragEnd:()=>te(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ie(!0)},onPointerUp:()=>ie(!1)},O.filter(X=>!X.position&&$===0||X.position===z).map((X,se)=>{var le,J;return ue.createElement(cme,{key:X.id,icons:C,index:se,toast:X,defaultRichColors:v,duration:(le=_?.duration)!=null?le:S,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:r,visibleToasts:y,closeButton:(J=_?.closeButton)!=null?J:u,interacting:q,position:z,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,closeButtonAriaLabel:_?.closeButtonAriaLabel,removeToast:B,toasts:O.filter(ee=>ee.position==X.position),heights:U.filter(ee=>ee.position==X.position),setHeights:F,expandByDefault:c,gap:k,expanded:H,swipeDirections:t.swipeDirections})})):null}))});var Qv="Dialog",[z9]=_i(Qv),[fme,ki]=z9(Qv),F9=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:r,onOpenChange:i,modal:s=!0}=e,c=E.useRef(null),u=E.useRef(null),[d,m]=ko({prop:a,defaultProp:r??!1,onChange:i,caller:Qv});return p.jsx(fme,{scope:t,triggerRef:c,contentRef:u,contentId:Cr(),titleId:Cr(),descriptionId:Cr(),open:d,onOpenChange:m,onOpenToggle:E.useCallback(()=>m(h=>!h),[m]),modal:s,children:n})};F9.displayName=Qv;var B9="DialogTrigger",H9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(B9,n),i=Vt(t,r.triggerRef);return p.jsx(yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":eN(r.open),...a,ref:i,onClick:Ve(e.onClick,r.onOpenToggle)})});H9.displayName=B9;var JT="DialogPortal",[pme,V9]=z9(JT,{forceMount:void 0}),G9=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:r}=e,i=ki(JT,t);return p.jsx(pme,{scope:t,forceMount:n,children:E.Children.map(a,s=>p.jsx(Da,{present:n||i.open,children:p.jsx(ed,{asChild:!0,container:r,children:s})}))})};G9.displayName=JT;var Ab="DialogOverlay",W9=E.forwardRef((e,t)=>{const n=V9(Ab,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,i=ki(Ab,e.__scopeDialog);return i.modal?p.jsx(Da,{present:a||i.open,children:p.jsx(hme,{...r,ref:t})}):null});W9.displayName=Ab;var mme=kl("DialogOverlay.RemoveScroll"),hme=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(Ab,n);return p.jsx(Hp,{as:mme,allowPinchZoom:!0,shards:[r.contentRef],children:p.jsx(yt.div,{"data-state":eN(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Al="DialogContent",K9=E.forwardRef((e,t)=>{const n=V9(Al,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,i=ki(Al,e.__scopeDialog);return p.jsx(Da,{present:a||i.open,children:i.modal?p.jsx(gme,{...r,ref:t}):p.jsx(bme,{...r,ref:t})})});K9.displayName=Al;var gme=E.forwardRef((e,t)=>{const n=ki(Al,e.__scopeDialog),a=E.useRef(null),r=Vt(t,n.contentRef,a);return E.useEffect(()=>{const i=a.current;if(i)return Fv(i)},[]),p.jsx(Z9,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ve(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ve(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&i.preventDefault()}),onFocusOutside:Ve(e.onFocusOutside,i=>i.preventDefault())})}),bme=E.forwardRef((e,t)=>{const n=ki(Al,e.__scopeDialog),a=E.useRef(!1),r=E.useRef(!1);return p.jsx(Z9,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(a.current||n.triggerRef.current?.focus(),i.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(a.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),Z9=E.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:i,...s}=e,c=ki(Al,n),u=E.useRef(null),d=Vt(t,u);return Dv(),p.jsxs(p.Fragment,{children:[p.jsx(Up,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:i,children:p.jsx(qu,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":eN(c.open),...s,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(vme,{titleId:c.titleId}),p.jsx(wme,{contentRef:u,descriptionId:c.descriptionId})]})]})}),QT="DialogTitle",Y9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(QT,n);return p.jsx(yt.h2,{id:r.titleId,...a,ref:t})});Y9.displayName=QT;var X9="DialogDescription",q9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(X9,n);return p.jsx(yt.p,{id:r.descriptionId,...a,ref:t})});q9.displayName=X9;var J9="DialogClose",Q9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(J9,n);return p.jsx(yt.button,{type:"button",...a,ref:t,onClick:Ve(e.onClick,()=>r.onOpenChange(!1))})});Q9.displayName=J9;function eN(e){return e?"open":"closed"}var eG="DialogTitleWarning",[P_e,tG]=cse(eG,{contentName:Al,titleName:QT,docsSlug:"dialog"}),vme=({titleId:e})=>{const t=tG(eG),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
102
+ `)},Qce=0,Ac=[];function eue(e){var t=E.useRef([]),n=E.useRef([0,0]),a=E.useRef(),r=E.useState(Qce++)[0],i=E.useState(SV)[0],s=E.useRef(e);E.useEffect(function(){s.current=e},[e]),E.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var w=Sce([e.lockRef.current],(e.shards||[]).map(KP),!0).filter(Boolean);return w.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),w.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var c=E.useCallback(function(w,y){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!s.current.allowPinchZoom;var _=vg(w),x=n.current,k="deltaX"in w?w.deltaX:x[0]-_[0],C="deltaY"in w?w.deltaY:x[1]-_[1],R,I=w.target,A=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in w&&A==="h"&&I.type==="range")return!1;var O=GP(A,I);if(!O)return!0;if(O?R=A:(R=A==="v"?"h":"v",O=GP(A,I)),!O)return!1;if(!a.current&&"changedTouches"in w&&(k||C)&&(a.current=R),!R)return!0;var M=a.current||R;return Xce(M,y,w,M==="h"?k:C)},[]),u=E.useCallback(function(w){var y=w;if(!(!Ac.length||Ac[Ac.length-1]!==i)){var _="deltaY"in y?WP(y):vg(y),x=t.current.filter(function(R){return R.name===y.type&&(R.target===y.target||y.target===R.shadowParent)&&qce(R.delta,_)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var k=(s.current.shards||[]).map(KP).filter(Boolean).filter(function(R){return R.contains(y.target)}),C=k.length>0?c(y,k[0]):!s.current.noIsolation;C&&y.cancelable&&y.preventDefault()}}},[]),d=E.useCallback(function(w,y,_,x){var k={name:w,delta:y,target:_,should:x,shadowParent:tue(_)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),m=E.useCallback(function(w){n.current=vg(w),a.current=void 0},[]),h=E.useCallback(function(w){d(w.type,WP(w),w.target,c(w,e.lockRef.current))},[]),g=E.useCallback(function(w){d(w.type,vg(w),w.target,c(w,e.lockRef.current))},[]);E.useEffect(function(){return Ac.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Cc),document.addEventListener("touchmove",u,Cc),document.addEventListener("touchstart",m,Cc),function(){Ac=Ac.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,Cc),document.removeEventListener("touchmove",u,Cc),document.removeEventListener("touchstart",m,Cc)}},[]);var v=e.removeScrollBar,S=e.inert;return E.createElement(E.Fragment,null,S?E.createElement(i,{styles:Jce(r)}):null,v?E.createElement(Hce,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function tue(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const nue=Ace(wV,eue);var Hp=E.forwardRef(function(e,t){return E.createElement(Bv,Di({},e,{ref:t,sideCar:nue}))});Hp.classNames=Bv.classNames;var ZE=["Enter"," "],rue=["ArrowDown","PageUp","Home"],kV=["ArrowUp","PageDown","End"],aue=[...rue,...kV],iue={ltr:[...ZE,"ArrowRight"],rtl:[...ZE,"ArrowLeft"]},oue={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Vp="Menu",[ep,sue,lue]=_T(Vp),[Pl,TV]=_i(Vp,[lue,Os,fV]),Hv=Os(),NV=fV(),[cue,Ul]=Pl(Vp),[uue,Gp]=Pl(Vp),RV=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:i,modal:s=!0}=e,c=Hv(t),[u,d]=E.useState(null),m=E.useRef(!1),h=zi(i),g=kT(r);return E.useEffect(()=>{const v=()=>{m.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>m.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),p.jsx(Pv,{...c,children:p.jsx(cue,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:d,children:p.jsx(uue,{scope:t,onClose:E.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:g,modal:s,children:a})})})};RV.displayName=Vp;var due="MenuAnchor",LT=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Hv(n);return p.jsx(Fp,{...r,...a,ref:t})});LT.displayName=due;var MT="MenuPortal",[fue,CV]=Pl(MT,{forceMount:void 0}),AV=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,i=Ul(MT,t);return p.jsx(fue,{scope:t,forceMount:n,children:p.jsx(Da,{present:n||i.open,children:p.jsx(ed,{asChild:!0,container:r,children:a})})})};AV.displayName=MT;var Za="MenuContent",[pue,jT]=Pl(Za),IV=E.forwardRef((e,t)=>{const n=CV(Za,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,i=Ul(Za,e.__scopeMenu),s=Gp(Za,e.__scopeMenu);return p.jsx(ep.Provider,{scope:e.__scopeMenu,children:p.jsx(Da,{present:a||i.open,children:p.jsx(ep.Slot,{scope:e.__scopeMenu,children:s.modal?p.jsx(mue,{...r,ref:t}):p.jsx(hue,{...r,ref:t})})})})}),mue=E.forwardRef((e,t)=>{const n=Ul(Za,e.__scopeMenu),a=E.useRef(null),r=Vt(t,a);return E.useEffect(()=>{const i=a.current;if(i)return Fv(i)},[]),p.jsx(PT,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),hue=E.forwardRef((e,t)=>{const n=Ul(Za,e.__scopeMenu);return p.jsx(PT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),gue=kl("MenuContent.ScrollLock"),PT=E.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:S,...w}=e,y=Ul(Za,n),_=Gp(Za,n),x=Hv(n),k=NV(n),C=sue(n),[R,I]=E.useState(null),A=E.useRef(null),O=Vt(t,A,y.onContentChange),M=E.useRef(0),U=E.useRef(""),F=E.useRef(0),H=E.useRef(null),te=E.useRef("right"),q=E.useRef(0),ie=S?Hp:E.Fragment,G=S?{as:gue,allowPinchZoom:!0}:void 0,Q=oe=>{const ne=U.current+oe,P=C().filter(K=>!K.disabled),B=document.activeElement,z=P.find(K=>K.ref.current===B)?.textValue,$=P.map(K=>K.textValue),j=Rue($,ne,z),V=P.find(K=>K.textValue===j)?.ref.current;(function K(X){U.current=X,window.clearTimeout(M.current),X!==""&&(M.current=window.setTimeout(()=>K(""),1e3))})(ne),V&&setTimeout(()=>V.focus())};E.useEffect(()=>()=>window.clearTimeout(M.current),[]),Dv();const W=E.useCallback(oe=>te.current===H.current?.side&&Aue(oe,H.current?.area),[]);return p.jsx(pue,{scope:n,searchRef:U,onItemEnter:E.useCallback(oe=>{W(oe)&&oe.preventDefault()},[W]),onItemLeave:E.useCallback(oe=>{W(oe)||(A.current?.focus(),I(null))},[W]),onTriggerLeave:E.useCallback(oe=>{W(oe)&&oe.preventDefault()},[W]),pointerGraceTimerRef:F,onPointerGraceIntentChange:E.useCallback(oe=>{H.current=oe},[]),children:p.jsx(ie,{...G,children:p.jsx(Up,{asChild:!0,trapped:r,onMountAutoFocus:Ve(i,oe=>{oe.preventDefault(),A.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:p.jsx(qu,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:p.jsx(gce,{asChild:!0,...k,dir:_.dir,orientation:"vertical",loop:a,currentTabStopId:R,onCurrentTabStopIdChange:I,onEntryFocus:Ve(u,oe=>{_.isUsingKeyboardRef.current||oe.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(Uv,{role:"menu","aria-orientation":"vertical","data-state":KV(y.open),"data-radix-menu-content":"",dir:_.dir,...x,...w,ref:O,style:{outline:"none",...w.style},onKeyDown:Ve(w.onKeyDown,oe=>{const P=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,B=oe.ctrlKey||oe.altKey||oe.metaKey,z=oe.key.length===1;P&&(oe.key==="Tab"&&oe.preventDefault(),!B&&z&&Q(oe.key));const $=A.current;if(oe.target!==$||!aue.includes(oe.key))return;oe.preventDefault();const V=C().filter(K=>!K.disabled).map(K=>K.ref.current);kV.includes(oe.key)&&V.reverse(),Tue(V)}),onBlur:Ve(e.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout(M.current),U.current="")}),onPointerMove:Ve(e.onPointerMove,tp(oe=>{const ne=oe.target,P=q.current!==oe.clientX;if(oe.currentTarget.contains(ne)&&P){const B=oe.clientX>q.current?"right":"left";te.current=B,q.current=oe.clientX}}))})})})})})})});IV.displayName=Za;var bue="MenuGroup",UT=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return p.jsx(yt.div,{role:"group",...a,ref:t})});UT.displayName=bue;var vue="MenuLabel",OV=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return p.jsx(yt.div,{...a,ref:t})});OV.displayName=vue;var Tb="MenuItem",ZP="menu.itemSelect",Vv=E.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,i=E.useRef(null),s=Gp(Tb,e.__scopeMenu),c=jT(Tb,e.__scopeMenu),u=Vt(t,i),d=E.useRef(!1),m=()=>{const h=i.current;if(!n&&h){const g=new CustomEvent(ZP,{bubbles:!0,cancelable:!0});h.addEventListener(ZP,v=>a?.(v),{once:!0}),zH(h,g),g.defaultPrevented?d.current=!1:s.onClose()}};return p.jsx(DV,{...r,ref:u,disabled:n,onClick:Ve(e.onClick,m),onPointerDown:h=>{e.onPointerDown?.(h),d.current=!0},onPointerUp:Ve(e.onPointerUp,h=>{d.current||h.currentTarget?.click()}),onKeyDown:Ve(e.onKeyDown,h=>{const g=c.searchRef.current!=="";n||g&&h.key===" "||ZE.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Vv.displayName=Tb;var DV=E.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...i}=e,s=jT(Tb,n),c=NV(n),u=E.useRef(null),d=Vt(t,u),[m,h]=E.useState(!1),[g,v]=E.useState("");return E.useEffect(()=>{const S=u.current;S&&v((S.textContent??"").trim())},[i.children]),p.jsx(ep.ItemSlot,{scope:n,disabled:a,textValue:r??g,children:p.jsx(bce,{asChild:!0,...c,focusable:!a,children:p.jsx(yt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...i,ref:d,onPointerMove:Ve(e.onPointerMove,tp(S=>{a?s.onItemLeave(S):(s.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ve(e.onPointerLeave,tp(S=>s.onItemLeave(S))),onFocus:Ve(e.onFocus,()=>h(!0)),onBlur:Ve(e.onBlur,()=>h(!1))})})})}),yue="MenuCheckboxItem",$V=E.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return p.jsx(UV,{scope:e.__scopeMenu,checked:n,children:p.jsx(Vv,{role:"menuitemcheckbox","aria-checked":Nb(n)?"mixed":n,...r,ref:t,"data-state":FT(n),onSelect:Ve(r.onSelect,()=>a?.(Nb(n)?!0:!n),{checkForDefaultPrevented:!1})})})});$V.displayName=yue;var LV="MenuRadioGroup",[wue,Sue]=Pl(LV,{value:void 0,onValueChange:()=>{}}),MV=E.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,i=zi(a);return p.jsx(wue,{scope:e.__scopeMenu,value:n,onValueChange:i,children:p.jsx(UT,{...r,ref:t})})});MV.displayName=LV;var jV="MenuRadioItem",PV=E.forwardRef((e,t)=>{const{value:n,...a}=e,r=Sue(jV,e.__scopeMenu),i=n===r.value;return p.jsx(UV,{scope:e.__scopeMenu,checked:i,children:p.jsx(Vv,{role:"menuitemradio","aria-checked":i,...a,ref:t,"data-state":FT(i),onSelect:Ve(a.onSelect,()=>r.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});PV.displayName=jV;var zT="MenuItemIndicator",[UV,Eue]=Pl(zT,{checked:!1}),zV=E.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,i=Eue(zT,n);return p.jsx(Da,{present:a||Nb(i.checked)||i.checked===!0,children:p.jsx(yt.span,{...r,ref:t,"data-state":FT(i.checked)})})});zV.displayName=zT;var xue="MenuSeparator",FV=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return p.jsx(yt.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});FV.displayName=xue;var _ue="MenuArrow",BV=E.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=Hv(n);return p.jsx(zv,{...r,...a,ref:t})});BV.displayName=_ue;var kue="MenuSub",[j_e,HV]=Pl(kue),vf="MenuSubTrigger",VV=E.forwardRef((e,t)=>{const n=Ul(vf,e.__scopeMenu),a=Gp(vf,e.__scopeMenu),r=HV(vf,e.__scopeMenu),i=jT(vf,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=i,d={__scopeMenu:e.__scopeMenu},m=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return E.useEffect(()=>m,[m]),E.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),u(null)}},[c,u]),p.jsx(LT,{asChild:!0,...d,children:p.jsx(DV,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":KV(n.open),...e,ref:Ui(t,r.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ve(e.onPointerMove,tp(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Ve(e.onPointerLeave,tp(h=>{m();const g=n.content?.getBoundingClientRect();if(g){const v=n.content?.dataset.side,S=v==="right",w=S?-5:5,y=g[S?"left":"right"],_=g[S?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+w,y:h.clientY},{x:y,y:g.top},{x:_,y:g.top},{x:_,y:g.bottom},{x:y,y:g.bottom}],side:v}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ve(e.onKeyDown,h=>{const g=i.searchRef.current!=="";e.disabled||g&&h.key===" "||iue[a.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});VV.displayName=vf;var GV="MenuSubContent",WV=E.forwardRef((e,t)=>{const n=CV(Za,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,i=Ul(Za,e.__scopeMenu),s=Gp(Za,e.__scopeMenu),c=HV(GV,e.__scopeMenu),u=E.useRef(null),d=Vt(t,u);return p.jsx(ep.Provider,{scope:e.__scopeMenu,children:p.jsx(Da,{present:a||i.open,children:p.jsx(ep.Slot,{scope:e.__scopeMenu,children:p.jsx(PT,{id:c.contentId,"aria-labelledby":c.triggerId,...r,ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{s.isUsingKeyboardRef.current&&u.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Ve(e.onFocusOutside,m=>{m.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ve(e.onEscapeKeyDown,m=>{s.onClose(),m.preventDefault()}),onKeyDown:Ve(e.onKeyDown,m=>{const h=m.currentTarget.contains(m.target),g=oue[s.dir].includes(m.key);h&&g&&(i.onOpenChange(!1),c.trigger?.focus(),m.preventDefault())})})})})})});WV.displayName=GV;function KV(e){return e?"open":"closed"}function Nb(e){return e==="indeterminate"}function FT(e){return Nb(e)?"indeterminate":e?"checked":"unchecked"}function Tue(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Nue(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function Rue(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=Nue(e,Math.max(i,0));r.length===1&&(s=s.filter(d=>d!==n));const u=s.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return u!==n?u:void 0}function Cue(e,t){const{x:n,y:a}=e;let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,m=c.y,h=u.x,g=u.y;m>a!=g>a&&n<(h-d)*(a-m)/(g-m)+d&&(r=!r)}return r}function Aue(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Cue(n,t)}function tp(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Iue=RV,Oue=LT,Due=AV,$ue=IV,Lue=UT,Mue=OV,jue=Vv,Pue=$V,Uue=MV,zue=PV,Fue=zV,Bue=FV,Hue=BV,Vue=VV,Gue=WV,Gv="DropdownMenu",[Wue]=_i(Gv,[TV]),qr=TV(),[Kue,ZV]=Wue(Gv),YV=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,u=qr(t),d=E.useRef(null),[m,h]=ko({prop:r,defaultProp:i??!1,onChange:s,caller:Gv});return p.jsx(Kue,{scope:t,triggerId:Cr(),triggerRef:d,contentId:Cr(),open:m,onOpenChange:h,onOpenToggle:E.useCallback(()=>h(g=>!g),[h]),modal:c,children:p.jsx(Iue,{...u,open:m,onOpenChange:h,dir:a,modal:c,children:n})})};YV.displayName=Gv;var XV="DropdownMenuTrigger",qV=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,i=ZV(XV,n),s=qr(n);return p.jsx(Oue,{asChild:!0,...s,children:p.jsx(yt.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...r,ref:Ui(t,i.triggerRef),onPointerDown:Ve(e.onPointerDown,c=>{!a&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:Ve(e.onKeyDown,c=>{a||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});qV.displayName=XV;var Zue="DropdownMenuPortal",JV=e=>{const{__scopeDropdownMenu:t,...n}=e,a=qr(t);return p.jsx(Due,{...a,...n})};JV.displayName=Zue;var QV="DropdownMenuContent",e9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=ZV(QV,n),i=qr(n),s=E.useRef(!1);return p.jsx($ue,{id:r.contentId,"aria-labelledby":r.triggerId,...i,...a,ref:t,onCloseAutoFocus:Ve(e.onCloseAutoFocus,c=>{s.current||r.triggerRef.current?.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Ve(e.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,m=u.button===2||d;(!r.modal||m)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});e9.displayName=QV;var Yue="DropdownMenuGroup",Xue=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Lue,{...r,...a,ref:t})});Xue.displayName=Yue;var que="DropdownMenuLabel",t9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Mue,{...r,...a,ref:t})});t9.displayName=que;var Jue="DropdownMenuItem",n9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(jue,{...r,...a,ref:t})});n9.displayName=Jue;var Que="DropdownMenuCheckboxItem",r9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Pue,{...r,...a,ref:t})});r9.displayName=Que;var ede="DropdownMenuRadioGroup",tde=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Uue,{...r,...a,ref:t})});tde.displayName=ede;var nde="DropdownMenuRadioItem",a9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(zue,{...r,...a,ref:t})});a9.displayName=nde;var rde="DropdownMenuItemIndicator",ade=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Fue,{...r,...a,ref:t})});ade.displayName=rde;var ide="DropdownMenuSeparator",i9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Bue,{...r,...a,ref:t})});i9.displayName=ide;var ode="DropdownMenuArrow",sde=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Hue,{...r,...a,ref:t})});sde.displayName=ode;var lde="DropdownMenuSubTrigger",o9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Vue,{...r,...a,ref:t})});o9.displayName=lde;var cde="DropdownMenuSubContent",s9=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=qr(n);return p.jsx(Gue,{...r,...a,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});s9.displayName=cde;var ude=YV,dde=qV,fde=JV,l9=e9,c9=t9,u9=n9,pde=r9,mde=a9,d9=i9,hde=o9,gde=s9;const YE=ude,XE=dde;hde.displayName;gde.displayName;function Rb({ref:e,className:t,sideOffset:n=4,...a}){return p.jsx(fde,{children:p.jsx(l9,{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),...a})})}Rb.displayName=l9.displayName;function wo({ref:e,className:t,inset:n,...a}){return p.jsx(u9,{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),...a})}wo.displayName=u9.displayName;pde.displayName;mde.displayName;function qE({ref:e,className:t,inset:n,...a}){return p.jsx(c9,{ref:e,className:Oe("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...a})}qE.displayName=c9.displayName;function yf({ref:e,className:t,...n}){return p.jsx(d9,{ref:e,className:Oe("-mx-1 my-1 h-px bg-muted",t),...n})}yf.displayName=d9.displayName;var bde=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lo=bde.reduce((e,t)=>{const n=EH(`Primitive.${t}`),a=E.forwardRef((r,i)=>{const{asChild:s,...c}=r,u=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(u,{...c,ref:i})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),vde="Label",f9=E.forwardRef((e,t)=>p.jsx(Lo.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));f9.displayName=vde;var yde=f9;function In({className:e,...t}){return p.jsx(yde,{"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 Wv({message:e,className:t="",vertical:n,noBorder:a}){return p.jsx("div",{className:Oe(`mt-2 rounded-md p-6 ${t}`,!a&&"border"),children:p.jsxs("p",{className:Oe("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[p.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:p.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:p.jsxs("g",{transform:"translate(5.320900, 5.320900)",fillRule:"nonzero",className:"stroke-black dark:stroke-white",strokeWidth:"4",children:[p.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"}),p.jsx("circle",{cx:"50",cy:"212.0001",r:"52.5"}),p.jsx("circle",{cx:"212.0001",cy:"50",r:"52.5"})]})})}),e]})})}function p9({className:e,color:t,children:n,grayscaled:a=!1}){const r=E.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[1]||"0")}return a?0:.2},[t,a]),i=E.useMemo(()=>{if(t){const h=t.split("(")[1].split(")")[0].trim().split(/\s+/);return Number.parseFloat(h[0]||"0.5")}return a?.3:.4},[t,a]),s=E.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=E.useMemo(()=>t||`oklch(${Math.min(i,1)} ${r} ${s})`,[s,r,i]),u=E.useMemo(()=>`oklch(${Math.min(i*2,1)} ${r} ${s})`,[s,r,i,t]),d=E.useMemo(()=>Math.floor(Math.random()*360),[s]),m=E.useMemo(()=>"1000%",[]);return p.jsx("section",{className:Oe("relative w-full h-full overflow-hidden",e),style:{background:`${u}`},children:p.jsxs("div",{className:"isolate relative w-full h-full",children:[p.jsx("div",{className:"noise w-full h-full",style:{background:`linear-gradient(${d}deg, ${c}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,filter:`contrast(120%) brightness(${m})`}}),n&&p.jsx("div",{className:"relative z-10 w-full h-full",children:n})]})})}function BT(e){const t=E.useRef({value:e,previous:e});return E.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Kv="Switch",[wde]=_i(Kv),[Sde,Ede]=wde(Kv),m9=E.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:r,defaultChecked:i,required:s,disabled:c,value:u="on",onCheckedChange:d,form:m,...h}=e,[g,v]=E.useState(null),S=Vt(t,k=>v(k)),w=E.useRef(!1),y=g?m||!!g.closest("form"):!0,[_,x]=ko({prop:r,defaultProp:i??!1,onChange:d,caller:Kv});return p.jsxs(Sde,{scope:n,checked:_,disabled:c,children:[p.jsx(yt.button,{type:"button",role:"switch","aria-checked":_,"aria-required":s,"data-state":v9(_),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:S,onClick:Ve(e.onClick,k=>{x(C=>!C),y&&(w.current=k.isPropagationStopped(),w.current||k.stopPropagation())})}),y&&p.jsx(b9,{control:g,bubbles:!w.current,name:a,value:u,checked:_,required:s,disabled:c,form:m,style:{transform:"translateX(-100%)"}})]})});m9.displayName=Kv;var h9="SwitchThumb",g9=E.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,r=Ede(h9,n);return p.jsx(yt.span,{"data-state":v9(r.checked),"data-disabled":r.disabled?"":void 0,...a,ref:t})});g9.displayName=h9;var xde="SwitchBubbleInput",b9=E.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...r},i)=>{const s=E.useRef(null),c=Vt(s,i),u=BT(n),d=OT(t);return E.useEffect(()=>{const m=s.current;if(!m)return;const h=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(h,"checked").set;if(u!==n&&v){const S=new Event("click",{bubbles:a});v.call(m,n),m.dispatchEvent(S)}},[u,n,a]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:c,style:{...r.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});b9.displayName=xde;function v9(e){return e?"checked":"unchecked"}var y9=m9,_de=g9;function Zv({ref:e,className:t,...n}){return p.jsx(y9,{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:p.jsx(_de,{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")})})}Zv.displayName=y9.displayName;var w9=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"}),kde="VisuallyHidden",S9=E.forwardRef((e,t)=>p.jsx(yt.span,{...e,ref:t,style:{...w9,...e.style}}));S9.displayName=kde;var Tde=S9,[Yv]=_i("Tooltip",[Os]),Xv=Os(),E9="TooltipProvider",Nde=700,JE="tooltip.open",[Rde,HT]=Yv(E9),x9=e=>{const{__scopeTooltip:t,delayDuration:n=Nde,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:i}=e,s=E.useRef(!0),c=E.useRef(!1),u=E.useRef(0);return E.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),p.jsx(Rde,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:E.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:E.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,a)},[a]),isPointerInTransitRef:c,onPointerInTransitChange:E.useCallback(d=>{c.current=d},[]),disableHoverableContent:r,children:i})};x9.displayName=E9;var np="Tooltip",[Cde,Wp]=Yv(np),_9=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:i,disableHoverableContent:s,delayDuration:c}=e,u=HT(np,e.__scopeTooltip),d=Xv(t),[m,h]=E.useState(null),g=Cr(),v=E.useRef(0),S=s??u.disableHoverableContent,w=c??u.delayDuration,y=E.useRef(!1),[_,x]=ko({prop:a,defaultProp:r??!1,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(JE))):u.onClose(),i?.(A)},caller:np}),k=E.useMemo(()=>_?y.current?"delayed-open":"instant-open":"closed",[_]),C=E.useCallback(()=>{window.clearTimeout(v.current),v.current=0,y.current=!1,x(!0)},[x]),R=E.useCallback(()=>{window.clearTimeout(v.current),v.current=0,x(!1)},[x]),I=E.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{y.current=!0,x(!0),v.current=0},w)},[w,x]);return E.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),p.jsx(Pv,{...d,children:p.jsx(Cde,{scope:t,contentId:g,open:_,stateAttribute:k,trigger:m,onTriggerChange:h,onTriggerEnter:E.useCallback(()=>{u.isOpenDelayedRef.current?I():C()},[u.isOpenDelayedRef,I,C]),onTriggerLeave:E.useCallback(()=>{S?R():(window.clearTimeout(v.current),v.current=0)},[R,S]),onOpen:C,onClose:R,disableHoverableContent:S,children:n})})};_9.displayName=np;var QE="TooltipTrigger",k9=E.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Wp(QE,n),i=HT(QE,n),s=Xv(n),c=E.useRef(null),u=Vt(t,c,r.onTriggerChange),d=E.useRef(!1),m=E.useRef(!1),h=E.useCallback(()=>d.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),p.jsx(Fp,{asChild:!0,...s,children:p.jsx(yt.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:u,onPointerMove:Ve(e.onPointerMove,g=>{g.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(r.onTriggerEnter(),m.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{r.onTriggerLeave(),m.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ve(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:Ve(e.onBlur,r.onClose),onClick:Ve(e.onClick,r.onClose)})})});k9.displayName=QE;var VT="TooltipPortal",[Ade,Ide]=Yv(VT,{forceMount:void 0}),T9=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,i=Wp(VT,t);return p.jsx(Ade,{scope:t,forceMount:n,children:p.jsx(Da,{present:n||i.open,children:p.jsx(ed,{asChild:!0,container:r,children:a})})})};T9.displayName=VT;var Du="TooltipContent",N9=E.forwardRef((e,t)=>{const n=Ide(Du,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...i}=e,s=Wp(Du,e.__scopeTooltip);return p.jsx(Da,{present:a||s.open,children:s.disableHoverableContent?p.jsx(R9,{side:r,...i,ref:t}):p.jsx(Ode,{side:r,...i,ref:t})})}),Ode=E.forwardRef((e,t)=>{const n=Wp(Du,e.__scopeTooltip),a=HT(Du,e.__scopeTooltip),r=E.useRef(null),i=Vt(t,r),[s,c]=E.useState(null),{trigger:u,onClose:d}=n,m=r.current,{onPointerInTransitChange:h}=a,g=E.useCallback(()=>{c(null),h(!1)},[h]),v=E.useCallback((S,w)=>{const y=S.currentTarget,_={x:S.clientX,y:S.clientY},x=Mde(_,y.getBoundingClientRect()),k=jde(_,x),C=Pde(w.getBoundingClientRect()),R=zde([...k,...C]);c(R),h(!0)},[h]);return E.useEffect(()=>()=>g(),[g]),E.useEffect(()=>{if(u&&m){const S=y=>v(y,m),w=y=>v(y,u);return u.addEventListener("pointerleave",S),m.addEventListener("pointerleave",w),()=>{u.removeEventListener("pointerleave",S),m.removeEventListener("pointerleave",w)}}},[u,m,v,g]),E.useEffect(()=>{if(s){const S=w=>{const y=w.target,_={x:w.clientX,y:w.clientY},x=u?.contains(y)||m?.contains(y),k=!Ude(_,s);x?g():k&&(g(),d())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[u,m,s,d,g]),p.jsx(R9,{...e,ref:i})}),[Dde,$de]=Yv(np,{isInside:!1}),Lde=hse("TooltipContent"),R9=E.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:i,onPointerDownOutside:s,...c}=e,u=Wp(Du,n),d=Xv(n),{onClose:m}=u;return E.useEffect(()=>(document.addEventListener(JE,m),()=>document.removeEventListener(JE,m)),[m]),E.useEffect(()=>{if(u.trigger){const h=g=>{g.target?.contains(u.trigger)&&m()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,m]),p.jsx(qu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:m,children:p.jsxs(Uv,{"data-state":u.stateAttribute,...d,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(Lde,{children:a}),p.jsx(Dde,{scope:n,isInside:!0,children:p.jsx(Tde,{id:u.contentId,role:"tooltip",children:r||a})})]})})});N9.displayName=Du;var C9="TooltipArrow",A9=E.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=Xv(n);return $de(C9,n).isInside?null:p.jsx(zv,{...r,...a,ref:t})});A9.displayName=C9;function Mde(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,a,r,i)){case i:return"left";case r:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function jde(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function Pde(e){const{top:t,right:n,bottom:a,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:a},{x:r,y:a}]}function Ude(e,t){const{x:n,y:a}=e;let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const c=t[i],u=t[s],d=c.x,m=c.y,h=u.x,g=u.y;m>a!=g>a&&n<(h-d)*(a-m)/(g-m)+d&&(r=!r)}return r}function zde(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),Fde(t)}function Fde(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const r=e[a];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(r.y-s.y)>=(i.y-s.y)*(r.x-s.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const r=e[a];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(r.y-s.y)>=(i.y-s.y)*(r.x-s.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Bde=x9,Hde=_9,Vde=k9,Gde=T9,Wde=N9,Kde=A9;function I9({delayDuration:e=0,...t}){return p.jsx(Bde,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function vn({...e}){return p.jsx(I9,{children:p.jsx(Hde,{"data-slot":"tooltip",...e})})}function yn({...e}){return p.jsx(Vde,{"data-slot":"tooltip-trigger",...e})}function wn({className:e,sideOffset:t=0,children:n,...a}){return p.jsx(Gde,{children:p.jsxs(Wde,{"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),...a,children:[n,p.jsx(Kde,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}class Zde{name="mcp_inspector_open";properties;constructor(t){this.properties={server_url:t.serverUrl,connection_count:t.connectionCount}}}class YP{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 XP{name="mcp_resource_read";properties;constructor(t){this.properties={resource_uri:t.resourceUri,server_id:t.serverId,success:t.success,error:t.error}}}class qP{name="mcp_prompt_call";properties;constructor(t){this.properties={prompt_name:t.promptName,server_id:t.serverId,success:t.success,error:t.error}}}class JP{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 Yde{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 Xde{name="mcp_server_removed";properties;constructor(t){this.properties={server_id:t.serverId}}}class qde{name="mcp_command_palette_open";properties;constructor(t){this.properties={trigger:t.trigger}}}class Jde{name="mcp_tool_saved";properties;constructor(t){this.properties={tool_name:t.toolName,server_id:t.serverId}}}function xS(){try{return"0.9.2"}catch{return"0.0.0"}}var Qde={};function _S(){try{return typeof window<"u"&&typeof document<"u"}catch{return!1}}class QP{endpoint;timeout;constructor(t,n=3e3){this.endpoint=t,this.timeout=n}async logEvent(t){try{const n=new AbortController,a=setTimeout(()=>n.abort(),this.timeout),r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n.signal});if(clearTimeout(a),!r.ok)throw new Error(`HTTP error! status: ${r.status}`)}catch{}}}function cs(e){return`mcp_inspector_telemetry_${e}`}class br{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=_S(),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 QP(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new QP(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return typeof localStorage<"u"&&localStorage.getItem(cs("disabled"))==="true"||typeof process<"u"&&Qde?.MCP_USE_ANONYMIZED_TELEMETRY==="false"}getStoredSource(){return typeof localStorage<"u"?localStorage.getItem(cs("source")):null}static getInstance(){return br.instance||(br.instance=new br),br.instance}setSource(t){this._source=t,typeof localStorage<"u"&&localStorage.setItem(cs("source"),t)}getSource(){return this._source}get userId(){if(this._currUserId)return this._currUserId;if(!_S())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{const t=localStorage.getItem(cs("user_id"));if(t)this._currUserId=t;else{const n=this.generateUserId();localStorage.setItem(cs("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:xS(),language:"typescript",source:this._source,package:"inspector"}};await this._posthogClient.logEvent(n)}catch{}if(this._scarfClient)try{const n={};n.mcp_use_version=xS(),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&&_S())try{const n=xS();let a=!1,r=!1;const i=localStorage.getItem(cs("download_version"));if(i?n>i&&(a=!0,r=!1,localStorage.setItem(cs("download_version"),n)):(a=!0,r=!0,localStorage.setItem(cs("download_version"),n)),a){const s={...t||{}};s.mcp_use_version=n,s.user_id=this.userId,s.event="package_download",s.first_download=r,s.language="typescript",s.source=this._source,s.package="inspector",await this._scarfClient.logEvent(s)}}catch{}}async trackInspectorOpen(t){const n=new Zde(t);await this.capture(n)}}const O9=E.createContext(null);function GT(){const e=E.use(O9);if(!e)throw new Error("useMcpContext must be used within a McpProvider");return e}function efe({url:e,name:t,proxyConfig:n,transportType:a,connectionId:r,onUpdate:i,onRemove:s}){const c=typeof window<"u"?new URL("/inspector/oauth/callback",window.location.origin).toString():"/inspector/oauth/callback";let u=e,d={};if(n?.proxyAddress){const U=new URL(n.proxyAddress),F=new URL(e);u=`${U.origin}${U.pathname}${F.pathname}${F.search}`,d["X-Target-URL"]=e}n?.customHeaders&&(d={...d,...n.customHeaders});const m=E.useRef(null),[h,g]=E.useState(!1),v=E.useRef(!1);E.useEffect(()=>{typeof window<"u"&&!v.current&&(v.current=!0,di(()=>import("./transport-wrapper-browser-BI4dDu3b.js"),[]).then(U=>{m.current=U.wrapTransportForLogging,g(!0),console.log("[McpContext] Transport wrapper loaded")}).catch(U=>{console.error("[McpContext] Failed to load transport wrapper:",U)}))},[]);const S=E.useMemo(()=>{if(!(!h||!m.current))return(U,F)=>{const H=r;return console.log("[McpContext] Applying transport wrapper, serverId:",H,"from connector:",F),m.current(U,H)}},[h,r]),w=`mcp-inspector-notifications-${r}`,y=500,[_,x]=E.useState([]);E.useEffect(()=>{try{const U=localStorage.getItem(w);if(U){const F=JSON.parse(U);Array.isArray(F)&&x(F)}}catch(U){console.error("Failed to load notifications from localStorage:",U)}},[w]),E.useEffect(()=>{try{localStorage.setItem(w,JSON.stringify(_))}catch(U){console.error("Failed to save notifications to localStorage:",U)}},[_,w]);const k=E.useCallback(U=>{x(F=>F.map(H=>H.id===U?{...H,read:!0}:H))},[]),C=E.useCallback(()=>{x(U=>U.map(F=>({...F,read:!0})))},[]),R=E.useCallback(()=>{x([])},[]),I=E.useCallback(U=>{x(F=>{const H=[U,...F];return H.length>y?H.slice(0,y):H})},[]),A=bT({url:u,callbackUrl:c,customHeaders:Object.keys(d).length>0?d:void 0,transportType:a||"http",preventAutoAuth:!0,useRedirectFlow:!0,enabled:h,wrapTransport:S,onNotification:U=>{I({id:globalThis.crypto.randomUUID(),method:U.method,params:U.params,timestamp:Date.now(),read:!1})}}),O=E.useRef(i),M=E.useRef(null);return E.useEffect(()=>{O.current=i},[i]),E.useEffect(()=>{if(typeof queueMicrotask<"u")queueMicrotask(()=>{A.state==="ready"&&A.serverInfo&&console.log("[McpContext] Server info available:",A.serverInfo);const U=_.filter(te=>!te.read).length,F={id:r,url:e,name:A.serverInfo?.name||t,state:A.state,tools:A.tools,resources:A.resources,prompts:A.prompts,error:A.error??null,authUrl:A.authUrl??null,customHeaders:d,transportType:a,proxyConfig:n,serverInfo:A.serverInfo,capabilities:A.capabilities,notifications:_,unreadNotificationCount:U,markNotificationRead:k,markAllNotificationsRead:C,clearNotifications:R,callTool:A.callTool,readResource:A.readResource,listPrompts:A.listPrompts,getPrompt:A.getPrompt,authenticate:A.authenticate,retry:A.retry,clearStorage:A.clearStorage,disconnect:A.disconnect,client:A.client},H=M.current;(!H||H.state!==F.state||H.error!==F.error||H.authUrl!==F.authUrl||H.name!==F.name||H.tools.length!==F.tools.length||H.resources.length!==F.resources.length||H.prompts.length!==F.prompts.length||H.serverInfo!==F.serverInfo||H.capabilities!==F.capabilities||H.notifications.length!==F.notifications.length||H.unreadNotificationCount!==F.unreadNotificationCount||!H.client)&&(M.current=F,O.current(F))});else{const U=_.filter(te=>!te.read).length,F={id:r,url:e,name:A.serverInfo?.name||t,state:A.state,tools:A.tools,resources:A.resources,prompts:A.prompts,error:A.error??null,authUrl:A.authUrl??null,customHeaders:d,transportType:a,proxyConfig:n,serverInfo:A.serverInfo,capabilities:A.capabilities,notifications:_,unreadNotificationCount:U,markNotificationRead:k,markAllNotificationsRead:C,clearNotifications:R,callTool:A.callTool,readResource:A.readResource,listPrompts:A.listPrompts,getPrompt:A.getPrompt,authenticate:A.authenticate,retry:A.retry,clearStorage:A.clearStorage,disconnect:A.disconnect,client:A.client},H=M.current;(!H||H.state!==F.state||H.error!==F.error||H.authUrl!==F.authUrl||H.name!==F.name||H.tools.length!==F.tools.length||H.resources.length!==F.resources.length||H.prompts.length!==F.prompts.length||H.serverInfo!==F.serverInfo||H.capabilities!==F.capabilities||H.notifications.length!==F.notifications.length||H.unreadNotificationCount!==F.unreadNotificationCount||!H.client)&&(M.current=F,O.current(F))}},[e,t,a,n,d,r,A.state,A.tools,A.resources,A.prompts,A.error,A.authUrl,A.serverInfo,A.capabilities,A.client,_,k,C,R,A.callTool,A.readResource,A.listPrompts,A.getPrompt,A.authenticate,A.retry,A.clearStorage]),null}function tfe({children:e}){const[t,n]=E.useState([]),[a,r]=E.useState(!1),[i,s]=E.useState(!0),[c,u]=E.useState([]);E.useEffect(()=>{try{const y=localStorage.getItem("mcp-inspector-connections");if(y){const x=JSON.parse(y);Array.isArray(x)&&(u(x),n(x.map(k=>({id:k.id||k.url,url:k.url,name:k.name||"MCP Server",state:"discovering",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:k.proxyConfig?.customHeaders,transportType:k.transportType,proxyConfig:k.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}))))}const _=localStorage.getItem("mcp-inspector-auto-connect");_!==null&&s(_==="true")}catch(y){console.error("Failed to load connections from localStorage:",y)}finally{r(!0)}},[]),E.useEffect(()=>{a&&localStorage.setItem("mcp-inspector-connections",JSON.stringify(c))},[c,a]),E.useEffect(()=>{a&&localStorage.setItem("mcp-inspector-auto-connect",String(i))},[i,a]);const d=E.useCallback((y,_,x,k)=>{const C=c.find(A=>A.url===y),R=t.find(A=>A.url===y);if(C&&R){if(JSON.stringify(C.proxyConfig)!==JSON.stringify(x)&&x){u(O=>O.filter(M=>M.url!==y)),n(O=>O.filter(M=>M.url!==y)),setTimeout(()=>{const O={id:y,url:y,name:_||C.name||"MCP Server",proxyConfig:x,transportType:k||C.transportType};u(M=>[...M,O]),n(M=>[...M,{id:y,url:y,name:_||C.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:x?.customHeaders,transportType:k||C.transportType,proxyConfig:x,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},10);return}return}if(C&&!R){(x||k)&&u(A=>A.map(O=>O.url===y?{...O,proxyConfig:x||O.proxyConfig,transportType:k||O.transportType,name:_||O.name}:O)),n(A=>[...A,{id:C.id||y,url:y,name:_||C.name||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:x?.customHeaders||C.proxyConfig?.customHeaders,transportType:k||C.transportType,proxyConfig:x||C.proxyConfig,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}]);return}const I={id:y,url:y,name:_||"MCP Server",proxyConfig:x,transportType:k};u(A=>[...A,I]),n(A=>[...A,{id:y,url:y,name:_||"MCP Server",state:"connecting",tools:[],resources:[],prompts:[],error:null,authUrl:null,customHeaders:x?.customHeaders,transportType:k,proxyConfig:x,notifications:[],unreadNotificationCount:0,markNotificationRead:()=>{},markAllNotificationsRead:()=>{},clearNotifications:()=>{},callTool:async()=>{},readResource:async()=>{},listPrompts:async()=>{},getPrompt:async()=>{},authenticate:()=>{},retry:()=>{},clearStorage:()=>{},disconnect:()=>{},client:null}])},[c,t]),m=E.useCallback(y=>{const _=t.find(k=>k.id===y);_&&(console.log(`[McpContext] Cleaning up connection: ${y}`),_.disconnect&&(console.log(`[McpContext] Disconnecting from server: ${y}`),_.disconnect()),_.clearStorage&&(console.log(`[McpContext] Clearing OAuth storage for connection: ${y}`),_.clearStorage())),u(k=>k.filter(C=>C.id!==y)),n(k=>k.filter(C=>C.id!==y));const x=localStorage.getItem("mcp-inspector-connections");if(x)try{const C=JSON.parse(x).filter(R=>(R.id||R.url)!==y);localStorage.setItem("mcp-inspector-connections",JSON.stringify(C))}catch(k){console.error("Failed to update localStorage on remove:",k)}br.getInstance().capture(new Xde({serverId:y}))},[t]),h=E.useCallback((y,_)=>{u(x=>x.map(k=>k.id===y||k.url===y?{...k,..._}:k)),n(x=>x.map(k=>k.id===y?{...k,..._}:k))},[]),g=E.useCallback(y=>{n(_=>{const x=_.findIndex(R=>R.id===y.id);if(x===-1)return _;const k=_[x];if(k.state===y.state&&k.tools===y.tools&&k.resources===y.resources&&k.prompts===y.prompts&&k.error===y.error&&k.serverInfo===y.serverInfo&&k.client===y.client&&k.notifications===y.notifications&&k.unreadNotificationCount===y.unreadNotificationCount)return _;const C=[..._];return C[x]=y,C})},[]),v=E.useCallback(y=>{console.log("Connect requested for:",y)},[]),S=E.useCallback(y=>{console.log("Disconnect requested for:",y)},[]),w=E.useMemo(()=>({connections:t,addConnection:d,removeConnection:m,updateConnectionConfig:h,autoConnect:i,setAutoConnect:s,connectServer:v,disconnectServer:S,configLoaded:a}),[t,d,m,h,i,v,S,a]);return p.jsxs(O9.Provider,{value:w,children:[e,a&&i&&c.map(y=>{const _=`${y.id||y.url}-${y.proxyConfig?.proxyAddress?"proxy":"direct"}`;return console.warn("[McpContext] Rendering McpConnectionWrapper with key:",_,"proxyConfig:",y.proxyConfig),p.jsx(efe,{url:y.url,name:y.name,proxyConfig:y.proxyConfig,transportType:y.transportType,connectionId:y.id||y.url,onUpdate:g,onRemove:()=>m(y.id||y.url)},_)})]})}const nfe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rfe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),eU=e=>{const t=rfe(e);return t.charAt(0).toUpperCase()+t.slice(1)},D9=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),afe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var ife={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 ofe=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:i,iconNode:s,...c},u)=>E.createElement("svg",{ref:u,...ife,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:D9("lucide",r),...!i&&!afe(c)&&{"aria-hidden":"true"},...c},[...s.map(([d,m])=>E.createElement(d,m)),...Array.isArray(i)?i:[i]]));const Je=(e,t)=>{const n=E.forwardRef(({className:a,...r},i)=>E.createElement(ofe,{ref:i,iconNode:t,className:D9(`lucide-${nfe(eU(e))}`,`lucide-${e}`,a),...r}));return n.displayName=eU(e),n};const sfe=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],lfe=Je("arrow-down-to-line",sfe);const cfe=[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]],ufe=Je("arrow-up-from-line",cfe);const dfe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ffe=Je("arrow-up",dfe);const pfe=[["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"}]],WT=Je("bell",pfe);const mfe=[["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"}]],$9=Je("brush",mfe);const hfe=[["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"}]],gfe=Je("bug",hfe);const bfe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Xa=Je("check",bfe);const vfe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zl=Je("chevron-down",vfe);const yfe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wfe=Je("chevron-right",yfe);const Sfe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],KT=Je("chevron-left",Sfe);const Efe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xfe=Je("chevron-up",Efe);const _fe=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],kfe=Je("chevrons-up-down",_fe);const Tfe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],tU=Je("circle-minus",Tfe);const Nfe=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$u=Je("clock",Nfe);const Rfe=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],L9=Je("code",Rfe);const Cfe=[["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"}]],Afe=Je("cog",Cfe);const Ife=[["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"}]],Ofe=Je("command",Ife);const Dfe=[["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"}]],ua=Je("copy",Dfe);const $fe=[["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"}]],qv=Je("database",$fe);const Lfe=[["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"}]],ZT=Je("download",Lfe);const Mfe=[["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"}]],jfe=Je("ellipsis-vertical",Mfe);const Pfe=[["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"}]],nU=Je("external-link",Pfe);const Ufe=[["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"}]],M9=Je("eye-off",Ufe);const zfe=[["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"}]],ex=Je("eye",zfe);const Ffe=[["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"}]],Bfe=Je("file-code",Ffe);const Hfe=[["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"}]],Vfe=Je("file-image",Hfe);const Gfe=[["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"}]],YT=Je("file-text",Gfe);const Wfe=[["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"}]],Kfe=Je("file",Wfe);const Zfe=[["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"}]],Yfe=Je("folder-open",Zfe);const Xfe=[["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"}]],qfe=Je("globe",Xfe);const Jfe=[["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"}]],Qfe=Je("grip-vertical",Jfe);const epe=[["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"}]],Cb=Je("history",epe);const tpe=[["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"}]],j9=Je("key",tpe);const npe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Nl=Je("loader-circle",npe);const rpe=[["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"}]],ape=Je("maximize-2",rpe);const ipe=[["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"}]],XT=Je("maximize",ipe);const ope=[["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"}]],spe=Je("message-circle",ope);const lpe=[["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"}]],rp=Je("message-square",lpe);const cpe=[["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"}]],upe=Je("minimize",cpe);const dpe=[["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"}]],rU=Je("monitor",dpe);const fpe=[["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"}]],ppe=Je("moon",fpe);const mpe=[["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"}]],hpe=Je("picture-in-picture",mpe);const gpe=[["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"}]],P9=Je("play",gpe);const bpe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],U9=Je("plus",bpe);const vpe=[["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"}]],aU=Je("rotate-ccw",vpe);const ype=[["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"}]],qT=Je("save",ype);const wpe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Jv=Je("search",wpe);const Spe=[["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"}]],Epe=Je("send",Spe);const xpe=[["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"}]],_pe=Je("server",xpe);const kpe=[["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"}]],au=Je("settings",kpe);const Tpe=[["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"}]],Npe=Je("shield",Tpe);const Rpe=[["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"}]],Cpe=Je("square-pen",Rpe);const Ape=[["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"}]],Ipe=Je("sun-dim",Ape);const Ope=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],kS=Je("terminal",Ope);const Dpe=[["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"}]],Rl=Je("trash-2",Dpe);const $pe=[["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"}]],Lpe=Je("trash",$pe);const Mpe=[["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=Je("wrench",Mpe);const jpe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],td=Je("x",jpe);const Ppe=[["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"}]],ap=Je("zap",Ppe);function Upe(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 zpe=e=>{switch(e){case"success":return Hpe;case"info":return Gpe;case"warning":return Vpe;case"error":return Wpe;default:return null}},Fpe=Array(12).fill(0),Bpe=({visible:e,className:t})=>ue.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ue.createElement("div",{className:"sonner-spinner"},Fpe.map((n,a)=>ue.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),Hpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Vpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Gpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Wpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Kpe=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ue.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ue.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Zpe=()=>{const[e,t]=ue.useState(document.hidden);return ue.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let tx=1;class Ype{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:a,...r}=t,i=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:tx++,s=this.toasts.find(u=>u.id===i),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(u=>u.id===i?(this.publish({...u,...t,id:i,title:a}),{...u,...t,id:i,dismissible:c,title:a}):u):this.addToast({title:a,...r,dismissible:c,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(a=>a({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let a;n.loading!==void 0&&(a=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const r=Promise.resolve(t instanceof Function?t():t);let i=a!==void 0,s;const c=r.then(async d=>{if(s=["resolve",d],ue.isValidElement(d))i=!1,this.create({id:a,type:"default",message:d});else if(qpe(d)&&!d.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,g=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,S=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...S})}else if(d instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,g=typeof n.description=="function"?await n.description(d):n.description,S=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"error",description:g,...S})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(d):n.success,g=typeof n.description=="function"?await n.description(d):n.description,S=typeof h=="object"&&!ue.isValidElement(h)?h:{message:h};this.create({id:a,type:"success",description:g,...S})}}).catch(async d=>{if(s=["reject",d],n.error!==void 0){i=!1;const m=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description,v=typeof m=="object"&&!ue.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:h,...v})}}).finally(()=>{i&&(this.dismiss(a),a=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((d,m)=>c.then(()=>s[0]==="reject"?m(s[1]):d(s[1])).catch(m));return typeof a!="string"&&typeof a!="number"?{unwrap:u}:Object.assign(a,{unwrap:u})},this.custom=(t,n)=>{const a=n?.id||tx++;return this.create({jsx:t(a),id:a,...n}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const sa=new Ype,Xpe=(e,t)=>{const n=t?.id||tx++;return sa.addToast({title:e,...t,id:n}),n},qpe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Jpe=Xpe,Qpe=()=>sa.toasts,eme=()=>sa.getActiveToasts(),bn=Object.assign(Jpe,{success:sa.success,info:sa.info,warning:sa.warning,error:sa.error,custom:sa.custom,message:sa.message,promise:sa.promise,dismiss:sa.dismiss,loading:sa.loading},{getHistory:Qpe,getToasts:eme});Upe("[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 yg(e){return e.label!==void 0}const tme=3,nme="24px",rme="16px",iU=4e3,ame=356,ime=14,ome=45,sme=200;function Oi(...e){return e.filter(Boolean).join(" ")}function lme(e){const[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}const cme=e=>{var t,n,a,r,i,s,c,u,d;const{invert:m,toast:h,unstyled:g,interacting:v,setHeights:S,visibleToasts:w,heights:y,index:_,toasts:x,expanded:k,removeToast:C,defaultRichColors:R,closeButton:I,style:A,cancelButtonStyle:O,actionButtonStyle:M,className:U="",descriptionClassName:F="",duration:H,position:te,gap:q,expandByDefault:ie,classNames:G,icons:Q,closeButtonAriaLabel:W="Close toast"}=e,[oe,ne]=ue.useState(null),[P,B]=ue.useState(null),[z,$]=ue.useState(!1),[j,V]=ue.useState(!1),[K,X]=ue.useState(!1),[se,le]=ue.useState(!1),[J,ee]=ue.useState(!1),[ce,re]=ue.useState(0),[ye,Te]=ue.useState(0),He=ue.useRef(h.duration||H||iU),_e=ue.useRef(null),Se=ue.useRef(null),Ue=_===0,pe=_+1<=w,$e=h.type,Be=h.dismissible!==!1,Ee=h.className||"",ot=h.descriptionClassName||"",at=ue.useMemo(()=>y.findIndex(qe=>qe.toastId===h.id)||0,[y,h.id]),pt=ue.useMemo(()=>{var qe;return(qe=h.closeButton)!=null?qe:I},[h.closeButton,I]),Pe=ue.useMemo(()=>h.duration||H||iU,[h.duration,H]),Le=ue.useRef(0),Qe=ue.useRef(0),en=ue.useRef(0),ke=ue.useRef(null),[Ie,ze]=te.split("-"),gt=ue.useMemo(()=>y.reduce((qe,Yt,xn)=>xn>=at?qe:qe+Yt.height,0),[y,at]),nt=Zpe(),et=h.invert||m,Ct=$e==="loading";Qe.current=ue.useMemo(()=>at*q+gt,[at,gt]),ue.useEffect(()=>{He.current=Pe},[Pe]),ue.useEffect(()=>{$(!0)},[]),ue.useEffect(()=>{const qe=Se.current;if(qe){const Yt=qe.getBoundingClientRect().height;return Te(Yt),S(xn=>[{toastId:h.id,height:Yt,position:h.position},...xn]),()=>S(xn=>xn.filter(_n=>_n.toastId!==h.id))}},[S,h.id]),ue.useLayoutEffect(()=>{if(!z)return;const qe=Se.current,Yt=qe.style.height;qe.style.height="auto";const xn=qe.getBoundingClientRect().height;qe.style.height=Yt,Te(xn),S(_n=>_n.find(an=>an.toastId===h.id)?_n.map(an=>an.toastId===h.id?{...an,height:xn}:an):[{toastId:h.id,height:xn,position:h.position},..._n])},[z,h.title,h.description,S,h.id,h.jsx,h.action,h.cancel]);const Lt=ue.useCallback(()=>{V(!0),re(Qe.current),S(qe=>qe.filter(Yt=>Yt.toastId!==h.id)),setTimeout(()=>{C(h)},sme)},[h,C,S,Qe]);ue.useEffect(()=>{if(h.promise&&$e==="loading"||h.duration===1/0||h.type==="loading")return;let qe;return k||v||nt?(()=>{if(en.current<Le.current){const _n=new Date().getTime()-Le.current;He.current=He.current-_n}en.current=new Date().getTime()})():(()=>{He.current!==1/0&&(Le.current=new Date().getTime(),qe=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),Lt()},He.current))})(),()=>clearTimeout(qe)},[k,v,h,$e,nt,Lt]),ue.useEffect(()=>{h.delete&&(Lt(),h.onDismiss==null||h.onDismiss.call(h,h))},[Lt,h.delete]);function En(){var qe;if(Q?.loading){var Yt;return ue.createElement("div",{className:Oi(G?.loader,h==null||(Yt=h.classNames)==null?void 0:Yt.loader,"sonner-loader"),"data-visible":$e==="loading"},Q.loading)}return ue.createElement(Bpe,{className:Oi(G?.loader,h==null||(qe=h.classNames)==null?void 0:qe.loader),visible:$e==="loading"})}const _t=h.icon||Q?.[$e]||zpe($e);var Zt,Ft;return ue.createElement("li",{tabIndex:0,ref:Se,className:Oi(U,Ee,G?.toast,h==null||(t=h.classNames)==null?void 0:t.toast,G?.default,G?.[$e],h==null||(n=h.classNames)==null?void 0:n[$e]),"data-sonner-toast":"","data-rich-colors":(Zt=h.richColors)!=null?Zt:R,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":z,"data-promise":!!h.promise,"data-swiped":J,"data-removed":j,"data-visible":pe,"data-y-position":Ie,"data-x-position":ze,"data-index":_,"data-front":Ue,"data-swiping":K,"data-dismissible":Be,"data-type":$e,"data-invert":et,"data-swipe-out":se,"data-swipe-direction":P,"data-expanded":!!(k||ie&&z),"data-testid":h.testId,style:{"--index":_,"--toasts-before":_,"--z-index":x.length-_,"--offset":`${j?ce:Qe.current}px`,"--initial-height":ie?"auto":`${ye}px`,...A,...h.style},onDragEnd:()=>{X(!1),ne(null),ke.current=null},onPointerDown:qe=>{qe.button!==2&&(Ct||!Be||(_e.current=new Date,re(Qe.current),qe.target.setPointerCapture(qe.pointerId),qe.target.tagName!=="BUTTON"&&(X(!0),ke.current={x:qe.clientX,y:qe.clientY})))},onPointerUp:()=>{var qe,Yt,xn;if(se||!Be)return;ke.current=null;const _n=Number(((qe=Se.current)==null?void 0:qe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Fr=Number(((Yt=Se.current)==null?void 0:Yt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),an=new Date().getTime()-((xn=_e.current)==null?void 0:xn.getTime()),Gn=oe==="x"?_n:Fr,Wn=Math.abs(Gn)/an;if(Math.abs(Gn)>=ome||Wn>.11){re(Qe.current),h.onDismiss==null||h.onDismiss.call(h,h),B(oe==="x"?_n>0?"right":"left":Fr>0?"down":"up"),Lt(),le(!0);return}else{var fn,on;(fn=Se.current)==null||fn.style.setProperty("--swipe-amount-x","0px"),(on=Se.current)==null||on.style.setProperty("--swipe-amount-y","0px")}ee(!1),X(!1),ne(null)},onPointerMove:qe=>{var Yt,xn,_n;if(!ke.current||!Be||((Yt=window.getSelection())==null?void 0:Yt.toString().length)>0)return;const an=qe.clientY-ke.current.y,Gn=qe.clientX-ke.current.x;var Wn;const fn=(Wn=e.swipeDirections)!=null?Wn:lme(te);!oe&&(Math.abs(Gn)>1||Math.abs(an)>1)&&ne(Math.abs(Gn)>Math.abs(an)?"x":"y");let on={x:0,y:0};const Jr=Gt=>1/(1.5+Math.abs(Gt)/20);if(oe==="y"){if(fn.includes("top")||fn.includes("bottom"))if(fn.includes("top")&&an<0||fn.includes("bottom")&&an>0)on.y=an;else{const Gt=an*Jr(an);on.y=Math.abs(Gt)<Math.abs(an)?Gt:an}}else if(oe==="x"&&(fn.includes("left")||fn.includes("right")))if(fn.includes("left")&&Gn<0||fn.includes("right")&&Gn>0)on.x=Gn;else{const Gt=Gn*Jr(Gn);on.x=Math.abs(Gt)<Math.abs(Gn)?Gt:Gn}(Math.abs(on.x)>0||Math.abs(on.y)>0)&&ee(!0),(xn=Se.current)==null||xn.style.setProperty("--swipe-amount-x",`${on.x}px`),(_n=Se.current)==null||_n.style.setProperty("--swipe-amount-y",`${on.y}px`)}},pt&&!h.jsx&&$e!=="loading"?ue.createElement("button",{"aria-label":W,"data-disabled":Ct,"data-close-button":!0,onClick:Ct||!Be?()=>{}:()=>{Lt(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Oi(G?.closeButton,h==null||(a=h.classNames)==null?void 0:a.closeButton)},(Ft=Q?.close)!=null?Ft:Kpe):null,($e||h.icon||h.promise)&&h.icon!==null&&(Q?.[$e]!==null||h.icon)?ue.createElement("div",{"data-icon":"",className:Oi(G?.icon,h==null||(r=h.classNames)==null?void 0:r.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||En():null,h.type!=="loading"?_t:null):null,ue.createElement("div",{"data-content":"",className:Oi(G?.content,h==null||(i=h.classNames)==null?void 0:i.content)},ue.createElement("div",{"data-title":"",className:Oi(G?.title,h==null||(s=h.classNames)==null?void 0:s.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?ue.createElement("div",{"data-description":"",className:Oi(F,ot,G?.description,h==null||(c=h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),ue.isValidElement(h.cancel)?h.cancel:h.cancel&&yg(h.cancel)?ue.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:qe=>{yg(h.cancel)&&Be&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,qe),Lt())},className:Oi(G?.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,ue.isValidElement(h.action)?h.action:h.action&&yg(h.action)?ue.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||M,onClick:qe=>{yg(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,qe),!qe.defaultPrevented&&Lt())},className:Oi(G?.actionButton,h==null||(d=h.classNames)==null?void 0:d.actionButton)},h.action.label):null)};function oU(){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 ume(e,t){const n={};return[e,t].forEach((a,r)=>{const i=r===1,s=i?"--mobile-offset":"--offset",c=i?rme:nme;function u(d){["top","right","bottom","left"].forEach(m=>{n[`${s}-${m}`]=typeof d=="number"?`${d}px`:d})}typeof a=="number"||typeof a=="string"?u(a):typeof a=="object"?["top","right","bottom","left"].forEach(d=>{a[d]===void 0?n[`${s}-${d}`]=c:n[`${s}-${d}`]=typeof a[d]=="number"?`${a[d]}px`:a[d]}):u(c)}),n}const dme=ue.forwardRef(function(t,n){const{id:a,invert:r,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:c,closeButton:u,className:d,offset:m,mobileOffset:h,theme:g="light",richColors:v,duration:S,style:w,visibleToasts:y=tme,toastOptions:_,dir:x=oU(),gap:k=ime,icons:C,containerAriaLabel:R="Notifications"}=t,[I,A]=ue.useState([]),O=ue.useMemo(()=>a?I.filter(z=>z.toasterId===a):I.filter(z=>!z.toasterId),[I,a]),M=ue.useMemo(()=>Array.from(new Set([i].concat(O.filter(z=>z.position).map(z=>z.position)))),[O,i]),[U,F]=ue.useState([]),[H,te]=ue.useState(!1),[q,ie]=ue.useState(!1),[G,Q]=ue.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=ue.useRef(null),oe=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),ne=ue.useRef(null),P=ue.useRef(!1),B=ue.useCallback(z=>{A($=>{var j;return(j=$.find(V=>V.id===z.id))!=null&&j.delete||sa.dismiss(z.id),$.filter(({id:V})=>V!==z.id)})},[]);return ue.useEffect(()=>sa.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{A($=>$.map(j=>j.id===z.id?{...j,delete:!0}:j))});return}setTimeout(()=>{wH.flushSync(()=>{A($=>{const j=$.findIndex(V=>V.id===z.id);return j!==-1?[...$.slice(0,j),{...$[j],...z},...$.slice(j+1)]:[z,...$]})})})}),[I]),ue.useEffect(()=>{if(g!=="system"){Q(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Q("dark"):Q("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:$})=>{Q($?"dark":"light")})}catch{z.addListener(({matches:j})=>{try{Q(j?"dark":"light")}catch(V){console.error(V)}})}},[g]),ue.useEffect(()=>{I.length<=1&&te(!1)},[I]),ue.useEffect(()=>{const z=$=>{var j;if(s.every(X=>$[X]||$.code===X)){var K;te(!0),(K=W.current)==null||K.focus()}$.code==="Escape"&&(document.activeElement===W.current||(j=W.current)!=null&&j.contains(document.activeElement))&&te(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),ue.useEffect(()=>{if(W.current)return()=>{ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null,P.current=!1)}},[W.current]),ue.createElement("section",{ref:n,"aria-label":`${R} ${oe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((z,$)=>{var j;const[V,K]=z.split("-");return O.length?ue.createElement("ol",{key:z,dir:x==="auto"?oU():x,tabIndex:-1,ref:W,className:d,"data-sonner-toaster":!0,"data-sonner-theme":G,"data-y-position":V,"data-x-position":K,style:{"--front-toast-height":`${((j=U[0])==null?void 0:j.height)||0}px`,"--width":`${ame}px`,"--gap":`${k}px`,...w,...ume(m,h)},onBlur:X=>{P.current&&!X.currentTarget.contains(X.relatedTarget)&&(P.current=!1,ne.current&&(ne.current.focus({preventScroll:!0}),ne.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||P.current||(P.current=!0,ne.current=X.relatedTarget)},onMouseEnter:()=>te(!0),onMouseMove:()=>te(!0),onMouseLeave:()=>{q||te(!1)},onDragEnd:()=>te(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ie(!0)},onPointerUp:()=>ie(!1)},O.filter(X=>!X.position&&$===0||X.position===z).map((X,se)=>{var le,J;return ue.createElement(cme,{key:X.id,icons:C,index:se,toast:X,defaultRichColors:v,duration:(le=_?.duration)!=null?le:S,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:r,visibleToasts:y,closeButton:(J=_?.closeButton)!=null?J:u,interacting:q,position:z,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,closeButtonAriaLabel:_?.closeButtonAriaLabel,removeToast:B,toasts:O.filter(ee=>ee.position==X.position),heights:U.filter(ee=>ee.position==X.position),setHeights:F,expandByDefault:c,gap:k,expanded:H,swipeDirections:t.swipeDirections})})):null}))});var Qv="Dialog",[z9]=_i(Qv),[fme,ki]=z9(Qv),F9=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:r,onOpenChange:i,modal:s=!0}=e,c=E.useRef(null),u=E.useRef(null),[d,m]=ko({prop:a,defaultProp:r??!1,onChange:i,caller:Qv});return p.jsx(fme,{scope:t,triggerRef:c,contentRef:u,contentId:Cr(),titleId:Cr(),descriptionId:Cr(),open:d,onOpenChange:m,onOpenToggle:E.useCallback(()=>m(h=>!h),[m]),modal:s,children:n})};F9.displayName=Qv;var B9="DialogTrigger",H9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(B9,n),i=Vt(t,r.triggerRef);return p.jsx(yt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":eN(r.open),...a,ref:i,onClick:Ve(e.onClick,r.onOpenToggle)})});H9.displayName=B9;var JT="DialogPortal",[pme,V9]=z9(JT,{forceMount:void 0}),G9=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:r}=e,i=ki(JT,t);return p.jsx(pme,{scope:t,forceMount:n,children:E.Children.map(a,s=>p.jsx(Da,{present:n||i.open,children:p.jsx(ed,{asChild:!0,container:r,children:s})}))})};G9.displayName=JT;var Ab="DialogOverlay",W9=E.forwardRef((e,t)=>{const n=V9(Ab,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,i=ki(Ab,e.__scopeDialog);return i.modal?p.jsx(Da,{present:a||i.open,children:p.jsx(hme,{...r,ref:t})}):null});W9.displayName=Ab;var mme=kl("DialogOverlay.RemoveScroll"),hme=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(Ab,n);return p.jsx(Hp,{as:mme,allowPinchZoom:!0,shards:[r.contentRef],children:p.jsx(yt.div,{"data-state":eN(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Al="DialogContent",K9=E.forwardRef((e,t)=>{const n=V9(Al,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,i=ki(Al,e.__scopeDialog);return p.jsx(Da,{present:a||i.open,children:i.modal?p.jsx(gme,{...r,ref:t}):p.jsx(bme,{...r,ref:t})})});K9.displayName=Al;var gme=E.forwardRef((e,t)=>{const n=ki(Al,e.__scopeDialog),a=E.useRef(null),r=Vt(t,n.contentRef,a);return E.useEffect(()=>{const i=a.current;if(i)return Fv(i)},[]),p.jsx(Z9,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ve(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ve(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&i.preventDefault()}),onFocusOutside:Ve(e.onFocusOutside,i=>i.preventDefault())})}),bme=E.forwardRef((e,t)=>{const n=ki(Al,e.__scopeDialog),a=E.useRef(!1),r=E.useRef(!1);return p.jsx(Z9,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(a.current||n.triggerRef.current?.focus(),i.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(a.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),Z9=E.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:i,...s}=e,c=ki(Al,n),u=E.useRef(null),d=Vt(t,u);return Dv(),p.jsxs(p.Fragment,{children:[p.jsx(Up,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:i,children:p.jsx(qu,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":eN(c.open),...s,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(vme,{titleId:c.titleId}),p.jsx(wme,{contentRef:u,descriptionId:c.descriptionId})]})]})}),QT="DialogTitle",Y9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(QT,n);return p.jsx(yt.h2,{id:r.titleId,...a,ref:t})});Y9.displayName=QT;var X9="DialogDescription",q9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(X9,n);return p.jsx(yt.p,{id:r.descriptionId,...a,ref:t})});q9.displayName=X9;var J9="DialogClose",Q9=E.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=ki(J9,n);return p.jsx(yt.button,{type:"button",...a,ref:t,onClick:Ve(e.onClick,()=>r.onOpenChange(!1))})});Q9.displayName=J9;function eN(e){return e?"open":"closed"}var eG="DialogTitleWarning",[P_e,tG]=cse(eG,{contentName:Al,titleName:QT,docsSlug:"dialog"}),vme=({titleId:e})=>{const t=tG(eG),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
103
103
 
104
104
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
105
105
 
@@ -1666,7 +1666,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1666
1666
  <\/script>
1667
1667
  </body>
1668
1668
  </html>`,oK=1,m4=2,sK=3,h4=4,lK=5,g4=Symbol.for("quilt.threads.serialize"),dxe=Symbol.for("quilt.threads.transferable");class fxe extends AbortController{constructor(...t){super();const n=t.find(a=>a.aborted);if(n)this.abort(n.reason);else{const a=i=>this.abort(i.target.reason),r={signal:this.signal};for(const i of t)i.addEventListener("abort",a,r)}}}class b4 extends Error{constructor(){super("You attempted to call a function on a closed thread.")}}let pxe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function cK(e=21){let t="",n=crypto.getRandomValues(new Uint8Array(e));for(let a=0;a<e;a++)t+=pxe[63&n[a]];return t}var xf,zc,_f,qg,r_,uK;class mxe{constructor(){ui(this,r_),ui(this,xf,new Map),ui(this,zc,new Map),ui(this,_f,new Map),ui(this,qg,new WeakMap)}get(t){return Ln(this,zc).get(t)}release(t){const n=Ln(this,zc).get(t);return n&&(Ln(this,zc).delete(t),Ln(this,xf).delete(n)),!!n}serialize(t){let n=Ln(this,xf).get(t);return n==null&&(n=cK(),Ln(this,xf).set(t,n),Ln(this,zc).set(n,t)),n}deserialize(t,n){var a,r;let i=(a=Ln(this,_f).get(t))==null?void 0:a.deref();return i||(i=(...s)=>{if(!Ln(this,_f).has(t))throw new Error("You attempted to call a function that was already revoked.");return n.call((c,u,d)=>{n.messages.send([sK,c,t,u],d)},s)},(r=Tr(this,r_,uK).call(this,n))==null||r.register(i,t),Ln(this,_f).set(t,new WeakRef(i)),i)}}xf=new WeakMap,zc=new WeakMap,_f=new WeakMap,qg=new WeakMap,r_=new WeakSet,uK=function(e){let t=Ln(this,qg).get(e);if(!(typeof FinalizationRegistry>"u"))return t||(t=new FinalizationRegistry(n=>{e.messages.send([lK,n])}),Ln(this,qg).set(e,t)),t};function hxe(e){return e!=null&&(Symbol.asyncIterator in e||Symbol.iterator in e)&&typeof e.next=="function"}function v4(e){if(e==null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t==null||t===Object.prototype}const eE="_@f",y4="_@i";var Vf,Gf,Va,Jg,ps;class gxe{constructor(t){ui(this,Va),ui(this,Vf),ui(this,Gf),t_(this,Vf,t?.serialize),t_(this,Gf,t?.deserialize)}serialize(t,n,a){return Tr(this,Va,Jg).call(this,t,n,a)}deserialize(t,n){return Tr(this,Va,ps).call(this,t,n)}}Vf=new WeakMap,Gf=new WeakMap,Va=new WeakSet,Jg=function(e,t,n,a=new Map,r=!1){if(e==null)return e;if(a.has(e))return a.get(e);if(a.set(e,void 0),typeof e=="object"){if(Ln(this,Vf)&&!r){const c=Ln(this,Vf).call(this,e,u=>Tr(this,Va,Jg).call(this,u,t,n,a,!0),t,n);if(c!==void 0)return a.set(e,c),c}if(e[dxe])return n?.push(e),a.set(e,e),e;const i=c=>Tr(this,Va,Jg).call(this,c,t,n,a);if(typeof e[g4]=="function"){const c=e[g4]({serialize:i});return a.set(e,c),c}if(Array.isArray(e)){const c=e.map(u=>i(u));return a.set(e,c),c}if(e instanceof Map){const c=[...e.entries()].map(([d,m])=>[i(d),i(m)]),u=new Map(c);return a.set(e,u),u}if(e instanceof Set){const c=[...e].map(d=>i(d)),u=new Set(c);return a.set(e,u),u}const s=hxe(e);if(v4(e)||s){const c={};for(const u of Object.keys(e))c[u]=i(e[u]);return s&&(c.next??(c.next=i(e.next.bind(e))),c.return??(c.return=i(e.return.bind(e))),c.throw??(c.throw=i(e.throw.bind(e))),c[y4]=!0),a.set(e,c),c}}if(typeof e=="function"){const i=t.functions.serialize(e,t,n),s={[eE]:i};return a.set(e,s),s}return a.set(e,e),e},ps=function(e,t,n=!1){if(e==null)return e;if(typeof e=="object"){if(Ln(this,Gf)&&!n){const r=Ln(this,Gf).call(this,e,i=>Tr(this,Va,ps).call(this,i,t,!0),t);if(r!==void 0)return r}if(e==null)return e;if(Array.isArray(e))return e.map(r=>Tr(this,Va,ps).call(this,r,t));if(e instanceof Map)return new Map([...e].map(([r,i])=>[Tr(this,Va,ps).call(this,r,t),Tr(this,Va,ps).call(this,i,t)]));if(e instanceof Set)return new Set([...e].map(r=>Tr(this,Va,ps).call(this,r,t)));if(eE in e)return t.functions.deserialize(e[eE],t);if(!v4(e))return e;const a={};for(const r of Object.keys(e))r===y4?a[Symbol.asyncIterator]=()=>a:a[r]=Tr(this,Va,ps).call(this,e[r],t);return a}return e};var Fc,gl,ms,a_,dK,i_,fK;class bxe{constructor(t,{imports:n,exports:a,functions:r=new mxe,serialization:i=new gxe,signal:s}={}){ui(this,ms),ui(this,Fc),ui(this,gl,new Map);var c,u,d,m;this.messages=t,t_(this,Fc,s?new fxe(s):new AbortController),this.exports=a??{},this.imports=vxe(Tr(this,ms,dK).bind(this),n),this.functions=r,this.serialization=i,(u=(c=this.functions).start)==null||u.call(c,this),(m=(d=this.serialization).start)==null||m.call(d,this),this.signal.addEventListener("abort",()=>{for(const h of Ln(this,gl).keys())Tr(this,ms,i_).call(this,h,void 0,new b4);Ln(this,gl).clear()},{once:!0}),t.listen(async h=>{if(!(Array.isArray(h)&&typeof h[0]=="number"))return;const g=h;switch(g[0]){case oK:{const[,v,S,w]=g,y=this.exports[S]??(()=>{throw new Error(`No '${S}' method is exported from this thread`)});await Tr(this,ms,a_).call(this,y,w,(_,x,k)=>{this.messages.send([m4,v,_,x],k)});break}case sK:{const[,v,S,w]=g,y=this.functions.get(S,this)??yxe;await Tr(this,ms,a_).call(this,y,w,(_,x,k)=>{this.messages.send([h4,v,_,x],k)});break}case m4:case h4:{Tr(this,ms,i_).call(this,...g.slice(1));break}case lK:{const v=g[1];this.functions.release(v,this);break}}},{signal:this.signal})}get signal(){return Ln(this,Fc).signal}get closed(){return Ln(this,Fc).signal.aborted}close(){Ln(this,Fc).abort()}call(t,n){if(this.closed)return Promise.reject(new b4);const a=[],r=this.serialization.serialize(n,this,a),i=cK(),s=Tr(this,ms,fK).call(this,i);return t(i,r,a),s}}Fc=new WeakMap,gl=new WeakMap,ms=new WeakSet,a_=async function(e,t,n){try{const a=this.functions.call?await this.functions.call(e,t,this):await e(...this.serialization.deserialize(t,this)),r=[],i=this.serialization.serialize(a,this,r);n(i,void 0,r)}catch(a){n(void 0,this.serialization.serialize(a,this))}},dK=function(e){return(...t)=>{try{if(typeof e!="string"&&typeof e!="number")throw new Error(`Can’t call a symbol method on a thread: ${e.toString()}`);return this.call((n,a,r)=>{this.messages.send([oK,n,e,a],r)},t)}catch(n){return Promise.reject(n)}}},i_=function(...e){const t=e[0],n=Ln(this,gl).get(t);n&&(n(...e),Ln(this,gl).delete(t))},fK=function(e){const t=new Promise((n,a)=>{Ln(this,gl).set(e,(r,i,s)=>{s==null?n(this.serialization.deserialize(i,this)):a(this.serialization.deserialize(s,this))})});return Object.defineProperty(t,Symbol.asyncIterator,{async*value(){const n=await t;Object.defineProperty(n,Symbol.asyncIterator,{value:()=>n}),yield*n}}),t};function vxe(e,t){let n;if(t==null){if(typeof Proxy!="function")throw new Error("You must pass an array of callable methods in environments without Proxies.");const a=new Map;n=new Proxy({},{get(r,i){if(a.has(i))return a.get(i);const s=e(i);return a.set(i,s),s}})}else{n={};for(const a of t)Object.defineProperty(n,a,{value:e(a),writable:!1,configurable:!0,enumerable:!0})}return n}function yxe(){throw new Error("You attempted to call a function that is not stored. It may have already been released.")}const wxe="quilt.threads.ping",w4="quilt.threads.pong";function Sxe(e,{targetOrigin:t="*"}={}){let n=!1;const a=function(i,s){e.postMessage(i,t,s)},r=new Promise(i=>{const s=new AbortController;globalThis.window.addEventListener("message",c=>{c.source===e&&c.data===w4&&(n=!0,s.abort(),i())},{signal:s.signal}),s.signal.addEventListener("abort",()=>i(),{once:!0}),a(wxe)});return{send(i,s){return n?a(i,s):r.then(()=>{if(n)return a(i,s)})},listen(i,{signal:s}){self.addEventListener("message",c=>{c.source===e&&c.data!==w4&&i(c.data)},{signal:s})}}}class Exe extends bxe{constructor(t,{targetOrigin:n="*",...a}={}){super(Sxe(t.contentWindow,{targetOrigin:n}),a),this.iframe=t}}const pK=ue.forwardRef(({content:e,children:t,...n},a)=>p.jsx("span",{ref:a,...n,children:e||t}));pK.displayName="UIText";const mK=ue.forwardRef(({label:e,onPress:t,onClick:n,children:a,...r},i)=>p.jsx("button",{ref:i,onClick:s=>{t&&t(),n&&n(s)},style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},...r,children:e||a}));mK.displayName="UIButton";const hK=ue.forwardRef(({direction:e="vertical",spacing:t="8",align:n="stretch",justify:a="flex-start",children:r,...i},s)=>p.jsx("div",{ref:s,style:{display:"flex",flexDirection:e==="horizontal"?"row":"column",gap:`${t}px`,alignItems:n,justifyContent:a},...i,children:r}));hK.displayName="UIStack";const gK=ue.forwardRef(({src:e,alt:t,width:n,height:a,children:r,...i},s)=>p.jsx("img",{ref:s,src:e,alt:t,width:n,height:a,style:{maxWidth:"100%",height:"auto",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},...i}));gK.displayName="UIImage";const gO={name:"basic",elements:[{tagName:"ui-text",component:pK,propMapping:{content:"content"},eventMapping:{}},{tagName:"ui-button",component:mK,propMapping:{label:"label"},eventMapping:{press:"onPress"}},{tagName:"ui-stack",component:hK,propMapping:{direction:"direction",spacing:"spacing",align:"align",justify:"justify"},eventMapping:{}},{tagName:"ui-image",component:gK,propMapping:{src:"src",alt:"alt",width:"width",height:"height"},eventMapping:{}}]},xxe=({receiver:e})=>{const t=E.useRef(null);return E.useEffect(()=>{if(t.current)return e.connect(t.current),()=>{e.disconnect()}},[e]),p.jsx("div",{ref:t,"data-testid":"standard-dom-renderer-container"})},_xe=({resource:e,library:t,remoteElements:n=[],onUIAction:a})=>{const r=E.useRef(null),i=E.useRef(null),[s,c]=E.useState(null),u=E.useMemo(()=>(e.mimeType||"").includes("framework=react")?"react":"webcomponents",[e.mimeType]),d=`${t?.name}-${u}`,{receiver:m,components:h}=E.useMemo(()=>{switch(u){case"react":{const v=new txe,S=t||gO,w=new Map;return S&&S.elements.forEach(y=>{const _=sxe(y.component);w.set(y.tagName,_)}),{receiver:v,components:w}}case"webcomponents":default:return{receiver:new nxe,components:null}}},[e,t,n]);E.useEffect(()=>{function v(S){var w;if(r.current&&S.source===r.current.contentWindow){const y=S.data;if(!y)return;(w=a?.(y))==null||w.catch(_=>{console.error("Error handling UI action result in RemoteDOMResourceRenderer:",_)})}}return window.addEventListener("message",v),()=>window.removeEventListener("message",v)},[a]),E.useEffect(()=>{const v=i.current;return i.current=null,()=>{v?.close()}},[d]);const g=()=>{const v=r.current;if(!v||i.current)return;const S=new Exe(v);i.current=S;const{code:w,error:y}=WEe(e);if(y){c(y);return}if(w&&m!=null&&m.connection){const _={code:w,remoteElements:n,useReactRenderer:u==="react",componentLibrary:t?.name};S.imports.render(_,m.connection).catch(x=>console.error("Error calling remote render:",x))}};return s?p.jsx("p",{className:"text-red-500",children:s}):p.jsxs(p.Fragment,{children:[p.jsx("iframe",{ref:r,srcDoc:uxe,sandbox:"allow-scripts",style:{display:"none"},title:"Remote DOM Sandbox",onLoad:g},d),u==="react"&&h?p.jsx(cxe,{receiver:m,components:h}):p.jsx(xxe,{receiver:m})]})};function kxe(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 bO=e=>{const{resource:t,onUIAction:n,supportedContentTypes:a,htmlProps:r,remoteDomProps:i}=e,s=kxe(t);if(a&&s&&!a.includes(s))return p.jsxs("p",{className:"text-red-500",children:["Unsupported content type: ",s,"."]});switch(s){case"rawHtml":case"externalUrl":return p.jsx(eK,{resource:t,onUIAction:n,...r});case"remoteDom":return p.jsx(_xe,{resource:t,onUIAction:n,library:i?.library||gO,...i});default:return p.jsx("p",{className:"text-red-500",children:"Unsupported resource type."})}};bO.displayName="UIResourceRenderer";const Txe={tagName:"ui-button",remoteAttributes:["label"],remoteEvents:["click","press"]},Nxe={tagName:"ui-text",remoteAttributes:["content"]},Rxe={tagName:"ui-stack",remoteAttributes:["direction","spacing","align","justify"]},Cxe={tagName:"ui-image",remoteAttributes:["src","alt","width","height"]},Axe=E.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://")?p.jsx("div",{className:"my-4 p-0 border h-[350px] rounded-2xl border-zinc-200 overflow-hidden bg-card",children:p.jsx(bO,{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 S4({toolName:e,toolArgs:t,result:n,serverId:a,readResource:r}){const[i,s]=E.useState(null),c=E.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=E.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]),d=E.useMemo(()=>u&&c.content.find(g=>g.type==="resource"&&g.resource?.uri?.startsWith("ui://")&&g.resource?.mimeType==="text/html+skybridge")?.resource||null,[u,c]);if(E.useEffect(()=>{(()=>{d&&s(d)})()},[d]),u&&i&&a&&r)return p.jsx(dO,{componentUrl:i.uri,toolName:e,toolArgs:t,toolResult:c,serverId:a,readResource:r,noWrapper:!0,className:"my-4",showConsole:!1});if(u&&!i)return p.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:p.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?p.jsx(p.Fragment,{children:m.map(h=>p.jsx(Axe,{resource:h},`${e}-mcp-ui-${h.uri}`))}):null}function Ixe({content:e,timestamp:t}){return!e||e.length===0?null:p.jsx("div",{className:"flex items-start gap-3 justify-end group/user-message",children:p.jsxs("div",{className:"flex-1 min-w-0 flex flex-col items-end",children:[p.jsx("div",{className:"bg-zinc-200 dark:bg-zinc-800 text-primary rounded-3xl px-4 py-2 max-w-[80%] break-words",children:p.jsx("p",{className:"text-base leading-7 font-sans text-start break-words",children:e})}),t&&p.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:new Date(t).toLocaleTimeString()})]})})}const Oxe=E.memo(({messages:e,isLoading:t,serverId:n,readResource:a})=>{const r=E.useRef(null);E.useEffect(()=>{e.length>0&&r.current&&r.current.scrollIntoView({behavior:t?"auto":"smooth",block:"start"})},[e.length,t]);const i=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})(),s=c=>{if(!t)return!1;const u=e[e.length-1];return c.id===u.id&&u.role==="assistant"};return p.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(d=>typeof d=="string"?d:d.text||JSON.stringify(d)).join(""):JSON.stringify(c.content);return c.role==="user"?p.jsx(Ixe,{content:u,timestamp:c.timestamp},c.id):c.role==="assistant"?p.jsx("div",{className:"space-y-4",children:c.parts&&c.parts.length>0?c.parts.map((d,m)=>{const h=d.type==="text"?`${c.id}-text-${m}-${d.text?.slice(0,20)}`:`${c.id}-tool-${d.toolInvocation?.toolName}-${m}`;return d.type==="text"?p.jsx(a4,{content:d.text||"",timestamp:m===c.parts.length-1?c.timestamp:void 0,_isStreaming:s(c)},h):d.type==="tool-invocation"&&d.toolInvocation?p.jsxs("div",{children:[p.jsx(i4,{toolName:d.toolInvocation.toolName,args:d.toolInvocation.args,result:d.toolInvocation.result,state:d.toolInvocation.result?"result":"call"}),d.toolInvocation.result&&p.jsx(S4,{toolName:d.toolInvocation.toolName,toolArgs:d.toolInvocation.args,result:d.toolInvocation.result,serverId:n,readResource:a})]},h):null}):p.jsxs(p.Fragment,{children:[p.jsx(a4,{content:u,timestamp:c.timestamp,_isStreaming:s(c)}),c.toolCalls&&c.toolCalls.length>0&&p.jsx("div",{className:"space-y-2",children:c.toolCalls.map(d=>{const m=`${c.id}-${d.toolName}-${JSON.stringify(d.args).slice(0,50)}`;return p.jsxs("div",{children:[p.jsx(i4,{toolName:d.toolName,args:d.args,result:d.result,state:d.result?"result":"call"}),d.result&&p.jsx(S4,{toolName:d.toolName,toolArgs:d.args,result:d.result,serverId:n,readResource:a})]},m)})})]})},c.id):null}),i&&p.jsx("div",{className:"flex items-start gap-3",children:p.jsx("div",{className:"flex-1",children:p.jsx("div",{className:"rounded-lg p-4 max-w-fit",children:p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("span",{className:"text-sm",children:p.jsx(Xwe,{duration:2,spread:1,children:"Thinking..."})})})})})}),p.jsx("div",{ref:r})]})});function bK(e){let t=0;for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);t=(t<<5)-t+a,t=t&t}return Math.abs(t).toString(16)}function Dxe({mcpServerUrl:e,llmConfig:t,authConfig:n,isConnected:a}){const[r,i]=E.useState([]),[s,c]=E.useState(!1),u=E.useCallback(async m=>{if(!m.trim()||!t||!a)return;const h={id:`user-${Date.now()}`,role:"user",content:m.trim(),timestamp:Date.now()};i(g=>[...g,h]),c(!0);try{let g=n;if(n?.type==="oauth")try{const C="mcp:auth",R=bK(e),I=`${C}_${R}_tokens`,A=localStorage.getItem(I);if(A){const O=JSON.parse(A);g={...n,oauthTokens:O}}else console.warn("No OAuth tokens found in localStorage for key:",I)}catch(C){console.warn("Failed to retrieve OAuth tokens:",C)}const v=await fetch("/inspector/api/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mcpServerUrl:e,llmConfig:t,authConfig:g,messages:[...r,h].map(C=>({role:C.role,content:C.content}))})});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);const S=`assistant-${Date.now()}`;let w="";const y=[];i(C=>[...C,{id:S,role:"assistant",content:"",timestamp:Date.now(),parts:[]}]);const _=v.body?.getReader(),x=new TextDecoder;if(!_)throw new Error("No response body");let k="";for(;;){const{done:C,value:R}=await _.read();if(C)break;k+=x.decode(R,{stream:!0});const I=k.split(`
1669
- `);k=I.pop()||"";for(const A of I)if(A.trim()&&A.startsWith("data: "))try{const O=JSON.parse(A.slice(6));if(console.log("[Client received event]",O.type,O.toolName||O.content?.slice?.(0,30)),O.type==="message")console.log("[Message started]",O.id);else if(O.type==="text"){w+=O.content;const M=y[y.length-1];M&&M.type==="text"?M.text=w:y.push({type:"text",text:w}),console.log("[Parts after text]",y.length,"parts, text length:",w.length),i(U=>U.map(F=>F.id===S?{...F,parts:[...y]}:F))}else if(O.type==="tool-call")w&&(w=""),y.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",y.length,"parts, tool:",O.toolName),i(M=>M.map(U=>U.id===S?{...U,parts:[...y]}:U));else if(O.type==="tool-result"){const M=y.find(U=>U.type==="tool-invocation"&&U.toolInvocation?.toolName===O.toolName&&!U.toolInvocation?.result);M&&M.toolInvocation?(M.toolInvocation.result=O.result,M.toolInvocation.state="result",console.log("[Parts after tool-result]",y.length,"parts, updated:",O.toolName),i(U=>U.map(F=>F.id===S?{...F,parts:[...y]}:F))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",y.length),i(M=>M.map(U=>U.id===S?{...U,parts:[...y],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(g){let v="Unknown error occurred";if(g instanceof Error){v=g.message;const w=g;w.status&&(v=`HTTP ${w.status}: ${v}`),(w.code===401||v.includes("401")||v.includes("Unauthorized"))&&(v="Authentication failed (401). Check your Authorization header in the connection settings.")}const S={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${v}`,timestamp:Date.now()};i(w=>[...w,S])}finally{c(!1)}},[t,a,e,r,n]),d=E.useCallback(()=>{i([])},[]);return{messages:r,isLoading:s,sendMessage:u,clearMessages:d}}function $xe({connection:e,llmConfig:t,isConnected:n,readResource:a}){const[r,i]=E.useState([]),[s,c]=E.useState(!1),u=E.useRef(null),d=E.useRef(null),m=E.useRef(null),h=E.useCallback(async v=>{if(!v.trim()||!t||!n)return;const S={id:`user-${Date.now()}`,role:"user",content:v.trim(),timestamp:Date.now()};i(_=>[..._,S]),c(!0),u.current=new AbortController;const w=Date.now();let y=0;try{const _=`assistant-${Date.now()}`;let x="";const k=[];if(i(C=>[...C,{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 C;if(t.provider==="openai"){const{ChatOpenAI:R}=await di(async()=>{const{ChatOpenAI:I}=await import("./index-xDfIuUbb.js");return{ChatOpenAI:I}},__vite__mapDeps([5,6,3,7,8]));C=new R({model:t.model,apiKey:t.apiKey})}else if(t.provider==="anthropic"){const{ChatAnthropic:R}=await di(async()=>{const{ChatAnthropic:I}=await import("./index-CQJrixEA.js");return{ChatAnthropic:I}},__vite__mapDeps([9,6,3]));C=new R({model:t.model,apiKey:t.apiKey})}else if(t.provider==="google"){const{ChatGoogleGenerativeAI:R}=await di(async()=>{const{ChatGoogleGenerativeAI:I}=await import("./index-MYH_v2_l.js");return{ChatGoogleGenerativeAI:I}},__vite__mapDeps([10,6,3,8]));C=new R({model:t.model,apiKey:t.apiKey})}else throw new Error(`Unsupported LLM provider: ${t.provider}`);m.current={instance:C,provider:t.provider,model:t.model,apiKey:t.apiKey}}if(!d.current||d.current.llm!==m.current.instance){const{MCPAgent:C}=await di(async()=>{const{MCPAgent:R}=await import("./browser-BPHOo4ze.js");return{MCPAgent:R}},__vite__mapDeps([11,7,6,3,2,4,8]));d.current=new C({llm:m.current.instance,client:e.client,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."}),await d.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",d.current.conversationHistory?.length);for await(const C of d.current.streamEvents(v,10,!1,void 0)){if(u.current?.signal.aborted)break;if(C.event==="on_chat_model_stream"&&C.data?.chunk?.text){const R=C.data.chunk.text;if(typeof R=="string"&&R.length>0){x+=R;const I=k[k.length-1];I&&I.type==="text"?I.text=x:k.push({type:"text",text:x}),i(A=>A.map(O=>O.id===_?{...O,parts:[...k]}:O))}}else if(C.event==="on_tool_start"){x&&(x="");let R={};C.data?.input?R=C.data.input:C.data?.tool_input?R=C.data.tool_input:C.data&&(R=C.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:C.name,eventData:C.data,extractedArgs:R}),y++,k.push({type:"tool-invocation",toolInvocation:{toolName:C.name||"unknown",args:R,state:"pending"}}),i(I=>I.map(A=>A.id===_?{...A,parts:[...k]}:A))}else if(C.event==="on_tool_end"){const R=k.find(I=>I.type==="tool-invocation"&&I.toolInvocation?.toolName===C.name&&!I.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:C.name,hasToolPart:!!R,output:C.data?.output}),R&&R.toolInvocation){let I=C.data?.output;if(I?.kwargs?.content&&typeof I.kwargs.content=="string")try{I=JSON.parse(I.kwargs.content)}catch(O){console.warn("[useChatMessagesClientSide] Failed to parse kwargs.content:",O),I=I.kwargs.content}else if(I?.content&&typeof I.content=="string")try{I=JSON.parse(I.content)}catch{I=I.content}R.toolInvocation.result=I,R.toolInvocation.state="result";const A=I?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:C.name,hasMeta:!!I?._meta,hasStructuredContent:!!I?.structuredContent,appsSdkUri:A}),A&&typeof A=="string"&&a){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",A);try{const O=await a(A);console.log("[useChatMessagesClientSide] Resource fetched:",O);const M=I?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const U=O.contents.map(H=>({type:"resource",resource:H}));console.log("[useChatMessagesClientSide] Created MCP resources:",U);const F={...I,content:[...I.content||[],...U],structuredContent:M};R.toolInvocation.result=F,console.log("[useChatMessagesClientSide] Updated result with resources")}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",O)}catch(O){console.error("Failed to fetch Apps SDK resource:",O)}}i(O=>O.map(M=>M.id===_?{...M,parts:[...k]}:M))}}}i(C=>C.map(R=>R.id===_?{...R,parts:[...k],content:""}:R)),t&&br.getInstance().capture(new JP({serverId:e.url,provider:t.provider,model:t.model,messageCount:r.length+1,toolCallsCount:y,success:!0,executionMode:"client-side",duration:Date.now()-w})).catch(()=>{})}catch(_){console.error("Client-side agent error:",_);let x="Unknown error occurred";if(_ instanceof Error){x=_.message;const C=_;C.status&&(x=`HTTP ${C.status}: ${x}`),(C.code===401||x.includes("401")||x.includes("Unauthorized"))&&(x="Authentication failed (401). Check your Authorization header in the connection settings.")}t&&br.getInstance().capture(new JP({serverId:e.url,provider:t.provider,model:t.model,messageCount:r.length+1,toolCallsCount:y,success:!1,executionMode:"client-side",duration:Date.now()-w,error:x})).catch(()=>{});const k={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${x}`,timestamp:Date.now()};i(C=>[...C,k])}finally{c(!1),u.current=null}},[e,t,n,r,a]),g=E.useCallback(()=>{i([]),d.current&&d.current.clearConversationHistory()},[]);return{messages:r,isLoading:s,sendMessage:h,clearMessages:g}}const E4={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function Lxe({mcpServerUrl:e}){const[t,n]=E.useState(null),[a,r]=E.useState(null),[i,s]=E.useState(!1),[c,u]=E.useState("openai"),[d,m]=E.useState(""),[h,g]=E.useState(E4.openai),v=E.useCallback(()=>{const M=localStorage.getItem("mcp-inspector-api-keys");if(M)try{return JSON.parse(M)}catch(U){return console.error("Failed to load API keys:",U),{}}return{}},[]),S=E.useCallback(M=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(M))},[]),[w,y]=E.useState("none"),[_,x]=E.useState(""),[k,C]=E.useState(""),[R,I]=E.useState("");E.useEffect(()=>{const M=localStorage.getItem("mcp-inspector-llm-config"),U=v();if(M)try{const F=JSON.parse(M);n(F),u(F.provider),m(U[F.provider]||F.apiKey||""),g(F.model)}catch(F){console.error("Failed to load LLM config:",F)}},[v]),E.useEffect(()=>{const M=localStorage.getItem("mcp-inspector-auth-config");if(M)try{const U=JSON.parse(M);r(U),y(U.type),U.username&&x(U.username),U.password&&C(U.password),U.token&&I(U.token)}catch(U){console.error("Failed to load auth config:",U)}else try{const U="mcp:auth",F=bK(e),H=`${U}_${F}_tokens`;localStorage.getItem(H)&&(r({type:"oauth"}),y("oauth"))}catch(U){console.error("Failed to check for OAuth tokens:",U)}},[e]),E.useEffect(()=>{g(E4[c]);const M=v();m(M[c]||"")},[c,v]);const A=E.useCallback(()=>{if(!d.trim())return;const M=v();M[c]=d,S(M);const U={provider:c,apiKey:d,model:h},F={type:w,...w==="basic"&&{username:_.trim(),password:k.trim()},...w==="bearer"&&{token:R.trim()}};n(U),r(F),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(U)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(F)),s(!1)},[c,d,h,w,_,k,R,v,S]),O=E.useCallback(()=>{n(null),r(null);const M=v();delete M[c],S(M),m(""),x(""),C(""),I(""),y("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,v,S]);return{llmConfig:t,authConfig:a,configDialogOpen:i,setConfigDialogOpen:s,tempProvider:c,setTempProvider:u,tempApiKey:d,setTempApiKey:m,tempModel:h,setTempModel:g,tempAuthType:w,saveLLMConfig:A,clearConfig:O}}function Mxe({connection:e,isConnected:t,useClientSide:n=!0,readResource:a}){const[r,i]=E.useState(""),s=E.useRef(null),{llmConfig:c,authConfig:u,configDialogOpen:d,setConfigDialogOpen:m,tempProvider:h,setTempProvider:g,tempApiKey:v,setTempApiKey:S,tempModel:w,setTempModel:y,saveLLMConfig:_,clearConfig:x}=Lxe({mcpServerUrl:e.url}),k={connection:e,llmConfig:c,isConnected:t,readResource:a},C=Dxe({mcpServerUrl:e.url,llmConfig:c,authConfig:u,isConnected:t}),R=$xe(k),{messages:I,isLoading:A,sendMessage:O,clearMessages:M}=n?R:C;gW({onNewChat:M}),E.useEffect(()=>{c&&I.length===0&&s.current&&s.current.focus()},[c,I.length]),E.useEffect(()=>{!A&&I.length>0&&s.current&&s.current.focus()},[A,I.length]);const U=E.useCallback(()=>{r.trim()&&(O(r),i(""))},[r,O]),F=E.useCallback(te=>{te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),U())},[U]),H=E.useCallback(()=>{x(),M()},[x,M]);return c&&I.length===0?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"absolute top-4 right-4 z-10",children:p.jsx(Ax,{open:d,onOpenChange:m,tempProvider:h,tempModel:w,tempApiKey:v,onProviderChange:g,onModelChange:y,onApiKeyChange:S,onSave:_,onClear:H,showClearButton:!0,buttonLabel:"Change API Key"})}),p.jsx(Zwe,{mcpServerUrl:e.url,inputValue:r,isConnected:t,isLoading:A,textareaRef:s,llmConfig:c,onInputChange:i,onKeyDown:F,onSubmit:te=>{te.preventDefault(),U()},onConfigDialogOpenChange:m})]}):p.jsxs("div",{className:"flex flex-col h-full relative",children:[p.jsx(Gwe,{llmConfig:c,hasMessages:I.length>0,configDialogOpen:d,onConfigDialogOpenChange:m,onClearChat:M,tempProvider:h,tempModel:w,tempApiKey:v,onProviderChange:g,onModelChange:y,onApiKeyChange:S,onSaveConfig:_,onClearConfig:H}),p.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?p.jsx(Oxe,{messages:I,isLoading:A,serverId:e.url,readResource:a}):p.jsx(Ywe,{onConfigureClick:()=>m(!0)})}),c&&p.jsx(Wwe,{inputValue:r,isConnected:t,isLoading:A,textareaRef:s,onInputChange:i,onKeyDown:F,onSendMessage:U})]})}const Ny=E.createContext(null);Ny.displayName="PanelGroupContext";const Vn={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"},vO=10,wl=E.useLayoutEffect,x4=Av.useId,jxe=typeof x4=="function"?x4:()=>null;let Pxe=0;function yO(e=null){const t=jxe(),n=E.useRef(e||t||null);return n.current===null&&(n.current=""+Pxe++),e??n.current}function vK({children:e,className:t="",collapsedSize:n,collapsible:a,defaultSize:r,forwardedRef:i,id:s,maxSize:c,minSize:u,onCollapse:d,onExpand:m,onResize:h,order:g,style:v,tagName:S="div",...w}){const y=E.useContext(Ny);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:_,expandPanel:x,getPanelSize:k,getPanelStyle:C,groupId:R,isPanelCollapsed:I,reevaluatePanelConstraints:A,registerPanel:O,resizePanel:M,unregisterPanel:U}=y,F=yO(s),H=E.useRef({callbacks:{onCollapse:d,onExpand:m,onResize:h},constraints:{collapsedSize:n,collapsible:a,defaultSize:r,maxSize:c,minSize:u},id:F,idIsFromProps:s!==void 0,order:g});E.useRef({didLogMissingDefaultSizeWarning:!1}),wl(()=>{const{callbacks:q,constraints:ie}=H.current,G={...ie};H.current.id=F,H.current.idIsFromProps=s!==void 0,H.current.order=g,q.onCollapse=d,q.onExpand=m,q.onResize=h,ie.collapsedSize=n,ie.collapsible=a,ie.defaultSize=r,ie.maxSize=c,ie.minSize=u,(G.collapsedSize!==ie.collapsedSize||G.collapsible!==ie.collapsible||G.maxSize!==ie.maxSize||G.minSize!==ie.minSize)&&A(H.current,G)}),wl(()=>{const q=H.current;return O(q),()=>{U(q)}},[g,F,O,U]),E.useImperativeHandle(i,()=>({collapse:()=>{_(H.current)},expand:q=>{x(H.current,q)},getId(){return F},getSize(){return k(H.current)},isCollapsed(){return I(H.current)},isExpanded(){return!I(H.current)},resize:q=>{M(H.current,q)}}),[_,x,k,I,F,M]);const te=C(H.current,r);return E.createElement(S,{...w,children:e,className:t,id:F,style:{...te,...v},[Vn.groupId]:R,[Vn.panel]:"",[Vn.panelCollapsible]:a||void 0,[Vn.panelId]:F,[Vn.panelSize]:parseFloat(""+te.flexGrow).toFixed(1)})}const yK=E.forwardRef((e,t)=>E.createElement(vK,{...e,forwardedRef:t}));vK.displayName="Panel";yK.displayName="forwardRef(Panel)";let o_=null,Qg=-1,vs=null;function Uxe(e,t,n){const a=(t&_K)!==0,r=(t&kK)!==0,i=(t&TK)!==0,s=(t&NK)!==0;if(t){if(a)return i?"se-resize":s?"ne-resize":"e-resize";if(r)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function zxe(){vs!==null&&(document.head.removeChild(vs),o_=null,vs=null,Qg=-1)}function tE(e,t,n){var a,r;const i=Uxe(e,t);if(o_!==i){if(o_=i,vs===null&&(vs=document.createElement("style"),document.head.appendChild(vs)),Qg>=0){var s;(s=vs.sheet)===null||s===void 0||s.removeRule(Qg)}Qg=(a=(r=vs.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${i} !important;}`))!==null&&a!==void 0?a:-1}}function wK(e){return e.type==="keydown"}function SK(e){return e.type.startsWith("pointer")}function EK(e){return e.type.startsWith("mouse")}function Ry(e){if(SK(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(EK(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Fxe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Bxe(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 Hxe(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:T4(e),b:T4(t)};let a;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),a=e;Et(a,"Stacking order can only be calculated for elements with a common ancestor");const r={a:k4(_4(n.a)),b:k4(_4(n.b))};if(r.a===r.b){const i=a.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const u=i[c];if(u===s.a)return 1;if(u===s.b)return-1}}return Math.sign(r.a-r.b)}const Vxe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Gxe(e){var t;const n=getComputedStyle((t=xK(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Wxe(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Gxe(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"||Vxe.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function _4(e){let t=e.length;for(;t--;){const n=e[t];if(Et(n,"Missing node"),Wxe(n))return n}return null}function k4(e){return e&&Number(getComputedStyle(e).zIndex)||0}function T4(e){const t=[];for(;e;)t.push(e),e=xK(e);return t}function xK(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const _K=1,kK=2,TK=4,NK=8,Kxe=Fxe()==="coarse";let hi=[],fu=!1,ys=new Map,Cy=new Map;const vp=new Set;function Zxe(e,t,n,a,r){var i;const{ownerDocument:s}=t,c={direction:n,element:t,hitAreaMargins:a,setResizeHandlerState:r},u=(i=ys.get(s))!==null&&i!==void 0?i:0;return ys.set(s,u+1),vp.add(c),nv(),function(){var m;Cy.delete(e),vp.delete(c);const h=(m=ys.get(s))!==null&&m!==void 0?m:1;if(ys.set(s,h-1),nv(),h===1&&ys.delete(s),hi.includes(c)){const g=hi.indexOf(c);g>=0&&hi.splice(g,1),Ay(),r("up",!0,null)}}}function Yxe(e){const{target:t}=e,{x:n,y:a}=Ry(e);fu=!0,wO({target:t,x:n,y:a}),nv(),hi.length>0&&(rv("down",e),Ay(),e.preventDefault(),RK(t)||e.stopImmediatePropagation())}function nE(e){const{x:t,y:n}=Ry(e);if(fu&&e.type!=="pointerleave"&&e.buttons===0&&(fu=!1,rv("up",e)),!fu){const{target:a}=e;wO({target:a,x:t,y:n})}rv("move",e),Ay(),hi.length>0&&e.preventDefault()}function rE(e){const{target:t}=e,{x:n,y:a}=Ry(e);Cy.clear(),fu=!1,hi.length>0&&(e.preventDefault(),RK(t)||e.stopImmediatePropagation()),rv("up",e),wO({target:t,x:n,y:a}),Ay(),nv()}function RK(e){let t=e;for(;t;){if(t.hasAttribute(Vn.resizeHandle))return!0;t=t.parentElement}return!1}function wO({target:e,x:t,y:n}){hi.splice(0);let a=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(a=e),vp.forEach(r=>{const{element:i,hitAreaMargins:s}=r,c=i.getBoundingClientRect(),{bottom:u,left:d,right:m,top:h}=c,g=Kxe?s.coarse:s.fine;if(t>=d-g&&t<=m+g&&n>=h-g&&n<=u+g){if(a!==null&&document.contains(a)&&i!==a&&!i.contains(a)&&!a.contains(i)&&Hxe(a,i)>0){let S=a,w=!1;for(;S&&!S.contains(i);){if(Bxe(S.getBoundingClientRect(),c)){w=!0;break}S=S.parentElement}if(w)return}hi.push(r)}})}function aE(e,t){Cy.set(e,t)}function Ay(){let e=!1,t=!1;hi.forEach(a=>{const{direction:r}=a;r==="horizontal"?e=!0:t=!0});let n=0;Cy.forEach(a=>{n|=a}),e&&t?tE("intersection",n):e?tE("horizontal",n):t?tE("vertical",n):zxe()}let iE;function nv(){var e;(e=iE)===null||e===void 0||e.abort(),iE=new AbortController;const t={capture:!0,signal:iE.signal};vp.size&&(fu?(hi.length>0&&ys.forEach((n,a)=>{const{body:r}=a;n>0&&(r.addEventListener("contextmenu",rE,t),r.addEventListener("pointerleave",nE,t),r.addEventListener("pointermove",nE,t))}),ys.forEach((n,a)=>{const{body:r}=a;r.addEventListener("pointerup",rE,t),r.addEventListener("pointercancel",rE,t)})):ys.forEach((n,a)=>{const{body:r}=a;n>0&&(r.addEventListener("pointerdown",Yxe,t),r.addEventListener("pointermove",nE,t))}))}function rv(e,t){vp.forEach(n=>{const{setResizeHandlerState:a}=n,r=hi.includes(n);a(e,r,t)})}function Xxe(){const[e,t]=E.useState(0);return E.useCallback(()=>t(n=>n+1),[])}function Et(e,t){if(!e)throw console.error(t),Error(t)}function Ll(e,t,n=vO){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function bo(e,t,n=vO){return Ll(e,t,n)===0}function Na(e,t,n){return Ll(e,t,n)===0}function qxe(e,t,n){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++){const r=e[a],i=t[a];if(!Na(r,i,n))return!1}return!0}function eu({panelConstraints:e,panelIndex:t,size:n}){const a=e[t];Et(a!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:r=0,collapsible:i,maxSize:s=100,minSize:c=0}=a;if(Ll(n,c)<0)if(i){const u=(r+c)/2;Ll(n,u)<0?n=r:n=c}else n=c;return n=Math.min(s,n),n=parseFloat(n.toFixed(vO)),n}function kf({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:a,prevLayout:r,trigger:i}){if(Na(e,0))return t;const s=[...t],[c,u]=a;Et(c!=null,"Invalid first pivot index"),Et(u!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const h=e<0?u:c,g=n[h];Et(g,`Panel constraints not found for index ${h}`);const{collapsedSize:v=0,collapsible:S,minSize:w=0}=g;if(S){const y=t[h];if(Et(y!=null,`Previous layout not found for panel index ${h}`),Na(y,v)){const _=w-y;Ll(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const h=e<0?c:u,g=n[h];Et(g,`No panel constraints found for index ${h}`);const{collapsedSize:v=0,collapsible:S,minSize:w=0}=g;if(S){const y=t[h];if(Et(y!=null,`Previous layout not found for panel index ${h}`),Na(y,w)){const _=y-v;Ll(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}}{const h=e<0?1:-1;let g=e<0?u:c,v=0;for(;;){const w=t[g];Et(w!=null,`Previous layout not found for panel index ${g}`);const _=eu({panelConstraints:n,panelIndex:g,size:100})-w;if(v+=_,g+=h,g<0||g>=n.length)break}const S=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-S:S}{let g=e<0?c:u;for(;g>=0&&g<n.length;){const v=Math.abs(e)-Math.abs(d),S=t[g];Et(S!=null,`Previous layout not found for panel index ${g}`);const w=S-v,y=eu({panelConstraints:n,panelIndex:g,size:w});if(!Na(S,y)&&(d+=S-y,s[g]=y,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(qxe(r,s))return r;{const h=e<0?u:c,g=t[h];Et(g!=null,`Previous layout not found for panel index ${h}`);const v=g+d,S=eu({panelConstraints:n,panelIndex:h,size:v});if(s[h]=S,!Na(S,v)){let w=v-S,_=e<0?u:c;for(;_>=0&&_<n.length;){const x=s[_];Et(x!=null,`Previous layout not found for panel index ${_}`);const k=x+w,C=eu({panelConstraints:n,panelIndex:_,size:k});if(Na(x,C)||(w-=C-x,s[_]=C),Na(w,0))break;e>0?_--:_++}}}const m=s.reduce((h,g)=>g+h,0);return Na(m,100)?s:r}function Jxe({layout:e,panelsArray:t,pivotIndices:n}){let a=0,r=100,i=0,s=0;const c=n[0];Et(c!=null,"No pivot index found"),t.forEach((h,g)=>{const{constraints:v}=h,{maxSize:S=100,minSize:w=0}=v;g===c?(a=w,r=S):(i+=w,s+=S)});const u=Math.min(r,100-i),d=Math.max(a,100-s),m=e[c];return{valueMax:u,valueMin:d,valueNow:m}}function yp(e,t=document){return Array.from(t.querySelectorAll(`[${Vn.resizeHandleId}][data-panel-group-id="${e}"]`))}function CK(e,t,n=document){const r=yp(e,n).findIndex(i=>i.getAttribute(Vn.resizeHandleId)===t);return r??null}function AK(e,t,n){const a=CK(e,t,n);return a!=null?[a,a+1]:[-1,-1]}function Qxe(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function IK(e,t=document){if(Qxe(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function Iy(e,t=document){const n=t.querySelector(`[${Vn.resizeHandleId}="${e}"]`);return n||null}function e_e(e,t,n,a=document){var r,i,s,c;const u=Iy(t,a),d=yp(e,a),m=u?d.indexOf(u):-1,h=(r=(i=n[m])===null||i===void 0?void 0:i.id)!==null&&r!==void 0?r:null,g=(s=(c=n[m+1])===null||c===void 0?void 0:c.id)!==null&&s!==void 0?s:null;return[h,g]}function t_e({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:a,panelDataArray:r,panelGroupElement:i,setLayout:s}){E.useRef({didWarnAboutMissingResizeHandle:!1}),wl(()=>{if(!i)return;const c=yp(n,i);for(let u=0;u<r.length-1;u++){const{valueMax:d,valueMin:m,valueNow:h}=Jxe({layout:a,panelsArray:r,pivotIndices:[u,u+1]}),g=c[u];if(g!=null){const v=r[u];Et(v,`No panel data found for index "${u}"`),g.setAttribute("aria-controls",v.id),g.setAttribute("aria-valuemax",""+Math.round(d)),g.setAttribute("aria-valuemin",""+Math.round(m)),g.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((u,d)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[n,a,r,i]),E.useEffect(()=>{if(!i)return;const c=t.current;Et(c,"Eager values not found");const{panelDataArray:u}=c,d=IK(n,i);Et(d!=null,`No group found for id "${n}"`);const m=yp(n,i);Et(m,`No resize handles found for group id "${n}"`);const h=m.map(g=>{const v=g.getAttribute(Vn.resizeHandleId);Et(v,"Resize handle element has no handle id attribute");const[S,w]=e_e(n,v,u,i);if(S==null||w==null)return()=>{};const y=_=>{if(!_.defaultPrevented)switch(_.key){case"Enter":{_.preventDefault();const x=u.findIndex(k=>k.id===S);if(x>=0){const k=u[x];Et(k,`No panel data found for index ${x}`);const C=a[x],{collapsedSize:R=0,collapsible:I,minSize:A=0}=k.constraints;if(C!=null&&I){const O=kf({delta:Na(C,R)?A-R:R-C,initialLayout:a,panelConstraints:u.map(M=>M.constraints),pivotIndices:AK(n,v,i),prevLayout:a,trigger:"keyboard"});a!==O&&s(O)}}break}}};return g.addEventListener("keydown",y),()=>{g.removeEventListener("keydown",y)}});return()=>{h.forEach(g=>g())}},[i,e,t,n,a,r,s])}function N4(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 OK(e,t){const n=e==="horizontal",{x:a,y:r}=Ry(t);return n?a:r}function n_e(e,t,n,a,r){const i=n==="horizontal",s=Iy(t,r);Et(s,`No resize handle element found for id "${t}"`);const c=s.getAttribute(Vn.groupId);Et(c,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=a;const d=OK(n,e),m=IK(c,r);Et(m,`No group element found for id "${c}"`);const h=m.getBoundingClientRect(),g=i?h.width:h.height;return(d-u)/g*100}function r_e(e,t,n,a,r,i){if(wK(e)){const s=n==="horizontal";let c=0;e.shiftKey?c=100:r!=null?c=r:c=10;let u=0;switch(e.key){case"ArrowDown":u=s?0:c;break;case"ArrowLeft":u=s?-c:0;break;case"ArrowRight":u=s?c:0;break;case"ArrowUp":u=s?0:-c;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return a==null?0:n_e(e,t,n,a,i)}function a_e({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let a=0,r=100;for(let i=0;i<e.length;i++){const s=n[i];Et(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;c!=null&&(a++,t[i]=c,r-=c)}for(let i=0;i<e.length;i++){const s=n[i];Et(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;if(c!=null)continue;const u=e.length-a,d=r/u;a++,t[i]=d,r-=d}return t}function Oc(e,t,n){t.forEach((a,r)=>{const i=e[r];Et(i,`Panel data not found for index ${r}`);const{callbacks:s,constraints:c,id:u}=i,{collapsedSize:d=0,collapsible:m}=c,h=n[u];if(h==null||a!==h){n[u]=a;const{onCollapse:g,onExpand:v,onResize:S}=s;S&&S(a,h),m&&(g||v)&&(v&&(h==null||bo(h,d))&&!bo(a,d)&&v(),g&&(h==null||!bo(h,d))&&bo(a,d)&&g())}})}function Cg(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 i_e({defaultSize:e,dragState:t,layout:n,panelData:a,panelIndex:r,precision:i=3}){const s=n[r];let c;return s==null?c=e!=null?e.toFixed(i):"1":a.length===1?c="1":c=s.toFixed(i),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function o_e(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function R4(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 DK(e){return`react-resizable-panels:${e}`}function $K(e){return e.map(t=>{const{constraints:n,id:a,idIsFromProps:r,order:i}=t;return r?a:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function LK(e,t){try{const n=DK(e),a=t.getItem(n);if(a){const r=JSON.parse(a);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function s_e(e,t,n){var a,r;const i=(a=LK(e,n))!==null&&a!==void 0?a:{},s=$K(t);return(r=i[s])!==null&&r!==void 0?r:null}function l_e(e,t,n,a,r){var i;const s=DK(e),c=$K(t),u=(i=LK(e,r))!==null&&i!==void 0?i:{};u[c]={expandToSizes:Object.fromEntries(n.entries()),layout:a};try{r.setItem(s,JSON.stringify(u))}catch(d){console.error(d)}}function C4({layout:e,panelConstraints:t}){const n=[...e],a=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Na(a,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];Et(s!=null,`No layout data found for index ${i}`);const c=100/a*s;n[i]=c}let r=0;for(let i=0;i<t.length;i++){const s=n[i];Et(s!=null,`No layout data found for index ${i}`);const c=eu({panelConstraints:t,panelIndex:i,size:s});s!=c&&(r+=s-c,n[i]=c)}if(!Na(r,0))for(let i=0;i<t.length;i++){const s=n[i];Et(s!=null,`No layout data found for index ${i}`);const c=s+r,u=eu({panelConstraints:t,panelIndex:i,size:c});if(s!==u&&(r-=u-s,n[i]=u,Na(r,0)))break}return n}const c_e=100,Tf={getItem:e=>(R4(Tf),Tf.getItem(e)),setItem:(e,t)=>{R4(Tf),Tf.setItem(e,t)}},A4={};function MK({autoSaveId:e=null,children:t,className:n="",direction:a,forwardedRef:r,id:i=null,onLayout:s=null,keyboardResizeBy:c=null,storage:u=Tf,style:d,tagName:m="div",...h}){const g=yO(i),v=E.useRef(null),[S,w]=E.useState(null),[y,_]=E.useState([]),x=Xxe(),k=E.useRef({}),C=E.useRef(new Map),R=E.useRef(0),I=E.useRef({autoSaveId:e,direction:a,dragState:S,id:g,keyboardResizeBy:c,onLayout:s,storage:u}),A=E.useRef({layout:y,panelDataArray:[],panelDataArrayChanged:!1});E.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),E.useImperativeHandle(r,()=>({getId:()=>I.current.id,getLayout:()=>{const{layout:z}=A.current;return z},setLayout:z=>{const{onLayout:$}=I.current,{layout:j,panelDataArray:V}=A.current,K=C4({layout:z,panelConstraints:V.map(X=>X.constraints)});N4(j,K)||(_(K),A.current.layout=K,$&&$(K),Oc(V,K,k.current))}}),[]),wl(()=>{I.current.autoSaveId=e,I.current.direction=a,I.current.dragState=S,I.current.id=g,I.current.onLayout=s,I.current.storage=u}),t_e({committedValuesRef:I,eagerValuesRef:A,groupId:g,layout:y,panelDataArray:A.current.panelDataArray,setLayout:_,panelGroupElement:v.current}),E.useEffect(()=>{const{panelDataArray:z}=A.current;if(e){if(y.length===0||y.length!==z.length)return;let $=A4[e];$==null&&($=o_e(l_e,c_e),A4[e]=$);const j=[...z],V=new Map(C.current);$(e,j,V,y,u)}},[e,y,u]),E.useEffect(()=>{});const O=E.useCallback(z=>{const{onLayout:$}=I.current,{layout:j,panelDataArray:V}=A.current;if(z.constraints.collapsible){const K=V.map(J=>J.constraints),{collapsedSize:X=0,panelSize:se,pivotIndices:le}=ol(V,z,j);if(Et(se!=null,`Panel size not found for panel "${z.id}"`),!bo(se,X)){C.current.set(z.id,se);const ee=Bc(V,z)===V.length-1?se-X:X-se,ce=kf({delta:ee,initialLayout:j,panelConstraints:K,pivotIndices:le,prevLayout:j,trigger:"imperative-api"});Cg(j,ce)||(_(ce),A.current.layout=ce,$&&$(ce),Oc(V,ce,k.current))}}},[]),M=E.useCallback((z,$)=>{const{onLayout:j}=I.current,{layout:V,panelDataArray:K}=A.current;if(z.constraints.collapsible){const X=K.map(re=>re.constraints),{collapsedSize:se=0,panelSize:le=0,minSize:J=0,pivotIndices:ee}=ol(K,z,V),ce=$??J;if(bo(le,se)){const re=C.current.get(z.id),ye=re!=null&&re>=ce?re:ce,He=Bc(K,z)===K.length-1?le-ye:ye-le,_e=kf({delta:He,initialLayout:V,panelConstraints:X,pivotIndices:ee,prevLayout:V,trigger:"imperative-api"});Cg(V,_e)||(_(_e),A.current.layout=_e,j&&j(_e),Oc(K,_e,k.current))}}},[]),U=E.useCallback(z=>{const{layout:$,panelDataArray:j}=A.current,{panelSize:V}=ol(j,z,$);return Et(V!=null,`Panel size not found for panel "${z.id}"`),V},[]),F=E.useCallback((z,$)=>{const{panelDataArray:j}=A.current,V=Bc(j,z);return i_e({defaultSize:$,dragState:S,layout:y,panelData:j,panelIndex:V})},[S,y]),H=E.useCallback(z=>{const{layout:$,panelDataArray:j}=A.current,{collapsedSize:V=0,collapsible:K,panelSize:X}=ol(j,z,$);return Et(X!=null,`Panel size not found for panel "${z.id}"`),K===!0&&bo(X,V)},[]),te=E.useCallback(z=>{const{layout:$,panelDataArray:j}=A.current,{collapsedSize:V=0,collapsible:K,panelSize:X}=ol(j,z,$);return Et(X!=null,`Panel size not found for panel "${z.id}"`),!K||Ll(X,V)>0},[]),q=E.useCallback(z=>{const{panelDataArray:$}=A.current;$.push(z),$.sort((j,V)=>{const K=j.order,X=V.order;return K==null&&X==null?0:K==null?-1:X==null?1:K-X}),A.current.panelDataArrayChanged=!0,x()},[x]);wl(()=>{if(A.current.panelDataArrayChanged){A.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:$,storage:j}=I.current,{layout:V,panelDataArray:K}=A.current;let X=null;if(z){const le=s_e(z,K,j);le&&(C.current=new Map(Object.entries(le.expandToSizes)),X=le.layout)}X==null&&(X=a_e({panelDataArray:K}));const se=C4({layout:X,panelConstraints:K.map(le=>le.constraints)});N4(V,se)||(_(se),A.current.layout=se,$&&$(se),Oc(K,se,k.current))}}),wl(()=>{const z=A.current;return()=>{z.layout=[]}},[]);const ie=E.useCallback(z=>{let $=!1;const j=v.current;return j&&window.getComputedStyle(j,null).getPropertyValue("direction")==="rtl"&&($=!0),function(K){K.preventDefault();const X=v.current;if(!X)return()=>null;const{direction:se,dragState:le,id:J,keyboardResizeBy:ee,onLayout:ce}=I.current,{layout:re,panelDataArray:ye}=A.current,{initialLayout:Te}=le??{},He=AK(J,z,X);let _e=r_e(K,z,se,le,ee,X);const Se=se==="horizontal";Se&&$&&(_e=-_e);const Ue=ye.map(Be=>Be.constraints),pe=kf({delta:_e,initialLayout:Te??re,panelConstraints:Ue,pivotIndices:He,prevLayout:re,trigger:wK(K)?"keyboard":"mouse-or-touch"}),$e=!Cg(re,pe);(SK(K)||EK(K))&&R.current!=_e&&(R.current=_e,!$e&&_e!==0?Se?aE(z,_e<0?_K:kK):aE(z,_e<0?TK:NK):aE(z,0)),$e&&(_(pe),A.current.layout=pe,ce&&ce(pe),Oc(ye,pe,k.current))}},[]),G=E.useCallback((z,$)=>{const{onLayout:j}=I.current,{layout:V,panelDataArray:K}=A.current,X=K.map(re=>re.constraints),{panelSize:se,pivotIndices:le}=ol(K,z,V);Et(se!=null,`Panel size not found for panel "${z.id}"`);const ee=Bc(K,z)===K.length-1?se-$:$-se,ce=kf({delta:ee,initialLayout:V,panelConstraints:X,pivotIndices:le,prevLayout:V,trigger:"imperative-api"});Cg(V,ce)||(_(ce),A.current.layout=ce,j&&j(ce),Oc(K,ce,k.current))},[]),Q=E.useCallback((z,$)=>{const{layout:j,panelDataArray:V}=A.current,{collapsedSize:K=0,collapsible:X}=$,{collapsedSize:se=0,collapsible:le,maxSize:J=100,minSize:ee=0}=z.constraints,{panelSize:ce}=ol(V,z,j);ce!=null&&(X&&le&&bo(ce,K)?bo(K,se)||G(z,se):ce<ee?G(z,ee):ce>J&&G(z,J))},[G]),W=E.useCallback((z,$)=>{const{direction:j}=I.current,{layout:V}=A.current;if(!v.current)return;const K=Iy(z,v.current);Et(K,`Drag handle element not found for id "${z}"`);const X=OK(j,$);w({dragHandleId:z,dragHandleRect:K.getBoundingClientRect(),initialCursorPosition:X,initialLayout:V})},[]),oe=E.useCallback(()=>{w(null)},[]),ne=E.useCallback(z=>{const{panelDataArray:$}=A.current,j=Bc($,z);j>=0&&($.splice(j,1),delete k.current[z.id],A.current.panelDataArrayChanged=!0,x())},[x]),P=E.useMemo(()=>({collapsePanel:O,direction:a,dragState:S,expandPanel:M,getPanelSize:U,getPanelStyle:F,groupId:g,isPanelCollapsed:H,isPanelExpanded:te,reevaluatePanelConstraints:Q,registerPanel:q,registerResizeHandle:ie,resizePanel:G,startDragging:W,stopDragging:oe,unregisterPanel:ne,panelGroupElement:v.current}),[O,S,a,M,U,F,g,H,te,Q,q,ie,G,W,oe,ne]),B={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return E.createElement(Ny.Provider,{value:P},E.createElement(m,{...h,children:t,className:n,id:i,ref:v,style:{...B,...d},[Vn.group]:"",[Vn.groupDirection]:a,[Vn.groupId]:g}))}const jK=E.forwardRef((e,t)=>E.createElement(MK,{...e,forwardedRef:t}));MK.displayName="PanelGroup";jK.displayName="forwardRef(PanelGroup)";function Bc(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function ol(e,t,n){const a=Bc(e,t),i=a===e.length-1?[a-1,a]:[a,a+1],s=n[a];return{...t.constraints,panelSize:s,pivotIndices:i}}function u_e({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:a}){E.useEffect(()=>{if(e||n==null||a==null)return;const r=Iy(t,a);if(r==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const c=r.getAttribute(Vn.groupId);Et(c,`No group element found for id "${c}"`);const u=yp(c,a),d=CK(c,t,a);Et(d!==null,`No resize element found for id "${t}"`);const m=s.shiftKey?d>0?d-1:u.length-1:d+1<u.length?d+1:0;u[m].focus();break}}};return r.addEventListener("keydown",i),()=>{r.removeEventListener("keydown",i)}},[a,e,t,n])}function PK({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:a,id:r,onBlur:i,onClick:s,onDragging:c,onFocus:u,onPointerDown:d,onPointerUp:m,style:h={},tabIndex:g=0,tagName:v="div",...S}){var w,y;const _=E.useRef(null),x=E.useRef({onClick:s,onDragging:c,onPointerDown:d,onPointerUp:m});E.useEffect(()=>{x.current.onClick=s,x.current.onDragging=c,x.current.onPointerDown=d,x.current.onPointerUp=m});const k=E.useContext(Ny);if(k===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:R,registerResizeHandle:I,startDragging:A,stopDragging:O,panelGroupElement:M}=k,U=yO(r),[F,H]=E.useState("inactive"),[te,q]=E.useState(!1),[ie,G]=E.useState(null),Q=E.useRef({state:F});wl(()=>{Q.current.state=F}),E.useEffect(()=>{if(n)G(null);else{const P=I(U);G(()=>P)}},[n,U,I]);const W=(w=a?.coarse)!==null&&w!==void 0?w:15,oe=(y=a?.fine)!==null&&y!==void 0?y:5;E.useEffect(()=>{if(n||ie==null)return;const P=_.current;Et(P,"Element ref not attached");let B=!1;return Zxe(U,P,C,{coarse:W,fine:oe},($,j,V)=>{if(!j){H("inactive");return}switch($){case"down":{H("drag"),B=!1,Et(V,'Expected event to be defined for "down" action'),A(U,V);const{onDragging:K,onPointerDown:X}=x.current;K?.(!0),X?.();break}case"move":{const{state:K}=Q.current;B=!0,K!=="drag"&&H("hover"),Et(V,'Expected event to be defined for "move" action'),ie(V);break}case"up":{H("hover"),O();const{onClick:K,onDragging:X,onPointerUp:se}=x.current;X?.(!1),se?.(),B||K?.();break}}})},[W,C,n,oe,I,U,ie,A,O]),u_e({disabled:n,handleId:U,resizeHandler:ie,panelGroupElement:M});const ne={touchAction:"none",userSelect:"none"};return E.createElement(v,{...S,children:e,className:t,id:r,onBlur:()=>{q(!1),i?.()},onFocus:()=>{q(!0),u?.()},ref:_,role:"separator",style:{...ne,...h},tabIndex:g,[Vn.groupDirection]:C,[Vn.groupId]:R,[Vn.resizeHandle]:"",[Vn.resizeHandleActive]:F==="drag"?"pointer":te?"keyboard":void 0,[Vn.resizeHandleEnabled]:!n,[Vn.resizeHandleId]:U,[Vn.resizeHandleState]:F})}PK.displayName="PanelResizeHandle";function gi({className:e,...t}){return p.jsx(jK,{"data-slot":"resizable-panel-group",className:Oe("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function ar({...e}){return p.jsx(yK,{"data-slot":"resizable-panel",...e})}function Eo({withHandle:e,className:t,...n}){return p.jsx(PK,{"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&&p.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:p.jsx(Qfe,{className:"size-2.5"})})})}function SO({className:e,...t}){return p.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 d_e({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:a,onSearchExpand:r,onSearchChange:i,onSearchBlur:s,onClearAll:c,searchInputRef:u}){return p.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[p.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?p.jsx(rr,{ref:u,placeholder:"Search notifications...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Notifications"}),p.jsx(fa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:p.jsx(Jv,{className:"h-4 w-4"})})}),p.jsxs(wn,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(SO,{children:"F"})]})]})]})}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:c,disabled:a===0,className:"h-8 w-8 p-0",children:p.jsx(Rl,{className:"h-4 w-4"})})}),p.jsx(wn,{side:"bottom",children:"Clear all"})]})})]})}function pd({id:e,isSelected:t,isFocused:n,icon:a,title:r,description:i,metadata:s,onClick:c,className:u}){return p.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:p.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a&&p.jsx("div",{className:"flex-shrink-0 mt-1",children:p.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:a})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-2 mb-1",children:p.jsx("h3",{className:Oe("font-medium truncate font-mono text-sm"),children:r})}),i&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:i})]})]})})}function f_e({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:a,formatRelativeTime:r,listRef:i}){return e.length===0?p.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:p.jsx(Wv,{vertical:!0,noBorder:!0,message:"No notifications yet"})}):p.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>p.jsx(pd,{id:`notification-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,title:p.jsxs("span",{className:"flex items-center gap-3",children:[s.method,!s.read&&p.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const u=r(s.timestamp),d=s.params&&Object.keys(s.params).length>0?Object.keys(s.params).length:0,m=d>0?` | ${d} param${d>1?"s":""}`:"";return u+m})(),onClick:()=>n(s)},s.id))})}function p_e({notification:e,previewMode:t,onTogglePreview:n,onCopy:a,onDownload:r,onFullscreen:i,isCopied:s=!1,onClose:c}){return e?p.jsxs("div",{className:"flex flex-col h-full",children:[p.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:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx($u,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.formatRelativeTime(e.timestamp)})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsxs(Fe,{variant:"ghost",size:"sm",onClick:n,className:t?"":"text-purple-600 dark:text-purple-400",children:[t?p.jsx(L9,{className:"h-4 w-4 mr-1"}):p.jsx($9,{className:"h-4 w-4 mr-1"}),t?"JSON":"Formatted"]}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:a,children:s?p.jsx(Xa,{className:"h-4 w-4"}):p.jsx(ua,{className:"h-4 w-4"})}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:r,children:p.jsx(ZT,{className:"h-4 w-4"})}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:i,children:p.jsx(XT,{className:"h-4 w-4"})}),c&&p.jsx(Fe,{variant:"ghost",size:"sm",onClick:c,children:p.jsx(td,{className:"h-4 w-4"})})]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto",children:p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{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`})})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(WT,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a notification to view details"})]})}function I4(e){const n=Date.now()-e,a=Math.floor(n/1e3),r=Math.floor(a/60),i=Math.floor(r/60),s=Math.floor(i/24);return a<60?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function m_e({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:a,clearNotifications:r,serverId:i,isConnected:s}){const[c,u]=E.useState(null),[d,m]=E.useState(""),[h,g]=E.useState(-1),[v,S]=E.useState(!0),[w,y]=E.useState(!1),[_,x]=E.useState(!0),[k,C]=E.useState(!1),R=E.useRef(null),I=E.useRef(null),A=E.useRef(null),O=E.useRef(!1);E.useEffect(()=>{v&&e.length>0&&R.current&&!O.current&&(R.current.scrollTop=0)},[e.length,v]),E.useEffect(()=>{const Q=R.current;if(!Q)return;const W=()=>{Q.scrollTop>0&&(O.current=!0,S(!1))};return Q.addEventListener("scroll",W),()=>Q.removeEventListener("scroll",W)},[]),E.useEffect(()=>{e.length===0&&(O.current=!1,S(!0))},[e.length]),E.useEffect(()=>{c&&!c.read&&n(c.id)},[c,n]),E.useEffect(()=>{w&&A.current&&A.current.focus()},[w]);const M=E.useCallback(()=>{d.trim()||y(!1)},[d]),U=E.useMemo(()=>{if(!d.trim())return e;const Q=d.toLowerCase();return e.filter(W=>W.method.toLowerCase().includes(Q)||JSON.stringify(W.params||{}).toLowerCase().includes(Q))},[e,d]);E.useEffect(()=>{g(-1)},[d]),E.useEffect(()=>{const Q=W=>{const oe=W.target;if(oe.tagName==="INPUT"||oe.tagName==="TEXTAREA"||oe.contentEditable==="true"||W.metaKey||W.ctrlKey||W.altKey)return;const P=U;if(W.key==="ArrowDown")W.preventDefault(),g(B=>{const z=B+1;return z>=P.length?0:z});else if(W.key==="ArrowUp")W.preventDefault(),g(B=>{const z=B-1;return z<0?P.length-1:z});else if(W.key==="Enter"&&h>=0){W.preventDefault();const B=U[h];B&&F(B)}};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[h,U]),E.useEffect(()=>{if(h>=0){const Q=`notification-${U[h]?.id}`,W=document.getElementById(Q);W&&W.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,U]);const F=E.useCallback(Q=>{u(Q)},[]),H=E.useCallback(()=>{window.confirm("Are you sure you want to clear all notifications? This cannot be undone.")&&(r(),u(null))},[r]),te=E.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(Q){console.error("[NotificationsTab] Failed to copy notification:",Q)}},[c]),q=E.useCallback(()=>{if(c)try{const Q=new globalThis.Blob([JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)],{type:"application/json"}),W=URL.createObjectURL(Q),oe=document.createElement("a");oe.href=W,oe.download=`notification-${Date.now()}.json`,document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(W)}catch(Q){console.error("[NotificationsTab] Failed to download notification:",Q)}},[c]),ie=E.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(Q){console.error("[NotificationsTab] Failed to toggle fullscreen:",Q)}},[]),G=c?{method:c.method,params:c.params,timestamp:c.timestamp,read:c.read,formatRelativeTime:I4}:null;return s?p.jsxs(gi,{direction:"horizontal",className:"h-full",children:[p.jsx(ar,{defaultSize:40,minSize:30,children:p.jsx(gi,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:p.jsxs(ar,{defaultSize:75,minSize:30,children:[p.jsx(d_e,{isSearchExpanded:w,searchQuery:d,filteredNotificationsCount:U.length,notificationsCount:e.length,onSearchExpand:()=>y(!0),onSearchChange:m,onSearchBlur:M,onClearAll:H,searchInputRef:A}),p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(f_e,{notifications:U,selectedNotification:c,onNotificationSelect:F,focusedIndex:h,formatRelativeTime:I4,listRef:R})})]})})}),p.jsx(Eo,{}),p.jsx(ar,{defaultSize:60,minSize:40,children:p.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:p.jsx(p_e,{notification:G,previewMode:_,onTogglePreview:()=>x(!_),onCopy:te,onDownload:q,onFullscreen:ie,onClose:()=>u(null),isCopied:k})})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(WT,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function UK({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:a,secondaryTabTitle:r,primaryCount:i,secondaryCount:s,secondaryIcon:c,primaryIcon:u,searchPlaceholder:d="Search...",onSearchExpand:m,onSearchChange:h,onSearchBlur:g,onTabSwitch:v,searchInputRef:S,primaryTabName:w}){const y=e===w;return p.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[p.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?p.jsx(rr,{ref:S,placeholder:d,value:n,onChange:_=>h(_.target.value),onBlur:g,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:y?a:r}),y&&p.jsxs(p.Fragment,{children:[p.jsx(fa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:i}),p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0",children:p.jsx(Jv,{className:"h-4 w-4"})})}),p.jsxs(wn,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(SO,{children:"F"})]})]})]})]})}),p.jsxs(Fe,{variant:"ghost",size:"sm",onClick:v,className:"gap-2 flex-shrink-0",children:[y?p.jsx(c,{}):p.jsx(u,{}),p.jsx("span",{className:"hidden sm:inline",children:y?r:a}),y&&s>0&&p.jsx(fa,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:s})]})]})}function O4({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:a}){return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(rp,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((r,i)=>p.jsx(pd,{id:`prompt-${r.name}`,isSelected:t?.name===r.name,isFocused:a===i,icon:p.jsx(rp,{className:"h-4 w-4"}),title:r.name,description:r.description,metadata:r.arguments&&r.arguments.length>0&&p.jsxs(fa,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[r.arguments.length," args"]}),onClick:()=>n(r)},r.name))})}function D4({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:a,savedPromptsCount:r,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return p.jsx(UK,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:a,secondaryCount:r,primaryIcon:rp,secondaryIcon:$u,searchPlaceholder:"Search prompts...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}function $4({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:a,focusedIndex:r}){return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx($u,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),p.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((i,s)=>p.jsx(pd,{id:`saved-prompt-${i.id}`,isSelected:t?.id===i.id,isFocused:r===s,icon:p.jsx($u,{className:"h-4 w-4"}),title:i.name,description:`${i.promptName} - ${new Date(i.savedAt).toLocaleString()}`,onClick:()=>n(i)},i.id))})}function h_e({selectedPrompt:e,promptArgs:t,onArgChange:n}){const a=e?.arguments||[];if(!(a.length>0))return p.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const i=s=>{const c=s.name,u=t[c],d=typeof u=="string"?u:JSON.stringify(u);return s.type==="boolean"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx("input",{id:c,type:"checkbox",checked:!!u,onChange:m=>n(c,m.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),p.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]})]},c):s.type==="number"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(rr,{id:c,type:"number",value:Number(u)||0,onChange:m=>n(c,Number(m.target.value)),placeholder:s.description||`Enter ${c}`}),s.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):s.type==="array"||s.type==="object"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(uy,{id:c,value:d,onChange:m=>{try{const h=JSON.parse(m.target.value);n(c,h)}catch{n(c,m.target.value)}},placeholder:s.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),s.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(rr,{id:c,value:d,onChange:m=>n(c,m.target.value),placeholder:s.description||`Enter ${c}`}),s.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c)};return p.jsx("div",{className:"space-y-4",children:a.map(s=>i(s))})}function L4({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:a,onArgChange:r,onExecute:i,onSave:s}){return e?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[p.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),p.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[p.jsx(Fe,{onClick:i,disabled:n||!a,size:"sm",className:"lg:size-default",children:n?p.jsxs(p.Fragment,{children:[p.jsx(Ao,{className:"mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(P9,{className:"h-4 w-4 sm:mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Execute"})]})}),p.jsxs(Fe,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[p.jsx(qT,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),e.description&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:p.jsx(h_e,{selectedPrompt:e,promptArgs:t,onArgChange:r})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),p.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 M4({results:e,copiedResult:t,onCopy:n}){return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:e.length>0?p.jsx("div",{className:"space-y-4 flex-1 h-full",children:e.map((a,r)=>p.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[p.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[p.jsx("h3",{className:"text-sm font-medium",children:"Response"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx($u,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(a.timestamp).toLocaleTimeString()})]}),a.duration!==void 0&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(ap,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[a.duration,"ms"]})]}),p.jsx("div",{className:"flex gap-2 ml-auto",children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>n(r,a.result),className:"h-6 px-2",children:t===r?p.jsx(Xa,{className:"h-4 w-4"}):p.jsx(ua,{className:"h-4 w-4"})})})]}),a.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:a.error})]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:a.result,filename:`prompt-result-${a.promptName}-${Date.now()}.json`})})]},r))}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-center",children:p.jsx(Wv,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function EO({serverIds:e,onCountChange:t,onClearRef:n}={}){const[a,r]=E.useState([]),i=E.useRef(null),[s,c]=E.useState(new Set),[u]=E.useState(""),d=v=>{c(S=>{const w=new Set(S);return w.has(v)?w.delete(v):w.add(v),w})},m=async()=>{r([]),c(new Set),t?.(0);try{const v=new URLSearchParams;e&&e.length>0&&v.set("serverIds",e.join(","));const S=await fetch(`/inspector/api/rpc/log?${v.toString()}`,{method:"DELETE"});S.ok||console.warn("[RPC Logger] Failed to clear server buffer:",S.status)}catch(v){console.warn("[RPC Logger] Error clearing server buffer:",v)}},h=E.useMemo(()=>!e||e.length===0?"":[...e].sort().join(","),[e]);E.useEffect(()=>(n&&(n.current=m),()=>{n&&(n.current=null)}),[n,m]),E.useEffect(()=>{t?.(a.length)},[a.length,t]),E.useEffect(()=>{let v=null;try{const S=new URLSearchParams;S.set("replay","3"),S.set("_t",Date.now().toString()),e&&e.length>0&&S.set("serverIds",e.join(","));const w=`/inspector/api/rpc/stream?${S.toString()}`;console.log("[RPC Logger] Connecting to SSE stream:",w),v=new globalThis.EventSource(w),v.onopen=()=>{console.log("[RPC Logger] SSE connection opened")},v.onmessage=y=>{try{const _=JSON.parse(y.data);if(!_||_.type!=="rpc")return;const{serverId:x,direction:k,message:C,timestamp:R}=_,I=C,A=typeof I?.method=="string"?I.method:I?.result!==void 0?"result":I?.error!==void 0?"error":"unknown",O={id:`${R??Date.now()}-${Math.random().toString(36).slice(2)}`,serverId:typeof x=="string"?x:"unknown",direction:typeof k=="string"?k.toUpperCase():"",method:A,timestamp:R??new Date().toISOString(),payload:C};console.log("[RPC Logger] Received RPC event:",{method:A,direction:k,serverId:x}),r(M=>{const U=[O,...M].slice(0,1e3);return t?.(U.length),U})}catch(_){console.error("[RPC Logger] Error parsing SSE message:",_)}},v.onerror=y=>{console.error("[RPC Logger] SSE connection error:",y);try{v?.close()}catch{}}}catch(S){console.error("[RPC Logger] Failed to create SSE connection:",S)}return()=>{try{v?.close(),console.log("[RPC Logger] SSE connection closed")}catch{}}},[h]);const g=E.useMemo(()=>{let v=a;if(e&&e.length>0){const S=new Set(e);v=v.filter(w=>S.has(w.serverId))}if(u.trim()){const S=u.toLowerCase();v=v.filter(w=>w.serverId.toLowerCase().includes(S)||w.method.toLowerCase().includes(S)||w.direction.toLowerCase().includes(S)||JSON.stringify(w.payload).toLowerCase().includes(S))}return v},[a,u,e]);return p.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:p.jsx("div",{ref:i,className:"flex-1 min-h-0 overflow-y-auto",children:g.length===0?p.jsxs("div",{className:"text-center py-8",children:[p.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages yet"}),p.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:"JSON-RPC messages will appear here"})]}):g.map(v=>{const S=s.has(v.id);return p.jsxs("div",{className:"group hover:bg-muted/50 transition-all duration-200 overflow-hidden",children:[p.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>d(v.id),children:[p.jsx("div",{className:"flex-shrink-0",children:S?p.jsx(zl,{className:"h-3 w-3 text-muted-foreground transition-transform"}):p.jsx(wfe,{className:"h-3 w-3 text-muted-foreground transition-transform"})}),p.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[p.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:new Date(v.timestamp).toLocaleTimeString()}),p.jsx("span",{className:`flex items-center justify-center px-1 py-0.5 rounded ${v.direction==="RECEIVE"?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-green-500/10 text-green-600 dark:text-green-400"}`,title:v.direction==="RECEIVE"?"Incoming":"Outgoing",children:v.direction==="RECEIVE"?p.jsx(lfe,{className:"h-3 w-3"}):p.jsx(ufe,{className:"h-3 w-3"})}),p.jsx("span",{className:"text-xs font-mono text-foreground truncate",children:v.method})]})]}),S&&p.jsx("div",{className:"border-t bg-muted/20",children:p.jsx("div",{className:"p-3",children:p.jsx("div",{className:"max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2",children:p.jsx(ur,{data:v.payload})})})})]},v.id)})})})}const j4="mcp-inspector-saved-prompts";function zK({ref:e,prompts:t,callPrompt:n,serverId:a,isConnected:r}){const[i,s]=E.useState(null),[c,u]=E.useState(null),{selectedPromptName:d,setSelectedPromptName:m}=qp(),[h,g]=E.useState({}),[v,S]=E.useState([]),[w,y]=E.useState(!1),[_,x]=E.useState(null),[k,C]=E.useState(""),[R,I]=E.useState("prompts"),[A,O]=E.useState([]),[M,U]=E.useState(!1),[F,H]=E.useState(""),[te,q]=E.useState(!1),[ie,G]=E.useState(-1),Q=E.useRef(null),[W,oe]=E.useState(!1),[ne,P]=E.useState("list"),[B,z]=E.useState(0),[$,j]=E.useState(!0),V=E.useRef(null),K=E.useRef(null);E.useEffect(()=>{const _e=()=>{oe(window.innerWidth<1024)};return _e(),window.addEventListener("resize",_e),()=>window.removeEventListener("resize",_e)},[]),E.useEffect(()=>{P(i?"detail":"list")},[i]),E.useEffect(()=>{W&&v.length>0&&!w&&P("response")},[v,w,W]),E.useImperativeHandle(e,()=>({focusSearch:()=>{q(!0),setTimeout(()=>{Q.current&&Q.current.focus()},0)},blurSearch:()=>{C(""),q(!1),Q.current&&Q.current.blur()}})),E.useEffect(()=>{try{const _e=localStorage.getItem(j4);if(_e){const Se=JSON.parse(_e);O(Se)}}catch(_e){console.error("[PromptsTab] Failed to load saved prompts:",_e)}},[]);const X=E.useCallback(_e=>{try{localStorage.setItem(j4,JSON.stringify(_e))}catch(Se){console.error("[PromptsTab] Failed to save prompts:",Se)}},[]);E.useEffect(()=>{te&&Q.current&&Q.current.focus()},[te]);const se=E.useCallback(()=>{k.trim()||q(!1)},[k]),le=E.useMemo(()=>{if(!k.trim())return t;const _e=k.toLowerCase();return t.filter(Se=>Se.name.toLowerCase().includes(_e)||Se.description?.toLowerCase().includes(_e))},[t,k]),J=E.useCallback(_e=>{s(_e);const Se={};_e.arguments&&_e.arguments.forEach(Ue=>{Ue.default!==void 0?Se[Ue.name]=Ue.default:Ue.type==="string"?Se[Ue.name]="":Ue.type==="number"?Se[Ue.name]=0:Ue.type==="boolean"?Se[Ue.name]=!1:Ue.type==="array"?Se[Ue.name]=[]:Ue.type==="object"&&(Se[Ue.name]={})}),g(Se)},[]),ee=E.useCallback(_e=>{const Se=t.find(Ue=>Ue.name===_e.promptName);Se&&(s(Se),g(_e.args),u(_e))},[t]);E.useEffect(()=>{G(-1)},[k,R]),E.useEffect(()=>{const _e=Se=>{const Ue=Se.target;if(Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.contentEditable==="true"||Se.metaKey||Se.ctrlKey||Se.altKey)return;const $e=R==="prompts"?le:A;if(Se.key==="ArrowDown")Se.preventDefault(),G(Be=>{const Ee=Be+1;return Ee>=$e.length?0:Ee});else if(Se.key==="ArrowUp")Se.preventDefault(),G(Be=>{const Ee=Be-1;return Ee<0?$e.length-1:Ee});else if(Se.key==="Enter"&&ie>=0)if(Se.preventDefault(),R==="prompts"){const Be=le[ie];Be&&J(Be)}else{const Be=A[ie];Be&&ee(Be)}};return document.addEventListener("keydown",_e),()=>document.removeEventListener("keydown",_e)},[ie,le,A,R,J,ee]),E.useEffect(()=>{if(ie>=0){const _e=R==="prompts"?`prompt-${le[ie]?.name}`:`saved-prompt-${A[ie]?.id}`,Se=document.getElementById(_e);Se&&Se.scrollIntoView({behavior:"smooth",block:"nearest"})}},[ie,le,A,R]),E.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:d,promptsCount:t.length,currentSelectedPrompt:i?.name}),d&&t.length>0){const _e=t.find(Se=>Se.name===d);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:d,promptFound:!!_e,promptName:_e?.name,shouldSelect:_e&&i?.name!==_e.name}),_e&&i?.name!==_e.name){console.warn("[PromptsTab] Selecting prompt:",_e.name),m(null);const Se=setTimeout(()=>{J(_e);const Ue=document.getElementById(`prompt-${_e.name}`);Ue&&(console.warn("[PromptsTab] Scrolling to prompt element"),Ue.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(Se)}}},[d,t,i,J,m]);const ce=E.useCallback((_e,Se)=>{g(Ue=>({...Ue,[_e]:Se}))},[]),re=E.useCallback(async()=>{if(!i||w)return;y(!0);const _e=Date.now();try{const Se=await n(i.name,h),Ue=Date.now()-_e;br.getInstance().capture(new qP({promptName:i.name,serverId:a,success:!0})).catch(()=>{}),S($e=>[{promptName:i.name,args:h,result:Se,timestamp:_e,duration:Ue},...$e])}catch(Se){br.getInstance().capture(new qP({promptName:i.name,serverId:a,success:!1,error:Se instanceof Error?Se.message:"Unknown error"})).catch(()=>{});const pe={promptName:i.name,args:h,result:null,error:Se instanceof Error?Se.message:String(Se),timestamp:_e,duration:Date.now()-_e};S($e=>[pe,...$e])}finally{y(!1)}},[i,h,w,n,a]),ye=E.useCallback(async(_e,Se)=>{try{await navigator.clipboard.writeText(JSON.stringify(Se,null,2)),x(_e),setTimeout(()=>x(null),2e3)}catch(Ue){console.error("[PromptsTab] Failed to copy result:",Ue)}},[]),Te=E.useCallback(()=>{i&&(H(""),U(!0))},[i]),He=E.useCallback(_e=>{X(A.filter(Se=>Se.id!==_e)),c?.id===_e&&u(null)},[A,X,c]);return W?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[ne!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{ne==="response"?P("detail"):(s(null),P("list"))},className:"p-0 h-8 w-8",children:p.jsx(KT,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{s(null),P("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),ne!=="list"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("button",{onClick:()=>{ne==="response"&&P("detail")},className:ne==="detail"?"text-foreground hover:underline":ne==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),ne==="response"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(ay,{initial:!1,mode:"popLayout",children:[ne==="list"&&p.jsxs(da.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:[p.jsx(D4,{activeTab:R,isSearchExpanded:te,searchQuery:k,filteredPromptsCount:le.length,savedPromptsCount:A.length,onSearchExpand:()=>q(!0),onSearchChange:C,onSearchBlur:se,onTabSwitch:()=>I(R==="prompts"?"saved":"prompts"),searchInputRef:Q}),R==="prompts"?p.jsx(O4,{prompts:le,selectedPrompt:i,onPromptSelect:J,focusedIndex:ie}):p.jsx($4,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:ee,onDeletePrompt:He,focusedIndex:ie})]},"list"),ne==="detail"&&p.jsx(da.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:p.jsx(L4,{selectedPrompt:i,promptArgs:h,isExecuting:w,isConnected:r,onArgChange:ce,onExecute:re,onSave:Te})},"detail"),ne==="response"&&p.jsx(da.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:p.jsx(M4,{results:v,copiedResult:_,onCopy:ye})},"response")]})})]}):p.jsxs(gi,{direction:"horizontal",className:"h-full",children:[p.jsx(ar,{defaultSize:33,className:"flex flex-col h-full relative",children:p.jsxs(gi,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[p.jsx(ar,{defaultSize:75,minSize:30,children:p.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[p.jsx(D4,{activeTab:R,isSearchExpanded:te,searchQuery:k,filteredPromptsCount:le.length,savedPromptsCount:A.length,onSearchExpand:()=>q(!0),onSearchChange:C,onSearchBlur:se,onTabSwitch:()=>I(R==="prompts"?"saved":"prompts"),searchInputRef:Q}),R==="prompts"?p.jsx(O4,{prompts:le,selectedPrompt:i,onPromptSelect:J,focusedIndex:ie}):p.jsx($4,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:ee,onDeletePrompt:He,focusedIndex:ie})]})}),p.jsx(Eo,{withHandle:!0}),p.jsxs(ar,{ref:V,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>j(!0),onExpand:()=>j(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[p.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),$?(V.current?.resize(25),j(!1)):(V.current?.resize(5),j(!0))},children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),B>0&&p.jsx(fa,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:B}),B>0&&!$&&p.jsx(Fe,{variant:"ghost",size:"sm",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),K.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:p.jsx(Rl,{className:"h-3.5 w-3.5"})})]}),p.jsx(zl,{className:`h-4 w-4 text-muted-foreground transition-transform ${$?"rotate-180":""}`})]}),!$&&p.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:p.jsx(EO,{serverIds:[a],onCountChange:z,onClearRef:K})})]})]})}),p.jsx(Eo,{withHandle:!0}),p.jsx(ar,{defaultSize:67,children:p.jsxs(gi,{direction:"vertical",children:[p.jsx(ar,{defaultSize:40,children:p.jsx(L4,{selectedPrompt:i,promptArgs:h,isExecuting:w,isConnected:r,onArgChange:ce,onExecute:re,onSave:Te})}),p.jsx(Eo,{withHandle:!0}),p.jsx(ar,{defaultSize:50,children:p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(M4,{results:v,copiedResult:_,onCopy:ye})})})]})})]})}zK.displayName="PromptsTab";function pu(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 g_e(e){return{uri:e.uri,mimeType:e.mimeType,text:e.text,blob:e.blob}}function FK({resource:e,onUIAction:t,className:n}){const a=async i=>t?.(i),r=g_e(e);return p.jsx("div",{className:n,children:p.jsx(bO,{resource:r,onUIAction:a,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[Nxe,Txe,Rxe,Cxe],library:gO}})})}function P4({result:e,isLoading:t,previewMode:n,serverId:a,readResource:r,onTogglePreview:i,onCopy:s,onDownload:c,onFullscreen:u,isCopied:d=!1}){let m=[],h;if(e?.resourceAnnotations&&(m=Object.keys(e.resourceAnnotations).filter(w=>w.startsWith("openai/")),h=e.resourceAnnotations["openai/outputTemplate"]),e?.result?.contents?.[0]?._meta){const w=e.result.contents[0]._meta,y=Object.keys(w).filter(_=>_.startsWith("openai/"));y.length>0&&(m=[...m,...y]),!h&&w["openai/outputTemplate"]&&(h=w["openai/outputTemplate"]),!h&&e.uri&&e.uri.startsWith("ui://widget/")&&(h=e.uri)}const g=!!(m.length>0&&h&&typeof h=="string"&&a&&r);if(t)return p.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:p.jsx(Ao,{className:"size-5"})});if(!e)return p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),p.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(e.error)return p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:e.error})]})});const v=e?.result?.contents&&Array.isArray(e.result.contents)&&e.result.contents.some(w=>w.mimeType&&pu(w)),S=v?e.result.contents.filter(w=>w.mimeType&&pu(w)):[];return p.jsxs("div",{className:"flex flex-col h-full",children:[p.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:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx($u,{className:"h-3 w-3 text-gray-400"}),p.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?p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(ap,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[w,"ms"]})]}):null})(),v&&p.jsx(fa,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),g&&p.jsx(fa,{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"})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[(v||g)&&p.jsxs(Fe,{variant:"ghost",size:"sm",onClick:i,className:n?"":"text-purple-600 dark:text-purple-400",children:[n?p.jsx(L9,{className:"h-4 w-4 mr-1"}):p.jsx($9,{className:"h-4 w-4 mr-1"}),n?"JSON":g?"Component":"Preview"]}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:s,children:d?p.jsx(Xa,{className:"h-4 w-4"}):p.jsx(ua,{className:"h-4 w-4"})}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:c,children:p.jsx(ZT,{className:"h-4 w-4"})}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:u,children:p.jsx(XT,{className:"h-4 w-4"})})]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto",children:g&&a&&r&&h?n?p.jsx("div",{className:"flex-1 h-full",children:p.jsx(dO,{componentUrl:h,toolName:e.uri,toolArgs:{},toolResult:e.result,serverId:a,readResource:r,className:"w-full h-full relative flex p-4"})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})}):v?n?p.jsxs("div",{className:"space-y-0 h-full",children:[S.map((w,y)=>p.jsx("div",{className:"mx-0 size-full",children:p.jsx("div",{className:"w-full h-full",children:p.jsx(FK,{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(y=>!(y.mimeType&&pu(y)));if(w.length>0)return p.jsx("div",{className:"px-4",children:p.jsx(ur,{data:w,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-non-ui-${Date.now()}.json`})})}return null})()]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-mcp-ui-${Date.now()}.json`})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]})}function b_e(e,t){if(!e&&!t)return p.jsx(Kfe,{className:"h-5 w-5"});const n=(e||t||"").toLowerCase();return n.includes("image")?p.jsx(Vfe,{className:"h-5 w-5"}):n.includes("json")||n.includes("javascript")||n.includes("typescript")?p.jsx(Bfe,{className:"h-5 w-5"}):n.includes("html")||n.includes("xml")?p.jsx(qfe,{className:"h-5 w-5"}):n.includes("database")||n.includes("sql")?p.jsx(qv,{className:"h-5 w-5"}):p.jsx(YT,{className:"h-5 w-5"})}function U4({resources:e,selectedResource:t,onResourceSelect:n,focusedIndex:a}){return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(qv,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((r,i)=>{const s=b_e(r.mimeType,r.uri),c=[r.description,r.mimeType&&p.jsx("span",{className:"font-mono",children:r.mimeType},"mime")].filter(Boolean);return p.jsx(pd,{id:`resource-${r.uri}`,isSelected:t?.uri===r.uri,isFocused:a===i,icon:s,title:r.name,description:c.length>0?p.jsxs("span",{className:"flex flex-col gap-1",children:[r.description&&p.jsx("span",{children:r.description}),r.mimeType&&p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:r.mimeType})]}):void 0,onClick:()=>n(r)},r.uri)})})}function z4({isSearchExpanded:e,searchQuery:t,filteredResourcesCount:n,onSearchExpand:a,onSearchChange:r,onSearchBlur:i,searchInputRef:s}){return p.jsx("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:p.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?p.jsx(rr,{ref:s,placeholder:"Search resources...",value:t,onChange:c=>r(c.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),p.jsx(fa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:p.jsx(Jv,{className:"h-4 w-4"})})}),p.jsxs(wn,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(SO,{children:"F"})]})]})]})})})}function BK({ref:e,resources:t,readResource:n,serverId:a,isConnected:r}){const[i,s]=E.useState(null),{selectedResourceUri:c,setSelectedResourceUri:u}=qp(),[d,m]=E.useState(null),[h,g]=E.useState(!1),[v,S]=E.useState(""),[w]=E.useState("resources"),[y,_]=E.useState(!0),[x,k]=E.useState(!1),[C,R]=E.useState(-1),[I,A]=E.useState(!1),O=E.useRef(null),M=E.useRef(null),[U,F]=E.useState(!1),[H,te]=E.useState("list"),[q,ie]=E.useState(0),[G,Q]=E.useState(!0),W=E.useRef(null),oe=E.useRef(null);E.useEffect(()=>{const V=()=>{F(window.innerWidth<1024)};return V(),window.addEventListener("resize",V),()=>window.removeEventListener("resize",V)},[]),E.useEffect(()=>{te(i?"detail":"list")},[i]),E.useImperativeHandle(e,()=>({focusSearch:()=>{k(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{S(""),k(!1),O.current&&O.current.blur()}})),E.useEffect(()=>{x&&O.current&&O.current.focus()},[x]);const ne=E.useCallback(()=>{v.trim()||k(!1)},[v]),P=E.useMemo(()=>{if(!v)return t;const V=v.toLowerCase();return t.filter(K=>K.name.toLowerCase().includes(V)||K.description?.toLowerCase().includes(V)||K.uri.toLowerCase().includes(V))},[t,v]),B=E.useCallback(async V=>{if(s(V),r){g(!0);const K=Date.now();try{const X=await n(V.uri);br.getInstance().capture(new XP({resourceUri:V.uri,serverId:a,success:!0})).catch(()=>{}),m({uri:V.uri,result:X,timestamp:K,resourceAnnotations:V.annotations})}catch(X){br.getInstance().capture(new XP({resourceUri:V.uri,serverId:a,success:!1,error:X instanceof Error?X.message:"Unknown error"})).catch(()=>{}),m({uri:V.uri,result:null,error:X instanceof Error?X.message:"Unknown error",timestamp:K,resourceAnnotations:V.annotations})}finally{g(!1)}}},[n,a,r]);E.useEffect(()=>{R(-1)},[v,w]),E.useEffect(()=>{const V=K=>{const X=K.target;if(X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.contentEditable==="true"||K.metaKey||K.ctrlKey||K.altKey)return;const le=P;if(K.key==="ArrowDown")K.preventDefault(),R(J=>{const ee=J+1;return ee>=le.length?0:ee});else if(K.key==="ArrowUp")K.preventDefault(),R(J=>{const ee=J-1;return ee<0?le.length-1:ee});else if(K.key==="Enter"&&C>=0){K.preventDefault();const J=P[C];J&&B(J)}};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[C,P,B]),E.useEffect(()=>{if(C>=0){const V=`resource-${P[C]?.uri}`,K=document.getElementById(V);K&&K.scrollIntoView({behavior:"smooth",block:"nearest"})}},[C,P]),E.useEffect(()=>{if(c&&t.length>0){const V=t.find(K=>K.uri===c);V&&i?.uri!==V.uri&&(u(null),setTimeout(()=>{B(V);const K=document.getElementById(`resource-${V.uri}`);K&&K.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,t,i,B,u]);const z=E.useCallback(async()=>{if(d)try{await navigator.clipboard.writeText(JSON.stringify(d.result,null,2)),A(!0),setTimeout(()=>A(!1),2e3)}catch(V){console.error("[ResourcesTab] Failed to copy result:",V)}},[d]),$=E.useCallback(()=>{if(d)try{const V=new globalThis.Blob([JSON.stringify(d.result,null,2)],{type:"application/json"}),K=URL.createObjectURL(V),X=document.createElement("a");X.href=K,X.download=`resource-${Date.now()}.json`,document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(K)}catch(V){console.error("[ResourcesTab] Failed to download result:",V)}},[d]),j=E.useCallback(async()=>{if(M.current)try{document.fullscreenElement?await document.exitFullscreen():await M.current.requestFullscreen()}catch(V){console.error("[ResourcesTab] Failed to toggle fullscreen:",V)}},[]);return U?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[H!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{s(null),te("list")},className:"p-0 h-8 w-8",children:p.jsx(KT,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{s(null),te("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Resources"}),H==="detail"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Content"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(ay,{initial:!1,mode:"popLayout",children:[H==="list"&&p.jsxs(da.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:[p.jsx(z4,{activeTab:w,isSearchExpanded:x,searchQuery:v,filteredResourcesCount:P.length,onSearchExpand:()=>k(!0),onSearchChange:S,onSearchBlur:ne,onTabSwitch:()=>{},searchInputRef:O}),p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(U4,{resources:P,selectedResource:i,onResourceSelect:B,focusedIndex:C})})]},"list"),H==="detail"&&p.jsx(da.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:p.jsx("div",{ref:M,className:"h-full",children:p.jsx(P4,{result:d,isLoading:h,previewMode:y,serverId:a,readResource:n,onTogglePreview:()=>_(!y),onCopy:z,onDownload:$,onFullscreen:j,isCopied:I})})},"detail")]})})]}):p.jsxs(gi,{direction:"horizontal",className:"h-full",children:[p.jsx(ar,{defaultSize:25,children:p.jsxs(gi,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[p.jsx(ar,{defaultSize:75,minSize:30,children:p.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[p.jsx(z4,{activeTab:w,isSearchExpanded:x,searchQuery:v,filteredResourcesCount:P.length,onSearchExpand:()=>k(!0),onSearchChange:S,onSearchBlur:ne,onTabSwitch:()=>{},searchInputRef:O}),p.jsx(U4,{resources:P,selectedResource:i,onResourceSelect:B,focusedIndex:C})]})}),p.jsx(Eo,{withHandle:!0}),p.jsxs(ar,{ref:W,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>Q(!0),onExpand:()=>Q(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[p.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:V=>{V.preventDefault(),V.stopPropagation(),G?(W.current?.resize(25),Q(!1)):(W.current?.resize(5),Q(!0))},children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),q>0&&p.jsx(fa,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:q}),q>0&&!G&&p.jsx(Fe,{variant:"ghost",size:"sm",onClick:V=>{V.preventDefault(),V.stopPropagation(),oe.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:p.jsx(Rl,{className:"h-3.5 w-3.5"})})]}),p.jsx(zl,{className:`h-4 w-4 text-muted-foreground transition-transform ${G?"":"rotate-180"}`})]}),!G&&p.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:p.jsx(EO,{serverIds:[a],onCountChange:ie,onClearRef:oe})})]})]})}),p.jsx(Eo,{}),p.jsx(ar,{defaultSize:50,children:p.jsx(gi,{direction:"vertical",children:p.jsx(ar,{defaultSize:70,children:p.jsx("div",{ref:M,className:"h-full bg-white dark:bg-zinc-900",children:p.jsx(P4,{result:d,isLoading:h,previewMode:y,serverId:a,readResource:n,onTogglePreview:()=>_(!y),onCopy:z,onDownload:$,onFullscreen:j,isCopied:I})})})})})]})}BK.displayName="ResourcesTab";function F4({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:a,focusedIndex:r}){if(e.length===0)return p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(qv,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),p.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const i=(s,c)=>{s.stopPropagation(),c()};return p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((s,c)=>p.jsxs("div",{className:"relative group",children:[p.jsx(pd,{id:`saved-${s.id}`,isSelected:t?.id===s.id,isFocused:r===c,icon:p.jsx(Cb,{className:"h-4 w-4"}),title:s.name,description:s.toolName,metadata:p.jsx("div",{className:"flex flex-col gap-1",children:p.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(s.savedAt).toLocaleString()})}),onClick:()=>n(s)}),p.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"secondary",size:"sm",onClick:u=>i(u,()=>a(s.id)),className:"h-8 w-8 p-0",children:p.jsx(Rl,{className:"h-4 w-4"})})}),p.jsx(wn,{children:p.jsx("p",{children:"Delete saved request"})})]})})]},s.id))})}function B4({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:a,onSave:r,onCancel:i}){return e?p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:i,children:p.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:s=>s.stopPropagation(),children:[p.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx(In,{htmlFor:"request-name",children:"Request Name (optional)"}),p.jsx(rr,{id:"request-name",value:t,onChange:s=>a(s.target.value),placeholder:n,className:"mt-2",onKeyDown:s=>{s.key==="Enter"&&r()},autoFocus:!0})]}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Fe,{variant:"outline",onClick:i,children:"Cancel"}),p.jsxs(Fe,{onClick:r,children:[p.jsx(qT,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function HK(e,t){if(!e?.$ref)return e;const n=e.$ref;if(n.startsWith("#/")){const a=n.substring(2).split("/");let r=t;for(const i of a)if(r&&typeof r=="object"&&i in r)r=r[i];else return console.warn(`Could not resolve $ref: ${n}`),e;return r}return e}function v_e(e,t){if(e.anyOf&&Array.isArray(e.anyOf)){const n=e.anyOf.find(a=>a.type!=="null");if(n)return{...HK(n,t),nullable:!0}}return e}function y_e(e){return Array.isArray(e.enum)?e.enum:null}function w_e({selectedTool:e,toolArgs:t,onArgChange:n}){const a=e?.inputSchema?.properties||{},r=e?.inputSchema?.required||[];return Object.keys(a).length>0?p.jsx("div",{className:"space-y-4",children:Object.entries(a).map(([s,c])=>{const u=e?.inputSchema||{};let d=v_e(c,u);d=HK(d,u);const m=y_e(d),h=d.type==="string"&&m!==null,g=d;g.required=r.includes(s);const v=t[s];let S="";return v!=null&&(typeof v=="string"?S=v:typeof v=="object"&&v!==null?S=JSON.stringify(v,null,2):S=String(v)),g.type==="object"||g.type==="array"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:s,className:"text-sm font-medium",children:[s,g?.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(uy,{id:s,value:S,onChange:y=>n(s,y.target.value),placeholder:g?.description||`Enter ${s}`,className:"min-h-[100px]"}),g?.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s):h&&m?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:s,className:"text-sm font-medium",children:[s,g.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsxs(iu,{value:String(t[s]||""),onValueChange:y=>n(s,y),children:[p.jsx(su,{id:s,className:"w-full",children:p.jsx(ou,{placeholder:g.description||"Select an option"})}),p.jsx(lu,{children:m.map((y,_)=>p.jsx(ci,{value:y,children:g.enumNames?.[_]||y},y))})]}),g.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s):p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:s,className:"text-sm font-medium",children:[s,g?.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(rr,{id:s,value:S,onChange:y=>n(s,y.target.value),placeholder:g?.description||`Enter ${s}`}),g?.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s)})}):p.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function H4({selectedTool:e,toolArgs:t,isExecuting:n,isConnected:a,onArgChange:r,onExecute:i,onSave:s}){return E.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&e&&!n&&a&&(u.preventDefault(),i())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n,a,i]),e?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"flex-shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-4 sm:pr-4",children:p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[p.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),p.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[p.jsxs(Fe,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[p.jsx(qT,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),p.jsx(Fe,{onClick:i,disabled:n||!a,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?p.jsxs(p.Fragment,{children:[p.jsx(Ao,{className:"mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(P9,{className:"h-4 w-4 sm:mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Execute"}),p.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&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:p.jsx(w_e,{selectedTool:e,toolArgs:t,onArgChange:r})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),p.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 V4(e){const n=Date.now()-e,a=Math.floor(n/1e3),r=Math.floor(a/60),i=Math.floor(r/60),s=Math.floor(i/24);return a<10?"now":a<60?`${a}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${s}d ago`}function S_e(e){try{return JSON.parse(e),!0}catch{return!1}}function E_e({content:e}){return!Array.isArray(e)||e.length===0?p.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content"}):p.jsx("div",{className:"space-y-4",children:e.map((t,n)=>{if(t.type==="text"){const a=t.text||"";if(S_e(a))try{const r=JSON.parse(a);return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content (JSON)"}),p.jsx(ur,{data:r,filename:`content-${n}.json`})]},n)}catch{}return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content"}),p.jsx("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words",children:a})]},n)}if(t.type==="image")return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Image Content"}),p.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[p.jsx("img",{src:`data:${t.mimeType||"image/png"};base64,${t.data}`,alt:"Result",className:"max-w-full rounded"}),t.annotations&&p.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:p.jsx(ur,{data:t.annotations,filename:`image-annotations-${n}.json`})})]})]},n);if(t.type==="audio")return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Audio Content"}),p.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[p.jsx("audio",{controls:!0,src:`data:${t.mimeType||"audio/wav"};base64,${t.data}`,className:"w-full"}),t.annotations&&p.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:p.jsx(ur,{data:t.annotations,filename:`audio-annotations-${n}.json`})})]})]},n);if(t.type==="resource_link")return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Resource Link"}),p.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[p.jsxs("div",{className:"font-mono text-sm break-all",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",t.uri]}),t.name&&p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Name:"})," ",t.name]}),t.description&&p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Description:"})," ",t.description]}),t.mimeType&&p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",t.mimeType]}),t.annotations&&p.jsxs("div",{className:"mt-2",children:[p.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),p.jsx(ur,{data:t.annotations,filename:`resource-link-annotations-${n}.json`})]})]})]},n);if(t.type==="resource"){const a=t.resource||{};return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Embedded Resource"}),p.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[p.jsxs("div",{className:"font-mono text-sm break-all",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",a.uri]}),a.mimeType&&p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",a.mimeType]}),a.text&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Content:"}),p.jsx("div",{className:"bg-white dark:bg-black rounded p-2 font-mono text-sm whitespace-pre-wrap break-words max-h-60 overflow-y-auto",children:a.text})]}),a.blob&&p.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["[Binary content: ",a.blob.length||0," bytes]"]}),a.annotations&&p.jsxs("div",{className:"mt-2",children:[p.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),p.jsx(ur,{data:a.annotations,filename:`resource-annotations-${n}.json`})]})]})]},n)}return p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Unknown Content Type: ",t.type||"N/A"]}),p.jsx(ur,{data:t,filename:`content-${n}.json`})]},n)})})}function G4({results:e,copiedResult:t,previewMode:n,serverId:a,readResource:r,onCopy:i,onTogglePreview:s,onMaximize:c,isMaximized:u=!1}){const[d,m]=E.useState(0),[h,g]=E.useState(""),[v,S]=E.useState(!0),w=e[0],y=w?e.filter(q=>q.toolName===w.toolName):[],_=y[d]||y[0],x=e.findIndex(q=>q===_);E.useEffect(()=>{y.length>0&&d>=y.length&&m(0)},[y.length,d]),E.useEffect(()=>{const q=()=>{_&&g(V4(_.timestamp))};q();const ie=setInterval(q,1e3);return()=>clearInterval(ie)},[_]);const k=E.useMemo(()=>_?.args,[_?.timestamp,d]),C=E.useMemo(()=>_?.result,[_?.timestamp,d]),R=E.useCallback(q=>r(q),[r]);if(e.length===0)return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-center",children:p.jsx(Wv,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})});const I=_.toolMeta?.["openai/outputTemplate"],A=!!(I&&typeof I=="string"&&_.appsSdkResource),O=I,M=_.result?.content||[],U=M.filter(q=>q.type==="resource"&&pu(q.resource)),F=U.length>0,H=!!(M&&M.length>0||_.result?.structuredContent),te=!F&&!A&&H;return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:p.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[p.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${F||A||te?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[p.jsx("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),_.duration!==void 0&&p.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[p.jsx(ap,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[_.duration,"ms"]})]}),A&&p.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[p.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",O||"No URI"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),F&&!A&&p.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[p.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",U[0]?.resource?.uri||"No URI"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),te&&p.jsxs("div",{className:"flex items-center gap-2 sm:ml-4",children:[p.jsx("button",{onClick:()=>S(!0),className:`text-xs font-medium ${v?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Formatted"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>S(!1),className:`text-xs font-medium ${v?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw"})]}),p.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(A||F)&&c&&p.jsx(Fe,{variant:"ghost",size:"sm",onClick:c,title:u?"Restore":"Maximize",children:u?p.jsx(upe,{className:"h-4 w-4"}):p.jsx(XT,{className:"h-4 w-4"})}),y.length>1&&p.jsxs(iu,{value:d.toString(),onValueChange:q=>m(parseInt(q)),children:[p.jsx(su,{size:"sm",className:"w-[140px] h-8 text-xs",children:p.jsx(ou,{children:p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Cb,{className:"h-3 w-3"}),p.jsx("span",{children:h})]})})}),p.jsx(lu,{children:y.map((q,ie)=>p.jsx(ci,{value:ie.toString(),children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Cb,{className:"h-3 w-3"}),p.jsx("span",{children:V4(q.timestamp)}),p.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",new Date(q.timestamp).toLocaleTimeString(),")"]})]})},ie))})]}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>i(x,_.result),children:t===x?p.jsx(Xa,{className:"h-4 w-4"}):p.jsx(ua,{className:"h-4 w-4"})})]})]}),_.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:_.error})]}):(()=>{if(A){const q=_.appsSdkResource;return q.isLoading?p.jsx(p.Fragment,{}):q.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:q.error})]}):n?p.jsx("div",{className:"flex-1",children:p.jsx(dO,{componentUrl:O,toolName:_.toolName,toolArgs:k,toolResult:C,serverId:a,readResource:R,className:"w-full h-full relative p-4"})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:_.result,filename:`tool-result-${_.toolName}-${Date.now()}.json`})})}if(F)return n?p.jsxs("div",{className:"space-y-0 h-full",children:[U.map((q,ie)=>p.jsx("div",{className:"mx-0 size-full",children:p.jsx(FK,{resource:q.resource,onUIAction:G=>{},className:"w-full h-full relative"})},ie)),M.filter(q=>!(q.type==="resource"&&pu(q.resource))).length>0&&p.jsx("div",{className:"px-4",children:p.jsx(ur,{data:M.filter(q=>!(q.type==="resource"&&pu(q.resource))),filename:`tool-result-${_.toolName}-non-ui-${Date.now()}.json`})})]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:_.result,filename:`tool-result-${_.toolName}-mcp-ui-${Date.now()}.json`})});if(te&&v){const q=_.result?.structuredContent;return p.jsxs("div",{className:"px-4 pt-4 space-y-4",children:[q&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Structured Content"}),p.jsx(ur,{data:q,filename:`structured-content-${_.toolName}-${Date.now()}.json`})]}),M&&M.length>0&&p.jsx(E_e,{content:M}),!q&&(!M||M.length===0)&&p.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content to display"})]})}return p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:_.result,filename:`tool-result-${_.toolName}-${Date.now()}.json`})})})()]})})})}function W4({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:a}){return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(Cl,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((r,i)=>p.jsx(pd,{id:`tool-${r.name}`,isSelected:t?.name===r.name,isFocused:a===i,icon:p.jsx(Cl,{className:"h-4 w-4"}),title:r.name,description:r.description,metadata:r.inputSchema?.properties&&p.jsxs(fa,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(r.inputSchema.properties).length," params"]}),onClick:()=>n(r)},r.name))})}function K4({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredToolsCount:a,savedRequestsCount:r,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return p.jsx(UK,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:a,secondaryCount:r,primaryIcon:Cl,secondaryIcon:qv,searchPlaceholder:"Search tools...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}const Z4="mcp-inspector-saved-requests";function VK({ref:e,tools:t,callTool:n,readResource:a,serverId:r,isConnected:i}){const[s,c]=E.useState(null),[u,d]=E.useState(null),{selectedToolName:m,setSelectedToolName:h}=qp(),[g,v]=E.useState({}),[S,w]=E.useState([]),[y,_]=E.useState(!1),[x,k]=E.useState(null),[C,R]=E.useState(""),[I,A]=E.useState("tools"),[O,M]=E.useState([]),[U,F]=E.useState(!1),[H,te]=E.useState(""),[q,ie]=E.useState(!0),[G,Q]=E.useState(!1),[W,oe]=E.useState(-1),ne=E.useRef(null),[P,B]=E.useState(!1),[z,$]=E.useState("list"),[j,V]=E.useState(!1),[K,X]=E.useState(0),[se,le]=E.useState(!0),[J,ee]=E.useState(void 0),ce=E.useRef(null),re=E.useRef(null),ye=E.useRef(null),Te=E.useRef(null),He=E.useRef(null);E.useEffect(()=>{const ke=()=>{B(window.innerWidth<1024)};return ke(),window.addEventListener("resize",ke),()=>window.removeEventListener("resize",ke)},[]),E.useEffect(()=>{$(s?"detail":"list")},[s]),E.useEffect(()=>{P&&S.length>0&&!y&&$("response")},[S,y,P]),E.useImperativeHandle(e,()=>({focusSearch:()=>{Q(!0),setTimeout(()=>{ne.current&&ne.current.focus()},0)},blurSearch:()=>{R(""),Q(!1),ne.current&&ne.current.blur()}})),E.useEffect(()=>{try{const ke=localStorage.getItem(Z4);ke&&M(JSON.parse(ke))}catch(ke){console.error("[ToolsTab] Failed to load saved requests:",ke)}},[]);const _e=E.useCallback(ke=>{try{localStorage.setItem(Z4,JSON.stringify(ke)),M(ke)}catch(Ie){console.error("[ToolsTab] Failed to save requests:",Ie)}},[]),Se=E.useMemo(()=>{if(!C.trim())return t;const ke=C.toLowerCase();return t.filter(Ie=>Ie.name.toLowerCase().includes(ke)||Ie.description?.toLowerCase().includes(ke))},[t,C]),Ue=E.useCallback(ke=>{c(ke);const Ie={};ke.inputSchema?.properties&&Object.entries(ke.inputSchema.properties).forEach(([ze,gt])=>{const nt=gt;nt.default!==void 0?Ie[ze]=nt.default:nt.type==="string"?Ie[ze]="":nt.type==="number"?Ie[ze]=0:nt.type==="boolean"?Ie[ze]=!1:nt.type==="array"?Ie[ze]="[]":nt.type==="object"&&(Ie[ze]="{}")}),v(Ie)},[]),pe=E.useCallback(ke=>{const Ie=t.find(ze=>ze.name===ke.toolName);Ie&&(c(Ie),v(ke.args),d(ke))},[t]);E.useEffect(()=>{G&&ne.current&&ne.current.focus()},[G]);const $e=E.useCallback(()=>{C.trim()||Q(!1)},[C]);E.useEffect(()=>{I!=="tools"&&Q(!1)},[I]),E.useEffect(()=>{oe(-1)},[C,I]),E.useEffect(()=>{const ke=Ie=>{const ze=Ie.target;if(ze.tagName==="INPUT"||ze.tagName==="TEXTAREA"||ze.contentEditable==="true"||Ie.metaKey||Ie.ctrlKey||Ie.altKey)return;const nt=I==="tools"?Se:O;if(Ie.key==="ArrowDown")Ie.preventDefault(),oe(et=>{const Ct=et+1;return Ct>=nt.length?0:Ct});else if(Ie.key==="ArrowUp")Ie.preventDefault(),oe(et=>{const Ct=et-1;return Ct<0?nt.length-1:Ct});else if(Ie.key==="Enter"&&W>=0)if(Ie.preventDefault(),I==="tools"){const et=Se[W];et&&Ue(et)}else{const et=O[W];et&&pe(et)}};return document.addEventListener("keydown",ke),()=>document.removeEventListener("keydown",ke)},[W,Se,O,I,Ue,pe]),E.useEffect(()=>{if(W>=0){const ke=I==="tools"?`tool-${Se[W]?.name}`:`saved-${O[W]?.id}`,Ie=document.getElementById(ke);Ie&&Ie.scrollIntoView({behavior:"smooth",block:"nearest"})}},[W,Se,O,I]),E.useEffect(()=>{if(m&&t.length>0){const ke=t.find(Ie=>Ie.name===m);if(ke&&s?.name!==ke.name){h(null);const Ie=setTimeout(()=>{Ue(ke);const ze=document.getElementById(`tool-${ke.name}`);ze&&ze.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Ie)}}},[m,t,s,Ue,h]);const Be=E.useCallback((ke,Ie)=>{v(ze=>{const gt={...ze};if(s?.inputSchema?.properties?.[ke]){const et=s.inputSchema.properties[ke].type;if(et==="object"||et==="array")gt[ke]=Ie;else if(et==="string")gt[ke]=Ie;else try{gt[ke]=JSON.parse(Ie)}catch{gt[ke]=Ie}}else gt[ke]=Ie;return gt})},[s]),Ee=E.useCallback(async()=>{if(!s||y)return;_(!0);const ke=Date.now();try{const Ie={...g};s.inputSchema?.properties&&Object.entries(s.inputSchema.properties).forEach(([En,_t])=>{const Ft=_t.type,qe=Ie[En];if((Ft==="object"||Ft==="array")&&typeof qe=="string")try{Ie[En]=JSON.parse(qe)}catch{}});const ze=await n(s.name,Ie,{timeout:6e5,resetTimeoutOnProgress:!0}),gt=Date.now()-ke;br.getInstance().capture(new YP({toolName:s.name,serverId:r,success:!0,duration:gt})).catch(()=>{});const et=s?._meta||s?.metadata,Ct=et?.["openai/outputTemplate"];let Lt;if(Ct&&typeof Ct=="string"){const En={toolName:s.name,args:g,result:ze,timestamp:ke,duration:gt,toolMeta:et,appsSdkResource:{uri:Ct,resourceData:null,isLoading:!0}};w([En]);try{const _t=await a(Ct);let Zt=null;if(ze?.structuredContent)Zt=ze.structuredContent;else if(Array.isArray(ze)&&ze[0]){const Ft=ze[0];Ft.output?.value?.structuredContent?Zt=Ft.output.value.structuredContent:Ft.structuredContent?Zt=Ft.structuredContent:Ft.output?.value&&(Zt=Ft.output.value)}Zt||(Zt=ze),Lt={uri:Ct,resourceData:{..._t,structuredContent:Zt},isLoading:!1}}catch(_t){Lt={uri:Ct,resourceData:null,isLoading:!1,error:_t instanceof Error?_t.message:String(_t)}}w(_t=>_t.map((Zt,Ft)=>Ft===0?{...Zt,appsSdkResource:Lt}:Zt))}else w(En=>[{toolName:s.name,args:g,result:ze,timestamp:ke,duration:gt,toolMeta:et},...En])}catch(Ie){const ze=Date.now()-ke;br.getInstance().capture(new YP({toolName:s.name,serverId:r,success:!1,duration:ze,error:Ie instanceof Error?Ie.message:String(Ie)})).catch(()=>{});const nt=s?._meta||s?.metadata,et={toolName:s.name,args:g,result:null,error:Ie instanceof Error?Ie.message:String(Ie),timestamp:ke,duration:ze,toolMeta:nt},Ct=nt?.["openai/outputTemplate"];w(Ct?[et]:Lt=>[et,...Lt])}finally{_(!1)}},[s,g,y,n,a,r]),ot=E.useCallback(async(ke,Ie)=>{try{await navigator.clipboard.writeText(JSON.stringify(Ie,null,2)),k(ke),setTimeout(()=>k(null),2e3)}catch(ze){console.error("[ToolsTab] Failed to copy result:",ze)}},[]),at=E.useCallback(ke=>{w(Ie=>Ie.filter((ze,gt)=>gt!==ke))},[]),pt=E.useCallback(ke=>{const Ie=S[ke];if(Ie){const ze=window.open("","_blank","width=800,height=600");ze&&(ze.document.write(`
1669
+ `);k=I.pop()||"";for(const A of I)if(A.trim()&&A.startsWith("data: "))try{const O=JSON.parse(A.slice(6));if(console.log("[Client received event]",O.type,O.toolName||O.content?.slice?.(0,30)),O.type==="message")console.log("[Message started]",O.id);else if(O.type==="text"){w+=O.content;const M=y[y.length-1];M&&M.type==="text"?M.text=w:y.push({type:"text",text:w}),console.log("[Parts after text]",y.length,"parts, text length:",w.length),i(U=>U.map(F=>F.id===S?{...F,parts:[...y]}:F))}else if(O.type==="tool-call")w&&(w=""),y.push({type:"tool-invocation",toolInvocation:{toolName:O.toolName,args:O.args,state:"pending"}}),console.log("[Parts after tool-call]",y.length,"parts, tool:",O.toolName),i(M=>M.map(U=>U.id===S?{...U,parts:[...y]}:U));else if(O.type==="tool-result"){const M=y.find(U=>U.type==="tool-invocation"&&U.toolInvocation?.toolName===O.toolName&&!U.toolInvocation?.result);M&&M.toolInvocation?(M.toolInvocation.result=O.result,M.toolInvocation.state="result",console.log("[Parts after tool-result]",y.length,"parts, updated:",O.toolName),i(U=>U.map(F=>F.id===S?{...F,parts:[...y]}:F))):console.warn("[tool-result] Could not find matching tool part for",O.toolName)}else if(O.type==="done")console.log("[Done] Final parts:",y.length),i(M=>M.map(U=>U.id===S?{...U,parts:[...y],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(g){let v="Unknown error occurred";if(g instanceof Error){v=g.message;const w=g;w.status&&(v=`HTTP ${w.status}: ${v}`),(w.code===401||v.includes("401")||v.includes("Unauthorized"))&&(v="Authentication failed (401). Check your Authorization header in the connection settings.")}const S={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${v}`,timestamp:Date.now()};i(w=>[...w,S])}finally{c(!1)}},[t,a,e,r,n]),d=E.useCallback(()=>{i([])},[]);return{messages:r,isLoading:s,sendMessage:u,clearMessages:d}}function $xe({connection:e,llmConfig:t,isConnected:n,readResource:a}){const[r,i]=E.useState([]),[s,c]=E.useState(!1),u=E.useRef(null),d=E.useRef(null),m=E.useRef(null),h=E.useCallback(async v=>{if(!v.trim()||!t||!n)return;const S={id:`user-${Date.now()}`,role:"user",content:v.trim(),timestamp:Date.now()};i(_=>[..._,S]),c(!0),u.current=new AbortController;const w=Date.now();let y=0;try{const _=`assistant-${Date.now()}`;let x="";const k=[];if(i(C=>[...C,{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 C;if(t.provider==="openai"){const{ChatOpenAI:R}=await di(async()=>{const{ChatOpenAI:I}=await import("./index-Dwx0D9tm.js");return{ChatOpenAI:I}},__vite__mapDeps([5,6,3,7,8]));C=new R({model:t.model,apiKey:t.apiKey})}else if(t.provider==="anthropic"){const{ChatAnthropic:R}=await di(async()=>{const{ChatAnthropic:I}=await import("./index-FfhUz5GP.js");return{ChatAnthropic:I}},__vite__mapDeps([9,6,3]));C=new R({model:t.model,apiKey:t.apiKey})}else if(t.provider==="google"){const{ChatGoogleGenerativeAI:R}=await di(async()=>{const{ChatGoogleGenerativeAI:I}=await import("./index-BDueMm07.js");return{ChatGoogleGenerativeAI:I}},__vite__mapDeps([10,6,3,8]));C=new R({model:t.model,apiKey:t.apiKey})}else throw new Error(`Unsupported LLM provider: ${t.provider}`);m.current={instance:C,provider:t.provider,model:t.model,apiKey:t.apiKey}}if(!d.current||d.current.llm!==m.current.instance){const{MCPAgent:C}=await di(async()=>{const{MCPAgent:R}=await import("./browser-BaWfMf0m.js");return{MCPAgent:R}},__vite__mapDeps([11,7,6,3,2,4,8]));d.current=new C({llm:m.current.instance,client:e.client,memoryEnabled:!0,systemPrompt:"You are a helpful assistant with access to MCP tools, prompts, and resources. Help users interact with the MCP server."}),await d.current.initialize()}else console.log("[useChatMessagesClientSide] Reusing existing agent. History length:",d.current.conversationHistory?.length);for await(const C of d.current.streamEvents(v,10,!1,void 0)){if(u.current?.signal.aborted)break;if(C.event==="on_chat_model_stream"&&C.data?.chunk?.text){const R=C.data.chunk.text;if(typeof R=="string"&&R.length>0){x+=R;const I=k[k.length-1];I&&I.type==="text"?I.text=x:k.push({type:"text",text:x}),i(A=>A.map(O=>O.id===_?{...O,parts:[...k]}:O))}}else if(C.event==="on_tool_start"){x&&(x="");let R={};C.data?.input?R=C.data.input:C.data?.tool_input?R=C.data.tool_input:C.data&&(R=C.data),console.log("[useChatMessagesClientSide] on_tool_start:",{toolName:C.name,eventData:C.data,extractedArgs:R}),y++,k.push({type:"tool-invocation",toolInvocation:{toolName:C.name||"unknown",args:R,state:"pending"}}),i(I=>I.map(A=>A.id===_?{...A,parts:[...k]}:A))}else if(C.event==="on_tool_end"){const R=k.find(I=>I.type==="tool-invocation"&&I.toolInvocation?.toolName===C.name&&!I.toolInvocation?.result);if(console.log("[useChatMessagesClientSide] on_tool_end event:",{toolName:C.name,hasToolPart:!!R,output:C.data?.output}),R&&R.toolInvocation){let I=C.data?.output;if(I?.kwargs?.content&&typeof I.kwargs.content=="string")try{I=JSON.parse(I.kwargs.content)}catch(O){console.warn("[useChatMessagesClientSide] Failed to parse kwargs.content:",O),I=I.kwargs.content}else if(I?.content&&typeof I.content=="string")try{I=JSON.parse(I.content)}catch{I=I.content}R.toolInvocation.result=I,R.toolInvocation.state="result";const A=I?._meta?.["openai/outputTemplate"];if(console.log("[useChatMessagesClientSide] Tool result:",{toolName:C.name,hasMeta:!!I?._meta,hasStructuredContent:!!I?.structuredContent,appsSdkUri:A}),A&&typeof A=="string"&&a){console.log("[useChatMessagesClientSide] Detected Apps SDK component, fetching resource:",A);try{const O=await a(A);console.log("[useChatMessagesClientSide] Resource fetched:",O);const M=I?.structuredContent||null;if(O?.contents&&Array.isArray(O.contents)){const U=O.contents.map(H=>({type:"resource",resource:H}));console.log("[useChatMessagesClientSide] Created MCP resources:",U);const F={...I,content:[...I.content||[],...U],structuredContent:M};R.toolInvocation.result=F,console.log("[useChatMessagesClientSide] Updated result with resources")}else console.warn("[useChatMessagesClientSide] No contents in resourceData:",O)}catch(O){console.error("Failed to fetch Apps SDK resource:",O)}}i(O=>O.map(M=>M.id===_?{...M,parts:[...k]}:M))}}}i(C=>C.map(R=>R.id===_?{...R,parts:[...k],content:""}:R)),t&&br.getInstance().capture(new JP({serverId:e.url,provider:t.provider,model:t.model,messageCount:r.length+1,toolCallsCount:y,success:!0,executionMode:"client-side",duration:Date.now()-w})).catch(()=>{})}catch(_){console.error("Client-side agent error:",_);let x="Unknown error occurred";if(_ instanceof Error){x=_.message;const C=_;C.status&&(x=`HTTP ${C.status}: ${x}`),(C.code===401||x.includes("401")||x.includes("Unauthorized"))&&(x="Authentication failed (401). Check your Authorization header in the connection settings.")}t&&br.getInstance().capture(new JP({serverId:e.url,provider:t.provider,model:t.model,messageCount:r.length+1,toolCallsCount:y,success:!1,executionMode:"client-side",duration:Date.now()-w,error:x})).catch(()=>{});const k={id:`error-${Date.now()}`,role:"assistant",content:`Error: ${x}`,timestamp:Date.now()};i(C=>[...C,k])}finally{c(!1),u.current=null}},[e,t,n,r,a]),g=E.useCallback(()=>{i([]),d.current&&d.current.clearConversationHistory()},[]);return{messages:r,isLoading:s,sendMessage:h,clearMessages:g}}const E4={openai:"gpt-4o",anthropic:"claude-haiku-4-5-20251001",google:"gemini-2.5-flash"};function Lxe({mcpServerUrl:e}){const[t,n]=E.useState(null),[a,r]=E.useState(null),[i,s]=E.useState(!1),[c,u]=E.useState("openai"),[d,m]=E.useState(""),[h,g]=E.useState(E4.openai),v=E.useCallback(()=>{const M=localStorage.getItem("mcp-inspector-api-keys");if(M)try{return JSON.parse(M)}catch(U){return console.error("Failed to load API keys:",U),{}}return{}},[]),S=E.useCallback(M=>{localStorage.setItem("mcp-inspector-api-keys",JSON.stringify(M))},[]),[w,y]=E.useState("none"),[_,x]=E.useState(""),[k,C]=E.useState(""),[R,I]=E.useState("");E.useEffect(()=>{const M=localStorage.getItem("mcp-inspector-llm-config"),U=v();if(M)try{const F=JSON.parse(M);n(F),u(F.provider),m(U[F.provider]||F.apiKey||""),g(F.model)}catch(F){console.error("Failed to load LLM config:",F)}},[v]),E.useEffect(()=>{const M=localStorage.getItem("mcp-inspector-auth-config");if(M)try{const U=JSON.parse(M);r(U),y(U.type),U.username&&x(U.username),U.password&&C(U.password),U.token&&I(U.token)}catch(U){console.error("Failed to load auth config:",U)}else try{const U="mcp:auth",F=bK(e),H=`${U}_${F}_tokens`;localStorage.getItem(H)&&(r({type:"oauth"}),y("oauth"))}catch(U){console.error("Failed to check for OAuth tokens:",U)}},[e]),E.useEffect(()=>{g(E4[c]);const M=v();m(M[c]||"")},[c,v]);const A=E.useCallback(()=>{if(!d.trim())return;const M=v();M[c]=d,S(M);const U={provider:c,apiKey:d,model:h},F={type:w,...w==="basic"&&{username:_.trim(),password:k.trim()},...w==="bearer"&&{token:R.trim()}};n(U),r(F),localStorage.setItem("mcp-inspector-llm-config",JSON.stringify(U)),localStorage.setItem("mcp-inspector-auth-config",JSON.stringify(F)),s(!1)},[c,d,h,w,_,k,R,v,S]),O=E.useCallback(()=>{n(null),r(null);const M=v();delete M[c],S(M),m(""),x(""),C(""),I(""),y("none"),localStorage.removeItem("mcp-inspector-llm-config"),localStorage.removeItem("mcp-inspector-auth-config")},[c,v,S]);return{llmConfig:t,authConfig:a,configDialogOpen:i,setConfigDialogOpen:s,tempProvider:c,setTempProvider:u,tempApiKey:d,setTempApiKey:m,tempModel:h,setTempModel:g,tempAuthType:w,saveLLMConfig:A,clearConfig:O}}function Mxe({connection:e,isConnected:t,useClientSide:n=!0,readResource:a}){const[r,i]=E.useState(""),s=E.useRef(null),{llmConfig:c,authConfig:u,configDialogOpen:d,setConfigDialogOpen:m,tempProvider:h,setTempProvider:g,tempApiKey:v,setTempApiKey:S,tempModel:w,setTempModel:y,saveLLMConfig:_,clearConfig:x}=Lxe({mcpServerUrl:e.url}),k={connection:e,llmConfig:c,isConnected:t,readResource:a},C=Dxe({mcpServerUrl:e.url,llmConfig:c,authConfig:u,isConnected:t}),R=$xe(k),{messages:I,isLoading:A,sendMessage:O,clearMessages:M}=n?R:C;gW({onNewChat:M}),E.useEffect(()=>{c&&I.length===0&&s.current&&s.current.focus()},[c,I.length]),E.useEffect(()=>{!A&&I.length>0&&s.current&&s.current.focus()},[A,I.length]);const U=E.useCallback(()=>{r.trim()&&(O(r),i(""))},[r,O]),F=E.useCallback(te=>{te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),U())},[U]),H=E.useCallback(()=>{x(),M()},[x,M]);return c&&I.length===0?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"absolute top-4 right-4 z-10",children:p.jsx(Ax,{open:d,onOpenChange:m,tempProvider:h,tempModel:w,tempApiKey:v,onProviderChange:g,onModelChange:y,onApiKeyChange:S,onSave:_,onClear:H,showClearButton:!0,buttonLabel:"Change API Key"})}),p.jsx(Zwe,{mcpServerUrl:e.url,inputValue:r,isConnected:t,isLoading:A,textareaRef:s,llmConfig:c,onInputChange:i,onKeyDown:F,onSubmit:te=>{te.preventDefault(),U()},onConfigDialogOpenChange:m})]}):p.jsxs("div",{className:"flex flex-col h-full relative",children:[p.jsx(Gwe,{llmConfig:c,hasMessages:I.length>0,configDialogOpen:d,onConfigDialogOpenChange:m,onClearChat:M,tempProvider:h,tempModel:w,tempApiKey:v,onProviderChange:g,onModelChange:y,onApiKeyChange:S,onSaveConfig:_,onClearConfig:H}),p.jsx("div",{className:"flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",children:c?p.jsx(Oxe,{messages:I,isLoading:A,serverId:e.url,readResource:a}):p.jsx(Ywe,{onConfigureClick:()=>m(!0)})}),c&&p.jsx(Wwe,{inputValue:r,isConnected:t,isLoading:A,textareaRef:s,onInputChange:i,onKeyDown:F,onSendMessage:U})]})}const Ny=E.createContext(null);Ny.displayName="PanelGroupContext";const Vn={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"},vO=10,wl=E.useLayoutEffect,x4=Av.useId,jxe=typeof x4=="function"?x4:()=>null;let Pxe=0;function yO(e=null){const t=jxe(),n=E.useRef(e||t||null);return n.current===null&&(n.current=""+Pxe++),e??n.current}function vK({children:e,className:t="",collapsedSize:n,collapsible:a,defaultSize:r,forwardedRef:i,id:s,maxSize:c,minSize:u,onCollapse:d,onExpand:m,onResize:h,order:g,style:v,tagName:S="div",...w}){const y=E.useContext(Ny);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:_,expandPanel:x,getPanelSize:k,getPanelStyle:C,groupId:R,isPanelCollapsed:I,reevaluatePanelConstraints:A,registerPanel:O,resizePanel:M,unregisterPanel:U}=y,F=yO(s),H=E.useRef({callbacks:{onCollapse:d,onExpand:m,onResize:h},constraints:{collapsedSize:n,collapsible:a,defaultSize:r,maxSize:c,minSize:u},id:F,idIsFromProps:s!==void 0,order:g});E.useRef({didLogMissingDefaultSizeWarning:!1}),wl(()=>{const{callbacks:q,constraints:ie}=H.current,G={...ie};H.current.id=F,H.current.idIsFromProps=s!==void 0,H.current.order=g,q.onCollapse=d,q.onExpand=m,q.onResize=h,ie.collapsedSize=n,ie.collapsible=a,ie.defaultSize=r,ie.maxSize=c,ie.minSize=u,(G.collapsedSize!==ie.collapsedSize||G.collapsible!==ie.collapsible||G.maxSize!==ie.maxSize||G.minSize!==ie.minSize)&&A(H.current,G)}),wl(()=>{const q=H.current;return O(q),()=>{U(q)}},[g,F,O,U]),E.useImperativeHandle(i,()=>({collapse:()=>{_(H.current)},expand:q=>{x(H.current,q)},getId(){return F},getSize(){return k(H.current)},isCollapsed(){return I(H.current)},isExpanded(){return!I(H.current)},resize:q=>{M(H.current,q)}}),[_,x,k,I,F,M]);const te=C(H.current,r);return E.createElement(S,{...w,children:e,className:t,id:F,style:{...te,...v},[Vn.groupId]:R,[Vn.panel]:"",[Vn.panelCollapsible]:a||void 0,[Vn.panelId]:F,[Vn.panelSize]:parseFloat(""+te.flexGrow).toFixed(1)})}const yK=E.forwardRef((e,t)=>E.createElement(vK,{...e,forwardedRef:t}));vK.displayName="Panel";yK.displayName="forwardRef(Panel)";let o_=null,Qg=-1,vs=null;function Uxe(e,t,n){const a=(t&_K)!==0,r=(t&kK)!==0,i=(t&TK)!==0,s=(t&NK)!==0;if(t){if(a)return i?"se-resize":s?"ne-resize":"e-resize";if(r)return i?"sw-resize":s?"nw-resize":"w-resize";if(i)return"s-resize";if(s)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function zxe(){vs!==null&&(document.head.removeChild(vs),o_=null,vs=null,Qg=-1)}function tE(e,t,n){var a,r;const i=Uxe(e,t);if(o_!==i){if(o_=i,vs===null&&(vs=document.createElement("style"),document.head.appendChild(vs)),Qg>=0){var s;(s=vs.sheet)===null||s===void 0||s.removeRule(Qg)}Qg=(a=(r=vs.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${i} !important;}`))!==null&&a!==void 0?a:-1}}function wK(e){return e.type==="keydown"}function SK(e){return e.type.startsWith("pointer")}function EK(e){return e.type.startsWith("mouse")}function Ry(e){if(SK(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(EK(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Fxe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Bxe(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 Hxe(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:T4(e),b:T4(t)};let a;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),a=e;Et(a,"Stacking order can only be calculated for elements with a common ancestor");const r={a:k4(_4(n.a)),b:k4(_4(n.b))};if(r.a===r.b){const i=a.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const u=i[c];if(u===s.a)return 1;if(u===s.b)return-1}}return Math.sign(r.a-r.b)}const Vxe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Gxe(e){var t;const n=getComputedStyle((t=xK(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Wxe(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Gxe(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"||Vxe.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function _4(e){let t=e.length;for(;t--;){const n=e[t];if(Et(n,"Missing node"),Wxe(n))return n}return null}function k4(e){return e&&Number(getComputedStyle(e).zIndex)||0}function T4(e){const t=[];for(;e;)t.push(e),e=xK(e);return t}function xK(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const _K=1,kK=2,TK=4,NK=8,Kxe=Fxe()==="coarse";let hi=[],fu=!1,ys=new Map,Cy=new Map;const vp=new Set;function Zxe(e,t,n,a,r){var i;const{ownerDocument:s}=t,c={direction:n,element:t,hitAreaMargins:a,setResizeHandlerState:r},u=(i=ys.get(s))!==null&&i!==void 0?i:0;return ys.set(s,u+1),vp.add(c),nv(),function(){var m;Cy.delete(e),vp.delete(c);const h=(m=ys.get(s))!==null&&m!==void 0?m:1;if(ys.set(s,h-1),nv(),h===1&&ys.delete(s),hi.includes(c)){const g=hi.indexOf(c);g>=0&&hi.splice(g,1),Ay(),r("up",!0,null)}}}function Yxe(e){const{target:t}=e,{x:n,y:a}=Ry(e);fu=!0,wO({target:t,x:n,y:a}),nv(),hi.length>0&&(rv("down",e),Ay(),e.preventDefault(),RK(t)||e.stopImmediatePropagation())}function nE(e){const{x:t,y:n}=Ry(e);if(fu&&e.type!=="pointerleave"&&e.buttons===0&&(fu=!1,rv("up",e)),!fu){const{target:a}=e;wO({target:a,x:t,y:n})}rv("move",e),Ay(),hi.length>0&&e.preventDefault()}function rE(e){const{target:t}=e,{x:n,y:a}=Ry(e);Cy.clear(),fu=!1,hi.length>0&&(e.preventDefault(),RK(t)||e.stopImmediatePropagation()),rv("up",e),wO({target:t,x:n,y:a}),Ay(),nv()}function RK(e){let t=e;for(;t;){if(t.hasAttribute(Vn.resizeHandle))return!0;t=t.parentElement}return!1}function wO({target:e,x:t,y:n}){hi.splice(0);let a=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(a=e),vp.forEach(r=>{const{element:i,hitAreaMargins:s}=r,c=i.getBoundingClientRect(),{bottom:u,left:d,right:m,top:h}=c,g=Kxe?s.coarse:s.fine;if(t>=d-g&&t<=m+g&&n>=h-g&&n<=u+g){if(a!==null&&document.contains(a)&&i!==a&&!i.contains(a)&&!a.contains(i)&&Hxe(a,i)>0){let S=a,w=!1;for(;S&&!S.contains(i);){if(Bxe(S.getBoundingClientRect(),c)){w=!0;break}S=S.parentElement}if(w)return}hi.push(r)}})}function aE(e,t){Cy.set(e,t)}function Ay(){let e=!1,t=!1;hi.forEach(a=>{const{direction:r}=a;r==="horizontal"?e=!0:t=!0});let n=0;Cy.forEach(a=>{n|=a}),e&&t?tE("intersection",n):e?tE("horizontal",n):t?tE("vertical",n):zxe()}let iE;function nv(){var e;(e=iE)===null||e===void 0||e.abort(),iE=new AbortController;const t={capture:!0,signal:iE.signal};vp.size&&(fu?(hi.length>0&&ys.forEach((n,a)=>{const{body:r}=a;n>0&&(r.addEventListener("contextmenu",rE,t),r.addEventListener("pointerleave",nE,t),r.addEventListener("pointermove",nE,t))}),ys.forEach((n,a)=>{const{body:r}=a;r.addEventListener("pointerup",rE,t),r.addEventListener("pointercancel",rE,t)})):ys.forEach((n,a)=>{const{body:r}=a;n>0&&(r.addEventListener("pointerdown",Yxe,t),r.addEventListener("pointermove",nE,t))}))}function rv(e,t){vp.forEach(n=>{const{setResizeHandlerState:a}=n,r=hi.includes(n);a(e,r,t)})}function Xxe(){const[e,t]=E.useState(0);return E.useCallback(()=>t(n=>n+1),[])}function Et(e,t){if(!e)throw console.error(t),Error(t)}function Ll(e,t,n=vO){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function bo(e,t,n=vO){return Ll(e,t,n)===0}function Na(e,t,n){return Ll(e,t,n)===0}function qxe(e,t,n){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++){const r=e[a],i=t[a];if(!Na(r,i,n))return!1}return!0}function eu({panelConstraints:e,panelIndex:t,size:n}){const a=e[t];Et(a!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:r=0,collapsible:i,maxSize:s=100,minSize:c=0}=a;if(Ll(n,c)<0)if(i){const u=(r+c)/2;Ll(n,u)<0?n=r:n=c}else n=c;return n=Math.min(s,n),n=parseFloat(n.toFixed(vO)),n}function kf({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:a,prevLayout:r,trigger:i}){if(Na(e,0))return t;const s=[...t],[c,u]=a;Et(c!=null,"Invalid first pivot index"),Et(u!=null,"Invalid second pivot index");let d=0;if(i==="keyboard"){{const h=e<0?u:c,g=n[h];Et(g,`Panel constraints not found for index ${h}`);const{collapsedSize:v=0,collapsible:S,minSize:w=0}=g;if(S){const y=t[h];if(Et(y!=null,`Previous layout not found for panel index ${h}`),Na(y,v)){const _=w-y;Ll(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const h=e<0?c:u,g=n[h];Et(g,`No panel constraints found for index ${h}`);const{collapsedSize:v=0,collapsible:S,minSize:w=0}=g;if(S){const y=t[h];if(Et(y!=null,`Previous layout not found for panel index ${h}`),Na(y,w)){const _=y-v;Ll(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}}{const h=e<0?1:-1;let g=e<0?u:c,v=0;for(;;){const w=t[g];Et(w!=null,`Previous layout not found for panel index ${g}`);const _=eu({panelConstraints:n,panelIndex:g,size:100})-w;if(v+=_,g+=h,g<0||g>=n.length)break}const S=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-S:S}{let g=e<0?c:u;for(;g>=0&&g<n.length;){const v=Math.abs(e)-Math.abs(d),S=t[g];Et(S!=null,`Previous layout not found for panel index ${g}`);const w=S-v,y=eu({panelConstraints:n,panelIndex:g,size:w});if(!Na(S,y)&&(d+=S-y,s[g]=y,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(qxe(r,s))return r;{const h=e<0?u:c,g=t[h];Et(g!=null,`Previous layout not found for panel index ${h}`);const v=g+d,S=eu({panelConstraints:n,panelIndex:h,size:v});if(s[h]=S,!Na(S,v)){let w=v-S,_=e<0?u:c;for(;_>=0&&_<n.length;){const x=s[_];Et(x!=null,`Previous layout not found for panel index ${_}`);const k=x+w,C=eu({panelConstraints:n,panelIndex:_,size:k});if(Na(x,C)||(w-=C-x,s[_]=C),Na(w,0))break;e>0?_--:_++}}}const m=s.reduce((h,g)=>g+h,0);return Na(m,100)?s:r}function Jxe({layout:e,panelsArray:t,pivotIndices:n}){let a=0,r=100,i=0,s=0;const c=n[0];Et(c!=null,"No pivot index found"),t.forEach((h,g)=>{const{constraints:v}=h,{maxSize:S=100,minSize:w=0}=v;g===c?(a=w,r=S):(i+=w,s+=S)});const u=Math.min(r,100-i),d=Math.max(a,100-s),m=e[c];return{valueMax:u,valueMin:d,valueNow:m}}function yp(e,t=document){return Array.from(t.querySelectorAll(`[${Vn.resizeHandleId}][data-panel-group-id="${e}"]`))}function CK(e,t,n=document){const r=yp(e,n).findIndex(i=>i.getAttribute(Vn.resizeHandleId)===t);return r??null}function AK(e,t,n){const a=CK(e,t,n);return a!=null?[a,a+1]:[-1,-1]}function Qxe(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function IK(e,t=document){if(Qxe(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function Iy(e,t=document){const n=t.querySelector(`[${Vn.resizeHandleId}="${e}"]`);return n||null}function e_e(e,t,n,a=document){var r,i,s,c;const u=Iy(t,a),d=yp(e,a),m=u?d.indexOf(u):-1,h=(r=(i=n[m])===null||i===void 0?void 0:i.id)!==null&&r!==void 0?r:null,g=(s=(c=n[m+1])===null||c===void 0?void 0:c.id)!==null&&s!==void 0?s:null;return[h,g]}function t_e({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:a,panelDataArray:r,panelGroupElement:i,setLayout:s}){E.useRef({didWarnAboutMissingResizeHandle:!1}),wl(()=>{if(!i)return;const c=yp(n,i);for(let u=0;u<r.length-1;u++){const{valueMax:d,valueMin:m,valueNow:h}=Jxe({layout:a,panelsArray:r,pivotIndices:[u,u+1]}),g=c[u];if(g!=null){const v=r[u];Et(v,`No panel data found for index "${u}"`),g.setAttribute("aria-controls",v.id),g.setAttribute("aria-valuemax",""+Math.round(d)),g.setAttribute("aria-valuemin",""+Math.round(m)),g.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((u,d)=>{u.removeAttribute("aria-controls"),u.removeAttribute("aria-valuemax"),u.removeAttribute("aria-valuemin"),u.removeAttribute("aria-valuenow")})}},[n,a,r,i]),E.useEffect(()=>{if(!i)return;const c=t.current;Et(c,"Eager values not found");const{panelDataArray:u}=c,d=IK(n,i);Et(d!=null,`No group found for id "${n}"`);const m=yp(n,i);Et(m,`No resize handles found for group id "${n}"`);const h=m.map(g=>{const v=g.getAttribute(Vn.resizeHandleId);Et(v,"Resize handle element has no handle id attribute");const[S,w]=e_e(n,v,u,i);if(S==null||w==null)return()=>{};const y=_=>{if(!_.defaultPrevented)switch(_.key){case"Enter":{_.preventDefault();const x=u.findIndex(k=>k.id===S);if(x>=0){const k=u[x];Et(k,`No panel data found for index ${x}`);const C=a[x],{collapsedSize:R=0,collapsible:I,minSize:A=0}=k.constraints;if(C!=null&&I){const O=kf({delta:Na(C,R)?A-R:R-C,initialLayout:a,panelConstraints:u.map(M=>M.constraints),pivotIndices:AK(n,v,i),prevLayout:a,trigger:"keyboard"});a!==O&&s(O)}}break}}};return g.addEventListener("keydown",y),()=>{g.removeEventListener("keydown",y)}});return()=>{h.forEach(g=>g())}},[i,e,t,n,a,r,s])}function N4(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 OK(e,t){const n=e==="horizontal",{x:a,y:r}=Ry(t);return n?a:r}function n_e(e,t,n,a,r){const i=n==="horizontal",s=Iy(t,r);Et(s,`No resize handle element found for id "${t}"`);const c=s.getAttribute(Vn.groupId);Et(c,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=a;const d=OK(n,e),m=IK(c,r);Et(m,`No group element found for id "${c}"`);const h=m.getBoundingClientRect(),g=i?h.width:h.height;return(d-u)/g*100}function r_e(e,t,n,a,r,i){if(wK(e)){const s=n==="horizontal";let c=0;e.shiftKey?c=100:r!=null?c=r:c=10;let u=0;switch(e.key){case"ArrowDown":u=s?0:c;break;case"ArrowLeft":u=s?-c:0;break;case"ArrowRight":u=s?c:0;break;case"ArrowUp":u=s?0:-c;break;case"End":u=100;break;case"Home":u=-100;break}return u}else return a==null?0:n_e(e,t,n,a,i)}function a_e({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let a=0,r=100;for(let i=0;i<e.length;i++){const s=n[i];Et(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;c!=null&&(a++,t[i]=c,r-=c)}for(let i=0;i<e.length;i++){const s=n[i];Et(s,`Panel constraints not found for index ${i}`);const{defaultSize:c}=s;if(c!=null)continue;const u=e.length-a,d=r/u;a++,t[i]=d,r-=d}return t}function Oc(e,t,n){t.forEach((a,r)=>{const i=e[r];Et(i,`Panel data not found for index ${r}`);const{callbacks:s,constraints:c,id:u}=i,{collapsedSize:d=0,collapsible:m}=c,h=n[u];if(h==null||a!==h){n[u]=a;const{onCollapse:g,onExpand:v,onResize:S}=s;S&&S(a,h),m&&(g||v)&&(v&&(h==null||bo(h,d))&&!bo(a,d)&&v(),g&&(h==null||!bo(h,d))&&bo(a,d)&&g())}})}function Cg(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 i_e({defaultSize:e,dragState:t,layout:n,panelData:a,panelIndex:r,precision:i=3}){const s=n[r];let c;return s==null?c=e!=null?e.toFixed(i):"1":a.length===1?c="1":c=s.toFixed(i),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function o_e(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function R4(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 DK(e){return`react-resizable-panels:${e}`}function $K(e){return e.map(t=>{const{constraints:n,id:a,idIsFromProps:r,order:i}=t;return r?a:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function LK(e,t){try{const n=DK(e),a=t.getItem(n);if(a){const r=JSON.parse(a);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function s_e(e,t,n){var a,r;const i=(a=LK(e,n))!==null&&a!==void 0?a:{},s=$K(t);return(r=i[s])!==null&&r!==void 0?r:null}function l_e(e,t,n,a,r){var i;const s=DK(e),c=$K(t),u=(i=LK(e,r))!==null&&i!==void 0?i:{};u[c]={expandToSizes:Object.fromEntries(n.entries()),layout:a};try{r.setItem(s,JSON.stringify(u))}catch(d){console.error(d)}}function C4({layout:e,panelConstraints:t}){const n=[...e],a=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Na(a,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];Et(s!=null,`No layout data found for index ${i}`);const c=100/a*s;n[i]=c}let r=0;for(let i=0;i<t.length;i++){const s=n[i];Et(s!=null,`No layout data found for index ${i}`);const c=eu({panelConstraints:t,panelIndex:i,size:s});s!=c&&(r+=s-c,n[i]=c)}if(!Na(r,0))for(let i=0;i<t.length;i++){const s=n[i];Et(s!=null,`No layout data found for index ${i}`);const c=s+r,u=eu({panelConstraints:t,panelIndex:i,size:c});if(s!==u&&(r-=u-s,n[i]=u,Na(r,0)))break}return n}const c_e=100,Tf={getItem:e=>(R4(Tf),Tf.getItem(e)),setItem:(e,t)=>{R4(Tf),Tf.setItem(e,t)}},A4={};function MK({autoSaveId:e=null,children:t,className:n="",direction:a,forwardedRef:r,id:i=null,onLayout:s=null,keyboardResizeBy:c=null,storage:u=Tf,style:d,tagName:m="div",...h}){const g=yO(i),v=E.useRef(null),[S,w]=E.useState(null),[y,_]=E.useState([]),x=Xxe(),k=E.useRef({}),C=E.useRef(new Map),R=E.useRef(0),I=E.useRef({autoSaveId:e,direction:a,dragState:S,id:g,keyboardResizeBy:c,onLayout:s,storage:u}),A=E.useRef({layout:y,panelDataArray:[],panelDataArrayChanged:!1});E.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),E.useImperativeHandle(r,()=>({getId:()=>I.current.id,getLayout:()=>{const{layout:z}=A.current;return z},setLayout:z=>{const{onLayout:$}=I.current,{layout:j,panelDataArray:V}=A.current,K=C4({layout:z,panelConstraints:V.map(X=>X.constraints)});N4(j,K)||(_(K),A.current.layout=K,$&&$(K),Oc(V,K,k.current))}}),[]),wl(()=>{I.current.autoSaveId=e,I.current.direction=a,I.current.dragState=S,I.current.id=g,I.current.onLayout=s,I.current.storage=u}),t_e({committedValuesRef:I,eagerValuesRef:A,groupId:g,layout:y,panelDataArray:A.current.panelDataArray,setLayout:_,panelGroupElement:v.current}),E.useEffect(()=>{const{panelDataArray:z}=A.current;if(e){if(y.length===0||y.length!==z.length)return;let $=A4[e];$==null&&($=o_e(l_e,c_e),A4[e]=$);const j=[...z],V=new Map(C.current);$(e,j,V,y,u)}},[e,y,u]),E.useEffect(()=>{});const O=E.useCallback(z=>{const{onLayout:$}=I.current,{layout:j,panelDataArray:V}=A.current;if(z.constraints.collapsible){const K=V.map(J=>J.constraints),{collapsedSize:X=0,panelSize:se,pivotIndices:le}=ol(V,z,j);if(Et(se!=null,`Panel size not found for panel "${z.id}"`),!bo(se,X)){C.current.set(z.id,se);const ee=Bc(V,z)===V.length-1?se-X:X-se,ce=kf({delta:ee,initialLayout:j,panelConstraints:K,pivotIndices:le,prevLayout:j,trigger:"imperative-api"});Cg(j,ce)||(_(ce),A.current.layout=ce,$&&$(ce),Oc(V,ce,k.current))}}},[]),M=E.useCallback((z,$)=>{const{onLayout:j}=I.current,{layout:V,panelDataArray:K}=A.current;if(z.constraints.collapsible){const X=K.map(re=>re.constraints),{collapsedSize:se=0,panelSize:le=0,minSize:J=0,pivotIndices:ee}=ol(K,z,V),ce=$??J;if(bo(le,se)){const re=C.current.get(z.id),ye=re!=null&&re>=ce?re:ce,He=Bc(K,z)===K.length-1?le-ye:ye-le,_e=kf({delta:He,initialLayout:V,panelConstraints:X,pivotIndices:ee,prevLayout:V,trigger:"imperative-api"});Cg(V,_e)||(_(_e),A.current.layout=_e,j&&j(_e),Oc(K,_e,k.current))}}},[]),U=E.useCallback(z=>{const{layout:$,panelDataArray:j}=A.current,{panelSize:V}=ol(j,z,$);return Et(V!=null,`Panel size not found for panel "${z.id}"`),V},[]),F=E.useCallback((z,$)=>{const{panelDataArray:j}=A.current,V=Bc(j,z);return i_e({defaultSize:$,dragState:S,layout:y,panelData:j,panelIndex:V})},[S,y]),H=E.useCallback(z=>{const{layout:$,panelDataArray:j}=A.current,{collapsedSize:V=0,collapsible:K,panelSize:X}=ol(j,z,$);return Et(X!=null,`Panel size not found for panel "${z.id}"`),K===!0&&bo(X,V)},[]),te=E.useCallback(z=>{const{layout:$,panelDataArray:j}=A.current,{collapsedSize:V=0,collapsible:K,panelSize:X}=ol(j,z,$);return Et(X!=null,`Panel size not found for panel "${z.id}"`),!K||Ll(X,V)>0},[]),q=E.useCallback(z=>{const{panelDataArray:$}=A.current;$.push(z),$.sort((j,V)=>{const K=j.order,X=V.order;return K==null&&X==null?0:K==null?-1:X==null?1:K-X}),A.current.panelDataArrayChanged=!0,x()},[x]);wl(()=>{if(A.current.panelDataArrayChanged){A.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:$,storage:j}=I.current,{layout:V,panelDataArray:K}=A.current;let X=null;if(z){const le=s_e(z,K,j);le&&(C.current=new Map(Object.entries(le.expandToSizes)),X=le.layout)}X==null&&(X=a_e({panelDataArray:K}));const se=C4({layout:X,panelConstraints:K.map(le=>le.constraints)});N4(V,se)||(_(se),A.current.layout=se,$&&$(se),Oc(K,se,k.current))}}),wl(()=>{const z=A.current;return()=>{z.layout=[]}},[]);const ie=E.useCallback(z=>{let $=!1;const j=v.current;return j&&window.getComputedStyle(j,null).getPropertyValue("direction")==="rtl"&&($=!0),function(K){K.preventDefault();const X=v.current;if(!X)return()=>null;const{direction:se,dragState:le,id:J,keyboardResizeBy:ee,onLayout:ce}=I.current,{layout:re,panelDataArray:ye}=A.current,{initialLayout:Te}=le??{},He=AK(J,z,X);let _e=r_e(K,z,se,le,ee,X);const Se=se==="horizontal";Se&&$&&(_e=-_e);const Ue=ye.map(Be=>Be.constraints),pe=kf({delta:_e,initialLayout:Te??re,panelConstraints:Ue,pivotIndices:He,prevLayout:re,trigger:wK(K)?"keyboard":"mouse-or-touch"}),$e=!Cg(re,pe);(SK(K)||EK(K))&&R.current!=_e&&(R.current=_e,!$e&&_e!==0?Se?aE(z,_e<0?_K:kK):aE(z,_e<0?TK:NK):aE(z,0)),$e&&(_(pe),A.current.layout=pe,ce&&ce(pe),Oc(ye,pe,k.current))}},[]),G=E.useCallback((z,$)=>{const{onLayout:j}=I.current,{layout:V,panelDataArray:K}=A.current,X=K.map(re=>re.constraints),{panelSize:se,pivotIndices:le}=ol(K,z,V);Et(se!=null,`Panel size not found for panel "${z.id}"`);const ee=Bc(K,z)===K.length-1?se-$:$-se,ce=kf({delta:ee,initialLayout:V,panelConstraints:X,pivotIndices:le,prevLayout:V,trigger:"imperative-api"});Cg(V,ce)||(_(ce),A.current.layout=ce,j&&j(ce),Oc(K,ce,k.current))},[]),Q=E.useCallback((z,$)=>{const{layout:j,panelDataArray:V}=A.current,{collapsedSize:K=0,collapsible:X}=$,{collapsedSize:se=0,collapsible:le,maxSize:J=100,minSize:ee=0}=z.constraints,{panelSize:ce}=ol(V,z,j);ce!=null&&(X&&le&&bo(ce,K)?bo(K,se)||G(z,se):ce<ee?G(z,ee):ce>J&&G(z,J))},[G]),W=E.useCallback((z,$)=>{const{direction:j}=I.current,{layout:V}=A.current;if(!v.current)return;const K=Iy(z,v.current);Et(K,`Drag handle element not found for id "${z}"`);const X=OK(j,$);w({dragHandleId:z,dragHandleRect:K.getBoundingClientRect(),initialCursorPosition:X,initialLayout:V})},[]),oe=E.useCallback(()=>{w(null)},[]),ne=E.useCallback(z=>{const{panelDataArray:$}=A.current,j=Bc($,z);j>=0&&($.splice(j,1),delete k.current[z.id],A.current.panelDataArrayChanged=!0,x())},[x]),P=E.useMemo(()=>({collapsePanel:O,direction:a,dragState:S,expandPanel:M,getPanelSize:U,getPanelStyle:F,groupId:g,isPanelCollapsed:H,isPanelExpanded:te,reevaluatePanelConstraints:Q,registerPanel:q,registerResizeHandle:ie,resizePanel:G,startDragging:W,stopDragging:oe,unregisterPanel:ne,panelGroupElement:v.current}),[O,S,a,M,U,F,g,H,te,Q,q,ie,G,W,oe,ne]),B={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return E.createElement(Ny.Provider,{value:P},E.createElement(m,{...h,children:t,className:n,id:i,ref:v,style:{...B,...d},[Vn.group]:"",[Vn.groupDirection]:a,[Vn.groupId]:g}))}const jK=E.forwardRef((e,t)=>E.createElement(MK,{...e,forwardedRef:t}));MK.displayName="PanelGroup";jK.displayName="forwardRef(PanelGroup)";function Bc(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function ol(e,t,n){const a=Bc(e,t),i=a===e.length-1?[a-1,a]:[a,a+1],s=n[a];return{...t.constraints,panelSize:s,pivotIndices:i}}function u_e({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:a}){E.useEffect(()=>{if(e||n==null||a==null)return;const r=Iy(t,a);if(r==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const c=r.getAttribute(Vn.groupId);Et(c,`No group element found for id "${c}"`);const u=yp(c,a),d=CK(c,t,a);Et(d!==null,`No resize element found for id "${t}"`);const m=s.shiftKey?d>0?d-1:u.length-1:d+1<u.length?d+1:0;u[m].focus();break}}};return r.addEventListener("keydown",i),()=>{r.removeEventListener("keydown",i)}},[a,e,t,n])}function PK({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:a,id:r,onBlur:i,onClick:s,onDragging:c,onFocus:u,onPointerDown:d,onPointerUp:m,style:h={},tabIndex:g=0,tagName:v="div",...S}){var w,y;const _=E.useRef(null),x=E.useRef({onClick:s,onDragging:c,onPointerDown:d,onPointerUp:m});E.useEffect(()=>{x.current.onClick=s,x.current.onDragging=c,x.current.onPointerDown=d,x.current.onPointerUp=m});const k=E.useContext(Ny);if(k===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:C,groupId:R,registerResizeHandle:I,startDragging:A,stopDragging:O,panelGroupElement:M}=k,U=yO(r),[F,H]=E.useState("inactive"),[te,q]=E.useState(!1),[ie,G]=E.useState(null),Q=E.useRef({state:F});wl(()=>{Q.current.state=F}),E.useEffect(()=>{if(n)G(null);else{const P=I(U);G(()=>P)}},[n,U,I]);const W=(w=a?.coarse)!==null&&w!==void 0?w:15,oe=(y=a?.fine)!==null&&y!==void 0?y:5;E.useEffect(()=>{if(n||ie==null)return;const P=_.current;Et(P,"Element ref not attached");let B=!1;return Zxe(U,P,C,{coarse:W,fine:oe},($,j,V)=>{if(!j){H("inactive");return}switch($){case"down":{H("drag"),B=!1,Et(V,'Expected event to be defined for "down" action'),A(U,V);const{onDragging:K,onPointerDown:X}=x.current;K?.(!0),X?.();break}case"move":{const{state:K}=Q.current;B=!0,K!=="drag"&&H("hover"),Et(V,'Expected event to be defined for "move" action'),ie(V);break}case"up":{H("hover"),O();const{onClick:K,onDragging:X,onPointerUp:se}=x.current;X?.(!1),se?.(),B||K?.();break}}})},[W,C,n,oe,I,U,ie,A,O]),u_e({disabled:n,handleId:U,resizeHandler:ie,panelGroupElement:M});const ne={touchAction:"none",userSelect:"none"};return E.createElement(v,{...S,children:e,className:t,id:r,onBlur:()=>{q(!1),i?.()},onFocus:()=>{q(!0),u?.()},ref:_,role:"separator",style:{...ne,...h},tabIndex:g,[Vn.groupDirection]:C,[Vn.groupId]:R,[Vn.resizeHandle]:"",[Vn.resizeHandleActive]:F==="drag"?"pointer":te?"keyboard":void 0,[Vn.resizeHandleEnabled]:!n,[Vn.resizeHandleId]:U,[Vn.resizeHandleState]:F})}PK.displayName="PanelResizeHandle";function gi({className:e,...t}){return p.jsx(jK,{"data-slot":"resizable-panel-group",className:Oe("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function ar({...e}){return p.jsx(yK,{"data-slot":"resizable-panel",...e})}function Eo({withHandle:e,className:t,...n}){return p.jsx(PK,{"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&&p.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:p.jsx(Qfe,{className:"size-2.5"})})})}function SO({className:e,...t}){return p.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 d_e({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:a,onSearchExpand:r,onSearchChange:i,onSearchBlur:s,onClearAll:c,searchInputRef:u}){return p.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[p.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?p.jsx(rr,{ref:u,placeholder:"Search notifications...",value:t,onChange:d=>i(d.target.value),onBlur:s,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Notifications"}),p.jsx(fa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",children:p.jsx(Jv,{className:"h-4 w-4"})})}),p.jsxs(wn,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(SO,{children:"F"})]})]})]})}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:c,disabled:a===0,className:"h-8 w-8 p-0",children:p.jsx(Rl,{className:"h-4 w-4"})})}),p.jsx(wn,{side:"bottom",children:"Clear all"})]})})]})}function pd({id:e,isSelected:t,isFocused:n,icon:a,title:r,description:i,metadata:s,onClick:c,className:u}){return p.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:p.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a&&p.jsx("div",{className:"flex-shrink-0 mt-1",children:p.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:a})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"flex items-center gap-2 mb-1",children:p.jsx("h3",{className:Oe("font-medium truncate font-mono text-sm"),children:r})}),i&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:i})]})]})})}function f_e({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:a,formatRelativeTime:r,listRef:i}){return e.length===0?p.jsx("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:p.jsx(Wv,{vertical:!0,noBorder:!0,message:"No notifications yet"})}):p.jsx("div",{ref:i,className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((s,c)=>p.jsx(pd,{id:`notification-${s.id}`,isSelected:t?.id===s.id,isFocused:a===c,title:p.jsxs("span",{className:"flex items-center gap-3",children:[s.method,!s.read&&p.jsx("span",{className:"size-1.5 block rounded-full bg-orange-500"})]}),description:(()=>{const u=r(s.timestamp),d=s.params&&Object.keys(s.params).length>0?Object.keys(s.params).length:0,m=d>0?` | ${d} param${d>1?"s":""}`:"";return u+m})(),onClick:()=>n(s)},s.id))})}function p_e({notification:e,previewMode:t,onTogglePreview:n,onCopy:a,onDownload:r,onFullscreen:i,isCopied:s=!1,onClose:c}){return e?p.jsxs("div",{className:"flex flex-col h-full",children:[p.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:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx($u,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(e.timestamp).toLocaleTimeString()})]}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.formatRelativeTime(e.timestamp)})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsxs(Fe,{variant:"ghost",size:"sm",onClick:n,className:t?"":"text-purple-600 dark:text-purple-400",children:[t?p.jsx(L9,{className:"h-4 w-4 mr-1"}):p.jsx($9,{className:"h-4 w-4 mr-1"}),t?"JSON":"Formatted"]}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:a,children:s?p.jsx(Xa,{className:"h-4 w-4"}):p.jsx(ua,{className:"h-4 w-4"})}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:r,children:p.jsx(ZT,{className:"h-4 w-4"})}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:i,children:p.jsx(XT,{className:"h-4 w-4"})}),c&&p.jsx(Fe,{variant:"ghost",size:"sm",onClick:c,children:p.jsx(td,{className:"h-4 w-4"})})]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto",children:p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{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`})})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(WT,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Select a notification to view details"})]})}function I4(e){const n=Date.now()-e,a=Math.floor(n/1e3),r=Math.floor(a/60),i=Math.floor(r/60),s=Math.floor(i/24);return a<60?"just now":r<60?`${r}m ago`:i<24?`${i}h ago`:s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function m_e({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:a,clearNotifications:r,serverId:i,isConnected:s}){const[c,u]=E.useState(null),[d,m]=E.useState(""),[h,g]=E.useState(-1),[v,S]=E.useState(!0),[w,y]=E.useState(!1),[_,x]=E.useState(!0),[k,C]=E.useState(!1),R=E.useRef(null),I=E.useRef(null),A=E.useRef(null),O=E.useRef(!1);E.useEffect(()=>{v&&e.length>0&&R.current&&!O.current&&(R.current.scrollTop=0)},[e.length,v]),E.useEffect(()=>{const Q=R.current;if(!Q)return;const W=()=>{Q.scrollTop>0&&(O.current=!0,S(!1))};return Q.addEventListener("scroll",W),()=>Q.removeEventListener("scroll",W)},[]),E.useEffect(()=>{e.length===0&&(O.current=!1,S(!0))},[e.length]),E.useEffect(()=>{c&&!c.read&&n(c.id)},[c,n]),E.useEffect(()=>{w&&A.current&&A.current.focus()},[w]);const M=E.useCallback(()=>{d.trim()||y(!1)},[d]),U=E.useMemo(()=>{if(!d.trim())return e;const Q=d.toLowerCase();return e.filter(W=>W.method.toLowerCase().includes(Q)||JSON.stringify(W.params||{}).toLowerCase().includes(Q))},[e,d]);E.useEffect(()=>{g(-1)},[d]),E.useEffect(()=>{const Q=W=>{const oe=W.target;if(oe.tagName==="INPUT"||oe.tagName==="TEXTAREA"||oe.contentEditable==="true"||W.metaKey||W.ctrlKey||W.altKey)return;const P=U;if(W.key==="ArrowDown")W.preventDefault(),g(B=>{const z=B+1;return z>=P.length?0:z});else if(W.key==="ArrowUp")W.preventDefault(),g(B=>{const z=B-1;return z<0?P.length-1:z});else if(W.key==="Enter"&&h>=0){W.preventDefault();const B=U[h];B&&F(B)}};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[h,U]),E.useEffect(()=>{if(h>=0){const Q=`notification-${U[h]?.id}`,W=document.getElementById(Q);W&&W.scrollIntoView({behavior:"smooth",block:"nearest"})}},[h,U]);const F=E.useCallback(Q=>{u(Q)},[]),H=E.useCallback(()=>{window.confirm("Are you sure you want to clear all notifications? This cannot be undone.")&&(r(),u(null))},[r]),te=E.useCallback(async()=>{if(c)try{await navigator.clipboard.writeText(JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)),C(!0),setTimeout(()=>C(!1),2e3)}catch(Q){console.error("[NotificationsTab] Failed to copy notification:",Q)}},[c]),q=E.useCallback(()=>{if(c)try{const Q=new globalThis.Blob([JSON.stringify({method:c.method,timestamp:c.timestamp,read:c.read,params:c.params},null,2)],{type:"application/json"}),W=URL.createObjectURL(Q),oe=document.createElement("a");oe.href=W,oe.download=`notification-${Date.now()}.json`,document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(W)}catch(Q){console.error("[NotificationsTab] Failed to download notification:",Q)}},[c]),ie=E.useCallback(async()=>{if(I.current)try{document.fullscreenElement?await document.exitFullscreen():await I.current.requestFullscreen()}catch(Q){console.error("[NotificationsTab] Failed to toggle fullscreen:",Q)}},[]),G=c?{method:c.method,params:c.params,timestamp:c.timestamp,read:c.read,formatRelativeTime:I4}:null;return s?p.jsxs(gi,{direction:"horizontal",className:"h-full",children:[p.jsx(ar,{defaultSize:40,minSize:30,children:p.jsx(gi,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:p.jsxs(ar,{defaultSize:75,minSize:30,children:[p.jsx(d_e,{isSearchExpanded:w,searchQuery:d,filteredNotificationsCount:U.length,notificationsCount:e.length,onSearchExpand:()=>y(!0),onSearchChange:m,onSearchBlur:M,onClearAll:H,searchInputRef:A}),p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(f_e,{notifications:U,selectedNotification:c,onNotificationSelect:F,focusedIndex:h,formatRelativeTime:I4,listRef:R})})]})})}),p.jsx(Eo,{}),p.jsx(ar,{defaultSize:60,minSize:40,children:p.jsx("div",{ref:I,className:"h-full bg-white dark:bg-zinc-900",children:p.jsx(p_e,{notification:G,previewMode:_,onTogglePreview:()=>x(!_),onCopy:te,onDownload:q,onFullscreen:ie,onClose:()=>u(null),isCopied:k})})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(WT,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Not connected to server"})]})}function UK({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:a,secondaryTabTitle:r,primaryCount:i,secondaryCount:s,secondaryIcon:c,primaryIcon:u,searchPlaceholder:d="Search...",onSearchExpand:m,onSearchChange:h,onSearchBlur:g,onTabSwitch:v,searchInputRef:S,primaryTabName:w}){const y=e===w;return p.jsxs("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:[p.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?p.jsx(rr,{ref:S,placeholder:d,value:n,onChange:_=>h(_.target.value),onBlur:g,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:y?a:r}),y&&p.jsxs(p.Fragment,{children:[p.jsx(fa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:i}),p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0",children:p.jsx(Jv,{className:"h-4 w-4"})})}),p.jsxs(wn,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(SO,{children:"F"})]})]})]})]})}),p.jsxs(Fe,{variant:"ghost",size:"sm",onClick:v,className:"gap-2 flex-shrink-0",children:[y?p.jsx(c,{}):p.jsx(u,{}),p.jsx("span",{className:"hidden sm:inline",children:y?r:a}),y&&s>0&&p.jsx(fa,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:s})]})]})}function O4({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:a}){return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(rp,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No prompts available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((r,i)=>p.jsx(pd,{id:`prompt-${r.name}`,isSelected:t?.name===r.name,isFocused:a===i,icon:p.jsx(rp,{className:"h-4 w-4"}),title:r.name,description:r.description,metadata:r.arguments&&r.arguments.length>0&&p.jsxs(fa,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[r.arguments.length," args"]}),onClick:()=>n(r)},r.name))})}function D4({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:a,savedPromptsCount:r,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return p.jsx(UK,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"prompts",secondaryTabName:"saved",primaryTabTitle:"Prompts",secondaryTabTitle:"History",primaryCount:a,secondaryCount:r,primaryIcon:rp,secondaryIcon:$u,searchPlaceholder:"Search prompts...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}function $4({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:a,focusedIndex:r}){return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx($u,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No history"}),p.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mt-1",children:"Prompts you execute will appear here"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((i,s)=>p.jsx(pd,{id:`saved-prompt-${i.id}`,isSelected:t?.id===i.id,isFocused:r===s,icon:p.jsx($u,{className:"h-4 w-4"}),title:i.name,description:`${i.promptName} - ${new Date(i.savedAt).toLocaleString()}`,onClick:()=>n(i)},i.id))})}function h_e({selectedPrompt:e,promptArgs:t,onArgChange:n}){const a=e?.arguments||[];if(!(a.length>0))return p.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No arguments required"});const i=s=>{const c=s.name,u=t[c],d=typeof u=="string"?u:JSON.stringify(u);return s.type==="boolean"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx("input",{id:c,type:"checkbox",checked:!!u,onChange:m=>n(c,m.target.checked),className:"rounded","aria-label":`Toggle ${c}`}),p.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:s.description})]})]},c):s.type==="number"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(rr,{id:c,type:"number",value:Number(u)||0,onChange:m=>n(c,Number(m.target.value)),placeholder:s.description||`Enter ${c}`}),s.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):s.type==="array"||s.type==="object"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(uy,{id:c,value:d,onChange:m=>{try{const h=JSON.parse(m.target.value);n(c,h)}catch{n(c,m.target.value)}},placeholder:s.description||`Enter ${c} as JSON`,className:"font-mono text-sm min-h-[100px]"}),s.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c):p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:c,className:"text-sm font-medium",children:[c,s.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(rr,{id:c,value:d,onChange:m=>n(c,m.target.value),placeholder:s.description||`Enter ${c}`}),s.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s.description})]},c)};return p.jsx("div",{className:"space-y-4",children:a.map(s=>i(s))})}function L4({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:a,onArgChange:r,onExecute:i,onSave:s}){return e?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",children:p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[p.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),p.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[p.jsx(Fe,{onClick:i,disabled:n||!a,size:"sm",className:"lg:size-default",children:n?p.jsxs(p.Fragment,{children:[p.jsx(Ao,{className:"mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(P9,{className:"h-4 w-4 sm:mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Execute"})]})}),p.jsxs(Fe,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[p.jsx(qT,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Save"})]})]})]}),e.description&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:p.jsx(h_e,{selectedPrompt:e,promptArgs:t,onArgChange:r})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a prompt to get started"}),p.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 M4({results:e,copiedResult:t,onCopy:n}){return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:e.length>0?p.jsx("div",{className:"space-y-4 flex-1 h-full",children:e.map((a,r)=>p.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[p.jsxs("div",{className:"flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",children:[p.jsx("h3",{className:"text-sm font-medium",children:"Response"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx($u,{className:"h-3 w-3 text-gray-400"}),p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(a.timestamp).toLocaleTimeString()})]}),a.duration!==void 0&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(ap,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[a.duration,"ms"]})]}),p.jsx("div",{className:"flex gap-2 ml-auto",children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>n(r,a.result),className:"h-6 px-2",children:t===r?p.jsx(Xa,{className:"h-4 w-4"}):p.jsx(ua,{className:"h-4 w-4"})})})]}),a.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:a.error})]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:a.result,filename:`prompt-result-${a.promptName}-${Date.now()}.json`})})]},r))}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-center",children:p.jsx(Wv,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})})}function EO({serverIds:e,onCountChange:t,onClearRef:n}={}){const[a,r]=E.useState([]),i=E.useRef(null),[s,c]=E.useState(new Set),[u]=E.useState(""),d=v=>{c(S=>{const w=new Set(S);return w.has(v)?w.delete(v):w.add(v),w})},m=async()=>{r([]),c(new Set),t?.(0);try{const v=new URLSearchParams;e&&e.length>0&&v.set("serverIds",e.join(","));const S=await fetch(`/inspector/api/rpc/log?${v.toString()}`,{method:"DELETE"});S.ok||console.warn("[RPC Logger] Failed to clear server buffer:",S.status)}catch(v){console.warn("[RPC Logger] Error clearing server buffer:",v)}},h=E.useMemo(()=>!e||e.length===0?"":[...e].sort().join(","),[e]);E.useEffect(()=>(n&&(n.current=m),()=>{n&&(n.current=null)}),[n,m]),E.useEffect(()=>{t?.(a.length)},[a.length,t]),E.useEffect(()=>{let v=null;try{const S=new URLSearchParams;S.set("replay","3"),S.set("_t",Date.now().toString()),e&&e.length>0&&S.set("serverIds",e.join(","));const w=`/inspector/api/rpc/stream?${S.toString()}`;console.log("[RPC Logger] Connecting to SSE stream:",w),v=new globalThis.EventSource(w),v.onopen=()=>{console.log("[RPC Logger] SSE connection opened")},v.onmessage=y=>{try{const _=JSON.parse(y.data);if(!_||_.type!=="rpc")return;const{serverId:x,direction:k,message:C,timestamp:R}=_,I=C,A=typeof I?.method=="string"?I.method:I?.result!==void 0?"result":I?.error!==void 0?"error":"unknown",O={id:`${R??Date.now()}-${Math.random().toString(36).slice(2)}`,serverId:typeof x=="string"?x:"unknown",direction:typeof k=="string"?k.toUpperCase():"",method:A,timestamp:R??new Date().toISOString(),payload:C};console.log("[RPC Logger] Received RPC event:",{method:A,direction:k,serverId:x}),r(M=>{const U=[O,...M].slice(0,1e3);return t?.(U.length),U})}catch(_){console.error("[RPC Logger] Error parsing SSE message:",_)}},v.onerror=y=>{console.error("[RPC Logger] SSE connection error:",y);try{v?.close()}catch{}}}catch(S){console.error("[RPC Logger] Failed to create SSE connection:",S)}return()=>{try{v?.close(),console.log("[RPC Logger] SSE connection closed")}catch{}}},[h]);const g=E.useMemo(()=>{let v=a;if(e&&e.length>0){const S=new Set(e);v=v.filter(w=>S.has(w.serverId))}if(u.trim()){const S=u.toLowerCase();v=v.filter(w=>w.serverId.toLowerCase().includes(S)||w.method.toLowerCase().includes(S)||w.direction.toLowerCase().includes(S)||JSON.stringify(w.payload).toLowerCase().includes(S))}return v},[a,u,e]);return p.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:p.jsx("div",{ref:i,className:"flex-1 min-h-0 overflow-y-auto",children:g.length===0?p.jsxs("div",{className:"text-center py-8",children:[p.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages yet"}),p.jsx("div",{className:"text-[10px] text-muted-foreground mt-1",children:"JSON-RPC messages will appear here"})]}):g.map(v=>{const S=s.has(v.id);return p.jsxs("div",{className:"group hover:bg-muted/50 transition-all duration-200 overflow-hidden",children:[p.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>d(v.id),children:[p.jsx("div",{className:"flex-shrink-0",children:S?p.jsx(zl,{className:"h-3 w-3 text-muted-foreground transition-transform"}):p.jsx(wfe,{className:"h-3 w-3 text-muted-foreground transition-transform"})}),p.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[p.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:new Date(v.timestamp).toLocaleTimeString()}),p.jsx("span",{className:`flex items-center justify-center px-1 py-0.5 rounded ${v.direction==="RECEIVE"?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-green-500/10 text-green-600 dark:text-green-400"}`,title:v.direction==="RECEIVE"?"Incoming":"Outgoing",children:v.direction==="RECEIVE"?p.jsx(lfe,{className:"h-3 w-3"}):p.jsx(ufe,{className:"h-3 w-3"})}),p.jsx("span",{className:"text-xs font-mono text-foreground truncate",children:v.method})]})]}),S&&p.jsx("div",{className:"border-t bg-muted/20",children:p.jsx("div",{className:"p-3",children:p.jsx("div",{className:"max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2",children:p.jsx(ur,{data:v.payload})})})})]},v.id)})})})}const j4="mcp-inspector-saved-prompts";function zK({ref:e,prompts:t,callPrompt:n,serverId:a,isConnected:r}){const[i,s]=E.useState(null),[c,u]=E.useState(null),{selectedPromptName:d,setSelectedPromptName:m}=qp(),[h,g]=E.useState({}),[v,S]=E.useState([]),[w,y]=E.useState(!1),[_,x]=E.useState(null),[k,C]=E.useState(""),[R,I]=E.useState("prompts"),[A,O]=E.useState([]),[M,U]=E.useState(!1),[F,H]=E.useState(""),[te,q]=E.useState(!1),[ie,G]=E.useState(-1),Q=E.useRef(null),[W,oe]=E.useState(!1),[ne,P]=E.useState("list"),[B,z]=E.useState(0),[$,j]=E.useState(!0),V=E.useRef(null),K=E.useRef(null);E.useEffect(()=>{const _e=()=>{oe(window.innerWidth<1024)};return _e(),window.addEventListener("resize",_e),()=>window.removeEventListener("resize",_e)},[]),E.useEffect(()=>{P(i?"detail":"list")},[i]),E.useEffect(()=>{W&&v.length>0&&!w&&P("response")},[v,w,W]),E.useImperativeHandle(e,()=>({focusSearch:()=>{q(!0),setTimeout(()=>{Q.current&&Q.current.focus()},0)},blurSearch:()=>{C(""),q(!1),Q.current&&Q.current.blur()}})),E.useEffect(()=>{try{const _e=localStorage.getItem(j4);if(_e){const Se=JSON.parse(_e);O(Se)}}catch(_e){console.error("[PromptsTab] Failed to load saved prompts:",_e)}},[]);const X=E.useCallback(_e=>{try{localStorage.setItem(j4,JSON.stringify(_e))}catch(Se){console.error("[PromptsTab] Failed to save prompts:",Se)}},[]);E.useEffect(()=>{te&&Q.current&&Q.current.focus()},[te]);const se=E.useCallback(()=>{k.trim()||q(!1)},[k]),le=E.useMemo(()=>{if(!k.trim())return t;const _e=k.toLowerCase();return t.filter(Se=>Se.name.toLowerCase().includes(_e)||Se.description?.toLowerCase().includes(_e))},[t,k]),J=E.useCallback(_e=>{s(_e);const Se={};_e.arguments&&_e.arguments.forEach(Ue=>{Ue.default!==void 0?Se[Ue.name]=Ue.default:Ue.type==="string"?Se[Ue.name]="":Ue.type==="number"?Se[Ue.name]=0:Ue.type==="boolean"?Se[Ue.name]=!1:Ue.type==="array"?Se[Ue.name]=[]:Ue.type==="object"&&(Se[Ue.name]={})}),g(Se)},[]),ee=E.useCallback(_e=>{const Se=t.find(Ue=>Ue.name===_e.promptName);Se&&(s(Se),g(_e.args),u(_e))},[t]);E.useEffect(()=>{G(-1)},[k,R]),E.useEffect(()=>{const _e=Se=>{const Ue=Se.target;if(Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.contentEditable==="true"||Se.metaKey||Se.ctrlKey||Se.altKey)return;const $e=R==="prompts"?le:A;if(Se.key==="ArrowDown")Se.preventDefault(),G(Be=>{const Ee=Be+1;return Ee>=$e.length?0:Ee});else if(Se.key==="ArrowUp")Se.preventDefault(),G(Be=>{const Ee=Be-1;return Ee<0?$e.length-1:Ee});else if(Se.key==="Enter"&&ie>=0)if(Se.preventDefault(),R==="prompts"){const Be=le[ie];Be&&J(Be)}else{const Be=A[ie];Be&&ee(Be)}};return document.addEventListener("keydown",_e),()=>document.removeEventListener("keydown",_e)},[ie,le,A,R,J,ee]),E.useEffect(()=>{if(ie>=0){const _e=R==="prompts"?`prompt-${le[ie]?.name}`:`saved-prompt-${A[ie]?.id}`,Se=document.getElementById(_e);Se&&Se.scrollIntoView({behavior:"smooth",block:"nearest"})}},[ie,le,A,R]),E.useEffect(()=>{if(console.warn("[PromptsTab] Auto-selection effect triggered:",{selectedPromptName:d,promptsCount:t.length,currentSelectedPrompt:i?.name}),d&&t.length>0){const _e=t.find(Se=>Se.name===d);if(console.warn("[PromptsTab] Prompt lookup result:",{selectedPromptName:d,promptFound:!!_e,promptName:_e?.name,shouldSelect:_e&&i?.name!==_e.name}),_e&&i?.name!==_e.name){console.warn("[PromptsTab] Selecting prompt:",_e.name),m(null);const Se=setTimeout(()=>{J(_e);const Ue=document.getElementById(`prompt-${_e.name}`);Ue&&(console.warn("[PromptsTab] Scrolling to prompt element"),Ue.scrollIntoView({behavior:"smooth",block:"nearest"}))},100);return()=>clearTimeout(Se)}}},[d,t,i,J,m]);const ce=E.useCallback((_e,Se)=>{g(Ue=>({...Ue,[_e]:Se}))},[]),re=E.useCallback(async()=>{if(!i||w)return;y(!0);const _e=Date.now();try{const Se=await n(i.name,h),Ue=Date.now()-_e;br.getInstance().capture(new qP({promptName:i.name,serverId:a,success:!0})).catch(()=>{}),S($e=>[{promptName:i.name,args:h,result:Se,timestamp:_e,duration:Ue},...$e])}catch(Se){br.getInstance().capture(new qP({promptName:i.name,serverId:a,success:!1,error:Se instanceof Error?Se.message:"Unknown error"})).catch(()=>{});const pe={promptName:i.name,args:h,result:null,error:Se instanceof Error?Se.message:String(Se),timestamp:_e,duration:Date.now()-_e};S($e=>[pe,...$e])}finally{y(!1)}},[i,h,w,n,a]),ye=E.useCallback(async(_e,Se)=>{try{await navigator.clipboard.writeText(JSON.stringify(Se,null,2)),x(_e),setTimeout(()=>x(null),2e3)}catch(Ue){console.error("[PromptsTab] Failed to copy result:",Ue)}},[]),Te=E.useCallback(()=>{i&&(H(""),U(!0))},[i]),He=E.useCallback(_e=>{X(A.filter(Se=>Se.id!==_e)),c?.id===_e&&u(null)},[A,X,c]);return W?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[ne!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{ne==="response"?P("detail"):(s(null),P("list"))},className:"p-0 h-8 w-8",children:p.jsx(KT,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{s(null),P("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Prompts"}),ne!=="list"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("button",{onClick:()=>{ne==="response"&&P("detail")},className:ne==="detail"?"text-foreground hover:underline":ne==="response"?"text-muted-foreground hover:text-foreground hover:underline cursor-pointer":"text-muted-foreground",children:"Execute"})]}),ne==="response"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Response"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(ay,{initial:!1,mode:"popLayout",children:[ne==="list"&&p.jsxs(da.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:[p.jsx(D4,{activeTab:R,isSearchExpanded:te,searchQuery:k,filteredPromptsCount:le.length,savedPromptsCount:A.length,onSearchExpand:()=>q(!0),onSearchChange:C,onSearchBlur:se,onTabSwitch:()=>I(R==="prompts"?"saved":"prompts"),searchInputRef:Q}),R==="prompts"?p.jsx(O4,{prompts:le,selectedPrompt:i,onPromptSelect:J,focusedIndex:ie}):p.jsx($4,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:ee,onDeletePrompt:He,focusedIndex:ie})]},"list"),ne==="detail"&&p.jsx(da.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:p.jsx(L4,{selectedPrompt:i,promptArgs:h,isExecuting:w,isConnected:r,onArgChange:ce,onExecute:re,onSave:Te})},"detail"),ne==="response"&&p.jsx(da.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:p.jsx(M4,{results:v,copiedResult:_,onCopy:ye})},"response")]})})]}):p.jsxs(gi,{direction:"horizontal",className:"h-full",children:[p.jsx(ar,{defaultSize:33,className:"flex flex-col h-full relative",children:p.jsxs(gi,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[p.jsx(ar,{defaultSize:75,minSize:30,children:p.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[p.jsx(D4,{activeTab:R,isSearchExpanded:te,searchQuery:k,filteredPromptsCount:le.length,savedPromptsCount:A.length,onSearchExpand:()=>q(!0),onSearchChange:C,onSearchBlur:se,onTabSwitch:()=>I(R==="prompts"?"saved":"prompts"),searchInputRef:Q}),R==="prompts"?p.jsx(O4,{prompts:le,selectedPrompt:i,onPromptSelect:J,focusedIndex:ie}):p.jsx($4,{savedPrompts:A,selectedPrompt:c,onLoadPrompt:ee,onDeletePrompt:He,focusedIndex:ie})]})}),p.jsx(Eo,{withHandle:!0}),p.jsxs(ar,{ref:V,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>j(!0),onExpand:()=>j(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[p.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),$?(V.current?.resize(25),j(!1)):(V.current?.resize(5),j(!0))},children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),B>0&&p.jsx(fa,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:B}),B>0&&!$&&p.jsx(Fe,{variant:"ghost",size:"sm",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),K.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:p.jsx(Rl,{className:"h-3.5 w-3.5"})})]}),p.jsx(zl,{className:`h-4 w-4 text-muted-foreground transition-transform ${$?"rotate-180":""}`})]}),!$&&p.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:p.jsx(EO,{serverIds:[a],onCountChange:z,onClearRef:K})})]})]})}),p.jsx(Eo,{withHandle:!0}),p.jsx(ar,{defaultSize:67,children:p.jsxs(gi,{direction:"vertical",children:[p.jsx(ar,{defaultSize:40,children:p.jsx(L4,{selectedPrompt:i,promptArgs:h,isExecuting:w,isConnected:r,onArgChange:ce,onExecute:re,onSave:Te})}),p.jsx(Eo,{withHandle:!0}),p.jsx(ar,{defaultSize:50,children:p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(M4,{results:v,copiedResult:_,onCopy:ye})})})]})})]})}zK.displayName="PromptsTab";function pu(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 g_e(e){return{uri:e.uri,mimeType:e.mimeType,text:e.text,blob:e.blob}}function FK({resource:e,onUIAction:t,className:n}){const a=async i=>t?.(i),r=g_e(e);return p.jsx("div",{className:n,children:p.jsx(bO,{resource:r,onUIAction:a,htmlProps:{autoResizeIframe:{width:!0,height:!0},style:{width:"100%",minHeight:"200px"},sandboxPermissions:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"},remoteDomProps:{remoteElements:[Nxe,Txe,Rxe,Cxe],library:gO}})})}function P4({result:e,isLoading:t,previewMode:n,serverId:a,readResource:r,onTogglePreview:i,onCopy:s,onDownload:c,onFullscreen:u,isCopied:d=!1}){let m=[],h;if(e?.resourceAnnotations&&(m=Object.keys(e.resourceAnnotations).filter(w=>w.startsWith("openai/")),h=e.resourceAnnotations["openai/outputTemplate"]),e?.result?.contents?.[0]?._meta){const w=e.result.contents[0]._meta,y=Object.keys(w).filter(_=>_.startsWith("openai/"));y.length>0&&(m=[...m,...y]),!h&&w["openai/outputTemplate"]&&(h=w["openai/outputTemplate"]),!h&&e.uri&&e.uri.startsWith("ui://widget/")&&(h=e.uri)}const g=!!(m.length>0&&h&&typeof h=="string"&&a&&r);if(t)return p.jsx("div",{className:"flex absolute left-0 top-0 items-center justify-center w-full h-full",children:p.jsx(Ao,{className:"size-5"})});if(!e)return p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a resource to view its contents"}),p.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a resource from the list to see its data"})]});if(e.error)return p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:e.error})]})});const v=e?.result?.contents&&Array.isArray(e.result.contents)&&e.result.contents.some(w=>w.mimeType&&pu(w)),S=v?e.result.contents.filter(w=>w.mimeType&&pu(w)):[];return p.jsxs("div",{className:"flex flex-col h-full",children:[p.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:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx($u,{className:"h-3 w-3 text-gray-400"}),p.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?p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(ap,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[w,"ms"]})]}):null})(),v&&p.jsx(fa,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 border-none border-purple-200 dark:border-purple-800/50 text-purple-600 dark:text-purple-400",children:"MCP UI"}),g&&p.jsx(fa,{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"})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[(v||g)&&p.jsxs(Fe,{variant:"ghost",size:"sm",onClick:i,className:n?"":"text-purple-600 dark:text-purple-400",children:[n?p.jsx(L9,{className:"h-4 w-4 mr-1"}):p.jsx($9,{className:"h-4 w-4 mr-1"}),n?"JSON":g?"Component":"Preview"]}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:s,children:d?p.jsx(Xa,{className:"h-4 w-4"}):p.jsx(ua,{className:"h-4 w-4"})}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:c,children:p.jsx(ZT,{className:"h-4 w-4"})}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:u,children:p.jsx(XT,{className:"h-4 w-4"})})]})]}),p.jsx("div",{className:"flex-1 overflow-y-auto",children:g&&a&&r&&h?n?p.jsx("div",{className:"flex-1 h-full",children:p.jsx(dO,{componentUrl:h,toolName:e.uri,toolArgs:{},toolResult:e.result,serverId:a,readResource:r,className:"w-full h-full relative flex p-4"})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})}):v?n?p.jsxs("div",{className:"space-y-0 h-full",children:[S.map((w,y)=>p.jsx("div",{className:"mx-0 size-full",children:p.jsx("div",{className:"w-full h-full",children:p.jsx(FK,{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(y=>!(y.mimeType&&pu(y)));if(w.length>0)return p.jsx("div",{className:"px-4",children:p.jsx(ur,{data:w,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-non-ui-${Date.now()}.json`})})}return null})()]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-mcp-ui-${Date.now()}.json`})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:e.result,filename:`resource-${e.uri.replace(/[^a-zA-Z0-9]/g,"-")}-${Date.now()}.json`})})})]})}function b_e(e,t){if(!e&&!t)return p.jsx(Kfe,{className:"h-5 w-5"});const n=(e||t||"").toLowerCase();return n.includes("image")?p.jsx(Vfe,{className:"h-5 w-5"}):n.includes("json")||n.includes("javascript")||n.includes("typescript")?p.jsx(Bfe,{className:"h-5 w-5"}):n.includes("html")||n.includes("xml")?p.jsx(qfe,{className:"h-5 w-5"}):n.includes("database")||n.includes("sql")?p.jsx(qv,{className:"h-5 w-5"}):p.jsx(YT,{className:"h-5 w-5"})}function U4({resources:e,selectedResource:t,onResourceSelect:n,focusedIndex:a}){return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(qv,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No resources available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((r,i)=>{const s=b_e(r.mimeType,r.uri),c=[r.description,r.mimeType&&p.jsx("span",{className:"font-mono",children:r.mimeType},"mime")].filter(Boolean);return p.jsx(pd,{id:`resource-${r.uri}`,isSelected:t?.uri===r.uri,isFocused:a===i,icon:s,title:r.name,description:c.length>0?p.jsxs("span",{className:"flex flex-col gap-1",children:[r.description&&p.jsx("span",{children:r.description}),r.mimeType&&p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500 font-mono",children:r.mimeType})]}):void 0,onClick:()=>n(r)},r.uri)})})}function z4({isSearchExpanded:e,searchQuery:t,filteredResourcesCount:n,onSearchExpand:a,onSearchChange:r,onSearchBlur:i,searchInputRef:s}){return p.jsx("div",{className:"flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2",children:p.jsx("div",{className:"flex items-center gap-2 flex-1",children:e?p.jsx(rr,{ref:s,placeholder:"Search resources...",value:t,onChange:c=>r(c.target.value),onBlur:i,className:"h-8 border-gray-300 dark:border-zinc-600"}):p.jsxs(p.Fragment,{children:[p.jsx("h2",{className:"text-lg font-medium text-gray-900 dark:text-gray-100",children:"Resources"}),p.jsx(fa,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:n}),p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:p.jsx(Jv,{className:"h-4 w-4"})})}),p.jsxs(wn,{side:"bottom",className:"flex gap-2",children:["Search",p.jsx(SO,{children:"F"})]})]})]})})})}function BK({ref:e,resources:t,readResource:n,serverId:a,isConnected:r}){const[i,s]=E.useState(null),{selectedResourceUri:c,setSelectedResourceUri:u}=qp(),[d,m]=E.useState(null),[h,g]=E.useState(!1),[v,S]=E.useState(""),[w]=E.useState("resources"),[y,_]=E.useState(!0),[x,k]=E.useState(!1),[C,R]=E.useState(-1),[I,A]=E.useState(!1),O=E.useRef(null),M=E.useRef(null),[U,F]=E.useState(!1),[H,te]=E.useState("list"),[q,ie]=E.useState(0),[G,Q]=E.useState(!0),W=E.useRef(null),oe=E.useRef(null);E.useEffect(()=>{const V=()=>{F(window.innerWidth<1024)};return V(),window.addEventListener("resize",V),()=>window.removeEventListener("resize",V)},[]),E.useEffect(()=>{te(i?"detail":"list")},[i]),E.useImperativeHandle(e,()=>({focusSearch:()=>{k(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{S(""),k(!1),O.current&&O.current.blur()}})),E.useEffect(()=>{x&&O.current&&O.current.focus()},[x]);const ne=E.useCallback(()=>{v.trim()||k(!1)},[v]),P=E.useMemo(()=>{if(!v)return t;const V=v.toLowerCase();return t.filter(K=>K.name.toLowerCase().includes(V)||K.description?.toLowerCase().includes(V)||K.uri.toLowerCase().includes(V))},[t,v]),B=E.useCallback(async V=>{if(s(V),r){g(!0);const K=Date.now();try{const X=await n(V.uri);br.getInstance().capture(new XP({resourceUri:V.uri,serverId:a,success:!0})).catch(()=>{}),m({uri:V.uri,result:X,timestamp:K,resourceAnnotations:V.annotations})}catch(X){br.getInstance().capture(new XP({resourceUri:V.uri,serverId:a,success:!1,error:X instanceof Error?X.message:"Unknown error"})).catch(()=>{}),m({uri:V.uri,result:null,error:X instanceof Error?X.message:"Unknown error",timestamp:K,resourceAnnotations:V.annotations})}finally{g(!1)}}},[n,a,r]);E.useEffect(()=>{R(-1)},[v,w]),E.useEffect(()=>{const V=K=>{const X=K.target;if(X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.contentEditable==="true"||K.metaKey||K.ctrlKey||K.altKey)return;const le=P;if(K.key==="ArrowDown")K.preventDefault(),R(J=>{const ee=J+1;return ee>=le.length?0:ee});else if(K.key==="ArrowUp")K.preventDefault(),R(J=>{const ee=J-1;return ee<0?le.length-1:ee});else if(K.key==="Enter"&&C>=0){K.preventDefault();const J=P[C];J&&B(J)}};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[C,P,B]),E.useEffect(()=>{if(C>=0){const V=`resource-${P[C]?.uri}`,K=document.getElementById(V);K&&K.scrollIntoView({behavior:"smooth",block:"nearest"})}},[C,P]),E.useEffect(()=>{if(c&&t.length>0){const V=t.find(K=>K.uri===c);V&&i?.uri!==V.uri&&(u(null),setTimeout(()=>{B(V);const K=document.getElementById(`resource-${V.uri}`);K&&K.scrollIntoView({behavior:"smooth",block:"nearest"})},100))}},[c,t,i,B,u]);const z=E.useCallback(async()=>{if(d)try{await navigator.clipboard.writeText(JSON.stringify(d.result,null,2)),A(!0),setTimeout(()=>A(!1),2e3)}catch(V){console.error("[ResourcesTab] Failed to copy result:",V)}},[d]),$=E.useCallback(()=>{if(d)try{const V=new globalThis.Blob([JSON.stringify(d.result,null,2)],{type:"application/json"}),K=URL.createObjectURL(V),X=document.createElement("a");X.href=K,X.download=`resource-${Date.now()}.json`,document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(K)}catch(V){console.error("[ResourcesTab] Failed to download result:",V)}},[d]),j=E.useCallback(async()=>{if(M.current)try{document.fullscreenElement?await document.exitFullscreen():await M.current.requestFullscreen()}catch(V){console.error("[ResourcesTab] Failed to toggle fullscreen:",V)}},[]);return U?p.jsxs("div",{className:"h-full flex flex-col overflow-hidden relative bg-background",children:[H!=="list"&&p.jsxs("div",{className:"flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",children:[p.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{s(null),te("list")},className:"p-0 h-8 w-8",children:p.jsx(KT,{className:"h-4 w-4"})}),p.jsxs("div",{className:"flex items-center text-sm font-medium",children:[p.jsx("button",{onClick:()=>{s(null),te("list")},className:"text-muted-foreground hover:text-foreground hover:underline cursor-pointer",children:"Resources"}),H==="detail"&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"mx-2 text-muted-foreground",children:"/"}),p.jsx("span",{className:"text-foreground",children:"Content"})]})]})]}),p.jsx("div",{className:"flex-1 relative overflow-hidden",children:p.jsxs(ay,{initial:!1,mode:"popLayout",children:[H==="list"&&p.jsxs(da.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:[p.jsx(z4,{activeTab:w,isSearchExpanded:x,searchQuery:v,filteredResourcesCount:P.length,onSearchExpand:()=>k(!0),onSearchChange:S,onSearchBlur:ne,onTabSwitch:()=>{},searchInputRef:O}),p.jsx("div",{className:"flex flex-col h-full",children:p.jsx(U4,{resources:P,selectedResource:i,onResourceSelect:B,focusedIndex:C})})]},"list"),H==="detail"&&p.jsx(da.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:p.jsx("div",{ref:M,className:"h-full",children:p.jsx(P4,{result:d,isLoading:h,previewMode:y,serverId:a,readResource:n,onTogglePreview:()=>_(!y),onCopy:z,onDownload:$,onFullscreen:j,isCopied:I})})},"detail")]})})]}):p.jsxs(gi,{direction:"horizontal",className:"h-full",children:[p.jsx(ar,{defaultSize:25,children:p.jsxs(gi,{direction:"vertical",className:"h-full border-r dark:border-zinc-700",children:[p.jsx(ar,{defaultSize:75,minSize:30,children:p.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[p.jsx(z4,{activeTab:w,isSearchExpanded:x,searchQuery:v,filteredResourcesCount:P.length,onSearchExpand:()=>k(!0),onSearchChange:S,onSearchBlur:ne,onTabSwitch:()=>{},searchInputRef:O}),p.jsx(U4,{resources:P,selectedResource:i,onResourceSelect:B,focusedIndex:C})]})}),p.jsx(Eo,{withHandle:!0}),p.jsxs(ar,{ref:W,defaultSize:0,collapsible:!0,minSize:5,collapsedSize:5,onCollapse:()=>Q(!0),onExpand:()=>Q(!1),className:"flex flex-col border-t dark:border-zinc-700",children:[p.jsxs("div",{className:"group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors",onClick:V=>{V.preventDefault(),V.stopPropagation(),G?(W.current?.resize(25),Q(!1)):(W.current?.resize(5),Q(!0))},children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"text-sm font-medium",children:"RPC Messages"}),q>0&&p.jsx(fa,{variant:"secondary",className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",children:q}),q>0&&!G&&p.jsx(Fe,{variant:"ghost",size:"sm",onClick:V=>{V.preventDefault(),V.stopPropagation(),oe.current?.()},className:"h-6 w-6 p-0",title:"Clear all messages",children:p.jsx(Rl,{className:"h-3.5 w-3.5"})})]}),p.jsx(zl,{className:`h-4 w-4 text-muted-foreground transition-transform ${G?"":"rotate-180"}`})]}),!G&&p.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:p.jsx(EO,{serverIds:[a],onCountChange:ie,onClearRef:oe})})]})]})}),p.jsx(Eo,{}),p.jsx(ar,{defaultSize:50,children:p.jsx(gi,{direction:"vertical",children:p.jsx(ar,{defaultSize:70,children:p.jsx("div",{ref:M,className:"h-full bg-white dark:bg-zinc-900",children:p.jsx(P4,{result:d,isLoading:h,previewMode:y,serverId:a,readResource:n,onTogglePreview:()=>_(!y),onCopy:z,onDownload:$,onFullscreen:j,isCopied:I})})})})})]})}BK.displayName="ResourcesTab";function F4({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:a,focusedIndex:r}){if(e.length===0)return p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(qv,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),p.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});const i=(s,c)=>{s.stopPropagation(),c()};return p.jsx("div",{className:"overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain",children:e.map((s,c)=>p.jsxs("div",{className:"relative group",children:[p.jsx(pd,{id:`saved-${s.id}`,isSelected:t?.id===s.id,isFocused:r===c,icon:p.jsx(Cb,{className:"h-4 w-4"}),title:s.name,description:s.toolName,metadata:p.jsx("div",{className:"flex flex-col gap-1",children:p.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(s.savedAt).toLocaleString()})}),onClick:()=>n(s)}),p.jsx("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:p.jsxs(vn,{children:[p.jsx(yn,{asChild:!0,children:p.jsx(Fe,{variant:"secondary",size:"sm",onClick:u=>i(u,()=>a(s.id)),className:"h-8 w-8 p-0",children:p.jsx(Rl,{className:"h-4 w-4"})})}),p.jsx(wn,{children:p.jsx("p",{children:"Delete saved request"})})]})})]},s.id))})}function B4({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:a,onSave:r,onCancel:i}){return e?p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:i,children:p.jsxs("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:s=>s.stopPropagation(),children:[p.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx(In,{htmlFor:"request-name",children:"Request Name (optional)"}),p.jsx(rr,{id:"request-name",value:t,onChange:s=>a(s.target.value),placeholder:n,className:"mt-2",onKeyDown:s=>{s.key==="Enter"&&r()},autoFocus:!0})]}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Fe,{variant:"outline",onClick:i,children:"Cancel"}),p.jsxs(Fe,{onClick:r,children:[p.jsx(qT,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}function HK(e,t){if(!e?.$ref)return e;const n=e.$ref;if(n.startsWith("#/")){const a=n.substring(2).split("/");let r=t;for(const i of a)if(r&&typeof r=="object"&&i in r)r=r[i];else return console.warn(`Could not resolve $ref: ${n}`),e;return r}return e}function v_e(e,t){if(e.anyOf&&Array.isArray(e.anyOf)){const n=e.anyOf.find(a=>a.type!=="null");if(n)return{...HK(n,t),nullable:!0}}return e}function y_e(e){return Array.isArray(e.enum)?e.enum:null}function w_e({selectedTool:e,toolArgs:t,onArgChange:n}){const a=e?.inputSchema?.properties||{},r=e?.inputSchema?.required||[];return Object.keys(a).length>0?p.jsx("div",{className:"space-y-4",children:Object.entries(a).map(([s,c])=>{const u=e?.inputSchema||{};let d=v_e(c,u);d=HK(d,u);const m=y_e(d),h=d.type==="string"&&m!==null,g=d;g.required=r.includes(s);const v=t[s];let S="";return v!=null&&(typeof v=="string"?S=v:typeof v=="object"&&v!==null?S=JSON.stringify(v,null,2):S=String(v)),g.type==="object"||g.type==="array"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:s,className:"text-sm font-medium",children:[s,g?.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(uy,{id:s,value:S,onChange:y=>n(s,y.target.value),placeholder:g?.description||`Enter ${s}`,className:"min-h-[100px]"}),g?.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s):h&&m?p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:s,className:"text-sm font-medium",children:[s,g.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsxs(iu,{value:String(t[s]||""),onValueChange:y=>n(s,y),children:[p.jsx(su,{id:s,className:"w-full",children:p.jsx(ou,{placeholder:g.description||"Select an option"})}),p.jsx(lu,{children:m.map((y,_)=>p.jsx(ci,{value:y,children:g.enumNames?.[_]||y},y))})]}),g.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s):p.jsxs("div",{className:"space-y-2",children:[p.jsxs(In,{htmlFor:s,className:"text-sm font-medium",children:[s,g?.required&&p.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p.jsx(rr,{id:s,value:S,onChange:y=>n(s,y.target.value),placeholder:g?.description||`Enter ${s}`}),g?.description&&p.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.description})]},s)})}):p.jsx("div",{className:"flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",children:"No parameters required"})}function H4({selectedTool:e,toolArgs:t,isExecuting:n,isConnected:a,onArgChange:r,onExecute:i,onSave:s}){return E.useEffect(()=>{const c=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&e&&!n&&a&&(u.preventDefault(),i())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n,a,i]),e?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("div",{className:"flex-shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-4 sm:pr-4",children:p.jsxs("div",{children:[p.jsxs("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[p.jsx("h3",{className:"text-base sm:text-lg font-semibold",children:e.name}),p.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[p.jsxs(Fe,{variant:"outline",onClick:s,disabled:n,size:"sm",className:"lg:size-default gap-2",children:[p.jsx(qT,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Save"})]}),p.jsx(Fe,{onClick:i,disabled:n||!a,size:"sm",className:"lg:size-default pr-1! gap-0",children:n?p.jsxs(p.Fragment,{children:[p.jsx(Ao,{className:"mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Executing..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(P9,{className:"h-4 w-4 sm:mr-2"}),p.jsx("span",{className:"hidden sm:inline",children:"Execute"}),p.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&&p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",children:e.description})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",children:p.jsx(w_e,{selectedTool:e,toolArgs:t,onArgChange:r})})]}):p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),p.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 V4(e){const n=Date.now()-e,a=Math.floor(n/1e3),r=Math.floor(a/60),i=Math.floor(r/60),s=Math.floor(i/24);return a<10?"now":a<60?`${a}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${s}d ago`}function S_e(e){try{return JSON.parse(e),!0}catch{return!1}}function E_e({content:e}){return!Array.isArray(e)||e.length===0?p.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content"}):p.jsx("div",{className:"space-y-4",children:e.map((t,n)=>{if(t.type==="text"){const a=t.text||"";if(S_e(a))try{const r=JSON.parse(a);return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content (JSON)"}),p.jsx(ur,{data:r,filename:`content-${n}.json`})]},n)}catch{}return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Text Content"}),p.jsx("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words",children:a})]},n)}if(t.type==="image")return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Image Content"}),p.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[p.jsx("img",{src:`data:${t.mimeType||"image/png"};base64,${t.data}`,alt:"Result",className:"max-w-full rounded"}),t.annotations&&p.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:p.jsx(ur,{data:t.annotations,filename:`image-annotations-${n}.json`})})]})]},n);if(t.type==="audio")return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Audio Content"}),p.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[p.jsx("audio",{controls:!0,src:`data:${t.mimeType||"audio/wav"};base64,${t.data}`,className:"w-full"}),t.annotations&&p.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:p.jsx(ur,{data:t.annotations,filename:`audio-annotations-${n}.json`})})]})]},n);if(t.type==="resource_link")return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Resource Link"}),p.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[p.jsxs("div",{className:"font-mono text-sm break-all",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",t.uri]}),t.name&&p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Name:"})," ",t.name]}),t.description&&p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Description:"})," ",t.description]}),t.mimeType&&p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",t.mimeType]}),t.annotations&&p.jsxs("div",{className:"mt-2",children:[p.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),p.jsx(ur,{data:t.annotations,filename:`resource-link-annotations-${n}.json`})]})]})]},n);if(t.type==="resource"){const a=t.resource||{};return p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Embedded Resource"}),p.jsxs("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[p.jsxs("div",{className:"font-mono text-sm break-all",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",a.uri]}),a.mimeType&&p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",a.mimeType]}),a.text&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Content:"}),p.jsx("div",{className:"bg-white dark:bg-black rounded p-2 font-mono text-sm whitespace-pre-wrap break-words max-h-60 overflow-y-auto",children:a.text})]}),a.blob&&p.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["[Binary content: ",a.blob.length||0," bytes]"]}),a.annotations&&p.jsxs("div",{className:"mt-2",children:[p.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),p.jsx(ur,{data:a.annotations,filename:`resource-annotations-${n}.json`})]})]})]},n)}return p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Unknown Content Type: ",t.type||"N/A"]}),p.jsx(ur,{data:t,filename:`content-${n}.json`})]},n)})})}function G4({results:e,copiedResult:t,previewMode:n,serverId:a,readResource:r,onCopy:i,onTogglePreview:s,onMaximize:c,isMaximized:u=!1}){const[d,m]=E.useState(0),[h,g]=E.useState(""),[v,S]=E.useState(!0),w=e[0],y=w?e.filter(q=>q.toolName===w.toolName):[],_=y[d]||y[0],x=e.findIndex(q=>q===_);E.useEffect(()=>{y.length>0&&d>=y.length&&m(0)},[y.length,d]),E.useEffect(()=>{const q=()=>{_&&g(V4(_.timestamp))};q();const ie=setInterval(q,1e3);return()=>clearInterval(ie)},[_]);const k=E.useMemo(()=>_?.args,[_?.timestamp,d]),C=E.useMemo(()=>_?.result,[_?.timestamp,d]),R=E.useCallback(q=>r(q),[r]);if(e.length===0)return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-center",children:p.jsx(Wv,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})});const I=_.toolMeta?.["openai/outputTemplate"],A=!!(I&&typeof I=="string"&&_.appsSdkResource),O=I,M=_.result?.content||[],U=M.filter(q=>q.type==="resource"&&pu(q.resource)),F=U.length>0,H=!!(M&&M.length>0||_.result?.structuredContent),te=!F&&!A&&H;return p.jsx("div",{className:"flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",children:p.jsx("div",{className:"flex-1 overflow-y-auto h-full",children:p.jsxs("div",{className:"space-y-0 flex-1 h-full flex flex-col",children:[p.jsxs("div",{className:`flex items-center gap-2 px-4 pt-2 ${F||A||te?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[p.jsx("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),_.duration!==void 0&&p.jsxs("div",{className:"hidden sm:flex items-center gap-1",children:[p.jsx(ap,{className:"h-3 w-3 text-gray-400"}),p.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[_.duration,"ms"]})]}),A&&p.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[p.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",O||"No URI"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Component"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw JSON"})]})]}),F&&!A&&p.jsxs("div",{className:"flex items-center gap-4 sm:ml-4",children:[p.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500 dark:text-gray-400",children:["URI: ",U[0]?.resource?.uri||"No URI"]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Preview"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>s(),className:`text-xs font-medium ${n?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"JSON"})]})]}),te&&p.jsxs("div",{className:"flex items-center gap-2 sm:ml-4",children:[p.jsx("button",{onClick:()=>S(!0),className:`text-xs font-medium ${v?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Formatted"}),p.jsx("span",{className:"text-xs text-zinc-400",children:"|"}),p.jsx("button",{onClick:()=>S(!1),className:`text-xs font-medium ${v?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw"})]}),p.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(A||F)&&c&&p.jsx(Fe,{variant:"ghost",size:"sm",onClick:c,title:u?"Restore":"Maximize",children:u?p.jsx(upe,{className:"h-4 w-4"}):p.jsx(XT,{className:"h-4 w-4"})}),y.length>1&&p.jsxs(iu,{value:d.toString(),onValueChange:q=>m(parseInt(q)),children:[p.jsx(su,{size:"sm",className:"w-[140px] h-8 text-xs",children:p.jsx(ou,{children:p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Cb,{className:"h-3 w-3"}),p.jsx("span",{children:h})]})})}),p.jsx(lu,{children:y.map((q,ie)=>p.jsx(ci,{value:ie.toString(),children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Cb,{className:"h-3 w-3"}),p.jsx("span",{children:V4(q.timestamp)}),p.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",new Date(q.timestamp).toLocaleTimeString(),")"]})]})},ie))})]}),p.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>i(x,_.result),children:t===x?p.jsx(Xa,{className:"h-4 w-4"}):p.jsx(ua,{className:"h-4 w-4"})})]})]}),_.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:_.error})]}):(()=>{if(A){const q=_.appsSdkResource;return q.isLoading?p.jsx(p.Fragment,{}):q.error?p.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:[p.jsx("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Resource Error:"}),p.jsx("p",{className:"text-red-700 dark:text-red-400 text-sm",children:q.error})]}):n?p.jsx("div",{className:"flex-1",children:p.jsx(dO,{componentUrl:O,toolName:_.toolName,toolArgs:k,toolResult:C,serverId:a,readResource:R,className:"w-full h-full relative p-4"})}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:_.result,filename:`tool-result-${_.toolName}-${Date.now()}.json`})})}if(F)return n?p.jsxs("div",{className:"space-y-0 h-full",children:[U.map((q,ie)=>p.jsx("div",{className:"mx-0 size-full",children:p.jsx(FK,{resource:q.resource,onUIAction:G=>{},className:"w-full h-full relative"})},ie)),M.filter(q=>!(q.type==="resource"&&pu(q.resource))).length>0&&p.jsx("div",{className:"px-4",children:p.jsx(ur,{data:M.filter(q=>!(q.type==="resource"&&pu(q.resource))),filename:`tool-result-${_.toolName}-non-ui-${Date.now()}.json`})})]}):p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:_.result,filename:`tool-result-${_.toolName}-mcp-ui-${Date.now()}.json`})});if(te&&v){const q=_.result?.structuredContent;return p.jsxs("div",{className:"px-4 pt-4 space-y-4",children:[q&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Structured Content"}),p.jsx(ur,{data:q,filename:`structured-content-${_.toolName}-${Date.now()}.json`})]}),M&&M.length>0&&p.jsx(E_e,{content:M}),!q&&(!M||M.length===0)&&p.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content to display"})]})}return p.jsx("div",{className:"px-4 pt-4",children:p.jsx(ur,{data:_.result,filename:`tool-result-${_.toolName}-${Date.now()}.json`})})})()]})})})}function W4({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:a}){return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[p.jsx(Cl,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),p.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]}):p.jsx("div",{className:"overflow-y-auto flex-1 overscroll-contain",children:e.map((r,i)=>p.jsx(pd,{id:`tool-${r.name}`,isSelected:t?.name===r.name,isFocused:a===i,icon:p.jsx(Cl,{className:"h-4 w-4"}),title:r.name,description:r.description,metadata:r.inputSchema?.properties&&p.jsxs(fa,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[Object.keys(r.inputSchema.properties).length," params"]}),onClick:()=>n(r)},r.name))})}function K4({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredToolsCount:a,savedRequestsCount:r,onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d}){return p.jsx(UK,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:"tools",secondaryTabName:"saved",primaryTabTitle:"Tools",secondaryTabTitle:"Saved",primaryCount:a,secondaryCount:r,primaryIcon:Cl,secondaryIcon:qv,searchPlaceholder:"Search tools...",onSearchExpand:i,onSearchChange:s,onSearchBlur:c,onTabSwitch:u,searchInputRef:d})}const Z4="mcp-inspector-saved-requests";function VK({ref:e,tools:t,callTool:n,readResource:a,serverId:r,isConnected:i}){const[s,c]=E.useState(null),[u,d]=E.useState(null),{selectedToolName:m,setSelectedToolName:h}=qp(),[g,v]=E.useState({}),[S,w]=E.useState([]),[y,_]=E.useState(!1),[x,k]=E.useState(null),[C,R]=E.useState(""),[I,A]=E.useState("tools"),[O,M]=E.useState([]),[U,F]=E.useState(!1),[H,te]=E.useState(""),[q,ie]=E.useState(!0),[G,Q]=E.useState(!1),[W,oe]=E.useState(-1),ne=E.useRef(null),[P,B]=E.useState(!1),[z,$]=E.useState("list"),[j,V]=E.useState(!1),[K,X]=E.useState(0),[se,le]=E.useState(!0),[J,ee]=E.useState(void 0),ce=E.useRef(null),re=E.useRef(null),ye=E.useRef(null),Te=E.useRef(null),He=E.useRef(null);E.useEffect(()=>{const ke=()=>{B(window.innerWidth<1024)};return ke(),window.addEventListener("resize",ke),()=>window.removeEventListener("resize",ke)},[]),E.useEffect(()=>{$(s?"detail":"list")},[s]),E.useEffect(()=>{P&&S.length>0&&!y&&$("response")},[S,y,P]),E.useImperativeHandle(e,()=>({focusSearch:()=>{Q(!0),setTimeout(()=>{ne.current&&ne.current.focus()},0)},blurSearch:()=>{R(""),Q(!1),ne.current&&ne.current.blur()}})),E.useEffect(()=>{try{const ke=localStorage.getItem(Z4);ke&&M(JSON.parse(ke))}catch(ke){console.error("[ToolsTab] Failed to load saved requests:",ke)}},[]);const _e=E.useCallback(ke=>{try{localStorage.setItem(Z4,JSON.stringify(ke)),M(ke)}catch(Ie){console.error("[ToolsTab] Failed to save requests:",Ie)}},[]),Se=E.useMemo(()=>{if(!C.trim())return t;const ke=C.toLowerCase();return t.filter(Ie=>Ie.name.toLowerCase().includes(ke)||Ie.description?.toLowerCase().includes(ke))},[t,C]),Ue=E.useCallback(ke=>{c(ke);const Ie={};ke.inputSchema?.properties&&Object.entries(ke.inputSchema.properties).forEach(([ze,gt])=>{const nt=gt;nt.default!==void 0?Ie[ze]=nt.default:nt.type==="string"?Ie[ze]="":nt.type==="number"?Ie[ze]=0:nt.type==="boolean"?Ie[ze]=!1:nt.type==="array"?Ie[ze]="[]":nt.type==="object"&&(Ie[ze]="{}")}),v(Ie)},[]),pe=E.useCallback(ke=>{const Ie=t.find(ze=>ze.name===ke.toolName);Ie&&(c(Ie),v(ke.args),d(ke))},[t]);E.useEffect(()=>{G&&ne.current&&ne.current.focus()},[G]);const $e=E.useCallback(()=>{C.trim()||Q(!1)},[C]);E.useEffect(()=>{I!=="tools"&&Q(!1)},[I]),E.useEffect(()=>{oe(-1)},[C,I]),E.useEffect(()=>{const ke=Ie=>{const ze=Ie.target;if(ze.tagName==="INPUT"||ze.tagName==="TEXTAREA"||ze.contentEditable==="true"||Ie.metaKey||Ie.ctrlKey||Ie.altKey)return;const nt=I==="tools"?Se:O;if(Ie.key==="ArrowDown")Ie.preventDefault(),oe(et=>{const Ct=et+1;return Ct>=nt.length?0:Ct});else if(Ie.key==="ArrowUp")Ie.preventDefault(),oe(et=>{const Ct=et-1;return Ct<0?nt.length-1:Ct});else if(Ie.key==="Enter"&&W>=0)if(Ie.preventDefault(),I==="tools"){const et=Se[W];et&&Ue(et)}else{const et=O[W];et&&pe(et)}};return document.addEventListener("keydown",ke),()=>document.removeEventListener("keydown",ke)},[W,Se,O,I,Ue,pe]),E.useEffect(()=>{if(W>=0){const ke=I==="tools"?`tool-${Se[W]?.name}`:`saved-${O[W]?.id}`,Ie=document.getElementById(ke);Ie&&Ie.scrollIntoView({behavior:"smooth",block:"nearest"})}},[W,Se,O,I]),E.useEffect(()=>{if(m&&t.length>0){const ke=t.find(Ie=>Ie.name===m);if(ke&&s?.name!==ke.name){h(null);const Ie=setTimeout(()=>{Ue(ke);const ze=document.getElementById(`tool-${ke.name}`);ze&&ze.scrollIntoView({behavior:"smooth",block:"nearest"})},100);return()=>clearTimeout(Ie)}}},[m,t,s,Ue,h]);const Be=E.useCallback((ke,Ie)=>{v(ze=>{const gt={...ze};if(s?.inputSchema?.properties?.[ke]){const et=s.inputSchema.properties[ke].type;if(et==="object"||et==="array")gt[ke]=Ie;else if(et==="string")gt[ke]=Ie;else try{gt[ke]=JSON.parse(Ie)}catch{gt[ke]=Ie}}else gt[ke]=Ie;return gt})},[s]),Ee=E.useCallback(async()=>{if(!s||y)return;_(!0);const ke=Date.now();try{const Ie={...g};s.inputSchema?.properties&&Object.entries(s.inputSchema.properties).forEach(([En,_t])=>{const Ft=_t.type,qe=Ie[En];if((Ft==="object"||Ft==="array")&&typeof qe=="string")try{Ie[En]=JSON.parse(qe)}catch{}});const ze=await n(s.name,Ie,{timeout:6e5,resetTimeoutOnProgress:!0}),gt=Date.now()-ke;br.getInstance().capture(new YP({toolName:s.name,serverId:r,success:!0,duration:gt})).catch(()=>{});const et=s?._meta||s?.metadata,Ct=et?.["openai/outputTemplate"];let Lt;if(Ct&&typeof Ct=="string"){const En={toolName:s.name,args:g,result:ze,timestamp:ke,duration:gt,toolMeta:et,appsSdkResource:{uri:Ct,resourceData:null,isLoading:!0}};w([En]);try{const _t=await a(Ct);let Zt=null;if(ze?.structuredContent)Zt=ze.structuredContent;else if(Array.isArray(ze)&&ze[0]){const Ft=ze[0];Ft.output?.value?.structuredContent?Zt=Ft.output.value.structuredContent:Ft.structuredContent?Zt=Ft.structuredContent:Ft.output?.value&&(Zt=Ft.output.value)}Zt||(Zt=ze),Lt={uri:Ct,resourceData:{..._t,structuredContent:Zt},isLoading:!1}}catch(_t){Lt={uri:Ct,resourceData:null,isLoading:!1,error:_t instanceof Error?_t.message:String(_t)}}w(_t=>_t.map((Zt,Ft)=>Ft===0?{...Zt,appsSdkResource:Lt}:Zt))}else w(En=>[{toolName:s.name,args:g,result:ze,timestamp:ke,duration:gt,toolMeta:et},...En])}catch(Ie){const ze=Date.now()-ke;br.getInstance().capture(new YP({toolName:s.name,serverId:r,success:!1,duration:ze,error:Ie instanceof Error?Ie.message:String(Ie)})).catch(()=>{});const nt=s?._meta||s?.metadata,et={toolName:s.name,args:g,result:null,error:Ie instanceof Error?Ie.message:String(Ie),timestamp:ke,duration:ze,toolMeta:nt},Ct=nt?.["openai/outputTemplate"];w(Ct?[et]:Lt=>[et,...Lt])}finally{_(!1)}},[s,g,y,n,a,r]),ot=E.useCallback(async(ke,Ie)=>{try{await navigator.clipboard.writeText(JSON.stringify(Ie,null,2)),k(ke),setTimeout(()=>k(null),2e3)}catch(ze){console.error("[ToolsTab] Failed to copy result:",ze)}},[]),at=E.useCallback(ke=>{w(Ie=>Ie.filter((ze,gt)=>gt!==ke))},[]),pt=E.useCallback(ke=>{const Ie=S[ke];if(Ie){const ze=window.open("","_blank","width=800,height=600");ze&&(ze.document.write(`
1670
1670
  <html>
1671
1671
  <head>
1672
1672
  <title>${Ie.toolName} Result</title>