apteva 0.4.57 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +216 -54
- package/cli.js +35 -0
- package/install.js +92 -0
- package/package.json +12 -79
- package/LICENSE +0 -63
- package/bin/apteva.js +0 -196
- package/dist/ActivityPage.kxzzb4yc.js +0 -3
- package/dist/ApiDocsPage.zq998hbm.js +0 -4
- package/dist/App.55rea8mn.js +0 -61
- package/dist/App.5ywb23z4.js +0 -53
- package/dist/App.6thds120.js +0 -4
- package/dist/App.9tctxzqm.js +0 -8
- package/dist/App.a8r8ttaz.js +0 -4
- package/dist/App.agsv5bje.js +0 -4
- package/dist/App.cepapqmx.js +0 -4
- package/dist/App.dp041gb3.js +0 -221
- package/dist/App.fds72zb5.js +0 -4
- package/dist/App.fg9qj2dq.js +0 -4
- package/dist/App.ndfejbm9.js +0 -4
- package/dist/App.nxmfmq1h.js +0 -13
- package/dist/App.qdfyt8ba.js +0 -4
- package/dist/App.x2d0ygt6.js +0 -4
- package/dist/App.yt9p4nr3.js +0 -20
- package/dist/App.zn4mw16t.js +0 -1
- package/dist/ConnectionsPage.8r96ryw7.js +0 -3
- package/dist/McpPage.3cwh0gnd.js +0 -3
- package/dist/SettingsPage.ykgdh5ev.js +0 -3
- package/dist/SkillsPage.4np1s65b.js +0 -3
- package/dist/TasksPage.4g08t7p6.js +0 -3
- package/dist/TelemetryPage.72w9pwcp.js +0 -3
- package/dist/TestsPage.z4fk3r7r.js +0 -3
- package/dist/ThreadsPage.63tcajeh.js +0 -3
- package/dist/apteva-kit.css +0 -1
- package/dist/icon.png +0 -0
- package/dist/index.html +0 -16
- package/dist/styles.css +0 -1
- package/scripts/postinstall.mjs +0 -102
- package/src/auth/index.ts +0 -394
- package/src/auth/middleware.ts +0 -213
- package/src/binary.ts +0 -536
- package/src/channels/index.ts +0 -40
- package/src/channels/telegram.ts +0 -311
- package/src/crypto.ts +0 -301
- package/src/db-tests.ts +0 -174
- package/src/db.ts +0 -3133
- package/src/integrations/agentdojo.ts +0 -559
- package/src/integrations/composio.ts +0 -437
- package/src/integrations/index.ts +0 -87
- package/src/integrations/skillsmp.ts +0 -318
- package/src/mcp-client.ts +0 -605
- package/src/mcp-handler.ts +0 -394
- package/src/mcp-platform.ts +0 -2403
- package/src/openapi.ts +0 -2410
- package/src/providers.ts +0 -597
- package/src/routes/api/agent-utils.ts +0 -890
- package/src/routes/api/agents.ts +0 -916
- package/src/routes/api/api-keys.ts +0 -95
- package/src/routes/api/channels.ts +0 -182
- package/src/routes/api/helpers.ts +0 -12
- package/src/routes/api/integrations.ts +0 -639
- package/src/routes/api/mcp.ts +0 -574
- package/src/routes/api/meta-agent.ts +0 -195
- package/src/routes/api/projects.ts +0 -112
- package/src/routes/api/providers.ts +0 -424
- package/src/routes/api/skills.ts +0 -537
- package/src/routes/api/system.ts +0 -333
- package/src/routes/api/telemetry.ts +0 -203
- package/src/routes/api/tests.ts +0 -148
- package/src/routes/api/triggers.ts +0 -518
- package/src/routes/api/users.ts +0 -148
- package/src/routes/api/webhooks.ts +0 -171
- package/src/routes/api.ts +0 -53
- package/src/routes/auth.ts +0 -251
- package/src/routes/share.ts +0 -86
- package/src/routes/static.ts +0 -131
- package/src/server.ts +0 -642
- package/src/test-runner.ts +0 -598
- package/src/triggers/agentdojo.ts +0 -253
- package/src/triggers/composio.ts +0 -264
- package/src/triggers/index.ts +0 -71
- package/src/tui/AgentList.tsx +0 -145
- package/src/tui/App.tsx +0 -102
- package/src/tui/Login.tsx +0 -104
- package/src/tui/api.ts +0 -72
- package/src/tui/index.tsx +0 -7
- package/src/web/App.tsx +0 -455
- package/src/web/components/activity/ActivityPage.tsx +0 -314
- package/src/web/components/activity/index.ts +0 -1
- package/src/web/components/agents/AgentCard.tsx +0 -189
- package/src/web/components/agents/AgentPanel.tsx +0 -2244
- package/src/web/components/agents/AgentsView.tsx +0 -180
- package/src/web/components/agents/CreateAgentModal.tsx +0 -475
- package/src/web/components/agents/index.ts +0 -4
- package/src/web/components/api/ApiDocsPage.tsx +0 -842
- package/src/web/components/auth/CreateAccountStep.tsx +0 -176
- package/src/web/components/auth/LoginPage.tsx +0 -91
- package/src/web/components/auth/index.ts +0 -2
- package/src/web/components/common/Icons.tsx +0 -250
- package/src/web/components/common/LoadingSpinner.tsx +0 -44
- package/src/web/components/common/Modal.tsx +0 -199
- package/src/web/components/common/Select.tsx +0 -97
- package/src/web/components/common/index.ts +0 -20
- package/src/web/components/connections/ConnectionsPage.tsx +0 -54
- package/src/web/components/connections/IntegrationsTab.tsx +0 -170
- package/src/web/components/connections/OverviewTab.tsx +0 -137
- package/src/web/components/connections/TriggersTab.tsx +0 -1346
- package/src/web/components/dashboard/Dashboard.tsx +0 -572
- package/src/web/components/dashboard/index.ts +0 -1
- package/src/web/components/index.ts +0 -21
- package/src/web/components/layout/ErrorBanner.tsx +0 -18
- package/src/web/components/layout/Header.tsx +0 -332
- package/src/web/components/layout/Sidebar.tsx +0 -231
- package/src/web/components/layout/index.ts +0 -3
- package/src/web/components/mcp/IntegrationsPanel.tsx +0 -857
- package/src/web/components/mcp/McpPage.tsx +0 -2515
- package/src/web/components/mcp/index.ts +0 -1
- package/src/web/components/meta-agent/MetaAgent.tsx +0 -245
- package/src/web/components/onboarding/OnboardingWizard.tsx +0 -404
- package/src/web/components/onboarding/index.ts +0 -1
- package/src/web/components/settings/SettingsPage.tsx +0 -2776
- package/src/web/components/settings/index.ts +0 -1
- package/src/web/components/skills/SkillsPage.tsx +0 -1200
- package/src/web/components/tasks/TasksPage.tsx +0 -1116
- package/src/web/components/tasks/index.ts +0 -1
- package/src/web/components/telemetry/TelemetryPage.tsx +0 -1129
- package/src/web/components/tests/TestsPage.tsx +0 -594
- package/src/web/components/threads/ThreadsPage.tsx +0 -315
- package/src/web/context/AuthContext.tsx +0 -242
- package/src/web/context/ProjectContext.tsx +0 -214
- package/src/web/context/TelemetryContext.tsx +0 -299
- package/src/web/context/ThemeContext.tsx +0 -90
- package/src/web/context/UIModeContext.tsx +0 -49
- package/src/web/context/index.ts +0 -12
- package/src/web/hooks/index.ts +0 -3
- package/src/web/hooks/useAgents.ts +0 -115
- package/src/web/hooks/useOnboarding.ts +0 -20
- package/src/web/hooks/useProviders.ts +0 -75
- package/src/web/icon.png +0 -0
- package/src/web/index.html +0 -16
- package/src/web/styles.css +0 -118
- package/src/web/themes.ts +0 -162
- package/src/web/types.ts +0 -298
package/dist/App.6thds120.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{j as fN}from"./App.a8r8ttaz.js";import{V as x}from"./App.fg9qj2dq.js";import{Y as O,aa as Xv,ba as I,ka as g,na as j}from"./App.yt9p4nr3.js";var $N=O(Xv(),1);var D=O(Xv(),1);var U=O(I(),1);function NN(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=D.useState([]),[Q,c]=D.useState([]),[W,a]=D.useState(!0);if(D.useEffect(()=>{(async()=>{a(!0);let A=H&&H!=="unassigned"?`?project_id=${H}`:"";try{let[l,S]=await Promise.all([R(`/api/subscriptions${A}`).catch(()=>null),R("/api/agents").catch(()=>null)]);if(l?.ok){let G=await l.json();F(G.subscriptions||[])}if(S?.ok){let G=await S.json();c(G.agents||[])}}catch(l){console.error("Failed to fetch overview data:",l)}a(!1)})()},[R,H]),W)return U.jsxDEV("div",{className:"text-center py-12 text-[var(--color-text-muted)]",children:"Loading..."},void 0,!1,void 0,this);let y=J.filter((Y)=>Y.enabled),T=J.filter((Y)=>!Y.enabled),P=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(bv,{label:"Active",value:y.length},void 0,!1,void 0,this),U.jsxDEV(bv,{label:"Disabled",value:T.length},void 0,!1,void 0,this),U.jsxDEV(bv,{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-[var(--color-text-secondary)] mb-3",children:["Subscriptions (",J.length,")"]},void 0,!0,void 0,this),J.length===0?U.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-6 text-center text-[var(--color-text-muted)] 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 A=P.get(Y.agent_id);return U.jsxDEV("div",{className:"bg-[var(--color-surface)] card 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-[var(--color-text-faint)]"}`},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-[var(--color-text-muted)]",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-[var(--color-text-secondary)] flex-shrink-0",children:[U.jsxDEV("span",{className:"text-[var(--color-text-faint)]",children:"→"},void 0,!1,void 0,this)," ",U.jsxDEV("span",{className:"text-[var(--color-accent)]",children:A?.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-[var(--color-surface-raised)] text-[var(--color-text-faint)]"}`,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 bv({label:R,value:H,valueColor:J}){return U.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4",children:[U.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mb-1",children:R},void 0,!1,void 0,this),U.jsxDEV("div",{className:`text-2xl font-bold ${J||"text-[var(--color-text)]"}`,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var $=O(Xv(),1);var i=O(I(),1);function lN({message:R="Loading...",fullScreen:H=!1}){let J=i.jsxDEV("div",{className:"flex items-center gap-3 text-[var(--color-text-muted)]",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-[var(--color-bg)] text-[var(--color-text)] 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 N=O(I(),1);function mN(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=$.useState([]),[Q,c]=$.useState(""),[W,a]=$.useState([]),[y,T]=$.useState(!0),[P,Y]=$.useState([]),[A,l]=$.useState([]),[S,G]=$.useState(!1),[w,k]=$.useState(""),[o,Fv]=$.useState(""),[RN,mv]=$.useState(!1),[B,fv]=$.useState(null),[_v,zN]=$.useState([]),[$v,lv]=$.useState(""),[Yv,Rv]=$.useState(!1),[r,Iv]=$.useState(""),[Zv,nv]=$.useState({}),[Pv,GN]=$.useState(""),[HN,qv]=$.useState(!1),[p,JN]=$.useState([]),[KN,kv]=$.useState(!1),[yv,UN]=$.useState([]),[Qv,XN]=$.useState([]),[s,Av]=$.useState(""),[t,Wv]=$.useState(""),[e,hv]=$.useState(""),[iv,av]=$.useState(!1),[Bv,zv]=$.useState({}),[Tv,YN]=$.useState(""),[Sv,Gv]=$.useState(!1),[Mv,pv]=$.useState(""),[uv,Hv]=$.useState(!1),[Ov,xv]=$.useState(""),[ZN,Jv]=$.useState(!1),[V,Lv]=$.useState(""),[Kv,wv]=$.useState(""),[cv,Vv]=$.useState(!1),[h,qN]=$.useState([]),[dv,Z]=$.useState(null),X=H&&H!=="unassigned"?`?project_id=${H}`:"",Ev=$.useCallback(async()=>{try{let v=await R(`/api/triggers/providers${X}`);if(v.ok){let f=((await v.json()).providers||[]).filter((_)=>_.connected);if(F(f),f.length>0)c((_)=>{if(!_||!f.find((K)=>K.id===_))return f[0].id;return _})}}catch(v){console.error("Failed to fetch providers:",v)}},[R]),u=$.useCallback(async()=>{T(!0);try{let v=`provider=${Q}`,m=X?"&":"?",f=X?`/api/triggers${X}&${v}`:`/api/triggers?${v}`,_=await R(f);if(_.ok){let K=await _.json();a(K.triggers||[])}}catch(v){console.error("Failed to fetch triggers:",v)}T(!1)},[R,X,Q]),vv=$.useCallback(async()=>{try{let v=await R(`/api/subscriptions${X}`);if(v.ok){let m=await v.json();Y(m.subscriptions||[])}}catch(v){console.error("Failed to fetch subscriptions:",v)}},[R,X]),Dv=$.useCallback(async()=>{try{let v=await R(`/api/agents${X}`);if(v.ok){let m=await v.json();qN(m.agents||[])}}catch(v){}},[R,X]);$.useEffect(()=>{Ev(),u(),vv(),Dv()},[Ev,u,vv,Dv]);let QN=async(v)=>{G(!0);try{let m=`/api/triggers/types?provider=${Q}`;if(v)m+=`&toolkit_slugs=${v}`;if(H&&H!=="unassigned")m+=`&project_id=${H}`;let f=await R(m);if(f.ok){let _=await f.json();l(_.types||[])}else{let _=await f.json();Z(_.error||"Failed to fetch trigger types")}}catch(m){Z("Failed to fetch trigger types")}G(!1)},WN=async()=>{try{let v=await R(`/api/integrations/${Q}/connected${X}`);if(v.ok){let m=await v.json();zN((m.accounts||[]).filter((f)=>f.status==="active"))}}catch(v){}},BN=(v)=>{fv(v),lv(""),Iv(""),nv({}),GN(""),mv(!0),WN()},b=Q==="agentdojo",MN=async()=>{qv(!0),Wv(""),Av(""),hv(""),zv({}),YN("");let v=async()=>{if(p.length>0)return;kv(!0);try{let _="/api/triggers/types?provider=agentdojo";if(H&&H!=="unassigned")_+=`&project_id=${H}`;let L=await(await R(_)).json();JN(L.types||[])}catch(_){console.error("Failed to load trigger types:",_)}kv(!1)},m=async()=>{try{let _=`/api/integrations/agentdojo/connected${X}`,q=((await(await R(_)).json()).accounts||[]).filter((E)=>E.status==="active");UN(q)}catch(_){console.error("Failed to load connected accounts:",_)}},f=async()=>{if(Qv.length>0)return;try{let _=`/api/integrations/agentdojo/apps${X}`,L=await(await R(_)).json();XN((L.apps||[]).map((q)=>({id:q.id,name:q.name,slug:q.slug,logo:q.logo})))}catch(_){console.error("Failed to load apps:",_)}};await Promise.all([v(),m(),f()])},ON=async()=>{let v=p.find((f)=>f.slug===t),m=Uv;if(!v||!e||!m)return;av(!0),Z(null);try{let f=h.find((FN)=>FN.id===e),_="provider=agentdojo",K=X?`/api/triggers${X}&provider=agentdojo`:"/api/triggers?provider=agentdojo",L={callback_url:`${window.location.origin}/api/webhooks/agentdojo`,title:`${v.name} → ${f?.name||"Agent"}`,server:v.toolkit_slug,agent_id:e,...Bv},q=await R(K,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:v.slug,connectedAccountId:m.id,config:L})}),E=await q.json();if(!q.ok)Z(E.error||"Failed to create subscription");else qv(!1),u()}catch(f){Z(f.message||"Failed to create subscription")}av(!1)},LN=async()=>{if(!B)return;if(b){if(!r||!Nv)return;Rv(!0),Z(null);try{let v=h.find((q)=>q.id===r),m=window.location.origin,f=`provider=${Q}`,_=X?`/api/triggers${X}&${f}`:`/api/triggers?${f}`,K=await R(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:Nv.id,config:{callback_url:`${m}/api/webhooks/agentdojo`,title:`${B.name} → ${v?.name||"Agent"}`,server:B.toolkit_slug,agent_id:r,...Zv}})}),L=await K.json();if(!K.ok)Z(L.error||"Failed to create subscription");else mv(!1),fv(null),u()}catch(v){Z(v.message||"Failed to create subscription")}Rv(!1);return}if(!$v)return;Rv(!0),Z(null);try{let v=`provider=${Q}`,m=X?`/api/triggers${X}&${v}`:`/api/triggers?${v}`,f=await R(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:$v})}),_=await f.json();if(!f.ok)Z(_.error||"Failed to create trigger");else mv(!1),fv(null),u()}catch(v){Z(v.message||"Failed to create trigger")}Rv(!1)},gv=async(v,m)=>{let f=m==="active"?"disable":"enable";try{let _=X?`&provider=${Q}`:`?provider=${Q}`,K=await R(`/api/triggers/${v}/${f}${X}${_}`,{method:"POST"});if(K.ok)u();else{let L=await K.json();Z(L.error||`Failed to ${f} trigger`)}}catch(_){Z(`Failed to ${f} trigger`)}},jv=async(v)=>{try{let m=X?`&provider=${Q}`:`?provider=${Q}`,f=await R(`/api/triggers/${v}${X}${m}`,{method:"DELETE"});if(f.ok)u();else{let _=await f.json();Z(_.error||"Failed to delete trigger")}}catch(m){Z("Failed to delete trigger")}},wN=async()=>{if(!V||!Kv)return;let v=W.find((m)=>m.id===V);if(!v)return;Vv(!0),Z(null);try{let m=await R("/api/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trigger_slug:v.trigger_slug,trigger_instance_id:v.id,agent_id:Kv,provider:Q,project_id:H&&H!=="unassigned"?H:null,public_url:window.location.origin})}),f=await m.json();if(!m.ok)Z(f.error||"Failed to create subscription");else Jv(!1),Lv(""),wv(""),vv()}catch(m){Z(m.message||"Failed to create subscription")}Vv(!1)},CN=async(v)=>{let m=v.enabled?"disable":"enable";try{if((await R(`/api/subscriptions/${v.id}/${m}`,{method:"POST"})).ok)vv()}catch(f){Z(`Failed to ${m} subscription`)}},bN=async(v)=>{try{if((await R(`/api/subscriptions/${v}`,{method:"DELETE"})).ok)vv()}catch(m){Z("Failed to delete subscription")}},Cv=A.filter((v)=>{if(!o)return!0;let m=o.toLowerCase();return v.name.toLowerCase().includes(m)||v.slug.toLowerCase().includes(m)||v.description.toLowerCase().includes(m)}),ov=(v,m)=>{if(!m||v.length===0)return null;let f=m.toLowerCase().replace(/[-_]/g," "),_=v.find((q)=>q.appId?.toLowerCase()===m.toLowerCase()||q.appName?.toLowerCase()===m.toLowerCase());if(_)return _;let K=v.find((q)=>q.appId?.toLowerCase().includes(f)||q.appName?.toLowerCase().replace(/[-_]/g," ").includes(f)||f.includes(q.appId?.toLowerCase()||"")||f.includes(q.appName?.toLowerCase().replace(/[-_]/g," ")||""));if(K)return K;let L=f.split(/\s+/);return v.find((q)=>{let E=(q.appName||"").toLowerCase().replace(/[-_]/g," ").split(/\s+/);return L[0]&&E[0]&&L[0]===E[0]})||null},M=p.find((v)=>v.slug===t),rv=M?ov(yv,M.toolkit_slug):null,Uv=Tv?yv.find((v)=>v.id===Tv)||rv:rv,sv=B&&b?ov(_v,B.toolkit_slug):null,Nv=Pv?_v.find((v)=>v.id===Pv)||sv:sv,tv=$.default.useMemo(()=>{let v=new Map;for(let f of Qv)if(f.logo)v.set(f.slug,f.logo);let m=new Map;for(let f of p){let _=m.get(f.toolkit_slug);if(_)_.count++;else{let K=v.get(f.toolkit_slug)||f.logo||null;m.set(f.toolkit_slug,{slug:f.toolkit_slug,name:f.toolkit_name,logo:K,count:1})}}return Array.from(m.values()).sort((f,_)=>f.name.localeCompare(_.name))},[p,Qv]),ev=s?p.filter((v)=>v.toolkit_slug===s):[],d=tv.find((v)=>v.slug===s),vN=new Map(h.map((v)=>[v.id,v]));if(J.length===0&&!y)return N.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-8 text-center",children:[N.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"No trigger providers configured."},void 0,!1,void 0,this),N.jsxDEV("p",{className:"text-sm text-[var(--color-text-faint)] 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 N.jsxDEV("div",{className:"space-y-6",children:[dv&&N.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:[N.jsxDEV("span",{children:dv},void 0,!1,void 0,this),N.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&&N.jsxDEV("div",{className:"flex items-center gap-2",children:[N.jsxDEV("span",{className:"text-xs text-[var(--color-text-muted)]",children:"Provider:"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex gap-1 bg-[var(--color-surface)] card p-0.5",children:J.map((v)=>N.jsxDEV("button",{onClick:()=>{c(v.id),l([]),k(""),Fv("")},className:`px-3 py-1 rounded text-xs font-medium transition ${Q===v.id?"bg-[var(--color-surface-raised)] text-white":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,children:v.name},v.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!b&&N.jsxDEV("section",{children:[N.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[N.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)]",children:["Subscriptions (",P.length,")"]},void 0,!0,void 0,this),N.jsxDEV("button",{onClick:()=>Jv(!0),className:"text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.length===0?N.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-6 text-center text-[var(--color-text-muted)] text-sm",children:"No subscriptions yet. Add one to route trigger events to an agent."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"space-y-2",children:P.map((v)=>{let m=vN.get(v.agent_id);return N.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-3 flex items-center gap-3",children:[N.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${v.enabled?"bg-green-400":"bg-[var(--color-text-muted)]"}`},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"text-sm font-medium truncate",children:[v.trigger_slug.replace(/_/g," "),N.jsxDEV("span",{className:"text-[var(--color-text-faint)] mx-1.5",children:"→"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[var(--color-accent)]",children:m?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:v.trigger_instance_id?`Instance: ${v.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[N.jsxDEV("button",{onClick:()=>CN(v),className:`text-xs px-3 py-1 rounded transition ${v.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:v.enabled?"Disable":"Enable"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>bN(v.id),className:"text-xs text-[var(--color-text-muted)] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},v.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!b&&N.jsxDEV("section",{children:[N.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3",children:["Trigger Instances (",W.length,")"]},void 0,!0,void 0,this),y?N.jsxDEV("div",{className:"text-center py-6 text-[var(--color-text-muted)] text-sm",children:"Loading triggers..."},void 0,!1,void 0,this):W.length===0?N.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-6 text-center text-[var(--color-text-muted)] text-sm",children:"No trigger instances. Browse trigger types below to create one."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"space-y-2",children:W.map((v)=>N.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-3 flex items-center gap-3",children:[N.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${v.status==="active"?"bg-green-400":"bg-[var(--color-text-muted)]"}`},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"text-sm font-medium truncate",children:v.trigger_slug.replace(/_/g," ")},void 0,!1,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:["ID: ",v.id.slice(0,12),"... | Created: ",new Date(v.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[N.jsxDEV("button",{onClick:()=>gv(v.id,v.status),className:`text-xs px-3 py-1 rounded transition ${v.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:v.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>jv(v.id),className:"text-xs text-[var(--color-text-muted)] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},v.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&N.jsxDEV("section",{children:[N.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[N.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)]",children:["Active Subscriptions (",W.length,")"]},void 0,!0,void 0,this),N.jsxDEV("button",{onClick:MN,className:"text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y?N.jsxDEV("div",{className:"text-center py-6 text-[var(--color-text-muted)] text-sm",children:"Loading subscriptions..."},void 0,!1,void 0,this):W.length===0?N.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-6 text-center text-[var(--color-text-muted)] text-sm",children:"No active subscriptions. Browse trigger types below to create one."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"space-y-2",children:W.map((v)=>{let m=P.find((_)=>_.trigger_instance_id===v.id),f=m?vN.get(m.agent_id):null;return N.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-3 flex items-center gap-3",children:[N.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${v.status==="active"?"bg-green-400":"bg-[var(--color-text-muted)]"}`},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"text-sm font-medium truncate",children:[v.config?.title||v.trigger_slug.replace(/_/g," "),f&&N.jsxDEV(N.Fragment,{children:[N.jsxDEV("span",{className:"text-[var(--color-text-faint)] mx-1.5",children:"→"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[var(--color-accent)]",children:f.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:[v.config?.server&&N.jsxDEV("span",{children:[String(v.config.server)," | "]},void 0,!0,void 0,this),"ID: ",String(v.id).slice(0,8)," | Created: ",new Date(v.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[N.jsxDEV("button",{onClick:()=>gv(v.id,v.status),className:`text-xs px-3 py-1 rounded transition ${v.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:v.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>jv(v.id),className:"text-xs text-[var(--color-text-muted)] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},v.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("section",{children:[N.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3",children:"Browse Trigger Types"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex gap-2 mb-3",children:[N.jsxDEV("input",{type:"text",value:w,onChange:(v)=>k(v.target.value),placeholder:"Toolkit filter (e.g. github, gmail, slack)",className:"flex-1 bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:()=>QN(w||void 0),disabled:S,className:"text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-4 py-2 rounded transition disabled:opacity-50",children:S?"Loading...":"Browse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A.length>0&&N.jsxDEV(N.Fragment,{children:[N.jsxDEV("input",{type:"text",value:o,onChange:(v)=>Fv(v.target.value),placeholder:"Search trigger types...",className:"w-full bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm mb-3 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Cv.slice(0,30).map((v)=>N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border)] hover:border-[var(--color-border-light)] rounded-lg p-3 transition",children:[N.jsxDEV("div",{className:"flex items-start gap-3",children:[v.logo?N.jsxDEV("img",{src:v.logo,alt:v.toolkit_name,className:"w-8 h-8 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):N.jsxDEV("div",{className:"w-8 h-8 rounded bg-[var(--color-surface-raised)] flex items-center justify-center text-xs flex-shrink-0",children:v.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"text-sm font-medium truncate",children:v.name},void 0,!1,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)]",children:v.toolkit_name},void 0,!1,void 0,this),N.jsxDEV("div",{className:"text-xs text-[var(--color-text-faint)] mt-1 line-clamp-2",children:v.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("button",{onClick:()=>BN(v),className:"w-full mt-3 text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-3 py-1.5 rounded transition",children:b?"Subscribe":"Create Trigger"},void 0,!1,void 0,this)]},v.slug,!0,void 0,this))},void 0,!1,void 0,this),Cv.length>30&&N.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-3 text-center",children:["Showing first 30 of ",Cv.length," types. Use search to filter."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),RN&&B&&N.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-md mx-4",children:[N.jsxDEV("h3",{className:"font-medium mb-1",children:b?"Create Subscription":"Create Trigger"},void 0,!1,void 0,this),N.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] mb-4",children:[B.name,B.toolkit_name&&N.jsxDEV("span",{className:"text-[var(--color-text-faint)]",children:[" (",B.toolkit_name,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"space-y-4",children:[!b&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),_v.length===0?N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg)] rounded p-3",children:"No connected accounts available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):N.jsxDEV(x,{value:$v,onChange:lv,placeholder:"Select account...",options:_v.map((v)=>({value:v.id,label:`${v.appName} (${v.id.slice(0,8)}...)`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Route to Agent"},void 0,!1,void 0,this),h.length===0?N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg)] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):N.jsxDEV(x,{value:r,onChange:Iv,placeholder:"Select agent...",options:h.map((v)=>({value:v.id,label:`${v.name} (${v.status})`}))},void 0,!1,void 0,this),N.jsxDEV("div",{className:"mt-3",children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),Nv?N.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",Nv.appName]},void 0,!0,void 0,this):N.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&&N.jsxDEV("div",{className:"mt-3",children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"space-y-2",children:Object.entries(B.config_schema.properties||{}).map(([v,m])=>{let f=(B.config_schema.required||[]).includes(v);return N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-[11px] text-[var(--color-text-secondary)] mb-1",children:[m.title||v,f&&N.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("input",{type:"text",value:Zv[v]||"",onChange:(_)=>nv((K)=>({...K,[v]:_.target.value})),placeholder:m.description||`Enter ${m.title||v}...`,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},v,!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),N.jsxDEV("div",{className:"flex gap-2 mt-4",children:[N.jsxDEV("button",{onClick:()=>{mv(!1),fv(null)},className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:LN,disabled:b?!r||!Nv||Yv||B?.config_schema&&(B.config_schema.required||[]).some((v)=>!Zv[v]?.trim()):!$v||Yv,className:"flex-1 text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition disabled:opacity-50",children:Yv?"Creating...":b?"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),ZN&&N.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-md mx-4",children:[N.jsxDEV("h3",{className:"font-medium mb-1",children:"Route Trigger to Agent"},void 0,!1,void 0,this),N.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] 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?N.jsxDEV(N.Fragment,{children:[N.jsxDEV("div",{className:"space-y-4",children:[N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Trigger Instance"},void 0,!1,void 0,this),N.jsxDEV(x,{value:V,onChange:Lv,placeholder:"Select trigger...",options:W.map((v)=>({value:v.id,label:`${v.trigger_slug.replace(/_/g," ")}`}))},void 0,!1,void 0,this),V&&N.jsxDEV("div",{className:"text-xs text-[var(--color-text-faint)] mt-1 font-mono",children:["ID: ",V.slice(0,16),"..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),N.jsxDEV(x,{value:Kv,onChange:wv,placeholder:"Select agent...",options:h.map((v)=>({value:v.id,label:`${v.name} (${v.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex gap-2 mt-5",children:[N.jsxDEV("button",{onClick:()=>{Jv(!1),Lv(""),wv("")},className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:wN,disabled:!V||!Kv||cv,className:"flex-1 text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition disabled:opacity-50",children:cv?"Adding...":"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):N.jsxDEV("div",{className:"flex gap-2 mt-4",children:N.jsxDEV("button",{onClick:()=>Jv(!1),className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] 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),HN&&N.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:N.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-lg mx-4",children:[N.jsxDEV("h3",{className:"font-medium mb-1",children:"Add Subscription"},void 0,!1,void 0,this),N.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] mb-4",children:"Select an app and trigger, then route it to an agent."},void 0,!1,void 0,this),KN?N.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)] text-sm",children:"Loading..."},void 0,!1,void 0,this):p.length===0?N.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)] text-sm",children:"No triggers available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):N.jsxDEV("div",{className:"space-y-4",children:[N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"App"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"relative",children:[N.jsxDEV("button",{onClick:()=>{Gv(!Sv),Hv(!1),pv("")},className:"w-full flex items-center gap-2 bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm text-left hover:border-[var(--color-text-faint)] transition",children:[d?N.jsxDEV(N.Fragment,{children:[d.logo?N.jsxDEV("img",{src:d.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):N.jsxDEV("div",{className:"w-5 h-5 rounded bg-[var(--color-surface-raised)] flex items-center justify-center text-[10px] flex-shrink-0",children:d.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1 truncate",children:d.name},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[d.count," triggers"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):N.jsxDEV("span",{className:"text-[var(--color-text-muted)] flex-1",children:"Select app..."},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[var(--color-text-muted)] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Sv&&N.jsxDEV(N.Fragment,{children:[N.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>Gv(!1)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[N.jsxDEV("div",{className:"p-2 border-b border-[var(--color-border)] flex-shrink-0",children:N.jsxDEV("input",{type:"text",value:Mv,onChange:(v)=>pv(v.target.value),placeholder:"Search apps...",className:"w-full bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[var(--color-accent)]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"overflow-y-auto flex-1",children:tv.filter((v)=>{if(!Mv)return!0;let m=Mv.toLowerCase();return v.name.toLowerCase().includes(m)||v.slug.toLowerCase().includes(m)}).map((v)=>N.jsxDEV("button",{onClick:()=>{Av(v.slug),Wv(""),zv({}),Gv(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[var(--color-surface-raised)] ${s===v.slug?"bg-[var(--color-surface-raised)] text-[var(--color-accent)]":""}`,children:[v.logo?N.jsxDEV("img",{src:v.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):N.jsxDEV("div",{className:"w-5 h-5 rounded bg-[var(--color-surface-raised)] flex items-center justify-center text-[10px] flex-shrink-0",children:v.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),N.jsxDEV("span",{className:"flex-1 truncate",children:v.name},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:v.count},void 0,!1,void 0,this)]},v.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&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Trigger"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"relative",children:[N.jsxDEV("button",{onClick:()=>{Hv(!uv),Gv(!1),xv("")},className:"w-full flex items-center gap-2 bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm text-left hover:border-[var(--color-text-faint)] transition",children:[M?N.jsxDEV(N.Fragment,{children:[N.jsxDEV("span",{className:"flex-1 truncate",children:M.name},void 0,!1,void 0,this),N.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):N.jsxDEV("span",{className:"text-[var(--color-text-muted)] flex-1",children:"Select trigger..."},void 0,!1,void 0,this),N.jsxDEV("span",{className:"text-[var(--color-text-muted)] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),uv&&N.jsxDEV(N.Fragment,{children:[N.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>Hv(!1)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[ev.length>3&&N.jsxDEV("div",{className:"p-2 border-b border-[var(--color-border)] flex-shrink-0",children:N.jsxDEV("input",{type:"text",value:Ov,onChange:(v)=>xv(v.target.value),placeholder:"Search triggers...",className:"w-full bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[var(--color-accent)]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),N.jsxDEV("div",{className:"overflow-y-auto flex-1",children:ev.filter((v)=>{if(!Ov)return!0;let m=Ov.toLowerCase();return v.name.toLowerCase().includes(m)||v.slug.toLowerCase().includes(m)||v.description.toLowerCase().includes(m)}).map((v)=>N.jsxDEV("button",{onClick:()=>{Wv(v.slug),zv({}),Hv(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[var(--color-surface-raised)] ${t===v.slug?"bg-[var(--color-surface-raised)] text-[var(--color-accent)]":""}`,children:[N.jsxDEV("div",{className:"flex-1 min-w-0",children:[N.jsxDEV("div",{className:"truncate",children:v.name},void 0,!1,void 0,this),N.jsxDEV("div",{className:"text-[10px] text-[var(--color-text-muted)] truncate",children:v.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${v.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:v.type},void 0,!1,void 0,this)]},v.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&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),Uv?N.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",Uv.appName]},void 0,!0,void 0,this):N.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&&N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),N.jsxDEV("div",{className:"space-y-2",children:Object.entries(M.config_schema.properties||{}).map(([v,m])=>{let f=(M.config_schema.required||[]).includes(v);return N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-[11px] text-[var(--color-text-secondary)] mb-1",children:[m.title||v,f&&N.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("input",{type:"text",value:Bv[v]||"",onChange:(_)=>zv((K)=>({...K,[v]:_.target.value})),placeholder:m.description||`Enter ${m.title||v}...`,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},v,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{children:[N.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),h.length===0?N.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg)] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):N.jsxDEV(x,{value:e,onChange:hv,placeholder:"Select agent...",options:h.map((v)=>({value:v.id,label:`${v.name} (${v.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),N.jsxDEV("div",{className:"flex gap-2 mt-5",children:[N.jsxDEV("button",{onClick:()=>qv(!1),className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),N.jsxDEV("button",{onClick:ON,disabled:!t||!e||!Uv||iv||M?.config_schema&&(M.config_schema.required||[]).some((v)=>!Bv[v]?.trim()),className:"flex-1 text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition disabled:opacity-50",children:iv?"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 n=O(Xv(),1);var z=O(I(),1);function _N(){let{authFetch:R}=g(),{currentProjectId:H}=j(),J=H&&H!=="unassigned"?H:null,F=J?`?project_id=${J}`:"",[Q,c]=n.useState([]),[W,a]=n.useState("");n.useEffect(()=>{R(`/api/triggers/providers${F}`).then((G)=>G.json()).then((G)=>{let w=(G.providers||[]).filter((k)=>k.connected);if(c(w),w.length>0&&!w.find((k)=>k.id===W))a(w[0].id)}).catch(()=>{})},[R]);let[y,T]=n.useState(null),[P,Y]=n.useState([]),[A,l]=n.useState(!1),S=n.useCallback(async(G)=>{T(G),l(!0);try{let w=`/api/triggers/types?provider=${W}&toolkit_slugs=${G}`;if(J)w+=`&project_id=${J}`;let k=await R(w);if(k.ok){let o=await k.json();Y(o.types||[])}}catch(w){console.error("Failed to fetch trigger types:",w)}l(!1)},[R,J,W]);return z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] 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-[var(--color-text-muted)]",children:"Provider:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-1 bg-[var(--color-surface)] card p-0.5",children:Q.map((G)=>z.jsxDEV("button",{onClick:()=>a(G.id),className:`px-3 py-1 rounded text-xs font-medium transition ${W===G.id?"bg-[var(--color-surface-raised)] text-white":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,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-[var(--color-surface)] card p-8 text-center",children:[z.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"No integration providers configured."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[var(--color-text-faint)] 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(fN,{providerId:W,projectId:J,hideMcpConfig:!0,onBrowseTriggers:S},void 0,!1,void 0,this),y&&z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:z.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] 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-[var(--color-border)] 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-[var(--color-text-muted)]",children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>{T(null),Y([])},className:"text-[var(--color-text-muted)] 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:A?z.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)]",children:"Loading trigger types..."},void 0,!1,void 0,this):P.length===0?z.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)]",children:"No trigger types available for this app."},void 0,!1,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:P.map((G)=>z.jsxDEV("div",{className:"bg-[var(--color-bg)] card 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-[var(--color-surface-raised)] 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-[var(--color-text-muted)] 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-[var(--color-surface-raised)] text-[var(--color-text-faint)] 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 C=O(I(),1);function J0(){let[R,H]=$N.useState("overview");return C.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:C.jsxDEV("div",{className:"max-w-6xl",children:[C.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:C.jsxDEV("div",{children:[C.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Connections"},void 0,!1,void 0,this),C.jsxDEV("p",{className:"text-[var(--color-text-muted)]",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),C.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[var(--color-surface)] card p-1 w-fit",children:[{id:"overview",label:"Overview"},{id:"triggers",label:"Triggers"},{id:"integrations",label:"Integrations"}].map((F)=>C.jsxDEV("button",{onClick:()=>H(F.id),className:`px-4 py-2 rounded text-sm font-medium transition ${R===F.id?"bg-[var(--color-surface-raised)] text-white":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,children:F.label},F.id,!1,void 0,this))},void 0,!1,void 0,this),R==="overview"&&C.jsxDEV(NN,{},void 0,!1,void 0,this),R==="triggers"&&C.jsxDEV(mN,{},void 0,!1,void 0,this),R==="integrations"&&C.jsxDEV(_N,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
-
export{lN as a,J0 as b};
|
|
3
|
-
|
|
4
|
-
//# debugId=E4657919D3AE33E964756E2164756E21
|
package/dist/App.9tctxzqm.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{Y as $,Z as U,aa as P}from"./App.yt9p4nr3.js";var I=U((C)=>{var Y=$(P());(function(){function z(){}function K(q){return""+q}function L(q,A,w){var M=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;try{K(M);var Q=!1}catch(X){Q=!0}return Q&&(console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",typeof Symbol==="function"&&Symbol.toStringTag&&M[Symbol.toStringTag]||M.constructor.name||"Object"),K(M)),{$$typeof:J,key:M==null?null:""+M,children:q,containerInfo:A,implementation:w}}function B(q,A){if(q==="font")return"";if(typeof A==="string")return A==="use-credentials"?A:""}function G(q){return q===null?"`null`":q===void 0?"`undefined`":q===""?"an empty string":'something with type "'+typeof q+'"'}function N(q){return q===null?"`null`":q===void 0?"`undefined`":q===""?"an empty string":typeof q==="string"?JSON.stringify(q):typeof q==="number"?"`"+q+"`":'something with type "'+typeof q+'"'}function Z(){var q=R.H;return q===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:
|
|
2
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
3
|
-
2. You might be breaking the Rules of Hooks
|
|
4
|
-
3. You might have more than one copy of React in the same app
|
|
5
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),q}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var H={d:{f:z,r:function(){throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.")},D:z,C:z,L:z,m:z,X:z,S:z,M:z},p:0,findDOMNode:null},J=Symbol.for("react.portal"),R=Y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;typeof Map==="function"&&Map.prototype!=null&&typeof Map.prototype.forEach==="function"&&typeof Set==="function"&&Set.prototype!=null&&typeof Set.prototype.clear==="function"&&typeof Set.prototype.forEach==="function"||console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),C.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,C.createPortal=function(q,A){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!A||A.nodeType!==1&&A.nodeType!==9&&A.nodeType!==11)throw Error("Target container is not a DOM element.");return L(q,A,null,w)},C.flushSync=function(q){var A=R.T,w=H.p;try{if(R.T=null,H.p=2,q)return q()}finally{R.T=A,H.p=w,H.d.f()&&console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.")}},C.preconnect=function(q,A){typeof q==="string"&&q?A!=null&&typeof A!=="object"?console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",N(A)):A!=null&&typeof A.crossOrigin!=="string"&&console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",G(A.crossOrigin)):console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",G(q)),typeof q==="string"&&(A?(A=A.crossOrigin,A=typeof A==="string"?A==="use-credentials"?A:"":void 0):A=null,H.d.C(q,A))},C.prefetchDNS=function(q){if(typeof q!=="string"||!q)console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",G(q));else if(1<arguments.length){var A=arguments[1];typeof A==="object"&&A.hasOwnProperty("crossOrigin")?console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",N(A)):console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",N(A))}typeof q==="string"&&H.d.D(q)},C.preinit=function(q,A){if(typeof q==="string"&&q?A==null||typeof A!=="object"?console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",N(A)):A.as!=="style"&&A.as!=="script"&&console.error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',N(A.as)):console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",G(q)),typeof q==="string"&&A&&typeof A.as==="string"){var w=A.as,M=B(w,A.crossOrigin),Q=typeof A.integrity==="string"?A.integrity:void 0,X=typeof A.fetchPriority==="string"?A.fetchPriority:void 0;w==="style"?H.d.S(q,typeof A.precedence==="string"?A.precedence:void 0,{crossOrigin:M,integrity:Q,fetchPriority:X}):w==="script"&&H.d.X(q,{crossOrigin:M,integrity:Q,fetchPriority:X,nonce:typeof A.nonce==="string"?A.nonce:void 0})}},C.preinitModule=function(q,A){var w="";if(typeof q==="string"&&q||(w+=" The `href` argument encountered was "+G(q)+"."),A!==void 0&&typeof A!=="object"?w+=" The `options` argument encountered was "+G(A)+".":A&&("as"in A)&&A.as!=="script"&&(w+=" The `as` option encountered was "+N(A.as)+"."),w)console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",w);else switch(w=A&&typeof A.as==="string"?A.as:"script",w){case"script":break;default:w=N(w),console.error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',w,q)}if(typeof q==="string")if(typeof A==="object"&&A!==null){if(A.as==null||A.as==="script")w=B(A.as,A.crossOrigin),H.d.M(q,{crossOrigin:w,integrity:typeof A.integrity==="string"?A.integrity:void 0,nonce:typeof A.nonce==="string"?A.nonce:void 0})}else A==null&&H.d.M(q)},C.preload=function(q,A){var w="";if(typeof q==="string"&&q||(w+=" The `href` argument encountered was "+G(q)+"."),A==null||typeof A!=="object"?w+=" The `options` argument encountered was "+G(A)+".":typeof A.as==="string"&&A.as||(w+=" The `as` option encountered was "+G(A.as)+"."),w&&console.error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',w),typeof q==="string"&&typeof A==="object"&&A!==null&&typeof A.as==="string"){w=A.as;var M=B(w,A.crossOrigin);H.d.L(q,w,{crossOrigin:M,integrity:typeof A.integrity==="string"?A.integrity:void 0,nonce:typeof A.nonce==="string"?A.nonce:void 0,type:typeof A.type==="string"?A.type:void 0,fetchPriority:typeof A.fetchPriority==="string"?A.fetchPriority:void 0,referrerPolicy:typeof A.referrerPolicy==="string"?A.referrerPolicy:void 0,imageSrcSet:typeof A.imageSrcSet==="string"?A.imageSrcSet:void 0,imageSizes:typeof A.imageSizes==="string"?A.imageSizes:void 0,media:typeof A.media==="string"?A.media:void 0})}},C.preloadModule=function(q,A){var w="";typeof q==="string"&&q||(w+=" The `href` argument encountered was "+G(q)+"."),A!==void 0&&typeof A!=="object"?w+=" The `options` argument encountered was "+G(A)+".":A&&("as"in A)&&typeof A.as!=="string"&&(w+=" The `as` option encountered was "+G(A.as)+"."),w&&console.error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',w),typeof q==="string"&&(A?(w=B(A.as,A.crossOrigin),H.d.m(q,{as:typeof A.as==="string"&&A.as!=="script"?A.as:void 0,crossOrigin:w,integrity:typeof A.integrity==="string"?A.integrity:void 0})):H.d.m(q))},C.requestFormReset=function(q){H.d.r(q)},C.unstable_batchedUpdates=function(q,A){return q(A)},C.useFormState=function(q,A,w){return Z().useFormState(q,A,w)},C.useFormStatus=function(){return Z().useHostTransitionStatus()},C.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var _=U((g,T)=>{var S=$(I());T.exports=S});function v(z){var K,L,B="";if(typeof z=="string"||typeof z=="number")B+=z;else if(typeof z=="object")if(Array.isArray(z)){var G=z.length;for(K=0;K<G;K++)z[K]&&(L=v(z[K]))&&(B&&(B+=" "),B+=L)}else for(L in z)z[L]&&(B&&(B+=" "),B+=L);return B}function f(){for(var z,K,L=0,B="",G=arguments.length;L<G;L++)(z=arguments[L])&&(K=v(z))&&(B&&(B+=" "),B+=K);return B}
|
|
6
|
-
export{_ as W,f as X};
|
|
7
|
-
|
|
8
|
-
//# debugId=2BA55B82AC99F89464756E2164756E21
|
package/dist/App.a8r8ttaz.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{Y as c,aa as Rq,ba as Gq,ka as Jq}from"./App.yt9p4nr3.js";var Q=c(Rq(),1);var q=c(Gq(),1);function C(H){return H.authSchemes.some((J)=>J.toUpperCase()==="API_KEY")}function Qq(H){return H.authSchemes.some((J)=>J.toUpperCase()==="OAUTH2")}function Lq(H){return C(H)&&Qq(H)}function wq({providerId:H="composio",projectId:J,onConnectionComplete:U,onBrowseTriggers:F,hideMcpConfig:y}){let{authFetch:Z}=Jq(),[A,I]=Q.useState([]),[k,P]=Q.useState([]),[S,h]=Q.useState(!0),[R,Wq]=Q.useState(""),[g,O]=Q.useState(null),[b,D]=Q.useState(null),[s,_]=Q.useState(null),[L,M]=Q.useState(null),[X,w]=Q.useState(null),[f,u]=Q.useState(""),[V,x]=Q.useState({}),[T,E]=Q.useState(null),[v,n]=Q.useState(""),[o,l]=Q.useState(!1),[t,j]=Q.useState(null),[r,i]=Q.useState(null),N=Q.useCallback(async()=>{h(!0),_(null);let z=J&&J!=="unassigned"?`?project_id=${J}`:"";try{let[G,W]=await Promise.all([Z(`/api/integrations/${H}/apps${z}`),Z(`/api/integrations/${H}/connected${z}`)]),Y=await G.json(),$=await W.json();I(Y.apps||[]),P($.accounts||[])}catch(G){console.error("Failed to fetch integrations:",G),_("Failed to load integrations")}h(!1)},[Z,H,J]);Q.useEffect(()=>{N()},[N]),Q.useEffect(()=>{if(new URLSearchParams(window.location.search).get("connected"))window.history.replaceState({},"",window.location.pathname),N(),U?.()},[N,U]),Q.useEffect(()=>{if(!b?.connectionId)return;let z=J&&J!=="unassigned"?`?project_id=${J}`:"",G=setInterval(async()=>{try{let Y=await(await Z(`/api/integrations/${H}/connection/${b.connectionId}${z}`)).json();if(Y.connection?.status==="active")D(null),O(null),N(),U?.();else if(Y.connection?.status==="failed")D(null),O(null),_(`Connection to ${b.appSlug} failed`)}catch(W){}},2000);return()=>clearInterval(G)},[b,Z,H,J,N,U]);let m=async(z,G,W,Y)=>{if(Lq(z)&&!G&&!Y&&!W){M({app:z});return}if(C(z)&&!G&&!Y&&!W){w({app:z}),u(""),x({});return}O(z.slug),_(null);try{let $={appSlug:z.slug};if(Y&&Object.keys(Y).length>0)$.credentials={authScheme:"API_KEY",fields:Y};else if(G)$.credentials={authScheme:"API_KEY",apiKey:G};let kq=J&&J!=="unassigned"?`?project_id=${J}`:"",qq=await Z(`/api/integrations/${H}/connect${kq}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),B=await qq.json();if(!qq.ok){_(B.error||"Failed to initiate connection"),O(null),w(null);return}if(B.status==="active"||!B.redirectUrl){O(null),w(null),N(),U?.();return}if(B.redirectUrl){D({appSlug:z.slug,connectionId:B.connectionId});let zq=window.open(B.redirectUrl,`connect-${z.slug}`,"width=600,height=700,left=200,top=100");if(!zq||zq.closed)window.location.href=B.redirectUrl}}catch($){_(`Failed to connect: ${$}`),O(null),w(null)}},Xq=(z)=>{if(z.preventDefault(),!X)return;if(X.app.credentialFields&&X.app.credentialFields.length>0){if(!X.app.credentialFields.filter(($)=>$.required!==!1).every(($)=>V[$.name]?.trim()))return;m(X.app,void 0,!1,V)}else{if(!f.trim())return;m(X.app,f.trim())}},Yq=async(z)=>{let G=J&&J!=="unassigned"?`?project_id=${J}`:"";try{let W=await Z(`/api/integrations/${H}/connection/${z.id}${G}`,{method:"DELETE"});if(W.ok)N();else{let Y=await W.json();_(Y.error||"Failed to disconnect")}}catch(W){_(`Failed to disconnect: ${W}`)}},Zq=(z)=>{E({app:z}),n(`${z.name} MCP`),j(null)},_q=async()=>{if(!T||!v.trim())return;l(!0),_(null);try{let z=J&&J!=="unassigned"?`?project_id=${J}`:"",G=await Z(`/api/integrations/${H}/configs${z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:v.replace(/[^a-zA-Z0-9\s-]/g,"").substring(0,30),toolkitSlug:T.app.slug})}),W=await G.json();if(!G.ok){_(W.error||"Failed to create MCP config"),l(!1);return}let Y=!1;if(W.config?.id)try{Y=(await Z(`/api/integrations/${H}/configs/${W.config.id}/add${z}`,{method:"POST"})).ok}catch{}j(v),U?.()}catch(z){_(`Failed to create MCP config: ${z}`)}finally{l(!1)}},$q=(z)=>{i({message:`Disconnect ${z.appName}?`,onConfirm:()=>{Yq(z),i(null)}})},a=(z)=>{return k.some((G)=>G.status==="active"&&(G.appId===z.slug||z.providerSlug&&G.appId===z.providerSlug))},p=(z)=>{return k.find((G)=>G.appId===z.slug&&G.status==="active")||z.providerSlug&&k.find((G)=>G.appId===z.providerSlug&&G.status==="active")||k.find((G)=>G.appId===z.slug)||z.providerSlug&&k.find((G)=>G.appId===z.providerSlug)||void 0},e=A.filter((z)=>{if(!R)return!0;let G=R.toLowerCase();return z.name.toLowerCase().includes(G)||z.slug.toLowerCase().includes(G)||z.description?.toLowerCase().includes(G)||z.categories.some((W)=>W.toLowerCase().includes(G))}),d=e.filter((z)=>a(z)),K=e.filter((z)=>!a(z));if(S)return q.jsxDEV("div",{className:"text-center py-8 text-[var(--color-text-muted)]",children:"Loading apps..."},void 0,!1,void 0,this);return q.jsxDEV("div",{className:"space-y-6",children:[L&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:q.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-md mx-4",children:[q.jsxDEV("div",{className:"flex items-center gap-3 mb-4",children:[L.app.logo&&q.jsxDEV("img",{src:L.app.logo,alt:L.app.name,className:"w-10 h-10 object-contain"},void 0,!1,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium",children:["Connect ",L.app.name]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)]",children:"Choose how to authenticate"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"space-y-3",children:[q.jsxDEV("button",{onClick:()=>{M(null),w({app:L.app}),u(""),x({})},className:"w-full text-left p-3 bg-[var(--color-bg)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] rounded-lg transition",children:[q.jsxDEV("div",{className:"font-medium text-sm",children:"API Key"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:["Enter your ",L.app.name," API key directly"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{M(null),m(L.app,void 0,!0)},className:"w-full text-left p-3 bg-[var(--color-bg)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] rounded-lg transition",children:[q.jsxDEV("div",{className:"font-medium text-sm",children:"OAuth"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[var(--color-text-muted)] mt-0.5",children:["Sign in with your ",L.app.name," account"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>M(null),className:"w-full text-sm text-[var(--color-text-muted)] hover:text-white mt-4 py-2 transition",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),X&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:q.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-md mx-4",children:[q.jsxDEV("div",{className:"flex items-center gap-3 mb-4",children:[X.app.logo&&q.jsxDEV("img",{src:X.app.logo,alt:X.app.name,className:"w-10 h-10 object-contain"},void 0,!1,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium",children:["Connect ",X.app.name]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)]",children:X.app.credentialFields?.length?"Enter your credentials to connect":"Enter your API key to connect"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("form",{onSubmit:Xq,children:[X.app.credentialFields&&X.app.credentialFields.length>0?q.jsxDEV("div",{className:"space-y-3 mb-4",children:X.app.credentialFields.map((z,G)=>q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1",children:[z.name.replace(/([A-Z])/g," $1").replace(/[-_]/g," ").replace(/\b\w/g,(W)=>W.toUpperCase()).trim(),z.required!==!1&&q.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.description&&q.jsxDEV("p",{className:"text-[10px] text-[var(--color-text-faint)] mb-1",children:z.description},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:V[z.name]||"",onChange:(W)=>x((Y)=>({...Y,[z.name]:W.target.value})),placeholder:`Enter ${z.name}...`,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded-lg px-4 py-2 focus:outline-none focus:border-[var(--color-accent)]",autoFocus:G===0},void 0,!1,void 0,this)]},z.name,!0,void 0,this))},void 0,!1,void 0,this):q.jsxDEV("input",{type:"password",value:f,onChange:(z)=>u(z.target.value),placeholder:"Enter API Key...",className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded-lg px-4 py-2 mb-4 focus:outline-none focus:border-[var(--color-accent)]",autoFocus:!0},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{type:"button",onClick:()=>w(null),className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{type:"submit",disabled:g===X.app.slug||(X.app.credentialFields?.length?!X.app.credentialFields.filter((z)=>z.required!==!1).every((z)=>V[z.name]?.trim()):!f.trim()),className:"flex-1 text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition disabled:opacity-50",children:g===X.app.slug?"Connecting...":"Connect"},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),T&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:q.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-md mx-4",children:t?q.jsxDEV(q.Fragment,{children:[q.jsxDEV("div",{className:"text-center mb-4",children:[q.jsxDEV("div",{className:"w-12 h-12 bg-green-500/20 rounded-full flex items-center justify-center mx-auto mb-3",children:q.jsxDEV("span",{className:"text-green-400 text-2xl",children:"✓"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("h3",{className:"font-medium text-lg",children:"MCP Config Created!"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mt-2",children:['"',t,'" has been created and added to your servers.']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{E(null),j(null)},className:"w-full text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition",children:"Done"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV(q.Fragment,{children:[q.jsxDEV("div",{className:"flex items-center gap-3 mb-4",children:[T.app.logo&&q.jsxDEV("img",{src:T.app.logo,alt:T.app.name,className:"w-10 h-10 object-contain"},void 0,!1,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium",children:"Create MCP Config"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)]",children:["Create an MCP config for ",T.app.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("form",{onSubmit:(z)=>{z.preventDefault(),_q()},children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1",children:"Config Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:v,onChange:(z)=>n(z.target.value),placeholder:"Enter config name...",className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded-lg px-4 py-2 mb-4 focus:outline-none focus:border-[var(--color-accent)]",autoFocus:!0,maxLength:30},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{type:"button",onClick:()=>E(null),className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{type:"submit",disabled:!v.trim()||o,className:"flex-1 text-sm bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-white px-4 py-2 rounded transition disabled:opacity-50",children:o?"Creating...":"Create Config"},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)},void 0,!1,void 0,this),r&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:q.jsxDEV("div",{className:"bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg p-6 w-full max-w-sm mx-4",children:[q.jsxDEV("p",{className:"text-center mb-4",children:r.message},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:()=>i(null),className:"flex-1 text-sm bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:r.onConfirm,className:"flex-1 text-sm bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded transition",children:"Confirm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),s&&q.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:[q.jsxDEV("span",{children:s},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>_(null),className:"text-red-400 hover:text-red-300",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&q.jsxDEV("div",{className:"text-yellow-400 text-sm p-3 bg-yellow-500/10 border border-yellow-500/20 rounded-lg flex items-center gap-2",children:[q.jsxDEV("span",{className:"animate-spin",children:"⟳"},void 0,!1,void 0,this),q.jsxDEV("span",{children:["Waiting for ",b.appSlug," authorization..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:q.jsxDEV("input",{type:"text",value:R,onChange:(z)=>Wq(z.target.value),placeholder:"Search apps...",className:"w-full bg-[var(--color-surface)] border border-[var(--color-border-light)] rounded-lg px-4 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),d.length>0&&q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3",children:["Connected (",d.length,")"]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d.map((z)=>q.jsxDEV(Hq,{app:z,connection:p(z),onConnect:()=>m(z),onDisconnect:()=>{let G=p(z);if(G)$q(G)},onCreateMcpConfig:y?void 0:()=>Zq(z),onBrowseTriggers:F?()=>F(z.slug):void 0,onUpdateKey:C(z)?()=>{w({app:z}),u(""),x({})}:void 0,connecting:g===z.slug},z.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3",children:["Available Apps (",K.length,")"]},void 0,!0,void 0,this),K.length===0?q.jsxDEV("p",{className:"text-[var(--color-text-muted)] text-sm",children:R?"No apps match your search":"No apps available"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:K.slice(0,50).map((z)=>q.jsxDEV(Hq,{app:z,onConnect:()=>m(z),connecting:g===z.slug},z.id,!1,void 0,this))},void 0,!1,void 0,this),K.length>50&&q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-3 text-center",children:["Showing first 50 of ",K.length," apps. Use search to find more."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Hq({app:H,connection:J,onConnect:U,onDisconnect:F,onCreateMcpConfig:y,onBrowseTriggers:Z,onUpdateKey:A,connecting:I}){let k=J?.status==="active",P=C(H),S=Qq(H),h=P&&S;return q.jsxDEV("div",{className:`bg-[var(--color-surface)] border rounded-lg p-3 transition ${k?"border-green-500/30":"border-[var(--color-border)] hover:border-[var(--color-border-light)]"}`,children:[q.jsxDEV("div",{className:"flex items-start gap-3",children:[q.jsxDEV("div",{className:"w-10 h-10 rounded bg-[var(--color-surface-raised)] flex items-center justify-center flex-shrink-0 overflow-hidden",children:H.logo?q.jsxDEV("img",{src:H.logo,alt:H.name,className:"w-8 h-8 object-contain",onError:(R)=>{R.target.style.display="none"}},void 0,!1,void 0,this):q.jsxDEV("span",{className:"text-lg",children:H.name[0]?.toUpperCase()},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("h4",{className:"font-medium text-sm truncate",children:H.name},void 0,!1,void 0,this),k&&q.jsxDEV("span",{className:"text-xs text-green-400",children:"✓"},void 0,!1,void 0,this),!k&&P&&!S&&q.jsxDEV("span",{className:"text-[10px] bg-[var(--color-surface-raised)] text-[var(--color-text-secondary)] px-1.5 py-0.5 rounded",title:"Requires API Key",children:"API Key"},void 0,!1,void 0,this),!k&&h&&q.jsxDEV("span",{className:"text-[10px] bg-[#1a2a1a] text-[#6a6] px-1.5 py-0.5 rounded",title:"Supports API Key or OAuth",children:"API Key / OAuth"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.description&&q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] line-clamp-2 mt-0.5",children:H.description},void 0,!1,void 0,this),H.categories.length>0&&q.jsxDEV("div",{className:"flex flex-wrap gap-1 mt-1",children:H.categories.slice(0,2).map((R)=>q.jsxDEV("span",{className:"text-[10px] bg-[var(--color-surface-raised)] text-[var(--color-text-faint)] px-1.5 py-0.5 rounded",children:R},R,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"mt-3 flex gap-2",children:k?q.jsxDEV(q.Fragment,{children:[y&&q.jsxDEV("button",{onClick:y,className:"flex-1 text-xs bg-[#1a2a1a] hover:bg-[#1a3a1a] border border-green-500/30 hover:border-green-500/50 text-green-400 px-3 py-1.5 rounded transition",children:"Create MCP Config"},void 0,!1,void 0,this),Z&&q.jsxDEV("button",{onClick:Z,className:"flex-1 text-xs bg-[#1a1a2a] hover:bg-[#1a1a3a] border border-blue-500/30 hover:border-blue-500/50 text-blue-400 px-3 py-1.5 rounded transition",children:"Browse Triggers"},void 0,!1,void 0,this),A&&q.jsxDEV("button",{onClick:A,className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-accent)] transition px-2",title:"Update API Key",children:"Key"},void 0,!1,void 0,this),F&&q.jsxDEV("button",{onClick:F,className:"text-xs text-[var(--color-text-muted)] hover:text-red-400 transition px-2",title:"Disconnect",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("button",{onClick:U,disabled:I,className:"w-full text-xs bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] border border-[var(--color-border-light)] hover:border-[var(--color-accent)] px-3 py-1.5 rounded transition disabled:opacity-50",children:I?"Connecting...":P&&!S?"Enter API Key":"Connect"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
-
export{wq as j};
|
|
3
|
-
|
|
4
|
-
//# debugId=2F7BCCE25B976A9A64756E2164756E21
|
package/dist/App.agsv5bje.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{F as r,k as V,l as zq}from"./App.x2d0ygt6.js";import{N as Zq,O as E}from"./App.fds72zb5.js";import{V as o}from"./App.fg9qj2dq.js";import{Y as e,aa as Gq,ba as Qq,ka as x,na as a,pa as Yq,ra as qq}from"./App.yt9p4nr3.js";var H=e(Gq(),1);var q=e(Qq(),1);function bq(){let{projectsEnabled:z,metaAgentEnabled:Z}=a(),{isBusiness:L}=qq(),[W,A]=H.useState("general"),Y=["providers","api-keys","data"],O=[{key:"general",label:"General"},{key:"providers",label:"Providers"},...z?[{key:"projects",label:"Projects"}]:[],...Z?[{key:"assistant",label:"Assistant"}]:[],{key:"channels",label:"Channels"},{key:"api-keys",label:"API Keys"},{key:"account",label:"Account"},{key:"updates",label:"Updates"},{key:"data",label:"Data"}].filter((G)=>!L||!Y.includes(G.key));return q.jsxDEV("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden",children:[q.jsxDEV("div",{className:"md:hidden border-b border-[var(--color-border)] bg-[var(--color-bg)]",children:q.jsxDEV("div",{className:"flex overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:O.map((G)=>q.jsxDEV("button",{onClick:()=>A(G.key),className:`flex-shrink-0 px-4 py-3 text-sm font-medium border-b-2 transition ${W===G.key?"border-[var(--color-accent)] text-[var(--color-accent)]":"border-transparent text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,children:G.label},G.key,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"hidden md:block w-48 border-r border-[var(--color-border)] p-4 flex-shrink-0",children:[q.jsxDEV("h2",{className:"text-sm font-medium text-[var(--color-text-muted)] uppercase tracking-wider mb-3",children:"Settings"},void 0,!1,void 0,this),q.jsxDEV("nav",{className:"space-y-1",children:O.map((G)=>q.jsxDEV(Jq,{label:G.label,active:W===G.key,onClick:()=>A(G.key)},G.key,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex-1 overflow-auto p-4 md:p-6",children:[W==="general"&&q.jsxDEV(Wq,{},void 0,!1,void 0,this),W==="providers"&&q.jsxDEV(_q,{},void 0,!1,void 0,this),W==="projects"&&z&&q.jsxDEV(Oq,{},void 0,!1,void 0,this),W==="channels"&&q.jsxDEV(Tq,{},void 0,!1,void 0,this),W==="api-keys"&&q.jsxDEV(Rq,{},void 0,!1,void 0,this),W==="account"&&q.jsxDEV(Uq,{},void 0,!1,void 0,this),W==="updates"&&q.jsxDEV(Nq,{},void 0,!1,void 0,this),W==="data"&&q.jsxDEV(Lq,{},void 0,!1,void 0,this),W==="assistant"&&Z&&q.jsxDEV(Mq,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Jq({label:z,active:Z,onClick:L}){return q.jsxDEV("button",{onClick:L,className:`w-full text-left px-3 py-2 rounded text-sm transition ${Z?"bg-[var(--color-surface-raised)] text-[var(--color-text)]":"text-[var(--color-text-muted)] hover:bg-[var(--color-surface)] hover:text-[var(--color-text-secondary)]"}`,children:z},void 0,!1,void 0,this)}function Wq(){let{authFetch:z}=x(),{mode:Z,style:L,setMode:W,setStyle:A}=Yq(),{mode:Y,setMode:O}=qq(),[G,U]=H.useState(""),[N,w]=H.useState(!0),[I,T]=H.useState(!1),[B,J]=H.useState(null);H.useEffect(()=>{(async()=>{try{let g=await(await z("/api/settings/instance-url")).json();U(g.instance_url||"")}catch{}w(!1)})()},[]);let b=async()=>{T(!0),J(null);try{let X=await z("/api/settings/instance-url",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({instance_url:G})}),K=await X.json();if(X.ok)U(K.instance_url||""),J({type:"success",text:"Instance URL saved"});else J({type:"error",text:K.error||"Failed to save"})}catch{J({type:"error",text:"Failed to save"})}T(!1)},R=[{value:"auto",label:"Auto",description:"Follow system preference"},{value:"dark",label:"Dark",description:"Dark background"},{value:"light",label:"Light",description:"Light background"}],M=[{value:"classic",label:"Classic",description:"Terminal-inspired, sharp"},{value:"professional",label:"Professional",description:"Polished, enterprise"}];return q.jsxDEV("div",{className:"max-w-4xl w-full",children:[q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"General"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"Instance configuration and appearance."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4 mb-4",children:[q.jsxDEV("h3",{className:"font-medium mb-4",children:"Appearance"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mb-2",children:"Color scheme"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-3 mb-5",children:R.map((X)=>q.jsxDEV("button",{onClick:()=>W(X.value),className:`flex-1 max-w-[160px] px-4 py-3 border text-left transition ${Z===X.value?"border-[var(--color-accent)] bg-[var(--color-accent-10)]":"border-[var(--color-border-light)] bg-[var(--color-bg)] hover:border-[var(--color-scrollbar)]"}`,style:{borderRadius:"var(--radius-card)"},children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center ${Z===X.value?"border-[var(--color-accent)]":"border-[var(--color-scrollbar)]"}`,children:Z===X.value&&q.jsxDEV("div",{className:"w-2 h-2 rounded-full bg-[var(--color-accent)]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-sm font-medium",children:X.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] ml-6",children:X.description},void 0,!1,void 0,this)]},X.value,!0,void 0,this))},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mb-2",children:"Style"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-3",children:M.map((X)=>q.jsxDEV("button",{onClick:()=>A(X.value),className:`flex-1 max-w-[200px] px-4 py-3 border text-left transition ${L===X.value?"border-[var(--color-accent)] bg-[var(--color-accent-10)]":"border-[var(--color-border-light)] bg-[var(--color-bg)] hover:border-[var(--color-scrollbar)]"}`,style:{borderRadius:"var(--radius-card)"},children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center ${L===X.value?"border-[var(--color-accent)]":"border-[var(--color-scrollbar)]"}`,children:L===X.value&&q.jsxDEV("div",{className:"w-2 h-2 rounded-full bg-[var(--color-accent)]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-sm font-medium",children:X.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] ml-6",children:X.description},void 0,!1,void 0,this)]},X.value,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4 mb-4",children:[q.jsxDEV("h3",{className:"font-medium mb-2",children:"UI Mode"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] mb-4",children:"Switch between developer and business views."},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-3",children:[{value:"developer",label:"Developer",description:"Full control over agents, providers, MCP, and configuration"},{value:"business",label:"Business",description:"Simplified view focused on employees and conversations"}].map((X)=>q.jsxDEV("button",{onClick:()=>O(X.value),className:`flex-1 max-w-[240px] px-4 py-3 border text-left transition ${Y===X.value?"border-[var(--color-accent)] bg-[var(--color-accent-10)]":"border-[var(--color-border-light)] bg-[var(--color-bg)] hover:border-[var(--color-scrollbar)]"}`,style:{borderRadius:"var(--radius-card)"},children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center ${Y===X.value?"border-[var(--color-accent)]":"border-[var(--color-scrollbar)]"}`,children:Y===X.value&&q.jsxDEV("div",{className:"w-2 h-2 rounded-full bg-[var(--color-accent)]"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-sm font-medium",children:X.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] ml-6",children:X.description},void 0,!1,void 0,this)]},X.value,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4",children:[q.jsxDEV("h3",{className:"font-medium mb-2",children:"Instance URL"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] mb-4",children:"The public HTTPS URL for this instance. Used for webhook callbacks from external services like Composio."},void 0,!1,void 0,this),N?q.jsxDEV("div",{className:"text-[var(--color-text-muted)] text-sm",children:"Loading..."},void 0,!1,void 0,this):q.jsxDEV("div",{className:"space-y-3 max-w-lg",children:[q.jsxDEV("input",{type:"text",value:G,onChange:(X)=>U(X.target.value),placeholder:"https://your-domain.com",className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)] font-mono text-sm"},void 0,!1,void 0,this),B&&q.jsxDEV("div",{className:`p-3 rounded text-sm ${B.type==="success"?"bg-green-500/10 text-green-400 border border-green-500/30":"bg-red-500/10 text-red-400 border border-red-500/30"}`,children:B.text},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:b,disabled:I,className:"px-4 py-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] disabled:opacity-50 text-black rounded text-sm font-medium transition",children:I?"Saving...":"Save"},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 _q(){let{authFetch:z}=x(),{projects:Z,projectsEnabled:L}=a(),[W,A]=H.useState([]),[Y,O]=H.useState(null),[G,U]=H.useState(""),[N,w]=H.useState(""),[I,T]=H.useState(!1),[B,J]=H.useState(!1),[b,R]=H.useState(null),[M,X]=H.useState(null),{confirm:K,ConfirmDialog:g}=E(),m=async()=>{let D=await(await z("/api/providers")).json();A(D.providers||[])};H.useEffect(()=>{m()},[]);let k=async()=>{if(!Y||!G)return;T(!0),R(null),X(null);let Q=G;if(Y==="browserbase"&&N)Q=JSON.stringify({api_key:G,project_id:N});try{J(!0);let S=await(await z(`/api/keys/${Y}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:Q})})).json();if(J(!1),!S.valid){R(S.error||"API key is invalid"),T(!1);return}let d=await z(`/api/keys/${Y}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:Q})}),l=await d.json();if(!d.ok)R(l.error||"Failed to save key");else{let i="API key saved!";if(l.restartedAgents&&l.restartedAgents.length>0){let j=l.restartedAgents.filter((u)=>u.success).length;if(l.restartedAgents.length-j===0)i+=` Restarted ${j} agent${j>1?"s":""} with new key.`;else i+=` Restarted ${j}/${l.restartedAgents.length} agents.`}X(i),U(""),w(""),O(null),m()}}catch(D){R("Failed to save key")}T(!1)},C=async(Q)=>{if(!await K("Are you sure you want to remove this API key?",{confirmText:"Remove",title:"Remove API Key"}))return;await z(`/api/keys/${Q}`,{method:"DELETE"}),m()},_=W.filter((Q)=>Q.type==="llm"),$=W.filter((Q)=>Q.type==="voice"&&!Q.isLocal),f=W.filter((Q)=>Q.type==="voice"&&Q.isLocal),h=W.filter((Q)=>Q.type==="voice"),p=W.filter((Q)=>Q.type==="integration"),c=W.filter((Q)=>Q.type==="browser"),y=_.filter((Q)=>Q.hasKey).length,P=h.filter((Q)=>Q.hasKey).length,v=p.filter((Q)=>Q.hasKey).length,n=c.filter((Q)=>Q.hasKey).length;return H.useEffect(()=>{if(M&&!Y){let Q=setTimeout(()=>X(null),5000);return()=>clearTimeout(Q)}},[M,Y]),q.jsxDEV(q.Fragment,{children:[g,q.jsxDEV("div",{className:"space-y-10",children:[M&&!Y&&q.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 flex items-center justify-between",children:[q.jsxDEV("div",{className:"flex items-center gap-2 text-green-400",children:[q.jsxDEV(V,{className:"w-5 h-5"},void 0,!1,void 0,this),q.jsxDEV("span",{children:M},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>X(null),className:"text-green-400 hover:text-green-300",children:q.jsxDEV(zq,{className:"w-4 h-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"AI Providers"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:["Manage your API keys for AI providers. ",y," of ",_.length," configured."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:_.map((Q)=>q.jsxDEV(Xq,{provider:Q,isEditing:Y===Q.id,apiKey:G,saving:I,testing:B,error:Y===Q.id?b:null,success:Y===Q.id?M:null,onStartEdit:()=>{O(Q.id),R(null),X(null)},onCancelEdit:()=>{O(null),U(""),R(null)},onApiKeyChange:U,onSave:k,onDelete:()=>C(Q.id)},Q.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("h2",{className:"text-xl font-semibold mb-1",children:"Voice Providers"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:["Configure voice providers for real-time voice conversations. ",P," of ",h.length," configured."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3 uppercase tracking-wider",children:"Cloud"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3 mb-6",children:$.map((Q)=>q.jsxDEV(s,{provider:Q,isEditing:Y===Q.id,apiKey:G,saving:I,testing:B,error:Y===Q.id?b:null,success:Y===Q.id?M:null,onStartEdit:()=>{O(Q.id),R(null),X(null)},onCancelEdit:()=>{O(null),U(""),R(null)},onApiKeyChange:U,onSave:k,onDelete:()=>C(Q.id),projectsEnabled:L,projects:Z,onRefresh:m},Q.id,!1,void 0,this))},void 0,!1,void 0,this),q.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-3 uppercase tracking-wider",children:"Local"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:f.map((Q)=>q.jsxDEV(Xq,{provider:Q,isEditing:Y===Q.id,apiKey:G,saving:I,testing:B,error:Y===Q.id?b:null,success:Y===Q.id?M:null,onStartEdit:()=>{O(Q.id),R(null),X(null)},onCancelEdit:()=>{O(null),U(""),R(null)},onApiKeyChange:U,onSave:k,onDelete:()=>C(Q.id)},Q.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("h2",{className:"text-xl font-semibold mb-1",children:"MCP Integrations"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:["Connect to MCP gateways for tool integrations. ",v," of ",p.length," configured."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:p.map((Q)=>q.jsxDEV(s,{provider:Q,isEditing:Y===Q.id,apiKey:G,saving:I,testing:B,error:Y===Q.id?b:null,success:Y===Q.id?M:null,onStartEdit:()=>{O(Q.id),R(null),X(null)},onCancelEdit:()=>{O(null),U(""),R(null)},onApiKeyChange:U,onSave:k,onDelete:()=>C(Q.id),projectsEnabled:L,projects:Z,onRefresh:m},Q.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("h2",{className:"text-xl font-semibold mb-1",children:"Browser Providers"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:["Configure browser environments for operator mode (computer use). ",n," of ",c.length," configured."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:c.map((Q)=>q.jsxDEV(s,{provider:Q,isEditing:Y===Q.id,apiKey:G,saving:I,testing:B,error:Y===Q.id?b:null,success:Y===Q.id?M:null,onStartEdit:()=>{O(Q.id),R(null),X(null)},onCancelEdit:()=>{O(null),U(""),R(null)},onApiKeyChange:U,onSave:k,onDelete:()=>C(Q.id),projectsEnabled:L,projects:Z,onRefresh:m},Q.id,!1,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)}var t=["#f97316","#6366f1","#22c55e","#ef4444","#3b82f6","#a855f7","#14b8a6","#f59e0b"];function Oq(){let{projects:z,createProject:Z,updateProject:L,deleteProject:W}=a(),[A,Y]=H.useState(!1),[O,G]=H.useState(null),{confirm:U,ConfirmDialog:N}=E(),w=async(J)=>{if(!await U("Are you sure you want to delete this project? Agents in this project will become unassigned.",{confirmText:"Delete",title:"Delete Project"}))return;await W(J)},I=()=>{G(null),Y(!0)},T=(J)=>{G(J),Y(!0)},B=()=>{Y(!1),G(null)};return q.jsxDEV(q.Fragment,{children:[N,q.jsxDEV("div",{className:"max-w-4xl w-full",children:[q.jsxDEV("div",{className:"mb-6 flex items-center justify-between gap-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Projects"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"Organize agents into projects for better management."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:I,className:"flex items-center gap-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-black px-4 py-2 rounded font-medium transition flex-shrink-0",children:[q.jsxDEV(r,{className:"w-4 h-4"},void 0,!1,void 0,this),"New Project"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.length===0?q.jsxDEV("div",{className:"text-center py-12 text-[var(--color-text-muted)]",children:[q.jsxDEV("p",{className:"text-lg mb-2",children:"No projects yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm",children:"Create a project to organize your agents."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"space-y-3",children:z.map((J)=>q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4 flex items-center gap-4",children:[q.jsxDEV("div",{className:"w-4 h-4 rounded-full flex-shrink-0",style:{backgroundColor:J.color}},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("h3",{className:"font-medium",children:J.name},void 0,!1,void 0,this),J.description&&q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] truncate",children:J.description},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] mt-1",children:[J.agentCount," agent",J.agentCount!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("button",{onClick:()=>T(J),className:"text-sm text-[var(--color-text-secondary)] hover:text-[var(--color-text)] px-2 py-1",children:"Edit"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>w(J.id),className:"text-sm text-red-400 hover:text-red-300 px-2 py-1",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},J.id,!0,void 0,this))},void 0,!1,void 0,this),A&&q.jsxDEV(Bq,{project:O,onSave:async(J)=>{if(O){let b=await L(O.id,J);if(b)B();return!!b}else{let b=await Z(J);if(b)B();return!!b}},onClose:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Bq({project:z,onSave:Z,onClose:L}){let[W,A]=H.useState(z?.name||""),[Y,O]=H.useState(z?.description||""),[G,U]=H.useState(z?.color||t[Math.floor(Math.random()*t.length)]),[N,w]=H.useState(!1),[I,T]=H.useState(null),B=async()=>{if(!W.trim()){T("Name is required");return}w(!0),T(null);let J=await Z({name:W,description:Y||void 0,color:G});if(w(!1),!J)T(z?"Failed to update project":"Failed to create project")};return q.jsxDEV(Zq,{onClose:L,children:[q.jsxDEV("h2",{className:"text-xl font-semibold mb-6",children:z?"Edit Project":"Create New Project"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:W,onChange:(J)=>A(J.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]",placeholder:"My Project",autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Description (optional)"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:Y,onChange:(J)=>O(J.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]",placeholder:"A short description"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Color"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-3 flex-wrap",children:t.map((J)=>q.jsxDEV("button",{type:"button",onClick:()=>U(J),className:`w-10 h-10 rounded-full transition ${G===J?"ring-2 ring-white ring-offset-2 ring-offset-[#111]":"hover:scale-110"}`,style:{backgroundColor:J}},J,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex gap-3 mt-6",children:[q.jsxDEV("button",{onClick:L,className:"flex-1 border border-[var(--color-border-light)] hover:border-[var(--color-accent)] hover:text-[var(--color-accent)] px-4 py-2 rounded font-medium transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:B,disabled:N||!W.trim(),className:"flex-1 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:N?"Saving...":z?"Update":"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Nq(){let{authFetch:z}=x(),[Z,L]=H.useState(null),[W,A]=H.useState(!1),[Y,O]=H.useState(!1),[G,U]=H.useState(null),[N,w]=H.useState(null),[I,T]=H.useState(null),B=async()=>{A(!0),U(null);try{let M=await z("/api/version");if(!M.ok)throw Error("Failed to check for updates");let X=await M.json();L(X)}catch(M){U("Failed to check for updates")}A(!1)},J=async()=>{O(!0),U(null),w(null);try{let X=await(await z("/api/version/update",{method:"POST"})).json();if(!X.success)U(X.error||"Update failed");else{let K=X.restarted?.length||0,g=K>0?` ${K} running agent${K>1?"s":""} restarted.`:"";w(`Agent binary updated to v${X.version}.${g}`),await B()}}catch(M){U("Failed to update agent")}O(!1)};H.useEffect(()=>{B()},[]);let b=(M,X)=>{navigator.clipboard.writeText(M),T(X),setTimeout(()=>T(null),2000)},R=Z?.apteva.updateAvailable||Z?.agent.updateAvailable;return q.jsxDEV("div",{className:"max-w-4xl w-full",children:[q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Updates"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"Check for new versions of apteva and the agent binary."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W&&!Z?q.jsxDEV("div",{className:"text-[var(--color-text-muted)]",children:"Checking version info..."},void 0,!1,void 0,this):G&&!Z?q.jsxDEV("div",{className:"text-red-400",children:G},void 0,!1,void 0,this):Z?.isDocker?q.jsxDEV("div",{className:"space-y-6",children:[q.jsxDEV("div",{className:"bg-blue-500/10 border border-blue-500/30 rounded-lg p-4",children:[q.jsxDEV("div",{className:"flex items-center gap-2 text-blue-400 mb-2",children:[q.jsxDEV("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:q.jsxDEV("path",{d:"M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.186.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.186.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.186.186 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.186.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.185-.186H5.136a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("span",{className:"font-medium",children:"Docker Environment"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Updates are automatic when you pull a new image version."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-5",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium text-lg",children:"Current Version"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:"apteva + agent binary"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"text-right",children:q.jsxDEV("div",{className:"text-xl font-mono",children:["v",Z.apteva.installed||"?"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R?q.jsxDEV("div",{className:"bg-[var(--color-accent-10)] border border-[var(--color-accent-30)] rounded-lg p-4",children:[q.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mb-3",children:["A newer version (v",Z.apteva.latest,") is available. To update:"]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"space-y-2",children:[q.jsxDEV("code",{className:"block bg-[var(--color-bg)] px-3 py-2 rounded font-mono text-sm text-[var(--color-text-secondary)]",children:"docker pull apteva/apteva:latest"},void 0,!1,void 0,this),q.jsxDEV("code",{className:"block bg-[var(--color-bg)] px-3 py-2 rounded font-mono text-sm text-[var(--color-text-secondary)]",children:"docker compose up -d"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{navigator.clipboard.writeText("docker pull apteva/apteva:latest && docker compose up -d"),T("docker"),setTimeout(()=>T(null),2000)},className:"mt-3 px-3 py-1.5 bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] rounded text-sm",children:I==="docker"?"Copied!":"Copy commands"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"flex items-center gap-2 text-green-400 text-sm",children:[q.jsxDEV(V,{className:"w-4 h-4"},void 0,!1,void 0,this),"Up to date"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)]",children:"Your data is stored in a Docker volume and persists across updates."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Z?q.jsxDEV("div",{className:"space-y-6",children:[N&&q.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 text-green-400",children:N},void 0,!1,void 0,this),G&&q.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-red-400",children:G},void 0,!1,void 0,this),q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-5",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium text-lg",children:"apteva"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:"The app you're running"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"text-right",children:[q.jsxDEV("div",{className:"text-xl font-mono",children:["v",Z.apteva.installed||"?"]},void 0,!0,void 0,this),Z.apteva.updateAvailable&&q.jsxDEV("div",{className:"text-sm text-[var(--color-accent)]",children:["→ v",Z.apteva.latest]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z.apteva.updateAvailable?q.jsxDEV("div",{className:"bg-[var(--color-accent-10)] border border-[var(--color-accent-30)] rounded-lg p-4",children:[q.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mb-3",children:"Update by running:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("code",{className:"flex-1 bg-[var(--color-bg)] px-3 py-2 rounded font-mono text-sm text-[var(--color-text-secondary)]",children:"npx apteva@latest"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>b("npx apteva@latest","apteva"),className:"px-3 py-2 bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] rounded text-sm",children:I==="apteva"?"Copied!":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"flex items-center gap-2 text-green-400 text-sm",children:[q.jsxDEV(V,{className:"w-4 h-4"},void 0,!1,void 0,this),"Up to date"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-5",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium text-lg",children:"Agent Binary"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:"The Go binary that runs agents"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"text-right",children:[q.jsxDEV("div",{className:"text-xl font-mono",children:["v",Z.agent.installed||"?"]},void 0,!0,void 0,this),Z.agent.updateAvailable&&q.jsxDEV("div",{className:"text-sm text-[var(--color-accent)]",children:["→ v",Z.agent.latest]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z.agent.updateAvailable?q.jsxDEV("div",{className:"bg-[var(--color-accent-10)] border border-[var(--color-accent-30)] rounded-lg p-4",children:[q.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mb-3",children:"A new version is available. Stop all agents before updating."},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2",children:q.jsxDEV("button",{onClick:J,disabled:Y,className:"px-4 py-2 bg-[var(--color-accent)] text-black rounded font-medium text-sm disabled:opacity-50",children:Y?"Updating...":"Update Agent"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"flex items-center gap-2 text-green-400 text-sm",children:[q.jsxDEV(V,{className:"w-4 h-4"},void 0,!1,void 0,this),"Up to date"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!R&&!N&&q.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 flex items-center gap-2 text-green-400",children:[q.jsxDEV(V,{className:"w-5 h-5"},void 0,!1,void 0,this),"Everything is up to date!"]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:B,disabled:W,className:"text-sm text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] disabled:opacity-50",children:W?"Checking...":"Check for updates"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function Xq({provider:z,isEditing:Z,apiKey:L,saving:W,testing:A,error:Y,success:O,onStartEdit:G,onCancelEdit:U,onApiKeyChange:N,onSave:w,onDelete:I,extraField:T,onExtraFieldChange:B}){let{authFetch:J}=x(),b=z.id==="ollama",R=z.id==="cdp",M=z.isLocal||!1,X=M||R,K=z.type==="browser",g=z.id==="browserbase",m=z.voiceSubtype,[k,C]=H.default.useState(null),[_,$]=H.default.useState(!1),[f,h]=H.default.useState(null),p=H.default.useCallback(()=>{J(`/api/providers/${z.id}/status`).then((y)=>y.json()).then((y)=>C({connected:y.connected,modelCount:y.modelCount,isDocker:y.isDocker})).catch(()=>C({connected:!1}))},[J,z.id]);H.default.useEffect(()=>{if(M)p()},[M,z.hasKey,p]);let c=async()=>{$(!0),h(null);try{let P=await(await J("/api/providers/ollama/install",{method:"POST"})).json();if(P.success)h({success:!0,message:P.message}),p();else h({success:!1,message:P.error||"Installation failed"})}catch{h({success:!1,message:"Failed to connect to server"})}finally{$(!1)}};return q.jsxDEV("div",{className:`bg-[var(--color-surface)] border rounded-lg p-4 ${z.hasKey?"border-green-500/20":"border-[var(--color-border)]"}`,children:[q.jsxDEV("div",{className:"flex items-start justify-between gap-2 mb-2",children:[q.jsxDEV("div",{className:"min-w-0",children:[q.jsxDEV("h3",{className:"font-medium",children:z.name},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] truncate",children:z.description?z.description:K?"Browser automation":z.type==="integration"?"MCP integration":M?"Run locally":`${z.models.length} models`},void 0,!1,void 0,this),m&&q.jsxDEV("span",{className:"text-[10px] uppercase tracking-wider text-[var(--color-text-muted)] bg-[var(--color-surface-raised)] px-1.5 py-0.5 rounded mt-1 inline-block",children:m==="both"?"STT + TTS":m==="stt"?"STT":"TTS"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.hasKey?q.jsxDEV("span",{className:`text-xs flex items-center gap-1 px-2 py-1 rounded whitespace-nowrap flex-shrink-0 ${M&&k?k.connected?"text-green-400 bg-green-500/10":"text-yellow-400 bg-yellow-500/10":"text-green-400 bg-green-500/10"}`,children:M&&k?k.connected?q.jsxDEV(q.Fragment,{children:[q.jsxDEV(V,{className:"w-3 h-3"},void 0,!1,void 0,this),k.modelCount?`${k.modelCount} models`:"Connected"]},void 0,!0,void 0,this):q.jsxDEV(q.Fragment,{children:"Not running"},void 0,!1,void 0,this):X?q.jsxDEV(q.Fragment,{children:[q.jsxDEV(V,{className:"w-3 h-3"},void 0,!1,void 0,this),"Configured"]},void 0,!0,void 0,this):q.jsxDEV(q.Fragment,{children:[q.jsxDEV(V,{className:"w-3 h-3"},void 0,!1,void 0,this),z.keyHint]},void 0,!0,void 0,this)},void 0,!1,void 0,this):q.jsxDEV("span",{className:"text-[var(--color-text-muted)] text-xs bg-[var(--color-surface-raised)] px-2 py-1 rounded whitespace-nowrap flex-shrink-0",children:"Not configured"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"mt-3 pt-3 border-t border-[var(--color-border)]",children:Z?q.jsxDEV("div",{className:"space-y-3",children:[g?q.jsxDEV(q.Fragment,{children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1",children:"API Key"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:L,onChange:(y)=>N(y.target.value),placeholder:z.hasKey?"Enter new API key...":"Enter API key...",autoFocus:!0,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-secondary)] mb-1",children:"Project ID"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:T||"",onChange:(y)=>B?.(y.target.value),placeholder:"Enter your Browserbase project ID...",className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("input",{type:X?"text":"password",value:L,onChange:(y)=>N(y.target.value),placeholder:M?z.defaultBaseUrl||"http://localhost:8080":R?"ws://localhost:9222":z.hasKey?"Enter new API key...":"Enter API key...",autoFocus:!0,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this),X&&q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)]",children:R?"Enter the CDP URL of your browser (e.g., ws://localhost:9222)":`Enter the server URL. Default is ${z.defaultBaseUrl||"http://localhost:8080"}`},void 0,!1,void 0,this),Y&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:Y},void 0,!1,void 0,this),O&&q.jsxDEV("p",{className:"text-green-400 text-sm",children:O},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:U,className:"flex-1 px-3 py-1.5 border border-[var(--color-border-light)] rounded text-sm hover:border-[var(--color-text-muted)]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:w,disabled:!L||W,className:"flex-1 px-3 py-1.5 bg-[var(--color-accent)] text-black rounded text-sm font-medium disabled:opacity-50",children:A?"Validating...":W?"Saving...":X?"Connect":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):z.hasKey?q.jsxDEV("div",{children:[M&&k&&!k.connected&&q.jsxDEV("div",{className:"mb-3",children:[b&&!k.isDocker?q.jsxDEV("button",{onClick:c,disabled:_,className:"w-full px-3 py-1.5 bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/30 rounded text-sm font-medium transition disabled:opacity-50 disabled:cursor-wait",children:_?"Starting Ollama...":"Start Ollama"},void 0,!1,void 0,this):q.jsxDEV("p",{className:"text-xs text-yellow-400/80",children:"Service not reachable. Make sure it's running at the configured URL."},void 0,!1,void 0,this),f&&q.jsxDEV("p",{className:`text-xs mt-1.5 ${f.success?"text-green-400":"text-red-400"}`,children:f.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center justify-between",children:[z.docsUrl?q.jsxDEV("a",{href:z.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:M?"Setup guide":"View docs"},void 0,!1,void 0,this):q.jsxDEV("span",{},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-3",children:[q.jsxDEV("button",{onClick:G,className:"text-sm text-[var(--color-text-secondary)] hover:text-[var(--color-text)]",children:X?"Change URL":"Update key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:I,className:"text-red-400 hover:text-red-300 text-sm",children:"Remove"},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("div",{children:[b&&!k?.isDocker&&q.jsxDEV("div",{className:"mb-3",children:[q.jsxDEV("button",{onClick:c,disabled:_,className:"w-full px-3 py-2 bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30 rounded text-sm font-medium transition disabled:opacity-50 disabled:cursor-wait",children:_?"Installing Ollama...":k?.connected?"Ollama Running":"Install Ollama"},void 0,!1,void 0,this),f&&q.jsxDEV("p",{className:`text-xs mt-1.5 ${f.success?"text-green-400":"text-red-400"}`,children:f.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center justify-between",children:[z.docsUrl?q.jsxDEV("a",{href:z.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:M?"Setup guide":K?"View docs":"Get API key"},void 0,!1,void 0,this):q.jsxDEV("span",{},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:G,className:"text-sm text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]",children:X?"Configure":"+ Add key"},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)}function s({provider:z,isEditing:Z,apiKey:L,saving:W,testing:A,error:Y,success:O,onStartEdit:G,onCancelEdit:U,onApiKeyChange:N,onSave:w,onDelete:I,projectsEnabled:T,projects:B,onRefresh:J}){let{authFetch:b}=x(),[R,M]=H.useState([]),[X,K]=H.useState(""),[g,m]=H.useState(!1),[k,C]=H.useState(null),[_,$]=H.useState(!1),[f,h]=H.useState(""),{confirm:p,ConfirmDialog:c}=E(),y=z.id==="browserbase",P=async()=>{try{let u=await(await b(`/api/keys/${z.id}`)).json();M(u.keys||[])}catch(F){console.error("Failed to fetch keys:",F)}};H.useEffect(()=>{if(T)P()},[z.id,T]),H.useEffect(()=>{if(Z)C(null)},[Z]);let v=async()=>{if(!L)return;$(!0),C(null);let F=L;if(y&&f)F=JSON.stringify({api_key:L,project_id:f});try{let u=await b(`/api/keys/${z.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:F,project_id:X||null})}),Hq=await u.json();if(u.ok)N(""),h(""),K(""),U(),P(),J();else C(Hq.error||"Failed to save key")}catch(u){console.error("Failed to save key:",u),C("Failed to save key")}$(!1)},n=async(F,u)=>{if(!await p(`Are you sure you want to remove this API key${u?` (${u})`:""}?`,{confirmText:"Remove",title:"Remove API Key"}))return;try{await b(`/api/keys/by-id/${F}`,{method:"DELETE"}),P(),J()}catch($q){console.error("Failed to delete key:",$q)}},Q=R.find((F)=>!F.project_id),D=R.filter((F)=>F.project_id),S=(F)=>B.find((u)=>u.id===F)?.name||"Unknown",d=(F)=>B.find((u)=>u.id===F)?.color||"#666";if(!T)return q.jsxDEV("div",{className:`bg-[var(--color-surface)] border rounded-lg p-4 ${z.hasKey?"border-[var(--color-accent-20)]":"border-[var(--color-border)]"}`,children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium",children:z.name},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:z.description||"MCP integration"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.hasKey?q.jsxDEV("span",{className:"text-[var(--color-accent)] text-xs flex items-center gap-1 bg-[var(--color-accent-10)] px-2 py-1 rounded",children:[q.jsxDEV(V,{className:"w-3 h-3"},void 0,!1,void 0,this),z.keyHint]},void 0,!0,void 0,this):q.jsxDEV("span",{className:"text-[var(--color-text-muted)] text-xs bg-[var(--color-surface-raised)] px-2 py-1 rounded",children:"Not configured"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"mt-3 pt-3 border-t border-[var(--color-border)]",children:Z?q.jsxDEV("div",{className:"space-y-3",children:[q.jsxDEV("input",{type:i,value:L,onChange:(F)=>N(F.target.value),placeholder:z.hasKey?`Enter new ${l?"URL":"API key"}...`:j,autoFocus:!0,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this),Y&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:Y},void 0,!1,void 0,this),O&&q.jsxDEV("p",{className:"text-green-400 text-sm",children:O},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:U,className:"flex-1 px-3 py-1.5 border border-[var(--color-border-light)] rounded text-sm hover:border-[var(--color-text-muted)]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:w,disabled:!L||W,className:"flex-1 px-3 py-1.5 bg-[var(--color-accent)] text-black rounded text-sm font-medium disabled:opacity-50",children:A?"Validating...":W?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):z.hasKey?q.jsxDEV("div",{className:"flex items-center justify-between",children:[q.jsxDEV("a",{href:z.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"View docs"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-3",children:[q.jsxDEV("button",{onClick:G,className:"text-sm text-[var(--color-text-secondary)] hover:text-[var(--color-text)]",children:"Update key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:I,className:"text-red-400 hover:text-red-300 text-sm",children:"Remove"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"flex items-center justify-between",children:[q.jsxDEV("a",{href:z.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:"Get API key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:G,className:"text-sm text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]",children:"+ Add key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let l=z.isLocal,i=l?"text":"password",j=l?z.defaultBaseUrl||"http://localhost:8080":"Enter API key...";return q.jsxDEV(q.Fragment,{children:[c,q.jsxDEV("div",{className:`bg-[var(--color-surface)] border rounded-lg p-4 ${R.length>0?"border-[var(--color-accent-20)]":"border-[var(--color-border)]"}`,children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[q.jsxDEV("div",{children:[q.jsxDEV("h3",{className:"font-medium",children:z.name},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:z.description||"MCP integration"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.length>0?q.jsxDEV("span",{className:"text-[var(--color-accent)] text-xs flex items-center gap-1 bg-[var(--color-accent-10)] px-2 py-1 rounded",children:[q.jsxDEV(V,{className:"w-3 h-3"},void 0,!1,void 0,this),R.length," key",R.length!==1?"s":""]},void 0,!0,void 0,this):q.jsxDEV("span",{className:"text-[var(--color-text-muted)] text-xs bg-[var(--color-surface-raised)] px-2 py-1 rounded",children:"Not configured"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R.length>0&&q.jsxDEV("div",{className:"mt-3 space-y-2",children:[Q&&q.jsxDEV("div",{className:"flex items-center justify-between text-sm bg-[var(--color-bg)] rounded px-3 py-2",children:[q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("span",{className:"text-[var(--color-text-secondary)]",children:"Global"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[var(--color-text-faint)]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[var(--color-text-muted)] font-mono text-xs",children:Q.key_hint},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>n(Q.id,"Global"),className:"text-red-400 hover:text-red-300 text-xs",children:"Remove"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),D.slice(0,g?void 0:2).map((F)=>q.jsxDEV("div",{className:"flex items-center justify-between text-sm bg-[var(--color-bg)] rounded px-3 py-2",children:[q.jsxDEV("div",{className:"flex items-center gap-2 min-w-0",children:[q.jsxDEV("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:d(F.project_id)}},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[var(--color-text-secondary)] truncate",children:F.name||S(F.project_id)},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[var(--color-text-faint)]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[var(--color-text-muted)] font-mono text-xs",children:F.key_hint},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>n(F.id,F.name||S(F.project_id)),className:"text-red-400 hover:text-red-300 text-xs flex-shrink-0 ml-2",children:"Remove"},void 0,!1,void 0,this)]},F.id,!0,void 0,this)),D.length>2&&!g&&q.jsxDEV("button",{onClick:()=>m(!0),className:"text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] w-full text-center py-1",children:["Show ",D.length-2," more..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"mt-3 pt-3 border-t border-[var(--color-border)]",children:Z?q.jsxDEV("div",{className:"space-y-3",children:[q.jsxDEV("input",{type:i,value:L,onChange:(F)=>N(F.target.value),placeholder:j,autoFocus:!0,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this),y&&q.jsxDEV("input",{type:"text",value:f,onChange:(F)=>h(F.target.value),placeholder:"Browserbase Project ID (optional)",className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)] text-sm"},void 0,!1,void 0,this),q.jsxDEV(o,{value:X,onChange:K,placeholder:"Global (all projects)",options:[{value:"",label:"Global (all projects)"},...B.map((F)=>({value:F.id,label:F.name}))]},void 0,!1,void 0,this),k&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:k},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:()=>{U(),K(""),C(null)},className:"flex-1 px-3 py-1.5 border border-[var(--color-border-light)] rounded text-sm hover:border-[var(--color-text-muted)]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:v,disabled:!L||_,className:"flex-1 px-3 py-1.5 bg-[var(--color-accent)] text-black rounded text-sm font-medium disabled:opacity-50",children:_?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"flex items-center justify-between",children:[q.jsxDEV("a",{href:z.docsUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#3b82f6] hover:underline",children:R.length>0?"View docs":"Get API key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:G,className:"text-sm text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]",children:"+ Add key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Rq(){let{authFetch:z}=x(),[Z,L]=H.useState([]),[W,A]=H.useState(!1),[Y,O]=H.useState(""),[G,U]=H.useState("90"),[N,w]=H.useState(!1),[I,T]=H.useState(null),[B,J]=H.useState(null),[b,R]=H.useState(!1),{confirm:M,ConfirmDialog:X}=E(),K=async()=>{try{let f=await(await z("/api/keys/personal")).json();L(f.keys||[])}catch{}};H.useEffect(()=>{K()},[]);let g=async()=>{if(!Y.trim()){T("Name is required");return}w(!0),T(null);try{let $=await z("/api/keys/personal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Y.trim(),expires_in_days:G?parseInt(G):null})}),f=await $.json();if(!$.ok)T(f.error||"Failed to create key");else J(f.key),O(""),U("90"),K()}catch{T("Failed to create key")}w(!1)},m=async($,f)=>{if(!await M(`Delete API key "${f}"? This cannot be undone.`,{confirmText:"Delete",title:"Delete API Key"}))return;try{await z(`/api/keys/personal/${$}`,{method:"DELETE"}),K()}catch{}},k=()=>{if(B)navigator.clipboard.writeText(B),R(!0),setTimeout(()=>R(!1),2000)},C=($)=>{if(!$)return"Never";return new Date($).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},_=($)=>{if(!$)return!1;return new Date($)<new Date};return q.jsxDEV(q.Fragment,{children:[X,q.jsxDEV("div",{className:"max-w-4xl w-full",children:[q.jsxDEV("div",{className:"mb-6 flex items-center justify-between gap-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"API Keys"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:["Create personal API keys for programmatic access. Use them with the ",q.jsxDEV("code",{className:"text-[var(--color-text-secondary)] bg-[var(--color-surface-raised)] px-1 rounded text-xs",children:"X-API-Key"},void 0,!1,void 0,this)," header."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!W&&!B&&q.jsxDEV("button",{onClick:()=>{A(!0),T(null)},className:"flex items-center gap-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-black px-4 py-2 rounded font-medium transition flex-shrink-0",children:[q.jsxDEV(r,{className:"w-4 h-4"},void 0,!1,void 0,this),"New Key"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B&&q.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 mb-6",children:[q.jsxDEV("div",{className:"flex items-center gap-2 text-green-400 mb-2",children:[q.jsxDEV(V,{className:"w-5 h-5"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"font-medium",children:"API key created"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-secondary)] mb-3",children:"Copy this key now. You won't be able to see it again."},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("code",{className:"flex-1 bg-[var(--color-bg)] px-3 py-2 rounded font-mono text-sm text-[var(--color-text)] break-all select-all",children:B},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:k,className:"px-3 py-2 bg-[var(--color-surface-raised)] hover:bg-[var(--color-surface-raised)] rounded text-sm flex-shrink-0",children:b?"Copied!":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{J(null),A(!1)},className:"mt-3 text-sm text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]",children:"Done"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W&&!B&&q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4 mb-6",children:[q.jsxDEV("h3",{className:"font-medium mb-4",children:"Create new API key"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-4 max-w-md",children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:Y,onChange:($)=>O($.target.value),placeholder:"e.g. CI Pipeline, My Script",autoFocus:!0,className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Expiration"},void 0,!1,void 0,this),q.jsxDEV("select",{value:G,onChange:($)=>U($.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]",children:[q.jsxDEV("option",{value:"30",children:"30 days"},void 0,!1,void 0,this),q.jsxDEV("option",{value:"90",children:"90 days"},void 0,!1,void 0,this),q.jsxDEV("option",{value:"180",children:"180 days"},void 0,!1,void 0,this),q.jsxDEV("option",{value:"365",children:"1 year"},void 0,!1,void 0,this),q.jsxDEV("option",{value:"",children:"No expiration"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:I},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:()=>{A(!1),T(null),O("")},className:"flex-1 px-3 py-2 border border-[var(--color-border-light)] rounded text-sm hover:border-[var(--color-text-muted)]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:g,disabled:N||!Y.trim(),className:"flex-1 px-3 py-2 bg-[var(--color-accent)] text-black rounded text-sm font-medium disabled:opacity-50",children:N?"Creating...":"Create Key"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z.length===0?q.jsxDEV("div",{className:"text-center py-12 text-[var(--color-text-muted)]",children:[q.jsxDEV("p",{className:"text-lg mb-2",children:"No API keys yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm",children:"Create an API key to access apteva programmatically."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"space-y-3",children:Z.map(($)=>q.jsxDEV("div",{className:`bg-[var(--color-surface)] border rounded-lg p-4 flex items-center gap-4 ${!$.is_active||_($.expires_at)?"border-[var(--color-border)] opacity-60":"border-[var(--color-border)]"}`,children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("h3",{className:"font-medium",children:$.name},void 0,!1,void 0,this),!$.is_active&&q.jsxDEV("span",{className:"text-xs text-red-400 bg-red-500/10 px-2 py-0.5 rounded",children:"Revoked"},void 0,!1,void 0,this),$.is_active&&_($.expires_at)&&q.jsxDEV("span",{className:"text-xs text-yellow-400 bg-yellow-500/10 px-2 py-0.5 rounded",children:"Expired"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-3 text-sm text-[var(--color-text-muted)]",children:[q.jsxDEV("code",{className:"font-mono text-xs bg-[var(--color-bg)] px-2 py-0.5 rounded",children:[$.prefix,"..."]},void 0,!0,void 0,this),q.jsxDEV("span",{children:["Created ",C($.created_at)]},void 0,!0,void 0,this),$.expires_at&&q.jsxDEV("span",{children:["Expires ",C($.expires_at)]},void 0,!0,void 0,this),$.last_used_at&&q.jsxDEV("span",{children:["Last used ",C($.last_used_at)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.is_active&&q.jsxDEV("button",{onClick:()=>m($.id,$.name),className:"text-sm text-red-400 hover:text-red-300 px-2 py-1 flex-shrink-0",children:"Delete"},void 0,!1,void 0,this)]},$.id,!0,void 0,this))},void 0,!1,void 0,this),Z.length>0&&q.jsxDEV("div",{className:"mt-6 bg-[var(--color-surface)] card p-4",children:[q.jsxDEV("h3",{className:"font-medium mb-2 text-sm",children:"Usage"},void 0,!1,void 0,this),q.jsxDEV("code",{className:"block bg-[var(--color-bg)] px-3 py-2 rounded font-mono text-xs text-[var(--color-text-secondary)]",children:'curl -H "X-API-Key: apt_..." http://localhost:4280/api/agents'},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 Uq(){let{authFetch:z,user:Z}=x(),[L,W]=H.useState(""),[A,Y]=H.useState(""),[O,G]=H.useState(""),[U,N]=H.useState(!1),[w,I]=H.useState(null),T=async()=>{if(!L||!A||!O){I({type:"error",text:"All fields are required"});return}if(A!==O){I({type:"error",text:"New passwords do not match"});return}if(A.length<8){I({type:"error",text:"Password must be at least 8 characters"});return}N(!0),I(null);try{let B=await z("/api/auth/password",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:L,newPassword:A})}),J=await B.json();if(B.ok)I({type:"success",text:"Password updated successfully"}),W(""),Y(""),G("");else I({type:"error",text:J.error||"Failed to update password"})}catch{I({type:"error",text:"Failed to update password"})}N(!1)};return q.jsxDEV("div",{className:"max-w-4xl w-full",children:[q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Account Settings"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"Manage your account and security."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z&&q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4 mb-6",children:[q.jsxDEV("h3",{className:"font-medium mb-3",children:"Profile"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-2 text-sm",children:[q.jsxDEV("div",{className:"flex justify-between",children:[q.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Username"},void 0,!1,void 0,this),q.jsxDEV("span",{children:Z.username},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z.email&&q.jsxDEV("div",{className:"flex justify-between",children:[q.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Email"},void 0,!1,void 0,this),q.jsxDEV("span",{children:Z.email},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex justify-between",children:[q.jsxDEV("span",{className:"text-[var(--color-text-muted)]",children:"Role"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"capitalize",children:Z.role},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("div",{className:"bg-[var(--color-surface)] card p-4",children:[q.jsxDEV("h3",{className:"font-medium mb-4",children:"Change Password"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-4 max-w-md",children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Current Password"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:L,onChange:(B)=>W(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"New Password"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:A,onChange:(B)=>Y(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Confirm New Password"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:O,onChange:(B)=>G(B.target.value),className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w&&q.jsxDEV("div",{className:`p-3 rounded text-sm ${w.type==="success"?"bg-green-500/10 text-green-400 border border-green-500/30":"bg-red-500/10 text-red-400 border border-red-500/30"}`,children:w.text},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:T,disabled:U||!L||!A||!O,className:"px-4 py-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] disabled:opacity-50 disabled:cursor-not-allowed text-black rounded text-sm font-medium transition",children:U?"Updating...":"Update Password"},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 Lq(){let{authFetch:z}=x(),[Z,L]=H.useState(!1),[W,A]=H.useState(null),[Y,O]=H.useState(null),{confirm:G,ConfirmDialog:U}=E(),N=async()=>{try{let T=await(await z("/api/telemetry/stats")).json();O(T.stats?.total_events||0)}catch{O(null)}};H.useEffect(()=>{N()},[]);let w=async()=>{if(!await G("Are you sure you want to delete all analytics data? This cannot be undone.",{confirmText:"Clear All",title:"Clear Analytics Data"}))return;L(!0),A(null);try{let T=await z("/api/telemetry/clear",{method:"POST"}),B=await T.json();if(T.ok)A({type:"success",text:`Cleared ${B.deleted||0} telemetry events.`}),O(0);else A({type:"error",text:B.error||"Failed to clear telemetry"})}catch{A({type:"error",text:"Failed to clear telemetry"})}L(!1)};return q.jsxDEV(q.Fragment,{children:[U,q.jsxDEV("div",{className:"max-w-4xl w-full",children:[q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Data Management"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[var(--color-text-muted)]",children:"Manage stored data and analytics."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4",children:[q.jsxDEV("h3",{className:"font-medium mb-2",children:"Analytics Data"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] mb-4",children:Y!==null?`${Y.toLocaleString()} events stored`:"Loading..."},void 0,!1,void 0,this),W&&q.jsxDEV("div",{className:`mb-4 p-3 rounded text-sm ${W.type==="success"?"bg-green-500/10 text-green-400 border border-green-500/30":"bg-red-500/10 text-red-400 border border-red-500/30"}`,children:W.text},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:w,disabled:Z||Y===0,className:"px-4 py-2 bg-red-500/20 text-red-400 hover:bg-red-500/30 disabled:opacity-50 disabled:cursor-not-allowed rounded text-sm font-medium transition",children:Z?"Clearing...":"Clear All Analytics"},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 Tq(){let{authFetch:z}=x(),[Z,L]=H.useState([]),[W,A]=H.useState([]),[Y,O]=H.useState(!0),[G,U]=H.useState(!1),[N,w]=H.useState({name:"",agent_id:"",botToken:""}),[I,T]=H.useState(!1),[B,J]=H.useState(null),{confirm:b,ConfirmDialog:R}=E(),M=async()=>{try{let $=await(await z("/api/channels")).json();L($.channels||[])}catch{}finally{O(!1)}},X=async()=>{try{let $=await(await z("/api/agents")).json();A(($.agents||[]).map((f)=>({id:f.id,name:f.name,status:f.status})))}catch{}};H.useEffect(()=>{M(),X()},[]);let K=async()=>{if(!N.name||!N.agent_id||!N.botToken)return;T(!0),J(null);try{let _=await z("/api/channels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"telegram",name:N.name,agent_id:N.agent_id,config:{botToken:N.botToken}})});if(!_.ok){let $=await _.json();J($.error||"Failed to create channel")}else w({name:"",agent_id:"",botToken:""}),U(!1),await M()}catch(_){J(_.message)}finally{T(!1)}},g=async(_)=>{let $=_.status==="running"?"stop":"start";try{let f=await z(`/api/channels/${_.id}/${$}`,{method:"POST"});if(!f.ok){let h=await f.json();J(h.error||`Failed to ${$} channel`)}await M()}catch{J(`Failed to ${$} channel`)}},m=async(_)=>{if(!await b(`Delete channel "${_.name}"?`,{confirmText:"Delete",title:"Delete Channel"}))return;try{await z(`/api/channels/${_.id}`,{method:"DELETE"}),await M()}catch{}},k={running:"bg-green-500/20 text-green-400",stopped:"bg-[var(--color-surface-raised)] text-[var(--color-text-muted)]",error:"bg-red-500/20 text-red-400"},C=(_)=>{return W.find(($)=>$.id===_)?.name||_};return q.jsxDEV(q.Fragment,{children:[R,q.jsxDEV("div",{className:"max-w-2xl",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[q.jsxDEV("div",{children:[q.jsxDEV("h2",{className:"text-xl font-semibold mb-1",children:"Channels"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:"Connect agents to external messaging platforms"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>U(!G),className:"flex items-center gap-2 bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] text-black px-3 py-1.5 rounded text-sm font-medium transition",children:[q.jsxDEV(r,{},void 0,!1,void 0,this)," Add Channel"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B&&q.jsxDEV("div",{className:"mb-4 bg-red-500/10 text-red-400 border border-red-500/30 px-3 py-2 rounded text-sm flex items-center justify-between",children:[q.jsxDEV("span",{children:B},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>J(null),className:"text-red-400 hover:text-red-300 ml-2",children:q.jsxDEV(zq,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&q.jsxDEV("div",{className:"mb-6 bg-[var(--color-surface)] card p-4 space-y-3",children:[q.jsxDEV("h3",{className:"text-sm font-medium text-[var(--color-text-secondary)] mb-2",children:"New Telegram Channel"},void 0,!1,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Channel Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:N.name,onChange:(_)=>w(($)=>({...$,name:_.target.value})),placeholder:"e.g. My Telegram Bot",className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Agent"},void 0,!1,void 0,this),q.jsxDEV(o,{value:N.agent_id,options:W.map((_)=>({value:_.id,label:_.name})),onChange:(_)=>w(($)=>({...$,agent_id:_})),placeholder:"Select an agent..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[var(--color-text-muted)] mb-1",children:"Bot Token"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:N.botToken,onChange:(_)=>w(($)=>({...$,botToken:_.target.value})),placeholder:"From @BotFather on Telegram",className:"w-full bg-[var(--color-bg)] border border-[var(--color-border-light)] rounded px-3 py-2 text-sm focus:outline-none focus:border-[var(--color-accent)]"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-1",children:["Create a bot via ",q.jsxDEV("a",{href:"https://t.me/BotFather",target:"_blank",className:"text-[var(--color-accent)] hover:underline",children:"@BotFather"},void 0,!1,void 0,this)," on Telegram to get a token."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex gap-2 pt-1",children:[q.jsxDEV("button",{onClick:K,disabled:I||!N.name||!N.agent_id||!N.botToken,className:"bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] disabled:opacity-50 text-black px-4 py-1.5 rounded text-sm font-medium transition",children:I?"Creating...":"Create"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>{U(!1),w({name:"",agent_id:"",botToken:""})},className:"border border-[var(--color-border-light)] hover:border-[var(--color-scrollbar)] px-4 py-1.5 rounded text-sm transition",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Y?q.jsxDEV("p",{className:"text-[var(--color-text-muted)] text-sm",children:"Loading channels..."},void 0,!1,void 0,this):Z.length===0?q.jsxDEV("div",{className:"text-center py-12 text-[var(--color-text-muted)]",children:[q.jsxDEV("p",{className:"text-lg mb-2",children:"No channels configured"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm",children:"Add a Telegram channel to let users message your agents directly."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"space-y-3",children:Z.map((_)=>q.jsxDEV("div",{className:"bg-[var(--color-surface)] card p-4",children:q.jsxDEV("div",{className:"flex items-start justify-between",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("h3",{className:"font-medium",children:_.name},void 0,!1,void 0,this),q.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${k[_.status]||k.stopped}`,children:_.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)]",children:[_.type==="telegram"?"Telegram":_.type," → ",C(_.agent_id)]},void 0,!0,void 0,this),_.status==="error"&&_.error&&q.jsxDEV("p",{className:"text-xs text-red-400 mt-1",children:_.error},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2 ml-4",children:[q.jsxDEV("button",{onClick:()=>g(_),className:`px-3 py-1 rounded text-xs font-medium transition ${_.status==="running"?"bg-[var(--color-accent-20)] text-[var(--color-accent)] hover:bg-[var(--color-accent-30)]":"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30"}`,children:_.status==="running"?"Stop":"Start"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>m(_),className:"text-[var(--color-text-muted)] hover:text-red-400 transition text-sm",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},_.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Mq(){let{authFetch:z}=x(),[Z,L]=H.useState([]),[W,A]=H.useState(""),[Y,O]=H.useState(""),[G,U]=H.useState(""),[N,w]=H.useState("unknown"),[I,T]=H.useState(!0),[B,J]=H.useState(!1),[b,R]=H.useState(null),[M,X]=H.useState(!1),[K,g]=H.useState(!1),[m,k]=H.useState(!1),[C,_]=H.useState({provider:"",model:"",systemPrompt:"",webSearch:!1,webFetch:!1});H.useEffect(()=>{(async()=>{try{let[v,n]=await Promise.all([z("/api/meta-agent/status"),z("/api/providers")]),Q=await v.json(),D=await n.json();if(L((D.providers||[]).filter((S)=>S.type==="llm"&&S.hasKey)),Q.agent){let S=Q.agent;A(S.provider||""),O(S.model||""),U(S.systemPrompt||""),w(S.status||"stopped");let d=S.features?.builtinTools?.webSearch||!1,l=S.features?.builtinTools?.webFetch||!1;g(d),k(l),_({provider:S.provider||"",model:S.model||"",systemPrompt:S.systemPrompt||"",webSearch:d,webFetch:l})}}catch{R({type:"error",text:"Failed to load assistant config"})}finally{T(!1)}})()},[z]);let f=Z.find((P)=>P.id===W)?.models||[],h=(P)=>{A(P);let v=Z.find((Q)=>Q.id===P),n=v?.models.find((Q)=>Q.recommended)?.value||v?.models[0]?.value||"";O(n)},p=W!==C.provider||Y!==C.model||G!==C.systemPrompt||K!==C.webSearch||m!==C.webFetch,c=async()=>{J(!0),R(null);try{let P=await z("/api/agents/apteva-assistant",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:W,model:Y,systemPrompt:G,features:{builtinTools:{webSearch:K,webFetch:m}}})});if(P.ok)_({provider:W,model:Y,systemPrompt:G,webSearch:K,webFetch:m}),R({type:"success",text:"Assistant settings saved"}),setTimeout(()=>R(null),3000);else{let v=await P.json().catch(()=>({}));R({type:"error",text:v.error||"Failed to save"})}}catch{R({type:"error",text:"Failed to save settings"})}finally{J(!1)}},y=async()=>{X(!0),R(null);try{let v=await z(N==="running"?"/api/meta-agent/stop":"/api/meta-agent/start",{method:"POST"});if(v.ok)w(N==="running"?"stopped":"running");else{let n=await v.json().catch(()=>({}));R({type:"error",text:n.error||"Failed to toggle assistant"})}}catch{R({type:"error",text:"Failed to toggle assistant"})}finally{X(!1)}};if(I)return q.jsxDEV("div",{className:"text-[var(--color-text-muted)]",children:"Loading assistant settings..."},void 0,!1,void 0,this);return q.jsxDEV("div",{className:"max-w-2xl",children:[q.jsxDEV("h2",{className:"text-lg font-medium mb-1",children:"Apteva Assistant"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] mb-6",children:"Configure the built-in AI assistant that manages your agents and platform."},void 0,!1,void 0,this),b&&q.jsxDEV("div",{className:`mb-4 px-3 py-2 rounded text-sm ${b.type==="success"?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:b.text},void 0,!1,void 0,this),q.jsxDEV("div",{className:"mb-6 flex items-center gap-3",children:[q.jsxDEV("span",{className:"text-sm text-[var(--color-text-muted)]",children:"Status:"},void 0,!1,void 0,this),q.jsxDEV("span",{className:`px-2 py-1 rounded text-xs font-medium ${N==="running"?"bg-[#3b82f6]/20 text-[#3b82f6]":"bg-[var(--color-surface-raised)] text-[var(--color-text-muted)]"}`,children:N},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:y,disabled:M,className:`px-3 py-1.5 rounded text-sm font-medium transition ${N==="running"?"bg-[var(--color-accent-20)] text-[var(--color-accent)] hover:bg-[var(--color-accent-30)]":"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30"} disabled:opacity-50`,children:M?"...":N==="running"?"Stop":"Start"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"mb-4",children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Provider"},void 0,!1,void 0,this),q.jsxDEV(o,{value:W,onChange:h,options:Z.map((P)=>({value:P.id,label:P.name})),placeholder:"Select provider..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"mb-4",children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Model"},void 0,!1,void 0,this),q.jsxDEV(o,{value:Y,onChange:O,options:f.map((P)=>({value:P.value,label:P.label,recommended:P.recommended})),placeholder:"Select model..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W==="anthropic"&&q.jsxDEV("div",{className:"mb-4",children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"Built-in Tools"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[q.jsxDEV("button",{type:"button",onClick:()=>g(!K),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${K?"border-[var(--color-accent)] bg-[var(--color-accent-10)] text-[var(--color-accent)]":"border-[var(--color-border-light)] hover:border-[var(--color-border-light)] text-[var(--color-text-secondary)]"}`,children:[q.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:q.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-sm",children:"Web Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{type:"button",onClick:()=>k(!m),className:`flex items-center gap-2 px-3 py-2 rounded border transition ${m?"border-[var(--color-accent)] bg-[var(--color-accent-10)] text-[var(--color-accent)]":"border-[var(--color-border-light)] hover:border-[var(--color-border-light)] text-[var(--color-text-secondary)]"}`,children:[q.jsxDEV("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:q.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-sm",children:"Web Fetch"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-xs text-[var(--color-text-faint)] mt-2",children:"Provider-native tools for real-time web access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"mb-6",children:[q.jsxDEV("label",{className:"block text-sm text-[var(--color-text-muted)] mb-1",children:"System Prompt"},void 0,!1,void 0,this),q.jsxDEV("textarea",{value:G,onChange:(P)=>U(P.target.value),rows:12,className:"w-full bg-[var(--color-surface)] border border-[var(--color-border)] rounded px-3 py-2 text-sm font-mono focus:outline-none focus:border-[var(--color-accent)] resize-y"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:c,disabled:!p||B,className:"bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)] disabled:opacity-50 disabled:cursor-not-allowed text-black px-4 py-2 rounded font-medium transition",children:B?"Saving...":"Save Changes"},void 0,!1,void 0,this),N==="running"&&p&&q.jsxDEV("p",{className:"text-xs text-[var(--color-text-muted)] mt-2",children:"Changes will be applied to the running assistant"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
-
export{bq as c};
|
|
3
|
-
|
|
4
|
-
//# debugId=8E9409D030EDF7E064756E2164756E21
|