@mcp-use/inspector 20.0.0-beta.5 → 20.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{ChatTab-B255lH5i.js → ChatTab-D6J3Gyp7.js} +885 -837
- package/dist/cdn/{ConnectionSettingsForm-DF-NS58d.js → ConnectionSettingsForm-CWQueI8J.js} +1 -1
- package/dist/cdn/{ConnectionSettingsTab-dI-Cqe79.js → ConnectionSettingsTab-FGyt3QaI.js} +1 -1
- package/dist/cdn/{MarkdownRenderer-Ba7nA4Ie.js → MarkdownRenderer-gLqUICEd.js} +1 -1
- package/dist/cdn/{OAuthCallback-Blc2Asxc.js → OAuthCallback-Bg2bP-o9.js} +1 -1
- package/dist/cdn/{PromptsTab-BYKnY7Rp.js → PromptsTab-C4LuwyWN.js} +1 -1
- package/dist/cdn/{ResourcesTab-BGualKW-.js → ResourcesTab-CQkKni-P.js} +5 -5
- package/dist/cdn/{SamplingTab-BeZBUeni.js → SamplingTab-D8q-iCMc.js} +3 -3
- package/dist/cdn/{ToolsTab-j6n4O_3s.js → ToolsTab-6xaVH43x.js} +4 -4
- package/dist/cdn/{ViewPreview-DihyG6Qd.js → ViewPreview-Ohh6JwOn.js} +2 -2
- package/dist/cdn/{WidgetWrapper-B4H3Fek7.js → WidgetWrapper-CruwjBOd.js} +2 -2
- package/dist/cdn/{dist-DbX5yidW.js → dist-CXHFvGre.js} +3 -2
- package/dist/cdn/inspector.js +5 -5
- package/dist/cdn/{react-BajV-X4P.js → react-BLtCruam.js} +575 -568
- package/dist/cdn/{telemetry-DabTAQ8x.js → telemetry-C7Ytz2BG.js} +1 -1
- package/dist/cdn/{useConfig-Btmh8wjJ.js → useConfig-BW6uQf2m.js} +2 -2
- package/dist/cdn/{useViewHostProps-B6SKeeH9.js → useViewHostProps-CINeSkth.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/components/chat/MessageList.d.ts +1 -0
- package/dist/client/components/chat/MessageList.d.ts.map +1 -1
- package/dist/client/components/chat/ToolResultRenderer.d.ts.map +1 -1
- package/dist/client/components/chat/partialToolArgs.d.ts +10 -0
- package/dist/client/components/chat/partialToolArgs.d.ts.map +1 -0
- package/dist/client/components/chat/types.d.ts +1 -0
- package/dist/client/components/chat/types.d.ts.map +1 -1
- package/dist/client/components/chat/useChatMessages.d.ts.map +1 -1
- package/dist/client/components/chat/useChatMessagesClientSide.d.ts.map +1 -1
- package/dist/client/index.js +158 -81
- package/dist/server/cdn-shell.js +2 -2
- package/dist/server/{chunk-ZCGLU5T7.js → chunk-GBY4WAVP.js} +1 -1
- package/dist/server/{chunk-DSTNUYWX.js → chunk-IFF5T5J4.js} +1 -1
- package/dist/server/{chunk-SQ4XNMLT.js → chunk-NUHI6MJ6.js} +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/middleware.js +3 -3
- package/dist/server/version.js +1 -1
- package/dist/web/assets/ChatTab-CsBPVCSc.js +18 -0
- package/dist/web/assets/{ConnectionSettingsTab-BjGkLwVu.js → ConnectionSettingsTab-DQTXfnl1.js} +1 -1
- package/dist/web/assets/{ElicitationTab-D3ZUKHND.js → ElicitationTab-_FKB7nNG.js} +1 -1
- package/dist/web/assets/{ManufactOAuthCallback-CS3ydSZg.js → ManufactOAuthCallback-BRO6TPkZ.js} +1 -1
- package/dist/web/assets/{MarkdownRenderer-BeeBfQhv.js → MarkdownRenderer-gaJFjbtr.js} +1 -1
- package/dist/web/assets/{NotificationsTab-Uj0_DrmK.js → NotificationsTab-LYcfRjyd.js} +1 -1
- package/dist/web/assets/{OAuthCallback-C0ljgCiw.js → OAuthCallback-D8UItgTB.js} +1 -1
- package/dist/web/assets/{PromptsTab-Bns2u0G-.js → PromptsTab-B2uVMRR2.js} +1 -1
- package/dist/web/assets/{ResourcesTab-CO24312V.js → ResourcesTab-DhOZYPjE.js} +1 -1
- package/dist/web/assets/{SamplingTab-7gtN7FwU.js → SamplingTab-C-oY2hoi.js} +1 -1
- package/dist/web/assets/{ServerMetadataTab-CQwqYSjL.js → ServerMetadataTab-BkTxO5KS.js} +1 -1
- package/dist/web/assets/{ToolsTab-bDdRxI1b.js → ToolsTab-DupHgo7A.js} +1 -1
- package/dist/web/assets/{ViewPreview-Ba1Ec5uA.js → ViewPreview--z6jL0Zg.js} +1 -1
- package/dist/web/assets/{WidgetWrapper-CYHfzrtb.js → WidgetWrapper-CZaEVEw4.js} +1 -1
- package/dist/web/assets/{checkbox-CzBkaNKa.js → checkbox-BQ9mI_6k.js} +1 -1
- package/dist/web/assets/{dist-C5JjLJN9.js → dist-B8sA8Zml.js} +5 -5
- package/dist/web/assets/{index-TQ5V7cM9.js → index-C_fCIJ4C.js} +3 -3
- package/dist/web/assets/{shared-BF0rJNdE.js → shared-CCC9rTz4.js} +1 -1
- package/dist/web/assets/{tabs-subtle-6D79T1xd.js → tabs-subtle-246ABJqx.js} +1 -1
- package/dist/web/assets/{useConfig-BAgALiZg.js → useConfig-BAsKhUxf.js} +1 -1
- package/dist/web/assets/{useViewHostProps-BYitt_6K.js → useViewHostProps-CV5zBxUb.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +3 -3
- package/dist/web/assets/ChatTab-BCobuZDc.js +0 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTab-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTab-CsBPVCSc.js","assets/react-CU_d2d5K.js","assets/input-CLYhA7PK.js","assets/createLucideIcon-B3b8EU0b.js","assets/jsx-runtime-Cjj9sGSy.js","assets/FormContext-DH2caWKO.js","assets/select-CJ57-Bor.js","assets/AnimatePresence-C5p0yiY1.js","assets/label-Cdim77Jw.js","assets/tabs-subtle-246ABJqx.js","assets/refresh-cw-C9wQl8_d.js","assets/MarkdownRenderer-gaJFjbtr.js","assets/checkbox-BQ9mI_6k.js","assets/dist-B8sA8Zml.js","assets/useConfig-BAsKhUxf.js","assets/schemaHelpers-DLNTQr_6.js","assets/textarea-DLAmNVf_.js","assets/useViewHostProps-CV5zBxUb.js","assets/ToolsTab-DupHgo7A.js","assets/WidgetWrapper-CZaEVEw4.js","assets/maximize-2-BTT9QQU9.js","assets/sparkles-2OAsc1aP.js","assets/zap-Du2Uc5pa.js","assets/code-tME-5H6D.js","assets/shared-CCC9rTz4.js","assets/ListTabHeader-R17w_JsB.js","assets/maximize-_O55kFcr.js","assets/save-B-MsgxX9.js","assets/PromptsTab-B2uVMRR2.js","assets/ResourcesTab-DhOZYPjE.js","assets/brush--0LobUi4.js","assets/SamplingTab-C-oY2hoi.js","assets/ElicitationTab-_FKB7nNG.js","assets/NotificationsTab-LYcfRjyd.js","assets/ServerMetadataTab-BkTxO5KS.js","assets/inspector-settings-layout-yjKRJDai.js","assets/ConnectionSettingsTab-DQTXfnl1.js","assets/OAuthCallback-D8UItgTB.js","assets/ManufactOAuthCallback-BRO6TPkZ.js","assets/ViewPreview--z6jL0Zg.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{a as e,i as t,n,s as r,t as i}from"./react-CU_d2d5K.js";import{$ as a,$n as o,A as s,Ar as c,At as l,B as u,Bn as d,Cr as f,Ct as p,D as m,Dn as h,Dr as g,Dt as _,E as v,En as y,Er as b,F as x,Fr as S,G as C,Gt as w,I as T,Ir as E,It as ee,J as te,K as ne,Kn as re,Kt as ie,L as ae,Lr as D,Lt as O,M as k,Mn as A,Mt as oe,N as j,Nn as se,Nr as ce,Nt as M,O as N,Ot as le,P as ue,Pn as de,Pr as fe,Pt as pe,Q as me,R as he,Rn as ge,Rt as _e,S as ve,Sr as ye,St as be,T as xe,Tn as P,Tt as Se,U as Ce,Un as we,Ut as Te,Wn as Ee,X as De,Y as Oe,Yn as ke,Z as Ae,Zn as je,_ as Me,_r as Ne,_t as Pe,a as Fe,an as Ie,ar as Le,at as Re,b as ze,br as Be,c as Ve,ct as He,dr as Ue,dt as We,et as Ge,f as F,fr as Ke,ft as qe,g as Je,gr as Ye,gt as Xe,h as Ze,hn as Qe,ht as $e,i as et,in as tt,ir as nt,it as rt,j as it,jt as at,k as ot,kn as st,kr as ct,kt as lt,lt as ut,m as dt,mn as ft,mr as I,mt as pt,n as mt,nr as ht,o as gt,on as _t,or as vt,ot as yt,pr as bt,pt as xt,q as St,qt as Ct,r as wt,rn as Tt,rr as Et,rt as Dt,s as Ot,sr as kt,st as At,t as jt,tt as Mt,ut as Nt,v as Pt,vt as Ft,w as It,wn as Lt,wr as Rt,wt as zt,x as Bt,xr as Vt,y as Ht,yr as Ut,yt as Wt,z as Gt,zn as Kt,zr as qt}from"./input-CLYhA7PK.js";import{t as Jt}from"./jsx-runtime-Cjj9sGSy.js";import{n as Yt,t as Xt}from"./label-Cdim77Jw.js";import{b as Zt,l as Qt,r as $t,t as en}from"./AnimatePresence-C5p0yiY1.js";import{C as tn,S as nn,T as rn,_ as an,a as on,b as sn,c as cn,d as ln,f as un,g as dn,h as fn,i as pn,l as mn,m as hn,n as gn,p as _n,r as vn,t as yn,u as bn,v as xn,w as Sn,x as Cn,y as wn}from"./select-CJ57-Bor.js";import{c as Tn,i as En,l as Dn,o as On,r as kn,t as An}from"./FormContext-DH2caWKO.js";import{t as L}from"./createLucideIcon-B3b8EU0b.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var jn=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ie(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=ee,te=function(){re.postMessage(null)}}else te=function(){_(ee,0)};function ie(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ie(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Mn=n(((e,t)=>{t.exports=jn()})),Nn=n((e=>{var t=Mn(),n=i(),r=qt();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var ie=Symbol.for(`react.client.reference`);function ae(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?ae(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}var D=Array.isArray,O=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,k=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A={pending:!1,data:null,method:null,action:null},oe=[],j=-1;function se(e){return{current:e}}function ce(e){0>j||(e.current=oe[j],oe[j]=null,j--)}function M(e,t){j++,oe[j]=e.current,e.current=t}var N=se(null),le=se(null),ue=se(null),de=se(null);function fe(e,t){switch(M(ue,t),M(le,e),M(N,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ef(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ef(t),e=tf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ce(N),M(N,e)}function pe(){ce(N),ce(le),ce(ue)}function me(e){e.memoizedState!==null&&M(de,e);var t=N.current,n=tf(t,e.type);t!==n&&(M(le,e),M(N,n))}function he(e){le.current===e&&(ce(N),ce(le)),de.current===e&&(ce(de),up._currentValue=A)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+ge+e+_e}var ye=!1;function be(e,t){if(!e||ye)return``;ye=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -482,11 +482,11 @@ window.addEventListener('unhandledrejection', function(event) {
|
|
|
482
482
|
}, "*");
|
|
483
483
|
<\/script>
|
|
484
484
|
</body>
|
|
485
|
-
</html>`;function Nj(e){let t=`<script>window.__SANDBOX_SEARCH__ = `+JSON.stringify(e).replace(/</g,`\\u003c`)+`;<\/script>`;return Mj.replace(`<body>`,`<body>`+t)}var Pj=`fixed inset-0 z-[100] w-full h-full min-h-0 bg-background flex flex-col [&:fullscreen]:h-full [&:fullscreen]:w-full [&:fullscreen]:bg-background`,Fj=[`fixed top-4 left-1/2 -translate-x-1/2 z-[100]`,`rounded-3xl w-full min-w-[300px] h-[400px]`,`shadow-2xl border overflow-hidden`,`bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80`,`flex flex-col`].join(` `),Ij=`data-mcp-widget-fullscreen`,Lj=`data-mcp-widget-display-mode`;function Rj(e){(0,z.useEffect)(()=>{if(!(typeof document>`u`)){if(e===`pip`||e===`fullscreen`)return document.documentElement.setAttribute(Lj,e),e===`fullscreen`?document.documentElement.setAttribute(Ij,``):document.documentElement.removeAttribute(Ij),()=>{document.documentElement.removeAttribute(Lj),document.documentElement.removeAttribute(Ij)};document.documentElement.removeAttribute(Lj),document.documentElement.removeAttribute(Ij)}},[e])}function zj({displayMode:e,setDisplayMode:t}){let n=e===`fullscreen`,r=e===`pip`;return Rj(e),{handleDisplayModeChange:(0,z.useCallback)(e=>t(e),[t]),fullscreenShellClassName:n?Pj:void 0,pipShellClassName:r?Fj:void 0,isFullscreen:n,isPip:r}}var Bj={PIP_MAX_WIDTH:700,DEFAULT_HEIGHT:400};function Vj(e){let t=e?.ui;return t&&typeof t==`object`&&`resourceUri`in t&&typeof t.resourceUri==`string`?t.resourceUri:null}function Hj(e){return Vj(e)!==null}function Uj(e){return e===HO}var Wj={name:`mcp-use-client`,version:`2.0.0`},Gj=6e5,Kj=`ui/notifications/sandbox-proxy-ready`,qj={openLinks:{},serverTools:{},serverResources:{},logging:{},updateModelContext:{text:{}},message:{text:{}}};function Jj(e){return new Promise(t=>{let n=r=>{r.source===e.contentWindow&&r.data?.method===Kj&&(window.removeEventListener(`message`,n),t())};window.addEventListener(`message`,n)})}function Yj(e){let t=e.oninitialized;return new Promise(n=>{e.oninitialized=(...r)=>{n(),e.oninitialized=t,t?.(...r)}})}function Xj(e,t){let n=Ej(t);return Object.keys(n).length>0?{...typeof e==`object`&&e?e:{},structuredContent:n}:e??null}function Zj({viewId:e,source:t,sandboxUrl:n,toolName:r=`view`,toolInput:i,toolOutput:a,partialToolInput:o,customProps:s,cancelled:c,hostInfo:l=Wj,hostContext:u,hostCapabilities:d,cspMode:f=`widget-declared`,displayMode:p,onDisplayModeChange:m,inlineMaxWidth:h=768,chromeless:g,onMessage:_,onModelContextUpdate:v,onLog:y,onReady:b,onLifecycleChange:x,onError:S,onCspViolation:C,onResourceResolved:w,wrapTransport:T,toolCallTimeout:E=Gj,mockOpenAiFileApis:ee=!1,className:te,testId:ne=`mcp-app-frame`,invoking:re,invoked:ie}){let ae=(0,z.useRef)(null),D=(0,z.useRef)(null),O=(0,z.useRef)(null),k=(0,z.useRef)(t.kind===`live`?t.connection:null),[A,oe]=(0,z.useState)(null),[j,se]=(0,z.useState)(null),[ce,M]=(0,z.useState)(null),[N,le]=(0,z.useState)(0),[ue,de]=(0,z.useState)(!0),[fe,pe]=(0,z.useState)(Bj.DEFAULT_HEIGHT),[me,he]=(0,z.useState)(`inline`),ge=p??me,_e=(0,z.useRef)(u);_e.current=u;let ve=(0,z.useRef)(_);ve.current=_;let ye=(0,z.useRef)(i);ye.current=i;let be=(0,z.useRef)(a);be.current=a;let xe=(0,z.useRef)(s);xe.current=s;let P=(0,z.useRef)(w);P.current=w;let Se=(0,z.useRef)(v);Se.current=v;let Ce=(0,z.useRef)(y);Ce.current=y;let we=(0,z.useRef)(S);we.current=S;let Te=(0,z.useRef)(C);Te.current=C;let Ee=(0,z.useRef)(b);Ee.current=b;let De=(0,z.useRef)(x);De.current=x;let Oe=(0,z.useRef)(n);Oe.current=n;let ke=(0,z.useRef)(f);ke.current=f;let Ae=(0,z.useRef)(ee);Ae.current=ee;let je=(0,z.useCallback)(e=>{let t=Oe.current;return t?typeof t==`function`?t(e):t:jj({cspMode:ke.current,permissions:e.permissions,widgetCsp:e.declaredCsp})},[]),{handleDisplayModeChange:Me,fullscreenShellClassName:Ne,pipShellClassName:Pe,isFullscreen:Fe,isPip:Ie}=zj({containerRef:O,displayMode:ge,setDisplayMode:(0,z.useCallback)(e=>{m?m(e):he(e)},[m])}),Le=(0,z.useRef)(Me);Le.current=Me;let Re=(0,z.useRef)(ge);Re.current=ge;let ze=t.kind===`live`?t.resourceUri:void 0,Be=t.kind===`preloaded`?t.html:void 0;t.kind===`live`&&(k.current=t.connection),(0,z.useEffect)(()=>{let e=!1;De.current?.({status:`resolving`});let n=e=>{oe(e),De.current?.({status:`sandbox-loading`});let t=je(e);se(e=>e?.href===t.href?e:t),P.current?.(e)};if(t.kind===`preloaded`){n({html:t.html,declaredCsp:t.csp,csp:f===`permissive`?void 0:t.csp,permissions:t.permissions,prefersBorder:t.prefersBorder??!1,mimeType:`text/html;profile=mcp-app`,mimeTypeValid:!0,mimeTypeWarning:null});return}let{connection:r,resourceUri:i}=t;return k.current=r,(async()=>{try{let t=await r.readResource(i);if(e)return;let a=r.resources?.find(e=>e.uri===i),o=kj({resourceResult:t,listingResource:a,cspMode:f,resourceUri:i});if(!o.mimeTypeValid){let e=o.mimeTypeWarning||`Invalid MIME type - SEP-1865 requires "text/html;profile=mcp-app"`;M(e),De.current?.({status:`error`,error:e});return}n(o)}catch(t){if(e)return;M(t instanceof Error?t.message:`Failed to prepare view`),De.current?.({status:`error`,error:t instanceof Error?t.message:`Failed to prepare view`})}})(),()=>{e=!0}},[t.kind,ze,Be,f,je]),(0,z.useEffect)(()=>{let e=j;return()=>{e?.protocol===`blob:`&&URL.revokeObjectURL(e.href)}},[j]);let Ve=j?.protocol===`blob:`,He=!j||Ve?null:(()=>{try{return j.origin}catch{return null}})();(0,z.useEffect)(()=>{if(!He&&!Ve)return;let e=e=>{let t=ae.current;if(t?.contentWindow&&e.source===t.contentWindow&&!(!Ve&&e.origin!==He&&He!==`*`)){if(e.data?.type===`mcp-apps:csp-violation`){Te.current?.({directive:e.data.directive,effectiveDirective:e.data.effectiveDirective,blockedUri:e.data.blockedUri,sourceFile:e.data.sourceFile,lineNumber:e.data.lineNumber,columnNumber:e.data.columnNumber,originalPolicy:e.data.originalPolicy,timestamp:e.data.timestamp||Date.now()});return}e.data?.type===`iframe-console-log`&&Ce.current&&Ce.current({level:e.data.level??`log`,data:e.data.args})}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[He,Ve]),(0,z.useEffect)(()=>{if(!A||!j)return;let t=ae.current;if(!t)return;let n=!1,r=null;return(async()=>{try{De.current?.({status:`connecting`}),t.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-forms`);let i=UO(A.permissions);i&&t.setAttribute(`allow`,i);let a=Jj(t);if(t.src=j.href,await a,n)return;r=new GO(null,l,{...d??qj,sandbox:{csp:f===`permissive`?void 0:A.csp,permissions:A.permissions}},{hostContext:_e.current}),r.onmessage=async({content:e})=>(e.length>0&&ve.current&&ve.current(e),{}),r.onopenlink=async({url:e})=>(e&&window.open(e,`_blank`,`noopener,noreferrer`),{}),r.oncalltool=(async({name:e,arguments:t})=>{let n=k.current;if(!n)throw Error(`Server connection not available`);try{return await n.callTool(e,t||{},{timeout:E,resetTimeoutOnProgress:!0})}catch(e){throw r?.sendToolCancelled({reason:e instanceof Error?e.message:String(e)}),e}}),r.onreadresource=(async({uri:e})=>{let t=k.current;if(!t)throw Error(`Server connection not available`);return await t.readResource(e)}),r.onlistresources=(async()=>{let e=k.current;if(!e)throw Error(`Server connection not available`);return{resources:[...e.resources??[]]}}),r.onrequestdisplaymode=async({mode:e})=>{let t=e??`inline`,n=(_e.current?.availableDisplayModes??[`inline`,`pip`,`fullscreen`]).includes(t)?t:Re.current;return await Le.current(n),{mode:n}},r.onupdatemodelcontext=async({content:e,structuredContent:t})=>(Se.current?.({content:e,structuredContent:t}),{}),r.onloggingmessage=async({level:e,data:t})=>(Ce.current?.({level:e,data:t}),{}),r.onsizechange=async({height:e})=>{Re.current===`inline`&&e!==void 0&&pe(e)};let o=Yj(r),s=new VO(t.contentWindow,t.contentWindow);if(T&&(s=T(s,e)),await r.connect(s),n||(await r.sendSandboxResourceReady({html:Ae.current?Oj(A.html):A.html,csp:A.csp,permissions:A.permissions}),await o,n))return;D.current=r,le(e=>e+1),De.current?.({status:`initialized`});let c={...ye.current,...Ej(xe.current)};r.sendToolInput({arguments:c});let u=Xj(be.current,xe.current);u&&r.sendToolResult(u),De.current?.({status:`ready`})}catch(e){if(!n){let t=e instanceof Error?e.message:`Failed to connect view`;M(t),we.current?.(t),De.current?.({status:`error`,error:t})}}})(),()=>{n=!0;let e=r;D.current=null,e&&(De.current?.({status:`tearing-down`}),(async()=>{try{await Promise.race([e.teardownResource({}),new Promise((e,t)=>setTimeout(()=>t(Error(`teardown timeout`)),2e3))])}catch{}finally{e.close().catch(()=>{}),De.current?.({status:`closed`})}})())}},[A,j,l,d,f,e,T,E,ee]),(0,z.useEffect)(()=>{let e=D.current;!e||N===0||!u||e.setHostContext(u)},[u,N]),(0,z.useEffect)(()=>{let e=D.current;!e||N===0||!o||e.sendToolInputPartial({arguments:o})},[N,o]),(0,z.useEffect)(()=>{let e=D.current;if(!e||N===0)return;let t={...i,...Ej(s)};e.sendToolInput({arguments:t})},[N,i,s]),(0,z.useEffect)(()=>{let e=D.current;if(!e||N===0)return;let t=Xj(a,s);t&&e.sendToolResult(t)},[N,a,s]),(0,z.useEffect)(()=>{let e=D.current;!e||N===0||!c||e.sendToolCancelled({reason:`Cancelled by user`})},[c,N]);let Ue=(0,z.useRef)(!1);if((0,z.useEffect)(()=>{Ue.current||N===0||(Ue.current=!0,Ee.current?.())},[N]),(0,z.useEffect)(()=>{if(N===0||!ue)return;let e=setTimeout(()=>de(!1),300);return()=>clearTimeout(e)},[N,ue]),ce)return z.createElement(`div`,{className:te},z.createElement(`div`,{className:`border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4`},z.createElement(`p`,{className:`text-sm text-red-600 dark:text-red-400`},`Failed to load view: `,ce)));if(!A)return z.createElement(`div`,{className:te},z.createElement(`div`,{className:`flex items-center justify-center w-full h-[200px]`},z.createElement(`span`,{className:`text-sm text-muted-foreground`},`Loading view…`)));let We=Ne??Pe??`flex group flex-1 items-center justify-center`,Ge={height:Fe||Ie?`100%`:`${fe}px`,width:`100%`,maxWidth:ge===`inline`?`${h}px`:`100%`,transition:Fe||Ie?void 0:`height 300ms ease-out`},F=z.createElement(`div`,{ref:O,className:We,style:Ie?{height:Bj.DEFAULT_HEIGHT,maxWidth:Bj.PIP_MAX_WIDTH,zIndex:100}:Fe?{zIndex:100}:void 0},(Fe||Ie)&&z.createElement(`button`,{type:`button`,"data-testid":Fe?`debugger-exit-fullscreen-button`:`debugger-exit-pip-button`,"aria-label":Fe?`Exit fullscreen`:`Exit picture-in-picture`,className:`absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-lg leading-none text-foreground shadow-sm backdrop-blur-sm hover:bg-background`,style:{zIndex:110},onClick:()=>void Me(`inline`)},`×`),z.createElement(`div`,{className:Fe||Ie?`relative w-full h-full min-h-0 flex flex-1 flex-col`:`relative w-full flex flex-1 justify-center items-center`},ue&&z.createElement(`div`,{className:`flex absolute inset-0 items-center justify-center z-10`},z.createElement(`span`,{className:`text-sm text-muted-foreground`},`Loading…`)),!Ie&&!Fe&&(re||ie)&&z.createElement(`div`,{className:`absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground`},re&&!a?re:ie),z.createElement(`div`,{"data-testid":ne,"data-mcp-app-tool":r,className:ge===`fullscreen`?`w-full h-full overflow-hidden`:`w-full overflow-hidden`,style:Ge},z.createElement(`iframe`,{ref:ae,title:`MCP App: ${r}`,className:`w-full h-full border-0 bg-transparent`,style:{border:A.prefersBorder&&ge!==`fullscreen`?void 0:`none`}}))));return z.createElement(`div`,{className:te},F)}function Qj(e,t){return!(e.viewId!==t.viewId||e.source!==t.source||e.sandboxUrl!==t.sandboxUrl||e.displayMode!==t.displayMode||e.cancelled!==t.cancelled||e.toolInput!==t.toolInput||e.toolOutput!==t.toolOutput||e.partialToolInput!==t.partialToolInput||e.customProps!==t.customProps||e.hostContext!==t.hostContext||e.hostCapabilities!==t.hostCapabilities||e.cspMode!==t.cspMode||e.mockOpenAiFileApis!==t.mockOpenAiFileApis||e.className!==t.className||e.onReady!==t.onReady||e.onLifecycleChange!==t.onLifecycleChange)}var $j=(0,z.memo)(Zj,Qj);function eM(e){let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;top:-9999px;left:-9999px;opacity:0`,document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand(`copy`)}finally{document.body.removeChild(t)}}function tM(e){return eM(e)}async function nM(e){if(!eM(e)){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);throw Error(`copy failed`)}}function rM(e){let t=Date.now()-e,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return n<60?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:a<7?`${a}d ago`:new Date(e).toLocaleDateString()}function iM(e){if(e==null)return`/mcp`;let t=e.trim().replace(/\/{2,}/g,`/`).replace(/\/+$/,``);return t===``||t===`/`?``:(t.startsWith(`/`)||(t=`/${t}`),t)}function aM(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=e.indexOf(`/inspector`);return t<=0?``:iM(e.slice(0,t))}function oM(){if(typeof window>`u`)return``;let e=window.__MCP_BASE_PATH__;return e==null?aM():iM(e)}function sM(){return`${oM()}/inspector`}function cM(e){let t=e.replace(/^\/+/,``);return`${sM()}/api/${t}`}var lM=/^127\.(?:0|[1-9]\d?|1\d\d|2[0-4]\d|25[0-5])(?:\.(?:0|[1-9]\d?|1\d\d|2[0-4]\d|25[0-5])){2}$/;function uM(e){try{let t=new URL(e).hostname.toLowerCase().replace(/^\[|\]$/g,``);return t===`localhost`||t===`::1`||t===`0.0.0.0`||lM.test(t)}catch{return!1}}function dM(e){try{return new URL(e).hostname.endsWith(`.mcp-use.run`)}catch{return!1}}function fM(e){let t=e.name?.trim(),n=e.url?.trim();return t?t===n?``:t:``}function pM(e){return fM(e)||e.serverInfo?.title?.trim()||e.serverInfo?.name?.trim()||e.name?.trim()||e.url?.trim()||`Unknown server`}var mM=`2026-07-28`;function hM(e){switch(e){case`v1`:return`legacy`;case`v2`:return{pin:mM};default:return`auto`}}function gM(e){return e===`legacy`?`v1`:typeof e==`object`&&e?.pin?`v2`:`auto`}function _M(){if(typeof window>`u`)return``;let e=window.__MCP_PROXY_URL__;return e===null?``:`${window.location.origin}${e||cM(`proxy`)}`}function vM(e,t,n=!1){return e===`auto`||e===`direct`||e===`proxy`?e:t===`Via Proxy`?`proxy`:t===`Direct`?`auto`:n?`proxy`:`auto`}function yM(e){return!e||typeof e==`boolean`?``:e.proxyAddress?.trim()||``}var bM=[`requestTimeout`,`resetTimeoutOnProgress`,`maxTotalTimeout`];function xM(e){if(!e)return{};let t={};for(let n of bM){let r=e[n];r!==void 0&&(t[n]=r)}return t}function SM(e,t){try{let n=localStorage.getItem(`mcp-inspector-connections`),r=n?JSON.parse(n):{};r[e]={...r[e],...t},localStorage.setItem(`mcp-inspector-connections`,JSON.stringify(r))}catch{}}function CM(e,t,n){let r=e.trim(),i=t.trim(),a=n.trim();if(!(!r&&!a))return{...r?{clientId:r}:{},...r&&i?{clientSecret:i}:{},...a?{scope:a}:{}}}function wM(e){let t=e.headers||e.proxyConfig?.headers||e.proxyConfig?.customHeaders;return t&&Object.keys(t).length>0?t:void 0}function TM(e){let t=e.proxyConfig,n=e.headers||e.customHeaders,r=t?.headers||t?.customHeaders||void 0,i=n||r,a=t?{...t,...r?{headers:r}:{},customHeaders:void 0}:void 0,{customHeaders:o,connectionType:s,transportType:c,...l}=e;return{...l,...i&&!a?.proxyAddress?{headers:i}:{},...a?{proxyConfig:a}:{},connectionMode:vM(e.connectionMode,e.connectionType,!!a?.proxyAddress)}}function EM(e){let t=kM(e),n=e.proxyConfig?.proxyAddress?.trim()||yM(e.autoProxyFallback),r=vM(e.connectionMode,e.connectionType,!!n),i={url:e.url,displayName:e.name?.trim()||e.url,connectionMode:r,protocolNegotiation:e.protocolNegotiation??`auto`,...e.oauth?{oauth:e.oauth}:{}};return r===`proxy`&&n?i.proxyConfig={proxyAddress:n,...Object.keys(t).length>0?{headers:t}:{}}:Object.keys(t).length>0&&(i.headers=t),r===`auto`&&(i.autoProxyFallback=e.autoProxyFallback??(n?{enabled:!0,proxyAddress:n}:!1)),i}function DM(e,t){let n=t?TM(t):e,r=wM(e)||{},i=n.proxyConfig?.proxyAddress?.trim()||yM(n.autoProxyFallback);return{url:e.url||``,name:e.displayName||e.url||``,transportType:`http`,connectionMode:vM(n.connectionMode,void 0,!!i),connectionType:n.connectionMode===`proxy`?`Via Proxy`:`Direct`,proxyConfig:n.connectionMode===`proxy`&&i?{proxyAddress:i,...Object.keys(r).length>0?{headers:r}:{}}:void 0,headers:r,oauth:n.oauth,autoProxyFallback:n.autoProxyFallback,protocolNegotiation:n.protocolNegotiation??`auto`,...xM(t)}}function OM(e){try{let t=localStorage.getItem(`mcp-inspector-connections`);return t&&JSON.parse(t)[e]||null}catch{return null}}function kM(e){let t=e.proxyConfig?.headers||e.proxyConfig?.customHeaders||e.headers||e.customHeaders||{};return Object.fromEntries(Object.entries(t).filter(([e,t])=>e&&t).map(([e,t])=>[e,String(t)]).sort(([e],[t])=>e.localeCompare(t)))}function AM(e){let t=e.url?.trim()||``,n=e.proxyConfig?.proxyAddress?.trim()||yM(e.autoProxyFallback);return{url:t,name:e.name?.trim()||t,transportType:e.transportType||`http`,proxyAddress:n,connectionMode:vM(e.connectionMode,e.connectionType,!!n),headers:kM(e),oauthClientId:e.oauth?.clientId?.trim()||``,oauthClientSecret:e.oauth?.clientSecret?.trim()||``,oauthScope:e.oauth?.scope?.trim()||``,requestTimeout:`requestTimeout`in e?e.requestTimeout:void 0,resetTimeoutOnProgress:`resetTimeoutOnProgress`in e?e.resetTimeoutOnProgress:void 0,maxTotalTimeout:`maxTotalTimeout`in e?e.maxTotalTimeout:void 0,protocolMode:gM(e.protocolNegotiation)}}function jM(e,t){let n=AM(e),r=AM(t);return n.url===r.url&&n.transportType===r.transportType&&n.proxyAddress===r.proxyAddress&&n.connectionMode===r.connectionMode&&JSON.stringify(n.headers)===JSON.stringify(r.headers)&&n.oauthClientId===r.oauthClientId&&n.oauthClientSecret===r.oauthClientSecret&&n.oauthScope===r.oauthScope&&n.requestTimeout===r.requestTimeout&&n.resetTimeoutOnProgress===r.resetTimeoutOnProgress&&n.maxTotalTimeout===r.maxTotalTimeout&&n.protocolMode===r.protocolMode&&n.name!==r.name}var MM=class extends Tj{setServers(e){let t=this.readRawStoredServers(),n=Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{...xM(t[e]),...n,...uM(e)&&typeof n.url==`string`&&dM(n.url)?{url:e}:{}}]));super.setServers(n)}setServer(e,t){let n=this.getServers();n[e]={...xM(this.readRawStoredServers()[e]),...t},this.setServers(n)}readRawStoredServers(){try{let e=localStorage.getItem(`mcp-inspector-connections`);return e?JSON.parse(e):{}}catch{return{}}}},NM=`popstate`;function PM(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function FM(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return BM(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:VM(t)}return UM(t,n,null,e)}function IM(e,t){if(e===!1||e==null)throw Error(t)}function LM(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function RM(){return Math.random().toString(36).substring(2,10)}function zM(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function BM(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?HM(t):t,state:n,key:t&&t.key||r||RM(),mask:i}}function VM({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function HM(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function UM(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=PM(e)?e:BM(h.location,e,t);n&&n(r,e),l=u()+1;let d=zM(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=PM(e)?e:BM(h.location,e,t);n&&n(r,e),l=u();let i=zM(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return WM(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(NM,d),c=e,()=>{i.removeEventListener(NM,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function WM(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),IM(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:VM(t);return i=i.replace(/ $/,`%20`),!n&&i.startsWith(`//`)&&(i=r+i),new URL(i,r)}function GM(e,t,n=`/`){return KM(e,t,n,!1)}function KM(e,t,n,r,i){let a=dN((typeof t==`string`?HM(t):t).pathname||`/`,n);if(a==null)return null;let o=i??JM(e),s=null,c=uN(a);for(let e=0;s==null&&e<o.length;++e)s=sN(o[e],c,r);return s}function qM(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function JM(e){let t=YM(e);return ZM(t),t}function YM(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;IM(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=bN([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(IM(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),YM(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:aN(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of XM(e.path))a(e,t,!0,n)}),t}function XM(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=XM(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ZM(e){e.sort((e,t)=>e.score===t.score?oN(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var QM=/^:[\w-]+$/,$M=3,eN=2,tN=1,nN=10,rN=-2,iN=e=>e===`*`;function aN(e,t){let n=e.split(`/`),r=n.length;return n.some(iN)&&(r+=rN),t&&(r+=eN),n.filter(e=>!iN(e)).reduce((e,t)=>e+(QM.test(t)?$M:t===``?tN:nN),r)}function oN(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function sN(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=cN({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=cN({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:bN([a,u.pathname]),pathnameBase:SN(bN([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=bN([a,u.pathnameBase]))}return o}function cN(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=lN(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function lN(e,t=!1,n=!0){LM(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function uN(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return LM(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function dN(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var fN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function pN(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?HM(e):e,a;return n?(n=yN(n),a=n.startsWith(`/`)?mN(n.substring(1),`/`):mN(n,t)):a=t,{pathname:a,search:CN(r),hash:wN(i)}}function mN(e,t){let n=xN(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function hN(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function gN(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function _N(e){let t=gN(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function vN(e,t,n,r=!1){let i;typeof e==`string`?i=HM(e):(i={...e},IM(!i.pathname||!i.pathname.includes(`?`),hN(`?`,`pathname`,`search`,i)),IM(!i.pathname||!i.pathname.includes(`#`),hN(`#`,`pathname`,`hash`,i)),IM(!i.search||!i.search.includes(`#`),hN(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=pN(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var yN=e=>e.replace(/\/\/+/g,`/`),bN=e=>yN(e.join(`/`)),xN=e=>e.replace(/\/+$/,``),SN=e=>xN(e).replace(/^\/*/,`/`),CN=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,wN=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,TN=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function EN(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function DN(e){return bN(e.map(e=>e.route.path).filter(Boolean))||`/`}var ON=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function kN(e,t){let n=e;if(typeof n!=`string`||!fN.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ON)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=dN(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{LM(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var AN=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(AN);var jN=[`GET`,...AN];new Set(jN);var MN=z.createContext(null);MN.displayName=`DataRouter`;var NN=z.createContext(null);NN.displayName=`DataRouterState`;var PN=z.createContext(!1);function FN(){return z.useContext(PN)}var IN=z.createContext({isTransitioning:!1});IN.displayName=`ViewTransition`;var LN=z.createContext(new Map);LN.displayName=`Fetchers`;var RN=z.createContext(null);RN.displayName=`Await`;var zN=z.createContext(null);zN.displayName=`Navigation`;var BN=z.createContext(null);BN.displayName=`Location`;var VN=z.createContext({outlet:null,matches:[],isDataRoute:!1});VN.displayName=`Route`;var HN=z.createContext(null);HN.displayName=`RouteError`;var UN=`REACT_ROUTER_ERROR`,WN=`REDIRECT`,GN=`ROUTE_ERROR_RESPONSE`;function KN(e){if(e.startsWith(`${UN}:${WN}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function qN(e){if(e.startsWith(`${UN}:${GN}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new TN(t.status,t.statusText,t.data)}catch{}}function JN(e,{relative:t}={}){IM(YN(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=z.useContext(zN),{hash:i,pathname:a,search:o}=nP(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:bN([n,a])),r.createHref({pathname:s,search:o,hash:i})}function YN(){return z.useContext(BN)!=null}function XN(){return IM(YN(),`useLocation() may be used only in the context of a <Router> component.`),z.useContext(BN).location}var ZN=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function QN(e){z.useContext(zN).static||z.useLayoutEffect(e)}function $N(){let{isDataRoute:e}=z.useContext(VN);return e?xP():eP()}function eP(){IM(YN(),`useNavigate() may be used only in the context of a <Router> component.`);let e=z.useContext(MN),{basename:t,navigator:n}=z.useContext(zN),{matches:r}=z.useContext(VN),{pathname:i}=XN(),a=JSON.stringify(_N(r)),o=z.useRef(!1);return QN(()=>{o.current=!0}),z.useCallback((r,s={})=>{if(LM(o.current,ZN),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=vN(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:bN([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}z.createContext(null);function tP(){let{matches:e}=z.useContext(VN);return e[e.length-1]?.params??{}}function nP(e,{relative:t}={}){let{matches:n}=z.useContext(VN),{pathname:r}=XN(),i=JSON.stringify(_N(n));return z.useMemo(()=>vN(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function rP(e,t){return iP(e,t)}function iP(e,t,n){IM(YN(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=z.useContext(zN),{matches:i}=z.useContext(VN),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;CP(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
485
|
+
</html>`;function Nj(e){let t=`<script>window.__SANDBOX_SEARCH__ = `+JSON.stringify(e).replace(/</g,`\\u003c`)+`;<\/script>`;return Mj.replace(`<body>`,`<body>`+t)}var Pj=`fixed inset-0 z-[100] w-full h-full min-h-0 bg-background flex flex-col [&:fullscreen]:h-full [&:fullscreen]:w-full [&:fullscreen]:bg-background`,Fj=[`fixed top-4 left-1/2 -translate-x-1/2 z-[100]`,`rounded-3xl w-full min-w-[300px] h-[400px]`,`shadow-2xl border overflow-hidden`,`bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80`,`flex flex-col`].join(` `),Ij=`data-mcp-widget-fullscreen`,Lj=`data-mcp-widget-display-mode`;function Rj(e){(0,z.useEffect)(()=>{if(!(typeof document>`u`)){if(e===`pip`||e===`fullscreen`)return document.documentElement.setAttribute(Lj,e),e===`fullscreen`?document.documentElement.setAttribute(Ij,``):document.documentElement.removeAttribute(Ij),()=>{document.documentElement.removeAttribute(Lj),document.documentElement.removeAttribute(Ij)};document.documentElement.removeAttribute(Lj),document.documentElement.removeAttribute(Ij)}},[e])}function zj({displayMode:e,setDisplayMode:t}){let n=e===`fullscreen`,r=e===`pip`;return Rj(e),{handleDisplayModeChange:(0,z.useCallback)(e=>t(e),[t]),fullscreenShellClassName:n?Pj:void 0,pipShellClassName:r?Fj:void 0,isFullscreen:n,isPip:r}}var Bj={PIP_MAX_WIDTH:700,DEFAULT_HEIGHT:400};function Vj(e){let t=e?.ui;return t&&typeof t==`object`&&`resourceUri`in t&&typeof t.resourceUri==`string`?t.resourceUri:null}function Hj(e){return Vj(e)!==null}function Uj(e){return e===HO}var Wj={name:`mcp-use-client`,version:`2.0.0`},Gj=6e5,Kj=`ui/notifications/sandbox-proxy-ready`,qj={openLinks:{},serverTools:{},serverResources:{},logging:{},updateModelContext:{text:{}},message:{text:{}}};function Jj(e){return new Promise(t=>{let n=r=>{r.source===e.contentWindow&&r.data?.method===Kj&&(window.removeEventListener(`message`,n),t())};window.addEventListener(`message`,n)})}function Yj(e){let t=e.oninitialized;return new Promise(n=>{e.oninitialized=(...r)=>{n(),e.oninitialized=t,t?.(...r)}})}function Xj(e,t){let n=Ej(t);return Object.keys(n).length>0?{...typeof e==`object`&&e?e:{},structuredContent:n}:e??null}function Zj({viewId:e,source:t,sandboxUrl:n,toolName:r=`view`,toolInput:i,toolOutput:a,partialToolInput:o,customProps:s,cancelled:c,hostInfo:l=Wj,hostContext:u,hostCapabilities:d,cspMode:f=`widget-declared`,displayMode:p,onDisplayModeChange:m,inlineMaxWidth:h=768,chromeless:g,onMessage:_,onModelContextUpdate:v,onLog:y,onReady:b,onLifecycleChange:x,onError:S,onCspViolation:C,onResourceResolved:w,wrapTransport:T,toolCallTimeout:E=Gj,mockOpenAiFileApis:ee=!1,className:te,testId:ne=`mcp-app-frame`,invoking:re,invoked:ie}){let ae=(0,z.useRef)(null),D=(0,z.useRef)(null),O=(0,z.useRef)(null),k=(0,z.useRef)(t.kind===`live`?t.connection:null),[A,oe]=(0,z.useState)(null),[j,se]=(0,z.useState)(null),[ce,M]=(0,z.useState)(null),[N,le]=(0,z.useState)(0),[ue,de]=(0,z.useState)(!0),[fe,pe]=(0,z.useState)(Bj.DEFAULT_HEIGHT),[me,he]=(0,z.useState)(`inline`),ge=p??me,_e=(0,z.useRef)(u);_e.current=u;let ve=(0,z.useRef)(_);ve.current=_;let ye=(0,z.useRef)(i);ye.current=i;let be=(0,z.useRef)(o);be.current=o;let xe=(0,z.useRef)(a);xe.current=a;let P=(0,z.useRef)(s);P.current=s;let Se=(0,z.useRef)(w);Se.current=w;let Ce=(0,z.useRef)(v);Ce.current=v;let we=(0,z.useRef)(y);we.current=y;let Te=(0,z.useRef)(S);Te.current=S;let Ee=(0,z.useRef)(C);Ee.current=C;let De=(0,z.useRef)(b);De.current=b;let Oe=(0,z.useRef)(x);Oe.current=x;let ke=(0,z.useRef)(n);ke.current=n;let Ae=(0,z.useRef)(f);Ae.current=f;let je=(0,z.useRef)(ee);je.current=ee;let Me=(0,z.useCallback)(e=>{let t=ke.current;return t?typeof t==`function`?t(e):t:jj({cspMode:Ae.current,permissions:e.permissions,widgetCsp:e.declaredCsp})},[]),{handleDisplayModeChange:Ne,fullscreenShellClassName:Pe,pipShellClassName:Fe,isFullscreen:Ie,isPip:Le}=zj({containerRef:O,displayMode:ge,setDisplayMode:(0,z.useCallback)(e=>{m?m(e):he(e)},[m])}),Re=(0,z.useRef)(Ne);Re.current=Ne;let ze=(0,z.useRef)(ge);ze.current=ge;let Be=t.kind===`live`?t.resourceUri:void 0,Ve=t.kind===`preloaded`?t.html:void 0;t.kind===`live`&&(k.current=t.connection),(0,z.useEffect)(()=>{let e=!1;Oe.current?.({status:`resolving`});let n=e=>{oe(e),Oe.current?.({status:`sandbox-loading`});let t=Me(e);se(e=>e?.href===t.href?e:t),Se.current?.(e)};if(t.kind===`preloaded`){n({html:t.html,declaredCsp:t.csp,csp:f===`permissive`?void 0:t.csp,permissions:t.permissions,prefersBorder:t.prefersBorder??!1,mimeType:`text/html;profile=mcp-app`,mimeTypeValid:!0,mimeTypeWarning:null});return}let{connection:r,resourceUri:i}=t;return k.current=r,(async()=>{try{let t=await r.readResource(i);if(e)return;let a=r.resources?.find(e=>e.uri===i),o=kj({resourceResult:t,listingResource:a,cspMode:f,resourceUri:i});if(!o.mimeTypeValid){let e=o.mimeTypeWarning||`Invalid MIME type - SEP-1865 requires "text/html;profile=mcp-app"`;M(e),Oe.current?.({status:`error`,error:e});return}n(o)}catch(t){if(e)return;M(t instanceof Error?t.message:`Failed to prepare view`),Oe.current?.({status:`error`,error:t instanceof Error?t.message:`Failed to prepare view`})}})(),()=>{e=!0}},[t.kind,Be,Ve,f,Me]),(0,z.useEffect)(()=>{let e=j;return()=>{e?.protocol===`blob:`&&URL.revokeObjectURL(e.href)}},[j]);let He=j?.protocol===`blob:`,Ue=!j||He?null:(()=>{try{return j.origin}catch{return null}})();(0,z.useEffect)(()=>{if(!Ue&&!He)return;let e=e=>{let t=ae.current;if(t?.contentWindow&&e.source===t.contentWindow&&!(!He&&e.origin!==Ue&&Ue!==`*`)){if(e.data?.type===`mcp-apps:csp-violation`){Ee.current?.({directive:e.data.directive,effectiveDirective:e.data.effectiveDirective,blockedUri:e.data.blockedUri,sourceFile:e.data.sourceFile,lineNumber:e.data.lineNumber,columnNumber:e.data.columnNumber,originalPolicy:e.data.originalPolicy,timestamp:e.data.timestamp||Date.now()});return}e.data?.type===`iframe-console-log`&&we.current&&we.current({level:e.data.level??`log`,data:e.data.args})}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[Ue,He]),(0,z.useEffect)(()=>{if(!A||!j)return;let t=ae.current;if(!t)return;let n=!1,r=null;return(async()=>{try{Oe.current?.({status:`connecting`}),t.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-forms`);let i=UO(A.permissions);i&&t.setAttribute(`allow`,i);let a=Jj(t);if(t.src=j.href,await a,n)return;r=new GO(null,l,{...d??qj,sandbox:{csp:f===`permissive`?void 0:A.csp,permissions:A.permissions}},{hostContext:_e.current}),r.onmessage=async({content:e})=>(e.length>0&&ve.current&&ve.current(e),{}),r.onopenlink=async({url:e})=>(e&&window.open(e,`_blank`,`noopener,noreferrer`),{}),r.oncalltool=(async({name:e,arguments:t})=>{let n=k.current;if(!n)throw Error(`Server connection not available`);try{return await n.callTool(e,t||{},{timeout:E,resetTimeoutOnProgress:!0})}catch(e){throw r?.sendToolCancelled({reason:e instanceof Error?e.message:String(e)}),e}}),r.onreadresource=(async({uri:e})=>{let t=k.current;if(!t)throw Error(`Server connection not available`);return await t.readResource(e)}),r.onlistresources=(async()=>{let e=k.current;if(!e)throw Error(`Server connection not available`);return{resources:[...e.resources??[]]}}),r.onrequestdisplaymode=async({mode:e})=>{let t=e??`inline`,n=(_e.current?.availableDisplayModes??[`inline`,`pip`,`fullscreen`]).includes(t)?t:ze.current;return await Re.current(n),{mode:n}},r.onupdatemodelcontext=async({content:e,structuredContent:t})=>(Ce.current?.({content:e,structuredContent:t}),{}),r.onloggingmessage=async({level:e,data:t})=>(we.current?.({level:e,data:t}),{}),r.onsizechange=async({height:e})=>{ze.current===`inline`&&e!==void 0&&pe(e)};let o=Yj(r),s=new VO(t.contentWindow,t.contentWindow);if(T&&(s=T(s,e)),await r.connect(s),n||(await r.sendSandboxResourceReady({html:je.current?Oj(A.html):A.html,csp:A.csp,permissions:A.permissions}),await o,n))return;D.current=r,le(e=>e+1),Oe.current?.({status:`initialized`});let c=be.current;if(c)r.sendToolInputPartial({arguments:c});else{let e={...ye.current,...Ej(P.current)};r.sendToolInput({arguments:e})}let u=Xj(xe.current,P.current);u&&r.sendToolResult(u),Oe.current?.({status:`ready`})}catch(e){if(!n){let t=e instanceof Error?e.message:`Failed to connect view`;M(t),Te.current?.(t),Oe.current?.({status:`error`,error:t})}}})(),()=>{n=!0;let e=r;D.current=null,e&&(Oe.current?.({status:`tearing-down`}),(async()=>{try{await Promise.race([e.teardownResource({}),new Promise((e,t)=>setTimeout(()=>t(Error(`teardown timeout`)),2e3))])}catch{}finally{e.close().catch(()=>{}),Oe.current?.({status:`closed`})}})())}},[A,j,l,d,f,e,T,E,ee]),(0,z.useEffect)(()=>{let e=D.current;!e||N===0||!u||e.setHostContext(u)},[u,N]),(0,z.useEffect)(()=>{let e=D.current;!e||N===0||!o||e.sendToolInputPartial({arguments:o})},[N,o]),(0,z.useEffect)(()=>{let e=D.current;if(!e||N===0||o)return;let t={...i,...Ej(s)};e.sendToolInput({arguments:t})},[N,i,o,s]),(0,z.useEffect)(()=>{let e=D.current;if(!e||N===0)return;let t=Xj(a,s);t&&e.sendToolResult(t)},[N,a,s]),(0,z.useEffect)(()=>{let e=D.current;!e||N===0||!c||e.sendToolCancelled({reason:`Cancelled by user`})},[c,N]);let We=(0,z.useRef)(!1);if((0,z.useEffect)(()=>{We.current||N===0||(We.current=!0,De.current?.())},[N]),(0,z.useEffect)(()=>{if(N===0||!ue)return;let e=setTimeout(()=>de(!1),300);return()=>clearTimeout(e)},[N,ue]),ce)return z.createElement(`div`,{className:te},z.createElement(`div`,{className:`border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4`},z.createElement(`p`,{className:`text-sm text-red-600 dark:text-red-400`},`Failed to load view: `,ce)));if(!A)return z.createElement(`div`,{className:te},z.createElement(`div`,{className:`flex items-center justify-center w-full h-[200px]`},z.createElement(`span`,{className:`text-sm text-muted-foreground`},`Loading view…`)));let Ge=Pe??Fe??`flex group flex-1 items-center justify-center`,F={height:Ie||Le?`100%`:`${fe}px`,width:`100%`,maxWidth:ge===`inline`?`${h}px`:`100%`,transition:Ie||Le?void 0:`height 300ms ease-out`},Ke=z.createElement(`div`,{ref:O,className:Ge,style:Le?{height:Bj.DEFAULT_HEIGHT,maxWidth:Bj.PIP_MAX_WIDTH,zIndex:100}:Ie?{zIndex:100}:void 0},(Ie||Le)&&z.createElement(`button`,{type:`button`,"data-testid":Ie?`debugger-exit-fullscreen-button`:`debugger-exit-pip-button`,"aria-label":Ie?`Exit fullscreen`:`Exit picture-in-picture`,className:`absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-lg leading-none text-foreground shadow-sm backdrop-blur-sm hover:bg-background`,style:{zIndex:110},onClick:()=>void Ne(`inline`)},`×`),z.createElement(`div`,{className:Ie||Le?`relative w-full h-full min-h-0 flex flex-1 flex-col`:`relative w-full flex flex-1 justify-center items-center`},ue&&z.createElement(`div`,{className:`flex absolute inset-0 items-center justify-center z-10`},z.createElement(`span`,{className:`text-sm text-muted-foreground`},`Loading…`)),!Le&&!Ie&&(re||ie)&&z.createElement(`div`,{className:`absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground`},re&&!a?re:ie),z.createElement(`div`,{"data-testid":ne,"data-mcp-app-tool":r,className:ge===`fullscreen`?`w-full h-full overflow-hidden`:`w-full overflow-hidden`,style:F},z.createElement(`iframe`,{ref:ae,title:`MCP App: ${r}`,className:`w-full h-full border-0 bg-transparent`,style:{border:A.prefersBorder&&ge!==`fullscreen`?void 0:`none`}}))));return z.createElement(`div`,{className:te},Ke)}function Qj(e,t){return!(e.viewId!==t.viewId||e.source!==t.source||e.sandboxUrl!==t.sandboxUrl||e.displayMode!==t.displayMode||e.cancelled!==t.cancelled||e.toolInput!==t.toolInput||e.toolOutput!==t.toolOutput||e.partialToolInput!==t.partialToolInput||e.customProps!==t.customProps||e.hostContext!==t.hostContext||e.hostCapabilities!==t.hostCapabilities||e.cspMode!==t.cspMode||e.mockOpenAiFileApis!==t.mockOpenAiFileApis||e.className!==t.className||e.onReady!==t.onReady||e.onLifecycleChange!==t.onLifecycleChange)}var $j=(0,z.memo)(Zj,Qj);function eM(e){let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;top:-9999px;left:-9999px;opacity:0`,document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand(`copy`)}finally{document.body.removeChild(t)}}function tM(e){return eM(e)}async function nM(e){if(!eM(e)){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);throw Error(`copy failed`)}}function rM(e){let t=Date.now()-e,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return n<60?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:a<7?`${a}d ago`:new Date(e).toLocaleDateString()}function iM(e){if(e==null)return`/mcp`;let t=e.trim().replace(/\/{2,}/g,`/`).replace(/\/+$/,``);return t===``||t===`/`?``:(t.startsWith(`/`)||(t=`/${t}`),t)}function aM(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=e.indexOf(`/inspector`);return t<=0?``:iM(e.slice(0,t))}function oM(){if(typeof window>`u`)return``;let e=window.__MCP_BASE_PATH__;return e==null?aM():iM(e)}function sM(){return`${oM()}/inspector`}function cM(e){let t=e.replace(/^\/+/,``);return`${sM()}/api/${t}`}var lM=/^127\.(?:0|[1-9]\d?|1\d\d|2[0-4]\d|25[0-5])(?:\.(?:0|[1-9]\d?|1\d\d|2[0-4]\d|25[0-5])){2}$/;function uM(e){try{let t=new URL(e).hostname.toLowerCase().replace(/^\[|\]$/g,``);return t===`localhost`||t===`::1`||t===`0.0.0.0`||lM.test(t)}catch{return!1}}function dM(e){try{return new URL(e).hostname.endsWith(`.mcp-use.run`)}catch{return!1}}function fM(e){let t=e.name?.trim(),n=e.url?.trim();return t?t===n?``:t:``}function pM(e){return fM(e)||e.serverInfo?.title?.trim()||e.serverInfo?.name?.trim()||e.name?.trim()||e.url?.trim()||`Unknown server`}var mM=`2026-07-28`;function hM(e){switch(e){case`v1`:return`legacy`;case`v2`:return{pin:mM};default:return`auto`}}function gM(e){return e===`legacy`?`v1`:typeof e==`object`&&e?.pin?`v2`:`auto`}function _M(){if(typeof window>`u`)return``;let e=window.__MCP_PROXY_URL__;return e===null?``:`${window.location.origin}${e||cM(`proxy`)}`}function vM(e,t,n=!1){return e===`auto`||e===`direct`||e===`proxy`?e:t===`Via Proxy`?`proxy`:t===`Direct`?`auto`:n?`proxy`:`auto`}function yM(e){return!e||typeof e==`boolean`?``:e.proxyAddress?.trim()||``}var bM=[`requestTimeout`,`resetTimeoutOnProgress`,`maxTotalTimeout`];function xM(e){if(!e)return{};let t={};for(let n of bM){let r=e[n];r!==void 0&&(t[n]=r)}return t}function SM(e,t){try{let n=localStorage.getItem(`mcp-inspector-connections`),r=n?JSON.parse(n):{};r[e]={...r[e],...t},localStorage.setItem(`mcp-inspector-connections`,JSON.stringify(r))}catch{}}function CM(e,t,n){let r=e.trim(),i=t.trim(),a=n.trim();if(!(!r&&!a))return{...r?{clientId:r}:{},...r&&i?{clientSecret:i}:{},...a?{scope:a}:{}}}function wM(e){let t=e.headers||e.proxyConfig?.headers||e.proxyConfig?.customHeaders;return t&&Object.keys(t).length>0?t:void 0}function TM(e){let t=e.proxyConfig,n=e.headers||e.customHeaders,r=t?.headers||t?.customHeaders||void 0,i=n||r,a=t?{...t,...r?{headers:r}:{},customHeaders:void 0}:void 0,{customHeaders:o,connectionType:s,transportType:c,...l}=e;return{...l,...i&&!a?.proxyAddress?{headers:i}:{},...a?{proxyConfig:a}:{},connectionMode:vM(e.connectionMode,e.connectionType,!!a?.proxyAddress)}}function EM(e){let t=kM(e),n=e.proxyConfig?.proxyAddress?.trim()||yM(e.autoProxyFallback),r=vM(e.connectionMode,e.connectionType,!!n),i={url:e.url,displayName:e.name?.trim()||e.url,connectionMode:r,protocolNegotiation:e.protocolNegotiation??`auto`,...e.oauth?{oauth:e.oauth}:{}};return r===`proxy`&&n?i.proxyConfig={proxyAddress:n,...Object.keys(t).length>0?{headers:t}:{}}:Object.keys(t).length>0&&(i.headers=t),r===`auto`&&(i.autoProxyFallback=e.autoProxyFallback??(n?{enabled:!0,proxyAddress:n}:!1)),i}function DM(e,t){let n=t?TM(t):e,r=wM(e)||{},i=n.proxyConfig?.proxyAddress?.trim()||yM(n.autoProxyFallback);return{url:e.url||``,name:e.displayName||e.url||``,transportType:`http`,connectionMode:vM(n.connectionMode,void 0,!!i),connectionType:n.connectionMode===`proxy`?`Via Proxy`:`Direct`,proxyConfig:n.connectionMode===`proxy`&&i?{proxyAddress:i,...Object.keys(r).length>0?{headers:r}:{}}:void 0,headers:r,oauth:n.oauth,autoProxyFallback:n.autoProxyFallback,protocolNegotiation:n.protocolNegotiation??`auto`,...xM(t)}}function OM(e){try{let t=localStorage.getItem(`mcp-inspector-connections`);return t&&JSON.parse(t)[e]||null}catch{return null}}function kM(e){let t=e.proxyConfig?.headers||e.proxyConfig?.customHeaders||e.headers||e.customHeaders||{};return Object.fromEntries(Object.entries(t).filter(([e,t])=>e&&t).map(([e,t])=>[e,String(t)]).sort(([e],[t])=>e.localeCompare(t)))}function AM(e){let t=e.url?.trim()||``,n=e.proxyConfig?.proxyAddress?.trim()||yM(e.autoProxyFallback);return{url:t,name:e.name?.trim()||t,transportType:e.transportType||`http`,proxyAddress:n,connectionMode:vM(e.connectionMode,e.connectionType,!!n),headers:kM(e),oauthClientId:e.oauth?.clientId?.trim()||``,oauthClientSecret:e.oauth?.clientSecret?.trim()||``,oauthScope:e.oauth?.scope?.trim()||``,requestTimeout:`requestTimeout`in e?e.requestTimeout:void 0,resetTimeoutOnProgress:`resetTimeoutOnProgress`in e?e.resetTimeoutOnProgress:void 0,maxTotalTimeout:`maxTotalTimeout`in e?e.maxTotalTimeout:void 0,protocolMode:gM(e.protocolNegotiation)}}function jM(e,t){let n=AM(e),r=AM(t);return n.url===r.url&&n.transportType===r.transportType&&n.proxyAddress===r.proxyAddress&&n.connectionMode===r.connectionMode&&JSON.stringify(n.headers)===JSON.stringify(r.headers)&&n.oauthClientId===r.oauthClientId&&n.oauthClientSecret===r.oauthClientSecret&&n.oauthScope===r.oauthScope&&n.requestTimeout===r.requestTimeout&&n.resetTimeoutOnProgress===r.resetTimeoutOnProgress&&n.maxTotalTimeout===r.maxTotalTimeout&&n.protocolMode===r.protocolMode&&n.name!==r.name}var MM=class extends Tj{setServers(e){let t=this.readRawStoredServers(),n=Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{...xM(t[e]),...n,...uM(e)&&typeof n.url==`string`&&dM(n.url)?{url:e}:{}}]));super.setServers(n)}setServer(e,t){let n=this.getServers();n[e]={...xM(this.readRawStoredServers()[e]),...t},this.setServers(n)}readRawStoredServers(){try{let e=localStorage.getItem(`mcp-inspector-connections`);return e?JSON.parse(e):{}}catch{return{}}}},NM=`popstate`;function PM(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function FM(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return BM(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:VM(t)}return UM(t,n,null,e)}function IM(e,t){if(e===!1||e==null)throw Error(t)}function LM(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function RM(){return Math.random().toString(36).substring(2,10)}function zM(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function BM(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?HM(t):t,state:n,key:t&&t.key||r||RM(),mask:i}}function VM({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function HM(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function UM(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=PM(e)?e:BM(h.location,e,t);n&&n(r,e),l=u()+1;let d=zM(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=PM(e)?e:BM(h.location,e,t);n&&n(r,e),l=u();let i=zM(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return WM(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(NM,d),c=e,()=>{i.removeEventListener(NM,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function WM(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),IM(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:VM(t);return i=i.replace(/ $/,`%20`),!n&&i.startsWith(`//`)&&(i=r+i),new URL(i,r)}function GM(e,t,n=`/`){return KM(e,t,n,!1)}function KM(e,t,n,r,i){let a=dN((typeof t==`string`?HM(t):t).pathname||`/`,n);if(a==null)return null;let o=i??JM(e),s=null,c=uN(a);for(let e=0;s==null&&e<o.length;++e)s=sN(o[e],c,r);return s}function qM(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function JM(e){let t=YM(e);return ZM(t),t}function YM(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;IM(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=bN([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(IM(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),YM(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:aN(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of XM(e.path))a(e,t,!0,n)}),t}function XM(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=XM(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ZM(e){e.sort((e,t)=>e.score===t.score?oN(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var QM=/^:[\w-]+$/,$M=3,eN=2,tN=1,nN=10,rN=-2,iN=e=>e===`*`;function aN(e,t){let n=e.split(`/`),r=n.length;return n.some(iN)&&(r+=rN),t&&(r+=eN),n.filter(e=>!iN(e)).reduce((e,t)=>e+(QM.test(t)?$M:t===``?tN:nN),r)}function oN(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function sN(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=cN({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=cN({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:bN([a,u.pathname]),pathnameBase:SN(bN([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=bN([a,u.pathnameBase]))}return o}function cN(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=lN(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function lN(e,t=!1,n=!0){LM(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function uN(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return LM(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function dN(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var fN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function pN(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?HM(e):e,a;return n?(n=yN(n),a=n.startsWith(`/`)?mN(n.substring(1),`/`):mN(n,t)):a=t,{pathname:a,search:CN(r),hash:wN(i)}}function mN(e,t){let n=xN(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function hN(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function gN(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function _N(e){let t=gN(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function vN(e,t,n,r=!1){let i;typeof e==`string`?i=HM(e):(i={...e},IM(!i.pathname||!i.pathname.includes(`?`),hN(`?`,`pathname`,`search`,i)),IM(!i.pathname||!i.pathname.includes(`#`),hN(`#`,`pathname`,`hash`,i)),IM(!i.search||!i.search.includes(`#`),hN(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=pN(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var yN=e=>e.replace(/\/\/+/g,`/`),bN=e=>yN(e.join(`/`)),xN=e=>e.replace(/\/+$/,``),SN=e=>xN(e).replace(/^\/*/,`/`),CN=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,wN=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,TN=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function EN(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function DN(e){return bN(e.map(e=>e.route.path).filter(Boolean))||`/`}var ON=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function kN(e,t){let n=e;if(typeof n!=`string`||!fN.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ON)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=dN(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{LM(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var AN=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(AN);var jN=[`GET`,...AN];new Set(jN);var MN=z.createContext(null);MN.displayName=`DataRouter`;var NN=z.createContext(null);NN.displayName=`DataRouterState`;var PN=z.createContext(!1);function FN(){return z.useContext(PN)}var IN=z.createContext({isTransitioning:!1});IN.displayName=`ViewTransition`;var LN=z.createContext(new Map);LN.displayName=`Fetchers`;var RN=z.createContext(null);RN.displayName=`Await`;var zN=z.createContext(null);zN.displayName=`Navigation`;var BN=z.createContext(null);BN.displayName=`Location`;var VN=z.createContext({outlet:null,matches:[],isDataRoute:!1});VN.displayName=`Route`;var HN=z.createContext(null);HN.displayName=`RouteError`;var UN=`REACT_ROUTER_ERROR`,WN=`REDIRECT`,GN=`ROUTE_ERROR_RESPONSE`;function KN(e){if(e.startsWith(`${UN}:${WN}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function qN(e){if(e.startsWith(`${UN}:${GN}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new TN(t.status,t.statusText,t.data)}catch{}}function JN(e,{relative:t}={}){IM(YN(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=z.useContext(zN),{hash:i,pathname:a,search:o}=nP(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:bN([n,a])),r.createHref({pathname:s,search:o,hash:i})}function YN(){return z.useContext(BN)!=null}function XN(){return IM(YN(),`useLocation() may be used only in the context of a <Router> component.`),z.useContext(BN).location}var ZN=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function QN(e){z.useContext(zN).static||z.useLayoutEffect(e)}function $N(){let{isDataRoute:e}=z.useContext(VN);return e?xP():eP()}function eP(){IM(YN(),`useNavigate() may be used only in the context of a <Router> component.`);let e=z.useContext(MN),{basename:t,navigator:n}=z.useContext(zN),{matches:r}=z.useContext(VN),{pathname:i}=XN(),a=JSON.stringify(_N(r)),o=z.useRef(!1);return QN(()=>{o.current=!0}),z.useCallback((r,s={})=>{if(LM(o.current,ZN),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=vN(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:bN([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}z.createContext(null);function tP(){let{matches:e}=z.useContext(VN);return e[e.length-1]?.params??{}}function nP(e,{relative:t}={}){let{matches:n}=z.useContext(VN),{pathname:r}=XN(),i=JSON.stringify(_N(n));return z.useMemo(()=>vN(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function rP(e,t){return iP(e,t)}function iP(e,t,n){IM(YN(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=z.useContext(zN),{matches:i}=z.useContext(VN),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;CP(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
486
486
|
|
|
487
487
|
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=XN(),d;if(t){let e=typeof t==`string`?HM(t):t;IM(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):GM(e,{pathname:p});LM(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),LM(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=dP(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:bN([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:bN([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?z.createElement(BN.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function aP(){let e=bP(),t=EN(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=z.createElement(z.Fragment,null,z.createElement(`p`,null,`💿 Hey developer 👋`),z.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,z.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,z.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),z.createElement(z.Fragment,null,z.createElement(`h2`,null,`Unexpected Application Error!`),z.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?z.createElement(`pre`,{style:i},n):null,o)}var oP=z.createElement(aP,null),sP=class extends z.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=qN(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:z.createElement(VN.Provider,{value:this.props.routeContext},z.createElement(HN.Provider,{value:e,children:this.props.component}));return this.context?z.createElement(lP,{error:e},t):t}};sP.contextType=PN;var cP=new WeakMap;function lP({children:e,error:t}){let{basename:n}=z.useContext(zN);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=KN(t.digest);if(e){let r=cP.get(t);if(r)throw r;let i=kN(e.location,n);if(ON&&!cP.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw cP.set(t,n),n}return z.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function uP({routeContext:e,match:t,children:n}){let r=z.useContext(MN);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),z.createElement(VN.Provider,{value:e},n)}function dP(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);IM(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:DN(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||oP,o&&(s<0&&c===0?(CP(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?z.createElement(n.route.Component,null):n.route.element?n.route.element:e,z.createElement(uP,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?z.createElement(sP,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function fP(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pP(e){let t=z.useContext(MN);return IM(t,fP(e)),t}function mP(e){let t=z.useContext(NN);return IM(t,fP(e)),t}function hP(e){let t=z.useContext(VN);return IM(t,fP(e)),t}function gP(e){let t=hP(e),n=t.matches[t.matches.length-1];return IM(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function _P(){return gP(`useRouteId`)}function vP(){let e=mP(`useNavigation`);return z.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function yP(){let{matches:e,loaderData:t}=mP(`useMatches`);return z.useMemo(()=>e.map(e=>qM(e,t)),[e,t])}function bP(){let e=z.useContext(HN),t=mP(`useRouteError`),n=gP(`useRouteError`);return e===void 0?t.errors?.[n]:e}function xP(){let{router:e}=pP(`useNavigate`),t=gP(`useNavigate`),n=z.useRef(!1);return QN(()=>{n.current=!0}),z.useCallback(async(r,i={})=>{LM(n.current,ZN),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var SP={};function CP(e,t,n){!t&&!SP[e]&&(SP[e]=!0,LM(!1,n))}z.memo(wP);function wP({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return iP(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function TP(e){IM(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function EP({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){IM(!YN(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=z.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=HM(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=z.useMemo(()=>{let e=dN(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return LM(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:z.createElement(zN.Provider,{value:c},z.createElement(BN.Provider,{children:t,value:h}))}function DP({children:e,location:t}){return rP(OP(e),t)}z.Component;function OP(e,t=[]){let n=[];return z.Children.forEach(e,(e,r)=>{if(!z.isValidElement(e))return;let i=[...t,r];if(e.type===z.Fragment){n.push.apply(n,OP(e.props.children,i));return}IM(e.type===TP,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),IM(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=OP(e.props.children,i)),n.push(a)}),n}var kP=`get`,AP=`application/x-www-form-urlencoded`;function jP(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function MP(e){return jP(e)&&e.tagName.toLowerCase()===`button`}function NP(e){return jP(e)&&e.tagName.toLowerCase()===`form`}function PP(e){return jP(e)&&e.tagName.toLowerCase()===`input`}function FP(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function IP(e,t){return e.button===0&&(!t||t===`_self`)&&!FP(e)}function LP(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function RP(e,t){let n=LP(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var zP=null;function BP(){if(zP===null)try{new FormData(document.createElement(`form`),0),zP=!1}catch{zP=!0}return zP}var VP=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function HP(e){return e!=null&&!VP.has(e)?(LM(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${AP}"`),null):e}function UP(e,t){let n,r,i,a,o;if(NP(e)){let o=e.getAttribute(`action`);r=o?dN(o,t):null,n=e.getAttribute(`method`)||kP,i=HP(e.getAttribute(`enctype`))||AP,a=new FormData(e)}else if(MP(e)||PP(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?dN(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||kP,i=HP(e.getAttribute(`formenctype`))||HP(o.getAttribute(`enctype`))||AP,a=new FormData(o,e),!BP()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(jP(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=kP,r=null,i=AP,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var WP={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},GP=/[&><\u2028\u2029]/g;function KP(e){return e.replace(GP,e=>WP[e])}function qP(e,t){if(e===!1||e==null)throw Error(t)}function JP(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&dN(i.pathname,t)===`/`?i.pathname=`${xN(t)}/_root.${r}`:i.pathname=`${xN(i.pathname)}.${r}`,i}async function YP(e,t){if(e.id in t)return t[e.id];try{let n=await rS(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function XP(e){return e!=null&&typeof e.page==`string`}function ZP(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function QP(e,t,n){return rF((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await YP(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ZP).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function $P(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function eF(e,t,{includeHydrateFallback:n}={}){return tF(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function tF(e){return[...new Set(e)]}function nF(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function rF(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!XP(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(nF(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function iF(){let e=z.useContext(MN);return qP(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function aF(){let e=z.useContext(NN);return qP(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var oF=z.createContext(void 0);oF.displayName=`FrameworkContext`;function sF(){let e=z.useContext(oF);return qP(e,`You must render this element inside a <HydratedRouter> element`),e}function cF(e,t){let n=z.useContext(oF),[r,i]=z.useState(!1),[a,o]=z.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=z.useRef(null);z.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),z.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:lF(s,p),onBlur:lF(c,m),onMouseEnter:lF(l,p),onMouseLeave:lF(u,m),onTouchStart:lF(d,p)}]:[a,f,{}]:[!1,f,{}]}function lF(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function uF({page:e,...t}){let n=FN(),{router:r}=iF(),i=z.useMemo(()=>GM(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?z.createElement(fF,{page:e,matches:i,...t}):z.createElement(pF,{page:e,matches:i,...t}):null}function dF(e){let{manifest:t,routeModules:n}=sF(),[r,i]=z.useState([]);return z.useEffect(()=>{let r=!1;return QP(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function fF({page:e,matches:t,...n}){let r=XN(),{future:i}=sF(),{basename:a}=iF(),o=z.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=JP(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return z.createElement(z.Fragment,null,o.map(e=>z.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function pF({page:e,matches:t,...n}){let r=XN(),{future:i,manifest:a,routeModules:o}=sF(),{basename:s}=iF(),{loaderData:c,matches:l}=aF(),u=z.useMemo(()=>$P(e,t,l,a,r,`data`),[e,t,l,a,r]),d=z.useMemo(()=>$P(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=z.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=JP(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=z.useMemo(()=>eF(d,a),[d,a]),m=dF(d);return z.createElement(z.Fragment,null,f.map(e=>z.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>z.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>z.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function mF(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}z.Component;var hF=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{hF&&(window.__reactRouterVersion=`7.16.0`)}catch{}function gF({basename:e,children:t,useTransitions:n,window:r}){let i=z.useRef();i.current??=FM({window:r,v5Compat:!0});let a=i.current,[o,s]=z.useState({action:a.action,location:a.location}),c=z.useCallback(e=>{n===!1?s(e):z.startTransition(()=>s(e))},[n]);return z.useLayoutEffect(()=>a.listen(c),[a,c]),z.createElement(EP,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function _F({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=z.useState({action:n.action,location:n.location}),o=z.useCallback(e=>{r===!1?a(e):z.startTransition(()=>a(e))},[r]);return z.useLayoutEffect(()=>n.listen(o),[n,o]),z.createElement(EP,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}_F.displayName=`unstable_HistoryRouter`;var vF=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yF=z.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=z.useContext(zN),v=typeof l==`string`&&vF.test(l),y=kN(l,h);l=y.to;let b=JN(l,{relative:r}),x=XN(),S=null;if(o){let e=vN(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:bN([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=cF(n,p),E=EF(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ee(t){e&&e(t),t.defaultPrevented||E(t)}let te=!(y.isExternal||i),ne=z.createElement(`a`,{...p,...T,href:(te?S:void 0)||y.absoluteURL||b,onClick:te?ee:e,ref:mF(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?z.createElement(z.Fragment,null,ne,z.createElement(uF,{page:b})):ne});yF.displayName=`Link`;var bF=z.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=nP(a,{relative:c.relative}),d=XN(),f=z.useContext(NN),{navigator:p,basename:m}=z.useContext(zN),h=f!=null&&LF(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=dN(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return z.createElement(yF,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});bF.displayName=`NavLink`;var xF=z.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=kP,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=z.useContext(zN),g=AF(),_=jF(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&vF.test(s);return z.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?z.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});xF.displayName=`Form`;function SF({getKey:e,storageKey:t,...n}){let r=z.useContext(oF),{basename:i}=z.useContext(zN),a=XN(),o=yP();FF({getKey:e,storageKey:t});let s=z.useMemo(()=>{if(!r||!e)return null;let t=PF(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return z.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${KP(JSON.stringify(t||MF))}, ${KP(JSON.stringify(s))})`}})}SF.displayName=`ScrollRestoration`;function CF(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wF(e){let t=z.useContext(MN);return IM(t,CF(e)),t}function TF(e){let t=z.useContext(NN);return IM(t,CF(e)),t}function EF(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=$N(),d=XN(),f=nP(e,{relative:o});return z.useCallback(p=>{if(IP(p,t)){p.preventDefault();let t=n===void 0?VM(d)===VM(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?z.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function DF(e){LM(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=z.useRef(LP(e)),n=z.useRef(!1),r=XN(),i=z.useMemo(()=>RP(r.search,n.current?null:t.current),[r.search]),a=$N();return[i,z.useCallback((e,t)=>{let r=LP(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var OF=0,kF=()=>`__${String(++OF)}__`;function AF(){let{router:e}=wF(`useSubmit`),{basename:t}=z.useContext(zN),n=_P(),r=e.fetch,i=e.navigate;return z.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=UP(e,t);a.navigate===!1?await r(a.fetcherKey||kF(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function jF(e,{relative:t}={}){let{basename:n}=z.useContext(zN),r=z.useContext(VN);IM(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...nP(e||`.`,{relative:t})},o=XN();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:bN([n,a.pathname])),VM(a)}var MF=`react-router-scroll-positions`,NF={};function PF(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:dN(e.pathname,n)||e.pathname},t)),i??=e.key,i}function FF({getKey:e,storageKey:t}={}){let{router:n}=wF(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=TF(`useScrollRestoration`),{basename:a}=z.useContext(zN),o=XN(),s=yP(),c=vP();z.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),IF(z.useCallback(()=>{if(c.state===`idle`){let t=PF(o,s,a,e);NF[t]=window.scrollY}try{sessionStorage.setItem(t||MF,JSON.stringify(NF))}catch(e){LM(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(z.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||MF);e&&(NF=JSON.parse(e))}catch{}},[t]),z.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(NF,()=>window.scrollY,e?(t,n)=>PF(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),z.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{LM(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function IF(e,t){let{capture:n}=t||{};z.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function LF(e,{relative:t}={}){let n=z.useContext(IN);IM(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=wF(`useViewTransitionState`),i=nP(e,{relative:t});if(!n.isTransitioning)return!1;let a=dN(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=dN(n.nextLocation.pathname,r)||n.nextLocation.pathname;return cN(i.pathname,o)!=null||cN(i.pathname,a)!=null}function RF(e){if(!e||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))}var zF=e=>{switch(e){case`success`:return HF;case`info`:return WF;case`warning`:return UF;case`error`:return GF;default:return null}},BF=Array(12).fill(0),VF=({visible:e,className:t})=>z.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},z.createElement(`div`,{className:`sonner-spinner`},BF.map((e,t)=>z.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),HF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},z.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`})),UF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},z.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`})),WF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},z.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`})),GF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},z.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`})),KF=z.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`},z.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),z.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),qF=()=>{let[e,t]=z.useState(document.hidden);return z.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},JF=1,YF=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:JF++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],z.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(ZF(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!z.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!z.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!z.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!z.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||JF++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},XF=(e,t)=>{let n=t?.id||JF++;return YF.addToast({title:e,...t,id:n}),n},ZF=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,QF=Object.assign(XF,{success:YF.success,info:YF.info,warning:YF.warning,error:YF.error,custom:YF.custom,message:YF.message,promise:YF.promise,dismiss:YF.dismiss,loading:YF.loading},{getHistory:()=>YF.toasts,getToasts:()=>YF.getActiveToasts()});RF(`[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 $F(e){return e.label!==void 0}var eI=3,tI=`24px`,nI=`16px`,rI=4e3,iI=356,aI=14,oI=45,sI=200;function cI(...e){return e.filter(Boolean).join(` `)}function lI(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var uI=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,ee]=z.useState(null),[te,ne]=z.useState(null),[re,ie]=z.useState(!1),[ae,D]=z.useState(!1),[O,k]=z.useState(!1),[A,oe]=z.useState(!1),[j,se]=z.useState(!1),[ce,M]=z.useState(0),[N,le]=z.useState(0),ue=z.useRef(n.duration||y||rI),de=z.useRef(null),fe=z.useRef(null),pe=c===0,me=c+1<=o,he=n.type,ge=n.dismissible!==!1,_e=n.className||``,ve=n.descriptionClassName||``,ye=z.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),be=z.useMemo(()=>n.closeButton??p,[n.closeButton,p]),xe=z.useMemo(()=>n.duration||y||rI,[n.duration,y]),P=z.useRef(0),Se=z.useRef(0),Ce=z.useRef(0),we=z.useRef(null),[Te,Ee]=b.split(`-`),De=z.useMemo(()=>s.reduce((e,t,n)=>n>=ye?e:e+t.height,0),[s,ye]),Oe=qF(),ke=n.invert||t,Ae=he===`loading`;Se.current=z.useMemo(()=>ye*x+De,[ye,De]),z.useEffect(()=>{ue.current=xe},[xe]),z.useEffect(()=>{ie(!0)},[]),z.useEffect(()=>{let e=fe.current;if(e){let t=e.getBoundingClientRect().height;return le(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),z.useLayoutEffect(()=>{if(!re)return;let e=fe.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,le(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[re,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let je=z.useCallback(()=>{D(!0),M(Se.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},sI)},[n,d,a,Se]);z.useEffect(()=>{if(n.promise&&he===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Oe?(()=>{if(Ce.current<P.current){let e=new Date().getTime()-P.current;ue.current-=e}Ce.current=new Date().getTime()})():ue.current!==1/0&&(P.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),je()},ue.current)),()=>clearTimeout(e)},[u,i,n,he,Oe,je]),z.useEffect(()=>{n.delete&&(je(),n.onDismiss==null||n.onDismiss.call(n,n))},[je,n.delete]);function Me(){return w?.loading?z.createElement(`div`,{className:cI(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":he===`loading`},w.loading):z.createElement(VF,{className:cI(C?.loader,n?.classNames?.loader),visible:he===`loading`})}let Ne=n.icon||w?.[he]||zF(he);return z.createElement(`li`,{tabIndex:0,ref:fe,className:cI(_,_e,C?.toast,n?.classNames?.toast,C?.default,C?.[he],n?.classNames?.[he]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":re,"data-promise":!!n.promise,"data-swiped":j,"data-removed":ae,"data-visible":me,"data-y-position":Te,"data-x-position":Ee,"data-index":c,"data-front":pe,"data-swiping":O,"data-dismissible":ge,"data-type":he,"data-invert":ke,"data-swipe-out":A,"data-swipe-direction":te,"data-expanded":!!(u||S&&re),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${ae?ce:Se.current}px`,"--initial-height":S?`auto`:`${N}px`,...m,...n.style},onDragEnd:()=>{k(!1),ee(null),we.current=null},onPointerDown:e=>{e.button!==2&&(Ae||!ge||(de.current=new Date,M(Se.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(k(!0),we.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(A||!ge)return;we.current=null;let e=Number(fe.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(fe.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-de.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=oI||a>.11){M(Se.current),n.onDismiss==null||n.onDismiss.call(n,n),ne(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),je(),oe(!0);return}else{var o,s;(o=fe.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=fe.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}se(!1),k(!1),ee(null)},onPointerMove:t=>{var n,r;if(!we.current||!ge||window.getSelection()?.toString().length>0)return;let i=t.clientY-we.current.y,a=t.clientX-we.current.x,o=e.swipeDirections??lI(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&ee(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(E===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&se(!0),(n=fe.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=fe.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},be&&!n.jsx&&he!==`loading`?z.createElement(`button`,{"aria-label":T,"data-disabled":Ae,"data-close-button":!0,onClick:Ae||!ge?()=>{}:()=>{je(),n.onDismiss==null||n.onDismiss.call(n,n)},className:cI(C?.closeButton,n?.classNames?.closeButton)},w?.close??KF):null,(he||n.icon||n.promise)&&n.icon!==null&&(w?.[he]!==null||n.icon)?z.createElement(`div`,{"data-icon":``,className:cI(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Me():null,n.type===`loading`?null:Ne):null,z.createElement(`div`,{"data-content":``,className:cI(C?.content,n?.classNames?.content)},z.createElement(`div`,{"data-title":``,className:cI(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?z.createElement(`div`,{"data-description":``,className:cI(v,ve,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),z.isValidElement(n.cancel)?n.cancel:n.cancel&&$F(n.cancel)?z.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{$F(n.cancel)&&ge&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),je())},className:cI(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,z.isValidElement(n.action)?n.action:n.action&&$F(n.action)?z.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{$F(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&je())},className:cI(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function dI(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function fI(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?nI:tI;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var pI=z.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=eI,toastOptions:g,dir:_=dI(),gap:v=aI,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=z.useState([]),C=z.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=z.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,E]=z.useState([]),[ee,te]=z.useState(!1),[ne,re]=z.useState(!1),[ie,ae]=z.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),D=z.useRef(null),O=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),k=z.useRef(null),A=z.useRef(!1),oe=z.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||YF.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return z.useEffect(()=>YF.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{br.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[x]),z.useEffect(()=>{if(d!==`system`){ae(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?ae(`dark`):ae(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{ae(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{ae(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),z.useEffect(()=>{x.length<=1&&te(!1)},[x]),z.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;te(!0),(t=D.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===D.current||D.current?.contains(document.activeElement))&&te(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),z.useEffect(()=>{if(D.current)return()=>{k.current&&(k.current.focus({preventScroll:!0}),k.current=null,A.current=!1)}},[D.current]),z.createElement(`section`,{ref:t,"aria-label":`${b} ${O}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?z.createElement(`ol`,{key:t,dir:_===`auto`?dI():_,tabIndex:-1,ref:D,className:c,"data-sonner-toaster":!0,"data-sonner-theme":ie,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${iI}px`,"--gap":`${v}px`,...m,...fI(l,u)},onBlur:e=>{A.current&&!e.currentTarget.contains(e.relatedTarget)&&(A.current=!1,k.current&&=(k.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||A.current||(A.current=!0,k.current=e.relatedTarget)},onMouseEnter:()=>te(!0),onMouseMove:()=>te(!0),onMouseLeave:()=>{ne||te(!1)},onDragEnd:()=>te(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||re(!0)},onPointerUp:()=>re(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>z.createElement(uI,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:ne,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:oe,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:v,expanded:ee,swipeDirections:e.swipeDirections}))):null}))}),mI=`__mcpUseInspectorReconnect`;function hI(e){let t=e??(typeof window<`u`?window.location.search:``);if(typeof window<`u`){try{if(sessionStorage.getItem(`__mcpUseInspectorReconnect`))return!0}catch{}if(window.__MCP_USE_INSPECTOR__?.autoConnectUrl)return!0}return!!new URLSearchParams(t).get(`autoConnect`)}function gI(e,t){return e.url===t.url&&e.state!==`ready`&&((e.transportType??`http`)!==t.transportType||gM(e.protocolNegotiation)!==gM(t.protocolNegotiation))}function _I(e){if(!e||typeof e!=`string`)return console.warn(`[useAutoConnect] parseAutoConnectParam: invalid param`,e),null;let t=e.trim();if((t.startsWith(`{`)||t.startsWith(`[`))&&t.endsWith(`/`)&&(t=t.replace(/\/+$/,``)),t.startsWith(`http://`)||t.startsWith(`https://`))return console.log(`[useAutoConnect] parseAutoConnectParam: treating as plain URL:`,t),{url:t,name:`Auto-connected Server`,transportType:`http`,connectionType:`Direct`,connectionMode:`auto`};try{let e=JSON.parse(t);if(console.log(`[useAutoConnect] parseAutoConnectParam: parsed JSON:`,e),e&&typeof e==`object`&&!Array.isArray(e))if(e.url&&typeof e.url==`string`){let t=e.url.trim();if((t.startsWith(`{`)||t.startsWith(`[`))&&t.length>2)try{let e=JSON.parse(t);e&&typeof e==`object`&&e.url&&typeof e.url==`string`?(t=e.url.trim(),console.log(`[useAutoConnect] parseAutoConnectParam: extracted URL from nested JSON:`,t)):console.warn(`[useAutoConnect] parseAutoConnectParam: url field is JSON but doesn't contain a url:`,e)}catch(e){console.warn(`[useAutoConnect] parseAutoConnectParam: url field looks like JSON but failed to parse, using as-is:`,e)}return!t.startsWith(`http://`)&&!t.startsWith(`https://`)?(console.error(`[useAutoConnect] parseAutoConnectParam: extracted URL is not a valid HTTP(S) URL:`,t),null):(console.log(`[useAutoConnect] parseAutoConnectParam: extracted URL:`,t),{url:t,name:e.name||`Auto-connected Server`,transportType:e.transportType===`sse`?`sse`:`http`,connectionMode:vM(e.connectionMode,e.connectionType,!!e.proxyConfig?.proxyAddress),connectionType:e.connectionType===`Via Proxy`?`Via Proxy`:`Direct`,autoProxyFallback:e.autoProxyFallback,protocolNegotiation:hM(gM(e.protocolNegotiation)),customHeaders:e.customHeaders||{},requestTimeout:e.requestTimeout,resetTimeoutOnProgress:e.resetTimeoutOnProgress,maxTotalTimeout:e.maxTotalTimeout,auth:e.auth})}else return console.warn(`[useAutoConnect] parseAutoConnectParam: parsed object missing or invalid url field:`,e),null;else return typeof e==`string`&&(e.startsWith(`http://`)||e.startsWith(`https://`))?(console.log(`[useAutoConnect] parseAutoConnectParam: JSON parsed to URL string:`,e),{url:e,name:`Auto-connected Server`,transportType:`http`,connectionType:`Direct`,connectionMode:`auto`}):(console.warn(`[useAutoConnect] parseAutoConnectParam: parsed value is not a valid object:`,e),null)}catch(e){return console.error(`[useAutoConnect] parseAutoConnectParam: Failed to parse as JSON and not a valid URL:`,e,`Param:`,t),null}}function vI({connections:e,addServer:t,removeConnection:n,configLoaded:r,embedded:i=!1}){let a=$N(),[o,s]=(0,z.useState)(()=>hI()),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(!1),f=(0,z.useCallback)(e=>{let{url:n,name:r,transportType:a,connectionMode:o,protocolNegotiation:s,customHeaders:c,auth:l}=e;console.log(`[useAutoConnect] Config received:`,e),console.log(`[useAutoConnect] Custom headers before auth:`,c),console.log(`[useAutoConnect] Auth config:`,l);let u={...c};if(l?.access_token){let e=l.token_type||`bearer`;if(u.Authorization=`${e.charAt(0).toUpperCase()+e.slice(1)} ${l.access_token}`,console.log(`[useAutoConnect] Added Authorization header:`,u.Authorization),typeof window<`u`&&!i){let e=`mcp:auth:${n}`,t={access_token:l.access_token,token_type:l.token_type||`bearer`,expires_at:l.expires_at,refresh_token:l.refresh_token,scope:l.scope||``};try{localStorage.setItem(e,JSON.stringify(t)),console.log(`[useAutoConnect] Pre-stored OAuth tokens for ${n}`)}catch(e){console.error(`[useAutoConnect] Failed to store OAuth tokens:`,e)}}}console.log(`[useAutoConnect] Final custom headers:`,u);let d;try{let e=new URL(n).origin;window.location.origin!==e&&(d=_M())}catch{d=_M()}let f=o===`proxy`&&d?{proxyAddress:d,...Object.keys(u).length>0&&{headers:u}}:Object.keys(u).length>0?{headers:u}:void 0,p=o===`auto`?e.autoProxyFallback===void 0?d?{enabled:!0,proxyAddress:d}:!1:e.autoProxyFallback:!1;console.warn(`[useAutoConnect] Attempting connection (${o}):`,{url:n,transportType:a,proxyConfig:f,autoProxyFallback:p}),t(n,EM({url:n,name:r,transportType:a,connectionMode:o,protocolNegotiation:s??`auto`,connectionType:o===`proxy`?`Via Proxy`:`Direct`,proxyConfig:f,headers:u,autoProxyFallback:p}))},[t]),p=(0,z.useCallback)(t=>{let r=e.find(e=>e.url===t.url);if(r){if(gI(r,t)){console.warn(`[useAutoConnect] Existing connection transport differs from auto-connect config; replacing it`),n(r.id),l(t),s(!0),f(t);return}if(r.state===`ready`){console.warn(`[useAutoConnect] Connection already ready, navigating to server`);let e=new URLSearchParams(window.location.search),t=e.get(`tunnelUrl`),n=e.get(`tab`),i=e.get(`openTunnelPopover`),o=new URLSearchParams;o.set(`server`,r.id),t&&o.set(`tunnelUrl`,t),n&&o.set(`tab`,n),i&&o.set(`openTunnelPopover`,i),a(`/?${o.toString()}`)}else console.warn(`[useAutoConnect] Connection exists, waiting for ready state`),l(t),s(!0)}else l(t),s(!0),f(t)},[e,a,n,f]);return(0,z.useEffect)(()=>{if(u)return;let e=()=>{if(typeof sessionStorage>`u`)return!1;try{let e=sessionStorage.getItem(mI);if(!e)return!1;let t=JSON.parse(e);return sessionStorage.removeItem(mI),!t?.url||!t.transportType?!1:(p(t),!0)}catch{try{sessionStorage.removeItem(mI)}catch{}return!1}};if(i){if(e()){d(!0);return}let t=new URLSearchParams(window.location.search).get(`autoConnect`);if(t){try{t=decodeURIComponent(t)}catch{}console.log(`[useAutoConnect] Raw autoConnect param:`,t);let e=_I(t);console.log(`[useAutoConnect] Parsed config:`,e),e&&p(e),d(!0);return}d(!0);return}if(r!==!0)return;if(e()){d(!0);return}let t=new URLSearchParams(window.location.search).get(`autoConnect`);if(t)try{t=decodeURIComponent(t)}catch{}if(t){let e=_I(t);e&&p(e),d(!0);return}let n=window.__MCP_USE_INSPECTOR__?.autoConnectUrl;if(n){let e=_I(n);e&&p(e),d(!0);return}fetch(`${sM()}/config.json`).then(e=>e.json()).then(e=>{if(d(!0),e.autoConnectUrl){let t=_I(e.autoConnectUrl);t&&p(t)}}).catch(()=>d(!0))},[u,r,p,i]),(0,z.useEffect)(()=>{if(!c)return;let t=e.find(e=>e.url===c.url);if(t?.state===`ready`){console.warn(`[useAutoConnect] Connection succeeded, navigating to server`);let e=new URLSearchParams(window.location.search),n=e.get(`tunnelUrl`),r=e.get(`tab`),i=e.get(`openTunnelPopover`),o=new URLSearchParams;o.set(`server`,t.id),n&&o.set(`tunnelUrl`,n),r&&o.set(`tab`,r),i&&o.set(`openTunnelPopover`,i),a(`/?${o.toString()}`),setTimeout(()=>{l(null),s(!1)},100);return}if(t?.state===`pending_auth`||t?.state===`authenticating`){console.warn(`[useAutoConnect] Connection requires authentication, clearing loading overlay`),setTimeout(()=>{s(!1)},100);return}t?.state===`failed`&&(console.warn(`[useAutoConnect] Connection failed after all retries`),QF.error(`Cannot connect to server. Please check the URL and try again.`),queueMicrotask(()=>{s(!1),l(null)}))},[e,c,a]),(0,z.useEffect)(()=>{if(o&&e.length>0&&!c&&e.some(e=>e.state===`ready`||e.state===`failed`||e.state===`pending_auth`)){let e=setTimeout(()=>s(!1),500);return()=>clearTimeout(e)}},[o,e,c]),(0,z.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>{o&&(console.warn(`[useAutoConnect] Auto-connect timeout - clearing loading state`),s(!1),l(null))},3e4);return()=>clearTimeout(e)},[o]),{isAutoConnecting:o,autoConnectUrl:c?.url||null}}function yI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card`,className:D(`flex flex-col gap-6 rounded-xl border border-border bg-transparent py-6 text-card-foreground`,e),...t})}function bI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card-header`,className:D(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]`,e),...t})}function xI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card-title`,className:D(`font-semibold leading-none`,e),...t})}function SI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card-description`,className:D(`text-sm text-muted-foreground`,e),...t})}function CI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card-content`,className:D(`px-6`,e),...t})}var wI={"chevron-right":ne,"chevron-down":Ir,pipette:Oi,x:Xi,copy:Wr,menu:_i,dot:Kr,monitor:bi,sun:Wi,moon:xi,"rectangle-horizontal":ji,circle:Br,"square-library":Bi,clock:Vr,star:Hi,settings:Ii,plus:Ai,"arrow-left":Or,"arrow-right":kr,"arrow-up":jr,search:C,loader:pi,users:Ji,lock:mi,mail:gi,bell:Mr,shield:Li,palette:Ci,lightbulb:ui,rocket:Mi,heart:ni,paintbrush:Si,brain:Nr,globe:ei,user:qi,image:ai,link:di,check:Fr,"rotate-ccw":Ni,play:ki,pause:Ei,home:ii,"message-circle":vi,inbox:oi,pencil:Di,"skip-forward":Ri,"corner-down-right":Gr},TI=(0,z.createContext)(null);function EI(e){return((0,z.useContext)(TI)??wI)[e]}var DI=z.createContext(!1),OI=z.createContext(void 0);function kI(e){let t=z.useContext(OI);if(e===!1&&t===void 0)throw Error(Be(27));return t}var AI={...Et,...vt},jI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=kI(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Ue(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:AI,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),MI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{store:c}=kI(),l=c.useState(`open`),{getButtonProps:u,buttonRef:f}=Ne({disabled:a,native:o}),p={disabled:a};function m(e){l&&c.setOpen(!1,A(d,e.nativeEvent))}return Ue(`button`,e,{state:p,ref:[t,f],props:[{onClick:m},s,u]})}),NI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=kI(),c=se(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Ue(`p`,e,{ref:t,props:[{id:c},o]})}),PI=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),FI=function(e){return e[e.open=ht.open]=`open`,e[e.closed=ht.closed]=`closed`,e[e.startingStyle=ht.startingStyle]=`startingStyle`,e[e.endingStyle=ht.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),II=z.createContext(void 0);function LI(){let e=z.useContext(II);if(e===void 0)throw Error(Be(26));return e}var RI={...Et,...vt,nestedDialogOpen(e){return e?{[FI.nestedDialogOpen]:``}:null}},zI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,{store:c}=kI(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`),C=d.useState(`floatingId`),w=s.id??C;LI(),y({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let T=o===void 0?ut(c.context.popupRef):o,E=g>0,ee=c.useStateSetter(`popupElement`),te=Ue(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:E},props:[f,{id:w,"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,...At,hidden:!m,onKeyDown(e){Qt.has(e.key)&&e.stopPropagation()},style:{[PI.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,ee],stateAttributesMapping:RI});return(0,R.jsx)(rn,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:T,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:te})}),BI=z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=kI(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,R.jsx)(II.Provider,{value:n,children:(0,R.jsxs)(pe,{ref:t,...r,children:[a&&o===!0&&(0,R.jsx)(wn,{ref:i.context.internalBackdropRef,inert:sn(!s)}),e.children]})}):null});function VI(e){let{store:t,actionsRef:n}=e,r=t.useState(`open`);$e(t,r),We(t);let{forceUnmount:i}=xt(r,t),a=z.useCallback(()=>{t.setOpen(!1,A(Ee))},[t]);z.useImperativeHandle(n,()=>({unmount:i,close:a}),[i,a])}function HI({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=z.useState(0),[u,d]=z.useState(0),f=c===0,p=_(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0||`touches`in t&&t.touches.length!==1)return!1;let n=Qe(t);return f&&!i?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===n||e.context.backdropRef.current===n||ft(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0:!1},escapeKey:f});return xn(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),e.useContextCallback(`onNestedDialogClose`,()=>{l(0),d(0)}),z.useEffect(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(c+1,u+ +!!n),t?.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[n,r,c,u,t]),pt(e,{activeTriggerProps:p.reference??bt,inactiveTriggerProps:p.trigger??bt,popupProps:p.floating??bt,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var UI={...Re,modal:zt(e=>e.modal),nested:zt(e=>e.nested),nestedOpenDialogCount:zt(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:zt(e=>e.nestedOpenDrawerCount),disablePointerDismissal:zt(e=>e.disablePointerDismissal),openMethod:zt(e=>e.openMethod),descriptionElementId:zt(e=>e.descriptionElementId),titleElementId:zt(e=>e.titleElementId),viewportElement:zt(e=>e.viewportElement),role:zt(e=>e.role)},WI=class e extends Wt{constructor(e,t,n=!1){let r=new yt,i=GI(e);i.floatingRootContext=rt(r,t,n),super(i,{popupRef:z.createRef(),backdropRef:z.createRef(),internalBackdropRef:z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:r,onOpenChange:void 0,onOpenChangeComplete:void 0},UI)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};Nt(n,e,t.trigger),this.update(n)};static useStore(t,n){return Xe(t,(t,r)=>new e(n,t,r),!0).store}};function GI(e={}){return{...Dt(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function KI(e,t=`dialog`){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=e,p=t===`drawer`,m=t===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=kI(!0),y={modal:h,disablePointerDismissal:g,nested:!!v,role:_},b=WI.useStore(u?.store,{open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y});Se(()=>{let e=r===void 0&&b.state.open===!1&&i===!0?{open:!0,activeTriggerId:f}:null;m?b.update(e?{...y,...e}:y):e&&b.update(e)}),b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);VI({store:b,actionsRef:l});let w=x||S,T=z.useMemo(()=>({store:b}),[b]);return(0,R.jsx)(DI.Provider,{value:!1,children:(0,R.jsxs)(OI.Provider,{value:T,children:[w&&(0,R.jsx)(HI,{store:b,parentContext:v?.store.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})})}function qI(e){return KI(e,z.useContext(DI)?`drawer`:`dialog`)}var JI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=kI(),c=se(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Ue(`h2`,e,{ref:t,props:[{id:c},o]})}),YI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=kI(!0),f=l?.store??d?.store;if(!f)throw Error(Be(79));let p=se(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=z.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=Pe(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=Ne({disabled:a,native:o}),S=Sn(m,{enabled:m!=null}),C=dn(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return Ue(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[ee]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:Le})}),XI=4,ZI=`h-14`,QI=(0,z.createContext)(null);function $I({className:e}){let t=EI(`x`);return(0,R.jsx)(MI,{render:(0,R.jsxs)(kt,{variant:`ghost`,size:`icon-sm`,className:e,children:[(0,R.jsx)(t,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})}function eL({children:e,open:t,defaultOpen:n,onOpenChange:r,modal:i}){return(0,R.jsx)(qI,{open:t,defaultOpen:n,onOpenChange:e=>r?.(e),modal:i,children:e})}function tL(e){return(0,R.jsx)(YI,{"data-slot":`dialog-trigger`,...e})}var nL=(0,z.forwardRef)(({className:e,children:t,size:n=`sm`,scrollable:r=!1,container:i,...a},o)=>{let s=E(),c=un(),l=Math.min(c+XI,8),[u,d]=(0,z.useState)(!1),f=(0,z.useCallback)(e=>{d(e)},[]);return(0,R.jsxs)(BI,{container:i??void 0,children:[(0,R.jsx)(jI,{render:(e,t)=>{let n=t.transitionStatus===`ending`,{style:r,onDrag:a,onDragStart:o,onDragEnd:s,onAnimationStart:c,onAnimationEnd:l,onAnimationIteration:u,...d}=e;return(0,R.jsx)(F.div,{...d,className:D(i?`absolute`:`fixed`,`inset-0 z-50 bg-black/40 dark:bg-black/80`),initial:{opacity:0},animate:{opacity:+!n},transition:n?Ot.slow.exit:Ot.slow})}}),(0,R.jsx)(zI,{ref:o,render:(o,c)=>{let d=c.transitionStatus===`ending`,{style:p,onDrag:m,onDragStart:h,onDragEnd:g,onAnimationStart:_,onAnimationEnd:v,onAnimationIteration:y,...b}=o;return(0,R.jsx)(F.div,{...b,...a,className:D(i?`absolute`:`fixed`,`left-1/2 top-1/2 z-50 w-[calc(100%-2rem)]`,bn(l),`p-6 focus:outline-none`,n===`sm`&&`max-w-[400px]`,n===`lg`&&`max-w-[540px]`,s.container,r&&`flex flex-col overflow-hidden p-0`,e),style:{...p,...a.style},initial:{opacity:0,scale:.97,x:`-50%`,y:`-50%`},animate:{opacity:+!d,scale:d?.97:1,x:`-50%`,y:`-50%`},transition:d?Ot.slow.exit:Ot.slow,children:(0,R.jsx)(ln,{value:l,children:(0,R.jsxs)(QI.Provider,{value:{scrollable:r,setStickyHeader:f},children:[t,!u&&(0,R.jsx)($I,{className:`absolute right-3 top-3 z-20`})]})})})}})]})});nL.displayName=`DialogContent`;function rL({className:e,sticky:t,children:n,...r}){let i=(0,z.useContext)(QI);return(0,z.useLayoutEffect)(()=>{if(t)return i?.setStickyHeader(!0),()=>i?.setStickyHeader(!1)},[t,i]),t?(0,R.jsxs)(`div`,{className:D(`sticky top-0 z-10 mb-0 flex shrink-0 items-center gap-2 border-b border-border/50 bg-white/50 px-6 backdrop-blur-xs dark:bg-black/50`,ZI,e),...r,children:[n,(0,R.jsx)($I,{className:`ml-auto shrink-0`})]}):(0,R.jsx)(`div`,{className:D(`mb-4 flex flex-col gap-1.5`,i?.scrollable&&`px-6 pt-6`,e),...r,children:n})}function iL({className:e,...t}){return(0,R.jsx)(`div`,{className:D(`flex-1 min-h-0 overflow-y-auto overscroll-none pt-2`,(0,z.useContext)(QI)?.scrollable?`px-6 pb-6`:`-mx-6 px-6`,e),...t})}function aL({className:e,onCopy:t,children:n,...r}){let i=EI(`copy`),a=EI(`check`),[o,s]=(0,z.useState)(!1),c=async()=>{if(t)try{await t(),s(!0),setTimeout(()=>s(!1),2e3)}catch{}};return(0,R.jsxs)(`div`,{className:D(`group/json relative -mx-6 bg-muted/20 px-6 pt-6 pb-4`,e),...r,children:[t?(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10 opacity-0 transition-opacity group-hover/json:opacity-100`,children:(0,R.jsx)(kt,{variant:`ghost`,size:`icon-sm`,onClick:c,title:`Copy`,children:o?(0,R.jsx)(a,{className:`text-green-600`}):(0,R.jsx)(i,{})})}):null,n]})}function oL({className:e,...t}){return(0,R.jsx)(`div`,{className:D(`mt-6 flex justify-end gap-2`,(0,z.useContext)(QI)?.scrollable&&`px-6 pb-6`,e),...t})}var sL=(0,z.forwardRef)(({className:e,...t},n)=>(0,R.jsx)(JI,{ref:n,className:D(`m-0 text-[16px] leading-none text-foreground`,e),style:{fontVariationSettings:`'wght' 700`},...t}));sL.displayName=`DialogTitle`;var cL=(0,z.forwardRef)(({className:e,...t},n)=>(0,R.jsx)(NI,{ref:n,className:D(`text-[13px] text-muted-foreground`,e),...t}));cL.displayName=`DialogDescription`;function lL({headers:e,onChange:t,onSave:n,className:r,title:i=`Custom Headers`,description:a=`Headers with both name and value will be sent`,maxHeaders:o=50}){let[s,c]=(0,z.useState)({}),[l,u]=(0,z.useState)(null),d=(0,z.useRef)({});(0,z.useEffect)(()=>{l&&d.current[l]&&(d.current[l]?.focus(),u(null))},[l,e]);let f=()=>Math.random().toString(36).slice(2,11),p=()=>{if(e.length>=o)return;let n={id:f(),name:``,value:``};t([...e,n])},m=n=>{t(e.filter(e=>e.id!==n))},h=(n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))},g=e=>{c(t=>({...t,[e]:!t[e]}))};return(0,R.jsxs)(`div`,{className:D(`space-y-3`,r),children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-base font-medium`,children:i}),(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr] gap-4 text-sm font-medium text-muted-foreground`,children:[(0,R.jsx)(`div`,{children:`Name`}),(0,R.jsx)(`div`,{children:`Value`})]}),e.length===0?(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr] gap-4 items-center`,children:[(0,R.jsx)(jt,{placeholder:`Authorization`,value:``,onChange:e=>{if(e.target.value.trim()){let n=f();t([{id:n,name:e.target.value,value:``}]),u(n)}},className:`text-sm`,autoComplete:`off`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(jt,{placeholder:`Bearer token...`,value:``,onChange:()=>{},type:`password`,className:`font-mono text-sm`,autoComplete:`off`,disabled:!0}),(0,R.jsx)(kt,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-8 w-8 p-0`,disabled:!0,children:(0,R.jsx)(Zr,{className:`h-4 w-4`})}),(0,R.jsx)(kt,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-8 w-8 p-0`,disabled:!0,children:(0,R.jsx)(Gi,{className:`h-4 w-4`})})]})]}):e.map(e=>(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr] gap-4 items-center`,children:[(0,R.jsx)(jt,{ref:t=>{d.current[e.id]=t},placeholder:`Authorization`,value:e.name,onChange:t=>h(e.id,`name`,t.target.value),className:`text-sm`,autoComplete:`off`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(jt,{placeholder:``,value:e.value,onChange:t=>h(e.id,`value`,t.target.value),type:s[e.id]?`text`:`password`,className:`font-mono text-sm`,autoComplete:`off`}),(0,R.jsx)(kt,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>g(e.id),className:`h-8 w-8 p-0`,children:s[e.id]?(0,R.jsx)(Xr,{className:`h-4 w-4`}):(0,R.jsx)(Zr,{className:`h-4 w-4`})}),(0,R.jsx)(kt,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>m(e.id),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Gi,{className:`h-4 w-4`})})]})]},e.id)),(0,R.jsx)(`div`,{className:`flex justify-start mt-4`,children:(0,R.jsxs)(kt,{type:`button`,variant:`outline`,size:`sm`,onClick:p,disabled:e.length>=o,className:`flex items-center gap-2`,children:[(0,R.jsx)(Ai,{className:`h-4 w-4`}),`Add`]})})]}),n&&(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(kt,{type:`button`,onClick:n,className:`bg-black text-white hover:bg-gray-800`,children:`Save`})})]})}function uL({alias:e,setAlias:t,url:n,setUrl:r,connectionMode:i,setConnectionMode:a,protocolMode:o,setProtocolMode:s,customHeaders:c,setCustomHeaders:l,requestTimeout:u,setRequestTimeout:d,resetTimeoutOnProgress:f,setResetTimeoutOnProgress:p,maxTotalTimeout:m,setMaxTotalTimeout:h,proxyAddress:g,setProxyAddress:_,clientId:v,setClientId:y,clientSecret:b,setClientSecret:x,scope:S,setScope:C,onConnect:w,onSave:T,onCancel:E,variant:ee=`default`,showConnectButton:te=!1,showSaveButton:ne=!1,showExportButton:re=!1,isConnecting:ie=!1,inlineSections:ae=!1,cardSections:O=!1}){let[k,A]=(0,z.useState)(!1),[oe,j]=(0,z.useState)(!1),[se,ce]=(0,z.useState)(!1),M=(0,z.useRef)(!1),N=async()=>{if(!n.trim()){QF.error(`Please enter a URL first`);return}let t={url:n,...e.trim()?{name:e.trim()}:{},transportType:`http`,connectionMode:i,protocolNegotiation:hM(o),connectionType:i===`proxy`?`Via Proxy`:`Direct`,proxyConfig:i===`proxy`&&g.trim()?{proxyAddress:g.trim(),customHeaders:c.reduce((e,t)=>(t.name&&t.value&&(e[t.name]=t.value),e),{})}:void 0,autoProxyFallback:i===`auto`&&g.trim()?{enabled:!0,proxyAddress:g.trim()}:void 0,customHeaders:c.reduce((e,t)=>(t.name&&t.value&&(e[t.name]=t.value),e),{}),requestTimeout:Number.parseInt(u,10),resetTimeoutOnProgress:f===`True`,maxTotalTimeout:Number.parseInt(m,10),oauth:v||S?{clientId:v,...v&&b?{clientSecret:b}:{},scope:S}:void 0};try{await nM(JSON.stringify(t,null,2)),QF.success(`Configuration copied to clipboard`)}catch{QF.error(`Failed to copy configuration to clipboard`)}},le=ee===`styled`,ue=le?`bg-white/10 border-white/20 text-white placeholder:text-white/50`:``,de=le?`text-white/90`:``,fe=le?`bg-white/10 border-white/20 text-white hover:bg-white/20`:``,pe=async e=>{let n=e.clipboardData.getData(`text`);try{let i=JSON.parse(n);if(i.url&&typeof i.url==`string`){e.preventDefault(),r(i.url),t(typeof i.name==`string`&&i.name!==i.url?i.name:``);let n=i.proxyConfig?.proxyAddress||(typeof i.autoProxyFallback==`object`?i.autoProxyFallback.proxyAddress:void 0);a(vM(i.connectionMode,i.connectionType,!!n)),s(gM(i.protocolNegotiation)),n&&_(n);let o=i.proxyConfig?.customHeaders||i.proxyConfig?.headers||i.customHeaders||i.headers||{};Object.keys(o).length>0&&l(Object.entries(o).map(([e,t],n)=>({id:`header-${n}`,name:e,value:String(t)}))),i.requestTimeout&&d(String(i.requestTimeout)),i.resetTimeoutOnProgress!==void 0&&p(i.resetTimeoutOnProgress?`True`:`False`),i.maxTotalTimeout&&h(String(i.maxTotalTimeout)),i.oauth&&(y(i.oauth.clientId||``),x(i.oauth.clientSecret||``),C(i.oauth.scope||``)),QF.success(`Configuration pasted and form populated`)}}catch{}},me=e=>{M.current||e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&e.target.tagName!==`TEXTAREA`&&(e.preventDefault(),w&&n.trim()&&w())},he=(0,R.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[!O&&(0,R.jsx)(`h4`,{className:`text-sm font-medium sm:col-span-2`,children:`OAuth 2.0`}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Client ID`}),(0,R.jsx)(jt,{"data-testid":`auth-dialog-client-id-input`,placeholder:`Client ID`,value:v,onChange:e=>y(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Client Secret`}),(0,R.jsx)(jt,{"data-testid":`auth-dialog-client-secret-input`,type:`password`,placeholder:`Client Secret (optional)`,value:b,onChange:e=>x(e.target.value)}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Stored in your browser's localStorage.`})]}),(0,R.jsxs)(`div`,{className:`space-y-2 sm:col-span-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Scope`}),(0,R.jsx)(jt,{"data-testid":`auth-dialog-scope-input`,placeholder:`Scope (space-separated)`,value:S,onChange:e=>C(e.target.value)})]})]}),ge=(0,R.jsx)(lL,{title:(0,R.jsx)(R.Fragment,{}),headers:c,onChange:l}),_e=(0,R.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Connection Mode`}),(0,R.jsxs)(yn,{value:i,onValueChange:e=>a(e),children:[(0,R.jsx)(pn,{className:`w-full`,"data-testid":`config-dialog-connection-mode-select`,children:(0,R.jsx)(on,{})}),(0,R.jsxs)(gn,{children:[(0,R.jsx)(vn,{value:`auto`,children:`Auto`}),(0,R.jsx)(vn,{value:`direct`,children:`Direct`}),(0,R.jsx)(vn,{value:`proxy`,children:`Proxy`})]})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Auto tries a direct connection first and falls back to the proxy. Direct bypasses the proxy; Proxy always routes through it.`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Protocol`}),(0,R.jsxs)(yn,{value:o,onValueChange:e=>s(e),children:[(0,R.jsx)(pn,{className:`w-full`,"data-testid":`config-dialog-protocol-mode-select`,children:(0,R.jsx)(on,{})}),(0,R.jsxs)(gn,{children:[(0,R.jsx)(vn,{value:`auto`,children:`Auto (recommended)`}),(0,R.jsx)(vn,{value:`v1`,children:`Force v1 (2024/2025)`}),(0,R.jsx)(vn,{value:`v2`,children:`Force v2 (2026-07-28)`})]})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Auto probes for v2 and falls back to the legacy v1 initialize flow. Forced modes fail when the server is incompatible.`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Proxy Endpoint`}),(0,R.jsx)(jt,{"data-testid":`config-dialog-proxy-address-input`,value:g,onChange:e=>_(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Request Timeout`}),(0,R.jsx)(jt,{"data-testid":`config-dialog-request-timeout-input`,type:`number`,value:u,onChange:e=>d(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Maximum Total Timeout`}),(0,R.jsx)(jt,{"data-testid":`config-dialog-max-timeout-input`,type:`number`,value:m,onChange:e=>h(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Reset Timeout on Progress`}),(0,R.jsxs)(yn,{value:f,onValueChange:p,children:[(0,R.jsx)(pn,{className:`w-full`,"data-testid":`config-dialog-reset-timeout-select`,children:(0,R.jsx)(on,{})}),(0,R.jsxs)(gn,{children:[(0,R.jsx)(vn,{value:`True`,children:`True`}),(0,R.jsx)(vn,{value:`False`,children:`False`})]})]})]})]}),ve=(0,R.jsxs)(`div`,{className:ae||O?`grid gap-4 sm:grid-cols-2`:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:de,children:`Alias`}),(0,R.jsx)(jt,{"data-testid":`connection-form-alias-input`,placeholder:`Optional server alias`,value:e,onChange:e=>t(e.target.value),className:ue})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:de,children:`URL`}),(0,R.jsx)(jt,{"data-testid":`connection-form-url-input`,placeholder:`http://localhost:3000`,value:n,onChange:e=>r(e.target.value),onPaste:pe,className:ue}),(0,R.jsx)(`p`,{className:D(`text-xs text-muted-foreground`,le?`text-white/60`:``),children:`Tip: You can paste a copied connection config (JSON) to auto-populate the form`})]})]}),ye={onCompositionStart:()=>{M.current=!0},onCompositionEnd:()=>{M.current=!1},onKeyDown:me},be=re?(0,R.jsxs)(kt,{"data-testid":`connection-form-copy-config-button`,variant:`ghost`,onClick:N,className:D(le?`absolute top-0 right-0 z-10 text-white hover:bg-white/20 dark:hover:bg-white/20`:`w-full`,!le&&`mb-2`),children:[(0,R.jsx)(Wr,{className:`mr-2 h-4 w-4`}),`Copy Config`]}):null;return ae&&O?(0,R.jsxs)(`div`,{className:`relative space-y-6 @container`,...ye,children:[be,(0,R.jsxs)(yI,{className:`border`,children:[(0,R.jsxs)(bI,{children:[(0,R.jsx)(xI,{className:`text-base font-medium`,children:`Endpoint`}),(0,R.jsx)(SI,{children:`MCP server URL and display alias`})]}),(0,R.jsx)(CI,{className:`pt-0`,children:ve})]}),(0,R.jsxs)(yI,{className:`border`,children:[(0,R.jsxs)(bI,{children:[(0,R.jsx)(xI,{className:`text-base font-medium`,children:`Authentication`}),(0,R.jsx)(SI,{children:`OAuth 2.0 client credentials`})]}),(0,R.jsx)(CI,{className:`pt-0`,children:he})]}),(0,R.jsxs)(yI,{className:`border`,children:[(0,R.jsxs)(bI,{children:[(0,R.jsx)(xI,{className:`text-base font-medium`,children:`Custom Headers`}),(0,R.jsx)(SI,{children:`Extra HTTP headers sent with MCP requests`})]}),(0,R.jsx)(CI,{className:`pt-0`,children:ge})]}),(0,R.jsxs)(yI,{className:`border`,children:[(0,R.jsxs)(bI,{children:[(0,R.jsx)(xI,{className:`text-base font-medium`,children:`Configuration`}),(0,R.jsx)(SI,{children:`Connection mode, proxy, and request timeouts`})]}),(0,R.jsx)(CI,{className:`pt-0`,children:_e})]})]}):(0,R.jsxs)(`div`,{className:`relative space-y-4 @container`,...ye,children:[!ae&&(0,R.jsx)(`h3`,{className:`mb-4 text-xl font-semibold text-white`,children:`Connect`}),be,ve,ae&&!O&&(0,R.jsxs)(`div`,{className:`space-y-8 pt-2`,children:[(0,R.jsxs)(`section`,{className:`space-y-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Authentication`}),he]}),(0,R.jsxs)(`section`,{className:`space-y-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Custom Headers`}),ge]}),(0,R.jsxs)(`section`,{className:`space-y-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Configuration`}),_e]})]}),!ae&&(0,R.jsxs)(`div`,{className:`flex flex-row gap-3 @lg:flex-col`,children:[(0,R.jsxs)(eL,{open:oe,onOpenChange:j,children:[(0,R.jsx)(tL,{render:(0,R.jsx)(`div`,{className:`relative flex-1 `,children:(0,R.jsxs)(kt,{"data-testid":`connection-form-auth-button`,variant:`outline`,className:D((v||b||S)&&`border-2`,`w-full justify-center hover:text-white cursor-pointer`,fe),children:[(0,R.jsx)(Li,{className:`w-4 h-4 mr-0`}),`Authentication`]})}),nativeButton:!1}),(0,R.jsxs)(nL,{scrollable:!0,className:`w-[calc(100vw-2rem)] sm:w-full max-w-2xl max-h-[80vh]`,children:[(0,R.jsx)(rL,{children:(0,R.jsx)(sL,{children:`Authentication`})}),(0,R.jsxs)(iL,{className:`space-y-4`,children:[he,(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(kt,{onClick:()=>j(!1),children:`Save`})})]})]})]}),(0,R.jsxs)(eL,{open:k,onOpenChange:A,children:[(0,R.jsx)(tL,{render:(0,R.jsx)(`div`,{className:`relative flex-1 `,children:(0,R.jsxs)(kt,{"data-testid":`connection-form-headers-button`,variant:`outline`,className:D(`w-full justify-center hover:text-white cursor-pointer`,fe),children:[(0,R.jsx)(Qr,{className:`w-4 h-4`}),`Custom Headers`]})}),nativeButton:!1}),(0,R.jsxs)(nL,{scrollable:!0,className:`w-full max-w-2xl max-h-[80vh]`,children:[(0,R.jsx)(rL,{children:(0,R.jsx)(sL,{children:`Custom Headers`})}),(0,R.jsx)(iL,{children:(0,R.jsx)(lL,{title:(0,R.jsx)(R.Fragment,{}),headers:c,onChange:l,onSave:()=>A(!1)})})]})]}),(0,R.jsxs)(eL,{open:se,onOpenChange:ce,children:[(0,R.jsx)(tL,{render:(0,R.jsxs)(kt,{"data-testid":`connection-form-config-button`,variant:`outline`,className:D(`flex-1 justify-center hover:text-white cursor-pointer`,fe),children:[(0,R.jsx)(Hr,{className:`w-4 h-4`}),`Configuration`]}),nativeButton:!0}),(0,R.jsxs)(nL,{scrollable:!0,className:`w-full max-w-2xl max-h-[80vh]`,children:[(0,R.jsx)(rL,{children:(0,R.jsx)(sL,{children:`Configuration`})}),(0,R.jsxs)(iL,{className:`space-y-4`,children:[_e,(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(kt,{onClick:()=>ce(!1),children:`Save`})})]})]})]})]}),te&&(0,R.jsx)(kt,{"data-testid":`connection-form-connect-button`,onClick:w,disabled:!n.trim()||ie,size:le?`lg`:void 0,className:D(`w-full font-semibold`,le?`rounded-full text-black [&_[aria-hidden]]:bg-white hover:[&_[aria-hidden]]:bg-white/90 group-active:[&_[aria-hidden]]:bg-white/80`:``),children:ie?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`svg`,{className:`w-4 h-4 mr-2 animate-spin`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15`})}),`Connecting...`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`svg`,{className:`w-4 h-4 mr-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M13 10V3L4 14h7v7l9-11h-7z`})}),`Connect`]})}),ne&&(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[E&&(0,R.jsx)(kt,{variant:`outline`,onClick:E,children:`Cancel`}),(0,R.jsx)(kt,{"data-testid":`connection-form-save-button`,onClick:T,children:`Save Connection Options`})]})]})}function dL({children:e,className:t,variant:n,duration:r=.4,delay:i=0,offset:a=6,direction:o=`down`,inView:s=!1,inViewMargin:c=`-50px`,blur:l=`6px`,...u}){let d=(0,z.useRef)(null),f=Ma(d,{once:!0,margin:c}),p=!s||f,m={hidden:{[o===`left`||o===`right`?`x`:`y`]:o===`right`||o===`down`?-a:a,opacity:0,filter:`blur(${l})`},visible:{[o===`left`||o===`right`?`x`:`y`]:0,opacity:1,filter:`blur(0px)`}},h=n||m;return(0,R.jsx)(en,{children:(0,R.jsx)(F.div,{ref:d,initial:`hidden`,animate:p?`visible`:`hidden`,exit:`hidden`,variants:h,transition:{delay:.04+i,duration:r,ease:`easeOut`},className:t,...u,children:e})})}function fL({className:e,...t}){return(0,R.jsx)(fi,{role:`status`,"aria-label":`Loading`,className:D(`size-4 animate-spin`,e),...t})}function pL({server:e,className:t,size:n=`md`}){let[r,i]=(0,z.useState)(!0),[a,o]=(0,z.useState)(!1),s={sm:`w-6 h-6`,md:`w-8 h-8`,lg:`w-12 h-12`,xs:`w-4 h-4`},c=(()=>{let t=e.serverInfo?.icons;return t&&Array.isArray(t)&&t.length>0?t[0].src:e.serverInfo?.icon?e.serverInfo.icon:null})();(0,z.useEffect)(()=>{i(c!==null),o(!1)},[c]);let l=pM(e);return!c||a?(0,R.jsx)(dL,{delay:.05,offset:0,children:(0,R.jsx)(lo,{className:D(`flex items-center justify-center rounded-full overflow-hidden`,s[n],t)})}):(0,R.jsx)(dL,{delay:.05,offset:0,children:(0,R.jsxs)(`div`,{className:D(`rounded-md overflow-hidden flex items-center justify-center bg-white dark:bg-zinc-800 relative`,s[n],t),children:[r&&(0,R.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-zinc-100/80 dark:bg-zinc-800/80`,children:(0,R.jsx)(fL,{})}),(0,R.jsx)(`img`,{src:c,alt:l,className:D(`object-contain`,s[n]),onLoad:()=>i(!1),onError:()=>{i(!1),o(!0)},style:{imageRendering:`-webkit-optimize-contrast`,display:r?`none`:`block`}})]})})}var mL=`mcp-inspector-connect-panel-mesh-animation-paused`,hL=[`#e0eaff`,`#f9ffbd`,`#dedede`,`#ffffff`];function gL(){let{servers:e,addServer:t,removeServer:n}=wj(),r=(0,z.useRef)(new Set);(0,z.useEffect)(()=>{e.forEach(e=>{if(e.state===`ready`&&!r.current.has(e.id)){r.current.add(e.id);try{OT(new yo({serverId:e.id,serverUrl:e.url??``,success:!0,connectionType:`http`})).catch(()=>{})}catch{}}else e.state===`failed`&&r.current.has(e.id)&&r.current.delete(e.id)})},[e]);let i=(0,z.useCallback)(e=>{try{OT(new So({serverId:e})).catch(()=>{})}catch{}r.current.delete(e),n(e,{clearCredentials:!0})},[n]),[a,o]=(0,z.useState)(new Set),s=(0,z.useRef)(new Set);(0,z.useEffect)(()=>{s.current=a},[a]);let c=(0,z.useCallback)(async t=>{if(s.current.has(t)){console.warn(`[InspectorDashboard] Connection ${t} is already being reconnected, skipping`);return}let n=e.find(e=>e.id===t);if(n){o(e=>new Set(e).add(t));try{await n.reconnect()}catch(e){console.error(`[InspectorDashboard] Failed to reconnect server ${t}:`,e)}finally{o(e=>{let n=new Set(e);return n.delete(t),n})}}},[e]),l=$N(),u=XN(),[d,f]=(0,z.useState)(new Set),[p,m]=(0,z.useState)(null);(0,z.useEffect)(()=>{kT({connectionCount:e.length}).catch(()=>{})},[]);let[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(`auto`),[x,S]=(0,z.useState)(`auto`),[C,w]=(0,z.useState)([]),[T,E]=(0,z.useState)(`10000`),[ee,te]=(0,z.useState)(`True`),[ne,re]=(0,z.useState)(`60000`),[ie,ae]=(0,z.useState)(_M()),[D,O]=(0,z.useState)(``),[k,A]=(0,z.useState)(``),[oe,j]=(0,z.useState)(``),se=(0,z.useRef)(null),[M,N]=(0,z.useState)(()=>{try{return localStorage.getItem(mL)===`true`}catch{return!1}}),le=(0,z.useCallback)(()=>{N(e=>{let t=!e;try{localStorage.setItem(mL,t?`true`:`false`)}catch{}return t})},[]),ue=(0,z.useCallback)(()=>{if(!_.trim())return;let e=_.trim();try{let t=new URL(e);if(!(t.protocol===`http:`||t.protocol===`https:`)){QF.error(`Invalid URL protocol. Please use http:// or https://`);return}}catch{try{let t=`https://${e}`,n=new URL(t);if(!(n.protocol===`http:`||n.protocol===`https:`)){QF.error(`Invalid URL protocol. Please use http:// or https://`);return}e=t}catch{QF.error(`Invalid URL format. Please enter a valid URL.`);return}}let n=C.reduce((e,t)=>(t.name&&t.value&&(e[t.name]=t.value),e),{}),r=y===`proxy`&&ie.trim()?{proxyAddress:ie.trim(),headers:n}:void 0,i=y===`auto`&&ie.trim()?{enabled:!0,proxyAddress:ie.trim()}:!1,a=CM(D,k,oe),o={url:e,displayName:h.trim()||e,connectionMode:y,protocolNegotiation:hM(x),autoProxyFallback:i,...r?{proxyConfig:r}:{},...Object.keys(n).length>0&&!r?{headers:n}:{},...a?{oauth:a}:{}};t(e,o),OT(new xo({serverId:_.trim(),serverUrl:_.trim(),connectionType:`http`,viaProxy:!!r?.proxyAddress})).catch(()=>{}),g(``),v(``),w([]),b(`auto`),S(`auto`),O(``),A(``),j(``),QF.success(`Server added successfully`)},[_,h,y,x,ie,C,D,k,oe,t]),de=()=>{e.forEach(e=>{i(e.id)})},fe=async e=>{try{await nM(e),QF.success(`Error message copied to clipboard`)}catch{QF.error(`Failed to copy error message`)}},pe=async e=>{try{let t=DM(e,OM(e.id));await nM(JSON.stringify(t,null,2)),QF.success(`Connection configuration copied to clipboard`)}catch{QF.error(`Failed to copy connection configuration`)}},me=(e,t)=>{e.stopPropagation(),t()},he=(e,t)=>{let n=new URLSearchParams(u.search).get(`tunnelUrl`),r=new URLSearchParams;r.set(`server`,e.id),r.set(`tab`,t),n&&r.set(`tunnelUrl`,n),l(`/?${r.toString()}`)},ge=e=>{if(e.state===`failed`)return;let t=new URLSearchParams(u.search),n=t.get(`tunnelUrl`),r=t.get(`tab`),i=new URLSearchParams;i.set(`server`,e.id),n&&i.set(`tunnelUrl`,n),r&&i.set(`tab`,r),l(`/?${i.toString()}`)},_e=e=>{console.log(`[InspectorDashboard] Reconnecting server:`,e.id),e.state===`failed`&&e.retry?e.retry():c(e.id)};return(0,z.useEffect)(()=>{f(t=>{let n=new Set(t),r=!1;return t.forEach(t=>{let i=e.find(e=>e.id===t);i&&(i.state===`ready`||i.state===`failed`)&&(n.delete(t),r=!0)}),r?n:t})},[e]),(0,z.useEffect)(()=>{if(!p)return;let t=e.find(e=>e.id===p),n=(t?.tools?.length||0)>0||(t?.resources?.length||0)>0||(t?.prompts?.length||0)>0;if(t&&(t.state===`ready`||n&&t.state!==`discovering`)){m(null);let e=new URLSearchParams(u.search),n=e.get(`tunnelUrl`),r=e.get(`tab`),i=new URLSearchParams;i.set(`server`,t.id),n&&i.set(`tunnelUrl`,n),r&&i.set(`tab`,r),l(`/?${i.toString()}`)}else t&&t.state===`failed`&&!n&&t.error&&(console.warn(`[InspectorDashboard] Connection failed with no data, canceling navigation`),m(null))},[e,p,l]),(0,R.jsxs)(`div`,{className:`flex flex-col lg:flex-row items-start justify-start gap-4 h-auto lg:h-full relative`,children:[(0,R.jsxs)(`div`,{className:`w-full px-3 pt-6 sm:px-6 sm:pt-3 overflow-visible lg:overflow-auto`,children:[(0,R.jsxs)(`div`,{className:`flex mb-3 md:mb-0 flex-col sm:flex-row items-center sm:items-center gap-3 relative z-10`,children:[(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-block order-1 sm:order-2`,children:(0,R.jsxs)(ce,{variant:`secondary`,className:`text-xs cursor-pointer hover:bg-secondary/80 transition-colors`,children:[`v`,jo()]})}),nativeButton:!1}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:`Visit GitHub`})})]}),(0,R.jsx)(`h2`,{className:`text-2xl font-medium tracking-tight text-center sm:text-left order-2 sm:order-1`,children:`MCP Inspector`})]}),(0,R.jsx)(`p`,{className:`text-muted-foreground relative z-10 text-center sm:text-left`,children:`Inspect and debug MCP (Model Context Protocol) servers`}),(0,R.jsxs)(`div`,{className:`space-y-4 mt-4 sm:mt-8`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center sm:items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`hidden sm:block text-base font-medium text-center sm:text-left`,children:`Connected Servers`}),(0,R.jsx)(`div`,{className:`hidden sm:flex items-center gap-3 justify-center sm:justify-start`,children:e.length>0&&(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,onClick:de,children:`Clear All`})})]}),e.length===0?(0,R.jsx)(ro,{message:`No servers connected yet. Add a server above to get started.`}):(0,R.jsx)(`div`,{className:`grid gap-3`,children:e.map(e=>(0,R.jsxs)(`div`,{"data-testid":`server-tile-${e.id}`,onClick:()=>ge(e),className:`group rounded-lg bg-zinc-100 dark:bg-white/10 p-4 transition-colors ${e.state===`ready`?`hover:bg-zinc-200 dark:hover:bg-white/15 cursor-pointer`:``}`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(pL,{server:e,size:`md`}),(0,R.jsx)(`h4`,{className:`font-semibold text-sm`,children:pM(e)}),(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:a.has(e.id)?(0,R.jsx)(fi,{className:`w-3 h-3 animate-spin text-blue-500`}):e.error&&e.state!==`ready`?(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`button`,{type:`button`,"data-testid":`server-tile-status-${e.state}`,onClick:t=>{t.stopPropagation(),fe(e.error)},className:`w-2 h-2 rounded-full transition-colors ${(e.error.includes(`401`)||e.error.includes(`Unauthorized`))&&e.error.includes(`does not support OAuth`)?`bg-yellow-500 animate-status-pulse-yellow hover:bg-yellow-600`:`bg-rose-500 animate-status-pulse-red hover:bg-rose-600`}`,title:`Click to copy error message`,"aria-label":`Copy error message to clipboard`}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{className:`max-w-xs`,children:e.error})})]}):(0,R.jsx)(`div`,{"data-testid":`server-tile-status-${e.state}`,className:`w-2 h-2 rounded-full ${e.state===`ready`?`bg-emerald-600 animate-status-pulse`:e.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground dark:text-zinc-400 font-mono`,children:e.url}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`button`,{type:`button`,onClick:async t=>{t.stopPropagation();try{await nM(e.url??``),QF.success(`URL copied to clipboard`)}catch{QF.error(`Failed to copy URL`)}},className:`opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded`,title:`Copy URL`,children:(0,R.jsx)(Wr,{className:`w-3 h-3 text-muted-foreground`})}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:`Copy URL`})})]})]})]}),(0,R.jsxs)(`div`,{className:`hidden lg:flex items-center gap-1 flex-shrink-0`,children:[(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(kt,{"data-testid":`server-tile-copy-config`,variant:`secondary`,size:`sm`,onClick:t=>me(t,()=>pe(e)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Wr,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:`Copy connection config`})})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(kt,{"data-testid":`server-tile-info`,variant:`secondary`,size:`sm`,onClick:t=>me(t,()=>he(e,`server-metadata`)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(si,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:`View server info`})})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(kt,{"data-testid":`server-tile-settings`,variant:`secondary`,size:`sm`,onClick:t=>me(t,()=>he(e,`connection-settings`)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Ii,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:`Edit connection settings`})})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(kt,{"data-testid":`server-tile-remove`,variant:`secondary`,size:`sm`,onClick:t=>me(t,()=>i(e.id)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Rr,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:`Remove connection`})})]}),(e.state===`ready`||e.state===`failed`||e.state===`discovering`)&&(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(kt,{"data-testid":`server-tile-reconnect`,variant:`secondary`,size:`sm`,onClick:t=>me(t,()=>_e(e)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Ni,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:e.state===`failed`?`Retry connection`:e.state===`discovering`?`Reconnect`:`Resync connection`})})]})]}),(0,R.jsx)(`div`,{className:`lg:hidden flex-shrink-0`,children:(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:e=>e.stopPropagation(),children:(0,R.jsx)(Jr,{className:`h-4 w-4`})}),nativeButton:!0}),(0,R.jsxs)(Za,{align:`end`,children:[(0,R.jsxs)($a,{onClick:t=>{t.stopPropagation(),pe(e)},children:[(0,R.jsx)(Wr,{className:`h-4 w-4 mr-2`}),`Copy connection config`]}),(0,R.jsxs)($a,{onClick:t=>{t.stopPropagation(),he(e,`server-metadata`)},children:[(0,R.jsx)(si,{className:`h-4 w-4 mr-2`}),`View server info`]}),(0,R.jsxs)($a,{onClick:t=>{t.stopPropagation(),he(e,`connection-settings`)},children:[(0,R.jsx)(Ii,{className:`h-4 w-4 mr-2`}),`Edit connection settings`]}),(e.state===`ready`||e.state===`failed`||e.state===`discovering`)&&(0,R.jsxs)($a,{onClick:t=>{t.stopPropagation(),_e(e)},children:[(0,R.jsx)(Ni,{className:`h-4 w-4 mr-2`}),e.state===`failed`?`Retry connection`:e.state===`discovering`?`Reconnect`:`Resync connection`]}),(0,R.jsxs)($a,{onClick:t=>{t.stopPropagation(),i(e.id)},className:`text-destructive focus:text-destructive`,children:[(0,R.jsx)(Rr,{className:`h-4 w-4 mr-2`}),`Remove connection`]})]})]})})]}),(e.state===`pending_auth`||e.state===`authenticating`)&&(0,R.jsx)(`div`,{className:`text-sm text-yellow-600 dark:text-yellow-400 mt-2`,children:e.state===`authenticating`?(0,R.jsxs)(kt,{size:`sm`,className:`bg-yellow-500/20 border-0 dark:bg-yellow-400/10 text-yellow-800 dark:text-yellow-500`,variant:`outline`,disabled:!0,children:[(0,R.jsx)(fi,{className:`mr-2 h-4 w-4 animate-spin`}),`Authenticating...`]}):e.authUrl?(0,R.jsx)(kt,{"data-testid":`server-tile-authenticate`,size:`sm`,className:`bg-yellow-500/20 border-0 dark:bg-yellow-400/10 text-yellow-800 dark:text-yellow-500`,variant:`outline`,render:(0,R.jsx)(`a`,{href:e.authUrl,onClick:t=>{t.stopPropagation();try{sessionStorage.setItem(`__mcpUseInspectorReconnect`,JSON.stringify({url:e.url,name:e.name||`Auto-connected Server`,transportType:e.transportType||`http`,connectionMode:`auto`}))}catch{}}}),nativeButton:!1,children:`Authenticate`}):null}),e.state===`failed`&&e.error&&(e.error.includes(`401`)||e.error.includes(`Unauthorized`))&&e.error.includes(`does not support OAuth`)&&(0,R.jsx)(`div`,{className:`text-sm mt-2 p-2 bg-yellow-500/10 dark:bg-yellow-400/10 border border-yellow-500/20 dark:border-yellow-400/20 rounded text-yellow-800 dark:text-yellow-400`,children:e.error})]},e.id))})]})]}),(0,R.jsxs)(`div`,{ref:se,className:`w-full relative overflow-hidden h-auto lg:h-full py-4 px-4 sm:py-6 sm:px-6 lg:p-10 items-center justify-center flex`,children:[(0,R.jsx)(`div`,{className:`absolute inset-0 z-0 overflow-hidden dark:opacity-60 pointer-events-none`,children:(0,R.jsx)(mo,{className:`h-full w-full`,colors:hL,distortion:.8,swirl:.1,grainMixer:0,grainOverlay:.2,speed:+!M})}),(0,R.jsx)(`div`,{className:`absolute inset-0 z-[1] pointer-events-none opacity-[0.07] mix-blend-soft-light dark:opacity-[0.06]`,"aria-hidden":!0,children:(0,R.jsx)(`div`,{className:`absolute inset-0 noise`,style:{background:`url("${oo}")`,filter:`contrast(150%) brightness(550%)`}})}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`button`,{type:`button`,onClick:le,"aria-label":M?`Enable background shader animation`:`Disable background shader animation`,className:`absolute bottom-3 right-3 sm:bottom-5 sm:right-5 z-[8] flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border border-zinc-500/60 bg-transparent text-zinc-600 transition-colors hover:border-zinc-500 hover:text-zinc-800 dark:border-zinc-500/50 dark:text-zinc-400 dark:hover:border-zinc-400 dark:hover:text-zinc-200`,children:M?(0,R.jsx)(ki,{className:`h-3 w-3 ml-px`,fill:`currentColor`}):(0,R.jsx)(Vi,{className:`h-2.5 w-2.5`,fill:`currentColor`})}),nativeButton:!0}),(0,R.jsx)(wt,{side:`left`,children:(0,R.jsx)(`p`,{children:M?`Enable shader animation`:`Disable shader animation`})})]}),(0,R.jsx)(`div`,{className:`relative w-full max-w-xl mx-auto z-10 flex flex-col gap-3 rounded-3xl p-4 sm:p-6 bg-black/70 dark:bg-black/90 shadow-2xl shadow-black/50 backdrop-blur-md`,children:(0,R.jsx)(uL,{alias:h,setAlias:g,url:_,setUrl:v,connectionMode:y,setConnectionMode:b,protocolMode:x,setProtocolMode:S,customHeaders:C,setCustomHeaders:w,requestTimeout:T,setRequestTimeout:E,resetTimeoutOnProgress:ee,setResetTimeoutOnProgress:te,maxTotalTimeout:ne,setMaxTotalTimeout:re,proxyAddress:ie,setProxyAddress:ae,clientId:D,setClientId:O,clientSecret:k,setClientSecret:A,scope:oe,setScope:j,onConnect:ue,variant:`styled`,showConnectButton:!0,showExportButton:!0})})]})]})}var _L=(0,z.createContext)(void 0);function vL({children:e}){let t=(typeof window<`u`?window.__MANUFACT_CHAT_URL__:void 0)??void 0,[n,r]=(0,z.useState)({selectedServerId:null,activeTab:`tools`,selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null,tunnelUrl:null,isTunnelStarting:!1,isEmbedded:!1,embeddedConfig:t?{chatApiUrl:t,chatStreamProtocol:`data-stream`,chatEnableFreeTierUpgrade:!0}:{}}),i=(0,z.useCallback)(e=>{r(t=>({...t,selectedServerId:e}))},[]),a=(0,z.useCallback)(e=>{r(t=>({...t,activeTab:e}))},[]),o=(0,z.useCallback)(e=>{r(t=>({...t,selectedToolName:e}))},[]),s=(0,z.useCallback)(e=>{r(t=>({...t,selectedPromptName:e}))},[]),c=(0,z.useCallback)(e=>{r(t=>({...t,selectedResourceUri:e}))},[]),l=(0,z.useCallback)(e=>{r(t=>({...t,selectedSamplingRequestId:e}))},[]),u=(0,z.useCallback)(e=>{r(t=>({...t,selectedElicitationRequestId:e}))},[]),d=(0,z.useCallback)(e=>{r(t=>({...t,tunnelUrl:e}))},[]),f=(0,z.useCallback)(e=>{r(t=>({...t,isTunnelStarting:e}))},[]),p=(0,z.useCallback)((e,t={})=>{r(n=>({...n,isEmbedded:e,embeddedConfig:t}))},[]),m=(0,z.useCallback)((e,t,n)=>{console.warn(`[InspectorContext] navigateToItem called:`,{serverId:e,tab:t,itemIdentifier:n}),r(r=>({...r,selectedServerId:e,activeTab:t,selectedToolName:t===`tools`&&n||null,selectedPromptName:t===`prompts`&&n||null,selectedResourceUri:t===`resources`&&n||null,selectedSamplingRequestId:t===`sampling`&&n||null,selectedElicitationRequestId:t===`elicitation`&&n||null}))},[]),h=(0,z.useCallback)(()=>{r(e=>({...e,selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null}))},[]);return(0,R.jsx)(_L,{value:{...n,setSelectedServerId:i,setActiveTab:a,setSelectedToolName:o,setSelectedPromptName:s,setSelectedResourceUri:c,setSelectedSamplingRequestId:l,setSelectedElicitationRequestId:u,setTunnelUrl:d,setIsTunnelStarting:f,setEmbeddedMode:p,navigateToItem:m,clearSelection:h},children:e})}function yL(){let e=(0,z.use)(_L);if(!e)throw Error(`useInspector must be used within InspectorProvider`);return e}function bL(e){(0,z.useEffect)(()=>{let t=t=>{let n=t.target,r=n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.contentEditable===`true`;if((t.metaKey||t.ctrlKey)&&t.key===`k`){t.preventDefault(),e.onCommandPalette?.();return}if((t.metaKey||t.ctrlKey)&&t.key===`o`&&e.onNewChat){t.preventDefault(),e.onNewChat();return}if(t.key===`Escape`){t.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),e.onBlurSearch?.();return}if(!r&&!(t.metaKey||t.ctrlKey||t.altKey||t.shiftKey))switch(t.key.toLowerCase()){case`t`:t.preventDefault(),e.onToolsTab?.();break;case`p`:t.preventDefault(),e.onPromptsTab?.();break;case`r`:t.preventDefault(),e.onResourcesTab?.();break;case`c`:t.preventDefault(),e.onChatTab?.();break;case`h`:t.preventDefault(),e.onHome?.();break;case`f`:t.preventDefault(),e.onFocusSearch?.();break;default:break}};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e])}var xL=`mcp-inspector-saved-requests`;function SL(){let[e,t]=(0,z.useState)([]);return(0,z.useEffect)(()=>{try{let e=localStorage.getItem(xL);e&&t(JSON.parse(e))}catch(e){console.error(`[useSavedRequests] Failed to load saved requests:`,e)}},[]),(0,z.useEffect)(()=>{let e=e=>{if(e.key===xL&&e.newValue)try{t(JSON.parse(e.newValue))}catch(e){console.error(`[useSavedRequests] Failed to parse saved requests:`,e)}};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),{savedRequests:e,saveSavedRequests:(0,z.useCallback)(e=>{try{localStorage.setItem(xL,JSON.stringify(e)),t(e)}catch(e){console.error(`[useSavedRequests] Failed to save requests:`,e)}},[])}}function CL(e){return e.replace(/[^a-zA-Z0-9-_]/g,`_`).toLowerCase()}function wL(e){return`'${e.replace(/'/g,`'\\''`)}'`}function TL(e){return e.replace(/[^a-zA-Z0-9]/g,`_`).toUpperCase().replace(/^_+|_+$/g,``)}function EL(e,t,n){let r={url:e};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`{{${TL(t)}}}`;r.headers=e}let i=JSON.stringify(r);return`cursor://anysphere.cursor-deeplink/mcp/install?config=${btoa(i)}&name=${encodeURIComponent(CL(t))}`}function DL(e,t,n){let r={url:e,name:CL(t),type:`http`};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TL(t)}-value`;r.headers=e}let i=JSON.stringify(r);return`vscode:mcp/install?${encodeURIComponent(i)}`}function OL(e,t,n){let r={url:e,name:CL(t),type:`http`};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TL(t)}-value`;r.headers=e}let i=JSON.stringify(r);return`vscode-insiders:mcp/install?${encodeURIComponent(i)}`}function kL(e,t,n){let r={url:e,name:CL(t)};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TL(t)}-value`;r.headers=e}return r}function AL(e,t,n){try{let r=kL(e,t,n),i=JSON.stringify(r,null,2),a=globalThis.Blob,o=new a([i],{type:`application/json`}),s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=`${CL(t)}.mcpb`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(s)}catch(e){throw console.error(`Failed to download .mcpb file:`,e),e}}function jL(e,t,n){let r=`claude mcp add --transport http "${CL(t)}" \\\n ${wL(e)}`,i=[];if(n&&Object.keys(n).length>0)for(let[e]of Object.entries(n)){let t=TL(e);r+=` \\\n --header ${wL(`${e}:\${${t}}`)}`,i.push({name:t,header:e})}return{command:r,envVars:i}}function ML(e,t,n){let r=`gemini mcp add --transport http "${CL(t)}" ${wL(e)}`,i=[];if(n&&Object.keys(n).length>0)for(let[e]of Object.entries(n)){let t=TL(e);r+=` \\\n --header ${wL(`${e}:\${${t}}`)}`,i.push({name:t,header:e})}return{command:r,envVars:i}}function NL(e,t,n){let r=`[mcp_servers.${CL(t)}]\nurl = "${e}"`,i=[];if(n&&Object.keys(n).length>0){let e=[];for(let[t]of Object.entries(n)){let n=TL(t);e.push(`"${t}" = "your-${n}-value"`),i.push({name:n,header:t})}if(r+=`\nhttp_headers = { ${e.join(`, `)} }`,i.length>0){r+=`
|
|
488
488
|
|
|
489
489
|
# (optional) Use environment variables instead:
|
|
490
490
|
# env_http_headers = { `;let e=i.map(({name:e,header:t})=>`"${t}" = "${e}"`);r+=e.join(`, `),r+=` }`}}return{config:r,envVars:i}}function PL(e){if(e.length===0)return``;let t=`Set these environment variables in your shell:
|
|
491
491
|
|
|
492
|
-
`;for(let{name:n}of e)t+=`export ${n}="your-${n}-value"\n`;return t}function FL({className:e,size:t=`md`}){return(0,R.jsxs)(`svg`,{viewBox:`0 0 500 500`,className:D(`text-current`,{sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`}[t],e),fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`}),(0,R.jsx)(`circle`,{cx:`100.426`,cy:`399.575`,r:`100.426`}),(0,R.jsx)(`path`,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`})]})}function IL({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,R.jsx)(`path`,{d:`M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`})})}function LL({className:e}){return(0,R.jsxs)(`svg`,{fill:`currentColor`,fillRule:`evenodd`,viewBox:`0 0 24 24`,className:e,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`ModelContextProtocol`,children:[(0,R.jsx)(`path`,{d:`M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z`}),(0,R.jsx)(`path`,{d:`M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z`})]})}function RL({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 -28.5 256 256`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,R.jsx)(`path`,{d:`M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z`,fillRule:`nonzero`})})}function zL({isOpen:e,onOpenChange:t,tools:n,prompts:r,resources:i,savedRequests:a,connections:o,selectedServer:s,tunnelUrl:c,onNavigate:l,onServerSelect:u}){let[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(0),h=(0,z.useRef)(null),g=(0,z.useRef)(null),_=$N(),v=S.pill,{activeIndex:y,itemRects:b,sessionRef:x,handlers:w,registerItem:T,measureItems:E}=_n(h),ee=s?c?`${c}/mcp`:s.url:null,te=s?.name||`MCP Server`,ne=s?wM(s):void 0,re=s?[{id:`open-in-cursor`,name:`Open in Cursor`,description:`Add this server to Cursor`,type:`global`,category:`Open in Client`,action:()=>{try{let e=EL(ee,te,ne);window.location.href=e,QF.success(`Opening in Cursor...`),t(!1)}catch{QF.error(`Failed to open in Cursor`)}}},{id:`open-in-claude-code`,name:`Open in Claude Code`,description:`Add this server to Claude Code CLI`,type:`global`,category:`Open in Client`,action:()=>{let{command:e}=jL(ee,te,ne);nM(e),QF.success(`Command copied to clipboard`),t(!1)}},{id:`open-in-claude-desktop`,name:`Open in Claude Desktop`,description:`Download .mcpb configuration file`,type:`global`,category:`Open in Client`,action:()=>{try{AL(ee,te,ne),QF.success(`Downloaded .mcpb file`),t(!1)}catch{QF.error(`Failed to download configuration file`)}}},{id:`open-in-vscode`,name:`Open in VS Code`,description:`Add this server to VS Code`,type:`global`,category:`Open in Client`,action:()=>{try{let e=DL(ee,te,ne);window.location.href=e,QF.success(`Opening in VS Code...`),t(!1)}catch{QF.error(`Failed to open in VS Code`)}}},{id:`open-in-vscode-insiders`,name:`Open in VS Code Insiders`,description:`Add this server to VS Code Insiders`,type:`global`,category:`Open in Client`,action:()=>{try{let e=OL(ee,te,ne);window.location.href=e,QF.success(`Opening in VS Code Insiders...`),t(!1)}catch{QF.error(`Failed to open in VS Code Insiders`)}}},{id:`open-in-gemini`,name:`Open in Gemini CLI`,description:`Add this server to Gemini CLI`,type:`global`,category:`Open in Client`,action:()=>{let{command:e}=ML(ee,te,ne);nM(e),QF.success(`Command copied to clipboard`),t(!1)}},{id:`open-in-codex`,name:`Open in Codex CLI`,description:`Add this server to Codex CLI`,type:`global`,category:`Open in Client`,action:()=>{let{config:e}=NL(ee,te,ne);nM(e),QF.success(`Config copied to clipboard`),t(!1)}}]:[],ie=[{id:`connect-server`,name:`Connect Server`,description:`Add a new MCP server connection`,type:`global`,category:`Navigation`,action:()=>_(`/`)},{id:`mcp-use-website`,name:`MCP Use Website`,description:`Visit mcp-use.com for tools and resources`,type:`global`,category:`Documentation`,action:()=>window.open(`https://mcp-use.com`,`_blank`)},{id:`mcp-use-docs`,name:`How to Create an MCP Server`,description:`Step-by-step guide to building MCP servers`,type:`global`,category:`Documentation`,action:()=>window.open(`https://mcp-use.com/docs`,`_blank`)},{id:`mcp-docs`,name:`MCP Official Documentation`,description:`Learn about the Model Context Protocol`,type:`global`,category:`Documentation`,action:()=>window.open(`https://modelcontextprotocol.io/docs/getting-started/intro`,`_blank`)},{id:`discord`,name:`Join Discord Community`,description:`Connect with the MCP community`,type:`global`,category:`Community`,action:()=>window.open(`https://discord.gg/XkNkSkMz3V`,`_blank`)},{id:`clear-localstorage`,name:`Clear localStorage & Reload`,description:`Having trouble connecting? Clear stored auth data and refresh`,type:`global`,category:`Troubleshooting`,action:()=>{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&(n.startsWith(`mcp:auth`)||n.startsWith(`mcp-inspector`))&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),QF.success(`Cleared ${e.length} localStorage item(s). Refreshing page...`,{duration:2e3}),setTimeout(()=>{window.location.reload()},500),t(!1)}}],ae=o.map(e=>({id:`server-${e.id}`,name:pM(e),description:`Connected server (${e.state})`,type:`global`,category:`Connected Servers`,metadata:{serverId:e.id,state:e.state},action:()=>u(e.id)})),O=[...ie,...re,...ae,...n.map(e=>({id:`tool-${e.name}`,name:e.name,description:e.description,type:`tool`,category:e._serverName?`Tools - ${e._serverName}`:`Tools`,metadata:{inputSchema:e.inputSchema,serverId:e._serverId,serverName:e._serverName}})),...r.map(e=>({id:`prompt-${e.name}`,name:e.name,description:e.description,type:`prompt`,category:e._serverName?`Prompts - ${e._serverName}`:`Prompts`,metadata:{arguments:e.arguments,serverId:e._serverId,serverName:e._serverName}})),...i.map(e=>({id:`resource-${e.uri}`,name:e.name,description:e.description,type:`resource`,category:e._serverName?`Resources - ${e._serverName}`:`Resources`,metadata:{uri:e.uri,mimeType:e.mimeType,serverId:e._serverId,serverName:e._serverName}})),...a.map(e=>({id:`saved-${e.id}`,name:e.name,description:`Saved request for ${e.toolName}`,type:`saved-request`,category:`Saved Requests`,metadata:{toolName:e.toolName,args:e.args,savedAt:e.savedAt,serverId:e.serverId,serverName:e.serverName}}))].filter(e=>d.trim()?`${e.name} ${e.description||``} ${e.category}`.toLowerCase().includes(d.trim().toLowerCase()):!0),k=(0,z.useCallback)(e=>{if(console.warn(`[CommandPalette] Item selected:`,{itemType:e.type,itemName:e.name,itemId:e.id,metadata:e.metadata}),e.action)console.warn(`[CommandPalette] Executing action for global item`),e.action(),t(!1);else if(e.type===`global`)e.metadata?.serverId&&(console.warn(`[CommandPalette] Selecting server:`,e.metadata.serverId),u(e.metadata.serverId),t(!1));else{let n=e.type===`resource`?e.metadata?.uri:e.name,r=e.type===`tool`?`tools`:e.type===`prompt`?`prompts`:e.type===`saved-request`?`tools`:`resources`;console.warn(`[CommandPalette] Navigating to item:`,{tab:r,itemIdentifier:n,serverId:e.metadata?.serverId}),l(r,n,e.metadata?.serverId),t(!1)}},[l,t,u]),A=(e,t,n)=>{switch(e){case`tool`:return(0,R.jsx)(`div`,{className:`bg-blue-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Yi,{className:`h-4 w-4 text-blue-500`})});case`prompt`:return(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(yi,{className:`h-4 w-4 text-purple-500`})});case`resource`:return(0,R.jsx)(`div`,{className:`bg-green-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Qr,{className:`h-4 w-4 text-green-500`})});case`saved-request`:return(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(ri,{className:`h-4 w-4 text-orange-500`})});case`global`:if(t===`Navigation`)return(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Ai,{className:`h-4 w-4 text-gray-600 dark:text-gray-300`})});if(t===`Open in Client`){if(n?.includes(`Cursor`))return(0,R.jsx)(`div`,{className:`bg-gray-200 dark:bg-gray-800 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`})});if(n?.includes(`Claude Code`)||n?.includes(`Claude Desktop`))return(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`})});if(n?.includes(`VS Code`))return(0,R.jsx)(`div`,{className:`bg-blue-600/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(IL,{className:`h-4 w-4 text-blue-600`})});if(n?.includes(`Gemini`))return(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`})});if(n?.includes(`Codex`))return(0,R.jsx)(`div`,{className:`bg-green-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`})})}return t===`Documentation`?n?.includes(`MCP Use`)||n?.includes(`mcp-use`)?(0,R.jsx)(`div`,{className:`bg-black/10 dark:bg-white/10 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(FL,{className:`h-4 w-4 text-black dark:text-white`,size:`sm`})}):(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Yr,{className:`h-4 w-4 text-orange-500`})}):t===`Community`?(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(RL,{className:`h-4 w-4 text-purple-500`})}):t===`Troubleshooting`?(0,R.jsx)(`div`,{className:`bg-yellow-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Pr,{className:`h-4 w-4 text-yellow-500`})}):t===`Connected Servers`?(0,R.jsx)(`div`,{className:`bg-cyan-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Fi,{className:`h-4 w-4 text-cyan-500`})}):(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Yr,{className:`h-4 w-4 text-gray-500`})});default:return(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(C,{className:`h-4 w-4 text-gray-500`})})}};(0,z.useEffect)(()=>{e&&(f(``),m(0),requestAnimationFrame(()=>g.current?.focus()))},[e]),(0,z.useEffect)(()=>{h.current&&(h.current.scrollTop=0),m(0)},[d]),(0,z.useEffect)(()=>{p>=O.length&&m(Math.max(0,O.length-1))},[p,O.length]),(0,z.useLayoutEffect)(()=>{e&&E()},[e,E,O]);let oe=b[p]??null,j=y===null?null:b[y],se=y!==null&&y!==p;return e?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-sm`,"aria-label":`Close command palette`,onClick:()=>t(!1)}),(0,R.jsxs)(`div`,{role:`dialog`,"aria-label":`Command Palette`,"data-testid":`command-palette-dialog`,className:`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-[51] max-w-[640px] w-[calc(100vw-2rem)] sm:w-full p-2 bg-white dark:bg-zinc-900/90 backdrop-blur-xl rounded-xl overflow-hidden border border-border shadow-[var(--cmdk-shadow)] transition-transform duration-100 ease-out outline-none`,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),m(e=>Math.min(e+1,O.length-1))):e.key===`ArrowUp`?(e.preventDefault(),m(e=>Math.max(e-1,0))):e.key===`Enter`&&O[p]?(e.preventDefault(),k(O[p])):e.key===`Escape`&&(e.preventDefault(),t(!1))},children:[(0,R.jsx)(`input`,{ref:g,placeholder:`What do you need?`,value:d,onChange:e=>f(e.target.value),className:`border-none w-full text-[17px] px-4 pt-2 pb-4 outline-none bg-transparent text-foreground border-b border-border mb-0 rounded-none placeholder:text-muted-foreground`,"data-testid":`command-palette-input`}),(0,R.jsxs)(`div`,{ref:h,onMouseEnter:w.onMouseEnter,onMouseMove:w.onMouseMove,onMouseLeave:w.onMouseLeave,className:`relative isolate min-h-[200px] sm:min-h-[330px] max-h-[400px] overflow-auto overscroll-contain transition-[height] duration-100 ease-out px-1`,"data-testid":`command-palette-list`,children:[(0,R.jsx)(en,{children:oe&&(0,R.jsx)(F.div,{"aria-hidden":!0,className:D(`pointer-events-none absolute bg-active`,v.bg),initial:!1,animate:{top:oe.top,left:oe.left,width:oe.width,height:oe.height,opacity:se?.8:1},exit:{opacity:0,transition:Ot.moderate.exit},transition:{...Ot.moderate,opacity:{duration:.08}}})}),(0,R.jsx)(en,{children:j&&(0,R.jsx)(F.div,{"aria-hidden":!0,className:D(`pointer-events-none absolute bg-hover`,v.bg),initial:{opacity:0,top:oe?.top??j.top,left:oe?.left??j.left,width:oe?.width??j.width,height:oe?.height??j.height},animate:{opacity:1,top:j.top,left:j.left,width:j.width,height:j.height},exit:{opacity:0,transition:Ot.fast.exit},transition:{...Ot.fast,opacity:{duration:.08}}},x.current)}),O.length===0?(0,R.jsx)(`div`,{className:`text-sm flex items-center justify-center h-12 whitespace-pre-wrap text-muted-foreground`,children:`No results found.`}):O.map((e,t)=>(0,R.jsxs)(`button`,{ref:e=>T(t,e),type:`button`,"data-testid":`command-palette-item-${e.id}`,"data-proximity-index":t,onClick:()=>k(e),className:`[content-visibility:auto] relative z-10 cursor-pointer h-12 text-sm flex items-center gap-3 px-3 text-foreground select-none w-full text-left mt-1 first:mt-0`,children:[A(e.type,e.category,e.name),(0,R.jsx)(`span`,{className:`font-medium truncate flex-1 min-w-0`,children:e.name}),(()=>{let t=e.metadata?.serverId;if(!t||e.category===`Connected Servers`)return null;let n=o.find(e=>e.id===t);return n?(0,R.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 text-muted-foreground`,children:[(0,R.jsx)(pL,{server:n,size:`xs`}),(0,R.jsx)(`span`,{className:`text-xs truncate max-w-[9rem]`,children:pM(n)})]}):null})()]},e.id))]}),(0,R.jsxs)(`div`,{className:`border-t border-border px-4 py-3 pb-1 flex items-center justify-between text-xs text-muted-foreground `,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`t`}),(0,R.jsx)(`span`,{children:`Tools`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`p`}),(0,R.jsx)(`span`,{children:`Prompts`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`r`}),(0,R.jsx)(`span`,{children:`Resources`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`c`}),(0,R.jsx)(`span`,{children:`Chat`})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`h`}),(0,R.jsx)(`span`,{children:`Home`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center px-2 h-5 font-mono text-[10px] font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`esc`}),(0,R.jsx)(`span`,{children:`Close`})]})]})]})]})]}):null}var BL=`openid profile email offline_access`,VL=`mcp-inspector:manufact-auth`,HL=`manufact:session-changed`,UL={loaded:!0,authorizing:!1,accessToken:null,user:null,mode:null},WL=new Map,GL=new Set,KL=new Map,qL=new Map,JL=null,YL=!1;typeof window<`u`&&window.addEventListener(`message`,e=>{if(e.data?.type!==`manufact:invalidate-oauth-client`)return;for(let e of WL.keys())ZL()?.removeItem(rR(e,`client`));let t=JL;!t||YL||(YL=!0,TR(t,{isRetry:!0}).finally(()=>{YL=!1}))});function XL(e){let t=WL.get(e);if(t)return t;let n={...UL,loaded:!1};return WL.set(e,n),n}function ZL(){return typeof window>`u`?null:window.localStorage}function QL(e){return new URL(e).origin}function $L(e,t){let n=new URL(e),r=new URL(t),i=new Set([`localhost`,`127.0.0.1`]);return i.has(n.hostname)&&i.has(r.hostname)?n.origin===r.origin:(n.hostname===`manufact.com`||n.hostname.endsWith(`.manufact.com`))&&(r.hostname===`manufact.com`||r.hostname.endsWith(`.manufact.com`))}function eR(e){let t=window.__MANUFACT_LOGIN_URL__;if(t)return new URL(t).origin;let n=new URL(e);return n.hostname===`localhost`||n.hostname===`127.0.0.1`?`${n.protocol}//${n.hostname}:3000`:`${n.protocol}//manufact.com`}function tR(e){return`${eR(e)}/login`}function nR(e){return`${eR(e)}/auth/embedded-sign-out`}function rR(e,t){return`${VL}:${t}:${e}`}function iR(e){return ZL()?.getItem(rR(e,`skip-session`))===`1`}function aR(e,t){let n=rR(e,`skip-session`);t?ZL()?.setItem(n,`1`):ZL()?.removeItem(n)}function oR(e){return`${VL}:state:${e}`}function sR(e){let t=ZL()?.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return ZL()?.removeItem(e),null}}function cR(e,t){ZL()?.setItem(e,JSON.stringify(t))}function lR(e,t){WL.set(e,{...WL.get(e)??UL,...t}),GL.forEach(e=>e()),window.dispatchEvent(new CustomEvent(HL))}function uR(e){let t=``;return e.forEach(e=>{t+=String.fromCharCode(e)}),btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function dR(e=32){let t=new Uint8Array(e);return crypto.getRandomValues(t),uR(t)}async function fR(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return uR(new Uint8Array(t))}async function pR(e){let t=await fetch(`${e}/api/auth/.well-known/openid-configuration`);if(!t.ok)throw Error(`Manufact OAuth discovery failed`);return await t.json()}function mR(){return`${window.location.origin}${sM()}/auth/callback`}function hR(e){return e===`localhost`||e===`127.0.0.1`}function gR(e){try{let t=new URL(e).hostname,n=typeof window<`u`?new URL(window.location.href).hostname:``;return hR(t)&&hR(n)}catch{return!1}}async function _R(e,t,n){let r=new URL(`${e}/api/auth/oauth2/authorize`);r.searchParams.set(`response_type`,`code`),r.searchParams.set(`client_id`,t),r.searchParams.set(`redirect_uri`,n),r.searchParams.set(`scope`,BL),r.searchParams.set(`code_challenge`,await fR(dR(32))),r.searchParams.set(`code_challenge_method`,`S256`),r.searchParams.set(`state`,`client-probe`),r.searchParams.set(`prompt`,`none`);try{let e=await fetch(r.toString(),{method:`GET`,redirect:`manual`,credentials:`include`}),t=e.headers.get(`location`)??``;return t.includes(`/auth/error`)&&t.includes(`invalid_client`)?!1:e.status>=300&&e.status<400||e.type===`opaqueredirect`?!!t&&!t.includes(`/auth/error`):!0}catch{return!1}}async function vR(e,t){let n=mR(),r=rR(e,`client`),i=sR(r),a=gR(e);if(!a&&i?.client_id&&i.redirect_uri===n){if(await _R(e,i.client_id,n))return i;ZL()?.removeItem(r)}else a&&i?.client_id&&ZL()?.removeItem(r);if(!t.registration_endpoint)throw Error(`Manufact OAuth registration is unavailable`);let o=await fetch(t.registration_endpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({client_name:`mcp-use Inspector`,redirect_uris:[n],grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],token_endpoint_auth_method:`none`,scope:BL})});if(!o.ok)throw Error(`Could not register Inspector with Manufact`);let s=await o.json();if(!s.client_id)throw Error(`Manufact returned no OAuth client ID`);let c={...s,redirect_uri:n};return cR(r,c),c}async function yR(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams(t)}),r=await n.json().catch(()=>({}));if(!n.ok||!r.access_token)throw Error(r.error_description??`Manufact token exchange failed`);return{access_token:r.access_token,refresh_token:r.refresh_token,token_type:r.token_type,expires_at:Date.now()+(r.expires_in??3600)*1e3}}async function bR(e,t){if(!t.refresh_token)return null;let n=qL.get(e);if(n)return n;let r=(async()=>{try{let n=await pR(e),r=sR(rR(e,`client`));if(!r?.client_id)return null;let i=await yR(n.token_endpoint,{grant_type:`refresh_token`,refresh_token:t.refresh_token,client_id:r.client_id}),a={...i,refresh_token:i.refresh_token??t.refresh_token};return cR(rR(e,`tokens`),a),a}catch{return ZL()?.removeItem(rR(e,`tokens`)),null}finally{qL.delete(e)}})();return qL.set(e,r),r}async function xR(e){let t=sR(rR(e,`tokens`));return t?.access_token?t.expires_at>Date.now()+3e4?t:bR(e,t):null}async function SR(e,t){let n=await pR(e);if(!n.userinfo_endpoint)return null;let r=await fetch(n.userinfo_endpoint,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)return null;let i=await r.json();return i.sub?{id:i.sub,name:i.name,email:i.email,image:i.picture}:null}async function CR(e){try{let t=await fetch(`${e}/api/auth/get-session`,{credentials:`include`});return t.ok?(await t.json())?.user??null:null}catch{return null}}async function wR(e){let t=KL.get(e);if(t)return t;WL.set(e,{...WL.get(e)??UL,loaded:!1});let n=(async()=>{try{let t=$L(typeof window<`u`?window.location.href:e,e),n=iR(e),r=await xR(e),i=r?await SR(e,r.access_token):null;if(i&&r){aR(e,!1),lR(e,{loaded:!0,accessToken:r.access_token,user:i,mode:`oauth`});return}r&&!i&&ZL()?.removeItem(rR(e,`tokens`));let a=t&&!n?await CR(e):null;if(a){lR(e,{loaded:!0,accessToken:null,user:a,mode:`session`});return}lR(e,{loaded:!0,accessToken:null,user:null,mode:null})}catch{lR(e,{loaded:!0,accessToken:null,user:null,mode:null})}})().finally(()=>KL.delete(e));return KL.set(e,n),n}async function TR(e,t){let n=QL(e);JL=e,aR(n,!1);let r=window.open(``,`manufact-oauth`,`width=600,height=700,resizable=yes,scrollbars=yes`);if(!r)throw Error(`Allow popups to sign in with Manufact`);if(lR(n,{authorizing:!0}),$L(window.location.href,n)){r.location.href=tR(n);let e=window.setInterval(async()=>{if(r.closed){window.clearInterval(e),lR(n,{authorizing:!1});return}let t=await CR(n);t&&(window.clearInterval(e),r.close(),lR(n,{loaded:!0,authorizing:!1,accessToken:null,user:t,mode:`session`}))},1e3);return}try{let e=await pR(n),t=await vR(n,e),i=dR(64),a=dR(),o=mR();cR(oR(a),{authOrigin:n,clientId:t.client_id,redirectUri:o,codeVerifier:i,expiresAt:Date.now()+600*1e3});let s=new URL(e.authorization_endpoint);s.searchParams.set(`response_type`,`code`),s.searchParams.set(`client_id`,t.client_id),s.searchParams.set(`redirect_uri`,o),s.searchParams.set(`scope`,BL),s.searchParams.set(`state`,a),s.searchParams.set(`code_challenge`,await fR(i)),s.searchParams.set(`code_challenge_method`,`S256`),s.searchParams.set(`prompt`,`consent`),r.location.href=s.toString();let c=window.setInterval(()=>{r.closed&&(window.clearInterval(c),wR(n).finally(()=>lR(n,{authorizing:!1})))},500)}catch(e){throw r.close(),lR(n,{authorizing:!1}),e}}async function ER(e=new URL(window.location.href)){let t=e.searchParams.get(`state`),n=e.searchParams.get(`code`),r=e.searchParams.get(`error_description`)??e.searchParams.get(`error`);if(r)throw Error(r);if(!t||!n)throw Error(`Missing OAuth code or state`);let i=oR(t),a=sR(i);if(ZL()?.removeItem(i),!a||a.expiresAt<Date.now())throw Error(`OAuth state is invalid or expired`);let o=await yR((await pR(a.authOrigin)).token_endpoint,{grant_type:`authorization_code`,code:n,redirect_uri:a.redirectUri,client_id:a.clientId,code_verifier:a.codeVerifier});cR(rR(a.authOrigin,`tokens`),o),aR(a.authOrigin,!1);let s=await SR(a.authOrigin,o.access_token);lR(a.authOrigin,{loaded:!0,authorizing:!1,accessToken:o.access_token,user:s,mode:`oauth`}),window.opener?.postMessage({type:`manufact:oauth-complete`,authOrigin:a.authOrigin},window.location.origin)}function DR(e){let t=QL(e);ZL()?.removeItem(rR(t,`tokens`)),lR(t,{loaded:!0,authorizing:!1,accessToken:null,user:null,mode:null})}async function OR(e){let t=sR(rR(e,`tokens`)),n=sR(rR(e,`client`)),r=t?.refresh_token??t?.access_token;if(!n?.client_id||!r)return null;try{let i=(await pR(e)).revocation_endpoint??`${e}/api/auth/oauth2/revoke`;return(await fetch(i,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({client_id:n.client_id,token:r,token_type_hint:t?.refresh_token?`refresh_token`:`access_token`})})).status}catch{return-1}}async function kR(e){let t=eR(e),n=window.open(nR(e),`manufact-sign-out`,`width=420,height=320`);return n?new Promise(r=>{let i=!1,a=e=>{i||(i=!0,window.clearTimeout(o),window.clearInterval(c),window.removeEventListener(`message`,s),r(e))},o=window.setTimeout(()=>{a({attempted:!0,signOutOk:!1,signOutStatus:null})},3e4),s=e=>{e.origin===t&&e.data?.type===`manufact:sign-out-complete`&&a({attempted:!0,signOutOk:!0,signOutStatus:200})},c=window.setInterval(()=>{n.closed&&CR(e).then(e=>{a({attempted:!0,signOutOk:!e,signOutStatus:e?401:200})})},500);window.addEventListener(`message`,s)}):{attempted:!0,signOutOk:!1,signOutStatus:null}}async function AR(e,t){let n=QL(e),r=!!sR(rR(n,`tokens`))?.access_token;t===`oauth`||r?(await OR(n),aR(n,!0)):t===`session`&&(await kR(n),aR(n,!1)),DR(e)}function jR(e){let t=e?QL(e):null,n=(0,z.useSyncExternalStore)((0,z.useCallback)(e=>(GL.add(e),()=>GL.delete(e)),[]),(0,z.useCallback)(()=>t?XL(t):UL,[t]),()=>UL);return(0,z.useEffect)(()=>{if(!t)return;wR(t);let e=e=>{e.origin===window.location.origin&&e.data?.type===`manufact:oauth-complete`&&e.data.authOrigin===t&&wR(t).finally(()=>lR(t,{authorizing:!1}))},n=e=>{e.key!==rR(t,`tokens`)||!e.newValue||wR(t).finally(()=>lR(t,{authorizing:!1}))};return window.addEventListener(`message`,e),window.addEventListener(`storage`,n),()=>{window.removeEventListener(`message`,e),window.removeEventListener(`storage`,n)}},[t]),{...n,authorize:(0,z.useCallback)(async()=>{e&&await TR(e)},[e]),logout:(0,z.useCallback)(async()=>{e&&await AR(e,n.mode)},[e,n.mode])}}var MR=(0,z.lazy)(()=>rS(()=>import(`./ChatTab-BCobuZDc.js`).then(e=>({default:e.ChatTab})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),NR=(0,z.lazy)(()=>rS(()=>import(`./ToolsTab-bDdRxI1b.js`).then(e=>({default:e.ToolsTab})),__vite__mapDeps([18,1,2,3,4,6,5,7,8,19,20,21,13,16,17,22,23,24,10,25,26,27]))),PR=(0,z.lazy)(()=>rS(()=>import(`./PromptsTab-Bns2u0G-.js`).then(e=>({default:e.PromptsTab})),__vite__mapDeps([28,1,2,3,4,6,5,7,8,22,24,10,25,26,27,11,12,16]))),FR=(0,z.lazy)(()=>rS(()=>import(`./ResourcesTab-CO24312V.js`).then(e=>({default:e.ResourcesTab})),__vite__mapDeps([29,1,2,3,4,7,19,6,5,8,20,21,13,16,17,30,22,23,24,10,25,26,14]))),IR=(0,z.lazy)(()=>rS(()=>import(`./SamplingTab-7gtN7FwU.js`).then(e=>({default:e.SamplingTab})),__vite__mapDeps([31,1,2,3,4,6,5,7,8,24,10,25,20,21,13,14,16]))),LR=(0,z.lazy)(()=>rS(()=>import(`./ElicitationTab-D3ZUKHND.js`).then(e=>({default:e.ElicitationTab})),__vite__mapDeps([32,1,2,3,4,8,24,10,25,20,15,12,16]))),RR=(0,z.lazy)(()=>rS(()=>import(`./NotificationsTab-Uj0_DrmK.js`).then(e=>({default:e.NotificationsTab})),__vite__mapDeps([33,1,2,3,4,30,23,24,10,25,26]))),zR=(0,z.lazy)(()=>rS(()=>import(`./ServerMetadataTab-CQwqYSjL.js`).then(e=>({default:e.ServerMetadataTab})),__vite__mapDeps([34,1,2,3,4,9,7,8,25,10,35]))),BR=(0,z.lazy)(()=>rS(()=>import(`./ConnectionSettingsTab-BjGkLwVu.js`).then(e=>({default:e.ConnectionSettingsTab})),__vite__mapDeps([36,1,2,3,4,25,10,35])));function VR({children:e}){return(0,R.jsx)(z.Suspense,{fallback:(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,R.jsx)(fL,{className:`size-6`})}),children:e})}var HR=`anthropic/claude-sonnet-4.6`;function UR({isLoopback:e,chatApiUrl:t}){return e&&!!t}function WR(e,t,n=!1,r){let i=e.replace(/\/chat\/stream\/?$/,`/llm`);return{provider:`openai-compatible`,model:r??`anthropic/claude-sonnet-4.6`,apiKey:t??`server-managed`,baseUrl:i,...n?{credentials:`include`}:{}}}function GR(e){return e?{Authorization:`Bearer ${e}`}:void 0}var KR=`mcp-inspector:managed-model`;function qR(e){return`${KR}:${e}`}function JR(e){try{return localStorage.getItem(qR(e))}catch{return null}}function YR(e,t,n,r){let i=e?new URL(e).origin:null,[a,o]=(0,z.useState)([]),[s,c]=(0,z.useState)(HR),[l,u]=(0,z.useState)(()=>i?JR(i)??`anthropic/claude-sonnet-4.6`:HR),[d,f]=(0,z.useState)(!1),p=(0,z.useCallback)(e=>{if(u(e),i)try{localStorage.setItem(qR(i),e)}catch{}},[i]);return(0,z.useEffect)(()=>{if(!r||!i)return;let e=!1;return f(!0),(async()=>{try{let r=GR(t),a=await fetch(`${i}/api/v1/models`,{headers:r,credentials:n===`session`?`include`:`same-origin`});if(!a.ok)return;let s=await a.json();if(e)return;let l=s.models??[];o(l);let d=s.defaultModelId??`anthropic/claude-sonnet-4.6`;c(d);let f=new Set(l.map(e=>e.id)),p=JR(i);p&&f.has(p)?u(p):f.has(d)?u(d):l[0]&&u(l[0].id)}finally{e||f(!1)}})(),()=>{e=!0}},[r,i,t,n]),{models:a,selectedModelId:l,setSelectedModelId:p,isLoading:d,selectedModel:a.find(e=>e.id===l)??null,defaultModelId:s}}var XR=[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`,`server-metadata`,`connection-settings`];function ZR(e){return XR.includes(e)?e:`tools`}function QR({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:i,onUpdateConnection:a,children:o}){let{embeddedConfig:s}=yL(),c=ZR(t),[l,u]=(0,z.useState)(()=>new Set([c]));(0,z.useEffect)(()=>{let e=ZR(t);u(t=>t.has(e)?t:new Set(t).add(e))},[t]);let{accessToken:d,mode:f,user:p}=jR(s.chatApiUrl),m=GR(d),h=f===`session`?`include`:void 0,g=p!=null,_=s.chatApiUrl,v=!!e?.url&&uM(e.url),y=e?UR({isLoopback:v,chatApiUrl:s.chatApiUrl,enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade}):!1,b=YR(_,d,f,!!e&&!!_&&g),x=y?WR(_,d,f===`session`,g?b.selectedModelId:void 0):s.managedLlmConfig??(_&&!v?{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`}:void 0);if(!e&&s.forceConnected)return s.chatApiUrl?(0,R.jsx)(VR,{children:(0,R.jsx)(MR,{connection:{id:`force-connected`,url:``,displayName:``,name:``,state:`ready`,tools:[],prompts:[],resources:[]},isConnected:!0,prompts:[],serverId:`force-connected`,callPrompt:async()=>({messages:[]}),readResource:async()=>({contents:[]}),useClientSide:!1,chatApiUrl:s.chatApiUrl,extraHeaders:m,credentials:h,managedLlmConfig:s.managedLlmConfig??{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`},enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade,hideTitle:s.chatHideTitle,hideModelBadge:s.chatHideModelBadge??!0,hideServerUrl:s.chatHideServerUrl??!0,clearButtonLabel:s.chatClearButtonLabel,clearButtonHideIcon:s.chatClearButtonHideIcon,clearButtonHideShortcut:s.chatClearButtonHideShortcut,clearButtonVariant:s.chatClearButtonVariant,chatQuickQuestions:s.chatQuickQuestions,chatFollowups:s.chatFollowups,hideClearButton:s.chatHideClearButton,hideToolSelector:s.chatHideToolSelector,enableKeyboardShortcuts:!1},`chat-force-connected`)}):(0,R.jsx)(R.Fragment,{children:o});if(!e)return(0,R.jsx)(R.Fragment,{children:o});let S=e=>s.visibleTabs?s.visibleTabs.includes(e):!0,C=XR;return(0,R.jsxs)(VR,{children:[S(`tools`)&&l.has(`tools`)&&(0,R.jsx)(`div`,{style:{display:t===`tools`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(NR,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,refreshTools:e.refreshTools},`tools-${e.id}`)}),S(`prompts`)&&l.has(`prompts`)&&(0,R.jsx)(`div`,{style:{display:t===`prompts`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(PR,{ref:r,prompts:e.prompts,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),serverId:e.id,isConnected:e.state===`ready`,refreshPrompts:e.refreshPrompts},`prompts-${e.id}`)}),S(`resources`)&&l.has(`resources`)&&(0,R.jsx)(`div`,{style:{display:t===`resources`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(FR,{ref:i,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url||``,refreshResources:e.refreshResources},`resources-${e.id}`)}),S(`chat`)&&l.has(`chat`)&&(0,R.jsx)(`div`,{style:{display:t===`chat`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(MR,{connection:e,isConnected:s.forceConnected||e.state===`ready`,prompts:e.prompts,serverId:e.id,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),readResource:e.readResource,useClientSide:y||!_,chatApiUrl:_,extraHeaders:m,credentials:s.chatCredentials??h,managedLlmConfig:x,managedCloudModel:b,enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade,hideTitle:s.chatHideTitle,hideModelBadge:s.chatHideModelBadge??!1,hideServerUrl:s.chatHideServerUrl??!!_,clearButtonLabel:s.chatClearButtonLabel,clearButtonHideIcon:s.chatClearButtonHideIcon,clearButtonHideShortcut:s.chatClearButtonHideShortcut,clearButtonVariant:s.chatClearButtonVariant,chatQuickQuestions:s.chatQuickQuestions,chatFollowups:s.chatFollowups,hideClearButton:s.chatHideClearButton,hideToolSelector:s.chatHideToolSelector,streamProtocol:s.chatStreamProtocol},`chat-${e.id}`)}),S(`sampling`)&&l.has(`sampling`)&&(0,R.jsx)(`div`,{style:{display:t===`sampling`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(IR,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url??``},`sampling-${e.id}`)}),S(`elicitation`)&&l.has(`elicitation`)&&(0,R.jsx)(`div`,{style:{display:t===`elicitation`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(LR,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state===`ready`},`elicitation-${e.id}`)}),S(`notifications`)&&l.has(`notifications`)&&(0,R.jsx)(`div`,{style:{display:t===`notifications`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(RR,{notifications:e.notifications,unreadCount:e.unreadNotificationCount,markNotificationRead:e.markNotificationRead,markAllNotificationsRead:e.markAllNotificationsRead,clearNotifications:e.clearNotifications,serverId:e.id,isConnected:e.state===`ready`},`notifications-${e.id}`)}),S(`server-metadata`)&&l.has(`server-metadata`)&&(0,R.jsx)(`div`,{style:{display:t===`server-metadata`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(zR,{connection:e},`server-metadata-${e.id}`)}),S(`connection-settings`)&&l.has(`connection-settings`)&&a&&(0,R.jsx)(`div`,{style:{display:t===`connection-settings`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(BR,{connection:e,onSave:a},`connection-settings-${e.id}`)}),!C.includes(t)&&(0,R.jsx)(R.Fragment,{children:o})]})}var $R=z.createContext(void 0);function ez(){let e=z.use($R);if(!e)throw Error(`useTabs must be used within a TabsProvider`);return e}var tz=z.createContext(void 0);function nz(){return z.use(tz)}function rz({ref:e,children:t,defaultValue:n,value:r,onValueChange:i,className:a,collapsed:o,onCollapsedChange:s,...c}){let[l,u]=z.useState(n||``),d=r!==void 0,f=o!==void 0,[p,m]=z.useState(!1),h=z.useCallback(e=>{d||u(e),i?.(e)},[d,i]);return(0,R.jsx)($R,{value:{activeValue:d?r:l,handleValueChange:h,collapsed:f?o:p,handleCollapsedChange:z.useCallback(e=>{f||m(e),s?.(e)},[f,s])},children:(0,R.jsx)(`div`,{ref:e,className:D(`flex flex-col gap-2`,a),...c,children:t})})}rz.displayName=`Tabs`;function iz({ref:e,children:t,className:n,variant:r=`default`,collapsible:i=!1,...a}){let{activeValue:o,collapsed:s,handleCollapsedChange:c}=ez(),[l,u]=z.useState({width:0,left:0}),d=z.useRef(null),f=z.useRef(null),p=z.useRef(null),m=z.useCallback(()=>{let e=d.current;if(!e)return;let t=e.querySelector(`div:first-child`);if(!t)return;let n=t.querySelector(`button[data-tab-value="${o}"]`);if(n&&o){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();u({width:r.width,left:r.left-e.left})}else u({width:0,left:0})},[o]),h=z.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(m,16)},[m]);z.useEffect(()=>{let e=setTimeout(m,10);return()=>clearTimeout(e)},[m,s]),z.useEffect(()=>{let e=d.current;if(!e)return;f.current=new ResizeObserver(()=>{h()}),f.current.observe(e);let t=e.querySelector(`div:first-child`);return t&&t.querySelectorAll(`button[data-tab-value]`).forEach(e=>{f.current&&f.current.observe(e)}),()=>{f.current&&f.current.disconnect(),p.current&&clearTimeout(p.current)}},[h]),z.useEffect(()=>{let e=()=>{h()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[h]);let g=z.useRef(null);return z.useEffect(()=>{g.current&&(g.current.style.width=`${l.width}px`,g.current.style.left=`${l.left}px`)},[l]),(0,R.jsx)(tz,{value:{variant:r,collapsed:s,handleCollapsedChange:c},children:(0,R.jsx)(`div`,{ref:d,className:D(`relative flex items-center bg-none gap-1`,r==="default"&&`p-1 rounded-full border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`border-b border-zinc-200 dark:border-zinc-700`,n),...a,children:(0,R.jsxs)(`div`,{role:`tablist`,className:`flex-1 flex items-center relative`,children:[t,(0,R.jsx)(`span`,{ref:g,className:D(`absolute transition-all duration-[250ms] ease-in-out z-0`,r==="default"&&`bg-white dark:bg-zinc-700 rounded-full h-[calc(100%)] top-0 border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`bottom-0 h-0.5 bg-black dark:bg-white`)})]})})})}iz.displayName=`TabsList`;var az=({children:e,title:t,collapsed:n})=>!t||!n?e:(0,R.jsx)(et,{children:(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`span`,{className:`contents`,children:e}),nativeButton:!1}),(0,R.jsx)(wt,{children:t})]})}),oz=z.forwardRef(({children:e,value:t,className:n,disabled:r,icon:i,title:a,showDot:o=!1,alwaysExpanded:s=!1,iconOnly:c=!1,badge:l,...u},d)=>{let{activeValue:f,handleValueChange:p,collapsed:m}=ez(),h=nz()?.variant||`default`,g=f===t,_=!c&&(!m||g||s),v=c||m&&!_;return(0,R.jsx)(az,{title:a,collapsed:m&&!_,children:(0,R.jsxs)(`button`,{ref:d,disabled:r,onClick:()=>p(t),"data-tab-value":t,"data-tab-active":g,role:`tab`,"aria-selected":g?`true`:`false`,title:m&&!_&&a?a:void 0,className:D(`relative z-10 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-[250ms] ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,c?`size-9 shrink-0 flex-none rounded-full p-0`:`flex-1`,h==="default"&&!c&&`py-2.5`,h==="default"&&!c&&`rounded-md px-4`,h===`underline`&&`px-6 py-3 border-b-2 border-transparent`,g&&`text-foreground`,!g&&`text-muted-foreground hover:text-foreground`,n),...u,children:[i&&(0,R.jsxs)(`span`,{className:D(`relative inline-flex shrink-0 items-center justify-center`,c?`size-5`:_&&`mr-2`),children:[(0,R.jsx)(i,{className:D(`h-4 w-4 shrink-0 transition-all duration-[250ms] ease-in-out`,!_&&!c&&`mr-0!`)}),l&&v?l:null]}),o&&(0,R.jsx)(`span`,{className:`absolute top-1.5 right-1.5 w-2 h-2 bg-orange-500 dark:bg-orange-400 border-2 border-white dark:border-zinc-900 rounded-full transition-opacity duration-300 z-10 animate-status-pulse-orange`}),(0,R.jsx)(`span`,{className:D(`min-w-0 transition-all duration-[250ms] ease-in-out overflow-hidden`,_?`w-auto opacity-100`:`w-0 opacity-0`),children:e}),l&&!v?l:null]})})});oz.displayName=`TabsTrigger`;function sz(e){return jR(e)}var cz=z.createContext(void 0);function lz(){let e=z.useContext(cz);if(e===void 0)throw Error(Be(13));return e}var uz={imageLoadingStatus:()=>null},dz=z.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,[o,s]=z.useState(`idle`),c={imageLoadingStatus:o},l=z.useMemo(()=>({imageLoadingStatus:o,setImageLoadingStatus:s}),[o,s]),u=Ue(`span`,e,{state:c,ref:t,props:a,stateAttributesMapping:uz});return(0,R.jsx)(cz.Provider,{value:l,children:u})});function fz(e,{referrerPolicy:t,crossOrigin:n,sizes:r,srcSet:i}){let[a,o]=z.useState(`idle`);return ye(()=>{if(!e&&!i)return o(`error`),I;let a=!0,s=new window.Image,c=e=>()=>{a&&o(e)};return o(`loading`),s.onload=c(`loaded`),s.onerror=c(`error`),t&&(s.referrerPolicy=t),s.crossOrigin=n??null,r&&(s.sizes=r),i&&(s.srcset=i),e&&(s.src=e),s.complete&&o(s.naturalWidth>0?`loaded`:`error`),()=>{a=!1}},[e,i,r,n,t]),a}var pz={...uz,...vt},mz=z.forwardRef(function(e,t){let{className:n,render:r,onLoadingStatusChange:i,style:a,...o}=e,{setImageLoadingStatus:s}=lz(),c=fz(o.src,o),l=c===`loaded`,{mounted:u,transitionStatus:d,setMounted:p}=st(l),m=z.useRef(null),h=f(e=>{i?.(e),s(e)});ye(()=>{c!==`idle`&&h(c)},[c,h]),ye(()=>()=>s(`idle`),[s]),y({open:l,ref:m,onComplete(){l||p(!1)}});let g=Ue(`img`,e,{state:{imageLoadingStatus:c,transitionStatus:d},ref:[t,m],props:o,stateAttributesMapping:pz,enabled:u});return u?g:null}),hz=z.forwardRef(function(e,t){let{className:n,render:r,delay:i,style:a,...o}=e,{imageLoadingStatus:s}=lz(),[c,l]=z.useState(i===void 0),u=P();return z.useEffect(()=>(i===void 0?l(!0):u.start(i,()=>l(!0)),u.clear),[u,i]),Ue(`span`,e,{state:{imageLoadingStatus:s},ref:t,props:o,stateAttributesMapping:uz,enabled:s!==`loaded`&&(i===void 0||c)})});function gz({className:e,size:t=`default`,...n}){return(0,R.jsx)(dz,{"data-slot":`avatar`,"data-size":t,className:D(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function _z({className:e,...t}){return(0,R.jsx)(mz,{"data-slot":`avatar-image`,className:D(`aspect-square size-full rounded-full object-cover`,e),...t})}function vz({className:e,...t}){return(0,R.jsx)(hz,{"data-slot":`avatar-fallback`,className:D(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function yz(e,t){return e?.[0]?e[0].toUpperCase():t?.[0]?t[0].toUpperCase():`U`}function bz({chatApiUrl:e,dashboardUrl:t=`https://manufact.com/cloud`,fallback:n=null,onUserResolved:r,compact:i=!1}){let{user:a,loaded:o,authorizing:s,authorize:c,logout:l,mode:u}=sz(e),d=(0,z.useRef)(void 0);if((0,z.useEffect)(()=>{if(!o)return;let e=a?.id??null;d.current!==e&&(d.current=e,r?.(a))},[o,a,r]),!o)return null;if(!a)return(0,R.jsxs)(R.Fragment,{children:[n,(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:D(`shrink-0 rounded-full text-[13px]`,i?`px-2.5 text-xs`:`px-4`),disabled:s,onClick:()=>{c().catch(e=>QF.error(e instanceof Error?e.message:`Authorization failed`))},children:s?`Authorizing…`:`Sign in`})]});let f=yz(a.name,a.email),p=a.name??a.email??`User`;return(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsx)(kt,{variant:`ghost`,className:`relative h-8 w-8 shrink-0 rounded-full p-0 mr-2`,"aria-label":`User menu`,children:(0,R.jsxs)(gz,{className:`h-8 w-8 border border-zinc-300 dark:border-zinc-600`,children:[(0,R.jsx)(_z,{src:a.image??``,alt:p}),(0,R.jsx)(vz,{className:`text-sm`,children:f})]})}),nativeButton:!0}),(0,R.jsxs)(Za,{className:`w-56`,align:`end`,forceMount:!0,children:[(0,R.jsx)(Qa,{className:`font-normal`,children:(0,R.jsxs)(`div`,{className:`flex flex-col space-y-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium leading-none truncate`,children:p}),a.email&&a.email!==p&&(0,R.jsx)(`p`,{className:`text-xs leading-none text-muted-foreground truncate`,children:a.email})]})}),(0,R.jsx)(no,{}),(0,R.jsx)($a,{render:(0,R.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,R.jsx)(li,{className:`mr-2 h-4 w-4`}),`Go to dashboard`]})}),(0,R.jsx)(no,{}),(0,R.jsxs)($a,{onClick:()=>{l().catch(()=>QF.error(`Sign out failed`))},children:[(0,R.jsx)(hi,{className:`mr-2 h-4 w-4`}),u===`session`?`Sign out of Manufact`:`Disconnect Inspector`]})]})]})}function xz({count:e,isActive:t,size:n=`md`,overlay:r=!1}){return e<=0?null:(0,R.jsx)(`span`,{className:D(t?`dark:bg-black`:`dark:bg-zinc-700`,`shrink-0 bg-zinc-200 text-zinc-700 dark:text-zinc-300 rounded-full font-medium`,r&&`absolute -bottom-1 -right-1.5 z-10 flex h-3.5 min-w-3.5 items-center justify-center border border-background px-0.5 text-[9px] leading-none`,!r&&`ml-1`,!r&&n===`sm`&&`text-[10px] px-1.5 py-0.5`,!r&&n===`md`&&`text-xs px-2 py-0.5`),children:e})}var Sz=`flex h-10 items-center gap-2`;function Cz({serverConfig:e,additionalItems:t=[],showClients:n={cursor:!0,vsCode:!0,vsCodeInsiders:!0,claudeDesktop:!0,claudeCode:!0,geminiCli:!0,codexCli:!0},className:r=``,onSuccess:i,onError:a,trigger:o}){let[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(!1),{url:p,name:m,headers:h}=e,g=e=>{try{OT(new ko({client:e})).catch(()=>{})}catch{}},_=()=>{g(`cursor`);try{let e=EL(p,m,h);window.location.href=e,i?.(`Cursor`)}catch(e){console.error(`Failed to generate Cursor deep link:`,e),a?.(e)}},v=()=>{g(`vscode`);try{let e=DL(p,m,h);window.location.href=e,i?.(`VS Code`)}catch(e){console.error(`Failed to generate VS Code deep link:`,e),a?.(e)}},y=()=>{g(`vscode-insiders`);try{let e=OL(p,m,h);window.location.href=e,i?.(`VS Code Insiders`)}catch(e){console.error(`Failed to generate VS Code Insiders deep link:`,e),a?.(e)}},b=()=>{g(`claude-desktop`);try{AL(p,m,h),i?.(`Claude Desktop`)}catch(e){console.error(`Failed to download .mcpb file:`,e),a?.(e)}},x=()=>{g(`claude-code`),u(`claude-code`),c(!0)},S=()=>{g(`gemini-cli`),u(`gemini-cli`),c(!0)},C=()=>{g(`codex-cli`),u(`codex-cli`),c(!0)},w=async e=>{try{await nM(e),f(!0),setTimeout(()=>f(!1),2e3)}catch(e){console.error(`Failed to copy:`,e),a?.(e)}},T=()=>{if(l===`claude-code`){let{command:e,envVars:t}=jL(p,m,h),n=PL(t);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(rL,{children:[(0,R.jsx)(sL,{children:`Add to Claude Code`}),(0,R.jsx)(cL,{children:`Execute the following command in your shell to add this server to Claude Code.`})]}),(0,R.jsxs)(iL,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsx)(`span`,{children:`Ensure the Claude Code executable is available in your path`})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),n&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:`After installation, set these environment variables in your shell:`}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:n})})]}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The MCP configuration supports environment variable expansion using `,(0,R.jsx)(`code`,{className:`text-foreground`,children:"${VAR}"}),` `,`syntax.`]})]})]})}if(l===`gemini-cli`){let{command:e,envVars:t}=ML(p,m,h),n=PL(t);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(rL,{children:[(0,R.jsx)(sL,{children:`Add to Gemini CLI`}),(0,R.jsx)(cL,{children:`Execute the following command in your shell to add this server to Gemini CLI.`})]}),(0,R.jsxs)(iL,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsx)(`span`,{children:`Ensure the Gemini CLI executable is available in your path`})]}),n&&(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsx)(`span`,{children:`Set these environment variables in your shell before running the command:`})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:n?`3.`:`2.`}),(0,R.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),n&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:n})})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Gemini CLI to load the new configuration.`})]})]})}if(l===`codex-cli`){let{config:e,envVars:t}=NL(p,m,h);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(rL,{children:[(0,R.jsx)(sL,{children:`Add to Codex CLI`}),(0,R.jsxs)(cL,{children:[`Add this configuration to your`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),` `,`file.`]})]}),(0,R.jsxs)(iL,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Add this configuration to your`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),`:`]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),t.length>0&&(0,R.jsx)(`div`,{children:(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`(optional) If you would rather use variables from your system's environment, replace the`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`http_headers`}),` key with the `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`env_http_headers`}),` `,`key as shown in the commented section above.`]})}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Codex CLI to load the new configuration.`})]})]})}return null},E=(0,R.jsxs)(kt,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center ${r}`,children:[(0,R.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,R.jsx)(Ai,{className:`size-3`}),`Client`]}),(0,R.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,R.jsx)(Ir,{className:`size-3`})]})]}),ee=o?typeof o==`function`?o({isOpen:!1,onClick:()=>{}}):o:E;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,z.isValidElement)(ee)?ee:E,nativeButton:!0}),(0,R.jsxs)(Za,{align:`end`,className:`w-auto min-w-[300px]`,children:[t.map(e=>(0,R.jsxs)($a,{onClick:async()=>{await e.onClick()},className:Sz,children:[e.icon,(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:e.label})]},e.id)),t.length>0&&(0,R.jsx)(no,{}),n.cursor&&(0,R.jsxs)($a,{onClick:_,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Cursor`})]}),n.claudeCode&&(0,R.jsxs)($a,{onClick:x,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Code`})]}),n.claudeDesktop&&(0,R.jsxs)($a,{onClick:b,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Desktop`})]}),n.vsCode&&(0,R.jsxs)($a,{onClick:v,className:Sz,children:[(0,R.jsx)(IL,{className:`h-4 w-4 text-blue-500`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code`})]}),n.vsCodeInsiders&&(0,R.jsxs)($a,{onClick:y,className:Sz,children:[(0,R.jsx)(IL,{className:`h-4 w-4 text-teal-400`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code Insiders`})]}),n.geminiCli&&(0,R.jsxs)($a,{onClick:S,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Gemini CLI`})]}),n.codexCli&&(0,R.jsxs)($a,{onClick:C,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Codex CLI`})]})]})]}),(0,R.jsx)(eL,{open:s,onOpenChange:c,children:(0,R.jsx)(nL,{scrollable:!0,className:`max-w-3xl max-h-[80vh]`,children:T()})})]})}function wz({className:e,state:t=`collapsed`,to:n=`/`,showLabel:r=t===`expanded`,labelParts:i=`full`,pinSymbolInIconColumn:a=!1,size:o}){let[s,c]=(0,z.useState)(!1),l=1.5,u=.2/l,d=.8999999999999999/l,f=r&&(t===`expanded`||i===`inspector`),p=o??(a?20:t===`expanded`?40:20),m=(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(F.svg,{viewBox:`0 0 500 500`,initial:`rest`,animate:s?`hover`:`rest`,className:`text-foreground`,style:{width:p,height:p},children:[(0,R.jsxs)(F.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:l,times:[0,u,d,1],ease:`easeInOut`}}},fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`}),(0,R.jsx)(`circle`,{cx:`100.426`,cy:`399.575`,r:`100.426`}),(0,R.jsx)(`path`,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`})]}),(0,R.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(Tz,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`,times:{T0:0,T1:u,T2:d,T3:1},total:l}),(0,R.jsx)(Ez,{cx:100.426,cy:399.575,r:100.426,times:{T0:0,T1:u,T2:d,T3:1},total:l}),(0,R.jsx)(Tz,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`,times:{T0:0,T1:u,T2:d,T3:1},total:l})]})]})}),h=r?(0,R.jsx)(`span`,{className:D(`font-ubuntu flex items-center gap-2 whitespace-nowrap`,a?D(`pl-(--sidebar-nav-text-pl-absolute)`,f?`relative opacity-100 blur-0`:`pointer-events-none absolute left-0 top-1/2 w-0 -translate-y-1/2 overflow-hidden opacity-0 blur-[3px]`):i===`inspector`?`mr-0`:`mr-3`),children:i===`full`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-xl font-bold leading-none text-foreground [text-box:trim-both_cap_alphabetic]`,children:`mcp-use`}),(0,R.jsx)(`span`,{className:`text-lg font-sans font-light leading-none tracking-wide text-muted-foreground [text-box:trim-both_cap_alphabetic]`,children:`Inspector`})]}):(0,R.jsx)(`span`,{className:`text-base font-medium leading-none text-foreground [text-box:trim-both_cap_alphabetic]`,children:`Inspector`})}):null,g=a?(0,R.jsxs)(`div`,{className:D(`relative flex shrink-0 items-center`,f?`min-w-(--sidebar-width-icon)`:`w-(--sidebar-width-icon)`),children:[(0,R.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 left-0 flex w-(--sidebar-width-icon) items-center justify-center`,children:(0,R.jsx)(`div`,{className:`pointer-events-auto`,children:m})}),h]}):i===`inspector`?(0,R.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[m,h]}):(0,R.jsxs)(R.Fragment,{children:[m,h]});return(0,R.jsx)(yF,{to:n,className:D(`flex items-center transition-opacity`,!a&&i!==`inspector`&&`-my-3`,e),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:g})}function Tz({d:e,times:t,total:n}){let{T0:r,T1:i,T2:a,T3:o}=t;return(0,R.jsx)(F.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[r,i,a,o],ease:`easeInOut`}}}})}function Ez({cx:e,cy:t,r:n,times:r,total:i}){let{T0:a,T1:o,T2:s,T3:c}=r;return(0,R.jsx)(F.circle,{cx:e,cy:t,r:n,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:i,times:[a,o,s,c],ease:`easeInOut`}}}})}var Dz=(0,z.createContext)(void 0);function Oz(){let e=(0,z.use)(Dz);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e}function kz({children:e,defaultTheme:t=`system`,storageKey:n=`theme`,forcedTheme:r}){let[i,a]=(0,z.useState)(r||t),[o,s]=(0,z.useState)(!1),c=()=>typeof window>`u`?`light`:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`,l=i===`system`?c():i,u=e=>{let t=document.documentElement,i=e===`system`?c():e;t.classList.remove(`light`,`dark`),t.classList.add(i),r||localStorage.setItem(n,e)};return(0,z.useEffect)(()=>{s(!0);let e=localStorage.getItem(n),i=r||e||t;a(i),u(i)},[t,n,r]),(0,z.useEffect)(()=>{if(i!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>{u(`system`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[i]),(0,z.useEffect)(()=>{o&&u(i)},[i,o]),(0,R.jsx)(Dz,{value:{theme:i,setTheme:e=>{if(r){console.warn(`[ThemeProvider] Theme is forced via URL parameter, ignoring setTheme call`);return}a(e)},resolvedTheme:l},children:e})}function Az({ref:e,shimmerColor:t,shimmerSize:n=`0.05em`,shimmerDuration:r=`3s`,borderRadius:i=`100px`,background:a,className:o,children:s,...c}){let{theme:l}=Oz();return(0,R.jsxs)(`button`,{style:{"--spread":`90deg`,"--shimmer-color":t||(l===`dark`?`#000000`:`#ffffff`),"--radius":i,"--speed":r,"--cut":n,"--bg":a||(l===`dark`?`rgba(255, 255, 255, 1)`:`rgba(0, 0, 0, 1)`)},className:D(`group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]`,`transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px`,`dark:text-white text-black dark:border-white/10 border-black/10`,o),ref:e,...c,children:[(0,R.jsx)(`div`,{className:D(`-z-30 blur-[2px]`,`@container-[size] absolute inset-0 overflow-visible`),children:(0,R.jsx)(`div`,{className:`animate-shimmer-slide absolute inset-0 aspect-[1] h-[100cqh] rounded-none mask-none`,children:(0,R.jsx)(`div`,{className:`animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]`})})}),s,(0,R.jsx)(`div`,{className:D(`absolute inset-0 size-full`,`rounded-2xl px-4 py-1.5 text-sm font-medium`,`transform-gpu transition-all duration-300 ease-in-out`,`dark:shadow-[inset_0_-8px_10px_#0000001f] dark:group-hover:shadow-[inset_0_-6px_10px_#0000003f] dark:group-active:shadow-[inset_0_-10px_10px_#0000003f] shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]`)}),(0,R.jsx)(`div`,{className:D(`absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] bg-black dark:bg-white`)})]})}Az.displayName=`ShimmerButton`;function jz(e){switch(e){case`ready`:return`bg-emerald-600 animate-status-pulse`;case`failed`:return`bg-rose-600 animate-status-pulse-red`;default:return`bg-yellow-500 animate-status-pulse-yellow`}}function Mz(e){switch(e){case`ready`:return`Connected`;case`failed`:return`Failed`;default:return e}}function Nz({status:e,className:t}){return(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`div`,{className:D(`w-2 h-2 rounded-full shrink-0`,jz(e),t)}),nativeButton:!1}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:Mz(e)})})]})}var Pz=`h-6 px-2 text-xs bg-yellow-500/20 border-0 dark:bg-yellow-400/10 text-yellow-800 dark:text-yellow-500 shrink-0`;function Fz(e){try{sessionStorage.setItem(mI,JSON.stringify({url:e.url,name:e.name||`Auto-connected Server`,transportType:e.transportType||`http`,connectionMode:`auto`}))}catch{}}function Iz({server:e,className:t}){let{state:n,authUrl:r,authenticate:i}=e;return n!==`pending_auth`&&n!==`authenticating`?null:n===`authenticating`?(0,R.jsxs)(kt,{size:`sm`,variant:`outline`,disabled:!0,className:D(Pz,t),children:[(0,R.jsx)(fi,{className:`h-3 w-3 animate-spin mr-1`}),`Authenticating`]}):i?(0,R.jsx)(kt,{"data-testid":`server-header-authenticate`,size:`sm`,variant:`outline`,className:D(Pz,t),onClick:t=>{t.stopPropagation(),Fz(e),i()},children:`Authenticate`}):r?(0,R.jsx)(kt,{size:`sm`,variant:`outline`,className:D(Pz,t),render:(0,R.jsx)(`a`,{href:r,"data-testid":`server-header-authenticate`,onClick:t=>{t.stopPropagation(),Fz(e)}}),nativeButton:!1,children:`Authenticate`}):null}function Lz({connections:e,selectedServer:t,onServerSelect:n,mobileMode:r=!1,variant:i=`default`,compactHeader:a=!1}){let o=$N(),s=t=>{e.some(e=>e.id===t)&&n(t)},c=(0,R.jsxs)(Za,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,R.jsx)(Qa,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>o(`/`),children:`MCP Servers`}),(0,R.jsx)(no,{}),e.length===0?(0,R.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center`,children:`No servers connected. Go to the dashboard to add one.`}):e.map(e=>(0,R.jsxs)($a,{onClick:()=>s(e.id),className:`flex items-center gap-3`,children:[(0,R.jsx)(pL,{server:e,size:`sm`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:pM(e)}),(0,R.jsx)(Nz,{status:e.state})]})]},e.id)),(0,R.jsx)(no,{}),(0,R.jsx)($a,{onClick:()=>o(`/`),children:(0,R.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]});return r?(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsxs)(kt,{variant:`ghost`,className:`h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5`,children:[t?(0,R.jsx)(pL,{server:t,size:`md`}):(0,R.jsx)(Fi,{className:`h-5 w-5`}),(0,R.jsx)(Ir,{className:`h-4 w-4`})]}),nativeButton:!0}),c]})})}):i===`header`?(0,R.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsxs)(`button`,{type:`button`,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 border-0 bg-transparent p-0 cursor-pointer text-foreground transition-opacity hover:opacity-80`,children:[t&&(0,R.jsx)(pL,{server:t,size:`sm`,className:`!size-5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate text-sm`,children:t?pM(t):`Select server`}),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Nz,{status:t.state}),!a&&(0,R.jsx)(Iz,{server:t})]}),(0,R.jsx)(Ir,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),nativeButton:!0}),c]})}):(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsxs)(Az,{className:D(`min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200`,!t&&`pl-4`),children:[t&&(0,R.jsx)(pL,{server:t,size:`md`,className:`mr-2`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,R.jsx)(`span`,{className:`truncate lg:max-w-[120px] xl:max-w-none`,children:t?pM(t):`Select server to inspect`}),t&&(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:t.error&&t.state!==`ready`?(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`button`,{onClick:e=>{e.stopPropagation()},className:`w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors`,title:`Click to copy error message`,"aria-label":`Copy error message to clipboard`}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{className:`max-w-xs`,children:t.error})})]}):(0,R.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t.state===`ready`?`bg-emerald-600 animate-status-pulse`:t.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]})]}),nativeButton:!0}),c]})})})}function Rz(e){if(!e)return null;try{let t=new URL(e);if(t.protocol===`https:`)return t.origin}catch{}return null}function zz(e,t){return e===`tools`?t.tools.length:e===`prompts`?t.prompts.length:e===`resources`?t.resources.length:e===`sampling`?t.pendingSamplingRequests?.length||0:e===`elicitation`?t.pendingElicitationRequests?.length||0:e===`notifications`?t.unreadNotificationCount:0}function Bz(e,t,n){return n&&t>0&&[`sampling`,`elicitation`,`notifications`].includes(e)}var Vz=[{id:`server-metadata`,label:`Server Metadata`,icon:si},{id:`separator`},{id:`chat`,label:`Chat`,icon:vi,alwaysExpanded:!0},{id:`separator`},{id:`tools`,label:`Tools`,icon:Yi},{id:`prompts`,label:`Prompts`,icon:yi},{id:`resources`,label:`Resources`,icon:$r},{id:`sampling`,label:`Sampling`,icon:ti},{id:`elicitation`,label:`Elicitation`,icon:zi},{id:`notifications`,label:`Notifications`,icon:Mr},{id:`separator`},{id:`connection-settings`,label:`Connection Settings`,icon:Ii}],Hz=z.createContext(void 0);function Uz(e){let t=z.useContext(Hz);if(t===void 0&&!e)throw Error(Be(47));return t}function Wz(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Gz={...Re,disabled:zt(e=>e.disabled),instantType:zt(e=>e.instantType),openMethod:zt(e=>e.openMethod),openChangeReason:zt(e=>e.openChangeReason),modal:zt(e=>e.modal),focusManagerModal:zt(e=>e.focusManagerModal),stickIfOpen:zt(e=>e.stickIfOpen),titleElementId:zt(e=>e.titleElementId),descriptionElementId:zt(e=>e.descriptionElementId),openOnHover:zt(e=>e.openOnHover),closeDelay:zt(e=>e.closeDelay),hasViewport:zt(e=>e.hasViewport)},Kz=class e extends Wt{constructor(e,t,n=!1){let r={...Wz(),...e},i=new yt;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=rt(i,t,n),super(r,{popupRef:z.createRef(),backdropRef:z.createRef(),internalBackdropRef:z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:z.createRef(),beforeContentFocusGuardRef:z.createRef(),stickIfOpenTimeout:new Lt,triggerElements:i},Gz)}setOpen=(e,t)=>{let n=t.reason===o,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=He(t),s=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&s!=null&&(t.trigger=this.context.triggerElements.getById(s)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let c=()=>{let n={open:e,openChangeReason:t.reason};Nt(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),br.flushSync(c)):c(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=Xe(t,(t,r)=>new e(n,t,r));return z.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function qz({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Kz.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});qe(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=at()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),$e(u,d),We(u);let{forceUnmount:h}=xt(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=z.useCallback(()=>{u.setOpen(!1,A(Ee))},[u]);z.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=z.useMemo(()=>({store:u}),[u]);return(0,R.jsxs)(Hz.Provider,{value:v,children:[_&&(0,R.jsx)(Yz,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Jz(e){return Uz(!0)?(0,R.jsx)(qz,{props:e}):(0,R.jsx)(lt,{children:(0,R.jsx)(qz,{props:e})})}function Yz({store:e,modal:t}){let n=_(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return pt(e,{activeTriggerProps:n.reference??bt,inactiveTriggerProps:n.trigger??bt,popupProps:z.useMemo(()=>Vt(At,n.floating),[n.floating])}),null}var Xz=z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:o=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:u=!1,delay:d=300,closeDelay:f=0,id:p,...m}=e,h=Uz(!0),g=c?.store??h?.store;if(!g)throw Error(Be(74));let _=se(p),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=z.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=Pe(_,S,g,{payload:l,disabled:o,openOnHover:u,closeDelay:f}),T=g.useState(`openChangeReason`),E=g.useState(`stickIfOpen`),te=g.useState(`openMethod`),ne=g.useState(`focusManagerModal`),re=a(y,{enabled:!o&&y!=null&&u&&(te!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:me(),restMs:d,delay:{close:f},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),ie=Sn(y,{enabled:y!=null,stickIfOpen:E}),ae=dn(()=>g.select(`open`),e=>{g.set(`openMethod`,e)}),D=g.useState(`triggerProps`,w),{getButtonProps:O,buttonRef:k}=Ne({disabled:o,native:s}),A={open(e){return e&&T===`trigger-press`?nt.open(e):Le.open(e)}},{preFocusGuardRef:oe,handlePreFocusGuardFocus:j,handleFocusTargetFocus:ce}=xr(g,S),M=Ue(`button`,e,{state:{disabled:o,open:b},ref:[k,t,C,S],props:[ie.reference,re,D,ae,{[ee]:``,id:_,"aria-haspopup":`dialog`,"aria-expanded":b,"aria-controls":x},m,O],stateAttributesMapping:A});return w&&!ne?(0,R.jsxs)(z.Fragment,{children:[(0,R.jsx)(Tt,{ref:oe,onFocus:j}),(0,R.jsx)(z.Fragment,{children:M},_),(0,R.jsx)(Tt,{ref:g.context.triggerFocusTargetRef,onFocus:ce})]}):(0,R.jsx)(z.Fragment,{children:M},_)}),Zz=z.createContext(void 0);function Qz(){let e=z.useContext(Zz);if(e===void 0)throw Error(Be(45));return e}var $z=z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Uz();return i.useState(`mounted`)||n?(0,R.jsx)(Zz.Provider,{value:n,children:(0,R.jsx)(pe,{ref:t,...r})}):null}),eB=z.createContext(void 0);function tB(){let e=z.useContext(eB);if(!e)throw Error(Be(46));return e}var nB=z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:u=0,alignOffset:d=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:_=!1,collisionAvoidance:v=_e,...y}=e,{store:b}=Uz(),x=Qz(),S=l(),C=b.useState(`floatingRootContext`),w=b.useState(`mounted`),T=b.useState(`open`),E=b.useState(`openChangeReason`),ee=b.useState(`activeTriggerElement`),ne=b.useState(`modal`),re=b.useState(`openMethod`),ie=b.useState(`positionerElement`),ae=b.useState(`instantType`),D=b.useState(`transitionStatus`),O=b.useState(`hasViewport`),k=z.useRef(null),A=h(ie,!1,!1),oe=te({anchor:a,floatingRootContext:C,positionMethod:o,mounted:w,side:s,sideOffset:u,align:c,alignOffset:d,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:g,disableAnchorTracking:_,keepMounted:x,nodeId:S,collisionAvoidance:v,adaptiveOrigin:O?Oe:void 0}),j=C.useState(`domReferenceElement`);ye(()=>{let e=j,t=k.current;if(e&&(k.current=e),t&&e&&e!==t){b.set(`instantType`,void 0);let e=new AbortController;return A(()=>{b.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[j,A,b]),an(T&&ne===!0&&E!==`trigger-hover`,re===`touch`,ie,ee);let se=z.useCallback(e=>{b.set(`positionerElement`,e)},[b]),ce=St(e,{open:T,side:oe.side,align:oe.align,anchorHidden:oe.anchorHidden,instant:ae},{styles:oe.positionerStyles,transitionStatus:D,props:y,refs:[t,se],hidden:!w,inert:!T});return(0,R.jsxs)(eB.Provider,{value:oe,children:[w&&ne===!0&&E!==`trigger-hover`&&(0,R.jsx)(wn,{ref:b.context.internalBackdropRef,inert:sn(!T),cutout:ee}),(0,R.jsx)(le,{id:S,children:ce})]})}),rB=z.createContext(void 0);function iB(){let[e,t]=z.useState(0),n=f(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function aB(e){let{value:t,children:n}=e;return(0,R.jsx)(rB.Provider,{value:t,children:n})}var oB={...Et,...vt},sB=z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,{store:c}=Uz(),l=tB(),u=Cn(!0)!=null,{context:d,hasClosePart:f}=iB(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),b=c.useState(`descriptionElementId`),x=c.useState(`modal`),S=c.useState(`mounted`),C=c.useState(`openChangeReason`),w=c.useState(`activeTriggerElement`),T=c.useState(`floatingRootContext`),E=T.useState(`floatingId`),ee=c.useState(`disabled`),te=c.useState(`openOnHover`),ne=c.useState(`closeDelay`),re=s.id??E;y({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),Ge(T,{enabled:te&&!ee,closeDelay:ne});let ie=a===void 0?ut(c.context.popupRef):a,ae=x!==!1&&f;c.useSyncedValue(`focusManagerModal`,ae);let D=z.useCallback(e=>{c.set(`popupElement`,e)},[c]),O=Ue(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,D],props:[_,{id:re,role:`dialog`,...At,"aria-labelledby":v,"aria-describedby":b,onKeyDown(e){u&&Qt.has(e.key)&&e.stopPropagation()}},Ae(g),s],stateAttributesMapping:oB});return(0,R.jsx)(rn,{context:T,openInteractionType:m,modal:ae,disabled:!S||C===`trigger-hover`,initialFocus:ie,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:ct(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,R.jsx)(aB,{value:d,children:O})})});function cB({...e}){return(0,R.jsx)(Jz,{"data-slot":`popover`,...e})}function lB(e){return(0,R.jsx)(Xz,{"data-slot":`popover-trigger`,...e})}function uB({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,R.jsx)($z,{children:(0,R.jsx)(nB,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,R.jsx)(sB,{"data-slot":`popover-content`,className:D(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var dB={success:`border-emerald-700/20 bg-emerald-700/10 text-emerald-700 dark:border-emerald-400/30 dark:bg-emerald-400/10 dark:text-emerald-400`,failed:`border-red-500/20 bg-red-500/10 text-red-500 dark:border-red-400/30 dark:bg-red-400/10 dark:text-red-400`,warning:`border-amber-700/20 bg-amber-700/10 text-amber-700 dark:border-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400`,loading:`border-purple-500/20 bg-purple-500/10 text-purple-500 dark:border-purple-400/30 dark:bg-purple-400/10 dark:text-purple-400 animate-spin`},fB=`size-4 shrink-0 rounded-full border p-0.5`;function pB({state:e,className:t}){let n=D(fB,dB[e],t);switch(e){case`success`:return(0,R.jsx)(Fr,{className:n,"aria-hidden":!0});case`failed`:return(0,R.jsx)(zr,{className:n,"aria-hidden":!0});case`warning`:return(0,R.jsx)(Ki,{className:n,"aria-hidden":!0});case`loading`:return(0,R.jsx)(fi,{className:n,"aria-hidden":!0});default:return null}}function mB(){return`text-emerald-700 dark:text-emerald-400`}function hB({onStop:e,showCopiedBanner:t=!1}){return(0,R.jsxs)(R.Fragment,{children:[t&&(0,R.jsxs)(`div`,{className:D(`flex items-center gap-2 text-sm -mt-1`,mB()),children:[(0,R.jsx)(pB,{state:`success`}),(0,R.jsx)(`span`,{children:`URL copied to clipboard`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Tunnel URL`}),(0,R.jsxs)(`a`,{href:`https://manufact.com/docs/tunneling`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[`Docs`,(0,R.jsx)(Ar,{className:`size-3`})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Use in ChatGPT & Claude`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsxs)(`span`,{children:[`Enable`,` `,(0,R.jsx)(`a`,{href:`https://chatgpt.com/plugins#settings/Security`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline underline-offset-2 hover:text-purple-600 dark:hover:text-purple-400`,children:`dev mode`}),` `,`from settings`]})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`a`,{href:`https://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2Fplugins`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline underline-offset-2 hover:text-purple-600 dark:hover:text-purple-400`,children:`Add a connector`}),` `,`in App & Connectors`]})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`3.`}),(0,R.jsx)(`span`,{children:`Use the tunnel URL in the input`})]})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void e(),className:`flex items-center gap-1.5 text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors cursor-pointer`,children:[(0,R.jsx)(Vi,{className:`size-3 fill-current`}),`Stop Tunnel`]})]})}function gB(e){try{let t=new URL(e),n=t.pathname+t.search;return t.host+(n&&n!==`/`?n:``)}catch{return e}}function _B({copied:e,onCopy:t,className:n}){return(0,R.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":e?`URL copied`:`Copy URL`,className:D(`shrink-0 cursor-pointer p-0.5 rounded-sm text-muted-foreground hover:text-foreground transition-opacity opacity-0 group-hover:opacity-100`,n),children:e?(0,R.jsx)(pB,{state:`success`,className:`size-3.5`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}function vB({url:e,className:t,tunnelPopover:n}){let[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!1);if(!e)return null;let s=gB(e),c=n?.mcpUrl??e,l=!!n,u=async()=>{try{await nM(c),i(!0),setTimeout(()=>i(!1),2e3)}catch{QF.error(`Failed to copy URL`)}};(0,z.useEffect)(()=>{if(!n?.autoCopyOnOpen){o(!1);return}o(!0),i(!0);let e=setTimeout(()=>i(!1),2e3);return()=>clearTimeout(e)},[n?.autoCopyOnOpen]);let d=(0,R.jsxs)(R.Fragment,{children:[l?(0,R.jsx)(Lr,{className:`size-3.5 shrink-0`}):(0,R.jsx)(ei,{className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate max-w-[min(24rem,30vw)]`,children:s})]}),f=D(`flex items-center gap-1 min-w-0 truncate text-left text-sm cursor-pointer`,l?`text-purple-600 dark:text-purple-400`:`text-blue-500`);return(0,R.jsxs)(`div`,{className:D(`group flex items-center gap-1.5 min-w-0`,t),children:[l?(0,R.jsxs)(cB,{open:n.open,onOpenChange:n.onOpenChange,children:[(0,R.jsx)(lB,{render:(0,R.jsx)(`button`,{type:`button`,className:D(f,`hover:opacity-80`),children:d}),nativeButton:!0}),(0,R.jsx)(uB,{className:`w-[calc(100vw-2rem)] sm:w-96`,align:`start`,sideOffset:4,children:(0,R.jsx)(hB,{showCopiedBanner:a,onStop:async()=>{n.onOpenChange(!1),await n.onStop()}})})]}):(0,R.jsx)(`span`,{className:f,children:d}),(0,R.jsx)(_B,{copied:r,onCopy:()=>void u()})]})}function yB({devFromCli:e,isTunnelStarting:t,waitTicks:n,onStart:r}){if(t)return(0,R.jsxs)(`button`,{disabled:!0,className:`flex items-center gap-1 h-6 px-2 bg-violet-50 dark:bg-violet-950/40 border border-violet-200 dark:border-violet-800 rounded-full opacity-75 cursor-wait shrink-0`,children:[(0,R.jsx)(fi,{className:`size-3 text-violet-500 dark:text-violet-400 animate-spin`}),(0,R.jsxs)(`span`,{className:`text-xs font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:[`Start Tunnel `,(0,R.jsxs)(`span`,{className:`tabular-nums`,children:[n,`s`]})]})]});let i=e===!0,a=e===null;return(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void r(),disabled:!i||a,title:e===!1?"Run `mcp-use dev` from your project to enable tunneling.":a?`Checking dev server…`:void 0,className:D(`flex items-center gap-1 h-6 px-2 border rounded-full transition-colors shrink-0`,i&&!a?`bg-violet-50 dark:bg-violet-950/40 border-violet-200 dark:border-violet-800 hover:bg-violet-100 dark:hover:bg-violet-900/50 cursor-pointer`:`bg-violet-50/60 dark:bg-violet-950/20 border-violet-200 dark:border-violet-800 cursor-not-allowed opacity-70`),children:[a?(0,R.jsx)(fi,{className:`size-3 text-violet-500 dark:text-violet-400 animate-spin`}):(0,R.jsx)(Lr,{className:`size-3 text-violet-500 dark:text-violet-400`}),(0,R.jsx)(`span`,{className:`text-xs font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:`Start Tunnel`})]})}async function bB(){try{let e=await fetch(cM(`dev/info`));return e.ok?await e.json():null}catch{return null}}function xB(){return typeof window>`u`?!1:window.__MCP_INSPECTOR_MODE__!==`standalone`}function SB({tunnelUrl:e,setTunnelUrl:t,isTunnelStarting:n,setIsTunnelStarting:r,onTunnelStarted:i}){let[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(0),d=(0,z.useCallback)((e,n)=>{let r=n?.syncTunnel??!1;if(o(!!e.fromCli),e.mcpUrl&&c(e.mcpUrl),!r)return;if(e.tunnelUrl){t(new URL(e.tunnelUrl).origin);return}let i=Rz(e.mcpUrl??null);if(i){t(i);return}t(null)},[t]);return(0,z.useEffect)(()=>{if(!n){u(20);return}u(20);let e=setInterval(()=>u(e=>e>0?e-1:0),1e3);return()=>clearInterval(e)},[n]),(0,z.useEffect)(()=>{let e=!1;if(!xB()){o(!1);return}return(async()=>{let t=await bB();e||(t?d(t,{syncTunnel:!0}):o(!1))})(),()=>{e=!0}},[d]),{devFromCli:a,mcpUrl:s,waitTicks:l,handleStartTunnel:(0,z.useCallback)(async()=>{if(a===!1){QF.error("Start Tunnel requires `mcp-use dev` from your project directory.");return}r(!0);let e=!1;try{let t=await fetch(cM(`dev/start-tunnel`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));QF.error(e.error||`Failed to start tunnel`);return}let n=await bB();if(n?.tunnelUrl||n?.mcpUrl){d(n,{syncTunnel:!0});let e=n.mcpUrl??(n.tunnelUrl?`${n.tunnelUrl.replace(/\/+$/,``)}/mcp`:null);e&&tM(e),i?.()}e=!0}catch{QF.error(`Failed to start tunnel`)}finally{r(!1)}try{OT(new To({action:`start`,success:e})).catch(()=>{})}catch{}},[d,a,i,r]),handleStopTunnel:(0,z.useCallback)(async()=>{r(!0);let n=!1;try{let e=await fetch(cM(`dev/stop-tunnel`),{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));QF.error(t.error||`Failed to stop tunnel`);return}t(null),c(null),QF.success(`Tunnel stopped`),n=!0}catch{QF.error(`Failed to stop tunnel`)}finally{r(!1)}try{OT(new To({action:`stop`,success:n,tunnelUrl:e})).catch(()=>{})}catch{}},[r,t,e])}}function CB(e){let t=window.matchMedia(`(min-width: 1024px)`);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function wB(){return window.matchMedia(`(min-width: 1024px)`).matches}function TB(){return!0}function EB(){return(0,z.useSyncExternalStore)(CB,wB,TB)}function DB(e){let[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)(!1),a=EB(),o=(0,z.useCallback)(()=>{n(!0),i(!0)},[]);return(0,z.useEffect)(()=>{e||(n(!1),i(!1))},[e]),(0,z.useEffect)(()=>{if(!e)return;let t=new URLSearchParams(window.location.search);if(!t.has(`openTunnelPopover`))return;n(!0),i(!0),t.delete(`openTunnelPopover`);let r=t.toString();window.history.replaceState({},``,`${window.location.pathname}${r?`?${r}`:``}`)},[e]),{open:t,onOpenChange:(0,z.useCallback)(e=>{n(e),e||i(!1)},[]),isLgUp:a,autoCopyOnOpen:r,openWithAutoCopy:o}}function OB({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:i,embedded:a=!1,sidebarCollapsed:o=!1}){let{tunnelUrl:s,isTunnelStarting:c,setTunnelUrl:l,setIsTunnelStarting:u,embeddedConfig:d}=yL(),[f,p]=(0,z.useState)(!1),[m]=(0,z.useState)(!0),h=DB(s),g=SB({tunnelUrl:s,setTunnelUrl:l,isTunnelStarting:c,setIsTunnelStarting:u,onTunnelStarted:h.openWithAutoCopy});if(d.singleTab)return null;let _=d.visibleTabs?Vz.filter(e=>e.id===`separator`||d.visibleTabs.includes(e.id)):Vz,v=!!t,y=!!t&&(uM(t.url??``)||dM(t.url??``)||!!s),b=t?s?`${s.replace(/\/+$/,``)}${oM()}`:t.url??``:``,x=g.mcpUrl??(s?`${s.replace(/\/+$/,``)}${oM()}`:null),S=(e,n)=>{if(!t||!b)return null;let r=e===`desktop`?h.isLgUp:!h.isLgUp;return(0,R.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,R.jsx)(vB,{url:b,className:n,tunnelPopover:s&&x&&r?{mcpUrl:x,onStop:g.handleStopTunnel,open:h.open,onOpenChange:h.onOpenChange,autoCopyOnOpen:h.autoCopyOnOpen}:void 0}),y&&!s&&(0,R.jsx)(yB,{devFromCli:g.devFromCli,isTunnelStarting:c,waitTicks:g.waitTicks,onStart:g.handleStartTunnel})]})},C=()=>a?null:(0,R.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 flex-shrink-0`,children:[t&&(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(Cz,{serverConfig:{url:b,name:pM(t),headers:wM(t),serverId:t.id},onSuccess:e=>QF.success(`Opening in ${e}...`),onError:e=>QF.error(`Failed: ${e.message}`),trigger:(0,R.jsxs)(kt,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center`,"aria-label":`Add to Client`,children:[(0,R.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,R.jsx)(Ai,{className:`size-3`}),`Client`]}),(0,R.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,R.jsx)(Ir,{className:`size-3`})]})]})})}),(0,R.jsx)(`a`,{href:f?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{OT(new Eo({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},className:`inline-flex h-8 items-center justify-center rounded-full border border-blue-500/25 bg-blue-500/10 px-4 text-[13px] text-blue-500 outline-none cursor-pointer transition-colors hover:bg-blue-500/15 dark:border-blue-400/30 dark:bg-blue-400/10 dark:text-blue-400 dark:hover:bg-blue-400/15 focus-visible:ring-1 focus-visible:ring-ring`,children:(0,R.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Deploy`})}),w()]}),w=(e=!1)=>d.chatApiUrl?(0,R.jsx)(bz,{chatApiUrl:d.chatApiUrl,onUserResolved:e=>p(!!e),compact:e}):null;return(0,R.jsxs)(`header`,{className:`w-full min-w-0 shrink-0 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`hidden lg:flex h-(--header-height) items-center justify-between gap-3 px-4 md:pl-0 md:pr-6`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:D(`hidden lg:block shrink-0`,v&&o&&`-mr-[calc(var(--sidebar-width-icon)/2-0.625rem)]`),children:(0,R.jsx)(wz,{pinSymbolInIconColumn:!0,showLabel:!v||!o,state:v&&o?`collapsed`:`expanded`})}),(0,R.jsx)(`span`,{className:`text-sm text-muted-foreground/60 shrink-0 [text-box:trim-both_cap_alphabetic]`,children:`/`}),(0,R.jsx)(Lz,{connections:e,selectedServer:t,onServerSelect:r,variant:`header`}),S(`desktop`)]})}),C()]}),(0,R.jsxs)(`div`,{className:`flex lg:hidden min-w-0 w-full flex-col overflow-hidden pt-(--mobile-chrome-gap)`,children:[(0,R.jsx)(`div`,{className:`flex min-h-0 items-center gap-2 pb-(--mobile-chrome-gap)`,children:!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2.5 overflow-hidden`,children:[(0,R.jsx)(wz,{state:`collapsed`,showLabel:!0,labelParts:`inspector`,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`shrink-0 px-0.5 text-sm text-muted-foreground/60 [text-box:trim-both_cap_alphabetic]`,children:`/`}),(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(Lz,{connections:e,selectedServer:t,onServerSelect:r,variant:`header`,compactHeader:!0})})]}),(0,R.jsx)(`div`,{className:`shrink-0`,children:w(!0)})]})}),t&&(0,R.jsx)(`div`,{className:`w-full min-w-0 pb-(--mobile-chrome-gap) lg:hidden`,children:(0,R.jsx)(rz,{value:n,onValueChange:e=>i(e),collapsed:m,className:`w-full`,children:(0,R.jsx)(iz,{className:`w-full gap-0 border-0 bg-transparent p-0 [&_[role=tablist]]:justify-between`,children:_.filter(e=>e.id!==`separator`).map(e=>{let r=zz(e.id,t);return(0,R.jsx)(oz,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,iconOnly:!0,title:e.label,badge:r>0?(0,R.jsx)(xz,{count:r,isActive:n===e.id,overlay:!0}):void 0,className:`size-9 shrink-0 rounded-full p-0`,children:(0,R.jsx)(`span`,{className:`sr-only`,children:e.label})},e.id)})})})})]})]})}function kB({collapsed:e,onToggle:t}){let n=e?`Expand sidebar`:`Collapse sidebar`;return(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsxs)(kt,{type:`button`,variant:`ghost`,size:`icon-sm`,tabIndex:-1,"aria-label":n,onClick:t,className:D(`border-border absolute top-1/2 right-0 z-30 hidden size-7 min-h-7 min-w-7 -translate-y-1/2 translate-x-1/2 rounded-full border bg-background lg:flex`,`opacity-0 transition-opacity duration-200 group-hover/sidebar:opacity-100 focus-visible:opacity-100`),children:[(0,R.jsx)(wi,{className:`size-4`}),(0,R.jsx)(`span`,{className:`sr-only`,children:n})]}),nativeButton:!0}),(0,R.jsx)(wt,{side:`right`,children:n})]})}function AB({className:e}){return(0,R.jsxs)(`svg`,{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`,className:e,children:[(0,R.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,R.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}var jB=z.createContext(void 0);function MB(){let e=z.useContext(jB);if(e===void 0)throw Error(Be(63));return e}var NB=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),PB={...Tn,checked(e){return e?{[NB.checked]:``}:{[NB.unchecked]:``}}};function FB(e,t,n,r=!0,i){let[a,o]=z.useState(),s=se(i?`${i}-label`:void 0),c=e??t??a;return ye(()=>{let i=e||t||!r?void 0:IB(n.current,s);a!==i&&o(i)}),c}function IB(e,t){let n=LB(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function LB(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var RB=z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:_,value:v,style:y,...b}=e,{clearErrors:x}=An(),{state:S,setTouched:C,setDirty:w,validityData:T,setFilled:E,setFocused:ee,validationMode:te,disabled:ne,name:re,validation:ie}=On(),{labelId:ae}=kn(),D=ne||m,O=re??l,k=z.useRef(null),oe=Ye(k,c,ie.inputRef),j=z.useRef(null),ce=se(),M=cn({id:s,implicit:!1,controlRef:j}),N=u?void 0:M,[le,ue]=Yt({controlled:n,default:!!i,name:`Switch`,state:`checked`});En(j,ce,le,void 0,!D,l),ye(()=>{k.current&&E(k.current.checked)},[k,E]),Dn(le,()=>{x(O),w(le!==T.initialValue),E(le),ie.change(le)});let{getButtonProps:de,buttonRef:fe}=Ne({disabled:D,native:u}),pe=FB(a,ae,k,!u,N),me={id:u?M:ce,role:`switch`,"aria-checked":le,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":pe,onFocus(){D||ee(!0)},onBlur(){let e=k.current;!e||D||(C(!0),ee(!1),te===`onBlur`&&ie.commit(e.checked))},onClick(e){if(f||D)return;e.preventDefault();let t=k.current;t&&t.dispatchEvent(new(g(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},he=Vt({checked:le,disabled:D,form:o,id:N,name:O,required:p,style:O?Ie:tt,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:oe,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=A(ke,e.nativeEvent);d?.(t,n),!n.isCanceled&&ue(t)},onFocus(){j.current?.focus()}},e=>ie.getValidationProps(D,e),v===void 0?bt:{value:v}),ge=z.useMemo(()=>({...S,checked:le,disabled:D,readOnly:f,required:p}),[S,le,D,f,p]),_e=Ue(`span`,e,{state:ge,ref:[t,j,fe],props:[me,b,de,e=>ie.getValidationProps(D,e)],stateAttributesMapping:PB});return(0,R.jsxs)(jB.Provider,{value:ge,children:[_e,!le&&O&&_!==void 0&&(0,R.jsx)(`input`,{type:`hidden`,form:o,name:O,value:_,disabled:D}),(0,R.jsx)(`input`,{...he,suppressHydrationWarning:!0})]})}),zB=z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Ue(`span`,e,{state:MB(),ref:t,stateAttributesMapping:PB,props:a})}),BB=34,VB=20,HB=16,UB=2,WB=4,GB=2;function KB(e){return`label`in e&&typeof e.label==`string`}var qB=(0,z.forwardRef)(({label:e,checked:t,onToggle:n,disabled:r=!1,thumbTransition:i,uncheckedTrackColor:a,uncheckedTrackColorHovered:o,className:s,...c},l)=>{let u=(0,z.useId)(),d=(0,z.useRef)(!1),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(!1),g=(0,z.useRef)(!1),_=(0,z.useRef)(!1),v=(0,z.useRef)(null),y=ia(t?16:UB);(0,z.useEffect)(()=>{d.current=!0},[]);let b=m?20:f?18:HB,x=m?HB-WB:HB,S=m?4:UB,C=b-HB,w=t?16-C:UB;(0,z.useEffect)(()=>{g.current||(d.current?ka(y,w,i??Ot.moderate):y.set(w))},[w,y,i]);let T=(0,z.useCallback)(e=>{r||e.pointerType===`mouse`&&e.button!==0||(h(!0),g.current=!1,_.current=!1,v.current={clientX:e.clientX,originX:y.get()},e.currentTarget.setPointerCapture(e.pointerId))},[r,y]),E=(0,z.useCallback)(e=>{if(!v.current)return;let t=e.clientX-v.current.clientX;if(!g.current){if(Math.abs(t)<GB)return;g.current=!0}let n=UB,r=BB-UB-20,i=v.current.originX+t;y.set(Math.max(n,Math.min(r,i)))},[y]),ee=(0,z.useCallback)(e=>{v.current&&=(h(!1),g.current&&(_.current=!0,g.current=!1,e&&(y.get()>14/2===t?ka(y,t?16:UB,i??Ot.moderate):n()),requestAnimationFrame(()=>{_.current=!1})),null)},[t,n,y,i]);return(0,R.jsxs)(`div`,{ref:l,className:D(`relative z-10 flex items-center gap-2.5 px-3 py-2 cursor-pointer select-none touch-none`,r&&`opacity-50 pointer-events-none`,s),onPointerEnter:e=>{e.pointerType===`mouse`&&p(!0)},onPointerLeave:()=>p(!1),onPointerDown:T,onPointerMove:E,onPointerUp:()=>ee(!0),onPointerCancel:()=>{v.current&&=(h(!1),g.current&&(g.current=!1,ka(y,t?16:UB,i??Ot.moderate)),null)},onClick:()=>{r||_.current||n()},...c,children:[(0,R.jsx)(RB,{checked:t,"aria-labelledby":u,onCheckedChange:()=>{_.current||n()},disabled:r,tabIndex:0,className:D(`relative shrink-0 rounded-full outline-none cursor-pointer`,`transition-colors duration-80`,`focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] focus-visible:ring-offset-2 focus-visible:ring-offset-background`),style:{width:BB,height:VB,backgroundColor:t?f?`color-mix(in oklab, var(--primary) 88%, black)`:`var(--primary)`:f?o??`color-mix(in oklab, var(--accent), rgb(var(--overlay)) 10%)`:a??`var(--accent)`},onClick:e=>e.stopPropagation(),children:(0,R.jsx)(zB,{render:e=>{let{style:t,onDrag:n,onDragStart:r,onDragEnd:a,onAnimationStart:o,onAnimationEnd:s,onAnimationIteration:c,...l}=e;return(0,R.jsx)(F.span,{...l,className:`absolute top-0 left-0 block rounded-full bg-white shadow-sm`,initial:!1,style:{...t,x:y},animate:{y:S,width:b,height:x},transition:d.current?i??Ot.moderate:{duration:0}})}})}),(0,R.jsx)(`span`,{id:u,className:D(`text-[13px] [text-box:trim-both_cap_alphabetic] transition-[color] duration-80`,t?`text-foreground`:`text-muted-foreground`),children:e})]})});qB.displayName=`FluidSwitch`;var JB=(0,z.forwardRef)(({checked:e,defaultChecked:t=!1,onCheckedChange:n,disabled:r=!1,className:i},a)=>{let[o,s]=(0,z.useState)(t),c=e??o;return(0,R.jsx)(RB,{ref:a,checked:c,disabled:r,onCheckedChange:t=>{e===void 0&&s(t),n?.(t)},className:D(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors duration-80`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)]`,`disabled:cursor-not-allowed disabled:opacity-50`,`data-checked:bg-primary data-unchecked:bg-input`,i),children:(0,R.jsx)(zB,{className:D(`pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform duration-80`,`data-checked:translate-x-4 data-unchecked:translate-x-0`)})})});JB.displayName=`ShadcnSwitch`;var YB=(0,z.forwardRef)((e,t)=>KB(e)?(0,R.jsx)(qB,{ref:t,...e}):(0,R.jsx)(JB,{ref:t,...e}));YB.displayName=`Switch`;function XB({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 -28.5 256 256`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,R.jsx)(`path`,{d:`M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z`,fillRule:`nonzero`})})}var ZB=`flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,QB=`color-mix(in oklab, var(--sidebar-foreground) 22%, var(--sidebar))`,$B=`color-mix(in oklab, var(--sidebar-foreground) 30%, var(--sidebar))`,eV=`data-unchecked:!bg-zinc-300 dark:data-unchecked:!bg-zinc-600`;function tV({collapsed:e,rpcLoggerOpen:t,onRpcLoggerOpenChange:n,onCommandPaletteOpen:r}){let{embeddedConfig:i}=yL(),{theme:a,setTheme:o}=Oz(),{user:s}=sz(i.chatApiUrl),c=s?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,l=()=>{try{OT(new Eo({referrer:`mcp-use-inspector-sidebar`})).catch(()=>{})}catch{}};return(0,R.jsx)(`footer`,{className:`mt-auto shrink-0`,children:(0,R.jsxs)(`div`,{className:D(`flex flex-col`,e?`items-center gap-2 px-2 py-3`:`gap-3 px-(--sidebar-nav-inset-x) py-4`),children:[e?(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`div`,{className:`flex size-8 items-center justify-center`,children:(0,R.jsx)(YB,{checked:t,onCheckedChange:n,"aria-label":`RPC Panel`,className:D(`scale-75`,eV)})}),nativeButton:!1}),(0,R.jsx)(wt,{side:`right`,children:`RPC Panel`})]}):(0,R.jsx)(YB,{label:`RPC Panel`,checked:t,onToggle:()=>n(!t),uncheckedTrackColor:QB,uncheckedTrackColorHovered:$B,className:`w-full flex-row-reverse justify-between`}),e?(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:l,className:ZB,"aria-label":`Deploying your MCP Server? Try manufact.com`,children:(0,R.jsx)(Ar,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:`right`,children:`Deploying your MCP Server? Try manufact.com`})]}):(0,R.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:l,className:`relative block rounded-xl border border-sidebar-border bg-white p-3 transition-colors hover:bg-sidebar-accent/50 dark:bg-black`,children:[(0,R.jsx)(Ar,{className:`absolute top-2.5 right-2.5 size-3.5 text-muted-foreground`,"aria-hidden":!0}),(0,R.jsx)(`p`,{className:`pr-5 text-xs leading-snug text-muted-foreground`,children:`Deploying your MCP Server?`}),(0,R.jsxs)(`p`,{className:`mt-0.5 text-xs leading-snug`,children:[`Try`,` `,(0,R.jsx)(`span`,{className:`font-medium underline underline-offset-2`,children:`manufact.com`})]})]}),(0,R.jsxs)(`div`,{className:D(`flex`,e?`flex-col items-center gap-1`:`flex-row items-center gap-2`),children:[(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,className:ZB,"aria-label":`GitHub`,children:(0,R.jsx)(AB,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:e?`right`:`top`,children:`GitHub`})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`a`,{href:`https://discord.gg/XkNkSkMz3V`,target:`_blank`,rel:`noopener noreferrer`,className:ZB,"aria-label":`Discord`,children:(0,R.jsx)(XB,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:e?`right`:`top`,children:`Discord`})]}),(0,R.jsxs)(Ya,{children:[(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(Xa,{render:(0,R.jsx)(`button`,{type:`button`,className:ZB,"aria-label":`Theme`,children:a===`light`?(0,R.jsx)(Ui,{className:`size-4`}):a===`dark`?(0,R.jsx)(xi,{className:`size-4`}):(0,R.jsx)(bi,{className:`size-4`})}),nativeButton:!0}),nativeButton:!0}),(0,R.jsx)(wt,{side:e?`right`:`top`,children:`Theme`})]}),(0,R.jsx)(Za,{side:e?`right`:`top`,align:e?`start`:`center`,className:`w-40`,children:(0,R.jsxs)(eo,{value:a,onValueChange:e=>o(e),children:[(0,R.jsxs)(to,{value:`light`,children:[(0,R.jsx)(Ui,{className:`size-4 mr-2`}),`Light`]}),(0,R.jsxs)(to,{value:`dark`,children:[(0,R.jsx)(xi,{className:`size-4 mr-2`}),`Dark`]}),(0,R.jsxs)(to,{value:`system`,children:[(0,R.jsx)(bi,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`button`,{type:`button`,onClick:r,className:ZB,"aria-label":`Command Palette`,"data-testid":`command-palette-trigger-button`,children:(0,R.jsx)(Ur,{className:`size-4`})}),nativeButton:!0}),(0,R.jsxs)(wt,{side:e?`right`:`top`,children:[`Command Palette (`,`⌘`,`K)`]})]})]})]})})}function nV(e,t){let n=0,r=0,i=e;for(;i&&i!==t;)n+=i.offsetTop,r+=i.offsetLeft,i=i.offsetParent;if(i!==t){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{top:r.top-n.top,left:r.left-n.left,width:r.width,height:r.height}}return{top:n,left:r,width:e.offsetWidth,height:e.offsetHeight}}function rV(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.top!==i.top||n.left!==i.left||n.width!==i.width||n.height!==i.height)return!1}return!0}function iV(e,t={}){let{axis:n=`y`}=t,r=(0,z.useRef)(new Map),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)({}),c=(0,z.useRef)({}),l=(0,z.useRef)(0),u=(0,z.useRef)(null),d=(0,z.useRef)(null),f=(0,z.useCallback)(()=>{let t=e.current;if(!t)return;let n={};r.current.forEach((e,r)=>{n[r]=nV(e,t)}),!rV(c.current,n)&&(c.current=n,s(n))},[e]),p=(0,z.useCallback)((e,t)=>{t?r.current.set(e,t):r.current.delete(e),d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{d.current=null,f()})},[f]),m=(0,z.useCallback)(t=>{let r=t.clientX,i=t.clientY;u.current!==null&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null;let t=e.current;if(!t)return;let o=t.getBoundingClientRect(),s=n===`x`?r:i,l=null,d=1/0,f=null,p=c.current,m=n===`x`?t.scrollLeft:t.scrollTop,h=n===`x`?t.clientLeft:t.clientTop,g=n===`x`?o.left:o.top,_=n===`x`?t.offsetWidth:t.offsetHeight,v=n===`x`?o.width:o.height,y=_>0?v/_:1;for(let[e,t]of Object.entries(p)){let r=g+(h+(n===`x`?t.left:t.top)-m)*y,i=(n===`x`?t.width:t.height)*y,a=r+i;s>=r&&s<=a&&(f=e);let o=r+i/2,c=Math.abs(s-o);c<d&&(d=c,l=e)}a(f??l)})},[n,e]),h=(0,z.useCallback)(()=>{l.current+=1},[]),g=(0,z.useCallback)(()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),a(null)},[]);return(0,z.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>{d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{d.current=null,f()})});return n.observe(t),()=>n.disconnect()},[e,f]),(0,z.useEffect)(()=>()=>{u.current!==null&&cancelAnimationFrame(u.current),d.current!==null&&cancelAnimationFrame(d.current)},[]),{activeKey:i,itemRects:o,sessionRef:l,handlers:{onMouseMove:m,onMouseEnter:h,onMouseLeave:g},registerItem:p,measureItems:f}}function aV(e){if(!e)return{left:0,right:0};let t=getComputedStyle(e),n=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-pill-bleed`))||0,r=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-scrollbar-width`))||0,i=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-pill-outer-trim-right`))||0;return{left:n,right:n+r+i}}function oV(e,t){return{...e,left:e.left-t.left,width:e.width+t.left+t.right}}var sV=(0,z.createContext)(null);function cV(){let e=(0,z.useContext)(sV),t=(0,z.useRef)(e?.registerItem);t.current=e?.registerItem;let n=(0,z.useRef)(new Map);return(0,z.useCallback)(e=>{let r=n.current,i=r.get(e);return i||(i=n=>t.current?.(e,n),r.set(e,i)),i},[])}function lV({children:e,isActiveKey:t,className:n}){let r=(0,z.useRef)(null),{activeKey:i,itemRects:a,sessionRef:o,handlers:s,registerItem:c,measureItems:l}=iV(r),u=(0,z.useMemo)(()=>({registerItem:c}),[c]),d=Object.keys(a).find(e=>t(e))??null;(0,z.useLayoutEffect)(()=>{l()},[l,e,d]);let f=aV(r.current),p=i?a[i]:null,m=d?a[d]:null,h=p?oV(p,f):null,g=m?oV(m,f):null,_=i!==null&&i!==d;return(0,R.jsx)(sV.Provider,{value:u,children:(0,R.jsxs)(`div`,{ref:r,onMouseEnter:s.onMouseEnter,onMouseMove:s.onMouseMove,onMouseLeave:s.onMouseLeave,className:D(`relative isolate`,n),children:[(0,R.jsx)(en,{initial:!1,children:g&&d?(0,R.jsx)(F.div,{"aria-hidden":!0,className:`pointer-events-none absolute -z-20 rounded-full bg-sidebar-accent`,initial:{opacity:0,top:g.top,left:g.left,width:g.width,height:g.height},animate:{opacity:_?.85:1,top:g.top,left:g.left,width:g.width,height:g.height},exit:{opacity:0,transition:Ot.fast.exit},transition:{opacity:{duration:.08},top:{duration:0},left:{duration:0},width:{duration:0},height:{duration:0}}},d):null}),(0,R.jsx)(en,{children:h?(0,R.jsx)(F.div,{"aria-hidden":!0,className:`pointer-events-none absolute -z-10 rounded-full bg-sidebar-accent`,initial:{opacity:0,top:g?.top??h.top,left:g?.left??h.left,width:g?.width??h.width,height:g?.height??h.height},animate:{opacity:1,top:h.top,left:h.left,width:h.width,height:h.height},exit:{opacity:0,transition:Ot.fast.exit},transition:{...Ot.fast,opacity:{duration:.08}}},o.current):null}),e]})})}var uV=D(`pointer-events-auto absolute right-(--sidebar-nav-trailing-right) top-1/2 z-10 flex h-(--sidebar-nav-trailing-size) min-w-(--sidebar-nav-trailing-size) -translate-y-1/2 items-center justify-center`,D(`transition-[opacity,filter] duration-200 ease-out`,`opacity-100 blur-0`,`group-data-[collapsible=icon]:opacity-0 group-data-[collapsible=icon]:blur-[3px] group-data-[collapsible=icon]:pointer-events-none`,`group-data-[collapsed=true]:opacity-0 group-data-[collapsed=true]:blur-[3px] group-data-[collapsed=true]:pointer-events-none`)),dV=D(`truncate transition-[opacity,filter,margin] duration-200 ease-out`,`group-data-[collapsible=icon]:hidden`,`group-data-[collapsed=true]:hidden`),fV=D(`peer/menu-button flex cursor-pointer items-center gap-2 overflow-hidden rounded-full py-2 text-left text-sm outline-hidden ring-sidebar-ring hover:text-sidebar-accent-foreground group-hover/menu-item:text-sidebar-accent-foreground focus-visible:ring-2 active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:font-medium data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,`transition-[width,max-width,height,padding,border-radius] duration-200 ease-out`,`h-8 text-sm`);function pV({count:e}){return(0,R.jsx)(`span`,{className:D(`inline-flex h-5 shrink-0 items-center justify-center border border-border bg-zinc-200 px-1 text-[10px] font-medium tabular-nums leading-none text-foreground dark:bg-zinc-700`,String(e).length>=3?`min-w-5 rounded-md`:`size-5 min-w-5 rounded-full`),children:e})}function mV(e){return e.id!==`separator`}function hV({activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i}){let a=cV();return(0,R.jsx)(`ul`,{className:`flex w-full min-w-0 flex-col gap-1 px-(--sidebar-nav-inset-x) group`,"data-collapsed":i,"aria-label":`Inspector tabs`,children:(r?Vz.filter(e=>mV(e)&&r.includes(e.id)):Vz.filter(mV)).map((r,o)=>{let s=zz(r.id,n),c=Bz(r.id,s,i),l=r.icon,u=e===r.id,d=s>0||c,f=(0,R.jsxs)(`button`,{ref:a(r.id),type:`button`,"data-testid":`tab-${r.id}`,"data-active":u?!0:void 0,onClick:()=>t(r.id),className:D(fV,i?`size-8! w-8! max-w-8! shrink-0 justify-center gap-0 p-0!`:`w-full max-w-full sidebar-nav-pill-bleed-x pl-(--sidebar-nav-icon-pl-bleed) pr-(--sidebar-nav-pr-bleed)`,d&&!i&&`pr-[calc(var(--sidebar-nav-trailing-right)+var(--sidebar-nav-trailing-size))]`),children:[(0,R.jsx)(l,{className:`size-4 shrink-0`}),(0,R.jsx)(`span`,{className:dV,children:r.label})]});return(0,R.jsxs)(`li`,{className:D(`group/menu-item relative`,o===0&&`mt-4`),children:[i?(0,R.jsxs)(mt,{delayDuration:0,children:[(0,R.jsx)(Fe,{render:f,nativeButton:!0}),(0,R.jsx)(wt,{side:`right`,children:s>0?`${r.label} (${s})`:r.label})]}):f,d&&!i?(0,R.jsx)(`div`,{className:uV,children:s>0?(0,R.jsx)(pV,{count:s}):c?(0,R.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full bg-yellow-500 animate-status-pulse-yellow`}):null}):null]},r.id)})})}function gV({activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i,onCollapsedChange:a,rpcLoggerOpen:o,onRpcLoggerOpenChange:s,onCommandPaletteOpen:c}){return(0,R.jsxs)(`aside`,{className:D(`group/sidebar relative hidden lg:flex flex-col shrink-0 text-sidebar-foreground transition-[width] duration-200 ease-out @container/sidebar`,i?`w-(--sidebar-width-icon)`:`w-(--sidebar-width)`),"data-collapsed":i,"data-collapsible":i?`icon`:`expanded`,children:[(0,R.jsx)(`div`,{className:`sidebar-nav-scroll flex-1 overflow-y-auto overflow-x-hidden min-h-0`,children:(0,R.jsx)(lV,{isActiveKey:t=>t===e,className:`pb-2`,children:(0,R.jsx)(hV,{activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i})})}),(0,R.jsx)(tV,{collapsed:i,rpcLoggerOpen:o,onRpcLoggerOpenChange:s,onCommandPaletteOpen:c}),(0,R.jsx)(kB,{collapsed:i,onToggle:()=>a(!i)})]})}function _V(e){if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/t**r*100)/100+` `+n[r]}function vV(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**r).toFixed(1))} ${n[r]}`}var yV=100*1024,bV=1024*20;function xV(e,t){if(e==null)return e;if(typeof e==`string`)return e.length>t?e.substring(0,t)+`... (truncated)`:e;if(Array.isArray(e))return e.map(e=>xV(e,t));if(typeof e==`object`){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=xV(e[r],t));return n}return e}function SV(e){let t=JSON.stringify(e,null,2);return new TextEncoder().encode(t).length>yV?xV(e,bV):e}function CV(e){let t=JSON.stringify(e,null,2),n=new TextEncoder().encode(t).length,r=n>yV,i;if(r){let t=xV(e,bV);i=JSON.stringify(t,null,2)}else i=t;return{isLarge:r,size:n,sizeFormatted:_V(n),preview:i,full:t}}function wV(e,t){try{let n=JSON.stringify(e,null,2),r=globalThis.Blob,i=new r([n],{type:`application/json`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=t||`data-${Date.now()}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)}catch(e){throw console.error(`Failed to download JSON:`,e),e}}var TV={key:`text-sky-600 dark:text-sky-400`,string:`text-emerald-600 dark:text-emerald-400`,number:`text-amber-600 dark:text-amber-400`,boolean:`text-violet-600 dark:text-violet-400`,null:`text-zinc-500 dark:text-zinc-400`,punctuation:`text-muted-foreground`};function EV(e){let t=[],n=0,r=(e,n)=>{n&&t.push({kind:e,text:n})};for(;n<e.length;){let t=e[n];if(t===`"`){let t=n;for(n++;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(e[n]===`"`){n++;break}n++}let i=e.slice(t,n),a=n;for(;a<e.length&&/[ \t]/.test(e[a]);)a++;r(e[a]===`:`?`key`:`string`,i);continue}if(/[0-9-]/.test(t)){let t=n;for(e[n]===`-`&&n++;n<e.length&&/[0-9.eE+-]/.test(e[n]);)n++;r(`number`,e.slice(t,n));continue}if(e.startsWith(`true`,n)||e.startsWith(`false`,n)){let t=e.startsWith(`true`,n)?`true`:`false`;r(`boolean`,t),n+=t.length;continue}if(e.startsWith(`null`,n)){r(`null`,`null`),n+=4;continue}if(/[{}[\],:]/.test(t)){r(`punctuation`,t),n++;continue}r(`punctuation`,t),n++}return t}function DV(e){return EV(e).map((e,t)=>(0,R.jsx)(`span`,{className:TV[e.kind],children:e.text},t))}var OV={string:`text-emerald-600 dark:text-emerald-400`,number:`text-amber-600 dark:text-amber-400`,boolean:`text-violet-600 dark:text-violet-400`,null:`text-zinc-500 dark:text-zinc-400`,key:`text-sky-600 dark:text-sky-400`,punctuation:`text-muted-foreground`};function kV(e){return e===null?(0,R.jsx)(`span`,{className:OV.null,children:`null`}):typeof e==`string`?(0,R.jsx)(`span`,{className:OV.string,children:JSON.stringify(e)}):typeof e==`number`?(0,R.jsx)(`span`,{className:OV.number,children:String(e)}):typeof e==`boolean`?(0,R.jsx)(`span`,{className:OV.boolean,children:String(e)}):(0,R.jsx)(`span`,{className:OV.string,children:JSON.stringify(e)})}function AV(e){return Array.isArray(e)?`[${e.length}]`:`{${Object.keys(e).length}}`}function jV({label:e,value:t,depth:n,defaultExpanded:r}){let i=typeof t==`object`&&t&&!Array.isArray(t)?Object.keys(t).length>0:Array.isArray(t)?t.length>0:!1,[a,o]=(0,z.useState)(i&&(r||n===0));if(!i){let r=Array.isArray(t)?`[]`:`{}`;return typeof t==`object`&&t?(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,style:{paddingLeft:n*12},children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:OV.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:OV.punctuation,children:`: `})]}),(0,R.jsx)(`span`,{className:OV.punctuation,children:r})]}):(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,style:{paddingLeft:n*12},children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:OV.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:OV.punctuation,children:`: `})]}),kV(t)]})}let s=Array.isArray(t)?t.map((e,t)=>[String(t),e]):Object.entries(t),c=Array.isArray(t),l=c?`[`:`{`,u=c?`]`:`}`;return(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-0.5`,style:{paddingLeft:n*12},children:[(0,R.jsx)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`mt-0.5 inline-flex shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground`,children:(0,R.jsx)(ne,{className:D(`h-3.5 w-3.5 transition-transform`,a&&`rotate-90`)})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:OV.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:OV.punctuation,children:`: `})]}),(0,R.jsx)(`span`,{className:OV.punctuation,children:l}),!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`mx-1 text-xs text-muted-foreground hover:text-foreground`,children:AV(t)}),(0,R.jsx)(`span`,{className:OV.punctuation,children:u})]})]})]}),a&&(0,R.jsxs)(`div`,{children:[s.map(([e,t])=>(0,R.jsx)(jV,{label:e,value:t,depth:n+1,defaultExpanded:r},`${n}-${e}`)),(0,R.jsx)(`div`,{style:{paddingLeft:n*12},children:(0,R.jsx)(`span`,{className:OV.punctuation,children:u})})]})]})}function MV({data:e,defaultExpanded:t=!0,className:n}){return(0,R.jsx)(`div`,{className:D(`text-gray-900 dark:text-gray-100 [overflow-wrap:anywhere]`,n),"data-testid":`collapsible-json`,children:(0,R.jsx)(jV,{value:e,depth:0,defaultExpanded:t})})}var NV=`font-mono text-[0.8rem] text-gray-900 dark:text-gray-100 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`;function PV({data:e,filename:t,className:n,collapsible:r=!1,defaultExpanded:i=!0,...a}){let o=CV(e),s=SV(e),c=o.isLarge?(0,R.jsx)(`div`,{className:`mb-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsxs)(`p`,{className:`text-sm font-medium text-yellow-800 dark:text-yellow-300 mb-1`,children:[`JSON is too large (`,o.sizeFormatted,`)`]}),(0,R.jsx)(`p`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:`Showing full structure with truncated values. Download the full JSON file to see complete values.`})]}),(0,R.jsxs)(kt,{variant:`outline`,size:`sm`,onClick:()=>{wV(e,t)},className:`shrink-0`,children:[(0,R.jsx)(qr,{className:`h-4 w-4 mr-1`}),`Download`]})]})}):null;return r?(0,R.jsxs)(`div`,{className:n,...a,children:[c,(0,R.jsx)(MV,{data:s,defaultExpanded:i})]}):o.isLarge?(0,R.jsxs)(`div`,{className:n,...a,children:[c,(0,R.jsx)(`pre`,{className:NV,children:(0,R.jsx)(`code`,{children:DV(o.preview)})})]}):(0,R.jsx)(`div`,{className:n,...a,children:(0,R.jsx)(`pre`,{className:NV,children:(0,R.jsx)(`code`,{children:DV(o.preview)})})})}function FV(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var IV=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function LV(e){return z.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[IV.checked]:``}:{[IV.unchecked]:``}},...Tn}),[e.indeterminate])}var RV=z.createContext({disabled:!1});function zV(){return z.useContext(RV)}var BV=z.createContext(void 0);function VV(e=!0){let t=z.useContext(BV);if(t===void 0&&!e)throw Error(Be(3));return t}var HV=z.createContext(void 0);function UV(){let e=z.useContext(HV);if(e===void 0)throw Error(Be(14));return e}var WV=`data-parent`,GV=z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:_=!1,uncheckedValue:v,value:y,nativeButton:b=!1,style:x,...S}=e,{clearErrors:C}=An(),{disabled:w,name:T,setDirty:E,setFilled:ee,setFocused:te,setTouched:ne,state:re,validationMode:ie,validityData:ae,validation:D}=On(),O=zV(),{labelId:k,controlId:oe,registerControlId:j,getDescriptionProps:ce}=kn(),M=VV(),N=M?.parent,le=N&&M.allValues,ue=w||O.disabled||M?.disabled||o,de=T??d,fe=y??de,pe=se(),me=se(),he=oe;le?he=p?me:`${N.id}-${fe}`:c&&(he=c);let ge={};le&&(p?ge=M.parent.getParentProps():fe&&(ge=M.parent.getChildProps(fe)));let{checked:_e=n,indeterminate:ve=l,onCheckedChange:be,...xe}=ge,P=M?.value,Se=M?.setValue,Ce=M?.defaultValue,we=z.useRef(null),Te=Rt(()=>Symbol(`checkbox-control`)),Ee=z.useRef(!1),{getButtonProps:De,buttonRef:Oe}=Ne({disabled:ue,native:b}),Ae=M?.validation??D,[je,Me]=Yt({controlled:fe&&P&&!p?P.includes(fe):_e,default:fe&&Ce&&!p?Ce.includes(fe):i,name:`Checkbox`,state:`checked`}),Pe=le?!!_e:je,Fe=le&&ve||l;ye(()=>{j!==I&&(Ee.current=!0,j(Te.current,he))},[he,j,Te]),z.useEffect(()=>{let e=Te.current;return()=>{!Ee.current||j===I||(Ee.current=!1,j(e,void 0))}},[j,Te]),En(we,pe,je,void 0,!M&&!ue,d);let Le=z.useRef(null),Re=Ye(u,Le,Ae.inputRef,Ae.registerInput),ze=FB(a,k,Le,!b,he??void 0);ye(()=>{Le.current&&(Le.current.indeterminate=Fe,je&&ee(!0))},[je,Fe,ee]),Dn(je,()=>{M||(C(de),ee(je),E(je!==ae.initialValue),Ae.change(je))});let Be=Vt({checked:je,disabled:ue,form:s,name:p?void 0:de,id:b?void 0:he??void 0,required:_,ref:Re,style:de?Ie:tt,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=A(ke,e.nativeEvent);f?.(t,n),!n.isCanceled&&(be?.(t,n),!n.isCanceled&&(Me(t),fe&&P&&Se&&!p&&!le&&Se(t?[...P,fe]:P.filter(e=>e!==fe),n)))},onFocus(){we.current?.focus()}},y===void 0?bt:{value:(M?je&&y:y)||``},ce,e=>Ae.getValidationProps(ue,e));z.useEffect(()=>{if(!N||!fe)return;let e=N.disabledStatesRef.current;return e.set(fe,ue),()=>{e.delete(fe)}},[N,ue,fe]);let Ve=z.useMemo(()=>({...re,checked:Pe,disabled:ue,readOnly:m,required:_,indeterminate:Fe}),[re,Pe,ue,m,_,Fe]),He=LV(Ve),We=Ue(`span`,e,{state:Ve,ref:[Oe,we,t,M?.registerControlRef],props:[{id:b?he??void 0:pe,role:`checkbox`,"aria-checked":Fe?`mixed`:Pe,"aria-readonly":m||void 0,"aria-required":_||void 0,"aria-labelledby":ze,[WV]:p?``:void 0,onFocus(){ue||te(!0)},onBlur(){let e=Le.current;e&&(ne(!0),te(!1),ie===`onBlur`&&Ae.commit(M?P:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Le.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),g(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||FV(t)?.click()})},onClick(e){if(m||ue)return;e.preventDefault();let t=Le.current;t&&t.dispatchEvent(new(g(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},S,xe,De,ce,e=>Ae.getValidationProps(ue,e)],stateAttributesMapping:He});return(0,R.jsxs)(HV.Provider,{value:Ve,children:[We,!je&&!M&&de&&!p&&v!==void 0&&(0,R.jsx)(`input`,{type:`hidden`,form:s,name:de,value:v,disabled:ue}),(0,R.jsx)(`input`,{...Be,suppressHydrationWarning:!0})]})}),KV=z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=UV(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=st(c),f=z.useRef(null),p={...s,transitionStatus:u};y({open:c,ref:f,onComplete(){c||d(!1)}});let m={...LV(s),...vt,...Tn},h=a||l,g=Ue(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null}),qV=(0,z.createContext)(null);function JV(){let e=(0,z.useContext)(qV);if(!e)throw Error(`useCheckboxGroup must be used within a CheckboxGroup`);return e}var YV=(0,z.forwardRef)(({children:e,checkedIndices:t,orientation:n=`vertical`,className:r,...i},a)=>{let o=(0,z.useRef)(null),s=n===`horizontal`,{activeIndex:c,setActiveIndex:l,handlers:u,registerItem:d,measureItems:f}=_n(o,{axis:s?`x`:`y`});(0,z.useEffect)(()=>{f()},[f,e]);let p=s?`ArrowLeft`:`ArrowUp`,m=s?`ArrowRight`:`ArrowDown`;return(0,R.jsx)(qV.Provider,{value:{registerItem:d,activeIndex:c},children:(0,R.jsx)(`div`,{ref:e=>{o.current=e,typeof a==`function`?a(e):a&&(a.current=e)},onMouseEnter:u.onMouseEnter,onMouseMove:u.onMouseMove,onMouseLeave:u.onMouseLeave,onFocus:e=>{let t=e.target.closest(`[data-proximity-index]`)?.getAttribute(`data-proximity-index`);t!=null&&l(Number(t))},onBlur:e=>{o.current?.contains(e.relatedTarget)||l(null)},onKeyDown:e=>{let t=Array.from(o.current?.querySelectorAll(`[data-proximity-index]`)??[]),n=t.indexOf(e.target);n!==-1&&([p,m].includes(e.key)?(e.preventDefault(),t[e.key===m?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()):e.key===`Home`?(e.preventDefault(),t[0]?.focus()):e.key===`End`&&(e.preventDefault(),t[t.length-1]?.focus()))},role:`group`,className:D(`relative flex max-w-full select-none`,s?`w-auto flex-row`:`w-72 flex-col`,r),...i,children:e})})});YV.displayName=`CheckboxGroup`;var XV=(0,z.forwardRef)(({label:e,index:t,checked:n,onToggle:r,size:i=`default`,className:a,...o},s)=>{let c=(0,z.useRef)(null),l=(0,z.useRef)(!1),{registerItem:u,activeIndex:d}=JV();(0,z.useEffect)(()=>(u(t,c.current),()=>u(t,null)),[t,u]),(0,z.useEffect)(()=>{l.current=!0},[]);let f=d===t,p=!l.current,m=E(),h=i===`sm`;return(0,R.jsxs)(`div`,{ref:e=>{c.current=e,typeof s==`function`?s(e):s&&(s.current=e)},"data-proximity-index":t,tabIndex:0,role:`checkbox`,"aria-checked":n,"aria-label":e,onClick:r,onMouseDown:e=>{let t=e.target.closest(`button:not([tabindex="-1"]), a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);t&&t!==e.currentTarget||(e.preventDefault(),e.currentTarget.focus())},onKeyDown:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),r())},className:D(`relative z-10 flex items-center cursor-pointer outline-none`,h?`h-7 gap-1.5 px-2`:`h-8 gap-2.5 px-3`,m.item,`focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)]`,a),...o,children:[(0,R.jsxs)(GV,{checked:n,tabIndex:-1,"aria-hidden":!0,className:D(`pointer-events-none relative shrink-0 appearance-none bg-transparent p-0 border-0 outline-none`,h?`size-[13px]`:`size-[15px]`),children:[(0,R.jsx)(`div`,{className:D(`absolute inset-0 rounded-[5px] border-solid transition-all duration-80 border-[1.5px]`,n?`border-border`:f?`border-neutral-400 dark:border-neutral-500`:`border-border`)}),(0,R.jsx)(en,{children:n&&(0,R.jsx)(KV,{keepMounted:!0,render:e=>{let{style:t,onDrag:n,onDragStart:r,onDragEnd:i,onAnimationStart:a,onAnimationEnd:o,onAnimationIteration:s,...c}=e;return(0,R.jsx)(F.svg,{...c,width:h?14:18,height:h?14:18,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-foreground`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:1},children:(0,R.jsx)(F.path,{d:`M6 12L10 16L18 8`,initial:{pathLength:+!!p},animate:{pathLength:1,transition:{duration:.08,ease:`easeOut`}},exit:{pathLength:0,transition:{duration:.04,ease:`easeIn`}}})})}})})]}),(0,R.jsxs)(`span`,{className:`inline-grid items-center self-center leading-none`,children:[(0,R.jsx)(`span`,{className:`col-start-1 row-start-1 invisible leading-none`,style:{fontVariationSettings:Ve.semibold},"aria-hidden":`true`,children:e}),(0,R.jsx)(`span`,{className:D(`col-start-1 row-start-1 leading-none transition-[color,font-variation-settings] duration-80`,h?`text-[11px]`:`text-[13px]`,n||f?`text-foreground`:`text-muted-foreground`),style:{fontVariationSettings:n?Ve.semibold:Ve.normal},children:e})]})]})});XV.displayName=`CheckboxItem`;var ZV=36,QV=188,$V=6;function eH(e,t,n){let[r,i]=(0,z.useState)(0),[a,o]=(0,z.useState)(0),s=(0,z.useMemo)(()=>{let n=[],r=[],i=0;for(let a of e){n.push(i);let e=ZV+(t.has(a.id)?QV:0);r.push(e),i+=e}return{offsets:n,heights:r,totalHeight:i}},[t,e]),c=(0,z.useMemo)(()=>{if(e.length===0)return{totalHeight:0,visibleItems:[]};let{offsets:t,heights:n,totalHeight:i}=s,o=r+a,c=0;for(;c<e.length&&t[c]+n[c]<r;)c++;c=Math.max(0,c-$V);let l=c;for(;l<e.length&&t[l]<o;)l++;l=Math.min(e.length,l+$V);let u=[];for(let r=c;r<l;r++)u.push({index:r,item:e[r],top:t[r],height:n[r]});return{totalHeight:i,visibleItems:u}},[e,s,r,a]),l=(0,z.useCallback)(()=>{let e=n.current;e&&i(e.scrollTop)},[n]);return(0,z.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{o(e.clientHeight),i(e.scrollTop)};t();let r=new ResizeObserver(t);return r.observe(e),e.addEventListener(`scroll`,l,{passive:!0}),()=>{r.disconnect(),e.removeEventListener(`scroll`,l)}},[l,n,e.length]),c}var tH=300,nH=/(?:^|\/)notifications\//;function rH(e){let t=e;return typeof t?.method==`string`?t.method:null}function iH(e){let t=e.message;if(t?.id!==void 0&&t.id!==null||t?.result!==void 0||t?.error!==void 0)return null;let n=rH(e.message);return!n||!nH.test(n)?null:[e.source,e.serverId,e.widgetId??``,e.direction,n].join(`|`)}function aH(e,t,n=Date.now()){let r=iH(e),i=iH(t);if(!r||r!==i)return!1;let a=Date.parse(e.timestamp);return Number.isNaN(a)?!1:n-a<=tH}function oH(e,t){return{...e,timestamp:t.timestamp,message:t.message,repeatCount:(e.repeatCount??1)+1}}var sH=new class{maxEntries;entries=[];listeners=new Set;nextId=0;emitFrame=null;constructor(e=1e3){this.maxEntries=e}publish(e){let t=this.entries[this.entries.length-1];if(t&&aH(t,e,Date.parse(e.timestamp))){this.entries[this.entries.length-1]=oH(t,e),this.scheduleEmit();return}this.entries.push({...e,id:`rpc-${++this.nextId}`}),this.entries.length>this.maxEntries&&this.entries.splice(0,this.entries.length-this.maxEntries),this.scheduleEmit()}getSnapshot=()=>this.entries;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));clear(e={}){let t=new Set(e.serverIds??[]),n=new Set(e.sources??[]);t.size===0&&n.size===0?this.entries=[]:this.entries=this.entries.filter(e=>!((t.size===0||t.has(e.serverId))&&(n.size===0||n.has(e.source)))),this.scheduleEmit()}peekCoalesceKey(e){return iH(e)}scheduleEmit(){if(this.emitFrame===null){if(typeof requestAnimationFrame>`u`){this.emit();return}this.emitFrame=requestAnimationFrame(()=>{this.emitFrame=null,this.emit()})}}emit(){this.listeners.forEach(e=>e())}},cH;function lH(e){sH.publish({source:`mcp`,serverId:e.serverId,direction:e.direction,timestamp:e.timestamp,message:e.message})}function uH(){cH||=(ak().forEach(lH),ok(lH))}uH();function dH({serverIds:e,onCountChange:t,onClearRef:n,onExportRef:r}={}){let i=(0,z.useRef)(null),[a,o]=(0,z.useState)(new Set),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(()=>new Set([`mcp`,`widget`])),p=(0,z.useSyncExternalStore)(sH.subscribe,sH.getSnapshot,sH.getSnapshot),m=async e=>{try{await nM(JSON.stringify(e,null,2)),QF.success(`Message copied to clipboard`)}catch(e){console.error(`Failed to copy message:`,e),QF.error(`Failed to copy to clipboard`)}},h=(0,z.useMemo)(()=>{if(!e?.length)return p;let t=new Set(e);return p.filter(e=>t.has(e.serverId))},[p,e]),g=(0,z.useMemo)(()=>{let e=new Set;return d.has(`mcp`)&&e.add(0),d.has(`widget`)&&e.add(1),e},[d]),_=(0,z.useCallback)(e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=(0,z.useMemo)(()=>{let e=h;d.size>0&&(e=e.filter(e=>d.has(e.source)));let t=s.trim().toLowerCase();return t&&(e=e.filter(e=>{let n=pH(e);return e.serverId.toLowerCase().includes(t)||e.widgetId?.toLowerCase().includes(t)||e.source.includes(t)||n.toLowerCase().includes(t)||e.direction.toLowerCase().includes(t)||JSON.stringify(e.message).toLowerCase().includes(t)})),[...e].reverse()},[h,s,d]),{totalHeight:y,visibleItems:b}=eH(v,a,i),x=(0,z.useCallback)(e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=(0,z.useCallback)(async()=>{let t=d.size===0||d.size===2?void 0:[...d];(!t||t.includes(`mcp`))&&(e?.length?e.forEach(e=>sk(e)):sk()),sH.clear({serverIds:e,sources:t}),o(new Set)},[e,d]),w=(0,z.useCallback)(async()=>{try{await nM(JSON.stringify(v,null,2)),QF.success(`Copied ${v.length} messages`)}catch(e){console.error(`Failed to copy messages:`,e),QF.error(`Failed to copy to clipboard`)}},[v]),T=(0,z.useCallback)(()=>{let e=new Blob([JSON.stringify(v,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`mcp-rpc-traffic-${new Date().toISOString().replaceAll(`:`,`-`)}.json`,n.click(),URL.revokeObjectURL(t)},[v]);return(0,z.useEffect)(()=>{t?.(v.length)},[v.length,t]),(0,z.useEffect)(()=>(n&&(n.current=S),()=>{n&&(n.current=null)}),[S,n]),(0,z.useEffect)(()=>(r&&(r.current=w),()=>{r&&(r.current=null)}),[w,r]),(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 pr-2 pt-2 pl-1`,children:[(0,R.jsx)(`h2`,{className:`text-xs font-medium text-foreground`,children:`RPC Logs`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:w,disabled:v.length===0,"aria-label":`Copy filtered RPC traffic`,title:`Copy filtered`,children:(0,R.jsx)(Wr,{className:`size-3.5`})}),(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:T,disabled:v.length===0,"aria-label":`Download filtered RPC traffic as JSON`,title:`Download JSON`,children:(0,R.jsx)(qr,{className:`size-3.5`})}),(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:S,disabled:p.length===0,"aria-label":`Clear RPC traffic`,title:`Clear`,children:(0,R.jsx)(Gi,{className:`size-3.5`})})]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center pr-2 pb-2 pt-1 pl-1`,children:[(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 transition-[flex-grow] duration-200 ease-out`,children:[(0,R.jsx)(C,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,R.jsx)(jt,{value:s,onChange:e=>c(e.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),placeholder:`Search`,"aria-label":`Search RPC traffic`,className:`h-8 w-full pl-7 text-xs shadow-none transition-[width] duration-200 ease-out`})]}),(0,R.jsx)(`div`,{"aria-hidden":l,className:D(`shrink-0 overflow-hidden transition-[max-width,opacity,margin] duration-200 ease-out`,l?`pointer-events-none ml-0 max-w-0 opacity-0`:`ml-2 max-w-32 opacity-100`),children:(0,R.jsxs)(YV,{checkedIndices:g,orientation:`horizontal`,"aria-label":`Filter RPC traffic by source`,className:`w-auto shrink-0`,children:[(0,R.jsx)(XV,{index:0,label:`MCP`,size:`sm`,checked:d.has(`mcp`),onToggle:()=>_(`mcp`)}),(0,R.jsx)(XV,{index:1,label:`UI`,size:`sm`,checked:d.has(`widget`),onToggle:()=>_(`widget`)})]})})]}),(0,R.jsx)(`div`,{ref:i,className:`min-h-0 flex-1 overflow-y-auto pb-10`,style:{maskImage:`linear-gradient(to bottom, black 0, black calc(100% - 3rem), transparent 100%)`,WebkitMaskImage:`linear-gradient(to bottom, black 0, black calc(100% - 3rem), transparent 100%)`},children:v.length===0?(0,R.jsxs)(`div`,{className:`text-center py-8`,children:[(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No messages yet`}),(0,R.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1`,children:`JSON-RPC messages will appear here`})]}):(0,R.jsx)(`div`,{className:`relative w-full`,style:{height:y},children:b.map(({item:e,top:t,height:n})=>(0,R.jsx)(fH,{item:e,top:t,height:n,expanded:a.has(e.id),onToggle:()=>x(e.id),onCopy:()=>m(e.message)},e.id))})})]})}function fH({item:e,top:t,height:n,expanded:r,onToggle:i,onCopy:a}){let o=pH(e),s=mH(e),c=e.repeatCount&&e.repeatCount>1?` ×${e.repeatCount}`:``;return(0,R.jsxs)(`div`,{className:`absolute inset-x-0 overflow-hidden`,style:{top:t,height:n},"data-testid":`rpc-message-${o.replace(/\//g,`-`)}`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:i,className:`flex h-9 w-full cursor-pointer items-center gap-2 py-2 pr-3 pl-1 text-left text-muted-foreground transition-colors hover:text-foreground`,children:[(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:e.direction===`receive`?(0,R.jsx)(Dr,{className:`size-3.5 text-blue-500`}):(0,R.jsx)(Ar,{className:`size-3.5 text-emerald-500`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:`left`,children:s})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center`,children:e.source===`mcp`?(0,R.jsx)(LL,{className:`size-3`}):(0,R.jsx)(Ti,{className:`size-3`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:`left`,children:e.source===`mcp`?`MCP server`:`UI widget`})]}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,children:[o,c?(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:c}):null]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`time`,{dateTime:e.timestamp,className:`shrink-0 cursor-default font-mono text-[10px] tabular-nums text-muted-foreground underline decoration-dotted underline-offset-2`,children:new Date(e.timestamp).toLocaleTimeString()}),nativeButton:!1}),(0,R.jsx)(wt,{side:`left`,children:new Date(e.timestamp).toLocaleString()})]})]}),r?(0,R.jsxs)(`div`,{className:`relative mx-3 mb-2 max-h-44 overflow-auto rounded-lg p-2 pr-8`,children:[(0,R.jsx)(PV,{data:e.message,className:`[&_pre]:!text-[10px] [&_pre]:!leading-4`}),(0,R.jsx)(kt,{variant:`secondary`,size:`icon-sm`,onClick:a,className:`absolute right-1 top-1 size-6 rounded-full p-0`,title:`Copy message`,"aria-label":`Copy message`,children:(0,R.jsx)(Wr,{className:`size-3`})})]}):null]})}function pH(e){let t=rH(e.message);if(t)return t;let n=e.message;return n?.result===void 0?n?.error===void 0?`unknown`:`error`:`result`}function mH(e){return e.source===`widget`?e.direction===`send`?`Host → Widget`:`Widget → Host`:e.direction===`send`?`Inspector → MCP`:`MCP → Inspector`}function hH({serverId:e,open:t}){return(0,R.jsx)(`aside`,{"aria-label":`RPC Panel`,"aria-hidden":!t,className:D(`relative hidden min-h-0 shrink-0 flex-col overflow-hidden transition-[width,margin] duration-200 ease-out lg:flex`,t?`w-(--rpc-panel-width) lg:mr-[18px]`:`w-0 lg:mr-0`),children:(0,R.jsx)(`div`,{className:D(`flex h-full min-h-0 w-(--rpc-panel-width) flex-col transition-opacity duration-200 ease-out`,t?`opacity-100`:`pointer-events-none opacity-0`),children:(0,R.jsx)(dH,{serverIds:[e]})})})}function gH({...e}){return(0,R.jsx)(qI,{"data-slot":`sheet`,...e})}function _H(e){return(0,R.jsx)(YI,{"data-slot":`sheet-trigger`,...e})}function vH({...e}){return(0,R.jsx)(BI,{"data-slot":`sheet-portal`,...e})}function yH({className:e,container:t,...n}){return(0,R.jsx)(jI,{"data-slot":`sheet-overlay`,className:D(`inset-0 z-50 bg-black/50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0`,t?`absolute`:`fixed`,e),...n})}function bH({className:e,children:t,side:n=`right`,showCloseButton:r=!0,container:i,...a}){return(0,R.jsxs)(vH,{container:i??void 0,children:[(0,R.jsx)(yH,{container:i}),(0,R.jsxs)(zI,{"data-slot":`sheet-content`,"data-side":n,className:D(`z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,i?`absolute`:`fixed`,e),...a,children:[t,r&&(0,R.jsxs)(MI,{"data-slot":`sheet-close`,render:(0,R.jsx)(kt,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,R.jsx)(Xi,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function xH({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`sheet-header`,className:D(`flex flex-col gap-1.5 p-4`,e),...t})}function SH({className:e,...t}){return(0,R.jsx)(JI,{"data-slot":`sheet-title`,className:D(`font-medium text-foreground`,e),...t})}function CH({className:e,...t}){return(0,R.jsx)(NI,{"data-slot":`sheet-description`,className:D(`text-sm text-muted-foreground`,e),...t})}var wH=`https://cdn.mcp-use.com/mcpuse_logo_circle_dark.svg`;function TH({symbolSize:e=14,className:t,textClassName:n}){return(0,R.jsxs)(`span`,{className:D(`inline-flex items-center gap-1.5`,t),children:[(0,R.jsx)(EH,{size:e}),(0,R.jsx)(`span`,{className:D(`font-medium leading-none text-black [font-family:var(--font-family-outfit)]`,n),children:`Manufact`})]})}function EH({size:e=14,className:t}){return(0,R.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 480 480`,"aria-hidden":!0,className:D(`block shrink-0`,t),children:[(0,R.jsx)(`path`,{d:`M101.7 0 C157.9 0 203.4 45.7 203.4 102.1 C203.4 126.6 202.1 152.1 212.2 174.3 L219.8 191 C233.8 221.8 258.5 246.4 289.2 260.5 L303.5 267 C326.5 277.5 353 275.8 378.3 275.8 C434.5 275.8 480 321.5 480 377.9 C480 434.3 434.5 480 378.3 480 C322.1 480 276.6 434.3 276.6 377.9 C276.6 354.2 277.7 329.6 267.8 308 L259.8 290.3 C245.7 259.5 221 234.8 190.2 220.7 L173 212.9 C151 202.9 125.8 204.2 101.7 204.2 C45.5 204.2 0 158.5 0 102.1 C0 45.7 45.5 0 101.7 0 Z`,fill:`currentColor`}),(0,R.jsx)(`circle`,{cx:`96.4`,cy:`383.6`,r:`96.4`,fill:`currentColor`}),(0,R.jsx)(`circle`,{cx:`383.6`,cy:`96.4`,r:`96.4`,fill:`currentColor`})]})}var DH=`data:image/svg+xml,%3Csvg%20width%3D%22512%22%20height%3D%22512%22%20viewBox%3D%220%200%20512%20512%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22%2394A3B8%22%20stroke%3D%22%2394A3B8%22%3E%3Cg%3E%3Cpath%20fill%3D%22none%22%20d%3D%22M3%20248.945C18%20248.945%2076%20236%20106%20219C136%20202%20136%20202%20198%20158C276.497%20102.293%20332%20120.945%20423%20120.945%22%20stroke-width%3D%2290%22%2F%3E%3Cpath%20d%3D%22M511%20121.5L357.25%20210.268L357.25%2032.7324L511%20121.5Z%22%2F%3E%3Cpath%20fill%3D%22none%22%20d%3D%22M0%20249C15%20249%2073%20261.945%20103%20278.945C133%20295.945%20133%20295.945%20195%20339.945C273.497%20395.652%20329%20377%20420%20377%22%20stroke-width%3D%2290%22%2F%3E%3Cpath%20d%3D%22M508%20376.445L354.25%20287.678L354.25%20465.213L508%20376.445Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E`,OH={openai:`OpenAI`,anthropic:`Anthropic`,google:`Google`};function kH(e){let t=e.split(`/`)[0]?.toLowerCase();return t===`openai`||t===`anthropic`||t===`google`?t:`openrouter`}function AH(e,t){let n=e.trim(),r=OH[t];if(r){let e=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),t=RegExp(`^${e}\\s*:\\s*`,`i`),i=n.replace(t,``).trim();if(i.length>0)return i}let i=n.indexOf(`: `);return i>0&&i<48?n.slice(i+2).trim():n}function jH({provider:e,model:t,displayName:n,mode:r=`byok`,className:i,...a}){let o=n??t,s=r===`managed`&&e===`openai-compatible`?kH(t):e;return(0,R.jsxs)(`button`,{type:`button`,className:D(`inline-flex items-center gap-1.5 min-w-0 border-0 bg-transparent p-1`,`font-mono text-[11px] text-muted-foreground cursor-pointer`,`hover:text-foreground transition-colors`,`rounded-md outline-none focus-visible:ring-1 focus-visible:ring-ring`,i),...a,children:[r===`managed`?(0,R.jsx)(`img`,{src:wH,alt:`Manufact`,className:`h-3.5 w-3.5 shrink-0 rounded-full object-cover`}):(0,R.jsx)(ci,{className:`size-3 shrink-0 opacity-70`,"aria-hidden":!0}),(0,R.jsx)(PH,{provider:s,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`whitespace-nowrap`,children:o}),(0,R.jsx)(Ir,{className:`size-3 shrink-0 opacity-60`,"aria-hidden":!0})]})}function MH(e){switch(e){case`openai`:return`OpenAI`;case`openai-compatible`:return`OpenAI Compatible`;case`anthropic`:return`Anthropic`;case`google`:return`Google`;case`openrouter`:return`OpenRouter`;case`ollama`:return`Ollama`;default:return e}}function NH(e,t){switch(e){case`openai`:case`anthropic`:case`google`:return`https://inspector-cdn.mcp-use.com/providers/${e}.png`;case`ollama`:return`https://inspector-cdn.mcp-use.com/providers/${t===`dark`?`ollama_dark`:`ollama_light`}.png`;case`openrouter`:return DH;case`openai-compatible`:return null;default:return null}}function PH({provider:e,className:t}){let{resolvedTheme:n}=Oz();if(e===`openai-compatible`)return null;let r=NH(e,n);if(r){let n=e===`ollama`?`h-3.5 w-3.5 object-contain`:`h-4 w-4 rounded-full object-cover`;return(0,R.jsx)(`img`,{src:r,alt:MH(e),className:D(n,t)})}return(0,R.jsx)(`div`,{"aria-label":MH(e),className:D(`flex h-4 w-4 items-center justify-center rounded-full bg-neutral-900 text-[9px] font-semibold text-white dark:bg-neutral-100 dark:text-neutral-900`,t),children:MH(e).charAt(0)})}function FH({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 -28.5 256 256`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,R.jsx)(`path`,{d:`M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z`,fillRule:`nonzero`})})}var IH=`flex flex-1 items-center justify-center text-muted-foreground transition-colors hover:text-foreground active:text-foreground`;function LH({serverId:e,rpcLoggerOpen:t,onRpcLoggerOpenChange:n}){let r=EB(),{embeddedConfig:i}=yL(),{user:a}=sz(i.chatApiUrl),o=a?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`;return(0,R.jsxs)(R.Fragment,{children:[typeof document<`u`&&(0,br.createPortal)((0,R.jsxs)(`nav`,{"aria-label":`Inspector shortcuts`,className:`fixed inset-x-0 bottom-0 z-[100] flex items-center bg-transparent px-4 pt-(--mobile-chrome-gap) pb-[calc(var(--mobile-chrome-gap)+env(safe-area-inset-bottom))] lg:hidden`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:D(IH,t&&`text-foreground`),"aria-label":`RPC logs`,"aria-pressed":t,children:(0,R.jsx)(Pi,{className:`size-4 shrink-0`})}),(0,R.jsx)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,className:IH,"aria-label":`GitHub`,children:(0,R.jsx)(AB,{className:`size-4 shrink-0`})}),(0,R.jsx)(`a`,{href:`https://discord.gg/XkNkSkMz3V`,target:`_blank`,rel:`noopener noreferrer`,className:IH,"aria-label":`Discord`,children:(0,R.jsx)(FH,{className:`size-4 shrink-0`})}),(0,R.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{OT(new Eo({referrer:`mcp-use-inspector-mobile-toolbar`})).catch(()=>{})}catch{}},className:IH,"aria-label":`manufact.com`,children:(0,R.jsx)(EH,{size:16})})]}),document.body),!r&&(0,R.jsx)(gH,{open:t,onOpenChange:n,children:(0,R.jsxs)(bH,{side:`bottom`,className:`z-[101] flex h-[min(85dvh,720px)] flex-col gap-0 rounded-t-2xl border-zinc-200 p-0 dark:border-zinc-700`,children:[(0,R.jsx)(xH,{className:`sr-only`,children:(0,R.jsx)(SH,{children:`RPC logs`})}),(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-2 pb-2 pt-1`,children:(0,R.jsx)(dH,{serverIds:e?[e]:void 0})})]})})]})}function RH(e){return`${e.replace(/\/+$/,``)}${oM()}`}function zH({tunnelUrl:e,tunnelMcpUrl:t,selectedServerId:n,selectedServer:r,configLoaded:i,removeConnection:a,updateConnection:o,connections:s}){let c=(0,z.useRef)(null),l=(0,z.useRef)(!1),u=(0,z.useRef)(null),[d,f]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{!d||r?.url!==u.current||r.state!==`ready`&&r.state!==`failed`||(f(!1),l.current=!1,u.current=null)},[d,r]),(0,z.useEffect)(()=>{n&&uM(n)?c.current=n:r?.url&&uM(r.url)&&(c.current=r.url)},[r?.url,n]),(0,z.useEffect)(()=>{if(!i||!n||!r||l.current)return;let d=r.url??``,p=uM(d),m=dM(d),h=t??(e?RH(e):null),g=null;e&&h&&p?g=h:!e&&m&&c.current&&(g=c.current),!(!g||g===d)&&(l.current=!0,u.current=g,f(!0),(async()=>{try{g!==n&&s.some(e=>e.id===g)&&await a(g),await o(n,EM({...OM(n)??DM(r),url:g}))}catch{f(!1),u.current=null,l.current=!1}})())},[i,s,a,r,n,t,e,o]),(0,z.useEffect)(()=>{d||(l.current=!1)},[d]),d}function BH({children:e}){let t=$N(),n=XN(),{servers:r,addServer:i,removeServer:a,updateServerMetadata:o,updateServer:s,storageLoaded:c}=wj(),l=(0,z.useCallback)(async(e,t)=>{try{await s(e,EM(t)),SM(e,t)}catch(t){console.error(`[Layout] Failed to update connection ${e}:`,t)}},[s]),u=(0,z.useCallback)(async(e,t)=>{try{await o(e,t)}catch(t){console.error(`[Layout] Failed to update connection metadata for ${e}:`,t)}},[o]),{selectedServerId:d,setSelectedServerId:f,activeTab:p,setActiveTab:m,navigateToItem:h,setTunnelUrl:g,tunnelUrl:_,isEmbedded:v,embeddedConfig:y,setEmbeddedMode:b}=yL(),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(()=>{try{return localStorage.getItem(`inspector-sidebar-collapsed`)===`true`}catch{return!1}}),[T,E]=(0,z.useState)(()=>{try{return localStorage.getItem(`inspector-rpc-logger-open`)===`true`}catch{return!1}});(0,z.useEffect)(()=>{try{localStorage.setItem(`inspector-sidebar-collapsed`,C?`true`:`false`)}catch{}},[C]),(0,z.useEffect)(()=>{try{localStorage.setItem(`inspector-rpc-logger-open`,String(T))}catch{}},[T]);let{savedRequests:ee}=SL();(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search),t=e.get(`embedded`)===`true`,r=e.get(`embeddedConfig`);if(t){let e={};if(r)try{e=JSON.parse(r)}catch(e){console.error(`Failed to parse embeddedConfig:`,e)}b(!0,e),e.defaultTab&&m(e.defaultTab)}},[]),(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tunnelUrl`);e!==null&&g(e)},[n.search,g]),(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tab`);e&&[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`,`server-metadata`,`connection-settings`].includes(e)&&m(e)},[n.search,m]);let te=(0,z.useRef)(null),ne=(0,z.useRef)(Date.now()),re=(0,z.useRef)(new Set),ie=(0,z.useRef)(0);(0,z.useEffect)(()=>{let e=()=>{ie.current++};return window.addEventListener(`mcp-tool-executed`,e),()=>window.removeEventListener(`mcp-tool-executed`,e)},[]),(0,z.useEffect)(()=>{let e=()=>{try{OT(new Ao({durationSeconds:Math.round((Date.now()-ne.current)/1e3),tabsVisited:re.current.size,toolsExecuted:ie.current})).catch(()=>{})}catch{}};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let ae=(0,z.useCallback)(e=>{try{OT(new Oo({tab:e,previousTab:te.current})).catch(()=>{})}catch{}te.current=e,re.current.add(e),m(e);let r=new URLSearchParams(n.search);r.set(`tab`,e),t(`/?${r.toString()}`,{replace:!0})},[m,t,n.search]);(0,z.useEffect)(()=>{let e=e=>{let t=e.detail.requestId;d&&h(d,`sampling`,t)},t=e=>{let t=e.detail.requestId;d&&h(d,`elicitation`,t)},n=e=>{let t=e.detail.toolName;d&&t?h(d,`tools`,t):d&&ae(`tools`)};return window.addEventListener(`navigate-to-sampling`,e),window.addEventListener(`navigate-to-elicitation`,t),window.addEventListener(`navigate-to-tool-result`,n),()=>{window.removeEventListener(`navigate-to-sampling`,e),window.removeEventListener(`navigate-to-elicitation`,t),window.removeEventListener(`navigate-to-tool-result`,n)}},[d,ae,h]);let O=(0,z.useRef)(null),k=(0,z.useRef)(null),A=(0,z.useRef)(null),{isAutoConnecting:oe}=vI({connections:r,addServer:i,removeConnection:a,configLoaded:c,embedded:v});(0,z.useEffect)(()=>{let e=()=>{let e=document.documentElement.classList.contains(`dark`)?`#000000`:`#f3f3f3`;document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]);let j=(0,z.useCallback)(e=>{OT(new Co({trigger:e})).catch(()=>{}),S(!0)},[]),se=e=>{if(!r.find(t=>t.id===e))return;f(e);let i=new URLSearchParams(n.search),a=i.get(`tunnelUrl`),o=i.get(`tab`),s=new URLSearchParams;s.set(`server`,e),a&&s.set(`tunnelUrl`,a),o&&s.set(`tab`,o),t(`/?${s.toString()}`)},ce=(0,z.useCallback)(e=>{if(!d)return;let t=OM(d)||r.find(e=>e.id===d);e.url===d?t&&jM(t,e)?(u(d,{name:e.name||e.url}),SM(d,e)):l(d,e):(a(d),i(e.url,EM(e))),QF.success(`Connection settings updated`)},[d,r,a,i,u,l]),M=(e,i,a)=>{if(console.warn(`[Layout] handleCommandPaletteNavigate called:`,{tab:e,itemName:i,serverId:a}),a){let o=r.find(e=>e.id===a);if(console.warn(`[Layout] Server lookup:`,{serverId:a,serverFound:!!o,serverState:o?.state}),!o||o.state!==`ready`){console.warn(`[Layout] Server not ready, showing error`),QF.error(`Server is not connected and cannot be inspected`);return}console.warn(`[Layout] Calling navigateToItem:`,{serverId:a,tab:e,itemName:i}),h(a,e,i);let s=new URLSearchParams(n.search),c=s.get(`tunnelUrl`),l=s.get(`tab`),u=new URLSearchParams;u.set(`server`,a),c&&u.set(`tunnelUrl`,c),e?u.set(`tab`,e):l&&u.set(`tab`,l);let d=`/?${u.toString()}`;console.warn(`[Layout] Navigating to:`,d),t(d)}else console.warn(`[Layout] No serverId, just updating tab to:`,e),ae(e)},N=r.find(e=>e.id===d),le=zH({tunnelUrl:_,selectedServerId:d,selectedServer:N,configLoaded:c,removeConnection:a,updateConnection:s,connections:r}),ue=N?N.tools.map(e=>({...e,_serverId:N.id})):r.flatMap(e=>e.state===`ready`?e.tools.map(t=>({...t,_serverId:e.id,_serverName:pM(e)})):[]),de=N?N.prompts.map(e=>({...e,_serverId:N.id})):r.flatMap(e=>e.state===`ready`?e.prompts.map(t=>({...t,_serverId:e.id,_serverName:pM(e)})):[]),fe=N?N.resources.map(e=>({...e,_serverId:N.id})):r.flatMap(e=>e.state===`ready`?e.resources.map(t=>({...t,_serverId:e.id,_serverName:pM(e)})):[]);(0,z.useEffect)(()=>{if(le)return;let e=new URLSearchParams(n.search),i=e.get(`server`);if(i&&(i.startsWith(`http://`)||i.startsWith(`https://`))&&!r.find(e=>e.id===i)){let n=new URLSearchParams(e);n.delete(`server`),n.set(`autoConnect`,i),t(`/?${n.toString()}`,{replace:!0});return}i!==d&&f(i)},[n.search,d,f,r,t,le]),(0,z.useEffect)(()=>{if(le)return;let e=new URLSearchParams(n.search).get(`server`);if(e&&!r.find(t=>t.id===e)){let e=setTimeout(()=>t(`/`),3e3);return()=>clearTimeout(e)}},[n.search,t,r,le]),(0,z.useEffect)(()=>{if(!v)return;let e=e=>{if(!e.data||typeof e.data!=`object`||e.data.type!==`mcp-inspector:connect_servers`)return;let t=e.data.servers;if(!Array.isArray(t)||t.length===0)return;let n=null;for(let e of t){if(!e.url||typeof e.url!=`string`)continue;let t=e.url,a=e.name??`Server`,o={...e.headers??{}};if(e.auth?.access_token){let t=e.auth.token_type||`bearer`;o.Authorization=`${t.charAt(0).toUpperCase()+t.slice(1)} ${e.auth.access_token}`}let s=typeof e.proxyConfig?.proxyAddress==`string`?e.proxyConfig.proxyAddress.trim():``,c=``;try{new URL(t).origin!==window.location.origin&&(c=_M())}catch{c=_M()}let l=s||c,u=vM(e.connectionMode,e.connectionType,!!s),d=EM({url:t,name:a,transportType:`http`,connectionMode:u,protocolNegotiation:hM(gM(e.protocolNegotiation)),connectionType:u===`proxy`?`Via Proxy`:`Direct`,proxyConfig:u===`proxy`&&l?{proxyAddress:l,...Object.keys(o).length>0?{headers:o}:{}}:void 0,headers:o,autoProxyFallback:u===`auto`&&l?{enabled:!0,proxyAddress:l}:!1});r.find(e=>e.url===t)||i(t,d),n||=t}window.parent!==window&&window.parent.postMessage({type:`mcp-inspector:servers_connected`,count:t.length},`*`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[v,r,i]);let pe=(0,z.useRef)(!1);(0,z.useEffect)(()=>{if(!v||pe.current||d)return;let e=r.find(e=>e.state===`ready`);if(e){pe.current=!0,f(e.id);let r=new URLSearchParams(n.search);r.set(`server`,e.id),t(`/?${r.toString()}`,{replace:!0})}},[v,r,d,f,t,n.search]),bL({onCommandPalette:()=>j(`keyboard`),onToolsTab:()=>{N&&ae(`tools`)},onPromptsTab:()=>{N&&ae(`prompts`)},onResourcesTab:()=>{N&&ae(`resources`)},onChatTab:()=>{N&&ae(`chat`)},onHome:()=>{t(`/`)},onFocusSearch:()=>{p===`tools`&&O.current?O.current.focusSearch():p===`prompts`&&k.current?k.current.focusSearch():p===`resources`&&A.current&&A.current.focusSearch()},onBlurSearch:()=>{p===`tools`&&O.current?O.current.blurSearch():p===`prompts`&&k.current?k.current.blurSearch():p===`resources`&&A.current&&A.current.blurSearch()}});let me=new URLSearchParams(n.search).get(`server`),he=!c&&!!me&&!me.startsWith(`http://`)&&!me.startsWith(`https://`),ge=oe||he||le,_e=N?.id??`home`,ve=ge?`boot`:_e,[ye,be]=(0,z.useState)(ve);(0,z.useLayoutEffect)(()=>{if(ve===ye)return;let e=()=>(0,br.flushSync)(()=>be(ve));typeof document.startViewTransition==`function`?document.startViewTransition(e):e()},[ve,ye]);let xe=ye===`boot`,P=xe||ye===`home`?void 0:r.find(e=>e.id===ye),Se=v&&y.singleTab,Ce=v?{backgroundColor:y.backgroundColor||`#f3f3f3`,padding:Se?`0`:y.padding||`0.5rem`}:{},we=v?Se?`h-screen flex flex-col`:`h-screen flex flex-col gap-2 sm:gap-4`:`h-screen bg-[#f3f3f3] dark:bg-black flex flex-col overflow-x-hidden px-4 lg:px-0 pb-[calc(var(--mobile-toolbar-height)+env(safe-area-inset-bottom))] lg:pb-4`,Te=Se?`flex-1 w-full bg-white dark:bg-black p-0 overflow-auto`:D(`flex-1 min-h-0 min-w-0 max-w-full w-full bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 overflow-x-hidden overflow-y-auto`,!P&&`lg:mx-4`,P&&`lg:mr-4`);return(0,R.jsxs)(et,{children:[(0,R.jsx)(`div`,{className:`inspector-view-transition h-screen overflow-x-hidden bg-[#f3f3f3] dark:bg-black`,children:xe?(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center bg-[#f3f3f3] dark:bg-black`,children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,R.jsx)(fL,{className:`h-8 w-8 text-zinc-600 dark:text-zinc-400`}),(0,R.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Connecting to MCP server...`})]})}):(0,R.jsxs)(`div`,{className:we,style:Ce,children:[!Se&&(0,R.jsx)(OB,{connections:r,selectedServer:P,activeTab:p,onServerSelect:se,onTabChange:ae,embedded:v,sidebarCollapsed:C}),(0,R.jsxs)(`div`,{className:Se?`flex-1 min-h-0`:`flex min-w-0 flex-1 min-h-0 overflow-hidden`,children:[P&&!Se&&(0,R.jsx)(gV,{activeTab:p,onTabChange:ae,selectedServer:P,visibleTabs:y.visibleTabs,collapsed:C,onCollapsedChange:w,rpcLoggerOpen:T,onRpcLoggerOpenChange:E,onCommandPaletteOpen:()=>j(`button`)}),(0,R.jsx)(`main`,{className:Te,children:(0,R.jsx)(QR,{selectedServer:P,activeTab:p,toolsSearchRef:O,promptsSearchRef:k,resourcesSearchRef:A,onUpdateConnection:ce,children:e})}),P&&!Se&&(0,R.jsx)(hH,{serverId:P.id,open:T})]})]})}),!Se&&!xe&&(0,R.jsx)(LH,{serverId:P?.id,rpcLoggerOpen:T,onRpcLoggerOpenChange:E}),(0,R.jsx)(zL,{isOpen:x,onOpenChange:S,tools:ue,prompts:de,resources:fe,savedRequests:ee,connections:r,selectedServer:N,tunnelUrl:_,onNavigate:M,onServerSelect:se})]})}function VH({...e}){let{resolvedTheme:t}=Oz();return(0,R.jsx)(pI,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}var HH=(0,z.createContext)(void 0),UH={deviceType:`desktop`,customViewport:{width:768,height:1024},cspMode:`permissive`,displayModeOverride:null,capabilities:{hover:!0,touch:!1},safeAreaInsets:{top:0,right:0,bottom:0,left:0},locale:`en-US`,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`};function WH({children:e}){let[t,n]=(0,z.useState)({activeWidgetId:null,widgets:new Map,playground:UH}),r=(0,z.useCallback)(e=>{n(t=>({...t,activeWidgetId:e}))},[]),i=(0,z.useCallback)((e,t)=>{n(n=>{if(n.widgets.has(e))return n;let r=new Map(n.widgets);return r.set(e,{...t,cspViolations:[]}),{...n,widgets:r}})},[]),a=(0,z.useCallback)(e=>{n(t=>{let n=new Map(t.widgets);return n.delete(e),{...t,widgets:n,activeWidgetId:t.activeWidgetId===e?null:t.activeWidgetId}})},[]),o=(0,z.useRef)(t);o.current=t;let s=(0,z.useCallback)(e=>o.current.widgets.get(e),[]),c=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i={cspViolations:[...r.cspViolations,t]};t.originalPolicy&&r.effectivePolicy===void 0&&(i.effectivePolicy=t.originalPolicy);let a=new Map(n.widgets);return a.set(e,{...r,...i}),{...n,widgets:a}})},[]),l=(0,z.useCallback)(e=>{n(t=>{let n=t.widgets.get(e);if(!n)return t;let r=new Map(t.widgets);return r.set(e,{...n,cspViolations:[]}),{...t,widgets:r}})},[]),u=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,modelContext:t}),{...n,widgets:i}})},[]),d=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,widgetState:t}),{...n,widgets:i}})},[]),f=(0,z.useCallback)((e,t,r)=>{n(n=>{let i=n.widgets.get(e);if(!i)return n;let a=new Map(n.widgets);return a.set(e,{...i,declaredCsp:t,...r!==void 0&&{effectivePolicy:r}}),{...n,widgets:a}})},[]),p=(0,z.useCallback)(e=>{n(t=>({...t,playground:{...t.playground,...e}}))},[]),m=(0,z.useCallback)(()=>{n(e=>({...e,widgets:new Map,activeWidgetId:null}))},[]),h=(0,z.useCallback)(()=>{let e=new Map;for(let[n,r]of t.widgets)r.modelContext&&e.set(n,r.modelContext);return e},[t.widgets]);return(0,R.jsx)(HH,{value:(0,z.useMemo)(()=>({...t,setActiveWidget:r,addWidget:i,removeWidget:a,getWidget:s,addCspViolation:c,clearCspViolations:l,setWidgetModelContext:u,setWidgetState:d,setWidgetDeclaredCsp:f,updatePlaygroundSettings:p,clearAllWidgets:m,getAllModelContexts:h}),[t,r,i,a,s,c,l,u,d,f,p,m,h]),children:e})}function GH(){let e=(0,z.use)(HH);if(!e)throw Error(`useWidgetDebug must be used within WidgetDebugProvider`);return e}var KH={mobile:{width:390,height:844,name:`iPhone 14`},tablet:{width:820,height:1180,name:`iPad Air`},desktop:{width:1440,height:900,name:`Desktop`},custom:{width:768,height:1024,name:`Custom`}},qH=(0,z.lazy)(()=>rS(()=>import(`./OAuthCallback-C0ljgCiw.js`).then(e=>({default:e.OAuthCallback})),__vite__mapDeps([37,1,4]))),JH=(0,z.lazy)(()=>rS(()=>import(`./ManufactOAuthCallback-CS3ydSZg.js`).then(e=>({default:e.ManufactOAuthCallback})),__vite__mapDeps([38,1,4]))),YH=(0,z.lazy)(()=>rS(()=>import(`./ViewPreview-Ba1Ec5uA.js`).then(e=>({default:e.ViewPreview})),__vite__mapDeps([39,1,4,17])));function XH({activeTabRef:e}){let{activeTab:t}=yL();return(0,z.useEffect)(()=>{e.current=t},[t,e]),null}function ZH(){let e=(0,z.useRef)(`tools`),t=new URLSearchParams(window.location.search),n=t.get(`embedded`)===`true`,r=t.get(`theme`),i=(0,z.useMemo)(()=>n?void 0:new MM(`mcp-inspector-connections`),[n]),a=_M(),o=a?.replace(/\/proxy\/?$/,`/oauth`),s=sM();return(0,z.useEffect)(()=>{ET()},[]),(0,z.useEffect)(()=>{let e=t.get(`auth_error`);if(!e)return;let n=t.get(`auth_error_description`);QF.error(`OAuth authentication failed: ${n||e}`,{duration:1/0,closeButton:!0});let r=new URLSearchParams(t);r.delete(`auth_error`),r.delete(`auth_error_description`);let i=r.toString();window.history.replaceState({},``,`${window.location.pathname}${i?`?${i}`:``}`)},[]),(0,R.jsx)(kz,{forcedTheme:r||void 0,children:(0,R.jsx)(fe,{defaultShape:`pill`,children:(0,R.jsx)(WH,{children:(0,R.jsx)(Cj,{storageProvider:i,enableRpcLogging:!0,defaultCallbackUrl:`${window.location.origin}${s}/oauth/callback`,defaultOAuthProxyUrl:o,defaultAutoProxyFallback:a?{enabled:!0,proxyAddress:a}:!1,defaultServerConfig:{preventAutoAuth:!0,useRedirectFlow:!0},clientInfo:{name:`mcp-use Inspector`,version:jo(),websiteUrl:`https://mcp-use.com`,icons:[{src:`https://mcp-use.com/logo.png`}],capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},onServerAdded:(e,t)=>{console.log(`[Inspector] Server added:`,e,t.state)},onServerRemoved:e=>{console.log(`[Inspector] Server removed:`,e)},onServerStateChange:(e,t)=>{console.log(`[Inspector] Server state changed:`,e,t)},onSamplingRequest:(e,t,n,r,i)=>{let a=QF((0,R.jsx)(Fn,{title:`Sampling Request Received`,description:`New request from ${n}`,actions:[{label:`View Details`,testId:`sampling-toast-view-details`,onClick:()=>{let t=new CustomEvent(`navigate-to-sampling`,{detail:{requestId:e.id}});window.dispatchEvent(t),QF.dismiss(a)}},{label:`Approve`,testId:`sampling-toast-approve`,onClick:()=>{r(e.id,In),QF.success(`Sampling request approved`),QF.dismiss(a)}},{label:`Deny`,testId:`sampling-toast-deny`,onClick:()=>{i(e.id,`User denied from toast`),QF.dismiss(a)}}]}),{duration:1/0})},onElicitationRequest:(t,n,r,i,a)=>{if(e.current===`chat`)return;let o=t.request.mode||`form`,s=t.request.message,c=o===`url`&&`url`in t.request?t.request.url:void 0,l=QF((0,R.jsx)(Fn,{title:`Elicitation Request Received`,description:`From ${r}: ${s}`,extra:o===`url`&&c?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 font-mono`,children:c}):void 0,actions:[{label:`View Details`,testId:`elicitation-toast-view-details`,onClick:()=>{let e=new CustomEvent(`navigate-to-elicitation`,{detail:{requestId:t.id}});window.dispatchEvent(e),QF.dismiss(l)}},...o===`url`&&c?[{label:`Open URL`,testId:`elicitation-toast-open-url`,onClick:()=>{window.open(c,`_blank`),QF.dismiss(l)}}]:[],{label:`Cancel`,testId:`elicitation-toast-cancel`,onClick:()=>{a(t.id,`User cancelled from toast`),QF.dismiss(l)}}]}),{duration:1/0})},children:(0,R.jsxs)(vL,{children:[(0,R.jsx)(XH,{activeTabRef:e}),(0,R.jsx)(gF,{basename:s,children:(0,R.jsxs)(DP,{children:[(0,R.jsx)(TP,{path:`/oauth/callback`,element:(0,R.jsx)(VR,{children:(0,R.jsx)(qH,{})})}),(0,R.jsx)(TP,{path:`/auth/callback`,element:(0,R.jsx)(VR,{children:(0,R.jsx)(JH,{})})}),(0,R.jsx)(TP,{path:`/preview/:view`,element:(0,R.jsx)(VR,{children:(0,R.jsx)(YH,{})})}),(0,R.jsx)(TP,{path:`/`,element:(0,R.jsx)(BH,{children:(0,R.jsx)(gL,{})})})]})}),(0,R.jsx)(VH,{position:`top-center`})]})})})})})}var QH=document.getElementById(`root`);QH?Pn.createRoot(QH).render((0,R.jsx)(ZH,{})):console.error(`[inspector] Root element not found`);export{jI as $,ki as $t,sz as A,rS as At,nL as B,ro as Bt,vV as C,Uj as Ct,uB as D,OT as Dt,cB as E,wj as Et,fL as F,vo as Ft,sL as G,Ia as Gt,oL as H,Za as Ht,dL as I,_o as It,KI as J,Gi as Jt,tL as K,Xi as Kt,uL as L,go as Lt,SL as M,_f as Mt,bL as N,Do as Nt,lB as O,BC as Ot,yL as P,bo as Pt,MI as Q,Ai as Qt,eL as R,wo as Rt,wV as S,_r as Sn,Vj as St,FB as T,uj as Tt,rL as U,$a as Ut,cL as V,Ya as Vt,aL as W,Xa as Wt,zI as X,zi as Xt,BI as Y,Wi as Yt,NI as Z,Ii as Zt,WV as _,Ir as _n,oM as _t,PH as a,ci as an,xI as at,PV as b,jr as bn,rM as bt,gH as c,ri as cn,DF as ct,xH as d,Zr as dn,OM as dt,Ti as en,EI as et,SH as f,Xr as fn,gM as ft,GV as g,Vr as gn,pM as gt,KV as h,Wr as hn,fM as ht,jH as i,fi as in,bI as it,ER as j,Pb as jt,Oz as k,Q as kt,bH as l,ti as ln,CM as lt,sH as m,qr as mn,DM as mt,GH as n,bi as nn,CI as nt,AH as o,si as on,QF as ot,_H as p,Yr as pn,hM as pt,JI as q,Yi as qt,TH as r,yi as rn,SI as rt,MH as s,ai as sn,tP as st,KH as t,xi as tn,yI as tt,CH as u,$r as un,_M as ut,BV as v,Fr as vn,cM as vt,YB as w,Hj as wt,CV as x,vr as xn,$j as xt,zV as y,Mr as yn,nM as yt,iL as z,mo as zt};
|
|
492
|
+
`;for(let{name:n}of e)t+=`export ${n}="your-${n}-value"\n`;return t}function FL({className:e,size:t=`md`}){return(0,R.jsxs)(`svg`,{viewBox:`0 0 500 500`,className:D(`text-current`,{sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`}[t],e),fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`}),(0,R.jsx)(`circle`,{cx:`100.426`,cy:`399.575`,r:`100.426`}),(0,R.jsx)(`path`,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`})]})}function IL({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,R.jsx)(`path`,{d:`M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`})})}function LL({className:e}){return(0,R.jsxs)(`svg`,{fill:`currentColor`,fillRule:`evenodd`,viewBox:`0 0 24 24`,className:e,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`ModelContextProtocol`,children:[(0,R.jsx)(`path`,{d:`M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z`}),(0,R.jsx)(`path`,{d:`M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z`})]})}function RL({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 -28.5 256 256`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,R.jsx)(`path`,{d:`M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z`,fillRule:`nonzero`})})}function zL({isOpen:e,onOpenChange:t,tools:n,prompts:r,resources:i,savedRequests:a,connections:o,selectedServer:s,tunnelUrl:c,onNavigate:l,onServerSelect:u}){let[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(0),h=(0,z.useRef)(null),g=(0,z.useRef)(null),_=$N(),v=S.pill,{activeIndex:y,itemRects:b,sessionRef:x,handlers:w,registerItem:T,measureItems:E}=_n(h),ee=s?c?`${c}/mcp`:s.url:null,te=s?.name||`MCP Server`,ne=s?wM(s):void 0,re=s?[{id:`open-in-cursor`,name:`Open in Cursor`,description:`Add this server to Cursor`,type:`global`,category:`Open in Client`,action:()=>{try{let e=EL(ee,te,ne);window.location.href=e,QF.success(`Opening in Cursor...`),t(!1)}catch{QF.error(`Failed to open in Cursor`)}}},{id:`open-in-claude-code`,name:`Open in Claude Code`,description:`Add this server to Claude Code CLI`,type:`global`,category:`Open in Client`,action:()=>{let{command:e}=jL(ee,te,ne);nM(e),QF.success(`Command copied to clipboard`),t(!1)}},{id:`open-in-claude-desktop`,name:`Open in Claude Desktop`,description:`Download .mcpb configuration file`,type:`global`,category:`Open in Client`,action:()=>{try{AL(ee,te,ne),QF.success(`Downloaded .mcpb file`),t(!1)}catch{QF.error(`Failed to download configuration file`)}}},{id:`open-in-vscode`,name:`Open in VS Code`,description:`Add this server to VS Code`,type:`global`,category:`Open in Client`,action:()=>{try{let e=DL(ee,te,ne);window.location.href=e,QF.success(`Opening in VS Code...`),t(!1)}catch{QF.error(`Failed to open in VS Code`)}}},{id:`open-in-vscode-insiders`,name:`Open in VS Code Insiders`,description:`Add this server to VS Code Insiders`,type:`global`,category:`Open in Client`,action:()=>{try{let e=OL(ee,te,ne);window.location.href=e,QF.success(`Opening in VS Code Insiders...`),t(!1)}catch{QF.error(`Failed to open in VS Code Insiders`)}}},{id:`open-in-gemini`,name:`Open in Gemini CLI`,description:`Add this server to Gemini CLI`,type:`global`,category:`Open in Client`,action:()=>{let{command:e}=ML(ee,te,ne);nM(e),QF.success(`Command copied to clipboard`),t(!1)}},{id:`open-in-codex`,name:`Open in Codex CLI`,description:`Add this server to Codex CLI`,type:`global`,category:`Open in Client`,action:()=>{let{config:e}=NL(ee,te,ne);nM(e),QF.success(`Config copied to clipboard`),t(!1)}}]:[],ie=[{id:`connect-server`,name:`Connect Server`,description:`Add a new MCP server connection`,type:`global`,category:`Navigation`,action:()=>_(`/`)},{id:`mcp-use-website`,name:`MCP Use Website`,description:`Visit mcp-use.com for tools and resources`,type:`global`,category:`Documentation`,action:()=>window.open(`https://mcp-use.com`,`_blank`)},{id:`mcp-use-docs`,name:`How to Create an MCP Server`,description:`Step-by-step guide to building MCP servers`,type:`global`,category:`Documentation`,action:()=>window.open(`https://mcp-use.com/docs`,`_blank`)},{id:`mcp-docs`,name:`MCP Official Documentation`,description:`Learn about the Model Context Protocol`,type:`global`,category:`Documentation`,action:()=>window.open(`https://modelcontextprotocol.io/docs/getting-started/intro`,`_blank`)},{id:`discord`,name:`Join Discord Community`,description:`Connect with the MCP community`,type:`global`,category:`Community`,action:()=>window.open(`https://discord.gg/XkNkSkMz3V`,`_blank`)},{id:`clear-localstorage`,name:`Clear localStorage & Reload`,description:`Having trouble connecting? Clear stored auth data and refresh`,type:`global`,category:`Troubleshooting`,action:()=>{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&(n.startsWith(`mcp:auth`)||n.startsWith(`mcp-inspector`))&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),QF.success(`Cleared ${e.length} localStorage item(s). Refreshing page...`,{duration:2e3}),setTimeout(()=>{window.location.reload()},500),t(!1)}}],ae=o.map(e=>({id:`server-${e.id}`,name:pM(e),description:`Connected server (${e.state})`,type:`global`,category:`Connected Servers`,metadata:{serverId:e.id,state:e.state},action:()=>u(e.id)})),O=[...ie,...re,...ae,...n.map(e=>({id:`tool-${e.name}`,name:e.name,description:e.description,type:`tool`,category:e._serverName?`Tools - ${e._serverName}`:`Tools`,metadata:{inputSchema:e.inputSchema,serverId:e._serverId,serverName:e._serverName}})),...r.map(e=>({id:`prompt-${e.name}`,name:e.name,description:e.description,type:`prompt`,category:e._serverName?`Prompts - ${e._serverName}`:`Prompts`,metadata:{arguments:e.arguments,serverId:e._serverId,serverName:e._serverName}})),...i.map(e=>({id:`resource-${e.uri}`,name:e.name,description:e.description,type:`resource`,category:e._serverName?`Resources - ${e._serverName}`:`Resources`,metadata:{uri:e.uri,mimeType:e.mimeType,serverId:e._serverId,serverName:e._serverName}})),...a.map(e=>({id:`saved-${e.id}`,name:e.name,description:`Saved request for ${e.toolName}`,type:`saved-request`,category:`Saved Requests`,metadata:{toolName:e.toolName,args:e.args,savedAt:e.savedAt,serverId:e.serverId,serverName:e.serverName}}))].filter(e=>d.trim()?`${e.name} ${e.description||``} ${e.category}`.toLowerCase().includes(d.trim().toLowerCase()):!0),k=(0,z.useCallback)(e=>{if(console.warn(`[CommandPalette] Item selected:`,{itemType:e.type,itemName:e.name,itemId:e.id,metadata:e.metadata}),e.action)console.warn(`[CommandPalette] Executing action for global item`),e.action(),t(!1);else if(e.type===`global`)e.metadata?.serverId&&(console.warn(`[CommandPalette] Selecting server:`,e.metadata.serverId),u(e.metadata.serverId),t(!1));else{let n=e.type===`resource`?e.metadata?.uri:e.name,r=e.type===`tool`?`tools`:e.type===`prompt`?`prompts`:e.type===`saved-request`?`tools`:`resources`;console.warn(`[CommandPalette] Navigating to item:`,{tab:r,itemIdentifier:n,serverId:e.metadata?.serverId}),l(r,n,e.metadata?.serverId),t(!1)}},[l,t,u]),A=(e,t,n)=>{switch(e){case`tool`:return(0,R.jsx)(`div`,{className:`bg-blue-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Yi,{className:`h-4 w-4 text-blue-500`})});case`prompt`:return(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(yi,{className:`h-4 w-4 text-purple-500`})});case`resource`:return(0,R.jsx)(`div`,{className:`bg-green-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Qr,{className:`h-4 w-4 text-green-500`})});case`saved-request`:return(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(ri,{className:`h-4 w-4 text-orange-500`})});case`global`:if(t===`Navigation`)return(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Ai,{className:`h-4 w-4 text-gray-600 dark:text-gray-300`})});if(t===`Open in Client`){if(n?.includes(`Cursor`))return(0,R.jsx)(`div`,{className:`bg-gray-200 dark:bg-gray-800 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`})});if(n?.includes(`Claude Code`)||n?.includes(`Claude Desktop`))return(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`})});if(n?.includes(`VS Code`))return(0,R.jsx)(`div`,{className:`bg-blue-600/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(IL,{className:`h-4 w-4 text-blue-600`})});if(n?.includes(`Gemini`))return(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`})});if(n?.includes(`Codex`))return(0,R.jsx)(`div`,{className:`bg-green-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`})})}return t===`Documentation`?n?.includes(`MCP Use`)||n?.includes(`mcp-use`)?(0,R.jsx)(`div`,{className:`bg-black/10 dark:bg-white/10 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(FL,{className:`h-4 w-4 text-black dark:text-white`,size:`sm`})}):(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Yr,{className:`h-4 w-4 text-orange-500`})}):t===`Community`?(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(RL,{className:`h-4 w-4 text-purple-500`})}):t===`Troubleshooting`?(0,R.jsx)(`div`,{className:`bg-yellow-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Pr,{className:`h-4 w-4 text-yellow-500`})}):t===`Connected Servers`?(0,R.jsx)(`div`,{className:`bg-cyan-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Fi,{className:`h-4 w-4 text-cyan-500`})}):(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Yr,{className:`h-4 w-4 text-gray-500`})});default:return(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(C,{className:`h-4 w-4 text-gray-500`})})}};(0,z.useEffect)(()=>{e&&(f(``),m(0),requestAnimationFrame(()=>g.current?.focus()))},[e]),(0,z.useEffect)(()=>{h.current&&(h.current.scrollTop=0),m(0)},[d]),(0,z.useEffect)(()=>{p>=O.length&&m(Math.max(0,O.length-1))},[p,O.length]),(0,z.useLayoutEffect)(()=>{e&&E()},[e,E,O]);let oe=b[p]??null,j=y===null?null:b[y],se=y!==null&&y!==p;return e?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-sm`,"aria-label":`Close command palette`,onClick:()=>t(!1)}),(0,R.jsxs)(`div`,{role:`dialog`,"aria-label":`Command Palette`,"data-testid":`command-palette-dialog`,className:`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-[51] max-w-[640px] w-[calc(100vw-2rem)] sm:w-full p-2 bg-white dark:bg-zinc-900/90 backdrop-blur-xl rounded-xl overflow-hidden border border-border shadow-[var(--cmdk-shadow)] transition-transform duration-100 ease-out outline-none`,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),m(e=>Math.min(e+1,O.length-1))):e.key===`ArrowUp`?(e.preventDefault(),m(e=>Math.max(e-1,0))):e.key===`Enter`&&O[p]?(e.preventDefault(),k(O[p])):e.key===`Escape`&&(e.preventDefault(),t(!1))},children:[(0,R.jsx)(`input`,{ref:g,placeholder:`What do you need?`,value:d,onChange:e=>f(e.target.value),className:`border-none w-full text-[17px] px-4 pt-2 pb-4 outline-none bg-transparent text-foreground border-b border-border mb-0 rounded-none placeholder:text-muted-foreground`,"data-testid":`command-palette-input`}),(0,R.jsxs)(`div`,{ref:h,onMouseEnter:w.onMouseEnter,onMouseMove:w.onMouseMove,onMouseLeave:w.onMouseLeave,className:`relative isolate min-h-[200px] sm:min-h-[330px] max-h-[400px] overflow-auto overscroll-contain transition-[height] duration-100 ease-out px-1`,"data-testid":`command-palette-list`,children:[(0,R.jsx)(en,{children:oe&&(0,R.jsx)(F.div,{"aria-hidden":!0,className:D(`pointer-events-none absolute bg-active`,v.bg),initial:!1,animate:{top:oe.top,left:oe.left,width:oe.width,height:oe.height,opacity:se?.8:1},exit:{opacity:0,transition:Ot.moderate.exit},transition:{...Ot.moderate,opacity:{duration:.08}}})}),(0,R.jsx)(en,{children:j&&(0,R.jsx)(F.div,{"aria-hidden":!0,className:D(`pointer-events-none absolute bg-hover`,v.bg),initial:{opacity:0,top:oe?.top??j.top,left:oe?.left??j.left,width:oe?.width??j.width,height:oe?.height??j.height},animate:{opacity:1,top:j.top,left:j.left,width:j.width,height:j.height},exit:{opacity:0,transition:Ot.fast.exit},transition:{...Ot.fast,opacity:{duration:.08}}},x.current)}),O.length===0?(0,R.jsx)(`div`,{className:`text-sm flex items-center justify-center h-12 whitespace-pre-wrap text-muted-foreground`,children:`No results found.`}):O.map((e,t)=>(0,R.jsxs)(`button`,{ref:e=>T(t,e),type:`button`,"data-testid":`command-palette-item-${e.id}`,"data-proximity-index":t,onClick:()=>k(e),className:`[content-visibility:auto] relative z-10 cursor-pointer h-12 text-sm flex items-center gap-3 px-3 text-foreground select-none w-full text-left mt-1 first:mt-0`,children:[A(e.type,e.category,e.name),(0,R.jsx)(`span`,{className:`font-medium truncate flex-1 min-w-0`,children:e.name}),(()=>{let t=e.metadata?.serverId;if(!t||e.category===`Connected Servers`)return null;let n=o.find(e=>e.id===t);return n?(0,R.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 text-muted-foreground`,children:[(0,R.jsx)(pL,{server:n,size:`xs`}),(0,R.jsx)(`span`,{className:`text-xs truncate max-w-[9rem]`,children:pM(n)})]}):null})()]},e.id))]}),(0,R.jsxs)(`div`,{className:`border-t border-border px-4 py-3 pb-1 flex items-center justify-between text-xs text-muted-foreground `,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`t`}),(0,R.jsx)(`span`,{children:`Tools`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`p`}),(0,R.jsx)(`span`,{children:`Prompts`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`r`}),(0,R.jsx)(`span`,{children:`Resources`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`c`}),(0,R.jsx)(`span`,{children:`Chat`})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`h`}),(0,R.jsx)(`span`,{children:`Home`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center px-2 h-5 font-mono text-[10px] font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`esc`}),(0,R.jsx)(`span`,{children:`Close`})]})]})]})]})]}):null}var BL=`openid profile email offline_access`,VL=`mcp-inspector:manufact-auth`,HL=`manufact:session-changed`,UL={loaded:!0,authorizing:!1,accessToken:null,user:null,mode:null},WL=new Map,GL=new Set,KL=new Map,qL=new Map,JL=null,YL=!1;typeof window<`u`&&window.addEventListener(`message`,e=>{if(e.data?.type!==`manufact:invalidate-oauth-client`)return;for(let e of WL.keys())ZL()?.removeItem(rR(e,`client`));let t=JL;!t||YL||(YL=!0,TR(t,{isRetry:!0}).finally(()=>{YL=!1}))});function XL(e){let t=WL.get(e);if(t)return t;let n={...UL,loaded:!1};return WL.set(e,n),n}function ZL(){return typeof window>`u`?null:window.localStorage}function QL(e){return new URL(e).origin}function $L(e,t){let n=new URL(e),r=new URL(t),i=new Set([`localhost`,`127.0.0.1`]);return i.has(n.hostname)&&i.has(r.hostname)?n.origin===r.origin:(n.hostname===`manufact.com`||n.hostname.endsWith(`.manufact.com`))&&(r.hostname===`manufact.com`||r.hostname.endsWith(`.manufact.com`))}function eR(e){let t=window.__MANUFACT_LOGIN_URL__;if(t)return new URL(t).origin;let n=new URL(e);return n.hostname===`localhost`||n.hostname===`127.0.0.1`?`${n.protocol}//${n.hostname}:3000`:`${n.protocol}//manufact.com`}function tR(e){return`${eR(e)}/login`}function nR(e){return`${eR(e)}/auth/embedded-sign-out`}function rR(e,t){return`${VL}:${t}:${e}`}function iR(e){return ZL()?.getItem(rR(e,`skip-session`))===`1`}function aR(e,t){let n=rR(e,`skip-session`);t?ZL()?.setItem(n,`1`):ZL()?.removeItem(n)}function oR(e){return`${VL}:state:${e}`}function sR(e){let t=ZL()?.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return ZL()?.removeItem(e),null}}function cR(e,t){ZL()?.setItem(e,JSON.stringify(t))}function lR(e,t){WL.set(e,{...WL.get(e)??UL,...t}),GL.forEach(e=>e()),window.dispatchEvent(new CustomEvent(HL))}function uR(e){let t=``;return e.forEach(e=>{t+=String.fromCharCode(e)}),btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function dR(e=32){let t=new Uint8Array(e);return crypto.getRandomValues(t),uR(t)}async function fR(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return uR(new Uint8Array(t))}async function pR(e){let t=await fetch(`${e}/api/auth/.well-known/openid-configuration`);if(!t.ok)throw Error(`Manufact OAuth discovery failed`);return await t.json()}function mR(){return`${window.location.origin}${sM()}/auth/callback`}function hR(e){return e===`localhost`||e===`127.0.0.1`}function gR(e){try{let t=new URL(e).hostname,n=typeof window<`u`?new URL(window.location.href).hostname:``;return hR(t)&&hR(n)}catch{return!1}}async function _R(e,t,n){let r=new URL(`${e}/api/auth/oauth2/authorize`);r.searchParams.set(`response_type`,`code`),r.searchParams.set(`client_id`,t),r.searchParams.set(`redirect_uri`,n),r.searchParams.set(`scope`,BL),r.searchParams.set(`code_challenge`,await fR(dR(32))),r.searchParams.set(`code_challenge_method`,`S256`),r.searchParams.set(`state`,`client-probe`),r.searchParams.set(`prompt`,`none`);try{let e=await fetch(r.toString(),{method:`GET`,redirect:`manual`,credentials:`include`}),t=e.headers.get(`location`)??``;return t.includes(`/auth/error`)&&t.includes(`invalid_client`)?!1:e.status>=300&&e.status<400||e.type===`opaqueredirect`?!!t&&!t.includes(`/auth/error`):!0}catch{return!1}}async function vR(e,t){let n=mR(),r=rR(e,`client`),i=sR(r),a=gR(e);if(!a&&i?.client_id&&i.redirect_uri===n){if(await _R(e,i.client_id,n))return i;ZL()?.removeItem(r)}else a&&i?.client_id&&ZL()?.removeItem(r);if(!t.registration_endpoint)throw Error(`Manufact OAuth registration is unavailable`);let o=await fetch(t.registration_endpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({client_name:`mcp-use Inspector`,redirect_uris:[n],grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],token_endpoint_auth_method:`none`,scope:BL})});if(!o.ok)throw Error(`Could not register Inspector with Manufact`);let s=await o.json();if(!s.client_id)throw Error(`Manufact returned no OAuth client ID`);let c={...s,redirect_uri:n};return cR(r,c),c}async function yR(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams(t)}),r=await n.json().catch(()=>({}));if(!n.ok||!r.access_token)throw Error(r.error_description??`Manufact token exchange failed`);return{access_token:r.access_token,refresh_token:r.refresh_token,token_type:r.token_type,expires_at:Date.now()+(r.expires_in??3600)*1e3}}async function bR(e,t){if(!t.refresh_token)return null;let n=qL.get(e);if(n)return n;let r=(async()=>{try{let n=await pR(e),r=sR(rR(e,`client`));if(!r?.client_id)return null;let i=await yR(n.token_endpoint,{grant_type:`refresh_token`,refresh_token:t.refresh_token,client_id:r.client_id}),a={...i,refresh_token:i.refresh_token??t.refresh_token};return cR(rR(e,`tokens`),a),a}catch{return ZL()?.removeItem(rR(e,`tokens`)),null}finally{qL.delete(e)}})();return qL.set(e,r),r}async function xR(e){let t=sR(rR(e,`tokens`));return t?.access_token?t.expires_at>Date.now()+3e4?t:bR(e,t):null}async function SR(e,t){let n=await pR(e);if(!n.userinfo_endpoint)return null;let r=await fetch(n.userinfo_endpoint,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)return null;let i=await r.json();return i.sub?{id:i.sub,name:i.name,email:i.email,image:i.picture}:null}async function CR(e){try{let t=await fetch(`${e}/api/auth/get-session`,{credentials:`include`});return t.ok?(await t.json())?.user??null:null}catch{return null}}async function wR(e){let t=KL.get(e);if(t)return t;WL.set(e,{...WL.get(e)??UL,loaded:!1});let n=(async()=>{try{let t=$L(typeof window<`u`?window.location.href:e,e),n=iR(e),r=await xR(e),i=r?await SR(e,r.access_token):null;if(i&&r){aR(e,!1),lR(e,{loaded:!0,accessToken:r.access_token,user:i,mode:`oauth`});return}r&&!i&&ZL()?.removeItem(rR(e,`tokens`));let a=t&&!n?await CR(e):null;if(a){lR(e,{loaded:!0,accessToken:null,user:a,mode:`session`});return}lR(e,{loaded:!0,accessToken:null,user:null,mode:null})}catch{lR(e,{loaded:!0,accessToken:null,user:null,mode:null})}})().finally(()=>KL.delete(e));return KL.set(e,n),n}async function TR(e,t){let n=QL(e);JL=e,aR(n,!1);let r=window.open(``,`manufact-oauth`,`width=600,height=700,resizable=yes,scrollbars=yes`);if(!r)throw Error(`Allow popups to sign in with Manufact`);if(lR(n,{authorizing:!0}),$L(window.location.href,n)){r.location.href=tR(n);let e=window.setInterval(async()=>{if(r.closed){window.clearInterval(e),lR(n,{authorizing:!1});return}let t=await CR(n);t&&(window.clearInterval(e),r.close(),lR(n,{loaded:!0,authorizing:!1,accessToken:null,user:t,mode:`session`}))},1e3);return}try{let e=await pR(n),t=await vR(n,e),i=dR(64),a=dR(),o=mR();cR(oR(a),{authOrigin:n,clientId:t.client_id,redirectUri:o,codeVerifier:i,expiresAt:Date.now()+600*1e3});let s=new URL(e.authorization_endpoint);s.searchParams.set(`response_type`,`code`),s.searchParams.set(`client_id`,t.client_id),s.searchParams.set(`redirect_uri`,o),s.searchParams.set(`scope`,BL),s.searchParams.set(`state`,a),s.searchParams.set(`code_challenge`,await fR(i)),s.searchParams.set(`code_challenge_method`,`S256`),s.searchParams.set(`prompt`,`consent`),r.location.href=s.toString();let c=window.setInterval(()=>{r.closed&&(window.clearInterval(c),wR(n).finally(()=>lR(n,{authorizing:!1})))},500)}catch(e){throw r.close(),lR(n,{authorizing:!1}),e}}async function ER(e=new URL(window.location.href)){let t=e.searchParams.get(`state`),n=e.searchParams.get(`code`),r=e.searchParams.get(`error_description`)??e.searchParams.get(`error`);if(r)throw Error(r);if(!t||!n)throw Error(`Missing OAuth code or state`);let i=oR(t),a=sR(i);if(ZL()?.removeItem(i),!a||a.expiresAt<Date.now())throw Error(`OAuth state is invalid or expired`);let o=await yR((await pR(a.authOrigin)).token_endpoint,{grant_type:`authorization_code`,code:n,redirect_uri:a.redirectUri,client_id:a.clientId,code_verifier:a.codeVerifier});cR(rR(a.authOrigin,`tokens`),o),aR(a.authOrigin,!1);let s=await SR(a.authOrigin,o.access_token);lR(a.authOrigin,{loaded:!0,authorizing:!1,accessToken:o.access_token,user:s,mode:`oauth`}),window.opener?.postMessage({type:`manufact:oauth-complete`,authOrigin:a.authOrigin},window.location.origin)}function DR(e){let t=QL(e);ZL()?.removeItem(rR(t,`tokens`)),lR(t,{loaded:!0,authorizing:!1,accessToken:null,user:null,mode:null})}async function OR(e){let t=sR(rR(e,`tokens`)),n=sR(rR(e,`client`)),r=t?.refresh_token??t?.access_token;if(!n?.client_id||!r)return null;try{let i=(await pR(e)).revocation_endpoint??`${e}/api/auth/oauth2/revoke`;return(await fetch(i,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({client_id:n.client_id,token:r,token_type_hint:t?.refresh_token?`refresh_token`:`access_token`})})).status}catch{return-1}}async function kR(e){let t=eR(e),n=window.open(nR(e),`manufact-sign-out`,`width=420,height=320`);return n?new Promise(r=>{let i=!1,a=e=>{i||(i=!0,window.clearTimeout(o),window.clearInterval(c),window.removeEventListener(`message`,s),r(e))},o=window.setTimeout(()=>{a({attempted:!0,signOutOk:!1,signOutStatus:null})},3e4),s=e=>{e.origin===t&&e.data?.type===`manufact:sign-out-complete`&&a({attempted:!0,signOutOk:!0,signOutStatus:200})},c=window.setInterval(()=>{n.closed&&CR(e).then(e=>{a({attempted:!0,signOutOk:!e,signOutStatus:e?401:200})})},500);window.addEventListener(`message`,s)}):{attempted:!0,signOutOk:!1,signOutStatus:null}}async function AR(e,t){let n=QL(e),r=!!sR(rR(n,`tokens`))?.access_token;t===`oauth`||r?(await OR(n),aR(n,!0)):t===`session`&&(await kR(n),aR(n,!1)),DR(e)}function jR(e){let t=e?QL(e):null,n=(0,z.useSyncExternalStore)((0,z.useCallback)(e=>(GL.add(e),()=>GL.delete(e)),[]),(0,z.useCallback)(()=>t?XL(t):UL,[t]),()=>UL);return(0,z.useEffect)(()=>{if(!t)return;wR(t);let e=e=>{e.origin===window.location.origin&&e.data?.type===`manufact:oauth-complete`&&e.data.authOrigin===t&&wR(t).finally(()=>lR(t,{authorizing:!1}))},n=e=>{e.key!==rR(t,`tokens`)||!e.newValue||wR(t).finally(()=>lR(t,{authorizing:!1}))};return window.addEventListener(`message`,e),window.addEventListener(`storage`,n),()=>{window.removeEventListener(`message`,e),window.removeEventListener(`storage`,n)}},[t]),{...n,authorize:(0,z.useCallback)(async()=>{e&&await TR(e)},[e]),logout:(0,z.useCallback)(async()=>{e&&await AR(e,n.mode)},[e,n.mode])}}var MR=(0,z.lazy)(()=>rS(()=>import(`./ChatTab-CsBPVCSc.js`).then(e=>({default:e.ChatTab})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),NR=(0,z.lazy)(()=>rS(()=>import(`./ToolsTab-DupHgo7A.js`).then(e=>({default:e.ToolsTab})),__vite__mapDeps([18,1,2,3,4,6,5,7,8,19,20,21,13,16,17,22,23,24,10,25,26,27]))),PR=(0,z.lazy)(()=>rS(()=>import(`./PromptsTab-B2uVMRR2.js`).then(e=>({default:e.PromptsTab})),__vite__mapDeps([28,1,2,3,4,6,5,7,8,22,24,10,25,26,27,11,12,16]))),FR=(0,z.lazy)(()=>rS(()=>import(`./ResourcesTab-DhOZYPjE.js`).then(e=>({default:e.ResourcesTab})),__vite__mapDeps([29,1,2,3,4,7,19,6,5,8,20,21,13,16,17,30,22,23,24,10,25,26,14]))),IR=(0,z.lazy)(()=>rS(()=>import(`./SamplingTab-C-oY2hoi.js`).then(e=>({default:e.SamplingTab})),__vite__mapDeps([31,1,2,3,4,6,5,7,8,24,10,25,20,21,13,14,16]))),LR=(0,z.lazy)(()=>rS(()=>import(`./ElicitationTab-_FKB7nNG.js`).then(e=>({default:e.ElicitationTab})),__vite__mapDeps([32,1,2,3,4,8,24,10,25,20,15,12,16]))),RR=(0,z.lazy)(()=>rS(()=>import(`./NotificationsTab-LYcfRjyd.js`).then(e=>({default:e.NotificationsTab})),__vite__mapDeps([33,1,2,3,4,30,23,24,10,25,26]))),zR=(0,z.lazy)(()=>rS(()=>import(`./ServerMetadataTab-BkTxO5KS.js`).then(e=>({default:e.ServerMetadataTab})),__vite__mapDeps([34,1,2,3,4,9,7,8,25,10,35]))),BR=(0,z.lazy)(()=>rS(()=>import(`./ConnectionSettingsTab-DQTXfnl1.js`).then(e=>({default:e.ConnectionSettingsTab})),__vite__mapDeps([36,1,2,3,4,25,10,35])));function VR({children:e}){return(0,R.jsx)(z.Suspense,{fallback:(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,R.jsx)(fL,{className:`size-6`})}),children:e})}var HR=`anthropic/claude-sonnet-4.6`;function UR({isLoopback:e,chatApiUrl:t}){return e&&!!t}function WR(e,t,n=!1,r){let i=e.replace(/\/chat\/stream\/?$/,`/llm`);return{provider:`openai-compatible`,model:r??`anthropic/claude-sonnet-4.6`,apiKey:t??`server-managed`,baseUrl:i,...n?{credentials:`include`}:{}}}function GR(e){return e?{Authorization:`Bearer ${e}`}:void 0}var KR=`mcp-inspector:managed-model`;function qR(e){return`${KR}:${e}`}function JR(e){try{return localStorage.getItem(qR(e))}catch{return null}}function YR(e,t,n,r){let i=e?new URL(e).origin:null,[a,o]=(0,z.useState)([]),[s,c]=(0,z.useState)(HR),[l,u]=(0,z.useState)(()=>i?JR(i)??`anthropic/claude-sonnet-4.6`:HR),[d,f]=(0,z.useState)(!1),p=(0,z.useCallback)(e=>{if(u(e),i)try{localStorage.setItem(qR(i),e)}catch{}},[i]);return(0,z.useEffect)(()=>{if(!r||!i)return;let e=!1;return f(!0),(async()=>{try{let r=GR(t),a=await fetch(`${i}/api/v1/models`,{headers:r,credentials:n===`session`?`include`:`same-origin`});if(!a.ok)return;let s=await a.json();if(e)return;let l=s.models??[];o(l);let d=s.defaultModelId??`anthropic/claude-sonnet-4.6`;c(d);let f=new Set(l.map(e=>e.id)),p=JR(i);p&&f.has(p)?u(p):f.has(d)?u(d):l[0]&&u(l[0].id)}finally{e||f(!1)}})(),()=>{e=!0}},[r,i,t,n]),{models:a,selectedModelId:l,setSelectedModelId:p,isLoading:d,selectedModel:a.find(e=>e.id===l)??null,defaultModelId:s}}var XR=[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`,`server-metadata`,`connection-settings`];function ZR(e){return XR.includes(e)?e:`tools`}function QR({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:i,onUpdateConnection:a,children:o}){let{embeddedConfig:s}=yL(),c=ZR(t),[l,u]=(0,z.useState)(()=>new Set([c]));(0,z.useEffect)(()=>{let e=ZR(t);u(t=>t.has(e)?t:new Set(t).add(e))},[t]);let{accessToken:d,mode:f,user:p}=jR(s.chatApiUrl),m=GR(d),h=f===`session`?`include`:void 0,g=p!=null,_=s.chatApiUrl,v=!!e?.url&&uM(e.url),y=e?UR({isLoopback:v,chatApiUrl:s.chatApiUrl,enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade}):!1,b=YR(_,d,f,!!e&&!!_&&g),x=y?WR(_,d,f===`session`,g?b.selectedModelId:void 0):s.managedLlmConfig??(_&&!v?{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`}:void 0);if(!e&&s.forceConnected)return s.chatApiUrl?(0,R.jsx)(VR,{children:(0,R.jsx)(MR,{connection:{id:`force-connected`,url:``,displayName:``,name:``,state:`ready`,tools:[],prompts:[],resources:[]},isConnected:!0,prompts:[],serverId:`force-connected`,callPrompt:async()=>({messages:[]}),readResource:async()=>({contents:[]}),useClientSide:!1,chatApiUrl:s.chatApiUrl,extraHeaders:m,credentials:h,managedLlmConfig:s.managedLlmConfig??{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`},enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade,hideTitle:s.chatHideTitle,hideModelBadge:s.chatHideModelBadge??!0,hideServerUrl:s.chatHideServerUrl??!0,clearButtonLabel:s.chatClearButtonLabel,clearButtonHideIcon:s.chatClearButtonHideIcon,clearButtonHideShortcut:s.chatClearButtonHideShortcut,clearButtonVariant:s.chatClearButtonVariant,chatQuickQuestions:s.chatQuickQuestions,chatFollowups:s.chatFollowups,hideClearButton:s.chatHideClearButton,hideToolSelector:s.chatHideToolSelector,enableKeyboardShortcuts:!1},`chat-force-connected`)}):(0,R.jsx)(R.Fragment,{children:o});if(!e)return(0,R.jsx)(R.Fragment,{children:o});let S=e=>s.visibleTabs?s.visibleTabs.includes(e):!0,C=XR;return(0,R.jsxs)(VR,{children:[S(`tools`)&&l.has(`tools`)&&(0,R.jsx)(`div`,{style:{display:t===`tools`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(NR,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,refreshTools:e.refreshTools},`tools-${e.id}`)}),S(`prompts`)&&l.has(`prompts`)&&(0,R.jsx)(`div`,{style:{display:t===`prompts`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(PR,{ref:r,prompts:e.prompts,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),serverId:e.id,isConnected:e.state===`ready`,refreshPrompts:e.refreshPrompts},`prompts-${e.id}`)}),S(`resources`)&&l.has(`resources`)&&(0,R.jsx)(`div`,{style:{display:t===`resources`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(FR,{ref:i,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url||``,refreshResources:e.refreshResources},`resources-${e.id}`)}),S(`chat`)&&l.has(`chat`)&&(0,R.jsx)(`div`,{style:{display:t===`chat`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(MR,{connection:e,isConnected:s.forceConnected||e.state===`ready`,prompts:e.prompts,serverId:e.id,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),readResource:e.readResource,useClientSide:y||!_,chatApiUrl:_,extraHeaders:m,credentials:s.chatCredentials??h,managedLlmConfig:x,managedCloudModel:b,enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade,hideTitle:s.chatHideTitle,hideModelBadge:s.chatHideModelBadge??!1,hideServerUrl:s.chatHideServerUrl??!!_,clearButtonLabel:s.chatClearButtonLabel,clearButtonHideIcon:s.chatClearButtonHideIcon,clearButtonHideShortcut:s.chatClearButtonHideShortcut,clearButtonVariant:s.chatClearButtonVariant,chatQuickQuestions:s.chatQuickQuestions,chatFollowups:s.chatFollowups,hideClearButton:s.chatHideClearButton,hideToolSelector:s.chatHideToolSelector,streamProtocol:s.chatStreamProtocol},`chat-${e.id}`)}),S(`sampling`)&&l.has(`sampling`)&&(0,R.jsx)(`div`,{style:{display:t===`sampling`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(IR,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url??``},`sampling-${e.id}`)}),S(`elicitation`)&&l.has(`elicitation`)&&(0,R.jsx)(`div`,{style:{display:t===`elicitation`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(LR,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state===`ready`},`elicitation-${e.id}`)}),S(`notifications`)&&l.has(`notifications`)&&(0,R.jsx)(`div`,{style:{display:t===`notifications`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(RR,{notifications:e.notifications,unreadCount:e.unreadNotificationCount,markNotificationRead:e.markNotificationRead,markAllNotificationsRead:e.markAllNotificationsRead,clearNotifications:e.clearNotifications,serverId:e.id,isConnected:e.state===`ready`},`notifications-${e.id}`)}),S(`server-metadata`)&&l.has(`server-metadata`)&&(0,R.jsx)(`div`,{style:{display:t===`server-metadata`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(zR,{connection:e},`server-metadata-${e.id}`)}),S(`connection-settings`)&&l.has(`connection-settings`)&&a&&(0,R.jsx)(`div`,{style:{display:t===`connection-settings`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(BR,{connection:e,onSave:a},`connection-settings-${e.id}`)}),!C.includes(t)&&(0,R.jsx)(R.Fragment,{children:o})]})}var $R=z.createContext(void 0);function ez(){let e=z.use($R);if(!e)throw Error(`useTabs must be used within a TabsProvider`);return e}var tz=z.createContext(void 0);function nz(){return z.use(tz)}function rz({ref:e,children:t,defaultValue:n,value:r,onValueChange:i,className:a,collapsed:o,onCollapsedChange:s,...c}){let[l,u]=z.useState(n||``),d=r!==void 0,f=o!==void 0,[p,m]=z.useState(!1),h=z.useCallback(e=>{d||u(e),i?.(e)},[d,i]);return(0,R.jsx)($R,{value:{activeValue:d?r:l,handleValueChange:h,collapsed:f?o:p,handleCollapsedChange:z.useCallback(e=>{f||m(e),s?.(e)},[f,s])},children:(0,R.jsx)(`div`,{ref:e,className:D(`flex flex-col gap-2`,a),...c,children:t})})}rz.displayName=`Tabs`;function iz({ref:e,children:t,className:n,variant:r=`default`,collapsible:i=!1,...a}){let{activeValue:o,collapsed:s,handleCollapsedChange:c}=ez(),[l,u]=z.useState({width:0,left:0}),d=z.useRef(null),f=z.useRef(null),p=z.useRef(null),m=z.useCallback(()=>{let e=d.current;if(!e)return;let t=e.querySelector(`div:first-child`);if(!t)return;let n=t.querySelector(`button[data-tab-value="${o}"]`);if(n&&o){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();u({width:r.width,left:r.left-e.left})}else u({width:0,left:0})},[o]),h=z.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(m,16)},[m]);z.useEffect(()=>{let e=setTimeout(m,10);return()=>clearTimeout(e)},[m,s]),z.useEffect(()=>{let e=d.current;if(!e)return;f.current=new ResizeObserver(()=>{h()}),f.current.observe(e);let t=e.querySelector(`div:first-child`);return t&&t.querySelectorAll(`button[data-tab-value]`).forEach(e=>{f.current&&f.current.observe(e)}),()=>{f.current&&f.current.disconnect(),p.current&&clearTimeout(p.current)}},[h]),z.useEffect(()=>{let e=()=>{h()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[h]);let g=z.useRef(null);return z.useEffect(()=>{g.current&&(g.current.style.width=`${l.width}px`,g.current.style.left=`${l.left}px`)},[l]),(0,R.jsx)(tz,{value:{variant:r,collapsed:s,handleCollapsedChange:c},children:(0,R.jsx)(`div`,{ref:d,className:D(`relative flex items-center bg-none gap-1`,r==="default"&&`p-1 rounded-full border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`border-b border-zinc-200 dark:border-zinc-700`,n),...a,children:(0,R.jsxs)(`div`,{role:`tablist`,className:`flex-1 flex items-center relative`,children:[t,(0,R.jsx)(`span`,{ref:g,className:D(`absolute transition-all duration-[250ms] ease-in-out z-0`,r==="default"&&`bg-white dark:bg-zinc-700 rounded-full h-[calc(100%)] top-0 border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`bottom-0 h-0.5 bg-black dark:bg-white`)})]})})})}iz.displayName=`TabsList`;var az=({children:e,title:t,collapsed:n})=>!t||!n?e:(0,R.jsx)(et,{children:(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`span`,{className:`contents`,children:e}),nativeButton:!1}),(0,R.jsx)(wt,{children:t})]})}),oz=z.forwardRef(({children:e,value:t,className:n,disabled:r,icon:i,title:a,showDot:o=!1,alwaysExpanded:s=!1,iconOnly:c=!1,badge:l,...u},d)=>{let{activeValue:f,handleValueChange:p,collapsed:m}=ez(),h=nz()?.variant||`default`,g=f===t,_=!c&&(!m||g||s),v=c||m&&!_;return(0,R.jsx)(az,{title:a,collapsed:m&&!_,children:(0,R.jsxs)(`button`,{ref:d,disabled:r,onClick:()=>p(t),"data-tab-value":t,"data-tab-active":g,role:`tab`,"aria-selected":g?`true`:`false`,title:m&&!_&&a?a:void 0,className:D(`relative z-10 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-[250ms] ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,c?`size-9 shrink-0 flex-none rounded-full p-0`:`flex-1`,h==="default"&&!c&&`py-2.5`,h==="default"&&!c&&`rounded-md px-4`,h===`underline`&&`px-6 py-3 border-b-2 border-transparent`,g&&`text-foreground`,!g&&`text-muted-foreground hover:text-foreground`,n),...u,children:[i&&(0,R.jsxs)(`span`,{className:D(`relative inline-flex shrink-0 items-center justify-center`,c?`size-5`:_&&`mr-2`),children:[(0,R.jsx)(i,{className:D(`h-4 w-4 shrink-0 transition-all duration-[250ms] ease-in-out`,!_&&!c&&`mr-0!`)}),l&&v?l:null]}),o&&(0,R.jsx)(`span`,{className:`absolute top-1.5 right-1.5 w-2 h-2 bg-orange-500 dark:bg-orange-400 border-2 border-white dark:border-zinc-900 rounded-full transition-opacity duration-300 z-10 animate-status-pulse-orange`}),(0,R.jsx)(`span`,{className:D(`min-w-0 transition-all duration-[250ms] ease-in-out overflow-hidden`,_?`w-auto opacity-100`:`w-0 opacity-0`),children:e}),l&&!v?l:null]})})});oz.displayName=`TabsTrigger`;function sz(e){return jR(e)}var cz=z.createContext(void 0);function lz(){let e=z.useContext(cz);if(e===void 0)throw Error(Be(13));return e}var uz={imageLoadingStatus:()=>null},dz=z.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,[o,s]=z.useState(`idle`),c={imageLoadingStatus:o},l=z.useMemo(()=>({imageLoadingStatus:o,setImageLoadingStatus:s}),[o,s]),u=Ue(`span`,e,{state:c,ref:t,props:a,stateAttributesMapping:uz});return(0,R.jsx)(cz.Provider,{value:l,children:u})});function fz(e,{referrerPolicy:t,crossOrigin:n,sizes:r,srcSet:i}){let[a,o]=z.useState(`idle`);return ye(()=>{if(!e&&!i)return o(`error`),I;let a=!0,s=new window.Image,c=e=>()=>{a&&o(e)};return o(`loading`),s.onload=c(`loaded`),s.onerror=c(`error`),t&&(s.referrerPolicy=t),s.crossOrigin=n??null,r&&(s.sizes=r),i&&(s.srcset=i),e&&(s.src=e),s.complete&&o(s.naturalWidth>0?`loaded`:`error`),()=>{a=!1}},[e,i,r,n,t]),a}var pz={...uz,...vt},mz=z.forwardRef(function(e,t){let{className:n,render:r,onLoadingStatusChange:i,style:a,...o}=e,{setImageLoadingStatus:s}=lz(),c=fz(o.src,o),l=c===`loaded`,{mounted:u,transitionStatus:d,setMounted:p}=st(l),m=z.useRef(null),h=f(e=>{i?.(e),s(e)});ye(()=>{c!==`idle`&&h(c)},[c,h]),ye(()=>()=>s(`idle`),[s]),y({open:l,ref:m,onComplete(){l||p(!1)}});let g=Ue(`img`,e,{state:{imageLoadingStatus:c,transitionStatus:d},ref:[t,m],props:o,stateAttributesMapping:pz,enabled:u});return u?g:null}),hz=z.forwardRef(function(e,t){let{className:n,render:r,delay:i,style:a,...o}=e,{imageLoadingStatus:s}=lz(),[c,l]=z.useState(i===void 0),u=P();return z.useEffect(()=>(i===void 0?l(!0):u.start(i,()=>l(!0)),u.clear),[u,i]),Ue(`span`,e,{state:{imageLoadingStatus:s},ref:t,props:o,stateAttributesMapping:uz,enabled:s!==`loaded`&&(i===void 0||c)})});function gz({className:e,size:t=`default`,...n}){return(0,R.jsx)(dz,{"data-slot":`avatar`,"data-size":t,className:D(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function _z({className:e,...t}){return(0,R.jsx)(mz,{"data-slot":`avatar-image`,className:D(`aspect-square size-full rounded-full object-cover`,e),...t})}function vz({className:e,...t}){return(0,R.jsx)(hz,{"data-slot":`avatar-fallback`,className:D(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function yz(e,t){return e?.[0]?e[0].toUpperCase():t?.[0]?t[0].toUpperCase():`U`}function bz({chatApiUrl:e,dashboardUrl:t=`https://manufact.com/cloud`,fallback:n=null,onUserResolved:r,compact:i=!1}){let{user:a,loaded:o,authorizing:s,authorize:c,logout:l,mode:u}=sz(e),d=(0,z.useRef)(void 0);if((0,z.useEffect)(()=>{if(!o)return;let e=a?.id??null;d.current!==e&&(d.current=e,r?.(a))},[o,a,r]),!o)return null;if(!a)return(0,R.jsxs)(R.Fragment,{children:[n,(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:D(`shrink-0 rounded-full text-[13px]`,i?`px-2.5 text-xs`:`px-4`),disabled:s,onClick:()=>{c().catch(e=>QF.error(e instanceof Error?e.message:`Authorization failed`))},children:s?`Authorizing…`:`Sign in`})]});let f=yz(a.name,a.email),p=a.name??a.email??`User`;return(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsx)(kt,{variant:`ghost`,className:`relative h-8 w-8 shrink-0 rounded-full p-0 mr-2`,"aria-label":`User menu`,children:(0,R.jsxs)(gz,{className:`h-8 w-8 border border-zinc-300 dark:border-zinc-600`,children:[(0,R.jsx)(_z,{src:a.image??``,alt:p}),(0,R.jsx)(vz,{className:`text-sm`,children:f})]})}),nativeButton:!0}),(0,R.jsxs)(Za,{className:`w-56`,align:`end`,forceMount:!0,children:[(0,R.jsx)(Qa,{className:`font-normal`,children:(0,R.jsxs)(`div`,{className:`flex flex-col space-y-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium leading-none truncate`,children:p}),a.email&&a.email!==p&&(0,R.jsx)(`p`,{className:`text-xs leading-none text-muted-foreground truncate`,children:a.email})]})}),(0,R.jsx)(no,{}),(0,R.jsx)($a,{render:(0,R.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,R.jsx)(li,{className:`mr-2 h-4 w-4`}),`Go to dashboard`]})}),(0,R.jsx)(no,{}),(0,R.jsxs)($a,{onClick:()=>{l().catch(()=>QF.error(`Sign out failed`))},children:[(0,R.jsx)(hi,{className:`mr-2 h-4 w-4`}),u===`session`?`Sign out of Manufact`:`Disconnect Inspector`]})]})]})}function xz({count:e,isActive:t,size:n=`md`,overlay:r=!1}){return e<=0?null:(0,R.jsx)(`span`,{className:D(t?`dark:bg-black`:`dark:bg-zinc-700`,`shrink-0 bg-zinc-200 text-zinc-700 dark:text-zinc-300 rounded-full font-medium`,r&&`absolute -bottom-1 -right-1.5 z-10 flex h-3.5 min-w-3.5 items-center justify-center border border-background px-0.5 text-[9px] leading-none`,!r&&`ml-1`,!r&&n===`sm`&&`text-[10px] px-1.5 py-0.5`,!r&&n===`md`&&`text-xs px-2 py-0.5`),children:e})}var Sz=`flex h-10 items-center gap-2`;function Cz({serverConfig:e,additionalItems:t=[],showClients:n={cursor:!0,vsCode:!0,vsCodeInsiders:!0,claudeDesktop:!0,claudeCode:!0,geminiCli:!0,codexCli:!0},className:r=``,onSuccess:i,onError:a,trigger:o}){let[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(!1),{url:p,name:m,headers:h}=e,g=e=>{try{OT(new ko({client:e})).catch(()=>{})}catch{}},_=()=>{g(`cursor`);try{let e=EL(p,m,h);window.location.href=e,i?.(`Cursor`)}catch(e){console.error(`Failed to generate Cursor deep link:`,e),a?.(e)}},v=()=>{g(`vscode`);try{let e=DL(p,m,h);window.location.href=e,i?.(`VS Code`)}catch(e){console.error(`Failed to generate VS Code deep link:`,e),a?.(e)}},y=()=>{g(`vscode-insiders`);try{let e=OL(p,m,h);window.location.href=e,i?.(`VS Code Insiders`)}catch(e){console.error(`Failed to generate VS Code Insiders deep link:`,e),a?.(e)}},b=()=>{g(`claude-desktop`);try{AL(p,m,h),i?.(`Claude Desktop`)}catch(e){console.error(`Failed to download .mcpb file:`,e),a?.(e)}},x=()=>{g(`claude-code`),u(`claude-code`),c(!0)},S=()=>{g(`gemini-cli`),u(`gemini-cli`),c(!0)},C=()=>{g(`codex-cli`),u(`codex-cli`),c(!0)},w=async e=>{try{await nM(e),f(!0),setTimeout(()=>f(!1),2e3)}catch(e){console.error(`Failed to copy:`,e),a?.(e)}},T=()=>{if(l===`claude-code`){let{command:e,envVars:t}=jL(p,m,h),n=PL(t);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(rL,{children:[(0,R.jsx)(sL,{children:`Add to Claude Code`}),(0,R.jsx)(cL,{children:`Execute the following command in your shell to add this server to Claude Code.`})]}),(0,R.jsxs)(iL,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsx)(`span`,{children:`Ensure the Claude Code executable is available in your path`})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),n&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:`After installation, set these environment variables in your shell:`}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:n})})]}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The MCP configuration supports environment variable expansion using `,(0,R.jsx)(`code`,{className:`text-foreground`,children:"${VAR}"}),` `,`syntax.`]})]})]})}if(l===`gemini-cli`){let{command:e,envVars:t}=ML(p,m,h),n=PL(t);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(rL,{children:[(0,R.jsx)(sL,{children:`Add to Gemini CLI`}),(0,R.jsx)(cL,{children:`Execute the following command in your shell to add this server to Gemini CLI.`})]}),(0,R.jsxs)(iL,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsx)(`span`,{children:`Ensure the Gemini CLI executable is available in your path`})]}),n&&(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsx)(`span`,{children:`Set these environment variables in your shell before running the command:`})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:n?`3.`:`2.`}),(0,R.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),n&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:n})})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Gemini CLI to load the new configuration.`})]})]})}if(l===`codex-cli`){let{config:e,envVars:t}=NL(p,m,h);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(rL,{children:[(0,R.jsx)(sL,{children:`Add to Codex CLI`}),(0,R.jsxs)(cL,{children:[`Add this configuration to your`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),` `,`file.`]})]}),(0,R.jsxs)(iL,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Add this configuration to your`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),`:`]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),t.length>0&&(0,R.jsx)(`div`,{children:(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`(optional) If you would rather use variables from your system's environment, replace the`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`http_headers`}),` key with the `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`env_http_headers`}),` `,`key as shown in the commented section above.`]})}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Codex CLI to load the new configuration.`})]})]})}return null},E=(0,R.jsxs)(kt,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center ${r}`,children:[(0,R.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,R.jsx)(Ai,{className:`size-3`}),`Client`]}),(0,R.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,R.jsx)(Ir,{className:`size-3`})]})]}),ee=o?typeof o==`function`?o({isOpen:!1,onClick:()=>{}}):o:E;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,z.isValidElement)(ee)?ee:E,nativeButton:!0}),(0,R.jsxs)(Za,{align:`end`,className:`w-auto min-w-[300px]`,children:[t.map(e=>(0,R.jsxs)($a,{onClick:async()=>{await e.onClick()},className:Sz,children:[e.icon,(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:e.label})]},e.id)),t.length>0&&(0,R.jsx)(no,{}),n.cursor&&(0,R.jsxs)($a,{onClick:_,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Cursor`})]}),n.claudeCode&&(0,R.jsxs)($a,{onClick:x,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Code`})]}),n.claudeDesktop&&(0,R.jsxs)($a,{onClick:b,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Desktop`})]}),n.vsCode&&(0,R.jsxs)($a,{onClick:v,className:Sz,children:[(0,R.jsx)(IL,{className:`h-4 w-4 text-blue-500`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code`})]}),n.vsCodeInsiders&&(0,R.jsxs)($a,{onClick:y,className:Sz,children:[(0,R.jsx)(IL,{className:`h-4 w-4 text-teal-400`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code Insiders`})]}),n.geminiCli&&(0,R.jsxs)($a,{onClick:S,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Gemini CLI`})]}),n.codexCli&&(0,R.jsxs)($a,{onClick:C,className:Sz,children:[(0,R.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Codex CLI`})]})]})]}),(0,R.jsx)(eL,{open:s,onOpenChange:c,children:(0,R.jsx)(nL,{scrollable:!0,className:`max-w-3xl max-h-[80vh]`,children:T()})})]})}function wz({className:e,state:t=`collapsed`,to:n=`/`,showLabel:r=t===`expanded`,labelParts:i=`full`,pinSymbolInIconColumn:a=!1,size:o}){let[s,c]=(0,z.useState)(!1),l=1.5,u=.2/l,d=.8999999999999999/l,f=r&&(t===`expanded`||i===`inspector`),p=o??(a?20:t===`expanded`?40:20),m=(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(F.svg,{viewBox:`0 0 500 500`,initial:`rest`,animate:s?`hover`:`rest`,className:`text-foreground`,style:{width:p,height:p},children:[(0,R.jsxs)(F.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:l,times:[0,u,d,1],ease:`easeInOut`}}},fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`}),(0,R.jsx)(`circle`,{cx:`100.426`,cy:`399.575`,r:`100.426`}),(0,R.jsx)(`path`,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`})]}),(0,R.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(Tz,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`,times:{T0:0,T1:u,T2:d,T3:1},total:l}),(0,R.jsx)(Ez,{cx:100.426,cy:399.575,r:100.426,times:{T0:0,T1:u,T2:d,T3:1},total:l}),(0,R.jsx)(Tz,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`,times:{T0:0,T1:u,T2:d,T3:1},total:l})]})]})}),h=r?(0,R.jsx)(`span`,{className:D(`font-ubuntu flex items-center gap-2 whitespace-nowrap`,a?D(`pl-(--sidebar-nav-text-pl-absolute)`,f?`relative opacity-100 blur-0`:`pointer-events-none absolute left-0 top-1/2 w-0 -translate-y-1/2 overflow-hidden opacity-0 blur-[3px]`):i===`inspector`?`mr-0`:`mr-3`),children:i===`full`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-xl font-bold leading-none text-foreground [text-box:trim-both_cap_alphabetic]`,children:`mcp-use`}),(0,R.jsx)(`span`,{className:`text-lg font-sans font-light leading-none tracking-wide text-muted-foreground [text-box:trim-both_cap_alphabetic]`,children:`Inspector`})]}):(0,R.jsx)(`span`,{className:`text-base font-medium leading-none text-foreground [text-box:trim-both_cap_alphabetic]`,children:`Inspector`})}):null,g=a?(0,R.jsxs)(`div`,{className:D(`relative flex shrink-0 items-center`,f?`min-w-(--sidebar-width-icon)`:`w-(--sidebar-width-icon)`),children:[(0,R.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 left-0 flex w-(--sidebar-width-icon) items-center justify-center`,children:(0,R.jsx)(`div`,{className:`pointer-events-auto`,children:m})}),h]}):i===`inspector`?(0,R.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[m,h]}):(0,R.jsxs)(R.Fragment,{children:[m,h]});return(0,R.jsx)(yF,{to:n,className:D(`flex items-center transition-opacity`,!a&&i!==`inspector`&&`-my-3`,e),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:g})}function Tz({d:e,times:t,total:n}){let{T0:r,T1:i,T2:a,T3:o}=t;return(0,R.jsx)(F.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[r,i,a,o],ease:`easeInOut`}}}})}function Ez({cx:e,cy:t,r:n,times:r,total:i}){let{T0:a,T1:o,T2:s,T3:c}=r;return(0,R.jsx)(F.circle,{cx:e,cy:t,r:n,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:i,times:[a,o,s,c],ease:`easeInOut`}}}})}var Dz=(0,z.createContext)(void 0);function Oz(){let e=(0,z.use)(Dz);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e}function kz({children:e,defaultTheme:t=`system`,storageKey:n=`theme`,forcedTheme:r}){let[i,a]=(0,z.useState)(r||t),[o,s]=(0,z.useState)(!1),c=()=>typeof window>`u`?`light`:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`,l=i===`system`?c():i,u=e=>{let t=document.documentElement,i=e===`system`?c():e;t.classList.remove(`light`,`dark`),t.classList.add(i),r||localStorage.setItem(n,e)};return(0,z.useEffect)(()=>{s(!0);let e=localStorage.getItem(n),i=r||e||t;a(i),u(i)},[t,n,r]),(0,z.useEffect)(()=>{if(i!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>{u(`system`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[i]),(0,z.useEffect)(()=>{o&&u(i)},[i,o]),(0,R.jsx)(Dz,{value:{theme:i,setTheme:e=>{if(r){console.warn(`[ThemeProvider] Theme is forced via URL parameter, ignoring setTheme call`);return}a(e)},resolvedTheme:l},children:e})}function Az({ref:e,shimmerColor:t,shimmerSize:n=`0.05em`,shimmerDuration:r=`3s`,borderRadius:i=`100px`,background:a,className:o,children:s,...c}){let{theme:l}=Oz();return(0,R.jsxs)(`button`,{style:{"--spread":`90deg`,"--shimmer-color":t||(l===`dark`?`#000000`:`#ffffff`),"--radius":i,"--speed":r,"--cut":n,"--bg":a||(l===`dark`?`rgba(255, 255, 255, 1)`:`rgba(0, 0, 0, 1)`)},className:D(`group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]`,`transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px`,`dark:text-white text-black dark:border-white/10 border-black/10`,o),ref:e,...c,children:[(0,R.jsx)(`div`,{className:D(`-z-30 blur-[2px]`,`@container-[size] absolute inset-0 overflow-visible`),children:(0,R.jsx)(`div`,{className:`animate-shimmer-slide absolute inset-0 aspect-[1] h-[100cqh] rounded-none mask-none`,children:(0,R.jsx)(`div`,{className:`animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]`})})}),s,(0,R.jsx)(`div`,{className:D(`absolute inset-0 size-full`,`rounded-2xl px-4 py-1.5 text-sm font-medium`,`transform-gpu transition-all duration-300 ease-in-out`,`dark:shadow-[inset_0_-8px_10px_#0000001f] dark:group-hover:shadow-[inset_0_-6px_10px_#0000003f] dark:group-active:shadow-[inset_0_-10px_10px_#0000003f] shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]`)}),(0,R.jsx)(`div`,{className:D(`absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] bg-black dark:bg-white`)})]})}Az.displayName=`ShimmerButton`;function jz(e){switch(e){case`ready`:return`bg-emerald-600 animate-status-pulse`;case`failed`:return`bg-rose-600 animate-status-pulse-red`;default:return`bg-yellow-500 animate-status-pulse-yellow`}}function Mz(e){switch(e){case`ready`:return`Connected`;case`failed`:return`Failed`;default:return e}}function Nz({status:e,className:t}){return(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`div`,{className:D(`w-2 h-2 rounded-full shrink-0`,jz(e),t)}),nativeButton:!1}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{children:Mz(e)})})]})}var Pz=`h-6 px-2 text-xs bg-yellow-500/20 border-0 dark:bg-yellow-400/10 text-yellow-800 dark:text-yellow-500 shrink-0`;function Fz(e){try{sessionStorage.setItem(mI,JSON.stringify({url:e.url,name:e.name||`Auto-connected Server`,transportType:e.transportType||`http`,connectionMode:`auto`}))}catch{}}function Iz({server:e,className:t}){let{state:n,authUrl:r,authenticate:i}=e;return n!==`pending_auth`&&n!==`authenticating`?null:n===`authenticating`?(0,R.jsxs)(kt,{size:`sm`,variant:`outline`,disabled:!0,className:D(Pz,t),children:[(0,R.jsx)(fi,{className:`h-3 w-3 animate-spin mr-1`}),`Authenticating`]}):i?(0,R.jsx)(kt,{"data-testid":`server-header-authenticate`,size:`sm`,variant:`outline`,className:D(Pz,t),onClick:t=>{t.stopPropagation(),Fz(e),i()},children:`Authenticate`}):r?(0,R.jsx)(kt,{size:`sm`,variant:`outline`,className:D(Pz,t),render:(0,R.jsx)(`a`,{href:r,"data-testid":`server-header-authenticate`,onClick:t=>{t.stopPropagation(),Fz(e)}}),nativeButton:!1,children:`Authenticate`}):null}function Lz({connections:e,selectedServer:t,onServerSelect:n,mobileMode:r=!1,variant:i=`default`,compactHeader:a=!1}){let o=$N(),s=t=>{e.some(e=>e.id===t)&&n(t)},c=(0,R.jsxs)(Za,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,R.jsx)(Qa,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>o(`/`),children:`MCP Servers`}),(0,R.jsx)(no,{}),e.length===0?(0,R.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center`,children:`No servers connected. Go to the dashboard to add one.`}):e.map(e=>(0,R.jsxs)($a,{onClick:()=>s(e.id),className:`flex items-center gap-3`,children:[(0,R.jsx)(pL,{server:e,size:`sm`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:pM(e)}),(0,R.jsx)(Nz,{status:e.state})]})]},e.id)),(0,R.jsx)(no,{}),(0,R.jsx)($a,{onClick:()=>o(`/`),children:(0,R.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]});return r?(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsxs)(kt,{variant:`ghost`,className:`h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5`,children:[t?(0,R.jsx)(pL,{server:t,size:`md`}):(0,R.jsx)(Fi,{className:`h-5 w-5`}),(0,R.jsx)(Ir,{className:`h-4 w-4`})]}),nativeButton:!0}),c]})})}):i===`header`?(0,R.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsxs)(`button`,{type:`button`,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 border-0 bg-transparent p-0 cursor-pointer text-foreground transition-opacity hover:opacity-80`,children:[t&&(0,R.jsx)(pL,{server:t,size:`sm`,className:`!size-5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate text-sm`,children:t?pM(t):`Select server`}),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Nz,{status:t.state}),!a&&(0,R.jsx)(Iz,{server:t})]}),(0,R.jsx)(Ir,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),nativeButton:!0}),c]})}):(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(Ya,{children:[(0,R.jsx)(Xa,{render:(0,R.jsxs)(Az,{className:D(`min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200`,!t&&`pl-4`),children:[t&&(0,R.jsx)(pL,{server:t,size:`md`,className:`mr-2`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,R.jsx)(`span`,{className:`truncate lg:max-w-[120px] xl:max-w-none`,children:t?pM(t):`Select server to inspect`}),t&&(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:t.error&&t.state!==`ready`?(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`button`,{onClick:e=>{e.stopPropagation()},className:`w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors`,title:`Click to copy error message`,"aria-label":`Copy error message to clipboard`}),nativeButton:!0}),(0,R.jsx)(wt,{children:(0,R.jsx)(`p`,{className:`max-w-xs`,children:t.error})})]}):(0,R.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t.state===`ready`?`bg-emerald-600 animate-status-pulse`:t.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]})]}),nativeButton:!0}),c]})})})}function Rz(e){if(!e)return null;try{let t=new URL(e);if(t.protocol===`https:`)return t.origin}catch{}return null}function zz(e,t){return e===`tools`?t.tools.length:e===`prompts`?t.prompts.length:e===`resources`?t.resources.length:e===`sampling`?t.pendingSamplingRequests?.length||0:e===`elicitation`?t.pendingElicitationRequests?.length||0:e===`notifications`?t.unreadNotificationCount:0}function Bz(e,t,n){return n&&t>0&&[`sampling`,`elicitation`,`notifications`].includes(e)}var Vz=[{id:`server-metadata`,label:`Server Metadata`,icon:si},{id:`separator`},{id:`chat`,label:`Chat`,icon:vi,alwaysExpanded:!0},{id:`separator`},{id:`tools`,label:`Tools`,icon:Yi},{id:`prompts`,label:`Prompts`,icon:yi},{id:`resources`,label:`Resources`,icon:$r},{id:`sampling`,label:`Sampling`,icon:ti},{id:`elicitation`,label:`Elicitation`,icon:zi},{id:`notifications`,label:`Notifications`,icon:Mr},{id:`separator`},{id:`connection-settings`,label:`Connection Settings`,icon:Ii}],Hz=z.createContext(void 0);function Uz(e){let t=z.useContext(Hz);if(t===void 0&&!e)throw Error(Be(47));return t}function Wz(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Gz={...Re,disabled:zt(e=>e.disabled),instantType:zt(e=>e.instantType),openMethod:zt(e=>e.openMethod),openChangeReason:zt(e=>e.openChangeReason),modal:zt(e=>e.modal),focusManagerModal:zt(e=>e.focusManagerModal),stickIfOpen:zt(e=>e.stickIfOpen),titleElementId:zt(e=>e.titleElementId),descriptionElementId:zt(e=>e.descriptionElementId),openOnHover:zt(e=>e.openOnHover),closeDelay:zt(e=>e.closeDelay),hasViewport:zt(e=>e.hasViewport)},Kz=class e extends Wt{constructor(e,t,n=!1){let r={...Wz(),...e},i=new yt;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=rt(i,t,n),super(r,{popupRef:z.createRef(),backdropRef:z.createRef(),internalBackdropRef:z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:z.createRef(),beforeContentFocusGuardRef:z.createRef(),stickIfOpenTimeout:new Lt,triggerElements:i},Gz)}setOpen=(e,t)=>{let n=t.reason===o,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=He(t),s=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&s!=null&&(t.trigger=this.context.triggerElements.getById(s)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let c=()=>{let n={open:e,openChangeReason:t.reason};Nt(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),br.flushSync(c)):c(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=Xe(t,(t,r)=>new e(n,t,r));return z.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function qz({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Kz.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});qe(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=at()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),$e(u,d),We(u);let{forceUnmount:h}=xt(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=z.useCallback(()=>{u.setOpen(!1,A(Ee))},[u]);z.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=z.useMemo(()=>({store:u}),[u]);return(0,R.jsxs)(Hz.Provider,{value:v,children:[_&&(0,R.jsx)(Yz,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Jz(e){return Uz(!0)?(0,R.jsx)(qz,{props:e}):(0,R.jsx)(lt,{children:(0,R.jsx)(qz,{props:e})})}function Yz({store:e,modal:t}){let n=_(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return pt(e,{activeTriggerProps:n.reference??bt,inactiveTriggerProps:n.trigger??bt,popupProps:z.useMemo(()=>Vt(At,n.floating),[n.floating])}),null}var Xz=z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:o=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:u=!1,delay:d=300,closeDelay:f=0,id:p,...m}=e,h=Uz(!0),g=c?.store??h?.store;if(!g)throw Error(Be(74));let _=se(p),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=z.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=Pe(_,S,g,{payload:l,disabled:o,openOnHover:u,closeDelay:f}),T=g.useState(`openChangeReason`),E=g.useState(`stickIfOpen`),te=g.useState(`openMethod`),ne=g.useState(`focusManagerModal`),re=a(y,{enabled:!o&&y!=null&&u&&(te!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:me(),restMs:d,delay:{close:f},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),ie=Sn(y,{enabled:y!=null,stickIfOpen:E}),ae=dn(()=>g.select(`open`),e=>{g.set(`openMethod`,e)}),D=g.useState(`triggerProps`,w),{getButtonProps:O,buttonRef:k}=Ne({disabled:o,native:s}),A={open(e){return e&&T===`trigger-press`?nt.open(e):Le.open(e)}},{preFocusGuardRef:oe,handlePreFocusGuardFocus:j,handleFocusTargetFocus:ce}=xr(g,S),M=Ue(`button`,e,{state:{disabled:o,open:b},ref:[k,t,C,S],props:[ie.reference,re,D,ae,{[ee]:``,id:_,"aria-haspopup":`dialog`,"aria-expanded":b,"aria-controls":x},m,O],stateAttributesMapping:A});return w&&!ne?(0,R.jsxs)(z.Fragment,{children:[(0,R.jsx)(Tt,{ref:oe,onFocus:j}),(0,R.jsx)(z.Fragment,{children:M},_),(0,R.jsx)(Tt,{ref:g.context.triggerFocusTargetRef,onFocus:ce})]}):(0,R.jsx)(z.Fragment,{children:M},_)}),Zz=z.createContext(void 0);function Qz(){let e=z.useContext(Zz);if(e===void 0)throw Error(Be(45));return e}var $z=z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Uz();return i.useState(`mounted`)||n?(0,R.jsx)(Zz.Provider,{value:n,children:(0,R.jsx)(pe,{ref:t,...r})}):null}),eB=z.createContext(void 0);function tB(){let e=z.useContext(eB);if(!e)throw Error(Be(46));return e}var nB=z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:u=0,alignOffset:d=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:_=!1,collisionAvoidance:v=_e,...y}=e,{store:b}=Uz(),x=Qz(),S=l(),C=b.useState(`floatingRootContext`),w=b.useState(`mounted`),T=b.useState(`open`),E=b.useState(`openChangeReason`),ee=b.useState(`activeTriggerElement`),ne=b.useState(`modal`),re=b.useState(`openMethod`),ie=b.useState(`positionerElement`),ae=b.useState(`instantType`),D=b.useState(`transitionStatus`),O=b.useState(`hasViewport`),k=z.useRef(null),A=h(ie,!1,!1),oe=te({anchor:a,floatingRootContext:C,positionMethod:o,mounted:w,side:s,sideOffset:u,align:c,alignOffset:d,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:g,disableAnchorTracking:_,keepMounted:x,nodeId:S,collisionAvoidance:v,adaptiveOrigin:O?Oe:void 0}),j=C.useState(`domReferenceElement`);ye(()=>{let e=j,t=k.current;if(e&&(k.current=e),t&&e&&e!==t){b.set(`instantType`,void 0);let e=new AbortController;return A(()=>{b.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[j,A,b]),an(T&&ne===!0&&E!==`trigger-hover`,re===`touch`,ie,ee);let se=z.useCallback(e=>{b.set(`positionerElement`,e)},[b]),ce=St(e,{open:T,side:oe.side,align:oe.align,anchorHidden:oe.anchorHidden,instant:ae},{styles:oe.positionerStyles,transitionStatus:D,props:y,refs:[t,se],hidden:!w,inert:!T});return(0,R.jsxs)(eB.Provider,{value:oe,children:[w&&ne===!0&&E!==`trigger-hover`&&(0,R.jsx)(wn,{ref:b.context.internalBackdropRef,inert:sn(!T),cutout:ee}),(0,R.jsx)(le,{id:S,children:ce})]})}),rB=z.createContext(void 0);function iB(){let[e,t]=z.useState(0),n=f(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function aB(e){let{value:t,children:n}=e;return(0,R.jsx)(rB.Provider,{value:t,children:n})}var oB={...Et,...vt},sB=z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,{store:c}=Uz(),l=tB(),u=Cn(!0)!=null,{context:d,hasClosePart:f}=iB(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),b=c.useState(`descriptionElementId`),x=c.useState(`modal`),S=c.useState(`mounted`),C=c.useState(`openChangeReason`),w=c.useState(`activeTriggerElement`),T=c.useState(`floatingRootContext`),E=T.useState(`floatingId`),ee=c.useState(`disabled`),te=c.useState(`openOnHover`),ne=c.useState(`closeDelay`),re=s.id??E;y({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),Ge(T,{enabled:te&&!ee,closeDelay:ne});let ie=a===void 0?ut(c.context.popupRef):a,ae=x!==!1&&f;c.useSyncedValue(`focusManagerModal`,ae);let D=z.useCallback(e=>{c.set(`popupElement`,e)},[c]),O=Ue(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,D],props:[_,{id:re,role:`dialog`,...At,"aria-labelledby":v,"aria-describedby":b,onKeyDown(e){u&&Qt.has(e.key)&&e.stopPropagation()}},Ae(g),s],stateAttributesMapping:oB});return(0,R.jsx)(rn,{context:T,openInteractionType:m,modal:ae,disabled:!S||C===`trigger-hover`,initialFocus:ie,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:ct(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,R.jsx)(aB,{value:d,children:O})})});function cB({...e}){return(0,R.jsx)(Jz,{"data-slot":`popover`,...e})}function lB(e){return(0,R.jsx)(Xz,{"data-slot":`popover-trigger`,...e})}function uB({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,R.jsx)($z,{children:(0,R.jsx)(nB,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,R.jsx)(sB,{"data-slot":`popover-content`,className:D(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var dB={success:`border-emerald-700/20 bg-emerald-700/10 text-emerald-700 dark:border-emerald-400/30 dark:bg-emerald-400/10 dark:text-emerald-400`,failed:`border-red-500/20 bg-red-500/10 text-red-500 dark:border-red-400/30 dark:bg-red-400/10 dark:text-red-400`,warning:`border-amber-700/20 bg-amber-700/10 text-amber-700 dark:border-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400`,loading:`border-purple-500/20 bg-purple-500/10 text-purple-500 dark:border-purple-400/30 dark:bg-purple-400/10 dark:text-purple-400 animate-spin`},fB=`size-4 shrink-0 rounded-full border p-0.5`;function pB({state:e,className:t}){let n=D(fB,dB[e],t);switch(e){case`success`:return(0,R.jsx)(Fr,{className:n,"aria-hidden":!0});case`failed`:return(0,R.jsx)(zr,{className:n,"aria-hidden":!0});case`warning`:return(0,R.jsx)(Ki,{className:n,"aria-hidden":!0});case`loading`:return(0,R.jsx)(fi,{className:n,"aria-hidden":!0});default:return null}}function mB(){return`text-emerald-700 dark:text-emerald-400`}function hB({onStop:e,showCopiedBanner:t=!1}){return(0,R.jsxs)(R.Fragment,{children:[t&&(0,R.jsxs)(`div`,{className:D(`flex items-center gap-2 text-sm -mt-1`,mB()),children:[(0,R.jsx)(pB,{state:`success`}),(0,R.jsx)(`span`,{children:`URL copied to clipboard`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Tunnel URL`}),(0,R.jsxs)(`a`,{href:`https://manufact.com/docs/tunneling`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[`Docs`,(0,R.jsx)(Ar,{className:`size-3`})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Use in ChatGPT & Claude`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsxs)(`span`,{children:[`Enable`,` `,(0,R.jsx)(`a`,{href:`https://chatgpt.com/plugins#settings/Security`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline underline-offset-2 hover:text-purple-600 dark:hover:text-purple-400`,children:`dev mode`}),` `,`from settings`]})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`a`,{href:`https://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2Fplugins`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline underline-offset-2 hover:text-purple-600 dark:hover:text-purple-400`,children:`Add a connector`}),` `,`in App & Connectors`]})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`3.`}),(0,R.jsx)(`span`,{children:`Use the tunnel URL in the input`})]})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void e(),className:`flex items-center gap-1.5 text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors cursor-pointer`,children:[(0,R.jsx)(Vi,{className:`size-3 fill-current`}),`Stop Tunnel`]})]})}function gB(e){try{let t=new URL(e),n=t.pathname+t.search;return t.host+(n&&n!==`/`?n:``)}catch{return e}}function _B({copied:e,onCopy:t,className:n}){return(0,R.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":e?`URL copied`:`Copy URL`,className:D(`shrink-0 cursor-pointer p-0.5 rounded-sm text-muted-foreground hover:text-foreground transition-opacity opacity-0 group-hover:opacity-100`,n),children:e?(0,R.jsx)(pB,{state:`success`,className:`size-3.5`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}function vB({url:e,className:t,tunnelPopover:n}){let[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!1);if(!e)return null;let s=gB(e),c=n?.mcpUrl??e,l=!!n,u=async()=>{try{await nM(c),i(!0),setTimeout(()=>i(!1),2e3)}catch{QF.error(`Failed to copy URL`)}};(0,z.useEffect)(()=>{if(!n?.autoCopyOnOpen){o(!1);return}o(!0),i(!0);let e=setTimeout(()=>i(!1),2e3);return()=>clearTimeout(e)},[n?.autoCopyOnOpen]);let d=(0,R.jsxs)(R.Fragment,{children:[l?(0,R.jsx)(Lr,{className:`size-3.5 shrink-0`}):(0,R.jsx)(ei,{className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate max-w-[min(24rem,30vw)]`,children:s})]}),f=D(`flex items-center gap-1 min-w-0 truncate text-left text-sm cursor-pointer`,l?`text-purple-600 dark:text-purple-400`:`text-blue-500`);return(0,R.jsxs)(`div`,{className:D(`group flex items-center gap-1.5 min-w-0`,t),children:[l?(0,R.jsxs)(cB,{open:n.open,onOpenChange:n.onOpenChange,children:[(0,R.jsx)(lB,{render:(0,R.jsx)(`button`,{type:`button`,className:D(f,`hover:opacity-80`),children:d}),nativeButton:!0}),(0,R.jsx)(uB,{className:`w-[calc(100vw-2rem)] sm:w-96`,align:`start`,sideOffset:4,children:(0,R.jsx)(hB,{showCopiedBanner:a,onStop:async()=>{n.onOpenChange(!1),await n.onStop()}})})]}):(0,R.jsx)(`span`,{className:f,children:d}),(0,R.jsx)(_B,{copied:r,onCopy:()=>void u()})]})}function yB({devFromCli:e,isTunnelStarting:t,waitTicks:n,onStart:r}){if(t)return(0,R.jsxs)(`button`,{disabled:!0,className:`flex items-center gap-1 h-6 px-2 bg-violet-50 dark:bg-violet-950/40 border border-violet-200 dark:border-violet-800 rounded-full opacity-75 cursor-wait shrink-0`,children:[(0,R.jsx)(fi,{className:`size-3 text-violet-500 dark:text-violet-400 animate-spin`}),(0,R.jsxs)(`span`,{className:`text-xs font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:[`Start Tunnel `,(0,R.jsxs)(`span`,{className:`tabular-nums`,children:[n,`s`]})]})]});let i=e===!0,a=e===null;return(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void r(),disabled:!i||a,title:e===!1?"Run `mcp-use dev` from your project to enable tunneling.":a?`Checking dev server…`:void 0,className:D(`flex items-center gap-1 h-6 px-2 border rounded-full transition-colors shrink-0`,i&&!a?`bg-violet-50 dark:bg-violet-950/40 border-violet-200 dark:border-violet-800 hover:bg-violet-100 dark:hover:bg-violet-900/50 cursor-pointer`:`bg-violet-50/60 dark:bg-violet-950/20 border-violet-200 dark:border-violet-800 cursor-not-allowed opacity-70`),children:[a?(0,R.jsx)(fi,{className:`size-3 text-violet-500 dark:text-violet-400 animate-spin`}):(0,R.jsx)(Lr,{className:`size-3 text-violet-500 dark:text-violet-400`}),(0,R.jsx)(`span`,{className:`text-xs font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:`Start Tunnel`})]})}async function bB(){try{let e=await fetch(cM(`dev/info`));return e.ok?await e.json():null}catch{return null}}function xB(){return typeof window>`u`?!1:window.__MCP_INSPECTOR_MODE__!==`standalone`}function SB({tunnelUrl:e,setTunnelUrl:t,isTunnelStarting:n,setIsTunnelStarting:r,onTunnelStarted:i}){let[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(0),d=(0,z.useCallback)((e,n)=>{let r=n?.syncTunnel??!1;if(o(!!e.fromCli),e.mcpUrl&&c(e.mcpUrl),!r)return;if(e.tunnelUrl){t(new URL(e.tunnelUrl).origin);return}let i=Rz(e.mcpUrl??null);if(i){t(i);return}t(null)},[t]);return(0,z.useEffect)(()=>{if(!n){u(20);return}u(20);let e=setInterval(()=>u(e=>e>0?e-1:0),1e3);return()=>clearInterval(e)},[n]),(0,z.useEffect)(()=>{let e=!1;if(!xB()){o(!1);return}return(async()=>{let t=await bB();e||(t?d(t,{syncTunnel:!0}):o(!1))})(),()=>{e=!0}},[d]),{devFromCli:a,mcpUrl:s,waitTicks:l,handleStartTunnel:(0,z.useCallback)(async()=>{if(a===!1){QF.error("Start Tunnel requires `mcp-use dev` from your project directory.");return}r(!0);let e=!1;try{let t=await fetch(cM(`dev/start-tunnel`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));QF.error(e.error||`Failed to start tunnel`);return}let n=await bB();if(n?.tunnelUrl||n?.mcpUrl){d(n,{syncTunnel:!0});let e=n.mcpUrl??(n.tunnelUrl?`${n.tunnelUrl.replace(/\/+$/,``)}/mcp`:null);e&&tM(e),i?.()}e=!0}catch{QF.error(`Failed to start tunnel`)}finally{r(!1)}try{OT(new To({action:`start`,success:e})).catch(()=>{})}catch{}},[d,a,i,r]),handleStopTunnel:(0,z.useCallback)(async()=>{r(!0);let n=!1;try{let e=await fetch(cM(`dev/stop-tunnel`),{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));QF.error(t.error||`Failed to stop tunnel`);return}t(null),c(null),QF.success(`Tunnel stopped`),n=!0}catch{QF.error(`Failed to stop tunnel`)}finally{r(!1)}try{OT(new To({action:`stop`,success:n,tunnelUrl:e})).catch(()=>{})}catch{}},[r,t,e])}}function CB(e){let t=window.matchMedia(`(min-width: 1024px)`);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function wB(){return window.matchMedia(`(min-width: 1024px)`).matches}function TB(){return!0}function EB(){return(0,z.useSyncExternalStore)(CB,wB,TB)}function DB(e){let[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)(!1),a=EB(),o=(0,z.useCallback)(()=>{n(!0),i(!0)},[]);return(0,z.useEffect)(()=>{e||(n(!1),i(!1))},[e]),(0,z.useEffect)(()=>{if(!e)return;let t=new URLSearchParams(window.location.search);if(!t.has(`openTunnelPopover`))return;n(!0),i(!0),t.delete(`openTunnelPopover`);let r=t.toString();window.history.replaceState({},``,`${window.location.pathname}${r?`?${r}`:``}`)},[e]),{open:t,onOpenChange:(0,z.useCallback)(e=>{n(e),e||i(!1)},[]),isLgUp:a,autoCopyOnOpen:r,openWithAutoCopy:o}}function OB({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:i,embedded:a=!1,sidebarCollapsed:o=!1}){let{tunnelUrl:s,isTunnelStarting:c,setTunnelUrl:l,setIsTunnelStarting:u,embeddedConfig:d}=yL(),[f,p]=(0,z.useState)(!1),[m]=(0,z.useState)(!0),h=DB(s),g=SB({tunnelUrl:s,setTunnelUrl:l,isTunnelStarting:c,setIsTunnelStarting:u,onTunnelStarted:h.openWithAutoCopy});if(d.singleTab)return null;let _=d.visibleTabs?Vz.filter(e=>e.id===`separator`||d.visibleTabs.includes(e.id)):Vz,v=!!t,y=!!t&&(uM(t.url??``)||dM(t.url??``)||!!s),b=t?s?`${s.replace(/\/+$/,``)}${oM()}`:t.url??``:``,x=g.mcpUrl??(s?`${s.replace(/\/+$/,``)}${oM()}`:null),S=(e,n)=>{if(!t||!b)return null;let r=e===`desktop`?h.isLgUp:!h.isLgUp;return(0,R.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,R.jsx)(vB,{url:b,className:n,tunnelPopover:s&&x&&r?{mcpUrl:x,onStop:g.handleStopTunnel,open:h.open,onOpenChange:h.onOpenChange,autoCopyOnOpen:h.autoCopyOnOpen}:void 0}),y&&!s&&(0,R.jsx)(yB,{devFromCli:g.devFromCli,isTunnelStarting:c,waitTicks:g.waitTicks,onStart:g.handleStartTunnel})]})},C=()=>a?null:(0,R.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 flex-shrink-0`,children:[t&&(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(Cz,{serverConfig:{url:b,name:pM(t),headers:wM(t),serverId:t.id},onSuccess:e=>QF.success(`Opening in ${e}...`),onError:e=>QF.error(`Failed: ${e.message}`),trigger:(0,R.jsxs)(kt,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center`,"aria-label":`Add to Client`,children:[(0,R.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,R.jsx)(Ai,{className:`size-3`}),`Client`]}),(0,R.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,R.jsx)(Ir,{className:`size-3`})]})]})})}),(0,R.jsx)(`a`,{href:f?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{OT(new Eo({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},className:`inline-flex h-8 items-center justify-center rounded-full border border-blue-500/25 bg-blue-500/10 px-4 text-[13px] text-blue-500 outline-none cursor-pointer transition-colors hover:bg-blue-500/15 dark:border-blue-400/30 dark:bg-blue-400/10 dark:text-blue-400 dark:hover:bg-blue-400/15 focus-visible:ring-1 focus-visible:ring-ring`,children:(0,R.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Deploy`})}),w()]}),w=(e=!1)=>d.chatApiUrl?(0,R.jsx)(bz,{chatApiUrl:d.chatApiUrl,onUserResolved:e=>p(!!e),compact:e}):null;return(0,R.jsxs)(`header`,{className:`w-full min-w-0 shrink-0 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`hidden lg:flex h-(--header-height) items-center justify-between gap-3 px-4 md:pl-0 md:pr-6`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:D(`hidden lg:block shrink-0`,v&&o&&`-mr-[calc(var(--sidebar-width-icon)/2-0.625rem)]`),children:(0,R.jsx)(wz,{pinSymbolInIconColumn:!0,showLabel:!v||!o,state:v&&o?`collapsed`:`expanded`})}),(0,R.jsx)(`span`,{className:`text-sm text-muted-foreground/60 shrink-0 [text-box:trim-both_cap_alphabetic]`,children:`/`}),(0,R.jsx)(Lz,{connections:e,selectedServer:t,onServerSelect:r,variant:`header`}),S(`desktop`)]})}),C()]}),(0,R.jsxs)(`div`,{className:`flex lg:hidden min-w-0 w-full flex-col overflow-hidden pt-(--mobile-chrome-gap)`,children:[(0,R.jsx)(`div`,{className:`flex min-h-0 items-center gap-2 pb-(--mobile-chrome-gap)`,children:!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2.5 overflow-hidden`,children:[(0,R.jsx)(wz,{state:`collapsed`,showLabel:!0,labelParts:`inspector`,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`shrink-0 px-0.5 text-sm text-muted-foreground/60 [text-box:trim-both_cap_alphabetic]`,children:`/`}),(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(Lz,{connections:e,selectedServer:t,onServerSelect:r,variant:`header`,compactHeader:!0})})]}),(0,R.jsx)(`div`,{className:`shrink-0`,children:w(!0)})]})}),t&&(0,R.jsx)(`div`,{className:`w-full min-w-0 pb-(--mobile-chrome-gap) lg:hidden`,children:(0,R.jsx)(rz,{value:n,onValueChange:e=>i(e),collapsed:m,className:`w-full`,children:(0,R.jsx)(iz,{className:`w-full gap-0 border-0 bg-transparent p-0 [&_[role=tablist]]:justify-between`,children:_.filter(e=>e.id!==`separator`).map(e=>{let r=zz(e.id,t);return(0,R.jsx)(oz,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,iconOnly:!0,title:e.label,badge:r>0?(0,R.jsx)(xz,{count:r,isActive:n===e.id,overlay:!0}):void 0,className:`size-9 shrink-0 rounded-full p-0`,children:(0,R.jsx)(`span`,{className:`sr-only`,children:e.label})},e.id)})})})})]})]})}function kB({collapsed:e,onToggle:t}){let n=e?`Expand sidebar`:`Collapse sidebar`;return(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsxs)(kt,{type:`button`,variant:`ghost`,size:`icon-sm`,tabIndex:-1,"aria-label":n,onClick:t,className:D(`border-border absolute top-1/2 right-0 z-30 hidden size-7 min-h-7 min-w-7 -translate-y-1/2 translate-x-1/2 rounded-full border bg-background lg:flex`,`opacity-0 transition-opacity duration-200 group-hover/sidebar:opacity-100 focus-visible:opacity-100`),children:[(0,R.jsx)(wi,{className:`size-4`}),(0,R.jsx)(`span`,{className:`sr-only`,children:n})]}),nativeButton:!0}),(0,R.jsx)(wt,{side:`right`,children:n})]})}function AB({className:e}){return(0,R.jsxs)(`svg`,{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`,className:e,children:[(0,R.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,R.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}var jB=z.createContext(void 0);function MB(){let e=z.useContext(jB);if(e===void 0)throw Error(Be(63));return e}var NB=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),PB={...Tn,checked(e){return e?{[NB.checked]:``}:{[NB.unchecked]:``}}};function FB(e,t,n,r=!0,i){let[a,o]=z.useState(),s=se(i?`${i}-label`:void 0),c=e??t??a;return ye(()=>{let i=e||t||!r?void 0:IB(n.current,s);a!==i&&o(i)}),c}function IB(e,t){let n=LB(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function LB(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var RB=z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:_,value:v,style:y,...b}=e,{clearErrors:x}=An(),{state:S,setTouched:C,setDirty:w,validityData:T,setFilled:E,setFocused:ee,validationMode:te,disabled:ne,name:re,validation:ie}=On(),{labelId:ae}=kn(),D=ne||m,O=re??l,k=z.useRef(null),oe=Ye(k,c,ie.inputRef),j=z.useRef(null),ce=se(),M=cn({id:s,implicit:!1,controlRef:j}),N=u?void 0:M,[le,ue]=Yt({controlled:n,default:!!i,name:`Switch`,state:`checked`});En(j,ce,le,void 0,!D,l),ye(()=>{k.current&&E(k.current.checked)},[k,E]),Dn(le,()=>{x(O),w(le!==T.initialValue),E(le),ie.change(le)});let{getButtonProps:de,buttonRef:fe}=Ne({disabled:D,native:u}),pe=FB(a,ae,k,!u,N),me={id:u?M:ce,role:`switch`,"aria-checked":le,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":pe,onFocus(){D||ee(!0)},onBlur(){let e=k.current;!e||D||(C(!0),ee(!1),te===`onBlur`&&ie.commit(e.checked))},onClick(e){if(f||D)return;e.preventDefault();let t=k.current;t&&t.dispatchEvent(new(g(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},he=Vt({checked:le,disabled:D,form:o,id:N,name:O,required:p,style:O?Ie:tt,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:oe,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=A(ke,e.nativeEvent);d?.(t,n),!n.isCanceled&&ue(t)},onFocus(){j.current?.focus()}},e=>ie.getValidationProps(D,e),v===void 0?bt:{value:v}),ge=z.useMemo(()=>({...S,checked:le,disabled:D,readOnly:f,required:p}),[S,le,D,f,p]),_e=Ue(`span`,e,{state:ge,ref:[t,j,fe],props:[me,b,de,e=>ie.getValidationProps(D,e)],stateAttributesMapping:PB});return(0,R.jsxs)(jB.Provider,{value:ge,children:[_e,!le&&O&&_!==void 0&&(0,R.jsx)(`input`,{type:`hidden`,form:o,name:O,value:_,disabled:D}),(0,R.jsx)(`input`,{...he,suppressHydrationWarning:!0})]})}),zB=z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Ue(`span`,e,{state:MB(),ref:t,stateAttributesMapping:PB,props:a})}),BB=34,VB=20,HB=16,UB=2,WB=4,GB=2;function KB(e){return`label`in e&&typeof e.label==`string`}var qB=(0,z.forwardRef)(({label:e,checked:t,onToggle:n,disabled:r=!1,thumbTransition:i,uncheckedTrackColor:a,uncheckedTrackColorHovered:o,className:s,...c},l)=>{let u=(0,z.useId)(),d=(0,z.useRef)(!1),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(!1),g=(0,z.useRef)(!1),_=(0,z.useRef)(!1),v=(0,z.useRef)(null),y=ia(t?16:UB);(0,z.useEffect)(()=>{d.current=!0},[]);let b=m?20:f?18:HB,x=m?HB-WB:HB,S=m?4:UB,C=b-HB,w=t?16-C:UB;(0,z.useEffect)(()=>{g.current||(d.current?ka(y,w,i??Ot.moderate):y.set(w))},[w,y,i]);let T=(0,z.useCallback)(e=>{r||e.pointerType===`mouse`&&e.button!==0||(h(!0),g.current=!1,_.current=!1,v.current={clientX:e.clientX,originX:y.get()},e.currentTarget.setPointerCapture(e.pointerId))},[r,y]),E=(0,z.useCallback)(e=>{if(!v.current)return;let t=e.clientX-v.current.clientX;if(!g.current){if(Math.abs(t)<GB)return;g.current=!0}let n=UB,r=BB-UB-20,i=v.current.originX+t;y.set(Math.max(n,Math.min(r,i)))},[y]),ee=(0,z.useCallback)(e=>{v.current&&=(h(!1),g.current&&(_.current=!0,g.current=!1,e&&(y.get()>14/2===t?ka(y,t?16:UB,i??Ot.moderate):n()),requestAnimationFrame(()=>{_.current=!1})),null)},[t,n,y,i]);return(0,R.jsxs)(`div`,{ref:l,className:D(`relative z-10 flex items-center gap-2.5 px-3 py-2 cursor-pointer select-none touch-none`,r&&`opacity-50 pointer-events-none`,s),onPointerEnter:e=>{e.pointerType===`mouse`&&p(!0)},onPointerLeave:()=>p(!1),onPointerDown:T,onPointerMove:E,onPointerUp:()=>ee(!0),onPointerCancel:()=>{v.current&&=(h(!1),g.current&&(g.current=!1,ka(y,t?16:UB,i??Ot.moderate)),null)},onClick:()=>{r||_.current||n()},...c,children:[(0,R.jsx)(RB,{checked:t,"aria-labelledby":u,onCheckedChange:()=>{_.current||n()},disabled:r,tabIndex:0,className:D(`relative shrink-0 rounded-full outline-none cursor-pointer`,`transition-colors duration-80`,`focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] focus-visible:ring-offset-2 focus-visible:ring-offset-background`),style:{width:BB,height:VB,backgroundColor:t?f?`color-mix(in oklab, var(--primary) 88%, black)`:`var(--primary)`:f?o??`color-mix(in oklab, var(--accent), rgb(var(--overlay)) 10%)`:a??`var(--accent)`},onClick:e=>e.stopPropagation(),children:(0,R.jsx)(zB,{render:e=>{let{style:t,onDrag:n,onDragStart:r,onDragEnd:a,onAnimationStart:o,onAnimationEnd:s,onAnimationIteration:c,...l}=e;return(0,R.jsx)(F.span,{...l,className:`absolute top-0 left-0 block rounded-full bg-white shadow-sm`,initial:!1,style:{...t,x:y},animate:{y:S,width:b,height:x},transition:d.current?i??Ot.moderate:{duration:0}})}})}),(0,R.jsx)(`span`,{id:u,className:D(`text-[13px] [text-box:trim-both_cap_alphabetic] transition-[color] duration-80`,t?`text-foreground`:`text-muted-foreground`),children:e})]})});qB.displayName=`FluidSwitch`;var JB=(0,z.forwardRef)(({checked:e,defaultChecked:t=!1,onCheckedChange:n,disabled:r=!1,className:i},a)=>{let[o,s]=(0,z.useState)(t),c=e??o;return(0,R.jsx)(RB,{ref:a,checked:c,disabled:r,onCheckedChange:t=>{e===void 0&&s(t),n?.(t)},className:D(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors duration-80`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)]`,`disabled:cursor-not-allowed disabled:opacity-50`,`data-checked:bg-primary data-unchecked:bg-input`,i),children:(0,R.jsx)(zB,{className:D(`pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform duration-80`,`data-checked:translate-x-4 data-unchecked:translate-x-0`)})})});JB.displayName=`ShadcnSwitch`;var YB=(0,z.forwardRef)((e,t)=>KB(e)?(0,R.jsx)(qB,{ref:t,...e}):(0,R.jsx)(JB,{ref:t,...e}));YB.displayName=`Switch`;function XB({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 -28.5 256 256`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,R.jsx)(`path`,{d:`M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z`,fillRule:`nonzero`})})}var ZB=`flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,QB=`color-mix(in oklab, var(--sidebar-foreground) 22%, var(--sidebar))`,$B=`color-mix(in oklab, var(--sidebar-foreground) 30%, var(--sidebar))`,eV=`data-unchecked:!bg-zinc-300 dark:data-unchecked:!bg-zinc-600`;function tV({collapsed:e,rpcLoggerOpen:t,onRpcLoggerOpenChange:n,onCommandPaletteOpen:r}){let{embeddedConfig:i}=yL(),{theme:a,setTheme:o}=Oz(),{user:s}=sz(i.chatApiUrl),c=s?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,l=()=>{try{OT(new Eo({referrer:`mcp-use-inspector-sidebar`})).catch(()=>{})}catch{}};return(0,R.jsx)(`footer`,{className:`mt-auto shrink-0`,children:(0,R.jsxs)(`div`,{className:D(`flex flex-col`,e?`items-center gap-2 px-2 py-3`:`gap-3 px-(--sidebar-nav-inset-x) py-4`),children:[e?(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`div`,{className:`flex size-8 items-center justify-center`,children:(0,R.jsx)(YB,{checked:t,onCheckedChange:n,"aria-label":`RPC Panel`,className:D(`scale-75`,eV)})}),nativeButton:!1}),(0,R.jsx)(wt,{side:`right`,children:`RPC Panel`})]}):(0,R.jsx)(YB,{label:`RPC Panel`,checked:t,onToggle:()=>n(!t),uncheckedTrackColor:QB,uncheckedTrackColorHovered:$B,className:`w-full flex-row-reverse justify-between`}),e?(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:l,className:ZB,"aria-label":`Deploying your MCP Server? Try manufact.com`,children:(0,R.jsx)(Ar,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:`right`,children:`Deploying your MCP Server? Try manufact.com`})]}):(0,R.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:l,className:`relative block rounded-xl border border-sidebar-border bg-white p-3 transition-colors hover:bg-sidebar-accent/50 dark:bg-black`,children:[(0,R.jsx)(Ar,{className:`absolute top-2.5 right-2.5 size-3.5 text-muted-foreground`,"aria-hidden":!0}),(0,R.jsx)(`p`,{className:`pr-5 text-xs leading-snug text-muted-foreground`,children:`Deploying your MCP Server?`}),(0,R.jsxs)(`p`,{className:`mt-0.5 text-xs leading-snug`,children:[`Try`,` `,(0,R.jsx)(`span`,{className:`font-medium underline underline-offset-2`,children:`manufact.com`})]})]}),(0,R.jsxs)(`div`,{className:D(`flex`,e?`flex-col items-center gap-1`:`flex-row items-center gap-2`),children:[(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,className:ZB,"aria-label":`GitHub`,children:(0,R.jsx)(AB,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:e?`right`:`top`,children:`GitHub`})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`a`,{href:`https://discord.gg/XkNkSkMz3V`,target:`_blank`,rel:`noopener noreferrer`,className:ZB,"aria-label":`Discord`,children:(0,R.jsx)(XB,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:e?`right`:`top`,children:`Discord`})]}),(0,R.jsxs)(Ya,{children:[(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(Xa,{render:(0,R.jsx)(`button`,{type:`button`,className:ZB,"aria-label":`Theme`,children:a===`light`?(0,R.jsx)(Ui,{className:`size-4`}):a===`dark`?(0,R.jsx)(xi,{className:`size-4`}):(0,R.jsx)(bi,{className:`size-4`})}),nativeButton:!0}),nativeButton:!0}),(0,R.jsx)(wt,{side:e?`right`:`top`,children:`Theme`})]}),(0,R.jsx)(Za,{side:e?`right`:`top`,align:e?`start`:`center`,className:`w-40`,children:(0,R.jsxs)(eo,{value:a,onValueChange:e=>o(e),children:[(0,R.jsxs)(to,{value:`light`,children:[(0,R.jsx)(Ui,{className:`size-4 mr-2`}),`Light`]}),(0,R.jsxs)(to,{value:`dark`,children:[(0,R.jsx)(xi,{className:`size-4 mr-2`}),`Dark`]}),(0,R.jsxs)(to,{value:`system`,children:[(0,R.jsx)(bi,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`button`,{type:`button`,onClick:r,className:ZB,"aria-label":`Command Palette`,"data-testid":`command-palette-trigger-button`,children:(0,R.jsx)(Ur,{className:`size-4`})}),nativeButton:!0}),(0,R.jsxs)(wt,{side:e?`right`:`top`,children:[`Command Palette (`,`⌘`,`K)`]})]})]})]})})}function nV(e,t){let n=0,r=0,i=e;for(;i&&i!==t;)n+=i.offsetTop,r+=i.offsetLeft,i=i.offsetParent;if(i!==t){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{top:r.top-n.top,left:r.left-n.left,width:r.width,height:r.height}}return{top:n,left:r,width:e.offsetWidth,height:e.offsetHeight}}function rV(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.top!==i.top||n.left!==i.left||n.width!==i.width||n.height!==i.height)return!1}return!0}function iV(e,t={}){let{axis:n=`y`}=t,r=(0,z.useRef)(new Map),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)({}),c=(0,z.useRef)({}),l=(0,z.useRef)(0),u=(0,z.useRef)(null),d=(0,z.useRef)(null),f=(0,z.useCallback)(()=>{let t=e.current;if(!t)return;let n={};r.current.forEach((e,r)=>{n[r]=nV(e,t)}),!rV(c.current,n)&&(c.current=n,s(n))},[e]),p=(0,z.useCallback)((e,t)=>{t?r.current.set(e,t):r.current.delete(e),d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{d.current=null,f()})},[f]),m=(0,z.useCallback)(t=>{let r=t.clientX,i=t.clientY;u.current!==null&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null;let t=e.current;if(!t)return;let o=t.getBoundingClientRect(),s=n===`x`?r:i,l=null,d=1/0,f=null,p=c.current,m=n===`x`?t.scrollLeft:t.scrollTop,h=n===`x`?t.clientLeft:t.clientTop,g=n===`x`?o.left:o.top,_=n===`x`?t.offsetWidth:t.offsetHeight,v=n===`x`?o.width:o.height,y=_>0?v/_:1;for(let[e,t]of Object.entries(p)){let r=g+(h+(n===`x`?t.left:t.top)-m)*y,i=(n===`x`?t.width:t.height)*y,a=r+i;s>=r&&s<=a&&(f=e);let o=r+i/2,c=Math.abs(s-o);c<d&&(d=c,l=e)}a(f??l)})},[n,e]),h=(0,z.useCallback)(()=>{l.current+=1},[]),g=(0,z.useCallback)(()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),a(null)},[]);return(0,z.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>{d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{d.current=null,f()})});return n.observe(t),()=>n.disconnect()},[e,f]),(0,z.useEffect)(()=>()=>{u.current!==null&&cancelAnimationFrame(u.current),d.current!==null&&cancelAnimationFrame(d.current)},[]),{activeKey:i,itemRects:o,sessionRef:l,handlers:{onMouseMove:m,onMouseEnter:h,onMouseLeave:g},registerItem:p,measureItems:f}}function aV(e){if(!e)return{left:0,right:0};let t=getComputedStyle(e),n=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-pill-bleed`))||0,r=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-scrollbar-width`))||0,i=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-pill-outer-trim-right`))||0;return{left:n,right:n+r+i}}function oV(e,t){return{...e,left:e.left-t.left,width:e.width+t.left+t.right}}var sV=(0,z.createContext)(null);function cV(){let e=(0,z.useContext)(sV),t=(0,z.useRef)(e?.registerItem);t.current=e?.registerItem;let n=(0,z.useRef)(new Map);return(0,z.useCallback)(e=>{let r=n.current,i=r.get(e);return i||(i=n=>t.current?.(e,n),r.set(e,i)),i},[])}function lV({children:e,isActiveKey:t,className:n}){let r=(0,z.useRef)(null),{activeKey:i,itemRects:a,sessionRef:o,handlers:s,registerItem:c,measureItems:l}=iV(r),u=(0,z.useMemo)(()=>({registerItem:c}),[c]),d=Object.keys(a).find(e=>t(e))??null;(0,z.useLayoutEffect)(()=>{l()},[l,e,d]);let f=aV(r.current),p=i?a[i]:null,m=d?a[d]:null,h=p?oV(p,f):null,g=m?oV(m,f):null,_=i!==null&&i!==d;return(0,R.jsx)(sV.Provider,{value:u,children:(0,R.jsxs)(`div`,{ref:r,onMouseEnter:s.onMouseEnter,onMouseMove:s.onMouseMove,onMouseLeave:s.onMouseLeave,className:D(`relative isolate`,n),children:[(0,R.jsx)(en,{initial:!1,children:g&&d?(0,R.jsx)(F.div,{"aria-hidden":!0,className:`pointer-events-none absolute -z-20 rounded-full bg-sidebar-accent`,initial:{opacity:0,top:g.top,left:g.left,width:g.width,height:g.height},animate:{opacity:_?.85:1,top:g.top,left:g.left,width:g.width,height:g.height},exit:{opacity:0,transition:Ot.fast.exit},transition:{opacity:{duration:.08},top:{duration:0},left:{duration:0},width:{duration:0},height:{duration:0}}},d):null}),(0,R.jsx)(en,{children:h?(0,R.jsx)(F.div,{"aria-hidden":!0,className:`pointer-events-none absolute -z-10 rounded-full bg-sidebar-accent`,initial:{opacity:0,top:g?.top??h.top,left:g?.left??h.left,width:g?.width??h.width,height:g?.height??h.height},animate:{opacity:1,top:h.top,left:h.left,width:h.width,height:h.height},exit:{opacity:0,transition:Ot.fast.exit},transition:{...Ot.fast,opacity:{duration:.08}}},o.current):null}),e]})})}var uV=D(`pointer-events-auto absolute right-(--sidebar-nav-trailing-right) top-1/2 z-10 flex h-(--sidebar-nav-trailing-size) min-w-(--sidebar-nav-trailing-size) -translate-y-1/2 items-center justify-center`,D(`transition-[opacity,filter] duration-200 ease-out`,`opacity-100 blur-0`,`group-data-[collapsible=icon]:opacity-0 group-data-[collapsible=icon]:blur-[3px] group-data-[collapsible=icon]:pointer-events-none`,`group-data-[collapsed=true]:opacity-0 group-data-[collapsed=true]:blur-[3px] group-data-[collapsed=true]:pointer-events-none`)),dV=D(`truncate transition-[opacity,filter,margin] duration-200 ease-out`,`group-data-[collapsible=icon]:hidden`,`group-data-[collapsed=true]:hidden`),fV=D(`peer/menu-button flex cursor-pointer items-center gap-2 overflow-hidden rounded-full py-2 text-left text-sm outline-hidden ring-sidebar-ring hover:text-sidebar-accent-foreground group-hover/menu-item:text-sidebar-accent-foreground focus-visible:ring-2 active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:font-medium data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,`transition-[width,max-width,height,padding,border-radius] duration-200 ease-out`,`h-8 text-sm`);function pV({count:e}){return(0,R.jsx)(`span`,{className:D(`inline-flex h-5 shrink-0 items-center justify-center border border-border bg-zinc-200 px-1 text-[10px] font-medium tabular-nums leading-none text-foreground dark:bg-zinc-700`,String(e).length>=3?`min-w-5 rounded-md`:`size-5 min-w-5 rounded-full`),children:e})}function mV(e){return e.id!==`separator`}function hV({activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i}){let a=cV();return(0,R.jsx)(`ul`,{className:`flex w-full min-w-0 flex-col gap-1 px-(--sidebar-nav-inset-x) group`,"data-collapsed":i,"aria-label":`Inspector tabs`,children:(r?Vz.filter(e=>mV(e)&&r.includes(e.id)):Vz.filter(mV)).map((r,o)=>{let s=zz(r.id,n),c=Bz(r.id,s,i),l=r.icon,u=e===r.id,d=s>0||c,f=(0,R.jsxs)(`button`,{ref:a(r.id),type:`button`,"data-testid":`tab-${r.id}`,"data-active":u?!0:void 0,onClick:()=>t(r.id),className:D(fV,i?`size-8! w-8! max-w-8! shrink-0 justify-center gap-0 p-0!`:`w-full max-w-full sidebar-nav-pill-bleed-x pl-(--sidebar-nav-icon-pl-bleed) pr-(--sidebar-nav-pr-bleed)`,d&&!i&&`pr-[calc(var(--sidebar-nav-trailing-right)+var(--sidebar-nav-trailing-size))]`),children:[(0,R.jsx)(l,{className:`size-4 shrink-0`}),(0,R.jsx)(`span`,{className:dV,children:r.label})]});return(0,R.jsxs)(`li`,{className:D(`group/menu-item relative`,o===0&&`mt-4`),children:[i?(0,R.jsxs)(mt,{delayDuration:0,children:[(0,R.jsx)(Fe,{render:f,nativeButton:!0}),(0,R.jsx)(wt,{side:`right`,children:s>0?`${r.label} (${s})`:r.label})]}):f,d&&!i?(0,R.jsx)(`div`,{className:uV,children:s>0?(0,R.jsx)(pV,{count:s}):c?(0,R.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full bg-yellow-500 animate-status-pulse-yellow`}):null}):null]},r.id)})})}function gV({activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i,onCollapsedChange:a,rpcLoggerOpen:o,onRpcLoggerOpenChange:s,onCommandPaletteOpen:c}){return(0,R.jsxs)(`aside`,{className:D(`group/sidebar relative hidden lg:flex flex-col shrink-0 text-sidebar-foreground transition-[width] duration-200 ease-out @container/sidebar`,i?`w-(--sidebar-width-icon)`:`w-(--sidebar-width)`),"data-collapsed":i,"data-collapsible":i?`icon`:`expanded`,children:[(0,R.jsx)(`div`,{className:`sidebar-nav-scroll flex-1 overflow-y-auto overflow-x-hidden min-h-0`,children:(0,R.jsx)(lV,{isActiveKey:t=>t===e,className:`pb-2`,children:(0,R.jsx)(hV,{activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i})})}),(0,R.jsx)(tV,{collapsed:i,rpcLoggerOpen:o,onRpcLoggerOpenChange:s,onCommandPaletteOpen:c}),(0,R.jsx)(kB,{collapsed:i,onToggle:()=>a(!i)})]})}function _V(e){if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/t**r*100)/100+` `+n[r]}function vV(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**r).toFixed(1))} ${n[r]}`}var yV=100*1024,bV=1024*20;function xV(e,t){if(e==null)return e;if(typeof e==`string`)return e.length>t?e.substring(0,t)+`... (truncated)`:e;if(Array.isArray(e))return e.map(e=>xV(e,t));if(typeof e==`object`){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=xV(e[r],t));return n}return e}function SV(e){let t=JSON.stringify(e,null,2);return new TextEncoder().encode(t).length>yV?xV(e,bV):e}function CV(e){let t=JSON.stringify(e,null,2),n=new TextEncoder().encode(t).length,r=n>yV,i;if(r){let t=xV(e,bV);i=JSON.stringify(t,null,2)}else i=t;return{isLarge:r,size:n,sizeFormatted:_V(n),preview:i,full:t}}function wV(e,t){try{let n=JSON.stringify(e,null,2),r=globalThis.Blob,i=new r([n],{type:`application/json`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=t||`data-${Date.now()}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)}catch(e){throw console.error(`Failed to download JSON:`,e),e}}var TV={key:`text-sky-600 dark:text-sky-400`,string:`text-emerald-600 dark:text-emerald-400`,number:`text-amber-600 dark:text-amber-400`,boolean:`text-violet-600 dark:text-violet-400`,null:`text-zinc-500 dark:text-zinc-400`,punctuation:`text-muted-foreground`};function EV(e){let t=[],n=0,r=(e,n)=>{n&&t.push({kind:e,text:n})};for(;n<e.length;){let t=e[n];if(t===`"`){let t=n;for(n++;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(e[n]===`"`){n++;break}n++}let i=e.slice(t,n),a=n;for(;a<e.length&&/[ \t]/.test(e[a]);)a++;r(e[a]===`:`?`key`:`string`,i);continue}if(/[0-9-]/.test(t)){let t=n;for(e[n]===`-`&&n++;n<e.length&&/[0-9.eE+-]/.test(e[n]);)n++;r(`number`,e.slice(t,n));continue}if(e.startsWith(`true`,n)||e.startsWith(`false`,n)){let t=e.startsWith(`true`,n)?`true`:`false`;r(`boolean`,t),n+=t.length;continue}if(e.startsWith(`null`,n)){r(`null`,`null`),n+=4;continue}if(/[{}[\],:]/.test(t)){r(`punctuation`,t),n++;continue}r(`punctuation`,t),n++}return t}function DV(e){return EV(e).map((e,t)=>(0,R.jsx)(`span`,{className:TV[e.kind],children:e.text},t))}var OV={string:`text-emerald-600 dark:text-emerald-400`,number:`text-amber-600 dark:text-amber-400`,boolean:`text-violet-600 dark:text-violet-400`,null:`text-zinc-500 dark:text-zinc-400`,key:`text-sky-600 dark:text-sky-400`,punctuation:`text-muted-foreground`};function kV(e){return e===null?(0,R.jsx)(`span`,{className:OV.null,children:`null`}):typeof e==`string`?(0,R.jsx)(`span`,{className:OV.string,children:JSON.stringify(e)}):typeof e==`number`?(0,R.jsx)(`span`,{className:OV.number,children:String(e)}):typeof e==`boolean`?(0,R.jsx)(`span`,{className:OV.boolean,children:String(e)}):(0,R.jsx)(`span`,{className:OV.string,children:JSON.stringify(e)})}function AV(e){return Array.isArray(e)?`[${e.length}]`:`{${Object.keys(e).length}}`}function jV({label:e,value:t,depth:n,defaultExpanded:r}){let i=typeof t==`object`&&t&&!Array.isArray(t)?Object.keys(t).length>0:Array.isArray(t)?t.length>0:!1,[a,o]=(0,z.useState)(i&&(r||n===0));if(!i){let r=Array.isArray(t)?`[]`:`{}`;return typeof t==`object`&&t?(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,style:{paddingLeft:n*12},children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:OV.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:OV.punctuation,children:`: `})]}),(0,R.jsx)(`span`,{className:OV.punctuation,children:r})]}):(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,style:{paddingLeft:n*12},children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:OV.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:OV.punctuation,children:`: `})]}),kV(t)]})}let s=Array.isArray(t)?t.map((e,t)=>[String(t),e]):Object.entries(t),c=Array.isArray(t),l=c?`[`:`{`,u=c?`]`:`}`;return(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-0.5`,style:{paddingLeft:n*12},children:[(0,R.jsx)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`mt-0.5 inline-flex shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground`,children:(0,R.jsx)(ne,{className:D(`h-3.5 w-3.5 transition-transform`,a&&`rotate-90`)})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:OV.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:OV.punctuation,children:`: `})]}),(0,R.jsx)(`span`,{className:OV.punctuation,children:l}),!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`mx-1 text-xs text-muted-foreground hover:text-foreground`,children:AV(t)}),(0,R.jsx)(`span`,{className:OV.punctuation,children:u})]})]})]}),a&&(0,R.jsxs)(`div`,{children:[s.map(([e,t])=>(0,R.jsx)(jV,{label:e,value:t,depth:n+1,defaultExpanded:r},`${n}-${e}`)),(0,R.jsx)(`div`,{style:{paddingLeft:n*12},children:(0,R.jsx)(`span`,{className:OV.punctuation,children:u})})]})]})}function MV({data:e,defaultExpanded:t=!0,className:n}){return(0,R.jsx)(`div`,{className:D(`text-gray-900 dark:text-gray-100 [overflow-wrap:anywhere]`,n),"data-testid":`collapsible-json`,children:(0,R.jsx)(jV,{value:e,depth:0,defaultExpanded:t})})}var NV=`font-mono text-[0.8rem] text-gray-900 dark:text-gray-100 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`;function PV({data:e,filename:t,className:n,collapsible:r=!1,defaultExpanded:i=!0,...a}){let o=CV(e),s=SV(e),c=o.isLarge?(0,R.jsx)(`div`,{className:`mb-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsxs)(`p`,{className:`text-sm font-medium text-yellow-800 dark:text-yellow-300 mb-1`,children:[`JSON is too large (`,o.sizeFormatted,`)`]}),(0,R.jsx)(`p`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:`Showing full structure with truncated values. Download the full JSON file to see complete values.`})]}),(0,R.jsxs)(kt,{variant:`outline`,size:`sm`,onClick:()=>{wV(e,t)},className:`shrink-0`,children:[(0,R.jsx)(qr,{className:`h-4 w-4 mr-1`}),`Download`]})]})}):null;return r?(0,R.jsxs)(`div`,{className:n,...a,children:[c,(0,R.jsx)(MV,{data:s,defaultExpanded:i})]}):o.isLarge?(0,R.jsxs)(`div`,{className:n,...a,children:[c,(0,R.jsx)(`pre`,{className:NV,children:(0,R.jsx)(`code`,{children:DV(o.preview)})})]}):(0,R.jsx)(`div`,{className:n,...a,children:(0,R.jsx)(`pre`,{className:NV,children:(0,R.jsx)(`code`,{children:DV(o.preview)})})})}function FV(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var IV=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function LV(e){return z.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[IV.checked]:``}:{[IV.unchecked]:``}},...Tn}),[e.indeterminate])}var RV=z.createContext({disabled:!1});function zV(){return z.useContext(RV)}var BV=z.createContext(void 0);function VV(e=!0){let t=z.useContext(BV);if(t===void 0&&!e)throw Error(Be(3));return t}var HV=z.createContext(void 0);function UV(){let e=z.useContext(HV);if(e===void 0)throw Error(Be(14));return e}var WV=`data-parent`,GV=z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:_=!1,uncheckedValue:v,value:y,nativeButton:b=!1,style:x,...S}=e,{clearErrors:C}=An(),{disabled:w,name:T,setDirty:E,setFilled:ee,setFocused:te,setTouched:ne,state:re,validationMode:ie,validityData:ae,validation:D}=On(),O=zV(),{labelId:k,controlId:oe,registerControlId:j,getDescriptionProps:ce}=kn(),M=VV(),N=M?.parent,le=N&&M.allValues,ue=w||O.disabled||M?.disabled||o,de=T??d,fe=y??de,pe=se(),me=se(),he=oe;le?he=p?me:`${N.id}-${fe}`:c&&(he=c);let ge={};le&&(p?ge=M.parent.getParentProps():fe&&(ge=M.parent.getChildProps(fe)));let{checked:_e=n,indeterminate:ve=l,onCheckedChange:be,...xe}=ge,P=M?.value,Se=M?.setValue,Ce=M?.defaultValue,we=z.useRef(null),Te=Rt(()=>Symbol(`checkbox-control`)),Ee=z.useRef(!1),{getButtonProps:De,buttonRef:Oe}=Ne({disabled:ue,native:b}),Ae=M?.validation??D,[je,Me]=Yt({controlled:fe&&P&&!p?P.includes(fe):_e,default:fe&&Ce&&!p?Ce.includes(fe):i,name:`Checkbox`,state:`checked`}),Pe=le?!!_e:je,Fe=le&&ve||l;ye(()=>{j!==I&&(Ee.current=!0,j(Te.current,he))},[he,j,Te]),z.useEffect(()=>{let e=Te.current;return()=>{!Ee.current||j===I||(Ee.current=!1,j(e,void 0))}},[j,Te]),En(we,pe,je,void 0,!M&&!ue,d);let Le=z.useRef(null),Re=Ye(u,Le,Ae.inputRef,Ae.registerInput),ze=FB(a,k,Le,!b,he??void 0);ye(()=>{Le.current&&(Le.current.indeterminate=Fe,je&&ee(!0))},[je,Fe,ee]),Dn(je,()=>{M||(C(de),ee(je),E(je!==ae.initialValue),Ae.change(je))});let Be=Vt({checked:je,disabled:ue,form:s,name:p?void 0:de,id:b?void 0:he??void 0,required:_,ref:Re,style:de?Ie:tt,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=A(ke,e.nativeEvent);f?.(t,n),!n.isCanceled&&(be?.(t,n),!n.isCanceled&&(Me(t),fe&&P&&Se&&!p&&!le&&Se(t?[...P,fe]:P.filter(e=>e!==fe),n)))},onFocus(){we.current?.focus()}},y===void 0?bt:{value:(M?je&&y:y)||``},ce,e=>Ae.getValidationProps(ue,e));z.useEffect(()=>{if(!N||!fe)return;let e=N.disabledStatesRef.current;return e.set(fe,ue),()=>{e.delete(fe)}},[N,ue,fe]);let Ve=z.useMemo(()=>({...re,checked:Pe,disabled:ue,readOnly:m,required:_,indeterminate:Fe}),[re,Pe,ue,m,_,Fe]),He=LV(Ve),We=Ue(`span`,e,{state:Ve,ref:[Oe,we,t,M?.registerControlRef],props:[{id:b?he??void 0:pe,role:`checkbox`,"aria-checked":Fe?`mixed`:Pe,"aria-readonly":m||void 0,"aria-required":_||void 0,"aria-labelledby":ze,[WV]:p?``:void 0,onFocus(){ue||te(!0)},onBlur(){let e=Le.current;e&&(ne(!0),te(!1),ie===`onBlur`&&Ae.commit(M?P:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Le.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),g(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||FV(t)?.click()})},onClick(e){if(m||ue)return;e.preventDefault();let t=Le.current;t&&t.dispatchEvent(new(g(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},S,xe,De,ce,e=>Ae.getValidationProps(ue,e)],stateAttributesMapping:He});return(0,R.jsxs)(HV.Provider,{value:Ve,children:[We,!je&&!M&&de&&!p&&v!==void 0&&(0,R.jsx)(`input`,{type:`hidden`,form:s,name:de,value:v,disabled:ue}),(0,R.jsx)(`input`,{...Be,suppressHydrationWarning:!0})]})}),KV=z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=UV(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=st(c),f=z.useRef(null),p={...s,transitionStatus:u};y({open:c,ref:f,onComplete(){c||d(!1)}});let m={...LV(s),...vt,...Tn},h=a||l,g=Ue(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null}),qV=(0,z.createContext)(null);function JV(){let e=(0,z.useContext)(qV);if(!e)throw Error(`useCheckboxGroup must be used within a CheckboxGroup`);return e}var YV=(0,z.forwardRef)(({children:e,checkedIndices:t,orientation:n=`vertical`,className:r,...i},a)=>{let o=(0,z.useRef)(null),s=n===`horizontal`,{activeIndex:c,setActiveIndex:l,handlers:u,registerItem:d,measureItems:f}=_n(o,{axis:s?`x`:`y`});(0,z.useEffect)(()=>{f()},[f,e]);let p=s?`ArrowLeft`:`ArrowUp`,m=s?`ArrowRight`:`ArrowDown`;return(0,R.jsx)(qV.Provider,{value:{registerItem:d,activeIndex:c},children:(0,R.jsx)(`div`,{ref:e=>{o.current=e,typeof a==`function`?a(e):a&&(a.current=e)},onMouseEnter:u.onMouseEnter,onMouseMove:u.onMouseMove,onMouseLeave:u.onMouseLeave,onFocus:e=>{let t=e.target.closest(`[data-proximity-index]`)?.getAttribute(`data-proximity-index`);t!=null&&l(Number(t))},onBlur:e=>{o.current?.contains(e.relatedTarget)||l(null)},onKeyDown:e=>{let t=Array.from(o.current?.querySelectorAll(`[data-proximity-index]`)??[]),n=t.indexOf(e.target);n!==-1&&([p,m].includes(e.key)?(e.preventDefault(),t[e.key===m?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()):e.key===`Home`?(e.preventDefault(),t[0]?.focus()):e.key===`End`&&(e.preventDefault(),t[t.length-1]?.focus()))},role:`group`,className:D(`relative flex max-w-full select-none`,s?`w-auto flex-row`:`w-72 flex-col`,r),...i,children:e})})});YV.displayName=`CheckboxGroup`;var XV=(0,z.forwardRef)(({label:e,index:t,checked:n,onToggle:r,size:i=`default`,className:a,...o},s)=>{let c=(0,z.useRef)(null),l=(0,z.useRef)(!1),{registerItem:u,activeIndex:d}=JV();(0,z.useEffect)(()=>(u(t,c.current),()=>u(t,null)),[t,u]),(0,z.useEffect)(()=>{l.current=!0},[]);let f=d===t,p=!l.current,m=E(),h=i===`sm`;return(0,R.jsxs)(`div`,{ref:e=>{c.current=e,typeof s==`function`?s(e):s&&(s.current=e)},"data-proximity-index":t,tabIndex:0,role:`checkbox`,"aria-checked":n,"aria-label":e,onClick:r,onMouseDown:e=>{let t=e.target.closest(`button:not([tabindex="-1"]), a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);t&&t!==e.currentTarget||(e.preventDefault(),e.currentTarget.focus())},onKeyDown:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),r())},className:D(`relative z-10 flex items-center cursor-pointer outline-none`,h?`h-7 gap-1.5 px-2`:`h-8 gap-2.5 px-3`,m.item,`focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)]`,a),...o,children:[(0,R.jsxs)(GV,{checked:n,tabIndex:-1,"aria-hidden":!0,className:D(`pointer-events-none relative shrink-0 appearance-none bg-transparent p-0 border-0 outline-none`,h?`size-[13px]`:`size-[15px]`),children:[(0,R.jsx)(`div`,{className:D(`absolute inset-0 rounded-[5px] border-solid transition-all duration-80 border-[1.5px]`,n?`border-border`:f?`border-neutral-400 dark:border-neutral-500`:`border-border`)}),(0,R.jsx)(en,{children:n&&(0,R.jsx)(KV,{keepMounted:!0,render:e=>{let{style:t,onDrag:n,onDragStart:r,onDragEnd:i,onAnimationStart:a,onAnimationEnd:o,onAnimationIteration:s,...c}=e;return(0,R.jsx)(F.svg,{...c,width:h?14:18,height:h?14:18,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-foreground`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:1},children:(0,R.jsx)(F.path,{d:`M6 12L10 16L18 8`,initial:{pathLength:+!!p},animate:{pathLength:1,transition:{duration:.08,ease:`easeOut`}},exit:{pathLength:0,transition:{duration:.04,ease:`easeIn`}}})})}})})]}),(0,R.jsxs)(`span`,{className:`inline-grid items-center self-center leading-none`,children:[(0,R.jsx)(`span`,{className:`col-start-1 row-start-1 invisible leading-none`,style:{fontVariationSettings:Ve.semibold},"aria-hidden":`true`,children:e}),(0,R.jsx)(`span`,{className:D(`col-start-1 row-start-1 leading-none transition-[color,font-variation-settings] duration-80`,h?`text-[11px]`:`text-[13px]`,n||f?`text-foreground`:`text-muted-foreground`),style:{fontVariationSettings:n?Ve.semibold:Ve.normal},children:e})]})]})});XV.displayName=`CheckboxItem`;var ZV=36,QV=188,$V=6;function eH(e,t,n){let[r,i]=(0,z.useState)(0),[a,o]=(0,z.useState)(0),s=(0,z.useMemo)(()=>{let n=[],r=[],i=0;for(let a of e){n.push(i);let e=ZV+(t.has(a.id)?QV:0);r.push(e),i+=e}return{offsets:n,heights:r,totalHeight:i}},[t,e]),c=(0,z.useMemo)(()=>{if(e.length===0)return{totalHeight:0,visibleItems:[]};let{offsets:t,heights:n,totalHeight:i}=s,o=r+a,c=0;for(;c<e.length&&t[c]+n[c]<r;)c++;c=Math.max(0,c-$V);let l=c;for(;l<e.length&&t[l]<o;)l++;l=Math.min(e.length,l+$V);let u=[];for(let r=c;r<l;r++)u.push({index:r,item:e[r],top:t[r],height:n[r]});return{totalHeight:i,visibleItems:u}},[e,s,r,a]),l=(0,z.useCallback)(()=>{let e=n.current;e&&i(e.scrollTop)},[n]);return(0,z.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{o(e.clientHeight),i(e.scrollTop)};t();let r=new ResizeObserver(t);return r.observe(e),e.addEventListener(`scroll`,l,{passive:!0}),()=>{r.disconnect(),e.removeEventListener(`scroll`,l)}},[l,n,e.length]),c}var tH=300,nH=/(?:^|\/)notifications\//;function rH(e){let t=e;return typeof t?.method==`string`?t.method:null}function iH(e){let t=e.message;if(t?.id!==void 0&&t.id!==null||t?.result!==void 0||t?.error!==void 0)return null;let n=rH(e.message);return!n||!nH.test(n)?null:[e.source,e.serverId,e.widgetId??``,e.direction,n].join(`|`)}function aH(e,t,n=Date.now()){let r=iH(e),i=iH(t);if(!r||r!==i)return!1;let a=Date.parse(e.timestamp);return Number.isNaN(a)?!1:n-a<=tH}function oH(e,t){return{...e,timestamp:t.timestamp,message:t.message,repeatCount:(e.repeatCount??1)+1}}var sH=new class{maxEntries;entries=[];listeners=new Set;nextId=0;emitFrame=null;constructor(e=1e3){this.maxEntries=e}publish(e){let t=this.entries[this.entries.length-1];if(t&&aH(t,e,Date.parse(e.timestamp))){this.entries[this.entries.length-1]=oH(t,e),this.scheduleEmit();return}this.entries.push({...e,id:`rpc-${++this.nextId}`}),this.entries.length>this.maxEntries&&this.entries.splice(0,this.entries.length-this.maxEntries),this.scheduleEmit()}getSnapshot=()=>this.entries;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));clear(e={}){let t=new Set(e.serverIds??[]),n=new Set(e.sources??[]);t.size===0&&n.size===0?this.entries=[]:this.entries=this.entries.filter(e=>!((t.size===0||t.has(e.serverId))&&(n.size===0||n.has(e.source)))),this.scheduleEmit()}peekCoalesceKey(e){return iH(e)}scheduleEmit(){if(this.emitFrame===null){if(typeof requestAnimationFrame>`u`){this.emit();return}this.emitFrame=requestAnimationFrame(()=>{this.emitFrame=null,this.emit()})}}emit(){this.listeners.forEach(e=>e())}},cH;function lH(e){sH.publish({source:`mcp`,serverId:e.serverId,direction:e.direction,timestamp:e.timestamp,message:e.message})}function uH(){cH||=(ak().forEach(lH),ok(lH))}uH();function dH({serverIds:e,onCountChange:t,onClearRef:n,onExportRef:r}={}){let i=(0,z.useRef)(null),[a,o]=(0,z.useState)(new Set),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(()=>new Set([`mcp`,`widget`])),p=(0,z.useSyncExternalStore)(sH.subscribe,sH.getSnapshot,sH.getSnapshot),m=async e=>{try{await nM(JSON.stringify(e,null,2)),QF.success(`Message copied to clipboard`)}catch(e){console.error(`Failed to copy message:`,e),QF.error(`Failed to copy to clipboard`)}},h=(0,z.useMemo)(()=>{if(!e?.length)return p;let t=new Set(e);return p.filter(e=>t.has(e.serverId))},[p,e]),g=(0,z.useMemo)(()=>{let e=new Set;return d.has(`mcp`)&&e.add(0),d.has(`widget`)&&e.add(1),e},[d]),_=(0,z.useCallback)(e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=(0,z.useMemo)(()=>{let e=h;d.size>0&&(e=e.filter(e=>d.has(e.source)));let t=s.trim().toLowerCase();return t&&(e=e.filter(e=>{let n=pH(e);return e.serverId.toLowerCase().includes(t)||e.widgetId?.toLowerCase().includes(t)||e.source.includes(t)||n.toLowerCase().includes(t)||e.direction.toLowerCase().includes(t)||JSON.stringify(e.message).toLowerCase().includes(t)})),[...e].reverse()},[h,s,d]),{totalHeight:y,visibleItems:b}=eH(v,a,i),x=(0,z.useCallback)(e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=(0,z.useCallback)(async()=>{let t=d.size===0||d.size===2?void 0:[...d];(!t||t.includes(`mcp`))&&(e?.length?e.forEach(e=>sk(e)):sk()),sH.clear({serverIds:e,sources:t}),o(new Set)},[e,d]),w=(0,z.useCallback)(async()=>{try{await nM(JSON.stringify(v,null,2)),QF.success(`Copied ${v.length} messages`)}catch(e){console.error(`Failed to copy messages:`,e),QF.error(`Failed to copy to clipboard`)}},[v]),T=(0,z.useCallback)(()=>{let e=new Blob([JSON.stringify(v,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`mcp-rpc-traffic-${new Date().toISOString().replaceAll(`:`,`-`)}.json`,n.click(),URL.revokeObjectURL(t)},[v]);return(0,z.useEffect)(()=>{t?.(v.length)},[v.length,t]),(0,z.useEffect)(()=>(n&&(n.current=S),()=>{n&&(n.current=null)}),[S,n]),(0,z.useEffect)(()=>(r&&(r.current=w),()=>{r&&(r.current=null)}),[w,r]),(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 pr-2 pt-2 pl-1`,children:[(0,R.jsx)(`h2`,{className:`text-xs font-medium text-foreground`,children:`RPC Logs`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:w,disabled:v.length===0,"aria-label":`Copy filtered RPC traffic`,title:`Copy filtered`,children:(0,R.jsx)(Wr,{className:`size-3.5`})}),(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:T,disabled:v.length===0,"aria-label":`Download filtered RPC traffic as JSON`,title:`Download JSON`,children:(0,R.jsx)(qr,{className:`size-3.5`})}),(0,R.jsx)(kt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:S,disabled:p.length===0,"aria-label":`Clear RPC traffic`,title:`Clear`,children:(0,R.jsx)(Gi,{className:`size-3.5`})})]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center pr-2 pb-2 pt-1 pl-1`,children:[(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 transition-[flex-grow] duration-200 ease-out`,children:[(0,R.jsx)(C,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,R.jsx)(jt,{value:s,onChange:e=>c(e.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),placeholder:`Search`,"aria-label":`Search RPC traffic`,className:`h-8 w-full pl-7 text-xs shadow-none transition-[width] duration-200 ease-out`})]}),(0,R.jsx)(`div`,{"aria-hidden":l,className:D(`shrink-0 overflow-hidden transition-[max-width,opacity,margin] duration-200 ease-out`,l?`pointer-events-none ml-0 max-w-0 opacity-0`:`ml-2 max-w-32 opacity-100`),children:(0,R.jsxs)(YV,{checkedIndices:g,orientation:`horizontal`,"aria-label":`Filter RPC traffic by source`,className:`w-auto shrink-0`,children:[(0,R.jsx)(XV,{index:0,label:`MCP`,size:`sm`,checked:d.has(`mcp`),onToggle:()=>_(`mcp`)}),(0,R.jsx)(XV,{index:1,label:`UI`,size:`sm`,checked:d.has(`widget`),onToggle:()=>_(`widget`)})]})})]}),(0,R.jsx)(`div`,{ref:i,className:`min-h-0 flex-1 overflow-y-auto pb-10`,style:{maskImage:`linear-gradient(to bottom, black 0, black calc(100% - 3rem), transparent 100%)`,WebkitMaskImage:`linear-gradient(to bottom, black 0, black calc(100% - 3rem), transparent 100%)`},children:v.length===0?(0,R.jsxs)(`div`,{className:`text-center py-8`,children:[(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No messages yet`}),(0,R.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1`,children:`JSON-RPC messages will appear here`})]}):(0,R.jsx)(`div`,{className:`relative w-full`,style:{height:y},children:b.map(({item:e,top:t,height:n})=>(0,R.jsx)(fH,{item:e,top:t,height:n,expanded:a.has(e.id),onToggle:()=>x(e.id),onCopy:()=>m(e.message)},e.id))})})]})}function fH({item:e,top:t,height:n,expanded:r,onToggle:i,onCopy:a}){let o=pH(e),s=mH(e),c=e.repeatCount&&e.repeatCount>1?` ×${e.repeatCount}`:``;return(0,R.jsxs)(`div`,{className:`absolute inset-x-0 overflow-hidden`,style:{top:t,height:n},"data-testid":`rpc-message-${o.replace(/\//g,`-`)}`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:i,className:`flex h-9 w-full cursor-pointer items-center gap-2 py-2 pr-3 pl-1 text-left text-muted-foreground transition-colors hover:text-foreground`,children:[(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:e.direction===`receive`?(0,R.jsx)(Dr,{className:`size-3.5 text-blue-500`}):(0,R.jsx)(Ar,{className:`size-3.5 text-emerald-500`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:`left`,children:s})]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center`,children:e.source===`mcp`?(0,R.jsx)(LL,{className:`size-3`}):(0,R.jsx)(Ti,{className:`size-3`})}),nativeButton:!1}),(0,R.jsx)(wt,{side:`left`,children:e.source===`mcp`?`MCP server`:`UI widget`})]}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,children:[o,c?(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:c}):null]}),(0,R.jsxs)(mt,{children:[(0,R.jsx)(Fe,{render:(0,R.jsx)(`time`,{dateTime:e.timestamp,className:`shrink-0 cursor-default font-mono text-[10px] tabular-nums text-muted-foreground underline decoration-dotted underline-offset-2`,children:new Date(e.timestamp).toLocaleTimeString()}),nativeButton:!1}),(0,R.jsx)(wt,{side:`left`,children:new Date(e.timestamp).toLocaleString()})]})]}),r?(0,R.jsxs)(`div`,{className:`relative mx-3 mb-2 max-h-44 overflow-auto rounded-lg p-2 pr-8`,children:[(0,R.jsx)(PV,{data:e.message,className:`[&_pre]:!text-[10px] [&_pre]:!leading-4`}),(0,R.jsx)(kt,{variant:`secondary`,size:`icon-sm`,onClick:a,className:`absolute right-1 top-1 size-6 rounded-full p-0`,title:`Copy message`,"aria-label":`Copy message`,children:(0,R.jsx)(Wr,{className:`size-3`})})]}):null]})}function pH(e){let t=rH(e.message);if(t)return t;let n=e.message;return n?.result===void 0?n?.error===void 0?`unknown`:`error`:`result`}function mH(e){return e.source===`widget`?e.direction===`send`?`Host → Widget`:`Widget → Host`:e.direction===`send`?`Inspector → MCP`:`MCP → Inspector`}function hH({serverId:e,open:t}){return(0,R.jsx)(`aside`,{"aria-label":`RPC Panel`,"aria-hidden":!t,className:D(`relative hidden min-h-0 shrink-0 flex-col overflow-hidden transition-[width,margin] duration-200 ease-out lg:flex`,t?`w-(--rpc-panel-width) lg:mr-[18px]`:`w-0 lg:mr-0`),children:(0,R.jsx)(`div`,{className:D(`flex h-full min-h-0 w-(--rpc-panel-width) flex-col transition-opacity duration-200 ease-out`,t?`opacity-100`:`pointer-events-none opacity-0`),children:(0,R.jsx)(dH,{serverIds:[e]})})})}function gH({...e}){return(0,R.jsx)(qI,{"data-slot":`sheet`,...e})}function _H(e){return(0,R.jsx)(YI,{"data-slot":`sheet-trigger`,...e})}function vH({...e}){return(0,R.jsx)(BI,{"data-slot":`sheet-portal`,...e})}function yH({className:e,container:t,...n}){return(0,R.jsx)(jI,{"data-slot":`sheet-overlay`,className:D(`inset-0 z-50 bg-black/50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0`,t?`absolute`:`fixed`,e),...n})}function bH({className:e,children:t,side:n=`right`,showCloseButton:r=!0,container:i,...a}){return(0,R.jsxs)(vH,{container:i??void 0,children:[(0,R.jsx)(yH,{container:i}),(0,R.jsxs)(zI,{"data-slot":`sheet-content`,"data-side":n,className:D(`z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,i?`absolute`:`fixed`,e),...a,children:[t,r&&(0,R.jsxs)(MI,{"data-slot":`sheet-close`,render:(0,R.jsx)(kt,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,R.jsx)(Xi,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function xH({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`sheet-header`,className:D(`flex flex-col gap-1.5 p-4`,e),...t})}function SH({className:e,...t}){return(0,R.jsx)(JI,{"data-slot":`sheet-title`,className:D(`font-medium text-foreground`,e),...t})}function CH({className:e,...t}){return(0,R.jsx)(NI,{"data-slot":`sheet-description`,className:D(`text-sm text-muted-foreground`,e),...t})}var wH=`https://cdn.mcp-use.com/mcpuse_logo_circle_dark.svg`;function TH({symbolSize:e=14,className:t,textClassName:n}){return(0,R.jsxs)(`span`,{className:D(`inline-flex items-center gap-1.5`,t),children:[(0,R.jsx)(EH,{size:e}),(0,R.jsx)(`span`,{className:D(`font-medium leading-none text-black [font-family:var(--font-family-outfit)]`,n),children:`Manufact`})]})}function EH({size:e=14,className:t}){return(0,R.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 480 480`,"aria-hidden":!0,className:D(`block shrink-0`,t),children:[(0,R.jsx)(`path`,{d:`M101.7 0 C157.9 0 203.4 45.7 203.4 102.1 C203.4 126.6 202.1 152.1 212.2 174.3 L219.8 191 C233.8 221.8 258.5 246.4 289.2 260.5 L303.5 267 C326.5 277.5 353 275.8 378.3 275.8 C434.5 275.8 480 321.5 480 377.9 C480 434.3 434.5 480 378.3 480 C322.1 480 276.6 434.3 276.6 377.9 C276.6 354.2 277.7 329.6 267.8 308 L259.8 290.3 C245.7 259.5 221 234.8 190.2 220.7 L173 212.9 C151 202.9 125.8 204.2 101.7 204.2 C45.5 204.2 0 158.5 0 102.1 C0 45.7 45.5 0 101.7 0 Z`,fill:`currentColor`}),(0,R.jsx)(`circle`,{cx:`96.4`,cy:`383.6`,r:`96.4`,fill:`currentColor`}),(0,R.jsx)(`circle`,{cx:`383.6`,cy:`96.4`,r:`96.4`,fill:`currentColor`})]})}var DH=`data:image/svg+xml,%3Csvg%20width%3D%22512%22%20height%3D%22512%22%20viewBox%3D%220%200%20512%20512%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22%2394A3B8%22%20stroke%3D%22%2394A3B8%22%3E%3Cg%3E%3Cpath%20fill%3D%22none%22%20d%3D%22M3%20248.945C18%20248.945%2076%20236%20106%20219C136%20202%20136%20202%20198%20158C276.497%20102.293%20332%20120.945%20423%20120.945%22%20stroke-width%3D%2290%22%2F%3E%3Cpath%20d%3D%22M511%20121.5L357.25%20210.268L357.25%2032.7324L511%20121.5Z%22%2F%3E%3Cpath%20fill%3D%22none%22%20d%3D%22M0%20249C15%20249%2073%20261.945%20103%20278.945C133%20295.945%20133%20295.945%20195%20339.945C273.497%20395.652%20329%20377%20420%20377%22%20stroke-width%3D%2290%22%2F%3E%3Cpath%20d%3D%22M508%20376.445L354.25%20287.678L354.25%20465.213L508%20376.445Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E`,OH={openai:`OpenAI`,anthropic:`Anthropic`,google:`Google`};function kH(e){let t=e.split(`/`)[0]?.toLowerCase();return t===`openai`||t===`anthropic`||t===`google`?t:`openrouter`}function AH(e,t){let n=e.trim(),r=OH[t];if(r){let e=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),t=RegExp(`^${e}\\s*:\\s*`,`i`),i=n.replace(t,``).trim();if(i.length>0)return i}let i=n.indexOf(`: `);return i>0&&i<48?n.slice(i+2).trim():n}function jH({provider:e,model:t,displayName:n,mode:r=`byok`,className:i,...a}){let o=n??t,s=r===`managed`&&e===`openai-compatible`?kH(t):e;return(0,R.jsxs)(`button`,{type:`button`,className:D(`inline-flex items-center gap-1.5 min-w-0 border-0 bg-transparent p-1`,`font-mono text-[11px] text-muted-foreground cursor-pointer`,`hover:text-foreground transition-colors`,`rounded-md outline-none focus-visible:ring-1 focus-visible:ring-ring`,i),...a,children:[r===`managed`?(0,R.jsx)(`img`,{src:wH,alt:`Manufact`,className:`h-3.5 w-3.5 shrink-0 rounded-full object-cover`}):(0,R.jsx)(ci,{className:`size-3 shrink-0 opacity-70`,"aria-hidden":!0}),(0,R.jsx)(PH,{provider:s,className:`shrink-0`}),(0,R.jsx)(`span`,{className:`whitespace-nowrap`,children:o}),(0,R.jsx)(Ir,{className:`size-3 shrink-0 opacity-60`,"aria-hidden":!0})]})}function MH(e){switch(e){case`openai`:return`OpenAI`;case`openai-compatible`:return`OpenAI Compatible`;case`anthropic`:return`Anthropic`;case`google`:return`Google`;case`openrouter`:return`OpenRouter`;case`ollama`:return`Ollama`;default:return e}}function NH(e,t){switch(e){case`openai`:case`anthropic`:case`google`:return`https://inspector-cdn.mcp-use.com/providers/${e}.png`;case`ollama`:return`https://inspector-cdn.mcp-use.com/providers/${t===`dark`?`ollama_dark`:`ollama_light`}.png`;case`openrouter`:return DH;case`openai-compatible`:return null;default:return null}}function PH({provider:e,className:t}){let{resolvedTheme:n}=Oz();if(e===`openai-compatible`)return null;let r=NH(e,n);if(r){let n=e===`ollama`?`h-3.5 w-3.5 object-contain`:`h-4 w-4 rounded-full object-cover`;return(0,R.jsx)(`img`,{src:r,alt:MH(e),className:D(n,t)})}return(0,R.jsx)(`div`,{"aria-label":MH(e),className:D(`flex h-4 w-4 items-center justify-center rounded-full bg-neutral-900 text-[9px] font-semibold text-white dark:bg-neutral-100 dark:text-neutral-900`,t),children:MH(e).charAt(0)})}function FH({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 -28.5 256 256`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,R.jsx)(`path`,{d:`M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z`,fillRule:`nonzero`})})}var IH=`flex flex-1 items-center justify-center text-muted-foreground transition-colors hover:text-foreground active:text-foreground`;function LH({serverId:e,rpcLoggerOpen:t,onRpcLoggerOpenChange:n}){let r=EB(),{embeddedConfig:i}=yL(),{user:a}=sz(i.chatApiUrl),o=a?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`;return(0,R.jsxs)(R.Fragment,{children:[typeof document<`u`&&(0,br.createPortal)((0,R.jsxs)(`nav`,{"aria-label":`Inspector shortcuts`,className:`fixed inset-x-0 bottom-0 z-[100] flex items-center bg-transparent px-4 pt-(--mobile-chrome-gap) pb-[calc(var(--mobile-chrome-gap)+env(safe-area-inset-bottom))] lg:hidden`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:D(IH,t&&`text-foreground`),"aria-label":`RPC logs`,"aria-pressed":t,children:(0,R.jsx)(Pi,{className:`size-4 shrink-0`})}),(0,R.jsx)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,className:IH,"aria-label":`GitHub`,children:(0,R.jsx)(AB,{className:`size-4 shrink-0`})}),(0,R.jsx)(`a`,{href:`https://discord.gg/XkNkSkMz3V`,target:`_blank`,rel:`noopener noreferrer`,className:IH,"aria-label":`Discord`,children:(0,R.jsx)(FH,{className:`size-4 shrink-0`})}),(0,R.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{OT(new Eo({referrer:`mcp-use-inspector-mobile-toolbar`})).catch(()=>{})}catch{}},className:IH,"aria-label":`manufact.com`,children:(0,R.jsx)(EH,{size:16})})]}),document.body),!r&&(0,R.jsx)(gH,{open:t,onOpenChange:n,children:(0,R.jsxs)(bH,{side:`bottom`,className:`z-[101] flex h-[min(85dvh,720px)] flex-col gap-0 rounded-t-2xl border-zinc-200 p-0 dark:border-zinc-700`,children:[(0,R.jsx)(xH,{className:`sr-only`,children:(0,R.jsx)(SH,{children:`RPC logs`})}),(0,R.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-2 pb-2 pt-1`,children:(0,R.jsx)(dH,{serverIds:e?[e]:void 0})})]})})]})}function RH(e){return`${e.replace(/\/+$/,``)}${oM()}`}function zH({tunnelUrl:e,tunnelMcpUrl:t,selectedServerId:n,selectedServer:r,configLoaded:i,removeConnection:a,updateConnection:o,connections:s}){let c=(0,z.useRef)(null),l=(0,z.useRef)(!1),u=(0,z.useRef)(null),[d,f]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{!d||r?.url!==u.current||r.state!==`ready`&&r.state!==`failed`||(f(!1),l.current=!1,u.current=null)},[d,r]),(0,z.useEffect)(()=>{n&&uM(n)?c.current=n:r?.url&&uM(r.url)&&(c.current=r.url)},[r?.url,n]),(0,z.useEffect)(()=>{if(!i||!n||!r||l.current)return;let d=r.url??``,p=uM(d),m=dM(d),h=t??(e?RH(e):null),g=null;e&&h&&p?g=h:!e&&m&&c.current&&(g=c.current),!(!g||g===d)&&(l.current=!0,u.current=g,f(!0),(async()=>{try{g!==n&&s.some(e=>e.id===g)&&await a(g),await o(n,EM({...OM(n)??DM(r),url:g}))}catch{f(!1),u.current=null,l.current=!1}})())},[i,s,a,r,n,t,e,o]),(0,z.useEffect)(()=>{d||(l.current=!1)},[d]),d}function BH({children:e}){let t=$N(),n=XN(),{servers:r,addServer:i,removeServer:a,updateServerMetadata:o,updateServer:s,storageLoaded:c}=wj(),l=(0,z.useCallback)(async(e,t)=>{try{await s(e,EM(t)),SM(e,t)}catch(t){console.error(`[Layout] Failed to update connection ${e}:`,t)}},[s]),u=(0,z.useCallback)(async(e,t)=>{try{await o(e,t)}catch(t){console.error(`[Layout] Failed to update connection metadata for ${e}:`,t)}},[o]),{selectedServerId:d,setSelectedServerId:f,activeTab:p,setActiveTab:m,navigateToItem:h,setTunnelUrl:g,tunnelUrl:_,isEmbedded:v,embeddedConfig:y,setEmbeddedMode:b}=yL(),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(()=>{try{return localStorage.getItem(`inspector-sidebar-collapsed`)===`true`}catch{return!1}}),[T,E]=(0,z.useState)(()=>{try{return localStorage.getItem(`inspector-rpc-logger-open`)===`true`}catch{return!1}});(0,z.useEffect)(()=>{try{localStorage.setItem(`inspector-sidebar-collapsed`,C?`true`:`false`)}catch{}},[C]),(0,z.useEffect)(()=>{try{localStorage.setItem(`inspector-rpc-logger-open`,String(T))}catch{}},[T]);let{savedRequests:ee}=SL();(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search),t=e.get(`embedded`)===`true`,r=e.get(`embeddedConfig`);if(t){let e={};if(r)try{e=JSON.parse(r)}catch(e){console.error(`Failed to parse embeddedConfig:`,e)}b(!0,e),e.defaultTab&&m(e.defaultTab)}},[]),(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tunnelUrl`);e!==null&&g(e)},[n.search,g]),(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tab`);e&&[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`,`server-metadata`,`connection-settings`].includes(e)&&m(e)},[n.search,m]);let te=(0,z.useRef)(null),ne=(0,z.useRef)(Date.now()),re=(0,z.useRef)(new Set),ie=(0,z.useRef)(0);(0,z.useEffect)(()=>{let e=()=>{ie.current++};return window.addEventListener(`mcp-tool-executed`,e),()=>window.removeEventListener(`mcp-tool-executed`,e)},[]),(0,z.useEffect)(()=>{let e=()=>{try{OT(new Ao({durationSeconds:Math.round((Date.now()-ne.current)/1e3),tabsVisited:re.current.size,toolsExecuted:ie.current})).catch(()=>{})}catch{}};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let ae=(0,z.useCallback)(e=>{try{OT(new Oo({tab:e,previousTab:te.current})).catch(()=>{})}catch{}te.current=e,re.current.add(e),m(e);let r=new URLSearchParams(n.search);r.set(`tab`,e),t(`/?${r.toString()}`,{replace:!0})},[m,t,n.search]);(0,z.useEffect)(()=>{let e=e=>{let t=e.detail.requestId;d&&h(d,`sampling`,t)},t=e=>{let t=e.detail.requestId;d&&h(d,`elicitation`,t)},n=e=>{let t=e.detail.toolName;d&&t?h(d,`tools`,t):d&&ae(`tools`)};return window.addEventListener(`navigate-to-sampling`,e),window.addEventListener(`navigate-to-elicitation`,t),window.addEventListener(`navigate-to-tool-result`,n),()=>{window.removeEventListener(`navigate-to-sampling`,e),window.removeEventListener(`navigate-to-elicitation`,t),window.removeEventListener(`navigate-to-tool-result`,n)}},[d,ae,h]);let O=(0,z.useRef)(null),k=(0,z.useRef)(null),A=(0,z.useRef)(null),{isAutoConnecting:oe}=vI({connections:r,addServer:i,removeConnection:a,configLoaded:c,embedded:v});(0,z.useEffect)(()=>{let e=()=>{let e=document.documentElement.classList.contains(`dark`)?`#000000`:`#f3f3f3`;document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]);let j=(0,z.useCallback)(e=>{OT(new Co({trigger:e})).catch(()=>{}),S(!0)},[]),se=e=>{if(!r.find(t=>t.id===e))return;f(e);let i=new URLSearchParams(n.search),a=i.get(`tunnelUrl`),o=i.get(`tab`),s=new URLSearchParams;s.set(`server`,e),a&&s.set(`tunnelUrl`,a),o&&s.set(`tab`,o),t(`/?${s.toString()}`)},ce=(0,z.useCallback)(e=>{if(!d)return;let t=OM(d)||r.find(e=>e.id===d);e.url===d?t&&jM(t,e)?(u(d,{name:e.name||e.url}),SM(d,e)):l(d,e):(a(d),i(e.url,EM(e))),QF.success(`Connection settings updated`)},[d,r,a,i,u,l]),M=(e,i,a)=>{if(console.warn(`[Layout] handleCommandPaletteNavigate called:`,{tab:e,itemName:i,serverId:a}),a){let o=r.find(e=>e.id===a);if(console.warn(`[Layout] Server lookup:`,{serverId:a,serverFound:!!o,serverState:o?.state}),!o||o.state!==`ready`){console.warn(`[Layout] Server not ready, showing error`),QF.error(`Server is not connected and cannot be inspected`);return}console.warn(`[Layout] Calling navigateToItem:`,{serverId:a,tab:e,itemName:i}),h(a,e,i);let s=new URLSearchParams(n.search),c=s.get(`tunnelUrl`),l=s.get(`tab`),u=new URLSearchParams;u.set(`server`,a),c&&u.set(`tunnelUrl`,c),e?u.set(`tab`,e):l&&u.set(`tab`,l);let d=`/?${u.toString()}`;console.warn(`[Layout] Navigating to:`,d),t(d)}else console.warn(`[Layout] No serverId, just updating tab to:`,e),ae(e)},N=r.find(e=>e.id===d),le=zH({tunnelUrl:_,selectedServerId:d,selectedServer:N,configLoaded:c,removeConnection:a,updateConnection:s,connections:r}),ue=N?N.tools.map(e=>({...e,_serverId:N.id})):r.flatMap(e=>e.state===`ready`?e.tools.map(t=>({...t,_serverId:e.id,_serverName:pM(e)})):[]),de=N?N.prompts.map(e=>({...e,_serverId:N.id})):r.flatMap(e=>e.state===`ready`?e.prompts.map(t=>({...t,_serverId:e.id,_serverName:pM(e)})):[]),fe=N?N.resources.map(e=>({...e,_serverId:N.id})):r.flatMap(e=>e.state===`ready`?e.resources.map(t=>({...t,_serverId:e.id,_serverName:pM(e)})):[]);(0,z.useEffect)(()=>{if(le)return;let e=new URLSearchParams(n.search),i=e.get(`server`);if(i&&(i.startsWith(`http://`)||i.startsWith(`https://`))&&!r.find(e=>e.id===i)){let n=new URLSearchParams(e);n.delete(`server`),n.set(`autoConnect`,i),t(`/?${n.toString()}`,{replace:!0});return}i!==d&&f(i)},[n.search,d,f,r,t,le]),(0,z.useEffect)(()=>{if(le)return;let e=new URLSearchParams(n.search).get(`server`);if(e&&!r.find(t=>t.id===e)){let e=setTimeout(()=>t(`/`),3e3);return()=>clearTimeout(e)}},[n.search,t,r,le]),(0,z.useEffect)(()=>{if(!v)return;let e=e=>{if(!e.data||typeof e.data!=`object`||e.data.type!==`mcp-inspector:connect_servers`)return;let t=e.data.servers;if(!Array.isArray(t)||t.length===0)return;let n=null;for(let e of t){if(!e.url||typeof e.url!=`string`)continue;let t=e.url,a=e.name??`Server`,o={...e.headers??{}};if(e.auth?.access_token){let t=e.auth.token_type||`bearer`;o.Authorization=`${t.charAt(0).toUpperCase()+t.slice(1)} ${e.auth.access_token}`}let s=typeof e.proxyConfig?.proxyAddress==`string`?e.proxyConfig.proxyAddress.trim():``,c=``;try{new URL(t).origin!==window.location.origin&&(c=_M())}catch{c=_M()}let l=s||c,u=vM(e.connectionMode,e.connectionType,!!s),d=EM({url:t,name:a,transportType:`http`,connectionMode:u,protocolNegotiation:hM(gM(e.protocolNegotiation)),connectionType:u===`proxy`?`Via Proxy`:`Direct`,proxyConfig:u===`proxy`&&l?{proxyAddress:l,...Object.keys(o).length>0?{headers:o}:{}}:void 0,headers:o,autoProxyFallback:u===`auto`&&l?{enabled:!0,proxyAddress:l}:!1});r.find(e=>e.url===t)||i(t,d),n||=t}window.parent!==window&&window.parent.postMessage({type:`mcp-inspector:servers_connected`,count:t.length},`*`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[v,r,i]);let pe=(0,z.useRef)(!1);(0,z.useEffect)(()=>{if(!v||pe.current||d)return;let e=r.find(e=>e.state===`ready`);if(e){pe.current=!0,f(e.id);let r=new URLSearchParams(n.search);r.set(`server`,e.id),t(`/?${r.toString()}`,{replace:!0})}},[v,r,d,f,t,n.search]),bL({onCommandPalette:()=>j(`keyboard`),onToolsTab:()=>{N&&ae(`tools`)},onPromptsTab:()=>{N&&ae(`prompts`)},onResourcesTab:()=>{N&&ae(`resources`)},onChatTab:()=>{N&&ae(`chat`)},onHome:()=>{t(`/`)},onFocusSearch:()=>{p===`tools`&&O.current?O.current.focusSearch():p===`prompts`&&k.current?k.current.focusSearch():p===`resources`&&A.current&&A.current.focusSearch()},onBlurSearch:()=>{p===`tools`&&O.current?O.current.blurSearch():p===`prompts`&&k.current?k.current.blurSearch():p===`resources`&&A.current&&A.current.blurSearch()}});let me=new URLSearchParams(n.search).get(`server`),he=!c&&!!me&&!me.startsWith(`http://`)&&!me.startsWith(`https://`),ge=oe||he||le,_e=N?.id??`home`,ve=ge?`boot`:_e,[ye,be]=(0,z.useState)(ve);(0,z.useLayoutEffect)(()=>{if(ve===ye)return;let e=()=>(0,br.flushSync)(()=>be(ve));typeof document.startViewTransition==`function`?document.startViewTransition(e):e()},[ve,ye]);let xe=ye===`boot`,P=xe||ye===`home`?void 0:r.find(e=>e.id===ye),Se=v&&y.singleTab,Ce=v?{backgroundColor:y.backgroundColor||`#f3f3f3`,padding:Se?`0`:y.padding||`0.5rem`}:{},we=v?Se?`h-screen flex flex-col`:`h-screen flex flex-col gap-2 sm:gap-4`:`h-screen bg-[#f3f3f3] dark:bg-black flex flex-col overflow-x-hidden px-4 lg:px-0 pb-[calc(var(--mobile-toolbar-height)+env(safe-area-inset-bottom))] lg:pb-4`,Te=Se?`flex-1 w-full bg-white dark:bg-black p-0 overflow-auto`:D(`flex-1 min-h-0 min-w-0 max-w-full w-full bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 overflow-x-hidden overflow-y-auto`,!P&&`lg:mx-4`,P&&`lg:mr-4`);return(0,R.jsxs)(et,{children:[(0,R.jsx)(`div`,{className:`inspector-view-transition h-screen overflow-x-hidden bg-[#f3f3f3] dark:bg-black`,children:xe?(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center bg-[#f3f3f3] dark:bg-black`,children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,R.jsx)(fL,{className:`h-8 w-8 text-zinc-600 dark:text-zinc-400`}),(0,R.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Connecting to MCP server...`})]})}):(0,R.jsxs)(`div`,{className:we,style:Ce,children:[!Se&&(0,R.jsx)(OB,{connections:r,selectedServer:P,activeTab:p,onServerSelect:se,onTabChange:ae,embedded:v,sidebarCollapsed:C}),(0,R.jsxs)(`div`,{className:Se?`flex-1 min-h-0`:`flex min-w-0 flex-1 min-h-0 overflow-hidden`,children:[P&&!Se&&(0,R.jsx)(gV,{activeTab:p,onTabChange:ae,selectedServer:P,visibleTabs:y.visibleTabs,collapsed:C,onCollapsedChange:w,rpcLoggerOpen:T,onRpcLoggerOpenChange:E,onCommandPaletteOpen:()=>j(`button`)}),(0,R.jsx)(`main`,{className:Te,children:(0,R.jsx)(QR,{selectedServer:P,activeTab:p,toolsSearchRef:O,promptsSearchRef:k,resourcesSearchRef:A,onUpdateConnection:ce,children:e})}),P&&!Se&&(0,R.jsx)(hH,{serverId:P.id,open:T})]})]})}),!Se&&!xe&&(0,R.jsx)(LH,{serverId:P?.id,rpcLoggerOpen:T,onRpcLoggerOpenChange:E}),(0,R.jsx)(zL,{isOpen:x,onOpenChange:S,tools:ue,prompts:de,resources:fe,savedRequests:ee,connections:r,selectedServer:N,tunnelUrl:_,onNavigate:M,onServerSelect:se})]})}function VH({...e}){let{resolvedTheme:t}=Oz();return(0,R.jsx)(pI,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}var HH=(0,z.createContext)(void 0),UH={deviceType:`desktop`,customViewport:{width:768,height:1024},cspMode:`permissive`,displayModeOverride:null,capabilities:{hover:!0,touch:!1},safeAreaInsets:{top:0,right:0,bottom:0,left:0},locale:`en-US`,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`};function WH({children:e}){let[t,n]=(0,z.useState)({activeWidgetId:null,widgets:new Map,playground:UH}),r=(0,z.useCallback)(e=>{n(t=>({...t,activeWidgetId:e}))},[]),i=(0,z.useCallback)((e,t)=>{n(n=>{if(n.widgets.has(e))return n;let r=new Map(n.widgets);return r.set(e,{...t,cspViolations:[]}),{...n,widgets:r}})},[]),a=(0,z.useCallback)(e=>{n(t=>{let n=new Map(t.widgets);return n.delete(e),{...t,widgets:n,activeWidgetId:t.activeWidgetId===e?null:t.activeWidgetId}})},[]),o=(0,z.useRef)(t);o.current=t;let s=(0,z.useCallback)(e=>o.current.widgets.get(e),[]),c=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i={cspViolations:[...r.cspViolations,t]};t.originalPolicy&&r.effectivePolicy===void 0&&(i.effectivePolicy=t.originalPolicy);let a=new Map(n.widgets);return a.set(e,{...r,...i}),{...n,widgets:a}})},[]),l=(0,z.useCallback)(e=>{n(t=>{let n=t.widgets.get(e);if(!n)return t;let r=new Map(t.widgets);return r.set(e,{...n,cspViolations:[]}),{...t,widgets:r}})},[]),u=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,modelContext:t}),{...n,widgets:i}})},[]),d=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,widgetState:t}),{...n,widgets:i}})},[]),f=(0,z.useCallback)((e,t,r)=>{n(n=>{let i=n.widgets.get(e);if(!i)return n;let a=new Map(n.widgets);return a.set(e,{...i,declaredCsp:t,...r!==void 0&&{effectivePolicy:r}}),{...n,widgets:a}})},[]),p=(0,z.useCallback)(e=>{n(t=>({...t,playground:{...t.playground,...e}}))},[]),m=(0,z.useCallback)(()=>{n(e=>({...e,widgets:new Map,activeWidgetId:null}))},[]),h=(0,z.useCallback)(()=>{let e=new Map;for(let[n,r]of t.widgets)r.modelContext&&e.set(n,r.modelContext);return e},[t.widgets]);return(0,R.jsx)(HH,{value:(0,z.useMemo)(()=>({...t,setActiveWidget:r,addWidget:i,removeWidget:a,getWidget:s,addCspViolation:c,clearCspViolations:l,setWidgetModelContext:u,setWidgetState:d,setWidgetDeclaredCsp:f,updatePlaygroundSettings:p,clearAllWidgets:m,getAllModelContexts:h}),[t,r,i,a,s,c,l,u,d,f,p,m,h]),children:e})}function GH(){let e=(0,z.use)(HH);if(!e)throw Error(`useWidgetDebug must be used within WidgetDebugProvider`);return e}var KH={mobile:{width:390,height:844,name:`iPhone 14`},tablet:{width:820,height:1180,name:`iPad Air`},desktop:{width:1440,height:900,name:`Desktop`},custom:{width:768,height:1024,name:`Custom`}},qH=(0,z.lazy)(()=>rS(()=>import(`./OAuthCallback-D8UItgTB.js`).then(e=>({default:e.OAuthCallback})),__vite__mapDeps([37,1,4]))),JH=(0,z.lazy)(()=>rS(()=>import(`./ManufactOAuthCallback-BRO6TPkZ.js`).then(e=>({default:e.ManufactOAuthCallback})),__vite__mapDeps([38,1,4]))),YH=(0,z.lazy)(()=>rS(()=>import(`./ViewPreview--z6jL0Zg.js`).then(e=>({default:e.ViewPreview})),__vite__mapDeps([39,1,4,17])));function XH({activeTabRef:e}){let{activeTab:t}=yL();return(0,z.useEffect)(()=>{e.current=t},[t,e]),null}function ZH(){let e=(0,z.useRef)(`tools`),t=new URLSearchParams(window.location.search),n=t.get(`embedded`)===`true`,r=t.get(`theme`),i=(0,z.useMemo)(()=>n?void 0:new MM(`mcp-inspector-connections`),[n]),a=_M(),o=a?.replace(/\/proxy\/?$/,`/oauth`),s=sM();return(0,z.useEffect)(()=>{ET()},[]),(0,z.useEffect)(()=>{let e=t.get(`auth_error`);if(!e)return;let n=t.get(`auth_error_description`);QF.error(`OAuth authentication failed: ${n||e}`,{duration:1/0,closeButton:!0});let r=new URLSearchParams(t);r.delete(`auth_error`),r.delete(`auth_error_description`);let i=r.toString();window.history.replaceState({},``,`${window.location.pathname}${i?`?${i}`:``}`)},[]),(0,R.jsx)(kz,{forcedTheme:r||void 0,children:(0,R.jsx)(fe,{defaultShape:`pill`,children:(0,R.jsx)(WH,{children:(0,R.jsx)(Cj,{storageProvider:i,enableRpcLogging:!0,defaultCallbackUrl:`${window.location.origin}${s}/oauth/callback`,defaultOAuthProxyUrl:o,defaultAutoProxyFallback:a?{enabled:!0,proxyAddress:a}:!1,defaultServerConfig:{preventAutoAuth:!0,useRedirectFlow:!0},clientInfo:{name:`mcp-use Inspector`,version:jo(),websiteUrl:`https://mcp-use.com`,icons:[{src:`https://mcp-use.com/logo.png`}],capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},onServerAdded:(e,t)=>{console.log(`[Inspector] Server added:`,e,t.state)},onServerRemoved:e=>{console.log(`[Inspector] Server removed:`,e)},onServerStateChange:(e,t)=>{console.log(`[Inspector] Server state changed:`,e,t)},onSamplingRequest:(e,t,n,r,i)=>{let a=QF((0,R.jsx)(Fn,{title:`Sampling Request Received`,description:`New request from ${n}`,actions:[{label:`View Details`,testId:`sampling-toast-view-details`,onClick:()=>{let t=new CustomEvent(`navigate-to-sampling`,{detail:{requestId:e.id}});window.dispatchEvent(t),QF.dismiss(a)}},{label:`Approve`,testId:`sampling-toast-approve`,onClick:()=>{r(e.id,In),QF.success(`Sampling request approved`),QF.dismiss(a)}},{label:`Deny`,testId:`sampling-toast-deny`,onClick:()=>{i(e.id,`User denied from toast`),QF.dismiss(a)}}]}),{duration:1/0})},onElicitationRequest:(t,n,r,i,a)=>{if(e.current===`chat`)return;let o=t.request.mode||`form`,s=t.request.message,c=o===`url`&&`url`in t.request?t.request.url:void 0,l=QF((0,R.jsx)(Fn,{title:`Elicitation Request Received`,description:`From ${r}: ${s}`,extra:o===`url`&&c?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 font-mono`,children:c}):void 0,actions:[{label:`View Details`,testId:`elicitation-toast-view-details`,onClick:()=>{let e=new CustomEvent(`navigate-to-elicitation`,{detail:{requestId:t.id}});window.dispatchEvent(e),QF.dismiss(l)}},...o===`url`&&c?[{label:`Open URL`,testId:`elicitation-toast-open-url`,onClick:()=>{window.open(c,`_blank`),QF.dismiss(l)}}]:[],{label:`Cancel`,testId:`elicitation-toast-cancel`,onClick:()=>{a(t.id,`User cancelled from toast`),QF.dismiss(l)}}]}),{duration:1/0})},children:(0,R.jsxs)(vL,{children:[(0,R.jsx)(XH,{activeTabRef:e}),(0,R.jsx)(gF,{basename:s,children:(0,R.jsxs)(DP,{children:[(0,R.jsx)(TP,{path:`/oauth/callback`,element:(0,R.jsx)(VR,{children:(0,R.jsx)(qH,{})})}),(0,R.jsx)(TP,{path:`/auth/callback`,element:(0,R.jsx)(VR,{children:(0,R.jsx)(JH,{})})}),(0,R.jsx)(TP,{path:`/preview/:view`,element:(0,R.jsx)(VR,{children:(0,R.jsx)(YH,{})})}),(0,R.jsx)(TP,{path:`/`,element:(0,R.jsx)(BH,{children:(0,R.jsx)(gL,{})})})]})}),(0,R.jsx)(VH,{position:`top-center`})]})})})})})}var QH=document.getElementById(`root`);QH?Pn.createRoot(QH).render((0,R.jsx)(ZH,{})):console.error(`[inspector] Root element not found`);export{jI as $,ki as $t,sz as A,rS as At,nL as B,ro as Bt,vV as C,Uj as Ct,uB as D,OT as Dt,cB as E,wj as Et,fL as F,vo as Ft,sL as G,Ia as Gt,oL as H,Za as Ht,dL as I,_o as It,KI as J,Gi as Jt,tL as K,Xi as Kt,uL as L,go as Lt,SL as M,_f as Mt,bL as N,Do as Nt,lB as O,BC as Ot,yL as P,bo as Pt,MI as Q,Ai as Qt,eL as R,wo as Rt,wV as S,_r as Sn,Vj as St,FB as T,uj as Tt,rL as U,$a as Ut,cL as V,Ya as Vt,aL as W,Xa as Wt,zI as X,zi as Xt,BI as Y,Wi as Yt,NI as Z,Ii as Zt,WV as _,Ir as _n,oM as _t,PH as a,ci as an,xI as at,PV as b,jr as bn,rM as bt,gH as c,ri as cn,DF as ct,xH as d,Zr as dn,OM as dt,Ti as en,EI as et,SH as f,Xr as fn,gM as ft,GV as g,Vr as gn,pM as gt,KV as h,Wr as hn,fM as ht,jH as i,fi as in,bI as it,ER as j,Pb as jt,Oz as k,Q as kt,bH as l,ti as ln,CM as lt,sH as m,qr as mn,DM as mt,GH as n,bi as nn,CI as nt,AH as o,si as on,QF as ot,_H as p,Yr as pn,hM as pt,JI as q,Yi as qt,TH as r,yi as rn,SI as rt,MH as s,ai as sn,tP as st,KH as t,xi as tn,yI as tt,CH as u,$r as un,_M as ut,BV as v,Fr as vn,cM as vt,YB as w,Hj as wt,CV as x,vr as xn,$j as xt,zV as y,Mr as yn,nM as yt,iL as z,mo as zt};
|