dexto 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +270 -160
- package/agents/agent-registry.json +16 -2
- package/agents/agent-template.yml +6 -12
- package/agents/default-agent.yml +6 -16
- package/agents/nano-banana-agent/README.md +200 -0
- package/agents/nano-banana-agent/nano-banana-agent.yml +68 -0
- package/agents/podcast-agent/README.md +168 -0
- package/agents/podcast-agent/podcast-agent.yml +167 -0
- package/agents/triage-demo/billing-agent.yml +2 -2
- package/agents/triage-demo/product-info-agent.yml +2 -3
- package/agents/triage-demo/technical-support-agent.yml +2 -3
- package/dist/src/app/{chunk-OIBH674O.js → chunk-BKF5BGLX.js} +318 -35
- package/dist/src/app/{chunk-FVWAYUL4.js → chunk-N7FUUBGT.js} +1 -1
- package/dist/src/app/{chunk-UG5P4DIL.js → chunk-OONTQZRM.js} +2 -2
- package/dist/src/app/{cli-confirmation-handler-7BZ6BMSE.js → cli-confirmation-handler-7235V7GL.js} +1 -1
- package/dist/src/app/{errors-EYGUMLKB.js → errors-YCS63OK6.js} +1 -1
- package/dist/src/app/index.js +19 -8
- package/dist/src/app/{loader-LJJQ4NDP.js → loader-PVRMNHST.js} +2 -2
- package/dist/src/app/{path-O5L5AW7V.js → path-DJ5C7EUS.js} +1 -1
- package/dist/src/app/{registry-HIVAEL5E.js → registry-KOOLQYP4.js} +3 -3
- package/dist/src/app/{sqlite-backend-FK7U4D6Z.js → sqlite-backend-NCFS7FN6.js} +1 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/{layout-43f98b6d34953fcf.js → layout-36c240720861a312.js} +1 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
- package/dist/src/app/webui/.next/{static/chunks/app/playground/page-c51bb3cc58225dc3.js → standalone/.next/static/chunks/app/playground/page-07a79d22b26d37f4.js} +1 -1
- package/dist/src/app/webui/.next/standalone/.next/static/css/c1d26dc78adbeb53.css +3 -0
- package/dist/src/app/webui/.next/standalone/package.json +3 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/BUILD_ID +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/app-build-manifest.json +9 -9
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/build-manifest.json +2 -2
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/prerender-manifest.json +3 -3
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/required-server-files.json +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page.js +3 -4
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page.js.nft.json +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page.js +2 -2
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page.js.nft.json +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/app/playground/page_client-reference-manifest.js +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/213.js +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/489.js +1 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/pages/500.html +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/server-reference-manifest.json +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/app/{layout-43f98b6d34953fcf.js → layout-36c240720861a312.js} +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
- package/dist/src/app/webui/.next/standalone/{.next/static/chunks/app/playground/page-c51bb3cc58225dc3.js → src/app/webui/.next/static/chunks/app/playground/page-07a79d22b26d37f4.js} +1 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/css/c1d26dc78adbeb53.css +3 -0
- package/dist/src/app/webui/.next/standalone/src/app/webui/server.js +1 -1
- package/dist/src/app/webui/.next/static/chunks/122-4d4c8aa883d114a2.js +1 -0
- package/dist/src/app/webui/.next/static/chunks/216-f5dbf2145a48ae92.js +1 -0
- package/dist/src/app/webui/.next/static/chunks/43-4f3d01c7feaf132f.js +1 -0
- package/dist/src/app/webui/.next/static/chunks/app/{layout-43f98b6d34953fcf.js → layout-36c240720861a312.js} +1 -1
- package/dist/src/app/webui/.next/static/chunks/app/page-ca08c66042cb54c8.js +1 -0
- package/dist/src/app/webui/.next/{standalone/src/app/webui/.next/static/chunks/app/playground/page-c51bb3cc58225dc3.js → static/chunks/app/playground/page-07a79d22b26d37f4.js} +1 -1
- package/dist/src/app/webui/.next/static/css/c1d26dc78adbeb53.css +3 -0
- package/dist/src/core/{chunk-2O5JENNA.js → chunk-XABD32T2.js} +318 -35
- package/dist/src/core/index.cjs +320 -35
- package/dist/src/core/index.d.cts +3 -0
- package/dist/src/core/index.d.ts +3 -0
- package/dist/src/core/index.js +1 -1
- package/dist/src/core/{sqlite-backend-4KSJRUVL.js → sqlite-backend-3VNBKYIT.js} +1 -1
- package/package.json +3 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/262-807eb8fa558ce992.js +0 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/42-ae0665ff0534f075.js +0 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/500-99efaae6ea436094.js +0 -1
- package/dist/src/app/webui/.next/standalone/.next/static/chunks/app/page-77c27b87857033eb.js +0 -1
- package/dist/src/app/webui/.next/standalone/.next/static/css/3d91ad5ec330296f.css +0 -3
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/server/chunks/950.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/262-807eb8fa558ce992.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/42-ae0665ff0534f075.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/500-99efaae6ea436094.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/chunks/app/page-77c27b87857033eb.js +0 -1
- package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/css/3d91ad5ec330296f.css +0 -3
- package/dist/src/app/webui/.next/static/chunks/262-807eb8fa558ce992.js +0 -1
- package/dist/src/app/webui/.next/static/chunks/42-ae0665ff0534f075.js +0 -1
- package/dist/src/app/webui/.next/static/chunks/500-99efaae6ea436094.js +0 -1
- package/dist/src/app/webui/.next/static/chunks/app/page-77c27b87857033eb.js +0 -1
- package/dist/src/app/webui/.next/static/css/3d91ad5ec330296f.css +0 -3
- /package/dist/src/app/webui/.next/standalone/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_buildManifest.js +0 -0
- /package/dist/src/app/webui/.next/standalone/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_ssgManifest.js +0 -0
- /package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_buildManifest.js +0 -0
- /package/dist/src/app/webui/.next/standalone/src/app/webui/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_ssgManifest.js +0 -0
- /package/dist/src/app/webui/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_buildManifest.js +0 -0
- /package/dist/src/app/webui/.next/static/{sig2NLqxammCphOh8eQRQ → RkBbxCa0lrWNsf3yPd4rX}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{2390:(e,t,s)=>{"use strict";s.d(t,{default:()=>tE});var r,a=s(5155),n=s(2115),i=s(4043),l=s(5016),o=s(6855),c=s(2056),d=s(2108),m=s(4033),u=s(5229),x=s(5917),h=s(5426),p=s(2758);function f(e){let{delayDuration:t=0,...s}=e;return(0,a.jsx)(p.Kq,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function g(e){let{...t}=e;return(0,a.jsx)(f,{children:(0,a.jsx)(p.bL,{"data-slot":"tooltip",...t})})}function v(e){let{...t}=e;return(0,a.jsx)(p.l9,{"data-slot":"tooltip-trigger",...t})}function j(e){let{className:t,sideOffset:s=0,children:r,...n}=e;return(0,a.jsx)(p.ZL,{children:(0,a.jsxs)(p.UC,{"data-slot":"tooltip-content",sideOffset:s,className:(0,l.cn)("bg-primary text-primary-foreground 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",t),...n,children:[r,(0,a.jsx)(p.i3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var b=s(7003);let y=(0,n.forwardRef)((e,t)=>{let{children:s,tooltip:r,side:n="bottom",className:i,...o}=e;return(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)(b.$,{variant:"ghost",size:"icon",...o,className:(0,l.cn)("size-6 p-1",i),ref:t,children:[s,(0,a.jsx)("span",{className:"sr-only",children:r})]})}),(0,a.jsx)(j,{side:n,children:r})]})});function N(e){let{value:t,tooltip:s="Copy",copiedTooltip:r="Copied!",className:i,size:l=12}=e,[o,c]=(0,n.useState)(!1);return(0,a.jsx)(y,{tooltip:o?r:s,onClick:()=>{navigator.clipboard.writeText(t).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)}).catch(()=>{})},className:i,children:o?(0,a.jsx)(x.A,{size:l}):(0,a.jsx)(h.A,{size:l})})}y.displayName="TooltipIconButton";var w=s(9e3),k=s(5130);class C{get supported(){return"speechSynthesis"in window&&"SpeechSynthesisUtterance"in window}isSpeaking(){return this._speaking}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}subscribeVoices(e){return this.voiceSubscribers.add(e),()=>{this.voiceSubscribers.delete(e)}}notify(){for(let e of this.subscribers)try{e()}catch(e){}}stop(){if(this.supported){try{window.speechSynthesis.cancel()}catch(e){}this.utterance=null,this._speaking&&(this._speaking=!1,this.notify())}}speak(e,t){if(!this.supported||!e||!e.trim())return;this.stop();let s=new window.SpeechSynthesisUtterance(e);(null==t?void 0:t.rate)!=null&&(s.rate=t.rate),(null==t?void 0:t.pitch)!=null&&(s.pitch=t.pitch);let r=this.resolveVoice();if(r)try{s.voice=r,(null==t?void 0:t.lang)?s.lang=t.lang:r.lang&&(s.lang=r.lang)}catch(e){}else(null==t?void 0:t.lang)&&(s.lang=t.lang);s.onstart=()=>{this.utterance===s&&(this._speaking=!0,this.notify())};let a=()=>{this.utterance===s&&(this._speaking=!1,this.utterance=null,this.notify())};s.onend=a,s.onerror=a;try{this.utterance=s,window.speechSynthesis.speak(s),this._speaking||(this._speaking=!0,this.notify())}catch(e){a()}}getVoices(){return this.voices}setPreferredVoice(e){this.preferredVoiceName=e&&e.length?e:null;try{this.preferredVoiceName?window.localStorage.setItem("ttsVoiceName",this.preferredVoiceName):window.localStorage.removeItem("ttsVoiceName")}catch(e){}this.voiceSubscribers.forEach(e=>e())}getPreferredVoiceName(){return this.preferredVoiceName}resolveVoice(){if(!this.voices.length)return null;let e=this.preferredVoiceName?this.voices.find(e=>e.name===this.preferredVoiceName):null;if(e)return e;let t=this.voices.find(e=>{var t;return"google uk english female"===e.name.toLowerCase()||e.name.toLowerCase().includes("google uk english female")&&(null==(t=e.lang)?void 0:t.toLowerCase().startsWith("en-gb"))});if(t)return t;let s=e=>{var t;let s=e.name.toLowerCase(),r=(null!=(t=e.lang)?t:"").toLowerCase(),a=0;return("en"===r||r.startsWith("en-"))&&(a+=3),s.includes("google")&&(a+=5),(s.includes("microsoft")||s.includes("azure"))&&(a+=4),(s.includes("natural")||s.includes("neural")||s.includes("premium"))&&(a+=4),s.includes("siri")&&(a+=3),s.includes("female")&&(a+=1),a};return[...this.voices].sort((e,t)=>s(t)-s(e))[0]||this.voices[0]||null}constructor(){if(this._speaking=!1,this.subscribers=new Set,this.utterance=null,this.voices=[],this.voiceSubscribers=new Set,this.preferredVoiceName=null,this.supported){try{let e=window.localStorage.getItem("ttsVoiceName");this.preferredVoiceName=e&&e.length?e:null}catch(e){}let e=()=>{try{let e=window.speechSynthesis.getVoices()||[];(e.length!==this.voices.length||e.some((e,t)=>{var s;return e.name!==(null==(s=this.voices[t])?void 0:s.name)}))&&(this.voices=e,this.voiceSubscribers.forEach(e=>e()))}catch(e){}};e();try{window.speechSynthesis.addEventListener("voiceschanged",e)}catch(e){}}}}let S=globalThis,A=null!=(r=S.__speechController)?r:S.__speechController=new C;function E(e){let{value:t,tooltip:s="Speak",stopTooltip:r="Stop",className:i,rate:l=1,pitch:o=1,lang:c}=e,[d,m]=(0,n.useState)(!1),u=A.supported,x=(null!=t?t:"").trim().length>0;return(0,n.useEffect)(()=>(m(A.isSpeaking()),A.subscribe(()=>m(A.isSpeaking()))),[]),(0,a.jsx)(y,{tooltip:d?r:s,onClick:()=>{if(u&&x){if(d)return A.stop();A.speak(t,{rate:l,pitch:o,lang:c})}},className:i,disabled:!u||!x,children:d?(0,a.jsx)(w.A,{size:12}):(0,a.jsx)(k.A,{size:12})})}function T(e){var t;let{error:s,onDismiss:r}=e,[i,l]=(0,n.useState)(!1),o=null==(t=s.detailedIssues)?void 0:t[0],x=(null==o?void 0:o.context)&&"object"==typeof o.context&&"detailedIssues"in o.context?o.context.detailedIssues:[],h=x.length>0?"".concat(s.message,"\n\nDetails:\n").concat(x.map(e=>{let t=e.message;if(e.context){let s="string"==typeof e.context?e.context:JSON.stringify(e.context,null,2);t+="\nContext: ".concat(s)}return t}).join("\n\n")):s.message;return(0,a.jsx)("div",{className:"w-full rounded-lg p-4 mb-4 border shadow-sm bg-destructive/10 border-destructive/40",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(c.A,{className:"h-5 w-5 text-destructive mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-destructive",children:"Error"}),s.context&&(0,a.jsx)("span",{className:"text-xs bg-destructive/15 text-destructive px-2 py-0.5 rounded-full",children:s.context})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[x.length>0&&(0,a.jsx)("button",{onClick:()=>l(!i),className:"p-1 hover:bg-destructive/15 rounded text-destructive",title:i?"Collapse":"Expand",children:i?(0,a.jsx)(d.A,{className:"h-4 w-4"}):(0,a.jsx)(m.A,{className:"h-4 w-4"})}),(0,a.jsx)(N,{value:h,tooltip:"Copy error",className:"p-1 hover:bg-destructive/15 rounded text-destructive",size:16}),(0,a.jsx)(E,{value:h,tooltip:"Read error",className:"p-1 hover:bg-destructive/15 rounded text-destructive"}),(0,a.jsx)("button",{onClick:r,className:"p-1 hover:bg-destructive/15 rounded text-destructive",title:"Dismiss",children:(0,a.jsx)(u.A,{className:"h-4 w-4"})})]})]}),(0,a.jsx)("div",{className:"mt-2 text-sm text-destructive",children:s.message}),i&&x.length>0&&(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("div",{className:"text-xs text-destructive bg-destructive/10 p-3 rounded border border-destructive/30 overflow-auto max-h-60",children:x.map((e,t)=>(0,a.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,a.jsx)("div",{className:"font-medium",children:e.message}),null!=e.context&&(0,a.jsx)("div",{className:"text-destructive/70 mt-1",children:"string"==typeof e.context?e.context:JSON.stringify(e.context,null,2)})]},t))})})]})]})})}var I=s(508),R=s(8192),D=s(3842),L=s(1473),P=s(7937),F=s(2529),O=s(5299),z=s(1682),M=s(2001),_=s(2196),U=s(4904),K=s(6504),$=s(4514);let V=(0,n.memo)(e=>{let{children:t}=e;return(0,a.jsx)("div",{className:"prose max-w-none dark:prose-invert [&>p]:my-5 [&>p]:leading-7 [&>p]:first:mt-0 [&>p]:last:mb-0 [&>h1]:mb-8 [&>h1]:text-4xl [&>h1]:font-extrabold [&>h1]:tracking-tight [&>h1]:last:mb-0 [&>h2]:mb-4 [&>h2]:mt-8 [&>h2]:text-3xl [&>h2]:font-semibold [&>h2]:tracking-tight [&>h2]:first:mt-0 [&>h2]:last:mb-0 [&>h3]:mb-4 [&>h3]:mt-6 [&>h3]:text-2xl [&>h3]:font-semibold [&>h3]:tracking-tight [&>h3]:first:mt-0 [&>h3]:last:mb-0 [&>h4]:mb-4 [&>h4]:mt-6 [&>h4]:text-xl [&>h4]:font-semibold [&>h4]:tracking-tight [&>h4]:first:mt-0 [&>h4]:last:mb-0 [&>ul]:my-5 [&>ul]:ml-6 [&>ul]:list-disc [&>ul>li]:mt-2 [&>ol]:my-5 [&>ol]:ml-6 [&>ol]:list-decimal [&>ol>li]:mt-2 [&_ul]:my-5 [&_ul]:ml-6 [&_ul]:list-disc [&_ul>li]:mt-2 [&_ol]:my-5 [&_ol]:ml-6 [&_ol]:list-decimal [&_ol>li]:mt-2 [&>blockquote]:border-l-2 [&>blockquote]:pl-6 [&>blockquote]:italic [&>hr]:my-5 [&>hr]:border-b",children:(0,a.jsx)(K.oz,{remarkPlugins:[$.A],skipHtml:!0,components:{table:e=>{let{className:t,children:s,...r}=e;return(0,a.jsx)("div",{className:"my-4 overflow-x-auto -mx-1 px-1",children:(0,a.jsx)("table",{className:["w-full border-separate border-spacing-0",t].filter(Boolean).join(" "),...r,children:s})})},thead:e=>{let{className:t,...s}=e;return(0,a.jsx)("thead",{className:t,...s})},tr:e=>{let{className:t,...s}=e;return(0,a.jsx)("tr",{className:["m-0 border-b first:border-t","[&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",t].filter(Boolean).join(" "),...s})},th:e=>{let{className:t,...s}=e;return(0,a.jsx)("th",{className:["bg-muted text-left font-bold align-top","px-4 py-2 first:rounded-tl-lg last:rounded-tr-lg","[&[align=center]]:text-center [&[align=right]]:text-right",t].filter(Boolean).join(" "),...s})},td:e=>{let{className:t,...s}=e;return(0,a.jsx)("td",{className:["border-b border-l last:border-r text-left align-top","px-4 py-2 whitespace-normal break-words","[&[align=center]]:text-center [&[align=right]]:text-right",t].filter(Boolean).join(" "),...s})},code:e=>{let{className:t,children:s,...r}=e,[i,l]=(0,n.useState)(!1),o=String(null!=s?s:"").replace(/\n$/,"");return t?(0,a.jsxs)("div",{className:"relative group my-4",children:[(0,a.jsx)(y,{tooltip:i?"Copied!":"Copy code",onClick:()=>{navigator.clipboard.writeText(o).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}).catch(()=>{})},className:"absolute right-2 top-2 z-10 opacity-70 hover:opacity-100 transition-opacity bg-background/80 hover:bg-background",children:i?(0,a.jsx)(x.A,{size:14}):(0,a.jsx)(h.A,{size:14})}),(0,a.jsx)("pre",{className:"overflow-auto bg-muted p-3 rounded-lg text-sm",children:(0,a.jsx)("code",{className:t,children:o})})]}):(0,a.jsx)("code",{className:"text-xs px-1.5 py-0.5 bg-muted rounded font-mono",...r,children:s})}},children:t})})});function q(e){return/^data:image\/(png|jpeg|jpg|gif|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/i.test(e)}function B(e){try{let t=new URL(e);return("https:"===t.protocol||"http:"===t.protocol)&&"localhost"!==t.hostname}catch(e){return!1}}function J(e){var t,s;if(e.base64&&e.mimeType)return"data:".concat(e.mimeType,";base64,").concat(e.base64);if("string"==typeof e.base64)return e.base64;let r=null!=(s=null!=(t=e.url)?t:e.image)?s:e.audio;return"string"==typeof r?r:""}function G(e){let{messages:t,activeError:s,onDismissError:r,outerRef:i}=e,x=(0,n.useRef)(null),[h,p]=(0,n.useState)({}),[f,b]=(0,n.useState)({}),[y,w]=(0,n.useState)(null);(0,n.useRef)(null);let[C,S]=(0,n.useState)({isOpen:!1,src:"",alt:""});if((0,n.useEffect)(()=>{let e=document.createElement("style");return e.textContent="\n .audio-controls-container audio {\n max-width: 100% !important;\n width: 100% !important;\n height: auto !important;\n min-height: 32px;\n }\n .audio-controls-container audio::-webkit-media-controls-panel {\n max-width: 100% !important;\n }\n .audio-controls-container audio::-webkit-media-controls-timeline {\n max-width: 100% !important;\n }\n ",document.head.appendChild(e),()=>{document.head.removeChild(e)}},[]),!t||0===t.length)return null;let A=e=>"string"==typeof e.content?e.content:Array.isArray(e.content)?e.content.map(e=>(0,o.PI)(e)?e.text:"").filter(Boolean).join("\n"):e.content&&"object"==typeof e.content?JSON.stringify(e.content,null,2):"",K=e=>e?(0,o.KU)(e)?"object"==typeof e.error?JSON.stringify(e.error,null,2):String(e.error):(0,o.P2)(e)?e.content.map(e=>(0,o.PI)(e)?e.text:"object"==typeof e?"":String(e)).filter(Boolean).join("\n"):"object"==typeof e?JSON.stringify(e,null,2):String(e):"";return(0,a.jsxs)("div",{id:"message-list-container",ref:i,className:"flex flex-col space-y-3 px-4 py-2",children:[t.map((e,n)=>{var i,u,x,y;let w=null!=(u=e.id)?u:"msg-".concat(n),C="user"===e.role,$="assistant"===e.role,G="system"===e.role,W=n===t.length-1,H=!!(e.toolName&&e.toolArgs),Y=!!(e.toolName&&e.toolResult),Z=H||Y,Q=Z&&W||!!h[w],X=[],ee=[];Y&&e.toolResult&&(0,o.P2)(e.toolResult)&&e.toolResult.content.forEach((e,t)=>{if((0,o.j0)(e)){let s=J(e);s&&(s.startsWith("data:")&&q(s)||s.startsWith("blob:")||B(s))&&X.push({src:s,alt:"Tool result image ".concat(t+1),index:t})}else if((0,o.kz)(e)){let s=J(e);s&&(s.startsWith("data:audio/")||s.startsWith("blob:")||B(s))&&ee.push({src:s,filename:e.filename,index:t})}});let et=C?I.A:R.A,es=(0,l.cn)(C?"grid w-full grid-cols-[1fr_auto] gap-x-2 items-start":"grid w-full grid-cols-[auto_1fr] gap-x-2 items-start"),er=(0,l.cn)("tool"===e.role?"w-full text-muted-foreground/70 bg-secondary border border-muted/30 rounded-md text-base":C?"p-3 rounded-xl shadow-sm w-fit max-w-[75%] bg-primary text-primary-foreground rounded-br-none text-base break-normal hyphens-none":$?"p-3 rounded-xl shadow-sm w-fit max-w-[90%] bg-card text-card-foreground border border-border rounded-bl-none text-base break-normal hyphens-none":G?"p-3 shadow-none w-full bg-transparent text-xs text-muted-foreground italic text-center border-none":""),ea=new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),en=!!(s&&s.anchorMessageId===e.id);return(0,a.jsxs)("div",{className:"w-full","data-role":e.role,id:e.id?"message-".concat(e.id):void 0,children:[(0,a.jsxs)("div",{className:es,children:[$&&(0,a.jsx)(et,{className:"h-7 w-7 mt-1 text-muted-foreground col-start-1"}),"tool"===e.role&&(0,a.jsx)(D.A,{className:"h-7 w-7 p-1 mt-1 rounded-full border border-border text-muted-foreground col-start-1"}),(0,a.jsxs)("div",{className:(0,l.cn)("flex flex-col group w-full",G?"col-span-2 items-center":C?"col-start-1 justify-self-end items-end":"col-start-2 justify-self-start items-start"),children:[(0,a.jsx)("div",{className:er,children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[$&&"string"==typeof e.reasoning&&e.reasoning.trim().length>0&&(0,a.jsxs)("div",{className:"mb-3 border border-orange-200/50 dark:border-orange-400/20 rounded-lg bg-gradient-to-br from-orange-50/30 to-amber-50/20 dark:from-orange-900/20 dark:to-amber-900/10",children:[(0,a.jsxs)("div",{className:"px-3 py-2 border-b border-orange-200/30 dark:border-orange-400/20 bg-orange-100/50 dark:bg-orange-900/30 rounded-t-lg flex items-center justify-between",children:[(0,a.jsxs)("button",{type:"button",className:"flex items-center gap-2 text-xs font-medium text-orange-700 dark:text-orange-300 hover:text-orange-800 dark:hover:text-orange-200 transition-colors group",onClick:()=>b(t=>({...t,[e.id]:!t[e.id]})),children:[(0,a.jsx)(L.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:"AI Reasoning"}),null==(x=f[e.id])||x?(0,a.jsx)(d.A,{className:"h-3 w-3 group-hover:scale-110 transition-transform"}):(0,a.jsx)(m.A,{className:"h-3 w-3 group-hover:scale-110 transition-transform"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(N,{value:e.reasoning,tooltip:"Copy reasoning",copiedTooltip:"Copied!",className:"opacity-70 hover:opacity-100 transition-opacity"}),(0,a.jsx)(E,{value:e.reasoning,tooltip:"Speak reasoning",stopTooltip:"Stop",className:"opacity-70 hover:opacity-100 transition-opacity"})]})]}),(null==(y=f[e.id])||y)&&(0,a.jsx)("div",{className:"px-3 py-2",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words text-xs text-orange-800/80 dark:text-orange-200/70 leading-relaxed font-mono",children:e.reasoning})})]}),e.toolName?(0,a.jsxs)("div",{className:"p-2 rounded border border-border bg-muted/30 hover:bg-muted/60 cursor-pointer w-full",onClick:()=>{Z&&p(e=>({...e,[w]:!e[w]}))},children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs font-medium",children:[(0,a.jsxs)("span",{className:"flex items-center",children:[Q?(0,a.jsx)(d.A,{className:"h-4 w-4 mr-2 text-primary"}):(0,a.jsx)(P.A,{className:"h-4 w-4 mr-2 text-primary"}),"Tool: ",e.toolName]}),e.toolResult?(0,o.KU)(e.toolResult)?(0,a.jsx)(c.A,{className:"mx-2 h-4 w-4 text-red-500"}):(0,a.jsx)(F.A,{className:"mx-2 h-4 w-4 text-green-500"}):(0,a.jsx)(O.A,{className:"mx-2 h-4 w-4 animate-spin text-muted-foreground"})]}),Q&&(0,a.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-medium",children:"Arguments:"}),(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground",children:JSON.stringify(e.toolArgs,null,2)})]}),e.toolResult&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-xs font-medium flex items-center justify-between",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("span",{children:"Result:"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(N,{value:K(e.toolResult),tooltip:"Copy result",copiedTooltip:"Copied!",className:"opacity-70 hover:opacity-100 transition-opacity"}),(0,a.jsx)(E,{value:K(e.toolResult),tooltip:"Speak result",stopTooltip:"Stop",className:"opacity-70 hover:opacity-100 transition-opacity"})]})]}),(0,o.KU)(e.toolResult)?(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-red-100 text-red-700 p-2 rounded text-xs",children:"object"==typeof e.toolResult.error?JSON.stringify(e.toolResult.error,null,2):String(e.toolResult.error)}):(0,o.P2)(e.toolResult)?e.toolResult.content.map((e,t)=>(0,o.j0)(e)||(0,o.kz)(e)?null:(0,o.PI)(e)?(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground my-1",children:e.text},t):(0,o.EQ)(e)?(0,a.jsxs)("div",{className:"my-1 flex items-center gap-2 p-2 rounded border border-border bg-muted/50",children:[(0,a.jsx)(z.A,{className:"h-4 w-4 text-muted-foreground"}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.filename||"File attachment"," (",e.mimeType,")"]})]},t):(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground my-1",children:"object"==typeof e?JSON.stringify(e,null,2):String(e)},t)):(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground",children:"string"==typeof e.toolResult&&e.toolResult.startsWith("data:image")?q(e.toolResult)?(0,a.jsx)("img",{src:e.toolResult,alt:"Tool result image",className:"my-1 max-h-48 w-auto rounded border border-border"}):"Invalid image data":"object"==typeof e.toolResult?JSON.stringify(e.toolResult,null,2):String(e.toolResult)})]})]})]}):(0,a.jsxs)(a.Fragment,{children:["string"==typeof e.content&&""!==e.content.trim()&&(0,a.jsx)("div",{className:"relative",children:C?(0,a.jsx)("p",{className:"text-base whitespace-pre-line break-normal",children:e.content}):(0,a.jsx)(V,{children:e.content})}),e.content&&"object"==typeof e.content&&!Array.isArray(e.content)&&(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words overflow-auto bg-background/50 p-2 rounded text-xs text-muted-foreground",children:JSON.stringify(e.content,null,2)}),Array.isArray(e.content)&&e.content.map((e,t)=>{let s="".concat(w,"-part-").concat(t);if("text"===e.type)return(0,a.jsx)("div",{className:"relative",children:C?(0,a.jsx)("p",{className:"text-base whitespace-pre-line break-normal",children:e.text}):(0,a.jsx)(V,{children:e.text})},s);if((0,o.EQ)(e)){if(!e.mimeType.startsWith("audio/"))return(0,a.jsxs)("div",{className:"my-2 flex items-center gap-2 p-3 rounded-lg border border-border bg-muted/50",children:[(0,a.jsx)(M.A,{className:(0,l.cn)("h-5 w-5",C?void 0:"text-muted-foreground")}),(0,a.jsx)("span",{className:(0,l.cn)("text-sm font-medium",void 0),children:e.filename||"".concat(e.mimeType," file")}),(0,a.jsx)("span",{className:(0,l.cn)("text-xs",C?"text-primary-foreground/70":"text-muted-foreground"),children:e.mimeType})]},s);{let t="data:".concat(e.mimeType,";base64,").concat(e.data);return(0,a.jsxs)("div",{className:"my-2 flex items-center gap-2 p-3 rounded-lg border border-border bg-muted/50",children:[(0,a.jsx)(z.A,{className:(0,l.cn)("h-5 w-5",C?void 0:"text-muted-foreground")}),(0,a.jsx)("audio",{controls:!0,src:t,className:"flex-1 h-8"}),e.filename&&(0,a.jsx)("span",{className:(0,l.cn)("text-sm truncate max-w-[120px]",C?"text-primary-foreground/80":"text-muted-foreground"),children:e.filename})]},s)}}return null}),G&&!e.content&&(0,a.jsx)("p",{className:"italic",children:"System message"})]}),e.imageData&&!Array.isArray(e.content)&&(()=>{let t="data:".concat(e.imageData.mimeType,";base64,").concat(e.imageData.base64);return q(t)?(0,a.jsx)("img",{src:t,alt:"attachment",className:"mt-2 max-h-60 w-full rounded-lg border border-border object-contain"}):null})(),e.fileData&&!Array.isArray(e.content)&&(0,a.jsx)("div",{className:"mt-2",children:e.fileData.mimeType.startsWith("audio/")?(0,a.jsxs)("div",{className:"relative w-fit border border-border rounded-lg p-2 bg-muted/50 flex items-center gap-2 group",children:[(0,a.jsx)(z.A,{className:"h-4 w-4"}),(0,a.jsx)("audio",{controls:!0,src:"data:".concat(e.fileData.mimeType,";base64,").concat(e.fileData.base64),className:"h-8"})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2 p-3 rounded-lg border border-border bg-muted/50",children:[(0,a.jsx)(M.A,{className:"h-5 w-5"}),(0,a.jsx)("span",{className:"text-sm font-medium",children:e.fileData.filename||"".concat(e.fileData.mimeType," file")}),(0,a.jsx)("span",{className:"text-xs text-primary-foreground/70",children:e.fileData.mimeType})]})})]})}),!G&&!Z&&(0,a.jsxs)("div",{className:"text-xs text-muted-foreground mt-1 px-1 flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{children:ea}),$&&(null==(i=e.tokenUsage)?void 0:i.totalTokens)!==void 0&&(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-muted/50 text-xs cursor-default",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),e.tokenUsage.totalTokens," tokens"]})}),(0,a.jsx)(j,{side:"bottom",children:(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[void 0!==e.tokenUsage.inputTokens&&(0,a.jsxs)("div",{children:["Input: ",e.tokenUsage.inputTokens]}),void 0!==e.tokenUsage.outputTokens&&(0,a.jsxs)("div",{children:["Output: ",e.tokenUsage.outputTokens]}),void 0!==e.tokenUsage.reasoningTokens&&(0,a.jsxs)("div",{children:["Reasoning: ",e.tokenUsage.reasoningTokens]}),(0,a.jsxs)("div",{className:"font-medium mt-0.5",children:["Total: ",e.tokenUsage.totalTokens]})]})})]}),$&&e.model&&(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{children:(0,a.jsx)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-muted/30 text-xs cursor-default",children:e.model})}),(0,a.jsx)(j,{side:"bottom",children:(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"font-medium",children:["Model: ",e.model]}),e.provider&&(0,a.jsxs)("div",{className:"font-medium",children:["Provider: ",e.provider]}),e.router&&(0,a.jsxs)("div",{className:"font-medium",children:["Router: ",e.router]})]})})]})]}),($||C)&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(N,{value:A(e),tooltip:"Copy message",copiedTooltip:"Copied!",className:"opacity-70 hover:opacity-100 transition-opacity"}),(0,a.jsx)(E,{value:A(e),tooltip:"Speak",stopTooltip:"Stop",className:"opacity-70 hover:opacity-100 transition-opacity"})]})]})]}),C&&(0,a.jsx)(et,{className:"h-7 w-7 mt-1 text-muted-foreground col-start-2"})]}),X.map((e,t)=>(0,a.jsx)("div",{className:"w-full mt-2",children:(0,a.jsxs)("div",{className:"flex items-end w-full justify-start",children:[(0,a.jsx)(_.A,{className:"h-7 w-7 mr-2 mb-1 text-muted-foreground self-start flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)("div",{className:"p-3 rounded-xl shadow-sm max-w-[75%] bg-card text-card-foreground border border-border rounded-bl-none text-sm",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(_.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:"Tool Result Image"})]}),(0,a.jsxs)("div",{className:"relative group cursor-pointer",onClick:()=>{S({isOpen:!0,src:e.src,alt:e.alt})},children:[(0,a.jsx)("img",{src:e.src,alt:e.alt,className:"max-h-80 w-auto rounded border border-border object-contain transition-transform group-hover:scale-[1.02]"}),(0,a.jsx)("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-colors rounded border border-border flex items-center justify-center",children:(0,a.jsx)(U.A,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity drop-shadow-lg"})})]})]})}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground mt-1 px-1",children:(0,a.jsx)("span",{children:ea})})]})]})},"".concat(w,"-image-").concat(t))),ee.map((e,t)=>(0,a.jsx)("div",{className:"w-full mt-2",children:(0,a.jsxs)("div",{className:"flex items-end w-full justify-start",children:[(0,a.jsx)(k.A,{className:"h-7 w-7 mr-2 mb-1 text-muted-foreground self-start flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex flex-col items-start",children:[(0,a.jsx)("div",{className:"p-3 rounded-xl shadow-sm max-w-[75%] bg-card text-card-foreground border border-border rounded-bl-none text-sm overflow-hidden",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(k.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:"Tool Result Audio"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 p-2 rounded border border-border bg-muted/30 min-w-0 audio-controls-container",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)(z.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,a.jsx)("audio",{controls:!0,src:e.src,className:"flex-1 min-w-0"})]}),e.filename&&(0,a.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,a.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:e.filename})})]})]})}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground mt-1 px-1",children:(0,a.jsx)("span",{children:ea})})]})]})},"".concat(w,"-audio-").concat(t))),en&&(0,a.jsx)("div",{className:"mt-2 ml-12 mr-4",children:(0,a.jsx)(T,{error:s,onDismiss:r||(()=>{})})})]},w)}),(0,a.jsx)("div",{ref:x,className:"h-px"},"end-anchor"),C.isOpen&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"relative max-w-[90vw] max-h-[90vh] bg-background rounded-lg shadow-2xl border border-border",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Tool Result Image"}),(0,a.jsx)("button",{onClick:()=>{S({isOpen:!1,src:"",alt:""})},className:"p-2 hover:bg-muted rounded-md transition-colors","aria-label":"Close modal",children:(0,a.jsx)(u.A,{className:"h-5 w-5"})})]}),(0,a.jsx)("div",{className:"p-4 flex items-center justify-center",children:(0,a.jsx)("img",{src:C.src,alt:C.alt,className:"max-w-full max-h-[70vh] object-contain rounded"})}),(0,a.jsx)("div",{className:"p-4 border-t border-border text-sm text-muted-foreground",children:(0,a.jsx)("p",{children:C.alt})})]})})]})}var W=s(1048);function H(e){let{children:t,className:s}=e;return(0,a.jsx)("div",{className:(0,l.cn)("relative","w-full","flex flex-col overflow-hidden","max-h-[max(35svh,5rem)]","border-2 border-border/50","bg-background","rounded-3xl shadow-sm","transition-all duration-200",s),children:t})}function Y(e){let{leftButtons:t,rightButtons:s,className:r}=e;return(0,a.jsxs)("div",{className:(0,l.cn)("flex items-center justify-between","h-12 px-2",r),children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:t}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:s})]})}var Z=s(6154),Q=s(7599);let X=n.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(Q.bL,{className:(0,l.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...r,ref:t,children:(0,a.jsx)(Q.zi,{className:(0,l.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});function ee(e){let{isStreaming:t,onStreamingChange:s,className:r}=e;return(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 cursor-pointer ".concat(r||""),children:[(0,a.jsx)(Z.A,{className:"h-3 w-3 ".concat(t?"text-blue-500":"text-muted-foreground")}),(0,a.jsx)(X,{checked:t,onCheckedChange:s,className:"scale-75","aria-label":"Toggle streaming"})]})}),(0,a.jsxs)(j,{side:"bottom",children:[(0,a.jsx)("p",{children:t?"Streaming enabled":"Streaming disabled"}),(0,a.jsx)("p",{className:"text-xs opacity-75",children:t?"Responses will stream in real-time":"Responses will arrive all at once"})]})]})})}X.displayName=Q.bL.displayName;var et=s(4285),es=s(2286);function er(e){let{...t}=e;return(0,a.jsx)(es.bL,{"data-slot":"popover",...t})}function ea(e){let{className:t,align:s="center",sideOffset:r=4,...n}=e;return(0,a.jsx)(es.ZL,{children:(0,a.jsx)(es.UC,{"data-slot":"popover-content",align:s,sideOffset:r,className:(0,l.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...n})})}let en=e=>{let{children:t,...s}=e;return(0,a.jsx)(er,{...s,children:t})},ei=function(e){let{...t}=e;return(0,a.jsx)(es.l9,{"data-slot":"popover-trigger",...t})},el=n.forwardRef((e,t)=>{let{className:s,align:r="end",sideOffset:n=4,...i}=e;return(0,a.jsx)(ea,{ref:t,align:r,sideOffset:n,className:(0,l.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...i})});el.displayName="DropdownMenuContent";let eo=n.forwardRef((e,t)=>{let{className:s,disabled:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pointer-events-none opacity-50",!r&&"hover:bg-accent hover:text-accent-foreground cursor-pointer",s),...n})});eo.displayName="DropdownMenuItem";let ec=n.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("-mx-1 my-1 h-px bg-muted",s),...r})});function ed(e){let{onImageAttach:t,onPdfAttach:s,onAudioAttach:r,className:i,supports:l}=e,[o,c]=n.useState(!1),d=(null==l?void 0:l.image)!==!1,m=(null==l?void 0:l.pdf)!==!1,u=(null==l?void 0:l.audio)!==!1;return(0,a.jsxs)(en,{open:o,onOpenChange:c,children:[(0,a.jsx)(ei,{asChild:!0,children:(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",className:"h-8 px-3 text-sm text-muted-foreground hover:text-foreground rounded-full ".concat(i||""),"aria-label":"Attach File",children:[(0,a.jsx)(et.A,{className:"h-3 w-3 mr-1.5"}),"Attach"]})}),(0,a.jsxs)(el,{side:"top",align:"start",children:[(0,a.jsx)(eo,{onClick:()=>{d&&(t(),c(!1))},className:d?void 0:"opacity-50 cursor-not-allowed","aria-disabled":!d,children:(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(et.A,{className:"h-4 w-4 mr-2"})," Image"]})}),!d&&(0,a.jsx)(j,{side:"bottom",children:"Unsupported for this model"})]})})}),(0,a.jsx)(eo,{onClick:()=>{m&&(s(),c(!1))},className:m?void 0:"opacity-50 cursor-not-allowed","aria-disabled":!m,children:(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(M.A,{className:"h-4 w-4 mr-2"})," PDF"]})}),!m&&(0,a.jsx)(j,{side:"bottom",children:"Unsupported for this model"})]})})}),(0,a.jsx)(eo,{onClick:()=>{u&&(r(),c(!1))},className:u?void 0:"opacity-50 cursor-not-allowed","aria-disabled":!u,children:(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(z.A,{className:"h-4 w-4 mr-2"})," Audio file"]})}),!u&&(0,a.jsx)(j,{side:"bottom",children:"Unsupported for this model"})]})})})]})]})}ec.displayName="DropdownMenuSeparator";var em=s(1410),eu=s(9142);function ex(e){let{isRecording:t,onToggleRecording:s,className:r,disabled:n}=e,i=(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",onClick:()=>{n||s()},className:"h-8 px-3 text-sm rounded-full ".concat(n?"opacity-50 cursor-not-allowed":"text-muted-foreground hover:text-foreground"," ").concat(r||""),"aria-label":t?"Stop recording":"Record audio","aria-disabled":!!n||void 0,children:[t?(0,a.jsx)(em.A,{className:"h-3 w-3 mr-1.5 text-red-500"}):(0,a.jsx)(eu.A,{className:"h-3 w-3 mr-1.5"}),t?"Stop":"Record"]});return n?(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:i}),(0,a.jsx)(j,{side:"bottom",children:"Unsupported for this model"})]})}):i}var eh=s(5239),ep=s(4679),ef=s(235),eg=s(2559),ev=s(7507),ej=s(6170);function eb(e){let{open:t,onOpenChange:s,provider:r,primaryEnvVar:i,onSaved:l}=e,[o,c]=(0,n.useState)(""),[d,m]=(0,n.useState)(!1),[u,x]=(0,n.useState)(null),h=async()=>{if(!o.trim())return void x("API key is required");m(!0),x(null);try{let e=await fetch("/api/llm/key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,apiKey:o})}),t=await e.json();if(!e.ok||"object"!=typeof t||null===t)throw Error("Failed to save API key");if(!t.ok||!t.provider||!t.envVar)throw Error("Unexpected response while saving API key");l({provider:t.provider,envVar:t.envVar}),s(!1),c("")}catch(e){x(e instanceof Error?e.message:"Failed to save API key")}finally{m(!1)}};return(0,a.jsx)(ep.lG,{open:t,onOpenChange:s,children:(0,a.jsxs)(ep.Cf,{className:"max-w-md",children:[(0,a.jsxs)(ep.c7,{children:[(0,a.jsxs)(ep.L3,{children:["Set ",r," API Key"]}),(0,a.jsxs)(ep.rr,{children:["This key will be stored in your .env (env var ",i,"). It is not shared with the client."]})]}),u&&(0,a.jsx)(eg.Fc,{variant:"destructive",children:(0,a.jsx)(eg.TN,{children:u})}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(ef.J,{htmlFor:"apiKey",children:"API Key"}),(0,a.jsx)(ej.p,{id:"apiKey",type:"password",value:o,onChange:e=>c(e.target.value),placeholder:"Enter ".concat(r," API key")})]}),(0,a.jsxs)(ep.Es,{children:[(0,a.jsx)(b.$,{variant:"outline",onClick:()=>s(!1),disabled:d,children:"Cancel"}),(0,a.jsx)(b.$,{onClick:h,disabled:d,children:d?"Saving...":"Save"})]})]})})}var ey=s(21),eN=s(9347),ew=s(6651);function ek(e){let{value:t,onChange:s,placeholder:r="Search providers or models",autoFocus:i=!1}=e,l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{i&&l.current&&setTimeout(()=>{var e;null==(e=l.current)||e.focus()},100)},[i]),(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)(ew.A,{className:"h-4 w-4 text-muted-foreground"}),(0,a.jsx)(ej.p,{ref:l,placeholder:r,value:t,onChange:e=>s(e.target.value),className:"focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0"})]})}var eC=s(7812),eS=s(4374),eA=s(5740);let eE={openai:"/logos/openai.svg",anthropic:"/logos/claude-color.svg",google:"/logos/gemini-color.svg",groq:"/logos/groq.svg",xai:"/logos/grok.svg","openai-compatible":"/logos/openai.svg",cohere:"/logos/cohere-color.svg"},eT={openai:"https://platform.openai.com/docs/pricing",anthropic:"https://www.anthropic.com/pricing#api",google:"https://ai.google.dev/gemini-api/docs/pricing",groq:"https://groq.com/pricing/",xai:"https://docs.x.ai/docs/models",cohere:"https://cohere.com/pricing"};function eI(e){if(!e)return[];let t="USD"===(e.currency||"USD")?"$":"",s=[];return s.push("Cost: ".concat(t).concat(e.inputPerM.toFixed(2)," in / ").concat(t).concat(e.outputPerM.toFixed(2)," out per 1M tokens")),null!=e.cacheReadPerM&&s.push("Cache read: ".concat(t).concat(e.cacheReadPerM.toFixed(2)," per 1M tokens")),null!=e.cacheWritePerM&&s.push("Cache write: ".concat(t).concat(e.cacheWritePerM.toFixed(2)," per 1M tokens")),s}let eR=["google","cohere","anthropic"],eD=e=>!eR.includes(e),eL={image:(0,a.jsx)("span",{className:"text-sm",children:"\uD83D\uDDBC️"}),audio:(0,a.jsx)("span",{className:"text-sm",children:"\uD83C\uDFB5"}),pdf:(0,a.jsx)("span",{className:"text-sm",children:"\uD83D\uDCC4"}),reasoning:(0,a.jsx)("span",{className:"text-sm",children:"\uD83E\uDDE0"}),experimental:(0,a.jsx)(eS.A,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-amber-500 transition-colors cursor-help"}),new:(0,a.jsx)(eA.A,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-yellow-500 transition-colors cursor-help"}),realtime:(0,a.jsx)(Z.A,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-blue-500 transition-colors cursor-help"})};var eP=s(9708);function eF(e){let{supportedFileTypes:t,hasApiKey:s,className:r}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5 flex-shrink-0 ".concat(r||""),children:[t.includes("pdf")&&(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)("div",{className:"transition-transform hover:scale-125",children:eL.pdf})}),(0,a.jsx)(j,{side:"top",children:(0,a.jsx)("span",{children:"PDF support"})})]}),t.includes("audio")&&(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)("div",{className:"transition-transform hover:scale-125",children:eL.audio})}),(0,a.jsx)(j,{side:"top",children:(0,a.jsx)("span",{children:"Audio support"})})]}),t.includes("image")&&(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)("div",{className:"transition-transform hover:scale-125",children:eL.image})}),(0,a.jsx)(j,{side:"top",children:(0,a.jsx)("span",{children:"Image support"})})]}),!s&&(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)("div",{className:"transition-transform hover:scale-125",children:(0,a.jsx)(eP.A,{className:"h-3.5 w-3.5 text-amber-500 hover:text-amber-400 transition-colors cursor-help"})})}),(0,a.jsx)(j,{side:"top",children:(0,a.jsx)("span",{children:"API key required"})})]})]})}function eO(e){let{providerId:t,provider:s,models:r,favorites:n,currentModel:i,onToggleFavorite:o,onUse:c}=e;return 0===r.length?null:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-5 h-5 flex items-center justify-center",children:eE[t]?(0,a.jsx)(eh.default,{src:eE[t],alt:"".concat(t," logo"),width:20,height:20,className:(0,l.cn)("object-contain",eD(t)&&"dark:invert dark:brightness-0 dark:contrast-200")}):(0,a.jsx)(ey.A,{className:"h-4 w-4 text-muted-foreground"})}),(0,a.jsx)("span",{className:"text-base font-medium",children:s.name})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[s.supportedRouters.map(e=>(0,a.jsx)(eC.E,{variant:"outline",className:"capitalize text-xs",children:e},e)),s.supportsBaseURL&&(0,a.jsx)(eC.E,{variant:"secondary",className:"text-xs",children:"baseURL"}),!s.hasApiKey&&(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)(eC.E,{variant:"destructive",className:"text-xs cursor-default",children:"API Key Required"})}),(0,a.jsxs)(j,{children:["Click any ",s.name," model to set up the API key"]})]})}),eT[t]&&(0,a.jsx)("a",{href:eT[t],target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:underline",title:"View provider pricing",children:"Pricing ↗"})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:r.map(e=>{let r,d,m=e.displayName||e.name,u=(r=e.name,(null==i?void 0:i.provider)===t&&(null==i?void 0:i.model)===r),x=(d=e.name,n.includes("".concat(t,"|").concat(d))),h=s.hasApiKey,p=eI(e.pricing||void 0),b=["Max tokens: ".concat(e.maxInputTokens.toLocaleString()),e.supportedFileTypes.length>0&&"Supports: ".concat(e.supportedFileTypes.join(", ")),e.default&&"Default model",!h&&"⚠️ API key required",...p].filter(Boolean);return(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)("div",{onClick:()=>c(t,e),onKeyDown:s=>{let r=s.target;if(r&&r.closest("button"))return;let a="Enter"===s.key,n=" "===s.key||"Spacebar"===s.key||"Space"===s.code;n&&s.preventDefault(),(a||n)&&c(t,e)},className:(0,l.cn)("group relative flex items-center gap-3 px-3 py-2.5 rounded-lg border transition-all duration-100 cursor-pointer outline-none","hover:bg-accent hover:border-accent-foreground/20 hover:shadow-sm","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",u&&"bg-accent border-accent-foreground/20 shadow-sm ring-1 ring-accent-foreground/10",!h&&"opacity-60"),role:"button",tabIndex:0,children:[(0,a.jsx)("div",{className:"flex-1 text-left",children:(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)("span",{className:"text-sm font-medium",children:m})})}),(0,a.jsx)(eF,{supportedFileTypes:e.supportedFileTypes,hasApiKey:h}),(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)("button",{onKeyDown:e=>{let t=" "===e.key||"Spacebar"===e.key||"Space"===e.code;("Enter"===e.key||t)&&(e.stopPropagation(),t&&e.preventDefault())},onClick:s=>{s.stopPropagation(),o(t,e.name)},className:"flex-shrink-0 text-muted-foreground hover:text-foreground transition-colors","aria-label":x?"Remove from favorites":"Add to favorites",children:(0,a.jsx)(eN.A,{className:(0,l.cn)("h-4 w-4",x&&"fill-current text-yellow-500")})})}),(0,a.jsx)(j,{side:"top",children:(0,a.jsx)("span",{children:x?"Remove from favorites":"Add to favorites"})})]})}),u&&(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 w-0.5 bg-primary rounded-l-lg"})]})}),(0,a.jsx)(j,{side:"bottom",className:"max-w-xs",children:(0,a.jsx)("div",{className:"text-xs space-y-0.5",children:b.map((e,t)=>(0,a.jsx)("div",{children:e},t))})})]})},e.name)})})]})}function ez(e,t){return"".concat(e,"|").concat(t)}let eM="dexto:modelFavorites";function e_(e){let{provider:t,model:s,providerInfo:r,isFavorite:n,isActive:i,onClick:o,onToggleFavorite:c}=e,d=s.displayName||s.name,m=r.hasApiKey,u=eI(s.pricing||void 0),x=["Max tokens: ".concat(s.maxInputTokens.toLocaleString()),s.supportedFileTypes.length>0&&"Supports: ".concat(s.supportedFileTypes.join(", ")),!m&&"⚠️ API key required",...u].filter(Boolean);return(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)("div",{onClick:o,className:(0,l.cn)("w-full flex items-center gap-4 px-4 py-3 rounded-xl transition-all duration-150 cursor-pointer group","hover:bg-accent/50 hover:shadow-md hover:scale-[1.01]",i&&"bg-primary/10 shadow-md ring-2 ring-primary/20 scale-[1.01]",!m&&"opacity-60"),role:"button",tabIndex:0,children:[(0,a.jsx)("div",{className:"w-6 h-6 flex-shrink-0 flex items-center justify-center",children:eE[t]?(0,a.jsx)(eh.default,{src:eE[t],alt:"".concat(t," logo"),width:24,height:24,className:(0,l.cn)("object-contain",eD(t)&&"dark:invert dark:brightness-0 dark:contrast-200")}):(0,a.jsx)(ey.A,{className:"h-5 w-5 text-muted-foreground"})}),(0,a.jsxs)("div",{className:"flex-1 text-left min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-semibold text-foreground truncate",children:d}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:t})]}),(0,a.jsx)(eF,{supportedFileTypes:s.supportedFileTypes,hasApiKey:m}),(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),c()},className:(0,l.cn)("flex-shrink-0 transition-all duration-200","hover:scale-110 active:scale-95",n?"text-yellow-500 hover:text-yellow-400":"text-muted-foreground hover:text-yellow-500"),"aria-label":n?"Remove from favorites":"Add to favorites",children:(0,a.jsx)(eN.A,{className:(0,l.cn)("h-4 w-4",n&&"fill-current")})})}),(0,a.jsx)(j,{side:"top",children:(0,a.jsx)("span",{children:n?"Remove from favorites":"Add to favorites"})})]})})]})}),(0,a.jsx)(j,{side:"right",className:"max-w-xs",children:(0,a.jsx)("div",{className:"text-xs space-y-0.5",children:x.map((e,t)=>(0,a.jsx)("div",{children:e},t))})})]})})}function eU(){var e;let[t,s]=(0,n.useState)(!1),[r,o]=(0,n.useState)(!1),[c,u]=(0,n.useState)(null),[x,h]=(0,n.useState)({}),[p,f]=(0,n.useState)(""),[g,v]=(0,n.useState)(!1),[j,y]=(0,n.useState)(""),[N,w]=(0,n.useState)(""),[k,C]=(0,n.useState)(!1),[S,A]=(0,n.useState)(!1),[E,T]=(0,n.useState)(!1),[I,D]=(0,n.useState)(!1),[L,P]=(0,n.useState)(null),[F,z]=(0,n.useState)(null),{currentSessionId:M,currentLLM:_,refreshCurrentLLM:U}=(0,i.v)();(0,n.useEffect)(()=>{t&&_&&(y(_.router||"vercel"),w(_.baseURL||""))},[t,_]),(0,n.useEffect)(()=>{if(!t)return;let e=!1;return async function(){o(!0),u(null);try{let t=await fetch("/api/llm/catalog");if(!e&&t.ok){let e=await t.json();h(e.providers||{})}}catch(t){e||u("Failed to load catalog")}finally{e||o(!1)}}(),()=>{e=!0}},[t]);let[K,$]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(t)try{let e=localStorage.getItem(eM);$(e?JSON.parse(e):[])}catch(e){$([])}},[t]);let V=(0,n.useCallback)((e,t)=>{let s=ez(e,t);$(e=>{let t=e.includes(s)?e.filter(e=>e!==s):[...e,s];return localStorage.setItem(eM,JSON.stringify(t)),t})},[]);async function q(e,t,r){C(!0),u(null);try{var a,n;let i=function(e,t){var s,r,a;let n=(null==_?void 0:_.router)||"vercel",i=null!=(r=null==(s=x[e])?void 0:s.supportedRouters)?r:["vercel"],l=null!=(a=t.supportedRouters)?a:i,o=j||n;return l.includes(o)?o:l[0]||i[0]||"vercel"}(e,t),l={provider:e,model:t.name,router:i};r&&(null==(a=x[e])?void 0:a.supportsBaseURL)&&(l.baseURL=r),M&&(l.sessionId=M);let o=await fetch("/api/llm/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}),c=await o.json().catch(()=>({}));if(!o.ok){let e=(null==c?void 0:c.issues)&&(null==(n=c.issues[0])?void 0:n.message)||"Failed to switch model";u(e);return}await U(),s(!1)}catch(e){u("Network error while switching")}finally{C(!1)}}function B(e,t){let s=x[e];if(s){if(s.supportsBaseURL&&N){let e=function(e){let t=e.trim();if(!t.length)return{isValid:!0};try{let e=new URL(t);if(!["http:","https:"].includes(e.protocol))return{isValid:!1,error:"URL must use http:// or https://"};if(!e.pathname.includes("/v1"))return{isValid:!1,error:"URL must include /v1 for compatibility"};return{isValid:!0}}catch(e){return{isValid:!1,error:"Invalid URL format"}}}(N);if(!e.isValid)return void u(e.error||"Invalid base URL")}if(!s.hasApiKey){z({provider:e,model:t.name}),P(e),D(!0);return}q(e,t,N)}}let J=Object.keys(x),G=(null==_?void 0:_.displayName)||(null==_?void 0:_.model)||"Choose Model",W=(0,n.useMemo)(()=>K.map(e=>{let[t,s]=e.split("|"),r=x[t],a=null==r?void 0:r.models.find(e=>e.name===s);return r&&a?{providerId:t,provider:r,model:a}:null}).filter(Boolean),[K,x]),H=(0,n.useMemo)(()=>{if(!p)return x;let e={};return J.forEach(t=>{let s=x[t].models.filter(e=>(function(e,t){var s,r,a,n;let i=p.trim().toLowerCase();return!i||t.name.toLowerCase().includes(i)||null!=(a=null==(s=t.displayName)?void 0:s.toLowerCase().includes(i))&&a||e.toLowerCase().includes(i)||null!=(n=null==(r=x[e])?void 0:r.name.toLowerCase().includes(i))&&n})(t,e));s.length>0&&(e[t]={...x[t],models:s})}),e},[x,p,J]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(ep.lG,{open:t,onOpenChange:s,children:[(0,a.jsx)(ep.zM,{asChild:!0,children:(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",className:"hidden lg:flex items-center gap-2 cursor-pointer",title:"Choose model",children:[(null==_?void 0:_.provider)&&eE[_.provider]?(0,a.jsx)(eh.default,{src:eE[_.provider],alt:"".concat(_.provider," logo"),width:16,height:16,className:(0,l.cn)("object-contain",eD(_.provider)&&"dark:invert dark:brightness-0 dark:contrast-200")}):(0,a.jsx)(R.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-sm",children:G}),(0,a.jsx)(m.A,{className:"h-3 w-3"})]})}),(0,a.jsxs)(ep.Cf,{className:"max-w-4xl max-h-[85vh] flex flex-col",children:[(0,a.jsxs)(ep.c7,{className:"pb-4 flex-shrink-0",children:[(0,a.jsx)(ep.L3,{className:"text-xl",children:"Select Model"}),(0,a.jsx)(ep.rr,{className:"text-sm text-muted-foreground",children:"Choose from your favorite models or explore all available options"})]}),(0,a.jsxs)("div",{className:"flex flex-col min-h-0 flex-1 space-y-6",children:[(0,a.jsxs)("div",{className:"flex-shrink-0 space-y-4",children:[c&&(0,a.jsx)(eg.Fc,{variant:"destructive",children:(0,a.jsx)(eg.TN,{children:c})}),(0,a.jsx)(ek,{value:p,onChange:f,placeholder:"Search models, providers..."})]}),W.length>0&&!p&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",onClick:()=>T(!E),className:"flex items-center justify-between w-full p-0 h-auto hover:bg-transparent",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eN.A,{className:"h-4 w-4 text-yellow-500 fill-current"}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Favorites"}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",W.length,")"]})]}),E?(0,a.jsx)(m.A,{className:"h-4 w-4"}):(0,a.jsx)(d.A,{className:"h-4 w-4"})]}),!E&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("div",{className:"max-h-[280px] overflow-y-auto px-1 py-1 space-y-1",children:W.map(e=>{let t,{providerId:s,provider:r,model:n}=e;return(0,a.jsx)(e_,{provider:s,model:n,providerInfo:r,isFavorite:!0,isActive:(t=n.name,(null==_?void 0:_.provider)===s&&(null==_?void 0:_.model)===t),onClick:()=>B(s,n),onToggleFavorite:()=>V(s,n.name)},ez(s,n.name))})}),W.length>6&&(0,a.jsxs)("div",{className:"text-xs text-muted-foreground text-center",children:["Scroll to see all ",W.length," favorites"]})]})]}),!p&&(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:()=>A(!S),className:"w-full justify-center gap-2",children:S?(0,a.jsxs)(a.Fragment,{children:["Hide All Models ",(0,a.jsx)(d.A,{className:"h-4 w-4"})]}):(0,a.jsxs)(a.Fragment,{children:["Show All Models ",(0,a.jsx)(m.A,{className:"h-4 w-4"})]})}),(S||p)&&(0,a.jsx)("div",{className:"flex-1 overflow-auto px-1 min-h-0",children:(0,a.jsx)("div",{className:"space-y-6 pb-2",children:r?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,a.jsx)(O.A,{className:"h-4 w-4 animate-spin"})," Loading models..."]}):0===Object.keys(H).length?(0,a.jsx)("div",{className:"text-sm text-muted-foreground text-center py-8",children:p?"No models found matching your search":"No providers available"}):Object.entries(H).map(e=>{let[t,s]=e;return(0,a.jsx)(eO,{providerId:t,provider:s,models:s.models,favorites:K,currentModel:_||void 0,onToggleFavorite:V,onUse:B},t)})})})]}),(0,a.jsxs)("div",{className:"flex-shrink-0 space-y-3 border-t pt-4 mt-4",children:[(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",onClick:()=>v(!g),className:"flex items-center justify-between w-full p-0 h-auto hover:bg-transparent",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Advanced Options"}),g?(0,a.jsx)(d.A,{className:"h-4 w-4"}):(0,a.jsx)(m.A,{className:"h-4 w-4"})]}),g&&(0,a.jsxs)("div",{className:"space-y-4 pl-4 border-l-2 border-muted",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(ef.J,{className:"text-sm font-medium",children:"Router"}),(0,a.jsxs)(ev.l6,{value:j,onValueChange:e=>y(e),children:[(0,a.jsx)(ev.bq,{children:(0,a.jsx)(ev.yv,{placeholder:"Select router"})}),(0,a.jsx)(ev.gC,{children:Array.from(new Set(J.flatMap(e=>x[e].supportedRouters))).map(e=>(0,a.jsx)(ev.eb,{value:e,children:(0,a.jsx)("span",{className:"capitalize",children:e})},e))})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(ef.J,{className:"text-sm font-medium",children:"Custom Base URL"}),(0,a.jsx)(ej.p,{value:N,onChange:e=>w(e.target.value),placeholder:"https://api.openai.com/v1",className:"text-sm"}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Only used for providers that support baseURL."})]})]})]})]})]}),L&&(0,a.jsx)(eb,{open:I,onOpenChange:D,provider:L,primaryEnvVar:(null==(e=x[L])?void 0:e.primaryEnvVar)||"",onSaved:function(e){if(h(t=>({...t,[e.provider]:t[e.provider]?{...t[e.provider],hasApiKey:!0}:t[e.provider]})),D(!1),F){var t;let{provider:e,model:s}=F,r=null==(t=x[e])?void 0:t.models.find(e=>e.name===s);r&&q(e,r,N),z(null)}}})]})}var eK=s(6132),e$=s(7188);function eV(e){let{onSend:t,isSending:s,variant:r="chat"}=e,[o,c]=(0,n.useState)(""),d=(0,n.useRef)(null),[m,x]=(0,n.useState)(null),[h,p]=(0,n.useState)(null),f=(0,n.useRef)(null),g=(0,n.useRef)(null),v=(0,n.useRef)(null),j=function(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{if("undefined"==typeof document)return;let e=document;if(!e.fonts||!e.fonts.ready)return void t(!0);let s=!1;return e.fonts.ready.then(()=>{s||t(!0)}),()=>{s=!0}},[]),e}(),[y,N]=(0,n.useState)(!1),k=(0,n.useRef)(null),{currentSessionId:C,isStreaming:S,setStreaming:A,cancel:E,processing:T,currentLLM:I}=(0,i.v)(),[R,D]=(0,n.useState)(null),[L,P]=(0,n.useState)(!1),[F,_]=(0,n.useState)(null),[U,K]=(0,n.useState)(null),[$,V]=(0,n.useState)([]),q=[{name:"Claude 4 Sonnet",provider:"anthropic",model:"claude-4-sonnet-20250514"},{name:"GPT-4o",provider:"openai",model:"gpt-4o"},{name:"GPT-4.1 Mini",provider:"openai",model:"gpt-4.1-mini"},{name:"Gemini 2.5 Pro",provider:"google",model:"gemini-2.5-pro"}],B=e=>{K(e),setTimeout(()=>K(null),5e3)};(0,n.useEffect)(()=>{(async()=>{try{let e=await fetch(C?"/api/llm/current?sessionId=".concat(C):"/api/llm/current");if(e.ok){let t=await e.json(),s=q.find(e=>e.model===t.config.model);s?D(s):D({name:"".concat(t.config.provider,"/").concat(t.config.model),provider:t.config.provider,model:t.config.model})}}catch(e){console.error("Failed to fetch current model:",e),D(null)}})()},[C]),(0,n.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/llm/catalog?mode=flat");if(!e.ok)return;let t=(await e.json()).models||[],s=null==I?void 0:I.provider,r=null==I?void 0:I.model;if(!s||!r)return;let a=t.find(e=>e.provider===s&&e.name===r);V((null==a?void 0:a.supportedFileTypes)||[])}catch(e){V([])}})()},[null==I?void 0:I.provider,null==I?void 0:I.model]);let J=()=>{let e=o.trim();(e||m||h)&&(t(e,null!=m?m:void 0,null!=h?h:void 0),c(""),x(null),p(null))},G=e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),J())},Z=e=>{let t=e.clipboardData.getData("text/plain");if(t&&!(t.length<=2e4))if(e.preventDefault(),window.confirm("Large text detected. Attach as a file instead of inflating the input?\n(OK = attach as file, Cancel = paste truncated preview)"))p({base64:(e=>{try{return btoa(unescape(encodeURIComponent(e)))}catch(t){return btoa(e)}})(t),mimeType:"text/plain",filename:"pasted.txt"});else{let e=t.slice(0,2e4);c(t=>t+e)}},Q=async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=new MediaRecorder(e);k.current=t;let s=[];t.ondataavailable=e=>{e.data.size>0&&s.push(e.data)},t.onstop=()=>{let r=new Blob(s,{type:t.mimeType}),a=new FileReader;a.onloadend=()=>{try{let e=a.result,s=e.indexOf(","),r=e.substring(s+1),n=t.mimeType||"audio/webm",i={"audio/mp3":"mp3","audio/mpeg":"mp3","audio/wav":"wav","audio/x-wav":"wav","audio/wave":"wav","audio/webm":"webm","audio/ogg":"ogg","audio/m4a":"m4a","audio/aac":"aac"}[n]||n.split("/")[1]||"webm";p({base64:r,mimeType:n,filename:"recording.".concat(i)})}catch(e){B("Failed to process audio recording. Please try again."),p(null)}},a.readAsDataURL(r),e.getTracks().forEach(e=>e.stop())},t.start(),N(!0)}catch(e){B("Failed to start audio recording. Please check microphone permissions.")}};return(0,n.useEffect)(()=>{o&&F&&_(null),o&&U&&K(null)},[o,F]),o.length,(0,a.jsxs)("div",{id:"input-area",className:"flex flex-col gap-2 w-full",children:[F&&(0,a.jsxs)(eg.Fc,{variant:"destructive",className:"mb-2",children:[(0,a.jsx)(eK.A,{className:"h-4 w-4"}),(0,a.jsxs)(eg.TN,{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{children:F}),(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:()=>_(null),className:"h-auto p-1 ml-2",children:(0,a.jsx)(u.A,{className:"h-3 w-3"})})]})]}),U&&(0,a.jsxs)(eg.Fc,{variant:"destructive",className:"mb-2",children:[(0,a.jsx)(eK.A,{className:"h-4 w-4"}),(0,a.jsxs)(eg.TN,{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{children:U}),(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:()=>K(null),className:"h-auto p-1 ml-2",children:(0,a.jsx)(u.A,{className:"h-3 w-3"})})]})]}),(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("form",{onSubmit:e=>{e.preventDefault(),J()},children:(0,a.jsxs)(H,{children:[(m||h)&&(0,a.jsx)("div",{className:"px-4 pt-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[m&&(0,a.jsxs)("div",{className:"relative w-fit border border-border rounded-lg p-1 bg-muted/50 group",children:[(0,a.jsx)("img",{src:"data:".concat(m.mimeType,";base64,").concat(m.base64),alt:"preview",className:"h-12 w-auto rounded-md"}),(0,a.jsx)(b.$,{variant:"destructive",size:"icon",onClick:()=>x(null),className:"absolute -top-1 -right-1 h-4 w-4 rounded-full bg-destructive text-destructive-foreground opacity-100 group-hover:opacity-100 transition-opacity duration-150 shadow-md","aria-label":"Remove image",children:(0,a.jsx)(u.A,{className:"h-2 w-2"})})]}),h&&(0,a.jsxs)("div",{className:"relative w-fit border border-border rounded-lg p-2 bg-muted/50 flex items-center gap-2 group",children:[h.mimeType.startsWith("audio")?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(z.A,{className:"h-4 w-4"}),(0,a.jsx)("audio",{controls:!0,src:"data:".concat(h.mimeType,";base64,").concat(h.base64),className:"h-8"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-xs font-medium max-w-[160px] truncate",children:h.filename||"attachment"})]}),(0,a.jsx)(b.$,{variant:"destructive",size:"icon",onClick:()=>p(null),className:"absolute -top-1 -right-1 h-4 w-4 rounded-full bg-destructive text-destructive-foreground opacity-100 group-hover:opacity-100 transition-opacity duration-150 shadow-md","aria-label":"Remove attachment",children:(0,a.jsx)(u.A,{className:"h-2 w-2"})})]})]})}),(0,a.jsx)("div",{className:"flex-auto overflow-y-auto",children:j?(0,a.jsx)(W.A,{ref:d,value:o,onChange:e=>c(e.target.value),onKeyDown:G,onPaste:Z,placeholder:"Ask Dexto anything...",minRows:1,maxRows:8,className:"w-full px-4 pt-4 pb-1 text-lg leading-7 placeholder:text-lg bg-transparent border-none resize-none outline-none ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none max-h-full"}):(0,a.jsx)("textarea",{ref:d,rows:1,value:o,onChange:e=>c(e.target.value),onKeyDown:G,onPaste:Z,placeholder:"Ask Dexto anything...",className:"w-full px-4 pt-4 pb-1 text-lg leading-7 placeholder:text-lg bg-transparent border-none resize-none outline-none ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none"})}),(0,a.jsx)(Y,{leftButtons:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ed,{onImageAttach:()=>{var e;return null==(e=f.current)?void 0:e.click()},onPdfAttach:()=>{var e;return null==(e=g.current)?void 0:e.click()},onAudioAttach:()=>{var e;return null==(e=v.current)?void 0:e.click()},supports:{image:$.length?$.includes("image"):void 0,pdf:$.length?$.includes("pdf"):void 0,audio:$.length?$.includes("audio"):void 0}}),(0,a.jsx)(ex,{isRecording:y,onToggleRecording:y?()=>{var e;null==(e=k.current)||e.stop(),N(!1)}:Q,disabled:!$.includes("audio")})]}),rightButtons:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ee,{isStreaming:S,onStreamingChange:A}),(0,a.jsx)(eU,{}),(0,a.jsx)(b.$,{type:T?"button":"submit",onClick:T?()=>E(C||void 0):void 0,disabled:!T&&(!o.trim()&&!m&&!h||s),className:(0,l.cn)("h-10 w-10 p-0 rounded-full transition-all duration-200",T?"bg-secondary/80 text-secondary-foreground hover:bg-secondary shadow-sm hover:shadow-md border border-border/50":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm hover:shadow-lg"),"aria-label":T?"Stop":"Send message",title:T?"Stop":"Send",children:T?(0,a.jsx)(w.A,{className:"h-3.5 w-3.5 fill-current"}):s?(0,a.jsx)(O.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(e$.A,{className:"h-4 w-4"})})]})})]})}),(0,a.jsx)("input",{ref:f,type:"file",id:"image-upload",accept:"image/*",className:"hidden",onChange:e=>{var t;let s=null==(t=e.target.files)?void 0:t[0];if(!s)return;if(s.size>0x4000000){B("Image file too large. Maximum size is 64MB."),e.target.value="";return}if(!s.type.startsWith("image/")){B("Please select a valid image file."),e.target.value="";return}let r=new FileReader;r.onloadend=()=>{try{let e=r.result,t=e.indexOf(",");if(-1===t)throw Error("Invalid Data URL format");let a=e.substring(0,t),n=e.substring(t+1),i=a.match(/data:(.*);base64/),l=i?i[1]:s.type;if(!l)throw Error("Could not determine MIME type");x({base64:n,mimeType:l}),K(null)}catch(e){B("Failed to process image file. Please try again."),x(null)}},r.onerror=e=>{B("Failed to read image file. Please try again."),x(null)},r.readAsDataURL(s),e.target.value=""}}),(0,a.jsx)("input",{ref:g,type:"file",id:"pdf-upload",accept:"application/pdf",className:"hidden",onChange:e=>{var t;let s=null==(t=e.target.files)?void 0:t[0];if(!s)return;if(s.size>0x4000000){B("PDF file too large. Maximum size is 64MB."),e.target.value="";return}if("application/pdf"!==s.type){B("Please select a valid PDF file."),e.target.value="";return}let r=new FileReader;r.onloadend=()=>{try{let e=r.result,t=e.indexOf(","),a=e.substring(t+1);p({base64:a,mimeType:"application/pdf",filename:s.name}),K(null)}catch(e){B("Failed to process PDF file. Please try again."),p(null)}},r.onerror=e=>{B("Failed to read PDF file. Please try again."),p(null)},r.readAsDataURL(s),e.target.value=""}}),(0,a.jsx)("input",{ref:v,type:"file",id:"audio-upload",accept:"audio/*",className:"hidden",onChange:e=>{var t;let s=null==(t=e.target.files)?void 0:t[0];if(!s)return;if(s.size>0x4000000){B("Audio file too large. Maximum size is 64MB."),e.target.value="";return}if(!s.type.startsWith("audio/")){B("Please select a valid audio file."),e.target.value="";return}let r=new FileReader;r.onloadend=()=>{try{let e=r.result,t=e.indexOf(","),a=e.substring(t+1);p({base64:a,mimeType:s.type,filename:s.name}),K(null)}catch(e){B("Failed to process audio file. Please try again."),p(null)}},r.onerror=e=>{B("Failed to read audio file. Please try again."),p(null)},r.readAsDataURL(s),e.target.value=""}})]})]})}var eq=s(8712);let eB=JSON.parse('[{"id":"filesystem","name":"Filesystem","description":"Secure file operations with configurable access controls for reading and writing files","category":"productivity","icon":"\uD83D\uDCC1","config":{"type":"stdio","command":"npx","args":["-y","@modelcontextprotocol/server-filesystem","."],"timeout":30000},"tags":["file","directory","filesystem","io"],"isOfficial":true,"isInstalled":false,"author":"Anthropic","homepage":"https://github.com/modelcontextprotocol/servers","matchIds":["filesystem"]},{"id":"meme-mcp","name":"Meme Generator","description":"Create memes using Imgflip templates","category":"creative","icon":"\uD83D\uDDBC️","config":{"type":"stdio","command":"npx","args":["-y","meme-mcp"],"env":{"IMGFLIP_USERNAME":"","IMGFLIP_PASSWORD":""},"timeout":30000},"tags":["meme","image","creative"],"isOfficial":false,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Community","homepage":"https://www.npmjs.com/package/meme-mcp","matchIds":["meme-mcp"]},{"id":"product-name-scout","name":"Product Name Scout","description":"SERP analysis, autocomplete, dev collisions, and scoring for product names","category":"research","icon":"\uD83D\uDD0E","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/product-name-scout-mcp"],"timeout":30000},"tags":["research","naming","brand"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["product-name-scout"]},{"id":"duckduckgo","name":"DuckDuckGo Search","description":"Search the web using DuckDuckGo","category":"research","icon":"\uD83E\uDD86","config":{"type":"stdio","command":"uvx","args":["duckduckgo-mcp-server"],"timeout":30000},"tags":["search","web","research"],"isOfficial":false,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10","dependencies":["uv"]},"author":"Community","homepage":"https://github.com/duckduckgo/mcp-server","matchIds":["duckduckgo","ddg"]},{"id":"domain-checker","name":"Domain Checker","description":"Check domain availability across TLDs","category":"research","icon":"\uD83C\uDF10","config":{"type":"stdio","command":"uvx","args":["truffle-ai-domain-checker-mcp"],"timeout":30000},"tags":["domains","availability","research"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["domain-checker"]},{"id":"linear","name":"Linear","description":"Manage Linear issues, projects, and workflows","category":"productivity","icon":"\uD83D\uDCCB","config":{"type":"stdio","command":"npx","args":["-y","mcp-remote","https://mcp.linear.app/sse"],"timeout":30000},"tags":["linear","tasks","projects"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Linear","homepage":"https://mcp.linear.app","matchIds":["linear"]},{"id":"image-editor","name":"Image Editor","description":"Comprehensive image processing and manipulation tools","category":"creative","icon":"\uD83D\uDD8C️","config":{"type":"stdio","command":"uvx","args":["truffle-ai-image-editor-mcp"],"timeout":30000},"tags":["image","edit","opencv","pillow"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["image_editor","image-editor"]},{"id":"music-creator","name":"Music Creator","description":"Create, analyze, and transform music and audio","category":"creative","icon":"\uD83C\uDFB5","config":{"type":"stdio","command":"uvx","args":["truffle-ai-music-creator-mcp"],"timeout":30000},"tags":["audio","music","effects"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["music_creator","music-creator"]},{"id":"elevenlabs","name":"ElevenLabs","description":"Text-to-speech and voice synthesis using ElevenLabs API","category":"creative","icon":"\uD83C\uDFA4","config":{"type":"stdio","command":"uvx","args":["elevenlabs-mcp"],"env":{"ELEVENLABS_API_KEY":""},"timeout":30000},"tags":["tts","voice","audio","synthesis"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","python":">=3.10"},"author":"ElevenLabs","homepage":"https://github.com/elevenlabs/elevenlabs-mcp","matchIds":["elevenlabs"]},{"id":"hf","name":"Hugging Face","description":"Access Hugging Face models and datasets","category":"development","icon":"\uD83E\uDD17","config":{"type":"stdio","command":"npx","args":["-y","@llmindset/mcp-hfspace"],"timeout":30000},"tags":["huggingface","models","ai","ml"],"isOfficial":false,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"LLMindset","homepage":"https://github.com/llmindset/mcp-hfspace","matchIds":["hf","huggingface"]},{"id":"tavily","name":"Tavily Search","description":"Web search and research using Tavily AI search engine","category":"research","icon":"\uD83D\uDD0D","config":{"type":"stdio","command":"npx","args":["-y","tavily-mcp@0.1.3"],"env":{"TAVILY_API_KEY":""},"timeout":30000},"tags":["search","web","research","ai"],"isOfficial":false,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Tavily AI","homepage":"https://www.npmjs.com/package/tavily-mcp","matchIds":["tavily"]},{"id":"puppeteer","name":"Puppeteer","description":"Browser automation and web interaction tools","category":"productivity","icon":"\uD83C\uDF10","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/puppeteer-server"],"timeout":30000},"tags":["browser","automation","web","puppeteer"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["puppeteer"]},{"id":"gemini-tts","name":"Gemini TTS","description":"Google Gemini Text-to-Speech with 30 prebuilt voices and multi-speaker conversation support","category":"creative","icon":"\uD83C\uDF99️","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/gemini-tts-server"],"env":{"GEMINI_API_KEY":""},"timeout":60000},"tags":["tts","speech","voice","audio","gemini","multi-speaker"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["gemini-tts","gemini_tts"]},{"id":"nano-banana","name":"Nano Banana","description":"Google Gemini 2.5 Flash Image for advanced image generation, editing, and manipulation","category":"creative","icon":"\uD83C\uDF4C","config":{"type":"stdio","command":"npx","args":["-y","@truffle-ai/nano-banana-server@0.1.2"],"env":{"GEMINI_API_KEY":""},"timeout":60000},"tags":["image","generation","editing","ai","gemini","nano-banana"],"isOfficial":true,"isInstalled":false,"requirements":{"platform":"all","node":">=18.0.0"},"author":"Truffle AI","homepage":"https://github.com/truffle-ai/mcp-servers","matchIds":["nano-banana","nano_banana"]}]');class eJ{static normalizeId(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}static getInstance(){return eJ.instance||(eJ.instance=new eJ),eJ.instance}async initialize(){this.isInitialized||(this.registryEntries=this.getBuiltinEntries(),this.isInitialized=!0)}async getEntries(e){var t;await this.initialize();let s=[...this.registryEntries];if((null==e?void 0:e.category)&&(s=s.filter(t=>t.category===e.category)),(null==e||null==(t=e.tags)?void 0:t.length)&&(s=s.filter(t=>e.tags.some(e=>t.tags.includes(e)))),null==e?void 0:e.search){let t=e.search.toLowerCase();s=s.filter(e=>e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags.some(e=>e.toLowerCase().includes(t)))}return(null==e?void 0:e.installed)!==void 0&&(s=s.filter(t=>t.isInstalled===e.installed)),(null==e?void 0:e.official)!==void 0&&(s=s.filter(t=>t.isOfficial===e.official)),s.sort((e,t)=>e.isInstalled!==t.isInstalled?e.isInstalled?-1:1:e.isOfficial!==t.isOfficial?e.isOfficial?-1:1:e.name.localeCompare(t.name))}async updateEntry(e,t){let s=this.registryEntries.findIndex(t=>t.id===e);return -1!==s&&(this.registryEntries[s]={...this.registryEntries[s],...t},!0)}async setInstalled(e,t){return this.updateEntry(e,{isInstalled:t})}async syncWithServerStatus(){try{if(await this.initialize(),0===this.registryEntries.length)return void console.warn("Registry entries not available for status sync");let e=new AbortController,t=setTimeout(()=>e.abort(),1e4),s=await fetch("/api/mcp/servers",{signal:e.signal});if(clearTimeout(t),!s.ok)return;let r=(await s.json()).servers||[],a=new Set;for(let e of(r.forEach(e=>{if(!(null==e?void 0:e.id)||"string"!=typeof e.id)return;let t=eJ.normalizeId(e.id);a.add(t)}),this.registryEntries)){let t=[e.id,e.name,...e.matchIds||[]].filter(Boolean).map(e=>eJ.normalizeId(String(e))).some(e=>a.has(e));e.isInstalled!==t&&(e.isInstalled=t)}}catch(e){console.warn("Failed to sync registry with server status:",e)}}async getServerConfig(e){return await this.initialize(),this.registryEntries.find(t=>t.id===e)||null}getBuiltinEntries(){return eB}constructor(){this.registryEntries=[],this.isInitialized=!1}}let eG=eJ.getInstance();function eW(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,l.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...s})}function eH(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,l.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...s})}function eY(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,l.cn)("leading-none font-semibold",t),...s})}function eZ(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,l.cn)("px-6",t),...s})}var eQ=s(4172),eX=s(3),e0=s(5530),e1=s(1169),e2=s(5880),e4=s(6191),e5=s(7726);function e3(e){let{isOpen:t,onClose:s,onInstallServer:r}=e,[i,o]=(0,n.useState)([]),[c,u]=(0,n.useState)([]),[x,h]=(0,n.useState)(!1),[p,f]=(0,n.useState)(null),[g,v]=(0,n.useState)(null),[j,y]=(0,n.useState)({}),[N,w]=(0,n.useState)(""),[k,C]=(0,n.useState)("list"),[S,A]=(0,n.useState)(null),E=(0,n.useRef)(null),T=(0,n.useRef)(!0),I=(0,n.useRef)(null);(0,n.useEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current&&clearTimeout(E.current),I.current&&I.current.abort()}),[]),(0,n.useEffect)(()=>{t&&(async()=>{I.current&&I.current.abort();let e=new AbortController;if(I.current=e,T.current){h(!0),f(null);try{await eG.syncWithServerStatus();let t=await eG.getEntries();T.current&&!e.signal.aborted&&(o(t),u(t))}catch(t){T.current&&!e.signal.aborted&&f(t instanceof Error?t.message:"Failed to load server registry")}finally{T.current&&!e.signal.aborted&&h(!1)}}})()},[t]);let R=(0,n.useCallback)(async(e,t)=>{if(T.current)try{let s=await eG.getEntries({...e,search:t||void 0});T.current&&u(s)}catch(e){T.current&&f(e instanceof Error?e.message:"Failed to filter entries")}},[]);(0,n.useEffect)(()=>(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{R(j,N)},300),()=>{E.current&&clearTimeout(E.current)}),[j,N,i,R]);let D=async e=>{if(T.current){v(e.id);try{await r(e),await eG.setInstalled(e.id,!0),T.current&&(o(t=>t.map(t=>t.id===e.id?{...t,isInstalled:!0}:t)),u(t=>t.map(t=>t.id===e.id?{...t,isInstalled:!0}:t)))}catch(e){T.current&&f(e instanceof Error?e.message:"Failed to install server")}finally{T.current&&v(null)}}};return(0,a.jsx)(ep.lG,{open:t,onOpenChange:e=>!e&&s(),children:(0,a.jsxs)(ep.Cf,{className:"!max-w-none w-[90vw] max-h-[85vh] overflow-hidden flex flex-col !sm:max-w-none",children:[(0,a.jsx)(ep.c7,{className:"pb-6 border-b",children:(0,a.jsxs)(ep.L3,{className:"flex items-center gap-3 text-xl font-semibold",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-primary/10 border border-primary/20",children:(0,a.jsx)(eQ.A,{className:"h-5 w-5 text-primary"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xl",children:"MCP Server Registry"}),(0,a.jsx)("div",{className:"text-sm font-normal text-muted-foreground mt-1",children:"Discover and add powerful integrations to your AI assistant"})]})]})}),(0,a.jsxs)("div",{className:"flex gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)(ew.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),(0,a.jsx)(ej.p,{placeholder:"Search servers, integrations, and capabilities...",value:N,onChange:e=>w(e.target.value),className:"pl-10 h-10 border-border/40 focus:border-primary/50 bg-background shadow-sm"})]}),(0,a.jsxs)("div",{className:"flex bg-muted/80 rounded-lg p-1 border border-border/40",children:[(0,a.jsxs)(b.$,{variant:"list"===k?"secondary":"ghost",size:"sm",onClick:()=>{C("list"),A(null)},className:(0,l.cn)("h-8 px-3 rounded-md transition-all","list"===k?"bg-background shadow-sm":"hover:bg-background/80"),children:[(0,a.jsx)(eX.A,{className:"h-4 w-4 mr-2"}),"List"]}),(0,a.jsxs)(b.$,{variant:"grid"===k?"secondary":"ghost",size:"sm",onClick:()=>{C("grid"),A(null)},className:(0,l.cn)("h-8 px-3 rounded-md transition-all","grid"===k?"bg-background shadow-sm":"hover:bg-background/80"),children:[(0,a.jsx)(e0.A,{className:"h-4 w-4 mr-2"}),"Grid"]})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto -mx-2 px-2",children:[p&&(0,a.jsx)(eg.Fc,{variant:"destructive",className:"mb-6 border-red-200/50 bg-red-50/50",children:(0,a.jsx)(eg.TN,{className:"text-red-800",children:p})}),x?(0,a.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,a.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,a.jsx)("div",{className:"h-10 w-10 border-3 border-primary/20 border-t-primary rounded-full animate-spin"}),(0,a.jsx)("div",{className:"text-base text-muted-foreground font-medium",children:"Discovering servers..."}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground/70",children:"Loading registry entries"})]})}):0===c.length?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,a.jsx)("div",{className:"p-4 rounded-2xl bg-muted/30 border border-border/20 mb-6",children:(0,a.jsx)(eQ.A,{className:"h-12 w-12 text-muted-foreground/60 mx-auto"})}),(0,a.jsx)("div",{className:"text-lg font-medium text-muted-foreground mb-2",children:0===i.length?"No servers available in the registry":"No servers match your search"}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground/70 mb-4",children:0===i.length?"The registry is currently empty or failed to load":"Try adjusting your search terms or browse all categories"}),N&&(0,a.jsxs)(b.$,{variant:"outline",onClick:()=>w(""),className:"border-primary/20 hover:bg-primary/5",children:[(0,a.jsx)(ew.A,{className:"h-4 w-4 mr-2"}),"Clear search"]})]}):(0,a.jsx)("div",{className:(0,l.cn)("grid"===k?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-4":"space-y-3"),children:c.map((e,t)=>{let s=S===e.id,r=e.description&&e.description.length>100;return"grid"===k?(0,a.jsx)(eW,{className:(0,l.cn)("group relative overflow-hidden transition-all duration-300 border-border/30 hover:border-primary/30 hover:shadow-lg bg-gradient-to-b from-card/90 to-card/50 backdrop-blur-sm",s&&"ring-2 ring-primary/20 border-primary/50 shadow-xl"),style:{animationDelay:"".concat(Math.min(30*t,300),"ms")},children:(0,a.jsxs)("div",{className:"cursor-pointer",onClick:()=>A(s?null:e.id),children:[(0,a.jsx)(eH,{className:"pb-4",children:(0,a.jsx)("div",{className:"flex items-start justify-between",children:(0,a.jsxs)("div",{className:"flex items-center gap-4 flex-1",children:[(0,a.jsx)("div",{className:"text-3xl p-3 rounded-xl bg-gradient-to-br from-primary/10 to-primary/5 border border-primary/20 group-hover:border-primary/30 transition-all",children:e.icon||"⚡"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)(eY,{className:"text-base font-semibold mb-2 group-hover:text-primary transition-colors leading-tight",children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[e.isOfficial&&(0,a.jsxs)(eC.E,{className:"text-xs px-2 py-1 bg-blue-100 text-blue-700 border-blue-200",children:[(0,a.jsx)(eN.A,{className:"h-3 w-3 mr-1"}),"Official"]}),e.isInstalled&&(0,a.jsxs)(eC.E,{className:"text-xs px-2 py-1 bg-green-100 text-green-700 border-green-200",children:[(0,a.jsx)(F.A,{className:"h-3 w-3 mr-1"}),"Connected"]}),e.category&&(0,a.jsx)(eC.E,{variant:"outline",className:(0,l.cn)("text-xs px-2 py-1",(e=>{let t={productivity:"bg-blue-100 text-blue-800",development:"bg-green-100 text-green-800",research:"bg-purple-100 text-purple-800",creative:"bg-pink-100 text-pink-800",data:"bg-orange-100 text-orange-800",communication:"bg-indigo-100 text-indigo-800",custom:"bg-gray-100 text-gray-800"};return t[e]||t.custom})(e.category)),children:e.category})]})]})]})})}),(0,a.jsxs)(eZ,{className:"pt-0",children:[(0,a.jsx)("p",{className:(0,l.cn)("text-sm text-muted-foreground leading-relaxed mb-4 transition-all duration-300",s?"":"line-clamp-2"),children:e.description}),s&&(0,a.jsxs)("div",{className:"space-y-4 pt-4 border-t border-border/20 animate-in slide-in-from-top-1 duration-300",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 text-xs",children:e.author&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"p-1 rounded bg-muted/50",children:(0,a.jsx)(e1.A,{className:"h-3 w-3 text-muted-foreground"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-foreground",children:"Author"}),(0,a.jsx)("div",{className:"text-muted-foreground",children:e.author})]})]})}),e.tags&&e.tags.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-medium text-foreground mb-2",children:"Tags"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.tags.slice(0,8).map(e=>(0,a.jsx)(eC.E,{variant:"outline",className:"text-xs px-2 py-0.5 text-muted-foreground border-border/40 bg-background/50",children:e},e)),e.tags.length>8&&(0,a.jsxs)(eC.E,{variant:"outline",className:"text-xs px-2 py-0.5 text-muted-foreground border-border/40 bg-background/50",children:["+",e.tags.length-8]})]})]}),e.homepage&&(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsxs)("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-primary hover:text-primary/80 transition-colors font-medium",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(e2.A,{className:"h-4 w-4"}),"View Documentation"]})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-4",children:[r&&(0,a.jsx)(b.$,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-primary p-0 h-auto",children:s?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{className:"h-3 w-3 mr-1"}),"Show less"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.A,{className:"h-3 w-3 mr-1"}),"Show more"]})}),(0,a.jsx)("div",{className:"ml-auto",children:(0,a.jsx)(b.$,{onClick:t=>{t.stopPropagation(),D(e)},disabled:e.isInstalled||g===e.id,size:"sm",variant:e.isInstalled?"outline":"default",className:(0,l.cn)("min-w-[75px] transition-all font-medium",g===e.id&&"opacity-70",!e.isInstalled&&"bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary shadow-md hover:shadow-lg"),children:g===e.id?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"h-3 w-3 border-2 border-current border-t-transparent rounded-full animate-spin"}),(0,a.jsx)("span",{children:"Connecting"})]}):e.isInstalled?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(F.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:"Connected"})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(e4.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:"Connect"})]})})})]})]})]})},e.id):(0,a.jsx)(eW,{className:(0,l.cn)("group transition-all duration-200 border-border/30 hover:border-primary/20 hover:shadow-md bg-card/50 hover:bg-card/80 cursor-pointer !py-0 !gap-0",s&&"border-primary/30 shadow-lg bg-card/90",r&&"hover:bg-card/85"),onClick:()=>A(s?null:e.id),children:(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-xl bg-gradient-to-br from-primary/10 via-primary/5 to-transparent border border-primary/15 flex items-center justify-center text-lg font-medium",children:e.icon||"⚡"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)("h3",{className:"text-base font-medium text-foreground group-hover:text-primary transition-colors leading-tight",children:e.name}),r&&(0,a.jsx)(m.A,{className:(0,l.cn)("h-4 w-4 text-muted-foreground/60 transition-all duration-200 flex-shrink-0",s&&"rotate-180 text-muted-foreground")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.isOfficial&&(0,a.jsxs)(eC.E,{className:"text-xs font-medium px-2 py-0.5 bg-blue-50 text-blue-600 border-blue-100 hover:bg-blue-100",children:[(0,a.jsx)(eN.A,{className:"h-2.5 w-2.5 mr-1 fill-current"}),"Official"]}),e.isInstalled&&(0,a.jsxs)(eC.E,{className:"text-xs font-medium px-2 py-0.5 bg-green-50 text-green-600 border-green-100",children:[(0,a.jsx)(F.A,{className:"h-2.5 w-2.5 mr-1"}),"Connected"]}),(0,a.jsx)(eC.E,{variant:"outline",className:"text-xs font-medium px-2 py-0.5 bg-background/50 text-muted-foreground border-border/40 capitalize",children:e.category})]})]}),(0,a.jsx)(b.$,{onClick:t=>{t.stopPropagation(),D(e)},disabled:e.isInstalled||g===e.id,size:"sm",variant:e.isInstalled?"outline":"default",className:(0,l.cn)("min-w-[80px] h-8 text-xs font-medium transition-all",g===e.id&&"opacity-70",!e.isInstalled&&"bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary shadow-sm hover:shadow-md"),children:g===e.id?(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("div",{className:"h-3 w-3 border-2 border-current border-t-transparent rounded-full animate-spin"}),(0,a.jsx)("span",{children:"Connecting..."})]}):e.isInstalled?(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(F.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:"Connected"})]}):(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(e4.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:"Connect"})]})})]}),(0,a.jsx)("div",{children:(0,a.jsx)("p",{className:(0,l.cn)("text-sm text-muted-foreground leading-relaxed transition-all duration-300",s?"":"line-clamp-2"),children:e.description})}),s&&(0,a.jsxs)("div",{className:"space-y-4 pt-4 border-t border-border/10 animate-in slide-in-from-top-2 duration-300",children:[e.author&&(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/20 border border-border/10",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-primary/10",children:(0,a.jsx)(e1.A,{className:"h-4 w-4 text-primary"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Author"}),(0,a.jsx)("div",{className:"text-sm font-medium text-foreground",children:e.author})]})]}),e.tags&&e.tags.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[(0,a.jsx)(e5.A,{className:"h-4 w-4 text-primary"}),"Tags"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tags.map(e=>(0,a.jsx)(eC.E,{variant:"outline",className:"text-xs px-3 py-1 text-muted-foreground border-border/40 bg-background/60 hover:bg-background/80 transition-colors",children:e},e))})]}),e.homepage&&(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsxs)("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-primary hover:text-primary/80 transition-colors font-medium px-4 py-2 rounded-lg border border-primary/20 hover:border-primary/40 bg-primary/5 hover:bg-primary/10",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(e2.A,{className:"h-4 w-4"}),"View Documentation"]})})]})]})]})})},e.id)})})]})]})})}var e8=s(9559),e6=s(6826),e7=s(6617),e9=s(1360),te=s(5159);let tt="/api";function ts(e){return{type:e.config.type,command:e.config.command,args:e.config.args||[],url:e.config.url,env:e.config.env||{},headers:e.config.headers||{},timeout:e.config.timeout||3e4}}function tr(e){let{isOpen:t,onClose:s,onOpenConnectModal:r,onOpenConnectWithPrefill:i,variant:o="overlay",refreshTrigger:d}=e,[x,h]=(0,n.useState)([]),[p,f]=(0,n.useState)(null),[g,v]=(0,n.useState)([]),[j,y]=(0,n.useState)(!1),[N,w]=(0,n.useState)(!1),[k,C]=(0,n.useState)(null),[S,A]=(0,n.useState)(null),[E,T]=(0,n.useState)(!1),[I,R]=(0,n.useState)(null),[D,L]=(0,n.useState)(!1),P=(e,t)=>{console.error("ServersPanel Error (".concat(t,"):"),e),"servers"===t&&C(e),"tools"===t&&A(e)},F=(0,n.useCallback)(async e=>{y(!0),C(null),h([]),f(null),v([]),A(null);try{let t=await fetch("".concat(tt,"/mcp/servers"),e?{signal:e}:{});if(!t.ok){let e=await t.json().catch(()=>({error:"Failed to fetch servers"}));throw Error(e.message||e.error||"Server List: ".concat(t.statusText))}let s=(await t.json()).servers||[];if(h(s),s.length>0){let e=s.find(e=>"connected"===e.status);e?f(e.id):s.length>0&&f(s[0].id)}else console.log("No MCP servers found or returned from API.")}catch(e){"AbortError"!==e.name&&P(e.message,"servers")}finally{(null==e?void 0:e.aborted)||y(!1)}},[]),O=async e=>{if(L(!1),"function"==typeof i){let t=ts(e);i({name:e.name,config:t,lockName:!0,registryEntryId:e.id});return}try{let t=await fetch("/api/connect-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,config:ts(e)})}),s=await t.json();if(!t.ok)throw Error(s.error||"Server returned status ".concat(t.status));await F();try{await eG.syncWithServerStatus()}catch(e){console.warn("Failed to sync registry after server install:",e)}}catch(e){throw Error(e.message||"Failed to install server")}},z=async e=>{let t=x.find(t=>t.id===e);if(t&&window.confirm('Are you sure you want to remove server "'.concat(t.name,'"?'))){R(e),C(null);try{let t=await fetch("".concat(tt,"/mcp/servers/").concat(e),{method:"DELETE"});if(!t.ok){let e=await t.json().catch(()=>({error:"Failed to remove server"}));throw Error(e.message||e.error||"Server Removal: ".concat(t.statusText))}p===e&&(f(null),v([]));try{let t=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-"),s=t(e),r=(await eG.getEntries()).find(e=>[e.id,e.name,...e.matchIds||[]].filter(Boolean).map(e=>t(String(e))).includes(s));r&&await eG.setInstalled(r.id,!1)}catch(e){console.warn("Failed to update registry installed state on delete:",e)}await F();try{await eG.syncWithServerStatus()}catch(e){console.warn("Failed to sync registry status after server deletion:",e)}}catch(e){P(e.message,"servers")}finally{R(null)}}};(0,n.useEffect)(()=>{if(!t)return;let e=new AbortController;return F(e.signal),R(null),()=>{e.abort()}},[t,F]),(0,n.useEffect)(()=>{if(d&&t){let e=new AbortController;return F(e.signal),()=>{e.abort()}}},[d,t,F]);let M=(0,n.useCallback)(async(e,t)=>{let s=x.find(t=>t.id===e);if(v([]),A(null),!s||"connected"!==s.status)return void console.warn('Server "'.concat((null==s?void 0:s.name)||e,'" is not connected or not found. Cannot fetch tools.'));w(!0);try{let r=await fetch("".concat(tt,"/mcp/servers/").concat(e,"/tools"),t?{signal:t}:{});if(!r.ok){let e=await r.json().catch(()=>({error:"Failed to fetch tools for ".concat(s.name)}));throw Error(e.message||e.error||"Tool List (".concat(s.name,"): ").concat(r.statusText))}let a=await r.json();(null==t?void 0:t.aborted)||v(a.tools||[]),a.tools&&0!==a.tools.length||console.log('No tools found for server "'.concat(s.name,'".'))}catch(e){"AbortError"!==e.name&&P(e.message,"tools")}finally{(null==t?void 0:t.aborted)||w(!1)}},[x]);(0,n.useEffect)(()=>{if(!p)return;let e=new AbortController;return M(p,e.signal),()=>{e.abort()}},[p,M]);let _=x.find(e=>e.id===p);if("overlay"===o&&!t)return null;let U=(0,l.cn)("fixed top-0 right-0 z-40 h-screen w-80 bg-card border-l border-border shadow-xl transition-transform transform flex flex-col",t?"translate-x-0":"translate-x-full"),K=(0,l.cn)("h-full w-full flex flex-col bg-card");return(0,a.jsxs)("aside",{className:"overlay"===o?U:K,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/50 bg-card/50 backdrop-blur-sm",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Tools & Servers"}),(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:()=>F(),disabled:j,className:"h-8 w-8 p-0",children:(0,a.jsx)(e8.A,{className:(0,l.cn)("h-3.5 w-3.5",j&&"animate-spin")})}),"overlay"===o&&(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:s,className:"h-8 w-8 p-0",children:(0,a.jsx)(u.A,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)("div",{className:"px-4 py-3 space-y-2 border-b border-border/30",children:[(0,a.jsxs)(b.$,{onClick:r,className:"w-full h-9 text-sm font-medium",size:"sm",children:[(0,a.jsx)(e6.A,{className:"mr-2 h-4 w-4"}),"Connect Server"]}),(0,a.jsxs)(b.$,{onClick:()=>L(!0),variant:"outline",className:"w-full h-9 text-sm font-medium",size:"sm",children:[(0,a.jsx)(e7.A,{className:"mr-2 h-4 w-4"}),"Browse Registry"]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-border/30",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,a.jsxs)("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Connected Servers (",x.length,")"]})}),j&&(0,a.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,a.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,a.jsx)(e8.A,{className:"h-5 w-5 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Loading servers..."})]})}),k&&(0,a.jsx)("div",{className:"p-3 rounded-lg bg-destructive/10 border border-destructive/20 mb-3",children:(0,a.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 text-destructive flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-destructive",children:"Connection Error"}),(0,a.jsx)("p",{className:"text-xs text-destructive/80 mt-1",children:k})]})]})}),!j&&0===x.length&&!k&&(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)(eQ.A,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"No servers connected"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Connect or browse the registry"})]}),x.map(e=>(0,a.jsx)("div",{onClick:()=>f(e.id),className:(0,l.cn)("p-3 rounded-lg border cursor-pointer transition-all duration-200 mb-2 last:mb-0",p===e.id?"bg-primary/5 border-primary/20 shadow-sm":"bg-background hover:bg-muted/50 border-border/50 hover:border-border"),children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("div",{className:(0,l.cn)("w-2 h-2 rounded-full flex-shrink-0","connected"===e.status?"bg-green-500":"error"===e.status?"bg-red-500":"bg-yellow-500")}),(0,a.jsx)("h4",{className:"text-sm font-medium truncate",children:e.name})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1 capitalize",children:e.status})]}),I===e.id?(0,a.jsx)(e8.A,{className:"h-4 w-4 animate-spin text-muted-foreground"}):(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),z(e.id)},className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:(0,a.jsx)(e9.A,{className:"h-3.5 w-3.5"})})]})},e.id))]}),_&&(0,a.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,a.jsx)("div",{className:"px-4 py-3 border-b border-border/30",children:(0,a.jsxs)("button",{onClick:()=>T(!E),className:"flex items-center justify-between w-full text-left",children:[(0,a.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Available Tools"}),(0,a.jsx)(m.A,{className:(0,l.cn)("h-3.5 w-3.5 transition-transform text-muted-foreground",E&&"rotate-180")})]})}),E&&(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:[N&&(0,a.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,a.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,a.jsx)(e8.A,{className:"h-4 w-4 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Loading tools..."})]})}),S&&(0,a.jsx)("div",{className:"p-3 rounded-lg bg-destructive/10 border border-destructive/20 mb-3",children:(0,a.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,a.jsx)(c.A,{className:"h-4 w-4 text-destructive flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-destructive",children:"Tools Error"}),(0,a.jsx)("p",{className:"text-xs text-destructive/80 mt-1",children:S})]})]})}),!N&&0===g.length&&!S&&"connected"===_.status&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)(te.A,{className:"h-6 w-6 text-muted-foreground/50 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tools available"})]}),"connected"!==_.status&&(0,a.jsxs)("div",{className:"text-center py-6",children:[(0,a.jsx)(c.A,{className:"h-6 w-6 text-muted-foreground/50 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Server not connected"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Tools unavailable"})]}),g.map(e=>{var t;return(0,a.jsxs)("div",{className:"p-3 rounded-lg border border-border/50 bg-background hover:bg-muted/30 transition-colors mb-2 last:mb-0",children:[(0,a.jsx)("h4",{className:"text-sm font-medium mb-1",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2",children:e.description}),(null==(t=e.inputSchema)?void 0:t.properties)&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[Object.keys(e.inputSchema.properties).slice(0,3).map(e=>(0,a.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-muted text-xs font-medium",children:e},e)),Object.keys(e.inputSchema.properties).length>3&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["+",Object.keys(e.inputSchema.properties).length-3," more"]})]})]},e.name)})]})]})]}),(0,a.jsx)(e3,{isOpen:D,onClose:()=>L(!1),onInstallServer:O})]})}let ta=n.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("relative overflow-auto",s),...n,children:r})});ta.displayName="ScrollArea";var tn=s(4485),ti=s(7107),tl=s(6983),to=s(6485);let tc=function(e){let{onClick:t,className:s,variant:r="outline",side:n="bottom"}=e;return(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)(b.$,{variant:r,size:"sm",onClick:t,className:["h-8 w-8 p-0",s].filter(Boolean).join(" "),"aria-label":"New chat",children:(0,a.jsx)(e4.A,{className:"h-4 w-4"})})}),(0,a.jsx)(j,{side:n,children:"New Chat (⌘K)"})]})})};function td(e){let{isOpen:t,onClose:s,currentSessionId:r,onSessionChange:i,returnToWelcome:o,variant:d="modal",onSearchOpen:m,onNewChat:u}=e,[x,h]=(0,n.useState)([]),[p,y]=(0,n.useState)(!1),[N,w]=(0,n.useState)(null),[k,C]=(0,n.useState)(!1),[S,A]=(0,n.useState)(""),[E,T]=(0,n.useState)(null),[I,R]=(0,n.useState)(!1),[D,L]=(0,n.useState)(null),[P,F]=(0,n.useState)(!1),O=(0,n.useCallback)(async()=>{y(!0),w(null);try{let e=await fetch("/api/sessions");if(!e.ok)throw Error("Failed to fetch sessions");let t=await e.json();h(t.sessions||[])}catch(e){console.error("Error fetching sessions:",e),w(e instanceof Error?e.message:"Failed to fetch sessions")}finally{y(!1)}},[]);(0,n.useEffect)(()=>{t&&O()},[t,O]),(0,n.useEffect)(()=>{let e=()=>{t&&O()},s=()=>{t&&O()};return window.addEventListener("dexto:message",e),window.addEventListener("dexto:response",s),()=>{window.removeEventListener("dexto:message",e),window.removeEventListener("dexto:response",s)}},[t,O]);let z=async()=>{try{let e=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:S.trim()||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to create session")}let t=await e.json();h(e=>[...e,t.session]),A(""),C(!1),i(t.session.id)}catch(e){console.error("Error creating session:",e),w(e instanceof Error?e.message:"Failed to create session")}},M=async e=>{T(e);try{let t=await fetch("/api/sessions/".concat(e),{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete session")}h(t=>t.filter(t=>t.id!==e)),r===e&&o()}catch(e){console.error("Error deleting session:",e),w(e instanceof Error?e.message:"Failed to delete session")}finally{T(null)}},_=async()=>{if(D){F(!0);try{if(!(await fetch("/api/sessions/".concat(D),{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to delete conversation");h(e=>e.filter(e=>e.id!==D)),r===D&&o(),R(!1),L(null)}catch(e){console.error("Error deleting conversation:",e),w(e instanceof Error?e.message:"Failed to delete conversation")}finally{F(!1)}}},U=(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-border/50",children:[(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsx)("h2",{className:"text-base font-semibold",children:"Chat History"})}),(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[m&&(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)(b.$,{variant:"outline",size:"sm",onClick:m,className:"h-7 w-7 p-0","aria-label":"Search conversations",children:(0,a.jsx)(ew.A,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(j,{children:"Search conversations (⌘⇧S)"})]})}),u&&(0,a.jsx)(tc,{onClick:u,variant:"outline"})]})]}),N&&(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)(eg.Fc,{variant:"destructive",children:[(0,a.jsx)(c.A,{className:"h-4 w-4"}),(0,a.jsx)(eg.TN,{children:N})]})}),(0,a.jsx)(ta,{className:"flex-1 p-4",children:(0,a.jsx)("div",{className:"space-y-2",children:p?(0,a.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,a.jsx)(e8.A,{className:"h-6 w-6 animate-spin"})}):0===x.length?(0,a.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,a.jsx)(tn.A,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,a.jsx)("p",{children:"No chat history"}),(0,a.jsx)("p",{className:"text-sm",children:"Start a conversation to see it here"})]}):x.map(e=>(0,a.jsx)("div",{className:(0,l.cn)("group p-3 rounded-lg border border-border/50 bg-card hover:bg-muted/50 transition-all cursor-pointer",r===e.id&&"ring-2 ring-primary bg-primary/5"),onClick:()=>i(e.id),children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 mb-2",children:[(0,a.jsx)("h3",{className:"font-medium text-sm truncate",children:e.id}),r===e.id&&(0,a.jsx)(eC.E,{variant:"secondary",className:"text-xs",children:"Active"})]}),(0,a.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,a.jsx)(ti.A,{className:"h-3 w-3"}),(0,a.jsxs)("span",{children:[e.messageCount," messages"]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,a.jsx)(tl.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:(e=>{if(!e)return"Unknown";let t=new Date(e),s=new Date().getTime()-t.getTime(),r=Math.floor(s/6e4),a=Math.floor(s/36e5),n=Math.floor(s/864e5);return r<1?"Just now":r<60?"".concat(r,"m ago"):a<24?"".concat(a,"h ago"):"".concat(n,"d ago")})(e.lastActivity)})]})]}),e.createdAt&&(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,a.jsx)(to.A,{className:"h-3 w-3"}),(0,a.jsxs)("span",{children:["Created ",(e=>{if(!e)return"Unknown";let t=new Date(e);return t.toLocaleDateString()+" "+t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})(e.createdAt)]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[e.messageCount>0&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),L(e.id),R(!0)},className:"h-8 w-8 p-0",title:"Delete Conversation",children:(0,a.jsx)(e9.A,{className:"h-4 w-4 text-destructive"})})}),0===e.messageCount&&(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),M(e.id)},disabled:E===e.id,className:"h-8 w-8 p-0",title:"Delete Session",children:(0,a.jsx)(e9.A,{className:"h-4 w-4 text-destructive"})})]})]})},e.id))})}),(0,a.jsx)(ep.lG,{open:k,onOpenChange:C,children:(0,a.jsxs)(ep.Cf,{className:"sm:max-w-md",children:[(0,a.jsx)(ep.c7,{children:(0,a.jsx)(ep.L3,{children:"Start New Chat"})}),(0,a.jsx)("div",{className:"space-y-4",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(ef.J,{htmlFor:"sessionId",children:"Chat ID"}),(0,a.jsx)(ej.p,{id:"sessionId",value:S,onChange:e=>A(e.target.value),placeholder:"e.g., user-123, project-alpha",className:"font-mono"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to auto-generate a unique ID"})]})}),(0,a.jsxs)(ep.Es,{children:[(0,a.jsx)(b.$,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),(0,a.jsx)(b.$,{onClick:z,children:"Start Chat"})]})]})}),(0,a.jsx)(ep.lG,{open:I,onOpenChange:R,children:(0,a.jsxs)(ep.Cf,{className:"sm:max-w-md",children:[(0,a.jsxs)(ep.c7,{children:[(0,a.jsxs)(ep.L3,{className:"flex items-center space-x-2",children:[(0,a.jsx)(e9.A,{className:"h-5 w-5 text-destructive"}),(0,a.jsx)("span",{children:"Delete Conversation"})]}),(0,a.jsxs)(ep.rr,{children:["This will permanently delete this conversation and all its messages. This action cannot be undone.",D&&(0,a.jsxs)("span",{className:"block mt-2 font-medium",children:["Session: ",(0,a.jsx)("span",{className:"font-mono",children:D})]})]})]}),(0,a.jsxs)(ep.Es,{children:[(0,a.jsx)(b.$,{variant:"outline",onClick:()=>R(!1),children:"Cancel"}),(0,a.jsxs)(b.$,{variant:"destructive",onClick:_,disabled:P,className:"flex items-center space-x-2",children:[(0,a.jsx)(e9.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:P?"Deleting...":"Delete Conversation"})]})]})]})})]});return"inline"===d?(0,a.jsx)("div",{className:"h-full",children:U}):(0,a.jsx)(ep.lG,{open:t,onOpenChange:s,children:(0,a.jsx)(ep.Cf,{className:"sm:max-w-lg h-[600px] flex flex-col p-0",children:U})})}var tm=s(4916);function tu(e){let{websocket:t}=e,[s,r]=(0,n.useState)(null),[l,o]=(0,n.useState)(!1),[d,m]=(0,n.useState)(!1),{currentSessionId:u}=(0,i.v)(),x=n.useRef([]);(0,n.useEffect)(()=>{if(!t)return;let e=e=>{try{let s=JSON.parse(e.data);if("toolConfirmationRequest"===s.event){var t;let e=null==s||null==(t=s.data)?void 0:t.sessionId;if(!e||e!==u)return;let a={...s.data,timestamp:new Date(s.data.timestamp)};console.debug("[WebUI] Received toolConfirmationRequest",a),d?x.current.push(a):(r(a),m(!0),o(!1))}}catch(e){console.error("Error parsing WebSocket message:",e)}};return t.addEventListener("message",e),()=>{t.removeEventListener("message",e)}},[t,d,u]);let h=(0,n.useCallback)(e=>{if(!s||!t)return;let a={type:"toolConfirmationResponse",data:{executionId:s.executionId,approved:e,rememberChoice:l,sessionId:s.sessionId}};if(console.debug("[WebUI] Sending toolConfirmationResponse",a),t.send(JSON.stringify(a)),m(!1),r(null),o(!1),x.current.length>0){let e=x.current.shift();setTimeout(()=>{r(e),m(!0)},0)}},[s,l,t]);return((0,n.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{h(!1)},12e4);return()=>clearTimeout(e)},[d,h]),s)?(0,a.jsx)(ep.lG,{open:d,onOpenChange:e=>{e||h(!1)},children:(0,a.jsxs)(ep.Cf,{className:"sm:max-w-[800px] max-w-[95vw] max-h-[90vh] overflow-hidden flex flex-col",children:[(0,a.jsx)(ep.c7,{children:(0,a.jsxs)(ep.L3,{className:"flex items-center gap-2",children:[(0,a.jsx)(c.A,{className:"h-5 w-5 text-yellow-500"}),"Tool Execution Confirmation"]})}),(0,a.jsxs)("div",{className:"space-y-4 overflow-y-auto flex-1 min-h-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(D.A,{className:"h-4 w-4 text-blue-500"}),(0,a.jsx)("span",{className:"font-medium",children:"Tool:"}),(0,a.jsx)(eC.E,{variant:"outline",children:s.toolName})]}),s.description&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium",children:"Description:"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:s.description})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium mb-2",children:"Arguments:"}),(0,a.jsx)("div",{className:"bg-background/50 p-3 rounded-md text-xs overflow-auto max-h-80 min-h-16 text-muted-foreground border",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words font-mono",children:(e=>{if(!e)return"No arguments";try{return JSON.stringify(e,null,2)}catch(t){return String(e)}})(s.args)})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,a.jsx)(tl.A,{className:"h-4 w-4"}),(0,a.jsxs)("span",{children:["Requested at: ",s.timestamp.toLocaleString()]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(tm.S,{id:"remember",checked:l,onCheckedChange:e=>o(!0===e),className:"ml-1"}),(0,a.jsx)("label",{htmlFor:"remember",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Approve future executions of this tool for this session"})]}),(0,a.jsx)("div",{className:"bg-yellow-50 p-3 rounded-md",children:(0,a.jsxs)("p",{className:"text-sm text-yellow-800",children:[(0,a.jsx)("strong",{children:"Security Notice:"})," Only approve tools you trust. Tools can access your system and data according to their permissions."]})})]}),(0,a.jsxs)(ep.Es,{className:"gap-2 flex-shrink-0 mt-4 pt-4 border-t",children:[(0,a.jsx)(b.$,{variant:"outline",onClick:()=>h(!1),className:"bg-red-50 hover:bg-red-100 text-red-700 border-red-200",children:"Deny"}),(0,a.jsx)(b.$,{onClick:()=>h(!0),className:"bg-green-600 hover:bg-green-700",children:"Approve"})]})]})}):null}var tx=s(5870),th=s(7586);function tp(e){let{isOpen:t,onClose:s,onNavigateToSession:r}=e,[i,o]=(0,n.useState)(""),[c,d]=(0,n.useState)([]),[m,u]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),[p,f]=(0,n.useState)(0),g=(0,n.useCallback)(async e=>{if(!e.trim()){d([]),h(null);return}u(!0),h(null);try{let t=new URLSearchParams({q:e,limit:"10",offset:"0"}),s=await fetch("/api/search/messages?".concat(t));if(!s.ok){let e=await s.text();throw Error("Search failed: ".concat(s.status," ").concat(e))}let r=await s.json();d(r.results),f(0)}catch(e){console.error("Search error:",e),d([]),h(e instanceof Error?e.message:"Search failed")}finally{u(!1)}},[]);(0,n.useEffect)(()=>{let e=setTimeout(()=>{g(i)},300);return()=>clearTimeout(e)},[i,g]),(0,n.useEffect)(()=>{t&&(o(""),d([]),h(null),f(0))},[t]),(0,n.useEffect)(()=>{if(!t)return;let e=e=>{if(t&&(!e.ctrlKey&&!e.metaKey||!e.shiftKey||"S"!==e.key))switch(e.key){case"ArrowDown":e.preventDefault(),e.stopPropagation(),f(e=>Math.min(e+1,c.length-1));break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),f(e=>Math.max(e-1,0));break;case"Enter":e.preventDefault(),e.stopPropagation(),c[p]&&v(c[p]);break;case"Escape":e.preventDefault(),e.stopPropagation(),s()}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,c,p,s]);let v=e=>{r(e.sessionId,e.messageIndex),s()};return(0,a.jsx)(ep.lG,{open:t,onOpenChange:e=>!e&&s(),children:(0,a.jsxs)(ep.Cf,{className:"max-w-2xl p-0 top-[20%] transform translate-y-0",children:[(0,a.jsx)(ep.c7,{children:(0,a.jsx)(ep.L3,{className:"sr-only",children:"Search Conversations"})}),(0,a.jsxs)("div",{className:"flex flex-col max-h-[70vh]",children:[(0,a.jsx)("div",{className:"p-6 pb-4",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(ew.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),(0,a.jsx)(ej.p,{placeholder:"Search conversations...",value:i,onChange:e=>o(e.target.value),className:"pl-12 text-lg border-0 shadow-none focus-visible:ring-0 bg-transparent",autoFocus:!0})]})}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden border-t",children:m?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,a.jsx)(e8.A,{className:"h-6 w-6 animate-spin mr-3"}),(0,a.jsx)("span",{className:"text-muted-foreground",children:"Searching..."})]}):x?(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(ew.A,{className:"w-12 h-12 mx-auto mb-4 text-destructive opacity-50"}),(0,a.jsx)("p",{className:"text-destructive font-medium",children:"Search Error"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-2",children:x}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:"Try again or check your connection."})]})}):(0,a.jsx)(ta,{className:"h-full",children:(0,a.jsx)("div",{className:"p-2",children:c.length>0?(0,a.jsx)("div",{className:"space-y-1",children:c.map((e,t)=>(0,a.jsxs)("div",{className:(0,l.cn)("flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-colors",t===p?"bg-accent text-accent-foreground":"hover:bg-accent/50"),onClick:()=>v(e),children:[(0,a.jsx)("div",{className:"flex-shrink-0 mt-1",children:(0,a.jsx)(eC.E,{className:(0,l.cn)("text-xs",(e=>{switch(e){case"user":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"assistant":return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";case"system":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200"}})(e.message.role)),children:(e=>{switch(e){case"user":return(0,a.jsx)(I.A,{className:"w-4 h-4"});case"assistant":return(0,a.jsx)(R.A,{className:"w-4 h-4"});case"system":return(0,a.jsx)(tx.A,{className:"w-4 h-4"});default:return(0,a.jsx)(th.A,{className:"w-4 h-4"})}})(e.message.role)})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:e.sessionId.length>20?"".concat(e.sessionId.slice(0,20),"..."):e.sessionId}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:e.message.role})]}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground line-clamp-2",children:((e,t)=>{if(!t)return e;let s=t.replace(/[.*+?^${}()|\[\]\\]/g,"\\$&"),r=RegExp("(".concat(s,")"),"gi");return e.split(r).map((e,t)=>r.test(e)?(0,a.jsx)("mark",{className:"bg-yellow-200 dark:bg-yellow-800 font-medium rounded px-1",children:e},t):e)})(e.context,i)})]}),(0,a.jsx)(P.A,{className:"w-4 h-4 text-muted-foreground flex-shrink-0 mt-1"})]},t))}):i?(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(ew.A,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground opacity-50"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:"No messages found matching your search."}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-2",children:"Try different keywords."})]}):(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(ew.A,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground opacity-50"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:"Start typing to search your conversations."}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-4 mt-4 text-xs text-muted-foreground",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"↑"}),(0,a.jsx)("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"↓"}),(0,a.jsx)("span",{children:"to navigate"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"Enter"}),(0,a.jsx)("span",{children:"to select"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"Esc"}),(0,a.jsx)("span",{children:"to close"})]})]})]})})})})]})]})})}var tf=s(7931),tg=s(7772),tv=s(9867),tj=s(6482),tb=s(7001),ty=s(2619),tN=s.n(ty),tw=s(7494),tk=s(9427);function tC(){let{theme:e,toggleTheme:t}=function(){let[e,t]=(0,n.useState)(()=>"undefined"!=typeof document?document.documentElement.classList.contains("dark")?"dark":"light":"dark");return(0,n.useEffect)(()=>{if("undefined"!=typeof document){document.documentElement.classList.toggle("dark","dark"===e);try{var t;localStorage.setItem("theme",e);let s=(null==(t=window.location)?void 0:t.protocol)==="https:";document.cookie="theme=".concat(encodeURIComponent(e),"; path=/; max-age=31536000; SameSite=Lax").concat(s?"; Secure":"")}catch(e){}}},[e]),{theme:e,toggleTheme:e=>{t(e?"dark":"light")},hasMounted:!0}}(),[s,r]=(0,n.useState)(!1);(0,n.useEffect)(()=>{r(!0)},[]);let i="dark"===e;return s?(0,a.jsx)(f,{children:(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)(Q.bL,{checked:i,onCheckedChange:t,className:"w-12 h-6 bg-gray-300 dark:bg-gray-700 rounded-full relative transition-colors flex items-center px-0.5","aria-label":"Toggle theme",children:(0,a.jsx)(Q.zi,{className:"\n w-5 h-5 rounded-full shadow flex items-center justify-center\n transition-transform transform\n translate-x-0.5 data-[state=checked]:translate-x-[1.375rem]\n bg-white dark:bg-gray-100\n ",children:i?(0,a.jsx)(tw.A,{className:"w-3.5 h-3.5 text-gray-700"}):(0,a.jsx)(tk.A,{className:"w-3.5 h-3.5 text-yellow-500"})})})}),(0,a.jsx)(j,{children:i?"Switch to light mode":"Switch to dark mode"})]})}):(0,a.jsx)("div",{className:"w-12 h-6 bg-gray-300 dark:bg-gray-700 rounded-full"})}function tS(e){let{active:t=!1}=e,{voices:s,selected:r,setSelected:i}=function(){let[e,t]=(0,n.useState)(A.getVoices()),[s,r]=(0,n.useState)(A.getPreferredVoiceName());return(0,n.useEffect)(()=>{let e=A.subscribeVoices(()=>{t(A.getVoices()),r(A.getPreferredVoiceName())});return()=>e()},[]),{voices:e,selected:s,setSelected:e=>{A.setPreferredVoice(e),r(A.getPreferredVoiceName())}}}(),[l,o]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{if(!t)return void o(!1);let e=window.requestIdleCallback?window.requestIdleCallback(()=>o(!0)):setTimeout(()=>o(!0),0);return()=>{window.cancelIdleCallback&&"number"==typeof e?window.cancelIdleCallback(e):clearTimeout(e)}},[t]),t)?(0,a.jsxs)(ev.l6,{value:null!=r?r:"auto",onValueChange:e=>{i("auto"===e?null:e)},children:[(0,a.jsx)(ev.bq,{className:"h-8 w-[12rem] text-xs",children:(0,a.jsx)(ev.yv,{placeholder:"Voice"})}),(0,a.jsxs)(ev.gC,{children:[(0,a.jsx)(ev.eb,{value:"auto",children:"Auto (best available)"}),l&&s.map(e=>(0,a.jsxs)(ev.eb,{value:e.name,children:[e.name," (",e.lang,")"]},"".concat(e.name,"-").concat(e.lang)))]})]}):null}function tA(e){let{isOpen:t,onClose:s}=e;return(0,a.jsx)(ep.lG,{open:t,onOpenChange:e=>!e&&s(),children:(0,a.jsxs)(ep.Cf,{className:"sm:max-w-lg",children:[(0,a.jsxs)(ep.c7,{children:[(0,a.jsx)(ep.L3,{children:"Settings"}),(0,a.jsx)(ep.rr,{children:"Configure preferences for speech and more."})]}),(0,a.jsx)("div",{className:"space-y-6 py-2",children:(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)(ef.J,{className:"text-xs uppercase text-muted-foreground",children:"Voice"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Choose a preferred text-to-speech voice. “Auto” selects the best available voice on your device."}),(0,a.jsx)(tS,{active:t})]})})]})})}function tE(){let{messages:e,sendMessage:t,currentSessionId:s,switchSession:r,isWelcomeState:o,returnToWelcome:d,websocket:u,activeError:h,clearError:p,processing:f,cancel:y,greeting:N}=(0,i.v)(),[w,k]=(0,n.useState)(!1),[C,S]=(0,n.useState)(!1),[A,E]=(0,n.useState)(!1),[T,I]=(0,n.useState)(!1),[R,L]=(0,n.useState)(!1),[P,F]=(0,n.useState)(!1),[O,z]=(0,n.useState)(!1),[M,_]=(0,n.useState)("dexto-config"),[U,K]=(0,n.useState)(null),[$,V]=(0,n.useState)(""),[q,B]=(0,n.useState)(!1),[J,W]=(0,n.useState)(null),[H,Y]=(0,n.useState)(!1),[Z,Q]=(0,n.useState)(!1),[X,ee]=(0,n.useState)(null),[et,es]=(0,n.useState)(!1),[er,ea]=(0,n.useState)(!1),[ed,em]=(0,n.useState)(""),eu=n.useRef(null),ex=n.useRef(null),[eh,ev]=(0,n.useState)(!0),[eb,ey]=(0,n.useState)(!1),[eN,ew]=(0,n.useState)(!1),ek=n.useRef(0),[eA,eE]=(0,n.useState)(!1),eT=n.useRef(null),[eI,eR]=(0,n.useState)(0),[eD,eL]=(0,n.useState)(null),eP=(0,n.useCallback)(()=>{let e=eu.current;e&&ev(e.scrollHeight-e.scrollTop<=e.clientHeight+1)},[]),eF=(0,n.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"auto",t=eu.current;t&&(ey(!0),t.scrollTo({top:t.scrollHeight,behavior:e}),requestAnimationFrame(()=>ey(!1)))},[]);(0,n.useEffect)(()=>{let e=eu.current;if(!e)return;let t=()=>{let t=ek.current,s=e.scrollTop;!eb&&eN&&s<t&&ew(!1),ek.current=s,eP(),e.scrollHeight-e.scrollTop<=e.clientHeight+1?(eE(!1),eT.current&&(window.clearTimeout(eT.current),eT.current=null)):(eE(!1),eT.current&&window.clearTimeout(eT.current),eT.current=window.setTimeout(()=>{eE(!0)},180))};return e.addEventListener("scroll",t),eP(),()=>e.removeEventListener("scroll",t)},[eP,eN,eb,o]),(0,n.useEffect)(()=>{let e=ex.current;if(!e)return;let t=new ResizeObserver(()=>{!eb&&(eN||eh)&&eF("auto")});return t.observe(e),()=>t.disconnect()},[eh,eb,eN,eF,o]),(0,n.useEffect)(()=>{eN&&eF("auto")},[eN,e,eF]);let eO=(0,n.useCallback)(()=>{let e=eu.current;if(!e)return;let t=e.querySelectorAll('[data-role="user"]'),s=t[t.length-1];if(!s)return void eF("auto");let r=e.getBoundingClientRect(),a=Math.max(s.getBoundingClientRect().top-r.top+e.scrollTop-16,0);ey(!0),e.scrollTo({top:a,behavior:"auto"}),requestAnimationFrame(()=>ey(!1))},[eF]);(0,n.useEffect)(()=>{P?fetch(s?"/api/config.yaml?sessionId=".concat(s):"/api/config.yaml").then(e=>{if(!e.ok)throw Error("Failed to fetch configuration");return e.text()}).then(e=>{V(e),K(null)}).catch(e=>{console.error("Preview fetch failed:",e),K(e instanceof Error?e.message:"Preview fetch failed")}):(V(""),K(null),B(!1))},[P,s]);let ez=(0,n.useCallback)(async()=>{try{let e=s?"/api/config.yaml?sessionId=".concat(s):"/api/config.yaml",t=await fetch(e);if(!t.ok)throw Error("Failed to fetch configuration");let r=await t.text(),a=new Blob([r],{type:"application/x-yaml"}),n=URL.createObjectURL(a),i=document.createElement("a");i.href=n,i.download=s?"".concat(M,"-").concat(s,".yml"):"".concat(M,".yml"),document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}catch(e){console.error("Download failed:",e),K(e instanceof Error?e.message:"Download failed")}},[M,s]),eM=(0,n.useCallback)(async()=>{try{await navigator.clipboard.writeText($),B(!0),setTimeout(()=>B(!1),2e3)}catch(e){console.error("Copy failed:",e),K("Failed to copy to clipboard")}},[$]),e_=(0,n.useCallback)(async(e,s,r)=>{Y(!0),ee(null);try{await t(e,s,r),setTimeout(()=>{eO(),ew(!0)},0)}catch(e){console.error("Failed to send message:",e),ee(e instanceof Error?e.message:"Failed to send message"),setTimeout(()=>ee(null),5e3)}finally{Y(!1)}},[t,eO]);(0,n.useEffect)(()=>{let e=()=>ew(!0),t=()=>ew(!1);return window.addEventListener("dexto:message",e),window.addEventListener("dexto:response",t),()=>{window.removeEventListener("dexto:message",e),window.removeEventListener("dexto:response",t)}},[]);let eU=(0,n.useCallback)(e=>{r(e),I(!1)},[r]),eK=(0,n.useCallback)(async e=>{let t={type:e.config.type,command:e.config.command,args:e.config.args||[],url:e.config.url,env:e.config.env||{},headers:e.config.headers||{},timeout:e.config.timeout||3e4};eL({name:e.name,config:t,lockName:!0,registryEntryId:e.id}),S(!1),k(!0)},[]),e$=(0,n.useCallback)(async()=>{if(s){ea(!0);try{if(!(await fetch("/api/sessions/".concat(s),{method:"DELETE"})).ok)throw Error("Failed to delete conversation");es(!1),d()}catch(e){console.error("Failed to delete conversation:",e),ee(e instanceof Error?e.message:"Failed to delete conversation"),setTimeout(()=>ee(null),5e3)}finally{ea(!1)}}},[s,d]);(0,n.useCallback)(e=>{e.preventDefault(),ed.trim()&&(e_(ed.trim()),em(""))},[ed,e_]);let eB=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!e.ok){let t="HTTP ".concat(e.status,": ").concat(e.statusText);try{let s=await e.json();t=s.message||s.error||t}catch(e){}throw Error(t)}let t=await e.json();eU(t.session.id)}catch(e){console.error("Error creating new session:",e),ee("Failed to create new session. Please try again."),setTimeout(()=>ee(null),5e3)}},[eU]),eJ=[{title:"Help me get started",description:"Show me what you can do",action:()=>e_("I'm new to Dexto. Can you show me your capabilities and help me understand how to work with you effectively?"),icon:"\uD83D\uDE80"},{title:"Create Snake Game",description:"Build a game and open it",action:()=>e_("Create a snake game in a new directory with HTML, CSS, and JavaScript, then open it in the browser for me to play."),icon:"\uD83D\uDC0D"},{title:"Connect new tools",description:"Browse and add MCP servers",action:()=>E(!0),icon:"\uD83D\uDD27"},{title:"Demonstrate tools",description:"Show me your capabilities",action:()=>e_("Pick one of your most interesting tools and demonstrate it with a practical example. Show me what it can do."),icon:"⚡"}];return(0,n.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&!e.shiftKey&&"h"===e.key&&(e.preventDefault(),I(e=>!e)),(e.ctrlKey||e.metaKey)&&!e.shiftKey&&"k"===e.key&&(e.preventDefault(),eB()),(e.ctrlKey||e.metaKey)&&!e.shiftKey&&"j"===e.key&&(e.preventDefault(),E(e=>!e)),(e.ctrlKey||e.metaKey)&&e.shiftKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),L(!0)),(e.ctrlKey||e.metaKey)&&!e.shiftKey&&"l"===e.key&&(e.preventDefault(),window.open("/playground","_blank")),(e.ctrlKey||e.metaKey)&&e.shiftKey&&"e"===e.key&&(e.preventDefault(),F(!0)),(e.ctrlKey||e.metaKey)&&!e.shiftKey&&"/"===e.key&&(e.preventDefault(),Q(!0)),"Escape"===e.key&&(A?E(!1):T?I(!1):C?S(!1):P?F(!1):Z?Q(!1):et?es(!1):X?ee(null):f&&y(s||void 0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[A,T,R,C,P,Z,et,X,L]),(0,a.jsxs)("div",{className:"flex h-screen bg-background",children:[(0,a.jsx)("div",{className:(0,l.cn)("shrink-0 transition-all duration-300 ease-in-out border-r border-border/50 bg-card/50 backdrop-blur-sm",T?"w-80":"w-0 overflow-hidden"),children:T&&(0,a.jsx)(td,{isOpen:T,onClose:()=>I(!1),currentSessionId:s,onSessionChange:eU,returnToWelcome:d,variant:"inline",onSearchOpen:()=>L(!0),onNewChat:eB})}),(0,a.jsxs)("main",{className:"flex-1 flex flex-col relative",style:{"--thread-max-width":"54rem"},children:[null,(0,a.jsx)("header",{className:"shrink-0 border-b border-border/50 bg-background/95 backdrop-blur-xl shadow-sm",children:(0,a.jsxs)("div",{className:"flex justify-between items-center px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:()=>I(!T),className:(0,l.cn)("h-8 w-8 p-0 transition-colors",T&&"bg-muted"),children:(0,a.jsx)(tf.A,{className:"h-4 w-4"})})}),(0,a.jsx)(j,{children:"Chat History (⌘H)"})]}),!T&&(0,a.jsx)(tc,{onClick:eB}),(0,a.jsxs)("a",{href:"https://dexto.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center space-x-3 hover:opacity-80 transition-opacity",children:[(0,a.jsx)("img",{src:"/logos/dexto_logo_light.svg",alt:"Dexto",className:"h-8 w-auto dark:hidden"}),(0,a.jsx)("img",{src:"/logos/dexto_logo.svg",alt:"Dexto",className:"h-8 w-auto hidden dark:block"}),(0,a.jsx)("span",{className:"sr-only",children:"Dexto"})]}),s&&!o&&(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsx)(eC.E,{variant:"secondary",className:"text-xs bg-muted/50 border-border/30",children:s})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,a.jsx)(tC,{}),(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)(b.$,{variant:"ghost",size:"sm",onClick:()=>z(!0),className:"h-8 w-8 p-0","aria-label":"Open settings",children:(0,a.jsx)(tx.A,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(j,{children:"Settings"})]}),(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",onClick:()=>E(!A),className:(0,l.cn)("h-8 px-2 text-sm transition-colors",A&&"bg-muted"),children:[(0,a.jsx)(D.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{className:"hidden sm:inline ml-1.5",children:"Tools"})]})}),(0,a.jsx)(j,{children:"Toggle tools panel (⌘J)"})]}),(0,a.jsxs)(g,{children:[(0,a.jsx)(v,{asChild:!0,children:(0,a.jsx)(b.$,{variant:"ghost",size:"sm",asChild:!0,className:"h-8 px-2 text-sm",children:(0,a.jsxs)(tN(),{href:"/playground",target:"_blank",rel:"noopener noreferrer",children:[(0,a.jsx)(eS.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{className:"hidden sm:inline ml-1.5",children:"Playground"})]})})}),(0,a.jsx)(j,{children:"Open MCP playground (⌘L)"})]}),(0,a.jsxs)(en,{children:[(0,a.jsx)(ei,{asChild:!0,children:(0,a.jsx)(b.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:(0,a.jsx)(tg.A,{className:"h-3.5 w-3.5"})})}),(0,a.jsxs)(el,{align:"end",children:[(0,a.jsxs)(eo,{onClick:()=>S(!0),children:[(0,a.jsx)(eQ.A,{className:"h-4 w-4 mr-2"}),"Browse MCP Registry"]}),(0,a.jsxs)(eo,{onClick:()=>F(!0),children:[(0,a.jsx)(tv.A,{className:"h-4 w-4 mr-2"}),"Export Config"]}),(0,a.jsxs)(eo,{onClick:()=>Q(!0),children:[(0,a.jsx)(tj.A,{className:"h-4 w-4 mr-2"}),"Shortcuts"]}),s&&!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ec,{}),(0,a.jsxs)(eo,{onClick:()=>es(!0),className:"text-destructive focus:text-destructive",children:[(0,a.jsx)(e9.A,{className:"h-4 w-4 mr-2"}),"Delete Conversation"]})]})]})]})]})]})}),(0,a.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[J&&(0,a.jsxs)("div",{className:"fixed bottom-4 right-4 z-50 border border-border/60 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 text-foreground px-3 py-2 rounded-md shadow-md inline-flex items-center gap-2",children:[(0,a.jsx)(x.A,{className:"h-4 w-4 text-green-600"}),(0,a.jsx)("span",{className:"text-sm",children:J})]}),X&&(0,a.jsx)("div",{className:"absolute top-4 right-4 z-50 bg-destructive text-destructive-foreground px-4 py-2 rounded-md shadow-lg",children:X}),(0,a.jsx)("div",{className:"flex-1 flex flex-col min-h-0",children:o||0===e.length?(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center p-6 -mt-20",children:(0,a.jsxs)("div",{className:"w-full max-w-[var(--thread-max-width)] mx-auto space-y-6",children:[(0,a.jsxs)("div",{className:"text-center space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,a.jsx)("img",{src:"/logos/dexto_logo_no_text.png",alt:"Dexto",className:"h-8 w-auto invert dark:invert-0"}),(0,a.jsx)("h2",{className:"text-2xl font-bold font-mono tracking-tight bg-gradient-to-r from-primary to-primary/70 bg-clip-text text-transparent",children:null!=N?N:"Welcome to Dexto"})]}),(0,a.jsx)("p",{className:"text-base text-muted-foreground max-w-xl mx-auto leading-relaxed",children:"Your AI assistant with powerful tools. Ask anything or connect new capabilities."})]}),(0,a.jsx)("div",{className:"flex flex-wrap justify-center gap-2 max-w-[var(--thread-max-width)] mx-auto",children:eJ.map((e,t)=>(0,a.jsx)("button",{onClick:e.action,className:"group px-3 py-2 text-left rounded-full bg-primary/5 hover:bg-primary/10 transition-all duration-200 hover:shadow-sm hover:scale-105",children:(0,a.jsxs)("div",{className:"flex items-center space-x-1.5",children:[(0,a.jsx)("span",{className:"text-sm",children:e.icon}),(0,a.jsx)("span",{className:"font-medium text-sm text-primary group-hover:text-primary/80 transition-colors",children:e.title})]})},t))}),(0,a.jsx)("div",{className:"max-w-[var(--thread-max-width)] mx-auto",children:(0,a.jsx)(eV,{onSend:e_,isSending:H,variant:"welcome"})}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground space-y-1 text-center",children:(0,a.jsxs)("p",{children:["\uD83D\uDCA1 Try ",(0,a.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"⌘K"})," for new chat, ",(0,a.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"⌘J"})," for tools, ",(0,a.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"⌘L"})," for playground, ",(0,a.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"⌘/"})," for shortcuts"]})})]})}):(0,a.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,a.jsx)("div",{ref:eu,className:"h-full overflow-y-auto overscroll-contain relative",children:(0,a.jsxs)("div",{className:"min-h-full grid grid-rows-[1fr_auto]",children:[(0,a.jsx)("div",{className:"w-full max-w-[var(--thread-max-width)] mx-auto",children:(0,a.jsx)(G,{messages:e,activeError:h,onDismissError:p,outerRef:ex})}),(0,a.jsxs)("div",{className:"sticky bottom-0 z-10 px-4 pt-2 pb-[calc(env(safe-area-inset-bottom)+16px)] bg-background relative",children:[eA&&(0,a.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 -top-3 z-20 pointer-events-none",children:(0,a.jsxs)("button",{onClick:()=>{eE(!1),eF("smooth")},className:"pointer-events-auto px-3 py-1.5 rounded-full shadow-sm bg-background/95 border border-border/60 backdrop-blur supports-[backdrop-filter]:bg-background/80 text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{children:"Scroll to bottom"}),(0,a.jsx)(m.A,{className:"h-3.5 w-3.5"})]})}),(0,a.jsx)("div",{className:"w-full max-w-[var(--thread-max-width)] mx-auto pointer-events-auto",children:(0,a.jsx)(eV,{onSend:e_,isSending:H,variant:"chat"})})]})]})})})}),(0,a.jsx)("div",{className:(0,l.cn)("shrink-0 transition-all duration-300 ease-in-out border-l border-border/50 bg-card/50 backdrop-blur-sm",A?"w-80":"w-0 overflow-hidden"),children:A&&(0,a.jsx)(tr,{isOpen:A,onClose:()=>E(!1),onOpenConnectModal:()=>k(!0),onOpenConnectWithPrefill:e=>{eL(e),k(!0)},variant:"inline",refreshTrigger:eI})})]}),(0,a.jsx)(eq.A,{isOpen:w,onClose:()=>{k(!1),eL(null)},onServerConnected:async()=>{if(null==eD?void 0:eD.registryEntryId)try{await eG.setInstalled(eD.registryEntryId,!0)}catch(e){console.warn("Failed to mark registry entry installed:",e)}eR(e=>e+1);let e=(null==eD?void 0:eD.name)||"Server";W("Added ".concat(e)),setTimeout(()=>W(null),4e3)},initialName:null==eD?void 0:eD.name,initialConfig:null==eD?void 0:eD.config,lockName:null==eD?void 0:eD.lockName}),(0,a.jsx)(e3,{isOpen:C,onClose:()=>S(!1),onInstallServer:eK}),(0,a.jsx)(ep.lG,{open:P,onOpenChange:F,children:(0,a.jsxs)(ep.Cf,{className:"sm:max-w-2xl",children:[(0,a.jsxs)(ep.c7,{children:[(0,a.jsxs)(ep.L3,{className:"flex items-center space-x-2",children:[(0,a.jsx)(tv.A,{className:"h-5 w-5"}),(0,a.jsx)("span",{children:"Export Configuration"})]}),(0,a.jsxs)(ep.rr,{children:["Download your tool configuration for Claude Desktop or other MCP clients",s&&(0,a.jsxs)("span",{className:"block mt-1 text-sm text-muted-foreground",children:["Including session-specific settings for: ",(0,a.jsx)("span",{className:"font-mono",children:s})]})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(ef.J,{htmlFor:"filename",children:"File name"}),(0,a.jsx)(ej.p,{id:"filename",value:M,onChange:e=>_(e.target.value),placeholder:"dexto-config",className:"font-mono"})]}),U&&(0,a.jsxs)(eg.Fc,{variant:"destructive",children:[(0,a.jsx)(c.A,{className:"h-4 w-4"}),(0,a.jsx)(eg.XL,{children:"Export Error"}),(0,a.jsx)(eg.TN,{children:U})]}),$&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(ef.J,{children:"Configuration Preview"}),(0,a.jsx)(tb.T,{value:$,readOnly:!0,className:"h-32 font-mono text-xs bg-muted/30"})]})]}),(0,a.jsxs)(ep.Es,{children:[(0,a.jsx)(b.$,{variant:"outline",onClick:eM,className:"flex items-center space-x-2",children:(0,a.jsx)("span",{children:q?"Copied!":"Copy"})}),(0,a.jsxs)(b.$,{onClick:ez,className:"flex items-center space-x-2",children:[(0,a.jsx)(tv.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:"Download"})]})]})]})}),(0,a.jsx)(tA,{isOpen:O,onClose:()=>z(!1)}),(0,a.jsx)(ep.lG,{open:et,onOpenChange:es,children:(0,a.jsxs)(ep.Cf,{className:"sm:max-w-md",children:[(0,a.jsxs)(ep.c7,{children:[(0,a.jsxs)(ep.L3,{className:"flex items-center space-x-2",children:[(0,a.jsx)(e9.A,{className:"h-5 w-5 text-destructive"}),(0,a.jsx)("span",{children:"Delete Conversation"})]}),(0,a.jsxs)(ep.rr,{children:["This will permanently delete this conversation and all its messages. This action cannot be undone.",s&&(0,a.jsxs)("span",{className:"block mt-2 font-medium",children:["Session: ",(0,a.jsx)("span",{className:"font-mono",children:s})]})]})]}),(0,a.jsxs)(ep.Es,{children:[(0,a.jsx)(b.$,{variant:"outline",onClick:()=>es(!1),children:"Cancel"}),(0,a.jsxs)(b.$,{variant:"destructive",onClick:e$,disabled:er,className:"flex items-center space-x-2",children:[(0,a.jsx)(e9.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:er?"Deleting...":"Delete Conversation"})]})]})]})}),(0,a.jsx)(ep.lG,{open:Z,onOpenChange:Q,children:(0,a.jsxs)(ep.Cf,{className:"sm:max-w-md",children:[(0,a.jsx)(ep.c7,{children:(0,a.jsxs)(ep.L3,{className:"flex items-center space-x-2",children:[(0,a.jsx)(tj.A,{className:"h-5 w-5"}),(0,a.jsx)("span",{children:"Keyboard Shortcuts"})]})}),(0,a.jsx)("div",{className:"space-y-3",children:[{key:"⌘H",desc:"Toggle chat history panel"},{key:"⌘K",desc:"Create new chat"},{key:"⌘J",desc:"Toggle tools panel"},{key:"⌘⇧S",desc:"Search conversations"},{key:"⌘L",desc:"Open MCP playground"},{key:"⌘⇧E",desc:"Export config"},{key:"⌘/",desc:"Show shortcuts"},{key:"Esc",desc:"Close panels"}].map((e,t)=>(0,a.jsxs)("div",{className:"flex justify-between items-center py-1",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:e.desc}),(0,a.jsx)(eC.E,{variant:"outline",className:"font-mono text-xs",children:e.key})]},t))}),(0,a.jsx)(ep.Es,{children:(0,a.jsx)(ep.HM,{asChild:!0,children:(0,a.jsx)(b.$,{variant:"outline",children:"Close"})})})]})})]}),(0,a.jsx)(tp,{isOpen:R,onClose:()=>L(!1),onNavigateToSession:(e,t)=>{r(e),L(!1)}}),(0,a.jsx)(tu,{websocket:u})]})}},8958:(e,t,s)=>{Promise.resolve().then(s.bind(s,2390))}},e=>{e.O(0,[537,216,122,43,441,255,358],()=>e(e.s=8958)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[882],{704:(e,t,r)=>{Promise.resolve().then(r.bind(r,6311))},6311:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>T});var s=r(5155),a=r(2115),n=r(2619),l=r.n(n),o=r(1847);let i=(0,o.A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var c=r(6983),d=r(2529);let m=(0,o.A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var u=r(2056),p=r(5426);let x=(0,o.A)("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);var h=r(4432),f=r(6504),g=r(4514),b=r(6170),y=r(4916),v=r(7507),j=r(7001),N=r(235),w=r(7003),S=r(7812),k=r(2559);function C(){var e,t,r,n,o,C,T;let[O,A]=(0,a.useState)([]),[E,J]=(0,a.useState)(null),[z,q]=(0,a.useState)([]),[D,_]=(0,a.useState)(null),[F,P]=(0,a.useState)({}),[R,I]=(0,a.useState)(null),[$,M]=(0,a.useState)(!1),[W,L]=(0,a.useState)(null),[Z,Q]=(0,a.useState)({}),[U,B]=(0,a.useState)(!1),[H,V]=(0,a.useState)(null),[G,K]=(0,a.useState)([]),[X]=(0,a.useState)(Date.now()),[Y]=(0,a.useState)([{name:"Quick Test",description:"Fill with test values",apply:e=>{var t;let r={};return(null==(t=e.inputSchema)?void 0:t.properties)&&Object.entries(e.inputSchema.properties).forEach(e=>{let[t,s]=e;"string"===s.type?r[t]="test-".concat(t):"number"===s.type?r[t]=42:"boolean"===s.type?r[t]=!0:"object"===s.type?r[t]='{"example": "value"}':"array"===s.type&&(r[t]='["example"]')}),r}},{name:"Empty Form",description:"Clear all fields",apply:()=>({})},{name:"Required Only",description:"Fill only required fields",apply:e=>{var t,r;let s={};return(null==(t=e.inputSchema)?void 0:t.properties)&&(null==(r=e.inputSchema)?void 0:r.required)&&e.inputSchema.required.forEach(t=>{let r=e.inputSchema.properties[t];"string"===r.type||"number"===r.type?s[t]="":"boolean"===r.type?s[t]=!1:"object"===r.type?s[t]="{}":"array"===r.type&&(s[t]="[]")}),s}}]),ee="/api",et=(0,a.useRef)(null),er=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{var e;null==(e=et.current)||e.abort()},[]);let es=(e,t)=>{console.error("Playground Error (".concat(t||"general","):"),e),"input"!==t&&L(e)},ea=(0,a.useCallback)(async()=>{M(!0),L(null);try{let e=await fetch("".concat(ee,"/mcp/servers"));if(!e.ok){let t=await e.json().catch(()=>({error:"Failed to fetch servers"}));throw Error(t.error||"Server List: ".concat(e.statusText))}let t=await e.json();A(t.servers||[]),t.servers&&0!==t.servers.length||console.log("No MCP servers found or returned from API.")}catch(e){es(e.message,"servers"),A([])}finally{M(!1)}},[]);(0,a.useEffect)(()=>{ea()},[ea]);let en=(0,a.useCallback)(async e=>{var t;null==(t=et.current)||t.abort();let r=new AbortController;if(et.current=r,J(e),_(null),I(null),q([]),L(null),Q({}),"connected"!==e.status)return void console.warn('Server "'.concat(e.name,'" is ').concat(e.status,". Cannot fetch tools."));M(!0);try{let t=await fetch("".concat(ee,"/mcp/servers/").concat(e.id,"/tools"),{signal:r.signal});if(!t.ok){let r=await t.json().catch(()=>({error:"Failed to fetch tools for ".concat(e.name)}));throw Error(r.error||"Tool List (".concat(e.name,"): ").concat(t.statusText))}let s=await t.json();if(r.signal.aborted)return;q(s.tools||[]),s.tools&&0!==s.tools.length||console.log('No tools found for server "'.concat(e.name,'".'))}catch(e){"AbortError"!==e.name&&(es(e.message,"tools"),q([]))}finally{r.signal.aborted||M(!1)}},[]),el=(0,a.useCallback)(e=>{_(e),I(null),L(null),Q({});let t={};if(e.inputSchema&&e.inputSchema.properties)for(let r in e.inputSchema.properties){let s=e.inputSchema.properties[r];void 0!==s.default?t[r]=s.default:"boolean"===s.type?t[r]=!1:("number"===s.type||"integer"===s.type||"object"===s.type||s.type,t[r]="")}P(t)},[]),eo=(0,a.useCallback)((e,t,r)=>{if((P(r=>({...r,[e]:t})),Z[e]&&Q(t=>({...t,[e]:""})),"object"===r||"array"===r)&&""!==t)try{JSON.parse(t)}catch(t){Q(t=>({...t,[e]:"Invalid JSON format"}));return}},[Z]),ei=()=>{if(!D||!D.inputSchema||!D.inputSchema.properties)return!0;let e={},t=!0;for(let s in D.inputSchema.properties){var r;let a=D.inputSchema.properties[s],n=F[s];if((null==(r=D.inputSchema.required)?void 0:r.includes(s))&&(void 0===n||""===n||"boolean"===a.type&&"boolean"!=typeof n)){e[s]="This field is required.",t=!1;continue}if(("number"===a.type||"integer"===a.type)&&""!==n&&isNaN(Number(n))&&(e[s]="Must be a valid number.",t=!1),("object"===a.type||"array"===a.type)&&""!==n)try{JSON.parse(n)}catch(r){e[s]="Invalid JSON format.",t=!1}}return Q(e),t},ec=(0,a.useCallback)(async()=>{var e;if(!E||!D)return void es("No server or tool selected for execution.","execution");null==(e=er.current)||e.abort();let t=new AbortController;if(er.current=t,L(null),I(null),!ei())return void es("Please correct the input errors.","input");let r=Date.now(),s="exec_".concat(Date.now(),"_").concat(Math.random().toString(36).substr(2,9));M(!0);try{let e={};if(D.inputSchema&&D.inputSchema.properties)for(let t in D.inputSchema.properties){let r=D.inputSchema.properties[t],s=F[t];if("number"===r.type)s=""===s?void 0:Number(s);else if("integer"===r.type)if(""===s)s=void 0;else{let e=Number(s);if(!Number.isInteger(e)){Q(e=>({...e,[t]:"Must be a valid integer."})),M(!1);return}s=e}else if("boolean"===r.type)s="string"==typeof s?"true"===s:!!s;else if(("object"===r.type||"array"===r.type)&&"string"==typeof s&&""!==s.trim())try{s=JSON.parse(s)}catch(e){Q(e=>({...e,[t]:"Invalid JSON before sending."})),M(!1);return}else("object"===r.type||"array"===r.type)&&(void 0===s||""===s)&&(s=void 0);void 0!==s&&(e[t]=s)}let a=await fetch("".concat(ee,"/mcp/servers/").concat(E.id,"/tools/").concat(D.id,"/execute"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t.signal}),n=await a.json();if(!a.ok)throw Error(n.error||"Tool Execution (".concat(D.name,"): ").concat(a.statusText));let l=Date.now()-r;I(n),K(e=>[{id:s,toolName:D.name,timestamp:new Date,success:!0,duration:l},...e.slice(0,9)])}catch(e){if("AbortError"!==e.name){let t=Date.now()-r;es(e.message,"execution"),e.message&&(!R||R.success||R.error!==e.message)&&I({success:!1,error:e.message}),K(e=>[{id:s,toolName:(null==D?void 0:D.name)||"Unknown",timestamp:new Date,success:!1,duration:t},...e.slice(0,9)])}}finally{t.signal.aborted||M(!1)}},[E,D,F,ei,R]),ed=async(e,t)=>{try{await navigator.clipboard.writeText(e),V({message:t||"Copied to clipboard",type:"success"}),setTimeout(()=>V(null),3e3)}catch(e){V({message:"Failed to copy to clipboard. Please check browser permissions.",type:"error"}),setTimeout(()=>V(null),5e3),console.error("Failed to copy to clipboard:",e)}};return(0,s.jsxs)("div",{className:"flex h-screen bg-muted/40 text-foreground antialiased",children:[(0,s.jsxs)("aside",{className:"w-72 flex-shrink-0 border-r border-border bg-background p-4 flex flex-col rounded-r-lg shadow-md",children:[(0,s.jsx)("div",{className:"flex items-center justify-between pb-3 mb-3 border-b border-border",children:(0,s.jsx)(l(),{href:"/",children:(0,s.jsx)(w.$,{variant:"outline",size:"sm",className:"pl-2 pr-3",asChild:!0,children:(0,s.jsxs)("span",{children:[(0,s.jsx)(i,{className:"h-4 w-4 mr-1.5"}),"Back to Chat"]})})})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground px-1",children:"MCP Servers"}),$&&0===O.length&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading..."})]}),W&&0===O.length&&!$&&(0,s.jsxs)("p",{className:"text-destructive text-sm p-2 bg-destructive/10 rounded-md",children:["Error: ",W]}),0===O.length&&!$&&!W&&(0,s.jsx)("p",{className:"text-muted-foreground text-sm px-1",children:"No servers available."}),(0,s.jsx)("div",{className:"flex-grow overflow-y-auto space-y-1 pr-1 -mr-1",children:O.length>0&&(0,s.jsx)("ul",{className:"space-y-1",children:O.map(e=>(0,s.jsx)("li",{className:"p-2.5 rounded-md cursor-pointer hover:bg-muted transition-colors group \n ".concat((null==E?void 0:E.id)===e.id?"bg-primary text-primary-foreground hover:bg-primary/90":"text-foreground hover:text-primary","\n ").concat("connected"!==e.status?"opacity-60 cursor-not-allowed":""),onClick:()=>"connected"===e.status&&en(e),title:"connected"!==e.status?"".concat(e.name," is ").concat(e.status):e.name,children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"font-medium truncate group-hover:text-primary-foreground_conditional",children:e.name}),(0,s.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full \n ".concat("connected"===e.status?"bg-green-100 text-green-700 dark:bg-green-700/20 dark:text-green-400":"disconnected"===e.status?"bg-slate-100 text-slate-600 dark:bg-slate-700/20 dark:text-slate-400":"bg-yellow-100 text-yellow-700 dark:bg-yellow-700/20 dark:text-yellow-400"),children:e.status})]})},e.id))})}),(0,s.jsx)(w.$,{onClick:()=>B(!0),variant:"outline",className:"mt-auto w-full sticky bottom-0 left-0 right-0 bg-background hover:bg-muted py-3",children:"Connect New Server"})]}),(0,s.jsxs)("section",{className:"w-80 flex-shrink-0 border-r border-border bg-background p-4 flex flex-col rounded-l-none shadow-md",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center pb-3 mb-3 border-b border-border",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground px-1",children:"Tools"}),E&&"connected"===E.status&&$&&0===z.length&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading..."})]}),(0,s.jsxs)("div",{className:"flex-grow overflow-y-auto space-y-1 pr-1 -mr-1",children:[!E&&(0,s.jsx)("p",{className:"text-muted-foreground text-sm px-1",children:"Select a connected server to view tools."}),E&&"connected"!==E.status&&(0,s.jsxs)("p",{className:"text-muted-foreground text-sm px-1",children:['Server "',E.name,'" is ',E.status,". Tools unavailable."]}),E&&"connected"===E.status&&!$&&0===z.length&&!W&&(0,s.jsxs)("p",{className:"text-muted-foreground text-sm px-1",children:["No tools found for ",E.name,"."]}),W&&(null==E?void 0:E.status)==="connected"&&0===z.length&&!$&&(0,s.jsxs)("p",{className:"text-destructive text-sm p-2 bg-destructive/10 rounded-md",children:["Error loading tools: ",W]}),z.length>0&&(0,s.jsx)("ul",{className:"space-y-1",children:z.map(e=>(0,s.jsxs)("li",{className:"p-3 rounded-md cursor-pointer hover:bg-muted transition-colors group\n ".concat((null==D?void 0:D.id)===e.id?"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90":"text-foreground hover:text-primary"),onClick:()=>el(e),children:[(0,s.jsx)("h3",{className:"font-medium truncate group-hover:text-primary-foreground_conditional",children:e.name}),e.description&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-0.5 group-hover:text-primary-foreground_conditional/80",children:e.description})]},e.id))})]})]}),(0,s.jsxs)("main",{className:"flex-1 p-6 flex flex-col bg-zinc-50 dark:bg-zinc-900 overflow-y-auto",children:[(0,s.jsx)("div",{className:"pb-3 mb-4 border-b border-border",children:(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Tool Runner"}),G.length>0&&(0,s.jsxs)("div",{className:"flex items-center space-x-4 mt-2 text-sm text-muted-foreground",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,s.jsx)(c.A,{className:"h-3 w-3"}),(0,s.jsxs)("span",{children:[G.length," executions this session"]})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,s.jsx)(d.A,{className:"h-3 w-3 text-green-500"}),(0,s.jsx)("span",{children:G.filter(e=>e.success).length})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,s.jsx)(m,{className:"h-3 w-3 text-red-500"}),(0,s.jsx)("span",{children:G.filter(e=>!e.success).length})]})]})]})]}),G.length>0&&(0,s.jsxs)("div",{className:"hidden lg:block",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:"Recent executions"}),(0,s.jsx)("div",{className:"flex space-x-1",children:G.slice(0,5).map(e=>(0,s.jsxs)(S.E,{variant:e.success?"secondary":"destructive",className:"text-xs px-2 py-1 truncate max-w-24",title:"".concat(e.toolName," - ").concat(e.success?"Success":"Failed"," (").concat(e.duration,"ms)"),children:[e.toolName.slice(0,8),e.toolName.length>8&&"..."]},e.id))})]})]})}),W&&D&&(!R||!R.success)&&(0,s.jsxs)("div",{className:"mb-4 p-3 border border-destructive/50 bg-destructive/10 rounded-md text-destructive text-sm",children:[(0,s.jsx)("p",{className:"font-medium",children:"Error:"}),(0,s.jsx)("p",{children:W})]}),H&&(0,s.jsxs)(k.Fc,{variant:"error"===H.type?"destructive":"default",className:"mb-4 ".concat("success"===H.type?"border-green-200 bg-green-50 text-green-800 dark:border-green-800 dark:bg-green-950 dark:text-green-400":""),children:["error"===H.type&&(0,s.jsx)(u.A,{className:"h-4 w-4"}),"success"===H.type&&(0,s.jsx)(d.A,{className:"h-4 w-4"}),(0,s.jsx)(k.TN,{children:H.message})]}),!D&&(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsxs)("div",{className:"text-center max-w-md",children:[(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(i,{className:"h-12 w-12 mx-auto text-muted-foreground opacity-50"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Select a Tool"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:"Choose a tool from the left panel to start testing and experimenting with MCP capabilities."})]})}),D&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)("div",{className:"p-4 border border-border rounded-lg bg-card shadow-sm",children:(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-primary mb-1",children:D.name}),D.description&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:D.description})]}),(0,s.jsxs)("div",{className:"text-right text-xs text-muted-foreground",children:[(0,s.jsxs)("p",{children:["Server: ",null==E?void 0:E.name]}),G.filter(e=>e.toolName===D.name).length>0&&(0,s.jsxs)("p",{children:["Runs: ",G.filter(e=>e.toolName===D.name).length]})]})]})}),(0,s.jsxs)("form",{onSubmit:e=>{e.preventDefault(),ei()&&ec()},className:"space-y-5 p-4 border border-border rounded-lg bg-card shadow-sm",children:[D&&(null==(e=D.inputSchema)?void 0:e.properties)&&Object.keys(D.inputSchema.properties).length>0&&(0,s.jsxs)("div",{className:"border-b border-border pb-4",children:[(0,s.jsx)("h4",{className:"text-sm font-medium mb-2 text-muted-foreground",children:"Quick Fill Templates"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.map((e,t)=>(0,s.jsx)(w.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{P(e.apply(D)),Q({})},className:"text-xs",title:e.description,children:e.name},t))})]}),D&&D.inputSchema&&D.inputSchema.properties?Object.entries(D.inputSchema.properties).map(e=>{var t,r;let a,[n,l]=e,o=null==(r=D.inputSchema)||null==(t=r.required)?void 0:t.includes(n),i=Z[n],c="w-full ".concat(i?"border-destructive focus-visible:ring-destructive":"border-input");if(l.enum&&Array.isArray(l.enum)){let e=l.enum.every(e=>"boolean"==typeof e),t=l.enum.every(e=>"number"==typeof e);a=(0,s.jsxs)(v.l6,{value:void 0===F[n]&&void 0!==l.default?String(l.default):String(F[n]||""),onValueChange:r=>{let s=r;e?s="true"===r:t&&(s=Number(r)),eo(n,s,l.type)},disabled:$,children:[(0,s.jsx)(v.bq,{id:n,className:c,children:(0,s.jsx)(v.yv,{placeholder:"Select ".concat(l.description||n).concat(o?"":" (optional)","...")})}),(0,s.jsx)(v.gC,{children:l.enum.map(e=>(0,s.jsx)(v.eb,{value:String(e),children:String(e)},String(e)))})]})}else if("boolean"===l.type)a=(0,s.jsx)(y.S,{id:n,checked:void 0===F[n]&&void 0!==l.default?!!l.default:!!F[n],onCheckedChange:e=>eo(n,e,l.type),disabled:$,className:"".concat(i?"border-destructive ring-destructive":"")});else if("object"===l.type||"array"===l.type)a=(0,s.jsx)(j.T,{id:n,value:void 0===F[n]&&void 0!==l.default?JSON.stringify(l.default,null,2):F[n]||"",onChange:e=>eo(n,e.target.value,l.type),rows:5,className:"".concat(c," font-mono text-sm min-h-[100px] resize-y"),placeholder:"Enter JSON for ".concat(l.description||n),disabled:$});else{let e="text";("number"===l.type||"integer"===l.type)&&(e="number"),"date-time"===l.format&&(e="datetime-local"),"date"===l.format&&(e="date"),"email"===l.format&&(e="email"),"uri"===l.format&&(e="url"),"password"===l.format&&(e="password"),a=(0,s.jsx)(b.p,{type:e,id:n,value:void 0===F[n]&&void 0!==l.default?String(l.default):String(F[n]||""),onChange:e=>eo(n,e.target.value,l.type),className:c,placeholder:l.description||"Enter ".concat(n),disabled:$,step:"number"===l.type||"integer"===l.type?"any":void 0})}return(0,s.jsxs)("div",{className:"grid gap-1.5",children:[(0,s.jsxs)("div",{className:"flex ".concat("boolean"===l.type?"flex-row items-center space-x-3":"flex-col"),children:[(0,s.jsxs)(N.J,{htmlFor:n,className:"".concat("boolean"===l.type?"leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70":"capitalize font-medium"),children:[l.description||n.replace(/([A-Z]+(?=[A-Z][a-z]))|([A-Z][a-z])/g," $&").trim().replace(/_/g," "),o&&(0,s.jsx)("span",{className:"text-destructive text-lg ml-0.5",children:"*"})]}),"boolean"===l.type?a:(0,s.jsx)("div",{className:"w-full",children:a})]}),i&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:i})]},n)}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground py-2",children:"This tool does not require any inputs, or its input schema is not defined."}),D&&(0,s.jsx)(w.$,{type:"submit",disabled:$||E&&"connected"!==E.status||Object.keys(Z).some(e=>""!==Z[e]),className:"w-full sm:w-auto mt-3 py-2.5 px-6",children:$?"Executing...":"Run Tool"}),D&&Object.keys(F).length>0&&(0,s.jsxs)("div",{className:"flex gap-2 mt-4 pt-4 border-t border-border",children:[(0,s.jsxs)(w.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{D&&E&&ed(JSON.stringify({server:E.name,tool:D.name,inputs:F,timestamp:new Date().toISOString()},null,2),"Tool configuration copied!")},className:"flex items-center gap-2",children:[(0,s.jsx)(p.A,{className:"h-3 w-3"}),"Copy Config"]}),(0,s.jsxs)(w.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(!D||!E)return;E.name,D.name;let e="Check out this Dexto tool configuration:\n\nServer: ".concat(E.name,"\nTool: ").concat(D.name,"\nInputs: ").concat(JSON.stringify(F,null,2));navigator.share?navigator.share({title:"Dexto Tool: ".concat(D.name),text:e}):ed(e,"Tool configuration copied for sharing!")},className:"flex items-center gap-2",children:[(0,s.jsx)(x,{className:"h-3 w-3"}),"Share"]})]})]}),R&&(0,s.jsxs)("div",{className:"mt-6 p-4 border border-border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,s.jsxs)("h3",{className:"text-lg font-semibold text-foreground",children:["Tool Result for ",(0,s.jsx)("span",{className:"font-bold text-primary",children:null==D?void 0:D.name})]}),(0,s.jsxs)(w.$,{variant:"outline",size:"sm",onClick:()=>{R&&ed("object"==typeof R.data?JSON.stringify(R.data,null,2):String(R.data),"Tool result copied!")},className:"flex items-center gap-2",children:[(0,s.jsx)(p.A,{className:"h-3 w-3"}),"Copy Result"]})]}),R.success?(0,s.jsx)("div",{className:"space-y-3 text-sm",children:((null==(r=R.metadata)||null==(t=r.mimeType)?void 0:t.startsWith("image/"))||(null==(o=R.metadata)||null==(n=o.type)?void 0:n.startsWith("image"))||R.data&&"object"==typeof R.data&&Array.isArray(R.data.content))&&R.data?(()=>{var e;let t="",r=null,a=null==(e=R.metadata)?void 0:e.mimeType,n=[];if(Array.isArray(R.data))(r=R.data.find(e=>e&&"image"===e.type))&&"string"==typeof r.data&&r.mimeType&&(t="data:".concat(r.mimeType,";base64,").concat(r.data));else if(R.data&&"object"==typeof R.data&&Array.isArray(R.data.content)){let e=R.data.content;if((r=e.find(e=>e&&"image"===e.type))&&"string"==typeof r.data){let e=r.mimeType||a;e&&(t="data:".concat(e,";base64,").concat(r.data))}n=e.filter(e=>e&&"image"!==e.type)}else"string"==typeof R.data&&(R.data.startsWith("data:image")?t=R.data:a?t="data:".concat(a,";base64,").concat(R.data):(R.data.startsWith("http://")||R.data.startsWith("https://"))&&(t=R.data));return t?(0,s.jsx)("img",{src:t,alt:"Tool result image",className:"my-2 max-h-96 w-auto rounded border border-input shadow-sm"}):n.length>0?(0,s.jsx)("div",{className:"space-y-3",children:n.map((e,t)=>(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-sm bg-background p-3 rounded-md border border-input font-mono overflow-x-auto max-h-64",children:"object"==typeof e?JSON.stringify(e,null,2):String(e)},t))}):(0,s.jsxs)("p",{className:"text-xs text-destructive",children:["Image data is not in a recognized format. Data: ",JSON.stringify(R.data)]})})():(null==(C=R.metadata)?void 0:C.type)==="markdown"&&R.data?(0,s.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none p-3 bg-background rounded border border-input leading-relaxed",children:(0,s.jsx)(f.oz,{remarkPlugins:[g.A],children:"string"==typeof R.data?R.data:JSON.stringify(R.data,null,2)})}):(null==(T=R.metadata)?void 0:T.type)==="json"&&R.data?(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-sm bg-background p-3 rounded-md border border-input font-mono",children:"string"==typeof R.data?R.data:JSON.stringify(R.data,null,2)}):(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-sm bg-background p-3 rounded-md border border-input",children:"object"==typeof R.data?JSON.stringify(R.data,null,2):String(R.data)})}):(0,s.jsxs)("div",{className:"p-3 bg-destructive/10 rounded-md",children:[(0,s.jsx)("p",{className:"text-sm text-destructive font-semibold",children:"Error executing tool:"}),(0,s.jsx)("pre",{className:"mt-1 text-xs text-destructive whitespace-pre-wrap break-all",children:R.error||"Unknown error"})]})]})]})]}),(0,s.jsx)(h.A,{isOpen:U,onClose:()=>{B(!1),ea()}})]})}function T(){return(0,s.jsx)(C,{})}}},e=>{e.O(0,[537,42,441,255,358],()=>e(e.s=704)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[882],{704:(e,t,r)=>{Promise.resolve().then(r.bind(r,6311))},6311:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>T});var s=r(5155),a=r(2115),n=r(2619),l=r.n(n),o=r(1847);let i=(0,o.A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var c=r(6983),d=r(2529);let m=(0,o.A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var u=r(2056),p=r(5426);let x=(0,o.A)("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);var h=r(8712),f=r(6504),g=r(4514),b=r(6170),y=r(4916),v=r(7507),j=r(7001),N=r(235),w=r(7003),S=r(7812),k=r(2559);function C(){var e,t,r,n,o,C,T;let[O,A]=(0,a.useState)([]),[E,J]=(0,a.useState)(null),[z,q]=(0,a.useState)([]),[D,_]=(0,a.useState)(null),[F,P]=(0,a.useState)({}),[R,I]=(0,a.useState)(null),[$,M]=(0,a.useState)(!1),[W,L]=(0,a.useState)(null),[Z,Q]=(0,a.useState)({}),[U,B]=(0,a.useState)(!1),[H,V]=(0,a.useState)(null),[G,K]=(0,a.useState)([]),[X]=(0,a.useState)(Date.now()),[Y]=(0,a.useState)([{name:"Quick Test",description:"Fill with test values",apply:e=>{var t;let r={};return(null==(t=e.inputSchema)?void 0:t.properties)&&Object.entries(e.inputSchema.properties).forEach(e=>{let[t,s]=e;"string"===s.type?r[t]="test-".concat(t):"number"===s.type?r[t]=42:"boolean"===s.type?r[t]=!0:"object"===s.type?r[t]='{"example": "value"}':"array"===s.type&&(r[t]='["example"]')}),r}},{name:"Empty Form",description:"Clear all fields",apply:()=>({})},{name:"Required Only",description:"Fill only required fields",apply:e=>{var t,r;let s={};return(null==(t=e.inputSchema)?void 0:t.properties)&&(null==(r=e.inputSchema)?void 0:r.required)&&e.inputSchema.required.forEach(t=>{let r=e.inputSchema.properties[t];"string"===r.type||"number"===r.type?s[t]="":"boolean"===r.type?s[t]=!1:"object"===r.type?s[t]="{}":"array"===r.type&&(s[t]="[]")}),s}}]),ee="/api",et=(0,a.useRef)(null),er=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{var e;null==(e=et.current)||e.abort()},[]);let es=(e,t)=>{console.error("Playground Error (".concat(t||"general","):"),e),"input"!==t&&L(e)},ea=(0,a.useCallback)(async()=>{M(!0),L(null);try{let e=await fetch("".concat(ee,"/mcp/servers"));if(!e.ok){let t=await e.json().catch(()=>({error:"Failed to fetch servers"}));throw Error(t.error||"Server List: ".concat(e.statusText))}let t=await e.json();A(t.servers||[]),t.servers&&0!==t.servers.length||console.log("No MCP servers found or returned from API.")}catch(e){es(e.message,"servers"),A([])}finally{M(!1)}},[]);(0,a.useEffect)(()=>{ea()},[ea]);let en=(0,a.useCallback)(async e=>{var t;null==(t=et.current)||t.abort();let r=new AbortController;if(et.current=r,J(e),_(null),I(null),q([]),L(null),Q({}),"connected"!==e.status)return void console.warn('Server "'.concat(e.name,'" is ').concat(e.status,". Cannot fetch tools."));M(!0);try{let t=await fetch("".concat(ee,"/mcp/servers/").concat(e.id,"/tools"),{signal:r.signal});if(!t.ok){let r=await t.json().catch(()=>({error:"Failed to fetch tools for ".concat(e.name)}));throw Error(r.error||"Tool List (".concat(e.name,"): ").concat(t.statusText))}let s=await t.json();if(r.signal.aborted)return;q(s.tools||[]),s.tools&&0!==s.tools.length||console.log('No tools found for server "'.concat(e.name,'".'))}catch(e){"AbortError"!==e.name&&(es(e.message,"tools"),q([]))}finally{r.signal.aborted||M(!1)}},[]),el=(0,a.useCallback)(e=>{_(e),I(null),L(null),Q({});let t={};if(e.inputSchema&&e.inputSchema.properties)for(let r in e.inputSchema.properties){let s=e.inputSchema.properties[r];void 0!==s.default?t[r]=s.default:"boolean"===s.type?t[r]=!1:("number"===s.type||"integer"===s.type||"object"===s.type||s.type,t[r]="")}P(t)},[]),eo=(0,a.useCallback)((e,t,r)=>{if((P(r=>({...r,[e]:t})),Z[e]&&Q(t=>({...t,[e]:""})),"object"===r||"array"===r)&&""!==t)try{JSON.parse(t)}catch(t){Q(t=>({...t,[e]:"Invalid JSON format"}));return}},[Z]),ei=()=>{if(!D||!D.inputSchema||!D.inputSchema.properties)return!0;let e={},t=!0;for(let s in D.inputSchema.properties){var r;let a=D.inputSchema.properties[s],n=F[s];if((null==(r=D.inputSchema.required)?void 0:r.includes(s))&&(void 0===n||""===n||"boolean"===a.type&&"boolean"!=typeof n)){e[s]="This field is required.",t=!1;continue}if(("number"===a.type||"integer"===a.type)&&""!==n&&isNaN(Number(n))&&(e[s]="Must be a valid number.",t=!1),("object"===a.type||"array"===a.type)&&""!==n)try{JSON.parse(n)}catch(r){e[s]="Invalid JSON format.",t=!1}}return Q(e),t},ec=(0,a.useCallback)(async()=>{var e;if(!E||!D)return void es("No server or tool selected for execution.","execution");null==(e=er.current)||e.abort();let t=new AbortController;if(er.current=t,L(null),I(null),!ei())return void es("Please correct the input errors.","input");let r=Date.now(),s="exec_".concat(Date.now(),"_").concat(Math.random().toString(36).substr(2,9));M(!0);try{let e={};if(D.inputSchema&&D.inputSchema.properties)for(let t in D.inputSchema.properties){let r=D.inputSchema.properties[t],s=F[t];if("number"===r.type)s=""===s?void 0:Number(s);else if("integer"===r.type)if(""===s)s=void 0;else{let e=Number(s);if(!Number.isInteger(e)){Q(e=>({...e,[t]:"Must be a valid integer."})),M(!1);return}s=e}else if("boolean"===r.type)s="string"==typeof s?"true"===s:!!s;else if(("object"===r.type||"array"===r.type)&&"string"==typeof s&&""!==s.trim())try{s=JSON.parse(s)}catch(e){Q(e=>({...e,[t]:"Invalid JSON before sending."})),M(!1);return}else("object"===r.type||"array"===r.type)&&(void 0===s||""===s)&&(s=void 0);void 0!==s&&(e[t]=s)}let a=await fetch("".concat(ee,"/mcp/servers/").concat(E.id,"/tools/").concat(D.id,"/execute"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t.signal}),n=await a.json();if(!a.ok)throw Error(n.error||"Tool Execution (".concat(D.name,"): ").concat(a.statusText));let l=Date.now()-r;I(n),K(e=>[{id:s,toolName:D.name,timestamp:new Date,success:!0,duration:l},...e.slice(0,9)])}catch(e){if("AbortError"!==e.name){let t=Date.now()-r;es(e.message,"execution"),e.message&&(!R||R.success||R.error!==e.message)&&I({success:!1,error:e.message}),K(e=>[{id:s,toolName:(null==D?void 0:D.name)||"Unknown",timestamp:new Date,success:!1,duration:t},...e.slice(0,9)])}}finally{t.signal.aborted||M(!1)}},[E,D,F,ei,R]),ed=async(e,t)=>{try{await navigator.clipboard.writeText(e),V({message:t||"Copied to clipboard",type:"success"}),setTimeout(()=>V(null),3e3)}catch(e){V({message:"Failed to copy to clipboard. Please check browser permissions.",type:"error"}),setTimeout(()=>V(null),5e3),console.error("Failed to copy to clipboard:",e)}};return(0,s.jsxs)("div",{className:"flex h-screen bg-muted/40 text-foreground antialiased",children:[(0,s.jsxs)("aside",{className:"w-72 flex-shrink-0 border-r border-border bg-background p-4 flex flex-col rounded-r-lg shadow-md",children:[(0,s.jsx)("div",{className:"flex items-center justify-between pb-3 mb-3 border-b border-border",children:(0,s.jsx)(l(),{href:"/",children:(0,s.jsx)(w.$,{variant:"outline",size:"sm",className:"pl-2 pr-3",asChild:!0,children:(0,s.jsxs)("span",{children:[(0,s.jsx)(i,{className:"h-4 w-4 mr-1.5"}),"Back to Chat"]})})})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground px-1",children:"MCP Servers"}),$&&0===O.length&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading..."})]}),W&&0===O.length&&!$&&(0,s.jsxs)("p",{className:"text-destructive text-sm p-2 bg-destructive/10 rounded-md",children:["Error: ",W]}),0===O.length&&!$&&!W&&(0,s.jsx)("p",{className:"text-muted-foreground text-sm px-1",children:"No servers available."}),(0,s.jsx)("div",{className:"flex-grow overflow-y-auto space-y-1 pr-1 -mr-1",children:O.length>0&&(0,s.jsx)("ul",{className:"space-y-1",children:O.map(e=>(0,s.jsx)("li",{className:"p-2.5 rounded-md cursor-pointer hover:bg-muted transition-colors group \n ".concat((null==E?void 0:E.id)===e.id?"bg-primary text-primary-foreground hover:bg-primary/90":"text-foreground hover:text-primary","\n ").concat("connected"!==e.status?"opacity-60 cursor-not-allowed":""),onClick:()=>"connected"===e.status&&en(e),title:"connected"!==e.status?"".concat(e.name," is ").concat(e.status):e.name,children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"font-medium truncate group-hover:text-primary-foreground_conditional",children:e.name}),(0,s.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full \n ".concat("connected"===e.status?"bg-green-100 text-green-700 dark:bg-green-700/20 dark:text-green-400":"disconnected"===e.status?"bg-slate-100 text-slate-600 dark:bg-slate-700/20 dark:text-slate-400":"bg-yellow-100 text-yellow-700 dark:bg-yellow-700/20 dark:text-yellow-400"),children:e.status})]})},e.id))})}),(0,s.jsx)(w.$,{onClick:()=>B(!0),variant:"outline",className:"mt-auto w-full sticky bottom-0 left-0 right-0 bg-background hover:bg-muted py-3",children:"Connect New Server"})]}),(0,s.jsxs)("section",{className:"w-80 flex-shrink-0 border-r border-border bg-background p-4 flex flex-col rounded-l-none shadow-md",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center pb-3 mb-3 border-b border-border",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground px-1",children:"Tools"}),E&&"connected"===E.status&&$&&0===z.length&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading..."})]}),(0,s.jsxs)("div",{className:"flex-grow overflow-y-auto space-y-1 pr-1 -mr-1",children:[!E&&(0,s.jsx)("p",{className:"text-muted-foreground text-sm px-1",children:"Select a connected server to view tools."}),E&&"connected"!==E.status&&(0,s.jsxs)("p",{className:"text-muted-foreground text-sm px-1",children:['Server "',E.name,'" is ',E.status,". Tools unavailable."]}),E&&"connected"===E.status&&!$&&0===z.length&&!W&&(0,s.jsxs)("p",{className:"text-muted-foreground text-sm px-1",children:["No tools found for ",E.name,"."]}),W&&(null==E?void 0:E.status)==="connected"&&0===z.length&&!$&&(0,s.jsxs)("p",{className:"text-destructive text-sm p-2 bg-destructive/10 rounded-md",children:["Error loading tools: ",W]}),z.length>0&&(0,s.jsx)("ul",{className:"space-y-1",children:z.map(e=>(0,s.jsxs)("li",{className:"p-3 rounded-md cursor-pointer hover:bg-muted transition-colors group\n ".concat((null==D?void 0:D.id)===e.id?"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90":"text-foreground hover:text-primary"),onClick:()=>el(e),children:[(0,s.jsx)("h3",{className:"font-medium truncate group-hover:text-primary-foreground_conditional",children:e.name}),e.description&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-0.5 group-hover:text-primary-foreground_conditional/80",children:e.description})]},e.id))})]})]}),(0,s.jsxs)("main",{className:"flex-1 p-6 flex flex-col bg-zinc-50 dark:bg-zinc-900 overflow-y-auto",children:[(0,s.jsx)("div",{className:"pb-3 mb-4 border-b border-border",children:(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Tool Runner"}),G.length>0&&(0,s.jsxs)("div",{className:"flex items-center space-x-4 mt-2 text-sm text-muted-foreground",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,s.jsx)(c.A,{className:"h-3 w-3"}),(0,s.jsxs)("span",{children:[G.length," executions this session"]})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,s.jsx)(d.A,{className:"h-3 w-3 text-green-500"}),(0,s.jsx)("span",{children:G.filter(e=>e.success).length})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,s.jsx)(m,{className:"h-3 w-3 text-red-500"}),(0,s.jsx)("span",{children:G.filter(e=>!e.success).length})]})]})]})]}),G.length>0&&(0,s.jsxs)("div",{className:"hidden lg:block",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:"Recent executions"}),(0,s.jsx)("div",{className:"flex space-x-1",children:G.slice(0,5).map(e=>(0,s.jsxs)(S.E,{variant:e.success?"secondary":"destructive",className:"text-xs px-2 py-1 truncate max-w-24",title:"".concat(e.toolName," - ").concat(e.success?"Success":"Failed"," (").concat(e.duration,"ms)"),children:[e.toolName.slice(0,8),e.toolName.length>8&&"..."]},e.id))})]})]})}),W&&D&&(!R||!R.success)&&(0,s.jsxs)("div",{className:"mb-4 p-3 border border-destructive/50 bg-destructive/10 rounded-md text-destructive text-sm",children:[(0,s.jsx)("p",{className:"font-medium",children:"Error:"}),(0,s.jsx)("p",{children:W})]}),H&&(0,s.jsxs)(k.Fc,{variant:"error"===H.type?"destructive":"default",className:"mb-4 ".concat("success"===H.type?"border-green-200 bg-green-50 text-green-800 dark:border-green-800 dark:bg-green-950 dark:text-green-400":""),children:["error"===H.type&&(0,s.jsx)(u.A,{className:"h-4 w-4"}),"success"===H.type&&(0,s.jsx)(d.A,{className:"h-4 w-4"}),(0,s.jsx)(k.TN,{children:H.message})]}),!D&&(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsxs)("div",{className:"text-center max-w-md",children:[(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(i,{className:"h-12 w-12 mx-auto text-muted-foreground opacity-50"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Select a Tool"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:"Choose a tool from the left panel to start testing and experimenting with MCP capabilities."})]})}),D&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)("div",{className:"p-4 border border-border rounded-lg bg-card shadow-sm",children:(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-primary mb-1",children:D.name}),D.description&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:D.description})]}),(0,s.jsxs)("div",{className:"text-right text-xs text-muted-foreground",children:[(0,s.jsxs)("p",{children:["Server: ",null==E?void 0:E.name]}),G.filter(e=>e.toolName===D.name).length>0&&(0,s.jsxs)("p",{children:["Runs: ",G.filter(e=>e.toolName===D.name).length]})]})]})}),(0,s.jsxs)("form",{onSubmit:e=>{e.preventDefault(),ei()&&ec()},className:"space-y-5 p-4 border border-border rounded-lg bg-card shadow-sm",children:[D&&(null==(e=D.inputSchema)?void 0:e.properties)&&Object.keys(D.inputSchema.properties).length>0&&(0,s.jsxs)("div",{className:"border-b border-border pb-4",children:[(0,s.jsx)("h4",{className:"text-sm font-medium mb-2 text-muted-foreground",children:"Quick Fill Templates"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.map((e,t)=>(0,s.jsx)(w.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{P(e.apply(D)),Q({})},className:"text-xs",title:e.description,children:e.name},t))})]}),D&&D.inputSchema&&D.inputSchema.properties?Object.entries(D.inputSchema.properties).map(e=>{var t,r;let a,[n,l]=e,o=null==(r=D.inputSchema)||null==(t=r.required)?void 0:t.includes(n),i=Z[n],c="w-full ".concat(i?"border-destructive focus-visible:ring-destructive":"border-input");if(l.enum&&Array.isArray(l.enum)){let e=l.enum.every(e=>"boolean"==typeof e),t=l.enum.every(e=>"number"==typeof e);a=(0,s.jsxs)(v.l6,{value:void 0===F[n]&&void 0!==l.default?String(l.default):String(F[n]||""),onValueChange:r=>{let s=r;e?s="true"===r:t&&(s=Number(r)),eo(n,s,l.type)},disabled:$,children:[(0,s.jsx)(v.bq,{id:n,className:c,children:(0,s.jsx)(v.yv,{placeholder:"Select ".concat(l.description||n).concat(o?"":" (optional)","...")})}),(0,s.jsx)(v.gC,{children:l.enum.map(e=>(0,s.jsx)(v.eb,{value:String(e),children:String(e)},String(e)))})]})}else if("boolean"===l.type)a=(0,s.jsx)(y.S,{id:n,checked:void 0===F[n]&&void 0!==l.default?!!l.default:!!F[n],onCheckedChange:e=>eo(n,e,l.type),disabled:$,className:"".concat(i?"border-destructive ring-destructive":"")});else if("object"===l.type||"array"===l.type)a=(0,s.jsx)(j.T,{id:n,value:void 0===F[n]&&void 0!==l.default?JSON.stringify(l.default,null,2):F[n]||"",onChange:e=>eo(n,e.target.value,l.type),rows:5,className:"".concat(c," font-mono text-sm min-h-[100px] resize-y"),placeholder:"Enter JSON for ".concat(l.description||n),disabled:$});else{let e="text";("number"===l.type||"integer"===l.type)&&(e="number"),"date-time"===l.format&&(e="datetime-local"),"date"===l.format&&(e="date"),"email"===l.format&&(e="email"),"uri"===l.format&&(e="url"),"password"===l.format&&(e="password"),a=(0,s.jsx)(b.p,{type:e,id:n,value:void 0===F[n]&&void 0!==l.default?String(l.default):String(F[n]||""),onChange:e=>eo(n,e.target.value,l.type),className:c,placeholder:l.description||"Enter ".concat(n),disabled:$,step:"number"===l.type||"integer"===l.type?"any":void 0})}return(0,s.jsxs)("div",{className:"grid gap-1.5",children:[(0,s.jsxs)("div",{className:"flex ".concat("boolean"===l.type?"flex-row items-center space-x-3":"flex-col"),children:[(0,s.jsxs)(N.J,{htmlFor:n,className:"".concat("boolean"===l.type?"leading-none cursor-pointer peer-disabled:cursor-not-allowed peer-disabled:opacity-70":"capitalize font-medium"),children:[l.description||n.replace(/([A-Z]+(?=[A-Z][a-z]))|([A-Z][a-z])/g," $&").trim().replace(/_/g," "),o&&(0,s.jsx)("span",{className:"text-destructive text-lg ml-0.5",children:"*"})]}),"boolean"===l.type?a:(0,s.jsx)("div",{className:"w-full",children:a})]}),i&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:i})]},n)}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground py-2",children:"This tool does not require any inputs, or its input schema is not defined."}),D&&(0,s.jsx)(w.$,{type:"submit",disabled:$||E&&"connected"!==E.status||Object.keys(Z).some(e=>""!==Z[e]),className:"w-full sm:w-auto mt-3 py-2.5 px-6",children:$?"Executing...":"Run Tool"}),D&&Object.keys(F).length>0&&(0,s.jsxs)("div",{className:"flex gap-2 mt-4 pt-4 border-t border-border",children:[(0,s.jsxs)(w.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{D&&E&&ed(JSON.stringify({server:E.name,tool:D.name,inputs:F,timestamp:new Date().toISOString()},null,2),"Tool configuration copied!")},className:"flex items-center gap-2",children:[(0,s.jsx)(p.A,{className:"h-3 w-3"}),"Copy Config"]}),(0,s.jsxs)(w.$,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(!D||!E)return;E.name,D.name;let e="Check out this Dexto tool configuration:\n\nServer: ".concat(E.name,"\nTool: ").concat(D.name,"\nInputs: ").concat(JSON.stringify(F,null,2));navigator.share?navigator.share({title:"Dexto Tool: ".concat(D.name),text:e}):ed(e,"Tool configuration copied for sharing!")},className:"flex items-center gap-2",children:[(0,s.jsx)(x,{className:"h-3 w-3"}),"Share"]})]})]}),R&&(0,s.jsxs)("div",{className:"mt-6 p-4 border border-border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,s.jsxs)("h3",{className:"text-lg font-semibold text-foreground",children:["Tool Result for ",(0,s.jsx)("span",{className:"font-bold text-primary",children:null==D?void 0:D.name})]}),(0,s.jsxs)(w.$,{variant:"outline",size:"sm",onClick:()=>{R&&ed("object"==typeof R.data?JSON.stringify(R.data,null,2):String(R.data),"Tool result copied!")},className:"flex items-center gap-2",children:[(0,s.jsx)(p.A,{className:"h-3 w-3"}),"Copy Result"]})]}),R.success?(0,s.jsx)("div",{className:"space-y-3 text-sm",children:((null==(r=R.metadata)||null==(t=r.mimeType)?void 0:t.startsWith("image/"))||(null==(o=R.metadata)||null==(n=o.type)?void 0:n.startsWith("image"))||R.data&&"object"==typeof R.data&&Array.isArray(R.data.content))&&R.data?(()=>{var e;let t="",r=null,a=null==(e=R.metadata)?void 0:e.mimeType,n=[];if(Array.isArray(R.data))(r=R.data.find(e=>e&&"image"===e.type))&&"string"==typeof r.data&&r.mimeType&&(t="data:".concat(r.mimeType,";base64,").concat(r.data));else if(R.data&&"object"==typeof R.data&&Array.isArray(R.data.content)){let e=R.data.content;if((r=e.find(e=>e&&"image"===e.type))&&"string"==typeof r.data){let e=r.mimeType||a;e&&(t="data:".concat(e,";base64,").concat(r.data))}n=e.filter(e=>e&&"image"!==e.type)}else"string"==typeof R.data&&(R.data.startsWith("data:image")?t=R.data:a?t="data:".concat(a,";base64,").concat(R.data):(R.data.startsWith("http://")||R.data.startsWith("https://"))&&(t=R.data));return t?(0,s.jsx)("img",{src:t,alt:"Tool result image",className:"my-2 max-h-96 w-auto rounded border border-input shadow-sm"}):n.length>0?(0,s.jsx)("div",{className:"space-y-3",children:n.map((e,t)=>(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-sm bg-background p-3 rounded-md border border-input font-mono overflow-x-auto max-h-64",children:"object"==typeof e?JSON.stringify(e,null,2):String(e)},t))}):(0,s.jsxs)("p",{className:"text-xs text-destructive",children:["Image data is not in a recognized format. Data: ",JSON.stringify(R.data)]})})():(null==(C=R.metadata)?void 0:C.type)==="markdown"&&R.data?(0,s.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none p-3 bg-background rounded border border-input leading-relaxed",children:(0,s.jsx)(f.oz,{remarkPlugins:[g.A],children:"string"==typeof R.data?R.data:JSON.stringify(R.data,null,2)})}):(null==(T=R.metadata)?void 0:T.type)==="json"&&R.data?(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-sm bg-background p-3 rounded-md border border-input font-mono",children:"string"==typeof R.data?R.data:JSON.stringify(R.data,null,2)}):(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-sm bg-background p-3 rounded-md border border-input",children:"object"==typeof R.data?JSON.stringify(R.data,null,2):String(R.data)})}):(0,s.jsxs)("div",{className:"p-3 bg-destructive/10 rounded-md",children:[(0,s.jsx)("p",{className:"text-sm text-destructive font-semibold",children:"Error executing tool:"}),(0,s.jsx)("pre",{className:"mt-1 text-xs text-destructive whitespace-pre-wrap break-all",children:R.error||"Unknown error"})]})]})]})]}),(0,s.jsx)(h.A,{isOpen:U,onClose:()=>{B(!1),ea()}})]})}function T(){return(0,s.jsx)(C,{})}}},e=>{e.O(0,[537,122,441,255,358],()=>e(e.s=704)),_N_E=e.O()}]);
|