@mcp-use/inspector 3.0.0 → 3.0.1-canary.0

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.
@@ -337,7 +337,7 @@ void main() {
337
337
 
338
338
  fragColor = vec4(color, opacity);
339
339
  }
340
- `;function ku(e){if(Array.isArray(e))return e.length===4?e:e.length===3?[...e,1]:Fu;if(typeof e!=`string`)return Fu;let t,n,r,i=1;if(e.startsWith(`#`))[t,n,r,i]=Au(e);else if(e.startsWith(`rgb`))[t,n,r,i]=ju(e);else if(e.startsWith(`hsl`))[t,n,r,i]=Nu(Mu(e));else return console.error(`Unsupported color format`,e),Fu;return[Pu(t,0,1),Pu(n,0,1),Pu(r,0,1),Pu(i,0,1)]}function Au(e){return e=e.replace(/^#/,``),e.length===3&&(e=e.split(``).map(e=>e+e).join(``)),e.length===6&&(e+=`ff`),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255,parseInt(e.slice(6,8),16)/255]}function ju(e){let t=e.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([0-9.]+))?\s*\)$/i);return t?[parseInt(t[1]??`0`)/255,parseInt(t[2]??`0`)/255,parseInt(t[3]??`0`)/255,t[4]===void 0?1:parseFloat(t[4])]:[0,0,0,1]}function Mu(e){let t=e.match(/^hsla?\s*\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([0-9.]+))?\s*\)$/i);return t?[parseInt(t[1]??`0`),parseInt(t[2]??`0`),parseInt(t[3]??`0`),t[4]===void 0?1:parseFloat(t[4])]:[0,0,0,1]}function Nu(e){let[t,n,r,i]=e,a=t/360,o=n/100,s=r/100,c,l,u;if(n===0)c=l=u=s;else{let e=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),t=s<.5?s*(1+o):s+o-s*o,n=2*s-t;c=e(n,t,a+1/3),l=e(n,t,a),u=e(n,t,a-1/3)}return[c,l,u,i]}var Pu=(e,t,n)=>Math.min(Math.max(e,t),n),Fu=[0,0,0,1];function Iu(e){let t=w.useRef(void 0),n=w.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return w.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}function Lu(e){if(e.naturalWidth<1024&&e.naturalHeight<1024){if(e.naturalWidth<1||e.naturalHeight<1)return;let t=e.naturalWidth/e.naturalHeight;e.width=Math.round(t>1?1024*t:1024),e.height=Math.round(t>1?1024:1024/t)}}async function Ru(e){let t={},n=[],r=e=>{try{return e.startsWith(`/`)||new URL(e),!0}catch{return!1}},i=e=>{try{return e.startsWith(`/`)?!1:new URL(e,window.location.origin).origin!==window.location.origin}catch{return!1}};return Object.entries(e).forEach(([e,a])=>{if(typeof a==`string`){let o=a||`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`;if(!r(o)){console.warn(`Uniform "${e}" has invalid URL "${o}". Skipping image loading.`);return}let s=new Promise((n,r)=>{let a=new Image;i(o)&&(a.crossOrigin=`anonymous`),a.onload=()=>{Lu(a),t[e]=a,n()},a.onerror=()=>{console.error(`Could not set uniforms. Failed to load image at ${o}`),r()},a.src=o});n.push(s)}else a instanceof HTMLImageElement&&Lu(a),t[e]=a}),await Promise.all(n),t}var zu=(0,w.forwardRef)(function({fragmentShader:e,uniforms:t,webGlContextAttributes:n,speed:r=0,frame:i=0,width:a,height:o,minPixelRatio:s,maxPixelCount:c,mipmaps:l,style:u,...d},f){let[p,m]=(0,w.useState)(!1),h=(0,w.useRef)(null),g=(0,w.useRef)(null),_=(0,w.useRef)(n);return(0,w.useEffect)(()=>((async()=>{let n=await Ru(t);h.current&&!g.current&&(g.current=new gu(h.current,e,n,_.current,r,i,s,c,l),m(!0))})(),()=>{g.current?.dispose(),g.current=null}),[e]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{let n=await Ru(t);e||g.current?.setUniforms(n)})(),()=>{e=!0}},[t,p]),(0,w.useEffect)(()=>{g.current?.setSpeed(r)},[r,p]),(0,w.useEffect)(()=>{g.current?.setMaxPixelCount(c)},[c,p]),(0,w.useEffect)(()=>{g.current?.setMinPixelRatio(s)},[s,p]),(0,w.useEffect)(()=>{g.current?.setFrame(i)},[i,p]),(0,S.jsx)(`div`,{ref:Iu([h,f]),style:a!==void 0||o!==void 0?{width:typeof a==`string`&&isNaN(+a)===!1?+a:a,height:typeof o==`string`&&isNaN(+o)===!1?+o:o,...u}:u,...d})});zu.displayName=`ShaderMount`;function Bu(e,t){for(let n in e){if(n===`colors`){let n=Array.isArray(e.colors),r=Array.isArray(t.colors);if(!n||!r){if(Object.is(e.colors,t.colors)===!1)return!1;continue}if(e.colors?.length!==t.colors?.length||!e.colors?.every((e,n)=>e===t.colors?.[n]))return!1;continue}if(Object.is(e[n],t[n])===!1)return!1}return!0}var Vu={name:`Default`,params:{...Su,speed:1,frame:0,colors:[`#e0eaff`,`#241d9a`,`#f75092`,`#9f50d3`],distortion:.8,swirl:.1,grainMixer:0,grainOverlay:0}};({...Su}),{...Su},{...Su};var Hu=(0,w.memo)(function({speed:e=Vu.params.speed,frame:t=Vu.params.frame,colors:n=Vu.params.colors,distortion:r=Vu.params.distortion,swirl:i=Vu.params.swirl,grainMixer:a=Vu.params.grainMixer,grainOverlay:o=Vu.params.grainOverlay,fit:s=Vu.params.fit,rotation:c=Vu.params.rotation,scale:l=Vu.params.scale,originX:u=Vu.params.originX,originY:d=Vu.params.originY,offsetX:f=Vu.params.offsetX,offsetY:p=Vu.params.offsetY,worldWidth:m=Vu.params.worldWidth,worldHeight:h=Vu.params.worldHeight,...g}){let _={u_colors:n.map(ku),u_colorsCount:n.length,u_distortion:r,u_swirl:i,u_grainMixer:a,u_grainOverlay:o,u_fit:Cu[s],u_rotation:c,u_scale:l,u_offsetX:f,u_offsetY:p,u_originX:u,u_originY:d,u_worldWidth:m,u_worldHeight:h};return(0,S.jsx)(zu,{...g,speed:e,frame:t,fragmentShader:Ou,uniforms:_})},Bu),Uu=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Wu=`VisuallyHidden`,Gu=w.forwardRef((e,t)=>(0,S.jsx)(Jt.span,{...e,ref:t,style:{...Uu,...e.style}}));Gu.displayName=Wu;var Ku=Gu,[qu,Ju]=Nt(`Tooltip`,[aa]),Yu=aa(),Xu=`TooltipProvider`,Zu=700,Qu=`tooltip.open`,[$u,ed]=qu(Xu),td=e=>{let{__scopeTooltip:t,delayDuration:n=Zu,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=w.useRef(!0),s=w.useRef(!1),c=w.useRef(0);return w.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,S.jsx)($u,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:w.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};td.displayName=Xu;var nd=`Tooltip`,[rd,id]=qu(nd),ad=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=ed(nd,e.__scopeTooltip),l=Yu(t),[u,d]=w.useState(null),f=Fn(),p=w.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=w.useRef(!1),[_,v]=Lt({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Qu))):c.onClose(),a?.(e)},caller:nd}),y=w.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=w.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=w.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),C=w.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return w.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,S.jsx)(xa,{...l,children:(0,S.jsx)(rd,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:w.useCallback(()=>{c.isOpenDelayedRef.current?C():b()},[c.isOpenDelayedRef,C,b]),onTriggerLeave:w.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};ad.displayName=nd;var od=`TooltipTrigger`,sd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=id(od,n),a=ed(od,n),o=Yu(n),s=D(t,w.useRef(null),i.onTriggerChange),c=w.useRef(!1),l=w.useRef(!1),u=w.useCallback(()=>c.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,S.jsx)(Sa,{asChild:!0,...o,children:(0,S.jsx)(Jt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:jt(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:jt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:jt(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:jt(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:jt(e.onBlur,i.onClose),onClick:jt(e.onClick,i.onClose)})})});sd.displayName=od;var cd=`TooltipPortal`,[ld,ud]=qu(cd,{forceMount:void 0}),dd=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=id(cd,t);return(0,S.jsx)(ld,{scope:t,forceMount:n,children:(0,S.jsx)(Oa,{present:n||a.open,children:(0,S.jsx)(Ea,{asChild:!0,container:i,children:r})})})};dd.displayName=cd;var fd=`TooltipContent`,pd=w.forwardRef((e,t)=>{let n=ud(fd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=id(fd,e.__scopeTooltip);return(0,S.jsx)(Oa,{present:r||o.open,children:o.disableHoverableContent?(0,S.jsx)(vd,{side:i,...a,ref:t}):(0,S.jsx)(md,{side:i,...a,ref:t})})}),md=w.forwardRef((e,t)=>{let n=id(fd,e.__scopeTooltip),r=ed(fd,e.__scopeTooltip),i=w.useRef(null),a=D(t,i),[o,s]=w.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=w.useCallback(()=>{s(null),d(!1)},[d]),p=w.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Sd(r,xd(r,n.getBoundingClientRect())),a=Cd(t.getBoundingClientRect());s(Td([...i,...a])),d(!0)},[d]);return w.useEffect(()=>()=>f(),[f]),w.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),w.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!wd(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,S.jsx)(vd,{...e,ref:a})}),[hd,gd]=qu(nd,{isInside:!1}),_d=Wt(`TooltipContent`),vd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=id(fd,n),l=Yu(n),{onClose:u}=c;return w.useEffect(()=>(document.addEventListener(Qu,u),()=>document.removeEventListener(Qu,u)),[u]),w.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,S.jsx)(cn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,S.jsxs)(Ca,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,S.jsx)(_d,{children:r}),(0,S.jsx)(hd,{scope:n,isInside:!0,children:(0,S.jsx)(Ku,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});pd.displayName=fd;var yd=`TooltipArrow`,bd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Yu(n);return gd(yd,n).isInside?null:(0,S.jsx)(wa,{...i,...r,ref:t})});bd.displayName=yd;function xd(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Sd(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Cd(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function wd(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Td(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Ed(t)}function Ed(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Dd=td,Od=ad,kd=sd,Ad=dd,jd=pd,Md=bd;function Nd({delayDuration:e=0,...t}){return(0,S.jsx)(Dd,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Pd({...e}){return(0,S.jsx)(Nd,{children:(0,S.jsx)(Od,{"data-slot":`tooltip`,...e})})}function Fd({...e}){return(0,S.jsx)(kd,{"data-slot":`tooltip-trigger`,...e})}function Id({className:e,sideOffset:t=0,children:n,...r}){return(0,S.jsx)(Ad,{children:(0,S.jsxs)(jd,{"data-slot":`tooltip-content`,sideOffset:t,className:H(`bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...r,children:[n,(0,S.jsx)(Md,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})})}var Ld=class{name=`mcp_inspector_open`;properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}},Rd=class{name=`mcp_tool_execution`;properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}},zd=class{name=`mcp_resource_read`;properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}},Bd=class{name=`mcp_prompt_call`;properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}},Vd=class{name=`mcp_server_connection`;properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,success:e.success,connection_type:e.connectionType,error:e.error}}},Hd=class{name=`mcp_chat_message`;properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}},Ud=class{name=`mcp_server_added`;properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}},Wd=class{name=`mcp_server_removed`;properties;constructor(e){this.properties={server_id:e.serverId}}},Gd=class{name=`mcp_command_palette_open`;properties;constructor(e){this.properties={trigger:e.trigger}}},Kd=class{name=`mcp_tool_saved`;properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}},qd=class{name=`mcp_tunnel_action`;properties;constructor(e){this.properties={action:e.action,success:e.success,tunnel_url:e.tunnelUrl}}},Jd=class{name=`mcp_deploy_click`;properties;constructor(e){this.properties={referrer:e.referrer}}},Yd=class{name=`mcp_chat_configured`;properties;constructor(e){this.properties={provider:e.provider,model:e.model}}},Xd=class{name=`mcp_tab_navigation`;properties;constructor(e){this.properties={tab:e.tab,previous_tab:e.previousTab}}},Zd=class{name=`mcp_add_to_client`;properties;constructor(e){this.properties={client:e.client}}},Qd=class{name=`mcp_session_duration`;properties;constructor(e){this.properties={duration_seconds:e.durationSeconds,tabs_visited:e.tabsVisited,tools_executed:e.toolsExecuted}}};function $d(){try{return`3.0.0`}catch{return`0.0.0`}}function ef(){try{return typeof window<`u`&&typeof document<`u`}catch{return!1}}var tf=class{endpoint;timeout;constructor(e,t=3e3){this.endpoint=e,this.timeout=t}async logEvent(e){try{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout),r=await fetch(this.endpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t.signal});if(clearTimeout(n),!r.ok)throw Error(`HTTP error! status: ${r.status}`)}catch{}}};function nf(e){return`mcp_inspector_telemetry_${e}`}function rf(){if(typeof window>`u`)return`standalone`;let e=window.__MCP_INSPECTOR_MODE__;return e===`standalone`||e===`embedded`||e===`cloud`?e:`standalone`}function af(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`}var of=class e{static instance=null;POSTHOG_PROXY_URL=`/inspector/api/tel/posthog`;SCARF_PROXY_URL=`/inspector/api/tel/scarf`;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_posthogClient=null;_scarfClient=null;_source=`inspector`;_mode=`standalone`;constructor(){let e=ef(),t=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||`inspector`,this._mode=rf(),t)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new tf(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new tf(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return!!(af()&&localStorage.getItem(nf(`disabled`))===`true`||typeof process<`u`&&{}?.MCP_USE_ANONYMIZED_TELEMETRY===`false`)}getStoredSource(){return af()?localStorage.getItem(nf(`source`)):null}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e,af()&&localStorage.setItem(nf(`source`),e)}getSource(){return this._source}getMode(){return this._mode}get userId(){if(this._currUserId)return this._currUserId;if(!ef())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{if(!af())throw Error(`localStorage is not available or not functional`);let e=localStorage.getItem(nf(`user_id`));if(e)this._currUserId=e;else{let e=this.generateUserId();localStorage.setItem(nf(`user_id`),e),this._currUserId=e}this.trackPackageDownload({triggered_by:`user_id_property`}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){let e=window.crypto;if(e){let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t).map(e=>e.toString(16).padStart(2,`0`)).join(``);return n.slice(0,8)+`-`+n.slice(8,12)+`-`+n.slice(12,16)+`-`+n.slice(16,20)+`-`+n.slice(20,32)}else return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{let t={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:$d(),language:`typescript`,source:this._source,package:`inspector`,mode:this._mode}};await this._posthogClient.logEvent(t)}catch{}if(this._scarfClient)try{let t={};t.mcp_use_version=$d(),t.user_id=this.userId,t.event=e.name,t.language=`typescript`,t.source=this._source,t.package=`inspector`,t.mode=this._mode,await this._scarfClient.logEvent(t)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&ef())try{if(!af())throw Error(`localStorage is not available or not functional`);let t=$d(),n=!1,r=!1,i=localStorage.getItem(nf(`download_version`));if(i?t>i&&(n=!0,r=!1,localStorage.setItem(nf(`download_version`),t)):(n=!0,r=!0,localStorage.setItem(nf(`download_version`),t)),n){let n={...e||{}};n.mcp_use_version=t,n.user_id=this.userId,n.event=`package_download`,n.first_download=r,n.language=`typescript`,n.source=this._source,n.package=`inspector`,n.mode=this._mode,await this._scarfClient.logEvent(n)}}catch{}}async trackInspectorOpen(e){let t=new Ld(e);await this.capture(t)}},sf=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),cf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),lf=e=>{let t=cf(e);return t.charAt(0).toUpperCase()+t.slice(1)},uf=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),df=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},ff={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`},pf=(0,w.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,w.createElement)(`svg`,{ref:c,...ff,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:uf(`lucide`,i),...!a&&!df(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,w.createElement)(e,t)),...Array.isArray(a)?a:[a]])),mf=(e,t)=>{let n=(0,w.forwardRef)(({className:n,...r},i)=>(0,w.createElement)(pf,{ref:i,iconNode:t,className:uf(`lucide-${sf(lf(e))}`,`lucide-${e}`,n),...r}));return n.displayName=lf(e),n},hf=mf(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),gf=mf(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),_f=mf(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),vf=mf(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),yf=mf(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),bf=mf(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),xf=mf(`brush-cleaning`,[[`path`,{d:`m16 22-1-4`,key:`1ow2iv`}],[`path`,{d:`M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1`,key:`11gii7`}],[`path`,{d:`M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z`,key:`bju7h4`}],[`path`,{d:`m8 22 1-4`,key:`s3unb`}]]),Sf=mf(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),Cf=mf(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),wf=mf(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Tf=mf(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ef=mf(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Df=mf(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Of=mf(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),kf=mf(`chevrons-left-right-ellipsis`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`m17 7 5 5-5 5`,key:`1xlxn0`}],[`path`,{d:`m7 7-5 5 5 5`,key:`19njba`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}]]),Af=mf(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),jf=mf(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Mf=mf(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Nf=mf(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Pf=mf(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ff=mf(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),If=mf(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Lf=mf(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Rf=mf(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),zf=mf(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Bf=mf(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Vf=mf(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Hf=mf(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Uf=mf(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Wf=mf(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Gf=mf(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Kf=mf(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),qf=mf(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Jf=mf(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Yf=mf(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Xf=mf(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Zf=mf(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Qf=mf(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),$f=mf(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ep=mf(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),tp=mf(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),np=mf(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),rp=mf(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ip=mf(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ap=mf(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),op=mf(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),sp=mf(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),cp=mf(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),lp=mf(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),up=mf(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),dp=mf(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),fp=mf(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),pp=mf(`picture-in-picture`,[[`path`,{d:`M2 10h6V4`,key:`zwrco`}],[`path`,{d:`m2 4 6 6`,key:`ug085t`}],[`path`,{d:`M21 10V7a2 2 0 0 0-2-2h-7`,key:`git5jr`}],[`path`,{d:`M3 14v2a2 2 0 0 0 2 2h3`,key:`1f7fh3`}],[`rect`,{x:`12`,y:`14`,width:`10`,height:`7`,rx:`1`,key:`1wjs3o`}]]),mp=mf(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),hp=mf(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),gp=mf(`pointer`,[[`path`,{d:`M22 14a8 8 0 0 1-8 8`,key:`56vcr3`}],[`path`,{d:`M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1agjmk`}],[`path`,{d:`M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1`,key:`wdbh2u`}],[`path`,{d:`M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10`,key:`1ibuk9`}],[`path`,{d:`M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`g6ys72`}]]),_p=mf(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),vp=mf(`rocket`,[[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z`,key:`m3kijz`}],[`path`,{d:`m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z`,key:`1fmvmk`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0`,key:`1f8sc4`}],[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}]]),yp=mf(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),bp=mf(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),xp=mf(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Sp=mf(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Cp=mf(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),wp=mf(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Tp=mf(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ep=mf(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Dp=mf(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Op=mf(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),kp=mf(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Ap=mf(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),jp=mf(`square-dashed-mouse-pointer`,[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h2`,key:`1qve2z`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v2`,key:`p14lih`}],[`path`,{d:`M3 14v1`,key:`vnatye`}]]),Mp=mf(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Np=mf(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Pp=mf(`sun-dim`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 4h.01`,key:`1ujb9j`}],[`path`,{d:`M20 12h.01`,key:`1ykeid`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M4 12h.01`,key:`158zrr`}],[`path`,{d:`M17.657 6.343h.01`,key:`31pqzk`}],[`path`,{d:`M17.657 17.657h.01`,key:`jehnf4`}],[`path`,{d:`M6.343 17.657h.01`,key:`gdk6ow`}],[`path`,{d:`M6.343 6.343h.01`,key:`1uurf0`}]]),Fp=mf(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Ip=mf(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),Lp=mf(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Rp=mf(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),zp=mf(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Bp=mf(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Vp=mf(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Hp=mf(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Up=Object.freeze({status:`aborted`});function W(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Wp=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Gp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Kp={};function qp(e){return e&&Object.assign(Kp,e),Kp}function Jp(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Yp(e,t){return typeof t==`bigint`?t.toString():t}function Xp(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Zp(e){return e==null}function Qp(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function nee(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var $p=Symbol(`evaluating`);function em(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==$p)return r===void 0&&(r=$p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function tm(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function nm(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function rm(e){return JSON.stringify(e)}function ree(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var iee=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function im(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var aee=Xp(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function am(e){if(im(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(im(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function oee(e){return am(e)?{...e}:Array.isArray(e)?[...e]:e}var see=new Set([`string`,`number`,`symbol`]);function om(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function sm(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function cm(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function cee(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var lee={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function uee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return sm(e,nm(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return tm(this,`shape`,e),e},checks:[]}))}function dee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return sm(e,nm(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return tm(this,`shape`,r),r},checks:[]}))}function fee(e,t){if(!am(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return sm(e,nm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return tm(this,`shape`,n),n}}))}function pee(e,t){if(!am(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return sm(e,nm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return tm(this,`shape`,n),n}}))}function mee(e,t){return sm(e,nm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return tm(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function hee(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return sm(t,nm(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return tm(this,`shape`,i),i},checks:[]}))}function gee(e,t,n){return sm(t,nm(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return tm(this,`shape`,i),i}}))}function lm(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function um(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function dm(e){return typeof e==`string`?e:e?.message}function fm(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=dm(e.inst?._zod.def?.error?.(e))??dm(t?.error?.(e))??dm(n.customError?.(e))??dm(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function pm(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function mm(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var hm=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Yp,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},gm=W(`$ZodError`,hm),_m=W(`$ZodError`,hm,{Parent:Error});function _ee(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function vee(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var vm=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Wp;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>fm(e,a,qp())));throw iee(t,i?.callee),t}return o.value},ym=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>fm(e,a,qp())));throw iee(t,i?.callee),t}return o.value},bm=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Wp;return a.issues.length?{success:!1,error:new(e??gm)(a.issues.map(e=>fm(e,i,qp())))}:{success:!0,data:a.value}},yee=bm(_m),xm=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>fm(e,i,qp())))}:{success:!0,data:a.value}},bee=xm(_m),xee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return vm(e)(t,n,i)},See=e=>(t,n,r)=>vm(e)(t,n,r),Cee=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ym(e)(t,n,i)},wee=e=>async(t,n,r)=>ym(e)(t,n,r),Tee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return bm(e)(t,n,i)},Eee=e=>(t,n,r)=>bm(e)(t,n,r),Dee=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return xm(e)(t,n,i)},Oee=e=>async(t,n,r)=>xm(e)(t,n,r),kee=/^[cC][^\s-]{8,}$/,Aee=/^[0-9a-z]+$/,jee=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Mee=/^[0-9a-vA-V]{20}$/,Nee=/^[A-Za-z0-9]{27}$/,Pee=/^[a-zA-Z0-9_-]{21}$/,Fee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Iee=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Sm=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Lee=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ree=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function zee(){return new RegExp(Ree,`u`)}var Bee=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Vee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Hee=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Uee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cm=/^[A-Za-z0-9_-]*$/,Gee=/^\+[1-9]\d{6,14}$/,wm=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Kee=RegExp(`^${wm}$`);function Tm(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function qee(e){return RegExp(`^${Tm(e)}$`)}function Jee(e){let t=Tm({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${wm}T(?:${r})$`)}var Yee=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Xee=/^-?\d+$/,Em=/^-?\d+(?:\.\d+)?$/,Zee=/^(?:true|false)$/i,Qee=/^null$/i,$ee=/^[^A-Z]*$/,ete=/^[^a-z]*$/,Dm=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Om={number:`number`,bigint:`bigint`,object:`date`},km=W(`$ZodCheckLessThan`,(e,t)=>{Dm.init(e,t);let n=Om[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Am=W(`$ZodCheckGreaterThan`,(e,t)=>{Dm.init(e,t);let n=Om[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tte=W(`$ZodCheckMultipleOf`,(e,t)=>{Dm.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):nee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),nte=W(`$ZodCheckNumberFormat`,(e,t)=>{Dm.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=lee[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Xee)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),rte=W(`$ZodCheckMaxLength`,(e,t)=>{var n;Dm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=pm(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ite=W(`$ZodCheckMinLength`,(e,t)=>{var n;Dm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=pm(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ate=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;Dm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=pm(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),jm=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Dm.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ote=W(`$ZodCheckRegex`,(e,t)=>{jm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ste=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$ee,jm.init(e,t)}),cte=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ete,jm.init(e,t)}),lte=W(`$ZodCheckIncludes`,(e,t)=>{Dm.init(e,t);let n=om(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ute=W(`$ZodCheckStartsWith`,(e,t)=>{Dm.init(e,t);let n=RegExp(`^${om(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),dte=W(`$ZodCheckEndsWith`,(e,t)=>{Dm.init(e,t);let n=RegExp(`.*${om(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),fte=W(`$ZodCheckOverwrite`,(e,t)=>{Dm.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),pte=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
340
+ `;function ku(e){if(Array.isArray(e))return e.length===4?e:e.length===3?[...e,1]:Fu;if(typeof e!=`string`)return Fu;let t,n,r,i=1;if(e.startsWith(`#`))[t,n,r,i]=Au(e);else if(e.startsWith(`rgb`))[t,n,r,i]=ju(e);else if(e.startsWith(`hsl`))[t,n,r,i]=Nu(Mu(e));else return console.error(`Unsupported color format`,e),Fu;return[Pu(t,0,1),Pu(n,0,1),Pu(r,0,1),Pu(i,0,1)]}function Au(e){return e=e.replace(/^#/,``),e.length===3&&(e=e.split(``).map(e=>e+e).join(``)),e.length===6&&(e+=`ff`),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255,parseInt(e.slice(6,8),16)/255]}function ju(e){let t=e.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([0-9.]+))?\s*\)$/i);return t?[parseInt(t[1]??`0`)/255,parseInt(t[2]??`0`)/255,parseInt(t[3]??`0`)/255,t[4]===void 0?1:parseFloat(t[4])]:[0,0,0,1]}function Mu(e){let t=e.match(/^hsla?\s*\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([0-9.]+))?\s*\)$/i);return t?[parseInt(t[1]??`0`),parseInt(t[2]??`0`),parseInt(t[3]??`0`),t[4]===void 0?1:parseFloat(t[4])]:[0,0,0,1]}function Nu(e){let[t,n,r,i]=e,a=t/360,o=n/100,s=r/100,c,l,u;if(n===0)c=l=u=s;else{let e=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),t=s<.5?s*(1+o):s+o-s*o,n=2*s-t;c=e(n,t,a+1/3),l=e(n,t,a),u=e(n,t,a-1/3)}return[c,l,u,i]}var Pu=(e,t,n)=>Math.min(Math.max(e,t),n),Fu=[0,0,0,1];function Iu(e){let t=w.useRef(void 0),n=w.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return w.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}function Lu(e){if(e.naturalWidth<1024&&e.naturalHeight<1024){if(e.naturalWidth<1||e.naturalHeight<1)return;let t=e.naturalWidth/e.naturalHeight;e.width=Math.round(t>1?1024*t:1024),e.height=Math.round(t>1?1024:1024/t)}}async function Ru(e){let t={},n=[],r=e=>{try{return e.startsWith(`/`)||new URL(e),!0}catch{return!1}},i=e=>{try{return e.startsWith(`/`)?!1:new URL(e,window.location.origin).origin!==window.location.origin}catch{return!1}};return Object.entries(e).forEach(([e,a])=>{if(typeof a==`string`){let o=a||`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`;if(!r(o)){console.warn(`Uniform "${e}" has invalid URL "${o}". Skipping image loading.`);return}let s=new Promise((n,r)=>{let a=new Image;i(o)&&(a.crossOrigin=`anonymous`),a.onload=()=>{Lu(a),t[e]=a,n()},a.onerror=()=>{console.error(`Could not set uniforms. Failed to load image at ${o}`),r()},a.src=o});n.push(s)}else a instanceof HTMLImageElement&&Lu(a),t[e]=a}),await Promise.all(n),t}var zu=(0,w.forwardRef)(function({fragmentShader:e,uniforms:t,webGlContextAttributes:n,speed:r=0,frame:i=0,width:a,height:o,minPixelRatio:s,maxPixelCount:c,mipmaps:l,style:u,...d},f){let[p,m]=(0,w.useState)(!1),h=(0,w.useRef)(null),g=(0,w.useRef)(null),_=(0,w.useRef)(n);return(0,w.useEffect)(()=>((async()=>{let n=await Ru(t);h.current&&!g.current&&(g.current=new gu(h.current,e,n,_.current,r,i,s,c,l),m(!0))})(),()=>{g.current?.dispose(),g.current=null}),[e]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{let n=await Ru(t);e||g.current?.setUniforms(n)})(),()=>{e=!0}},[t,p]),(0,w.useEffect)(()=>{g.current?.setSpeed(r)},[r,p]),(0,w.useEffect)(()=>{g.current?.setMaxPixelCount(c)},[c,p]),(0,w.useEffect)(()=>{g.current?.setMinPixelRatio(s)},[s,p]),(0,w.useEffect)(()=>{g.current?.setFrame(i)},[i,p]),(0,S.jsx)(`div`,{ref:Iu([h,f]),style:a!==void 0||o!==void 0?{width:typeof a==`string`&&isNaN(+a)===!1?+a:a,height:typeof o==`string`&&isNaN(+o)===!1?+o:o,...u}:u,...d})});zu.displayName=`ShaderMount`;function Bu(e,t){for(let n in e){if(n===`colors`){let n=Array.isArray(e.colors),r=Array.isArray(t.colors);if(!n||!r){if(Object.is(e.colors,t.colors)===!1)return!1;continue}if(e.colors?.length!==t.colors?.length||!e.colors?.every((e,n)=>e===t.colors?.[n]))return!1;continue}if(Object.is(e[n],t[n])===!1)return!1}return!0}var Vu={name:`Default`,params:{...Su,speed:1,frame:0,colors:[`#e0eaff`,`#241d9a`,`#f75092`,`#9f50d3`],distortion:.8,swirl:.1,grainMixer:0,grainOverlay:0}};({...Su}),{...Su},{...Su};var Hu=(0,w.memo)(function({speed:e=Vu.params.speed,frame:t=Vu.params.frame,colors:n=Vu.params.colors,distortion:r=Vu.params.distortion,swirl:i=Vu.params.swirl,grainMixer:a=Vu.params.grainMixer,grainOverlay:o=Vu.params.grainOverlay,fit:s=Vu.params.fit,rotation:c=Vu.params.rotation,scale:l=Vu.params.scale,originX:u=Vu.params.originX,originY:d=Vu.params.originY,offsetX:f=Vu.params.offsetX,offsetY:p=Vu.params.offsetY,worldWidth:m=Vu.params.worldWidth,worldHeight:h=Vu.params.worldHeight,...g}){let _={u_colors:n.map(ku),u_colorsCount:n.length,u_distortion:r,u_swirl:i,u_grainMixer:a,u_grainOverlay:o,u_fit:Cu[s],u_rotation:c,u_scale:l,u_offsetX:f,u_offsetY:p,u_originX:u,u_originY:d,u_worldWidth:m,u_worldHeight:h};return(0,S.jsx)(zu,{...g,speed:e,frame:t,fragmentShader:Ou,uniforms:_})},Bu),Uu=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Wu=`VisuallyHidden`,Gu=w.forwardRef((e,t)=>(0,S.jsx)(Jt.span,{...e,ref:t,style:{...Uu,...e.style}}));Gu.displayName=Wu;var Ku=Gu,[qu,Ju]=Nt(`Tooltip`,[aa]),Yu=aa(),Xu=`TooltipProvider`,Zu=700,Qu=`tooltip.open`,[$u,ed]=qu(Xu),td=e=>{let{__scopeTooltip:t,delayDuration:n=Zu,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=w.useRef(!0),s=w.useRef(!1),c=w.useRef(0);return w.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,S.jsx)($u,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:w.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};td.displayName=Xu;var nd=`Tooltip`,[rd,id]=qu(nd),ad=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=ed(nd,e.__scopeTooltip),l=Yu(t),[u,d]=w.useState(null),f=Fn(),p=w.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=w.useRef(!1),[_,v]=Lt({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Qu))):c.onClose(),a?.(e)},caller:nd}),y=w.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=w.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=w.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),C=w.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return w.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,S.jsx)(xa,{...l,children:(0,S.jsx)(rd,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:w.useCallback(()=>{c.isOpenDelayedRef.current?C():b()},[c.isOpenDelayedRef,C,b]),onTriggerLeave:w.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};ad.displayName=nd;var od=`TooltipTrigger`,sd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=id(od,n),a=ed(od,n),o=Yu(n),s=D(t,w.useRef(null),i.onTriggerChange),c=w.useRef(!1),l=w.useRef(!1),u=w.useCallback(()=>c.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,S.jsx)(Sa,{asChild:!0,...o,children:(0,S.jsx)(Jt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:jt(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:jt(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:jt(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:jt(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:jt(e.onBlur,i.onClose),onClick:jt(e.onClick,i.onClose)})})});sd.displayName=od;var cd=`TooltipPortal`,[ld,ud]=qu(cd,{forceMount:void 0}),dd=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=id(cd,t);return(0,S.jsx)(ld,{scope:t,forceMount:n,children:(0,S.jsx)(Oa,{present:n||a.open,children:(0,S.jsx)(Ea,{asChild:!0,container:i,children:r})})})};dd.displayName=cd;var fd=`TooltipContent`,pd=w.forwardRef((e,t)=>{let n=ud(fd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=id(fd,e.__scopeTooltip);return(0,S.jsx)(Oa,{present:r||o.open,children:o.disableHoverableContent?(0,S.jsx)(vd,{side:i,...a,ref:t}):(0,S.jsx)(md,{side:i,...a,ref:t})})}),md=w.forwardRef((e,t)=>{let n=id(fd,e.__scopeTooltip),r=ed(fd,e.__scopeTooltip),i=w.useRef(null),a=D(t,i),[o,s]=w.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=w.useCallback(()=>{s(null),d(!1)},[d]),p=w.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Sd(r,xd(r,n.getBoundingClientRect())),a=Cd(t.getBoundingClientRect());s(Td([...i,...a])),d(!0)},[d]);return w.useEffect(()=>()=>f(),[f]),w.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),w.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!wd(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,S.jsx)(vd,{...e,ref:a})}),[hd,gd]=qu(nd,{isInside:!1}),_d=Wt(`TooltipContent`),vd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=id(fd,n),l=Yu(n),{onClose:u}=c;return w.useEffect(()=>(document.addEventListener(Qu,u),()=>document.removeEventListener(Qu,u)),[u]),w.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,S.jsx)(cn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,S.jsxs)(Ca,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,S.jsx)(_d,{children:r}),(0,S.jsx)(hd,{scope:n,isInside:!0,children:(0,S.jsx)(Ku,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});pd.displayName=fd;var yd=`TooltipArrow`,bd=w.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Yu(n);return gd(yd,n).isInside?null:(0,S.jsx)(wa,{...i,...r,ref:t})});bd.displayName=yd;function xd(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Sd(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Cd(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function wd(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Td(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Ed(t)}function Ed(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Dd=td,Od=ad,kd=sd,Ad=dd,jd=pd,Md=bd;function Nd({delayDuration:e=0,...t}){return(0,S.jsx)(Dd,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Pd({...e}){return(0,S.jsx)(Nd,{children:(0,S.jsx)(Od,{"data-slot":`tooltip`,...e})})}function Fd({...e}){return(0,S.jsx)(kd,{"data-slot":`tooltip-trigger`,...e})}function Id({className:e,sideOffset:t=0,children:n,...r}){return(0,S.jsx)(Ad,{children:(0,S.jsxs)(jd,{"data-slot":`tooltip-content`,sideOffset:t,className:H(`bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...r,children:[n,(0,S.jsx)(Md,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})})}var Ld=class{name=`mcp_inspector_open`;properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}},Rd=class{name=`mcp_tool_execution`;properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}},zd=class{name=`mcp_resource_read`;properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}},Bd=class{name=`mcp_prompt_call`;properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}},Vd=class{name=`mcp_server_connection`;properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,success:e.success,connection_type:e.connectionType,error:e.error}}},Hd=class{name=`mcp_chat_message`;properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}},Ud=class{name=`mcp_server_added`;properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}},Wd=class{name=`mcp_server_removed`;properties;constructor(e){this.properties={server_id:e.serverId}}},Gd=class{name=`mcp_command_palette_open`;properties;constructor(e){this.properties={trigger:e.trigger}}},Kd=class{name=`mcp_tool_saved`;properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}},qd=class{name=`mcp_tunnel_action`;properties;constructor(e){this.properties={action:e.action,success:e.success,tunnel_url:e.tunnelUrl}}},Jd=class{name=`mcp_deploy_click`;properties;constructor(e){this.properties={referrer:e.referrer}}},Yd=class{name=`mcp_chat_configured`;properties;constructor(e){this.properties={provider:e.provider,model:e.model}}},Xd=class{name=`mcp_tab_navigation`;properties;constructor(e){this.properties={tab:e.tab,previous_tab:e.previousTab}}},Zd=class{name=`mcp_add_to_client`;properties;constructor(e){this.properties={client:e.client}}},Qd=class{name=`mcp_session_duration`;properties;constructor(e){this.properties={duration_seconds:e.durationSeconds,tabs_visited:e.tabsVisited,tools_executed:e.toolsExecuted}}};function $d(){try{return`3.0.1-canary.0`}catch{return`0.0.0`}}function ef(){try{return typeof window<`u`&&typeof document<`u`}catch{return!1}}var tf=class{endpoint;timeout;constructor(e,t=3e3){this.endpoint=e,this.timeout=t}async logEvent(e){try{let t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout),r=await fetch(this.endpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t.signal});if(clearTimeout(n),!r.ok)throw Error(`HTTP error! status: ${r.status}`)}catch{}}};function nf(e){return`mcp_inspector_telemetry_${e}`}function rf(){if(typeof window>`u`)return`standalone`;let e=window.__MCP_INSPECTOR_MODE__;return e===`standalone`||e===`embedded`||e===`cloud`?e:`standalone`}function af(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`}var of=class e{static instance=null;POSTHOG_PROXY_URL=`/inspector/api/tel/posthog`;SCARF_PROXY_URL=`/inspector/api/tel/scarf`;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_posthogClient=null;_scarfClient=null;_source=`inspector`;_mode=`standalone`;constructor(){let e=ef(),t=this.isTelemetryDisabled();if(this._source=this.getStoredSource()||`inspector`,this._mode=rf(),t)this._posthogClient=null,this._scarfClient=null;else if(!e)this._posthogClient=null,this._scarfClient=null;else{try{this._posthogClient=new tf(this.POSTHOG_PROXY_URL,3e3)}catch{this._posthogClient=null}try{this._scarfClient=new tf(this.SCARF_PROXY_URL,3e3)}catch{this._scarfClient=null}}}isTelemetryDisabled(){return!!(af()&&localStorage.getItem(nf(`disabled`))===`true`||typeof process<`u`&&{}?.MCP_USE_ANONYMIZED_TELEMETRY===`false`)}getStoredSource(){return af()?localStorage.getItem(nf(`source`)):null}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e,af()&&localStorage.setItem(nf(`source`),e)}getSource(){return this._source}getMode(){return this._mode}get userId(){if(this._currUserId)return this._currUserId;if(!ef())return this._currUserId=this.UNKNOWN_USER_ID,this._currUserId;try{if(!af())throw Error(`localStorage is not available or not functional`);let e=localStorage.getItem(nf(`user_id`));if(e)this._currUserId=e;else{let e=this.generateUserId();localStorage.setItem(nf(`user_id`),e),this._currUserId=e}this.trackPackageDownload({triggered_by:`user_id_property`}).catch(()=>{})}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}generateUserId(){let e=window.crypto;if(e){let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t).map(e=>e.toString(16).padStart(2,`0`)).join(``);return n.slice(0,8)+`-`+n.slice(8,12)+`-`+n.slice(12,16)+`-`+n.slice(16,20)+`-`+n.slice(20,32)}else return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}async capture(e){if(!(!this._posthogClient&&!this._scarfClient)){if(this._posthogClient)try{let t={event:e.name,user_id:this.userId,properties:{...e.properties,mcp_use_version:$d(),language:`typescript`,source:this._source,package:`inspector`,mode:this._mode}};await this._posthogClient.logEvent(t)}catch{}if(this._scarfClient)try{let t={};t.mcp_use_version=$d(),t.user_id=this.userId,t.event=e.name,t.language=`typescript`,t.source=this._source,t.package=`inspector`,t.mode=this._mode,await this._scarfClient.logEvent(t)}catch{}}}async trackPackageDownload(e){if(this._scarfClient&&ef())try{if(!af())throw Error(`localStorage is not available or not functional`);let t=$d(),n=!1,r=!1,i=localStorage.getItem(nf(`download_version`));if(i?t>i&&(n=!0,r=!1,localStorage.setItem(nf(`download_version`),t)):(n=!0,r=!0,localStorage.setItem(nf(`download_version`),t)),n){let n={...e||{}};n.mcp_use_version=t,n.user_id=this.userId,n.event=`package_download`,n.first_download=r,n.language=`typescript`,n.source=this._source,n.package=`inspector`,n.mode=this._mode,await this._scarfClient.logEvent(n)}}catch{}}async trackInspectorOpen(e){let t=new Ld(e);await this.capture(t)}},sf=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),cf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),lf=e=>{let t=cf(e);return t.charAt(0).toUpperCase()+t.slice(1)},uf=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),df=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},ff={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`},pf=(0,w.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,w.createElement)(`svg`,{ref:c,...ff,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:uf(`lucide`,i),...!a&&!df(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,w.createElement)(e,t)),...Array.isArray(a)?a:[a]])),mf=(e,t)=>{let n=(0,w.forwardRef)(({className:n,...r},i)=>(0,w.createElement)(pf,{ref:i,iconNode:t,className:uf(`lucide-${sf(lf(e))}`,`lucide-${e}`,n),...r}));return n.displayName=lf(e),n},hf=mf(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),gf=mf(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),_f=mf(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),vf=mf(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),yf=mf(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),bf=mf(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),xf=mf(`brush-cleaning`,[[`path`,{d:`m16 22-1-4`,key:`1ow2iv`}],[`path`,{d:`M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1`,key:`11gii7`}],[`path`,{d:`M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z`,key:`bju7h4`}],[`path`,{d:`m8 22 1-4`,key:`s3unb`}]]),Sf=mf(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),Cf=mf(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),wf=mf(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Tf=mf(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ef=mf(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Df=mf(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Of=mf(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),kf=mf(`chevrons-left-right-ellipsis`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`m17 7 5 5-5 5`,key:`1xlxn0`}],[`path`,{d:`m7 7-5 5 5 5`,key:`19njba`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}]]),Af=mf(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),jf=mf(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Mf=mf(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),Nf=mf(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Pf=mf(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ff=mf(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),If=mf(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Lf=mf(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Rf=mf(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),zf=mf(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Bf=mf(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Vf=mf(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Hf=mf(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Uf=mf(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Wf=mf(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Gf=mf(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Kf=mf(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),qf=mf(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Jf=mf(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Yf=mf(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Xf=mf(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Zf=mf(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Qf=mf(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),$f=mf(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ep=mf(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),tp=mf(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),np=mf(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),rp=mf(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ip=mf(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ap=mf(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),op=mf(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),sp=mf(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),cp=mf(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),lp=mf(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),up=mf(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),dp=mf(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),fp=mf(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),pp=mf(`picture-in-picture`,[[`path`,{d:`M2 10h6V4`,key:`zwrco`}],[`path`,{d:`m2 4 6 6`,key:`ug085t`}],[`path`,{d:`M21 10V7a2 2 0 0 0-2-2h-7`,key:`git5jr`}],[`path`,{d:`M3 14v2a2 2 0 0 0 2 2h3`,key:`1f7fh3`}],[`rect`,{x:`12`,y:`14`,width:`10`,height:`7`,rx:`1`,key:`1wjs3o`}]]),mp=mf(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),hp=mf(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),gp=mf(`pointer`,[[`path`,{d:`M22 14a8 8 0 0 1-8 8`,key:`56vcr3`}],[`path`,{d:`M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1agjmk`}],[`path`,{d:`M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1`,key:`wdbh2u`}],[`path`,{d:`M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10`,key:`1ibuk9`}],[`path`,{d:`M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`g6ys72`}]]),_p=mf(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),vp=mf(`rocket`,[[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z`,key:`m3kijz`}],[`path`,{d:`m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z`,key:`1fmvmk`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0`,key:`1f8sc4`}],[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}]]),yp=mf(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),bp=mf(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),xp=mf(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Sp=mf(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Cp=mf(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),wp=mf(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Tp=mf(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ep=mf(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Dp=mf(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Op=mf(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),kp=mf(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Ap=mf(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),jp=mf(`square-dashed-mouse-pointer`,[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h2`,key:`1qve2z`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v2`,key:`p14lih`}],[`path`,{d:`M3 14v1`,key:`vnatye`}]]),Mp=mf(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Np=mf(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Pp=mf(`sun-dim`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 4h.01`,key:`1ujb9j`}],[`path`,{d:`M20 12h.01`,key:`1ykeid`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M4 12h.01`,key:`158zrr`}],[`path`,{d:`M17.657 6.343h.01`,key:`31pqzk`}],[`path`,{d:`M17.657 17.657h.01`,key:`jehnf4`}],[`path`,{d:`M6.343 17.657h.01`,key:`gdk6ow`}],[`path`,{d:`M6.343 6.343h.01`,key:`1uurf0`}]]),Fp=mf(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Ip=mf(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),Lp=mf(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Rp=mf(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),zp=mf(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Bp=mf(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Vp=mf(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Hp=mf(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Up=Object.freeze({status:`aborted`});function W(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Wp=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Gp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Kp={};function qp(e){return e&&Object.assign(Kp,e),Kp}function Jp(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Yp(e,t){return typeof t==`bigint`?t.toString():t}function Xp(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Zp(e){return e==null}function Qp(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function nee(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var $p=Symbol(`evaluating`);function em(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==$p)return r===void 0&&(r=$p,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function tm(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function nm(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function rm(e){return JSON.stringify(e)}function ree(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var iee=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function im(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var aee=Xp(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function am(e){if(im(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(im(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function oee(e){return am(e)?{...e}:Array.isArray(e)?[...e]:e}var see=new Set([`string`,`number`,`symbol`]);function om(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function sm(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function cm(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function cee(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var lee={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function uee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return sm(e,nm(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return tm(this,`shape`,e),e},checks:[]}))}function dee(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return sm(e,nm(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return tm(this,`shape`,r),r},checks:[]}))}function fee(e,t){if(!am(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return sm(e,nm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return tm(this,`shape`,n),n}}))}function pee(e,t){if(!am(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return sm(e,nm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return tm(this,`shape`,n),n}}))}function mee(e,t){return sm(e,nm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return tm(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function hee(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return sm(t,nm(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return tm(this,`shape`,i),i},checks:[]}))}function gee(e,t,n){return sm(t,nm(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return tm(this,`shape`,i),i}}))}function lm(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function um(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function dm(e){return typeof e==`string`?e:e?.message}function fm(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=dm(e.inst?._zod.def?.error?.(e))??dm(t?.error?.(e))??dm(n.customError?.(e))??dm(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function pm(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function mm(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var hm=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Yp,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},gm=W(`$ZodError`,hm),_m=W(`$ZodError`,hm,{Parent:Error});function _ee(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function vee(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var vm=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Wp;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>fm(e,a,qp())));throw iee(t,i?.callee),t}return o.value},ym=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>fm(e,a,qp())));throw iee(t,i?.callee),t}return o.value},bm=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Wp;return a.issues.length?{success:!1,error:new(e??gm)(a.issues.map(e=>fm(e,i,qp())))}:{success:!0,data:a.value}},yee=bm(_m),xm=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>fm(e,i,qp())))}:{success:!0,data:a.value}},bee=xm(_m),xee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return vm(e)(t,n,i)},See=e=>(t,n,r)=>vm(e)(t,n,r),Cee=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ym(e)(t,n,i)},wee=e=>async(t,n,r)=>ym(e)(t,n,r),Tee=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return bm(e)(t,n,i)},Eee=e=>(t,n,r)=>bm(e)(t,n,r),Dee=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return xm(e)(t,n,i)},Oee=e=>async(t,n,r)=>xm(e)(t,n,r),kee=/^[cC][^\s-]{8,}$/,Aee=/^[0-9a-z]+$/,jee=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Mee=/^[0-9a-vA-V]{20}$/,Nee=/^[A-Za-z0-9]{27}$/,Pee=/^[a-zA-Z0-9_-]{21}$/,Fee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Iee=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Sm=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Lee=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ree=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function zee(){return new RegExp(Ree,`u`)}var Bee=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Vee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Hee=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Uee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cm=/^[A-Za-z0-9_-]*$/,Gee=/^\+[1-9]\d{6,14}$/,wm=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Kee=RegExp(`^${wm}$`);function Tm(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function qee(e){return RegExp(`^${Tm(e)}$`)}function Jee(e){let t=Tm({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${wm}T(?:${r})$`)}var Yee=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Xee=/^-?\d+$/,Em=/^-?\d+(?:\.\d+)?$/,Zee=/^(?:true|false)$/i,Qee=/^null$/i,$ee=/^[^A-Z]*$/,ete=/^[^a-z]*$/,Dm=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Om={number:`number`,bigint:`bigint`,object:`date`},km=W(`$ZodCheckLessThan`,(e,t)=>{Dm.init(e,t);let n=Om[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Am=W(`$ZodCheckGreaterThan`,(e,t)=>{Dm.init(e,t);let n=Om[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tte=W(`$ZodCheckMultipleOf`,(e,t)=>{Dm.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):nee(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),nte=W(`$ZodCheckNumberFormat`,(e,t)=>{Dm.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=lee[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Xee)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),rte=W(`$ZodCheckMaxLength`,(e,t)=>{var n;Dm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=pm(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ite=W(`$ZodCheckMinLength`,(e,t)=>{var n;Dm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=pm(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ate=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;Dm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zp(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=pm(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),jm=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Dm.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ote=W(`$ZodCheckRegex`,(e,t)=>{jm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ste=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$ee,jm.init(e,t)}),cte=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ete,jm.init(e,t)}),lte=W(`$ZodCheckIncludes`,(e,t)=>{Dm.init(e,t);let n=om(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ute=W(`$ZodCheckStartsWith`,(e,t)=>{Dm.init(e,t);let n=RegExp(`^${om(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),dte=W(`$ZodCheckEndsWith`,(e,t)=>{Dm.init(e,t);let n=RegExp(`.*${om(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),fte=W(`$ZodCheckOverwrite`,(e,t)=>{Dm.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),pte=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
341
341
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
342
342
  `))}},mte={major:4,minor:3,patch:5},Mm=W(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=mte;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=lm(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Wp;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=lm(e,t))});else{if(e.issues.length===t)continue;r||=lm(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(lm(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Wp;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Wp;return o.then(e=>t(e,r,a))}return t(o,r,a)}}em(e,`~standard`,()=>({validate:t=>{try{let n=yee(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return bee(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Nm=W(`$ZodString`,(e,t)=>{Mm.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Yee(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Pm=W(`$ZodStringFormat`,(e,t)=>{jm.init(e,t),Nm.init(e,t)}),hte=W(`$ZodGUID`,(e,t)=>{t.pattern??=Iee,Pm.init(e,t)}),gte=W(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Sm(e)}else t.pattern??=Sm();Pm.init(e,t)}),_te=W(`$ZodEmail`,(e,t)=>{t.pattern??=Lee,Pm.init(e,t)}),vte=W(`$ZodURL`,(e,t)=>{Pm.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),yte=W(`$ZodEmoji`,(e,t)=>{t.pattern??=zee(),Pm.init(e,t)}),bte=W(`$ZodNanoID`,(e,t)=>{t.pattern??=Pee,Pm.init(e,t)}),xte=W(`$ZodCUID`,(e,t)=>{t.pattern??=kee,Pm.init(e,t)}),Ste=W(`$ZodCUID2`,(e,t)=>{t.pattern??=Aee,Pm.init(e,t)}),Cte=W(`$ZodULID`,(e,t)=>{t.pattern??=jee,Pm.init(e,t)}),wte=W(`$ZodXID`,(e,t)=>{t.pattern??=Mee,Pm.init(e,t)}),Tte=W(`$ZodKSUID`,(e,t)=>{t.pattern??=Nee,Pm.init(e,t)}),Ete=W(`$ZodISODateTime`,(e,t)=>{t.pattern??=Jee(t),Pm.init(e,t)}),Dte=W(`$ZodISODate`,(e,t)=>{t.pattern??=Kee,Pm.init(e,t)}),Ote=W(`$ZodISOTime`,(e,t)=>{t.pattern??=qee(t),Pm.init(e,t)}),kte=W(`$ZodISODuration`,(e,t)=>{t.pattern??=Fee,Pm.init(e,t)}),Ate=W(`$ZodIPv4`,(e,t)=>{t.pattern??=Bee,Pm.init(e,t),e._zod.bag.format=`ipv4`}),jte=W(`$ZodIPv6`,(e,t)=>{t.pattern??=Vee,Pm.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Mte=W(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Hee,Pm.init(e,t)}),Nte=W(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Uee,Pm.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Fm(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Pte=W(`$ZodBase64`,(e,t)=>{t.pattern??=Wee,Pm.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Fm(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Fte(e){if(!Cm.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Fm(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ite=W(`$ZodBase64URL`,(e,t)=>{t.pattern??=Cm,Pm.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Fte(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Lte=W(`$ZodE164`,(e,t)=>{t.pattern??=Gee,Pm.init(e,t)});function Rte(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var zte=W(`$ZodJWT`,(e,t)=>{Pm.init(e,t),e._zod.check=n=>{Rte(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Im=W(`$ZodNumber`,(e,t)=>{Mm.init(e,t),e._zod.pattern=e._zod.bag.pattern??Em,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Bte=W(`$ZodNumberFormat`,(e,t)=>{nte.init(e,t),Im.init(e,t)}),Vte=W(`$ZodBoolean`,(e,t)=>{Mm.init(e,t),e._zod.pattern=Zee,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Hte=W(`$ZodNull`,(e,t)=>{Mm.init(e,t),e._zod.pattern=Qee,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Ute=W(`$ZodAny`,(e,t)=>{Mm.init(e,t),e._zod.parse=e=>e}),Wte=W(`$ZodUnknown`,(e,t)=>{Mm.init(e,t),e._zod.parse=e=>e}),Gte=W(`$ZodNever`,(e,t)=>{Mm.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Lm(e,t,n){e.issues.length&&t.issues.push(...um(n,e.issues)),t.value[n]=e.value}var Kte=W(`$ZodArray`,(e,t)=>{Mm.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Lm(t,n,e))):Lm(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Rm(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...um(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function zm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=cee(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Bm(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Rm(e,n,i,t,u))):Rm(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var qte=W(`$ZodObject`,(e,t)=>{if(Mm.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Xp(()=>zm(t));em(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=im,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Rm(n,t,e,s,r))):Rm(i,t,e,s,r)}return i?Bm(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Jte=W(`$ZodObjectJIT`,(e,t)=>{qte.init(e,t);let n=e._zod.parse,r=Xp(()=>zm(t)),i=e=>{let t=new pte([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=rm(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=rm(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
343
343
  if (${n}.issues.length) {
@@ -435,7 +435,7 @@ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Rec
435
435
  for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);K.object({method:K.literal(`ui/open-link`),params:K.object({url:K.string().describe(`URL to open in the host's browser`)})}),K.object({isError:K.boolean().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),K.object({isError:K.boolean().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough(),K.object({method:K.literal(`ui/notifications/sandbox-proxy-ready`),params:K.object({})});var lO=K.object({connectDomains:K.array(K.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).`),resourceDomains:K.array(K.string()).optional().describe(`Origins for static resources (scripts, images, styles, fonts).`),frameDomains:K.array(K.string()).optional().describe(`Origins for nested iframes (frame-src directive).`),baseUriDomains:K.array(K.string()).optional().describe(`Allowed base URIs for the document (base-uri directive).`)}),uO=K.object({camera:K.object({}).optional().describe("Request camera access (Permission Policy `camera` feature)."),microphone:K.object({}).optional().describe("Request microphone access (Permission Policy `microphone` feature)."),geolocation:K.object({}).optional().describe("Request geolocation access (Permission Policy `geolocation` feature)."),clipboardWrite:K.object({}).optional().describe("Request clipboard write access (Permission Policy `clipboard-write` feature).")});K.object({method:K.literal(`ui/notifications/size-changed`),params:K.object({width:K.number().optional().describe(`New width in pixels.`),height:K.number().optional().describe(`New height in pixels.`)})}),K.object({method:K.literal(`ui/notifications/tool-input`),params:K.object({arguments:K.record(K.string(),K.unknown().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),K.object({method:K.literal(`ui/notifications/tool-input-partial`),params:K.object({arguments:K.record(K.string(),K.unknown().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),K.object({method:K.literal(`ui/notifications/tool-cancelled`),params:K.object({reason:K.string().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})});var Xle=K.object({fonts:K.string().optional()}),Zle=K.object({variables:Yle.optional().describe(`CSS variables for theming the app.`),css:Xle.optional().describe(`CSS blocks that apps can inject.`)});K.object({method:K.literal(`ui/resource-teardown`),params:K.object({})}),K.record(K.string(),K.unknown());var dO=K.object({text:K.object({}).optional().describe(`Host supports text content blocks.`),image:K.object({}).optional().describe(`Host supports image content blocks.`),audio:K.object({}).optional().describe(`Host supports audio content blocks.`),resource:K.object({}).optional().describe(`Host supports resource content blocks.`),resourceLink:K.object({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:K.object({}).optional().describe(`Host supports structured content.`)}),Qle=K.object({experimental:K.object({}).optional().describe(`Experimental features (structure TBD).`),openLinks:K.object({}).optional().describe(`Host supports opening external URLs.`),serverTools:K.object({listChanged:K.boolean().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:K.object({listChanged:K.boolean().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:K.object({}).optional().describe(`Host accepts log messages.`),sandbox:K.object({permissions:uO.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:lO.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:dO.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:dO.optional().describe(`Host supports receiving content messages (ui/message) from the view.`)}),$le=K.object({experimental:K.object({}).optional().describe(`Experimental features (structure TBD).`),tools:K.object({listChanged:K.boolean().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:K.array(cO).optional().describe(`Display modes the app supports.`)});K.object({method:K.literal(`ui/notifications/initialized`),params:K.object({}).optional()}),K.object({csp:lO.optional().describe(`Content Security Policy configuration.`),permissions:uO.optional().describe(`Sandbox permissions requested by the UI.`),domain:K.string().optional().describe(`Dedicated origin for view sandbox.`),prefersBorder:K.boolean().optional().describe(`Visual boundary preference - true if UI prefers a visible border.`)}),K.object({method:K.literal(`ui/request-display-mode`),params:K.object({mode:cO.describe(`The display mode being requested.`)})}),K.object({mode:cO.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough();var eue=K.union([K.literal(`model`),K.literal(`app`)]).describe(`Tool visibility scope - who can access the tool.`);K.object({resourceUri:K.string().optional(),visibility:K.array(eue).optional().describe(`Who can access this tool. Default: ["model", "app"]
436
436
  - "model": Tool visible to and callable by the agent
437
437
  - "app": Tool callable by the app from this server only`)}),K.object({mimeTypes:K.array(K.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),K.object({method:K.literal(`ui/message`),params:K.object({role:K.literal(`user`).describe(`Message role, currently only "user" is supported.`),content:K.array(r_).describe(`Message content blocks (text, image, etc.).`)})}),K.object({method:K.literal(`ui/notifications/sandbox-resource-ready`),params:K.object({html:K.string().describe(`HTML content to load into the inner iframe.`),sandbox:K.string().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:lO.optional().describe(`CSP configuration from resource metadata.`),permissions:uO.optional().describe(`Sandbox permissions from resource metadata.`)})}),K.object({method:K.literal(`ui/notifications/tool-result`),params:c_.describe(`Standard MCP tool execution result.`)});var fO=K.object({toolInfo:K.object({id:cg.optional().describe(`JSON-RPC id of the tools/call request.`),tool:o_.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:qle.optional().describe(`Current color theme preference.`),styles:Zle.optional().describe(`Style configuration for theming the app.`),displayMode:cO.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:K.array(cO).optional().describe(`Display modes the host supports.`),containerDimensions:K.union([K.object({height:K.number().describe(`Fixed container height in pixels.`)}),K.object({maxHeight:K.union([K.number(),K.undefined()]).optional().describe(`Maximum container height in pixels.`)})]).and(K.union([K.object({width:K.number().describe(`Fixed container width in pixels.`)}),K.object({maxWidth:K.union([K.number(),K.undefined()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
438
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:K.string().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:K.string().optional().describe(`User's timezone in IANA format.`),userAgent:K.string().optional().describe(`Host application identifier.`),platform:K.union([K.literal(`web`),K.literal(`desktop`),K.literal(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:K.object({touch:K.boolean().optional().describe(`Whether the device supports touch input.`),hover:K.boolean().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:K.object({top:K.number().describe(`Top safe area inset in pixels.`),right:K.number().describe(`Right safe area inset in pixels.`),bottom:K.number().describe(`Bottom safe area inset in pixels.`),left:K.number().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();K.object({method:K.literal(`ui/notifications/host-context-changed`),params:fO.describe(`Partial context update containing only changed fields.`)}),K.object({method:K.literal(`ui/update-model-context`),params:K.object({content:K.array(r_).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:K.record(K.string(),K.unknown().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),K.object({method:K.literal(`ui/initialize`),params:K.object({appInfo:xg.describe(`App identification (name and version).`),appCapabilities:$le.describe(`Features and capabilities this app provides.`),protocolVersion:K.string().describe(`Protocol version this app supports.`)})}),K.object({protocolVersion:K.string().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:xg.describe(`Host application identification and version.`),hostCapabilities:Qle.describe(`Features and capabilities provided by the host.`),hostContext:fO.describe(`Rich context about the host environment.`)}).passthrough();var tue=`text/html;profile=mcp-app`,nue=`modulepreload`,rue=function(e){return`/inspector/`+e},pO={},J=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=rue(t,n),t in pO)return;pO[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:nue,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},iue=`1.25.0`;function mO(){return iue}a(mO,`getPackageVersion`);var hO=class{static{a(this,`BaseTelemetryEvent`)}},aue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`MCPAgentExecutionEvent`)}get name(){return`mcp_agent_execution`}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}};function gO(e,t){let n=Array.from(e.registrations.tools.values()),r=Array.from(e.registrations.prompts.values()),i=Array.from(e.registrations.resources.values()),a=Array.from(e.registrations.resourceTemplates.values()),o=i.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,uri:e.config.uri??null,mime_type:e.config.mimeType??null})),s=o.filter(e=>e.mime_type===`text/html+skybridge`),c=o.filter(e=>e.mime_type===`text/uri-list`||e.mime_type===`text/html`),l=o.filter(e=>e.mime_type===tue);return{transport:t,toolsNumber:e.registeredTools.length,resourcesNumber:e.registeredResources.length,promptsNumber:e.registeredPrompts.length,auth:!!e.oauthProvider,name:e.config.name,description:e.config.description??null,baseUrl:e.serverBaseUrl??null,toolNames:e.registeredTools.length>0?e.registeredTools:null,resourceNames:e.registeredResources.length>0?e.registeredResources:null,promptNames:e.registeredPrompts.length>0?e.registeredPrompts:null,tools:n.length>0?n.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,input_schema:e.config.schema?JSON.stringify(e.config.schema):null,output_schema:e.config.outputSchema?JSON.stringify(e.config.outputSchema):null})):null,resources:o.length>0?o:null,prompts:r.length>0?r.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,args:e.config.args?JSON.stringify(e.config.args):null})):null,templates:a.length>0?a.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null})):null,capabilities:{logging:!0,resources:{subscribe:!0,listChanged:!0}},appsSdkResources:s.length>0?s:null,appsSdkResourcesNumber:s.length,mcpUiResources:c.length>0?c:null,mcpUiResourcesNumber:c.length,mcpAppsResources:l.length>0?l:null,mcpAppsResourcesNumber:l.length}}a(gO,`createServerRunEventData`);var oue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerRunEvent`)}get name(){return`server_run`}get properties(){return{transport:this.data.transport,tools_number:this.data.toolsNumber,resources_number:this.data.resourcesNumber,prompts_number:this.data.promptsNumber,auth:this.data.auth,name:this.data.name,description:this.data.description??null,base_url:this.data.baseUrl??null,tool_names:this.data.toolNames??null,resource_names:this.data.resourceNames??null,prompt_names:this.data.promptNames??null,tools:this.data.tools??null,resources:this.data.resources??null,prompts:this.data.prompts??null,templates:this.data.templates??null,capabilities:this.data.capabilities?JSON.stringify(this.data.capabilities):null,apps_sdk_resources:this.data.appsSdkResources?JSON.stringify(this.data.appsSdkResources):null,apps_sdk_resources_number:this.data.appsSdkResourcesNumber??0,mcp_ui_resources:this.data.mcpUiResources?JSON.stringify(this.data.mcpUiResources):null,mcp_ui_resources_number:this.data.mcpUiResourcesNumber??0,mcp_apps_resources:this.data.mcpAppsResources?JSON.stringify(this.data.mcpAppsResources):null,mcp_apps_resources_number:this.data.mcpAppsResourcesNumber??0}}},sue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerInitializeEvent`)}get name(){return`server_initialize_call`}get properties(){return{protocol_version:this.data.protocolVersion,client_info:JSON.stringify(this.data.clientInfo),client_capabilities:JSON.stringify(this.data.clientCapabilities),session_id:this.data.sessionId??null}}},cue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerToolCallEvent`)}get name(){return`server_tool_call`}get properties(){return{tool_name:this.data.toolName,length_input_argument:this.data.lengthInputArgument,success:this.data.success,error_type:this.data.errorType??null,execution_time_ms:this.data.executionTimeMs??null}}},lue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerResourceCallEvent`)}get name(){return`server_resource_call`}get properties(){return{name:this.data.name,description:this.data.description,contents:this.data.contents,success:this.data.success,error_type:this.data.errorType??null}}},uue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerPromptCallEvent`)}get name(){return`server_prompt_call`}get properties(){return{name:this.data.name,description:this.data.description,success:this.data.success,error_type:this.data.errorType??null}}},due=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerContextEvent`)}get name(){return`server_context_${this.data.contextType}`}get properties(){return{context_type:this.data.contextType,notification_type:this.data.notificationType??null}}},fue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`MCPClientInitEvent`)}get name(){return`mcpclient_init`}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},pue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ConnectorInitEvent`)}get name(){return`connector_init`}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},mue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ClientAddServerEvent`)}get name(){return`client_add_server`}get properties(){let{serverName:e,serverConfig:t}=this.data,n=t.url;return{server_name:e,server_url_domain:n?this._extractHostname(n):null,transport:t.transport??null,has_auth:!!(t.authToken||t.authProvider)}}_extractHostname(e){try{return new URL(e).hostname}catch{return null}}},hue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ClientRemoveServerEvent`)}get name(){return`client_remove_server`}get properties(){return{server_name:this.data.serverName}}};function _O(e){return e._llm_type||e.constructor.name.toLowerCase()}a(_O,`getModelProvider`);function vO(e){if(`_identifyingParams`in e){let t=e._identifyingParams;if(typeof t==`object`&&t){for(let e of[`model`,`modelName`,`model_name`,`modelId`,`model_id`,`deploymentName`,`deployment_name`])if(e in t)return String(t[e])}}return e.model||e.modelName||e.constructor.name}a(vO,`getModelName`);function gue(e){return[_O(e),vO(e)]}a(gue,`extractModelInfo`);function yO(){if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.randomUUID==`function`)return globalThis.crypto.randomUUID();if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16,20)}-${t.substring(20)}`}return`${Date.now()}-${Math.random().toString(36).substring(2,15)}-${Math.random().toString(36).substring(2,15)}`}a(yO,`generateUUID`);function bO(){if(typeof window<`u`&&window.crypto&&typeof window.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return window.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).substring(2,15)}a(bO,`secureRandomString`);var xO=`mcp_use_user_id`;function SO(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`&&typeof localStorage.removeItem==`function`}a(SO,`isLocalStorageFunctional`);function CO(){try{return typeof window<`u`&&typeof document<`u`?`browser`:`unknown`}catch{return`unknown`}}a(CO,`detectRuntimeEnvironment`);function wO(e){if(e===`browser`)try{if(SO())return localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`),`localStorage`}catch{}return`session-only`}a(wO,`getStorageCapability`);var TO=null;function EO(){return TO===null&&(TO=CO()),TO}a(EO,`getRuntimeEnvironment`);var DO=class e{static{a(this,`Telemetry`)}static instance=null;PROJECT_API_KEY=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`;HOST=`https://eu.i.posthog.com`;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_posthogBrowserClient=null;_posthogLoading=null;_runtimeEnvironment;_storageCapability;_source;constructor(){this._runtimeEnvironment=EO(),this._storageCapability=wO(this._runtimeEnvironment),this._source=this._getSourceFromLocalStorage()||this._runtimeEnvironment;let e=this._checkTelemetryDisabled(),t=this._runtimeEnvironment!==`unknown`;e?(this._posthogBrowserClient=null,l.debug(`Telemetry disabled via localStorage`)):t?(l.debug(`Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false in localStorage to disable.`),this._posthogLoading=this._initPostHogBrowser()):(this._posthogBrowserClient=null,l.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`))}_getSourceFromLocalStorage(){try{if(SO())return localStorage.getItem(`MCP_USE_TELEMETRY_SOURCE`)}catch{}return null}_checkTelemetryDisabled(){return!!(SO()&&localStorage.getItem(`MCP_USE_ANONYMIZED_TELEMETRY`)===`false`)}async _initPostHogBrowser(){try{let e=await J(()=>import(`./module-DjisYqbk.js`),[]),t=e.default||e.posthog;if(!t||typeof t.init!=`function`)throw Error(`posthog-js module did not export expected interface`);t.init(this.PROJECT_API_KEY,{api_host:this.HOST,persistence:`localStorage`,autocapture:!1,capture_pageview:!1,disable_session_recording:!0,loaded:a(()=>{l.debug(`PostHog browser client initialized`)},`loaded`)}),this._posthogBrowserClient=t}catch(e){l.warn(`Failed to initialize PostHog browser telemetry: ${e}`),this._posthogBrowserClient=null}}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e;try{SO()&&localStorage.setItem(`MCP_USE_TELEMETRY_SOURCE`,e)}catch{}l.debug(`Telemetry source set to: ${e}`)}getSource(){return this._source}get isEnabled(){return this._posthogBrowserClient!==null}get userId(){if(this._currUserId)return this._currUserId;try{switch(this._storageCapability){case`localStorage`:this._currUserId=this._getUserIdFromLocalStorage();break;default:try{this._currUserId=`session-${yO()}`}catch{this._currUserId=`session-${Date.now()}-${bO()}`}break}}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}_getUserIdFromLocalStorage(){try{if(!SO())throw Error(`localStorage is not available or not functional`);localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`);let e=localStorage.getItem(xO);if(!e){try{e=yO()}catch{e=`${Date.now()}-${bO()}`}localStorage.setItem(xO,e)}return e}catch(e){l.debug(`Failed to access localStorage for user ID: ${e}`);let t;try{t=`session-${yO()}`}catch{t=`session-${Date.now()}-${bO()}`}return t}}async capture(e){if(this._posthogLoading&&await this._posthogLoading,!this._posthogBrowserClient)return;let t=this.userId,n={...e.properties};if(n.mcp_use_version=mO(),n.language=`typescript`,n.source=this._source,n.runtime=this._runtimeEnvironment,this._posthogBrowserClient)try{this._posthogBrowserClient.capture(e.name,{...n,distinct_id:t})}catch(t){l.debug(`Failed to track PostHog Browser event ${e.name}: ${t}`)}}async trackAgentExecution(e){if(!this.isEnabled)return;let t=new aue(e);await this.capture(t)}async trackServerRunFromServer(e,t){if(!this.isEnabled)return;let n=new oue(gO(e,t));await this.capture(n)}async trackServerInitialize(e){if(!this.isEnabled)return;let t=new sue(e);await this.capture(t)}async trackServerToolCall(e){if(!this.isEnabled)return;let t=new cue(e);await this.capture(t)}async trackServerResourceCall(e){if(!this.isEnabled)return;let t=new lue(e);await this.capture(t)}async trackServerPromptCall(e){if(!this.isEnabled)return;let t=new uue(e);await this.capture(t)}async trackServerContext(e){if(!this.isEnabled)return;let t=new due(e);await this.capture(t)}async trackMCPClientInit(e){if(!this.isEnabled)return;let t=new fue(e);await this.capture(t)}async trackConnectorInit(e){if(!this.isEnabled)return;let t=new pue(e);await this.capture(t)}async trackClientAddServer(e,t){if(!this.isEnabled)return;let n=new mue({serverName:e,serverConfig:t});await this.capture(n)}async trackClientRemoveServer(e){if(!this.isEnabled)return;let t=new hue({serverName:e});await this.capture(t)}async trackUseMcpConnection(e){this.isEnabled&&await this.capture({name:`usemcp_connection`,properties:{url_domain:new URL(e.url).hostname,transport_type:e.transportType,success:e.success,error_type:e.errorType??null,connection_time_ms:e.connectionTimeMs??null,has_oauth:e.hasOAuth,has_sampling:e.hasSampling,has_elicitation:e.hasElicitation}})}async trackUseMcpToolCall(e){this.isEnabled&&await this.capture({name:`usemcp_tool_call`,properties:{tool_name:e.toolName,success:e.success,error_type:e.errorType??null,execution_time_ms:e.executionTimeMs??null}})}async trackUseMcpResourceRead(e){this.isEnabled&&await this.capture({name:`usemcp_resource_read`,properties:{resource_uri_scheme:e.resourceUri.split(`:`)[0],success:e.success,error_type:e.errorType??null}})}identify(e,t){if(this._posthogBrowserClient)try{this._posthogBrowserClient.identify(e,t)}catch(e){l.debug(`Failed to identify user: ${e}`)}}reset(){if(this._posthogBrowserClient)try{this._posthogBrowserClient.reset()}catch(e){l.debug(`Failed to reset user: ${e}`)}this._currUserId=null}flush(){}shutdown(){}async trackPackageDownload(e){}},OO=DO;function _ue(e){OO.getInstance().setSource(e)}a(_ue,`setTelemetrySource`);var vue=class{static{a(this,`BaseConnector`)}client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];constructor(e={}){let t={...e,onSampling:e.onSampling??e.samplingCallback,onElicitation:e.onElicitation??e.elicitationCallback};e.samplingCallback&&!e.onSampling&&l.warn(`[BaseConnector] The "samplingCallback" option is deprecated. Use "onSampling" instead.`),e.elicitationCallback&&!e.onElicitation&&console.warn(`[BaseConnector] The "elicitationCallback" option is deprecated. Use "onElicitation" instead.`),this.opts=t,t.roots&&(this.rootsCache=[...t.roots]),t.onNotification&&this.notificationHandlers.push(t.onNotification)}trackConnectorInit(e){let t=this.constructor.name;DO.getInstance().trackConnectorInit({connectorType:t,...e}).catch(e=>l.debug(`Failed to track connector init: ${e}`))}onNotification(e){this.notificationHandlers.push(e),this.client&&this.setupNotificationHandler()}setupNotificationHandler(){if(!this.client)return;let e=a(async e=>{for(let t of this.notificationHandlers)try{await t(e)}catch(e){l.error(`Error in notification handler:`,e)}},`forwardToUserHandlers`);this.client.fallbackNotificationHandler=async t=>{switch(t.method){case`notifications/tools/list_changed`:await this.refreshToolsCache();break;case`notifications/resources/list_changed`:await this.onResourcesListChanged();break;case`notifications/prompts/list_changed`:await this.onPromptsListChanged();break;default:break}await e(t)};let t=this.client._notificationHandlers;for(let n of[`notifications/progress`,`notifications/cancelled`]){let r=t.get(n);r&&t.set(n,async t=>{await r(t),await e(t)})}}async refreshToolsCache(){if(this.client)try{l.debug(`[Auto] Refreshing tools cache due to list_changed notification`),this.toolsCache=(await this.client.listTools()).tools??[],l.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(e){l.warn(`[Auto] Failed to refresh tools cache:`,e)}}async onResourcesListChanged(){l.debug(`[Auto] Resources list changed - clients should re-fetch if needed`)}async onPromptsListChanged(){l.debug(`[Auto] Prompts list changed - clients should re-fetch if needed`)}async setRoots(e){this.rootsCache=[...e],this.client&&(l.debug(`Sending roots/list_changed notification with ${e.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(b_,async(e,t)=>(l.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){l.debug(`setupSamplingHandler: No client available`);return}let e=this.opts.onSampling??this.opts.samplingCallback;if(!e){l.debug(`setupSamplingHandler: No sampling callback provided`);return}l.debug(`setupSamplingHandler: Setting up sampling request handler`),this.client.setRequestHandler(m_,async(t,n)=>(l.debug(`Server requested sampling, forwarding to callback`),await e(t.params))),l.debug(`setupSamplingHandler: Sampling handler registered successfully`)}setupElicitationHandler(){if(!this.client){l.debug(`setupElicitationHandler: No client available`);return}let e=this.opts.onElicitation??this.opts.elicitationCallback;if(!e){l.debug(`setupElicitationHandler: No elicitation callback provided`);return}l.debug(`setupElicitationHandler: Setting up elicitation request handler`),this.client.setRequestHandler(__,async(t,n)=>(l.debug(`Server requested elicitation, forwarding to callback`),await e(t.params))),l.debug(`setupElicitationHandler: Elicitation handler registered successfully`)}async disconnect(){if(!this.connected){l.debug(`Not connected to MCP implementation`);return}l.debug(`Disconnecting from MCP implementation`),await this.cleanupResources(),this.connected=!1,l.debug(`Disconnected from MCP implementation`)}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`Caching server capabilities & tools`);let t=this.client.getServerCapabilities();this.capabilitiesCache=t||null;let n=this.client.getServerVersion();this.serverInfoCache=n||null;try{this.toolsCache=(await this.client.listTools(void 0,e)).tools??[],l.debug(`Fetched ${this.toolsCache.length} tools from server`)}catch(e){let t=e;t.code===-32601?l.debug(`Server does not implement tools/list, assuming no tools`):l.debug(`Failed to list tools, assuming empty:`,t.message),this.toolsCache=[]}return l.debug(`Server capabilities:`,t),l.debug(`Server info:`,n),t}get tools(){if(!this.toolsCache)throw Error(`MCP client is not initialized; call initialize() first`);return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}async callTool(e,t,n){if(!this.client)throw Error(`MCP client is not connected`);let r=n?{...n}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},l.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)),l.debug(`Calling tool '${e}' with args`,t);let i=await this.client.callTool({name:e,arguments:t},void 0,r);return l.debug(`Tool '${e}' returned`,i),i}async listTools(e){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`[listTools] Fetching fresh tools from server...`);let t=await this.client.listTools(void 0,e),n=t.tools?[...t.tools]:[];return l.debug(`[listTools] Returned ${n.length} tools:`,n.map(e=>e.name)),n}async listResources(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Listing resources`,e?`with cursor: ${e}`:``),await this.client.listResources({cursor:e},t)}async listAllResources(e){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.resources)return l.debug(`Server does not advertise resources capability, skipping`),{resources:[]};try{l.debug(`Listing all resources (with auto-pagination)`);let t=[],n;do{let r=await this.client.listResources({cursor:n},e);t.push(...r.resources||[]),n=r.nextCursor}while(n);return{resources:t}}catch(e){if(e.code===-32601)return l.debug(`Server advertised resources but method not found`),{resources:[]};throw e}}async listResourceTemplates(e){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Listing resource templates`),await this.client.listResourceTemplates(void 0,e)}async complete(e,t){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`[complete] Requesting completions for:`,e.ref);let n=await this.client.complete(e,t);return l.debug(`[complete] Received ${n.completion.values.length} suggestions`),n}async readResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},t)}async subscribeToResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},t)}async unsubscribeFromResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},t)}async listPrompts(){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.prompts)return l.debug(`Server does not advertise prompts capability, skipping`),{prompts:[]};try{return l.debug(`Listing prompts`),await this.client.listPrompts()}catch(e){if(e.code===-32601)return l.debug(`Server advertised prompts but method not found`),{prompts:[]};throw e}}async getPrompt(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:t})}async request(e,t=null,n){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Sending raw request '${e}' with params`,t),await this.client.request({method:e,params:t??{}},void 0,n)}async cleanupResources(){let e=[];if(this.client)try{typeof this.client.close==`function`&&await this.client.close()}catch(t){let n=`Error closing client: ${t}`;l.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(t){let n=`Error stopping connection manager: ${t}`;l.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&l.warn(`Resource cleanup finished with ${e.length} issue(s)`)}},yue=class{static{a(this,`ConnectionManager`)}_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),l.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw Error(`Connection was not established`);return this._connection}async stop(){if(this._task&&this._abortController){l.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(e){e instanceof Error&&e.name===`AbortError`?l.debug(`${this.constructor.name} task aborted successfully`):l.warn(`Error stopping ${this.constructor.name} task: ${e}`)}}await this._donePromise,l.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(e=>this._readyResolver=e),this._donePromise=new Promise(e=>this._doneResolver=e),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){l.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),l.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(e){this._exception=e,l.error(`Error in ${this.constructor.name} task: ${e}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(e){l.warn(`Error closing connection in ${this.constructor.name}: ${e}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((e,t)=>{if(!this._abortController)return;let n=this._abortController.signal;if(n.aborted){e();return}let r=a(()=>{n.removeEventListener(`abort`,r),e()},`onAbort`);n.addEventListener(`abort`,r)})}},kO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),AO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=kO(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),jO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=kO(),n=AO(),r=kO();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=AO();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
438
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:K.string().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:K.string().optional().describe(`User's timezone in IANA format.`),userAgent:K.string().optional().describe(`Host application identifier.`),platform:K.union([K.literal(`web`),K.literal(`desktop`),K.literal(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:K.object({touch:K.boolean().optional().describe(`Whether the device supports touch input.`),hover:K.boolean().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:K.object({top:K.number().describe(`Top safe area inset in pixels.`),right:K.number().describe(`Right safe area inset in pixels.`),bottom:K.number().describe(`Bottom safe area inset in pixels.`),left:K.number().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();K.object({method:K.literal(`ui/notifications/host-context-changed`),params:fO.describe(`Partial context update containing only changed fields.`)}),K.object({method:K.literal(`ui/update-model-context`),params:K.object({content:K.array(r_).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:K.record(K.string(),K.unknown().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),K.object({method:K.literal(`ui/initialize`),params:K.object({appInfo:xg.describe(`App identification (name and version).`),appCapabilities:$le.describe(`Features and capabilities this app provides.`),protocolVersion:K.string().describe(`Protocol version this app supports.`)})}),K.object({protocolVersion:K.string().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:xg.describe(`Host application identification and version.`),hostCapabilities:Qle.describe(`Features and capabilities provided by the host.`),hostContext:fO.describe(`Rich context about the host environment.`)}).passthrough();var tue=`text/html;profile=mcp-app`,nue=`modulepreload`,rue=function(e){return`/inspector/`+e},pO={},J=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=rue(t,n),t in pO)return;pO[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:nue,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},iue=`1.25.1-canary.0`;function mO(){return iue}a(mO,`getPackageVersion`);var hO=class{static{a(this,`BaseTelemetryEvent`)}},aue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`MCPAgentExecutionEvent`)}get name(){return`mcp_agent_execution`}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}};function gO(e,t){let n=Array.from(e.registrations.tools.values()),r=Array.from(e.registrations.prompts.values()),i=Array.from(e.registrations.resources.values()),a=Array.from(e.registrations.resourceTemplates.values()),o=i.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,uri:e.config.uri??null,mime_type:e.config.mimeType??null})),s=o.filter(e=>e.mime_type===`text/html+skybridge`),c=o.filter(e=>e.mime_type===`text/uri-list`||e.mime_type===`text/html`),l=o.filter(e=>e.mime_type===tue);return{transport:t,toolsNumber:e.registeredTools.length,resourcesNumber:e.registeredResources.length,promptsNumber:e.registeredPrompts.length,auth:!!e.oauthProvider,name:e.config.name,description:e.config.description??null,baseUrl:e.serverBaseUrl??null,toolNames:e.registeredTools.length>0?e.registeredTools:null,resourceNames:e.registeredResources.length>0?e.registeredResources:null,promptNames:e.registeredPrompts.length>0?e.registeredPrompts:null,tools:n.length>0?n.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,input_schema:e.config.schema?JSON.stringify(e.config.schema):null,output_schema:e.config.outputSchema?JSON.stringify(e.config.outputSchema):null})):null,resources:o.length>0?o:null,prompts:r.length>0?r.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,args:e.config.args?JSON.stringify(e.config.args):null})):null,templates:a.length>0?a.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null})):null,capabilities:{logging:!0,resources:{subscribe:!0,listChanged:!0}},appsSdkResources:s.length>0?s:null,appsSdkResourcesNumber:s.length,mcpUiResources:c.length>0?c:null,mcpUiResourcesNumber:c.length,mcpAppsResources:l.length>0?l:null,mcpAppsResourcesNumber:l.length}}a(gO,`createServerRunEventData`);var oue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerRunEvent`)}get name(){return`server_run`}get properties(){return{transport:this.data.transport,tools_number:this.data.toolsNumber,resources_number:this.data.resourcesNumber,prompts_number:this.data.promptsNumber,auth:this.data.auth,name:this.data.name,description:this.data.description??null,base_url:this.data.baseUrl??null,tool_names:this.data.toolNames??null,resource_names:this.data.resourceNames??null,prompt_names:this.data.promptNames??null,tools:this.data.tools??null,resources:this.data.resources??null,prompts:this.data.prompts??null,templates:this.data.templates??null,capabilities:this.data.capabilities?JSON.stringify(this.data.capabilities):null,apps_sdk_resources:this.data.appsSdkResources?JSON.stringify(this.data.appsSdkResources):null,apps_sdk_resources_number:this.data.appsSdkResourcesNumber??0,mcp_ui_resources:this.data.mcpUiResources?JSON.stringify(this.data.mcpUiResources):null,mcp_ui_resources_number:this.data.mcpUiResourcesNumber??0,mcp_apps_resources:this.data.mcpAppsResources?JSON.stringify(this.data.mcpAppsResources):null,mcp_apps_resources_number:this.data.mcpAppsResourcesNumber??0}}},sue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerInitializeEvent`)}get name(){return`server_initialize_call`}get properties(){return{protocol_version:this.data.protocolVersion,client_info:JSON.stringify(this.data.clientInfo),client_capabilities:JSON.stringify(this.data.clientCapabilities),session_id:this.data.sessionId??null}}},cue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerToolCallEvent`)}get name(){return`server_tool_call`}get properties(){return{tool_name:this.data.toolName,length_input_argument:this.data.lengthInputArgument,success:this.data.success,error_type:this.data.errorType??null,execution_time_ms:this.data.executionTimeMs??null}}},lue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerResourceCallEvent`)}get name(){return`server_resource_call`}get properties(){return{name:this.data.name,description:this.data.description,contents:this.data.contents,success:this.data.success,error_type:this.data.errorType??null}}},uue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerPromptCallEvent`)}get name(){return`server_prompt_call`}get properties(){return{name:this.data.name,description:this.data.description,success:this.data.success,error_type:this.data.errorType??null}}},due=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ServerContextEvent`)}get name(){return`server_context_${this.data.contextType}`}get properties(){return{context_type:this.data.contextType,notification_type:this.data.notificationType??null}}},fue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`MCPClientInitEvent`)}get name(){return`mcpclient_init`}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},pue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ConnectorInitEvent`)}get name(){return`connector_init`}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},mue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ClientAddServerEvent`)}get name(){return`client_add_server`}get properties(){let{serverName:e,serverConfig:t}=this.data,n=t.url;return{server_name:e,server_url_domain:n?this._extractHostname(n):null,transport:t.transport??null,has_auth:!!(t.authToken||t.authProvider)}}_extractHostname(e){try{return new URL(e).hostname}catch{return null}}},hue=class extends hO{constructor(e){super(),this.data=e}static{a(this,`ClientRemoveServerEvent`)}get name(){return`client_remove_server`}get properties(){return{server_name:this.data.serverName}}};function _O(e){return e._llm_type||e.constructor.name.toLowerCase()}a(_O,`getModelProvider`);function vO(e){if(`_identifyingParams`in e){let t=e._identifyingParams;if(typeof t==`object`&&t){for(let e of[`model`,`modelName`,`model_name`,`modelId`,`model_id`,`deploymentName`,`deployment_name`])if(e in t)return String(t[e])}}return e.model||e.modelName||e.constructor.name}a(vO,`getModelName`);function gue(e){return[_O(e),vO(e)]}a(gue,`extractModelInfo`);function yO(){if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.randomUUID==`function`)return globalThis.crypto.randomUUID();if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16,20)}-${t.substring(20)}`}return`${Date.now()}-${Math.random().toString(36).substring(2,15)}-${Math.random().toString(36).substring(2,15)}`}a(yO,`generateUUID`);function bO(){if(typeof window<`u`&&window.crypto&&typeof window.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return window.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).substring(2,15)}a(bO,`secureRandomString`);var xO=`mcp_use_user_id`;function SO(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`&&typeof localStorage.removeItem==`function`}a(SO,`isLocalStorageFunctional`);function CO(){try{return typeof window<`u`&&typeof document<`u`?`browser`:`unknown`}catch{return`unknown`}}a(CO,`detectRuntimeEnvironment`);function wO(e){if(e===`browser`)try{if(SO())return localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`),`localStorage`}catch{}return`session-only`}a(wO,`getStorageCapability`);var TO=null;function EO(){return TO===null&&(TO=CO()),TO}a(EO,`getRuntimeEnvironment`);var DO=class e{static{a(this,`Telemetry`)}static instance=null;PROJECT_API_KEY=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`;HOST=`https://eu.i.posthog.com`;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_posthogBrowserClient=null;_posthogLoading=null;_runtimeEnvironment;_storageCapability;_source;constructor(){this._runtimeEnvironment=EO(),this._storageCapability=wO(this._runtimeEnvironment),this._source=this._getSourceFromLocalStorage()||this._runtimeEnvironment;let e=this._checkTelemetryDisabled(),t=this._runtimeEnvironment!==`unknown`;e?(this._posthogBrowserClient=null,l.debug(`Telemetry disabled via localStorage`)):t?(l.debug(`Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false in localStorage to disable.`),this._posthogLoading=this._initPostHogBrowser()):(this._posthogBrowserClient=null,l.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`))}_getSourceFromLocalStorage(){try{if(SO())return localStorage.getItem(`MCP_USE_TELEMETRY_SOURCE`)}catch{}return null}_checkTelemetryDisabled(){return!!(SO()&&localStorage.getItem(`MCP_USE_ANONYMIZED_TELEMETRY`)===`false`)}async _initPostHogBrowser(){try{let e=await J(()=>import(`./module-DjisYqbk.js`),[]),t=e.default||e.posthog;if(!t||typeof t.init!=`function`)throw Error(`posthog-js module did not export expected interface`);t.init(this.PROJECT_API_KEY,{api_host:this.HOST,persistence:`localStorage`,autocapture:!1,capture_pageview:!1,disable_session_recording:!0,loaded:a(()=>{l.debug(`PostHog browser client initialized`)},`loaded`)}),this._posthogBrowserClient=t}catch(e){l.warn(`Failed to initialize PostHog browser telemetry: ${e}`),this._posthogBrowserClient=null}}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e;try{SO()&&localStorage.setItem(`MCP_USE_TELEMETRY_SOURCE`,e)}catch{}l.debug(`Telemetry source set to: ${e}`)}getSource(){return this._source}get isEnabled(){return this._posthogBrowserClient!==null}get userId(){if(this._currUserId)return this._currUserId;try{switch(this._storageCapability){case`localStorage`:this._currUserId=this._getUserIdFromLocalStorage();break;default:try{this._currUserId=`session-${yO()}`}catch{this._currUserId=`session-${Date.now()}-${bO()}`}break}}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}_getUserIdFromLocalStorage(){try{if(!SO())throw Error(`localStorage is not available or not functional`);localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`);let e=localStorage.getItem(xO);if(!e){try{e=yO()}catch{e=`${Date.now()}-${bO()}`}localStorage.setItem(xO,e)}return e}catch(e){l.debug(`Failed to access localStorage for user ID: ${e}`);let t;try{t=`session-${yO()}`}catch{t=`session-${Date.now()}-${bO()}`}return t}}async capture(e){if(this._posthogLoading&&await this._posthogLoading,!this._posthogBrowserClient)return;let t=this.userId,n={...e.properties};if(n.mcp_use_version=mO(),n.language=`typescript`,n.source=this._source,n.runtime=this._runtimeEnvironment,this._posthogBrowserClient)try{this._posthogBrowserClient.capture(e.name,{...n,distinct_id:t})}catch(t){l.debug(`Failed to track PostHog Browser event ${e.name}: ${t}`)}}async trackAgentExecution(e){if(!this.isEnabled)return;let t=new aue(e);await this.capture(t)}async trackServerRunFromServer(e,t){if(!this.isEnabled)return;let n=new oue(gO(e,t));await this.capture(n)}async trackServerInitialize(e){if(!this.isEnabled)return;let t=new sue(e);await this.capture(t)}async trackServerToolCall(e){if(!this.isEnabled)return;let t=new cue(e);await this.capture(t)}async trackServerResourceCall(e){if(!this.isEnabled)return;let t=new lue(e);await this.capture(t)}async trackServerPromptCall(e){if(!this.isEnabled)return;let t=new uue(e);await this.capture(t)}async trackServerContext(e){if(!this.isEnabled)return;let t=new due(e);await this.capture(t)}async trackMCPClientInit(e){if(!this.isEnabled)return;let t=new fue(e);await this.capture(t)}async trackConnectorInit(e){if(!this.isEnabled)return;let t=new pue(e);await this.capture(t)}async trackClientAddServer(e,t){if(!this.isEnabled)return;let n=new mue({serverName:e,serverConfig:t});await this.capture(n)}async trackClientRemoveServer(e){if(!this.isEnabled)return;let t=new hue({serverName:e});await this.capture(t)}async trackUseMcpConnection(e){this.isEnabled&&await this.capture({name:`usemcp_connection`,properties:{url_domain:new URL(e.url).hostname,transport_type:e.transportType,success:e.success,error_type:e.errorType??null,connection_time_ms:e.connectionTimeMs??null,has_oauth:e.hasOAuth,has_sampling:e.hasSampling,has_elicitation:e.hasElicitation}})}async trackUseMcpToolCall(e){this.isEnabled&&await this.capture({name:`usemcp_tool_call`,properties:{tool_name:e.toolName,success:e.success,error_type:e.errorType??null,execution_time_ms:e.executionTimeMs??null}})}async trackUseMcpResourceRead(e){this.isEnabled&&await this.capture({name:`usemcp_resource_read`,properties:{resource_uri_scheme:e.resourceUri.split(`:`)[0],success:e.success,error_type:e.errorType??null}})}identify(e,t){if(this._posthogBrowserClient)try{this._posthogBrowserClient.identify(e,t)}catch(e){l.debug(`Failed to identify user: ${e}`)}}reset(){if(this._posthogBrowserClient)try{this._posthogBrowserClient.reset()}catch(e){l.debug(`Failed to reset user: ${e}`)}this._currUserId=null}flush(){}shutdown(){}async trackPackageDownload(e){}},OO=DO;function _ue(e){OO.getInstance().setSource(e)}a(_ue,`setTelemetrySource`);var vue=class{static{a(this,`BaseConnector`)}client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];constructor(e={}){let t={...e,onSampling:e.onSampling??e.samplingCallback,onElicitation:e.onElicitation??e.elicitationCallback};e.samplingCallback&&!e.onSampling&&l.warn(`[BaseConnector] The "samplingCallback" option is deprecated. Use "onSampling" instead.`),e.elicitationCallback&&!e.onElicitation&&console.warn(`[BaseConnector] The "elicitationCallback" option is deprecated. Use "onElicitation" instead.`),this.opts=t,t.roots&&(this.rootsCache=[...t.roots]),t.onNotification&&this.notificationHandlers.push(t.onNotification)}trackConnectorInit(e){let t=this.constructor.name;DO.getInstance().trackConnectorInit({connectorType:t,...e}).catch(e=>l.debug(`Failed to track connector init: ${e}`))}onNotification(e){this.notificationHandlers.push(e),this.client&&this.setupNotificationHandler()}setupNotificationHandler(){if(!this.client)return;let e=a(async e=>{for(let t of this.notificationHandlers)try{await t(e)}catch(e){l.error(`Error in notification handler:`,e)}},`forwardToUserHandlers`);this.client.fallbackNotificationHandler=async t=>{switch(t.method){case`notifications/tools/list_changed`:await this.refreshToolsCache();break;case`notifications/resources/list_changed`:await this.onResourcesListChanged();break;case`notifications/prompts/list_changed`:await this.onPromptsListChanged();break;default:break}await e(t)};let t=this.client._notificationHandlers;for(let n of[`notifications/progress`,`notifications/cancelled`]){let r=t.get(n);r&&t.set(n,async t=>{await r(t),await e(t)})}}async refreshToolsCache(){if(this.client)try{l.debug(`[Auto] Refreshing tools cache due to list_changed notification`),this.toolsCache=(await this.client.listTools()).tools??[],l.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(e){l.warn(`[Auto] Failed to refresh tools cache:`,e)}}async onResourcesListChanged(){l.debug(`[Auto] Resources list changed - clients should re-fetch if needed`)}async onPromptsListChanged(){l.debug(`[Auto] Prompts list changed - clients should re-fetch if needed`)}async setRoots(e){this.rootsCache=[...e],this.client&&(l.debug(`Sending roots/list_changed notification with ${e.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(b_,async(e,t)=>(l.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){l.debug(`setupSamplingHandler: No client available`);return}let e=this.opts.onSampling??this.opts.samplingCallback;if(!e){l.debug(`setupSamplingHandler: No sampling callback provided`);return}l.debug(`setupSamplingHandler: Setting up sampling request handler`),this.client.setRequestHandler(m_,async(t,n)=>(l.debug(`Server requested sampling, forwarding to callback`),await e(t.params))),l.debug(`setupSamplingHandler: Sampling handler registered successfully`)}setupElicitationHandler(){if(!this.client){l.debug(`setupElicitationHandler: No client available`);return}let e=this.opts.onElicitation??this.opts.elicitationCallback;if(!e){l.debug(`setupElicitationHandler: No elicitation callback provided`);return}l.debug(`setupElicitationHandler: Setting up elicitation request handler`),this.client.setRequestHandler(__,async(t,n)=>(l.debug(`Server requested elicitation, forwarding to callback`),await e(t.params))),l.debug(`setupElicitationHandler: Elicitation handler registered successfully`)}async disconnect(){if(!this.connected){l.debug(`Not connected to MCP implementation`);return}l.debug(`Disconnecting from MCP implementation`),await this.cleanupResources(),this.connected=!1,l.debug(`Disconnected from MCP implementation`)}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`Caching server capabilities & tools`);let t=this.client.getServerCapabilities();this.capabilitiesCache=t||null;let n=this.client.getServerVersion();this.serverInfoCache=n||null;try{this.toolsCache=(await this.client.listTools(void 0,e)).tools??[],l.debug(`Fetched ${this.toolsCache.length} tools from server`)}catch(e){let t=e;t.code===-32601?l.debug(`Server does not implement tools/list, assuming no tools`):l.debug(`Failed to list tools, assuming empty:`,t.message),this.toolsCache=[]}return l.debug(`Server capabilities:`,t),l.debug(`Server info:`,n),t}get tools(){if(!this.toolsCache)throw Error(`MCP client is not initialized; call initialize() first`);return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}async callTool(e,t,n){if(!this.client)throw Error(`MCP client is not connected`);let r=n?{...n}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},l.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)),l.debug(`Calling tool '${e}' with args`,t);let i=await this.client.callTool({name:e,arguments:t},void 0,r);return l.debug(`Tool '${e}' returned`,i),i}async listTools(e){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`[listTools] Fetching fresh tools from server...`);let t=await this.client.listTools(void 0,e),n=t.tools?[...t.tools]:[];return l.debug(`[listTools] Returned ${n.length} tools:`,n.map(e=>e.name)),n}async listResources(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Listing resources`,e?`with cursor: ${e}`:``),await this.client.listResources({cursor:e},t)}async listAllResources(e){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.resources)return l.debug(`Server does not advertise resources capability, skipping`),{resources:[]};try{l.debug(`Listing all resources (with auto-pagination)`);let t=[],n;do{let r=await this.client.listResources({cursor:n},e);t.push(...r.resources||[]),n=r.nextCursor}while(n);return{resources:t}}catch(e){if(e.code===-32601)return l.debug(`Server advertised resources but method not found`),{resources:[]};throw e}}async listResourceTemplates(e){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Listing resource templates`),await this.client.listResourceTemplates(void 0,e)}async complete(e,t){if(!this.client)throw Error(`MCP client is not connected`);l.debug(`[complete] Requesting completions for:`,e.ref);let n=await this.client.complete(e,t);return l.debug(`[complete] Received ${n.completion.values.length} suggestions`),n}async readResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},t)}async subscribeToResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},t)}async unsubscribeFromResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},t)}async listPrompts(){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.prompts)return l.debug(`Server does not advertise prompts capability, skipping`),{prompts:[]};try{return l.debug(`Listing prompts`),await this.client.listPrompts()}catch(e){if(e.code===-32601)return l.debug(`Server advertised prompts but method not found`),{prompts:[]};throw e}}async getPrompt(e,t){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:t})}async request(e,t=null,n){if(!this.client)throw Error(`MCP client is not connected`);return l.debug(`Sending raw request '${e}' with params`,t),await this.client.request({method:e,params:t??{}},void 0,n)}async cleanupResources(){let e=[];if(this.client)try{typeof this.client.close==`function`&&await this.client.close()}catch(t){let n=`Error closing client: ${t}`;l.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(t){let n=`Error stopping connection manager: ${t}`;l.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&l.warn(`Resource cleanup finished with ${e.length} issue(s)`)}},yue=class{static{a(this,`ConnectionManager`)}_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),l.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw Error(`Connection was not established`);return this._connection}async stop(){if(this._task&&this._abortController){l.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(e){e instanceof Error&&e.name===`AbortError`?l.debug(`${this.constructor.name} task aborted successfully`):l.warn(`Error stopping ${this.constructor.name} task: ${e}`)}}await this._donePromise,l.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(e=>this._readyResolver=e),this._donePromise=new Promise(e=>this._doneResolver=e),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){l.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),l.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(e){this._exception=e,l.error(`Error in ${this.constructor.name} task: ${e}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(e){l.warn(`Error closing connection in ${this.constructor.name}: ${e}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((e,t)=>{if(!this._abortController)return;let n=this._abortController.signal;if(n.aborted){e();return}let r=a(()=>{n.removeEventListener(`abort`,r),e()},`onAbort`);n.addEventListener(`abort`,r)})}},kO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),AO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=kO(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),jO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=kO(),n=AO(),r=kO();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=AO();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
439
439
  `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;var M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),MO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=jO(),n=kO();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),NO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=jO();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),PO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=jO(),n=MO(),r=NO();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),bue=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=PO(),n=jO(),r=NO(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),FO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),IO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),LO=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=FO(),n=IO(),r=PO(),i=jO(),a=MO(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
440
440
  || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
441
441
  || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
@@ -471,7 +471,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
471
471
  ${h}px !important;
472
472
  ${g}px !important;
473
473
  }
474
- `),()=>{v.contains(_)&&v.removeChild(_)}},[t]),(0,S.jsx)(YSe,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:w.cloneElement(e,{ref:u})})}var ZSe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=KV(QSe),d=(0,w.useId)(),f=!0,p=(0,w.useMemo)(()=>(f=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>u.delete(e))}),[n,u,r]);return a&&f&&(p={...p}),(0,w.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),w.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,S.jsx)(XSe,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,S.jsx)(YV.Provider,{value:p,children:e})};function QSe(){return new Map}function YK(e=!0){let t=(0,w.useContext)(YV);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,w.useId)();(0,w.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,w.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var XK=e=>e.key||``;function ZK(e){let t=[];return w.Children.forEach(e,e=>{(0,w.isValidElement)(e)&&t.push(e)}),t}var QK=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=YK(o),f=(0,w.useMemo)(()=>ZK(e),[e]),p=o&&!u?[]:f.map(XK),m=(0,w.useRef)(!0),h=(0,w.useRef)(f),g=KV(()=>new Map),_=(0,w.useRef)(new Set),[v,y]=(0,w.useState)(f),[b,x]=(0,w.useState)(f);JV(()=>{m.current=!1,h.current=f;for(let e=0;e<b.length;e++){let t=XK(b[e]);p.includes(t)?(g.delete(t),_.current.delete(t)):g.get(t)!==!0&&g.set(t,!1)}},[b,p.length,p.join(`-`)]);let C=[];if(f!==v){let e=[...f];for(let t=0;t<b.length;t++){let n=b[t],r=XK(n);p.includes(r)||(e.splice(t,0,n),C.push(n))}return a===`wait`&&C.length&&(e=C),x(ZK(e)),y(f),null}let{forceRender:T}=(0,w.useContext)(GV);return(0,S.jsx)(S.Fragment,{children:b.map(e=>{let v=XK(e),y=o&&!u?!1:f===b||p.includes(v);return(0,S.jsx)(ZSe,{isPresent:y,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:y?void 0:()=>{if(_.current.has(v))return;if(_.current.add(v),g.has(v))g.set(v,!0);else return;let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(T?.(),x(h.current),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},v)})})},$K=(0,w.createContext)({strict:!1}),eq={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},tq=!1;function $Se(){if(tq)return;let e={};for(let t in eq)e[t]={isEnabled:e=>eq[t].some(t=>!!e[t])};xG(e),tq=!0}function nq(){return $Se(),zxe()}function eCe(e){let t=nq();for(let n in e)t[n]={...t[n],...e[n]};xG(t)}var tCe=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function rq(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||tCe.has(e)}var nCe=r({default:()=>iq}),iq,rCe=n((()=>{throw iq={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),aq=e=>!rq(e);function iCe(e){typeof e==`function`&&(aq=t=>t.startsWith(`on`)?!rq(t):e(t))}try{iCe((rCe(),t(nCe)).default)}catch{}function aCe(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(aq(i)||n===!0&&rq(i)||!t&&!rq(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var oq=(0,w.createContext)({});function oCe(e,t){if(hG(e)){let{initial:t,animate:n}=e;return{initial:t===!1||fG(t)?t:void 0,animate:fG(n)?n:void 0}}return e.inherit===!1?{}:t}function sCe(e){let{initial:t,animate:n}=oCe(e,(0,w.useContext)(oq));return(0,w.useMemo)(()=>({initial:t,animate:n}),[sq(t),sq(n)])}function sq(e){return Array.isArray(e)?e.join(` `):e}var cq=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function lq(e,t,n){for(let r in t)!wW(t[r])&&!GG(r,n)&&(e[r]=t[r])}function cCe({transformTemplate:e},t){return(0,w.useMemo)(()=>{let n=cq();return BG(n,t,e),Object.assign({},n.vars,n.style)},[t])}function lCe(e,t){let n=e.style||{},r={};return lq(r,n,e),Object.assign(r,cCe(e,t)),r}function uCe(e,t){let n={},r=lCe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var uq=()=>({...cq(),attrs:{}});function dCe(e,t,n,r){let i=(0,w.useMemo)(()=>{let n=uq();return qG(n,t,YG(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};lq(t,e.style,e),i.style={...t,...i.style}}return i}var fCe=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function dq(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(fCe.indexOf(e)>-1||/[A-Z]/u.test(e))}function pCe(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??dq(e)?dCe:uCe)(t,r,i,e),c=aCe(t,typeof e==`string`,a),l=e===w.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,w.useMemo)(()=>wW(u)?u.get():u,[u]);return(0,w.createElement)(e,{...l,children:d})}function mCe({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:hCe(n,r,i,e),renderState:t()}}function hCe(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=kK(a[e]);let{initial:o,animate:s}=e,c=hG(e),l=gG(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!dG(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=_W(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var fq=e=>(t,n)=>{let r=(0,w.useContext)(oq),i=(0,w.useContext)(YV),a=()=>mCe(e,t,r,i);return n?a():KV(a)},gCe=fq({scrapeMotionValuesFromProps:KG,createRenderState:cq}),_Ce=fq({scrapeMotionValuesFromProps:XG,createRenderState:uq}),vCe=Symbol.for(`motionComponentSymbol`);function yCe(e,t,n){let r=(0,w.useRef)(n);(0,w.useInsertionEffect)(()=>{r.current=n});let i=(0,w.useRef)(null);return(0,w.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var pq=(0,w.createContext)({});function mq(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function bCe(e,t,n,r,i,a){let{visualElement:o}=(0,w.useContext)(oq),s=(0,w.useContext)($K),c=(0,w.useContext)(YV),l=(0,w.useContext)(qK),u=l.reducedMotion,d=l.skipAnimations,f=(0,w.useRef)(null),p=(0,w.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,w.useContext)(pq);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&xCe(f.current,n,i,h);let g=(0,w.useRef)(!1);(0,w.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[DW],v=(0,w.useRef)(!!_&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return JV(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,w.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function xCe(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:hq(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&mq(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:l})}function hq(e){if(e)return e.options.allowProjection===!1?hq(e.parent):e.projection}function gq(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&eCe(r);let a=n?n===`svg`:dq(e),o=a?_Ce:gCe;function s(n,s){let c,l={...(0,w.useContext)(qK),...n,layoutId:SCe(n)},{isStatic:u}=l,d=sCe(n),f=o(n,u);if(!u&&qV){CCe(l,r);let t=wCe(l);c=t.MeasureLayout,d.visualElement=bCe(e,f,l,i,t.ProjectionNode,a)}return(0,S.jsxs)(oq.Provider,{value:d,children:[c&&d.visualElement?(0,S.jsx)(c,{visualElement:d.visualElement,...l}):null,pCe(e,n,yCe(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,w.forwardRef)(s);return c[vCe]=e,c}function SCe({layoutId:e}){let t=(0,w.useContext)(GV).id;return t&&e!==void 0?t+`-`+e:e}function CCe(e,t){(0,w.useContext)($K).strict}function wCe(e){let{drag:t,layout:n}=nq();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function TCe(e,t){if(typeof Proxy>`u`)return gq;let n=new Map,r=(n,r)=>gq(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,gq(a,void 0,e,t)),n.get(a))})}var ECe=(e,t)=>t.isSVG??dq(e)?new nSe(t):new Xxe(t,{allowProjection:e!==w.Fragment}),DCe=class extends CG{constructor(e){super(e),e.animationState||=sSe(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();dG(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},OCe=0,kCe={animation:{Feature:DCe},exit:{Feature:class extends CG{constructor(){super(...arguments),this.id=OCe++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function _q(e){return{point:{x:e.pageX,y:e.pageY}}}var ACe=e=>t=>JW(t)&&e(t,_q(t));function vq(e,t,n,r){return OK(e,t,ACe(n),r)}var yq=({current:e})=>e?e.ownerDocument.defaultView:null,bq=(e,t)=>Math.abs(e-t);function jCe(e,t){let n=bq(e.x,t.x),r=bq(e.y,t.y);return Math.sqrt(n**2+r**2)}var xq=new Set([`auto`,`scroll`]),Sq=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=Tq(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=jCe(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=jH;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=Cq(t,this.transformPagePoint),kH.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=Tq(e.type===`pointercancel`?this.lastMoveEventInfo:Cq(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!JW(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=Cq(_q(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=jH;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,Tq(s,this.history)),this.removeListeners=aH(vq(this.contextWindow,`pointermove`,this.handlePointerMove),vq(this.contextWindow,`pointerup`,this.handlePointerUp),vq(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(xq.has(e.overflowX)||xq.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener(`scroll`,this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),kH.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),AH(this.updatePoint)}};function Cq(e,t){return t?{point:t(e.point)}:e}function wq(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Tq({point:e},t){return{point:e,delta:wq(e,Eq(t)),offset:wq(e,MCe(t)),velocity:NCe(t,.1)}}function MCe(e){return e[0]}function Eq(e){return e[e.length-1]}function NCe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Eq(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>cH(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>cH(t)*2&&(r=e[1]);let a=lH(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function PCe(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?fU(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?fU(n,e,r.max):Math.min(e,n)),e}function Dq(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function FCe(e,{top:t,left:n,bottom:r,right:i}){return{x:Dq(e.x,n,i),y:Dq(e.y,t,r)}}function Oq(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function ICe(e,t){return{x:Oq(e.x,t.x),y:Oq(e.y,t.y)}}function LCe(e,t){let n=.5,r=oK(e),i=oK(t);return i>r?n=oH(t.min,t.max-r,e.min):r>i&&(n=oH(e.min,e.max-i,t.min)),QV(0,1,n)}function RCe(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var kq=.35;function zCe(e=kq){return e===!1?e=0:e===!0&&(e=kq),{x:Aq(e,`left`,`right`),y:Aq(e,`top`,`bottom`)}}function Aq(e,t,n){return{min:jq(e,t),max:jq(e,n)}}function jq(e,t){return typeof e==`number`?e:e[t]||0}var BCe=new WeakMap,VCe=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=uG(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(_q(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=hxe(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),SK(e=>{let t=this.getAxisMotionValue(e).get()||0;if(QH.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=oK(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&kH.update(()=>i(e,t),!1,!0),TW(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=UCe(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&kH.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new Sq(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:yq(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&kH.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!Nq(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=PCe(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&mq(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=FCe(n.layoutBox,e):this.constraints=!1,this.elastic=zCe(t),r!==this.constraints&&!mq(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&SK(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=RCe(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!mq(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=Wxe(n,r.root,this.visualElement.getTransformPagePoint()),a=ICe(r.layout.layoutBox,i);if(t){let e=t(Vxe(a));this.hasMutatedConstraints=!!e,e&&(a=wG(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=SK(o=>{if(!Nq(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return TW(this.visualElement,e),n.start(hW(e,n,0,t,this.visualElement,!1))}stopAnimation(){SK(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){SK(t=>{let{drag:n}=this.getProps();if(!Nq(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-fU(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!mq(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};SK(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=LCe({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),SK(t=>{if(!Nq(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(fU(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;BCe.set(this.visualElement,this);let e=this.visualElement.current,t=vq(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&xxe(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();mq(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=HCe(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),kH.read(r);let o=OK(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(SK(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=kq,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Mq(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function HCe(e,t,n){let r=oG(e,Mq(n)),i=oG(t,Mq(n));return()=>{r(),i()}}function Nq(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function UCe(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var WCe=class extends CG{constructor(e){super(e),this.removeGroupControls=iH,this.removeListeners=iH,this.controls=new VCe(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||iH}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},Pq=e=>(t,n)=>{e&&kH.update(()=>e(t,n),!1,!0)},GCe=class extends CG{constructor(){super(...arguments),this.removePointerDownListener=iH}onPointerDown(e){this.session=new Sq(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:yq(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Pq(e),onStart:Pq(t),onMove:Pq(n),onEnd:(e,t)=>{delete this.session,r&&kH.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=vq(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Fq=!1,KCe=class extends w.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Fq&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),AK.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Fq=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||kH.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),UW.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Fq=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function Iq(e){let[t,n]=YK(),r=(0,w.useContext)(GV);return(0,S.jsx)(KCe,{...e,layoutGroup:r,switchLayoutGroup:(0,w.useContext)(pq),isPresent:t,safeToRemove:n})}var qCe={pan:{Feature:GCe},drag:{Feature:WCe,ProjectionNode:KK,MeasureLayout:Iq}};function Lq(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&kH.postRender(()=>i(t,_q(t)))}var JCe=class extends CG{mount(){let{current:e}=this.node;e&&(this.unmount=_xe(e,(e,t)=>(Lq(this.node,t,`Start`),e=>Lq(this.node,e,`End`))))}unmount(){}},YCe=class extends CG{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=aH(OK(this.node.current,`focus`,()=>this.onFocus()),OK(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Rq(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&kH.postRender(()=>i(t,_q(t)))}var XCe=class extends CG{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Cxe(e,(e,t)=>(Rq(this.node,t,`Start`),(e,{success:t})=>Rq(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},zq=new WeakMap,Bq=new WeakMap,ZCe=e=>{let t=zq.get(e.target);t&&t(e)},QCe=e=>{e.forEach(ZCe)};function $Ce({root:e,...t}){let n=e||document;Bq.has(n)||Bq.set(n,{});let r=Bq.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(QCe,{root:e,...t})),r[i]}function ewe(e,t,n){let r=$Ce(t);return zq.set(e,n),r.observe(e),()=>{zq.delete(e),r.unobserve(e)}}var twe={some:0,all:1},nwe=class extends CG{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:twe[r]};return ewe(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(rwe(e,t))&&this.startObserver()}unmount(){}};function rwe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var iwe={inView:{Feature:nwe},tap:{Feature:XCe},focus:{Feature:YCe},hover:{Feature:JCe}},awe={layout:{ProjectionNode:KK,MeasureLayout:Iq}},Vq=TCe({...kCe,...iwe,...qCe,...awe},ECe),owe={some:0,all:1};function swe(e,t,{root:n,margin:r,amount:i=`some`}={}){let a=BW(e),o=new WeakMap,s=new IntersectionObserver(e=>{e.forEach(e=>{let n=o.get(e.target);if(e.isIntersecting!==!!n)if(e.isIntersecting){let n=t(e.target,e);typeof n==`function`?o.set(e.target,n):s.unobserve(e.target)}else typeof n==`function`&&(n(e),o.delete(e.target))})},{root:n,rootMargin:r,threshold:typeof i==`number`?i:owe[i]});return a.forEach(e=>s.observe(e)),()=>s.disconnect()}function cwe(e,{root:t,margin:n,amount:r,once:i=!1,initial:a=!1}={}){let[o,s]=(0,w.useState)(a);return(0,w.useEffect)(()=>{if(!e.current||i&&o)return;let a=()=>(s(!0),i?void 0:()=>s(!1)),c={root:t&&t.current||void 0,margin:n,amount:r};return swe(e.current,a,c)},[t,e,n,i,r]),o}function Hq({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,w.useRef)(null),f=cwe(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,S.jsx)(QK,{children:(0,S.jsx)(Vq.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 Uq({className:e,...t}){return(0,S.jsx)(rp,{role:`status`,"aria-label":`Loading`,className:H(`size-4 animate-spin`,e),...t})}function Wq({server:e,className:t,size:n=`md`}){let[r,i]=(0,w.useState)(!0),[a,o]=(0,w.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,w.useEffect)(()=>{i(c!==null),o(!1)},[c]);let l=Tj(e);return!c||a?(0,S.jsx)(Hq,{delay:.05,children:(0,S.jsx)(pu,{className:H(`flex items-center justify-center rounded-full overflow-hidden`,s[n],t)})}):(0,S.jsx)(Hq,{delay:.05,children:(0,S.jsxs)(`div`,{className:H(`rounded-md overflow-hidden flex items-center justify-center bg-white dark:bg-zinc-800 relative`,s[n],t),children:[r&&(0,S.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-zinc-100/80 dark:bg-zinc-800/80`,children:(0,S.jsx)(Uq,{})}),(0,S.jsx)(`img`,{src:c,alt:l,className:H(`object-contain`,s[n]),onLoad:()=>i(!1),onError:()=>{i(!1),o(!0)},style:{imageRendering:`-webkit-optimize-contrast`,display:r?`none`:`block`}})]})})}var Gq=`mcp-inspector-connect-panel-mesh-animation-paused`;function lwe(){let{servers:e,addServer:t,removeServer:n,updateServerMetadata:r,updateServer:i}=yj(),a=(0,w.useRef)(new Set);(0,w.useEffect)(()=>{e.forEach(e=>{if(e.state===`ready`&&!a.current.has(e.id)){a.current.add(e.id);try{of.getInstance().capture(new Vd({serverId:e.id,serverUrl:e.url,success:!0,connectionType:`http`})).catch(()=>{})}catch{}}else e.state===`failed`&&a.current.has(e.id)&&a.current.delete(e.id)})},[e]);let o=(0,w.useCallback)(e=>{try{of.getInstance().capture(new Wd({serverId:e})).catch(()=>{})}catch{}a.current.delete(e),n(e)},[n]),[s,c]=(0,w.useState)(new Set),l=(0,w.useRef)(new Set);(0,w.useEffect)(()=>{l.current=s},[s]);let u=(0,w.useCallback)((e,n,r,i)=>{t(e,{url:e,name:n,proxyConfig:r,transportType:i})},[t]),d=(0,w.useCallback)(async(e,t)=>{if(l.current.has(e)){console.warn(`[InspectorDashboard] Connection ${e} is already being updated, skipping`);return}c(t=>new Set(t).add(e));try{await i(e,t)}catch(t){console.error(`[InspectorDashboard] Failed to update connection ${e}:`,t)}finally{c(t=>{let n=new Set(t);return n.delete(e),n})}},[i]),f=(0,w.useCallback)(async(e,t)=>{try{await r(e,t)}catch(t){console.error(`[InspectorDashboard] Failed to update connection metadata for ${e}:`,t)}},[r]),p=(0,w.useCallback)(async t=>{if(l.current.has(t)){console.warn(`[InspectorDashboard] Connection ${t} is already being reconnected, skipping`);return}let n=e.find(e=>e.id===t);if(n){c(e=>new Set(e).add(t));try{await i(t,{url:n.url,name:n.name})}catch(e){console.error(`[InspectorDashboard] Failed to reconnect server ${t}:`,e)}finally{c(e=>{let n=new Set(e);return n.delete(t),n})}}},[e,i]),m=aM(),h=nM(),[g,_]=(0,w.useState)(new Set),[v,y]=(0,w.useState)(null),[b,x]=(0,w.useState)(null),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(null);(0,w.useEffect)(()=>{of.getInstance().trackInspectorOpen({connectionCount:e.length}).catch(()=>{})},[]);let[O,k]=(0,w.useState)(``),[A,j]=(0,w.useState)(``),[M,N]=(0,w.useState)(`Direct`),[P,F]=(0,w.useState)([]),[I,L]=(0,w.useState)(`10000`),[ee,te]=(0,w.useState)(`True`),[ne,R]=(0,w.useState)(`60000`),[z,B]=(0,w.useState)(`${window.location.origin}/inspector/api/proxy`),[re,ie]=(0,w.useState)(``),[ae,oe]=(0,w.useState)(``),se=(0,w.useRef)(null),[ce,le]=(0,w.useState)(null),ue=(0,w.useCallback)(()=>{if(se.current){let{width:e,height:t}=se.current.getBoundingClientRect();le({width:Math.round(e),height:Math.round(t)})}},[]);(0,w.useEffect)(()=>{let e=requestAnimationFrame(ue),t=new ResizeObserver(ue);return se.current&&t.observe(se.current),window.addEventListener(`resize`,ue),()=>{cancelAnimationFrame(e),t.disconnect(),window.removeEventListener(`resize`,ue)}},[ue]);let[de,fe]=(0,w.useState)(()=>{try{return localStorage.getItem(Gq)===`true`}catch{return!1}}),pe=(0,w.useCallback)(()=>{fe(e=>{let t=!e;try{localStorage.setItem(Gq,t?`true`:`false`)}catch{}return t})},[]),me=(0,w.useCallback)(()=>{if(!A.trim())return;let e=A.trim();try{let t=new URL(e);if(!(t.protocol===`http:`||t.protocol===`https:`)){BM.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:`)){BM.error(`Invalid URL protocol. Please use http:// or https://`);return}e=t}catch{BM.error(`Invalid URL format. Please enter a valid URL.`);return}}let n=P.reduce((e,t)=>(t.name&&t.value&&(e[t.name]=t.value),e),{}),r=M===`Via Proxy`&&z.trim()?{proxyAddress:z.trim(),headers:n}:void 0,i={url:e,name:O.trim()||e,transportType:`http`,preventAutoAuth:!0,clientOptions:{capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},...r?{proxyConfig:r,autoProxyFallback:!1}:{},...Object.keys(n).length>0&&!r?{headers:n}:{}};t(e,i),of.getInstance().capture(new Ud({serverId:A.trim(),serverUrl:A.trim(),connectionType:`http`,viaProxy:!!r?.proxyAddress})).catch(()=>{}),k(``),j(``),F([]),ie(``),oe(``),BM.success(`Server added successfully`)},[A,O,M,z,P,t]),he=()=>{e.forEach(e=>{o(e.id)})},ge=async e=>{try{await bj(e),BM.success(`Error message copied to clipboard`)}catch{BM.error(`Failed to copy error message`)}},_e=async e=>{try{let t=null;try{let n=localStorage.getItem(`mcp-inspector-connections`);n&&(t=JSON.parse(n)[e.id])}catch(e){console.warn(`[InspectorDashboard] Could not read from localStorage:`,e)}let n=t?.proxyConfig?.headers||t?.proxyConfig?.customHeaders||t?.headers||t?.customHeaders||e.proxyConfig?.headers||e.proxyConfig?.customHeaders||e.headers||e.customHeaders||{},r=t?.proxyConfig?.proxyAddress||e.proxyConfig?.proxyAddress,i=r?`Via Proxy`:`Direct`,a=r?t?.proxyConfig||e.proxyConfig:void 0,o={url:e.url,...wj(t||e)?{name:wj(t||e)}:{},transportType:e.transportType||`http`,connectionType:i,proxyConfig:a,customHeaders:n,requestTimeout:e.requestTimeout||1e4,resetTimeoutOnProgress:e.resetTimeoutOnProgress!==!1,maxTotalTimeout:e.maxTotalTimeout||6e4,oauth:e.oauth};await bj(JSON.stringify(o,null,2)),BM.success(`Connection configuration copied to clipboard`)}catch{BM.error(`Failed to copy connection configuration`)}},ve=(e,t)=>{e.stopPropagation(),t()},ye=(0,w.useCallback)(t=>{if(!b)return;let r=xj(b)||e.find(e=>e.id===b);t.url===b?r&&Cj(r,t)?f(b,{name:t.name||t.url}):d(b,{name:t.name,proxyConfig:t.proxyConfig,transportType:t.transportType}):(n(b),u(t.url,t.name,t.proxyConfig,t.transportType)),x(null),BM.success(`Connection settings updated`)},[b,e,n,u,f,d]),be=e=>{if(e.state===`failed`)return;if(e.state!==`ready`){BM.error(`Server is not connected and cannot be inspected`);return}let t=new URLSearchParams(h.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),m(`/?${i.toString()}`)},xe=e=>{console.log(`[InspectorDashboard] Reconnecting server:`,e.id),e.state===`failed`&&e.retry?e.retry():p(e.id)};return(0,w.useEffect)(()=>{_(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,w.useEffect)(()=>{if(!v)return;let t=e.find(e=>e.id===v),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`)){y(null);let e=new URLSearchParams(h.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),m(`/?${i.toString()}`)}else t&&t.state===`failed`&&!n&&t.error&&(console.warn(`[InspectorDashboard] Connection failed with no data, canceling navigation`),y(null))},[e,v,m]),(0,S.jsxs)(`div`,{className:`flex flex-col lg:flex-row items-start justify-start gap-4 h-auto lg:h-full relative`,children:[(0,S.jsxs)(`div`,{className:`w-full px-3 pt-6 sm:px-6 sm:pt-3 overflow-visible lg:overflow-auto`,children:[(0,S.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,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.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,S.jsxs)(kt,{variant:`secondary`,className:`text-xs cursor-pointer hover:bg-secondary/80 transition-colors`,children:[`v`,typeof window<`u`&&window.__INSPECTOR_VERSION__||`1.0.0`]})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Visit GitHub`})})]}),(0,S.jsx)(`h2`,{className:`text-2xl font-medium tracking-tight text-center sm:text-left order-2 sm:order-1`,children:`MCP Inspector`})]}),(0,S.jsx)(`p`,{className:`text-muted-foreground relative z-10 text-center sm:text-left`,children:`Inspect and debug MCP (Model Context Protocol) servers`}),(0,S.jsxs)(`div`,{className:`space-y-4 mt-4 sm:mt-8`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center sm:items-center justify-between gap-3`,children:[(0,S.jsx)(`h3`,{className:`hidden sm:block text-base font-medium text-center sm:text-left`,children:`Connected Servers`}),(0,S.jsx)(`div`,{className:`hidden sm:flex items-center gap-3 justify-center sm:justify-start`,children:e.length>0&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:he,children:`Clear All`})})]}),e.length===0?(0,S.jsx)(su,{message:`No servers connected yet. Add a server above to get started.`}):(0,S.jsx)(`div`,{className:`grid gap-3`,children:e.map(e=>(0,S.jsxs)(`div`,{"data-testid":`server-tile-${e.id}`,onClick:()=>be(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,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(Wq,{server:e,size:`md`}),(0,S.jsx)(`h4`,{className:`font-semibold text-sm`,children:Tj(e)}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:s.has(e.id)?(0,S.jsx)(rp,{className:`w-3 h-3 animate-spin text-blue-500`}):e.error&&e.state!==`ready`?(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,"data-testid":`server-tile-status-${e.state}`,onClick:t=>{t.stopPropagation(),ge(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`})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{className:`max-w-xs`,children:e.error})})]}):(0,S.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,S.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground dark:text-zinc-400 font-mono`,children:e.url}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:async t=>{t.stopPropagation();try{await bj(e.url),BM.success(`URL copied to clipboard`)}catch{BM.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,S.jsx)(Lf,{className:`w-3 h-3 text-muted-foreground`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Copy URL`})})]})]})]}),(0,S.jsxs)(`div`,{className:`hidden lg:flex items-center gap-1 flex-shrink-0`,children:[(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-copy-config`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>_e(e)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(Lf,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Copy connection config`})})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-info`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>{D(e),T(!0)}),className:`h-8 w-8 p-0`,children:(0,S.jsx)(ep,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`View server info`})})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-settings`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>x(e.id)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(wp,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Edit connection settings`})})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-remove`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>o(e.id)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(Mf,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Remove connection`})})]}),(e.state===`ready`||e.state===`failed`||e.state===`discovering`)&&(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-reconnect`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>xe(e)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(yp,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:e.state===`failed`?`Retry connection`:e.state===`discovering`?`Reconnect`:`Resync connection`})})]})]}),(0,S.jsx)(`div`,{className:`lg:hidden flex-shrink-0`,children:(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:e=>e.stopPropagation(),children:(0,S.jsx)(Bf,{className:`h-4 w-4`})})}),(0,S.jsxs)(eu,{align:`end`,children:[(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),_e(e)},children:[(0,S.jsx)(Lf,{className:`h-4 w-4 mr-2`}),`Copy connection config`]}),(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),D(e),T(!0)},children:[(0,S.jsx)(ep,{className:`h-4 w-4 mr-2`}),`View server info`]}),(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),x(e.id)},children:[(0,S.jsx)(wp,{className:`h-4 w-4 mr-2`}),`Edit connection settings`]}),(e.state===`ready`||e.state===`failed`||e.state===`discovering`)&&(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),xe(e)},children:[(0,S.jsx)(yp,{className:`h-4 w-4 mr-2`}),e.state===`failed`?`Retry connection`:e.state===`discovering`?`Reconnect`:`Resync connection`]}),(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),o(e.id)},className:`text-destructive focus:text-destructive`,children:[(0,S.jsx)(Mf,{className:`h-4 w-4 mr-2`}),`Remove connection`]})]})]})})]}),(e.state===`pending_auth`||e.state===`authenticating`)&&(0,S.jsx)(`div`,{className:`text-sm text-yellow-600 dark:text-yellow-400 mt-2`,children:e.state===`authenticating`?(0,S.jsxs)(U,{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,S.jsx)(rp,{className:`mr-2 h-4 w-4 animate-spin`}),`Authenticating...`]}):e.authUrl?(0,S.jsx)(U,{"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`,asChild:!0,children:(0,S.jsx)(`a`,{href:e.authUrl,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:`Authenticate`})}):null}),e.state===`failed`&&e.error&&(e.error.includes(`401`)||e.error.includes(`Unauthorized`))&&e.error.includes(`does not support OAuth`)&&(0,S.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,S.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,S.jsx)(`div`,{className:`absolute inset-0 z-0 overflow-hidden dark:opacity-60 pointer-events-none`,children:(0,S.jsx)(Hu,{width:ce?.width??1280,height:ce?.height??720,colors:[`#e0eaff`,`#f9ffbd`,`#dedede`,`#ffffff`],distortion:.8,swirl:.1,grainMixer:0,grainOverlay:.2,speed:+!de})}),(0,S.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,S.jsx)(`div`,{className:`absolute inset-0 noise`,style:{background:`url("${uu}")`,filter:`contrast(150%) brightness(550%)`}})}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:pe,"aria-label":de?`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:de?(0,S.jsx)(mp,{className:`h-3 w-3 ml-px`,fill:`currentColor`}):(0,S.jsx)(Np,{className:`h-2.5 w-2.5`,fill:`currentColor`})})}),(0,S.jsx)(Id,{side:`left`,children:(0,S.jsx)(`p`,{children:de?`Enable shader animation`:`Disable shader animation`})})]}),(0,S.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,S.jsx)(LP,{alias:O,setAlias:k,url:A,setUrl:j,connectionType:M,setConnectionType:N,customHeaders:P,setCustomHeaders:F,requestTimeout:I,setRequestTimeout:L,resetTimeoutOnProgress:ee,setResetTimeoutOnProgress:te,maxTotalTimeout:ne,setMaxTotalTimeout:R,proxyAddress:z,setProxyAddress:B,clientId:re,setClientId:ie,scope:ae,setScope:oe,onConnect:me,variant:`styled`,showConnectButton:!0,showExportButton:!0})})]}),(0,S.jsx)(WV,{connection:b&&e.find(e=>e.id===b)||null,open:b!==null,onOpenChange:e=>{e||x(null)},onConnect:ye}),(0,S.jsx)(UV,{open:C,onOpenChange:T,connection:E})]})}var Kq=(0,w.createContext)(void 0);function uwe({children:e}){let t=(typeof window<`u`?window.__MANUFACT_CHAT_URL__:void 0)??void 0,[n,r]=(0,w.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`,chatCredentials:`include`}:{}}),i=(0,w.useCallback)(e=>{r(t=>({...t,selectedServerId:e}))},[]),a=(0,w.useCallback)(e=>{r(t=>({...t,activeTab:e}))},[]),o=(0,w.useCallback)(e=>{r(t=>({...t,selectedToolName:e}))},[]),s=(0,w.useCallback)(e=>{r(t=>({...t,selectedPromptName:e}))},[]),c=(0,w.useCallback)(e=>{r(t=>({...t,selectedResourceUri:e}))},[]),l=(0,w.useCallback)(e=>{r(t=>({...t,selectedSamplingRequestId:e}))},[]),u=(0,w.useCallback)(e=>{r(t=>({...t,selectedElicitationRequestId:e}))},[]),d=(0,w.useCallback)(e=>{r(t=>({...t,tunnelUrl:e}))},[]),f=(0,w.useCallback)(e=>{r(t=>({...t,isTunnelStarting:e}))},[]),p=(0,w.useCallback)((e,t={})=>{r(n=>({...n,isEmbedded:e,embeddedConfig:t}))},[]),m=(0,w.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,w.useCallback)(()=>{r(e=>({...e,selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null}))},[]);return(0,S.jsx)(Kq,{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 qq(){let e=(0,w.use)(Kq);if(!e)throw Error(`useInspector must be used within InspectorProvider`);return e}var Jq=`__mcpUseInspectorReconnect`;function Yq(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`};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`,connectionType:e.connectionType===`Via Proxy`?`Via Proxy`:`Direct`,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`}):(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 dwe({connections:e,addConnection:t,removeConnection:n,configLoaded:r,embedded:i=!1}){let a=aM(),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),[u,d]=(0,w.useState)(!1),f=(0,w.useCallback)(e=>{let{url:n,name:r,transportType:a,connectionType:o,customHeaders:s,auth:c}=e;console.log(`[useAutoConnect] Config received:`,e),console.log(`[useAutoConnect] Custom headers before auth:`,s),console.log(`[useAutoConnect] Auth config:`,c);let l={...s};if(c?.access_token){let e=c.token_type||`bearer`;if(l.Authorization=`${e.charAt(0).toUpperCase()+e.slice(1)} ${c.access_token}`,console.log(`[useAutoConnect] Added Authorization header:`,l.Authorization),typeof window<`u`&&!i){let e=`mcp:auth:${n}`,t={access_token:c.access_token,token_type:c.token_type||`bearer`,expires_at:c.expires_at,refresh_token:c.refresh_token,scope:c.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:`,l);let u;try{let e=new URL(n).origin,t=window.location.origin;t!==e&&(u=`${t}/inspector/api/proxy`)}catch{u=`${window.location.origin}/inspector/api/proxy`}let d={...u?{proxyAddress:u}:{},...Object.keys(l).length>0&&{headers:l}};console.warn(`[useAutoConnect] Attempting connection (${o}):`,{url:n,transportType:a,proxyConfig:d}),t(n,r,d,a)},[t]),p=(0,w.useCallback)(t=>{let n=e.find(e=>e.url===t.url);if(n)if(n.state===`ready`){console.warn(`[useAutoConnect] Connection already ready, navigating to server`);let e=new URLSearchParams(window.location.search),t=e.get(`tunnelUrl`),r=e.get(`tab`),i=e.get(`openTunnelPopover`),o=new URLSearchParams;o.set(`server`,n.id),t&&o.set(`tunnelUrl`,t),r&&o.set(`tab`,r),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,f]);return(0,w.useEffect)(()=>{if(u)return;let e=()=>{if(typeof sessionStorage>`u`)return!1;try{let e=sessionStorage.getItem(Jq);if(!e)return!1;let t=JSON.parse(e);return sessionStorage.removeItem(Jq),!t?.url||!t.transportType?!1:(p(t),!0)}catch{try{sessionStorage.removeItem(Jq)}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=Yq(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=Yq(t);e&&p(e),d(!0);return}fetch(`/inspector/config.json`).then(e=>e.json()).then(e=>{if(d(!0),e.autoConnectUrl){let t=Yq(e.autoConnectUrl);t&&p(t)}}).catch(()=>d(!0))},[u,r,p,i]),(0,w.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`),BM.error(`Cannot connect to server. Please check the URL and try again.`),queueMicrotask(()=>{s(!1),l(null)}))},[e,c,a]),(0,w.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,w.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 Xq(e){(0,w.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 Zq=`mcp-inspector-saved-requests`;function fwe(){let[e,t]=(0,w.useState)([]);return(0,w.useEffect)(()=>{try{let e=localStorage.getItem(Zq);e&&t(JSON.parse(e))}catch(e){console.error(`[useSavedRequests] Failed to load saved requests:`,e)}},[]),(0,w.useEffect)(()=>{let e=e=>{if(e.key===Zq&&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)},[]),e}var Qq=1,pwe=.9,mwe=.8,hwe=.17,$q=.1,eJ=.999,gwe=.9999,_we=.99,vwe=/[\\\/_+.#"@\[\(\{&]/,ywe=/[\\\/_+.#"@\[\(\{&]/g,bwe=/[\s-]/,tJ=/[\s-]/g;function nJ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Qq:_we;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=nJ(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Qq:vwe.test(e.charAt(l-1))?(d*=mwe,p=e.slice(i,l-1).match(ywe),p&&i>0&&(d*=eJ**+p.length)):bwe.test(e.charAt(l-1))?(d*=pwe,m=e.slice(i,l-1).match(tJ),m&&i>0&&(d*=eJ**+m.length)):(d*=hwe,i>0&&(d*=eJ**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=gwe)),(d<$q&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=nJ(e,t,n,r,l+1,a+2,o),f*$q>d&&(d=f*$q)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function rJ(e){return e.toLowerCase().replace(tJ,` `)}function xwe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,nJ(e,t,rJ(e),rJ(t),0,0,{})}var iJ=`[cmdk-group=""]`,aJ=`[cmdk-group-items=""]`,Swe=`[cmdk-group-heading=""]`,oJ=`[cmdk-item=""]`,sJ=`${oJ}:not([aria-disabled="true"])`,cJ=`cmdk-item-select`,lJ=`data-value`,Cwe=(e,t,n)=>xwe(e,t,n),uJ=w.createContext(void 0),dJ=()=>w.useContext(uJ),fJ=w.createContext(void 0),pJ=()=>w.useContext(fJ),mJ=w.createContext(void 0),hJ=w.forwardRef((e,t)=>{let n=yJ(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=yJ(()=>new Set),i=yJ(()=>new Map),a=yJ(()=>new Map),o=yJ(()=>new Set),s=_J(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Fn(),y=Fn(),b=Fn(),x=w.useRef(null),S=Pwe();vJ(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),vJ(()=>{S(6,A)},[]);let C=w.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),S(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=j()?.id,C.emit()}),r||S(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=w.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),S(2,()=>{D(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{k(),D(),n.current.value||O(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();S(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function E(e,t){let r=s.current?.filter??Cwe;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(aJ);t?t.appendChild(e.parentElement===t?e:e.closest(`${aJ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${aJ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${iJ}[${lJ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(lJ);C.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(iJ)?.querySelector(Swe))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return x.current?.querySelector(`${oJ}[aria-selected="true"]`)}function M(){return Array.from(x.current?.querySelectorAll(sJ)||[])}function N(e){let t=M()[e];t&&C.setState(`value`,t.getAttribute(lJ))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(lJ))}function F(e){let t=j()?.closest(iJ),n;for(;t&&!n;)t=e>0?Mwe(t,iJ):Nwe(t,iJ),n=t?.querySelector(sJ);n?C.setState(`value`,n.getAttribute(lJ)):P(e)}let I=()=>N(M().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},ee=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return w.createElement(AN.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:g&&e.ctrlKey&&ee(e);break;case`ArrowUp`:ee(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(cJ);t.dispatchEvent(e)}}}}},w.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Iwe},c),SJ(e,e=>w.createElement(fJ.Provider,{value:C},w.createElement(uJ.Provider,{value:T},e))))}),wwe=w.forwardRef((e,t)=>{let n=Fn(),r=w.useRef(null),i=w.useContext(mJ),a=dJ(),o=_J(e),s=o.current?.forceMount??i?.forceMount;vJ(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=xJ(n,r,[e.value,e.children,r],e.keywords),l=pJ(),u=bJ(e=>e.value&&e.value===c.current),d=bJ(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);w.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(cJ,f),()=>t.removeEventListener(cJ,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return w.createElement(AN.div,{ref:E(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Twe=w.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Fn(),s=w.useRef(null),c=w.useRef(null),l=Fn(),u=dJ(),d=bJ(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);vJ(()=>u.group(o),[]),xJ(o,s,[e.value,e.heading,c]);let f=w.useMemo(()=>({id:o,forceMount:i}),[i]);return w.createElement(AN.div,{ref:E(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&w.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),SJ(e,e=>w.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},w.createElement(mJ.Provider,{value:f},e))))}),Ewe=w.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=w.useRef(null),a=bJ(e=>!e.search);return!n&&!a?null:w.createElement(AN.div,{ref:E(i,t),...r,"cmdk-separator":``,role:`separator`})}),Dwe=w.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=pJ(),o=bJ(e=>e.search),s=bJ(e=>e.selectedItemId),c=dJ();return w.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),w.createElement(AN.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Owe=w.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=w.useRef(null),o=w.useRef(null),s=bJ(e=>e.selectedItemId),c=dJ();return w.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),w.createElement(AN.div,{ref:E(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},SJ(e,e=>w.createElement(`div`,{ref:E(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),kwe=w.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return w.createElement(hN,{open:n,onOpenChange:r},w.createElement(_N,{container:o},w.createElement(vN,{"cmdk-overlay":``,className:i}),w.createElement(yN,{"aria-label":e.label,"cmdk-dialog":``,className:a},w.createElement(hJ,{ref:t,...s}))))}),Awe=w.forwardRef((e,t)=>bJ(e=>e.filtered.count===0)?w.createElement(AN.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),jwe=w.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return w.createElement(AN.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},SJ(e,e=>w.createElement(`div`,{"aria-hidden":!0},e)))}),gJ=Object.assign(hJ,{List:Owe,Item:wwe,Input:Dwe,Group:Twe,Separator:Ewe,Dialog:kwe,Empty:Awe,Loading:jwe});function Mwe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Nwe(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _J(e){let t=w.useRef(e);return vJ(()=>{t.current=e}),t}var vJ=typeof window>`u`?w.useEffect:w.useLayoutEffect;function yJ(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function bJ(e){let t=pJ(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function xJ(e,t,n,r=[]){let i=w.useRef(),a=dJ();return vJ(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(lJ,s),i.current=s}),i}var Pwe=()=>{let[e,t]=w.useState(),n=yJ(()=>new Map);return vJ(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Fwe(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function SJ({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(Fwe(t),{ref:t.ref},n(t.props.children)):n(t)}var Iwe={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function CJ(e){return e.replace(/[^a-zA-Z0-9-_]/g,`_`).toLowerCase()}function wJ(e){return`'${e.replace(/'/g,`'\\''`)}'`}function TJ(e){return e.replace(/[^a-zA-Z0-9]/g,`_`).toUpperCase().replace(/^_+|_+$/g,``)}function EJ(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]=`{{${TJ(t)}}}`;r.headers=e}let i=JSON.stringify(r);return`cursor://anysphere.cursor-deeplink/mcp/install?config=${btoa(i)}&name=${encodeURIComponent(CJ(t))}`}function DJ(e,t,n){let r={url:e,name:CJ(t),type:`http`};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TJ(t)}-value`;r.headers=e}let i=JSON.stringify(r);return`vscode:mcp/install?${encodeURIComponent(i)}`}function OJ(e,t,n){let r={url:e,name:CJ(t),type:`http`};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TJ(t)}-value`;r.headers=e}let i=JSON.stringify(r);return`vscode-insiders:mcp/install?${encodeURIComponent(i)}`}function Lwe(e,t,n){let r={url:e,name:CJ(t)};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TJ(t)}-value`;r.headers=e}return r}function kJ(e,t,n){try{let r=Lwe(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=`${CJ(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 AJ(e,t,n){let r=`claude mcp add --transport http "${CJ(t)}" \\\n ${wJ(e)}`,i=[];if(n&&Object.keys(n).length>0)for(let[e]of Object.entries(n)){let t=TJ(e);r+=` \\\n --header ${wJ(`${e}:\${${t}}`)}`,i.push({name:t,header:e})}return{command:r,envVars:i}}function jJ(e,t,n){let r=`gemini mcp add --transport http "${CJ(t)}" ${wJ(e)}`,i=[];if(n&&Object.keys(n).length>0)for(let[e]of Object.entries(n)){let t=TJ(e);r+=` \\\n --header ${wJ(`${e}:\${${t}}`)}`,i.push({name:t,header:e})}return{command:r,envVars:i}}function MJ(e,t,n){let r=`[mcp_servers.${CJ(t)}]\nurl = "${e}"`,i=[];if(n&&Object.keys(n).length>0){let e=[];for(let[t]of Object.entries(n)){let n=TJ(t);e.push(`"${t}" = "your-${n}-value"`),i.push({name:n,header:t})}if(r+=`\nhttp_headers = { ${e.join(`, `)} }`,i.length>0){r+=`
474
+ `),()=>{v.contains(_)&&v.removeChild(_)}},[t]),(0,S.jsx)(YSe,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:w.cloneElement(e,{ref:u})})}var ZSe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=KV(QSe),d=(0,w.useId)(),f=!0,p=(0,w.useMemo)(()=>(f=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>u.delete(e))}),[n,u,r]);return a&&f&&(p={...p}),(0,w.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),w.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,S.jsx)(XSe,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,S.jsx)(YV.Provider,{value:p,children:e})};function QSe(){return new Map}function YK(e=!0){let t=(0,w.useContext)(YV);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,w.useId)();(0,w.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,w.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var XK=e=>e.key||``;function ZK(e){let t=[];return w.Children.forEach(e,e=>{(0,w.isValidElement)(e)&&t.push(e)}),t}var QK=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=YK(o),f=(0,w.useMemo)(()=>ZK(e),[e]),p=o&&!u?[]:f.map(XK),m=(0,w.useRef)(!0),h=(0,w.useRef)(f),g=KV(()=>new Map),_=(0,w.useRef)(new Set),[v,y]=(0,w.useState)(f),[b,x]=(0,w.useState)(f);JV(()=>{m.current=!1,h.current=f;for(let e=0;e<b.length;e++){let t=XK(b[e]);p.includes(t)?(g.delete(t),_.current.delete(t)):g.get(t)!==!0&&g.set(t,!1)}},[b,p.length,p.join(`-`)]);let C=[];if(f!==v){let e=[...f];for(let t=0;t<b.length;t++){let n=b[t],r=XK(n);p.includes(r)||(e.splice(t,0,n),C.push(n))}return a===`wait`&&C.length&&(e=C),x(ZK(e)),y(f),null}let{forceRender:T}=(0,w.useContext)(GV);return(0,S.jsx)(S.Fragment,{children:b.map(e=>{let v=XK(e),y=o&&!u?!1:f===b||p.includes(v);return(0,S.jsx)(ZSe,{isPresent:y,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:y?void 0:()=>{if(_.current.has(v))return;if(_.current.add(v),g.has(v))g.set(v,!0);else return;let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(T?.(),x(h.current),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},v)})})},$K=(0,w.createContext)({strict:!1}),eq={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},tq=!1;function $Se(){if(tq)return;let e={};for(let t in eq)e[t]={isEnabled:e=>eq[t].some(t=>!!e[t])};xG(e),tq=!0}function nq(){return $Se(),zxe()}function eCe(e){let t=nq();for(let n in e)t[n]={...t[n],...e[n]};xG(t)}var tCe=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function rq(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||tCe.has(e)}var nCe=r({default:()=>iq}),iq,rCe=n((()=>{throw iq={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),aq=e=>!rq(e);function iCe(e){typeof e==`function`&&(aq=t=>t.startsWith(`on`)?!rq(t):e(t))}try{iCe((rCe(),t(nCe)).default)}catch{}function aCe(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(aq(i)||n===!0&&rq(i)||!t&&!rq(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var oq=(0,w.createContext)({});function oCe(e,t){if(hG(e)){let{initial:t,animate:n}=e;return{initial:t===!1||fG(t)?t:void 0,animate:fG(n)?n:void 0}}return e.inherit===!1?{}:t}function sCe(e){let{initial:t,animate:n}=oCe(e,(0,w.useContext)(oq));return(0,w.useMemo)(()=>({initial:t,animate:n}),[sq(t),sq(n)])}function sq(e){return Array.isArray(e)?e.join(` `):e}var cq=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function lq(e,t,n){for(let r in t)!wW(t[r])&&!GG(r,n)&&(e[r]=t[r])}function cCe({transformTemplate:e},t){return(0,w.useMemo)(()=>{let n=cq();return BG(n,t,e),Object.assign({},n.vars,n.style)},[t])}function lCe(e,t){let n=e.style||{},r={};return lq(r,n,e),Object.assign(r,cCe(e,t)),r}function uCe(e,t){let n={},r=lCe(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var uq=()=>({...cq(),attrs:{}});function dCe(e,t,n,r){let i=(0,w.useMemo)(()=>{let n=uq();return qG(n,t,YG(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};lq(t,e.style,e),i.style={...t,...i.style}}return i}var fCe=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function dq(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(fCe.indexOf(e)>-1||/[A-Z]/u.test(e))}function pCe(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??dq(e)?dCe:uCe)(t,r,i,e),c=aCe(t,typeof e==`string`,a),l=e===w.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,w.useMemo)(()=>wW(u)?u.get():u,[u]);return(0,w.createElement)(e,{...l,children:d})}function mCe({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:hCe(n,r,i,e),renderState:t()}}function hCe(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=kK(a[e]);let{initial:o,animate:s}=e,c=hG(e),l=gG(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!dG(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=_W(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var fq=e=>(t,n)=>{let r=(0,w.useContext)(oq),i=(0,w.useContext)(YV),a=()=>mCe(e,t,r,i);return n?a():KV(a)},gCe=fq({scrapeMotionValuesFromProps:KG,createRenderState:cq}),_Ce=fq({scrapeMotionValuesFromProps:XG,createRenderState:uq}),vCe=Symbol.for(`motionComponentSymbol`);function yCe(e,t,n){let r=(0,w.useRef)(n);(0,w.useInsertionEffect)(()=>{r.current=n});let i=(0,w.useRef)(null);return(0,w.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var pq=(0,w.createContext)({});function mq(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function bCe(e,t,n,r,i,a){let{visualElement:o}=(0,w.useContext)(oq),s=(0,w.useContext)($K),c=(0,w.useContext)(YV),l=(0,w.useContext)(qK),u=l.reducedMotion,d=l.skipAnimations,f=(0,w.useRef)(null),p=(0,w.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,w.useContext)(pq);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&xCe(f.current,n,i,h);let g=(0,w.useRef)(!1);(0,w.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[DW],v=(0,w.useRef)(!!_&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return JV(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,w.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function xCe(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:hq(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&mq(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:l})}function hq(e){if(e)return e.options.allowProjection===!1?hq(e.parent):e.projection}function gq(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&eCe(r);let a=n?n===`svg`:dq(e),o=a?_Ce:gCe;function s(n,s){let c,l={...(0,w.useContext)(qK),...n,layoutId:SCe(n)},{isStatic:u}=l,d=sCe(n),f=o(n,u);if(!u&&qV){CCe(l,r);let t=wCe(l);c=t.MeasureLayout,d.visualElement=bCe(e,f,l,i,t.ProjectionNode,a)}return(0,S.jsxs)(oq.Provider,{value:d,children:[c&&d.visualElement?(0,S.jsx)(c,{visualElement:d.visualElement,...l}):null,pCe(e,n,yCe(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,w.forwardRef)(s);return c[vCe]=e,c}function SCe({layoutId:e}){let t=(0,w.useContext)(GV).id;return t&&e!==void 0?t+`-`+e:e}function CCe(e,t){(0,w.useContext)($K).strict}function wCe(e){let{drag:t,layout:n}=nq();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function TCe(e,t){if(typeof Proxy>`u`)return gq;let n=new Map,r=(n,r)=>gq(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,gq(a,void 0,e,t)),n.get(a))})}var ECe=(e,t)=>t.isSVG??dq(e)?new nSe(t):new Xxe(t,{allowProjection:e!==w.Fragment}),DCe=class extends CG{constructor(e){super(e),e.animationState||=sSe(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();dG(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},OCe=0,kCe={animation:{Feature:DCe},exit:{Feature:class extends CG{constructor(){super(...arguments),this.id=OCe++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function _q(e){return{point:{x:e.pageX,y:e.pageY}}}var ACe=e=>t=>JW(t)&&e(t,_q(t));function vq(e,t,n,r){return OK(e,t,ACe(n),r)}var yq=({current:e})=>e?e.ownerDocument.defaultView:null,bq=(e,t)=>Math.abs(e-t);function jCe(e,t){let n=bq(e.x,t.x),r=bq(e.y,t.y);return Math.sqrt(n**2+r**2)}var xq=new Set([`auto`,`scroll`]),Sq=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=Tq(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=jCe(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=jH;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=Cq(t,this.transformPagePoint),kH.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=Tq(e.type===`pointercancel`?this.lastMoveEventInfo:Cq(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!JW(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=Cq(_q(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=jH;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,Tq(s,this.history)),this.removeListeners=aH(vq(this.contextWindow,`pointermove`,this.handlePointerMove),vq(this.contextWindow,`pointerup`,this.handlePointerUp),vq(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(xq.has(e.overflowX)||xq.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener(`scroll`,this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),kH.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),AH(this.updatePoint)}};function Cq(e,t){return t?{point:t(e.point)}:e}function wq(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Tq({point:e},t){return{point:e,delta:wq(e,Eq(t)),offset:wq(e,MCe(t)),velocity:NCe(t,.1)}}function MCe(e){return e[0]}function Eq(e){return e[e.length-1]}function NCe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Eq(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>cH(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>cH(t)*2&&(r=e[1]);let a=lH(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function PCe(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?fU(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?fU(n,e,r.max):Math.min(e,n)),e}function Dq(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function FCe(e,{top:t,left:n,bottom:r,right:i}){return{x:Dq(e.x,n,i),y:Dq(e.y,t,r)}}function Oq(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function ICe(e,t){return{x:Oq(e.x,t.x),y:Oq(e.y,t.y)}}function LCe(e,t){let n=.5,r=oK(e),i=oK(t);return i>r?n=oH(t.min,t.max-r,e.min):r>i&&(n=oH(e.min,e.max-i,t.min)),QV(0,1,n)}function RCe(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var kq=.35;function zCe(e=kq){return e===!1?e=0:e===!0&&(e=kq),{x:Aq(e,`left`,`right`),y:Aq(e,`top`,`bottom`)}}function Aq(e,t,n){return{min:jq(e,t),max:jq(e,n)}}function jq(e,t){return typeof e==`number`?e:e[t]||0}var BCe=new WeakMap,VCe=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=uG(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(_q(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=hxe(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),SK(e=>{let t=this.getAxisMotionValue(e).get()||0;if(QH.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=oK(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&kH.update(()=>i(e,t),!1,!0),TW(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=UCe(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&kH.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new Sq(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:yq(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&kH.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!Nq(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=PCe(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&mq(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=FCe(n.layoutBox,e):this.constraints=!1,this.elastic=zCe(t),r!==this.constraints&&!mq(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&SK(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=RCe(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!mq(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=Wxe(n,r.root,this.visualElement.getTransformPagePoint()),a=ICe(r.layout.layoutBox,i);if(t){let e=t(Vxe(a));this.hasMutatedConstraints=!!e,e&&(a=wG(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=SK(o=>{if(!Nq(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return TW(this.visualElement,e),n.start(hW(e,n,0,t,this.visualElement,!1))}stopAnimation(){SK(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){SK(t=>{let{drag:n}=this.getProps();if(!Nq(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-fU(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!mq(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};SK(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=LCe({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),SK(t=>{if(!Nq(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(fU(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;BCe.set(this.visualElement,this);let e=this.visualElement.current,t=vq(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&xxe(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();mq(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=HCe(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),kH.read(r);let o=OK(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(SK(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=kq,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Mq(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function HCe(e,t,n){let r=oG(e,Mq(n)),i=oG(t,Mq(n));return()=>{r(),i()}}function Nq(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function UCe(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var WCe=class extends CG{constructor(e){super(e),this.removeGroupControls=iH,this.removeListeners=iH,this.controls=new VCe(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||iH}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},Pq=e=>(t,n)=>{e&&kH.update(()=>e(t,n),!1,!0)},GCe=class extends CG{constructor(){super(...arguments),this.removePointerDownListener=iH}onPointerDown(e){this.session=new Sq(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:yq(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Pq(e),onStart:Pq(t),onMove:Pq(n),onEnd:(e,t)=>{delete this.session,r&&kH.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=vq(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Fq=!1,KCe=class extends w.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Fq&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),AK.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Fq=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||kH.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),UW.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Fq=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function Iq(e){let[t,n]=YK(),r=(0,w.useContext)(GV);return(0,S.jsx)(KCe,{...e,layoutGroup:r,switchLayoutGroup:(0,w.useContext)(pq),isPresent:t,safeToRemove:n})}var qCe={pan:{Feature:GCe},drag:{Feature:WCe,ProjectionNode:KK,MeasureLayout:Iq}};function Lq(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&kH.postRender(()=>i(t,_q(t)))}var JCe=class extends CG{mount(){let{current:e}=this.node;e&&(this.unmount=_xe(e,(e,t)=>(Lq(this.node,t,`Start`),e=>Lq(this.node,e,`End`))))}unmount(){}},YCe=class extends CG{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=aH(OK(this.node.current,`focus`,()=>this.onFocus()),OK(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Rq(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&kH.postRender(()=>i(t,_q(t)))}var XCe=class extends CG{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Cxe(e,(e,t)=>(Rq(this.node,t,`Start`),(e,{success:t})=>Rq(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},zq=new WeakMap,Bq=new WeakMap,ZCe=e=>{let t=zq.get(e.target);t&&t(e)},QCe=e=>{e.forEach(ZCe)};function $Ce({root:e,...t}){let n=e||document;Bq.has(n)||Bq.set(n,{});let r=Bq.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(QCe,{root:e,...t})),r[i]}function ewe(e,t,n){let r=$Ce(t);return zq.set(e,n),r.observe(e),()=>{zq.delete(e),r.unobserve(e)}}var twe={some:0,all:1},nwe=class extends CG{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:twe[r]};return ewe(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(rwe(e,t))&&this.startObserver()}unmount(){}};function rwe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var iwe={inView:{Feature:nwe},tap:{Feature:XCe},focus:{Feature:YCe},hover:{Feature:JCe}},awe={layout:{ProjectionNode:KK,MeasureLayout:Iq}},Vq=TCe({...kCe,...iwe,...qCe,...awe},ECe),owe={some:0,all:1};function swe(e,t,{root:n,margin:r,amount:i=`some`}={}){let a=BW(e),o=new WeakMap,s=new IntersectionObserver(e=>{e.forEach(e=>{let n=o.get(e.target);if(e.isIntersecting!==!!n)if(e.isIntersecting){let n=t(e.target,e);typeof n==`function`?o.set(e.target,n):s.unobserve(e.target)}else typeof n==`function`&&(n(e),o.delete(e.target))})},{root:n,rootMargin:r,threshold:typeof i==`number`?i:owe[i]});return a.forEach(e=>s.observe(e)),()=>s.disconnect()}function cwe(e,{root:t,margin:n,amount:r,once:i=!1,initial:a=!1}={}){let[o,s]=(0,w.useState)(a);return(0,w.useEffect)(()=>{if(!e.current||i&&o)return;let a=()=>(s(!0),i?void 0:()=>s(!1)),c={root:t&&t.current||void 0,margin:n,amount:r};return swe(e.current,a,c)},[t,e,n,i,r]),o}function Hq({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,w.useRef)(null),f=cwe(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,S.jsx)(QK,{children:(0,S.jsx)(Vq.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 Uq({className:e,...t}){return(0,S.jsx)(rp,{role:`status`,"aria-label":`Loading`,className:H(`size-4 animate-spin`,e),...t})}function Wq({server:e,className:t,size:n=`md`}){let[r,i]=(0,w.useState)(!0),[a,o]=(0,w.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,w.useEffect)(()=>{i(c!==null),o(!1)},[c]);let l=Tj(e);return!c||a?(0,S.jsx)(Hq,{delay:.05,children:(0,S.jsx)(pu,{className:H(`flex items-center justify-center rounded-full overflow-hidden`,s[n],t)})}):(0,S.jsx)(Hq,{delay:.05,children:(0,S.jsxs)(`div`,{className:H(`rounded-md overflow-hidden flex items-center justify-center bg-white dark:bg-zinc-800 relative`,s[n],t),children:[r&&(0,S.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-zinc-100/80 dark:bg-zinc-800/80`,children:(0,S.jsx)(Uq,{})}),(0,S.jsx)(`img`,{src:c,alt:l,className:H(`object-contain`,s[n]),onLoad:()=>i(!1),onError:()=>{i(!1),o(!0)},style:{imageRendering:`-webkit-optimize-contrast`,display:r?`none`:`block`}})]})})}var Gq=`mcp-inspector-connect-panel-mesh-animation-paused`;function lwe(){let{servers:e,addServer:t,removeServer:n,updateServerMetadata:r,updateServer:i}=yj(),a=(0,w.useRef)(new Set);(0,w.useEffect)(()=>{e.forEach(e=>{if(e.state===`ready`&&!a.current.has(e.id)){a.current.add(e.id);try{of.getInstance().capture(new Vd({serverId:e.id,serverUrl:e.url,success:!0,connectionType:`http`})).catch(()=>{})}catch{}}else e.state===`failed`&&a.current.has(e.id)&&a.current.delete(e.id)})},[e]);let o=(0,w.useCallback)(e=>{try{of.getInstance().capture(new Wd({serverId:e})).catch(()=>{})}catch{}a.current.delete(e),n(e)},[n]),[s,c]=(0,w.useState)(new Set),l=(0,w.useRef)(new Set);(0,w.useEffect)(()=>{l.current=s},[s]);let u=(0,w.useCallback)((e,n,r,i)=>{t(e,{url:e,name:n,proxyConfig:r,transportType:i,preventAutoAuth:!0,useRedirectFlow:!0})},[t]),d=(0,w.useCallback)(async(e,t)=>{if(l.current.has(e)){console.warn(`[InspectorDashboard] Connection ${e} is already being updated, skipping`);return}c(t=>new Set(t).add(e));try{await i(e,t)}catch(t){console.error(`[InspectorDashboard] Failed to update connection ${e}:`,t)}finally{c(t=>{let n=new Set(t);return n.delete(e),n})}},[i]),f=(0,w.useCallback)(async(e,t)=>{try{await r(e,t)}catch(t){console.error(`[InspectorDashboard] Failed to update connection metadata for ${e}:`,t)}},[r]),p=(0,w.useCallback)(async t=>{if(l.current.has(t)){console.warn(`[InspectorDashboard] Connection ${t} is already being reconnected, skipping`);return}let n=e.find(e=>e.id===t);if(n){c(e=>new Set(e).add(t));try{await i(t,{url:n.url,name:n.name})}catch(e){console.error(`[InspectorDashboard] Failed to reconnect server ${t}:`,e)}finally{c(e=>{let n=new Set(e);return n.delete(t),n})}}},[e,i]),m=aM(),h=nM(),[g,_]=(0,w.useState)(new Set),[v,y]=(0,w.useState)(null),[b,x]=(0,w.useState)(null),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(null);(0,w.useEffect)(()=>{of.getInstance().trackInspectorOpen({connectionCount:e.length}).catch(()=>{})},[]);let[O,k]=(0,w.useState)(``),[A,j]=(0,w.useState)(``),[M,N]=(0,w.useState)(`Direct`),[P,F]=(0,w.useState)([]),[I,L]=(0,w.useState)(`10000`),[ee,te]=(0,w.useState)(`True`),[ne,R]=(0,w.useState)(`60000`),[z,B]=(0,w.useState)(`${window.location.origin}/inspector/api/proxy`),[re,ie]=(0,w.useState)(``),[ae,oe]=(0,w.useState)(``),se=(0,w.useRef)(null),[ce,le]=(0,w.useState)(null),ue=(0,w.useCallback)(()=>{if(se.current){let{width:e,height:t}=se.current.getBoundingClientRect();le({width:Math.round(e),height:Math.round(t)})}},[]);(0,w.useEffect)(()=>{let e=requestAnimationFrame(ue),t=new ResizeObserver(ue);return se.current&&t.observe(se.current),window.addEventListener(`resize`,ue),()=>{cancelAnimationFrame(e),t.disconnect(),window.removeEventListener(`resize`,ue)}},[ue]);let[de,fe]=(0,w.useState)(()=>{try{return localStorage.getItem(Gq)===`true`}catch{return!1}}),pe=(0,w.useCallback)(()=>{fe(e=>{let t=!e;try{localStorage.setItem(Gq,t?`true`:`false`)}catch{}return t})},[]),me=(0,w.useCallback)(()=>{if(!A.trim())return;let e=A.trim();try{let t=new URL(e);if(!(t.protocol===`http:`||t.protocol===`https:`)){BM.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:`)){BM.error(`Invalid URL protocol. Please use http:// or https://`);return}e=t}catch{BM.error(`Invalid URL format. Please enter a valid URL.`);return}}let n=P.reduce((e,t)=>(t.name&&t.value&&(e[t.name]=t.value),e),{}),r=M===`Via Proxy`&&z.trim()?{proxyAddress:z.trim(),headers:n}:void 0,i={url:e,name:O.trim()||e,transportType:`http`,preventAutoAuth:!0,useRedirectFlow:!0,clientOptions:{capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},...r?{proxyConfig:r,autoProxyFallback:!1}:{},...Object.keys(n).length>0&&!r?{headers:n}:{}};t(e,i),of.getInstance().capture(new Ud({serverId:A.trim(),serverUrl:A.trim(),connectionType:`http`,viaProxy:!!r?.proxyAddress})).catch(()=>{}),k(``),j(``),F([]),ie(``),oe(``),BM.success(`Server added successfully`)},[A,O,M,z,P,t]),he=()=>{e.forEach(e=>{o(e.id)})},ge=async e=>{try{await bj(e),BM.success(`Error message copied to clipboard`)}catch{BM.error(`Failed to copy error message`)}},_e=async e=>{try{let t=null;try{let n=localStorage.getItem(`mcp-inspector-connections`);n&&(t=JSON.parse(n)[e.id])}catch(e){console.warn(`[InspectorDashboard] Could not read from localStorage:`,e)}let n=t?.proxyConfig?.headers||t?.proxyConfig?.customHeaders||t?.headers||t?.customHeaders||e.proxyConfig?.headers||e.proxyConfig?.customHeaders||e.headers||e.customHeaders||{},r=t?.proxyConfig?.proxyAddress||e.proxyConfig?.proxyAddress,i=r?`Via Proxy`:`Direct`,a=r?t?.proxyConfig||e.proxyConfig:void 0,o={url:e.url,...wj(t||e)?{name:wj(t||e)}:{},transportType:e.transportType||`http`,connectionType:i,proxyConfig:a,customHeaders:n,requestTimeout:e.requestTimeout||1e4,resetTimeoutOnProgress:e.resetTimeoutOnProgress!==!1,maxTotalTimeout:e.maxTotalTimeout||6e4,oauth:e.oauth};await bj(JSON.stringify(o,null,2)),BM.success(`Connection configuration copied to clipboard`)}catch{BM.error(`Failed to copy connection configuration`)}},ve=(e,t)=>{e.stopPropagation(),t()},ye=(0,w.useCallback)(t=>{if(!b)return;let r=xj(b)||e.find(e=>e.id===b);t.url===b?r&&Cj(r,t)?f(b,{name:t.name||t.url}):d(b,{name:t.name,proxyConfig:t.proxyConfig,transportType:t.transportType}):(n(b),u(t.url,t.name,t.proxyConfig,t.transportType)),x(null),BM.success(`Connection settings updated`)},[b,e,n,u,f,d]),be=e=>{if(e.state===`failed`)return;if(e.state!==`ready`){BM.error(`Server is not connected and cannot be inspected`);return}let t=new URLSearchParams(h.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),m(`/?${i.toString()}`)},xe=e=>{console.log(`[InspectorDashboard] Reconnecting server:`,e.id),e.state===`failed`&&e.retry?e.retry():p(e.id)};return(0,w.useEffect)(()=>{_(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,w.useEffect)(()=>{if(!v)return;let t=e.find(e=>e.id===v),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`)){y(null);let e=new URLSearchParams(h.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),m(`/?${i.toString()}`)}else t&&t.state===`failed`&&!n&&t.error&&(console.warn(`[InspectorDashboard] Connection failed with no data, canceling navigation`),y(null))},[e,v,m]),(0,S.jsxs)(`div`,{className:`flex flex-col lg:flex-row items-start justify-start gap-4 h-auto lg:h-full relative`,children:[(0,S.jsxs)(`div`,{className:`w-full px-3 pt-6 sm:px-6 sm:pt-3 overflow-visible lg:overflow-auto`,children:[(0,S.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,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.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,S.jsxs)(kt,{variant:`secondary`,className:`text-xs cursor-pointer hover:bg-secondary/80 transition-colors`,children:[`v`,typeof window<`u`&&window.__INSPECTOR_VERSION__||`1.0.0`]})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Visit GitHub`})})]}),(0,S.jsx)(`h2`,{className:`text-2xl font-medium tracking-tight text-center sm:text-left order-2 sm:order-1`,children:`MCP Inspector`})]}),(0,S.jsx)(`p`,{className:`text-muted-foreground relative z-10 text-center sm:text-left`,children:`Inspect and debug MCP (Model Context Protocol) servers`}),(0,S.jsxs)(`div`,{className:`space-y-4 mt-4 sm:mt-8`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center sm:items-center justify-between gap-3`,children:[(0,S.jsx)(`h3`,{className:`hidden sm:block text-base font-medium text-center sm:text-left`,children:`Connected Servers`}),(0,S.jsx)(`div`,{className:`hidden sm:flex items-center gap-3 justify-center sm:justify-start`,children:e.length>0&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:he,children:`Clear All`})})]}),e.length===0?(0,S.jsx)(su,{message:`No servers connected yet. Add a server above to get started.`}):(0,S.jsx)(`div`,{className:`grid gap-3`,children:e.map(e=>(0,S.jsxs)(`div`,{"data-testid":`server-tile-${e.id}`,onClick:()=>be(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,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(Wq,{server:e,size:`md`}),(0,S.jsx)(`h4`,{className:`font-semibold text-sm`,children:Tj(e)}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:s.has(e.id)?(0,S.jsx)(rp,{className:`w-3 h-3 animate-spin text-blue-500`}):e.error&&e.state!==`ready`?(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,"data-testid":`server-tile-status-${e.state}`,onClick:t=>{t.stopPropagation(),ge(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`})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{className:`max-w-xs`,children:e.error})})]}):(0,S.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,S.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground dark:text-zinc-400 font-mono`,children:e.url}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:async t=>{t.stopPropagation();try{await bj(e.url),BM.success(`URL copied to clipboard`)}catch{BM.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,S.jsx)(Lf,{className:`w-3 h-3 text-muted-foreground`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Copy URL`})})]})]})]}),(0,S.jsxs)(`div`,{className:`hidden lg:flex items-center gap-1 flex-shrink-0`,children:[(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-copy-config`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>_e(e)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(Lf,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Copy connection config`})})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-info`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>{D(e),T(!0)}),className:`h-8 w-8 p-0`,children:(0,S.jsx)(ep,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`View server info`})})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-settings`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>x(e.id)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(wp,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Edit connection settings`})})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-remove`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>o(e.id)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(Mf,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Remove connection`})})]}),(e.state===`ready`||e.state===`failed`||e.state===`discovering`)&&(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{"data-testid":`server-tile-reconnect`,variant:`secondary`,size:`sm`,onClick:t=>ve(t,()=>xe(e)),className:`h-8 w-8 p-0`,children:(0,S.jsx)(yp,{className:`w-4 h-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:e.state===`failed`?`Retry connection`:e.state===`discovering`?`Reconnect`:`Resync connection`})})]})]}),(0,S.jsx)(`div`,{className:`lg:hidden flex-shrink-0`,children:(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:e=>e.stopPropagation(),children:(0,S.jsx)(Bf,{className:`h-4 w-4`})})}),(0,S.jsxs)(eu,{align:`end`,children:[(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),_e(e)},children:[(0,S.jsx)(Lf,{className:`h-4 w-4 mr-2`}),`Copy connection config`]}),(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),D(e),T(!0)},children:[(0,S.jsx)(ep,{className:`h-4 w-4 mr-2`}),`View server info`]}),(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),x(e.id)},children:[(0,S.jsx)(wp,{className:`h-4 w-4 mr-2`}),`Edit connection settings`]}),(e.state===`ready`||e.state===`failed`||e.state===`discovering`)&&(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),xe(e)},children:[(0,S.jsx)(yp,{className:`h-4 w-4 mr-2`}),e.state===`failed`?`Retry connection`:e.state===`discovering`?`Reconnect`:`Resync connection`]}),(0,S.jsxs)(tu,{onClick:t=>{t.stopPropagation(),o(e.id)},className:`text-destructive focus:text-destructive`,children:[(0,S.jsx)(Mf,{className:`h-4 w-4 mr-2`}),`Remove connection`]})]})]})})]}),(e.state===`pending_auth`||e.state===`authenticating`)&&(0,S.jsx)(`div`,{className:`text-sm text-yellow-600 dark:text-yellow-400 mt-2`,children:e.state===`authenticating`?(0,S.jsxs)(U,{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,S.jsx)(rp,{className:`mr-2 h-4 w-4 animate-spin`}),`Authenticating...`]}):e.authUrl?(0,S.jsx)(U,{"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`,asChild:!0,children:(0,S.jsx)(`a`,{href:e.authUrl,onClick:e=>e.stopPropagation(),children:`Authenticate`})}):null}),e.state===`failed`&&e.error&&(e.error.includes(`401`)||e.error.includes(`Unauthorized`))&&e.error.includes(`does not support OAuth`)&&(0,S.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,S.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,S.jsx)(`div`,{className:`absolute inset-0 z-0 overflow-hidden dark:opacity-60 pointer-events-none`,children:(0,S.jsx)(Hu,{width:ce?.width??1280,height:ce?.height??720,colors:[`#e0eaff`,`#f9ffbd`,`#dedede`,`#ffffff`],distortion:.8,swirl:.1,grainMixer:0,grainOverlay:.2,speed:+!de})}),(0,S.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,S.jsx)(`div`,{className:`absolute inset-0 noise`,style:{background:`url("${uu}")`,filter:`contrast(150%) brightness(550%)`}})}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:pe,"aria-label":de?`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:de?(0,S.jsx)(mp,{className:`h-3 w-3 ml-px`,fill:`currentColor`}):(0,S.jsx)(Np,{className:`h-2.5 w-2.5`,fill:`currentColor`})})}),(0,S.jsx)(Id,{side:`left`,children:(0,S.jsx)(`p`,{children:de?`Enable shader animation`:`Disable shader animation`})})]}),(0,S.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,S.jsx)(LP,{alias:O,setAlias:k,url:A,setUrl:j,connectionType:M,setConnectionType:N,customHeaders:P,setCustomHeaders:F,requestTimeout:I,setRequestTimeout:L,resetTimeoutOnProgress:ee,setResetTimeoutOnProgress:te,maxTotalTimeout:ne,setMaxTotalTimeout:R,proxyAddress:z,setProxyAddress:B,clientId:re,setClientId:ie,scope:ae,setScope:oe,onConnect:me,variant:`styled`,showConnectButton:!0,showExportButton:!0})})]}),(0,S.jsx)(WV,{connection:b&&e.find(e=>e.id===b)||null,open:b!==null,onOpenChange:e=>{e||x(null)},onConnect:ye}),(0,S.jsx)(UV,{open:C,onOpenChange:T,connection:E})]})}var Kq=(0,w.createContext)(void 0);function uwe({children:e}){let t=(typeof window<`u`?window.__MANUFACT_CHAT_URL__:void 0)??void 0,[n,r]=(0,w.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`,chatCredentials:`include`,chatEnableFreeTierUpgrade:!0}:{}}),i=(0,w.useCallback)(e=>{r(t=>({...t,selectedServerId:e}))},[]),a=(0,w.useCallback)(e=>{r(t=>({...t,activeTab:e}))},[]),o=(0,w.useCallback)(e=>{r(t=>({...t,selectedToolName:e}))},[]),s=(0,w.useCallback)(e=>{r(t=>({...t,selectedPromptName:e}))},[]),c=(0,w.useCallback)(e=>{r(t=>({...t,selectedResourceUri:e}))},[]),l=(0,w.useCallback)(e=>{r(t=>({...t,selectedSamplingRequestId:e}))},[]),u=(0,w.useCallback)(e=>{r(t=>({...t,selectedElicitationRequestId:e}))},[]),d=(0,w.useCallback)(e=>{r(t=>({...t,tunnelUrl:e}))},[]),f=(0,w.useCallback)(e=>{r(t=>({...t,isTunnelStarting:e}))},[]),p=(0,w.useCallback)((e,t={})=>{r(n=>({...n,isEmbedded:e,embeddedConfig:t}))},[]),m=(0,w.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,w.useCallback)(()=>{r(e=>({...e,selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null}))},[]);return(0,S.jsx)(Kq,{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 qq(){let e=(0,w.use)(Kq);if(!e)throw Error(`useInspector must be used within InspectorProvider`);return e}var Jq=`__mcpUseInspectorReconnect`;function Yq(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`};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`,connectionType:e.connectionType===`Via Proxy`?`Via Proxy`:`Direct`,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`}):(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 dwe({connections:e,addConnection:t,removeConnection:n,configLoaded:r,embedded:i=!1}){let a=aM(),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),[u,d]=(0,w.useState)(!1),f=(0,w.useCallback)(e=>{let{url:n,name:r,transportType:a,connectionType:o,customHeaders:s,auth:c}=e;console.log(`[useAutoConnect] Config received:`,e),console.log(`[useAutoConnect] Custom headers before auth:`,s),console.log(`[useAutoConnect] Auth config:`,c);let l={...s};if(c?.access_token){let e=c.token_type||`bearer`;if(l.Authorization=`${e.charAt(0).toUpperCase()+e.slice(1)} ${c.access_token}`,console.log(`[useAutoConnect] Added Authorization header:`,l.Authorization),typeof window<`u`&&!i){let e=`mcp:auth:${n}`,t={access_token:c.access_token,token_type:c.token_type||`bearer`,expires_at:c.expires_at,refresh_token:c.refresh_token,scope:c.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:`,l);let u;try{let e=new URL(n).origin,t=window.location.origin;t!==e&&(u=`${t}/inspector/api/proxy`)}catch{u=`${window.location.origin}/inspector/api/proxy`}let d={...u?{proxyAddress:u}:{},...Object.keys(l).length>0&&{headers:l}};console.warn(`[useAutoConnect] Attempting connection (${o}):`,{url:n,transportType:a,proxyConfig:d}),t(n,r,d,a)},[t]),p=(0,w.useCallback)(t=>{let n=e.find(e=>e.url===t.url);if(n)if(n.state===`ready`){console.warn(`[useAutoConnect] Connection already ready, navigating to server`);let e=new URLSearchParams(window.location.search),t=e.get(`tunnelUrl`),r=e.get(`tab`),i=e.get(`openTunnelPopover`),o=new URLSearchParams;o.set(`server`,n.id),t&&o.set(`tunnelUrl`,t),r&&o.set(`tab`,r),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,f]);return(0,w.useEffect)(()=>{if(u)return;let e=()=>{if(typeof sessionStorage>`u`)return!1;try{let e=sessionStorage.getItem(Jq);if(!e)return!1;let t=JSON.parse(e);return sessionStorage.removeItem(Jq),!t?.url||!t.transportType?!1:(p(t),!0)}catch{try{sessionStorage.removeItem(Jq)}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=Yq(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=Yq(t);e&&p(e),d(!0);return}fetch(`/inspector/config.json`).then(e=>e.json()).then(e=>{if(d(!0),e.autoConnectUrl){let t=Yq(e.autoConnectUrl);t&&p(t)}}).catch(()=>d(!0))},[u,r,p,i]),(0,w.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`),BM.error(`Cannot connect to server. Please check the URL and try again.`),queueMicrotask(()=>{s(!1),l(null)}))},[e,c,a]),(0,w.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,w.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 Xq(e){(0,w.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 Zq=`mcp-inspector-saved-requests`;function fwe(){let[e,t]=(0,w.useState)([]);return(0,w.useEffect)(()=>{try{let e=localStorage.getItem(Zq);e&&t(JSON.parse(e))}catch(e){console.error(`[useSavedRequests] Failed to load saved requests:`,e)}},[]),(0,w.useEffect)(()=>{let e=e=>{if(e.key===Zq&&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)},[]),e}var Qq=1,pwe=.9,mwe=.8,hwe=.17,$q=.1,eJ=.999,gwe=.9999,_we=.99,vwe=/[\\\/_+.#"@\[\(\{&]/,ywe=/[\\\/_+.#"@\[\(\{&]/g,bwe=/[\s-]/,tJ=/[\s-]/g;function nJ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Qq:_we;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=nJ(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Qq:vwe.test(e.charAt(l-1))?(d*=mwe,p=e.slice(i,l-1).match(ywe),p&&i>0&&(d*=eJ**+p.length)):bwe.test(e.charAt(l-1))?(d*=pwe,m=e.slice(i,l-1).match(tJ),m&&i>0&&(d*=eJ**+m.length)):(d*=hwe,i>0&&(d*=eJ**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=gwe)),(d<$q&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=nJ(e,t,n,r,l+1,a+2,o),f*$q>d&&(d=f*$q)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function rJ(e){return e.toLowerCase().replace(tJ,` `)}function xwe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,nJ(e,t,rJ(e),rJ(t),0,0,{})}var iJ=`[cmdk-group=""]`,aJ=`[cmdk-group-items=""]`,Swe=`[cmdk-group-heading=""]`,oJ=`[cmdk-item=""]`,sJ=`${oJ}:not([aria-disabled="true"])`,cJ=`cmdk-item-select`,lJ=`data-value`,Cwe=(e,t,n)=>xwe(e,t,n),uJ=w.createContext(void 0),dJ=()=>w.useContext(uJ),fJ=w.createContext(void 0),pJ=()=>w.useContext(fJ),mJ=w.createContext(void 0),hJ=w.forwardRef((e,t)=>{let n=yJ(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=yJ(()=>new Set),i=yJ(()=>new Map),a=yJ(()=>new Map),o=yJ(()=>new Set),s=_J(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Fn(),y=Fn(),b=Fn(),x=w.useRef(null),S=Pwe();vJ(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),vJ(()=>{S(6,A)},[]);let C=w.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),S(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=j()?.id,C.emit()}),r||S(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=w.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),S(2,()=>{D(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{k(),D(),n.current.value||O(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();S(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function E(e,t){let r=s.current?.filter??Cwe;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(aJ);t?t.appendChild(e.parentElement===t?e:e.closest(`${aJ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${aJ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${iJ}[${lJ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(lJ);C.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(iJ)?.querySelector(Swe))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return x.current?.querySelector(`${oJ}[aria-selected="true"]`)}function M(){return Array.from(x.current?.querySelectorAll(sJ)||[])}function N(e){let t=M()[e];t&&C.setState(`value`,t.getAttribute(lJ))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(lJ))}function F(e){let t=j()?.closest(iJ),n;for(;t&&!n;)t=e>0?Mwe(t,iJ):Nwe(t,iJ),n=t?.querySelector(sJ);n?C.setState(`value`,n.getAttribute(lJ)):P(e)}let I=()=>N(M().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},ee=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return w.createElement(AN.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:g&&e.ctrlKey&&ee(e);break;case`ArrowUp`:ee(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(cJ);t.dispatchEvent(e)}}}}},w.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Iwe},c),SJ(e,e=>w.createElement(fJ.Provider,{value:C},w.createElement(uJ.Provider,{value:T},e))))}),wwe=w.forwardRef((e,t)=>{let n=Fn(),r=w.useRef(null),i=w.useContext(mJ),a=dJ(),o=_J(e),s=o.current?.forceMount??i?.forceMount;vJ(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=xJ(n,r,[e.value,e.children,r],e.keywords),l=pJ(),u=bJ(e=>e.value&&e.value===c.current),d=bJ(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);w.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(cJ,f),()=>t.removeEventListener(cJ,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return w.createElement(AN.div,{ref:E(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Twe=w.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Fn(),s=w.useRef(null),c=w.useRef(null),l=Fn(),u=dJ(),d=bJ(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);vJ(()=>u.group(o),[]),xJ(o,s,[e.value,e.heading,c]);let f=w.useMemo(()=>({id:o,forceMount:i}),[i]);return w.createElement(AN.div,{ref:E(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&w.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),SJ(e,e=>w.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},w.createElement(mJ.Provider,{value:f},e))))}),Ewe=w.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=w.useRef(null),a=bJ(e=>!e.search);return!n&&!a?null:w.createElement(AN.div,{ref:E(i,t),...r,"cmdk-separator":``,role:`separator`})}),Dwe=w.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=pJ(),o=bJ(e=>e.search),s=bJ(e=>e.selectedItemId),c=dJ();return w.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),w.createElement(AN.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Owe=w.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=w.useRef(null),o=w.useRef(null),s=bJ(e=>e.selectedItemId),c=dJ();return w.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),w.createElement(AN.div,{ref:E(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},SJ(e,e=>w.createElement(`div`,{ref:E(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),kwe=w.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return w.createElement(hN,{open:n,onOpenChange:r},w.createElement(_N,{container:o},w.createElement(vN,{"cmdk-overlay":``,className:i}),w.createElement(yN,{"aria-label":e.label,"cmdk-dialog":``,className:a},w.createElement(hJ,{ref:t,...s}))))}),Awe=w.forwardRef((e,t)=>bJ(e=>e.filtered.count===0)?w.createElement(AN.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),jwe=w.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return w.createElement(AN.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},SJ(e,e=>w.createElement(`div`,{"aria-hidden":!0},e)))}),gJ=Object.assign(hJ,{List:Owe,Item:wwe,Input:Dwe,Group:Twe,Separator:Ewe,Dialog:kwe,Empty:Awe,Loading:jwe});function Mwe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Nwe(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _J(e){let t=w.useRef(e);return vJ(()=>{t.current=e}),t}var vJ=typeof window>`u`?w.useEffect:w.useLayoutEffect;function yJ(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function bJ(e){let t=pJ(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function xJ(e,t,n,r=[]){let i=w.useRef(),a=dJ();return vJ(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(lJ,s),i.current=s}),i}var Pwe=()=>{let[e,t]=w.useState(),n=yJ(()=>new Map);return vJ(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Fwe(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function SJ({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(Fwe(t),{ref:t.ref},n(t.props.children)):n(t)}var Iwe={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function CJ(e){return e.replace(/[^a-zA-Z0-9-_]/g,`_`).toLowerCase()}function wJ(e){return`'${e.replace(/'/g,`'\\''`)}'`}function TJ(e){return e.replace(/[^a-zA-Z0-9]/g,`_`).toUpperCase().replace(/^_+|_+$/g,``)}function EJ(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]=`{{${TJ(t)}}}`;r.headers=e}let i=JSON.stringify(r);return`cursor://anysphere.cursor-deeplink/mcp/install?config=${btoa(i)}&name=${encodeURIComponent(CJ(t))}`}function DJ(e,t,n){let r={url:e,name:CJ(t),type:`http`};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TJ(t)}-value`;r.headers=e}let i=JSON.stringify(r);return`vscode:mcp/install?${encodeURIComponent(i)}`}function OJ(e,t,n){let r={url:e,name:CJ(t),type:`http`};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TJ(t)}-value`;r.headers=e}let i=JSON.stringify(r);return`vscode-insiders:mcp/install?${encodeURIComponent(i)}`}function Lwe(e,t,n){let r={url:e,name:CJ(t)};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${TJ(t)}-value`;r.headers=e}return r}function kJ(e,t,n){try{let r=Lwe(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=`${CJ(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 AJ(e,t,n){let r=`claude mcp add --transport http "${CJ(t)}" \\\n ${wJ(e)}`,i=[];if(n&&Object.keys(n).length>0)for(let[e]of Object.entries(n)){let t=TJ(e);r+=` \\\n --header ${wJ(`${e}:\${${t}}`)}`,i.push({name:t,header:e})}return{command:r,envVars:i}}function jJ(e,t,n){let r=`gemini mcp add --transport http "${CJ(t)}" ${wJ(e)}`,i=[];if(n&&Object.keys(n).length>0)for(let[e]of Object.entries(n)){let t=TJ(e);r+=` \\\n --header ${wJ(`${e}:\${${t}}`)}`,i.push({name:t,header:e})}return{command:r,envVars:i}}function MJ(e,t,n){let r=`[mcp_servers.${CJ(t)}]\nurl = "${e}"`,i=[];if(n&&Object.keys(n).length>0){let e=[];for(let[t]of Object.entries(n)){let n=TJ(t);e.push(`"${t}" = "your-${n}-value"`),i.push({name:n,header:t})}if(r+=`\nhttp_headers = { ${e.join(`, `)} }`,i.length>0){r+=`
475
475
 
476
476
  # (optional) Use environment variables instead:
477
477
  # env_http_headers = { `;let e=i.map(({name:e,header:t})=>`"${t}" = "${e}"`);r+=e.join(`, `),r+=` }`}}return{config:r,envVars:i}}function NJ(e){if(e.length===0)return``;let t=`Set these environment variables in your shell:
@@ -795,16 +795,16 @@ Based on this information, suggest 3-5 common customizable properties like theme
795
795
  `)}`})}let h=i??(a?await a():void 0)??`/inspector/api/chat/stream`,g=[...[...p,...C].map(e=>({role:e.role,content:e.content||(e.parts?.filter(e=>e.type===`text`).map(e=>e.text).join(``)??``),attachments:e.attachments})),...s],_=await fetch(h,{method:`POST`,headers:{"Content-Type":`application/json`,...d},signal:x.current.signal,...u?{credentials:u}:{},body:JSON.stringify(f?f(g):{mcpServerUrl:e,llmConfig:t,authConfig:r,messages:g,...c&&c.size>0?{disabledTools:[...c]}:{}})});if(!_.ok){if(_.status===429){let e=await _.json().catch(()=>null);e?.loginRequired&&e?.loginUrl&&b({loginUrl:e.loginUrl}),m(e=>e.filter(e=>e.id!==`assistant-${Date.now()}`));return}throw Error(`HTTP error! status: ${_.status}`)}let v=`assistant-${Date.now()}`,y=``,S=[];m(e=>[...e,{id:v,role:`assistant`,content:``,timestamp:Date.now(),parts:[]}]);let w=_.body?.getReader(),T=new TextDecoder;if(!w)throw Error(`No response body`);let E=()=>{m(e=>e.map(e=>e.id===v?{...e,parts:[...S]}:e))},D=()=>{m(e=>e.map(e=>e.id===v?{...e,parts:[...S],content:``}:e))},O=e=>{y+=e;let t=S[S.length-1];t&&t.type===`text`?t.text=y:S.push({type:`text`,text:y}),E()},k=(e,t)=>{y&&=``,S.push({type:`tool-invocation`,toolInvocation:{toolName:e,args:t,state:`pending`}}),E()},A=(e,t)=>{let n;n=e.by===`toolName`?S.find(t=>t.type===`tool-invocation`&&t.toolInvocation?.toolName===e.toolName&&!t.toolInvocation?.result):S[e.index],n?.toolInvocation&&(n.toolInvocation.result=t,n.toolInvocation.state=t?.isError?`error`:`result`,E())},j=new Map,M=``;for(;;){if(x.current?.signal.aborted){await w.cancel();break}let{done:e,value:t}=await w.read();if(e)break;M+=T.decode(t,{stream:!0});let n=M.split(`
796
796
  `);M=n.pop()||``;for(let e of n)if(e.trim())try{if(l===`data-stream`){let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t),r=e.slice(t+1),i;try{i=JSON.parse(r)}catch{continue}switch(n){case`0`:O(typeof i==`string`?i:String(i));break;case`9`:{let e=i,t=e.args??{};if(typeof t.input==`string`&&Object.keys(t).length===1)try{let e=JSON.parse(t.input);typeof e==`object`&&e&&(t=e)}catch{}k(String(e.toolName??``),t),e.toolCallId&&j.set(e.toolCallId,S.length-1);break}case`a`:{let e=i,t=j.get(e.toolCallId),n=e.result,r=n;if(r?.lc===1&&r?.type===`constructor`&&r?.kwargs?.content){let e=r.kwargs.content;if(typeof e==`string`)try{n=JSON.parse(e)}catch{n=e}}t!==void 0&&A({by:`index`,index:t},n);break}case`d`:D();break;case`3`:throw Error(typeof i==`string`?i:JSON.stringify(i));default:break}}else{if(!e.startsWith(`data: `))continue;let t=JSON.parse(e.slice(6));if(t.type!==`message`){if(t.type===`text`)O(t.content);else if(t.type===`tool-call`)k(t.toolName,t.args);else if(t.type===`tool-result`)A({by:`toolName`,toolName:t.toolName},t.result);else if(t.type===`done`)D();else if(t.type===`error`)throw Error(t.message||`Streaming error`)}}}catch(t){if(t instanceof Error&&t.message!==`Streaming error`)console.error(`Failed to parse streaming event:`,t,e);else throw t}}if(x.current?.signal.aborted){for(let e of S)e.type===`tool-invocation`&&e.toolInvocation?.state===`pending`&&(e.toolInvocation.state=`error`,e.toolInvocation.result=`Cancelled by user`);m(e=>e.map(e=>e.id===v?{...e,parts:[...S],content:``}:e))}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;let t=`Unknown error occurred`;if(e instanceof Error){t=e.message;let n=e;n.status&&(t=`HTTP ${n.status}: ${t}`),(n.code===401||t.includes(`401`)||t.includes(`Unauthorized`))&&(t=`Authentication failed (401). Check your Authorization header in the connection settings.`)}let n={id:`error-${Date.now()}`,role:`assistant`,content:`Error: ${t}`,timestamp:Date.now()};m(e=>[...e,n])}finally{g(!1),x.current=null}},[t,r,e,p,n,_,i,a,o,c,l,u,d,f]),clearMessages:(0,w.useCallback)(()=>{m([]),b(null)},[]),clearRateLimitInfo:(0,w.useCallback)(()=>{b(null)},[]),setMessages:m,stop:(0,w.useCallback)(()=>{x.current&&x.current.abort()},[]),addAttachment:(0,w.useCallback)(async e=>{try{let t=await TY(e);v(e=>{let n=[...e,t];return wY(n)?n:(alert(`Total attachment size exceeds 20MB limit`),e)})}catch(e){e instanceof Error?alert(e.message):alert(`Failed to add attachment`)}},[]),removeAttachment:(0,w.useCallback)(e=>{v(t=>t.filter((t,n)=>n!==e))},[]),clearAttachments:(0,w.useCallback)(()=>{v([])},[])}}async function*XMe(e){let{config:t,tools:n,callTool:r,signal:i}=e,a=e.maxSteps??10,o=[...e.messages];for(let e=0;e<a;e++){if(i?.aborted)return;let e=[],a=``;try{for await(let r of bMe({config:t,messages:o,tools:n,signal:i}))r.type===`text-delta`?a+=r.delta:r.type===`tool-call-ready`&&e.push({id:r.toolCallId,name:r.toolName,args:r.args}),yield r}catch(e){yield{type:`error`,message:e instanceof Error?e.message:String(e)};return}if(e.length===0)return;o.push({role:`assistant`,content:a,toolCalls:e});for(let t of e){if(i?.aborted)return;let e,n=!1;try{e=await r(t.name,t.args)}catch(t){n=!0,e={error:t instanceof Error?t.message:String(t)}}let a=ZMe(e),s=typeof a==`string`?a:JSON.stringify(a);o.push({role:`tool`,content:s,toolCallId:t.id,toolName:t.name,toolResult:e,toolIsError:n}),yield{type:`tool-result`,toolCallId:t.id,toolName:t.name,result:e,isError:n}}}}function ZMe(e){if(e&&typeof e==`object`&&!Array.isArray(e)){let{_meta:t,...n}=e;return n}return e}var QMe=`You are a helpful assistant with access to MCP tools. Help users interact with the MCP server.`;function $Me({connection:e,llmConfig:t,isConnected:n,readResource:r,widgetModelContexts:i,disabledTools:a}){let[o,s]=(0,w.useState)([]),[c,l]=(0,w.useState)(!1),[u,d]=(0,w.useState)([]),f=(0,w.useRef)(null);return{messages:o,isLoading:c,attachments:u,sendMessage:(0,w.useCallback)(async(c,p,m)=>{let h=[...u,...m??[]];if(!(c.trim()||p.length>0||h.length>0)||!t||!n)return;let g=JMe(p),_={id:`user-${Date.now()}`,role:`user`,content:c.trim(),timestamp:Date.now(),attachments:h.length>0?h:void 0},v=[...g];(c.trim()||h.length>0)&&v.push(_),s(e=>[...e,...v]),l(!0),d([]),f.current=new AbortController;let y=Date.now(),b=0;try{let n=`assistant-${Date.now()}`,l=``,u=[],d=new Map,p=0,m=async()=>{let e=Date.now();e-p>=80&&(p=e,await new Promise(e=>setTimeout(e,0)))};s(e=>[...e,{id:n,role:`assistant`,content:``,timestamp:Date.now(),parts:[]}]);let h=(e.tools??[]).filter(e=>!a?.has(e.name)).map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema??{type:`object`}})),v=[];if(i&&i.size>0){let e=[];for(let[,t]of i)t&&(t.content?.length?e.push(t.content.map(e=>e.text).join(`
797
797
  `)):t.structuredContent&&e.push(JSON.stringify(t.structuredContent)));e.length>0&&v.push({id:`widget-context-${Date.now()}`,role:`user`,content:`[Current Widget State]\n${e.join(`
798
- `)}`,timestamp:Date.now()})}let x=(_.attachments?.length??0)>0,S=qMe([...o,...g,...v,...c.trim()||x?[_]:[]]);S.unshift({role:`system`,content:QMe});let C=e=>{try{return JSON.parse(e)}catch{let t=[()=>{let t=e;(t.match(/(?<!\\)"/g)||[]).length%2!=0&&(t+=`"`);let n=(t.match(/{/g)||[]).length-(t.match(/}/g)||[]).length,r=(t.match(/\[/g)||[]).length-(t.match(/]/g)||[]).length;for(let e=0;e<r;e++)t+=`]`;for(let e=0;e<n;e++)t+=`}`;return JSON.parse(t)},()=>{let t=e;t=t.replace(/,\s*"[^"]*"?\s*:\s*("([^"\\]|\\.)*)?$/,``),t=t.replace(/,\s*"[^"]*$/,``),(t.match(/(?<!\\)"/g)||[]).length%2!=0&&(t+=`"`);let n=(t.match(/{/g)||[]).length-(t.match(/}/g)||[]).length,r=(t.match(/\[/g)||[]).length-(t.match(/]/g)||[]).length;for(let e=0;e<r;e++)t+=`]`;for(let e=0;e<n;e++)t+=`}`;return JSON.parse(t)}];for(let e of t)try{return e()}catch{}return}},w=()=>{s(e=>e.map(e=>e.id===n?{...e,parts:[...u]}:e))},T=async e=>{let t=e.toolInvocation?.result,n=t?._meta?.[`openai/outputTemplate`];if(!(!n||typeof n!=`string`||!r))try{let i=await r(n);if(i?.contents&&Array.isArray(i.contents)){let n=i.contents.map(e=>({type:`resource`,resource:e}));e.toolInvocation.result={...t,content:[...t.content||[],...n],structuredContent:t?.structuredContent||null}}}catch(e){console.error(`Failed to fetch Apps SDK resource:`,e)}};for await(let n of XMe({config:{provider:t.provider,model:t.model,apiKey:t.apiKey,temperature:t.temperature},messages:S,tools:h,callTool:async(t,n)=>await e.callTool(t,n,{signal:f.current?.signal}),maxSteps:10,signal:f.current?.signal})){if(f.current?.signal.aborted)break;if(n.type===`text-delta`){l+=n.delta;let e=u[u.length-1];e&&e.type===`text`?e.text=l:u.push({type:`text`,text:l}),w()}else if(n.type===`tool-call-start`)l&&=``,d.set(n.toolCallId,{name:n.toolName,accumulatedJson:``}),u.push({type:`tool-invocation`,toolInvocation:{toolName:n.toolName,args:{},state:`streaming`,partialArgs:{}}}),w();else if(n.type===`tool-call-args-delta`){let e=d.get(n.toolCallId);if(e){e.accumulatedJson+=n.argsDelta;let t=C(e.accumulatedJson);if(t){let n=u.find(t=>t.type===`tool-invocation`&&t.toolInvocation?.state===`streaming`&&t.toolInvocation?.toolName===e.name);if(n&&n.toolInvocation){let e=n.toolInvocation.partialArgs,r=e?Object.keys(e):[],i=Object.keys(t),a=r.reduce((t,n)=>t+String(e[n]??``).length,0),o=i.reduce((e,n)=>e+String(t[n]??``).length,0);(i.length>r.length||o>=a)&&(n.toolInvocation.partialArgs=t),w(),await m()}}}}else if(n.type===`tool-call-ready`){b++,l&&=``;let e=u.find(e=>e.type===`tool-invocation`&&e.toolInvocation?.state===`streaming`&&e.toolInvocation?.toolName===n.toolName);e&&e.toolInvocation?(e.toolInvocation.args=n.args,e.toolInvocation.state=`pending`):u.push({type:`tool-invocation`,toolInvocation:{toolName:n.toolName,args:n.args,state:`pending`}}),w()}else if(n.type===`tool-result`){let e=u.find(e=>e.type===`tool-invocation`&&e.toolInvocation?.toolName===n.toolName&&!e.toolInvocation?.result);e&&e.toolInvocation&&(e.toolInvocation.result=n.result,e.toolInvocation.state=n.isError||n.result?.isError?`error`:`result`,await T(e),w())}else if(n.type===`error`)throw Error(n.message)}if(f.current?.signal.aborted)for(let e of u)e.type===`tool-invocation`&&e.toolInvocation?.state===`pending`&&(e.toolInvocation.state=`error`,e.toolInvocation.result=`Cancelled by user`);s(e=>e.map(e=>e.id===n?{...e,parts:[...u],content:``}:e)),t&&of.getInstance().capture(new Hd({serverId:e.url,provider:t.provider,model:t.model,messageCount:o.length+1,toolCallsCount:b,success:!0,executionMode:`client-side`,duration:Date.now()-y})).catch(()=>{})}catch(n){if(n instanceof DOMException&&n.name===`AbortError`)return;console.error(`Client-side agent error:`,n);let r=`Unknown error occurred`;if(n instanceof Error){r=n.message;let e=n;e.status&&(r=`HTTP ${e.status}: ${r}`),(e.code===401||r.includes(`401`)||r.includes(`Unauthorized`))&&(r=`Authentication failed (401). Check your Authorization header in the connection settings.`)}t&&of.getInstance().capture(new Hd({serverId:e.url,provider:t.provider,model:t.model,messageCount:o.length+1,toolCallsCount:b,success:!1,executionMode:`client-side`,duration:Date.now()-y,error:r})).catch(()=>{});let i={id:`error-${Date.now()}`,role:`assistant`,content:`Error: ${r}`,timestamp:Date.now()};s(e=>[...e,i])}finally{l(!1),f.current=null}},[e,t,n,o,r,u,a,i]),clearMessages:(0,w.useCallback)(()=>{s([])},[]),setMessages:s,stop:(0,w.useCallback)(()=>{f.current&&f.current.abort()},[]),addAttachment:(0,w.useCallback)(async e=>{try{let t=await TY(e);d(e=>{let n=[...e,t];return wY(n)?n:(alert(`Total attachment size exceeds 20MB limit`),e)})}catch(e){e instanceof Error?alert(e.message):alert(`Failed to add attachment`)}},[]),removeAttachment:(0,w.useCallback)(e=>{d(t=>t.filter((t,n)=>n!==e))},[]),clearAttachments:(0,w.useCallback)(()=>{d([])},[])}}var eNe={openai:`gpt-4o`,anthropic:`claude-haiku-4-5-20251001`,google:`gemini-2.5-flash`};function X7({mcpServerUrl:e}){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(null),[a,o]=(0,w.useState)(!1),[s,c]=(0,w.useState)(`openai`),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(eNe.openai),p=(0,w.useCallback)(()=>{let e=localStorage.getItem(`mcp-inspector-api-keys`);if(e)try{return JSON.parse(e)}catch(e){return console.error(`Failed to load API keys:`,e),{}}return{}},[]),m=(0,w.useCallback)(e=>{localStorage.setItem(`mcp-inspector-api-keys`,JSON.stringify(e))},[]),[h,g]=(0,w.useState)(`none`),[_,v]=(0,w.useState)(``),[y,b]=(0,w.useState)(``),[x,S]=(0,w.useState)(``);return(0,w.useEffect)(()=>{let e=()=>{let e=localStorage.getItem(`mcp-inspector-llm-config`),t=p();if(e)try{let r=JSON.parse(e);n(r),c(r.provider),u(t[r.provider]||r.apiKey||``),f(r.model)}catch(e){console.error(`Failed to load LLM config:`,e)}};e();let t=()=>{e()},r=t=>{(t.key===`mcp-inspector-llm-config`||t.key===`mcp-inspector-api-keys`)&&e()};return window.addEventListener(`llm-config-updated`,t),window.addEventListener(`storage`,r),()=>{window.removeEventListener(`llm-config-updated`,t),window.removeEventListener(`storage`,r)}},[p]),(0,w.useEffect)(()=>{let t=localStorage.getItem(`mcp-inspector-auth-config`);if(t)try{let e=JSON.parse(t);i(e),g(e.type),e.username&&v(e.username),e.password&&b(e.password),e.token&&S(e.token)}catch(e){console.error(`Failed to load auth config:`,e)}else try{let t=`mcp:auth_${CY(e)}_tokens`;localStorage.getItem(t)&&(i({type:`oauth`}),g(`oauth`))}catch(e){console.error(`Failed to check for OAuth tokens:`,e)}},[e]),(0,w.useEffect)(()=>{f(eNe[s]),u(p()[s]||``)},[s,p]),{llmConfig:t,authConfig:r,configDialogOpen:a,setConfigDialogOpen:o,tempProvider:s,setTempProvider:c,tempApiKey:l,setTempApiKey:u,tempModel:d,setTempModel:f,tempAuthType:h,saveLLMConfig:(0,w.useCallback)(()=>{if(!l.trim())return;let e=p();e[s]=l,m(e);let t={provider:s,apiKey:l,model:d},r={type:h,...h===`basic`&&{username:_.trim(),password:y.trim()},...h===`bearer`&&{token:x.trim()}};n(t),i(r),localStorage.setItem(`mcp-inspector-llm-config`,JSON.stringify(t)),localStorage.setItem(`mcp-inspector-auth-config`,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(`llm-config-updated`));try{of.getInstance().capture(new Yd({provider:s,model:d})).catch(()=>{})}catch{}o(!1)},[s,l,d,h,_,y,x,p,m]),clearConfig:(0,w.useCallback)(()=>{n(null),i(null);let e=p();delete e[s],m(e),u(``),v(``),b(``),S(``),g(`none`),localStorage.removeItem(`mcp-inspector-llm-config`),localStorage.removeItem(`mcp-inspector-auth-config`)},[s,p,m])}}function tNe({className:e}){return(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,xmlns:`http://www.w3.org/2000/svg`,children:[(0,S.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`,fill:`#4285F4`}),(0,S.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,S.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,S.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`})]})}function nNe({className:e}){return(0,S.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,S.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function rNe({text:e}){return(0,S.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,S.jsx)(`div`,{className:`flex-grow border-t border-border`}),(0,S.jsx)(`span`,{className:`mx-3 flex-shrink text-xs text-muted-foreground`,children:e}),(0,S.jsx)(`div`,{className:`flex-grow border-t border-border`})]})}function iNe({authOrigin:e,onDismiss:t,onUseApiKey:n}){let[r,i]=(0,w.useState)(``),[a,o]=(0,w.useState)(``),[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(null),p=(0,w.useCallback)(()=>{window.dispatchEvent(new CustomEvent(`manufact:session-changed`)),t()},[t]),m=async t=>{t.preventDefault(),u(null),f(`email`);try{let t=await fetch(`${e}/api/auth/sign-in/email`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:r,password:a,rememberMe:!0})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||`Incorrect email or password.`)}p()}catch(e){u(e instanceof Error?e.message:`Sign in failed.`)}finally{f(null)}},h=t=>{u(null),f(t);let n=`${window.location.origin}/inspector/oauth-popup-closed.html`;fetch(`${e}/api/auth/sign-in/social`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({provider:t,callbackURL:n})}).then(e=>e.json()).then(t=>{if(!t.url)throw Error(`No redirect URL returned`);let n=window.open(t.url,`manufact-oauth`,`width=500,height=650`),r=e=>{if(e.data?.type===`manufact:oauth-complete`){window.removeEventListener(`message`,r),clearInterval(i),f(null);try{n?.close()}catch{}p()}};window.addEventListener(`message`,r);let i=setInterval(async()=>{let t=!n||n.closed;try{if((await(await fetch(`${e}/api/auth/get-session`,{credentials:`include`})).json().catch(()=>null))?.user){if(clearInterval(i),window.removeEventListener(`message`,r),f(null),!t)try{n?.close()}catch{}p();return}}catch{}t&&(clearInterval(i),window.removeEventListener(`message`,r),f(null))},2e3)}).catch(e=>{u(e instanceof Error?e.message:`OAuth failed.`),f(null)})},g=d!==null;return(0,S.jsx)(CN,{open:!0,onOpenChange:e=>{e||t()},children:(0,S.jsxs)(TN,{className:`max-w-sm`,children:[(0,S.jsxs)(EN,{children:[(0,S.jsx)(DN,{children:`Sign in to Manufact`}),(0,S.jsx)(ON,{children:`Sign in to unlock generous usage limits on the Manufact free tier.`})]}),(0,S.jsxs)(`form`,{onSubmit:m,className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(MN,{htmlFor:`lm-email`,children:`Email`}),(0,S.jsx)(kN,{id:`lm-email`,type:`email`,placeholder:`you@example.com`,value:r,onChange:e=>{i(e.target.value),u(null)},disabled:g,required:!0,autoComplete:`email`})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(MN,{htmlFor:`lm-password`,children:`Password`}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(kN,{id:`lm-password`,type:s?`text`:`password`,placeholder:`••••••••`,value:a,onChange:e=>{o(e.target.value),u(null)},disabled:g,required:!0,autoComplete:`current-password`,className:`pr-10`}),(0,S.jsx)(`button`,{type:`button`,className:`absolute inset-y-0 right-0 pr-3 flex items-center text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),"aria-label":s?`Hide password`:`Show password`,tabIndex:-1,children:s?(0,S.jsx)(Hf,{className:`h-4 w-4`}):(0,S.jsx)(Uf,{className:`h-4 w-4`})})]})]}),l&&(0,S.jsxs)(`p`,{className:`text-sm text-destructive flex items-center gap-1.5`,children:[(0,S.jsx)(jf,{className:`h-4 w-4 shrink-0`}),l]}),(0,S.jsx)(U,{type:`submit`,disabled:g,className:`w-full`,children:d===`email`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Uq,{className:`mr-2`}),`Signing in…`]}):`Sign in`})]}),(0,S.jsx)(rNe,{text:`Or continue with`}),(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,S.jsxs)(U,{variant:`outline`,type:`button`,disabled:g,onClick:()=>h(`google`),children:[d===`google`?(0,S.jsx)(Uq,{className:`mr-2`}):(0,S.jsx)(tNe,{className:H(`mr-2 h-4 w-4`)}),`Google`]}),(0,S.jsxs)(U,{variant:`outline`,type:`button`,disabled:g,onClick:()=>h(`github`),children:[d===`github`?(0,S.jsx)(Uq,{className:`mr-2`}):(0,S.jsx)(nNe,{className:H(`mr-2 h-4 w-4`)}),`GitHub`]})]}),n&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(rNe,{text:`or`}),(0,S.jsx)(`button`,{type:`button`,disabled:g,onClick:n,className:`w-full text-sm text-muted-foreground hover:text-foreground transition-colors text-center`,children:`Use your own API key`})]}),(0,S.jsxs)(`p`,{className:`text-xs text-center text-muted-foreground pt-1`,children:[`By signing in you agree to our`,` `,(0,S.jsx)(`a`,{href:`https://manufact.com/terms`,target:`_blank`,rel:`noopener noreferrer`,className:`underline hover:text-foreground`,children:`Terms`}),` `,`and`,` `,(0,S.jsx)(`a`,{href:`https://manufact.com/privacy`,target:`_blank`,rel:`noopener noreferrer`,className:`underline hover:text-foreground`,children:`Privacy Policy`})]})]})})}var aNe=/(?:^\/$|\s+\/$)/,oNe=[`ArrowDown`,`ArrowUp`,`Escape`,`Enter`];function sNe({connection:e,isConnected:t,useClientSide:n=!0,enableKeyboardShortcuts:r=!0,prompts:i,serverId:a,callPrompt:o,readResource:s,chatApiUrl:c,waitForChatApiUrl:l,initialMessages:u,managedLlmConfig:d,clearButtonLabel:f,hideTitle:p,hideModelBadge:m,hideServerUrl:h,clearButtonHideIcon:g,clearButtonHideShortcut:_,clearButtonVariant:v,hideClearButton:y,hideToolSelector:b,chatQuickQuestions:x=[],chatFollowups:C=[],streamProtocol:T,credentials:E,extraHeaders:D,body:O}){let[k,A]=(0,w.useState)(``),[j,M]=(0,w.useState)(!1),[N,P]=(0,w.useState)(-1),[F,I]=(0,w.useState)(x),[L,ee]=(0,w.useState)(C),[te,ne]=(0,w.useState)(new Set),R=(0,w.useRef)(null),z=(0,w.useRef)(null),B=(0,w.useRef)(null),re=(0,w.useMemo)(()=>(e.tools??[]).map(e=>({name:e.name,description:e.description})),[e.tools]),{llmConfig:ie,authConfig:ae,configDialogOpen:oe,setConfigDialogOpen:se,tempProvider:ce,setTempProvider:le,tempApiKey:ue,setTempApiKey:de,tempModel:fe,setTempModel:pe,saveLLMConfig:me,clearConfig:he}=X7({mcpServerUrl:e.url}),[ge,_e]=(0,w.useState)(()=>!!ie),ve=n||ge||!!ie,ye=ve?ie:d??ie,be=!ve&&!!d,{getAllModelContexts:xe}=gQ(),Se=xe(),Ce={connection:e,llmConfig:ye,isConnected:t,readResource:s,widgetModelContexts:Se,disabledTools:te},we=YMe({mcpServerUrl:e.url,llmConfig:ye,authConfig:ae,isConnected:t,chatApiUrl:c,waitForChatApiUrl:l,widgetModelContexts:Se,initialMessages:u,disabledTools:te,streamProtocol:T,credentials:E,extraHeaders:D,body:O}),Te=$Me(Ce),{messages:Ee,isLoading:De,attachments:Oe,sendMessage:ke,clearMessages:Ae,setMessages:je,stop:Me,addAttachment:Ne,removeAttachment:Pe}=ve?Te:we,Fe=ve?null:we.rateLimitInfo??null,Ie=ve?void 0:we.clearRateLimitInfo,Le=(0,w.useCallback)(()=>{Ie?.(),_e(!0),se(!0)},[Ie,se]),[Re,ze]=(0,w.useState)(!1),Be=(0,w.useCallback)(()=>{se(!1),ze(!0)},[se]),Ve=be?{onLoginClick:Be}:void 0,{filteredPrompts:He,setSelectedPrompt:Ue,selectedPrompt:We,setPromptArgs:V,executePrompt:Ge,results:Ke,handleDeleteResult:qe,clearPromptResults:Je}=FJ({prompts:i,callPrompt:o,serverId:a}),Ye=(0,w.useCallback)(e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).slice(0,8):[],[]),Xe=(0,w.useCallback)(e=>{if(typeof e.content==`string`&&e.content.trim())return e.content;if(Array.isArray(e.content)&&e.content.length>0)return e.content.map(e=>typeof e==`string`?e:e.text??``).join(``);if(e.parts&&e.parts.length>0){let t=e.parts.filter(e=>e.type===`text`&&e.text).map(e=>e.text);if(t.length>0)return t.join(`
799
- `)}return``},[]),Ze=(0,w.useCallback)(e=>{if(e==null)return`No result`;if(typeof e==`string`)try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}if(typeof e==`object`&&Array.isArray(e.content)){let t=e.content;return t.length===0?`Empty result`:t.map(e=>{if(e.type===`text`){let t=e.text||``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}return e.type===`image`?`[Image: ${e.mimeType}]`:e.type===`resource`?`[Resource: ${e.resource?.uri||`unknown`}]`:JSON.stringify(e,null,2)}).join(`
798
+ `)}`,timestamp:Date.now()})}let x=(_.attachments?.length??0)>0,S=qMe([...o,...g,...v,...c.trim()||x?[_]:[]]);S.unshift({role:`system`,content:QMe});let C=e=>{try{return JSON.parse(e)}catch{let t=[()=>{let t=e;(t.match(/(?<!\\)"/g)||[]).length%2!=0&&(t+=`"`);let n=(t.match(/{/g)||[]).length-(t.match(/}/g)||[]).length,r=(t.match(/\[/g)||[]).length-(t.match(/]/g)||[]).length;for(let e=0;e<r;e++)t+=`]`;for(let e=0;e<n;e++)t+=`}`;return JSON.parse(t)},()=>{let t=e;t=t.replace(/,\s*"[^"]*"?\s*:\s*("([^"\\]|\\.)*)?$/,``),t=t.replace(/,\s*"[^"]*$/,``),(t.match(/(?<!\\)"/g)||[]).length%2!=0&&(t+=`"`);let n=(t.match(/{/g)||[]).length-(t.match(/}/g)||[]).length,r=(t.match(/\[/g)||[]).length-(t.match(/]/g)||[]).length;for(let e=0;e<r;e++)t+=`]`;for(let e=0;e<n;e++)t+=`}`;return JSON.parse(t)}];for(let e of t)try{return e()}catch{}return}},w=()=>{s(e=>e.map(e=>e.id===n?{...e,parts:[...u]}:e))},T=async e=>{let t=e.toolInvocation?.result,n=t?._meta?.[`openai/outputTemplate`];if(!(!n||typeof n!=`string`||!r))try{let i=await r(n);if(i?.contents&&Array.isArray(i.contents)){let n=i.contents.map(e=>({type:`resource`,resource:e}));e.toolInvocation.result={...t,content:[...t.content||[],...n],structuredContent:t?.structuredContent||null}}}catch(e){console.error(`Failed to fetch Apps SDK resource:`,e)}};for await(let n of XMe({config:{provider:t.provider,model:t.model,apiKey:t.apiKey,temperature:t.temperature},messages:S,tools:h,callTool:async(t,n)=>await e.callTool(t,n,{signal:f.current?.signal}),maxSteps:10,signal:f.current?.signal})){if(f.current?.signal.aborted)break;if(n.type===`text-delta`){l+=n.delta;let e=u[u.length-1];e&&e.type===`text`?e.text=l:u.push({type:`text`,text:l}),w()}else if(n.type===`tool-call-start`)l&&=``,d.set(n.toolCallId,{name:n.toolName,accumulatedJson:``}),u.push({type:`tool-invocation`,toolInvocation:{toolName:n.toolName,args:{},state:`streaming`,partialArgs:{}}}),w();else if(n.type===`tool-call-args-delta`){let e=d.get(n.toolCallId);if(e){e.accumulatedJson+=n.argsDelta;let t=C(e.accumulatedJson);if(t){let n=u.find(t=>t.type===`tool-invocation`&&t.toolInvocation?.state===`streaming`&&t.toolInvocation?.toolName===e.name);if(n&&n.toolInvocation){let e=n.toolInvocation.partialArgs,r=e?Object.keys(e):[],i=Object.keys(t),a=r.reduce((t,n)=>t+String(e[n]??``).length,0),o=i.reduce((e,n)=>e+String(t[n]??``).length,0);(i.length>r.length||o>=a)&&(n.toolInvocation.partialArgs=t),w(),await m()}}}}else if(n.type===`tool-call-ready`){b++,l&&=``;let e=u.find(e=>e.type===`tool-invocation`&&e.toolInvocation?.state===`streaming`&&e.toolInvocation?.toolName===n.toolName);e&&e.toolInvocation?(e.toolInvocation.args=n.args,e.toolInvocation.state=`pending`):u.push({type:`tool-invocation`,toolInvocation:{toolName:n.toolName,args:n.args,state:`pending`}}),w()}else if(n.type===`tool-result`){let e=u.find(e=>e.type===`tool-invocation`&&e.toolInvocation?.toolName===n.toolName&&!e.toolInvocation?.result);e&&e.toolInvocation&&(e.toolInvocation.result=n.result,e.toolInvocation.state=n.isError||n.result?.isError?`error`:`result`,await T(e),w())}else if(n.type===`error`)throw Error(n.message)}if(f.current?.signal.aborted)for(let e of u)e.type===`tool-invocation`&&e.toolInvocation?.state===`pending`&&(e.toolInvocation.state=`error`,e.toolInvocation.result=`Cancelled by user`);s(e=>e.map(e=>e.id===n?{...e,parts:[...u],content:``}:e)),t&&of.getInstance().capture(new Hd({serverId:e.url,provider:t.provider,model:t.model,messageCount:o.length+1,toolCallsCount:b,success:!0,executionMode:`client-side`,duration:Date.now()-y})).catch(()=>{})}catch(n){if(n instanceof DOMException&&n.name===`AbortError`)return;console.error(`Client-side agent error:`,n);let r=`Unknown error occurred`;if(n instanceof Error){r=n.message;let e=n;e.status&&(r=`HTTP ${e.status}: ${r}`),(e.code===401||r.includes(`401`)||r.includes(`Unauthorized`))&&(r=`Authentication failed (401). Check your Authorization header in the connection settings.`)}t&&of.getInstance().capture(new Hd({serverId:e.url,provider:t.provider,model:t.model,messageCount:o.length+1,toolCallsCount:b,success:!1,executionMode:`client-side`,duration:Date.now()-y,error:r})).catch(()=>{});let i={id:`error-${Date.now()}`,role:`assistant`,content:`Error: ${r}`,timestamp:Date.now()};s(e=>[...e,i])}finally{l(!1),f.current=null}},[e,t,n,o,r,u,a,i]),clearMessages:(0,w.useCallback)(()=>{s([])},[]),setMessages:s,stop:(0,w.useCallback)(()=>{f.current&&f.current.abort()},[]),addAttachment:(0,w.useCallback)(async e=>{try{let t=await TY(e);d(e=>{let n=[...e,t];return wY(n)?n:(alert(`Total attachment size exceeds 20MB limit`),e)})}catch(e){e instanceof Error?alert(e.message):alert(`Failed to add attachment`)}},[]),removeAttachment:(0,w.useCallback)(e=>{d(t=>t.filter((t,n)=>n!==e))},[]),clearAttachments:(0,w.useCallback)(()=>{d([])},[])}}var eNe={openai:`gpt-4o`,anthropic:`claude-haiku-4-5-20251001`,google:`gemini-2.5-flash`};function X7({mcpServerUrl:e}){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(null),[a,o]=(0,w.useState)(!1),[s,c]=(0,w.useState)(`openai`),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(eNe.openai),p=(0,w.useCallback)(()=>{let e=localStorage.getItem(`mcp-inspector-api-keys`);if(e)try{return JSON.parse(e)}catch(e){return console.error(`Failed to load API keys:`,e),{}}return{}},[]),m=(0,w.useCallback)(e=>{localStorage.setItem(`mcp-inspector-api-keys`,JSON.stringify(e))},[]),[h,g]=(0,w.useState)(`none`),[_,v]=(0,w.useState)(``),[y,b]=(0,w.useState)(``),[x,S]=(0,w.useState)(``);return(0,w.useEffect)(()=>{let e=()=>{let e=localStorage.getItem(`mcp-inspector-llm-config`),t=p();if(e)try{let r=JSON.parse(e);n(r),c(r.provider),u(t[r.provider]||r.apiKey||``),f(r.model)}catch(e){console.error(`Failed to load LLM config:`,e)}};e();let t=()=>{e()},r=t=>{(t.key===`mcp-inspector-llm-config`||t.key===`mcp-inspector-api-keys`)&&e()};return window.addEventListener(`llm-config-updated`,t),window.addEventListener(`storage`,r),()=>{window.removeEventListener(`llm-config-updated`,t),window.removeEventListener(`storage`,r)}},[p]),(0,w.useEffect)(()=>{let t=localStorage.getItem(`mcp-inspector-auth-config`);if(t)try{let e=JSON.parse(t);i(e),g(e.type),e.username&&v(e.username),e.password&&b(e.password),e.token&&S(e.token)}catch(e){console.error(`Failed to load auth config:`,e)}else try{let t=`mcp:auth_${CY(e)}_tokens`;localStorage.getItem(t)&&(i({type:`oauth`}),g(`oauth`))}catch(e){console.error(`Failed to check for OAuth tokens:`,e)}},[e]),(0,w.useEffect)(()=>{f(eNe[s]),u(p()[s]||``)},[s,p]),{llmConfig:t,authConfig:r,configDialogOpen:a,setConfigDialogOpen:o,tempProvider:s,setTempProvider:c,tempApiKey:l,setTempApiKey:u,tempModel:d,setTempModel:f,tempAuthType:h,saveLLMConfig:(0,w.useCallback)(()=>{if(!l.trim())return;let e=p();e[s]=l,m(e);let t={provider:s,apiKey:l,model:d},r={type:h,...h===`basic`&&{username:_.trim(),password:y.trim()},...h===`bearer`&&{token:x.trim()}};n(t),i(r),localStorage.setItem(`mcp-inspector-llm-config`,JSON.stringify(t)),localStorage.setItem(`mcp-inspector-auth-config`,JSON.stringify(r)),window.dispatchEvent(new CustomEvent(`llm-config-updated`));try{of.getInstance().capture(new Yd({provider:s,model:d})).catch(()=>{})}catch{}o(!1)},[s,l,d,h,_,y,x,p,m]),clearConfig:(0,w.useCallback)(()=>{n(null),i(null);let e=p();delete e[s],m(e),u(``),v(``),b(``),S(``),g(`none`),localStorage.removeItem(`mcp-inspector-llm-config`),localStorage.removeItem(`mcp-inspector-auth-config`)},[s,p,m])}}function tNe({className:e}){return(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,xmlns:`http://www.w3.org/2000/svg`,children:[(0,S.jsx)(`path`,{d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`,fill:`#4285F4`}),(0,S.jsx)(`path`,{d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`,fill:`#34A853`}),(0,S.jsx)(`path`,{d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`,fill:`#FBBC05`}),(0,S.jsx)(`path`,{d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`,fill:`#EA4335`})]})}function nNe({className:e}){return(0,S.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,S.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function rNe({text:e}){return(0,S.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,S.jsx)(`div`,{className:`flex-grow border-t border-border`}),(0,S.jsx)(`span`,{className:`mx-3 flex-shrink text-xs text-muted-foreground`,children:e}),(0,S.jsx)(`div`,{className:`flex-grow border-t border-border`})]})}function iNe({authOrigin:e,onDismiss:t,onUseApiKey:n}){let[r,i]=(0,w.useState)(``),[a,o]=(0,w.useState)(``),[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(null),p=(0,w.useCallback)(()=>{window.dispatchEvent(new CustomEvent(`manufact:session-changed`)),t()},[t]),m=async t=>{t.preventDefault(),u(null),f(`email`);try{let t=await fetch(`${e}/api/auth/sign-in/email`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:r,password:a,rememberMe:!0})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||`Incorrect email or password.`)}p()}catch(e){u(e instanceof Error?e.message:`Sign in failed.`)}finally{f(null)}},h=t=>{u(null),f(t);let n=`${window.location.origin}/inspector/oauth-popup-closed.html`;fetch(`${e}/api/auth/sign-in/social`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({provider:t,callbackURL:n})}).then(e=>e.json()).then(t=>{if(!t.url)throw Error(`No redirect URL returned`);let n=window.open(t.url,`manufact-oauth`,`width=500,height=650`),r=e=>{if(e.data?.type===`manufact:oauth-complete`){window.removeEventListener(`message`,r),clearInterval(i),f(null);try{n?.close()}catch{}p()}};window.addEventListener(`message`,r);let i=setInterval(async()=>{let t=!n||n.closed;try{if((await(await fetch(`${e}/api/auth/get-session`,{credentials:`include`})).json().catch(()=>null))?.user){if(clearInterval(i),window.removeEventListener(`message`,r),f(null),!t)try{n?.close()}catch{}p();return}}catch{}t&&(clearInterval(i),window.removeEventListener(`message`,r),f(null))},2e3)}).catch(e=>{u(e instanceof Error?e.message:`OAuth failed.`),f(null)})},g=d!==null;return(0,S.jsx)(CN,{open:!0,onOpenChange:e=>{e||t()},children:(0,S.jsxs)(TN,{className:`max-w-sm`,children:[(0,S.jsxs)(EN,{children:[(0,S.jsx)(DN,{children:`Sign in to Manufact`}),(0,S.jsx)(ON,{children:`Sign in to unlock generous usage limits on the Manufact free tier.`})]}),(0,S.jsxs)(`form`,{onSubmit:m,className:`space-y-3`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(MN,{htmlFor:`lm-email`,children:`Email`}),(0,S.jsx)(kN,{id:`lm-email`,type:`email`,placeholder:`you@example.com`,value:r,onChange:e=>{i(e.target.value),u(null)},disabled:g,required:!0,autoComplete:`email`})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(MN,{htmlFor:`lm-password`,children:`Password`}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(kN,{id:`lm-password`,type:s?`text`:`password`,placeholder:`••••••••`,value:a,onChange:e=>{o(e.target.value),u(null)},disabled:g,required:!0,autoComplete:`current-password`,className:`pr-10`}),(0,S.jsx)(`button`,{type:`button`,className:`absolute inset-y-0 right-0 pr-3 flex items-center text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),"aria-label":s?`Hide password`:`Show password`,tabIndex:-1,children:s?(0,S.jsx)(Hf,{className:`h-4 w-4`}):(0,S.jsx)(Uf,{className:`h-4 w-4`})})]})]}),l&&(0,S.jsxs)(`p`,{className:`text-sm text-destructive flex items-center gap-1.5`,children:[(0,S.jsx)(jf,{className:`h-4 w-4 shrink-0`}),l]}),(0,S.jsx)(U,{type:`submit`,disabled:g,className:`w-full`,children:d===`email`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Uq,{className:`mr-2`}),`Signing in…`]}):`Sign in`})]}),(0,S.jsx)(rNe,{text:`Or continue with`}),(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,S.jsxs)(U,{variant:`outline`,type:`button`,disabled:g,onClick:()=>h(`google`),children:[d===`google`?(0,S.jsx)(Uq,{className:`mr-2`}):(0,S.jsx)(tNe,{className:H(`mr-2 h-4 w-4`)}),`Google`]}),(0,S.jsxs)(U,{variant:`outline`,type:`button`,disabled:g,onClick:()=>h(`github`),children:[d===`github`?(0,S.jsx)(Uq,{className:`mr-2`}):(0,S.jsx)(nNe,{className:H(`mr-2 h-4 w-4`)}),`GitHub`]})]}),n&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(rNe,{text:`or`}),(0,S.jsx)(`button`,{type:`button`,disabled:g,onClick:n,className:`w-full text-sm text-muted-foreground hover:text-foreground transition-colors text-center`,children:`Use your own API key`})]}),(0,S.jsxs)(`p`,{className:`text-xs text-center text-muted-foreground pt-1`,children:[`By signing in you agree to our`,` `,(0,S.jsx)(`a`,{href:`https://manufact.com/terms`,target:`_blank`,rel:`noopener noreferrer`,className:`underline hover:text-foreground`,children:`Terms`}),` `,`and`,` `,(0,S.jsx)(`a`,{href:`https://manufact.com/privacy`,target:`_blank`,rel:`noopener noreferrer`,className:`underline hover:text-foreground`,children:`Privacy Policy`})]})]})})}var aNe=/(?:^\/$|\s+\/$)/,oNe=[`ArrowDown`,`ArrowUp`,`Escape`,`Enter`];function sNe({connection:e,isConnected:t,useClientSide:n=!0,enableKeyboardShortcuts:r=!0,prompts:i,serverId:a,callPrompt:o,readResource:s,chatApiUrl:c,waitForChatApiUrl:l,initialMessages:u,managedLlmConfig:d,enableFreeTierUpgrade:f=!1,clearButtonLabel:p,hideTitle:m,hideModelBadge:h,hideServerUrl:g,clearButtonHideIcon:_,clearButtonHideShortcut:v,clearButtonVariant:y,hideClearButton:b,hideToolSelector:x,chatQuickQuestions:C=[],chatFollowups:T=[],streamProtocol:E,credentials:D,extraHeaders:O,body:k}){let[A,j]=(0,w.useState)(``),[M,N]=(0,w.useState)(!1),[P,F]=(0,w.useState)(-1),[I,L]=(0,w.useState)(C),[ee,te]=(0,w.useState)(T),[ne,R]=(0,w.useState)(new Set),z=(0,w.useRef)(null),B=(0,w.useRef)(null),re=(0,w.useRef)(null),ie=(0,w.useMemo)(()=>(e.tools??[]).map(e=>({name:e.name,description:e.description})),[e.tools]),{llmConfig:ae,authConfig:oe,configDialogOpen:se,setConfigDialogOpen:ce,tempProvider:le,setTempProvider:ue,tempApiKey:de,setTempApiKey:fe,tempModel:pe,setTempModel:me,saveLLMConfig:he,clearConfig:ge}=X7({mcpServerUrl:e.url}),[_e,ve]=(0,w.useState)(()=>!!ae),ye=n||_e||!!ae,be=ye?ae:d??ae,xe=!ye&&!!d,{getAllModelContexts:Se}=gQ(),Ce=Se(),we={connection:e,llmConfig:be,isConnected:t,readResource:s,widgetModelContexts:Ce,disabledTools:ne},Te=YMe({mcpServerUrl:e.url,llmConfig:be,authConfig:oe,isConnected:t,chatApiUrl:c,waitForChatApiUrl:l,widgetModelContexts:Ce,initialMessages:u,disabledTools:ne,streamProtocol:E,credentials:D,extraHeaders:O,body:k}),Ee=$Me(we),{messages:De,isLoading:Oe,attachments:ke,sendMessage:Ae,clearMessages:je,setMessages:Me,stop:Ne,addAttachment:Pe,removeAttachment:Fe}=ye?Ee:Te,Ie=ye?null:Te.rateLimitInfo??null,Le=ye?void 0:Te.clearRateLimitInfo,Re=(0,w.useCallback)(()=>{Le?.(),ve(!0),ce(!0)},[Le,ce]),[ze,Be]=(0,w.useState)(!1),Ve=(0,w.useCallback)(()=>{ce(!1),Be(!0)},[ce]),He=xe&&f?{onLoginClick:Ve}:void 0,{filteredPrompts:Ue,setSelectedPrompt:We,selectedPrompt:V,setPromptArgs:Ge,executePrompt:Ke,results:qe,handleDeleteResult:Je,clearPromptResults:Ye}=FJ({prompts:i,callPrompt:o,serverId:a}),Xe=(0,w.useCallback)(e=>Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean).slice(0,8):[],[]),Ze=(0,w.useCallback)(e=>{if(typeof e.content==`string`&&e.content.trim())return e.content;if(Array.isArray(e.content)&&e.content.length>0)return e.content.map(e=>typeof e==`string`?e:e.text??``).join(``);if(e.parts&&e.parts.length>0){let t=e.parts.filter(e=>e.type===`text`&&e.text).map(e=>e.text);if(t.length>0)return t.join(`
799
+ `)}return``},[]),Qe=(0,w.useCallback)(e=>{if(e==null)return`No result`;if(typeof e==`string`)try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}if(typeof e==`object`&&Array.isArray(e.content)){let t=e.content;return t.length===0?`Empty result`:t.map(e=>{if(e.type===`text`){let t=e.text||``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}return e.type===`image`?`[Image: ${e.mimeType}]`:e.type===`resource`?`[Resource: ${e.resource?.uri||`unknown`}]`:JSON.stringify(e,null,2)}).join(`
800
800
 
801
- `)}return JSON.stringify(e,null,2)},[]),Qe=(0,w.useCallback)(()=>Ee.map(e=>{let t=Xe(e),n=e.parts?.filter(e=>e.type===`tool-invocation`&&e.toolInvocation).map(e=>({toolName:e.toolInvocation.toolName,args:e.toolInvocation.args,state:e.toolInvocation.state,result:typeof e.toolInvocation.result==`string`?e.toolInvocation.result.slice(0,2e3):e.toolInvocation.result==null?void 0:JSON.stringify(e.toolInvocation.result).slice(0,2e3)})),r=t||(n?.length?`[Tool calls: ${n.map(e=>`${e.toolName}(${e.state})`).join(`, `)}]`:``);return{id:e.id,role:e.role,content:r,timestamp:e.timestamp,toolInvocations:n?.length?n:void 0}}),[Ee,Xe]),$e=(0,w.useCallback)((e,t={})=>{typeof window>`u`||window.parent===window||window.parent.postMessage({type:e,serverId:a,...t},`*`)},[a]);(0,w.useEffect)(()=>{$e(`mcp-inspector:chat:ready`,{capabilities:{send:!0,clear:!0,getState:!0,setQuickQuestions:!0,setFollowups:!0,loadMessages:!0}})},[$e]),(0,w.useEffect)(()=>{$e(`mcp-inspector:chat:state_changed`,{isLoading:De,messageCount:Ee.length,messages:Qe(),quickQuestions:F,followups:L})},[L,Qe,De,Ee.length,$e,F]),(0,w.useEffect)(()=>{let e=e=>{if(!e.data||typeof e.data!=`object`)return;let n=e.data;if(!n.type?.startsWith(`mcp-inspector:chat:`)||n.serverId&&n.serverId!==a)return;let r=n.requestId,i=(e,t={})=>{$e(`mcp-inspector:chat:command_result`,{requestId:r,ok:e,...t})};if(n.type===`mcp-inspector:chat:send`){let e=(n.message??n.prompt??``).trim();if(!e){i(!1,{error:`Missing message`});return}if(!ye||!t){i(!1,{error:`Chat is not ready to send messages`});return}ke(e,[]).then(()=>{$e(`mcp-inspector:chat:message_sent`,{requestId:r,message:e,source:`bridge`}),i(!0)}).catch(e=>{i(!1,{error:e instanceof Error?e.message:String(e)})});return}if(n.type===`mcp-inspector:chat:clear`){Ae(),$e(`mcp-inspector:chat:cleared`,{requestId:r}),i(!0);return}if(n.type===`mcp-inspector:chat:get_state`){$e(`mcp-inspector:chat:state`,{requestId:r,isLoading:De,messageCount:Ee.length,messages:Qe(),quickQuestions:F,followups:L}),i(!0);return}if(n.type===`mcp-inspector:chat:set_quick_questions`){let e=Ye(n.questions);I(e),i(!0,{quickQuestions:e});return}if(n.type===`mcp-inspector:chat:set_followups`){let e=Ye(n.followups);ee(e),i(!0,{followups:e});return}if(n.type===`mcp-inspector:chat:load_messages`){let e=n.messages;if(!Array.isArray(e)){i(!1,{error:`messages must be an array`});return}je(e),i(!0,{count:e.length});return}if(n.type===`mcp-inspector:chat:screenshot`){let e=n.toolCallId;(async()=>{try{let t=null;if(e&&(t=document.querySelector(`[data-tool-call-id="${e}"]`)),!t){let e=document.querySelectorAll(`[data-tool-call-id]`);e.length>0&&(t=e[e.length-1])}if(!t&&z.current&&(t=z.current),!t){i(!1,{error:`No screenshot target found`});return}let n=1e4,a=null,o=``,s=``;try{let e=await J(()=>import(`https://esm.sh/html-to-image@1.11.13`),[]);e?.toPng?a=await Promise.race([e.toPng(t,{pixelRatio:1,backgroundColor:`#ffffff`,includeQueryParams:!0}),new Promise((e,t)=>setTimeout(()=>t(Error(`html-to-image timed out`)),n))]):o=`toPng not found on module`}catch(e){o=e instanceof Error?e.message:String(e)}if(!a)try{if(!window.html2canvas){let e=document.createElement(`script`);e.src=`https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js`,document.head.appendChild(e),await new Promise((t,n)=>{e.onload=()=>t(),e.onerror=()=>n(Error(`Failed to load html2canvas`))})}let e=window.html2canvas;a=(await Promise.race([e(t,{useCORS:!0,allowTaint:!0,backgroundColor:`#ffffff`,scale:1,logging:!1,foreignObjectRendering:!1}),new Promise((e,t)=>setTimeout(()=>t(Error(`html2canvas timed out`)),n))])).toDataURL(`image/png`)}catch(e){s=e instanceof Error?e.message:String(e)}if(a)$e(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:a,timestamp:Date.now()}),i(!0);else{let t=z.current||document.body,n=t.innerText?.substring(0,5e3)||``,a=t.innerHTML?.substring(0,1e4)||``;$e(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:``,domText:n,domHtml:a,error:`html-to-image: ${o||`ok`}; html2canvas: ${s||`ok`}`,timestamp:Date.now()}),i(!1,{error:`html-to-image: ${o}; html2canvas: ${s}`})}}catch(t){let n=(z.current||document.body).innerText?.substring(0,5e3)||``;$e(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:``,domText:n,error:t instanceof Error?t.message:`Screenshot capture failed`,timestamp:Date.now()}),i(!1,{error:t instanceof Error?t.message:`Screenshot failed`})}})();return}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[Ae,je,L,Qe,De,Ee.length,$e,F,Ye,ke,a,ye,t]),Xq(r?{onNewChat:Ae}:{});let et=(0,w.useCallback)(()=>{P(-1),M(!1),B.current=null},[]),tt=(0,w.useCallback)(()=>{if(!R.current)return;let e=R.current.selectionStart,t=k.slice(0,e),n=aNe.test(t);M(n),n?(B.current={start:e-1,end:e},P(0)):et()},[k,et]);(0,w.useEffect)(()=>{ye&&Ee.length===0&&R.current&&R.current.focus()},[ye,Ee.length]),(0,w.useEffect)(()=>{!De&&Ee.length>0&&R.current&&R.current.focus()},[De,Ee.length]),(0,w.useEffect)(()=>{R.current&&tt()},[k,tt]);let nt=(0,w.useCallback)(()=>{Ue(null),V({}),et()},[et]),rt=(0,w.useCallback)(async e=>{if(Ue(e),e.arguments&&e.arguments.length>0){Ue(null),BM.error(`Prompts with arguments are not supported`,{description:`This prompt requires arguments which are not yet supported in chat mode.`});return}try{await Ge(e,{})}catch(e){console.error(`Error executing prompt`,e)}finally{if(R.current&&B.current){let{start:e,end:t}=B.current;A(k.slice(0,e)+k.slice(t)),requestAnimationFrame(()=>{R.current?.focus(),R.current?.setSelectionRange(e,e)})}nt()}},[Ge,nt,k]),it=(0,w.useCallback)(()=>{(k.trim()||Ke.length>0||Oe.length>0)&&(ke(k,Ke),A(``),Je())},[k,Ke,ke,Je,Oe]),at=(0,w.useCallback)(e=>{if(e.key===`ArrowDown`)P(e=>He.length===0?-1:(e+1)%He.length);else if(e.key===`ArrowUp`)P(e=>He.length===0?-1:(e-1+He.length)%He.length);else if(e.key===`Escape`)e.stopPropagation(),et();else if(e.key===`Enter`&&N>=0){let e=He[N];e&&rt(e)}},[He,N,rt,et]),ot=(0,w.useCallback)(e=>{oNe.includes(e.key)&&j?(e.preventDefault(),at(e)):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),it())},[it,at,j]),st=(0,w.useCallback)(e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&tt()},[tt]),ct=(0,w.useCallback)(e=>{let t=`# Chat Export - ${new Date().toLocaleString()}\n\n`;return t+=e.map(e=>{let t=e.role.charAt(0).toUpperCase()+e.role.slice(1);if(!e.parts||e.parts.length===0){let n=Xe(e).trim();return n?`## ${t}\n${n}`:``}let n=[];for(let t of e.parts)if(t.type===`text`&&t.text?.trim())n.push(t.text.trim());else if(t.type===`tool-invocation`&&t.toolInvocation){let e=t.toolInvocation,r=Ze(e.result);n.push(`#### ${e.toolName}\n**Arguments:**\n\`\`\`json\n${JSON.stringify(e.args,null,2)}\n\`\`\`\n**Result:**\n\n${r}`)}return n.length===0?``:`## ${t}\n\n${n.join(`
801
+ `)}return JSON.stringify(e,null,2)},[]),$e=(0,w.useCallback)(()=>De.map(e=>{let t=Ze(e),n=e.parts?.filter(e=>e.type===`tool-invocation`&&e.toolInvocation).map(e=>({toolName:e.toolInvocation.toolName,args:e.toolInvocation.args,state:e.toolInvocation.state,result:typeof e.toolInvocation.result==`string`?e.toolInvocation.result.slice(0,2e3):e.toolInvocation.result==null?void 0:JSON.stringify(e.toolInvocation.result).slice(0,2e3)})),r=t||(n?.length?`[Tool calls: ${n.map(e=>`${e.toolName}(${e.state})`).join(`, `)}]`:``);return{id:e.id,role:e.role,content:r,timestamp:e.timestamp,toolInvocations:n?.length?n:void 0}}),[De,Ze]),et=(0,w.useCallback)((e,t={})=>{typeof window>`u`||window.parent===window||window.parent.postMessage({type:e,serverId:a,...t},`*`)},[a]);(0,w.useEffect)(()=>{et(`mcp-inspector:chat:ready`,{capabilities:{send:!0,clear:!0,getState:!0,setQuickQuestions:!0,setFollowups:!0,loadMessages:!0}})},[et]),(0,w.useEffect)(()=>{et(`mcp-inspector:chat:state_changed`,{isLoading:Oe,messageCount:De.length,messages:$e(),quickQuestions:I,followups:ee})},[ee,$e,Oe,De.length,et,I]),(0,w.useEffect)(()=>{let e=e=>{if(!e.data||typeof e.data!=`object`)return;let n=e.data;if(!n.type?.startsWith(`mcp-inspector:chat:`)||n.serverId&&n.serverId!==a)return;let r=n.requestId,i=(e,t={})=>{et(`mcp-inspector:chat:command_result`,{requestId:r,ok:e,...t})};if(n.type===`mcp-inspector:chat:send`){let e=(n.message??n.prompt??``).trim();if(!e){i(!1,{error:`Missing message`});return}if(!be||!t){i(!1,{error:`Chat is not ready to send messages`});return}Ae(e,[]).then(()=>{et(`mcp-inspector:chat:message_sent`,{requestId:r,message:e,source:`bridge`}),i(!0)}).catch(e=>{i(!1,{error:e instanceof Error?e.message:String(e)})});return}if(n.type===`mcp-inspector:chat:clear`){je(),et(`mcp-inspector:chat:cleared`,{requestId:r}),i(!0);return}if(n.type===`mcp-inspector:chat:get_state`){et(`mcp-inspector:chat:state`,{requestId:r,isLoading:Oe,messageCount:De.length,messages:$e(),quickQuestions:I,followups:ee}),i(!0);return}if(n.type===`mcp-inspector:chat:set_quick_questions`){let e=Xe(n.questions);L(e),i(!0,{quickQuestions:e});return}if(n.type===`mcp-inspector:chat:set_followups`){let e=Xe(n.followups);te(e),i(!0,{followups:e});return}if(n.type===`mcp-inspector:chat:load_messages`){let e=n.messages;if(!Array.isArray(e)){i(!1,{error:`messages must be an array`});return}Me(e),i(!0,{count:e.length});return}if(n.type===`mcp-inspector:chat:screenshot`){let e=n.toolCallId;(async()=>{try{let t=null;if(e&&(t=document.querySelector(`[data-tool-call-id="${e}"]`)),!t){let e=document.querySelectorAll(`[data-tool-call-id]`);e.length>0&&(t=e[e.length-1])}if(!t&&B.current&&(t=B.current),!t){i(!1,{error:`No screenshot target found`});return}let n=1e4,a=null,o=``,s=``;try{let e=await J(()=>import(`https://esm.sh/html-to-image@1.11.13`),[]);e?.toPng?a=await Promise.race([e.toPng(t,{pixelRatio:1,backgroundColor:`#ffffff`,includeQueryParams:!0}),new Promise((e,t)=>setTimeout(()=>t(Error(`html-to-image timed out`)),n))]):o=`toPng not found on module`}catch(e){o=e instanceof Error?e.message:String(e)}if(!a)try{if(!window.html2canvas){let e=document.createElement(`script`);e.src=`https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js`,document.head.appendChild(e),await new Promise((t,n)=>{e.onload=()=>t(),e.onerror=()=>n(Error(`Failed to load html2canvas`))})}let e=window.html2canvas;a=(await Promise.race([e(t,{useCORS:!0,allowTaint:!0,backgroundColor:`#ffffff`,scale:1,logging:!1,foreignObjectRendering:!1}),new Promise((e,t)=>setTimeout(()=>t(Error(`html2canvas timed out`)),n))])).toDataURL(`image/png`)}catch(e){s=e instanceof Error?e.message:String(e)}if(a)et(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:a,timestamp:Date.now()}),i(!0);else{let t=B.current||document.body,n=t.innerText?.substring(0,5e3)||``,a=t.innerHTML?.substring(0,1e4)||``;et(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:``,domText:n,domHtml:a,error:`html-to-image: ${o||`ok`}; html2canvas: ${s||`ok`}`,timestamp:Date.now()}),i(!1,{error:`html-to-image: ${o}; html2canvas: ${s}`})}}catch(t){let n=(B.current||document.body).innerText?.substring(0,5e3)||``;et(`mcp-inspector:chat:screenshot_result`,{requestId:r,toolCallId:e||null,image:``,domText:n,error:t instanceof Error?t.message:`Screenshot capture failed`,timestamp:Date.now()}),i(!1,{error:t instanceof Error?t.message:`Screenshot failed`})}})();return}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[je,Me,ee,$e,Oe,De.length,et,I,Xe,Ae,a,be,t]),Xq(r?{onNewChat:je}:{});let tt=(0,w.useCallback)(()=>{F(-1),N(!1),re.current=null},[]),nt=(0,w.useCallback)(()=>{if(!z.current)return;let e=z.current.selectionStart,t=A.slice(0,e),n=aNe.test(t);N(n),n?(re.current={start:e-1,end:e},F(0)):tt()},[A,tt]);(0,w.useEffect)(()=>{be&&De.length===0&&z.current&&z.current.focus()},[be,De.length]),(0,w.useEffect)(()=>{!Oe&&De.length>0&&z.current&&z.current.focus()},[Oe,De.length]),(0,w.useEffect)(()=>{z.current&&nt()},[A,nt]);let rt=(0,w.useCallback)(()=>{We(null),Ge({}),tt()},[tt]),it=(0,w.useCallback)(async e=>{if(We(e),e.arguments&&e.arguments.length>0){We(null),BM.error(`Prompts with arguments are not supported`,{description:`This prompt requires arguments which are not yet supported in chat mode.`});return}try{await Ke(e,{})}catch(e){console.error(`Error executing prompt`,e)}finally{if(z.current&&re.current){let{start:e,end:t}=re.current;j(A.slice(0,e)+A.slice(t)),requestAnimationFrame(()=>{z.current?.focus(),z.current?.setSelectionRange(e,e)})}rt()}},[Ke,rt,A]),at=(0,w.useCallback)(()=>{(A.trim()||qe.length>0||ke.length>0)&&(Ae(A,qe),j(``),Ye())},[A,qe,Ae,Ye,ke]),ot=(0,w.useCallback)(e=>{if(e.key===`ArrowDown`)F(e=>Ue.length===0?-1:(e+1)%Ue.length);else if(e.key===`ArrowUp`)F(e=>Ue.length===0?-1:(e-1+Ue.length)%Ue.length);else if(e.key===`Escape`)e.stopPropagation(),tt();else if(e.key===`Enter`&&P>=0){let e=Ue[P];e&&it(e)}},[Ue,P,it,tt]),st=(0,w.useCallback)(e=>{oNe.includes(e.key)&&M?(e.preventDefault(),ot(e)):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),at())},[at,ot,M]),ct=(0,w.useCallback)(e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&nt()},[nt]),lt=(0,w.useCallback)(e=>{let t=`# Chat Export - ${new Date().toLocaleString()}\n\n`;return t+=e.map(e=>{let t=e.role.charAt(0).toUpperCase()+e.role.slice(1);if(!e.parts||e.parts.length===0){let n=Ze(e).trim();return n?`## ${t}\n${n}`:``}let n=[];for(let t of e.parts)if(t.type===`text`&&t.text?.trim())n.push(t.text.trim());else if(t.type===`tool-invocation`&&t.toolInvocation){let e=t.toolInvocation,r=Qe(e.result);n.push(`#### ${e.toolName}\n**Arguments:**\n\`\`\`json\n${JSON.stringify(e.args,null,2)}\n\`\`\`\n**Result:**\n\n${r}`)}return n.length===0?``:`## ${t}\n\n${n.join(`
802
802
 
803
803
  `)}`}).filter(e=>e!==``).join(`
804
804
 
805
805
  ---
806
806
 
807
- `),t},[Xe,Ze]),lt=(0,w.useCallback)(()=>{bj(ct(Ee)).then(()=>BM.success(`Chat copied to clipboard`),()=>BM.error(`Failed to copy chat`))},[Ee,ct]),ut=(0,w.useCallback)(e=>{let t=`chat-export-${new Date().toISOString().split(`T`)[0]}`;if(e===`json`)WP(Ee.map(e=>({id:e.id,role:e.role,content:Xe(e),timestamp:e.timestamp,toolInvocations:e.parts?.filter(e=>e.type===`tool-invocation`&&e.toolInvocation).map(e=>({toolName:e.toolInvocation.toolName,args:e.toolInvocation.args,result:e.toolInvocation.result}))})),t+`.json`);else{let e=ct(Ee),n=new Blob([e],{type:`text/markdown`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t+`.md`,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),100)}BM.success(`Chat exported as ${e.toUpperCase()}`)},[Ee,ct,Xe]),dt=(0,w.useCallback)(()=>{he(),Ae()},[he,Ae]),ft=(0,w.useCallback)(e=>{e.trim()&&(!ye||!t||ke(e,[]).then(()=>{$e(`mcp-inspector:chat:message_sent`,{message:e,source:`quick_question`})}))},[$e,ke,ye,t]),pt=(0,w.useCallback)(e=>{e.trim()&&(!ye||!t||ke(e,[]).then(()=>{$e(`mcp-inspector:chat:message_sent`,{message:e,source:`followup`})}))},[$e,ke,ye,t]),mt=(Fe||Re)&&c?(0,S.jsx)(iNe,{authOrigin:new URL(c).origin,onDismiss:()=>{Ie?.(),ze(!1)},onUseApiKey:Le}):null;return ye&&Ee.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,S.jsx)(lY,{open:oe,onOpenChange:se,tempProvider:ce,tempModel:fe,tempApiKey:ue,onProviderChange:le,onModelChange:pe,onApiKeyChange:de,onSave:me,onClear:dt,showClearButton:!be,buttonLabel:`Change API Key`,freeTierInfo:Ve})}),(0,S.jsx)(DTe,{mcpServerUrl:e.url,inputValue:k,isConnected:t,isLoading:De,textareaRef:R,llmConfig:ye,promptsDropdownOpen:j,promptFocusedIndex:N,prompts:He,selectedPrompt:We,promptResults:Ke,attachments:Oe,tools:b?void 0:re,disabledTools:b?void 0:te,onDisabledToolsChange:b?void 0:ne,onDeletePromptResult:qe,onPromptSelect:rt,onInputChange:A,onKeyDown:ot,onKeyUp:st,onClick:tt,onSubmit:e=>{e.preventDefault(),it()},onConfigDialogOpenChange:se,onAttachmentAdd:Ne,onAttachmentRemove:Pe,hideModelBadge:m&&!ve,hideServerUrl:h,quickQuestions:F,onQuickQuestionSelect:ft,freeTierInfo:Ve}),mt]}):(0,S.jsxs)(`div`,{className:`flex flex-col h-full relative`,children:[(0,S.jsx)(dTe,{llmConfig:ye,hasMessages:Ee.length>0,configDialogOpen:oe,onConfigDialogOpenChange:se,onClearChat:Ae,tempProvider:ce,tempModel:fe,tempApiKey:ue,onProviderChange:le,onModelChange:pe,onApiKeyChange:de,onSaveConfig:me,onClearConfig:dt,hideConfigButton:be&&!Ve,freeTierInfo:Ve,onCopyChat:lt,onExportChat:ut,clearButtonLabel:f,hideTitle:p,clearButtonHideIcon:g,clearButtonHideShortcut:_,clearButtonVariant:v,hideClearButton:y}),(0,S.jsx)(`div`,{ref:z,className:`flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]`,children:ye?(0,S.jsx)(KMe,{messages:Ee,isLoading:De,serverId:e.url,readResource:s,tools:e.tools,sendMessage:(e,t)=>ke(e,[],t),serverBaseUrl:e.url,pendingElicitationRequests:e.pendingElicitationRequests,onApproveElicitation:e.approveElicitation,onRejectElicitation:e.rejectElicitation}):(0,S.jsx)(OTe,{onConfigureClick:()=>se(!0)})}),mt,ye&&(0,S.jsx)(TTe,{inputValue:k,isConnected:t&&!Fe,isLoading:De,textareaRef:R,promptsDropdownOpen:j,promptFocusedIndex:N,prompts:He,promptResults:Ke,selectedPrompt:We,attachments:Oe,tools:b?void 0:re,disabledTools:b?void 0:te,onDisabledToolsChange:b?void 0:ne,onDeletePromptResult:qe,onPromptSelect:rt,onInputChange:A,onKeyDown:ot,onKeyUp:st,onClick:tt,onSendMessage:it,onStopStreaming:Me,onAttachmentAdd:Ne,onAttachmentRemove:Pe,followups:L,onFollowupSelect:pt})]})}var cNe=r({Group:()=>E9,Panel:()=>k9,Separator:()=>A9,isCoarsePointer:()=>yNe,useDefaultLayout:()=>uPe,useGroupCallbackRef:()=>fPe,useGroupRef:()=>pPe,usePanelCallbackRef:()=>gPe,usePanelRef:()=>_Pe});function lNe(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function uNe(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function dNe(e){return e/100*window.innerHeight}function fNe(e){return e/100*window.innerWidth}function pNe(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Z7({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=pNe(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=uNe(t,i);break;case`em`:r=lNe(t,i);break;case`vh`:r=dNe(i);break;case`vw`:r=fNe(i);break}return r}function Q7(e){return parseFloat(e.toFixed(3))}function $7({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function e9(e){let{panels:t}=e,n=$7({group:e});return n===0?t.map(e=>({collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Q7(Z7({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Q7(Z7({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Q7(Z7({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Q7(Z7({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function t9(e,t=`Assertion error`){if(!e)throw Error(t)}function n9(e,t){return Array.from(t).sort(e===`horizontal`?mNe:hNe)}function mNe(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function hNe(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function gNe(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function _Ne(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function vNe({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=_Ne(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return t9(i,`No rect found`),i}var r9;function yNe(){return r9===void 0&&(r9=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),r9}function bNe(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=n9(n,Array.from(t.children).filter(gNe).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.ariaDisabled===null&&(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,vNe({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=yNe()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:$7({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var xNe=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}};function i9(e,t,n=0){return Math.abs(Q7(e)-Q7(t))<=n}var a9={cursorFlags:0,interactionState:{state:`inactive`},mountedGroups:new Map},o9=new xNe;function s9(){return a9}function c9(e){let t=typeof e==`function`?e(a9):e;if(a9===t)return a9;let n=a9;return a9={...a9,...t},t.cursorFlags!==void 0&&o9.emit(`cursorFlagsChange`,a9.cursorFlags),t.interactionState!==void 0&&o9.emit(`interactionStateChange`,a9.interactionState),t.mountedGroups!==void 0&&(a9.mountedGroups.forEach((e,t)=>{e.derivedPanelConstraints.forEach(r=>{if(r.collapsible){let{layout:i}=n.mountedGroups.get(t)??{};if(i){let n=i9(r.collapsedSize,e.layout[r.panelId]),a=i9(r.collapsedSize,i[r.panelId]);n&&!a&&(t.inMemoryLastExpandedPanelSizes[r.panelId]=i[r.panelId])}}})}),o9.emit(`mountedGroupsChange`,a9.mountedGroups)),a9}function SNe(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=_Ne(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function CNe(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function wNe(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ANe(e),b:ANe(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();t9(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:kNe(ONe(n.a)),b:kNe(ONe(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var TNe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ENe(e){let t=getComputedStyle(jNe(e)??e).display;return t===`flex`||t===`inline-flex`}function DNe(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||ENe(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||TNe.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function ONe(e){let t=e.length;for(;t--;){let n=e[t];if(t9(n,`Missing node`),DNe(n))return n}return null}function kNe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ANe(e){let t=[];for(;e;)t.push(e),e=jNe(e);return t}function jNe(e){let{parentNode:t}=e;return CNe(t)?t.host:t}function MNe(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function NNe({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!gNe(n)||n.contains(e)||e.contains(n))return!0;if(wNe(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(MNe(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function l9(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=bNe(r),a=SNe(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&NNe({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function PNe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function u9(e,t){return i9(e,t)?0:e>t?1:-1}function d9({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(u9(r,c)<0)if(a){let e=(i+c)/2;r=u9(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Q7(r),r}function f9({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(i9(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;t9(u!=null,`Invalid first pivot index`),t9(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];t9(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(t9(n!=null,`Previous layout not found for panel index ${t}`),i9(n,i)){let t=o-n;u9(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];t9(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(t9(n!=null,`Previous layout not found for panel index ${t}`),i9(n,o)){let t=n-i;u9(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];t9(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&u9(i,c)<0)if(e>0){let t=c-o,n=t/2;u9(i+e,c)<0&&(e=u9(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;u9(i-e,c)<0&&(e=u9(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];t9(e!=null,`Previous layout not found for panel index ${r}`);let a=d9({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];t9(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=d9({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!i9(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(PNe(c,l))return i;{let t=e<0?d:u,r=s[t];t9(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=d9({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!i9(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];t9(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=d9({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(i9(i,s)||(t-=s-i,l[r]=s),i9(t,0))break;e>0?r--:r++}}}if(!i9(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function p9(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||u9(e[n],t[n])!==0)return!1;return!0}function m9({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!i9(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];t9(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];t9(i!=null,`No layout data found for index ${e}`);let o=r[e];t9(o!=null,`No layout data found for index ${e}`);let s=d9({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!i9(a,0))for(let e=0;e<t.length;e++){let n=r[e];t9(n!=null,`No layout data found for index ${e}`);let i=n+a,o=d9({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,i9(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function FNe({groupId:e,panelId:t}){let n=()=>{let{mountedGroups:t}=s9();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,separatorToPanels:o}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,layout:a,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,layout:c,separatorToPanels:l}=n(),u=s.panels.findIndex(e=>e.id===t),d=u===s.panels.length-1,f=m9({layout:f9({delta:d?r-e:e-r,initialLayout:c,panelConstraints:o,pivotIndices:d?[u-1,u]:[u,u+1],prevLayout:c,trigger:`imperative-api`}),panelConstraints:o});p9(c,f)||c9(e=>({mountedGroups:new Map(e.mountedGroups).set(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,layout:f,separatorToPanels:l})}))};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&i9(t,n)},resize:e=>{if(a()!==e){let t;switch(typeof e){case`number`:{let{group:r}=n();t=Q7(e/$7({group:r})*100);break}case`string`:t=parseFloat(e);break}o(t)}}}}function INe(e){if(e.defaultPrevented)return;let{mountedGroups:t}=s9();l9(e,t).forEach(t=>{if(t.separator){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=FNe({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function h9(e){let{mountedGroups:t}=s9();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function LNe({groupId:e}){let t=()=>{let{mountedGroups:t}=s9();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,layout:a,separatorToPanels:o}=t(),s=m9({layout:e,panelConstraints:r});if(n)return a;if(!p9(a,s)){c9(e=>({mountedGroups:new Map(e.mountedGroups).set(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:s,separatorToPanels:o})}));let e=i.panels.map(({id:e})=>e).join(`,`);i.inMemoryLayouts[e]=s}return s}}}function RNe(e){let{mountedGroups:t}=s9(),n=t.get(e);return t9(n,`Mounted Group ${e.id} not found`),n}function g9(e,t){let n=h9(e),r=RNe(n),i=n.separators.find(t=>t.element===e);t9(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);t9(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=LNe({groupId:n.id}).getLayout(),c=m9({layout:f9({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});p9(s,c)||c9(e=>({mountedGroups:new Map(e.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:c,separatorToPanels:r.separatorToPanels})}))}function zNe(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=h9(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&g9(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&g9(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&g9(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&g9(t,-5);break;case`End`:e.preventDefault(),g9(t,100);break;case`Enter`:{e.preventDefault();let n=h9(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=RNe(n),o=n.separators.find(e=>e.element===t);t9(o,`Matching separator not found`);let s=a.get(o);t9(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(t9(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];g9(t,(l.collapsedSize===e?n.inMemoryLastExpandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=h9(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);t9(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus();break}case`Home`:e.preventDefault(),g9(t,-100);break}}function BNe(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let{mountedGroups:t}=s9(),n=l9(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus()));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),c9({interactionState:{hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}}),n.length&&e.preventDefault()}var VNe=e=>e,_9=()=>{},HNe=1,UNe=2,WNe=4,GNe=8,KNe=3,qNe=12,v9;function JNe(){return v9===void 0&&(v9=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(v9=!0)),v9}function YNe({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&JNe()){let t=(e&HNe)!==0,n=(e&UNe)!==0,r=(e&WNe)!==0,i=(e&GNe)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return JNe()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var XNe=new WeakMap;function y9(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=XNe.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets.push(n));let{cursorFlags:r,interactionState:i}=s9();switch(i.state){case`active`:case`hover`:{let e=YNe({cursorFlags:r,groups:i.hitRegions.map(e=>e.group),state:i.state}),a=`*, *:hover {cursor: ${e} !important; }`;if(t===a)return;t=a,e?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}XNe.set(e,{prevStyle:t,styleSheet:n})}function ZNe({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0,c=new Map(i);n.forEach(e=>{let{group:n,groupSize:o}=e,{disableCursor:l,orientation:u,panels:d}=n,f=0;f=a?u===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:u===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let p=r.get(n),{defaultLayoutDeferred:m,derivedPanelConstraints:h,layout:g,separatorToPanels:_}=i.get(n)??{defaultLayoutDeferred:!1};if(h&&p&&g&&_){let t=f9({delta:f,initialLayout:p,panelConstraints:h,pivotIndices:e.panels.map(e=>d.indexOf(e)),prevLayout:g,trigger:`mouse-or-touch`});if(p9(t,g)){if(f!==0&&!l)switch(u){case`horizontal`:s|=f<0?HNe:UNe;break;case`vertical`:s|=f<0?WNe:GNe;break}}else{c.set(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,layout:t,separatorToPanels:_});let n=e.group.panels.map(({id:e})=>e).join(`,`);e.group.inMemoryLayouts[n]=t}}});let l=0;t.movementX===0?l|=o&KNe:l|=s&KNe,t.movementY===0?l|=o&qNe:l|=s&qNe,c9({cursorFlags:l,mountedGroups:c}),y9(e)}function QNe(e){let{cursorFlags:t,interactionState:n,mountedGroups:r}=s9();switch(n.state){case`active`:ZNe({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:r,prevCursorFlags:t})}}function $Ne(e){if(e.defaultPrevented)return;let{cursorFlags:t,interactionState:n,mountedGroups:r}=s9();switch(n.state){case`active`:if(e.buttons===0){c9(e=>e.interactionState.state===`inactive`?e:{cursorFlags:0,interactionState:{state:`inactive`}}),c9(e=>({mountedGroups:new Map(e.mountedGroups)}));return}ZNe({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:r,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:t});break;default:{let t=l9(e,r);t.length===0?n.state!==`inactive`&&c9({interactionState:{state:`inactive`}}):c9({interactionState:{hitRegions:t,state:`hover`}}),y9(e.currentTarget);break}}}function ePe(e){if(e.relatedTarget instanceof HTMLIFrameElement){let{interactionState:e}=s9();switch(e.state){case`hover`:c9({interactionState:{state:`inactive`}})}}}function tPe(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let{interactionState:t}=s9();switch(t.state){case`active`:c9({cursorFlags:0,interactionState:{state:`inactive`}}),t.hitRegions.length>0&&(y9(e.currentTarget),c9(e=>({mountedGroups:new Map(e.mountedGroups)})),e.preventDefault())}}function nPe(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Q7(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Q7((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function rPe(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=$7({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Q7(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function iPe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function aPe(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var b9=new Map;function oPe(e){let t=!0;t9(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){if($7({group:e})===0)return;c9(t=>{let n=t.mountedGroups.get(e);if(n){let r=e9(e),i=n.defaultLayoutDeferred?nPe(r):n.layout,a=m9({layout:i,panelConstraints:r});return!n.defaultLayoutDeferred&&p9(i,a)&&iPe(n.derivedPanelConstraints,r)?t:{mountedGroups:new Map(t.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,layout:a,separatorToPanels:n.separatorToPanels})}}return t})}}else rPe(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{t9(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=$7({group:e}),s=e9(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.defaultLayout;l&&(aPe(e.panels,l)||(l=void 0));let u=m9({layout:e.inMemoryLayouts[c]??l??nPe(s),panelConstraints:s}),d=bNe(e),f=e.element.ownerDocument;return c9(t=>{let n=new Map;return b9.set(f,(b9.get(f)??0)+1),d.forEach(e=>{e.separator&&n.set(e.separator,e.panels)}),{mountedGroups:new Map(t.mountedGroups).set(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,layout:u,separatorToPanels:n})}}),e.separators.forEach(e=>{t9(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,zNe)}),b9.get(f)===1&&(f.addEventListener(`dblclick`,INe,!0),f.addEventListener(`pointerdown`,BNe,!0),f.addEventListener(`pointerleave`,QNe),f.addEventListener(`pointermove`,$Ne),f.addEventListener(`pointerout`,ePe),f.addEventListener(`pointerup`,tPe,!0)),function(){t=!1,b9.set(f,Math.max(0,(b9.get(f)??0)-1)),c9(t=>{let n=new Map(t.mountedGroups);return n.delete(e),{mountedGroups:n}}),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,zNe)}),b9.get(f)||(f.removeEventListener(`dblclick`,INe,!0),f.removeEventListener(`pointerdown`,BNe,!0),f.removeEventListener(`pointerleave`,QNe),f.removeEventListener(`pointermove`,$Ne),f.removeEventListener(`pointerout`,ePe),f.removeEventListener(`pointerup`,tPe,!0)),a.disconnect()}}function sPe(){let[e,t]=(0,w.useState)({});return[e,(0,w.useCallback)(()=>t({}),[])]}function x9(e){let t=(0,w.useId)();return`${e??t}`}var S9=typeof window<`u`?w.useLayoutEffect:w.useEffect;function C9(e){let t=(0,w.useRef)(e);return S9(()=>{t.current=e},[e]),(0,w.useCallback)((...e)=>t.current?.(...e),[t])}function w9(...e){return C9(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function T9(e){let t=(0,w.useRef)({...e});return S9(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var cPe=(0,w.createContext)(null);function lPe(e,t){let n=(0,w.useRef)({getLayout:()=>({}),setLayout:VNe});(0,w.useImperativeHandle)(t,()=>n.current,[]),S9(()=>{Object.assign(n.current,LNe({groupId:e}))})}function E9({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,w.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=C9(e=>{p9(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=C9(e=>{p9(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=x9(s),v=(0,w.useRef)(null),[y,b]=sPe(),x=(0,w.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),C=w9(v,a);lPe(_,o);let T=C9((e,t)=>{let{interactionState:r,mountedGroups:i}=s9();for(let n of i.keys())if(n.id===e){let e=i.get(n);if(e){let i=!1;switch(r.state){case`active`:i=r.hitRegions.some(e=>e.group===n);break}return{flexGrow:e.layout[t]??1,pointerEvents:i?`none`:void 0}}}return{flexGrow:n?.[t]??1}}),E=T9({defaultLayout:n,disableCursor:r}),D=(0,w.useMemo)(()=>({get disableCursor(){return!!E.disableCursor},getPanelStyles:T,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=n9(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=n9(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},togglePanelDisabled:(e,t)=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let{mountedGroups:r}=s9();for(let e of r.keys())if(e.id===_){let t=r.get(e);t&&(t.derivedPanelConstraints=e9(e))}},toggleSeparatorDisabled:(e,t)=>{let n=x.current.separators.find(t=>t.id===e);n&&(n.disabled=t)}}),[T,_,b,u,E]),O=(0,w.useRef)(null);return S9(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(E.defaultLayout!==void 0&&Object.keys(E.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=E.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={defaultLayout:n,disableCursor:!!E.disableCursor,disabled:!!i,element:e,id:_,inMemoryLastExpandedPanelSizes:x.current.lastExpandedPanelSizes,inMemoryLayouts:x.current.layouts,orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};O.current=r;let a=oPe(r),o=s9().mountedGroups.get(r);if(o){let{defaultLayoutDeferred:e,derivedPanelConstraints:t,layout:n}=o;!e&&t.length>0&&(h(n),g(n))}let s=o9.addListener(`interactionStateChange`,e=>{e.state}),c=o9.addListener(`mountedGroupsChange`,e=>{let t=e.get(r);if(t){let{defaultLayoutDeferred:e,derivedPanelConstraints:n,layout:r}=t;if(e||n.length===0)return;let{interactionState:i}=s9(),a=i.state!==`active`;h(r),a&&g(r)}});return()=>{O.current=null,a(),s(),c()}},[i,_,g,h,u,y,E]),(0,w.useEffect)(()=>{let e=O.current;e&&(e.defaultLayout=n,e.disableCursor=!!r)}),(0,S.jsx)(cPe.Provider,{value:D,children:(0,S.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:C,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}E9.displayName=`Group`;function D9(e,t){return`react-resizable-panels:${[e,...t].join(`:`)}`}function uPe({debounceSaveMs:e=100,panelIds:t,storage:n=localStorage,...r}){let i=t!==void 0,a=`id`in r?r.id:r.groupId,o=D9(a,t??[]),s=(0,w.useSyncExternalStore)(dPe,()=>n.getItem(o),()=>n.getItem(o)),c=(0,w.useMemo)(()=>s?JSON.parse(s):void 0,[s]),l=(0,w.useRef)(null),u=(0,w.useCallback)(()=>{let e=l.current;e&&(l.current=null,clearTimeout(e))},[]);(0,w.useLayoutEffect)(()=>()=>{u()},[u]);let d=(0,w.useCallback)(e=>{u();let t;t=i?D9(a,Object.keys(e)):D9(a,[]);try{n.setItem(t,JSON.stringify(e))}catch(e){console.error(e)}},[u,i,a,n]);return{defaultLayout:c,onLayoutChange:(0,w.useCallback)(t=>{u(),e===0?d(t):l.current=setTimeout(()=>{d(t)},e)},[u,e,d]),onLayoutChanged:d}}function dPe(){return function(){}}function fPe(){return(0,w.useState)(null)}function pPe(){return(0,w.useRef)(null)}function O9(){let e=(0,w.useContext)(cPe);return t9(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function mPe(e,t){let{id:n}=O9(),r=(0,w.useRef)({collapse:_9,expand:_9,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:_9});(0,w.useImperativeHandle)(t,()=>r.current,[]),S9(()=>{Object.assign(r.current,FNe({groupId:n,panelId:e}))})}function k9({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,id:s,maxSize:c=`100%`,minSize:l=`0%`,onResize:u,panelRef:d,style:f,...p}){let m=!!s,h=x9(s),g=T9({disabled:a}),_=(0,w.useRef)(null),v=w9(_,o),{getPanelStyles:y,id:b,orientation:x,registerPanel:C,togglePanelDisabled:T}=O9(),E=u!==null,D=C9((e,t,n)=>{u?.(e,s,n)});S9(()=>{let e=_.current;if(e!==null)return C({element:e,id:h,idIsStable:m,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,disabled:g.disabled,maxSize:c,minSize:l}})},[n,r,i,E,h,m,c,l,D,C,g]),(0,w.useEffect)(()=>{T(h,!!a)},[a,h,T]),mPe(h,d);let O=(0,w.useSyncExternalStore)(e=>(o9.addListener(`mountedGroupsChange`,e),()=>{o9.removeListener(`mountedGroupsChange`,e)}),()=>JSON.stringify(y(b,h)),()=>JSON.stringify(y(b,h)));return(0,S.jsx)(`div`,{...p,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":h,id:h,ref:v,style:{...hPe,display:`flex`,flexBasis:0,flexShrink:1,overflow:`hidden`,...JSON.parse(O)},children:(0,S.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,...f,touchAction:x===`horizontal`?`pan-y`:`pan-x`},children:e})})}k9.displayName=`Panel`;var hPe={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function gPe(){return(0,w.useState)(null)}function _Pe(){return(0,w.useRef)(null)}function vPe({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=m9({layout:f9({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=m9({layout:f9({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function A9({children:e,className:t,disabled:n,elementRef:r,id:i,style:a,...o}){let s=x9(i),c=T9({disabled:n}),[l,u]=(0,w.useState)({}),[d,f]=(0,w.useState)(`inactive`),p=(0,w.useRef)(null),m=w9(p,r),{disableCursor:h,id:g,orientation:_,registerSeparator:v,toggleSeparatorDisabled:y}=O9(),b=_===`horizontal`?`vertical`:`horizontal`;S9(()=>{let e=p.current;if(e!==null){let t={disabled:c.disabled,element:e,id:s},n=v(t),r=o9.addListener(`interactionStateChange`,e=>{f(e.state!==`inactive`&&e.hitRegions.some(e=>e.separator===t)?e.state:`inactive`)}),i=o9.addListener(`mountedGroupsChange`,e=>{e.forEach(({derivedPanelConstraints:e,layout:n,separatorToPanels:r},i)=>{if(i.id===g){let a=r.get(t);if(a){let t=a[0],r=i.panels.indexOf(t);u(vPe({layout:n,panelConstraints:e,panelId:t.id,panelIndex:r}))}}})});return()=>{r(),i(),n()}}},[g,s,v,c]),(0,w.useEffect)(()=>{y(s,!!n)},[n,s,y]);let x;return n&&!h&&(x=`not-allowed`),(0,S.jsx)(`div`,{...o,"aria-controls":l.valueControls,"aria-disabled":n||void 0,"aria-orientation":b,"aria-valuemax":l.valueMax,"aria-valuemin":l.valueMin,"aria-valuenow":l.valueNow,children:e,className:t,"data-separator":n?`disabled`:d,"data-testid":s,id:s,ref:m,role:`separator`,style:{flexBasis:`auto`,cursor:x,...a,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}A9.displayName=`Separator`;var{usePanelRef:j9}=cNe;function M9({className:e,...t}){return(0,S.jsx)(E9,{"data-slot":`resizable-panel-group`,className:H(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function N9({...e}){return(0,S.jsx)(k9,{"data-slot":`resizable-panel`,...e})}function P9({withHandle:e,className:t,...n}){return(0,S.jsx)(A9,{"data-slot":`resizable-handle`,className:H(`relative flex items-center justify-center bg-border`,`focus-visible:ring-ring focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden`,`after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2`,`aria-[orientation=vertical]:h-auto aria-[orientation=vertical]:w-px`,`aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full`,`aria-[orientation=vertical]:after:left-0 aria-[orientation=vertical]:after:h-1 aria-[orientation=vertical]:after:w-full aria-[orientation=vertical]:after:translate-x-0 aria-[orientation=vertical]:after:-translate-y-1/2`,`[&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e&&(0,S.jsx)(`div`,{className:`bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border`,children:(0,S.jsx)(Xf,{className:`size-2.5`})})})}function F9({className:e,...t}){return(0,S.jsx)(`kbd`,{"data-slot":`kbd`,className:H(`bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none`,`[&_svg:not([class*='size-'])]:size-3`,`[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10`,e),...t})}function yPe({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:r,onSearchExpand:i,onSearchChange:a,onSearchBlur:o,onCancelAll:s,searchInputRef:c}){return(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:e?(0,S.jsx)(kN,{ref:c,placeholder:`Search requests...`,value:t,onChange:e=>a(e.target.value),onBlur:o,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,"data-testid":`elicitation-tab-header`,children:`Elicitation`}),(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:n}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(xp,{className:`h-4 w-4`})})}),(0,S.jsxs)(Id,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(F9,{children:`F`})]})]})]})}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,disabled:r===0,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Vp,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{side:`bottom`,children:`Cancel all`})]})})]})}function I9({id:e,isSelected:t,isFocused:n,icon:r,title:i,description:a,metadata:o,onClick:s,className:c,"data-testid":l}){return(0,S.jsx)(`button`,{id:e,"data-testid":l,type:`button`,onClick:s,className:H(`w-full text-left cursor-pointer p-2 sm:p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group`,t&&`bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500`,n&&`ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset`,c),children:(0,S.jsxs)(`div`,{className:`flex items-start gap-2 sm:gap-3`,children:[r&&(0,S.jsx)(`div`,{className:`flex-shrink-0 mt-1`,children:(0,S.jsx)(`div`,{className:H(`p-2.5 rounded-full transition-colors`,t?`bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900`:`bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600`),children:r})}),(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 mb-1`,children:(0,S.jsx)(`h3`,{className:H(`font-medium truncate font-mono text-sm`),children:i})}),a&&(0,S.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 line-clamp-2`,children:a})]}),o&&(0,S.jsx)(`div`,{className:`flex-shrink-0 flex items-center self-center`,children:o})]})})}function bPe({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:r,formatRelativeTime:i,listRef:a}){return e.length===0?(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(su,{vertical:!0,noBorder:!0,message:`No elicitation requests`})}):(0,S.jsx)(`div`,{ref:a,className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,a)=>{let o=e.request.mode||`form`,s=o===`form`&&`requestedSchema`in e.request&&e.request.requestedSchema;return(0,S.jsx)(I9,{id:`elicitation-request-${e.id}`,"data-testid":`elicitation-request-item-${a}`,isSelected:t?.id===e.id,isFocused:r===a,title:(0,S.jsxs)(`span`,{className:`flex items-center gap-3`,children:[e.serverName,(0,S.jsx)(kt,{variant:`outline`,className:o===`url`?`bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50`:`bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50`,children:o})]}),description:(()=>{let t=i(e.timestamp),n=[];return s&&n.push(`with schema`),o===`url`&&n.push(`external action`),t+(n.length>0?` | ${n.join(`, `)}`:``)})(),onClick:()=>n(e)},e.id)})})}function xPe({request:t,onApprove:n,onReject:r,onClose:i,previewMode:a,onTogglePreview:o,isCopied:s,onCopy:c,onDownload:l,onFullscreen:u}){let{formData:d,setFieldValue:f,getMissingRequiredFields:p,urlCompleted:h,setUrlCompleted:g,mode:_,isFormMode:v,isUrlMode:y}=WMe(t);return t?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b dark:border-zinc-700`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-gray-900 dark:text-gray-100`,children:t.serverName}),(0,S.jsx)(kt,{variant:`outline`,className:y?`bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50`:`bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50`,children:_}),(0,S.jsx)(`span`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:new Date(t.timestamp).toLocaleString()})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:c,className:`h-8 w-8 p-0`,children:s?(0,S.jsx)(wf,{className:`h-4 w-4 text-green-600`}):(0,S.jsx)(Lf,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:`Copy request`})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:l,className:`h-8 w-8 p-0`,children:(0,S.jsx)(zf,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:`Download request`})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:u,className:`h-8 w-8 p-0`,children:(0,S.jsx)(ip,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:`Fullscreen`})]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Vp,{className:`h-4 w-4`})})]})]}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-6`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`Message`}),(0,S.jsx)(`p`,{className:`text-sm text-gray-700 dark:text-gray-300`,children:t.request.message})]}),y&&`url`in t.request&&(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`External Action Required`}),(0,S.jsxs)(`div`,{className:`bg-muted rounded-lg p-4 space-y-3`,children:[(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This request requires you to complete an action at an external URL:`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-background rounded border`,children:[(0,S.jsx)(`code`,{className:`flex-1 text-xs font-mono break-all`,children:t.request.url}),(0,S.jsxs)(U,{size:`sm`,variant:`outline`,onClick:()=>{t&&y&&`url`in t.request&&(window.open(t.request.url,`_blank`),g(!0))},className:`flex items-center gap-2`,children:[(0,S.jsx)(Vf,{className:`h-4 w-4`}),`Open URL`]})]}),(0,S.jsxs)(`div`,{className:`flex items-center space-x-2 pt-2`,children:[(0,S.jsx)(SY,{id:`url-completed`,checked:h,onCheckedChange:e=>g(!!e)}),(0,S.jsx)(MN,{htmlFor:`url-completed`,className:`text-sm font-normal cursor-pointer`,children:`I have completed the required action`})]})]})]}),v&&(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`Form Data`}),(0,S.jsx)(UMe,{request:t,formData:d,onFieldChange:f,idPrefix:`field`,testIdPrefix:`elicitation-field`,emptyFallback:(0,S.jsx)(`div`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:`No form schema available`})})]}),v&&`requestedSchema`in t.request&&t.request.requestedSchema&&(0,S.jsxs)(`details`,{className:`space-y-2`,children:[(0,S.jsx)(`summary`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100 cursor-pointer`,children:`Schema (for reference)`}),(0,S.jsx)(`div`,{className:`bg-muted rounded-lg p-3 max-h-64 overflow-auto`,children:(0,S.jsx)(HV,{data:t.request.requestedSchema})})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-2 p-4 border-t dark:border-zinc-700`,children:[(0,S.jsx)(U,{onClick:()=>{if(t){if(v){let e=p();if(e.length>0){BM.error(`Missing required fields`,{description:`Please fill in: ${e.join(`, `)}`});return}n(t.id,{action:`accept`,content:d})}else y&&n(t.id,{action:`accept`});i(),J(()=>Promise.resolve().then(()=>e(m(),1)).then(e=>{let t=BM(e.createElement(`div`,{className:`space-y-3`},e.createElement(`div`,null,e.createElement(`strong`,null,`Elicitation Response Sent`),e.createElement(`p`,{className:`text-sm text-muted-foreground mt-1`},`The tool will continue executing.`)),e.createElement(`div`,{className:`flex gap-2`},e.createElement(`button`,{"data-testid":`elicitation-view-tool-result`,className:`px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,onClick:()=>{let e=new globalThis.CustomEvent(`navigate-to-tool-result`,{detail:{toolName:null}});window.dispatchEvent(e),BM.dismiss(t)}},`View Tool Result`))),{duration:5e3})}),void 0)}},className:`flex-1`,"data-testid":`elicitation-accept-button`,children:`Accept`}),(0,S.jsx)(U,{onClick:()=>{t&&(n(t.id,{action:`decline`}),i())},variant:`outline`,className:`flex-1`,"data-testid":`elicitation-decline-button`,children:`Decline`}),(0,S.jsx)(U,{onClick:()=>{t&&(r(t.id,`User cancelled elicitation request`),i())},variant:`outline`,className:`flex-1`,"data-testid":`elicitation-cancel-button`,children:`Cancel`})]})]}):(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Select an elicitation request to view details`})})}function L9(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 SPe({pendingRequests:e=[],onApprove:t,onReject:n,serverId:r,isConnected:i}){let{selectedElicitationRequestId:a,setSelectedElicitationRequestId:o}=qq(),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(-1),[p,m]=(0,w.useState)(!0),[h,g]=(0,w.useState)(!1),[_,v]=(0,w.useState)(!0),[y,b]=(0,w.useState)(!1),x=(0,w.useRef)(null),C=(0,w.useRef)(null),T=(0,w.useRef)(null),E=(0,w.useRef)(!1);(0,w.useEffect)(()=>{if(console.log(`[ElicitationTab] Auto-selection check:`,{selectedElicitationRequestId:a,pendingRequestsCount:e.length,currentSelectedId:s?.id}),a&&e.length>0){let t=e.find(e=>e.id===a);console.log(`[ElicitationTab] Found request for auto-selection:`,!!t,t?.id),t&&(console.log(`[ElicitationTab] Auto-selecting request:`,t.id),o(null),c(t),setTimeout(()=>{let e=document.getElementById(`elicitation-request-${t.id}`);console.log(`[ElicitationTab] Scrolling to element:`,!!e),e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},100))}},[a,e,o]),(0,w.useEffect)(()=>{let t=t=>{let n=t.detail.requestId;console.log(`[ElicitationTab] Custom navigate event received:`,n);let r=e.find(e=>e.id===n);r&&(console.log(`[ElicitationTab] Selecting request from event:`,n),c(r),setTimeout(()=>{let e=document.getElementById(`elicitation-request-${n}`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},200))};return window.addEventListener(`navigate-to-elicitation`,t),()=>window.removeEventListener(`navigate-to-elicitation`,t)},[e]),(0,w.useEffect)(()=>{p&&e.length>0&&x.current&&!E.current&&(x.current.scrollTop=0)},[e.length,p]),(0,w.useEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{e.scrollTop>0&&(E.current=!0,m(!1))};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,w.useEffect)(()=>{e.length===0&&(E.current=!1,m(!0))},[e.length]),(0,w.useEffect)(()=>{h&&T.current&&T.current.focus()},[h]);let D=(0,w.useCallback)(()=>{l.trim()||g(!1)},[l]),O=(0,w.useMemo)(()=>{if(!l.trim())return e;let t=l.toLowerCase();return e.filter(e=>e.serverName.toLowerCase().includes(t)||e.request.message.toLowerCase().includes(t)||JSON.stringify(e.request||{}).toLowerCase().includes(t))},[e,l]);(0,w.useEffect)(()=>{f(-1)},[l]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=O;if(e.key===`ArrowDown`)e.preventDefault(),f(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&d>=0){e.preventDefault();let t=O[d];t&&k(t)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,O]),(0,w.useEffect)(()=>{if(d>=0){let e=`elicitation-request-${O[d]?.id}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[d,O]);let k=(0,w.useCallback)(e=>{c(e)},[]),A=(0,w.useCallback)(()=>{window.confirm(`Are you sure you want to cancel all elicitation requests? This cannot be undone.`)&&(e.forEach(e=>{n(e.id,`User cancelled all requests`)}),c(null))},[e,n]),j=(0,w.useCallback)(async()=>{if(s)try{await bj(JSON.stringify({id:s.id,serverName:s.serverName,timestamp:s.timestamp,request:s.request},null,2)),b(!0),setTimeout(()=>b(!1),2e3)}catch(e){console.error(`[ElicitationTab] Failed to copy request:`,e)}},[s]),M=(0,w.useCallback)(()=>{if(s)try{let e=new globalThis.Blob([JSON.stringify({id:s.id,serverName:s.serverName,timestamp:s.timestamp,request:s.request},null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`elicitation-request-${Date.now()}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`[ElicitationTab] Failed to download request:`,e)}},[s]),N=(0,w.useCallback)(async()=>{if(C.current)try{document.fullscreenElement?await document.exitFullscreen():await C.current.requestFullscreen()}catch(e){console.error(`[ElicitationTab] Failed to toggle fullscreen:`,e)}},[]);return i?(0,S.jsxs)(M9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(N9,{defaultSize:40,minSize:30,children:(0,S.jsx)(M9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:(0,S.jsxs)(N9,{defaultSize:75,minSize:30,children:[(0,S.jsx)(yPe,{isSearchExpanded:h,searchQuery:l,filteredRequestsCount:O.length,requestsCount:e.length,onSearchExpand:()=>g(!0),onSearchChange:u,onSearchBlur:D,onCancelAll:A,searchInputRef:T}),(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(bPe,{requests:O,selectedRequest:s,onRequestSelect:k,focusedIndex:d,formatRelativeTime:L9,listRef:x})})]})})}),(0,S.jsx)(P9,{}),(0,S.jsx)(N9,{defaultSize:60,minSize:40,children:(0,S.jsx)(`div`,{ref:C,className:`h-full bg-white dark:bg-zinc-900`,children:(0,S.jsx)(xPe,{request:s,onApprove:t,onReject:n,onClose:()=>c(null),previewMode:_,onTogglePreview:()=>v(!_),isCopied:y,onCopy:j,onDownload:M,onFullscreen:N})})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Ap,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Not connected to server`})]})}function CPe({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:r,onSearchExpand:i,onSearchChange:a,onSearchBlur:o,onClearAll:s,searchInputRef:c}){return(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:e?(0,S.jsx)(kN,{ref:c,placeholder:`Search notifications...`,value:t,onChange:e=>a(e.target.value),onBlur:o,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,children:`Notifications`}),(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:n}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(xp,{className:`h-4 w-4`})})}),(0,S.jsxs)(Id,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(F9,{children:`F`})]})]})]})}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,disabled:r===0,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Rp,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{side:`bottom`,children:`Clear all`})]})})]})}function wPe({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:r,formatRelativeTime:i,listRef:a}){return e.length===0?(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(su,{vertical:!0,noBorder:!0,message:`No notifications yet`})}):(0,S.jsx)(`div`,{ref:a,className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,a)=>(0,S.jsx)(I9,{id:`notification-${e.id}`,isSelected:t?.id===e.id,isFocused:r===a,title:(0,S.jsxs)(`span`,{className:`flex items-center gap-3`,children:[e.method,!e.read&&(0,S.jsx)(`span`,{className:`size-1.5 block rounded-full bg-orange-500`})]}),description:(()=>{let t=i(e.timestamp),n=e.params&&Object.keys(e.params).length>0?Object.keys(e.params).length:0;return t+(n>0?` | ${n} param${n>1?`s`:``}`:``)})(),onClick:()=>n(e)},e.id))})}function TPe({notification:e,previewMode:t,onTogglePreview:n,onCopy:r,onDownload:i,onFullscreen:a,isCopied:o=!1,onClose:s}){return e?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsxs)(`div`,{className:`flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Nf,{className:`h-3 w-3 text-gray-400`}),(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:new Date(e.timestamp).toLocaleTimeString()})]}),(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e.formatRelativeTime(e.timestamp)})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:n,className:t?``:`text-purple-600 dark:text-purple-400`,children:[t?(0,S.jsx)(Pf,{className:`h-4 w-4 mr-1`}):(0,S.jsx)(Sf,{className:`h-4 w-4 mr-1`}),t?`JSON`:`Formatted`]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:r,children:o?(0,S.jsx)(wf,{className:`h-4 w-4`}):(0,S.jsx)(Lf,{className:`h-4 w-4`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,children:(0,S.jsx)(zf,{className:`h-4 w-4`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:a,children:(0,S.jsx)(ap,{className:`h-4 w-4`})}),s&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,children:(0,S.jsx)(Vp,{className:`h-4 w-4`})})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(HV,{data:{method:e.method,timestamp:e.timestamp,read:e.read,params:e.params},filename:`notification-${e.method.replace(/[^a-zA-Z0-9]/g,`-`)}-${Date.now()}.json`})})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(yf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Select a notification to view details`})]})}function EPe({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:r,clearNotifications:i,serverId:a,isConnected:o}){let[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(-1),[p,m]=(0,w.useState)(!0),[h,g]=(0,w.useState)(!1),[_,v]=(0,w.useState)(!0),[y,b]=(0,w.useState)(!1),x=(0,w.useRef)(null),C=(0,w.useRef)(null),T=(0,w.useRef)(null),E=(0,w.useRef)(!1);(0,w.useEffect)(()=>{p&&e.length>0&&x.current&&!E.current&&(x.current.scrollTop=0)},[e.length,p]),(0,w.useEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{e.scrollTop>0&&(E.current=!0,m(!1))};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,w.useEffect)(()=>{e.length===0&&(E.current=!1,m(!0))},[e.length]),(0,w.useEffect)(()=>{s&&!s.read&&n(s.id)},[s,n]),(0,w.useEffect)(()=>{h&&T.current&&T.current.focus()},[h]);let D=(0,w.useCallback)(()=>{l.trim()||g(!1)},[l]),O=(0,w.useMemo)(()=>{if(!l.trim())return e;let t=l.toLowerCase();return e.filter(e=>e.method.toLowerCase().includes(t)||JSON.stringify(e.params||{}).toLowerCase().includes(t))},[e,l]);(0,w.useEffect)(()=>{f(-1)},[l]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=O;if(e.key===`ArrowDown`)e.preventDefault(),f(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&d>=0){e.preventDefault();let t=O[d];t&&k(t)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,O]),(0,w.useEffect)(()=>{if(d>=0){let e=`notification-${O[d]?.id}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[d,O]);let k=(0,w.useCallback)(e=>{c(e)},[]),A=(0,w.useCallback)(()=>{window.confirm(`Are you sure you want to clear all notifications? This cannot be undone.`)&&(i(),c(null))},[i]),j=(0,w.useCallback)(async()=>{if(s)try{await bj(JSON.stringify({method:s.method,timestamp:s.timestamp,read:s.read,params:s.params},null,2)),b(!0),setTimeout(()=>b(!1),2e3)}catch(e){console.error(`[NotificationsTab] Failed to copy notification:`,e)}},[s]),M=(0,w.useCallback)(()=>{if(s)try{let e=new globalThis.Blob([JSON.stringify({method:s.method,timestamp:s.timestamp,read:s.read,params:s.params},null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`notification-${Date.now()}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`[NotificationsTab] Failed to download notification:`,e)}},[s]),N=(0,w.useCallback)(async()=>{if(C.current)try{document.fullscreenElement?await document.exitFullscreen():await C.current.requestFullscreen()}catch(e){console.error(`[NotificationsTab] Failed to toggle fullscreen:`,e)}},[]),P=s?{method:s.method,params:s.params,timestamp:s.timestamp,read:s.read,formatRelativeTime:L9}:null;return o?(0,S.jsxs)(M9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(N9,{defaultSize:40,minSize:30,children:(0,S.jsx)(M9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:(0,S.jsxs)(N9,{defaultSize:75,minSize:30,children:[(0,S.jsx)(CPe,{isSearchExpanded:h,searchQuery:l,filteredNotificationsCount:O.length,notificationsCount:e.length,onSearchExpand:()=>g(!0),onSearchChange:u,onSearchBlur:D,onClearAll:A,searchInputRef:T}),(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(wPe,{notifications:O,selectedNotification:s,onNotificationSelect:k,focusedIndex:d,formatRelativeTime:L9,listRef:x})})]})})}),(0,S.jsx)(P9,{}),(0,S.jsx)(N9,{defaultSize:60,minSize:40,children:(0,S.jsx)(`div`,{ref:C,className:`h-full bg-white dark:bg-zinc-900`,children:(0,S.jsx)(TPe,{notification:P,previewMode:_,onTogglePreview:()=>v(!_),onCopy:j,onDownload:M,onFullscreen:N,onClose:()=>c(null),isCopied:y})})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(yf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Not connected to server`})]})}function DPe({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:r,secondaryTabTitle:i,primaryCount:a,secondaryCount:o,secondaryIcon:s,primaryIcon:c,searchPlaceholder:l=`Search...`,onSearchExpand:u,onSearchChange:d,onSearchBlur:f,onTabSwitch:p,searchInputRef:m,primaryTabName:h,onRefresh:g,isRefreshing:_=!1}){let v=e===h;return(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:t?(0,S.jsx)(kN,{ref:m,placeholder:l,value:n,onChange:e=>d(e.target.value),onBlur:f,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,children:v?r:i}),v&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:a}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:u,className:`h-8 w-8 p-0`,children:(0,S.jsx)(xp,{className:`h-4 w-4`})})}),(0,S.jsxs)(Id,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(F9,{children:`F`})]})]}),g&&(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:g,disabled:_,className:`h-8 w-8 p-0`,children:(0,S.jsx)(_p,{className:`h-4 w-4 ${_?`animate-spin`:``}`})})}),(0,S.jsxs)(Id,{side:`bottom`,className:`flex gap-2`,children:[`Refresh list`,(0,S.jsx)(F9,{children:`R`})]})]})]})]})}),(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:p,className:`gap-2 flex-shrink-0`,children:[v?(0,S.jsx)(s,{}):(0,S.jsx)(c,{}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:v?i:r}),v&&o>0&&(0,S.jsx)(kt,{className:`bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent`,variant:`outline`,children:o})]})]})}function OPe({serverIds:e,onCountChange:t,onClearRef:n,onExportRef:r}={}){let[i,a]=(0,w.useState)([]),c=(0,w.useRef)(null),[l,d]=(0,w.useState)(new Set),[f]=(0,w.useState)(``),p=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},m=async()=>{a([]),d(new Set),t?.(0),e&&e.length>0?e.forEach(e=>u(e)):u()},h=async e=>{try{await bj(JSON.stringify(e,null,2)),BM.success(`Message copied to clipboard`)}catch(e){console.error(`Failed to copy message:`,e),BM.error(`Failed to copy to clipboard`)}},g=async()=>{try{await bj(JSON.stringify(v,null,2)),BM.success(`All messages copied to clipboard (${v.length})`)}catch(e){console.error(`Failed to copy all messages:`,e),BM.error(`Failed to copy to clipboard`)}},_=(0,w.useMemo)(()=>!e||e.length===0?``:[...e].sort().join(`,`),[e]);(0,w.useEffect)(()=>(n&&(n.current=m),()=>{n&&(n.current=null)}),[n,m]),(0,w.useEffect)(()=>(r&&(r.current=g),()=>{r&&(r.current=null)}),[r,g]),(0,w.useEffect)(()=>{t?.(i.length)},[i.length,t]),(0,w.useEffect)(()=>{console.log(`[RPC Logger] Subscribing to RPC logs for servers:`,e);let n=s(),r=(e&&e.length>0?n.filter(t=>e.includes(t.serverId)):n).map(e=>{let t=e.message,n=typeof t?.method==`string`?t.method:t?.result===void 0?t?.error===void 0?`unknown`:`error`:`result`;return{id:`${e.timestamp}-${Math.random().toString(36).slice(2)}`,serverId:e.serverId,direction:e.direction.toUpperCase(),method:n,timestamp:e.timestamp,payload:e.message}}).reverse();a(r),t?.(r.length);let i=o(n=>{if(e&&e.length>0&&!e.includes(n.serverId))return;let r=n.message,i=typeof r?.method==`string`?r.method:r?.result===void 0?r?.error===void 0?`unknown`:`error`:`result`,o={id:`${n.timestamp}-${Math.random().toString(36).slice(2)}`,serverId:n.serverId,direction:n.direction.toUpperCase(),method:i,timestamp:n.timestamp,payload:n.message};console.log(`[RPC Logger] New RPC log:`,{method:i,direction:n.direction,serverId:n.serverId}),a(e=>{let n=[o,...e].slice(0,1e3);return t?.(n.length),n})});return()=>{i(),console.log(`[RPC Logger] Unsubscribed from RPC logs`)}},[_,t]);let v=(0,w.useMemo)(()=>{let t=i;if(e&&e.length>0){let n=new Set(e);t=t.filter(e=>n.has(e.serverId))}if(f.trim()){let e=f.toLowerCase();t=t.filter(t=>t.serverId.toLowerCase().includes(e)||t.method.toLowerCase().includes(e)||t.direction.toLowerCase().includes(e)||JSON.stringify(t.payload).toLowerCase().includes(e))}return t=[...t].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),t},[i,f,e]);return(0,S.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:(0,S.jsx)(`div`,{ref:c,className:`flex-1 min-h-0 overflow-y-auto`,children:v.length===0?(0,S.jsxs)(`div`,{className:`text-center py-8`,children:[(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No messages yet`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1`,children:`JSON-RPC messages will appear here`})]}):v.map(e=>{let t=l.has(e.id);return(0,S.jsxs)(`div`,{className:`group hover:bg-muted/50 transition-all duration-200 overflow-hidden`,"data-testid":`rpc-message-${e.method.replace(/\//g,`-`)}`,children:[(0,S.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors`,onClick:()=>p(e.id),children:[(0,S.jsx)(`div`,{className:`flex-shrink-0`,children:t?(0,S.jsx)(Tf,{className:`h-3 w-3 text-muted-foreground transition-transform`}):(0,S.jsx)(Df,{className:`h-3 w-3 text-muted-foreground transition-transform`})}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,S.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:new Date(e.timestamp).toLocaleTimeString()}),(0,S.jsx)(`span`,{className:`flex items-center justify-center px-1 py-0.5 rounded ${e.direction===`RECEIVE`?`bg-blue-500/10 text-blue-600 dark:text-blue-400`:`bg-green-500/10 text-green-600 dark:text-green-400`}`,title:e.direction===`RECEIVE`?`Incoming`:`Outgoing`,children:e.direction===`RECEIVE`?(0,S.jsx)(hf,{className:`h-3 w-3`}):(0,S.jsx)(gf,{className:`h-3 w-3`})}),(0,S.jsx)(`span`,{className:`text-xs font-mono text-foreground truncate`,children:e.method})]})]}),t&&(0,S.jsx)(`div`,{className:`border-t bg-muted/20`,children:(0,S.jsxs)(`div`,{className:`p-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Message Payload`}),(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:t=>{t.stopPropagation(),h(e.payload)},className:`h-6 px-2`,title:`Copy message to clipboard`,children:[(0,S.jsx)(Lf,{className:`h-3 w-3 mr-1`}),(0,S.jsx)(`span`,{className:`text-xs`,children:`Copy`})]})]}),(0,S.jsx)(`div`,{className:`max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2`,children:(0,S.jsx)(HV,{data:e.payload})})]})})]},e.id)})})})}function R9({serverId:e,className:t}){let[n,r]=(0,w.useState)(0),[i,a]=(0,w.useState)(!0),o=j9(),s=(0,w.useRef)(null),c=(0,w.useRef)(null);return(0,w.useEffect)(()=>{o.current?.collapse()},[]),(0,S.jsxs)(N9,{panelRef:o,defaultSize:46,collapsible:!0,minSize:150,collapsedSize:46,onResize:e=>{i&&e.inPixels>46?a(!1):!i&&e.inPixels<=46&&a(!0)},className:`flex flex-col border-t dark:border-zinc-700 ${t||``}`,children:[(0,S.jsxs)(`div`,{"data-testid":`rpc-panel-toggle`,className:`group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors`,onClick:e=>{e.preventDefault(),e.stopPropagation(),i?(a(!1),setTimeout(()=>{o.current?.expand()},100)):(o.current?.collapse(),setTimeout(()=>{a(!0)},100))},children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium`,children:`RPC Messages`}),n>0&&(0,S.jsx)(kt,{"data-testid":`rpc-message-count`,variant:`secondary`,className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,children:n})]}),n>0&&!i&&(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),c.current?.()},className:`h-6 w-6 p-0`,title:`Copy all messages to clipboard`,children:(0,S.jsx)(Lf,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),s.current?.()},className:`h-6 w-6 p-0`,title:`Clear all messages`,children:(0,S.jsx)(Rp,{className:`h-3.5 w-3.5`})})]})]}),(0,S.jsx)(Tf,{className:`h-4 w-4 text-muted-foreground transition-transform ${i?``:`rotate-180`}`})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-hidden min-h-0 ${i?`hidden`:``}`,children:(0,S.jsx)(OPe,{serverIds:[e],onCountChange:r,onClearRef:s,onExportRef:c})})]})}R9.displayName=`RpcPanel`;function kPe({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:r}){return e.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(sp,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`No prompts available`})]}):(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain`,children:e.map((e,i)=>(0,S.jsx)(I9,{id:`prompt-${e.name}`,"data-testid":`prompt-item-${e.name}`,isSelected:t?.name===e.name,isFocused:r===i,icon:(0,S.jsx)(sp,{className:`h-4 w-4`}),title:e.name,description:e.description,metadata:e.arguments&&e.arguments.length>0&&(0,S.jsxs)(kt,{variant:`outline`,className:`text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400`,children:[e.arguments.length,` args`]}),onClick:()=>n(e)},e.name))})}function APe({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:r,savedPromptsCount:i,onSearchExpand:a,onSearchChange:o,onSearchBlur:s,onTabSwitch:c,searchInputRef:l,onRefresh:u,isRefreshing:d}){return(0,S.jsx)(DPe,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:`prompts`,secondaryTabName:`saved`,primaryTabTitle:`Prompts`,secondaryTabTitle:`History`,primaryCount:r,secondaryCount:i,primaryIcon:sp,secondaryIcon:Nf,searchPlaceholder:`Search prompts...`,onSearchExpand:a,onSearchChange:o,onSearchBlur:s,onTabSwitch:c,searchInputRef:l,onRefresh:u,isRefreshing:d})}function jPe({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:r,focusedIndex:i}){return e.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Nf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`No history`}),(0,S.jsx)(`p`,{className:`text-sm text-gray-400 dark:text-gray-500 mt-1`,children:`Prompts you execute will appear here`})]}):(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain`,children:e.map((e,r)=>(0,S.jsx)(I9,{id:`saved-prompt-${e.id}`,isSelected:t?.id===e.id,isFocused:i===r,icon:(0,S.jsx)(Nf,{className:`h-4 w-4`}),title:e.name,description:`${e.promptName} - ${new Date(e.savedAt).toLocaleString()}`,onClick:()=>n(e)},e.id))})}function MPe({selectedPrompt:e,promptArgs:t,onArgChange:n}){let r=e?.arguments||[];if(!(r.length>0))return(0,S.jsx)(`div`,{className:`flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm`,children:`No arguments required`});let i=e=>{let r=e.name,i=t[r],a=typeof i==`string`?i:JSON.stringify(i);return e.type===`boolean`?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(MN,{htmlFor:r,className:`text-sm font-medium`,children:[r,e.required&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(`input`,{id:r,type:`checkbox`,checked:!!i,onChange:e=>n(r,e.target.checked),className:`rounded`,"aria-label":`Toggle ${r}`}),(0,S.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:e.description})]})]},r):e.type===`number`?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(MN,{htmlFor:r,className:`text-sm font-medium`,children:[r,e.required&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsx)(kN,{id:r,type:`number`,value:Number(i)||0,onChange:e=>n(r,Number(e.target.value)),placeholder:e.description||`Enter ${r}`}),e.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e.description})]},r):e.type===`array`||e.type===`object`?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(MN,{htmlFor:r,className:`text-sm font-medium`,children:[r,e.required&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsx)(uY,{id:r,value:a,onChange:e=>{try{n(r,JSON.parse(e.target.value))}catch{n(r,e.target.value)}},placeholder:e.description||`Enter ${r} as JSON`,className:`font-mono text-sm min-h-[100px]`}),e.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e.description})]},r):(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(MN,{htmlFor:r,className:`text-sm font-medium`,children:[r,e.required&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsx)(kN,{id:r,"data-testid":`prompt-param-${r}`,value:a,onChange:e=>n(r,e.target.value),placeholder:e.description||`Enter ${r}`}),e.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e.description})]},r)};return(0,S.jsx)(`div`,{className:`space-y-4`,children:r.map(e=>i(e))})}function NPe({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:r,onArgChange:i,onExecute:a,onSave:o}){return(0,w.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&e&&!n&&r&&(t.preventDefault(),a())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,n,r,a]),e?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsx)(`div`,{className:`flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between mb-0 gap-2`,children:[(0,S.jsx)(`h3`,{className:`text-base sm:text-lg font-semibold`,children:e.name}),(0,S.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,S.jsx)(U,{onClick:a,disabled:n||!r,size:`sm`,className:`lg:size-default pr-1! gap-0`,"data-testid":`prompt-execute-button`,children:n?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Uq,{className:`mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Executing...`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(mp,{className:`h-4 w-4 sm:mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Execute`}),(0,S.jsx)(`span`,{className:`hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2`,children:`⌘↵`})]})}),(0,S.jsxs)(U,{variant:`outline`,onClick:o,disabled:n,size:`sm`,className:`lg:size-default gap-2`,children:[(0,S.jsx)(bp,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Save`})]})]})]}),e.description&&(0,S.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2`,children:e.description})]})}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3`,children:(0,S.jsx)(MPe,{selectedPrompt:e,promptArgs:t,onArgChange:i})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 mb-2`,children:`Select a prompt to get started`}),(0,S.jsx)(`p`,{className:`text-xs text-gray-400 dark:text-gray-500`,children:`Choose a prompt from the list to view its details and execute it`})]})}function PPe(e){switch(e){case`system`:return`default`;case`user`:return`outline`;case`assistant`:return`secondary`;default:return`outline`}}function FPe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function IPe(e){return typeof e==`string`?e:e.text?e.text:e.type===`resource`&&e.resource?.text?e.resource.text:e.type===`image`?`[Image: ${e.mimeType||`unknown type`}]`:JSON.stringify(e,null,2)}function LPe({message:e,index:t}){let[n,r]=(0,w.useState)(!1);return(0,S.jsxs)(`div`,{className:`border border-border rounded-lg overflow-hidden bg-white dark:bg-zinc-900`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-muted/30 border-b border-border`,children:[(0,S.jsx)(kt,{variant:PPe(e.role),children:FPe(e.role)}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:async()=>{await bj(IPe(e.content)),r(!0),setTimeout(()=>r(!1),2e3)},className:`h-6 px-2`,title:`Copy message content`,children:n?(0,S.jsx)(wf,{className:`h-3.5 w-3.5`}):(0,S.jsx)(Lf,{className:`h-3.5 w-3.5`})})]}),(0,S.jsx)(`div`,{className:`px-4 py-3`,"data-testid":`prompt-message-content-${t}`,children:(()=>{let t=e.content;return typeof t==`string`?(0,S.jsx)(sQ,{content:t}):t.type===`text`&&t.text?(0,S.jsx)(sQ,{content:t.text}):t.type===`image`?(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,S.jsxs)(`span`,{className:`font-mono bg-muted px-2 py-1 rounded`,children:[`Image: `,t.mimeType||`unknown type`]}),t.data&&(0,S.jsx)(`img`,{src:`data:${t.mimeType};base64,${t.data}`,alt:`Prompt image`,className:`max-w-full max-h-[300px] object-contain rounded-lg border border-border mt-2`})]}):t.type===`resource`&&t.resource?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,S.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Resource:`}),(0,S.jsx)(`code`,{className:`bg-muted px-2 py-0.5 rounded text-xs font-mono`,children:t.resource.uri})]}),t.resource.text&&(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(sQ,{content:t.resource.text})})]}):(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-lg text-sm overflow-x-auto`,children:(0,S.jsx)(`code`,{children:JSON.stringify(t,null,2)})})})()})]})}function RPe(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<10?`now`:n<60?`${n}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`}function zPe(e){return`isError`in e&&!e.isError?null:`error`in e&&e.error?String(e.error):`isError`in e&&e.isError?`An error occurred`:null}function BPe({results:e,copiedResult:t,previewMode:n=!0,onCopy:r,onDelete:i,onFullscreen:a,onTogglePreview:o,onMaximize:s,isMaximized:c=!1}){let[l,u]=(0,w.useState)(0),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(!0),h=e[0],g=h?e.filter(e=>e.promptName===h.promptName):[],_=g[l]||g[0],v=e.findIndex(e=>e===_);if((0,w.useEffect)(()=>{g.length>0&&l>=g.length&&u(0)},[g.length,l]),(0,w.useEffect)(()=>{let e=()=>{_&&f(RPe(_.timestamp))};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[_]),e.length===0)return(0,S.jsx)(`div`,{className:`flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700`,children:(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto h-full`,children:(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,S.jsx)(`div`,{className:`text-center`,children:(0,S.jsx)(su,{vertical:!0,noBorder:!0,message:`No Results yet`})})})})});let y=_.error||zPe(_.result),b=`messages`in _.result&&Array.isArray(_.result.messages);return(0,S.jsx)(`div`,{className:`flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700`,children:(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto h-full`,children:(0,S.jsxs)(`div`,{className:`space-y-0 flex-1 h-full flex flex-col`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium hidden sm:block`,children:`Response`}),_.duration!==void 0&&(0,S.jsxs)(`div`,{className:`hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(Hp,{className:`h-3 w-3 text-gray-400`}),(0,S.jsxs)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[_.duration,`ms`]})]}),b&&(0,S.jsx)(`div`,{className:`flex items-center gap-4 sm:ml-4`,children:(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{onClick:()=>m(!0),className:`text-xs font-medium ${p?`text-black dark:text-white`:`text-zinc-500 dark:text-zinc-400`}`,children:`Formatted`}),(0,S.jsx)(`span`,{className:`text-xs text-zinc-400`,children:`|`}),(0,S.jsx)(`button`,{onClick:()=>m(!1),className:`text-xs font-medium ${p?`text-zinc-500 dark:text-zinc-400`:`text-black dark:text-white`}`,children:`Raw`})]})}),(0,S.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[g.length>1&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mr-2`,children:[(0,S.jsx)(Qf,{className:`h-3 w-3 text-gray-400`}),(0,S.jsxs)(wP,{value:l.toString(),onValueChange:e=>u(parseInt(e)),children:[(0,S.jsx)(EP,{className:`h-7 w-[120px] text-xs`,children:(0,S.jsx)(TP,{})}),(0,S.jsx)(DP,{children:g.map((e,t)=>(0,S.jsx)(OP,{value:t.toString(),children:t===0?`Latest`:`${t+1} call ago`},t))})]})]}),(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400 mr-2`,children:d}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>r(v,_.result),className:`h-7 w-7 p-0`,title:`Copy result`,children:t===v?(0,S.jsx)(wf,{className:`h-4 w-4`}):(0,S.jsx)(Lf,{className:`h-4 w-4`})}),i&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>i(v),className:`h-7 w-7 p-0`,title:`Delete result`,children:(0,S.jsx)(Rp,{className:`h-4 w-4`})}),a&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a(v),className:`h-7 w-7 p-0 sm:hidden`,title:`Fullscreen`,children:(0,S.jsx)(ap,{className:`h-4 w-4`})}),s&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,className:`h-7 w-7 p-0 hidden sm:flex`,title:c?`Restore`:`Maximize`,children:c?(0,S.jsx)(cp,{className:`h-4 w-4`}):(0,S.jsx)(ap,{className:`h-4 w-4`})})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:y?(0,S.jsxs)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:[(0,S.jsx)(`p`,{className:`text-red-800 dark:text-red-300 font-medium`,children:`Error:`}),(0,S.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-sm`,children:y})]}):p&&b?(0,S.jsx)(`div`,{className:`space-y-3`,children:(`messages`in _.result?_.result.messages:[]).map((e,t)=>(0,S.jsx)(LPe,{message:e,index:t},t))}):(0,S.jsx)(HV,{data:_.result,filename:`prompt-result-${_.promptName}-${Date.now()}.json`})})]})})})}var VPe=`mcp-inspector-saved-prompts`;function HPe({ref:e,prompts:t,callPrompt:n,serverId:r,isConnected:i,refreshPrompts:a}){let[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),{selectedPromptName:u,setSelectedPromptName:d}=qq(),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(`prompts`),[g,_]=(0,w.useState)([]),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(``),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(-1),O=(0,w.useRef)(null),[k,A]=(0,w.useState)(!1),[j,M]=(0,w.useState)(`list`),[N,P]=(0,w.useState)(!1),{filteredPrompts:F,selectedPrompt:I,setSelectedPrompt:L,results:ee,handleDeleteResult:te,promptArgs:ne,setPromptArgs:R,isExecuting:z,handlePromptSelect:B,handleArgChange:re,executeSelectedPrompt:ie,searchQuery:ae,setSearchQuery:oe}=FJ({prompts:t,callPrompt:n,serverId:r}),se=j9(),ce=j9();(0,w.useEffect)(()=>{let e=()=>{A(window.innerWidth<1024)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,w.useEffect)(()=>{M(I?`detail`:`list`)},[I]),(0,w.useEffect)(()=>{k&&ee.length>0&&!z&&M(`response`)},[ee,z,k]),(0,w.useImperativeHandle)(e,()=>({focusSearch:()=>{T(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{oe(``),T(!1),O.current&&O.current.blur()}})),(0,w.useEffect)(()=>{try{let e=localStorage.getItem(VPe);e&&_(JSON.parse(e))}catch(e){console.error(`[PromptsTab] Failed to load saved prompts:`,e)}},[]);let le=(0,w.useCallback)(e=>{try{localStorage.setItem(VPe,JSON.stringify(e))}catch(e){console.error(`[PromptsTab] Failed to save prompts:`,e)}},[]);(0,w.useEffect)(()=>{C&&O.current&&O.current.focus()},[C]);let ue=(0,w.useCallback)(()=>{ae.trim()||T(!1)},[ae]),de=(0,w.useCallback)(async()=>{if(a){s(!0);try{await a()}finally{s(!1)}}},[a]),fe=(0,w.useCallback)(e=>{let n=t.find(t=>t.name===e.promptName);n&&(L(n),R(e.args),l(e))},[t,L,R]);(0,w.useEffect)(()=>{D(-1)},[ae,m]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=m===`prompts`?F:g;if(e.key===`ArrowDown`)e.preventDefault(),D(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),D(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&E>=0)if(e.preventDefault(),m===`prompts`){let e=F[E];e&&B(e)}else{let e=g[E];e&&fe(e)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[E,F,g,m,B,fe]),(0,w.useEffect)(()=>{if(E>=0){let e=m===`prompts`?`prompt-${F[E]?.name}`:`saved-prompt-${g[E]?.id}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[E,F,g,m]),(0,w.useEffect)(()=>{if(console.warn(`[PromptsTab] Auto-selection effect triggered:`,{selectedPromptName:u,promptsCount:t.length,currentSelectedPrompt:I?.name}),u&&t.length>0){let e=t.find(e=>e.name===u);if(console.warn(`[PromptsTab] Prompt lookup result:`,{selectedPromptName:u,promptFound:!!e,promptName:e?.name,shouldSelect:e&&I?.name!==e.name}),e&&I?.name!==e.name){console.warn(`[PromptsTab] Selecting prompt:`,e.name),d(null);let t=setTimeout(()=>{B(e);let t=document.getElementById(`prompt-${e.name}`);t&&(console.warn(`[PromptsTab] Scrolling to prompt element`),t.scrollIntoView({behavior:`smooth`,block:`nearest`}))},100);return()=>clearTimeout(t)}}},[u,t,I,B,d]);let pe=(0,w.useCallback)(async(e,t)=>{try{await bj(JSON.stringify(t,null,2)),p(e),setTimeout(()=>p(null),2e3)}catch(e){console.error(`[PromptsTab] Failed to copy result:`,e)}},[]),me=(0,w.useCallback)(e=>{if(k)M(`response`);else{let t=ee[e];if(t){let e=window.open(``,`_blank`,`width=800,height=600`);if(e){let n=t.result;e.document.write(`
807
+ `),t},[Ze,Qe]),ut=(0,w.useCallback)(()=>{bj(lt(De)).then(()=>BM.success(`Chat copied to clipboard`),()=>BM.error(`Failed to copy chat`))},[De,lt]),dt=(0,w.useCallback)(e=>{let t=`chat-export-${new Date().toISOString().split(`T`)[0]}`;if(e===`json`)WP(De.map(e=>({id:e.id,role:e.role,content:Ze(e),timestamp:e.timestamp,toolInvocations:e.parts?.filter(e=>e.type===`tool-invocation`&&e.toolInvocation).map(e=>({toolName:e.toolInvocation.toolName,args:e.toolInvocation.args,result:e.toolInvocation.result}))})),t+`.json`);else{let e=lt(De),n=new Blob([e],{type:`text/markdown`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t+`.md`,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),100)}BM.success(`Chat exported as ${e.toUpperCase()}`)},[De,lt,Ze]),ft=(0,w.useCallback)(()=>{ge(),je()},[ge,je]),pt=(0,w.useCallback)(e=>{e.trim()&&(!be||!t||Ae(e,[]).then(()=>{et(`mcp-inspector:chat:message_sent`,{message:e,source:`quick_question`})}))},[et,Ae,be,t]),mt=(0,w.useCallback)(e=>{e.trim()&&(!be||!t||Ae(e,[]).then(()=>{et(`mcp-inspector:chat:message_sent`,{message:e,source:`followup`})}))},[et,Ae,be,t]),ht=(Ie||ze)&&c?(0,S.jsx)(iNe,{authOrigin:new URL(c).origin,onDismiss:()=>{Le?.(),Be(!1)},onUseApiKey:Re}):null;return be&&De.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,S.jsx)(lY,{open:se,onOpenChange:ce,tempProvider:le,tempModel:pe,tempApiKey:de,onProviderChange:ue,onModelChange:me,onApiKeyChange:fe,onSave:he,onClear:ft,showClearButton:!xe,buttonLabel:`Change API Key`,freeTierInfo:He})}),(0,S.jsx)(DTe,{mcpServerUrl:e.url,inputValue:A,isConnected:t,isLoading:Oe,textareaRef:z,llmConfig:be,promptsDropdownOpen:M,promptFocusedIndex:P,prompts:Ue,selectedPrompt:V,promptResults:qe,attachments:ke,tools:x?void 0:ie,disabledTools:x?void 0:ne,onDisabledToolsChange:x?void 0:R,onDeletePromptResult:Je,onPromptSelect:it,onInputChange:j,onKeyDown:st,onKeyUp:ct,onClick:nt,onSubmit:e=>{e.preventDefault(),at()},onConfigDialogOpenChange:ce,onAttachmentAdd:Pe,onAttachmentRemove:Fe,hideModelBadge:h&&!ye,hideServerUrl:g,quickQuestions:I,onQuickQuestionSelect:pt,freeTierInfo:He}),ht]}):(0,S.jsxs)(`div`,{className:`flex flex-col h-full relative`,children:[(0,S.jsx)(dTe,{llmConfig:be,hasMessages:De.length>0,configDialogOpen:se,onConfigDialogOpenChange:ce,onClearChat:je,tempProvider:le,tempModel:pe,tempApiKey:de,onProviderChange:ue,onModelChange:me,onApiKeyChange:fe,onSaveConfig:he,onClearConfig:ft,hideConfigButton:xe&&!He,freeTierInfo:He,onCopyChat:ut,onExportChat:dt,clearButtonLabel:p,hideTitle:m,clearButtonHideIcon:_,clearButtonHideShortcut:v,clearButtonVariant:y,hideClearButton:b}),(0,S.jsx)(`div`,{ref:B,className:`flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]`,children:be?(0,S.jsx)(KMe,{messages:De,isLoading:Oe,serverId:e.url,readResource:s,tools:e.tools,sendMessage:(e,t)=>Ae(e,[],t),serverBaseUrl:e.url,pendingElicitationRequests:e.pendingElicitationRequests,onApproveElicitation:e.approveElicitation,onRejectElicitation:e.rejectElicitation}):(0,S.jsx)(OTe,{onConfigureClick:()=>ce(!0)})}),ht,be&&(0,S.jsx)(TTe,{inputValue:A,isConnected:t&&!Ie,isLoading:Oe,textareaRef:z,promptsDropdownOpen:M,promptFocusedIndex:P,prompts:Ue,promptResults:qe,selectedPrompt:V,attachments:ke,tools:x?void 0:ie,disabledTools:x?void 0:ne,onDisabledToolsChange:x?void 0:R,onDeletePromptResult:Je,onPromptSelect:it,onInputChange:j,onKeyDown:st,onKeyUp:ct,onClick:nt,onSendMessage:at,onStopStreaming:Ne,onAttachmentAdd:Pe,onAttachmentRemove:Fe,followups:ee,onFollowupSelect:mt})]})}var cNe=r({Group:()=>E9,Panel:()=>k9,Separator:()=>A9,isCoarsePointer:()=>yNe,useDefaultLayout:()=>uPe,useGroupCallbackRef:()=>fPe,useGroupRef:()=>pPe,usePanelCallbackRef:()=>gPe,usePanelRef:()=>_Pe});function lNe(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function uNe(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function dNe(e){return e/100*window.innerHeight}function fNe(e){return e/100*window.innerWidth}function pNe(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Z7({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=pNe(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=uNe(t,i);break;case`em`:r=lNe(t,i);break;case`vh`:r=dNe(i);break;case`vw`:r=fNe(i);break}return r}function Q7(e){return parseFloat(e.toFixed(3))}function $7({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function e9(e){let{panels:t}=e,n=$7({group:e});return n===0?t.map(e=>({collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Q7(Z7({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Q7(Z7({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Q7(Z7({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Q7(Z7({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function t9(e,t=`Assertion error`){if(!e)throw Error(t)}function n9(e,t){return Array.from(t).sort(e===`horizontal`?mNe:hNe)}function mNe(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function hNe(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function gNe(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function _Ne(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function vNe({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=_Ne(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return t9(i,`No rect found`),i}var r9;function yNe(){return r9===void 0&&(r9=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),r9}function bNe(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=n9(n,Array.from(t.children).filter(gNe).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.ariaDisabled===null&&(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,vNe({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=yNe()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:$7({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var xNe=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}};function i9(e,t,n=0){return Math.abs(Q7(e)-Q7(t))<=n}var a9={cursorFlags:0,interactionState:{state:`inactive`},mountedGroups:new Map},o9=new xNe;function s9(){return a9}function c9(e){let t=typeof e==`function`?e(a9):e;if(a9===t)return a9;let n=a9;return a9={...a9,...t},t.cursorFlags!==void 0&&o9.emit(`cursorFlagsChange`,a9.cursorFlags),t.interactionState!==void 0&&o9.emit(`interactionStateChange`,a9.interactionState),t.mountedGroups!==void 0&&(a9.mountedGroups.forEach((e,t)=>{e.derivedPanelConstraints.forEach(r=>{if(r.collapsible){let{layout:i}=n.mountedGroups.get(t)??{};if(i){let n=i9(r.collapsedSize,e.layout[r.panelId]),a=i9(r.collapsedSize,i[r.panelId]);n&&!a&&(t.inMemoryLastExpandedPanelSizes[r.panelId]=i[r.panelId])}}})}),o9.emit(`mountedGroupsChange`,a9.mountedGroups)),a9}function SNe(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=_Ne(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function CNe(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function wNe(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ANe(e),b:ANe(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();t9(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:kNe(ONe(n.a)),b:kNe(ONe(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var TNe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ENe(e){let t=getComputedStyle(jNe(e)??e).display;return t===`flex`||t===`inline-flex`}function DNe(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||ENe(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||TNe.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function ONe(e){let t=e.length;for(;t--;){let n=e[t];if(t9(n,`Missing node`),DNe(n))return n}return null}function kNe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ANe(e){let t=[];for(;e;)t.push(e),e=jNe(e);return t}function jNe(e){let{parentNode:t}=e;return CNe(t)?t.host:t}function MNe(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function NNe({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!gNe(n)||n.contains(e)||e.contains(n))return!0;if(wNe(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(MNe(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function l9(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=bNe(r),a=SNe(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&NNe({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function PNe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function u9(e,t){return i9(e,t)?0:e>t?1:-1}function d9({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(u9(r,c)<0)if(a){let e=(i+c)/2;r=u9(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Q7(r),r}function f9({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(i9(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;t9(u!=null,`Invalid first pivot index`),t9(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];t9(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(t9(n!=null,`Previous layout not found for panel index ${t}`),i9(n,i)){let t=o-n;u9(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];t9(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(t9(n!=null,`Previous layout not found for panel index ${t}`),i9(n,o)){let t=n-i;u9(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];t9(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&u9(i,c)<0)if(e>0){let t=c-o,n=t/2;u9(i+e,c)<0&&(e=u9(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;u9(i-e,c)<0&&(e=u9(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];t9(e!=null,`Previous layout not found for panel index ${r}`);let a=d9({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];t9(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=d9({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!i9(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(PNe(c,l))return i;{let t=e<0?d:u,r=s[t];t9(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=d9({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!i9(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];t9(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=d9({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(i9(i,s)||(t-=s-i,l[r]=s),i9(t,0))break;e>0?r--:r++}}}if(!i9(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function p9(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||u9(e[n],t[n])!==0)return!1;return!0}function m9({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!i9(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];t9(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];t9(i!=null,`No layout data found for index ${e}`);let o=r[e];t9(o!=null,`No layout data found for index ${e}`);let s=d9({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!i9(a,0))for(let e=0;e<t.length;e++){let n=r[e];t9(n!=null,`No layout data found for index ${e}`);let i=n+a,o=d9({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,i9(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function FNe({groupId:e,panelId:t}){let n=()=>{let{mountedGroups:t}=s9();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,separatorToPanels:o}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,layout:a,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,layout:c,separatorToPanels:l}=n(),u=s.panels.findIndex(e=>e.id===t),d=u===s.panels.length-1,f=m9({layout:f9({delta:d?r-e:e-r,initialLayout:c,panelConstraints:o,pivotIndices:d?[u-1,u]:[u,u+1],prevLayout:c,trigger:`imperative-api`}),panelConstraints:o});p9(c,f)||c9(e=>({mountedGroups:new Map(e.mountedGroups).set(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,layout:f,separatorToPanels:l})}))};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&i9(t,n)},resize:e=>{if(a()!==e){let t;switch(typeof e){case`number`:{let{group:r}=n();t=Q7(e/$7({group:r})*100);break}case`string`:t=parseFloat(e);break}o(t)}}}}function INe(e){if(e.defaultPrevented)return;let{mountedGroups:t}=s9();l9(e,t).forEach(t=>{if(t.separator){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=FNe({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function h9(e){let{mountedGroups:t}=s9();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function LNe({groupId:e}){let t=()=>{let{mountedGroups:t}=s9();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,layout:a,separatorToPanels:o}=t(),s=m9({layout:e,panelConstraints:r});if(n)return a;if(!p9(a,s)){c9(e=>({mountedGroups:new Map(e.mountedGroups).set(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:s,separatorToPanels:o})}));let e=i.panels.map(({id:e})=>e).join(`,`);i.inMemoryLayouts[e]=s}return s}}}function RNe(e){let{mountedGroups:t}=s9(),n=t.get(e);return t9(n,`Mounted Group ${e.id} not found`),n}function g9(e,t){let n=h9(e),r=RNe(n),i=n.separators.find(t=>t.element===e);t9(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);t9(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=LNe({groupId:n.id}).getLayout(),c=m9({layout:f9({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});p9(s,c)||c9(e=>({mountedGroups:new Map(e.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:c,separatorToPanels:r.separatorToPanels})}))}function zNe(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=h9(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&g9(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&g9(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&g9(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&g9(t,-5);break;case`End`:e.preventDefault(),g9(t,100);break;case`Enter`:{e.preventDefault();let n=h9(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=RNe(n),o=n.separators.find(e=>e.element===t);t9(o,`Matching separator not found`);let s=a.get(o);t9(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(t9(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];g9(t,(l.collapsedSize===e?n.inMemoryLastExpandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=h9(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);t9(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus();break}case`Home`:e.preventDefault(),g9(t,-100);break}}function BNe(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let{mountedGroups:t}=s9(),n=l9(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus()));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),c9({interactionState:{hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}}),n.length&&e.preventDefault()}var VNe=e=>e,_9=()=>{},HNe=1,UNe=2,WNe=4,GNe=8,KNe=3,qNe=12,v9;function JNe(){return v9===void 0&&(v9=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(v9=!0)),v9}function YNe({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&JNe()){let t=(e&HNe)!==0,n=(e&UNe)!==0,r=(e&WNe)!==0,i=(e&GNe)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return JNe()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var XNe=new WeakMap;function y9(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=XNe.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets.push(n));let{cursorFlags:r,interactionState:i}=s9();switch(i.state){case`active`:case`hover`:{let e=YNe({cursorFlags:r,groups:i.hitRegions.map(e=>e.group),state:i.state}),a=`*, *:hover {cursor: ${e} !important; }`;if(t===a)return;t=a,e?n.cssRules.length===0?n.insertRule(a):n.replaceSync(a):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}XNe.set(e,{prevStyle:t,styleSheet:n})}function ZNe({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0,c=new Map(i);n.forEach(e=>{let{group:n,groupSize:o}=e,{disableCursor:l,orientation:u,panels:d}=n,f=0;f=a?u===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:u===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let p=r.get(n),{defaultLayoutDeferred:m,derivedPanelConstraints:h,layout:g,separatorToPanels:_}=i.get(n)??{defaultLayoutDeferred:!1};if(h&&p&&g&&_){let t=f9({delta:f,initialLayout:p,panelConstraints:h,pivotIndices:e.panels.map(e=>d.indexOf(e)),prevLayout:g,trigger:`mouse-or-touch`});if(p9(t,g)){if(f!==0&&!l)switch(u){case`horizontal`:s|=f<0?HNe:UNe;break;case`vertical`:s|=f<0?WNe:GNe;break}}else{c.set(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,layout:t,separatorToPanels:_});let n=e.group.panels.map(({id:e})=>e).join(`,`);e.group.inMemoryLayouts[n]=t}}});let l=0;t.movementX===0?l|=o&KNe:l|=s&KNe,t.movementY===0?l|=o&qNe:l|=s&qNe,c9({cursorFlags:l,mountedGroups:c}),y9(e)}function QNe(e){let{cursorFlags:t,interactionState:n,mountedGroups:r}=s9();switch(n.state){case`active`:ZNe({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:r,prevCursorFlags:t})}}function $Ne(e){if(e.defaultPrevented)return;let{cursorFlags:t,interactionState:n,mountedGroups:r}=s9();switch(n.state){case`active`:if(e.buttons===0){c9(e=>e.interactionState.state===`inactive`?e:{cursorFlags:0,interactionState:{state:`inactive`}}),c9(e=>({mountedGroups:new Map(e.mountedGroups)}));return}ZNe({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:r,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:t});break;default:{let t=l9(e,r);t.length===0?n.state!==`inactive`&&c9({interactionState:{state:`inactive`}}):c9({interactionState:{hitRegions:t,state:`hover`}}),y9(e.currentTarget);break}}}function ePe(e){if(e.relatedTarget instanceof HTMLIFrameElement){let{interactionState:e}=s9();switch(e.state){case`hover`:c9({interactionState:{state:`inactive`}})}}}function tPe(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let{interactionState:t}=s9();switch(t.state){case`active`:c9({cursorFlags:0,interactionState:{state:`inactive`}}),t.hitRegions.length>0&&(y9(e.currentTarget),c9(e=>({mountedGroups:new Map(e.mountedGroups)})),e.preventDefault())}}function nPe(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Q7(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Q7((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function rPe(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=$7({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Q7(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function iPe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function aPe(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var b9=new Map;function oPe(e){let t=!0;t9(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){if($7({group:e})===0)return;c9(t=>{let n=t.mountedGroups.get(e);if(n){let r=e9(e),i=n.defaultLayoutDeferred?nPe(r):n.layout,a=m9({layout:i,panelConstraints:r});return!n.defaultLayoutDeferred&&p9(i,a)&&iPe(n.derivedPanelConstraints,r)?t:{mountedGroups:new Map(t.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,layout:a,separatorToPanels:n.separatorToPanels})}}return t})}}else rPe(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{t9(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=$7({group:e}),s=e9(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.defaultLayout;l&&(aPe(e.panels,l)||(l=void 0));let u=m9({layout:e.inMemoryLayouts[c]??l??nPe(s),panelConstraints:s}),d=bNe(e),f=e.element.ownerDocument;return c9(t=>{let n=new Map;return b9.set(f,(b9.get(f)??0)+1),d.forEach(e=>{e.separator&&n.set(e.separator,e.panels)}),{mountedGroups:new Map(t.mountedGroups).set(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,layout:u,separatorToPanels:n})}}),e.separators.forEach(e=>{t9(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,zNe)}),b9.get(f)===1&&(f.addEventListener(`dblclick`,INe,!0),f.addEventListener(`pointerdown`,BNe,!0),f.addEventListener(`pointerleave`,QNe),f.addEventListener(`pointermove`,$Ne),f.addEventListener(`pointerout`,ePe),f.addEventListener(`pointerup`,tPe,!0)),function(){t=!1,b9.set(f,Math.max(0,(b9.get(f)??0)-1)),c9(t=>{let n=new Map(t.mountedGroups);return n.delete(e),{mountedGroups:n}}),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,zNe)}),b9.get(f)||(f.removeEventListener(`dblclick`,INe,!0),f.removeEventListener(`pointerdown`,BNe,!0),f.removeEventListener(`pointerleave`,QNe),f.removeEventListener(`pointermove`,$Ne),f.removeEventListener(`pointerout`,ePe),f.removeEventListener(`pointerup`,tPe,!0)),a.disconnect()}}function sPe(){let[e,t]=(0,w.useState)({});return[e,(0,w.useCallback)(()=>t({}),[])]}function x9(e){let t=(0,w.useId)();return`${e??t}`}var S9=typeof window<`u`?w.useLayoutEffect:w.useEffect;function C9(e){let t=(0,w.useRef)(e);return S9(()=>{t.current=e},[e]),(0,w.useCallback)((...e)=>t.current?.(...e),[t])}function w9(...e){return C9(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function T9(e){let t=(0,w.useRef)({...e});return S9(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var cPe=(0,w.createContext)(null);function lPe(e,t){let n=(0,w.useRef)({getLayout:()=>({}),setLayout:VNe});(0,w.useImperativeHandle)(t,()=>n.current,[]),S9(()=>{Object.assign(n.current,LNe({groupId:e}))})}function E9({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,w.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=C9(e=>{p9(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=C9(e=>{p9(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=x9(s),v=(0,w.useRef)(null),[y,b]=sPe(),x=(0,w.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),C=w9(v,a);lPe(_,o);let T=C9((e,t)=>{let{interactionState:r,mountedGroups:i}=s9();for(let n of i.keys())if(n.id===e){let e=i.get(n);if(e){let i=!1;switch(r.state){case`active`:i=r.hitRegions.some(e=>e.group===n);break}return{flexGrow:e.layout[t]??1,pointerEvents:i?`none`:void 0}}}return{flexGrow:n?.[t]??1}}),E=T9({defaultLayout:n,disableCursor:r}),D=(0,w.useMemo)(()=>({get disableCursor(){return!!E.disableCursor},getPanelStyles:T,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=n9(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=n9(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},togglePanelDisabled:(e,t)=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let{mountedGroups:r}=s9();for(let e of r.keys())if(e.id===_){let t=r.get(e);t&&(t.derivedPanelConstraints=e9(e))}},toggleSeparatorDisabled:(e,t)=>{let n=x.current.separators.find(t=>t.id===e);n&&(n.disabled=t)}}),[T,_,b,u,E]),O=(0,w.useRef)(null);return S9(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(E.defaultLayout!==void 0&&Object.keys(E.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=E.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={defaultLayout:n,disableCursor:!!E.disableCursor,disabled:!!i,element:e,id:_,inMemoryLastExpandedPanelSizes:x.current.lastExpandedPanelSizes,inMemoryLayouts:x.current.layouts,orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};O.current=r;let a=oPe(r),o=s9().mountedGroups.get(r);if(o){let{defaultLayoutDeferred:e,derivedPanelConstraints:t,layout:n}=o;!e&&t.length>0&&(h(n),g(n))}let s=o9.addListener(`interactionStateChange`,e=>{e.state}),c=o9.addListener(`mountedGroupsChange`,e=>{let t=e.get(r);if(t){let{defaultLayoutDeferred:e,derivedPanelConstraints:n,layout:r}=t;if(e||n.length===0)return;let{interactionState:i}=s9(),a=i.state!==`active`;h(r),a&&g(r)}});return()=>{O.current=null,a(),s(),c()}},[i,_,g,h,u,y,E]),(0,w.useEffect)(()=>{let e=O.current;e&&(e.defaultLayout=n,e.disableCursor=!!r)}),(0,S.jsx)(cPe.Provider,{value:D,children:(0,S.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:C,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}E9.displayName=`Group`;function D9(e,t){return`react-resizable-panels:${[e,...t].join(`:`)}`}function uPe({debounceSaveMs:e=100,panelIds:t,storage:n=localStorage,...r}){let i=t!==void 0,a=`id`in r?r.id:r.groupId,o=D9(a,t??[]),s=(0,w.useSyncExternalStore)(dPe,()=>n.getItem(o),()=>n.getItem(o)),c=(0,w.useMemo)(()=>s?JSON.parse(s):void 0,[s]),l=(0,w.useRef)(null),u=(0,w.useCallback)(()=>{let e=l.current;e&&(l.current=null,clearTimeout(e))},[]);(0,w.useLayoutEffect)(()=>()=>{u()},[u]);let d=(0,w.useCallback)(e=>{u();let t;t=i?D9(a,Object.keys(e)):D9(a,[]);try{n.setItem(t,JSON.stringify(e))}catch(e){console.error(e)}},[u,i,a,n]);return{defaultLayout:c,onLayoutChange:(0,w.useCallback)(t=>{u(),e===0?d(t):l.current=setTimeout(()=>{d(t)},e)},[u,e,d]),onLayoutChanged:d}}function dPe(){return function(){}}function fPe(){return(0,w.useState)(null)}function pPe(){return(0,w.useRef)(null)}function O9(){let e=(0,w.useContext)(cPe);return t9(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function mPe(e,t){let{id:n}=O9(),r=(0,w.useRef)({collapse:_9,expand:_9,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:_9});(0,w.useImperativeHandle)(t,()=>r.current,[]),S9(()=>{Object.assign(r.current,FNe({groupId:n,panelId:e}))})}function k9({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,id:s,maxSize:c=`100%`,minSize:l=`0%`,onResize:u,panelRef:d,style:f,...p}){let m=!!s,h=x9(s),g=T9({disabled:a}),_=(0,w.useRef)(null),v=w9(_,o),{getPanelStyles:y,id:b,orientation:x,registerPanel:C,togglePanelDisabled:T}=O9(),E=u!==null,D=C9((e,t,n)=>{u?.(e,s,n)});S9(()=>{let e=_.current;if(e!==null)return C({element:e,id:h,idIsStable:m,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,disabled:g.disabled,maxSize:c,minSize:l}})},[n,r,i,E,h,m,c,l,D,C,g]),(0,w.useEffect)(()=>{T(h,!!a)},[a,h,T]),mPe(h,d);let O=(0,w.useSyncExternalStore)(e=>(o9.addListener(`mountedGroupsChange`,e),()=>{o9.removeListener(`mountedGroupsChange`,e)}),()=>JSON.stringify(y(b,h)),()=>JSON.stringify(y(b,h)));return(0,S.jsx)(`div`,{...p,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":h,id:h,ref:v,style:{...hPe,display:`flex`,flexBasis:0,flexShrink:1,overflow:`hidden`,...JSON.parse(O)},children:(0,S.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,...f,touchAction:x===`horizontal`?`pan-y`:`pan-x`},children:e})})}k9.displayName=`Panel`;var hPe={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function gPe(){return(0,w.useState)(null)}function _Pe(){return(0,w.useRef)(null)}function vPe({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=m9({layout:f9({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=m9({layout:f9({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function A9({children:e,className:t,disabled:n,elementRef:r,id:i,style:a,...o}){let s=x9(i),c=T9({disabled:n}),[l,u]=(0,w.useState)({}),[d,f]=(0,w.useState)(`inactive`),p=(0,w.useRef)(null),m=w9(p,r),{disableCursor:h,id:g,orientation:_,registerSeparator:v,toggleSeparatorDisabled:y}=O9(),b=_===`horizontal`?`vertical`:`horizontal`;S9(()=>{let e=p.current;if(e!==null){let t={disabled:c.disabled,element:e,id:s},n=v(t),r=o9.addListener(`interactionStateChange`,e=>{f(e.state!==`inactive`&&e.hitRegions.some(e=>e.separator===t)?e.state:`inactive`)}),i=o9.addListener(`mountedGroupsChange`,e=>{e.forEach(({derivedPanelConstraints:e,layout:n,separatorToPanels:r},i)=>{if(i.id===g){let a=r.get(t);if(a){let t=a[0],r=i.panels.indexOf(t);u(vPe({layout:n,panelConstraints:e,panelId:t.id,panelIndex:r}))}}})});return()=>{r(),i(),n()}}},[g,s,v,c]),(0,w.useEffect)(()=>{y(s,!!n)},[n,s,y]);let x;return n&&!h&&(x=`not-allowed`),(0,S.jsx)(`div`,{...o,"aria-controls":l.valueControls,"aria-disabled":n||void 0,"aria-orientation":b,"aria-valuemax":l.valueMax,"aria-valuemin":l.valueMin,"aria-valuenow":l.valueNow,children:e,className:t,"data-separator":n?`disabled`:d,"data-testid":s,id:s,ref:m,role:`separator`,style:{flexBasis:`auto`,cursor:x,...a,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}A9.displayName=`Separator`;var{usePanelRef:j9}=cNe;function M9({className:e,...t}){return(0,S.jsx)(E9,{"data-slot":`resizable-panel-group`,className:H(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function N9({...e}){return(0,S.jsx)(k9,{"data-slot":`resizable-panel`,...e})}function P9({withHandle:e,className:t,...n}){return(0,S.jsx)(A9,{"data-slot":`resizable-handle`,className:H(`relative flex items-center justify-center bg-border`,`focus-visible:ring-ring focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden`,`after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2`,`aria-[orientation=vertical]:h-auto aria-[orientation=vertical]:w-px`,`aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full`,`aria-[orientation=vertical]:after:left-0 aria-[orientation=vertical]:after:h-1 aria-[orientation=vertical]:after:w-full aria-[orientation=vertical]:after:translate-x-0 aria-[orientation=vertical]:after:-translate-y-1/2`,`[&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e&&(0,S.jsx)(`div`,{className:`bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border`,children:(0,S.jsx)(Xf,{className:`size-2.5`})})})}function F9({className:e,...t}){return(0,S.jsx)(`kbd`,{"data-slot":`kbd`,className:H(`bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none`,`[&_svg:not([class*='size-'])]:size-3`,`[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10`,e),...t})}function yPe({isSearchExpanded:e,searchQuery:t,filteredRequestsCount:n,requestsCount:r,onSearchExpand:i,onSearchChange:a,onSearchBlur:o,onCancelAll:s,searchInputRef:c}){return(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:e?(0,S.jsx)(kN,{ref:c,placeholder:`Search requests...`,value:t,onChange:e=>a(e.target.value),onBlur:o,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,"data-testid":`elicitation-tab-header`,children:`Elicitation`}),(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:n}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(xp,{className:`h-4 w-4`})})}),(0,S.jsxs)(Id,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(F9,{children:`F`})]})]})]})}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,disabled:r===0,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Vp,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{side:`bottom`,children:`Cancel all`})]})})]})}function I9({id:e,isSelected:t,isFocused:n,icon:r,title:i,description:a,metadata:o,onClick:s,className:c,"data-testid":l}){return(0,S.jsx)(`button`,{id:e,"data-testid":l,type:`button`,onClick:s,className:H(`w-full text-left cursor-pointer p-2 sm:p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group`,t&&`bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500`,n&&`ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset`,c),children:(0,S.jsxs)(`div`,{className:`flex items-start gap-2 sm:gap-3`,children:[r&&(0,S.jsx)(`div`,{className:`flex-shrink-0 mt-1`,children:(0,S.jsx)(`div`,{className:H(`p-2.5 rounded-full transition-colors`,t?`bg-zinc-500 dark:bg-zinc-100/80 text-zinc-100 dark:text-zinc-900`:`bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 group-hover:bg-gray-200 dark:group-hover:bg-zinc-600`),children:r})}),(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 mb-1`,children:(0,S.jsx)(`h3`,{className:H(`font-medium truncate font-mono text-sm`),children:i})}),a&&(0,S.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 line-clamp-2`,children:a})]}),o&&(0,S.jsx)(`div`,{className:`flex-shrink-0 flex items-center self-center`,children:o})]})})}function bPe({requests:e,selectedRequest:t,onRequestSelect:n,focusedIndex:r,formatRelativeTime:i,listRef:a}){return e.length===0?(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(su,{vertical:!0,noBorder:!0,message:`No elicitation requests`})}):(0,S.jsx)(`div`,{ref:a,className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,a)=>{let o=e.request.mode||`form`,s=o===`form`&&`requestedSchema`in e.request&&e.request.requestedSchema;return(0,S.jsx)(I9,{id:`elicitation-request-${e.id}`,"data-testid":`elicitation-request-item-${a}`,isSelected:t?.id===e.id,isFocused:r===a,title:(0,S.jsxs)(`span`,{className:`flex items-center gap-3`,children:[e.serverName,(0,S.jsx)(kt,{variant:`outline`,className:o===`url`?`bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50`:`bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50`,children:o})]}),description:(()=>{let t=i(e.timestamp),n=[];return s&&n.push(`with schema`),o===`url`&&n.push(`external action`),t+(n.length>0?` | ${n.join(`, `)}`:``)})(),onClick:()=>n(e)},e.id)})})}function xPe({request:t,onApprove:n,onReject:r,onClose:i,previewMode:a,onTogglePreview:o,isCopied:s,onCopy:c,onDownload:l,onFullscreen:u}){let{formData:d,setFieldValue:f,getMissingRequiredFields:p,urlCompleted:h,setUrlCompleted:g,mode:_,isFormMode:v,isUrlMode:y}=WMe(t);return t?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b dark:border-zinc-700`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`h3`,{className:`font-medium text-gray-900 dark:text-gray-100`,children:t.serverName}),(0,S.jsx)(kt,{variant:`outline`,className:y?`bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50`:`bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50`,children:_}),(0,S.jsx)(`span`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:new Date(t.timestamp).toLocaleString()})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:c,className:`h-8 w-8 p-0`,children:s?(0,S.jsx)(wf,{className:`h-4 w-4 text-green-600`}):(0,S.jsx)(Lf,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:`Copy request`})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:l,className:`h-8 w-8 p-0`,children:(0,S.jsx)(zf,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:`Download request`})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:u,className:`h-8 w-8 p-0`,children:(0,S.jsx)(ip,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:`Fullscreen`})]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Vp,{className:`h-4 w-4`})})]})]}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-6`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`Message`}),(0,S.jsx)(`p`,{className:`text-sm text-gray-700 dark:text-gray-300`,children:t.request.message})]}),y&&`url`in t.request&&(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`External Action Required`}),(0,S.jsxs)(`div`,{className:`bg-muted rounded-lg p-4 space-y-3`,children:[(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This request requires you to complete an action at an external URL:`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-background rounded border`,children:[(0,S.jsx)(`code`,{className:`flex-1 text-xs font-mono break-all`,children:t.request.url}),(0,S.jsxs)(U,{size:`sm`,variant:`outline`,onClick:()=>{t&&y&&`url`in t.request&&(window.open(t.request.url,`_blank`),g(!0))},className:`flex items-center gap-2`,children:[(0,S.jsx)(Vf,{className:`h-4 w-4`}),`Open URL`]})]}),(0,S.jsxs)(`div`,{className:`flex items-center space-x-2 pt-2`,children:[(0,S.jsx)(SY,{id:`url-completed`,checked:h,onCheckedChange:e=>g(!!e)}),(0,S.jsx)(MN,{htmlFor:`url-completed`,className:`text-sm font-normal cursor-pointer`,children:`I have completed the required action`})]})]})]}),v&&(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(`h4`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:`Form Data`}),(0,S.jsx)(UMe,{request:t,formData:d,onFieldChange:f,idPrefix:`field`,testIdPrefix:`elicitation-field`,emptyFallback:(0,S.jsx)(`div`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:`No form schema available`})})]}),v&&`requestedSchema`in t.request&&t.request.requestedSchema&&(0,S.jsxs)(`details`,{className:`space-y-2`,children:[(0,S.jsx)(`summary`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100 cursor-pointer`,children:`Schema (for reference)`}),(0,S.jsx)(`div`,{className:`bg-muted rounded-lg p-3 max-h-64 overflow-auto`,children:(0,S.jsx)(HV,{data:t.request.requestedSchema})})]})]}),(0,S.jsxs)(`div`,{className:`flex gap-2 p-4 border-t dark:border-zinc-700`,children:[(0,S.jsx)(U,{onClick:()=>{if(t){if(v){let e=p();if(e.length>0){BM.error(`Missing required fields`,{description:`Please fill in: ${e.join(`, `)}`});return}n(t.id,{action:`accept`,content:d})}else y&&n(t.id,{action:`accept`});i(),J(()=>Promise.resolve().then(()=>e(m(),1)).then(e=>{let t=BM(e.createElement(`div`,{className:`space-y-3`},e.createElement(`div`,null,e.createElement(`strong`,null,`Elicitation Response Sent`),e.createElement(`p`,{className:`text-sm text-muted-foreground mt-1`},`The tool will continue executing.`)),e.createElement(`div`,{className:`flex gap-2`},e.createElement(`button`,{"data-testid":`elicitation-view-tool-result`,className:`px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,onClick:()=>{let e=new globalThis.CustomEvent(`navigate-to-tool-result`,{detail:{toolName:null}});window.dispatchEvent(e),BM.dismiss(t)}},`View Tool Result`))),{duration:5e3})}),void 0)}},className:`flex-1`,"data-testid":`elicitation-accept-button`,children:`Accept`}),(0,S.jsx)(U,{onClick:()=>{t&&(n(t.id,{action:`decline`}),i())},variant:`outline`,className:`flex-1`,"data-testid":`elicitation-decline-button`,children:`Decline`}),(0,S.jsx)(U,{onClick:()=>{t&&(r(t.id,`User cancelled elicitation request`),i())},variant:`outline`,className:`flex-1`,"data-testid":`elicitation-cancel-button`,children:`Cancel`})]})]}):(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Select an elicitation request to view details`})})}function L9(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 SPe({pendingRequests:e=[],onApprove:t,onReject:n,serverId:r,isConnected:i}){let{selectedElicitationRequestId:a,setSelectedElicitationRequestId:o}=qq(),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(-1),[p,m]=(0,w.useState)(!0),[h,g]=(0,w.useState)(!1),[_,v]=(0,w.useState)(!0),[y,b]=(0,w.useState)(!1),x=(0,w.useRef)(null),C=(0,w.useRef)(null),T=(0,w.useRef)(null),E=(0,w.useRef)(!1);(0,w.useEffect)(()=>{if(console.log(`[ElicitationTab] Auto-selection check:`,{selectedElicitationRequestId:a,pendingRequestsCount:e.length,currentSelectedId:s?.id}),a&&e.length>0){let t=e.find(e=>e.id===a);console.log(`[ElicitationTab] Found request for auto-selection:`,!!t,t?.id),t&&(console.log(`[ElicitationTab] Auto-selecting request:`,t.id),o(null),c(t),setTimeout(()=>{let e=document.getElementById(`elicitation-request-${t.id}`);console.log(`[ElicitationTab] Scrolling to element:`,!!e),e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},100))}},[a,e,o]),(0,w.useEffect)(()=>{let t=t=>{let n=t.detail.requestId;console.log(`[ElicitationTab] Custom navigate event received:`,n);let r=e.find(e=>e.id===n);r&&(console.log(`[ElicitationTab] Selecting request from event:`,n),c(r),setTimeout(()=>{let e=document.getElementById(`elicitation-request-${n}`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},200))};return window.addEventListener(`navigate-to-elicitation`,t),()=>window.removeEventListener(`navigate-to-elicitation`,t)},[e]),(0,w.useEffect)(()=>{p&&e.length>0&&x.current&&!E.current&&(x.current.scrollTop=0)},[e.length,p]),(0,w.useEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{e.scrollTop>0&&(E.current=!0,m(!1))};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,w.useEffect)(()=>{e.length===0&&(E.current=!1,m(!0))},[e.length]),(0,w.useEffect)(()=>{h&&T.current&&T.current.focus()},[h]);let D=(0,w.useCallback)(()=>{l.trim()||g(!1)},[l]),O=(0,w.useMemo)(()=>{if(!l.trim())return e;let t=l.toLowerCase();return e.filter(e=>e.serverName.toLowerCase().includes(t)||e.request.message.toLowerCase().includes(t)||JSON.stringify(e.request||{}).toLowerCase().includes(t))},[e,l]);(0,w.useEffect)(()=>{f(-1)},[l]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=O;if(e.key===`ArrowDown`)e.preventDefault(),f(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&d>=0){e.preventDefault();let t=O[d];t&&k(t)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,O]),(0,w.useEffect)(()=>{if(d>=0){let e=`elicitation-request-${O[d]?.id}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[d,O]);let k=(0,w.useCallback)(e=>{c(e)},[]),A=(0,w.useCallback)(()=>{window.confirm(`Are you sure you want to cancel all elicitation requests? This cannot be undone.`)&&(e.forEach(e=>{n(e.id,`User cancelled all requests`)}),c(null))},[e,n]),j=(0,w.useCallback)(async()=>{if(s)try{await bj(JSON.stringify({id:s.id,serverName:s.serverName,timestamp:s.timestamp,request:s.request},null,2)),b(!0),setTimeout(()=>b(!1),2e3)}catch(e){console.error(`[ElicitationTab] Failed to copy request:`,e)}},[s]),M=(0,w.useCallback)(()=>{if(s)try{let e=new globalThis.Blob([JSON.stringify({id:s.id,serverName:s.serverName,timestamp:s.timestamp,request:s.request},null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`elicitation-request-${Date.now()}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`[ElicitationTab] Failed to download request:`,e)}},[s]),N=(0,w.useCallback)(async()=>{if(C.current)try{document.fullscreenElement?await document.exitFullscreen():await C.current.requestFullscreen()}catch(e){console.error(`[ElicitationTab] Failed to toggle fullscreen:`,e)}},[]);return i?(0,S.jsxs)(M9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(N9,{defaultSize:40,minSize:30,children:(0,S.jsx)(M9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:(0,S.jsxs)(N9,{defaultSize:75,minSize:30,children:[(0,S.jsx)(yPe,{isSearchExpanded:h,searchQuery:l,filteredRequestsCount:O.length,requestsCount:e.length,onSearchExpand:()=>g(!0),onSearchChange:u,onSearchBlur:D,onCancelAll:A,searchInputRef:T}),(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(bPe,{requests:O,selectedRequest:s,onRequestSelect:k,focusedIndex:d,formatRelativeTime:L9,listRef:x})})]})})}),(0,S.jsx)(P9,{}),(0,S.jsx)(N9,{defaultSize:60,minSize:40,children:(0,S.jsx)(`div`,{ref:C,className:`h-full bg-white dark:bg-zinc-900`,children:(0,S.jsx)(xPe,{request:s,onApprove:t,onReject:n,onClose:()=>c(null),previewMode:_,onTogglePreview:()=>v(!_),isCopied:y,onCopy:j,onDownload:M,onFullscreen:N})})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Ap,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Not connected to server`})]})}function CPe({isSearchExpanded:e,searchQuery:t,filteredNotificationsCount:n,notificationsCount:r,onSearchExpand:i,onSearchChange:a,onSearchBlur:o,onClearAll:s,searchInputRef:c}){return(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:e?(0,S.jsx)(kN,{ref:c,placeholder:`Search notifications...`,value:t,onChange:e=>a(e.target.value),onBlur:o,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,children:`Notifications`}),(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:n}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,className:`h-8 w-8 p-0`,children:(0,S.jsx)(xp,{className:`h-4 w-4`})})}),(0,S.jsxs)(Id,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(F9,{children:`F`})]})]})]})}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,disabled:r===0,className:`h-8 w-8 p-0`,children:(0,S.jsx)(Rp,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{side:`bottom`,children:`Clear all`})]})})]})}function wPe({notifications:e,selectedNotification:t,onNotificationSelect:n,focusedIndex:r,formatRelativeTime:i,listRef:a}){return e.length===0?(0,S.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:(0,S.jsx)(su,{vertical:!0,noBorder:!0,message:`No notifications yet`})}):(0,S.jsx)(`div`,{ref:a,className:`overflow-y-auto flex-1 overscroll-contain`,children:e.map((e,a)=>(0,S.jsx)(I9,{id:`notification-${e.id}`,isSelected:t?.id===e.id,isFocused:r===a,title:(0,S.jsxs)(`span`,{className:`flex items-center gap-3`,children:[e.method,!e.read&&(0,S.jsx)(`span`,{className:`size-1.5 block rounded-full bg-orange-500`})]}),description:(()=>{let t=i(e.timestamp),n=e.params&&Object.keys(e.params).length>0?Object.keys(e.params).length:0;return t+(n>0?` | ${n} param${n>1?`s`:``}`:``)})(),onClick:()=>n(e)},e.id))})}function TPe({notification:e,previewMode:t,onTogglePreview:n,onCopy:r,onDownload:i,onFullscreen:a,isCopied:o=!1,onClose:s}){return e?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsxs)(`div`,{className:`flex-shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Nf,{className:`h-3 w-3 text-gray-400`}),(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:new Date(e.timestamp).toLocaleTimeString()})]}),(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e.formatRelativeTime(e.timestamp)})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:n,className:t?``:`text-purple-600 dark:text-purple-400`,children:[t?(0,S.jsx)(Pf,{className:`h-4 w-4 mr-1`}):(0,S.jsx)(Sf,{className:`h-4 w-4 mr-1`}),t?`JSON`:`Formatted`]}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:r,children:o?(0,S.jsx)(wf,{className:`h-4 w-4`}):(0,S.jsx)(Lf,{className:`h-4 w-4`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:i,children:(0,S.jsx)(zf,{className:`h-4 w-4`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:a,children:(0,S.jsx)(ap,{className:`h-4 w-4`})}),s&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,children:(0,S.jsx)(Vp,{className:`h-4 w-4`})})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,S.jsx)(`div`,{className:`px-4 pt-4`,children:(0,S.jsx)(HV,{data:{method:e.method,timestamp:e.timestamp,read:e.read,params:e.params},filename:`notification-${e.method.replace(/[^a-zA-Z0-9]/g,`-`)}-${Date.now()}.json`})})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(yf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Select a notification to view details`})]})}function EPe({notifications:e,unreadCount:t,markNotificationRead:n,markAllNotificationsRead:r,clearNotifications:i,serverId:a,isConnected:o}){let[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(-1),[p,m]=(0,w.useState)(!0),[h,g]=(0,w.useState)(!1),[_,v]=(0,w.useState)(!0),[y,b]=(0,w.useState)(!1),x=(0,w.useRef)(null),C=(0,w.useRef)(null),T=(0,w.useRef)(null),E=(0,w.useRef)(!1);(0,w.useEffect)(()=>{p&&e.length>0&&x.current&&!E.current&&(x.current.scrollTop=0)},[e.length,p]),(0,w.useEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{e.scrollTop>0&&(E.current=!0,m(!1))};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,w.useEffect)(()=>{e.length===0&&(E.current=!1,m(!0))},[e.length]),(0,w.useEffect)(()=>{s&&!s.read&&n(s.id)},[s,n]),(0,w.useEffect)(()=>{h&&T.current&&T.current.focus()},[h]);let D=(0,w.useCallback)(()=>{l.trim()||g(!1)},[l]),O=(0,w.useMemo)(()=>{if(!l.trim())return e;let t=l.toLowerCase();return e.filter(e=>e.method.toLowerCase().includes(t)||JSON.stringify(e.params||{}).toLowerCase().includes(t))},[e,l]);(0,w.useEffect)(()=>{f(-1)},[l]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=O;if(e.key===`ArrowDown`)e.preventDefault(),f(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&d>=0){e.preventDefault();let t=O[d];t&&k(t)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,O]),(0,w.useEffect)(()=>{if(d>=0){let e=`notification-${O[d]?.id}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[d,O]);let k=(0,w.useCallback)(e=>{c(e)},[]),A=(0,w.useCallback)(()=>{window.confirm(`Are you sure you want to clear all notifications? This cannot be undone.`)&&(i(),c(null))},[i]),j=(0,w.useCallback)(async()=>{if(s)try{await bj(JSON.stringify({method:s.method,timestamp:s.timestamp,read:s.read,params:s.params},null,2)),b(!0),setTimeout(()=>b(!1),2e3)}catch(e){console.error(`[NotificationsTab] Failed to copy notification:`,e)}},[s]),M=(0,w.useCallback)(()=>{if(s)try{let e=new globalThis.Blob([JSON.stringify({method:s.method,timestamp:s.timestamp,read:s.read,params:s.params},null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`notification-${Date.now()}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`[NotificationsTab] Failed to download notification:`,e)}},[s]),N=(0,w.useCallback)(async()=>{if(C.current)try{document.fullscreenElement?await document.exitFullscreen():await C.current.requestFullscreen()}catch(e){console.error(`[NotificationsTab] Failed to toggle fullscreen:`,e)}},[]),P=s?{method:s.method,params:s.params,timestamp:s.timestamp,read:s.read,formatRelativeTime:L9}:null;return o?(0,S.jsxs)(M9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(N9,{defaultSize:40,minSize:30,children:(0,S.jsx)(M9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:(0,S.jsxs)(N9,{defaultSize:75,minSize:30,children:[(0,S.jsx)(CPe,{isSearchExpanded:h,searchQuery:l,filteredNotificationsCount:O.length,notificationsCount:e.length,onSearchExpand:()=>g(!0),onSearchChange:u,onSearchBlur:D,onClearAll:A,searchInputRef:T}),(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(wPe,{notifications:O,selectedNotification:s,onNotificationSelect:k,focusedIndex:d,formatRelativeTime:L9,listRef:x})})]})})}),(0,S.jsx)(P9,{}),(0,S.jsx)(N9,{defaultSize:60,minSize:40,children:(0,S.jsx)(`div`,{ref:C,className:`h-full bg-white dark:bg-zinc-900`,children:(0,S.jsx)(TPe,{notification:P,previewMode:_,onTogglePreview:()=>v(!_),onCopy:j,onDownload:M,onFullscreen:N,onClose:()=>c(null),isCopied:y})})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(yf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`Not connected to server`})]})}function DPe({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:r,secondaryTabTitle:i,primaryCount:a,secondaryCount:o,secondaryIcon:s,primaryIcon:c,searchPlaceholder:l=`Search...`,onSearchExpand:u,onSearchChange:d,onSearchBlur:f,onTabSwitch:p,searchInputRef:m,primaryTabName:h,onRefresh:g,isRefreshing:_=!1}){let v=e===h;return(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between p-4 sm:p-4 py-3 gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:t?(0,S.jsx)(kN,{ref:m,placeholder:l,value:n,onChange:e=>d(e.target.value),onBlur:f,className:`h-8 border-gray-300 dark:border-zinc-600`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h2`,{className:`text-lg font-medium text-gray-900 dark:text-gray-100`,children:v?r:i}),v&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(kt,{className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,variant:`outline`,children:a}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:u,className:`h-8 w-8 p-0`,children:(0,S.jsx)(xp,{className:`h-4 w-4`})})}),(0,S.jsxs)(Id,{side:`bottom`,className:`flex gap-2`,children:[`Search`,(0,S.jsx)(F9,{children:`F`})]})]}),g&&(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:g,disabled:_,className:`h-8 w-8 p-0`,children:(0,S.jsx)(_p,{className:`h-4 w-4 ${_?`animate-spin`:``}`})})}),(0,S.jsxs)(Id,{side:`bottom`,className:`flex gap-2`,children:[`Refresh list`,(0,S.jsx)(F9,{children:`R`})]})]})]})]})}),(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:p,className:`gap-2 flex-shrink-0`,children:[v?(0,S.jsx)(s,{}):(0,S.jsx)(c,{}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:v?i:r}),v&&o>0&&(0,S.jsx)(kt,{className:`bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent`,variant:`outline`,children:o})]})]})}function OPe({serverIds:e,onCountChange:t,onClearRef:n,onExportRef:r}={}){let[i,a]=(0,w.useState)([]),c=(0,w.useRef)(null),[l,d]=(0,w.useState)(new Set),[f]=(0,w.useState)(``),p=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},m=async()=>{a([]),d(new Set),t?.(0),e&&e.length>0?e.forEach(e=>u(e)):u()},h=async e=>{try{await bj(JSON.stringify(e,null,2)),BM.success(`Message copied to clipboard`)}catch(e){console.error(`Failed to copy message:`,e),BM.error(`Failed to copy to clipboard`)}},g=async()=>{try{await bj(JSON.stringify(v,null,2)),BM.success(`All messages copied to clipboard (${v.length})`)}catch(e){console.error(`Failed to copy all messages:`,e),BM.error(`Failed to copy to clipboard`)}},_=(0,w.useMemo)(()=>!e||e.length===0?``:[...e].sort().join(`,`),[e]);(0,w.useEffect)(()=>(n&&(n.current=m),()=>{n&&(n.current=null)}),[n,m]),(0,w.useEffect)(()=>(r&&(r.current=g),()=>{r&&(r.current=null)}),[r,g]),(0,w.useEffect)(()=>{t?.(i.length)},[i.length,t]),(0,w.useEffect)(()=>{console.log(`[RPC Logger] Subscribing to RPC logs for servers:`,e);let n=s(),r=(e&&e.length>0?n.filter(t=>e.includes(t.serverId)):n).map(e=>{let t=e.message,n=typeof t?.method==`string`?t.method:t?.result===void 0?t?.error===void 0?`unknown`:`error`:`result`;return{id:`${e.timestamp}-${Math.random().toString(36).slice(2)}`,serverId:e.serverId,direction:e.direction.toUpperCase(),method:n,timestamp:e.timestamp,payload:e.message}}).reverse();a(r),t?.(r.length);let i=o(n=>{if(e&&e.length>0&&!e.includes(n.serverId))return;let r=n.message,i=typeof r?.method==`string`?r.method:r?.result===void 0?r?.error===void 0?`unknown`:`error`:`result`,o={id:`${n.timestamp}-${Math.random().toString(36).slice(2)}`,serverId:n.serverId,direction:n.direction.toUpperCase(),method:i,timestamp:n.timestamp,payload:n.message};console.log(`[RPC Logger] New RPC log:`,{method:i,direction:n.direction,serverId:n.serverId}),a(e=>{let n=[o,...e].slice(0,1e3);return t?.(n.length),n})});return()=>{i(),console.log(`[RPC Logger] Unsubscribed from RPC logs`)}},[_,t]);let v=(0,w.useMemo)(()=>{let t=i;if(e&&e.length>0){let n=new Set(e);t=t.filter(e=>n.has(e.serverId))}if(f.trim()){let e=f.toLowerCase();t=t.filter(t=>t.serverId.toLowerCase().includes(e)||t.method.toLowerCase().includes(e)||t.direction.toLowerCase().includes(e)||JSON.stringify(t.payload).toLowerCase().includes(e))}return t=[...t].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),t},[i,f,e]);return(0,S.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:(0,S.jsx)(`div`,{ref:c,className:`flex-1 min-h-0 overflow-y-auto`,children:v.length===0?(0,S.jsxs)(`div`,{className:`text-center py-8`,children:[(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No messages yet`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1`,children:`JSON-RPC messages will appear here`})]}):v.map(e=>{let t=l.has(e.id);return(0,S.jsxs)(`div`,{className:`group hover:bg-muted/50 transition-all duration-200 overflow-hidden`,"data-testid":`rpc-message-${e.method.replace(/\//g,`-`)}`,children:[(0,S.jsxs)(`div`,{className:`px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-muted/50 transition-colors`,onClick:()=>p(e.id),children:[(0,S.jsx)(`div`,{className:`flex-shrink-0`,children:t?(0,S.jsx)(Tf,{className:`h-3 w-3 text-muted-foreground transition-transform`}):(0,S.jsx)(Df,{className:`h-3 w-3 text-muted-foreground transition-transform`})}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,S.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:new Date(e.timestamp).toLocaleTimeString()}),(0,S.jsx)(`span`,{className:`flex items-center justify-center px-1 py-0.5 rounded ${e.direction===`RECEIVE`?`bg-blue-500/10 text-blue-600 dark:text-blue-400`:`bg-green-500/10 text-green-600 dark:text-green-400`}`,title:e.direction===`RECEIVE`?`Incoming`:`Outgoing`,children:e.direction===`RECEIVE`?(0,S.jsx)(hf,{className:`h-3 w-3`}):(0,S.jsx)(gf,{className:`h-3 w-3`})}),(0,S.jsx)(`span`,{className:`text-xs font-mono text-foreground truncate`,children:e.method})]})]}),t&&(0,S.jsx)(`div`,{className:`border-t bg-muted/20`,children:(0,S.jsxs)(`div`,{className:`p-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Message Payload`}),(0,S.jsxs)(U,{variant:`ghost`,size:`sm`,onClick:t=>{t.stopPropagation(),h(e.payload)},className:`h-6 px-2`,title:`Copy message to clipboard`,children:[(0,S.jsx)(Lf,{className:`h-3 w-3 mr-1`}),(0,S.jsx)(`span`,{className:`text-xs`,children:`Copy`})]})]}),(0,S.jsx)(`div`,{className:`max-h-[40vh] overflow-auto rounded-sm bg-background/60 p-2`,children:(0,S.jsx)(HV,{data:e.payload})})]})})]},e.id)})})})}function R9({serverId:e,className:t}){let[n,r]=(0,w.useState)(0),[i,a]=(0,w.useState)(!0),o=j9(),s=(0,w.useRef)(null),c=(0,w.useRef)(null);return(0,w.useEffect)(()=>{o.current?.collapse()},[]),(0,S.jsxs)(N9,{panelRef:o,defaultSize:46,collapsible:!0,minSize:150,collapsedSize:46,onResize:e=>{i&&e.inPixels>46?a(!1):!i&&e.inPixels<=46&&a(!0)},className:`flex flex-col border-t dark:border-zinc-700 ${t||``}`,children:[(0,S.jsxs)(`div`,{"data-testid":`rpc-panel-toggle`,className:`group flex items-center justify-between p-3 shrink-0 cursor-pointer hover:bg-muted/50 transition-colors`,onClick:e=>{e.preventDefault(),e.stopPropagation(),i?(a(!1),setTimeout(()=>{o.current?.expand()},100)):(o.current?.collapse(),setTimeout(()=>{a(!0)},100))},children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium`,children:`RPC Messages`}),n>0&&(0,S.jsx)(kt,{"data-testid":`rpc-message-count`,variant:`secondary`,className:`bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent`,children:n})]}),n>0&&!i&&(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),c.current?.()},className:`h-6 w-6 p-0`,title:`Copy all messages to clipboard`,children:(0,S.jsx)(Lf,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),s.current?.()},className:`h-6 w-6 p-0`,title:`Clear all messages`,children:(0,S.jsx)(Rp,{className:`h-3.5 w-3.5`})})]})]}),(0,S.jsx)(Tf,{className:`h-4 w-4 text-muted-foreground transition-transform ${i?``:`rotate-180`}`})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-hidden min-h-0 ${i?`hidden`:``}`,children:(0,S.jsx)(OPe,{serverIds:[e],onCountChange:r,onClearRef:s,onExportRef:c})})]})}R9.displayName=`RpcPanel`;function kPe({prompts:e,selectedPrompt:t,onPromptSelect:n,focusedIndex:r}){return e.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(sp,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`No prompts available`})]}):(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain`,children:e.map((e,i)=>(0,S.jsx)(I9,{id:`prompt-${e.name}`,"data-testid":`prompt-item-${e.name}`,isSelected:t?.name===e.name,isFocused:r===i,icon:(0,S.jsx)(sp,{className:`h-4 w-4`}),title:e.name,description:e.description,metadata:e.arguments&&e.arguments.length>0&&(0,S.jsxs)(kt,{variant:`outline`,className:`text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400`,children:[e.arguments.length,` args`]}),onClick:()=>n(e)},e.name))})}function APe({activeTab:e,isSearchExpanded:t,searchQuery:n,filteredPromptsCount:r,savedPromptsCount:i,onSearchExpand:a,onSearchChange:o,onSearchBlur:s,onTabSwitch:c,searchInputRef:l,onRefresh:u,isRefreshing:d}){return(0,S.jsx)(DPe,{activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabName:`prompts`,secondaryTabName:`saved`,primaryTabTitle:`Prompts`,secondaryTabTitle:`History`,primaryCount:r,secondaryCount:i,primaryIcon:sp,secondaryIcon:Nf,searchPlaceholder:`Search prompts...`,onSearchExpand:a,onSearchChange:o,onSearchBlur:s,onTabSwitch:c,searchInputRef:l,onRefresh:u,isRefreshing:d})}function jPe({savedPrompts:e,selectedPrompt:t,onLoadPrompt:n,onDeletePrompt:r,focusedIndex:i}){return e.length===0?(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(Nf,{className:`h-12 w-12 text-gray-400 dark:text-gray-600 mb-3`}),(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:`No history`}),(0,S.jsx)(`p`,{className:`text-sm text-gray-400 dark:text-gray-500 mt-1`,children:`Prompts you execute will appear here`})]}):(0,S.jsx)(`div`,{className:`overflow-y-auto flex-1 border-r dark:border-zinc-700 overscroll-contain`,children:e.map((e,r)=>(0,S.jsx)(I9,{id:`saved-prompt-${e.id}`,isSelected:t?.id===e.id,isFocused:i===r,icon:(0,S.jsx)(Nf,{className:`h-4 w-4`}),title:e.name,description:`${e.promptName} - ${new Date(e.savedAt).toLocaleString()}`,onClick:()=>n(e)},e.id))})}function MPe({selectedPrompt:e,promptArgs:t,onArgChange:n}){let r=e?.arguments||[];if(!(r.length>0))return(0,S.jsx)(`div`,{className:`flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm`,children:`No arguments required`});let i=e=>{let r=e.name,i=t[r],a=typeof i==`string`?i:JSON.stringify(i);return e.type===`boolean`?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(MN,{htmlFor:r,className:`text-sm font-medium`,children:[r,e.required&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,S.jsx)(`input`,{id:r,type:`checkbox`,checked:!!i,onChange:e=>n(r,e.target.checked),className:`rounded`,"aria-label":`Toggle ${r}`}),(0,S.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:e.description})]})]},r):e.type===`number`?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(MN,{htmlFor:r,className:`text-sm font-medium`,children:[r,e.required&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsx)(kN,{id:r,type:`number`,value:Number(i)||0,onChange:e=>n(r,Number(e.target.value)),placeholder:e.description||`Enter ${r}`}),e.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e.description})]},r):e.type===`array`||e.type===`object`?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(MN,{htmlFor:r,className:`text-sm font-medium`,children:[r,e.required&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsx)(uY,{id:r,value:a,onChange:e=>{try{n(r,JSON.parse(e.target.value))}catch{n(r,e.target.value)}},placeholder:e.description||`Enter ${r} as JSON`,className:`font-mono text-sm min-h-[100px]`}),e.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e.description})]},r):(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(MN,{htmlFor:r,className:`text-sm font-medium`,children:[r,e.required&&(0,S.jsx)(`span`,{className:`text-red-500 ml-1`,children:`*`})]}),(0,S.jsx)(kN,{id:r,"data-testid":`prompt-param-${r}`,value:a,onChange:e=>n(r,e.target.value),placeholder:e.description||`Enter ${r}`}),e.description&&(0,S.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:e.description})]},r)};return(0,S.jsx)(`div`,{className:`space-y-4`,children:r.map(e=>i(e))})}function NPe({selectedPrompt:e,promptArgs:t,isExecuting:n,isConnected:r,onArgChange:i,onExecute:a,onSave:o}){return(0,w.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&e&&!n&&r&&(t.preventDefault(),a())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,n,r,a]),e?(0,S.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,S.jsx)(`div`,{className:`flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex flex-row items-center justify-between mb-0 gap-2`,children:[(0,S.jsx)(`h3`,{className:`text-base sm:text-lg font-semibold`,children:e.name}),(0,S.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,S.jsx)(U,{onClick:a,disabled:n||!r,size:`sm`,className:`lg:size-default pr-1! gap-0`,"data-testid":`prompt-execute-button`,children:n?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Uq,{className:`mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Executing...`})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(mp,{className:`h-4 w-4 sm:mr-2`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Execute`}),(0,S.jsx)(`span`,{className:`hidden sm:inline text-[12px] border text-zinc-300 p-1 rounded-full border-zinc-300 dark:text-zinc-600 dark:border-zinc-500 ml-2`,children:`⌘↵`})]})}),(0,S.jsxs)(U,{variant:`outline`,onClick:o,disabled:n,size:`sm`,className:`lg:size-default gap-2`,children:[(0,S.jsx)(bp,{className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Save`})]})]})]}),e.description&&(0,S.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2`,children:e.description})]})}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3`,children:(0,S.jsx)(MPe,{selectedPrompt:e,promptArgs:t,onArgChange:i})})]}):(0,S.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-4 text-center`,children:[(0,S.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400 mb-2`,children:`Select a prompt to get started`}),(0,S.jsx)(`p`,{className:`text-xs text-gray-400 dark:text-gray-500`,children:`Choose a prompt from the list to view its details and execute it`})]})}function PPe(e){switch(e){case`system`:return`default`;case`user`:return`outline`;case`assistant`:return`secondary`;default:return`outline`}}function FPe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function IPe(e){return typeof e==`string`?e:e.text?e.text:e.type===`resource`&&e.resource?.text?e.resource.text:e.type===`image`?`[Image: ${e.mimeType||`unknown type`}]`:JSON.stringify(e,null,2)}function LPe({message:e,index:t}){let[n,r]=(0,w.useState)(!1);return(0,S.jsxs)(`div`,{className:`border border-border rounded-lg overflow-hidden bg-white dark:bg-zinc-900`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-muted/30 border-b border-border`,children:[(0,S.jsx)(kt,{variant:PPe(e.role),children:FPe(e.role)}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:async()=>{await bj(IPe(e.content)),r(!0),setTimeout(()=>r(!1),2e3)},className:`h-6 px-2`,title:`Copy message content`,children:n?(0,S.jsx)(wf,{className:`h-3.5 w-3.5`}):(0,S.jsx)(Lf,{className:`h-3.5 w-3.5`})})]}),(0,S.jsx)(`div`,{className:`px-4 py-3`,"data-testid":`prompt-message-content-${t}`,children:(()=>{let t=e.content;return typeof t==`string`?(0,S.jsx)(sQ,{content:t}):t.type===`text`&&t.text?(0,S.jsx)(sQ,{content:t.text}):t.type===`image`?(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,S.jsxs)(`span`,{className:`font-mono bg-muted px-2 py-1 rounded`,children:[`Image: `,t.mimeType||`unknown type`]}),t.data&&(0,S.jsx)(`img`,{src:`data:${t.mimeType};base64,${t.data}`,alt:`Prompt image`,className:`max-w-full max-h-[300px] object-contain rounded-lg border border-border mt-2`})]}):t.type===`resource`&&t.resource?(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,S.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Resource:`}),(0,S.jsx)(`code`,{className:`bg-muted px-2 py-0.5 rounded text-xs font-mono`,children:t.resource.uri})]}),t.resource.text&&(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(sQ,{content:t.resource.text})})]}):(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-lg text-sm overflow-x-auto`,children:(0,S.jsx)(`code`,{children:JSON.stringify(t,null,2)})})})()})]})}function RPe(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<10?`now`:n<60?`${n}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`}function zPe(e){return`isError`in e&&!e.isError?null:`error`in e&&e.error?String(e.error):`isError`in e&&e.isError?`An error occurred`:null}function BPe({results:e,copiedResult:t,previewMode:n=!0,onCopy:r,onDelete:i,onFullscreen:a,onTogglePreview:o,onMaximize:s,isMaximized:c=!1}){let[l,u]=(0,w.useState)(0),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(!0),h=e[0],g=h?e.filter(e=>e.promptName===h.promptName):[],_=g[l]||g[0],v=e.findIndex(e=>e===_);if((0,w.useEffect)(()=>{g.length>0&&l>=g.length&&u(0)},[g.length,l]),(0,w.useEffect)(()=>{let e=()=>{_&&f(RPe(_.timestamp))};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[_]),e.length===0)return(0,S.jsx)(`div`,{className:`flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700`,children:(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto h-full`,children:(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,S.jsx)(`div`,{className:`text-center`,children:(0,S.jsx)(su,{vertical:!0,noBorder:!0,message:`No Results yet`})})})})});let y=_.error||zPe(_.result),b=`messages`in _.result&&Array.isArray(_.result.messages);return(0,S.jsx)(`div`,{className:`flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700`,children:(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto h-full`,children:(0,S.jsxs)(`div`,{className:`space-y-0 flex-1 h-full flex flex-col`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-medium hidden sm:block`,children:`Response`}),_.duration!==void 0&&(0,S.jsxs)(`div`,{className:`hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(Hp,{className:`h-3 w-3 text-gray-400`}),(0,S.jsxs)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[_.duration,`ms`]})]}),b&&(0,S.jsx)(`div`,{className:`flex items-center gap-4 sm:ml-4`,children:(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{onClick:()=>m(!0),className:`text-xs font-medium ${p?`text-black dark:text-white`:`text-zinc-500 dark:text-zinc-400`}`,children:`Formatted`}),(0,S.jsx)(`span`,{className:`text-xs text-zinc-400`,children:`|`}),(0,S.jsx)(`button`,{onClick:()=>m(!1),className:`text-xs font-medium ${p?`text-zinc-500 dark:text-zinc-400`:`text-black dark:text-white`}`,children:`Raw`})]})}),(0,S.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[g.length>1&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mr-2`,children:[(0,S.jsx)(Qf,{className:`h-3 w-3 text-gray-400`}),(0,S.jsxs)(wP,{value:l.toString(),onValueChange:e=>u(parseInt(e)),children:[(0,S.jsx)(EP,{className:`h-7 w-[120px] text-xs`,children:(0,S.jsx)(TP,{})}),(0,S.jsx)(DP,{children:g.map((e,t)=>(0,S.jsx)(OP,{value:t.toString(),children:t===0?`Latest`:`${t+1} call ago`},t))})]})]}),(0,S.jsx)(`span`,{className:`text-xs text-gray-500 dark:text-gray-400 mr-2`,children:d}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>r(v,_.result),className:`h-7 w-7 p-0`,title:`Copy result`,children:t===v?(0,S.jsx)(wf,{className:`h-4 w-4`}):(0,S.jsx)(Lf,{className:`h-4 w-4`})}),i&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>i(v),className:`h-7 w-7 p-0`,title:`Delete result`,children:(0,S.jsx)(Rp,{className:`h-4 w-4`})}),a&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a(v),className:`h-7 w-7 p-0 sm:hidden`,title:`Fullscreen`,children:(0,S.jsx)(ap,{className:`h-4 w-4`})}),s&&(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:s,className:`h-7 w-7 p-0 hidden sm:flex`,title:c?`Restore`:`Maximize`,children:c?(0,S.jsx)(cp,{className:`h-4 w-4`}):(0,S.jsx)(ap,{className:`h-4 w-4`})})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:y?(0,S.jsxs)(`div`,{className:`bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3`,children:[(0,S.jsx)(`p`,{className:`text-red-800 dark:text-red-300 font-medium`,children:`Error:`}),(0,S.jsx)(`p`,{className:`text-red-700 dark:text-red-400 text-sm`,children:y})]}):p&&b?(0,S.jsx)(`div`,{className:`space-y-3`,children:(`messages`in _.result?_.result.messages:[]).map((e,t)=>(0,S.jsx)(LPe,{message:e,index:t},t))}):(0,S.jsx)(HV,{data:_.result,filename:`prompt-result-${_.promptName}-${Date.now()}.json`})})]})})})}var VPe=`mcp-inspector-saved-prompts`;function HPe({ref:e,prompts:t,callPrompt:n,serverId:r,isConnected:i,refreshPrompts:a}){let[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),{selectedPromptName:u,setSelectedPromptName:d}=qq(),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(`prompts`),[g,_]=(0,w.useState)([]),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(``),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(-1),O=(0,w.useRef)(null),[k,A]=(0,w.useState)(!1),[j,M]=(0,w.useState)(`list`),[N,P]=(0,w.useState)(!1),{filteredPrompts:F,selectedPrompt:I,setSelectedPrompt:L,results:ee,handleDeleteResult:te,promptArgs:ne,setPromptArgs:R,isExecuting:z,handlePromptSelect:B,handleArgChange:re,executeSelectedPrompt:ie,searchQuery:ae,setSearchQuery:oe}=FJ({prompts:t,callPrompt:n,serverId:r}),se=j9(),ce=j9();(0,w.useEffect)(()=>{let e=()=>{A(window.innerWidth<1024)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,w.useEffect)(()=>{M(I?`detail`:`list`)},[I]),(0,w.useEffect)(()=>{k&&ee.length>0&&!z&&M(`response`)},[ee,z,k]),(0,w.useImperativeHandle)(e,()=>({focusSearch:()=>{T(!0),setTimeout(()=>{O.current&&O.current.focus()},0)},blurSearch:()=>{oe(``),T(!1),O.current&&O.current.blur()}})),(0,w.useEffect)(()=>{try{let e=localStorage.getItem(VPe);e&&_(JSON.parse(e))}catch(e){console.error(`[PromptsTab] Failed to load saved prompts:`,e)}},[]);let le=(0,w.useCallback)(e=>{try{localStorage.setItem(VPe,JSON.stringify(e))}catch(e){console.error(`[PromptsTab] Failed to save prompts:`,e)}},[]);(0,w.useEffect)(()=>{C&&O.current&&O.current.focus()},[C]);let ue=(0,w.useCallback)(()=>{ae.trim()||T(!1)},[ae]),de=(0,w.useCallback)(async()=>{if(a){s(!0);try{await a()}finally{s(!1)}}},[a]),fe=(0,w.useCallback)(e=>{let n=t.find(t=>t.name===e.promptName);n&&(L(n),R(e.args),l(e))},[t,L,R]);(0,w.useEffect)(()=>{D(-1)},[ae,m]),(0,w.useEffect)(()=>{let e=e=>{let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.contentEditable===`true`||e.metaKey||e.ctrlKey||e.altKey)return;let n=m===`prompts`?F:g;if(e.key===`ArrowDown`)e.preventDefault(),D(e=>{let t=e+1;return t>=n.length?0:t});else if(e.key===`ArrowUp`)e.preventDefault(),D(e=>{let t=e-1;return t<0?n.length-1:t});else if(e.key===`Enter`&&E>=0)if(e.preventDefault(),m===`prompts`){let e=F[E];e&&B(e)}else{let e=g[E];e&&fe(e)}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[E,F,g,m,B,fe]),(0,w.useEffect)(()=>{if(E>=0){let e=m===`prompts`?`prompt-${F[E]?.name}`:`saved-prompt-${g[E]?.id}`,t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`})}},[E,F,g,m]),(0,w.useEffect)(()=>{if(console.warn(`[PromptsTab] Auto-selection effect triggered:`,{selectedPromptName:u,promptsCount:t.length,currentSelectedPrompt:I?.name}),u&&t.length>0){let e=t.find(e=>e.name===u);if(console.warn(`[PromptsTab] Prompt lookup result:`,{selectedPromptName:u,promptFound:!!e,promptName:e?.name,shouldSelect:e&&I?.name!==e.name}),e&&I?.name!==e.name){console.warn(`[PromptsTab] Selecting prompt:`,e.name),d(null);let t=setTimeout(()=>{B(e);let t=document.getElementById(`prompt-${e.name}`);t&&(console.warn(`[PromptsTab] Scrolling to prompt element`),t.scrollIntoView({behavior:`smooth`,block:`nearest`}))},100);return()=>clearTimeout(t)}}},[u,t,I,B,d]);let pe=(0,w.useCallback)(async(e,t)=>{try{await bj(JSON.stringify(t,null,2)),p(e),setTimeout(()=>p(null),2e3)}catch(e){console.error(`[PromptsTab] Failed to copy result:`,e)}},[]),me=(0,w.useCallback)(e=>{if(k)M(`response`);else{let t=ee[e];if(t){let e=window.open(``,`_blank`,`width=800,height=600`);if(e){let n=t.result;e.document.write(`
808
808
  <html>
809
809
  <head>
810
810
  <title>${t.promptName} Result</title>
@@ -841,4 +841,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
841
841
  <pre>${JSON.stringify(t.result,null,2)}</pre>
842
842
  </body>
843
843
  </html>
844
- `),e.document.close())}},[x]),Fe=(0,w.useCallback)(()=>{l&&(ne(``),ee(!0))},[l]),Ie=(0,w.useCallback)(()=>{if(!l)return;let e={id:`${Date.now()}-${Math.random()}`,name:te.trim()||`${l.name} - ${new Date().toLocaleString()}`,toolName:l.name,args:ke,savedAt:Date.now(),serverId:l._serverId,serverName:l._serverName};ve([...F,e]),of.getInstance().capture(new Kd({toolName:l.name,serverId:i})).catch(()=>{}),ee(!1),ne(``)},[l,te,ke,F,ve,i]),Le=(0,w.useCallback)(e=>{ve(F.filter(t=>t.id!==e)),d?.id===e&&f(null)},[F,ve,d]);return ae?(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative bg-background`,children:[se!==`list`&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{se===`response`?ce(`detail`):(u(null),ce(`list`))},className:`p-0 h-8 w-8`,children:(0,S.jsx)(Ef,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`flex items-center text-sm font-medium`,children:[(0,S.jsx)(`button`,{onClick:()=>{u(null),ce(`list`)},className:`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`,children:`Tools`}),se===`detail`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`button`,{onClick:()=>{ce(`response`)},className:se===`detail`?`text-foreground hover:underline`:se===`response`?`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`:`text-muted-foreground`,children:`Execute`})]}),se===`response`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`span`,{className:`text-foreground`,children:`Response`})]})]})]}),(0,S.jsx)(`div`,{className:`flex-1 relative overflow-hidden`,children:(0,S.jsxs)(QK,{initial:!1,mode:`popLayout`,children:[se===`list`&&(0,S.jsxs)(Vq.div,{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 flex flex-col bg-background z-0`,children:[(0,S.jsx)(xFe,{activeTab:N,isSearchExpanded:R,searchQuery:j,filteredToolsCount:ye.length,savedRequestsCount:F.length,onSearchExpand:()=>z(!0),onSearchChange:M,onSearchBlur:Se,onTabSwitch:()=>P(N===`tools`?`saved`:`tools`),searchInputRef:ie,onRefresh:o?Ce:void 0,isRefreshing:s}),N===`tools`?(0,S.jsx)(bFe,{tools:ye,selectedTool:l,onToolSelect:be,focusedIndex:B}):(0,S.jsx)(rFe,{savedRequests:F,selectedRequest:d,onLoadRequest:xe,onDeleteRequest:Le,focusedIndex:B})]},`list`),se===`detail`&&(0,S.jsx)(Vq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-10`,children:(0,S.jsx)(mFe,{selectedTool:l,toolArgs:h,payloadToSend:ke,isExecuting:T,isConnected:a,onArgChange:we,onExecute:Ae,onSave:Fe,onBulkPaste:Ee,autoFilledFields:pe,setFields:_,sendEmptyFields:y,onToggleEmpty:Te})},`detail`),se===`response`&&(0,S.jsx)(Vq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-20`,children:(0,S.jsx)(yFe,{results:Ne,copiedResult:D,serverId:i,readResource:r,onCopy:je,onDelete:Me,onFullscreen:Pe,onRerunTool:Ae})},`response`)]})}),(0,S.jsx)(iFe,{isOpen:L,requestName:te,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ne,onSave:Ie,onCancel:()=>ee(!1)}),(0,S.jsx)($Fe,{open:de.open,onOpenChange:e=>{e||Oe()},children:(0,S.jsxs)(nIe,{children:[(0,S.jsxs)(rIe,{children:[(0,S.jsx)(aIe,{children:`Auto-fill fields from pasted object?`}),(0,S.jsxs)(oIe,{children:[de.fieldsToUpdate.length>0&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`font-medium mb-2`,children:`The following fields will be updated:`}),(0,S.jsx)(`ul`,{className:`text-sm space-y-1 max-h-[200px] overflow-y-auto`,children:de.fieldsToUpdate.map(({key:e,oldValue:t,newValue:n})=>(0,S.jsxs)(`li`,{className:`font-mono`,children:[(0,S.jsxs)(`span`,{className:`font-semibold`,children:[e,`:`]}),` `,(0,S.jsx)(`span`,{className:`text-red-600 dark:text-red-400 line-through`,children:typeof t==`object`?JSON.stringify(t).substring(0,30)+`...`:String(t).substring(0,30)}),` `,`→`,` `,(0,S.jsx)(`span`,{className:`text-green-600 dark:text-green-400`,children:typeof n==`string`&&n.length>30?n.substring(0,30)+`...`:String(n).substring(0,30)})]},e))})]}),de.newFields.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`font-medium mb-1`,children:`New fields to be filled:`}),(0,S.jsx)(`p`,{className:`text-sm font-mono`,children:de.newFields.join(`, `)})]})]})]}),(0,S.jsxs)(iIe,{children:[(0,S.jsx)(cIe,{onClick:Oe,children:`Cancel`}),(0,S.jsx)(sIe,{onClick:De,children:`Auto-fill`})]})]})})]}):(0,S.jsxs)(M9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(N9,{id:`left-panel`,defaultSize:`33%`,minSize:`20%`,collapsible:!0,className:`flex flex-col h-full relative`,panelRef:he,children:(0,S.jsxs)(M9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:[(0,S.jsx)(N9,{minSize:`30%`,children:(0,S.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,S.jsx)(xFe,{activeTab:N,isSearchExpanded:R,searchQuery:j,filteredToolsCount:ye.length,savedRequestsCount:F.length,onSearchExpand:()=>z(!0),onSearchChange:M,onSearchBlur:Se,onTabSwitch:()=>P(N===`tools`?`saved`:`tools`),searchInputRef:ie,onRefresh:o?Ce:void 0,isRefreshing:s}),N===`tools`?(0,S.jsx)(bFe,{tools:ye,selectedTool:l,onToolSelect:be,focusedIndex:B}):(0,S.jsx)(rFe,{savedRequests:F,selectedRequest:d,onLoadRequest:xe,onDeleteRequest:Le,focusedIndex:B})]})}),(0,S.jsx)(P9,{withHandle:!0}),(0,S.jsx)(R9,{serverId:i})]})}),(0,S.jsx)(P9,{withHandle:!0}),(0,S.jsx)(N9,{defaultSize:`67%`,children:(0,S.jsxs)(M9,{orientation:`vertical`,children:[(0,S.jsx)(N9,{defaultSize:`40%`,collapsible:!0,panelRef:ge,children:(0,S.jsx)(mFe,{selectedTool:l,toolArgs:h,payloadToSend:ke,isExecuting:T,isConnected:a,onArgChange:we,onExecute:Ae,onSave:Fe,onCancel:()=>{k&&k.abort()},onBulkPaste:Ee,autoFilledFields:pe,setFields:_,sendEmptyFields:y,onToggleEmpty:Te})}),(0,S.jsx)(P9,{withHandle:!0}),(0,S.jsx)(N9,{defaultSize:`60%`,children:(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(yFe,{results:Ne,copiedResult:D,serverId:i,readResource:r,onCopy:je,onDelete:Me,onFullscreen:Pe,onMaximize:_e,isMaximized:le,onRerunTool:Ae})})})]})}),(0,S.jsx)(iFe,{isOpen:L,requestName:te,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ne,onSave:Ie,onCancel:()=>ee(!1)}),(0,S.jsx)($Fe,{open:de.open,onOpenChange:e=>{e||Oe()},children:(0,S.jsxs)(nIe,{children:[(0,S.jsxs)(rIe,{children:[(0,S.jsx)(aIe,{children:`Auto-fill fields from pasted object?`}),(0,S.jsxs)(oIe,{children:[de.fieldsToUpdate.length>0&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`font-medium mb-2`,children:`The following fields will be updated:`}),(0,S.jsx)(`ul`,{className:`text-sm space-y-1 max-h-[200px] overflow-y-auto`,children:de.fieldsToUpdate.map(({key:e,oldValue:t,newValue:n})=>(0,S.jsxs)(`li`,{className:`font-mono`,children:[(0,S.jsxs)(`span`,{className:`font-semibold`,children:[e,`:`]}),` `,(0,S.jsx)(`span`,{className:`text-red-600 dark:text-red-400 line-through`,children:typeof t==`object`?JSON.stringify(t).substring(0,30)+`...`:String(t).substring(0,30)}),` `,`→`,` `,(0,S.jsx)(`span`,{className:`text-green-600 dark:text-green-400`,children:typeof n==`string`&&n.length>30?n.substring(0,30)+`...`:String(n).substring(0,30)})]},e))})]}),de.newFields.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`font-medium mb-1`,children:`New fields to be filled:`}),(0,S.jsx)(`p`,{className:`text-sm font-mono`,children:de.newFields.join(`, `)})]})]})]}),(0,S.jsxs)(iIe,{children:[(0,S.jsx)(cIe,{onClick:Oe,children:`Cancel`}),(0,S.jsx)(sIe,{onClick:De,children:`Auto-fill`})]})]})})]})}uIe.displayName=`ToolsTab`;function dIe({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:i,children:a}){let{embeddedConfig:o}=qq();if(!e&&o.forceConnected)return o.chatApiUrl?(0,S.jsx)(sNe,{connection:{id:`force-connected`,url:``,name:``,state:`ready`,tools:[],prompts:[],resources:[]},isConnected:!0,prompts:[],serverId:`force-connected`,callPrompt:async()=>({messages:[]}),readResource:async()=>({contents:[]}),useClientSide:!1,chatApiUrl:o.chatApiUrl,managedLlmConfig:o.managedLlmConfig??{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`},hideTitle:o.chatHideTitle,hideModelBadge:o.chatHideModelBadge??!0,hideServerUrl:o.chatHideServerUrl??!0,clearButtonLabel:o.chatClearButtonLabel,clearButtonHideIcon:o.chatClearButtonHideIcon,clearButtonHideShortcut:o.chatClearButtonHideShortcut,clearButtonVariant:o.chatClearButtonVariant,chatQuickQuestions:o.chatQuickQuestions,chatFollowups:o.chatFollowups,hideClearButton:o.chatHideClearButton,hideToolSelector:o.chatHideToolSelector,enableKeyboardShortcuts:!1},`chat-force-connected`):(0,S.jsx)(S.Fragment,{children:a});if(!e)return(0,S.jsx)(S.Fragment,{children:a});let s=e=>o.visibleTabs?o.visibleTabs.includes(e):!0;return(0,S.jsxs)(S.Fragment,{children:[s(`tools`)&&(0,S.jsx)(`div`,{style:{display:t===`tools`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(uIe,{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`)&&(0,S.jsx)(`div`,{style:{display:t===`prompts`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(HPe,{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`)&&(0,S.jsx)(`div`,{style:{display:t===`resources`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(YPe,{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`)&&(0,S.jsx)(`div`,{style:{display:t===`chat`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(sNe,{connection:e,isConnected:o.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:!o.chatApiUrl,chatApiUrl:o.chatApiUrl,managedLlmConfig:o.managedLlmConfig??(o.chatApiUrl?{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`}:void 0),hideTitle:o.chatHideTitle,hideModelBadge:o.chatHideModelBadge??!!o.chatApiUrl,hideServerUrl:o.chatHideServerUrl??!!o.chatApiUrl,clearButtonLabel:o.chatClearButtonLabel,clearButtonHideIcon:o.chatClearButtonHideIcon,clearButtonHideShortcut:o.chatClearButtonHideShortcut,clearButtonVariant:o.chatClearButtonVariant,chatQuickQuestions:o.chatQuickQuestions,chatFollowups:o.chatFollowups,hideClearButton:o.chatHideClearButton,hideToolSelector:o.chatHideToolSelector,streamProtocol:o.chatStreamProtocol,credentials:o.chatCredentials},`chat-${e.id}`)}),s(`sampling`)&&(0,S.jsx)(`div`,{style:{display:t===`sampling`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(nFe,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url},`sampling-${e.id}`)}),s(`elicitation`)&&(0,S.jsx)(`div`,{style:{display:t===`elicitation`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(SPe,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state===`ready`},`elicitation-${e.id}`)}),s(`notifications`)&&(0,S.jsx)(`div`,{style:{display:t===`notifications`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(EPe,{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}`)}),![`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`].includes(t)&&(0,S.jsx)(S.Fragment,{children:a})]})}function fIe({className:e}){return(0,S.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,S.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,S.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}var pIe=w.createContext(void 0);function G9(){let e=w.use(pIe);if(!e)throw Error(`useTabs must be used within a TabsProvider`);return e}var mIe=w.createContext(void 0);function hIe(){return w.use(mIe)}function K9({ref:e,children:t,defaultValue:n,value:r,onValueChange:i,className:a,collapsed:o,onCollapsedChange:s,...c}){let[l,u]=w.useState(n||``),d=r!==void 0,f=o!==void 0,[p,m]=w.useState(!1),h=w.useCallback(e=>{d||u(e),i?.(e)},[d,i]);return(0,S.jsx)(pIe,{value:{activeValue:d?r:l,handleValueChange:h,collapsed:f?o:p,handleCollapsedChange:w.useCallback(e=>{f||m(e),s?.(e)},[f,s])},children:(0,S.jsx)(`div`,{ref:e,className:H(`flex flex-col gap-2`,a),...c,children:t})})}K9.displayName=`Tabs`;function q9({ref:e,children:t,className:n,variant:r=`default`,collapsible:i=!1,...a}){let{activeValue:o,collapsed:s,handleCollapsedChange:c}=G9(),[l,u]=w.useState({width:0,left:0}),d=w.useRef(null),f=w.useRef(null),p=w.useRef(null),m=w.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=w.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(m,16)},[m]);w.useEffect(()=>{let e=setTimeout(m,10);return()=>clearTimeout(e)},[m,s]),w.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]),w.useEffect(()=>{let e=()=>{h()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[h]);let g=w.useRef(null);return w.useEffect(()=>{g.current&&(g.current.style.width=`${l.width}px`,g.current.style.left=`${l.left}px`)},[l]),(0,S.jsx)(mIe,{value:{variant:r,collapsed:s,handleCollapsedChange:c},children:(0,S.jsx)(`div`,{ref:d,className:H(`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,S.jsxs)(`div`,{role:`tablist`,className:`flex-1 flex items-center relative`,children:[t,(0,S.jsx)(`span`,{ref:g,className:H(`absolute transition-all duration-500 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`)})]})})})}q9.displayName=`TabsList`;var gIe=({children:e,title:t,collapsed:n})=>!t||!n?e:(0,S.jsx)(Nd,{children:(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{children:e}),(0,S.jsx)(Id,{children:t})]})}),J9=w.forwardRef(({children:e,value:t,className:n,disabled:r,icon:i,title:a,showDot:o=!1,alwaysExpanded:s=!1,...c},l)=>{let{activeValue:u,handleValueChange:d,collapsed:f}=G9(),p=hIe()?.variant||`default`,m=u===t,h=!f||m||s;return(0,S.jsx)(gIe,{title:a,collapsed:f&&!h,children:(0,S.jsxs)(`button`,{ref:l,disabled:r,onClick:()=>d(t),"data-tab-value":t,"data-tab-active":m,role:`tab`,"aria-selected":m?`true`:`false`,title:f&&!h&&a?a:void 0,className:H(`relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-500 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,p===`default`&&`py-2.5`,p===`default`&&`rounded-md px-4`,p===`underline`&&`px-6 py-3 border-b-2 border-transparent`,m&&`text-foreground`,!m&&`text-muted-foreground hover:text-foreground`,n),...c,children:[i&&(0,S.jsx)(i,{className:H(`h-4 w-4 transition-all duration-500 ease-in-out`,h&&`mr-2`,!h&&`mr-0!`)}),o&&(0,S.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,S.jsx)(`span`,{className:H(`transition-all duration-500 ease-in-out overflow-hidden`,h?`w-auto opacity-100`:`w-0 opacity-0`),children:e})]})})});J9.displayName=`TabsTrigger`;function _Ie({ref:e,children:t,value:n,className:r,...i}){let{activeValue:a}=G9();return a===n?(0,S.jsx)(`div`,{ref:e,role:`tabpanel`,className:H(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,r),...i,children:t}):null}_Ie.displayName=`TabsContent`;function vIe(e,t=[]){let n=[];function r(t,r){let i=w.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=w.useMemo(()=>o,Object.values(o));return(0,S.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=w.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>w.createContext(e));return function(n){let r=n?.[e]||t;return w.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,yIe(i,...t)]}function yIe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var bIe=i((e=>{var t=m();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),xIe=i(((e,t)=>{t.exports=bIe()}))();function SIe(){return(0,xIe.useSyncExternalStore)(CIe,()=>!0,()=>!1)}function CIe(){return()=>{}}var Y9=`Avatar`,[wIe,TIe]=vIe(Y9),[EIe,DIe]=wIe(Y9),OIe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=w.useState(`idle`);return(0,S.jsx)(EIe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,S.jsx)(AN.span,{...r,ref:t})})});OIe.displayName=Y9;var kIe=`AvatarImage`,AIe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=DIe(kIe,n),s=PIe(r,a),c=$t(e=>{i(e),o.onImageLoadingStatusChange(e)});return Ft(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,S.jsx)(AN.img,{...a,ref:t,src:r}):null});AIe.displayName=kIe;var jIe=`AvatarFallback`,MIe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=DIe(jIe,n),[o,s]=w.useState(r===void 0);return w.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,S.jsx)(AN.span,{...i,ref:t}):null});MIe.displayName=jIe;function NIe(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function PIe(e,{referrerPolicy:t,crossOrigin:n}){let r=SIe(),i=w.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=w.useState(()=>NIe(a,e));return Ft(()=>{s(NIe(a,e))},[a,e]),Ft(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var FIe=OIe,IIe=AIe,LIe=MIe;function RIe({className:e,...t}){return(0,S.jsx)(FIe,{"data-slot":`avatar`,className:H(`relative flex size-8 shrink-0 overflow-hidden rounded-full`,e),...t})}function zIe({className:e,...t}){return(0,S.jsx)(IIe,{"data-slot":`avatar-image`,className:H(`aspect-square size-full`,e),...t})}function BIe({className:e,...t}){return(0,S.jsx)(LIe,{"data-slot":`avatar-fallback`,className:H(`flex size-full items-center justify-center rounded-full bg-zinc-200 dark:bg-zinc-700 text-muted-foreground font-medium`,e),...t})}function VIe(e,t){return e?.[0]?e[0].toUpperCase():t?.[0]?t[0].toUpperCase():`U`}function HIe({chatApiUrl:e,dashboardUrl:t=`https://manufact.com/cloud`,fallback:n=null,onUserResolved:r}){let[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),c=(0,w.useCallback)(()=>{let t=!1,n=`${new URL(e).origin}/api/auth/get-session`;return fetch(n,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{if(!t){let t=e?.user??null;a(t),s(!0),r?.(t)}}).catch(()=>{t||(s(!0),r?.(null))}),()=>{t=!0}},[e]);if((0,w.useEffect)(()=>c(),[c]),(0,w.useEffect)(()=>{let e=()=>{c()};return window.addEventListener(`manufact:session-changed`,e),()=>window.removeEventListener(`manufact:session-changed`,e)},[c]),!o)return null;if(!i)return(0,S.jsx)(S.Fragment,{children:n});let l=VIe(i.name,i.email),u=i.name??i.email??`User`;return(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,className:`relative h-8 w-8 shrink-0 rounded-full p-0 mr-2`,"aria-label":`User menu`,children:(0,S.jsxs)(RIe,{className:`h-8 w-8 border border-zinc-300 dark:border-zinc-600`,children:[(0,S.jsx)(zIe,{src:i.image??``,alt:u}),(0,S.jsx)(BIe,{className:`text-sm`,children:l})]})})}),(0,S.jsxs)(eu,{className:`w-56`,align:`end`,forceMount:!0,children:[(0,S.jsx)(iu,{className:`font-normal`,children:(0,S.jsxs)(`div`,{className:`flex flex-col space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium leading-none truncate`,children:u}),i.email&&i.email!==u&&(0,S.jsx)(`p`,{className:`text-xs leading-none text-muted-foreground truncate`,children:i.email})]})}),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(np,{className:`mr-2 h-4 w-4`}),`Go to dashboard`]})})]})]})}function UIe({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,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),{url:p,name:m,headers:h}=e,g=e=>{try{of.getInstance().capture(new Zd({client:e})).catch(()=>{})}catch{}},_=()=>{g(`cursor`);try{let e=EJ(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=DJ(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=OJ(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{kJ(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)},C=()=>{g(`gemini-cli`),u(`gemini-cli`),c(!0)},T=()=>{g(`codex-cli`),u(`codex-cli`),c(!0)},E=async e=>{try{await bj(e),f(!0),setTimeout(()=>f(!1),2e3)}catch(e){console.error(`Failed to copy:`,e),a?.(e)}},D=()=>{if(l===`claude-code`){let{command:e,envVars:t}=AJ(p,m,h),n=NJ(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(EN,{children:[(0,S.jsx)(DN,{children:`Add to Claude Code`}),(0,S.jsx)(ON,{children:`Execute the following command in your shell to add this server to Claude Code.`})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsx)(`span`,{children:`Ensure the Claude Code executable is available in your path`})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(wf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(Lf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:`After installation, set these environment variables in your shell:`}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:n})})]}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The MCP configuration supports environment variable expansion using `,(0,S.jsx)(`code`,{className:`text-foreground`,children:"${VAR}"}),` `,`syntax.`]})]})]})}if(l===`gemini-cli`){let{command:e,envVars:t}=jJ(p,m,h),n=NJ(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(EN,{children:[(0,S.jsx)(DN,{children:`Add to Gemini CLI`}),(0,S.jsx)(ON,{children:`Execute the following command in your shell to add this server to Gemini CLI.`})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsx)(`span`,{children:`Ensure the Gemini CLI executable is available in your path`})]}),n&&(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsx)(`span`,{children:`Set these environment variables in your shell before running the command:`})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:n?`3.`:`2.`}),(0,S.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:n})})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(wf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(Lf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),(0,S.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}=MJ(p,m,h);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(EN,{children:[(0,S.jsx)(DN,{children:`Add to Codex CLI`}),(0,S.jsxs)(ON,{children:[`Add this configuration to your`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),` `,`file.`]})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Add this configuration to your`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),`:`]})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(wf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(Lf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),t.length>0&&(0,S.jsx)(`div`,{children:(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`(optional) If you would rather use variables from your system's environment, replace the`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`http_headers`}),` key with the `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`env_http_headers`}),` `,`key as shown in the commented section above.`]})}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Codex CLI to load the new configuration.`})]})]})}return null},O=(0,S.jsxs)(U,{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,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(hp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(Tf,{className:`size-3`})]})]});return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:o?typeof o==`function`?o({isOpen:!1,onClick:()=>{}}):o:O}),(0,S.jsxs)(eu,{align:`end`,className:`w-auto min-w-[300px]`,children:[t.map(e=>(0,S.jsxs)(tu,{onClick:async()=>{await e.onClick()},className:`flex items-center gap-2`,children:[e.icon,(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:e.label})]},e.id)),t.length>0&&(0,S.jsx)(au,{}),n.cursor&&(0,S.jsxs)(tu,{onClick:_,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Cursor`})]}),n.claudeCode&&(0,S.jsxs)(tu,{onClick:x,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Code`})]}),n.claudeDesktop&&(0,S.jsxs)(tu,{onClick:b,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Desktop`})]}),n.vsCode&&(0,S.jsxs)(tu,{onClick:v,className:`flex items-center gap-2`,children:[(0,S.jsx)(PJ,{className:`h-4 w-4 text-blue-500`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code`})]}),n.vsCodeInsiders&&(0,S.jsxs)(tu,{onClick:y,className:`flex items-center gap-2`,children:[(0,S.jsx)(PJ,{className:`h-4 w-4 text-teal-400`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code Insiders`})]}),n.geminiCli&&(0,S.jsxs)(tu,{onClick:C,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Gemini CLI`})]}),n.codexCli&&(0,S.jsxs)(tu,{onClick:T,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Codex CLI`})]})]})]}),(0,S.jsx)(CN,{open:s,onOpenChange:c,children:(0,S.jsx)(TN,{className:`max-w-3xl max-h-[80vh] overflow-y-auto`,children:D()})})]})}function X9({className:e,state:t=`collapsed`,href:n=`https://mcp-use.com`}){let[r,i]=(0,w.useState)(!1),a=.2,o=.7,s=a+o+.6,c=a/s,l=(a+o)/s;return(0,S.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:H(`flex items-center transition-opacity -my-3`,t===`expanded`?`space-x-2`:``,e),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[(0,S.jsx)(`div`,{className:`relative`,children:(0,S.jsxs)(Vq.svg,{viewBox:`0 0 303 303`,initial:`rest`,animate:r?`hover`:`rest`,className:H(`text-foreground`,t===`expanded`?`size-[40px]`:`size-[20px]`),children:[(0,S.jsxs)(Vq.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:s,times:[0,c,l,1],ease:`easeInOut`}}},fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`path`,{d:`m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z`}),(0,S.jsx)(`circle`,{cx:`70.3`,cy:`232.3`,r:`50`}),(0,S.jsx)(`circle`,{cx:`232.3`,cy:`70.3`,r:`50`})]}),(0,S.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(WIe,{d:`m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z`,times:{T0:0,T1:c,T2:l,T3:1},total:s}),(0,S.jsx)(GIe,{cx:70.3,cy:232.3,r:50,times:{T0:0,T1:c,T2:l,T3:1},total:s}),(0,S.jsx)(GIe,{cx:232.3,cy:70.3,r:50,times:{T0:0,T1:c,T2:l,T3:1},total:s})]})]})}),t===`expanded`&&(0,S.jsxs)(`div`,{className:`font-ubuntu flex-col items-start -space-y-1 mr-3 hidden xl:flex`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-medium`,children:`mcp-use`}),(0,S.jsx)(`span`,{className:`text-lg text-muted-foreground tracking-wide font-sans font-light`,children:`Inspector`})]})]})}function WIe({d:e,times:t,total:n}){let{T0:r,T1:i,T2:a,T3:o}=t;return(0,S.jsx)(Vq.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 GIe({cx:e,cy:t,r:n,times:r,total:i}){let{T0:a,T1:o,T2:s,T3:c}=r;return(0,S.jsx)(Vq.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`}}}})}function Z9({open:e,onOpenChange:t,serverUrl:n,serverName:r,serverId:i,headers:a,language:o}){let{prismStyle:s}=VP(),[c,l]=(0,w.useState)(!1),u=o===`typescript`?Rwe(n,r,i,a):zwe(n,r,i,a),d=async()=>{await bj(u),l(!0),setTimeout(()=>l(!1),2e3)},f=o===`typescript`?`TypeScript`:`Python`;return(0,S.jsx)(CN,{open:e,onOpenChange:t,children:(0,S.jsxs)(TN,{className:`max-w-[90vw] max-h-[90vh] overflow-hidden flex flex-col`,children:[(0,S.jsxs)(EN,{children:[(0,S.jsxs)(DN,{children:[`Add to `,f,` SDK`]}),(0,S.jsxs)(ON,{children:[`Copy the following code to integrate this server into your`,` `,f,` application using the mcp-use SDK.`]})]}),(0,S.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 min-h-0`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsxs)(`span`,{children:[`Install the mcp-use package:`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:o===`typescript`?`npm install mcp-use`:`pip install mcp-use`})]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsxs)(`span`,{children:[`Copy the following code into your `,f,` project:`]})]})]})]}),(0,S.jsxs)(`div`,{className:`relative w-full overflow-x-auto overflow-y-auto max-h-[60vh]`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:d,children:c?(0,S.jsx)(wf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(Lf,{className:`size-3.5`})})}),(0,S.jsx)(VV,{language:o,style:s,customStyle:{margin:0,padding:`1rem`,paddingRight:`3rem`,borderRadius:`0.5rem`,fontSize:`0.75rem`,background:`var(--muted)`,width:`100%`,maxWidth:`100%`,overflow:`auto`},wrapLines:!0,wrapLongLines:!0,PreTag:`div`,children:u})]})]})]})})}function KIe({ref:e,shimmerColor:t,shimmerSize:n=`0.05em`,shimmerDuration:r=`3s`,borderRadius:i=`100px`,background:a,className:o,children:s,...c}){let{theme:l}=zP();return(0,S.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:H(`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,S.jsx)(`div`,{className:H(`-z-30 blur-[2px]`,`@container-[size] absolute inset-0 overflow-visible`),children:(0,S.jsx)(`div`,{className:`animate-shimmer-slide absolute inset-0 aspect-[1] h-[100cqh] rounded-none mask-none`,children:(0,S.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,S.jsx)(`div`,{className:H(`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,S.jsx)(`div`,{className:H(`absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] bg-black dark:bg-white`)})]})}KIe.displayName=`ShimmerButton`;function qIe({status:e}){let{color:t,ringColor:n,tooltip:r}=(e=>{switch(e){case`ready`:return{color:`bg-emerald-500`,ringColor:`ring-emerald-500`,tooltip:`Connected`};case`failed`:return{color:`bg-red-500`,ringColor:`ring-red-500`,tooltip:`Failed`};default:return{color:`bg-yellow-500`,ringColor:`ring-yellow-500`,tooltip:e}}})(e);return(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute w-2 h-2 rounded-full ${n} animate-ping`}),(0,S.jsx)(`div`,{className:`relative w-2 h-2 rounded-full ${t}`})]})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:r})})]})}function JIe({connections:e,selectedServer:t,onServerSelect:n,onOpenConnectionOptions:r,mobileMode:i=!1}){let a=aM(),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),u=t=>{let r=e.find(e=>e.id===t);if(!r||r.state!==`ready`){BM.error(`Server is not connected and cannot be inspected`);return}n(t)};return i?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`relative`,children:(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsxs)(U,{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,S.jsx)(Wq,{server:t,size:`md`}):(0,S.jsx)(Cp,{className:`h-5 w-5`}),(0,S.jsx)(Tf,{className:`h-4 w-4`})]})}),(0,S.jsxs)(eu,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,S.jsx)(iu,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,S.jsx)(au,{}),e.length===0?(0,S.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,S.jsxs)(tu,{onClick:()=>u(e.id),className:`flex items-center gap-3`,children:[(0,S.jsx)(Wq,{server:e,size:`sm`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-medium`,children:Tj(e)}),(0,S.jsx)(qIe,{status:e.state})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),l(e),s(!0)},children:(0,S.jsx)(ep,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,S.jsx)(wp,{className:`h-3 w-3`})})]})]},e.id)),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{onClick:()=>a(`/`),children:(0,S.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]})]})}),(0,S.jsx)(UV,{open:o,onOpenChange:s,connection:c})]}):(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsxs)(KIe,{className:H(`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`,t&&`pr-20`),children:[t&&(0,S.jsx)(Wq,{server:t,size:`md`,className:`mr-2`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`span`,{className:`truncate lg:max-w-[120px] xl:max-w-none`,children:t?Tj(t):`Select server to inspect`}),t&&(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:t.error&&t.state!==`ready`?(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.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`})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{className:`max-w-xs`,children:t.error})})]}):(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t.state===`ready`?`bg-emerald-600 animate-status-pulse`:t.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]})]})}),t&&(0,S.jsxs)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1`,children:[(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>{l(t),s(!0)},className:`p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black`,"aria-label":`View server info`,children:(0,S.jsx)(ep,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`View server info`})})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>{r(t.id)},className:`p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black`,"aria-label":`Edit connection settings`,children:(0,S.jsx)(wp,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Edit connection settings`})})]})]}),(0,S.jsxs)(eu,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,S.jsx)(iu,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,S.jsx)(au,{}),e.length===0?(0,S.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,S.jsxs)(tu,{onClick:()=>u(e.id),className:`flex items-center gap-3`,children:[(0,S.jsx)(Wq,{server:e,size:`sm`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-medium`,children:Tj(e)}),(0,S.jsx)(qIe,{status:e.state})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),l(e),s(!0)},children:(0,S.jsx)(ep,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,S.jsx)(wp,{className:`h-3 w-3`})})]})]},e.id)),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{onClick:()=>a(`/`),children:(0,S.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]})]}),(0,S.jsx)(UV,{open:o,onOpenChange:s,connection:c})]})})}var YIe=[{id:`chat`,label:`Chat`,icon:op,alwaysExpanded:!0},{id:`separator`},{id:`tools`,label:`Tools`,icon:Bp},{id:`prompts`,label:`Prompts`,icon:sp},{id:`resources`,label:`Resources`,icon:Jf},{id:`sampling`,label:`Sampling`,icon:Zf},{id:`elicitation`,label:`Elicitation`,icon:Ap},{id:`notifications`,label:`Notifications`,icon:yf}];function XIe(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 ZIe(e,t,n){return n&&t>0&&[`sampling`,`elicitation`,`notifications`].includes(e)}function QIe({collapsed:e,onToggle:t}){return(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{onClick:t,className:H(`shrink-0 p-1.5 rounded-md transition-all duration-500 ease-in-out cursor-pointer`,`text-muted-foreground hover:text-foreground`,`hover:bg-zinc-100 dark:hover:bg-zinc-800`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),"aria-label":e?`Expand tabs`:`Collapse tabs`,type:`button`,children:e?(0,S.jsx)(Df,{className:`h-4 w-4 transition-transform duration-500 ease-in-out`}):(0,S.jsx)(Ef,{className:`h-4 w-4 transition-transform duration-500 ease-in-out`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:e?`Expand tabs`:`Collapse tabs`})})]})}function $Ie(e){try{let t=new URL(e).hostname.toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`0.0.0.0`}catch{return!1}}function eLe(e){try{return new URL(e).hostname.endsWith(`.mcp-use.run`)}catch{return!1}}function tLe(e){if(!e)return null;try{let t=new URL(e);if(t.protocol===`https:`)return t.origin}catch{}return null}var Q9={starting:`Starting tunnel…`,stopping:`Stopping tunnel…`,reconnecting:`Reconnecting…`};function nLe({tunnelUrl:e,isTunnelStarting:t,setTunnelUrl:n,setIsTunnelStarting:r,copied:i,setCopied:a,handleCopy:o}){let[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(0),[p,m]=(0,w.useState)(Q9.starting);(0,w.useEffect)(()=>{if(!t){f(20);return}f(20);let e=setInterval(()=>f(e=>e>0?e-1:0),1e3);return()=>clearInterval(e)},[t]),(0,w.useEffect)(()=>{if(!e)return;c(!0);let t=new URLSearchParams(window.location.search);if(t.has(`openTunnelPopover`)){t.delete(`openTunnelPopover`);let e=t.toString();window.history.replaceState({},``,`${window.location.pathname}${e?`?${e}`:``}`)}},[e]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch(`/inspector/api/dev/info`);if(!t.ok||e)return;let r=await t.json();if(e)return;if(u(!!r.fromCli),r.tunnelUrl)n(new URL(r.tunnelUrl).origin);else{let e=tLe(r.mcpUrl??null);e&&n(e)}}catch{e||u(!1)}})(),()=>{e=!0}},[n]);let h=async e=>{let t=window.location.port||`3000`,i=`http://localhost:${t}/inspector/api/dev/info`,a=Date.now()+9e4;for(m(e?`Restarting with tunnel…`:`Restarting…`),await new Promise(e=>setTimeout(e,1500));Date.now()<a;){try{let r=await fetch(i,{cache:`no-store`});if(r.ok){let i=await r.json();if(!!i.tunnelUrl===e){let r=(i.tunnelUrl||i.mcpUrl||`http://localhost:${t}`).replace(/\/+$/,``)+`/mcp`;i.tunnelUrl?n(new URL(i.tunnelUrl).origin):n(null),sessionStorage.setItem(Jq,JSON.stringify({url:r,name:`Local MCP Server`,transportType:`http`,connectionType:`Direct`})),BM.success(e?`Tunnel ready — reconnecting…`:`Tunnel stopped — reconnecting…`),m(Q9.reconnecting);let a=new URL(window.location.href);a.searchParams.delete(`server`),a.searchParams.delete(`tunnelUrl`),a.searchParams.delete(`autoConnect`),e&&a.searchParams.set(`openTunnelPopover`,`1`),window.location.assign(a.toString());return}}}catch{}await new Promise(e=>setTimeout(e,1500))}BM.error(`Timeout waiting for server to restart`),r(!1)},g=async()=>{if(l===!1){BM.error("Start Tunnel requires `mcp-use dev` from your project directory.");return}m(Q9.starting),r(!0);let e=!1;try{let t=await fetch(`/inspector/api/dev/start-tunnel`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));BM.error(e.error||`Failed to start tunnel`),r(!1);return}await h(!0),e=!0}catch{BM.error(`Failed to start tunnel`),r(!1)}try{of.getInstance().capture(new qd({action:`start`,success:e})).catch(()=>{})}catch{}},_=async()=>{m(Q9.stopping),r(!0);let t=!1;try{let e=await fetch(`/inspector/api/dev/stop-tunnel`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));BM.error(t.error||`Failed to stop tunnel`),r(!1);return}a(!1),c(!1),await h(!1),t=!0}catch{BM.error(`Failed to stop tunnel`),r(!1)}try{of.getInstance().capture(new qd({action:`stop`,success:t,tunnelUrl:e})).catch(()=>{})}catch{}};if(t)return(0,S.jsxs)(`button`,{disabled:!0,className:`flex items-center gap-2 h-9 px-3 bg-violet-50 dark:bg-violet-950/40 border border-violet-200 dark:border-violet-800 rounded-full opacity-75 cursor-wait`,children:[(0,S.jsx)(rp,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}),(0,S.jsxs)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:[`Start Tunnel `,(0,S.jsxs)(`span`,{className:`tabular-nums`,children:[d,`s`]})]})]});if(!e){let e=l===!0,t=l===null;return(0,S.jsxs)(`button`,{type:`button`,onClick:g,disabled:!e||t,title:l===!1?"Run `mcp-use dev` from your project to enable tunneling.":t?`Checking dev server…`:void 0,className:H(`flex items-center gap-2 h-9 px-3 border rounded-full transition-colors`,e&&!t?`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:[t?(0,S.jsx)(rp,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}):(0,S.jsx)(kf,{className:`size-4 text-violet-500 dark:text-violet-400`}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:`Start Tunnel`})]})}return(0,S.jsxs)(iY,{open:s,onOpenChange:c,children:[(0,S.jsx)(aY,{asChild:!0,children:(0,S.jsxs)(`button`,{className:`flex items-center gap-2 h-9 px-3 bg-gradient-to-r from-purple-500/10 to-pink-500/10 dark:from-purple-500/20 dark:to-pink-500/20 border border-purple-500/30 dark:border-purple-500/40 rounded-full hover:from-purple-500/20 hover:to-pink-500/20 dark:hover:from-purple-500/30 dark:hover:to-pink-500/30 transition-colors cursor-pointer`,children:[(0,S.jsx)(kf,{className:`size-4 text-purple-600 dark:text-purple-400`}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-purple-700 dark:text-purple-300 hidden lg:inline`,children:`Tunnel`})]})}),(0,S.jsx)(oY,{className:`w-[calc(100vw-2rem)] sm:w-96 overflow-hidden`,align:`end`,children:(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,S.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Tunnel URL`}),(0,S.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,S.jsx)(_f,{className:`size-3`})]})]}),(0,S.jsxs)(`button`,{onClick:o,className:`-mx-4 px-4 py-3 bg-muted hover:bg-accent transition-colors cursor-pointer flex items-center gap-3 w-[calc(100%+2rem)]`,children:[(0,S.jsxs)(`code`,{className:`flex-1 text-[10px] font-mono truncate text-left`,children:[e,`/mcp`]}),i?(0,S.jsx)(wf,{className:`size-3.5 text-green-600 shrink-0`}):(0,S.jsx)(Lf,{className:`size-3.5 shrink-0 text-muted-foreground`})]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Use in ChatGPT`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsxs)(`span`,{children:[`Enable`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`dev mode`}),` `,`from settings`]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsxs)(`span`,{children:[`In`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`App & Connectors`}),` `,`click on`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`create`})]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`3.`}),(0,S.jsx)(`span`,{children:`Use the tunnel URL in the input`})]})]})]}),(0,S.jsxs)(`button`,{onClick:_,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,S.jsx)(Np,{className:`size-3 fill-current`}),`Stop Tunnel`]})]})})]})}function rLe({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:i,onCommandPaletteOpen:a,onOpenConnectionOptions:o,embedded:s=!1}){let{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,embeddedConfig:f}=qq(),{theme:p,setTheme:m}=zP(),h=!!t&&($Ie(t.url)||eLe(t.url)||!!c),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(!1),[C,T]=(0,w.useState)(!0),[E,D]=(0,w.useState)(!1);if(f.singleTab)return null;let O=f.visibleTabs?YIe.filter(e=>e.id===`separator`||f.visibleTabs.includes(e.id)):YIe,k=async()=>{if(c)try{await bj(`${c}/mcp`),_(!0),BM.success(`Tunnel URL copied to clipboard`),setTimeout(()=>_(!1),2e3)}catch{BM.error(`Failed to copy URL`)}};return(0,S.jsxs)(`header`,{className:`w-full mx-auto`,children:[(0,S.jsxs)(`div`,{className:`flex lg:hidden flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[!s&&(0,S.jsx)(`div`,{className:`flex-1 flex justify-start`,children:(0,S.jsx)(JIe,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:o,mobileMode:!0})}),!s&&(0,S.jsx)(`div`,{className:`flex-shrink-0 flex justify-center`,children:(0,S.jsx)(`div`,{className:`scale-150`,children:(0,S.jsx)(X9,{state:`collapsed`})})}),!s&&(0,S.jsxs)(`div`,{className:`flex-1 flex justify-end items-center gap-2`,children:[t&&(()=>{let e=Tj(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(UIe,{serverConfig:{url:c?`${c}/mcp`:t.url,name:e,headers:t.customHeaders,serverId:t.id},onSuccess:e=>BM.success(`Opening in ${e}...`),onError:e=>BM.error(`Failed: ${e.message}`),additionalItems:[{id:`ts-sdk`,label:`TypeScript SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/typescript`,alt:`TypeScript`,className:`h-4 w-4`}),onClick:()=>y(!0)},{id:`py-sdk`,label:`Python SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/python`,alt:`Python`,className:`h-4 w-4`}),onClick:()=>x(!0)}],trigger:(0,S.jsxs)(U,{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 p-2`,"aria-label":`Add to Client`,children:[(0,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(hp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(Tf,{className:`size-3`})]})]})}),(0,S.jsx)(Z9,{open:v,onOpenChange:y,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`typescript`}),(0,S.jsx)(Z9,{open:b,onOpenChange:x,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`python`})]})})(),h&&(0,S.jsx)(nLe,{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,copied:g,setCopied:_,handleCopy:k}),(0,S.jsx)(U,{asChild:!0,size:`sm`,className:`rounded-full bg-blue-600 hover:bg-blue-700 text-white px-3`,children:(0,S.jsx)(`a`,{href:E?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{of.getInstance().capture(new Jd({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},children:(0,S.jsx)(vp,{className:`size-4`})})}),(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors`,"aria-label":`Settings`,children:(0,S.jsx)(wp,{className:`size-4`})})}),(0,S.jsxs)(eu,{align:`end`,className:`w-48`,children:[(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Ql,{children:[p===`light`?(0,S.jsx)(Pp,{className:`size-4 mr-2`}):p===`dark`?(0,S.jsx)(up,{className:`size-4 mr-2`}):(0,S.jsx)(lp,{className:`size-4 mr-2`}),`Theme`]}),(0,S.jsx)($l,{children:(0,S.jsxs)(Zl,{value:p,onValueChange:e=>m(e),children:[(0,S.jsxs)(ru,{value:`light`,children:[(0,S.jsx)(Pp,{className:`size-4 mr-2`}),`Light`]}),(0,S.jsxs)(ru,{value:`dark`,children:[(0,S.jsx)(up,{className:`size-4 mr-2`}),`Dark`]}),(0,S.jsxs)(ru,{value:`system`,children:[(0,S.jsx)(lp,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(fIe,{className:`h-4 w-4 mr-2`}),`GitHub`]})}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use/issues/new?labels=inspector&template=bug_report.md&title=%5BInspector%5D+`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(Cf,{className:`size-4 mr-2`}),`Report a Bug`]})})]})]})]})]}),t&&(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsx)(K9,{value:n,onValueChange:e=>i(e),collapsed:C,onCollapsedChange:T,children:(0,S.jsx)(q9,{className:`w-full justify-center`,children:O.map(e=>{if(e.id===`separator`)return(0,S.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator`);let r=XIe(e.id,t),i=ZIe(e.id,r,C);return(0,S.jsxs)(J9,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:i,alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:H(`[&>svg]:mr-0 flex-1 flex-row gap-2 relative`,C&&`pl-2`),children:[r>0&&!C&&(0,S.jsx)(`span`,{className:H(n===e.id?`dark:bg-black`:`dark:bg-zinc-700`,`bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-[10px] px-1.5 py-0.5 rounded-full font-medium`),children:r}),(0,S.jsx)(`span`,{className:`sr-only`,children:e.label})]},e.id)})})})})]}),(0,S.jsxs)(`div`,{className:`hidden lg:flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center flex-wrap gap-2 md:space-x-6 space-x-2`,children:[!s&&(0,S.jsx)(JIe,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:o}),t&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(K9,{value:n,onValueChange:e=>i(e),collapsed:C,onCollapsedChange:T,children:(0,S.jsx)(q9,{className:`overflow-x-auto`,collapsible:!0,children:O.map(e=>{if(e.id===`separator`)return(0,S.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator`);let r=XIe(e.id,t),i=r>0?`${e.label} (${r})`:e.label,a=ZIe(e.id,r,C);return(0,S.jsx)(J9,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:a,alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:H(`[&>svg]:mr-0 lg:[&>svg]:mr-2 relative`,C&&`pl-4`),title:i,children:(0,S.jsxs)(`div`,{className:`items-center gap-2 hidden lg:flex`,children:[e.label,r>0&&(0,S.jsx)(`span`,{className:H(n===e.id?` dark:bg-black `:`dark:bg-zinc-700`,`bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-xs px-2 py-0.5 rounded-full font-medium`),children:r})]})},e.id)})})}),(0,S.jsx)(QIe,{collapsed:C,onToggle:()=>T(!C)})]})]}),!s&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-4 flex-shrink-0`,children:[t&&(()=>{let e=Tj(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(UIe,{serverConfig:{url:c?`${c}/mcp`:t.url,name:e,headers:t.customHeaders,serverId:t.id},onSuccess:e=>BM.success(`Opening in ${e}...`),onError:e=>BM.error(`Failed: ${e.message}`),additionalItems:[{id:`ts-sdk`,label:`TypeScript SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/typescript`,alt:`TypeScript`,className:`h-4 w-4`}),onClick:()=>y(!0)},{id:`py-sdk`,label:`Python SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/python`,alt:`Python`,className:`h-4 w-4`}),onClick:()=>x(!0)}],trigger:(0,S.jsxs)(U,{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,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(hp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(Tf,{className:`size-3`})]})]})}),(0,S.jsx)(Z9,{open:v,onOpenChange:y,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`typescript`}),(0,S.jsx)(Z9,{open:b,onOpenChange:x,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`python`})]})})(),h&&(0,S.jsx)(nLe,{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,copied:g,setCopied:_,handleCopy:k}),(0,S.jsx)(U,{asChild:!0,className:`rounded-full bg-blue-600 hover:bg-blue-700 text-white px-4`,children:(0,S.jsxs)(`a`,{href:E?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{of.getInstance().capture(new Jd({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},children:[(0,S.jsx)(vp,{className:`size-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Deploy`})]})}),(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors`,"aria-label":`Settings`,children:(0,S.jsx)(wp,{className:`size-4`})})}),(0,S.jsxs)(eu,{align:`end`,className:`w-48`,children:[(0,S.jsxs)(tu,{onClick:a,"data-testid":`command-palette-trigger-button`,children:[(0,S.jsx)(If,{className:`size-4 mr-2`}),`Command Palette`,(0,S.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[`⌘`,`K`]})]}),(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Ql,{children:[p===`light`?(0,S.jsx)(Pp,{className:`size-4 mr-2`}):p===`dark`?(0,S.jsx)(up,{className:`size-4 mr-2`}):(0,S.jsx)(lp,{className:`size-4 mr-2`}),`Theme`]}),(0,S.jsx)($l,{children:(0,S.jsxs)(Zl,{value:p,onValueChange:e=>m(e),children:[(0,S.jsxs)(ru,{value:`light`,children:[(0,S.jsx)(Pp,{className:`size-4 mr-2`}),`Light`]}),(0,S.jsxs)(ru,{value:`dark`,children:[(0,S.jsx)(up,{className:`size-4 mr-2`}),`Dark`]}),(0,S.jsxs)(ru,{value:`system`,children:[(0,S.jsx)(lp,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(fIe,{className:`h-4 w-4 mr-2`}),`GitHub`]})}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use/issues/new?labels=inspector&template=bug_report.md&title=%5BInspector%5D+`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(Cf,{className:`size-4 mr-2`}),`Report a Bug`]})})]})]}),f.chatApiUrl?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(HIe,{chatApiUrl:f.chatApiUrl,onUserResolved:e=>D(!!e),fallback:(0,S.jsx)(`span`,{className:`[@media(min-width:1400px)]:hidden`,children:(0,S.jsx)(X9,{state:`expanded`})})}),(0,S.jsx)(`span`,{className:`hidden [@media(min-width:1400px)]:block`,children:(0,S.jsx)(X9,{state:`expanded`})})]}):(0,S.jsx)(X9,{state:`expanded`})]})]})]})}function iLe({children:e}){let t=aM(),n=nM(),{servers:r,addServer:i,removeServer:a,updateServerMetadata:o,updateServer:s,storageLoaded:c}=yj(),l=(0,w.useCallback)((e,t,n,r)=>{i(e,{url:e,name:t,proxyConfig:n,transportType:r,preventAutoAuth:!0,clientOptions:{capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}}})},[i]),u=(0,w.useCallback)(async(e,t)=>{try{await s(e,t)}catch(t){console.error(`[Layout] Failed to update connection ${e}:`,t)}},[s]),d=(0,w.useCallback)(async(e,t)=>{try{await o(e,t)}catch(t){console.error(`[Layout] Failed to update connection metadata for ${e}:`,t)}},[o]),{selectedServerId:f,setSelectedServerId:p,activeTab:m,setActiveTab:h,navigateToItem:g,setTunnelUrl:_,tunnelUrl:v,isEmbedded:y,embeddedConfig:b,setEmbeddedMode:x}=qq(),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(null),O=fwe();(0,w.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)}x(!0,e),e.defaultTab&&h(e.defaultTab)}},[]),(0,w.useEffect)(()=>{_(new URLSearchParams(n.search).get(`tunnelUrl`))},[n.search,_]),(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tab`);e&&[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`].includes(e)&&h(e)},[n.search,h]);let k=(0,w.useRef)(null),A=(0,w.useRef)(Date.now()),j=(0,w.useRef)(new Set),M=(0,w.useRef)(0);(0,w.useEffect)(()=>{let e=()=>{M.current++};return window.addEventListener(`mcp-tool-executed`,e),()=>window.removeEventListener(`mcp-tool-executed`,e)},[]),(0,w.useEffect)(()=>{let e=()=>{try{let e=Math.round((Date.now()-A.current)/1e3);of.getInstance().capture(new Qd({durationSeconds:e,tabsVisited:j.current.size,toolsExecuted:M.current})).catch(()=>{})}catch{}};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let N=(0,w.useCallback)(e=>{try{of.getInstance().capture(new Xd({tab:e,previousTab:k.current})).catch(()=>{})}catch{}k.current=e,j.current.add(e),h(e);let r=new URLSearchParams(n.search);r.set(`tab`,e),t(`/?${r.toString()}`,{replace:!0})},[h,t,n.search]);(0,w.useEffect)(()=>{let e=e=>{let t=e.detail.requestId;f&&g(f,`sampling`,t)},t=e=>{let t=e.detail.requestId;f&&g(f,`elicitation`,t)},n=e=>{let t=e.detail.toolName;f&&t?g(f,`tools`,t):f&&N(`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)}},[f,N,g]);let P=(0,w.useRef)(null),F=(0,w.useRef)(null),I=(0,w.useRef)(null),{isAutoConnecting:L}=dwe({connections:r,addConnection:l,removeConnection:a,configLoaded:c,embedded:y}),ee=(0,w.useCallback)(e=>{of.getInstance().capture(new Gd({trigger:e})).catch(()=>{}),T(!0)},[]),te=e=>{let i=r.find(t=>t.id===e);if(!i||i.state!==`ready`){BM.error(`Server is not connected and cannot be inspected`);return}p(e);let a=new URLSearchParams(n.search),o=a.get(`tunnelUrl`),s=a.get(`tab`),c=new URLSearchParams;c.set(`server`,e),o&&c.set(`tunnelUrl`,o),s&&c.set(`tab`,s),t(`/?${c.toString()}`)},ne=(0,w.useCallback)(e=>{D(e)},[]),R=(0,w.useCallback)(e=>{if(!E)return;let t=xj(E)||r.find(e=>e.id===E);e.url===E?t&&Cj(t,e)?d(E,{name:e.name||e.url}):u(E,{name:e.name,proxyConfig:e.proxyConfig,transportType:e.transportType}):(a(E),l(e.url,e.name,e.proxyConfig,e.transportType)),D(null),BM.success(`Connection settings updated`)},[E,r,a,l,d,u]),z=(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`),BM.error(`Server is not connected and cannot be inspected`);return}console.warn(`[Layout] Calling navigateToItem:`,{serverId:a,tab:e,itemName:i}),g(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),N(e)},B=r.find(e=>e.id===f),re=B?B.tools.map(e=>({...e,_serverId:B.id})):r.flatMap(e=>e.state===`ready`?e.tools.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]),ie=B?B.prompts.map(e=>({...e,_serverId:B.id})):r.flatMap(e=>e.state===`ready`?e.prompts.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]),ae=B?B.resources.map(e=>({...e,_serverId:B.id})):r.flatMap(e=>e.state===`ready`?e.resources.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]);(0,w.useEffect)(()=>{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!==f&&p(i)},[n.search,f,p,r,t]),(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`server`);if(!e)return;let i=r.find(t=>t.id===e);if(!i){let e=setTimeout(()=>t(`/`),3e3);return()=>clearTimeout(e)}if(i.state===`failed`){let e=setTimeout(()=>t(`/`),2e3);return()=>clearTimeout(e)}},[n.search,t,r]),(0,w.useEffect)(()=>{if(!y)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,i=e.name??`Server`,a=e.transportType??`http`,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={proxyAddress:`${window.location.origin}/inspector/api/proxy`,...Object.keys(o).length>0&&{headers:o}};r.find(e=>e.url===t)||l(t,i,s,a),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)},[y,r,l]);let oe=(0,w.useRef)(!1);if((0,w.useEffect)(()=>{if(!y||oe.current||f)return;let e=r.find(e=>e.state===`ready`);if(e){oe.current=!0,p(e.id);let r=new URLSearchParams(n.search);r.set(`server`,e.id),t(`/?${r.toString()}`,{replace:!0})}},[y,r,f,p,t,n.search]),Xq({onCommandPalette:()=>ee(`keyboard`),onToolsTab:()=>{B&&N(`tools`)},onPromptsTab:()=>{B&&N(`prompts`)},onResourcesTab:()=>{B&&N(`resources`)},onChatTab:()=>{B&&N(`chat`)},onHome:()=>{t(`/`)},onFocusSearch:()=>{m===`tools`&&P.current?P.current.focusSearch():m===`prompts`&&F.current?F.current.focusSearch():m===`resources`&&I.current&&I.current.focusSearch()},onBlurSearch:()=>{m===`tools`&&P.current?P.current.blurSearch():m===`prompts`&&F.current?F.current.blurSearch():m===`resources`&&I.current&&I.current.blurSearch()}}),L)return(0,S.jsx)(`div`,{className:`h-screen bg-white dark:bg-zinc-900 flex items-center justify-center`,children:(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,S.jsx)(Uq,{className:`h-8 w-8 text-zinc-600 dark:text-zinc-400`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Connecting to MCP server...`})]})});let se=y&&b.singleTab,ce=y?{backgroundColor:b.backgroundColor||`#f3f3f3`,padding:se?`0`:b.padding||`0.5rem`}:{};return(0,S.jsx)(Nd,{children:(0,S.jsxs)(`div`,{className:y?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 px-2 py-2 sm:px-4 sm:py-4 gap-2 sm:gap-4`,style:ce,children:[!se&&(0,S.jsx)(rLe,{connections:r,selectedServer:B,activeTab:m,onServerSelect:te,onTabChange:N,onCommandPaletteOpen:()=>ee(`button`),onOpenConnectionOptions:ne,embedded:y}),(0,S.jsx)(`main`,{className:se?`flex-1 w-full bg-white dark:bg-black p-0 overflow-auto`:`flex-1 w-full mx-auto bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 p-0 overflow-auto`,children:(0,S.jsx)(dIe,{selectedServer:B,activeTab:m,toolsSearchRef:P,promptsSearchRef:F,resourcesSearchRef:I,children:e})}),(0,S.jsx)(Wwe,{isOpen:C,onOpenChange:T,tools:re,prompts:ie,resources:ae,savedRequests:O,connections:r,selectedServer:B,tunnelUrl:v,onNavigate:z,onServerSelect:te}),(0,S.jsx)(WV,{connection:E&&r.find(e=>e.id===E)||null,open:E!==null,onOpenChange:e=>{e||D(null)},onConnect:R})]})})}function $9(e){let t=a(()=>{throw Error(`Invalid url to pass to open(): ${e}`)},`abort`),n;try{n=new URL(e)}catch{t()}return n.protocol!==`https:`&&n.protocol!==`http:`&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&=encodeURIComponent(n.username),n.password&&=encodeURIComponent(n.password),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi,`/`),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(aLe).join(`&`),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}a($9,`sanitizeUrl`);function aLe([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:``}`}a(aLe,`sanitizeParam`);async function oLe(e){return typeof e==`string`?e:e instanceof URLSearchParams||e instanceof FormData?Object.fromEntries(e.entries()):e instanceof Blob?await e.text():e}a(oLe,`serializeBody`);var sLe=class{static{a(this,`BrowserOAuthClientProvider`)}serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;logoUri;callbackUrl;preventAutoAuth;useRedirectFlow;oauthProxyUrl;connectionUrl;originalFetch;pendingCodeVerifier=null;_lastOriginalResource=null;_cachedAuthServerUrl=null;_cachedMetadata=null;_refreshPromise=null;onPopupWindow;constructor(e,t={}){this.serverUrl=e,this.storageKeyPrefix=t.storageKeyPrefix||`mcp:auth`,this.serverUrlHash=this.hashString(e),this.clientName=t.clientName||`mcp-use`,this.clientUri=t.clientUri||(typeof window<`u`?window.location.origin:``),this.logoUri=t.logoUri||`https://mcp-use.com/logo.png`,this.callbackUrl=$9(t.callbackUrl||(typeof window<`u`?new URL(`/oauth/callback`,window.location.origin).toString():`/oauth/callback`)),this.preventAutoAuth=t.preventAutoAuth,this.useRedirectFlow=t.useRedirectFlow,this.oauthProxyUrl=t.oauthProxyUrl,this.connectionUrl=t.connectionUrl,this.onPopupWindow=t.onPopupWindow}installFetchInterceptor(){if(!this.oauthProxyUrl){console.warn(`[BrowserOAuthProvider] No OAuth proxy URL configured, skipping fetch interceptor installation`);return}if(!this.originalFetch)this.originalFetch=window.fetch;else{console.warn(`[BrowserOAuthProvider] Fetch interceptor already installed`);return}let e=this.oauthProxyUrl,t=this.connectionUrl,n=this.serverUrl,r=this.originalFetch;console.log(`[BrowserOAuthProvider] Installing fetch interceptor with proxy: ${e}`),window.fetch=async(i,a)=>{let o=typeof i==`string`?i:i instanceof URL?i.toString():i.url;if(!(o.includes(`/.well-known/`)||o.match(/\/(register|token|authorize)$/)))return await r(i,a);try{let t=new URL(o),n=new URL(e);if(t.origin===n.origin&&(t.pathname.startsWith(n.pathname)||o.includes(`/inspector/api/oauth`)))return await r(i,a)}catch{}try{let i=o.includes(`/.well-known/`),s=i?`${e}/metadata?url=${encodeURIComponent(o)}`:`${e}/proxy`;if(console.log(`[OAuth Proxy] Routing ${i?`metadata`:`request`} through: ${s}`),i){let e={...a?.headers?Object.fromEntries(new Headers(a.headers)):{}};t&&(e[`X-Connection-URL`]=t);let i=new URL(s);n&&i.searchParams.set(`mcp_url`,n);let o=await r(i.toString(),{...a,method:`GET`,headers:e});try{if((o.headers.get(`content-type`)||``).includes(`application/json`)){let e=await o.clone().json(),t=e&&typeof e==`object`&&typeof e._original_resource==`string`?e._original_resource:null;t&&(this._lastOriginalResource=t)}}catch{}return o}let c=a?.body?await oLe(a.body):void 0,l=await(await r(s,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:o,method:a?.method||`POST`,headers:a?.headers?Object.fromEntries(new Headers(a.headers)):{},body:c})})).json();return new Response(JSON.stringify(l.body),{status:l.status,statusText:l.statusText,headers:new Headers(l.headers)})}catch(e){return console.error(`[OAuth Proxy] Request failed, falling back to direct fetch:`,e),await r(i,a)}}}restoreFetch(){this.originalFetch&&=(console.log(`[BrowserOAuthProvider] Restoring original fetch`),window.fetch=this.originalFetch,void 0)}get redirectUrl(){return $9(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:this.clientName,client_uri:this.clientUri,logo_uri:this.logoUri}}async clientInformation(){let e=this.getKey(`client_info`),t=localStorage.getItem(e);if(t)try{let n=JSON.parse(t),r=Array.isArray(n.redirect_uris)?n.redirect_uris:[];if(!(r.length===0||r.includes(this.redirectUrl))){console.info(`[${this.storageKeyPrefix}] Invalidating cached OAuth client info due to redirect URI mismatch.`),localStorage.removeItem(e),localStorage.removeItem(this.getKey(`tokens`)),localStorage.removeItem(this.getKey(`last_auth_url`));return}return n}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,t),localStorage.removeItem(e);return}}async saveClientInformation(e){let t=this.getKey(`client_info`);localStorage.setItem(t,JSON.stringify(e))}async tokens(){let e=this.getKey(`tokens`),t=localStorage.getItem(e);if(t)try{let e=JSON.parse(t);if(e.access_token&&e.refresh_token)try{let t=JSON.parse(atob(e.access_token.split(`.`)[1]));if(t.exp&&Date.now()>=(t.exp-30)*1e3){console.log(`[tokens] Access token expiring soon, refreshing...`);let t=await this._dedupedRefresh(e);if(t)return console.log(`[tokens] Refreshed successfully`),t}}catch{}return e}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,t),localStorage.removeItem(e);return}}async saveTokens(e){let t=this.getKey(`tokens`);localStorage.setItem(t,JSON.stringify(e)),localStorage.removeItem(this.getKey(`code_verifier`)),localStorage.removeItem(this.getKey(`last_auth_url`)),this.pendingCodeVerifier=null}async _refresh(e){try{if(!this._cachedAuthServerUrl||!this._cachedMetadata){let e=(await Mk(this.serverUrl)).authorization_servers?.[0];if(!e)return null;let t=await Fk(e);if(!t)return null;this._cachedAuthServerUrl=e,this._cachedMetadata=t}let t=await this.clientInformation();if(!t)return null;let n=await Lk(this._cachedAuthServerUrl,{metadata:this._cachedMetadata,clientInformation:t,refreshToken:e.refresh_token});return await this.saveTokens(n),n}catch{return null}}async _dedupedRefresh(e){if(this._refreshPromise)return this._refreshPromise;this._refreshPromise=this._refresh(e);try{return await this._refreshPromise}finally{this._refreshPromise=null}}async invalidateCredentials(e){switch(e){case`all`:localStorage.removeItem(this.getKey(`tokens`)),localStorage.removeItem(this.getKey(`client_info`)),localStorage.removeItem(this.getKey(`code_verifier`)),localStorage.removeItem(this.getKey(`last_auth_url`)),this.pendingCodeVerifier=null;break;case`client`:localStorage.removeItem(this.getKey(`client_info`));break;case`tokens`:localStorage.removeItem(this.getKey(`tokens`));break;case`verifier`:localStorage.removeItem(this.getKey(`code_verifier`)),this.pendingCodeVerifier=null;break;default:break}}async saveCodeVerifier(e){let t=this.getKey(`code_verifier`);localStorage.setItem(t,e),this.pendingCodeVerifier=e}async codeVerifier(){let e=this.getKey(`code_verifier`),t=localStorage.getItem(e);if(!t)throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async prepareAuthorizationUrl(e){let t=e.searchParams.get(`resource`),n=!!(t&&(t.includes(`/inspector/api/proxy`)||t.includes(`/api/proxy`)||t.includes(`localhost:3000`))),r=!!(t&&this.connectionUrl&&t===this.connectionUrl),i=!!(t&&(this._lastOriginalResource||this.serverUrl)&&(r||n)),a=this._lastOriginalResource||this.serverUrl;i&&a&&e.searchParams.set(`resource`,a);let o=globalThis.crypto.randomUUID(),s=`${this.storageKeyPrefix}:state_${o}`,c=this.pendingCodeVerifier||localStorage.getItem(this.getKey(`code_verifier`)),l={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,codeVerifier:c||void 0,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl,oauthProxyUrl:this.oauthProxyUrl,connectionUrl:this.connectionUrl},flowType:this.useRedirectFlow?`redirect`:`popup`,returnUrl:typeof window<`u`?window.location.href:void 0};console.log(`[OAuth] Storing state key: ${s}`),localStorage.setItem(s,JSON.stringify(l));let u=localStorage.getItem(s);console.log(`[OAuth] State stored successfully: ${!!u}`),e.searchParams.set(`state`,o);let d=$9(e.toString());return localStorage.setItem(this.getKey(`last_auth_url`),d),d}async redirectToAuthorization(e){let t=await this.prepareAuthorizationUrl(e);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=t;return}let n=`width=600,height=700,resizable=yes,scrollbars=yes,status=yes`;try{let e=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,e),!e||e.closed||e.closed===void 0?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(e.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(e){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,e)}}getLastAttemptedAuthUrl(){let e=localStorage.getItem(this.getKey(`last_auth_url`));return e?$9(e):null}clearStorage(){let e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[],r=0;for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{let e=localStorage.getItem(i);e&&JSON.parse(e).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(e){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,e)}}}return[...new Set(n)].forEach(e=>{localStorage.removeItem(e),r++}),r}hashString(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}};async function cLe(){let e=new URLSearchParams(window.location.search),t=e.get(`code`),n=e.get(`state`),r=e.get(`error`),i=e.get(`error_description`),a=`[mcp-callback]`;console.log(`${a} Handling callback...`,{code:t,state:n,error:r,errorDescription:i});let o=null,s=null,c=null;try{if(r)throw Error(`OAuth error: ${r} - ${i||`No description provided.`}`);if(!t)throw Error(`Authorization code not found in callback query parameters.`);if(!n)throw Error(`State parameter not found or invalid in callback query parameters.`);console.log(`[mcp-callback] Looking for state: ${n}`),console.log(`[mcp-callback] All localStorage keys:`,Object.keys(localStorage));let e=`mcp:auth:state_${n}`;if(localStorage.getItem(e))c=e,console.log(`[mcp-callback] Found state with default key: ${e}`);else{let e=`:state_${n}`;for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n&&n.endsWith(e)){c=n,console.log(`[mcp-callback] Found state with dynamic key: ${n}`);break}}}if(!c){let e=Object.keys(localStorage).filter(e=>e.includes(`state`));throw console.log(`[mcp-callback] State keys in storage:`,e),Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`)}let l=localStorage.getItem(c);if(!l)throw Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{s=JSON.parse(l)}catch{throw Error(`Failed to parse stored OAuth state.`)}if(!s.expiry||s.expiry<Date.now())throw localStorage.removeItem(c),Error(`OAuth state has expired. Please try initiating authentication again.`);if(!s.providerOptions)throw Error(`Stored state is missing required provider options.`);let{serverUrl:u,...d}=s.providerOptions,f=d.connectionUrl,p=!!(f&&/run\.mcp-use\.com|mcp-use\.run/.test(f)),m=p?f:void 0,h=d.oauthProxyUrl,g=m;if(!h&&g)try{let e=new URL(window.location.href);if(e.pathname.includes(`/oauth/callback`)){let t=e.pathname.replace(/\/oauth\/callback.*$/,``);(!t||t===``)&&(/run\.mcp-use\.com|mcp-use\.run/.test(g)?console.log(`${a} Gateway connection detected; skipping default /inspector OAuth proxy inference`):(t=`/inspector`,console.log(`${a} Callback at root /oauth/callback, using /inspector as base path for OAuth proxy`))),t&&(h=`${e.origin}${t}/api/oauth`),console.log(`${a} Inferred OAuth proxy URL from callback: ${h}`)}}catch(e){console.warn(`${a} Could not infer OAuth proxy URL:`,e)}console.log(`${a} Re-instantiating provider for server: ${u}`),o=new sLe(u,{...d,oauthProxyUrl:h,connectionUrl:g});let _=`${d.storageKeyPrefix}_${s.serverUrlHash}_code_verifier`,v=s.codeVerifier||localStorage.getItem(_);if(v)localStorage.setItem(_,v),localStorage.setItem(o.getKey(`code_verifier`),v);else throw Error(`[${d.storageKeyPrefix}] Code verifier missing for OAuth state ${n}. Please restart authentication.`);h&&(console.log(`${a} Installing fetch interceptor for token exchange (proxy: ${h})`),o.installFetchInterceptor()),console.log(`${a} Calling SDK auth() to exchange code...`);let y=p&&g?g:u;console.log(`${a} Using SDK serverUrl: ${y} (connectionUrl: ${g||`none`})`);let b=await Ok(o,{serverUrl:y,authorizationCode:t});if(b===`AUTHORIZED`)if(console.log(`${a} Authorization successful via SDK auth().`),s.flowType===`redirect`&&s.returnUrl)console.log(`${a} Redirect flow complete. Returning to: ${s.returnUrl}`),localStorage.removeItem(c),window.location.href=s.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${a} Popup flow complete. Notifying opener...`),window.opener.postMessage({type:`mcp_auth_callback`,success:!0},window.location.origin),localStorage.removeItem(c),window.close();else if(s.returnUrl)console.log(`${a} Popup flow without opener. Returning to: ${s.returnUrl}`),localStorage.removeItem(c),window.location.href=s.returnUrl;else{console.warn(`${a} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(c);let e=window.location.pathname.split(`/`).filter(Boolean),t=e.length>0&&e[e.length-1]===`callback`?`/`+e.slice(0,-2).join(`/`):`/`;window.location.href=t||`/`}else throw console.warn(`${a} SDK auth() returned unexpected status: ${b}`),Error(`Unexpected result from authentication library: ${b}`)}catch(e){console.error(`${a} Error during OAuth callback handling:`,e);let t=e instanceof Error?e.message:String(e);window.opener&&!window.opener.closed&&window.opener.postMessage({type:`mcp_auth_callback`,success:!1,error:t},window.location.origin);try{document.body.innerHTML=``;let n=document.createElement(`div`);n.style.fontFamily=`sans-serif`,n.style.padding=`20px`;let r=document.createElement(`h1`);r.textContent=`Authentication Error`,n.appendChild(r);let i=document.createElement(`p`);i.style.color=`red`,i.style.backgroundColor=`#ffebeb`,i.style.border=`1px solid red`,i.style.padding=`10px`,i.style.borderRadius=`4px`,i.textContent=t,n.appendChild(i);let a=document.createElement(`p`);a.textContent=`You can close this window or `;let o=document.createElement(`a`);if(o.href=`#`,o.textContent=`click here to close`,o.onclick=e=>(e.preventDefault(),window.close(),!1),a.appendChild(o),a.appendChild(document.createTextNode(`.`)),n.appendChild(a),e instanceof Error&&e.stack){let t=document.createElement(`pre`);t.style.fontSize=`0.8em`,t.style.color=`#555`,t.style.marginTop=`20px`,t.style.whiteSpace=`pre-wrap`,t.textContent=e.stack,n.appendChild(t)}document.body.appendChild(n)}catch(e){console.error(`${a} Could not display error in callback window:`,e)}c&&localStorage.removeItem(c),o&&localStorage.removeItem(o.getKey(`last_auth_url`))}}a(cLe,`onMcpAuthorization`);async function lLe(e,t=fetch){let n=e.replace(/\/$/,``),r=await t(n.endsWith(`/mcp`)?n:`${n}/mcp`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jsonrpc:`2.0`,method:`initialize`,id:1,params:{}})});if(r.status!==401)return{};let{resourceMetadataUrl:i,scope:a}=Ak(r);return{resourceMetadataUrl:i,scope:a}}a(lLe,`probeAuthParams`);function uLe(){let[e,t]=(0,w.useState)(`processing`),[n,r]=(0,w.useState)(``);return(0,w.useEffect)(()=>{console.log(`[OAuthCallback] Component mounted, handling authorization...`),console.log(`[OAuthCallback] Current URL:`,window.location.href),cLe().then(()=>{console.log(`[OAuthCallback] Authorization successful`),t(`success`)}).catch(e=>{console.error(`[OAuthCallback] Authorization failed:`,e),t(`error`),r(e instanceof Error?e.message:String(e))})},[]),e===`processing`?(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,S.jsx)(rp,{className:`h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Completing authentication...`})]})}):e===`error`?(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`max-w-md p-6`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold text-red-600 dark:text-red-400 mb-2`,children:`Authentication Error`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400 mb-4`,children:n}),(0,S.jsx)(`p`,{className:`text-xs text-zinc-500 dark:text-zinc-500`,children:`You can close this window and try again.`})]})}):(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`max-w-md p-6`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold text-green-600 dark:text-green-400 mb-2`,children:`Authentication Successful!`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Redirecting you back...`})]})})}var dLe=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},fLe=w.createContext(void 0),pLe={setTheme:e=>{},themes:[]},mLe=()=>w.useContext(fLe)??pLe;w.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return w.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${dLe.toString()})(${u})`}})});function hLe({...e}){let{theme:t=`system`}=mLe();return(0,S.jsx)(Qme,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}function gLe({activeTabRef:e}){let{activeTab:t}=qq();return(0,w.useEffect)(()=>{e.current=t},[t,e]),null}function _Le(){let e=(0,w.useRef)(`tools`),t=new URLSearchParams(window.location.search),n=t.get(`embedded`)===`true`,r=t.get(`theme`),i=(0,w.useMemo)(()=>n?void 0:new Gfe(`mcp-inspector-connections`),[n]),a=window.__MCP_PROXY_URL__,o=a?`${window.location.origin}${a}`:void 0;return(0,S.jsx)(age,{forcedTheme:r||void 0,children:(0,S.jsx)(UEe,{children:(0,S.jsx)(vj,{storageProvider:i,enableRpcLogging:!0,defaultCallbackUrl:`${window.location.origin}/inspector/oauth/callback`,defaultAutoProxyFallback:o?{enabled:!0,proxyAddress:o}:!1,clientInfo:{name:`mcp-use Inspector`,version:window.__INSPECTOR_VERSION__,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=BM((0,S.jsx)(tFe,{requestId:e.id,serverName:n,onViewDetails:()=>{let t=new CustomEvent(`navigate-to-sampling`,{detail:{requestId:e.id}});window.dispatchEvent(t),BM.dismiss(a)},onApprove:t=>{r(e.id,t),BM.success(`Sampling request approved`),BM.dismiss(a)},onDeny:()=>{i(e.id,`User denied from toast`),BM.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=BM((0,S.jsx)(C,{requestId:t.id,serverName:r,mode:o,message:s,url:c,onViewDetails:()=>{let e=new CustomEvent(`navigate-to-elicitation`,{detail:{requestId:t.id}});window.dispatchEvent(e),BM.dismiss(l)},onOpenUrl:o===`url`&&c?()=>{window.open(c,`_blank`),BM.dismiss(l)}:void 0,onCancel:()=>{a(t.id,`User cancelled from toast`),BM.dismiss(l)}}),{duration:1/0})},children:(0,S.jsxs)(uwe,{children:[(0,S.jsx)(gLe,{activeTabRef:e}),(0,S.jsx)(gme,{basename:`/inspector`,children:(0,S.jsxs)(Upe,{children:[(0,S.jsx)(gM,{path:`/oauth/callback`,element:(0,S.jsx)(uLe,{})}),(0,S.jsx)(gM,{path:`/`,element:(0,S.jsx)(iLe,{children:(0,S.jsx)(lwe,{})})})]})}),(0,S.jsx)(hLe,{position:`top-center`})]})})})})}var vLe=document.getElementById(`root`);vLe?x.createRoot(vLe).render((0,S.jsx)(_Le,{})):console.error(`[inspector] Root element not found`);
844
+ `),e.document.close())}},[x]),Fe=(0,w.useCallback)(()=>{l&&(ne(``),ee(!0))},[l]),Ie=(0,w.useCallback)(()=>{if(!l)return;let e={id:`${Date.now()}-${Math.random()}`,name:te.trim()||`${l.name} - ${new Date().toLocaleString()}`,toolName:l.name,args:ke,savedAt:Date.now(),serverId:l._serverId,serverName:l._serverName};ve([...F,e]),of.getInstance().capture(new Kd({toolName:l.name,serverId:i})).catch(()=>{}),ee(!1),ne(``)},[l,te,ke,F,ve,i]),Le=(0,w.useCallback)(e=>{ve(F.filter(t=>t.id!==e)),d?.id===e&&f(null)},[F,ve,d]);return ae?(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden relative bg-background`,children:[se!==`list`&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>{se===`response`?ce(`detail`):(u(null),ce(`list`))},className:`p-0 h-8 w-8`,children:(0,S.jsx)(Ef,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`flex items-center text-sm font-medium`,children:[(0,S.jsx)(`button`,{onClick:()=>{u(null),ce(`list`)},className:`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`,children:`Tools`}),se===`detail`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`button`,{onClick:()=>{ce(`response`)},className:se===`detail`?`text-foreground hover:underline`:se===`response`?`text-muted-foreground hover:text-foreground hover:underline cursor-pointer`:`text-muted-foreground`,children:`Execute`})]}),se===`response`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`mx-2 text-muted-foreground`,children:`/`}),(0,S.jsx)(`span`,{className:`text-foreground`,children:`Response`})]})]})]}),(0,S.jsx)(`div`,{className:`flex-1 relative overflow-hidden`,children:(0,S.jsxs)(QK,{initial:!1,mode:`popLayout`,children:[se===`list`&&(0,S.jsxs)(Vq.div,{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 flex flex-col bg-background z-0`,children:[(0,S.jsx)(xFe,{activeTab:N,isSearchExpanded:R,searchQuery:j,filteredToolsCount:ye.length,savedRequestsCount:F.length,onSearchExpand:()=>z(!0),onSearchChange:M,onSearchBlur:Se,onTabSwitch:()=>P(N===`tools`?`saved`:`tools`),searchInputRef:ie,onRefresh:o?Ce:void 0,isRefreshing:s}),N===`tools`?(0,S.jsx)(bFe,{tools:ye,selectedTool:l,onToolSelect:be,focusedIndex:B}):(0,S.jsx)(rFe,{savedRequests:F,selectedRequest:d,onLoadRequest:xe,onDeleteRequest:Le,focusedIndex:B})]},`list`),se===`detail`&&(0,S.jsx)(Vq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`-100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-10`,children:(0,S.jsx)(mFe,{selectedTool:l,toolArgs:h,payloadToSend:ke,isExecuting:T,isConnected:a,onArgChange:we,onExecute:Ae,onSave:Fe,onBulkPaste:Ee,autoFilledFields:pe,setFields:_,sendEmptyFields:y,onToggleEmpty:Te})},`detail`),se===`response`&&(0,S.jsx)(Vq.div,{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`},transition:{type:`spring`,stiffness:300,damping:30},className:`absolute inset-0 bg-background z-20`,children:(0,S.jsx)(yFe,{results:Ne,copiedResult:D,serverId:i,readResource:r,onCopy:je,onDelete:Me,onFullscreen:Pe,onRerunTool:Ae})},`response`)]})}),(0,S.jsx)(iFe,{isOpen:L,requestName:te,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ne,onSave:Ie,onCancel:()=>ee(!1)}),(0,S.jsx)($Fe,{open:de.open,onOpenChange:e=>{e||Oe()},children:(0,S.jsxs)(nIe,{children:[(0,S.jsxs)(rIe,{children:[(0,S.jsx)(aIe,{children:`Auto-fill fields from pasted object?`}),(0,S.jsxs)(oIe,{children:[de.fieldsToUpdate.length>0&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`font-medium mb-2`,children:`The following fields will be updated:`}),(0,S.jsx)(`ul`,{className:`text-sm space-y-1 max-h-[200px] overflow-y-auto`,children:de.fieldsToUpdate.map(({key:e,oldValue:t,newValue:n})=>(0,S.jsxs)(`li`,{className:`font-mono`,children:[(0,S.jsxs)(`span`,{className:`font-semibold`,children:[e,`:`]}),` `,(0,S.jsx)(`span`,{className:`text-red-600 dark:text-red-400 line-through`,children:typeof t==`object`?JSON.stringify(t).substring(0,30)+`...`:String(t).substring(0,30)}),` `,`→`,` `,(0,S.jsx)(`span`,{className:`text-green-600 dark:text-green-400`,children:typeof n==`string`&&n.length>30?n.substring(0,30)+`...`:String(n).substring(0,30)})]},e))})]}),de.newFields.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`font-medium mb-1`,children:`New fields to be filled:`}),(0,S.jsx)(`p`,{className:`text-sm font-mono`,children:de.newFields.join(`, `)})]})]})]}),(0,S.jsxs)(iIe,{children:[(0,S.jsx)(cIe,{onClick:Oe,children:`Cancel`}),(0,S.jsx)(sIe,{onClick:De,children:`Auto-fill`})]})]})})]}):(0,S.jsxs)(M9,{orientation:`horizontal`,className:`h-full`,children:[(0,S.jsx)(N9,{id:`left-panel`,defaultSize:`33%`,minSize:`20%`,collapsible:!0,className:`flex flex-col h-full relative`,panelRef:he,children:(0,S.jsxs)(M9,{orientation:`vertical`,className:`h-full border-r dark:border-zinc-700`,children:[(0,S.jsx)(N9,{minSize:`30%`,children:(0,S.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,S.jsx)(xFe,{activeTab:N,isSearchExpanded:R,searchQuery:j,filteredToolsCount:ye.length,savedRequestsCount:F.length,onSearchExpand:()=>z(!0),onSearchChange:M,onSearchBlur:Se,onTabSwitch:()=>P(N===`tools`?`saved`:`tools`),searchInputRef:ie,onRefresh:o?Ce:void 0,isRefreshing:s}),N===`tools`?(0,S.jsx)(bFe,{tools:ye,selectedTool:l,onToolSelect:be,focusedIndex:B}):(0,S.jsx)(rFe,{savedRequests:F,selectedRequest:d,onLoadRequest:xe,onDeleteRequest:Le,focusedIndex:B})]})}),(0,S.jsx)(P9,{withHandle:!0}),(0,S.jsx)(R9,{serverId:i})]})}),(0,S.jsx)(P9,{withHandle:!0}),(0,S.jsx)(N9,{defaultSize:`67%`,children:(0,S.jsxs)(M9,{orientation:`vertical`,children:[(0,S.jsx)(N9,{defaultSize:`40%`,collapsible:!0,panelRef:ge,children:(0,S.jsx)(mFe,{selectedTool:l,toolArgs:h,payloadToSend:ke,isExecuting:T,isConnected:a,onArgChange:we,onExecute:Ae,onSave:Fe,onCancel:()=>{k&&k.abort()},onBulkPaste:Ee,autoFilledFields:pe,setFields:_,sendEmptyFields:y,onToggleEmpty:Te})}),(0,S.jsx)(P9,{withHandle:!0}),(0,S.jsx)(N9,{defaultSize:`60%`,children:(0,S.jsx)(`div`,{className:`flex flex-col h-full`,children:(0,S.jsx)(yFe,{results:Ne,copiedResult:D,serverId:i,readResource:r,onCopy:je,onDelete:Me,onFullscreen:Pe,onMaximize:_e,isMaximized:le,onRerunTool:Ae})})})]})}),(0,S.jsx)(iFe,{isOpen:L,requestName:te,defaultPlaceholder:`${l?.name} - ${new Date().toLocaleString()}`,onRequestNameChange:ne,onSave:Ie,onCancel:()=>ee(!1)}),(0,S.jsx)($Fe,{open:de.open,onOpenChange:e=>{e||Oe()},children:(0,S.jsxs)(nIe,{children:[(0,S.jsxs)(rIe,{children:[(0,S.jsx)(aIe,{children:`Auto-fill fields from pasted object?`}),(0,S.jsxs)(oIe,{children:[de.fieldsToUpdate.length>0&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`font-medium mb-2`,children:`The following fields will be updated:`}),(0,S.jsx)(`ul`,{className:`text-sm space-y-1 max-h-[200px] overflow-y-auto`,children:de.fieldsToUpdate.map(({key:e,oldValue:t,newValue:n})=>(0,S.jsxs)(`li`,{className:`font-mono`,children:[(0,S.jsxs)(`span`,{className:`font-semibold`,children:[e,`:`]}),` `,(0,S.jsx)(`span`,{className:`text-red-600 dark:text-red-400 line-through`,children:typeof t==`object`?JSON.stringify(t).substring(0,30)+`...`:String(t).substring(0,30)}),` `,`→`,` `,(0,S.jsx)(`span`,{className:`text-green-600 dark:text-green-400`,children:typeof n==`string`&&n.length>30?n.substring(0,30)+`...`:String(n).substring(0,30)})]},e))})]}),de.newFields.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`font-medium mb-1`,children:`New fields to be filled:`}),(0,S.jsx)(`p`,{className:`text-sm font-mono`,children:de.newFields.join(`, `)})]})]})]}),(0,S.jsxs)(iIe,{children:[(0,S.jsx)(cIe,{onClick:Oe,children:`Cancel`}),(0,S.jsx)(sIe,{onClick:De,children:`Auto-fill`})]})]})})]})}uIe.displayName=`ToolsTab`;function dIe({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:i,children:a}){let{embeddedConfig:o}=qq();if(!e&&o.forceConnected)return o.chatApiUrl?(0,S.jsx)(sNe,{connection:{id:`force-connected`,url:``,name:``,state:`ready`,tools:[],prompts:[],resources:[]},isConnected:!0,prompts:[],serverId:`force-connected`,callPrompt:async()=>({messages:[]}),readResource:async()=>({contents:[]}),useClientSide:!1,chatApiUrl:o.chatApiUrl,managedLlmConfig:o.managedLlmConfig??{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`},enableFreeTierUpgrade:o.chatEnableFreeTierUpgrade,hideTitle:o.chatHideTitle,hideModelBadge:o.chatHideModelBadge??!0,hideServerUrl:o.chatHideServerUrl??!0,clearButtonLabel:o.chatClearButtonLabel,clearButtonHideIcon:o.chatClearButtonHideIcon,clearButtonHideShortcut:o.chatClearButtonHideShortcut,clearButtonVariant:o.chatClearButtonVariant,chatQuickQuestions:o.chatQuickQuestions,chatFollowups:o.chatFollowups,hideClearButton:o.chatHideClearButton,hideToolSelector:o.chatHideToolSelector,enableKeyboardShortcuts:!1},`chat-force-connected`):(0,S.jsx)(S.Fragment,{children:a});if(!e)return(0,S.jsx)(S.Fragment,{children:a});let s=e=>o.visibleTabs?o.visibleTabs.includes(e):!0;return(0,S.jsxs)(S.Fragment,{children:[s(`tools`)&&(0,S.jsx)(`div`,{style:{display:t===`tools`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(uIe,{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`)&&(0,S.jsx)(`div`,{style:{display:t===`prompts`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(HPe,{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`)&&(0,S.jsx)(`div`,{style:{display:t===`resources`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(YPe,{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`)&&(0,S.jsx)(`div`,{style:{display:t===`chat`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(sNe,{connection:e,isConnected:o.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:!o.chatApiUrl,chatApiUrl:o.chatApiUrl,managedLlmConfig:o.managedLlmConfig??(o.chatApiUrl?{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`}:void 0),enableFreeTierUpgrade:o.chatEnableFreeTierUpgrade,hideTitle:o.chatHideTitle,hideModelBadge:o.chatHideModelBadge??!!o.chatApiUrl,hideServerUrl:o.chatHideServerUrl??!!o.chatApiUrl,clearButtonLabel:o.chatClearButtonLabel,clearButtonHideIcon:o.chatClearButtonHideIcon,clearButtonHideShortcut:o.chatClearButtonHideShortcut,clearButtonVariant:o.chatClearButtonVariant,chatQuickQuestions:o.chatQuickQuestions,chatFollowups:o.chatFollowups,hideClearButton:o.chatHideClearButton,hideToolSelector:o.chatHideToolSelector,streamProtocol:o.chatStreamProtocol,credentials:o.chatCredentials},`chat-${e.id}`)}),s(`sampling`)&&(0,S.jsx)(`div`,{style:{display:t===`sampling`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(nFe,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url},`sampling-${e.id}`)}),s(`elicitation`)&&(0,S.jsx)(`div`,{style:{display:t===`elicitation`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(SPe,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state===`ready`},`elicitation-${e.id}`)}),s(`notifications`)&&(0,S.jsx)(`div`,{style:{display:t===`notifications`?`block`:`none`},className:`h-full`,children:(0,S.jsx)(EPe,{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}`)}),![`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`].includes(t)&&(0,S.jsx)(S.Fragment,{children:a})]})}function fIe({className:e}){return(0,S.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,S.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,S.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}var pIe=w.createContext(void 0);function G9(){let e=w.use(pIe);if(!e)throw Error(`useTabs must be used within a TabsProvider`);return e}var mIe=w.createContext(void 0);function hIe(){return w.use(mIe)}function K9({ref:e,children:t,defaultValue:n,value:r,onValueChange:i,className:a,collapsed:o,onCollapsedChange:s,...c}){let[l,u]=w.useState(n||``),d=r!==void 0,f=o!==void 0,[p,m]=w.useState(!1),h=w.useCallback(e=>{d||u(e),i?.(e)},[d,i]);return(0,S.jsx)(pIe,{value:{activeValue:d?r:l,handleValueChange:h,collapsed:f?o:p,handleCollapsedChange:w.useCallback(e=>{f||m(e),s?.(e)},[f,s])},children:(0,S.jsx)(`div`,{ref:e,className:H(`flex flex-col gap-2`,a),...c,children:t})})}K9.displayName=`Tabs`;function q9({ref:e,children:t,className:n,variant:r=`default`,collapsible:i=!1,...a}){let{activeValue:o,collapsed:s,handleCollapsedChange:c}=G9(),[l,u]=w.useState({width:0,left:0}),d=w.useRef(null),f=w.useRef(null),p=w.useRef(null),m=w.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=w.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(m,16)},[m]);w.useEffect(()=>{let e=setTimeout(m,10);return()=>clearTimeout(e)},[m,s]),w.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]),w.useEffect(()=>{let e=()=>{h()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[h]);let g=w.useRef(null);return w.useEffect(()=>{g.current&&(g.current.style.width=`${l.width}px`,g.current.style.left=`${l.left}px`)},[l]),(0,S.jsx)(mIe,{value:{variant:r,collapsed:s,handleCollapsedChange:c},children:(0,S.jsx)(`div`,{ref:d,className:H(`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,S.jsxs)(`div`,{role:`tablist`,className:`flex-1 flex items-center relative`,children:[t,(0,S.jsx)(`span`,{ref:g,className:H(`absolute transition-all duration-500 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`)})]})})})}q9.displayName=`TabsList`;var gIe=({children:e,title:t,collapsed:n})=>!t||!n?e:(0,S.jsx)(Nd,{children:(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{children:e}),(0,S.jsx)(Id,{children:t})]})}),J9=w.forwardRef(({children:e,value:t,className:n,disabled:r,icon:i,title:a,showDot:o=!1,alwaysExpanded:s=!1,...c},l)=>{let{activeValue:u,handleValueChange:d,collapsed:f}=G9(),p=hIe()?.variant||`default`,m=u===t,h=!f||m||s;return(0,S.jsx)(gIe,{title:a,collapsed:f&&!h,children:(0,S.jsxs)(`button`,{ref:l,disabled:r,onClick:()=>d(t),"data-tab-value":t,"data-tab-active":m,role:`tab`,"aria-selected":m?`true`:`false`,title:f&&!h&&a?a:void 0,className:H(`relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-500 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,p===`default`&&`py-2.5`,p===`default`&&`rounded-md px-4`,p===`underline`&&`px-6 py-3 border-b-2 border-transparent`,m&&`text-foreground`,!m&&`text-muted-foreground hover:text-foreground`,n),...c,children:[i&&(0,S.jsx)(i,{className:H(`h-4 w-4 transition-all duration-500 ease-in-out`,h&&`mr-2`,!h&&`mr-0!`)}),o&&(0,S.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,S.jsx)(`span`,{className:H(`transition-all duration-500 ease-in-out overflow-hidden`,h?`w-auto opacity-100`:`w-0 opacity-0`),children:e})]})})});J9.displayName=`TabsTrigger`;function _Ie({ref:e,children:t,value:n,className:r,...i}){let{activeValue:a}=G9();return a===n?(0,S.jsx)(`div`,{ref:e,role:`tabpanel`,className:H(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,r),...i,children:t}):null}_Ie.displayName=`TabsContent`;function vIe(e,t=[]){let n=[];function r(t,r){let i=w.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=w.useMemo(()=>o,Object.values(o));return(0,S.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=w.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>w.createContext(e));return function(n){let r=n?.[e]||t;return w.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,yIe(i,...t)]}function yIe(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var bIe=i((e=>{var t=m();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),xIe=i(((e,t)=>{t.exports=bIe()}))();function SIe(){return(0,xIe.useSyncExternalStore)(CIe,()=>!0,()=>!1)}function CIe(){return()=>{}}var Y9=`Avatar`,[wIe,TIe]=vIe(Y9),[EIe,DIe]=wIe(Y9),OIe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=w.useState(`idle`);return(0,S.jsx)(EIe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,S.jsx)(AN.span,{...r,ref:t})})});OIe.displayName=Y9;var kIe=`AvatarImage`,AIe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=DIe(kIe,n),s=PIe(r,a),c=$t(e=>{i(e),o.onImageLoadingStatusChange(e)});return Ft(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,S.jsx)(AN.img,{...a,ref:t,src:r}):null});AIe.displayName=kIe;var jIe=`AvatarFallback`,MIe=w.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=DIe(jIe,n),[o,s]=w.useState(r===void 0);return w.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,S.jsx)(AN.span,{...i,ref:t}):null});MIe.displayName=jIe;function NIe(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function PIe(e,{referrerPolicy:t,crossOrigin:n}){let r=SIe(),i=w.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=w.useState(()=>NIe(a,e));return Ft(()=>{s(NIe(a,e))},[a,e]),Ft(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var FIe=OIe,IIe=AIe,LIe=MIe;function RIe({className:e,...t}){return(0,S.jsx)(FIe,{"data-slot":`avatar`,className:H(`relative flex size-8 shrink-0 overflow-hidden rounded-full`,e),...t})}function zIe({className:e,...t}){return(0,S.jsx)(IIe,{"data-slot":`avatar-image`,className:H(`aspect-square size-full`,e),...t})}function BIe({className:e,...t}){return(0,S.jsx)(LIe,{"data-slot":`avatar-fallback`,className:H(`flex size-full items-center justify-center rounded-full bg-zinc-200 dark:bg-zinc-700 text-muted-foreground font-medium`,e),...t})}function VIe(e,t){return e?.[0]?e[0].toUpperCase():t?.[0]?t[0].toUpperCase():`U`}function HIe({chatApiUrl:e,dashboardUrl:t=`https://manufact.com/cloud`,fallback:n=null,onUserResolved:r}){let[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),c=(0,w.useCallback)(()=>{let t=!1,n=`${new URL(e).origin}/api/auth/get-session`;return fetch(n,{credentials:`include`}).then(e=>e.ok?e.json():null).then(e=>{if(!t){let t=e?.user??null;a(t),s(!0),r?.(t)}}).catch(()=>{t||(s(!0),r?.(null))}),()=>{t=!0}},[e]);if((0,w.useEffect)(()=>c(),[c]),(0,w.useEffect)(()=>{let e=()=>{c()};return window.addEventListener(`manufact:session-changed`,e),()=>window.removeEventListener(`manufact:session-changed`,e)},[c]),!o)return null;if(!i)return(0,S.jsx)(S.Fragment,{children:n});let l=VIe(i.name,i.email),u=i.name??i.email??`User`;return(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,className:`relative h-8 w-8 shrink-0 rounded-full p-0 mr-2`,"aria-label":`User menu`,children:(0,S.jsxs)(RIe,{className:`h-8 w-8 border border-zinc-300 dark:border-zinc-600`,children:[(0,S.jsx)(zIe,{src:i.image??``,alt:u}),(0,S.jsx)(BIe,{className:`text-sm`,children:l})]})})}),(0,S.jsxs)(eu,{className:`w-56`,align:`end`,forceMount:!0,children:[(0,S.jsx)(iu,{className:`font-normal`,children:(0,S.jsxs)(`div`,{className:`flex flex-col space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium leading-none truncate`,children:u}),i.email&&i.email!==u&&(0,S.jsx)(`p`,{className:`text-xs leading-none text-muted-foreground truncate`,children:i.email})]})}),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(np,{className:`mr-2 h-4 w-4`}),`Go to dashboard`]})})]})]})}function UIe({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,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),{url:p,name:m,headers:h}=e,g=e=>{try{of.getInstance().capture(new Zd({client:e})).catch(()=>{})}catch{}},_=()=>{g(`cursor`);try{let e=EJ(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=DJ(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=OJ(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{kJ(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)},C=()=>{g(`gemini-cli`),u(`gemini-cli`),c(!0)},T=()=>{g(`codex-cli`),u(`codex-cli`),c(!0)},E=async e=>{try{await bj(e),f(!0),setTimeout(()=>f(!1),2e3)}catch(e){console.error(`Failed to copy:`,e),a?.(e)}},D=()=>{if(l===`claude-code`){let{command:e,envVars:t}=AJ(p,m,h),n=NJ(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(EN,{children:[(0,S.jsx)(DN,{children:`Add to Claude Code`}),(0,S.jsx)(ON,{children:`Execute the following command in your shell to add this server to Claude Code.`})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsx)(`span`,{children:`Ensure the Claude Code executable is available in your path`})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(wf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(Lf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:`After installation, set these environment variables in your shell:`}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:n})})]}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The MCP configuration supports environment variable expansion using `,(0,S.jsx)(`code`,{className:`text-foreground`,children:"${VAR}"}),` `,`syntax.`]})]})]})}if(l===`gemini-cli`){let{command:e,envVars:t}=jJ(p,m,h),n=NJ(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(EN,{children:[(0,S.jsx)(DN,{children:`Add to Gemini CLI`}),(0,S.jsx)(ON,{children:`Execute the following command in your shell to add this server to Gemini CLI.`})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsx)(`span`,{children:`Ensure the Gemini CLI executable is available in your path`})]}),n&&(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsx)(`span`,{children:`Set these environment variables in your shell before running the command:`})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:n?`3.`:`2.`}),(0,S.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),n&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:n})})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(wf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(Lf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),(0,S.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}=MJ(p,m,h);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(EN,{children:[(0,S.jsx)(DN,{children:`Add to Codex CLI`}),(0,S.jsxs)(ON,{children:[`Add this configuration to your`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),` `,`file.`]})]}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Add this configuration to your`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),`:`]})]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>E(e),children:d?(0,S.jsx)(wf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(Lf,{className:`size-3.5`})})}),(0,S.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,S.jsx)(`code`,{children:e})})]}),t.length>0&&(0,S.jsx)(`div`,{children:(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`(optional) If you would rather use variables from your system's environment, replace the`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`http_headers`}),` key with the `,(0,S.jsx)(`code`,{className:`text-foreground`,children:`env_http_headers`}),` `,`key as shown in the commented section above.`]})}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Codex CLI to load the new configuration.`})]})]})}return null},O=(0,S.jsxs)(U,{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,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(hp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(Tf,{className:`size-3`})]})]});return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:o?typeof o==`function`?o({isOpen:!1,onClick:()=>{}}):o:O}),(0,S.jsxs)(eu,{align:`end`,className:`w-auto min-w-[300px]`,children:[t.map(e=>(0,S.jsxs)(tu,{onClick:async()=>{await e.onClick()},className:`flex items-center gap-2`,children:[e.icon,(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:e.label})]},e.id)),t.length>0&&(0,S.jsx)(au,{}),n.cursor&&(0,S.jsxs)(tu,{onClick:_,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Cursor`})]}),n.claudeCode&&(0,S.jsxs)(tu,{onClick:x,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Code`})]}),n.claudeDesktop&&(0,S.jsxs)(tu,{onClick:b,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Desktop`})]}),n.vsCode&&(0,S.jsxs)(tu,{onClick:v,className:`flex items-center gap-2`,children:[(0,S.jsx)(PJ,{className:`h-4 w-4 text-blue-500`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code`})]}),n.vsCodeInsiders&&(0,S.jsxs)(tu,{onClick:y,className:`flex items-center gap-2`,children:[(0,S.jsx)(PJ,{className:`h-4 w-4 text-teal-400`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code Insiders`})]}),n.geminiCli&&(0,S.jsxs)(tu,{onClick:C,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Gemini CLI`})]}),n.codexCli&&(0,S.jsxs)(tu,{onClick:T,className:`flex items-center gap-2`,children:[(0,S.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`}),(0,S.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Codex CLI`})]})]})]}),(0,S.jsx)(CN,{open:s,onOpenChange:c,children:(0,S.jsx)(TN,{className:`max-w-3xl max-h-[80vh] overflow-y-auto`,children:D()})})]})}function X9({className:e,state:t=`collapsed`,href:n=`https://mcp-use.com`}){let[r,i]=(0,w.useState)(!1),a=.2,o=.7,s=a+o+.6,c=a/s,l=(a+o)/s;return(0,S.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:H(`flex items-center transition-opacity -my-3`,t===`expanded`?`space-x-2`:``,e),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[(0,S.jsx)(`div`,{className:`relative`,children:(0,S.jsxs)(Vq.svg,{viewBox:`0 0 303 303`,initial:`rest`,animate:r?`hover`:`rest`,className:H(`text-foreground`,t===`expanded`?`size-[40px]`:`size-[20px]`),children:[(0,S.jsxs)(Vq.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:s,times:[0,c,l,1],ease:`easeInOut`}}},fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`path`,{d:`m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z`}),(0,S.jsx)(`circle`,{cx:`70.3`,cy:`232.3`,r:`50`}),(0,S.jsx)(`circle`,{cx:`232.3`,cy:`70.3`,r:`50`})]}),(0,S.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(WIe,{d:`m105.5 34.8.6.6c9.5 9.5 14.4 21.9 14.6 34.4a112.6 112.6 0 0 0 112.2 112.1h.6c12 .4 24 5.1 33.2 14.1l.6.6a50 50 0 0 1-70.1 71.3l-.6-.6A49.9 49.9 0 0 1 182 230 112.6 112.6 0 0 0 73.4 120.7h-.8a49.9 49.9 0 0 1-36.7-14l-.5-.6a50 50 0 0 1-.6-70.2l.6-.5a50 50 0 0 1 69.5-1.2l.6.6Z`,times:{T0:0,T1:c,T2:l,T3:1},total:s}),(0,S.jsx)(GIe,{cx:70.3,cy:232.3,r:50,times:{T0:0,T1:c,T2:l,T3:1},total:s}),(0,S.jsx)(GIe,{cx:232.3,cy:70.3,r:50,times:{T0:0,T1:c,T2:l,T3:1},total:s})]})]})}),t===`expanded`&&(0,S.jsxs)(`div`,{className:`font-ubuntu flex-col items-start -space-y-1 mr-3 hidden xl:flex`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-medium`,children:`mcp-use`}),(0,S.jsx)(`span`,{className:`text-lg text-muted-foreground tracking-wide font-sans font-light`,children:`Inspector`})]})]})}function WIe({d:e,times:t,total:n}){let{T0:r,T1:i,T2:a,T3:o}=t;return(0,S.jsx)(Vq.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 GIe({cx:e,cy:t,r:n,times:r,total:i}){let{T0:a,T1:o,T2:s,T3:c}=r;return(0,S.jsx)(Vq.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`}}}})}function Z9({open:e,onOpenChange:t,serverUrl:n,serverName:r,serverId:i,headers:a,language:o}){let{prismStyle:s}=VP(),[c,l]=(0,w.useState)(!1),u=o===`typescript`?Rwe(n,r,i,a):zwe(n,r,i,a),d=async()=>{await bj(u),l(!0),setTimeout(()=>l(!1),2e3)},f=o===`typescript`?`TypeScript`:`Python`;return(0,S.jsx)(CN,{open:e,onOpenChange:t,children:(0,S.jsxs)(TN,{className:`max-w-[90vw] max-h-[90vh] overflow-hidden flex flex-col`,children:[(0,S.jsxs)(EN,{children:[(0,S.jsxs)(DN,{children:[`Add to `,f,` SDK`]}),(0,S.jsxs)(ON,{children:[`Copy the following code to integrate this server into your`,` `,f,` application using the mcp-use SDK.`]})]}),(0,S.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 min-h-0`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsxs)(`span`,{children:[`Install the mcp-use package:`,` `,(0,S.jsx)(`code`,{className:`text-foreground`,children:o===`typescript`?`npm install mcp-use`:`pip install mcp-use`})]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsxs)(`span`,{children:[`Copy the following code into your `,f,` project:`]})]})]})]}),(0,S.jsxs)(`div`,{className:`relative w-full overflow-x-auto overflow-y-auto max-h-[60vh]`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:d,children:c?(0,S.jsx)(wf,{className:`size-3.5 text-green-600`}):(0,S.jsx)(Lf,{className:`size-3.5`})})}),(0,S.jsx)(VV,{language:o,style:s,customStyle:{margin:0,padding:`1rem`,paddingRight:`3rem`,borderRadius:`0.5rem`,fontSize:`0.75rem`,background:`var(--muted)`,width:`100%`,maxWidth:`100%`,overflow:`auto`},wrapLines:!0,wrapLongLines:!0,PreTag:`div`,children:u})]})]})]})})}function KIe({ref:e,shimmerColor:t,shimmerSize:n=`0.05em`,shimmerDuration:r=`3s`,borderRadius:i=`100px`,background:a,className:o,children:s,...c}){let{theme:l}=zP();return(0,S.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:H(`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,S.jsx)(`div`,{className:H(`-z-30 blur-[2px]`,`@container-[size] absolute inset-0 overflow-visible`),children:(0,S.jsx)(`div`,{className:`animate-shimmer-slide absolute inset-0 aspect-[1] h-[100cqh] rounded-none mask-none`,children:(0,S.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,S.jsx)(`div`,{className:H(`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,S.jsx)(`div`,{className:H(`absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] bg-black dark:bg-white`)})]})}KIe.displayName=`ShimmerButton`;function qIe({status:e}){let{color:t,ringColor:n,tooltip:r}=(e=>{switch(e){case`ready`:return{color:`bg-emerald-500`,ringColor:`ring-emerald-500`,tooltip:`Connected`};case`failed`:return{color:`bg-red-500`,ringColor:`ring-red-500`,tooltip:`Failed`};default:return{color:`bg-yellow-500`,ringColor:`ring-yellow-500`,tooltip:e}}})(e);return(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`absolute w-2 h-2 rounded-full ${n} animate-ping`}),(0,S.jsx)(`div`,{className:`relative w-2 h-2 rounded-full ${t}`})]})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:r})})]})}function JIe({connections:e,selectedServer:t,onServerSelect:n,onOpenConnectionOptions:r,mobileMode:i=!1}){let a=aM(),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),u=t=>{let r=e.find(e=>e.id===t);if(!r||r.state!==`ready`){BM.error(`Server is not connected and cannot be inspected`);return}n(t)};return i?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`relative`,children:(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsxs)(U,{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,S.jsx)(Wq,{server:t,size:`md`}):(0,S.jsx)(Cp,{className:`h-5 w-5`}),(0,S.jsx)(Tf,{className:`h-4 w-4`})]})}),(0,S.jsxs)(eu,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,S.jsx)(iu,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,S.jsx)(au,{}),e.length===0?(0,S.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,S.jsxs)(tu,{onClick:()=>u(e.id),className:`flex items-center gap-3`,children:[(0,S.jsx)(Wq,{server:e,size:`sm`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-medium`,children:Tj(e)}),(0,S.jsx)(qIe,{status:e.state})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),l(e),s(!0)},children:(0,S.jsx)(ep,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,S.jsx)(wp,{className:`h-3 w-3`})})]})]},e.id)),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{onClick:()=>a(`/`),children:(0,S.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]})]})}),(0,S.jsx)(UV,{open:o,onOpenChange:s,connection:c})]}):(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsxs)(KIe,{className:H(`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`,t&&`pr-20`),children:[t&&(0,S.jsx)(Wq,{server:t,size:`md`,className:`mr-2`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`span`,{className:`truncate lg:max-w-[120px] xl:max-w-none`,children:t?Tj(t):`Select server to inspect`}),t&&(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:t.error&&t.state!==`ready`?(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.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`})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{className:`max-w-xs`,children:t.error})})]}):(0,S.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t.state===`ready`?`bg-emerald-600 animate-status-pulse`:t.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]})]})}),t&&(0,S.jsxs)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1`,children:[(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>{l(t),s(!0)},className:`p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black`,"aria-label":`View server info`,children:(0,S.jsx)(ep,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`View server info`})})]}),(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>{r(t.id)},className:`p-1.5 hover:bg-white/10 dark:hover:bg-black/10 rounded-full transition-colors text-white dark:text-black`,"aria-label":`Edit connection settings`,children:(0,S.jsx)(wp,{className:`h-4 w-4`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:`Edit connection settings`})})]})]}),(0,S.jsxs)(eu,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,S.jsx)(iu,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,S.jsx)(au,{}),e.length===0?(0,S.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,S.jsxs)(tu,{onClick:()=>u(e.id),className:`flex items-center gap-3`,children:[(0,S.jsx)(Wq,{server:e,size:`sm`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-medium`,children:Tj(e)}),(0,S.jsx)(qIe,{status:e.state})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),l(e),s(!0)},children:(0,S.jsx)(ep,{className:`h-3 w-3`})}),(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,S.jsx)(wp,{className:`h-3 w-3`})})]})]},e.id)),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{onClick:()=>a(`/`),children:(0,S.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]})]}),(0,S.jsx)(UV,{open:o,onOpenChange:s,connection:c})]})})}var YIe=[{id:`chat`,label:`Chat`,icon:op,alwaysExpanded:!0},{id:`separator`},{id:`tools`,label:`Tools`,icon:Bp},{id:`prompts`,label:`Prompts`,icon:sp},{id:`resources`,label:`Resources`,icon:Jf},{id:`sampling`,label:`Sampling`,icon:Zf},{id:`elicitation`,label:`Elicitation`,icon:Ap},{id:`notifications`,label:`Notifications`,icon:yf}];function XIe(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 ZIe(e,t,n){return n&&t>0&&[`sampling`,`elicitation`,`notifications`].includes(e)}function QIe({collapsed:e,onToggle:t}){return(0,S.jsxs)(Pd,{children:[(0,S.jsx)(Fd,{asChild:!0,children:(0,S.jsx)(`button`,{onClick:t,className:H(`shrink-0 p-1.5 rounded-md transition-all duration-500 ease-in-out cursor-pointer`,`text-muted-foreground hover:text-foreground`,`hover:bg-zinc-100 dark:hover:bg-zinc-800`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),"aria-label":e?`Expand tabs`:`Collapse tabs`,type:`button`,children:e?(0,S.jsx)(Df,{className:`h-4 w-4 transition-transform duration-500 ease-in-out`}):(0,S.jsx)(Ef,{className:`h-4 w-4 transition-transform duration-500 ease-in-out`})})}),(0,S.jsx)(Id,{children:(0,S.jsx)(`p`,{children:e?`Expand tabs`:`Collapse tabs`})})]})}function $Ie(e){try{let t=new URL(e).hostname.toLowerCase();return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`0.0.0.0`}catch{return!1}}function eLe(e){try{return new URL(e).hostname.endsWith(`.mcp-use.run`)}catch{return!1}}function tLe(e){if(!e)return null;try{let t=new URL(e);if(t.protocol===`https:`)return t.origin}catch{}return null}var Q9={starting:`Starting tunnel…`,stopping:`Stopping tunnel…`,reconnecting:`Reconnecting…`};function nLe({tunnelUrl:e,isTunnelStarting:t,setTunnelUrl:n,setIsTunnelStarting:r,copied:i,setCopied:a,handleCopy:o}){let[s,c]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(0),[p,m]=(0,w.useState)(Q9.starting);(0,w.useEffect)(()=>{if(!t){f(20);return}f(20);let e=setInterval(()=>f(e=>e>0?e-1:0),1e3);return()=>clearInterval(e)},[t]),(0,w.useEffect)(()=>{if(!e)return;c(!0);let t=new URLSearchParams(window.location.search);if(t.has(`openTunnelPopover`)){t.delete(`openTunnelPopover`);let e=t.toString();window.history.replaceState({},``,`${window.location.pathname}${e?`?${e}`:``}`)}},[e]),(0,w.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch(`/inspector/api/dev/info`);if(!t.ok||e)return;let r=await t.json();if(e)return;if(u(!!r.fromCli),r.tunnelUrl)n(new URL(r.tunnelUrl).origin);else{let e=tLe(r.mcpUrl??null);e&&n(e)}}catch{e||u(!1)}})(),()=>{e=!0}},[n]);let h=async e=>{let t=window.location.port||`3000`,i=`http://localhost:${t}/inspector/api/dev/info`,a=Date.now()+9e4;for(m(e?`Restarting with tunnel…`:`Restarting…`),await new Promise(e=>setTimeout(e,1500));Date.now()<a;){try{let r=await fetch(i,{cache:`no-store`});if(r.ok){let i=await r.json();if(!!i.tunnelUrl===e){let r=(i.tunnelUrl||i.mcpUrl||`http://localhost:${t}`).replace(/\/+$/,``)+`/mcp`;i.tunnelUrl?n(new URL(i.tunnelUrl).origin):n(null),sessionStorage.setItem(Jq,JSON.stringify({url:r,name:`Local MCP Server`,transportType:`http`,connectionType:`Direct`})),BM.success(e?`Tunnel ready — reconnecting…`:`Tunnel stopped — reconnecting…`),m(Q9.reconnecting);let a=new URL(window.location.href);a.searchParams.delete(`server`),a.searchParams.delete(`tunnelUrl`),a.searchParams.delete(`autoConnect`),e&&a.searchParams.set(`openTunnelPopover`,`1`),window.location.assign(a.toString());return}}}catch{}await new Promise(e=>setTimeout(e,1500))}BM.error(`Timeout waiting for server to restart`),r(!1)},g=async()=>{if(l===!1){BM.error("Start Tunnel requires `mcp-use dev` from your project directory.");return}m(Q9.starting),r(!0);let e=!1;try{let t=await fetch(`/inspector/api/dev/start-tunnel`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));BM.error(e.error||`Failed to start tunnel`),r(!1);return}await h(!0),e=!0}catch{BM.error(`Failed to start tunnel`),r(!1)}try{of.getInstance().capture(new qd({action:`start`,success:e})).catch(()=>{})}catch{}},_=async()=>{m(Q9.stopping),r(!0);let t=!1;try{let e=await fetch(`/inspector/api/dev/stop-tunnel`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));BM.error(t.error||`Failed to stop tunnel`),r(!1);return}a(!1),c(!1),await h(!1),t=!0}catch{BM.error(`Failed to stop tunnel`),r(!1)}try{of.getInstance().capture(new qd({action:`stop`,success:t,tunnelUrl:e})).catch(()=>{})}catch{}};if(t)return(0,S.jsxs)(`button`,{disabled:!0,className:`flex items-center gap-2 h-9 px-3 bg-violet-50 dark:bg-violet-950/40 border border-violet-200 dark:border-violet-800 rounded-full opacity-75 cursor-wait`,children:[(0,S.jsx)(rp,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}),(0,S.jsxs)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:[`Start Tunnel `,(0,S.jsxs)(`span`,{className:`tabular-nums`,children:[d,`s`]})]})]});if(!e){let e=l===!0,t=l===null;return(0,S.jsxs)(`button`,{type:`button`,onClick:g,disabled:!e||t,title:l===!1?"Run `mcp-use dev` from your project to enable tunneling.":t?`Checking dev server…`:void 0,className:H(`flex items-center gap-2 h-9 px-3 border rounded-full transition-colors`,e&&!t?`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:[t?(0,S.jsx)(rp,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}):(0,S.jsx)(kf,{className:`size-4 text-violet-500 dark:text-violet-400`}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:`Start Tunnel`})]})}return(0,S.jsxs)(iY,{open:s,onOpenChange:c,children:[(0,S.jsx)(aY,{asChild:!0,children:(0,S.jsxs)(`button`,{className:`flex items-center gap-2 h-9 px-3 bg-gradient-to-r from-purple-500/10 to-pink-500/10 dark:from-purple-500/20 dark:to-pink-500/20 border border-purple-500/30 dark:border-purple-500/40 rounded-full hover:from-purple-500/20 hover:to-pink-500/20 dark:hover:from-purple-500/30 dark:hover:to-pink-500/30 transition-colors cursor-pointer`,children:[(0,S.jsx)(kf,{className:`size-4 text-purple-600 dark:text-purple-400`}),(0,S.jsx)(`span`,{className:`text-sm font-medium text-purple-700 dark:text-purple-300 hidden lg:inline`,children:`Tunnel`})]})}),(0,S.jsx)(oY,{className:`w-[calc(100vw-2rem)] sm:w-96 overflow-hidden`,align:`end`,children:(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,S.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Tunnel URL`}),(0,S.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,S.jsx)(_f,{className:`size-3`})]})]}),(0,S.jsxs)(`button`,{onClick:o,className:`-mx-4 px-4 py-3 bg-muted hover:bg-accent transition-colors cursor-pointer flex items-center gap-3 w-[calc(100%+2rem)]`,children:[(0,S.jsxs)(`code`,{className:`flex-1 text-[10px] font-mono truncate text-left`,children:[e,`/mcp`]}),i?(0,S.jsx)(wf,{className:`size-3.5 text-green-600 shrink-0`}):(0,S.jsx)(Lf,{className:`size-3.5 shrink-0 text-muted-foreground`})]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Use in ChatGPT`}),(0,S.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,S.jsxs)(`span`,{children:[`Enable`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`dev mode`}),` `,`from settings`]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,S.jsxs)(`span`,{children:[`In`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`App & Connectors`}),` `,`click on`,` `,(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:`create`})]})]}),(0,S.jsxs)(`li`,{className:`flex gap-2`,children:[(0,S.jsx)(`span`,{className:`font-semibold text-foreground`,children:`3.`}),(0,S.jsx)(`span`,{children:`Use the tunnel URL in the input`})]})]})]}),(0,S.jsxs)(`button`,{onClick:_,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,S.jsx)(Np,{className:`size-3 fill-current`}),`Stop Tunnel`]})]})})]})}function rLe({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:i,onCommandPaletteOpen:a,onOpenConnectionOptions:o,embedded:s=!1}){let{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,embeddedConfig:f}=qq(),{theme:p,setTheme:m}=zP(),h=!!t&&($Ie(t.url)||eLe(t.url)||!!c),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(!1),[C,T]=(0,w.useState)(!0),[E,D]=(0,w.useState)(!1);if(f.singleTab)return null;let O=f.visibleTabs?YIe.filter(e=>e.id===`separator`||f.visibleTabs.includes(e.id)):YIe,k=async()=>{if(c)try{await bj(`${c}/mcp`),_(!0),BM.success(`Tunnel URL copied to clipboard`),setTimeout(()=>_(!1),2e3)}catch{BM.error(`Failed to copy URL`)}};return(0,S.jsxs)(`header`,{className:`w-full mx-auto`,children:[(0,S.jsxs)(`div`,{className:`flex lg:hidden flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[!s&&(0,S.jsx)(`div`,{className:`flex-1 flex justify-start`,children:(0,S.jsx)(JIe,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:o,mobileMode:!0})}),!s&&(0,S.jsx)(`div`,{className:`flex-shrink-0 flex justify-center`,children:(0,S.jsx)(`div`,{className:`scale-150`,children:(0,S.jsx)(X9,{state:`collapsed`})})}),!s&&(0,S.jsxs)(`div`,{className:`flex-1 flex justify-end items-center gap-2`,children:[t&&(()=>{let e=Tj(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(UIe,{serverConfig:{url:c?`${c}/mcp`:t.url,name:e,headers:t.customHeaders,serverId:t.id},onSuccess:e=>BM.success(`Opening in ${e}...`),onError:e=>BM.error(`Failed: ${e.message}`),additionalItems:[{id:`ts-sdk`,label:`TypeScript SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/typescript`,alt:`TypeScript`,className:`h-4 w-4`}),onClick:()=>y(!0)},{id:`py-sdk`,label:`Python SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/python`,alt:`Python`,className:`h-4 w-4`}),onClick:()=>x(!0)}],trigger:(0,S.jsxs)(U,{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 p-2`,"aria-label":`Add to Client`,children:[(0,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(hp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(Tf,{className:`size-3`})]})]})}),(0,S.jsx)(Z9,{open:v,onOpenChange:y,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`typescript`}),(0,S.jsx)(Z9,{open:b,onOpenChange:x,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`python`})]})})(),h&&(0,S.jsx)(nLe,{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,copied:g,setCopied:_,handleCopy:k}),(0,S.jsx)(U,{asChild:!0,size:`sm`,className:`rounded-full bg-blue-600 hover:bg-blue-700 text-white px-3`,children:(0,S.jsx)(`a`,{href:E?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{of.getInstance().capture(new Jd({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},children:(0,S.jsx)(vp,{className:`size-4`})})}),(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors`,"aria-label":`Settings`,children:(0,S.jsx)(wp,{className:`size-4`})})}),(0,S.jsxs)(eu,{align:`end`,className:`w-48`,children:[(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Ql,{children:[p===`light`?(0,S.jsx)(Pp,{className:`size-4 mr-2`}):p===`dark`?(0,S.jsx)(up,{className:`size-4 mr-2`}):(0,S.jsx)(lp,{className:`size-4 mr-2`}),`Theme`]}),(0,S.jsx)($l,{children:(0,S.jsxs)(Zl,{value:p,onValueChange:e=>m(e),children:[(0,S.jsxs)(ru,{value:`light`,children:[(0,S.jsx)(Pp,{className:`size-4 mr-2`}),`Light`]}),(0,S.jsxs)(ru,{value:`dark`,children:[(0,S.jsx)(up,{className:`size-4 mr-2`}),`Dark`]}),(0,S.jsxs)(ru,{value:`system`,children:[(0,S.jsx)(lp,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(fIe,{className:`h-4 w-4 mr-2`}),`GitHub`]})}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use/issues/new?labels=inspector&template=bug_report.md&title=%5BInspector%5D+`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(Cf,{className:`size-4 mr-2`}),`Report a Bug`]})})]})]})]})]}),t&&(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsx)(K9,{value:n,onValueChange:e=>i(e),collapsed:C,onCollapsedChange:T,children:(0,S.jsx)(q9,{className:`w-full justify-center`,children:O.map(e=>{if(e.id===`separator`)return(0,S.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator`);let r=XIe(e.id,t),i=ZIe(e.id,r,C);return(0,S.jsxs)(J9,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:i,alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:H(`[&>svg]:mr-0 flex-1 flex-row gap-2 relative`,C&&`pl-2`),children:[r>0&&!C&&(0,S.jsx)(`span`,{className:H(n===e.id?`dark:bg-black`:`dark:bg-zinc-700`,`bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-[10px] px-1.5 py-0.5 rounded-full font-medium`),children:r}),(0,S.jsx)(`span`,{className:`sr-only`,children:e.label})]},e.id)})})})})]}),(0,S.jsxs)(`div`,{className:`hidden lg:flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center flex-wrap gap-2 md:space-x-6 space-x-2`,children:[!s&&(0,S.jsx)(JIe,{connections:e,selectedServer:t,onServerSelect:r,onOpenConnectionOptions:o}),t&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(K9,{value:n,onValueChange:e=>i(e),collapsed:C,onCollapsedChange:T,children:(0,S.jsx)(q9,{className:`overflow-x-auto`,collapsible:!0,children:O.map(e=>{if(e.id===`separator`)return(0,S.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator`);let r=XIe(e.id,t),i=r>0?`${e.label} (${r})`:e.label,a=ZIe(e.id,r,C);return(0,S.jsx)(J9,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:a,alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:H(`[&>svg]:mr-0 lg:[&>svg]:mr-2 relative`,C&&`pl-4`),title:i,children:(0,S.jsxs)(`div`,{className:`items-center gap-2 hidden lg:flex`,children:[e.label,r>0&&(0,S.jsx)(`span`,{className:H(n===e.id?` dark:bg-black `:`dark:bg-zinc-700`,`bg-zinc-200 text-zinc-700 dark:text-zinc-300 text-xs px-2 py-0.5 rounded-full font-medium`),children:r})]})},e.id)})})}),(0,S.jsx)(QIe,{collapsed:C,onToggle:()=>T(!C)})]})]}),!s&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-4 flex-shrink-0`,children:[t&&(()=>{let e=Tj(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(UIe,{serverConfig:{url:c?`${c}/mcp`:t.url,name:e,headers:t.customHeaders,serverId:t.id},onSuccess:e=>BM.success(`Opening in ${e}...`),onError:e=>BM.error(`Failed: ${e.message}`),additionalItems:[{id:`ts-sdk`,label:`TypeScript SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/typescript`,alt:`TypeScript`,className:`h-4 w-4`}),onClick:()=>y(!0)},{id:`py-sdk`,label:`Python SDK`,icon:(0,S.jsx)(`img`,{src:`https://cdn.simpleicons.org/python`,alt:`Python`,className:`h-4 w-4`}),onClick:()=>x(!0)}],trigger:(0,S.jsxs)(U,{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,S.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,S.jsx)(hp,{className:`size-3`}),`Client`]}),(0,S.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,S.jsx)(Tf,{className:`size-3`})]})]})}),(0,S.jsx)(Z9,{open:v,onOpenChange:y,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`typescript`}),(0,S.jsx)(Z9,{open:b,onOpenChange:x,serverUrl:c?`${c}/mcp`:t.url,serverName:e,serverId:void 0,headers:t.customHeaders,language:`python`})]})})(),h&&(0,S.jsx)(nLe,{tunnelUrl:c,isTunnelStarting:l,setTunnelUrl:u,setIsTunnelStarting:d,copied:g,setCopied:_,handleCopy:k}),(0,S.jsx)(U,{asChild:!0,className:`rounded-full bg-blue-600 hover:bg-blue-700 text-white px-4`,children:(0,S.jsxs)(`a`,{href:E?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{of.getInstance().capture(new Jd({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},children:[(0,S.jsx)(vp,{className:`size-4`}),(0,S.jsx)(`span`,{className:`hidden sm:inline`,children:`Deploy`})]})}),(0,S.jsxs)(Jl,{children:[(0,S.jsx)(Yl,{asChild:!0,children:(0,S.jsx)(U,{variant:`ghost`,size:`sm`,className:`p-2 hover:bg-zinc-200 dark:hover:bg-zinc-800 rounded-full transition-colors`,"aria-label":`Settings`,children:(0,S.jsx)(wp,{className:`size-4`})})}),(0,S.jsxs)(eu,{align:`end`,className:`w-48`,children:[(0,S.jsxs)(tu,{onClick:a,"data-testid":`command-palette-trigger-button`,children:[(0,S.jsx)(If,{className:`size-4 mr-2`}),`Command Palette`,(0,S.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[`⌘`,`K`]})]}),(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Ql,{children:[p===`light`?(0,S.jsx)(Pp,{className:`size-4 mr-2`}):p===`dark`?(0,S.jsx)(up,{className:`size-4 mr-2`}):(0,S.jsx)(lp,{className:`size-4 mr-2`}),`Theme`]}),(0,S.jsx)($l,{children:(0,S.jsxs)(Zl,{value:p,onValueChange:e=>m(e),children:[(0,S.jsxs)(ru,{value:`light`,children:[(0,S.jsx)(Pp,{className:`size-4 mr-2`}),`Light`]}),(0,S.jsxs)(ru,{value:`dark`,children:[(0,S.jsx)(up,{className:`size-4 mr-2`}),`Dark`]}),(0,S.jsxs)(ru,{value:`system`,children:[(0,S.jsx)(lp,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,S.jsx)(au,{}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(fIe,{className:`h-4 w-4 mr-2`}),`GitHub`]})}),(0,S.jsx)(tu,{asChild:!0,children:(0,S.jsxs)(`a`,{href:`https://github.com/mcp-use/mcp-use/issues/new?labels=inspector&template=bug_report.md&title=%5BInspector%5D+`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,S.jsx)(Cf,{className:`size-4 mr-2`}),`Report a Bug`]})})]})]}),f.chatApiUrl?(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(HIe,{chatApiUrl:f.chatApiUrl,onUserResolved:e=>D(!!e),fallback:(0,S.jsx)(`span`,{className:`[@media(min-width:1400px)]:hidden`,children:(0,S.jsx)(X9,{state:`expanded`})})}),(0,S.jsx)(`span`,{className:`hidden [@media(min-width:1400px)]:block`,children:(0,S.jsx)(X9,{state:`expanded`})})]}):(0,S.jsx)(X9,{state:`expanded`})]})]})]})}function iLe({children:e}){let t=aM(),n=nM(),{servers:r,addServer:i,removeServer:a,updateServerMetadata:o,updateServer:s,storageLoaded:c}=yj(),l=(0,w.useCallback)((e,t,n,r)=>{i(e,{url:e,name:t,proxyConfig:n,transportType:r,preventAutoAuth:!0,useRedirectFlow:!0,clientOptions:{capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}}})},[i]),u=(0,w.useCallback)(async(e,t)=>{try{await s(e,t)}catch(t){console.error(`[Layout] Failed to update connection ${e}:`,t)}},[s]),d=(0,w.useCallback)(async(e,t)=>{try{await o(e,t)}catch(t){console.error(`[Layout] Failed to update connection metadata for ${e}:`,t)}},[o]),{selectedServerId:f,setSelectedServerId:p,activeTab:m,setActiveTab:h,navigateToItem:g,setTunnelUrl:_,tunnelUrl:v,isEmbedded:y,embeddedConfig:b,setEmbeddedMode:x}=qq(),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(null),O=fwe();(0,w.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)}x(!0,e),e.defaultTab&&h(e.defaultTab)}},[]),(0,w.useEffect)(()=>{_(new URLSearchParams(n.search).get(`tunnelUrl`))},[n.search,_]),(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tab`);e&&[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`].includes(e)&&h(e)},[n.search,h]);let k=(0,w.useRef)(null),A=(0,w.useRef)(Date.now()),j=(0,w.useRef)(new Set),M=(0,w.useRef)(0);(0,w.useEffect)(()=>{let e=()=>{M.current++};return window.addEventListener(`mcp-tool-executed`,e),()=>window.removeEventListener(`mcp-tool-executed`,e)},[]),(0,w.useEffect)(()=>{let e=()=>{try{let e=Math.round((Date.now()-A.current)/1e3);of.getInstance().capture(new Qd({durationSeconds:e,tabsVisited:j.current.size,toolsExecuted:M.current})).catch(()=>{})}catch{}};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let N=(0,w.useCallback)(e=>{try{of.getInstance().capture(new Xd({tab:e,previousTab:k.current})).catch(()=>{})}catch{}k.current=e,j.current.add(e),h(e);let r=new URLSearchParams(n.search);r.set(`tab`,e),t(`/?${r.toString()}`,{replace:!0})},[h,t,n.search]);(0,w.useEffect)(()=>{let e=e=>{let t=e.detail.requestId;f&&g(f,`sampling`,t)},t=e=>{let t=e.detail.requestId;f&&g(f,`elicitation`,t)},n=e=>{let t=e.detail.toolName;f&&t?g(f,`tools`,t):f&&N(`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)}},[f,N,g]);let P=(0,w.useRef)(null),F=(0,w.useRef)(null),I=(0,w.useRef)(null),{isAutoConnecting:L}=dwe({connections:r,addConnection:l,removeConnection:a,configLoaded:c,embedded:y}),ee=(0,w.useCallback)(e=>{of.getInstance().capture(new Gd({trigger:e})).catch(()=>{}),T(!0)},[]),te=e=>{let i=r.find(t=>t.id===e);if(!i||i.state!==`ready`){BM.error(`Server is not connected and cannot be inspected`);return}p(e);let a=new URLSearchParams(n.search),o=a.get(`tunnelUrl`),s=a.get(`tab`),c=new URLSearchParams;c.set(`server`,e),o&&c.set(`tunnelUrl`,o),s&&c.set(`tab`,s),t(`/?${c.toString()}`)},ne=(0,w.useCallback)(e=>{D(e)},[]),R=(0,w.useCallback)(e=>{if(!E)return;let t=xj(E)||r.find(e=>e.id===E);e.url===E?t&&Cj(t,e)?d(E,{name:e.name||e.url}):u(E,{name:e.name,proxyConfig:e.proxyConfig,transportType:e.transportType}):(a(E),l(e.url,e.name,e.proxyConfig,e.transportType)),D(null),BM.success(`Connection settings updated`)},[E,r,a,l,d,u]),z=(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`),BM.error(`Server is not connected and cannot be inspected`);return}console.warn(`[Layout] Calling navigateToItem:`,{serverId:a,tab:e,itemName:i}),g(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),N(e)},B=r.find(e=>e.id===f),re=B?B.tools.map(e=>({...e,_serverId:B.id})):r.flatMap(e=>e.state===`ready`?e.tools.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]),ie=B?B.prompts.map(e=>({...e,_serverId:B.id})):r.flatMap(e=>e.state===`ready`?e.prompts.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]),ae=B?B.resources.map(e=>({...e,_serverId:B.id})):r.flatMap(e=>e.state===`ready`?e.resources.map(t=>({...t,_serverId:e.id,_serverName:e.name})):[]);(0,w.useEffect)(()=>{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!==f&&p(i)},[n.search,f,p,r,t]),(0,w.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`server`);if(!e)return;let i=r.find(t=>t.id===e);if(!i){let e=setTimeout(()=>t(`/`),3e3);return()=>clearTimeout(e)}if(i.state===`failed`){let e=setTimeout(()=>t(`/`),2e3);return()=>clearTimeout(e)}},[n.search,t,r]),(0,w.useEffect)(()=>{if(!y)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,i=e.name??`Server`,a=e.transportType??`http`,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={proxyAddress:`${window.location.origin}/inspector/api/proxy`,...Object.keys(o).length>0&&{headers:o}};r.find(e=>e.url===t)||l(t,i,s,a),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)},[y,r,l]);let oe=(0,w.useRef)(!1);if((0,w.useEffect)(()=>{if(!y||oe.current||f)return;let e=r.find(e=>e.state===`ready`);if(e){oe.current=!0,p(e.id);let r=new URLSearchParams(n.search);r.set(`server`,e.id),t(`/?${r.toString()}`,{replace:!0})}},[y,r,f,p,t,n.search]),Xq({onCommandPalette:()=>ee(`keyboard`),onToolsTab:()=>{B&&N(`tools`)},onPromptsTab:()=>{B&&N(`prompts`)},onResourcesTab:()=>{B&&N(`resources`)},onChatTab:()=>{B&&N(`chat`)},onHome:()=>{t(`/`)},onFocusSearch:()=>{m===`tools`&&P.current?P.current.focusSearch():m===`prompts`&&F.current?F.current.focusSearch():m===`resources`&&I.current&&I.current.focusSearch()},onBlurSearch:()=>{m===`tools`&&P.current?P.current.blurSearch():m===`prompts`&&F.current?F.current.blurSearch():m===`resources`&&I.current&&I.current.blurSearch()}}),L)return(0,S.jsx)(`div`,{className:`h-screen bg-white dark:bg-zinc-900 flex items-center justify-center`,children:(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,S.jsx)(Uq,{className:`h-8 w-8 text-zinc-600 dark:text-zinc-400`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Connecting to MCP server...`})]})});let se=y&&b.singleTab,ce=y?{backgroundColor:b.backgroundColor||`#f3f3f3`,padding:se?`0`:b.padding||`0.5rem`}:{};return(0,S.jsx)(Nd,{children:(0,S.jsxs)(`div`,{className:y?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 px-2 py-2 sm:px-4 sm:py-4 gap-2 sm:gap-4`,style:ce,children:[!se&&(0,S.jsx)(rLe,{connections:r,selectedServer:B,activeTab:m,onServerSelect:te,onTabChange:N,onCommandPaletteOpen:()=>ee(`button`),onOpenConnectionOptions:ne,embedded:y}),(0,S.jsx)(`main`,{className:se?`flex-1 w-full bg-white dark:bg-black p-0 overflow-auto`:`flex-1 w-full mx-auto bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 p-0 overflow-auto`,children:(0,S.jsx)(dIe,{selectedServer:B,activeTab:m,toolsSearchRef:P,promptsSearchRef:F,resourcesSearchRef:I,children:e})}),(0,S.jsx)(Wwe,{isOpen:C,onOpenChange:T,tools:re,prompts:ie,resources:ae,savedRequests:O,connections:r,selectedServer:B,tunnelUrl:v,onNavigate:z,onServerSelect:te}),(0,S.jsx)(WV,{connection:E&&r.find(e=>e.id===E)||null,open:E!==null,onOpenChange:e=>{e||D(null)},onConnect:R})]})})}function $9(e){let t=a(()=>{throw Error(`Invalid url to pass to open(): ${e}`)},`abort`),n;try{n=new URL(e)}catch{t()}return n.protocol!==`https:`&&n.protocol!==`http:`&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&=encodeURIComponent(n.username),n.password&&=encodeURIComponent(n.password),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi,`/`),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(aLe).join(`&`),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}a($9,`sanitizeUrl`);function aLe([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:``}`}a(aLe,`sanitizeParam`);async function oLe(e){return typeof e==`string`?e:e instanceof URLSearchParams||e instanceof FormData?Object.fromEntries(e.entries()):e instanceof Blob?await e.text():e}a(oLe,`serializeBody`);var sLe=class{static{a(this,`BrowserOAuthClientProvider`)}serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;logoUri;callbackUrl;preventAutoAuth;useRedirectFlow;oauthProxyUrl;connectionUrl;originalFetch;pendingCodeVerifier=null;_lastOriginalResource=null;_cachedAuthServerUrl=null;_cachedMetadata=null;_refreshPromise=null;onPopupWindow;constructor(e,t={}){this.serverUrl=e,this.storageKeyPrefix=t.storageKeyPrefix||`mcp:auth`,this.serverUrlHash=this.hashString(e),this.clientName=t.clientName||`mcp-use`,this.clientUri=t.clientUri||(typeof window<`u`?window.location.origin:``),this.logoUri=t.logoUri||`https://mcp-use.com/logo.png`,this.callbackUrl=$9(t.callbackUrl||(typeof window<`u`?new URL(`/oauth/callback`,window.location.origin).toString():`/oauth/callback`)),this.preventAutoAuth=t.preventAutoAuth,this.useRedirectFlow=t.useRedirectFlow,this.oauthProxyUrl=t.oauthProxyUrl,this.connectionUrl=t.connectionUrl,this.onPopupWindow=t.onPopupWindow}installFetchInterceptor(){if(!this.oauthProxyUrl){console.warn(`[BrowserOAuthProvider] No OAuth proxy URL configured, skipping fetch interceptor installation`);return}if(!this.originalFetch)this.originalFetch=window.fetch;else{console.warn(`[BrowserOAuthProvider] Fetch interceptor already installed`);return}let e=this.oauthProxyUrl,t=this.connectionUrl,n=this.serverUrl,r=this.originalFetch;console.log(`[BrowserOAuthProvider] Installing fetch interceptor with proxy: ${e}`),window.fetch=async(i,a)=>{let o=typeof i==`string`?i:i instanceof URL?i.toString():i.url;if(!(o.includes(`/.well-known/`)||o.match(/\/(register|token|authorize)$/)))return await r(i,a);try{let t=new URL(o),n=new URL(e);if(t.origin===n.origin&&(t.pathname.startsWith(n.pathname)||o.includes(`/inspector/api/oauth`)))return await r(i,a)}catch{}try{let i=o.includes(`/.well-known/`),s=i?`${e}/metadata?url=${encodeURIComponent(o)}`:`${e}/proxy`;if(console.log(`[OAuth Proxy] Routing ${i?`metadata`:`request`} through: ${s}`),i){let e={...a?.headers?Object.fromEntries(new Headers(a.headers)):{}};t&&(e[`X-Connection-URL`]=t);let i=new URL(s);n&&i.searchParams.set(`mcp_url`,n);let o=await r(i.toString(),{...a,method:`GET`,headers:e});try{if((o.headers.get(`content-type`)||``).includes(`application/json`)){let e=await o.clone().json(),t=e&&typeof e==`object`&&typeof e._original_resource==`string`?e._original_resource:null;t&&(this._lastOriginalResource=t)}}catch{}return o}let c=a?.body?await oLe(a.body):void 0,l=await(await r(s,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:o,method:a?.method||`POST`,headers:a?.headers?Object.fromEntries(new Headers(a.headers)):{},body:c})})).json();return new Response(JSON.stringify(l.body),{status:l.status,statusText:l.statusText,headers:new Headers(l.headers)})}catch(e){return console.error(`[OAuth Proxy] Request failed, falling back to direct fetch:`,e),await r(i,a)}}}restoreFetch(){this.originalFetch&&=(console.log(`[BrowserOAuthProvider] Restoring original fetch`),window.fetch=this.originalFetch,void 0)}get redirectUrl(){return $9(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:this.clientName,client_uri:this.clientUri,logo_uri:this.logoUri}}async clientInformation(){let e=this.getKey(`client_info`),t=localStorage.getItem(e);if(t)try{let n=JSON.parse(t),r=Array.isArray(n.redirect_uris)?n.redirect_uris:[];if(!(r.length===0||r.includes(this.redirectUrl))){console.info(`[${this.storageKeyPrefix}] Invalidating cached OAuth client info due to redirect URI mismatch.`),localStorage.removeItem(e),localStorage.removeItem(this.getKey(`tokens`)),localStorage.removeItem(this.getKey(`last_auth_url`));return}return n}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,t),localStorage.removeItem(e);return}}async saveClientInformation(e){let t=this.getKey(`client_info`);localStorage.setItem(t,JSON.stringify(e))}async tokens(){let e=this.getKey(`tokens`),t=localStorage.getItem(e);if(t)try{let e=JSON.parse(t);if(e.access_token&&e.refresh_token)try{let t=JSON.parse(atob(e.access_token.split(`.`)[1]));if(t.exp&&Date.now()>=(t.exp-30)*1e3){console.log(`[tokens] Access token expiring soon, refreshing...`);let t=await this._dedupedRefresh(e);if(t)return console.log(`[tokens] Refreshed successfully`),t}}catch{}return e}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,t),localStorage.removeItem(e);return}}async saveTokens(e){let t=this.getKey(`tokens`);localStorage.setItem(t,JSON.stringify(e)),localStorage.removeItem(this.getKey(`code_verifier`)),localStorage.removeItem(this.getKey(`last_auth_url`)),this.pendingCodeVerifier=null}async _refresh(e){try{if(!this._cachedAuthServerUrl||!this._cachedMetadata){let e=(await Mk(this.serverUrl)).authorization_servers?.[0];if(!e)return null;let t=await Fk(e);if(!t)return null;this._cachedAuthServerUrl=e,this._cachedMetadata=t}let t=await this.clientInformation();if(!t)return null;let n=await Lk(this._cachedAuthServerUrl,{metadata:this._cachedMetadata,clientInformation:t,refreshToken:e.refresh_token});return await this.saveTokens(n),n}catch{return null}}async _dedupedRefresh(e){if(this._refreshPromise)return this._refreshPromise;this._refreshPromise=this._refresh(e);try{return await this._refreshPromise}finally{this._refreshPromise=null}}async invalidateCredentials(e){switch(e){case`all`:localStorage.removeItem(this.getKey(`tokens`)),localStorage.removeItem(this.getKey(`client_info`)),localStorage.removeItem(this.getKey(`code_verifier`)),localStorage.removeItem(this.getKey(`last_auth_url`)),this.pendingCodeVerifier=null;break;case`client`:localStorage.removeItem(this.getKey(`client_info`));break;case`tokens`:localStorage.removeItem(this.getKey(`tokens`));break;case`verifier`:localStorage.removeItem(this.getKey(`code_verifier`)),this.pendingCodeVerifier=null;break;default:break}}async saveCodeVerifier(e){let t=this.getKey(`code_verifier`);localStorage.setItem(t,e),this.pendingCodeVerifier=e}async codeVerifier(){let e=this.getKey(`code_verifier`),t=localStorage.getItem(e);if(!t)throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async prepareAuthorizationUrl(e){let t=e.searchParams.get(`resource`),n=!!(t&&(t.includes(`/inspector/api/proxy`)||t.includes(`/api/proxy`)||t.includes(`localhost:3000`))),r=!!(t&&this.connectionUrl&&t===this.connectionUrl),i=!!(t&&(this._lastOriginalResource||this.serverUrl)&&(r||n)),a=this._lastOriginalResource||this.serverUrl;i&&a&&e.searchParams.set(`resource`,a);let o=globalThis.crypto.randomUUID(),s=`${this.storageKeyPrefix}:state_${o}`,c=this.pendingCodeVerifier||localStorage.getItem(this.getKey(`code_verifier`)),l={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,codeVerifier:c||void 0,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl,oauthProxyUrl:this.oauthProxyUrl,connectionUrl:this.connectionUrl},flowType:this.useRedirectFlow?`redirect`:`popup`,returnUrl:typeof window<`u`?window.location.href:void 0};console.log(`[OAuth] Storing state key: ${s}`),localStorage.setItem(s,JSON.stringify(l));let u=localStorage.getItem(s);console.log(`[OAuth] State stored successfully: ${!!u}`),e.searchParams.set(`state`,o);let d=$9(e.toString());return localStorage.setItem(this.getKey(`last_auth_url`),d),d}async redirectToAuthorization(e){let t=await this.prepareAuthorizationUrl(e);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=t;return}let n=`width=600,height=700,resizable=yes,scrollbars=yes,status=yes`;try{let e=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,e),!e||e.closed||e.closed===void 0?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(e.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(e){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,e)}}getLastAttemptedAuthUrl(){let e=localStorage.getItem(this.getKey(`last_auth_url`));return e?$9(e):null}clearStorage(){let e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[],r=0;for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{let e=localStorage.getItem(i);e&&JSON.parse(e).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(e){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,e)}}}return[...new Set(n)].forEach(e=>{localStorage.removeItem(e),r++}),r}hashString(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}};async function cLe(){let e=new URLSearchParams(window.location.search),t=e.get(`code`),n=e.get(`state`),r=e.get(`error`),i=e.get(`error_description`),a=`[mcp-callback]`;console.log(`${a} Handling callback...`,{code:t,state:n,error:r,errorDescription:i});let o=null,s=null,c=null;try{if(r)throw Error(`OAuth error: ${r} - ${i||`No description provided.`}`);if(!t)throw Error(`Authorization code not found in callback query parameters.`);if(!n)throw Error(`State parameter not found or invalid in callback query parameters.`);console.log(`[mcp-callback] Looking for state: ${n}`),console.log(`[mcp-callback] All localStorage keys:`,Object.keys(localStorage));let e=`mcp:auth:state_${n}`;if(localStorage.getItem(e))c=e,console.log(`[mcp-callback] Found state with default key: ${e}`);else{let e=`:state_${n}`;for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n&&n.endsWith(e)){c=n,console.log(`[mcp-callback] Found state with dynamic key: ${n}`);break}}}if(!c){let e=Object.keys(localStorage).filter(e=>e.includes(`state`));throw console.log(`[mcp-callback] State keys in storage:`,e),Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`)}let l=localStorage.getItem(c);if(!l)throw Error(`Invalid or expired state parameter "${n}". No matching state found in storage.`);try{s=JSON.parse(l)}catch{throw Error(`Failed to parse stored OAuth state.`)}if(!s.expiry||s.expiry<Date.now())throw localStorage.removeItem(c),Error(`OAuth state has expired. Please try initiating authentication again.`);if(!s.providerOptions)throw Error(`Stored state is missing required provider options.`);let{serverUrl:u,...d}=s.providerOptions,f=d.connectionUrl,p=!!(f&&/run\.mcp-use\.com|mcp-use\.run/.test(f)),m=p?f:void 0,h=d.oauthProxyUrl,g=m;if(!h&&g)try{let e=new URL(window.location.href);if(e.pathname.includes(`/oauth/callback`)){let t=e.pathname.replace(/\/oauth\/callback.*$/,``);(!t||t===``)&&(/run\.mcp-use\.com|mcp-use\.run/.test(g)?console.log(`${a} Gateway connection detected; skipping default /inspector OAuth proxy inference`):(t=`/inspector`,console.log(`${a} Callback at root /oauth/callback, using /inspector as base path for OAuth proxy`))),t&&(h=`${e.origin}${t}/api/oauth`),console.log(`${a} Inferred OAuth proxy URL from callback: ${h}`)}}catch(e){console.warn(`${a} Could not infer OAuth proxy URL:`,e)}console.log(`${a} Re-instantiating provider for server: ${u}`),o=new sLe(u,{...d,oauthProxyUrl:h,connectionUrl:g});let _=`${d.storageKeyPrefix}_${s.serverUrlHash}_code_verifier`,v=s.codeVerifier||localStorage.getItem(_);if(v)localStorage.setItem(_,v),localStorage.setItem(o.getKey(`code_verifier`),v);else throw Error(`[${d.storageKeyPrefix}] Code verifier missing for OAuth state ${n}. Please restart authentication.`);h&&(console.log(`${a} Installing fetch interceptor for token exchange (proxy: ${h})`),o.installFetchInterceptor()),console.log(`${a} Calling SDK auth() to exchange code...`);let y=p&&g?g:u;console.log(`${a} Using SDK serverUrl: ${y} (connectionUrl: ${g||`none`})`);let b=await Ok(o,{serverUrl:y,authorizationCode:t});if(b===`AUTHORIZED`)if(console.log(`${a} Authorization successful via SDK auth().`),s.flowType===`redirect`&&s.returnUrl)console.log(`${a} Redirect flow complete. Returning to: ${s.returnUrl}`),localStorage.removeItem(c),window.location.href=s.returnUrl;else if(window.opener&&!window.opener.closed)console.log(`${a} Popup flow complete. Notifying opener...`),window.opener.postMessage({type:`mcp_auth_callback`,success:!0},window.location.origin),localStorage.removeItem(c),window.close();else if(s.returnUrl)console.log(`${a} Popup flow without opener. Returning to: ${s.returnUrl}`),localStorage.removeItem(c),window.location.href=s.returnUrl;else{console.warn(`${a} No opener window or return URL detected. Redirecting to root.`),localStorage.removeItem(c);let e=window.location.pathname.split(`/`).filter(Boolean),t=e.length>0&&e[e.length-1]===`callback`?`/`+e.slice(0,-2).join(`/`):`/`;window.location.href=t||`/`}else throw console.warn(`${a} SDK auth() returned unexpected status: ${b}`),Error(`Unexpected result from authentication library: ${b}`)}catch(e){console.error(`${a} Error during OAuth callback handling:`,e);let t=e instanceof Error?e.message:String(e);window.opener&&!window.opener.closed&&window.opener.postMessage({type:`mcp_auth_callback`,success:!1,error:t},window.location.origin);try{document.body.innerHTML=``;let n=document.createElement(`div`);n.style.fontFamily=`sans-serif`,n.style.padding=`20px`;let r=document.createElement(`h1`);r.textContent=`Authentication Error`,n.appendChild(r);let i=document.createElement(`p`);i.style.color=`red`,i.style.backgroundColor=`#ffebeb`,i.style.border=`1px solid red`,i.style.padding=`10px`,i.style.borderRadius=`4px`,i.textContent=t,n.appendChild(i);let a=document.createElement(`p`);a.textContent=`You can close this window or `;let o=document.createElement(`a`);if(o.href=`#`,o.textContent=`click here to close`,o.onclick=e=>(e.preventDefault(),window.close(),!1),a.appendChild(o),a.appendChild(document.createTextNode(`.`)),n.appendChild(a),e instanceof Error&&e.stack){let t=document.createElement(`pre`);t.style.fontSize=`0.8em`,t.style.color=`#555`,t.style.marginTop=`20px`,t.style.whiteSpace=`pre-wrap`,t.textContent=e.stack,n.appendChild(t)}document.body.appendChild(n)}catch(e){console.error(`${a} Could not display error in callback window:`,e)}c&&localStorage.removeItem(c),o&&localStorage.removeItem(o.getKey(`last_auth_url`))}}a(cLe,`onMcpAuthorization`);async function lLe(e,t=fetch){let n=e.replace(/\/$/,``),r=await t(n.endsWith(`/mcp`)?n:`${n}/mcp`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jsonrpc:`2.0`,method:`initialize`,id:1,params:{}})});if(r.status!==401)return{};let{resourceMetadataUrl:i,scope:a}=Ak(r);return{resourceMetadataUrl:i,scope:a}}a(lLe,`probeAuthParams`);function uLe(){let[e,t]=(0,w.useState)(`processing`),[n,r]=(0,w.useState)(``);return(0,w.useEffect)(()=>{console.log(`[OAuthCallback] Component mounted, handling authorization...`),console.log(`[OAuthCallback] Current URL:`,window.location.href),cLe().then(()=>{console.log(`[OAuthCallback] Authorization successful`),t(`success`)}).catch(e=>{console.error(`[OAuthCallback] Authorization failed:`,e),t(`error`),r(e instanceof Error?e.message:String(e))})},[]),e===`processing`?(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,S.jsx)(rp,{className:`h-8 w-8 animate-spin text-zinc-600 dark:text-zinc-400`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Completing authentication...`})]})}):e===`error`?(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`max-w-md p-6`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold text-red-600 dark:text-red-400 mb-2`,children:`Authentication Error`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400 mb-4`,children:n}),(0,S.jsx)(`p`,{className:`text-xs text-zinc-500 dark:text-zinc-500`,children:`You can close this window and try again.`})]})}):(0,S.jsx)(`div`,{className:`h-screen w-full flex items-center justify-center bg-white dark:bg-zinc-900`,children:(0,S.jsxs)(`div`,{className:`max-w-md p-6`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold text-green-600 dark:text-green-400 mb-2`,children:`Authentication Successful!`}),(0,S.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Redirecting you back...`})]})})}var dLe=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},fLe=w.createContext(void 0),pLe={setTheme:e=>{},themes:[]},mLe=()=>w.useContext(fLe)??pLe;w.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return w.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${dLe.toString()})(${u})`}})});function hLe({...e}){let{theme:t=`system`}=mLe();return(0,S.jsx)(Qme,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}function gLe({activeTabRef:e}){let{activeTab:t}=qq();return(0,w.useEffect)(()=>{e.current=t},[t,e]),null}function _Le(){let e=(0,w.useRef)(`tools`),t=new URLSearchParams(window.location.search),n=t.get(`embedded`)===`true`,r=t.get(`theme`),i=(0,w.useMemo)(()=>n?void 0:new Gfe(`mcp-inspector-connections`),[n]),a=window.__MCP_PROXY_URL__,o=a?`${window.location.origin}${a}`:void 0;return(0,S.jsx)(age,{forcedTheme:r||void 0,children:(0,S.jsx)(UEe,{children:(0,S.jsx)(vj,{storageProvider:i,enableRpcLogging:!0,defaultCallbackUrl:`${window.location.origin}/inspector/oauth/callback`,defaultAutoProxyFallback:o?{enabled:!0,proxyAddress:o}:!1,clientInfo:{name:`mcp-use Inspector`,version:window.__INSPECTOR_VERSION__,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=BM((0,S.jsx)(tFe,{requestId:e.id,serverName:n,onViewDetails:()=>{let t=new CustomEvent(`navigate-to-sampling`,{detail:{requestId:e.id}});window.dispatchEvent(t),BM.dismiss(a)},onApprove:t=>{r(e.id,t),BM.success(`Sampling request approved`),BM.dismiss(a)},onDeny:()=>{i(e.id,`User denied from toast`),BM.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=BM((0,S.jsx)(C,{requestId:t.id,serverName:r,mode:o,message:s,url:c,onViewDetails:()=>{let e=new CustomEvent(`navigate-to-elicitation`,{detail:{requestId:t.id}});window.dispatchEvent(e),BM.dismiss(l)},onOpenUrl:o===`url`&&c?()=>{window.open(c,`_blank`),BM.dismiss(l)}:void 0,onCancel:()=>{a(t.id,`User cancelled from toast`),BM.dismiss(l)}}),{duration:1/0})},children:(0,S.jsxs)(uwe,{children:[(0,S.jsx)(gLe,{activeTabRef:e}),(0,S.jsx)(gme,{basename:`/inspector`,children:(0,S.jsxs)(Upe,{children:[(0,S.jsx)(gM,{path:`/oauth/callback`,element:(0,S.jsx)(uLe,{})}),(0,S.jsx)(gM,{path:`/`,element:(0,S.jsx)(iLe,{children:(0,S.jsx)(lwe,{})})})]})}),(0,S.jsx)(hLe,{position:`top-center`})]})})})})}var vLe=document.getElementById(`root`);vLe?x.createRoot(vLe).render((0,S.jsx)(_Le,{})):console.error(`[inspector] Root element not found`);