apteva 0.4.32 → 0.4.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivityPage.7907h64p.js +3 -0
- package/dist/ApiDocsPage.k3jjenpq.js +4 -0
- package/dist/App.01nq20st.js +4 -0
- package/dist/App.1maqvamf.js +4 -0
- package/dist/App.2yjrh32f.js +4 -0
- package/dist/App.3qw8nben.js +20 -0
- package/dist/App.7fb3e7mp.js +4 -0
- package/dist/App.7sy3wq8c.js +4 -0
- package/dist/App.apjrmctz.js +57 -0
- package/dist/App.av6t2yhe.js +4 -0
- package/dist/App.jqj5a094.js +46 -0
- package/dist/App.mc7xf85h.js +4 -0
- package/dist/App.myxqcj9x.js +4 -0
- package/dist/App.nm91r1mp.js +13 -0
- package/dist/App.qcknavjz.js +221 -0
- package/dist/App.vc7vfhg4.js +4 -0
- package/dist/App.z4s9zkw5.js +4 -0
- package/dist/ConnectionsPage.z1pw5xe2.js +3 -0
- package/dist/McpPage.8vc97z0b.js +3 -0
- package/dist/SettingsPage.p61bz8kd.js +3 -0
- package/dist/SkillsPage.r9x43g3g.js +3 -0
- package/dist/TasksPage.1e0zkye4.js +3 -0
- package/dist/TelemetryPage.p9vbe4gf.js +3 -0
- package/dist/TestsPage.d4xy504e.js +3 -0
- package/dist/ThreadsPage.m016am3x.js +3 -0
- package/dist/index.html +1 -1
- package/dist/styles.css +1 -1
- package/package.json +8 -7
- package/src/crypto.ts +4 -3
- package/src/db.ts +153 -28
- package/src/integrations/agentdojo.ts +94 -12
- package/src/integrations/index.ts +7 -0
- package/src/mcp-platform.ts +494 -121
- package/src/providers.ts +12 -12
- package/src/routes/api/agent-utils.ts +59 -46
- package/src/routes/api/agents.ts +52 -1
- package/src/routes/api/integrations.ts +11 -5
- package/src/routes/api/mcp.ts +5 -4
- package/src/routes/api/meta-agent.ts +35 -1
- package/src/routes/api/projects.ts +3 -3
- package/src/routes/api/providers.ts +121 -30
- package/src/routes/api/skills.ts +2 -3
- package/src/routes/api/system.ts +8 -13
- package/src/server.ts +31 -32
- package/src/triggers/agentdojo.ts +2 -2
- package/src/web/App.tsx +18 -10
- package/src/web/components/activity/ActivityPage.tsx +241 -388
- package/src/web/components/agents/AgentCard.tsx +5 -13
- package/src/web/components/common/Icons.tsx +8 -0
- package/src/web/components/common/Select.tsx +4 -3
- package/src/web/components/dashboard/Dashboard.tsx +155 -30
- package/src/web/components/index.ts +1 -1
- package/src/web/components/layout/Sidebar.tsx +7 -1
- package/src/web/components/mcp/IntegrationsPanel.tsx +126 -35
- package/src/web/components/mcp/McpPage.tsx +10 -1
- package/src/web/components/meta-agent/MetaAgent.tsx +4 -2
- package/src/web/components/settings/SettingsPage.tsx +133 -48
- package/src/web/components/tasks/TasksPage.tsx +48 -16
- package/src/web/components/telemetry/TelemetryPage.tsx +184 -0
- package/src/web/components/threads/ThreadsPage.tsx +313 -0
- package/src/web/context/AuthContext.tsx +3 -3
- package/src/web/context/ProjectContext.tsx +3 -3
- package/src/web/context/TelemetryContext.tsx +24 -6
- package/src/web/context/index.ts +1 -1
- package/src/web/styles.css +20 -4
- package/src/web/types.ts +4 -3
- package/dist/ActivityPage.41nbye4r.js +0 -3
- package/dist/ApiDocsPage.4smnt8m3.js +0 -4
- package/dist/App.0sbax9et.js +0 -4
- package/dist/App.0ws427h8.js +0 -4
- package/dist/App.6q6bar8b.js +0 -4
- package/dist/App.80301vdb.js +0 -4
- package/dist/App.af2wg84v.js +0 -267
- package/dist/App.ca1rz1ph.js +0 -4
- package/dist/App.ensa6z0r.js +0 -4
- package/dist/App.f8g7tych.js +0 -13
- package/dist/App.mvtqv6qc.js +0 -20
- package/dist/App.ncgc9cxy.js +0 -4
- package/dist/App.p0fb1pds.js +0 -4
- package/dist/App.pmaq48sj.js +0 -4
- package/dist/App.yv87t9m5.js +0 -4
- package/dist/App.zjmfm8p6.js +0 -4
- package/dist/ConnectionsPage.anb3rv9a.js +0 -3
- package/dist/McpPage.y396h6fy.js +0 -3
- package/dist/SettingsPage.p1hc60gk.js +0 -3
- package/dist/SkillsPage.yj3xdsay.js +0 -3
- package/dist/TasksPage.sjv0khtv.js +0 -3
- package/dist/TelemetryPage.2qm4w16r.js +0 -3
- package/dist/TestsPage.zzs4qfj8.js +0 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{V as A}from"./App.7sy3wq8c.js";import{$ as V,X as C,aa as L,ca as P,ja as S,ma as b}from"./App.3qw8nben.js";var W=C(V(),1);var q=C(L(),1),x=new Set(["thread_activity","agent_started","agent_stopped","agent_error","task_created","task_updated","task_deleted","task_executed","llm_request","tool_invocation","mcp_request","mcp_tool_execution"]),j={CHAT:"bg-green-400",LLM:"bg-purple-400",TOOL:"bg-blue-400",TASK:"bg-yellow-400",MEMORY:"bg-cyan-400",MCP:"bg-orange-400",SYSTEM:"bg-gray-400",ERROR:"bg-red-400"};function m($,G){let U=$.data||{};switch($.type){case"thread_activity":return U.activity||"Working...";case"agent_started":return"Agent started";case"agent_stopped":return U.reason?`Agent stopped (${U.reason})`:"Agent stopped";case"agent_error":return $.error||"Agent error";case"llm_request":return"Thinking...";case"tool_invocation":{let Q=U.tool_name||"";if(!Q)return"Using tools";return`Tool: ${Q.replace(/[-_]/g," ").replace(/\b\w/g,(Z)=>Z.toUpperCase())}`}case"task_created":return U.title?`Task created: ${U.title}`:"Task created";case"task_updated":{let{status:Q,title:X}=U,Z=Q?Q.charAt(0).toUpperCase()+Q.slice(1):null;if(X&&Z)return`Task ${Z}: ${X}`;if(Z)return`Task ${Z}`;if(X)return`Task updated: ${X}`;return"Task updated"}case"task_deleted":return"Task deleted";case"task_executed":{let Q=U.title;return Q?`Task started: ${Q}`:"Task started"}case"memory_stored":return"Memory stored";case"memory_retrieved":return"Memory retrieved";case"mcp_request":return U.server?`MCP request to ${U.server}`:"MCP request";case"mcp_tool_execution":{let Q=U.tool_name||U.tool||"";if(!Q)return"MCP tool call";return`MCP: ${(Q.includes("__")?Q.split("__").slice(1).join("__"):Q).replace(/[-_]/g," ").replace(/\b\w/g,(H)=>H.toUpperCase())}`}default:return $.type.replace(/_/g," ")}}function l({agents:$,loading:G,onNavigate:U}){let{authFetch:Q}=S(),{currentProjectId:X}=b(),{events:Z,statusChangeCounter:H}=P(),[_,p]=W.useState([]),[R,I]=W.useState(""),[O]=W.useState(()=>new Set),y=W.useRef(!1),Y=W.useMemo(()=>{if(X===null)return $;if(X==="unassigned")return $.filter((z)=>!z.projectId);return $.filter((z)=>z.projectId===X)},[$,X]),N=W.useMemo(()=>new Set(Y.map((z)=>z.id)),[Y]),h=W.useMemo(()=>{let z=new Map;return Y.forEach((J)=>z.set(J.id,J.name)),z},[Y]),w=W.useCallback(async()=>{let z=X?`&project_id=${encodeURIComponent(X)}`:"";try{let J=await Q(`/api/telemetry/events?limit=200${z}`);if(J.ok){let B=await J.json();p(B.events||[])}}catch{}},[Q,X]);W.useEffect(()=>{w()},[w,H]),W.useEffect(()=>{if(_.length>0&&!y.current){for(let z of _)O.add(z.id);for(let z of Z)O.add(z.id);y.current=!0}},[_,Z,O]);let M=W.useMemo(()=>{let z=new Set,J=[],B=(K)=>{if(!x.has(K.type)||!N.has(K.agent_id)||K.data?.parent_id)return!1;if(K.type==="mcp_tool_execution"&&!K.duration_ms)return!1;return!0};for(let K of Z)if(!z.has(K.id)&&B(K))J.push(K),z.add(K.id);for(let K of _)if(!z.has(K.id)&&B(K))J.push(K),z.add(K.id);let k=J;if(R)k=k.filter((K)=>K.agent_id===R);return k.sort((K,F)=>new Date(F.timestamp).getTime()-new Date(K.timestamp).getTime()),k.slice(0,200)},[Z,_,N,R]),f=W.useMemo(()=>{let z=[],J="",B=new Date().toDateString(),k=new Date(Date.now()-86400000).toDateString();for(let K of M){let F=new Date(K.timestamp).toDateString(),T=F===B?"Today":F===k?"Yesterday":F;if(T!==J)J=T,z.push({label:T,events:[]});z[z.length-1].events.push(K)}return z},[M]);if(G)return q.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:"Loading..."},void 0,!1,void 0,this);let D=Y.filter((z)=>z.status==="running").length;return q.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden",children:[q.jsxDEV("div",{className:"px-6 pt-6 pb-4 shrink-0",children:q.jsxDEV("div",{className:"flex items-center justify-between gap-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-xl font-semibold",children:"Activity"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[#666] mt-0.5",children:[D," of ",Y.length," agents running"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"w-48",children:q.jsxDEV(A,{value:R,onChange:I,placeholder:"All agents",options:[{value:"",label:"All agents"},...Y.map((z)=>({value:z.id,label:z.name}))]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 overflow-auto px-6 pb-6",children:M.length===0?q.jsxDEV("div",{className:"flex flex-col items-center justify-center py-20 text-[#555]",children:[q.jsxDEV("p",{className:"text-lg mb-2",children:"No activity yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm",children:"Agent activity will appear here in real-time."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"max-w-2xl",children:f.map((z)=>q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"sticky top-0 z-10 bg-[#0a0a0a]/95 backdrop-blur-sm py-2 mb-1",children:q.jsxDEV("span",{className:"text-xs font-semibold text-[#666] uppercase tracking-wider",children:z.label},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"relative ml-3 border-l border-[#1a1a1a]",children:z.events.map((J)=>{let B=!O.has(J.id);if(B)O.add(J.id);let k=h.get(J.agent_id)||J.agent_id.slice(0,8),K=J.level==="error"?"bg-red-400":j[J.category]||"bg-[#555]";return q.jsxDEV("div",{className:`relative pl-6 pr-3 py-2.5 hover:bg-[#111]/50 transition-colors ${B?"animate-slideIn":""}`,children:[q.jsxDEV("span",{className:`absolute left-[-4.5px] top-[14px] w-[9px] h-[9px] rounded-full ${K} ring-2 ring-[#0a0a0a]`},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-start justify-between gap-3",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("p",{className:`text-sm ${J.level==="error"?"text-red-400":""}`,children:m(J,k)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2 text-[11px] text-[#555] mt-0.5",children:[q.jsxDEV("span",{className:"text-[#888] font-medium",children:k},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#333]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#555]",children:J.category},void 0,!1,void 0,this),J.duration_ms!=null&&J.duration_ms>0&&q.jsxDEV(q.Fragment,{children:[q.jsxDEV("span",{className:"text-[#333]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{children:J.duration_ms<1000?`${J.duration_ms}ms`:`${(J.duration_ms/1000).toFixed(1)}s`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-[11px] text-[#555] shrink-0 pt-0.5",children:g(J.timestamp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},J.id,!0,void 0,this)})},void 0,!1,void 0,this)]},z.label,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function g($){let G=Math.floor((Date.now()-new Date($).getTime())/1000);if(G<5)return"just now";if(G<60)return`${G}s ago`;let U=Math.floor(G/60);if(U<60)return`${U}m ago`;let Q=Math.floor(U/60);if(Q<24)return`${Q}h ago`;return`${Math.floor(Q/24)}d ago`}export{l as ActivityPage};
|
|
2
|
+
|
|
3
|
+
//# debugId=7FD9FF2C4015E95064756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{$ as E,X as y,aa as D,ja as l}from"./App.3qw8nben.js";var M=y(E(),1);var z=y(D(),1),V={get:"#61affe",post:"#49cc90",put:"#fca130",delete:"#f93e3e",patch:"#50e3c2"};function c({method:I,path:A,parameters:F,requestBody:L,authFetch:T}){let[U,R]=M.useState({}),[G,O]=M.useState(""),[_,k]=M.useState(null),[w,q]=M.useState(!1),[B,f]=M.useState(null);M.useEffect(()=>{if(L?.content?.["application/json"]?.schema){let W=L.content["application/json"].schema;if(W.example)O(JSON.stringify(W.example,null,2));else if(W.properties){let $={};for(let[N,Q]of Object.entries(W.properties))if(Q.example!==void 0)$[N]=Q.example;else if(Q.type==="string")$[N]="";else if(Q.type==="number"||Q.type==="integer")$[N]=0;else if(Q.type==="boolean")$[N]=!1;else if(Q.type==="array")$[N]=[];else if(Q.type==="object")$[N]={};O(JSON.stringify($,null,2))}}},[L]);let C=async()=>{q(!0),f(null),k(null);try{let W=A,$=[];for(let Z of F||[]){let H=U[Z.name]||"";if(Z.in==="path")W=W.replace(`{${Z.name}}`,encodeURIComponent(H));else if(Z.in==="query"&&H)$.push(`${Z.name}=${encodeURIComponent(H)}`)}if($.length>0)W+=`?${$.join("&")}`;let N={method:I.toUpperCase()};if(G&&["post","put","patch"].includes(I))N.headers={"Content-Type":"application/json"},N.body=G;let Q=await T(`/api${W}`,N),X;if(Q.headers.get("content-type")?.includes("application/json"))X=await Q.json();else X=await Q.text();k({status:Q.status,data:X})}catch(W){f(W.message||"Request failed")}finally{q(!1)}},b=F?.filter((W)=>W.in==="path")||[],K=F?.filter((W)=>W.in==="query")||[],S=["post","put","patch"].includes(I)&&L;return z.jsxDEV("div",{style:{marginTop:16,padding:16,background:"#0a0a14",borderRadius:6,border:"1px solid #222"},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#f97316",marginBottom:12,fontWeight:600},children:"Try it out"},void 0,!1,void 0,this),b.length>0&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Path Parameters"},void 0,!1,void 0,this),b.map((W)=>z.jsxDEV("div",{style:{marginBottom:8},children:[z.jsxDEV("label",{style:{fontSize:12,color:"#888",display:"block",marginBottom:4},children:[W.name," ",W.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("input",{type:"text",value:U[W.name]||"",onChange:($)=>R({...U,[W.name]:$.target.value}),placeholder:W.schema?.type||"string",style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:13,fontFamily:"monospace"}},void 0,!1,void 0,this)]},W.name,!0,void 0,this))]},void 0,!0,void 0,this),K.length>0&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Query Parameters"},void 0,!1,void 0,this),K.map((W)=>z.jsxDEV("div",{style:{marginBottom:8},children:[z.jsxDEV("label",{style:{fontSize:12,color:"#888",display:"block",marginBottom:4},children:[W.name," ",W.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("input",{type:"text",value:U[W.name]||"",onChange:($)=>R({...U,[W.name]:$.target.value}),placeholder:W.schema?.type||"string",style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:13,fontFamily:"monospace"}},void 0,!1,void 0,this)]},W.name,!0,void 0,this))]},void 0,!0,void 0,this),S&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Request Body (JSON)"},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:G,onChange:(W)=>O(W.target.value),rows:6,style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:12,fontFamily:"monospace",resize:"vertical"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:C,disabled:w,style:{padding:"10px 20px",background:w?"#333":"#f97316",color:w?"#666":"#000",border:"none",borderRadius:4,cursor:w?"not-allowed":"pointer",fontSize:13,fontWeight:600},children:w?"Executing...":"Execute"},void 0,!1,void 0,this),B&&z.jsxDEV("div",{style:{marginTop:12,padding:12,background:"#2a1515",borderRadius:4,color:"#f66",fontSize:12},children:B},void 0,!1,void 0,this),_&&z.jsxDEV("div",{style:{marginTop:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:["Response"," ",z.jsxDEV("span",{style:{color:_.status>=200&&_.status<300?"#49cc90":"#f66"},children:_.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("pre",{style:{padding:12,background:"#111",borderRadius:4,color:"#888",fontSize:11,fontFamily:"monospace",overflow:"auto",maxHeight:300,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:typeof _.data==="string"?_.data:JSON.stringify(_.data,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function h(){let{authFetch:I}=l(),[A,F]=M.useState(null),[L,T]=M.useState(!0),[U,R]=M.useState(new Set),[G,O]=M.useState(null),[_,k]=M.useState(!1);M.useEffect(()=>{B()},[]);async function w(){if(!A)return;try{await navigator.clipboard.writeText(JSON.stringify(A,null,2)),k(!0),setTimeout(()=>k(!1),2000)}catch(N){console.error("Failed to copy:",N)}}function q(){if(!A)return;let N=new Blob([JSON.stringify(A,null,2)],{type:"application/json"}),Q=URL.createObjectURL(N),X=document.createElement("a");X.href=Q,X.download="apteva-openapi.json",X.click(),URL.revokeObjectURL(Q)}async function B(){try{let N=await I("/api/openapi");if(N.ok){let Q=await N.json();F(Q)}}catch(N){console.error("Failed to load OpenAPI spec:",N)}finally{T(!1)}}function f(N){R((Q)=>{let X=new Set(Q);if(X.has(N))X.delete(N);else X.add(N);return X})}function C(N,Q=0){if(!N)return"{}";if(Q>2)return"...";if(N.$ref)return N.$ref.split("/").pop()||"Object";if(N.type==="array")return`${C(N.items,Q+1)}[]`;if(N.type==="object"&&N.properties){let X=Object.entries(N.properties).slice(0,3).map(([Z,H])=>`${Z}: ${H.type||"any"}`).join(", "),Y=Object.keys(N.properties).length>3?", ...":"";return`{ ${X}${Y} }`}return N.type||"any"}if(L)return z.jsxDEV("div",{style:{padding:24},children:z.jsxDEV("p",{style:{color:"#888"},children:"Loading API documentation..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(!A)return z.jsxDEV("div",{style:{padding:24},children:z.jsxDEV("p",{style:{color:"#f66"},children:"Failed to load API documentation"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let b=A.tags||[],K=Object.entries(A.paths);function S(N){let Q=new Set;function X(Y){if(!Y)return;if(typeof Y==="object"){if(Y.$ref){let Z=Y.$ref.split("/").pop();if(Z)Q.add(Z)}for(let Z of Object.values(Y))X(Z)}}return X(N.requestBody),X(N.responses),Q}function W(){if(!G||!A.components?.schemas)return Object.keys(A.components?.schemas||{});let N=new Set;for(let[Q,X]of $)for(let[Y,Z]of Object.entries(X)){if(!["get","post","put","delete","patch"].includes(Y))continue;if(Z.tags?.includes(G))S(Z).forEach((g)=>N.add(g))}return Array.from(N)}let $=G?K.filter(([N,Q])=>Object.values(Q).some((X)=>X.tags?.includes(G))):K;return z.jsxDEV("div",{style:{padding:24,maxWidth:1000,height:"100%",overflowY:"auto"},children:[z.jsxDEV("div",{style:{marginBottom:24},children:[z.jsxDEV("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:8},children:[z.jsxDEV("h1",{style:{fontSize:24,fontWeight:600},children:A.info.title},void 0,!1,void 0,this),z.jsxDEV("div",{style:{display:"flex",gap:8},children:[z.jsxDEV("button",{onClick:w,style:{padding:"8px 16px",borderRadius:4,border:"1px solid #333",background:_?"#49cc90":"#1a1a2e",color:_?"#000":"#fff",cursor:"pointer",fontSize:12,fontFamily:"inherit"},children:_?"Copied!":"Copy JSON"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:q,style:{padding:"8px 16px",borderRadius:4,border:"1px solid #333",background:"#1a1a2e",color:"#fff",cursor:"pointer",fontSize:12,fontFamily:"inherit"},children:"Download"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{style:{color:"#888",marginBottom:8},children:A.info.description.split(`
|
|
2
|
+
`)[0]},void 0,!1,void 0,this),z.jsxDEV("p",{style:{color:"#666",fontSize:12},children:["Version: ",A.info.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",padding:12,borderRadius:6,marginBottom:24,fontFamily:"monospace"},children:[z.jsxDEV("span",{style:{color:"#888"},children:"Base URL: "},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#61affe"},children:[window.location.origin,"/api"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{marginBottom:24,display:"flex",flexWrap:"wrap",gap:8},children:[z.jsxDEV("button",{onClick:()=>O(null),style:{padding:"6px 12px",borderRadius:4,border:"1px solid #333",background:G===null?"#333":"transparent",color:G===null?"#fff":"#888",cursor:"pointer",fontSize:12},children:"All"},void 0,!1,void 0,this),b.map((N)=>z.jsxDEV("button",{onClick:()=>O(N.name),style:{padding:"6px 12px",borderRadius:4,border:"1px solid #333",background:G===N.name?"#333":"transparent",color:G===N.name?"#fff":"#888",cursor:"pointer",fontSize:12},title:N.description,children:N.name},N.name,!1,void 0,this))]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{display:"flex",flexDirection:"column",gap:8},children:$.map(([N,Q])=>Object.entries(Q).filter(([X])=>["get","post","put","delete","patch"].includes(X)).map(([X,Y])=>{let Z=`${X}:${N}`,H=U.has(Z),g=X.toUpperCase(),j=V[X]||"#888";return z.jsxDEV("div",{style:{border:"1px solid #333",borderRadius:6,overflow:"hidden"},children:[z.jsxDEV("div",{onClick:()=>f(Z),style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",background:H?"#1a1a2e":"transparent",cursor:"pointer"},children:[z.jsxDEV("span",{style:{background:j,color:"#000",padding:"4px 8px",borderRadius:4,fontSize:11,fontWeight:600,minWidth:60,textAlign:"center"},children:g},void 0,!1,void 0,this),z.jsxDEV("span",{style:{fontFamily:"monospace",color:"#fff"},children:N},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888",flex:1,fontSize:13},children:Y.summary},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#666",fontSize:12},children:H?"[-]":"[+]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&z.jsxDEV("div",{style:{padding:16,background:"#0d0d1a",borderTop:"1px solid #333"},children:[Y.description&&z.jsxDEV("p",{style:{color:"#888",marginBottom:16,fontSize:13},children:Y.description},void 0,!1,void 0,this),Y.parameters&&Y.parameters.length>0&&z.jsxDEV("div",{style:{marginBottom:16},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:"Parameters"},void 0,!1,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12},children:Y.parameters.map((J)=>z.jsxDEV("div",{style:{display:"flex",gap:12,marginBottom:8,fontSize:12},children:[z.jsxDEV("span",{style:{color:"#61affe",minWidth:100},children:[J.name,J.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("span",{style:{color:"#666"},children:["(",J.in,")"]},void 0,!0,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:J.schema?.type||"string"},void 0,!1,void 0,this),J.description&&z.jsxDEV("span",{style:{color:"#666"},children:["- ",J.description]},void 0,!0,void 0,this)]},J.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.requestBody&&z.jsxDEV("div",{style:{marginBottom:16},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:["Request Body",Y.requestBody.required&&z.jsxDEV("span",{style:{color:"#f66"},children:" (required)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12,fontFamily:"monospace",fontSize:12,color:"#49cc90"},children:Object.entries(Y.requestBody.content||{}).map(([J,P])=>z.jsxDEV("div",{children:[z.jsxDEV("span",{style:{color:"#666"},children:[J,": "]},void 0,!0,void 0,this),C(P.schema)]},J,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.responses&&z.jsxDEV("div",{children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:"Responses"},void 0,!1,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12},children:Object.entries(Y.responses).map(([J,P])=>{let v=P.content?.["application/json"]?.schema,u=v?.$ref?.split("/").pop(),n=v?.type,i=v?.items?.$ref?.split("/").pop();return z.jsxDEV("div",{style:{marginBottom:12,fontSize:12},children:[z.jsxDEV("div",{style:{display:"flex",gap:12,marginBottom:4},children:[z.jsxDEV("span",{style:{color:J.startsWith("2")?"#49cc90":"#f66",minWidth:40},children:J},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:P.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&z.jsxDEV("div",{style:{marginLeft:52,padding:"8px 12px",background:"#0d0d1a",borderRadius:4,fontFamily:"monospace"},children:u?z.jsxDEV("span",{style:{color:"#61affe"},children:u},void 0,!1,void 0,this):n==="array"&&i?z.jsxDEV("span",{style:{color:"#61affe"},children:[i,"[]"]},void 0,!0,void 0,this):n==="array"?z.jsxDEV("span",{style:{color:"#888"},children:"array"},void 0,!1,void 0,this):z.jsxDEV("span",{style:{color:"#888"},children:C(v)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},J,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(c,{method:X,path:N,parameters:Y.parameters,requestBody:Y.requestBody,authFetch:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},Z,!0,void 0,this)}))},void 0,!1,void 0,this),A.components?.schemas&&W().length>0&&z.jsxDEV("div",{style:{marginTop:32},children:[z.jsxDEV("h2",{style:{fontSize:18,fontWeight:600,marginBottom:16},children:["Schemas ",G&&z.jsxDEV("span",{style:{color:"#666",fontSize:14},children:["(",G,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{display:"flex",flexDirection:"column",gap:8},children:W().map((N)=>{let Q=A.components.schemas[N];if(!Q)return null;return z.jsxDEV("div",{style:{border:"1px solid #333",borderRadius:6,padding:12},children:[z.jsxDEV("h3",{style:{fontSize:14,color:"#61affe",marginBottom:8},children:N},void 0,!1,void 0,this),Q.properties&&z.jsxDEV("div",{style:{fontSize:12},children:Object.entries(Q.properties).map(([X,Y])=>z.jsxDEV("div",{style:{display:"flex",gap:8,marginBottom:4,fontFamily:"monospace"},children:[z.jsxDEV("span",{style:{color:"#fff",minWidth:120},children:X},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:[Y.type||(Y.$ref?Y.$ref.split("/").pop():"any"),Y.nullable&&" | null"]},void 0,!0,void 0,this),Y.enum&&z.jsxDEV("span",{style:{color:"#666"},children:["[",Y.enum.join(" | "),"]"]},void 0,!0,void 0,this)]},X,!0,void 0,this))},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{h as ApiDocsPage};
|
|
3
|
+
|
|
4
|
+
//# debugId=1AB92358965FEA7164756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
function a(r){var n,f,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var o=r.length;for(n=0;n<o;n++)r[n]&&(f=a(r[n]))&&(t&&(t+=" "),t+=f)}else for(f in r)r[f]&&(t&&(t+=" "),t+=f);return t}function e(){for(var r,n,f=0,t="",o=arguments.length;f<o;f++)(r=arguments[f])&&(n=a(r))&&(t&&(t+=" "),t+=n);return t}
|
|
2
|
+
export{e as W};
|
|
3
|
+
|
|
4
|
+
//# debugId=C80F2DB3063D851D64756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{j as _0}from"./App.myxqcj9x.js";import{V as x}from"./App.7sy3wq8c.js";import{$ as X1,X as O,aa as n,ja as g,ma as j}from"./App.3qw8nben.js";var $0=O(X1(),1);var D=O(X1(),1);var U=O(n(),1);function m0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=D.useState([]),[Q,V]=D.useState([]),[W,T]=D.useState(!0);if(D.useEffect(()=>{(async()=>{T(!0);let y=H&&H!=="unassigned"?`?project_id=${H}`:"";try{let[I,a]=await Promise.all([R(`/api/subscriptions${y}`).catch(()=>null),R("/api/agents").catch(()=>null)]);if(I?.ok){let G=await I.json();F(G.subscriptions||[])}if(a?.ok){let G=await a.json();V(G.agents||[])}}catch(I){console.error("Failed to fetch overview data:",I)}T(!1)})()},[R,H]),W)return U.jsxDEV("div",{className:"text-center py-12 text-[#666]",children:"Loading..."},void 0,!1,void 0,this);let A=J.filter((Y)=>Y.enabled),S=J.filter((Y)=>!Y.enabled),l=new Map(Q.map((Y)=>[Y.id,Y]));return U.jsxDEV("div",{className:"space-y-6",children:[U.jsxDEV("div",{className:"grid grid-cols-3 gap-4",children:[U.jsxDEV(C1,{label:"Active",value:A.length},void 0,!1,void 0,this),U.jsxDEV(C1,{label:"Disabled",value:S.length},void 0,!1,void 0,this),U.jsxDEV(C1,{label:"Total",value:J.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("section",{children:[U.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Subscriptions (",J.length,")"]},void 0,!0,void 0,this),J.length===0?U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No subscriptions yet. Go to the Triggers tab to create one."},void 0,!1,void 0,this):U.jsxDEV("div",{className:"space-y-2",children:J.map((Y)=>{let y=l.get(Y.agent_id);return U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[U.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Y.enabled?"bg-green-400":"bg-[#555]"}`},void 0,!1,void 0,this),U.jsxDEV("div",{className:"flex-1 min-w-0",children:[U.jsxDEV("div",{className:"text-sm font-medium truncate",children:Y.trigger_slug.replace(/_/g," ").replace(/-/g," ")},void 0,!1,void 0,this),U.jsxDEV("div",{className:"text-xs text-[#666]",children:Y.trigger_instance_id?`ID: ${Y.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("div",{className:"text-xs text-[#888] flex-shrink-0",children:[U.jsxDEV("span",{className:"text-[#555]",children:"→"},void 0,!1,void 0,this)," ",U.jsxDEV("span",{className:"text-[#f97316]",children:y?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("span",{className:`text-xs px-2 py-0.5 rounded flex-shrink-0 ${Y.enabled?"bg-green-500/10 text-green-400":"bg-[#1a1a1a] text-[#555]"}`,children:Y.enabled?"active":"disabled"},void 0,!1,void 0,this)]},Y.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function C1({label:R,value:H,valueColor:J}){return U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:[U.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:R},void 0,!1,void 0,this),U.jsxDEV("div",{className:`text-2xl font-bold ${J||"text-[#e0e0e0]"}`,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var $=O(X1(),1);var i=O(n(),1);function I0({message:R="Loading...",fullScreen:H=!1}){let J=i.jsxDEV("div",{className:"flex items-center gap-3 text-[#666]",children:[i.jsxDEV("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[i.jsxDEV("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"},void 0,!1,void 0,this),i.jsxDEV("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.jsxDEV("span",{children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(H)return i.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center",children:J},void 0,!1,void 0,this);return i.jsxDEV("div",{className:"flex items-center justify-center py-20",children:J},void 0,!1,void 0,this)}var m=O(n(),1);function v0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=$.useState([]),[Q,V]=$.useState(""),[W,T]=$.useState([]),[A,S]=$.useState(!0),[l,Y]=$.useState([]),[y,I]=$.useState([]),[a,G]=$.useState(!1),[b,k]=$.useState(""),[o,F1]=$.useState(""),[R0,v1]=$.useState(!1),[B,_1]=$.useState(null),[f1,z0]=$.useState([]),[$1,I1]=$.useState(""),[Y1,R1]=$.useState(!1),[r,n1]=$.useState(""),[Z1,P1]=$.useState({}),[l1,G0]=$.useState(""),[H0,q1]=$.useState(!1),[p,J0]=$.useState([]),[K0,k1]=$.useState(!1),[A1,U0]=$.useState([]),[Q1,X0]=$.useState([]),[s,y1]=$.useState(""),[t,W1]=$.useState(""),[e,h1]=$.useState(""),[i1,T1]=$.useState(!1),[B1,z1]=$.useState({}),[S1,Y0]=$.useState(""),[a1,G1]=$.useState(!1),[M1,p1]=$.useState(""),[u1,H1]=$.useState(!1),[O1,x1]=$.useState(""),[Z0,J1]=$.useState(!1),[c,L1]=$.useState(""),[K1,b1]=$.useState(""),[V1,c1]=$.useState(!1),[h,q0]=$.useState([]),[d1,Z]=$.useState(null),X=H&&H!=="unassigned"?`?project_id=${H}`:"",E1=$.useCallback(async()=>{try{let N=await R(`/api/triggers/providers${X}`);if(N.ok){let _=((await N.json()).providers||[]).filter((f)=>f.connected);if(F(_),_.length>0)V((f)=>{if(!f||!_.find((K)=>K.id===f))return _[0].id;return f})}}catch(N){console.error("Failed to fetch providers:",N)}},[R]),u=$.useCallback(async()=>{S(!0);try{let N=`provider=${Q}`,v=X?"&":"?",_=X?`/api/triggers${X}&${N}`:`/api/triggers?${N}`,f=await R(_);if(f.ok){let K=await f.json();T(K.triggers||[])}}catch(N){console.error("Failed to fetch triggers:",N)}S(!1)},[R,X,Q]),N1=$.useCallback(async()=>{try{let N=await R(`/api/subscriptions${X}`);if(N.ok){let v=await N.json();Y(v.subscriptions||[])}}catch(N){console.error("Failed to fetch subscriptions:",N)}},[R,X]),D1=$.useCallback(async()=>{try{let N=await R(`/api/agents${X}`);if(N.ok){let v=await N.json();q0(v.agents||[])}}catch(N){}},[R,X]);$.useEffect(()=>{E1(),u(),N1(),D1()},[E1,u,N1,D1]);let Q0=async(N)=>{G(!0);try{let v=`/api/triggers/types?provider=${Q}`;if(N)v+=`&toolkit_slugs=${N}`;if(H&&H!=="unassigned")v+=`&project_id=${H}`;let _=await R(v);if(_.ok){let f=await _.json();I(f.types||[])}else{let f=await _.json();Z(f.error||"Failed to fetch trigger types")}}catch(v){Z("Failed to fetch trigger types")}G(!1)},W0=async()=>{try{let N=await R(`/api/integrations/${Q}/connected${X}`);if(N.ok){let v=await N.json();z0((v.accounts||[]).filter((_)=>_.status==="active"))}}catch(N){}},B0=(N)=>{_1(N),I1(""),n1(""),P1({}),G0(""),v1(!0),W0()},C=Q==="agentdojo",M0=async()=>{q1(!0),W1(""),y1(""),h1(""),z1({}),Y0("");let N=async()=>{if(p.length>0)return;k1(!0);try{let f="/api/triggers/types?provider=agentdojo";if(H&&H!=="unassigned")f+=`&project_id=${H}`;let L=await(await R(f)).json();J0(L.types||[])}catch(f){console.error("Failed to load trigger types:",f)}k1(!1)},v=async()=>{try{let f=`/api/integrations/agentdojo/connected${X}`,q=((await(await R(f)).json()).accounts||[]).filter((E)=>E.status==="active");U0(q)}catch(f){console.error("Failed to load connected accounts:",f)}},_=async()=>{if(Q1.length>0)return;try{let f=`/api/integrations/agentdojo/apps${X}`,L=await(await R(f)).json();X0((L.apps||[]).map((q)=>({id:q.id,name:q.name,slug:q.slug,logo:q.logo})))}catch(f){console.error("Failed to load apps:",f)}};await Promise.all([N(),v(),_()])},O0=async()=>{let N=p.find((_)=>_.slug===t),v=U1;if(!N||!e||!v)return;T1(!0),Z(null);try{let _=h.find((F0)=>F0.id===e),f="provider=agentdojo",K=X?`/api/triggers${X}&provider=agentdojo`:"/api/triggers?provider=agentdojo",L={callback_url:`${window.location.origin}/api/webhooks/agentdojo`,title:`${N.name} → ${_?.name||"Agent"}`,server:N.toolkit_slug,agent_id:e,...B1},q=await R(K,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:N.slug,connectedAccountId:v.id,config:L})}),E=await q.json();if(!q.ok)Z(E.error||"Failed to create subscription");else q1(!1),u()}catch(_){Z(_.message||"Failed to create subscription")}T1(!1)},L0=async()=>{if(!B)return;if(C){if(!r||!m1)return;R1(!0),Z(null);try{let N=h.find((q)=>q.id===r),v=window.location.origin,_=`provider=${Q}`,f=X?`/api/triggers${X}&${_}`:`/api/triggers?${_}`,K=await R(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:m1.id,config:{callback_url:`${v}/api/webhooks/agentdojo`,title:`${B.name} → ${N?.name||"Agent"}`,server:B.toolkit_slug,agent_id:r,...Z1}})}),L=await K.json();if(!K.ok)Z(L.error||"Failed to create subscription");else v1(!1),_1(null),u()}catch(N){Z(N.message||"Failed to create subscription")}R1(!1);return}if(!$1)return;R1(!0),Z(null);try{let N=`provider=${Q}`,v=X?`/api/triggers${X}&${N}`:`/api/triggers?${N}`,_=await R(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:$1})}),f=await _.json();if(!_.ok)Z(f.error||"Failed to create trigger");else v1(!1),_1(null),u()}catch(N){Z(N.message||"Failed to create trigger")}R1(!1)},g1=async(N,v)=>{let _=v==="active"?"disable":"enable";try{let f=X?`&provider=${Q}`:`?provider=${Q}`,K=await R(`/api/triggers/${N}/${_}${X}${f}`,{method:"POST"});if(K.ok)u();else{let L=await K.json();Z(L.error||`Failed to ${_} trigger`)}}catch(f){Z(`Failed to ${_} trigger`)}},j1=async(N)=>{try{let v=X?`&provider=${Q}`:`?provider=${Q}`,_=await R(`/api/triggers/${N}${X}${v}`,{method:"DELETE"});if(_.ok)u();else{let f=await _.json();Z(f.error||"Failed to delete trigger")}}catch(v){Z("Failed to delete trigger")}},b0=async()=>{if(!c||!K1)return;let N=W.find((v)=>v.id===c);if(!N)return;c1(!0),Z(null);try{let v=await R("/api/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trigger_slug:N.trigger_slug,trigger_instance_id:N.id,agent_id:K1,provider:Q,project_id:H&&H!=="unassigned"?H:null,public_url:window.location.origin})}),_=await v.json();if(!v.ok)Z(_.error||"Failed to create subscription");else J1(!1),L1(""),b1(""),N1()}catch(v){Z(v.message||"Failed to create subscription")}c1(!1)},w0=async(N)=>{let v=N.enabled?"disable":"enable";try{if((await R(`/api/subscriptions/${N.id}/${v}`,{method:"POST"})).ok)N1()}catch(_){Z(`Failed to ${v} subscription`)}},C0=async(N)=>{try{if((await R(`/api/subscriptions/${N}`,{method:"DELETE"})).ok)N1()}catch(v){Z("Failed to delete subscription")}},w1=y.filter((N)=>{if(!o)return!0;let v=o.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)||N.description.toLowerCase().includes(v)}),o1=(N,v)=>{if(!v||N.length===0)return null;let _=v.toLowerCase().replace(/[-_]/g," "),f=N.find((q)=>q.appId?.toLowerCase()===v.toLowerCase()||q.appName?.toLowerCase()===v.toLowerCase());if(f)return f;let K=N.find((q)=>q.appId?.toLowerCase().includes(_)||q.appName?.toLowerCase().replace(/[-_]/g," ").includes(_)||_.includes(q.appId?.toLowerCase()||"")||_.includes(q.appName?.toLowerCase().replace(/[-_]/g," ")||""));if(K)return K;let L=_.split(/\s+/);return N.find((q)=>{let E=(q.appName||"").toLowerCase().replace(/[-_]/g," ").split(/\s+/);return L[0]&&E[0]&&L[0]===E[0]})||null},M=p.find((N)=>N.slug===t),r1=M?o1(A1,M.toolkit_slug):null,U1=S1?A1.find((N)=>N.id===S1)||r1:r1,s1=B&&C?o1(f1,B.toolkit_slug):null,m1=l1?f1.find((N)=>N.id===l1)||s1:s1,t1=$.default.useMemo(()=>{let N=new Map;for(let _ of Q1)if(_.logo)N.set(_.slug,_.logo);let v=new Map;for(let _ of p){let f=v.get(_.toolkit_slug);if(f)f.count++;else{let K=N.get(_.toolkit_slug)||_.logo||null;v.set(_.toolkit_slug,{slug:_.toolkit_slug,name:_.toolkit_name,logo:K,count:1})}}return Array.from(v.values()).sort((_,f)=>_.name.localeCompare(f.name))},[p,Q1]),e1=s?p.filter((N)=>N.toolkit_slug===s):[],d=t1.find((N)=>N.slug===s),N0=new Map(h.map((N)=>[N.id,N]));if(J.length===0&&!A)return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[m.jsxDEV("p",{className:"text-[#666]",children:"No trigger providers configured."},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-sm text-[#555] mt-1",children:"Add API keys for Composio or AgentDojo in Settings to enable triggers."},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return m.jsxDEV("div",{className:"space-y-6",children:[d1&&m.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg flex items-center justify-between",children:[m.jsxDEV("span",{children:d1},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>Z(null),className:"text-red-400 hover:text-red-300",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.length>1&&m.jsxDEV("div",{className:"flex items-center gap-2",children:[m.jsxDEV("span",{className:"text-xs text-[#666]",children:"Provider:"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex gap-1 bg-[#111] border border-[#1a1a1a] rounded-lg p-0.5",children:J.map((N)=>m.jsxDEV("button",{onClick:()=>{V(N.id),I([]),k(""),F1("")},className:`px-3 py-1 rounded text-xs font-medium transition ${Q===N.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:N.name},N.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&m.jsxDEV("section",{children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Subscriptions (",l.length,")"]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:()=>J1(!0),className:"text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No subscriptions yet. Add one to route trigger events to an agent."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:l.map((N)=>{let v=N0.get(N.agent_id);return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.enabled?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:[N.trigger_slug.replace(/_/g," "),m.jsxDEV("span",{className:"text-[#555] mx-1.5",children:"→"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#f97316]",children:v?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:N.trigger_instance_id?`Instance: ${N.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>w0(N),className:`text-xs px-3 py-1 rounded transition ${N.enabled?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.enabled?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>C0(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&m.jsxDEV("section",{children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Trigger Instances (",W.length,")"]},void 0,!0,void 0,this),A?m.jsxDEV("div",{className:"text-center py-6 text-[#666] text-sm",children:"Loading triggers..."},void 0,!1,void 0,this):W.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No trigger instances. Browse trigger types below to create one."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:W.map((N)=>m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.status==="active"?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:N.trigger_slug.replace(/_/g," ")},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:["ID: ",N.id.slice(0,12),"... | Created: ",new Date(N.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>g1(N.id,N.status),className:`text-xs px-3 py-1 rounded transition ${N.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>j1(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&m.jsxDEV("section",{children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Active Subscriptions (",W.length,")"]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:M0,className:"text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A?m.jsxDEV("div",{className:"text-center py-6 text-[#666] text-sm",children:"Loading subscriptions..."},void 0,!1,void 0,this):W.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No active subscriptions. Browse trigger types below to create one."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:W.map((N)=>{let v=l.find((f)=>f.trigger_instance_id===N.id),_=v?N0.get(v.agent_id):null;return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.status==="active"?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:[N.config?.title||N.trigger_slug.replace(/_/g," "),_&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("span",{className:"text-[#555] mx-1.5",children:"→"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#f97316]",children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:[N.config?.server&&m.jsxDEV("span",{children:[String(N.config.server)," | "]},void 0,!0,void 0,this),"ID: ",String(N.id).slice(0,8)," | Created: ",new Date(N.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>g1(N.id,N.status),className:`text-xs px-3 py-1 rounded transition ${N.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>j1(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("section",{children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:"Browse Trigger Types"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mb-3",children:[m.jsxDEV("input",{type:"text",value:b,onChange:(N)=>k(N.target.value),placeholder:"Toolkit filter (e.g. github, gmail, slack)",className:"flex-1 bg-[#111] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>Q0(b||void 0),disabled:a,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-4 py-2 rounded transition disabled:opacity-50",children:a?"Loading...":"Browse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.length>0&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("input",{type:"text",value:o,onChange:(N)=>F1(N.target.value),placeholder:"Search trigger types...",className:"w-full bg-[#111] border border-[#333] rounded px-3 py-2 text-sm mb-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:w1.slice(0,30).map((N)=>m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] hover:border-[#333] rounded-lg p-3 transition",children:[m.jsxDEV("div",{className:"flex items-start gap-3",children:[N.logo?m.jsxDEV("img",{src:N.logo,alt:N.toolkit_name,className:"w-8 h-8 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-8 h-8 rounded bg-[#1a1a1a] flex items-center justify-center text-xs flex-shrink-0",children:N.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:N.toolkit_name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#555] mt-1 line-clamp-2",children:N.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:()=>B0(N),className:"w-full mt-3 text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:C?"Subscribe":"Create Trigger"},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this),w1.length>30&&m.jsxDEV("p",{className:"text-xs text-[#555] mt-3 text-center",children:["Showing first 30 of ",w1.length," types. Use search to filter."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R0&&B&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:C?"Create Subscription":"Create Trigger"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:[B.name,B.toolkit_name&&m.jsxDEV("span",{className:"text-[#555]",children:[" (",B.toolkit_name,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"space-y-4",children:[!C&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),f1.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No connected accounts available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):m.jsxDEV(x,{value:$1,onChange:I1,placeholder:"Select account...",options:f1.map((N)=>({value:N.id,label:`${N.appName} (${N.id.slice(0,8)}...)`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Route to Agent"},void 0,!1,void 0,this),h.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):m.jsxDEV(x,{value:r,onChange:n1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this),m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),m1?m.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",m1.appName]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",B?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.config_schema&&Object.keys(B.config_schema.properties||{}).length>0&&m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"space-y-2",children:Object.entries(B.config_schema.properties||{}).map(([N,v])=>{let _=(B.config_schema.required||[]).includes(N);return m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-[11px] text-[#888] mb-1",children:[v.title||N,_&&m.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("input",{type:"text",value:Z1[N]||"",onChange:(f)=>P1((K)=>({...K,[N]:f.target.value})),placeholder:v.description||`Enter ${v.title||N}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-4",children:[m.jsxDEV("button",{onClick:()=>{v1(!1),_1(null)},className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:L0,disabled:C?!r||!m1||Y1||B?.config_schema&&(B.config_schema.required||[]).some((N)=>!Z1[N]?.trim()):!$1||Y1,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:Y1?"Creating...":C?"Subscribe":"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Z0&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:"Route Trigger to Agent"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:W.length===0?"No trigger instances yet. Create one first from the Browse section below.":"Select a trigger instance and the agent that should handle its events."},void 0,!1,void 0,this),W.length>0?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"space-y-4",children:[m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Trigger Instance"},void 0,!1,void 0,this),m.jsxDEV(x,{value:c,onChange:L1,placeholder:"Select trigger...",options:W.map((N)=>({value:N.id,label:`${N.trigger_slug.replace(/_/g," ")}`}))},void 0,!1,void 0,this),c&&m.jsxDEV("div",{className:"text-xs text-[#555] mt-1 font-mono",children:["ID: ",c.slice(0,16),"..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),m.jsxDEV(x,{value:K1,onChange:b1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-5",children:[m.jsxDEV("button",{onClick:()=>{J1(!1),L1(""),b1("")},className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:b0,disabled:!c||!K1||V1,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:V1?"Adding...":"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"flex gap-2 mt-4",children:m.jsxDEV("button",{onClick:()=>J1(!1),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H0&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-lg mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:"Add Subscription"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:"Select an app and trigger, then route it to an agent."},void 0,!1,void 0,this),K0?m.jsxDEV("div",{className:"text-center py-8 text-[#666] text-sm",children:"Loading..."},void 0,!1,void 0,this):p.length===0?m.jsxDEV("div",{className:"text-center py-8 text-[#666] text-sm",children:"No triggers available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-4",children:[m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"App"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("button",{onClick:()=>{G1(!a1),H1(!1),p1("")},className:"w-full flex items-center gap-2 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm text-left hover:border-[#555] transition",children:[d?m.jsxDEV(m.Fragment,{children:[d.logo?m.jsxDEV("img",{src:d.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-5 h-5 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0",children:d.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"flex-1 truncate",children:d.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[10px] text-[#666]",children:[d.count," triggers"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("span",{className:"text-[#666] flex-1",children:"Select app..."},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#666] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a1&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>G1(!1)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#0a0a0a] border border-[#333] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[m.jsxDEV("div",{className:"p-2 border-b border-[#1a1a1a] flex-shrink-0",children:m.jsxDEV("input",{type:"text",value:M1,onChange:(N)=>p1(N.target.value),placeholder:"Search apps...",className:"w-full bg-[#111] border border-[#333] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"overflow-y-auto flex-1",children:t1.filter((N)=>{if(!M1)return!0;let v=M1.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)}).map((N)=>m.jsxDEV("button",{onClick:()=>{y1(N.slug),W1(""),z1({}),G1(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[#1a1a1a] ${s===N.slug?"bg-[#1a1a1a] text-[#f97316]":""}`,children:[N.logo?m.jsxDEV("img",{src:N.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-5 h-5 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0",children:N.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"flex-1 truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[10px] text-[#666]",children:N.count},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Trigger"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("button",{onClick:()=>{H1(!u1),G1(!1),x1("")},className:"w-full flex items-center gap-2 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm text-left hover:border-[#555] transition",children:[M?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("span",{className:"flex-1 truncate",children:M.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${M.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:M.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("span",{className:"text-[#666] flex-1",children:"Select trigger..."},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#666] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u1&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>H1(!1)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#0a0a0a] border border-[#333] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[e1.length>3&&m.jsxDEV("div",{className:"p-2 border-b border-[#1a1a1a] flex-shrink-0",children:m.jsxDEV("input",{type:"text",value:O1,onChange:(N)=>x1(N.target.value),placeholder:"Search triggers...",className:"w-full bg-[#111] border border-[#333] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"overflow-y-auto flex-1",children:e1.filter((N)=>{if(!O1)return!0;let v=O1.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)||N.description.toLowerCase().includes(v)}).map((N)=>m.jsxDEV("button",{onClick:()=>{W1(N.slug),z1({}),H1(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[#1a1a1a] ${t===N.slug?"bg-[#1a1a1a] text-[#f97316]":""}`,children:[m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-[10px] text-[#666] truncate",children:N.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${N.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:N.type},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),U1?m.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",U1.appName]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",M?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M&&M.config_schema&&Object.keys(M.config_schema.properties||{}).length>0&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"space-y-2",children:Object.entries(M.config_schema.properties||{}).map(([N,v])=>{let _=(M.config_schema.required||[]).includes(N);return m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-[11px] text-[#888] mb-1",children:[v.title||N,_&&m.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("input",{type:"text",value:B1[N]||"",onChange:(f)=>z1((K)=>({...K,[N]:f.target.value})),placeholder:v.description||`Enter ${v.title||N}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),h.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):m.jsxDEV(x,{value:e,onChange:h1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-5",children:[m.jsxDEV("button",{onClick:()=>q1(!1),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:O0,disabled:!t||!e||!U1||i1||M?.config_schema&&(M.config_schema.required||[]).some((N)=>!B1[N]?.trim()),className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:i1?"Creating...":"Subscribe"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var P=O(X1(),1);var z=O(n(),1);function f0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),J=H&&H!=="unassigned"?H:null,F=J?`?project_id=${J}`:"",[Q,V]=P.useState([]),[W,T]=P.useState("");P.useEffect(()=>{R(`/api/triggers/providers${F}`).then((G)=>G.json()).then((G)=>{let b=(G.providers||[]).filter((k)=>k.connected);if(V(b),b.length>0&&!b.find((k)=>k.id===W))T(b[0].id)}).catch(()=>{})},[R]);let[A,S]=P.useState(null),[l,Y]=P.useState([]),[y,I]=P.useState(!1),a=P.useCallback(async(G)=>{S(G),I(!0);try{let b=`/api/triggers/types?provider=${W}&toolkit_slugs=${G}`;if(J)b+=`&project_id=${J}`;let k=await R(b);if(k.ok){let o=await k.json();Y(o.types||[])}}catch(b){console.error("Failed to fetch trigger types:",b)}I(!1)},[R,J,W]);return z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Connect external apps via OAuth or API Key. Connected apps can be used for triggers and MCP integrations."},void 0,!1,void 0,this),Q.length>1&&z.jsxDEV("div",{className:"flex items-center gap-2 mb-4",children:[z.jsxDEV("span",{className:"text-xs text-[#666]",children:"Provider:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-1 bg-[#111] border border-[#1a1a1a] rounded-lg p-0.5",children:Q.map((G)=>z.jsxDEV("button",{onClick:()=>T(G.id),className:`px-3 py-1 rounded text-xs font-medium transition ${W===G.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:G.name},G.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV("p",{className:"text-[#666]",children:"No integration providers configured."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#555] mt-1",children:"Add API keys for Composio or AgentDojo in Settings."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV(_0,{providerId:W,projectId:J,hideMcpConfig:!0,onBrowseTriggers:a},void 0,!1,void 0,this),A&&z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:z.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h3",{className:"font-medium",children:"Trigger Types"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#666]",children:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>{S(null),Y([])},className:"text-[#666] hover:text-white transition text-lg px-2",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:y?z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading trigger types..."},void 0,!1,void 0,this):l.length===0?z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"No trigger types available for this app."},void 0,!1,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:l.map((G)=>z.jsxDEV("div",{className:"bg-[#0a0a0a] border border-[#1a1a1a] rounded-lg p-3",children:z.jsxDEV("div",{className:"flex items-start gap-3",children:[G.logo?z.jsxDEV("img",{src:G.logo,alt:G.toolkit_name,className:"w-6 h-6 rounded object-contain flex-shrink-0 mt-0.5"},void 0,!1,void 0,this):z.jsxDEV("div",{className:"w-6 h-6 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0 mt-0.5",children:G.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"text-sm font-medium",children:G.name},void 0,!1,void 0,this),z.jsxDEV("div",{className:"text-xs text-[#666] mt-0.5",children:G.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-1.5",children:[z.jsxDEV("span",{className:"text-[10px] bg-[#1a1a1a] text-[#555] px-1.5 py-0.5 rounded font-mono",children:G.slug},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${G.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:G.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},G.slug,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var w=O(n(),1);function JN(){let[R,H]=$0.useState("overview");return w.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:w.jsxDEV("div",{className:"max-w-6xl",children:[w.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:w.jsxDEV("div",{children:[w.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Connections"},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-[#666]",children:"Manage external app connections, triggers, and webhooks."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-1 w-fit",children:[{id:"overview",label:"Overview"},{id:"triggers",label:"Triggers"},{id:"integrations",label:"Integrations"}].map((F)=>w.jsxDEV("button",{onClick:()=>H(F.id),className:`px-4 py-2 rounded text-sm font-medium transition ${R===F.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:F.label},F.id,!1,void 0,this))},void 0,!1,void 0,this),R==="overview"&&w.jsxDEV(m0,{},void 0,!1,void 0,this),R==="triggers"&&w.jsxDEV(v0,{},void 0,!1,void 0,this),R==="integrations"&&w.jsxDEV(f0,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
+
export{I0 as a,JN as b};
|
|
3
|
+
|
|
4
|
+
//# debugId=B89E2F0AA55E409E64756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{j as r}from"./App.myxqcj9x.js";import{t as Oz}from"./App.7fb3e7mp.js";import{O as Jz,P as o}from"./App.mc7xf85h.js";import{V as t}from"./App.7sy3wq8c.js";import{$ as Qz,X as a,aa as zz,ja as c,ma as Gz}from"./App.3qw8nben.js";var J=a(Qz(),1);var z=a(zz(),1);function Mz(){let{authFetch:G}=c(),{projects:$,currentProjectId:H}=Gz(),[K,w]=J.useState([]),[X,B]=J.useState(!0),[q,F]=J.useState(!1),[U,T]=J.useState(null),[M,L]=J.useState(null),[Q,k]=J.useState("servers"),{confirm:y,ConfirmDialog:f}=Jz(),Y=$.length>0,A=async()=>{try{let b=await(await G("/api/mcp/servers")).json();w(b.servers||[])}catch(W){console.error("Failed to fetch MCP servers:",W)}B(!1)};J.useEffect(()=>{A()},[G]);let Z=K.filter((W)=>{if(!H)return!0;if(H==="unassigned")return W.project_id===null;return W.project_id===null||W.project_id===H}),S=async(W)=>{try{await G(`/api/mcp/servers/${W}/start`,{method:"POST"}),A()}catch(b){console.error("Failed to start server:",b)}},I=async(W)=>{try{await G(`/api/mcp/servers/${W}/stop`,{method:"POST"}),A()}catch(b){console.error("Failed to stop server:",b)}},p=async(W)=>{if(!await y("Delete this MCP server?",{confirmText:"Delete",title:"Delete Server"}))return;try{if(await G(`/api/mcp/servers/${W}`,{method:"DELETE"}),M?.id===W)L(null);A()}catch(C){console.error("Failed to delete server:",C)}},u=async(W,b)=>{try{await G(`/api/mcp/servers/${W}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b})}),A()}catch(C){console.error("Failed to rename server:",C)}},i=async(W,b)=>{try{await G(`/api/mcp/servers/${W}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),A()}catch(C){throw console.error("Failed to update server:",C),C}};return z.jsxDEV(z.Fragment,{children:[f,z.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[z.jsxDEV("div",{className:"max-w-6xl",children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[z.jsxDEV("div",{children:[z.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"MCP Servers"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[#666]",children:"Manage Model Context Protocol servers for tool integrations."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q==="servers"&&z.jsxDEV("button",{onClick:()=>F(!0),className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"+ Add Server"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-1 w-fit",children:[z.jsxDEV("button",{onClick:()=>k("servers"),className:`px-4 py-2 rounded text-sm font-medium transition ${Q==="servers"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"My Servers"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>k("hosted"),className:`px-4 py-2 rounded text-sm font-medium transition ${Q==="hosted"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Hosted Services"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>k("registry"),className:`px-4 py-2 rounded text-sm font-medium transition ${Q==="registry"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Browse Registry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q==="servers"&&z.jsxDEV(z.Fragment,{children:[X&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading..."},void 0,!1,void 0,this),!X&&Z.length===0&&K.length===0&&z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV(Oz,{className:"w-12 h-12 text-[#333] mx-auto mb-4"},void 0,!1,void 0,this),z.jsxDEV("h3",{className:"text-lg font-medium mb-2",children:"No MCP servers configured"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[#666] mb-6 max-w-md mx-auto",children:"MCP servers extend your agents with tools like file access, web browsing, database connections, and more."},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-3 justify-center",children:[z.jsxDEV("button",{onClick:()=>F(!0),className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"Add Manually"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>k("registry"),className:"border border-[#333] hover:border-[#666] px-4 py-2 rounded font-medium transition",children:"Browse Registry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!X&&Z.length===0&&K.length>0&&z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center",children:z.jsxDEV("p",{className:"text-[#666]",children:"No servers match this filter."},void 0,!1,void 0,this)},void 0,!1,void 0,this),!X&&Z.length>0&&z.jsxDEV("div",{className:"flex gap-6",children:[z.jsxDEV("div",{className:`space-y-3 ${M?"w-1/2":"w-full"}`,children:Z.map((W)=>{let C=W.type==="http"&&W.url||W.status==="running",h=Y&&W.project_id?$.find((v)=>v.id===W.project_id):null;return z.jsxDEV(Wz,{server:W,project:h,selected:M?.id===W.id,onSelect:()=>L(C?W:null),onStart:()=>S(W.id),onStop:()=>I(W.id),onDelete:()=>p(W.id),onEdit:async()=>{try{let D=await(await G(`/api/mcp/servers/${W.id}`)).json();T(D.server||W)}catch{T(W)}}},W.id,!1,void 0,this)})},void 0,!1,void 0,this),M&&z.jsxDEV("div",{className:"w-1/2",children:z.jsxDEV(Xz,{server:M,onClose:()=>L(null)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Q==="hosted"&&z.jsxDEV(_z,{onServerAdded:A,projectId:H},void 0,!1,void 0,this),Q==="registry"&&z.jsxDEV(Zz,{onInstall:(W)=>{A(),k("servers")}},void 0,!1,void 0,this),Q==="servers"&&z.jsxDEV("div",{className:"mt-8 p-4 bg-[#111] border border-[#1a1a1a] rounded-lg",children:[z.jsxDEV("h3",{className:"font-medium mb-2",children:"Quick Start"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mb-3",children:"Add an MCP server by providing its npm package name. For example:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[{name:"filesystem",pkg:"@modelcontextprotocol/server-filesystem"},{name:"fetch",pkg:"@modelcontextprotocol/server-fetch"},{name:"memory",pkg:"@modelcontextprotocol/server-memory"}].map((W)=>z.jsxDEV("code",{className:"text-xs bg-[#0a0a0a] px-2 py-1 rounded",children:W.pkg},W.name,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q&&z.jsxDEV(Bz,{onClose:()=>F(!1),onAdded:()=>{F(!1),A()},projects:Y?$:void 0,defaultProjectId:H&&H!=="unassigned"?H:null},void 0,!1,void 0,this),U&&z.jsxDEV(Uz,{server:U,projects:Y?$:void 0,onClose:()=>T(null),onSaved:()=>{T(null),A()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Wz({server:G,project:$,selected:H,onSelect:K,onStart:w,onStop:X,onDelete:B,onEdit:q}){let F=G.type==="http"&&G.url,U=F||G.status==="running",T=()=>{if(F)return`${G.source||"remote"} • http`;return`${G.type} • ${G.package||G.command||"custom"}${G.status==="running"&&G.port?` • :${G.port}`:""}`},M=()=>{if($)return z.jsxDEV("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:`${$.color}20`,color:$.color},children:$.name},void 0,!1,void 0,this);if(G.project_id===null)return z.jsxDEV("span",{className:"text-xs text-[#666] bg-[#1a1a1a] px-1.5 py-0.5 rounded",children:"Global"},void 0,!1,void 0,this);return null};return z.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 cursor-pointer transition ${H?"border-[#f97316]":"border-[#1a1a1a] hover:border-[#333]"}`,onClick:U?K:void 0,children:z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex items-center gap-3",children:[z.jsxDEV("div",{className:`w-2 h-2 rounded-full ${U?"bg-green-400":"bg-[#444]"}`},void 0,!1,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("h3",{className:"font-medium",children:G.name},void 0,!1,void 0,this),M()]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666]",children:T()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),q()},className:"text-sm text-[#666] hover:text-[#888] px-3 py-1 transition",title:"Edit server settings",children:"Edit"},void 0,!1,void 0,this),F?z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),B()},className:"text-sm text-[#666] hover:text-red-400 px-3 py-1 transition",children:"Remove"},void 0,!1,void 0,this):G.status==="running"?z.jsxDEV(z.Fragment,{children:[z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),K()},className:"text-sm text-[#f97316] hover:text-[#fb923c] px-3 py-1 transition",children:"Tools"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),X()},className:"text-sm text-[#666] hover:text-red-400 px-3 py-1 transition",children:"Stop"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),B()},className:"text-sm text-[#666] hover:text-red-400 px-3 py-1 transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV(z.Fragment,{children:[z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),w()},className:"text-sm text-[#666] hover:text-green-400 px-3 py-1 transition",children:"Start"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),B()},className:"text-sm text-[#666] hover:text-red-400 px-3 py-1 transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Xz({server:G,onClose:$}){let{authFetch:H}=c(),[K,w]=J.useState([]),[X,B]=J.useState(null),[q,F]=J.useState(!0),[U,T]=J.useState(null),[M,L]=J.useState(null);return J.useEffect(()=>{(async()=>{F(!0),T(null);try{let k=await H(`/api/mcp/servers/${G.id}/tools`),y=await k.json();if(!k.ok){T(y.error||"Failed to fetch tools");return}w(y.tools||[]),B(y.serverInfo||null)}catch(k){T(`Failed to fetch tools: ${k}`)}finally{F(!1)}})()},[G.id,H]),z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg overflow-hidden",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h3",{className:"font-medium",children:[G.name," Tools"]},void 0,!0,void 0,this),X&&z.jsxDEV("p",{className:"text-xs text-[#666]",children:[X.name," v",X.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:$,className:"text-[#666] hover:text-[#888] text-xl leading-none",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 max-h-[500px] overflow-auto",children:[q&&z.jsxDEV("p",{className:"text-[#666]",children:"Loading tools..."},void 0,!1,void 0,this),U&&z.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 rounded",children:U},void 0,!1,void 0,this),!q&&!U&&K.length===0&&z.jsxDEV("p",{className:"text-[#666]",children:"No tools available from this server."},void 0,!1,void 0,this),!q&&!U&&K.length>0&&!M&&z.jsxDEV("div",{className:"space-y-2",children:K.map((Q)=>z.jsxDEV("button",{onClick:()=>L(Q),className:"w-full text-left p-3 bg-[#0a0a0a] hover:bg-[#1a1a1a] border border-[#222] hover:border-[#333] rounded transition",children:[z.jsxDEV("div",{className:"font-medium text-sm",children:Q.name},void 0,!1,void 0,this),Q.description&&z.jsxDEV("div",{className:"text-xs text-[#666] mt-1",children:Q.description},void 0,!1,void 0,this)]},Q.name,!0,void 0,this))},void 0,!1,void 0,this),M&&z.jsxDEV(Yz,{serverId:G.id,tool:M,onBack:()=>L(null)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Yz({serverId:G,tool:$,onBack:H}){let{authFetch:K}=c(),[w,X]=J.useState("{}"),[B,q]=J.useState(null),[F,U]=J.useState(null),[T,M]=J.useState(!1);J.useEffect(()=>{let Q=$.inputSchema;if(Q&&typeof Q==="object"&&"properties"in Q){let k=Q.properties,y={};for(let[f,Y]of Object.entries(k))if(Y.default!==void 0)y[f]=Y.default;else if(Y.type==="string")y[f]="";else if(Y.type==="number"||Y.type==="integer")y[f]=0;else if(Y.type==="boolean")y[f]=!1;else if(Y.type==="array")y[f]=[];else if(Y.type==="object")y[f]={};X(JSON.stringify(y,null,2))}},[$]);let L=async()=>{M(!0),U(null),q(null);try{let Q=JSON.parse(w),k=await K(`/api/mcp/servers/${G}/tools/${encodeURIComponent($.name)}/call`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({arguments:Q})}),y=await k.json();if(!k.ok){U(y.error||"Failed to call tool");return}q(y.result)}catch(Q){U(`Error: ${Q}`)}finally{M(!1)}};return z.jsxDEV("div",{className:"space-y-4",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("button",{onClick:H,className:"text-[#666] hover:text-[#888] text-sm",children:"← Back"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-[#444]",children:"/"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"font-medium",children:$.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.description&&z.jsxDEV("p",{className:"text-sm text-[#666]",children:$.description},void 0,!1,void 0,this),$.inputSchema&&z.jsxDEV("div",{className:"text-xs",children:z.jsxDEV("details",{className:"cursor-pointer",children:[z.jsxDEV("summary",{className:"text-[#666] hover:text-[#888]",children:"Input Schema"},void 0,!1,void 0,this),z.jsxDEV("pre",{className:"mt-2 p-2 bg-[#0a0a0a] rounded text-[#888] overflow-auto max-h-32",children:JSON.stringify($.inputSchema,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Arguments (JSON)"},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:w,onChange:(Q)=>X(Q.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 h-32 font-mono text-sm focus:outline-none focus:border-[#f97316] resize-none",placeholder:"{}"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:L,disabled:T,className:"w-full bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:T?"Calling...":"Call Tool"},void 0,!1,void 0,this),F&&z.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 rounded",children:F},void 0,!1,void 0,this),B&&z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV("div",{className:"text-sm text-[#666]",children:["Result ",B.isError&&z.jsxDEV("span",{className:"text-red-400",children:"(error)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:`p-3 rounded text-sm ${B.isError?"bg-red-500/10":"bg-green-500/10"}`,children:B.content.map((Q,k)=>z.jsxDEV("div",{className:"mb-2 last:mb-0",children:[Q.type==="text"&&z.jsxDEV("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:Q.text},void 0,!1,void 0,this),Q.type==="image"&&Q.data&&z.jsxDEV("img",{src:`data:${Q.mimeType||"image/png"};base64,${Q.data}`,alt:"Tool result",className:"max-w-full rounded"},void 0,!1,void 0,this)]},k,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Zz({onInstall:G}){let{authFetch:$}=c(),[H,K]=J.useState(""),[w,X]=J.useState([]),[B,q]=J.useState(!1),[F,U]=J.useState(!1),[T,M]=J.useState(null),[L,Q]=J.useState(null),k=async(Y)=>{q(!0),Q(null);try{let A=await $(`/api/mcp/registry?search=${encodeURIComponent(Y)}&limit=20`),Z=await A.json();if(!A.ok)Q(Z.error||"Failed to search registry"),X([]);else X(Z.servers||[])}catch(A){Q(`Failed to search: ${A}`),X([])}finally{q(!1),U(!0)}},y=(Y)=>{if(Y.preventDefault(),H.trim())k(H.trim())};J.useEffect(()=>{k("")},[]);let f=async(Y)=>{if(!Y.npmPackage){Q("This server does not have an npm package");return}M(Y.id),Q(null);try{let A=await $("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Y.name,type:"npm",package:Y.npmPackage})});if(!A.ok){let Z=await A.json();Q(Z.error||"Failed to add server");return}G(Y)}catch(A){Q(`Failed to add server: ${A}`)}finally{M(null)}};return z.jsxDEV("div",{className:"space-y-6",children:[z.jsxDEV("form",{onSubmit:y,className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:H,onChange:(Y)=>K(Y.target.value),placeholder:"Search MCP servers (e.g., filesystem, github, slack...)",className:"flex-1 bg-[#111] border border-[#333] rounded-lg px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{type:"submit",disabled:B,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-6 py-3 rounded-lg font-medium transition",children:B?"...":"Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L&&z.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:L},void 0,!1,void 0,this),!B&&F&&w.length===0&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"No servers found. Try a different search term."},void 0,!1,void 0,this),w.length>0&&z.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2",children:w.map((Y)=>z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 hover:border-[#333] transition",children:z.jsxDEV("div",{className:"flex items-start justify-between gap-3",children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("h3",{className:"font-medium truncate",children:Y.name},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mt-1 line-clamp-2",children:Y.description||"No description"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-2 text-xs text-[#555]",children:[Y.version&&z.jsxDEV("span",{children:["v",Y.version]},void 0,!0,void 0,this),z.jsxDEV("span",{className:`px-1.5 py-0.5 rounded ${Y.npmPackage?"bg-green-500/10 text-green-400":"bg-blue-500/10 text-blue-400"}`,children:Y.npmPackage?"npm":"remote"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("code",{className:"text-xs text-[#555] bg-[#0a0a0a] px-2 py-0.5 rounded mt-2 inline-block truncate max-w-full",children:Y.npmPackage||Y.fullName},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-shrink-0",children:Y.npmPackage?z.jsxDEV("button",{onClick:()=>f(Y),disabled:T===Y.id,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition disabled:opacity-50",children:T===Y.id?"Adding...":"Add"},void 0,!1,void 0,this):Y.repository?z.jsxDEV("a",{href:Y.repository,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#666] hover:text-[#f97316] transition",children:"View →"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Y.id,!1,void 0,this))},void 0,!1,void 0,this),B&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Searching registry..."},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-4 bg-[#111] border border-[#1a1a1a] rounded-lg text-sm text-[#666]",children:z.jsxDEV("p",{children:["Servers are sourced from the"," ",z.jsxDEV("a",{href:"https://github.com/modelcontextprotocol/servers",target:"_blank",rel:"noopener noreferrer",className:"text-[#f97316] hover:underline",children:"official MCP registry"},void 0,!1,void 0,this),". Not all servers have npm packages - some require manual setup."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _z({onServerAdded:G,projectId:$}){let{authFetch:H}=c(),[K,w]=J.useState("composio"),[X,B]=J.useState("configs"),[q,F]=J.useState(!1),[U,T]=J.useState(!1),[M,L]=J.useState(!1),[Q,k]=J.useState([]),[y,f]=J.useState(new Set),[Y,A]=J.useState(!0),[Z,S]=J.useState(!1),[I,p]=J.useState(null),{alert:u,AlertDialog:i}=o(),W=async()=>{try{let P=$&&$!=="unassigned"?`/api/mcp/servers?project=${encodeURIComponent($)}`:"/api/mcp/servers",[x,_]=await Promise.all([H("/api/providers"),H(P)]),R=await x.json(),g=await _.json(),V=R.providers||[],O=g.servers||[],N=new Set(O.filter((E)=>E.source==="composio"&&E.url).map((E)=>{let e=E.url.match(/\/v3\/mcp\/([^/]+)/);return e?e[1]:null}).filter(Boolean));f(N);let m=V.find((E)=>E.id==="composio"),l=V.find((E)=>E.id==="smithery"),n=V.find((E)=>E.id==="agentdojo"),d=m?.hasKey||!1,j=l?.hasKey||!1,s=n?.hasKey||!1;if(F(d),T(j),L(s),d)w("composio"),b();else if(j)w("smithery");else if(s)w("agentdojo")}catch(P){console.error("Failed to fetch providers:",P)}A(!1)},b=async()=>{S(!0);try{let P=$&&$!=="unassigned"?`?project_id=${$}`:"",_=await(await H(`/api/integrations/composio/configs${P}`)).json();k(_.configs||[])}catch(P){console.error("Failed to fetch Composio configs:",P)}S(!1)},C=async(P)=>{p(P);try{let x=$&&$!=="unassigned"?`?project_id=${$}`:"",_=await H(`/api/integrations/composio/configs/${P}/add${x}`,{method:"POST"});if(_.ok)f((R)=>new Set([...R,P])),G?.();else{let R=await _.json();await u(R.error||"Failed to add config",{title:"Error",variant:"error"})}}catch(x){console.error("Failed to add config:",x)}p(null)},h=(P)=>{return y.has(P)};if(J.useEffect(()=>{W()},[H,$]),Y)return z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading..."},void 0,!1,void 0,this);let v=q||U||M,D=[q,U,M].filter(Boolean).length;if(!v)return z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV("p",{className:"text-[#888] mb-2",children:"No hosted MCP services connected"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Connect Composio, Smithery, or AgentDojo in Settings to access cloud-based MCP servers."},void 0,!1,void 0,this),z.jsxDEV("a",{href:"/settings",className:"inline-block bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-4 py-2 rounded text-sm font-medium transition",children:"Go to Settings →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return z.jsxDEV(z.Fragment,{children:[i,z.jsxDEV("div",{className:"space-y-6",children:[D>1&&z.jsxDEV("div",{className:"flex gap-1 bg-[#0a0a0a] border border-[#222] rounded-lg p-1 w-fit",children:[q&&z.jsxDEV("button",{onClick:()=>{w("composio"),B("configs")},className:`px-4 py-2 rounded text-sm font-medium transition flex items-center gap-2 ${K==="composio"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-purple-500"},void 0,!1,void 0,this),"Composio"]},void 0,!0,void 0,this),U&&z.jsxDEV("button",{onClick:()=>w("smithery"),className:`px-4 py-2 rounded text-sm font-medium transition flex items-center gap-2 ${K==="smithery"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-blue-500"},void 0,!1,void 0,this),"Smithery"]},void 0,!0,void 0,this),M&&z.jsxDEV("button",{onClick:()=>w("agentdojo"),className:`px-4 py-2 rounded text-sm font-medium transition flex items-center gap-2 ${K==="agentdojo"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-green-500"},void 0,!1,void 0,this),"AgentDojo"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q&&(D===1||K==="composio")&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex gap-1 bg-[#0a0a0a] border border-[#222] rounded-lg p-1",children:[z.jsxDEV("button",{onClick:()=>B("configs"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="configs"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"MCP Configs"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>B("connect"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="connect"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Connect Apps"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),D===1&&z.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-[#666]",children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-purple-500"},void 0,!1,void 0,this),"Composio",z.jsxDEV("span",{className:"text-green-400",children:"Connected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X==="connect"&&z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Connect your accounts to enable tools in MCP configs"},void 0,!1,void 0,this),z.jsxDEV(r,{providerId:"composio",projectId:$,onConnectionComplete:()=>{b()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="configs"&&z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"Your MCP configs from Composio"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-3",children:[z.jsxDEV("button",{onClick:b,disabled:Z,className:"text-xs text-[#666] hover:text-[#888] transition",children:Z?"Loading...":"Refresh"},void 0,!1,void 0,this),z.jsxDEV("a",{href:"https://app.composio.dev/mcp_configs",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#666] hover:text-[#f97316] transition",children:"Create Config →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z?z.jsxDEV("div",{className:"text-center py-6 text-[#666]",children:"Loading configs..."},void 0,!1,void 0,this):Q.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 text-center",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"No MCP configs found"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:["First ",z.jsxDEV("button",{onClick:()=>B("connect"),className:"text-[#f97316] hover:text-[#fb923c]",children:"connect some apps"},void 0,!1,void 0,this),", then create a config."]},void 0,!0,void 0,this),z.jsxDEV("a",{href:"https://app.composio.dev/mcp_configs",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#f97316] hover:text-[#fb923c] mt-2 inline-block",children:"Create in Composio →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:Q.map((P)=>{let x=h(P.id),_=I===P.id;return z.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-3 transition flex items-center justify-between ${x?"border-green-500/30":"border-[#1a1a1a] hover:border-[#333]"}`,children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("span",{className:"font-medium text-sm",children:P.name},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-xs text-[#555]",children:[P.toolsCount," tools"]},void 0,!0,void 0,this),x&&z.jsxDEV("span",{className:"text-xs text-green-400",children:"Added"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.toolkits.length>0&&z.jsxDEV("div",{className:"flex flex-wrap gap-1 mt-1",children:[P.toolkits.slice(0,4).map((R)=>z.jsxDEV("span",{className:"text-xs bg-[#1a1a1a] text-[#666] px-1.5 py-0.5 rounded",children:R},R,!1,void 0,this)),P.toolkits.length>4&&z.jsxDEV("span",{className:"text-xs text-[#555]",children:["+",P.toolkits.length-4]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 ml-3",children:[x?z.jsxDEV("span",{className:"text-xs text-[#555] px-2 py-1",children:"In Servers"},void 0,!1,void 0,this):z.jsxDEV("button",{onClick:()=>C(P.id),disabled:_,className:"text-xs bg-[#f97316] hover:bg-[#fb923c] text-black px-3 py-1 rounded font-medium transition disabled:opacity-50",children:_?"Adding...":"Add"},void 0,!1,void 0,this),z.jsxDEV("a",{href:`https://app.composio.dev/mcp_configs/${P.id}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#666] hover:text-[#888] transition",children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},P.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),U&&(D===1||K==="smithery")&&z.jsxDEV("div",{children:[D===1&&z.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-[#666] mb-4",children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-blue-500"},void 0,!1,void 0,this),"Smithery",z.jsxDEV("span",{className:"text-green-400",children:"Connected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"Add MCP servers from the Smithery registry"},void 0,!1,void 0,this),z.jsxDEV("a",{href:"https://smithery.ai/servers",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#666] hover:text-[#f97316] transition",children:"Browse Smithery →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 text-center",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:["Smithery servers can be added from the ",z.jsxDEV("strong",{children:"Browse Registry"},void 0,!1,void 0,this)," tab."]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Your API key will be used automatically when adding Smithery servers."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M&&(D===1||K==="agentdojo")&&z.jsxDEV($z,{projectId:$,onServerAdded:G,showProviderBadge:D===1},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-3 bg-[#0a0a0a] border border-[#222] rounded text-xs text-[#666]",children:[z.jsxDEV("strong",{className:"text-[#888]",children:"Tip:"},void 0,!1,void 0,this)," Connect apps first, then add MCP configs to make tools available to your agents."," · ",z.jsxDEV("a",{href:"/settings",className:"text-[#f97316] hover:text-[#fb923c]",children:"Add more providers in Settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $z({projectId:G,onServerAdded:$,showProviderBadge:H}){let{authFetch:K}=c(),[w,X]=J.useState("configs"),[B,q]=J.useState([]),[F,U]=J.useState(new Set),[T,M]=J.useState(!1),[L,Q]=J.useState(null),{alert:k,AlertDialog:y}=o(),f=async()=>{M(!0);try{let Z=G&&G!=="unassigned"?`?project_id=${G}`:"",S=G&&G!=="unassigned"?`/api/mcp/servers?project=${encodeURIComponent(G)}`:"/api/mcp/servers";console.log(`[AgentDojo:fetchConfigs] projectId=${G} serversUrl=${S}`);let[I,p]=await Promise.all([K(`/api/integrations/agentdojo/configs${Z}`),K(S)]),u=await I.json(),i=await p.json();console.log(`[AgentDojo:fetchConfigs] configs=${(u.configs||[]).length} servers=${(i.servers||[]).length}`),q(u.configs||[]);let W=(i.servers||[]).filter((C)=>C.source==="agentdojo");console.log(`[AgentDojo:fetchConfigs] agentdojo servers found: ${W.length}`);for(let C of W){let h=C.url?.match(/\/mcp\/([^/?]+)/);console.log(`[AgentDojo:fetchConfigs] server: id=${C.id} name=${C.name} project_id=${C.project_id} url=${C.url?.substring(0,80)} extracted=${h?h[1]:C.name}`)}let b=new Set(W.map((C)=>{let h=C.url?.match(/\/mcp\/([^/?]+)/);return h?h[1]:C.name}));console.log("[AgentDojo:fetchConfigs] addedServers set:",[...b]),U(b)}catch(Z){console.error("Failed to fetch AgentDojo configs:",Z)}M(!1)},Y=async(Z)=>{Q(Z);try{let S=G&&G!=="unassigned"?`?project_id=${G}`:"";console.log(`[AgentDojo:addConfig] configId=${Z} projectParam=${S}`);let I=await K(`/api/integrations/agentdojo/configs/${Z}/add${S}`,{method:"POST"}),p=await I.json();if(console.log(`[AgentDojo:addConfig] response status=${I.status} ok=${I.ok} message=${p.message} server.id=${p.server?.id} server.project_id=${p.server?.project_id}`),I.ok){let u=B.find((W)=>W.id===Z),i=u?.slug||Z;console.log(`[AgentDojo:addConfig] marking as added: key=${i} config.slug=${u?.slug} config.id=${u?.id} config.name=${u?.name}`),U((W)=>new Set([...W,i])),$?.()}else await k(p.error||"Failed to add config",{title:"Error",variant:"error"})}catch(S){console.error("Failed to add config:",S)}Q(null)},A=(Z)=>{return F.has(Z.slug)||F.has(Z.id)||F.has(Z.name)};return J.useEffect(()=>{f()},[K,G]),z.jsxDEV(z.Fragment,{children:[y,z.jsxDEV("div",{children:[H&&z.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-[#666] mb-4",children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-green-500"},void 0,!1,void 0,this),"AgentDojo",z.jsxDEV("span",{className:"text-green-400",children:"Connected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:z.jsxDEV("div",{className:"flex gap-1 bg-[#0a0a0a] border border-[#222] rounded-lg p-1",children:[z.jsxDEV("button",{onClick:()=>X("configs"),className:`px-4 py-2 rounded text-sm font-medium transition ${w==="configs"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"MCP Servers"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>X("toolkits"),className:`px-4 py-2 rounded text-sm font-medium transition ${w==="toolkits"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Browse Toolkits"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w==="configs"&&z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"Your MCP servers from AgentDojo"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:f,disabled:T,className:"text-xs text-[#666] hover:text-[#888] transition",children:T?"Loading...":"Refresh"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T?z.jsxDEV("div",{className:"text-center py-6 text-[#666]",children:"Loading servers..."},void 0,!1,void 0,this):B.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 text-center",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"No MCP servers found"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:[z.jsxDEV("button",{onClick:()=>X("toolkits"),className:"text-[#f97316] hover:text-[#fb923c]",children:"Browse toolkits"},void 0,!1,void 0,this)," ","to create a new MCP server."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:B.map((Z)=>{let S=A(Z),I=L===Z.id;return z.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-3 transition flex items-center justify-between ${S?"border-green-500/30":"border-[#1a1a1a] hover:border-[#333]"}`,children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("span",{className:"font-medium text-sm",children:Z.name},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-xs text-[#555]",children:[Z.toolsCount," tools"]},void 0,!0,void 0,this),S&&z.jsxDEV("span",{className:"text-xs text-green-400",children:"Added"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z.mcpUrl&&z.jsxDEV("code",{className:"text-xs text-[#555] mt-1 block truncate",children:Z.mcpUrl},void 0,!1,void 0,this),!Z.mcpUrl&&Z.slug&&z.jsxDEV("code",{className:"text-xs text-[#555] mt-1 block truncate",children:Z.slug},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 ml-3",children:S?z.jsxDEV("span",{className:"text-xs text-[#555] px-2 py-1",children:"In Servers"},void 0,!1,void 0,this):z.jsxDEV("button",{onClick:()=>Y(Z.id),disabled:I,className:"text-xs bg-[#f97316] hover:bg-[#fb923c] text-black px-3 py-1 rounded font-medium transition disabled:opacity-50",children:I?"Adding...":"Add"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},Z.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w==="toolkits"&&z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Browse available toolkits and create MCP servers"},void 0,!1,void 0,this),z.jsxDEV(r,{providerId:"agentdojo",projectId:G,onConnectionComplete:()=>{f()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function qz(G){let $=[],H=G,K=null,w=G.match(/(?:npx\s+-y\s+)?(@?[\w-]+\/)?(@?[\w-]+)(?:@[\w.-]+)?/);if(w){let q=w[2]||w[1];if(q)K=q.replace(/^@/,"").replace(/-mcp$/,"").replace(/-server$/,"").replace(/^server-/,"").replace(/^mcp-/,"")}let X=/--(\w+[-\w]*)\s+(YOUR_\w+|<[\w_]+>|\{[\w_]+\}|\$[\w_]+|[\w_]*(?:TOKEN|KEY|SECRET|PASSWORD|USER|ID|APIKEY)[\w_]*)/gi,B;while((B=X.exec(G))!==null){let q=B[1],F=B[2],U=q.toUpperCase().replace(/-/g,"_"),T=K?`${K.toUpperCase().replace(/-/g,"_")}_${U}`:U;$.push({key:T,flag:q}),H=H.replace(new RegExp(`(--${q}\\s+)${F.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"i"),`--${q} $${T}`)}return{cleanCommand:H,credentials:$,serverName:K}}function Bz({onClose:G,onAdded:$,projects:H,defaultProjectId:K}){let{authFetch:w}=c(),[X,B]=J.useState("npm"),[q,F]=J.useState(""),[U,T]=J.useState(""),[M,L]=J.useState(""),[Q,k]=J.useState(""),[y,f]=J.useState(""),[Y,A]=J.useState(""),[Z,S]=J.useState(""),[I,p]=J.useState([]),[u,i]=J.useState(K||null),[W,b]=J.useState(!1),[C,h]=J.useState(null),v=H&&H.length>0,D=()=>{p([...I,{key:"",value:""}])},P=(O,N,m)=>{let l=[...I];l[O][N]=m,p(l)},x=(O)=>{p(I.filter((N,m)=>m!==O))},_=(O)=>{if(k(O),O.includes("YOUR_")||O.includes("<")||O.includes("{")||/TOKEN|KEY|SECRET|PASSWORD/i.test(O)){let{cleanCommand:N,credentials:m,serverName:l}=qz(O);if(!q&&l)F(l);if(m.length>0){let n=new Set(I.map((j)=>j.key)),d=m.filter((j)=>!n.has(j.key)).map((j)=>({key:j.key,value:""}));if(d.length>0)p([...I,...d]),k(N)}}},R=(O)=>{if(O.startsWith("npx ")||O.includes(" --")||O.includes("YOUR_")||O.includes("<")||/\s+(TOKEN|KEY|SECRET|PASSWORD)/i.test(O))B("command"),_(O);else if(T(O),!q&&O){let m=O.replace(/^@[\w-]+\//,"").replace(/@[\w.-]+$/,"").replace(/^server-/,"").replace(/-server$/,"").replace(/^mcp-/,"").replace(/-mcp$/,"");if(m&&m!==O)F(m)}},g=async()=>{if(!q){h("Name is required");return}if(X==="npm"&&!U){h("npm package is required");return}if(X==="pip"&&!U){h("pip package is required");return}if(X==="command"&&!Q){h("Command is required");return}if(X==="http"&&!y){h("URL is required");return}b(!0),h(null);let O={};for(let{key:N,value:m}of I)if(N.trim())O[N.trim()]=m;try{let N={name:q};if(X==="npm")N.type="npm",N.package=U;else if(X==="pip"){if(N.type="pip",N.package=U,M)N.pip_module=M}else if(X==="http"){N.type="http",N.url=y;let l={"Content-Type":"application/json"};if(Y&&Z){let n=btoa(`${Y}:${Z}`);l.Authorization=`Basic ${n}`}N.headers=l}else{let l=Q.trim().split(/\s+/);N.type="custom",N.command=l[0],N.args=l.slice(1).join(" ")}if(Object.keys(O).length>0)N.env=O;if(u)N.project_id=u;let m=await w("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)});if(!m.ok){let l=await m.json();h(l.error||"Failed to add server"),b(!1);return}$()}catch(N){h("Failed to add server"),b(!1)}},V=(O,N)=>{B("npm"),F(O),T(N)};return z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-[2px] z-50 flex items-center justify-center p-4",children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between sticky top-0 bg-[#111]",children:[z.jsxDEV("h2",{className:"text-lg font-semibold",children:"Add MCP Server"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:G,className:"text-[#666] hover:text-[#888]",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 space-y-4",children:[z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-2",children:"Quick add:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[{name:"filesystem",pkg:"@modelcontextprotocol/server-filesystem",type:"npm"},{name:"fetch",pkg:"@modelcontextprotocol/server-fetch",type:"npm"},{name:"memory",pkg:"@modelcontextprotocol/server-memory",type:"npm"},{name:"github",pkg:"@modelcontextprotocol/server-github",type:"npm"},{name:"time",pkg:"mcp-server-time",module:"mcp_server_time",type:"pip"}].map((O)=>z.jsxDEV("button",{onClick:()=>{if(B(O.type),F(O.name),T(O.pkg),O.type==="pip"&&"module"in O)L(O.module||"");else L("")},className:"text-sm bg-[#1a1a1a] hover:bg-[#222] px-3 py-1 rounded transition",children:O.name},O.name,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex gap-1 bg-[#0a0a0a] border border-[#222] rounded p-1",children:[z.jsxDEV("button",{onClick:()=>B("npm"),className:`flex-1 px-2 py-1.5 rounded text-sm transition ${X==="npm"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"npm"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>B("pip"),className:`flex-1 px-2 py-1.5 rounded text-sm transition ${X==="pip"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"pip"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>B("command"),className:`flex-1 px-2 py-1.5 rounded text-sm transition ${X==="command"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Command"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>B("http"),className:`flex-1 px-2 py-1.5 rounded text-sm transition ${X==="http"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"HTTP"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:q,onChange:(O)=>F(O.target.value),placeholder:"e.g., pushover",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Scope"},void 0,!1,void 0,this),z.jsxDEV(t,{value:u||"",onChange:(O)=>i(O||null),options:[{value:"",label:"Global (all projects)"},...H.map((O)=>({value:O.id,label:O.name}))],placeholder:"Select scope..."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Global servers are available to all agents. Project-scoped servers are only available to agents in that project."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="npm"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"npm Package"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:U,onChange:(O)=>R(O.target.value),placeholder:"e.g., @modelcontextprotocol/server-filesystem or paste full command",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Package name or paste a full npx command with credentials"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="pip"&&z.jsxDEV("div",{className:"space-y-4",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"pip Package"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:U,onChange:(O)=>{if(T(O.target.value),!M&&O.target.value){let N=O.target.value.split("[")[0].replace(/-/g,".");L(N)}},placeholder:"e.g., late-sdk[mcp]",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Python package with extras, e.g., late-sdk[mcp] or mcp-server-time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Module (optional)"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:M,onChange:(O)=>L(O.target.value),placeholder:"e.g., late.mcp",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Python module to run with -m. Auto-detected from package name if not specified."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X==="command"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Command"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:Q,onChange:(O)=>_(O.target.value),placeholder:"e.g., npx -y pushover-mcp@latest start --token YOUR_TOKEN",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Paste the full command - credentials like YOUR_TOKEN will be auto-extracted"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="http"&&z.jsxDEV("div",{className:"space-y-4",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"URL"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:y,onChange:(O)=>f(O.target.value),placeholder:"e.g., https://example.com/wp-json/mcp/v1/messages",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-3 bg-[#0a0a0a] border border-[#222] rounded",children:[z.jsxDEV("p",{className:"text-xs text-[#666] mb-3",children:"Optional: Basic Auth credentials (will be encoded and stored securely)"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"grid grid-cols-2 gap-3",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-xs text-[#555] mb-1",children:"Username"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:Y,onChange:(O)=>A(O.target.value),placeholder:"username",className:"w-full bg-[#111] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-xs text-[#555] mb-1",children:"Password"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"password",value:Z,onChange:(O)=>S(O.target.value),placeholder:"password or app key",className:"w-full bg-[#111] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[z.jsxDEV("label",{className:"text-sm text-[#666]",children:"Environment Variables / Credentials"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:D,className:"text-xs text-[#f97316] hover:text-[#fb923c] transition",children:"+ Add Variable"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I.length===0&&z.jsxDEV("p",{className:"text-xs text-[#555] bg-[#0a0a0a] border border-[#222] rounded p-3",children:"Add environment variables for API tokens and credentials. These are stored encrypted and passed to the server at startup."},void 0,!1,void 0,this),I.length>0&&z.jsxDEV("div",{className:"space-y-2",children:I.map((O,N)=>z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:O.key,onChange:(m)=>P(N,"key",m.target.value),placeholder:"KEY",className:"w-1/3 bg-[#0a0a0a] border border-[#333] rounded px-2 py-1.5 text-sm font-mono focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"password",value:O.value,onChange:(m)=>P(N,"value",m.target.value),placeholder:"value",className:"flex-1 bg-[#0a0a0a] border border-[#333] rounded px-2 py-1.5 text-sm font-mono focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>x(N),className:"text-[#666] hover:text-red-400 px-2 transition",children:"✕"},void 0,!1,void 0,this)]},N,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&z.jsxDEV("p",{className:"text-red-400 text-sm",children:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 border-t border-[#1a1a1a] flex justify-end gap-2 sticky bottom-0 bg-[#111]",children:[z.jsxDEV("button",{onClick:G,className:"px-4 py-2 border border-[#333] hover:border-[#666] rounded transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:g,disabled:W||!q||(X==="npm"?!U:X==="pip"?!U:X==="http"?!y:!Q),className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-black rounded font-medium transition disabled:opacity-50",children:W?"Adding...":"Add Server"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Uz({server:G,projects:$,onClose:H,onSaved:K}){let{authFetch:w}=c(),[X,B]=J.useState(G.name),[q,F]=J.useState(G.package||""),[U,T]=J.useState(G.command||""),[M,L]=J.useState(G.args||""),[Q,k]=J.useState(G.url||""),[y,f]=J.useState(()=>{let _=G.headers?.Authorization||"";if(_.startsWith("Basic "))try{return atob(_.slice(6)).split(":")[0]||""}catch{return""}return""}),[Y,A]=J.useState(()=>{let _=G.headers?.Authorization||"";if(_.startsWith("Basic "))try{return atob(_.slice(6)).split(":").slice(1).join(":")||""}catch{return""}return""}),[Z,S]=J.useState(()=>{return Object.entries(G.env||{}).map(([_,R])=>({key:_,value:R}))}),[I,p]=J.useState(G.project_id),[u,i]=J.useState(!1),[W,b]=J.useState(null),C=$&&$.length>0,h=G.type==="http",v=()=>{S([...Z,{key:"",value:""}])},D=(_,R,g)=>{let V=[...Z];V[_][R]=g,S(V)},P=(_)=>{S(Z.filter((R,g)=>g!==_))},x=async()=>{if(!X.trim()){b("Name is required");return}i(!0),b(null);let _={};for(let{key:R,value:g}of Z)if(R.trim())_[R.trim()]=g;try{let R={name:X.trim(),env:_};if(h){if(Q.trim())R.url=Q.trim();let V={"Content-Type":"application/json"};if(y&&Y){let O=btoa(`${y}:${Y}`);V.Authorization=`Basic ${O}`}R.headers=V}else{if(G.type==="npm"&&q.trim())R.package=q.trim();if(G.type==="pip"&&q.trim())R.package=q.trim();if(G.type==="custom"){if(U.trim())R.command=U.trim();if(M.trim())R.args=M.trim()}}R.project_id=I;let g=await w(`/api/mcp/servers/${G.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)});if(!g.ok){let V=await g.json();b(V.error||"Failed to save changes"),i(!1);return}if(G.status==="running"&&!h)try{await w(`/api/mcp/servers/${G.id}/stop`,{method:"POST"}),await w(`/api/mcp/servers/${G.id}/start`,{method:"POST"})}catch(V){console.error("Failed to restart server:",V)}K()}catch(R){b("Failed to save changes"),i(!1)}};return z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-[2px] z-50 flex items-center justify-center p-4",children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between sticky top-0 bg-[#111]",children:[z.jsxDEV("h2",{className:"text-lg font-semibold",children:"Edit MCP Server"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:H,className:"text-[#666] hover:text-[#888]",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 space-y-4",children:[z.jsxDEV("div",{className:"text-sm text-[#666] bg-[#0a0a0a] border border-[#222] rounded p-3",children:["Type: ",z.jsxDEV("span",{className:"text-[#888]",children:G.type},void 0,!1,void 0,this),G.package&&z.jsxDEV(z.Fragment,{children:[" • Package: ",z.jsxDEV("span",{className:"text-[#888] font-mono",children:G.package},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.command&&z.jsxDEV(z.Fragment,{children:[" • Command: ",z.jsxDEV("span",{className:"text-[#888] font-mono",children:G.command},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:X,onChange:(_)=>B(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Scope"},void 0,!1,void 0,this),z.jsxDEV(t,{value:I||"",onChange:(_)=>p(_||null),options:[{value:"",label:"Global (all projects)"},...$.map((_)=>({value:_.id,label:_.name}))],placeholder:"Select scope..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.type==="npm"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"npm Package"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:q,onChange:(_)=>F(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.type==="pip"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"pip Package"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:q,onChange:(_)=>F(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),h&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Server URL"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:Q,onChange:(_)=>k(_.target.value),placeholder:"https://example.com/mcp",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Authentication (Basic Auth)"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:y,onChange:(_)=>f(_.target.value),placeholder:"Username",className:"flex-1 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"password",value:Y,onChange:(_)=>A(_.target.value),placeholder:"Password / App Password",className:"flex-1 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Leave empty if no authentication required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.type==="custom"&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Command"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:U,onChange:(_)=>T(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Arguments"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:M,onChange:(_)=>L(_.target.value),placeholder:"e.g., --token $TOKEN --verbose",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!h&&z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[z.jsxDEV("label",{className:"text-sm text-[#666]",children:"Environment Variables / Credentials"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:v,className:"text-xs text-[#f97316] hover:text-[#fb923c] transition",children:"+ Add Variable"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z.length===0&&z.jsxDEV("p",{className:"text-xs text-[#555] bg-[#0a0a0a] border border-[#222] rounded p-3",children:"No environment variables configured."},void 0,!1,void 0,this),Z.length>0&&z.jsxDEV("div",{className:"space-y-2",children:Z.map((_,R)=>z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:_.key,onChange:(g)=>D(R,"key",g.target.value),placeholder:"KEY",className:"w-1/3 bg-[#0a0a0a] border border-[#333] rounded px-2 py-1.5 text-sm font-mono focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"password",value:_.value,onChange:(g)=>D(R,"value",g.target.value),placeholder:"value",className:"flex-1 bg-[#0a0a0a] border border-[#333] rounded px-2 py-1.5 text-sm font-mono focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>P(R),className:"text-[#666] hover:text-red-400 px-2 transition",children:"✕"},void 0,!1,void 0,this)]},R,!0,void 0,this))},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:G.status==="running"?"Server will be automatically restarted to apply changes.":"Changes will take effect when the server is started."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W&&z.jsxDEV("p",{className:"text-red-400 text-sm",children:W},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 border-t border-[#1a1a1a] flex justify-end gap-2 sticky bottom-0 bg-[#111]",children:[z.jsxDEV("button",{onClick:H,className:"px-4 py-2 border border-[#333] hover:border-[#666] rounded transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:x,disabled:u||!X.trim(),className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-black rounded font-medium transition disabled:opacity-50",children:u?"Saving...":"Save Changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
+
export{Mz as i};
|
|
3
|
+
|
|
4
|
+
//# debugId=7936DF6F3383B76864756E2164756E21
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var rW=Object.create;var{getPrototypeOf:aW,defineProperty:NW,getOwnPropertyNames:tW}=Object;var eW=Object.prototype.hasOwnProperty;var r=(B,D,J)=>{J=B!=null?rW(aW(B)):{};let w=D||!B||!B.__esModule?NW(J,"default",{value:B,enumerable:!0}):J;for(let P of tW(B))if(!eW.call(w,P))NW(w,P,{get:()=>B[P],enumerable:!0});return w};var fW=(B,D)=>()=>(D||B((D={exports:{}}).exports,D),D.exports);var LZ=(B,D)=>{for(var J in D)NW(B,J,{get:D[J],enumerable:!0,configurable:!0,set:(w)=>D[J]=()=>w})};var qZ=((B)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(B,{get:(D,J)=>(typeof require<"u"?require:D)[J]}):B)(function(B){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+B+'" is not supported')});var UW=fW((WZ,RW)=>{(function(){function B(W,Z){Object.defineProperty(w.prototype,W,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",Z[0],Z[1])}})}function D(W){if(W===null||typeof W!=="object")return null;return W=EW&&W[EW]||W["@@iterator"],typeof W==="function"?W:null}function J(W,Z){W=(W=W.constructor)&&(W.displayName||W.name)||"ReactClass";var G=W+"."+Z;PW[G]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",Z,W),PW[G]=!0)}function w(W,Z,G){this.props=W,this.context=Z,this.refs=VW,this.updater=G||_W}function P(){}function T(W,Z,G){this.props=W,this.context=Z,this.refs=VW,this.updater=G||_W}function j(){}function A(W){return""+W}function C(W){try{A(W);var Z=!1}catch(z){Z=!0}if(Z){Z=console;var G=Z.error,H=typeof Symbol==="function"&&Symbol.toStringTag&&W[Symbol.toStringTag]||W.constructor.name||"Object";return G.call(Z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",H),A(W)}}function h(W){if(W==null)return null;if(typeof W==="function")return W.$$typeof===iW?null:W.displayName||W.name||null;if(typeof W==="string")return W;switch(W){case BW:return"Fragment";case U:return"Profiler";case X:return"StrictMode";case MW:return"Suspense";case v:return"SuspenseList";case DW:return"Activity"}if(typeof W==="object")switch(typeof W.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),W.$$typeof){case OW:return"Portal";case m:return W.displayName||"Context";case E:return(W._context.displayName||"Context")+".Consumer";case l:var Z=W.render;return W=W.displayName,W||(W=Z.displayName||Z.name||"",W=W!==""?"ForwardRef("+W+")":"ForwardRef"),W;case n:return Z=W.displayName||null,Z!==null?Z:h(W.type)||"Memo";case t:Z=W._payload,W=W._init;try{return h(W(Z))}catch(G){}}return null}function i(W){if(W===BW)return"<>";if(typeof W==="object"&&W!==null&&W.$$typeof===t)return"<...>";try{var Z=h(W);return Z?"<"+Z+">":"<...>"}catch(G){return"<...>"}}function p(){var W=O.A;return W===null?null:W.getOwner()}function y(){return Error("react-stack-top-frame")}function d(W){if(JW.call(W,"key")){var Z=Object.getOwnPropertyDescriptor(W,"key").get;if(Z&&Z.isReactWarning)return!1}return W.key!==void 0}function u(W,Z){function G(){jW||(jW=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Z))}G.isReactWarning=!0,Object.defineProperty(W,"key",{get:G,configurable:!0})}function S(){var W=h(this.type);return CW[W]||(CW[W]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),W=this.props.ref,W!==void 0?W:null}function V(W,Z,G,H,z,L){var $=G.ref;return W={$$typeof:QW,type:W,key:Z,props:G,_owner:H},($!==void 0?$:null)!==null?Object.defineProperty(W,"ref",{enumerable:!1,get:S}):Object.defineProperty(W,"ref",{enumerable:!1,value:null}),W._store={},Object.defineProperty(W._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(W,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(W,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(W,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:L}),Object.freeze&&(Object.freeze(W.props),Object.freeze(W)),W}function b(W,Z){return Z=V(W.type,Z,W.props,W._owner,W._debugStack,W._debugTask),W._store&&(Z._store.validated=W._store.validated),Z}function g(W){f(W)?W._store&&(W._store.validated=1):typeof W==="object"&&W!==null&&W.$$typeof===t&&(W._payload.status==="fulfilled"?f(W._payload.value)&&W._payload.value._store&&(W._payload.value._store.validated=1):W._store&&(W._store.validated=1))}function f(W){return typeof W==="object"&&W!==null&&W.$$typeof===QW}function k(W){var Z={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(G){return Z[G]})}function _(W,Z){return typeof W==="object"&&W!==null&&W.key!=null?(C(W.key),k(""+W.key)):Z.toString(36)}function s(W){switch(W.status){case"fulfilled":return W.value;case"rejected":throw W.reason;default:switch(typeof W.status==="string"?W.then(j,j):(W.status="pending",W.then(function(Z){W.status==="pending"&&(W.status="fulfilled",W.value=Z)},function(Z){W.status==="pending"&&(W.status="rejected",W.reason=Z)})),W.status){case"fulfilled":return W.value;case"rejected":throw W.reason}}throw W}function x(W,Z,G,H,z){var L=typeof W;if(L==="undefined"||L==="boolean")W=null;var $=!1;if(W===null)$=!0;else switch(L){case"bigint":case"string":case"number":$=!0;break;case"object":switch(W.$$typeof){case QW:case OW:$=!0;break;case t:return $=W._init,x($(W._payload),Z,G,H,z)}}if($){$=W,z=z($);var F=H===""?"."+_($,0):H;return AW(z)?(G="",F!=null&&(G=F.replace(gW,"$&/")+"/"),x(z,Z,G,"",function(e){return e})):z!=null&&(f(z)&&(z.key!=null&&($&&$.key===z.key||C(z.key)),G=b(z,G+(z.key==null||$&&$.key===z.key?"":(""+z.key).replace(gW,"$&/")+"/")+F),H!==""&&$!=null&&f($)&&$.key==null&&$._store&&!$._store.validated&&(G._store.validated=2),z=G),Z.push(z)),1}if($=0,F=H===""?".":H+":",AW(W))for(var q=0;q<W.length;q++)H=W[q],L=F+_(H,q),$+=x(H,Z,G,L,z);else if(q=D(W),typeof q==="function")for(q===W.entries&&(SW||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),SW=!0),W=q.call(W),q=0;!(H=W.next()).done;)H=H.value,L=F+_(H,q++),$+=x(H,Z,G,L,z);else if(L==="object"){if(typeof W.then==="function")return x(s(W),Z,G,H,z);throw Z=String(W),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return $}function M(W,Z,G){if(W==null)return W;var H=[],z=0;return x(W,H,"","",function(L){return Z.call(G,L,z++)}),H}function Q(W){if(W._status===-1){var Z=W._ioInfo;Z!=null&&(Z.start=Z.end=performance.now()),Z=W._result;var G=Z();if(G.then(function(z){if(W._status===0||W._status===-1){W._status=1,W._result=z;var L=W._ioInfo;L!=null&&(L.end=performance.now()),G.status===void 0&&(G.status="fulfilled",G.value=z)}},function(z){if(W._status===0||W._status===-1){W._status=2,W._result=z;var L=W._ioInfo;L!=null&&(L.end=performance.now()),G.status===void 0&&(G.status="rejected",G.reason=z)}}),Z=W._ioInfo,Z!=null){Z.value=G;var H=G.displayName;typeof H==="string"&&(Z.name=H)}W._status===-1&&(W._status=0,W._result=G)}if(W._status===1)return Z=W._result,Z===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
|
+
|
|
3
|
+
Your code should look like:
|
|
4
|
+
const MyComponent = lazy(() => import('./MyComponent'))
|
|
5
|
+
|
|
6
|
+
Did you accidentally put curly braces around the import?`,Z),"default"in Z||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
|
+
|
|
8
|
+
Your code should look like:
|
|
9
|
+
const MyComponent = lazy(() => import('./MyComponent'))`,Z),Z.default;throw W._result}function Y(){var W=O.H;return W===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
|
+
2. You might be breaking the Rules of Hooks
|
|
12
|
+
3. You might have more than one copy of React in the same app
|
|
13
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),W}function R(){O.asyncTransitions--}function o(W){if(LW===null)try{var Z=("require"+Math.random()).slice(0,7);LW=(RW&&RW[Z]).call(RW,"timers").setImmediate}catch(G){LW=function(H){bW===!1&&(bW=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var z=new MessageChannel;z.port1.onmessage=H,z.port2.postMessage(void 0)}}return LW(W)}function a(W){return 1<W.length&&typeof AggregateError==="function"?AggregateError(W):W[0]}function WW(W,Z){Z!==qW-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),qW=Z}function HW(W,Z,G){var H=O.actQueue;if(H!==null)if(H.length!==0)try{YW(H),o(function(){return HW(W,Z,G)});return}catch(z){O.thrownErrors.push(z)}else O.actQueue=null;0<O.thrownErrors.length?(H=a(O.thrownErrors),O.thrownErrors.length=0,G(H)):Z(W)}function YW(W){if(!FW){FW=!0;var Z=0;try{for(;Z<W.length;Z++){var G=W[Z];do{O.didUsePromise=!1;var H=G(!1);if(H!==null){if(O.didUsePromise){W[Z]=G,W.splice(0,Z);return}G=H}else break}while(1)}W.length=0}catch(z){W.splice(0,Z+1),O.thrownErrors.push(z)}finally{FW=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var QW=Symbol.for("react.transitional.element"),OW=Symbol.for("react.portal"),BW=Symbol.for("react.fragment"),X=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),m=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),MW=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),n=Symbol.for("react.memo"),t=Symbol.for("react.lazy"),DW=Symbol.for("react.activity"),EW=Symbol.iterator,PW={},_W={isMounted:function(){return!1},enqueueForceUpdate:function(W){J(W,"forceUpdate")},enqueueReplaceState:function(W){J(W,"replaceState")},enqueueSetState:function(W){J(W,"setState")}},IW=Object.assign,VW={};Object.freeze(VW),w.prototype.isReactComponent={},w.prototype.setState=function(W,Z){if(typeof W!=="object"&&typeof W!=="function"&&W!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,Z,"setState")},w.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};var c={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for($W in c)c.hasOwnProperty($W)&&B($W,c[$W]);P.prototype=w.prototype,c=T.prototype=new P,c.constructor=T,IW(c,w.prototype),c.isPureReactComponent=!0;var AW=Array.isArray,iW=Symbol.for("react.client.reference"),O={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},JW=Object.prototype.hasOwnProperty,TW=console.createTask?console.createTask:function(){return null};c={react_stack_bottom_frame:function(W){return W()}};var jW,vW,CW={},cW=c.react_stack_bottom_frame.bind(c,y)(),oW=TW(i(y)),SW=!1,gW=/\/+/g,kW=typeof reportError==="function"?reportError:function(W){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof W==="object"&&W!==null&&typeof W.message==="string"?String(W.message):String(W),error:W});if(!window.dispatchEvent(Z))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",W);return}console.error(W)},bW=!1,LW=null,qW=0,wW=!1,FW=!1,mW=typeof queueMicrotask==="function"?function(W){queueMicrotask(function(){return queueMicrotask(W)})}:o;c=Object.freeze({__proto__:null,c:function(W){return Y().useMemoCache(W)}});var $W={map:M,forEach:function(W,Z,G){M(W,function(){Z.apply(this,arguments)},G)},count:function(W){var Z=0;return M(W,function(){Z++}),Z},toArray:function(W){return M(W,function(Z){return Z})||[]},only:function(W){if(!f(W))throw Error("React.Children.only expected to receive a single React element child.");return W}};WZ.Activity=DW,WZ.Children=$W,WZ.Component=w,WZ.Fragment=BW,WZ.Profiler=U,WZ.PureComponent=T,WZ.StrictMode=X,WZ.Suspense=MW,WZ.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,WZ.__COMPILER_RUNTIME=c,WZ.act=function(W){var Z=O.actQueue,G=qW;qW++;var H=O.actQueue=Z!==null?Z:[],z=!1;try{var L=W()}catch(q){O.thrownErrors.push(q)}if(0<O.thrownErrors.length)throw WW(Z,G),W=a(O.thrownErrors),O.thrownErrors.length=0,W;if(L!==null&&typeof L==="object"&&typeof L.then==="function"){var $=L;return mW(function(){z||wW||(wW=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(q,e){z=!0,$.then(function(zW){if(WW(Z,G),G===0){try{YW(H),o(function(){return HW(zW,q,e)})}catch(nW){O.thrownErrors.push(nW)}if(0<O.thrownErrors.length){var lW=a(O.thrownErrors);O.thrownErrors.length=0,e(lW)}}else q(zW)},function(zW){WW(Z,G),0<O.thrownErrors.length?(zW=a(O.thrownErrors),O.thrownErrors.length=0,e(zW)):e(zW)})}}}var F=L;if(WW(Z,G),G===0&&(YW(H),H.length!==0&&mW(function(){z||wW||(wW=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),O.actQueue=null),0<O.thrownErrors.length)throw W=a(O.thrownErrors),O.thrownErrors.length=0,W;return{then:function(q,e){z=!0,G===0?(O.actQueue=H,o(function(){return HW(F,q,e)})):q(F)}}},WZ.cache=function(W){return function(){return W.apply(null,arguments)}},WZ.cacheSignal=function(){return null},WZ.captureOwnerStack=function(){var W=O.getCurrentStack;return W===null?null:W()},WZ.cloneElement=function(W,Z,G){if(W===null||W===void 0)throw Error("The argument must be a React element, but you passed "+W+".");var H=IW({},W.props),z=W.key,L=W._owner;if(Z!=null){var $;W:{if(JW.call(Z,"ref")&&($=Object.getOwnPropertyDescriptor(Z,"ref").get)&&$.isReactWarning){$=!1;break W}$=Z.ref!==void 0}$&&(L=p()),d(Z)&&(C(Z.key),z=""+Z.key);for(F in Z)!JW.call(Z,F)||F==="key"||F==="__self"||F==="__source"||F==="ref"&&Z.ref===void 0||(H[F]=Z[F])}var F=arguments.length-2;if(F===1)H.children=G;else if(1<F){$=Array(F);for(var q=0;q<F;q++)$[q]=arguments[q+2];H.children=$}H=V(W.type,z,H,L,W._debugStack,W._debugTask);for(z=2;z<arguments.length;z++)g(arguments[z]);return H},WZ.createContext=function(W){return W={$$typeof:m,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null},W.Provider=W,W.Consumer={$$typeof:E,_context:W},W._currentRenderer=null,W._currentRenderer2=null,W},WZ.createElement=function(W,Z,G){for(var H=2;H<arguments.length;H++)g(arguments[H]);H={};var z=null;if(Z!=null)for(q in vW||!("__self"in Z)||"key"in Z||(vW=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),d(Z)&&(C(Z.key),z=""+Z.key),Z)JW.call(Z,q)&&q!=="key"&&q!=="__self"&&q!=="__source"&&(H[q]=Z[q]);var L=arguments.length-2;if(L===1)H.children=G;else if(1<L){for(var $=Array(L),F=0;F<L;F++)$[F]=arguments[F+2];Object.freeze&&Object.freeze($),H.children=$}if(W&&W.defaultProps)for(q in L=W.defaultProps,L)H[q]===void 0&&(H[q]=L[q]);z&&u(H,typeof W==="function"?W.displayName||W.name||"Unknown":W);var q=1e4>O.recentlyCreatedOwnerStacks++;return V(W,z,H,p(),q?Error("react-stack-top-frame"):cW,q?TW(i(W)):oW)},WZ.createRef=function(){var W={current:null};return Object.seal(W),W},WZ.forwardRef=function(W){W!=null&&W.$$typeof===n?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof W!=="function"?console.error("forwardRef requires a render function but was given %s.",W===null?"null":typeof W):W.length!==0&&W.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",W.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),W!=null&&W.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var Z={$$typeof:l,render:W},G;return Object.defineProperty(Z,"displayName",{enumerable:!1,configurable:!0,get:function(){return G},set:function(H){G=H,W.name||W.displayName||(Object.defineProperty(W,"name",{value:H}),W.displayName=H)}}),Z},WZ.isValidElement=f,WZ.lazy=function(W){W={_status:-1,_result:W};var Z={$$typeof:t,_payload:W,_init:Q},G={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return W._ioInfo=G,Z._debugInfo=[{awaited:G}],Z},WZ.memo=function(W,Z){W==null&&console.error("memo: The first argument must be a component. Instead received: %s",W===null?"null":typeof W),Z={$$typeof:n,type:W,compare:Z===void 0?null:Z};var G;return Object.defineProperty(Z,"displayName",{enumerable:!1,configurable:!0,get:function(){return G},set:function(H){G=H,W.name||W.displayName||(Object.defineProperty(W,"name",{value:H}),W.displayName=H)}}),Z},WZ.startTransition=function(W){var Z=O.T,G={};G._updatedFibers=new Set,O.T=G;try{var H=W(),z=O.S;z!==null&&z(G,H),typeof H==="object"&&H!==null&&typeof H.then==="function"&&(O.asyncTransitions++,H.then(R,R),H.then(j,kW))}catch(L){kW(L)}finally{Z===null&&G._updatedFibers&&(W=G._updatedFibers.size,G._updatedFibers.clear(),10<W&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),Z!==null&&G.types!==null&&(Z.types!==null&&Z.types!==G.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),Z.types=G.types),O.T=Z}},WZ.unstable_useCacheRefresh=function(){return Y().useCacheRefresh()},WZ.use=function(W){return Y().use(W)},WZ.useActionState=function(W,Z,G){return Y().useActionState(W,Z,G)},WZ.useCallback=function(W,Z){return Y().useCallback(W,Z)},WZ.useContext=function(W){var Z=Y();return W.$$typeof===E&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),Z.useContext(W)},WZ.useDebugValue=function(W,Z){return Y().useDebugValue(W,Z)},WZ.useDeferredValue=function(W,Z){return Y().useDeferredValue(W,Z)},WZ.useEffect=function(W,Z){return W==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),Y().useEffect(W,Z)},WZ.useEffectEvent=function(W){return Y().useEffectEvent(W)},WZ.useId=function(){return Y().useId()},WZ.useImperativeHandle=function(W,Z,G){return Y().useImperativeHandle(W,Z,G)},WZ.useInsertionEffect=function(W,Z){return W==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),Y().useInsertionEffect(W,Z)},WZ.useLayoutEffect=function(W,Z){return W==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),Y().useLayoutEffect(W,Z)},WZ.useMemo=function(W,Z){return Y().useMemo(W,Z)},WZ.useOptimistic=function(W,Z){return Y().useOptimistic(W,Z)},WZ.useReducer=function(W,Z,G){return Y().useReducer(W,Z,G)},WZ.useRef=function(W){return Y().useRef(W)},WZ.useState=function(W){return Y().useState(W)},WZ.useSyncExternalStore=function(W,Z,G){return Y().useSyncExternalStore(W,Z,G)},WZ.useTransition=function(){return Y().useTransition()},WZ.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var XW=fW((ZZ)=>{var ZW=r(UW());(function(){function B(X){if(X==null)return null;if(typeof X==="function")return X.$$typeof===Y?null:X.displayName||X.name||null;if(typeof X==="string")return X;switch(X){case S:return"Fragment";case b:return"Profiler";case V:return"StrictMode";case _:return"Suspense";case s:return"SuspenseList";case Q:return"Activity"}if(typeof X==="object")switch(typeof X.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),X.$$typeof){case u:return"Portal";case f:return X.displayName||"Context";case g:return(X._context.displayName||"Context")+".Consumer";case k:var U=X.render;return X=X.displayName,X||(X=U.displayName||U.name||"",X=X!==""?"ForwardRef("+X+")":"ForwardRef"),X;case x:return U=X.displayName||null,U!==null?U:B(X.type)||"Memo";case M:U=X._payload,X=X._init;try{return B(X(U))}catch(E){}}return null}function D(X){return""+X}function J(X){try{D(X);var U=!1}catch(l){U=!0}if(U){U=console;var E=U.error,m=typeof Symbol==="function"&&Symbol.toStringTag&&X[Symbol.toStringTag]||X.constructor.name||"Object";return E.call(U,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",m),D(X)}}function w(X){if(X===S)return"<>";if(typeof X==="object"&&X!==null&&X.$$typeof===M)return"<...>";try{var U=B(X);return U?"<"+U+">":"<...>"}catch(E){return"<...>"}}function P(){var X=R.A;return X===null?null:X.getOwner()}function T(){return Error("react-stack-top-frame")}function j(X){if(o.call(X,"key")){var U=Object.getOwnPropertyDescriptor(X,"key").get;if(U&&U.isReactWarning)return!1}return X.key!==void 0}function A(X,U){function E(){HW||(HW=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",U))}E.isReactWarning=!0,Object.defineProperty(X,"key",{get:E,configurable:!0})}function C(){var X=B(this.type);return YW[X]||(YW[X]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),X=this.props.ref,X!==void 0?X:null}function h(X,U,E,m,l,MW){var v=E.ref;return X={$$typeof:d,type:X,key:U,props:E,_owner:m},(v!==void 0?v:null)!==null?Object.defineProperty(X,"ref",{enumerable:!1,get:C}):Object.defineProperty(X,"ref",{enumerable:!1,value:null}),X._store={},Object.defineProperty(X._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(X,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(X,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:l}),Object.defineProperty(X,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:MW}),Object.freeze&&(Object.freeze(X.props),Object.freeze(X)),X}function i(X,U,E,m,l,MW){var v=U.children;if(v!==void 0)if(m)if(a(v)){for(m=0;m<v.length;m++)p(v[m]);Object.freeze&&Object.freeze(v)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(v);if(o.call(U,"key")){v=B(X);var n=Object.keys(U).filter(function(DW){return DW!=="key"});m=0<n.length?"{key: someKey, "+n.join(": ..., ")+": ...}":"{key: someKey}",BW[v+m]||(n=0<n.length?"{"+n.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
14
|
+
let props = %s;
|
|
15
|
+
<%s {...props} />
|
|
16
|
+
React keys must be passed directly to JSX without using spread:
|
|
17
|
+
let props = %s;
|
|
18
|
+
<%s key={someKey} {...props} />`,m,v,n,v),BW[v+m]=!0)}if(v=null,E!==void 0&&(J(E),v=""+E),j(U)&&(J(U.key),v=""+U.key),"key"in U){E={};for(var t in U)t!=="key"&&(E[t]=U[t])}else E=U;return v&&A(E,typeof X==="function"?X.displayName||X.name||"Unknown":X),h(X,v,E,P(),l,MW)}function p(X){y(X)?X._store&&(X._store.validated=1):typeof X==="object"&&X!==null&&X.$$typeof===M&&(X._payload.status==="fulfilled"?y(X._payload.value)&&X._payload.value._store&&(X._payload.value._store.validated=1):X._store&&(X._store.validated=1))}function y(X){return typeof X==="object"&&X!==null&&X.$$typeof===d}var d=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),f=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),s=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),Y=Symbol.for("react.client.reference"),R=ZW.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,o=Object.prototype.hasOwnProperty,a=Array.isArray,WW=console.createTask?console.createTask:function(){return null};ZW={react_stack_bottom_frame:function(X){return X()}};var HW,YW={},QW=ZW.react_stack_bottom_frame.bind(ZW,T)(),OW=WW(w(T)),BW={};ZZ.Fragment=S,ZZ.jsxDEV=function(X,U,E,m){var l=1e4>R.recentlyCreatedOwnerStacks++;return i(X,U,E,m,l?Error("react-stack-top-frame"):QW,l?WW(w(X)):OW)}})()});var N=r(UW(),1),yW=r(XW(),1),hW=N.createContext(null),XZ=200;function GZ({children:B}){let[D,J]=N.useState(!1),[w,P]=N.useState([]),[T,j]=N.useState({}),[A,C]=N.useState({}),[h,i]=N.useState(0),[p,y]=N.useState(0),[d,u]=N.useState(0),S=N.useRef(null),V=N.useRef(null);N.useEffect(()=>{let _=setInterval(()=>{let s=Date.now();C((x)=>{let M={};for(let[Q,Y]of Object.entries(x))if(Y.expiresAt>s)M[Q]=Y;return M})},500);return()=>clearInterval(_)},[]);let b=N.useCallback(()=>{if(S.current)S.current.close(),S.current=null;try{let _=new EventSource("/api/telemetry/stream");S.current=_,_.onopen=()=>{J(!0)},_.onmessage=(s)=>{if(!s.data||s.data.trim()==="")return;try{let x=JSON.parse(s.data);if(x.connected){J(!0);return}if(Array.isArray(x)){if(P((M)=>{return[...x,...M].slice(0,XZ)}),j((M)=>{let Q={...M};for(let Y of x){let R=Q[Y.agent_id];if(!R||new Date(Y.timestamp)>new Date(R.timestamp))Q[Y.agent_id]={timestamp:Y.timestamp,category:Y.category,type:Y.type}}return Q}),C((M)=>{let Q={...M},Y=Date.now()+3000;for(let R of x)Q[R.agent_id]={type:R.type,expiresAt:Y};return Q}),x.some((M)=>M.category==="system"&&(M.type==="agent_started"||M.type==="agent_stopped")))i((M)=>M+1);if(x.some((M)=>M.category==="TASK"&&(M.type==="task_created"||M.type==="task_updated"||M.type==="task_deleted")))y((M)=>M+1);if(x.some((M)=>M.level==="error"||M.category==="ERROR"||M.category==="system"&&M.type==="agent_stopped"))u((M)=>M+1)}}catch{}},_.onerror=()=>{if(J(!1),_.close(),S.current=null,V.current)clearTimeout(V.current);V.current=setTimeout(b,2000)}}catch{if(J(!1),V.current)clearTimeout(V.current);V.current=setTimeout(b,2000)}},[]);N.useEffect(()=>{return b(),()=>{if(S.current)S.current.close();if(V.current)clearTimeout(V.current)}},[b]);let g=N.useCallback(()=>{P([])},[]),f=N.useCallback(()=>{i((_)=>_+1),y((_)=>_+1)},[]),k=N.default.useMemo(()=>({connected:D,events:w,lastActivityByAgent:T,activeAgents:A,statusChangeCounter:h,taskChangeCounter:p,notificationCounter:d,clearEvents:g,triggerRefresh:f}),[D,w,T,A,h,p,d,g,f]);return yW.jsxDEV(hW.Provider,{value:k,children:B},void 0,!1,void 0,this)}function GW(){let B=N.useContext(hW);if(!B)throw Error("useTelemetryContext must be used within TelemetryProvider");return B}function HZ(B){let{connected:D,events:J,lastActivityByAgent:w}=GW(),P=N.default.useMemo(()=>{let A=J;if(B?.agent_id)A=A.filter((C)=>C.agent_id===B.agent_id);if(B?.category)A=A.filter((C)=>C.category===B.category);if(B?.limit)A=A.slice(0,B.limit);return A},[J,B?.agent_id,B?.category,B?.limit]),T=B?.agent_id?w[B.agent_id]:void 0,j=N.default.useMemo(()=>{if(!T)return!1;let A=new Date(T.timestamp).getTime();return Date.now()-A<1e4},[T]);return{connected:D,events:P,lastActivity:T,isActive:j}}function YZ(B){switch(B){case"llm_request":return"Thinking";case"tool_invocation":return"Using tools";case"tool_result":return"Using tools";case"thread_activity":return"Working";case"agent_started":return"Starting";case"agent_stopped":return"Stopped";default:return"Working"}}function BZ(B){let{activeAgents:D}=GW(),J=D[B],w=!!J,P=J?.type;return N.default.useMemo(()=>({isActive:w,type:P,label:w?YZ(P):void 0}),[w,P])}function MZ(){let{statusChangeCounter:B}=GW();return B}function zZ(){let{taskChangeCounter:B}=GW();return B}function QZ(){let{notificationCounter:B}=GW();return B}function $Z(){let{triggerRefresh:B}=GW();return B}var K=r(UW(),1),dW=r(XW(),1),uW=K.createContext(null);function KW(){let B=K.useContext(uW);if(!B)throw Error("useAuth must be used within an AuthProvider");return B}function UZ({children:B}){let[D,J]=K.useState(null),[w,P]=K.useState(null),[T,j]=K.useState(!0),[A,C]=K.useState(null),[h,i]=K.useState(!1),[p,y]=K.useState(null),d=K.useRef(null),u=K.useRef(!1),S=K.useRef(!1),V=K.useCallback((M)=>{d.current=M,P(M)},[]),b=K.useCallback(async()=>{if(u.current)return!1;u.current=!0;try{let M=await fetch("/api/auth/refresh",{method:"POST",credentials:"include"});if(!M.ok)return!1;let Q=await M.json();if(V(Q.accessToken),Q.user)J(Q.user);if(Q.onboarding)y(Q.onboarding.completed||Q.onboarding.has_any_keys);return!!Q.user}catch(M){return console.error("Token refresh failed:",M),!1}finally{u.current=!1}},[V]),g=K.useCallback(async()=>{try{let M=d.current,Y=await(await fetch("/api/auth/check",{headers:M?{Authorization:`Bearer ${M}`}:{}})).json();if(C(Y.hasUsers),i(Y.isDev??!1),Y.onboarding)y(Y.onboarding.completed||Y.onboarding.has_any_keys);if(Y.authenticated&&Y.user)J(Y.user);else if(J(null),Y.hasUsers){if(!await b())V(null)}}catch(M){console.error("Auth check failed:",M),J(null),V(null)}finally{j(!1)}},[b,V]),f=K.useCallback(async(M,Q)=>{try{let Y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:M,password:Q})}),R=await Y.json();if(!Y.ok)return{success:!1,error:R.error||"Login failed"};return V(R.accessToken),J(R.user),C(!0),{success:!0}}catch(Y){return console.error("Login failed:",Y),{success:!1,error:"Login failed"}}},[V]),k=K.useCallback(async()=>{try{let M=d.current;await fetch("/api/auth/logout",{method:"POST",credentials:"include",headers:M?{Authorization:`Bearer ${M}`}:{}})}catch(M){console.error("Logout failed:",M)}finally{J(null),V(null)}},[V]),_=K.useCallback(async(M,Q={})=>{let Y=new Headers(Q.headers),R=d.current;if(R)Y.set("Authorization",`Bearer ${R}`);return fetch(M,{...Q,headers:Y})},[]),s=K.useCallback(async()=>{return b()},[b]);K.useEffect(()=>{if(S.current)return;S.current=!0,g()},[g]),K.useEffect(()=>{if(!w)return;let M=setInterval(()=>{b()},840000);return()=>clearInterval(M)},[w,b]);let x=K.useMemo(()=>({user:D,isAuthenticated:!!D,isLoading:T,hasUsers:A,isDev:h,accessToken:w,onboardingComplete:p,setOnboardingComplete:y,login:f,logout:k,refreshToken:s,checkAuth:g,authFetch:_}),[D,T,A,h,w,p,y,f,k,s,g,_]);return dW.jsxDEV(uW.Provider,{value:x,children:B},void 0,!1,void 0,this)}function OZ(){let{accessToken:B}=KW();return B?{Authorization:`Bearer ${B}`}:{}}var I=r(UW(),1);var pW=r(XW(),1),sW=I.createContext(null);function DZ(){let B=I.useContext(sW);if(!B)throw Error("useProjects must be used within a ProjectProvider");return B}var xW="apteva_current_project";function JZ({children:B}){let{authFetch:D,isAuthenticated:J,isLoading:w}=KW(),[P,T]=I.useState([]),[j,A]=I.useState(()=>{if(typeof window<"u")return localStorage.getItem(xW);return null}),[C,h]=I.useState(!0),[i,p]=I.useState(null),[y,d]=I.useState(0),[u,S]=I.useState(!1),[V,b]=I.useState(!1);I.useEffect(()=>{fetch("/api/features").then((Q)=>Q.json()).then((Q)=>{S(Q.projects===!0),b(Q.metaAgent===!0)}).catch(()=>{S(!1),b(!1)})},[]);let g=I.useCallback((Q)=>{if(A(Q),typeof window<"u")if(Q===null)localStorage.removeItem(xW);else localStorage.setItem(xW,Q)},[]),f=P.find((Q)=>Q.id===j)||null,k=I.useCallback(async()=>{if(!u){T([]),h(!1);return}if(!J&&!w){T([]),h(!1);return}try{p(null);let Q=await D("/api/projects");if(!Q.ok)throw Error("Failed to fetch projects");let Y=await Q.json();if(T(Y.projects||[]),d(Y.unassignedCount||0),j&&j!=="unassigned"&&!Y.projects.find((R)=>R.id===j))g(null)}catch(Q){console.error("Failed to fetch projects:",Q),p("Failed to load projects")}finally{h(!1)}},[D,J,w,j,g,u]),_=I.useCallback(async(Q)=>{try{let Y=await D("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)});if(!Y.ok){let o=await Y.json();throw Error(o.error||"Failed to create project")}let R=await Y.json();return await k(),R.project}catch(Y){return console.error("Failed to create project:",Y),null}},[D,k]),s=I.useCallback(async(Q,Y)=>{try{let R=await D(`/api/projects/${Q}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)});if(!R.ok){let a=await R.json();throw Error(a.error||"Failed to update project")}let o=await R.json();return await k(),o.project}catch(R){return console.error("Failed to update project:",R),null}},[D,k]),x=I.useCallback(async(Q)=>{try{let Y=await D(`/api/projects/${Q}`,{method:"DELETE"});if(!Y.ok){let R=await Y.json();throw Error(R.error||"Failed to delete project")}if(j===Q)g(null);return await k(),!0}catch(Y){return console.error("Failed to delete project:",Y),!1}},[D,j,g,k]);I.useEffect(()=>{if(!w&&u)k()},[w,u,k]);let M=I.useMemo(()=>({projects:P,currentProjectId:j,currentProject:f,isLoading:C,error:i,unassignedCount:y,projectsEnabled:u,metaAgentEnabled:V,setCurrentProjectId:g,createProject:_,updateProject:s,deleteProject:x,refreshProjects:k}),[P,j,f,C,i,y,u,V,g,_,s,x,k]);return pW.jsxDEV(sW.Provider,{value:M,children:B},void 0,!1,void 0,this)}export{r as X,fW as Y,LZ as Z,qZ as _,UW as $,XW as aa,GZ as ba,GW as ca,HZ as da,BZ as ea,MZ as fa,zZ as ga,QZ as ha,$Z as ia,KW as ja,UZ as ka,OZ as la,DZ as ma,JZ as na};
|
|
19
|
+
|
|
20
|
+
//# debugId=DBEFC0D692C7DDD864756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{X as n,aa as e}from"./App.3qw8nben.js";var o=n(e(),1);function t({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function i({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function a({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function s({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function c({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function l({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function u({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function h({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function d({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function k({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function p({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function v({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function L({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function M({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function m({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function g({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function f({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function w({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function I({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function C({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function W({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function P({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function B({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h5M20 20v-5h-5"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.49 9A9 9 0 005.64 5.64L4 4m16 16l-1.64-1.64A9 9 0 013.51 15"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function N({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3"},void 0,!1,void 0,this),o.jsxDEV("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function z({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 14l2 2 4-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function H({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function A({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
+
export{t as k,i as l,a as m,s as n,c as o,l as p,u as q,h as r,d as s,k as t,p as u,v,L as w,M as x,m as y,g as z,f as A,w as B,I as C,C as D,W as E,P as F,B as G,N as H,z as I,H as J,A as K};
|
|
3
|
+
|
|
4
|
+
//# debugId=AF49E0E4F6CBFBFF64756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{$ as b,X as i,aa as d}from"./App.3qw8nben.js";var n=i(b(),1),e=i(d(),1);function h({value:o,options:c,onChange:m,placeholder:f="Select...",compact:u}){let[r,l]=n.useState(!1),s=n.useRef(null),a=c.find((t)=>t.value===o);return n.useEffect(()=>{function t(p){if(s.current&&!s.current.contains(p.target))l(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]),e.jsxDEV("div",{ref:s,className:"relative",children:[e.jsxDEV("button",{type:"button",onClick:()=>l(!r),className:`w-full bg-[#0a0a0a] border border-[#222] rounded ${u?"px-2.5 py-1.5 text-sm":"px-3 py-2"} text-left flex items-center justify-between focus:outline-none focus:border-[#f97316] text-[#e0e0e0] hover:border-[#333] transition`,children:[e.jsxDEV("span",{className:a?"text-[#e0e0e0]":"text-[#666]",children:a?e.jsxDEV(e.Fragment,{children:[a.label,a.recommended&&e.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):f},void 0,!1,void 0,this),e.jsxDEV(v,{isOpen:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&e.jsxDEV("div",{className:"absolute z-50 w-full min-w-max mt-1 bg-[#111] border border-[#222] rounded shadow-lg max-h-60 overflow-y-auto scrollbar-hide",children:c.map((t)=>e.jsxDEV("button",{type:"button",onClick:()=>{m(t.value),l(!1)},className:`w-full ${u?"px-2.5 py-1.5 text-sm":"px-3 py-2"} text-left flex items-center justify-between hover:bg-[#1a1a1a] transition ${t.value===o?"bg-[#1a1a1a] text-[#f97316]":"text-[#e0e0e0]"}`,children:[e.jsxDEV("span",{children:[t.label,t.recommended&&e.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.value===o&&e.jsxDEV("svg",{className:"w-4 h-4 text-[#f97316]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},t.value,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function v({isOpen:o}){return e.jsxDEV("svg",{className:`w-4 h-4 text-[#666] transition-transform ${o?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
+
export{h as V};
|
|
3
|
+
|
|
4
|
+
//# debugId=4FCDB5E18FD8A95864756E2164756E21
|