apteva 0.4.16 → 0.4.18

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.
Files changed (62) hide show
  1. package/dist/ActivityPage.yv28a2vj.js +3 -0
  2. package/dist/ApiDocsPage.4ccwjjbk.js +4 -0
  3. package/dist/App.155wke5v.js +4 -0
  4. package/dist/App.2e19nvn4.js +13 -0
  5. package/dist/App.2ye1b5n0.js +4 -0
  6. package/dist/App.4da4ycbe.js +4 -0
  7. package/dist/App.b6wtzd1j.js +4 -0
  8. package/dist/App.fjrh28tf.js +4 -0
  9. package/dist/App.htc36cy8.js +4 -0
  10. package/dist/App.me6reaa6.js +4 -0
  11. package/dist/App.n5q6p960.js +4 -0
  12. package/dist/App.nft7h9jt.js +4 -0
  13. package/dist/App.np463xvy.js +4 -0
  14. package/dist/App.nps62kvt.js +4 -0
  15. package/dist/App.q8ws33cc.js +181 -0
  16. package/dist/App.tb0y0jmt.js +40 -0
  17. package/dist/ConnectionsPage.52evzrp7.js +3 -0
  18. package/dist/McpPage.bjqrp0n2.js +3 -0
  19. package/dist/SettingsPage.es76hnj2.js +3 -0
  20. package/dist/SkillsPage.06h8yf0h.js +3 -0
  21. package/dist/TasksPage.99df66mk.js +3 -0
  22. package/dist/TelemetryPage.bmdnxhq7.js +3 -0
  23. package/dist/TestsPage.denxrg8c.js +3 -0
  24. package/dist/index.html +1 -1
  25. package/dist/styles.css +1 -1
  26. package/package.json +1 -1
  27. package/src/auth/middleware.ts +2 -0
  28. package/src/db.ts +162 -11
  29. package/src/mcp-platform.ts +41 -1
  30. package/src/routes/api/agent-utils.ts +38 -2
  31. package/src/routes/api/agents.ts +65 -2
  32. package/src/routes/api/projects.ts +19 -2
  33. package/src/routes/api/system.ts +26 -12
  34. package/src/routes/api/triggers.ts +458 -0
  35. package/src/routes/api/webhooks.ts +171 -0
  36. package/src/routes/api.ts +4 -0
  37. package/src/routes/static.ts +12 -3
  38. package/src/server.ts +6 -4
  39. package/src/triggers/agentdojo.ts +248 -0
  40. package/src/triggers/composio.ts +264 -0
  41. package/src/triggers/index.ts +71 -0
  42. package/src/web/App.tsx +20 -12
  43. package/src/web/components/agents/AgentCard.tsx +14 -7
  44. package/src/web/components/agents/AgentPanel.tsx +105 -115
  45. package/src/web/components/common/Icons.tsx +8 -0
  46. package/src/web/components/common/index.ts +1 -0
  47. package/src/web/components/connections/ConnectionsPage.tsx +54 -0
  48. package/src/web/components/connections/IntegrationsTab.tsx +144 -0
  49. package/src/web/components/connections/OverviewTab.tsx +183 -0
  50. package/src/web/components/connections/TriggersTab.tsx +690 -0
  51. package/src/web/components/index.ts +1 -0
  52. package/src/web/components/layout/Sidebar.tsx +7 -1
  53. package/src/web/components/mcp/IntegrationsPanel.tsx +19 -3
  54. package/src/web/components/mcp/McpPage.tsx +9 -3
  55. package/src/web/components/settings/SettingsPage.tsx +96 -2
  56. package/src/web/components/tasks/TasksPage.tsx +2 -2
  57. package/src/web/components/tests/TestsPage.tsx +1 -2
  58. package/src/web/context/TelemetryContext.tsx +14 -1
  59. package/src/web/context/index.ts +1 -1
  60. package/src/web/hooks/useAgents.ts +15 -11
  61. package/src/web/types.ts +1 -1
  62. package/dist/App.2194efgj.js +0 -228
@@ -0,0 +1,4 @@
1
+ import{O as P}from"./App.nps62kvt.js";import{P as N,S as Qq,T as c,V as o,_ as E,aa as u}from"./App.tb0y0jmt.js";var K=N(Qq(),1);var z=N(c(),1);function i(W){let H=W.category==="LLM",X=W.category==="TOOL",M=W.level==="error",$=W.data?.input_tokens||0,Z=W.data?.output_tokens||0;return{llm_calls:H?1:0,tool_calls:X?1:0,errors:M?1:0,input_tokens:$,output_tokens:Z}}function _q(){let{events:W,statusChangeCounter:H}=o(),{currentProjectId:X,currentProject:M}=u(),{authFetch:$}=E(),[Z,l]=K.useState(null),[C,v]=K.useState([]),[I,d]=K.useState([]),[r,h]=K.useState(!0),[Y,p]=K.useState({level:"",agent_id:""}),[k,n]=K.useState(new Set(["DATABASE"])),[R,a]=K.useState([]),[S,s]=K.useState(null),T=K.useRef(new Set),[t,m]=K.useState(new Set),f=K.useRef(new Set);K.useEffect(()=>{(async()=>{try{let G=await(await $("/api/agents")).json();a(G.agents||[])}catch(B){console.error("Failed to fetch agents:",B)}})()},[$]);let w=K.useMemo(()=>{if(X===null)return R;if(X==="unassigned")return R.filter((q)=>!q.projectId);return R.filter((q)=>q.projectId===X)},[R,X]),V=K.useMemo(()=>new Set(w.map((q)=>q.id)),[w]),g=async()=>{h(!0);try{let q=X==="unassigned"?"null":X||"",B=new URLSearchParams;if(q)B.set("project_id",q);let Q=await(await $(`/api/telemetry/stats${B.toString()?`?${B}`:""}`)).json();l(Q.stats);let J=new URLSearchParams;if(Y.level)J.set("level",Y.level);if(Y.agent_id)J.set("agent_id",Y.agent_id);if(q)J.set("project_id",q);J.set("limit","100");let O=(await(await $(`/api/telemetry/events?${J}`)).json()).events||[];v(O),T.current=new Set(O.map((Kq)=>Kq.id));let b=new URLSearchParams;if(b.set("group_by","agent"),q)b.set("project_id",q);let Jq=await(await $(`/api/telemetry/usage?${b}`)).json();d(Jq.usage||[])}catch(q){console.error("Failed to fetch telemetry:",q)}h(!1)};K.useEffect(()=>{g()},[Y,X,$,H]);let U=K.useMemo(()=>{if(!Z)return null;let q=0,B=0,G=0,Q=0,J=0,A=0;for(let y of W)if(!T.current.has(y.id)){q++;let O=i(y);B+=O.llm_calls,G+=O.tool_calls,Q+=O.errors,J+=O.input_tokens,A+=O.output_tokens}return{total_events:Z.total_events+q,total_llm_calls:Z.total_llm_calls+B,total_tool_calls:Z.total_tool_calls+G,total_errors:Z.total_errors+Q,total_input_tokens:Z.total_input_tokens+J,total_output_tokens:Z.total_output_tokens+A}},[Z,W]),D=K.useMemo(()=>{let q=new Map;for(let B of I)q.set(B.agent_id,{...B});for(let B of W)if(!T.current.has(B.id)){let G=i(B),Q=q.get(B.agent_id);if(Q)Q.llm_calls+=G.llm_calls,Q.tool_calls+=G.tool_calls,Q.errors+=G.errors,Q.input_tokens+=G.input_tokens,Q.output_tokens+=G.output_tokens;else q.set(B.agent_id,{agent_id:B.agent_id,llm_calls:G.llm_calls,tool_calls:G.tool_calls,errors:G.errors,input_tokens:G.input_tokens,output_tokens:G.output_tokens})}return Array.from(q.values())},[I,W]),F=K.default.useMemo(()=>{let q=W;if(X!==null)q=q.filter((J)=>V.has(J.agent_id));if(Y.agent_id)q=q.filter((J)=>J.agent_id===Y.agent_id);if(k.size>0)q=q.filter((J)=>!k.has(J.category));if(Y.level)q=q.filter((J)=>J.level===Y.level);let B=C;if(k.size>0)B=B.filter((J)=>!k.has(J.category));let G=new Set(q.map((J)=>J.id)),Q=[...q];for(let J of B)if(!G.has(J.id))Q.push(J),G.add(J.id);return Q.sort((J,A)=>new Date(A.timestamp).getTime()-new Date(J.timestamp).getTime()),Q.slice(0,100)},[W,C,Y,k,X,V]);K.useEffect(()=>{let q=[];for(let B of W)if(!f.current.has(B.id))f.current.add(B.id),q.push(B.id);if(q.length>0)m((B)=>{let G=new Set(B);return q.forEach((Q)=>G.add(Q)),G}),setTimeout(()=>{m((B)=>{let G=new Set(B);return q.forEach((Q)=>G.delete(Q)),G})},5000)},[W]);let x=(q)=>{return R.find((G)=>G.id===q)?.name||q},_=(q)=>{if(q>=1e6)return(q/1e6).toFixed(1)+"M";if(q>=1000)return(q/1000).toFixed(1)+"K";return q.toString()},e={debug:"text-[#555]",info:"text-blue-400",warn:"text-yellow-400",error:"text-red-400"},j={LLM:"bg-purple-500/20 text-purple-400 border-purple-500/30",TOOL:"bg-blue-500/20 text-blue-400 border-blue-500/30",CHAT:"bg-green-500/20 text-green-400 border-green-500/30",ERROR:"bg-red-500/20 text-red-400 border-red-500/30",SYSTEM:"bg-gray-500/20 text-gray-400 border-gray-500/30",TASK:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",MEMORY:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",MCP:"bg-orange-500/20 text-orange-400 border-orange-500/30",DATABASE:"bg-pink-500/20 text-pink-400 border-pink-500/30"},qq=["LLM","TOOL","CHAT","TASK","MEMORY","MCP","SYSTEM","DATABASE","ERROR"],zq=(q)=>{n((B)=>{let G=new Set(B);if(G.has(q))G.delete(q);else G.add(q);return G})},Bq=[{value:"",label:"All Agents"},...w.map((q)=>({value:q.id,label:q.name}))],Gq=[{value:"",label:"All Levels"},{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}];return z.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"mb-6",children:[z.jsxDEV("div",{className:"flex items-center gap-3 mb-1",children:[M&&z.jsxDEV("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:M.color}},void 0,!1,void 0,this),z.jsxDEV("h1",{className:"text-2xl font-semibold",children:X===null?"Telemetry":X==="unassigned"?"Telemetry - Unassigned":`Telemetry - ${M?.name||""}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-[#666]",children:"Monitor agent activity, token usage, and errors."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&z.jsxDEV("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:[z.jsxDEV(L,{label:"Events",value:_(U.total_events)},void 0,!1,void 0,this),z.jsxDEV(L,{label:"LLM Calls",value:_(U.total_llm_calls)},void 0,!1,void 0,this),z.jsxDEV(L,{label:"Tool Calls",value:_(U.total_tool_calls)},void 0,!1,void 0,this),z.jsxDEV(L,{label:"Errors",value:_(U.total_errors),color:"red"},void 0,!1,void 0,this),z.jsxDEV(L,{label:"Input Tokens",value:_(U.total_input_tokens)},void 0,!1,void 0,this),z.jsxDEV(L,{label:"Output Tokens",value:_(U.total_output_tokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),D.length>0&&z.jsxDEV("div",{className:"mb-6",children:[z.jsxDEV("h2",{className:"text-lg font-medium mb-3",children:"Usage by Agent"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg overflow-hidden",children:z.jsxDEV("table",{className:"w-full text-sm",children:[z.jsxDEV("thead",{children:z.jsxDEV("tr",{className:"border-b border-[#1a1a1a] text-[#666]",children:[z.jsxDEV("th",{className:"text-left p-3",children:"Agent"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"LLM Calls"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"Tool Calls"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"Input Tokens"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"Output Tokens"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"Errors"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("tbody",{children:D.map((q)=>z.jsxDEV("tr",{className:"border-b border-[#1a1a1a] last:border-0",children:[z.jsxDEV("td",{className:"p-3 font-medium",children:x(q.agent_id)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right text-[#888]",children:_(q.llm_calls)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right text-[#888]",children:_(q.tool_calls)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right text-[#888]",children:_(q.input_tokens)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right text-[#888]",children:_(q.output_tokens)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right",children:q.errors>0?z.jsxDEV("span",{className:"text-red-400",children:q.errors},void 0,!1,void 0,this):z.jsxDEV("span",{className:"text-[#444]",children:"0"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},q.agent_id,!0,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),z.jsxDEV("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[z.jsxDEV("div",{className:"w-44",children:z.jsxDEV(P,{value:Y.agent_id,options:Bq,onChange:(q)=>p({...Y,agent_id:q}),placeholder:"All Agents"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap items-center gap-1.5 flex-1",children:qq.map((q)=>{let B=k.has(q),G=j[q]||"bg-[#222] text-[#888] border-[#333]";return z.jsxDEV("button",{onClick:()=>zq(q),className:`px-2 py-0.5 rounded text-xs border transition-all ${B?"bg-[#1a1a1a] text-[#555] border-[#333] opacity-50":G}`,children:q},q,!1,void 0,this)})},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("div",{className:"w-36",children:z.jsxDEV(P,{value:Y.level,options:Gq,onChange:(q)=>p({...Y,level:q}),placeholder:"All Levels"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:g,className:"px-3 py-2 bg-[#1a1a1a] hover:bg-[#222] border border-[#333] rounded text-sm transition",children:"Refresh"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg",children:[z.jsxDEV("div",{className:"p-3 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("h2",{className:"font-medium",children:"Recent Events"},void 0,!1,void 0,this),W.length>0&&z.jsxDEV("span",{className:"text-xs text-[#666]",children:[W.length," new"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r&&F.length===0?z.jsxDEV("div",{className:"p-8 text-center text-[#666]",children:"Loading..."},void 0,!1,void 0,this):F.length===0?z.jsxDEV("div",{className:"p-8 text-center text-[#666]",children:"No telemetry events yet. Events will appear here in real-time once agents start sending data."},void 0,!1,void 0,this):z.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:F.map((q)=>{let B=t.has(q.id);return z.jsxDEV("div",{className:`p-3 hover:bg-[#0a0a0a] cursor-pointer transition-all duration-500 ${B?"bg-green-500/5":""}`,style:{animation:B?"slideIn 0.3s ease-out":void 0},onClick:()=>s(S===q.id?null:q.id),children:z.jsxDEV("div",{className:"flex items-start gap-3",children:[z.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs border transition-colors duration-300 ${j[q.category]||"bg-[#222] text-[#888] border-[#333]"}`,children:q.category},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("span",{className:"font-medium text-sm",children:q.type},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-xs ${e[q.level]||"text-[#666]"}`,children:q.level},void 0,!1,void 0,this),q.duration_ms&&z.jsxDEV("span",{className:"text-xs text-[#555]",children:[q.duration_ms,"ms"]},void 0,!0,void 0,this),z.jsxDEV("span",{className:`w-1.5 h-1.5 rounded-full bg-green-400 transition-opacity duration-1000 ${B?"opacity-100":"opacity-0"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"text-xs text-[#555] mt-1",children:[x(q.agent_id)," · ",new Date(q.timestamp).toLocaleString()]},void 0,!0,void 0,this),q.error&&z.jsxDEV("div",{className:"text-xs text-red-400 mt-1 font-mono",children:q.error},void 0,!1,void 0,this),S===q.id&&q.data&&Object.keys(q.data).length>0&&z.jsxDEV("pre",{className:"text-xs text-[#666] mt-2 p-2 bg-[#0a0a0a] rounded overflow-x-auto",children:JSON.stringify(q.data,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},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,!1,void 0,this)}function L({label:W,value:H,color:X}){return z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:[z.jsxDEV("div",{className:"text-[#666] text-xs mb-1",children:W},void 0,!1,void 0,this),z.jsxDEV("div",{className:`text-2xl font-semibold ${X==="red"?"text-red-400":""}`,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{_q as N};
3
+
4
+ //# debugId=2F19EF82DE22149B64756E2164756E21
@@ -0,0 +1,4 @@
1
+ import{E as D,j as K,k as o}from"./App.nft7h9jt.js";import{K as j,L as p}from"./App.np463xvy.js";import{O as E}from"./App.nps62kvt.js";import{P as x,S as t,T as i,_ as y,aa as c}from"./App.tb0y0jmt.js";var B=x(t(),1);var q=x(i(),1);function Lq(){let{projectsEnabled:z}=c(),[H,W]=B.useState("general"),L=[{key:"general",label:"General"},{key:"providers",label:"Providers"},...z?[{key:"projects",label:"Projects"}]:[],{key:"api-keys",label:"API Keys"},{key:"account",label:"Account"},{key:"updates",label:"Updates"},{key:"data",label:"Data"}];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-[#1a1a1a] bg-[#0a0a0a]",children:q.jsxDEV("div",{className:"flex overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:L.map(($)=>q.jsxDEV("button",{onClick:()=>W($.key),className:`flex-shrink-0 px-4 py-3 text-sm font-medium border-b-2 transition ${H===$.key?"border-[#f97316] text-[#f97316]":"border-transparent text-[#666] hover:text-[#888]"}`,children:$.label},$.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-[#1a1a1a] p-4 flex-shrink-0",children:[q.jsxDEV("h2",{className:"text-sm font-medium text-[#666] uppercase tracking-wider mb-3",children:"Settings"},void 0,!1,void 0,this),q.jsxDEV("nav",{className:"space-y-1",children:L.map(($)=>q.jsxDEV(s,{label:$.label,active:H===$.key,onClick:()=>W($.key)},$.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:[H==="general"&&q.jsxDEV(e,{},void 0,!1,void 0,this),H==="providers"&&q.jsxDEV(qq,{},void 0,!1,void 0,this),H==="projects"&&z&&q.jsxDEV(zq,{},void 0,!1,void 0,this),H==="api-keys"&&q.jsxDEV(Yq,{},void 0,!1,void 0,this),H==="account"&&q.jsxDEV(Zq,{},void 0,!1,void 0,this),H==="updates"&&q.jsxDEV(Hq,{},void 0,!1,void 0,this),H==="data"&&q.jsxDEV($q,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function s({label:z,active:H,onClick:W}){return q.jsxDEV("button",{onClick:W,className:`w-full text-left px-3 py-2 rounded text-sm transition ${H?"bg-[#1a1a1a] text-[#e0e0e0]":"text-[#666] hover:bg-[#111] hover:text-[#888]"}`,children:z},void 0,!1,void 0,this)}function e(){let{authFetch:z}=y(),[H,W]=B.useState(""),[L,$]=B.useState(!0),[Y,R]=B.useState(!1),[J,N]=B.useState(null);B.useEffect(()=>{(async()=>{try{let X=await(await z("/api/settings/instance-url")).json();W(X.instance_url||"")}catch{}$(!1)})()},[]);let F=async()=>{R(!0),N(null);try{let O=await z("/api/settings/instance-url",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({instance_url:H})}),U=await O.json();if(O.ok)W(U.instance_url||""),N({type:"success",text:"Instance URL saved"});else N({type:"error",text:U.error||"Failed to save"})}catch{N({type:"error",text:"Failed to save"})}R(!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:"General"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[#666]",children:"Instance configuration."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg 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-[#666] 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),L?q.jsxDEV("div",{className:"text-[#666] 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:H,onChange:(O)=>W(O.target.value),placeholder:"https://your-domain.com",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] font-mono text-sm"},void 0,!1,void 0,this),J&&q.jsxDEV("div",{className:`p-3 rounded text-sm ${J.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:J.text},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:F,disabled:Y,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black rounded text-sm font-medium transition",children:Y?"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 qq(){let{authFetch:z}=y(),{projects:H,projectsEnabled:W}=c(),[L,$]=B.useState([]),[Y,R]=B.useState(null),[J,N]=B.useState(""),[F,O]=B.useState(!1),[U,X]=B.useState(!1),[Z,Q]=B.useState(null),[M,A]=B.useState(null),{confirm:w,ConfirmDialog:b}=p(),I=async()=>{let m=await(await z("/api/providers")).json();$(m.providers||[])};B.useEffect(()=>{I()},[]);let k=async()=>{if(!Y||!J)return;O(!0),Q(null),A(null);try{X(!0);let m=await(await z(`/api/keys/${Y}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:J})})).json();if(X(!1),!m.valid){Q(m.error||"API key is invalid"),O(!1);return}let l=await z(`/api/keys/${Y}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:J})}),h=await l.json();if(!l.ok)Q(h.error||"Failed to save key");else{let v="API key saved!";if(h.restartedAgents&&h.restartedAgents.length>0){let S=h.restartedAgents.filter((d)=>d.success).length;if(h.restartedAgents.length-S===0)v+=` Restarted ${S} agent${S>1?"s":""} with new key.`;else v+=` Restarted ${S}/${h.restartedAgents.length} agents.`}A(v),N(""),R(null),I()}}catch(G){Q("Failed to save key")}O(!1)},u=async(G)=>{if(!await w("Are you sure you want to remove this API key?",{confirmText:"Remove",title:"Remove API Key"}))return;await z(`/api/keys/${G}`,{method:"DELETE"}),I()},C=L.filter((G)=>G.type==="llm"),f=L.filter((G)=>G.type==="integration"),g=C.filter((G)=>G.hasKey).length,_=f.filter((G)=>G.hasKey).length;return B.useEffect(()=>{if(M&&!Y){let G=setTimeout(()=>A(null),5000);return()=>clearTimeout(G)}},[M,Y]),q.jsxDEV(q.Fragment,{children:[b,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(K,{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:()=>A(null),className:"text-green-400 hover:text-green-300",children:q.jsxDEV(o,{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-[#666]",children:["Manage your API keys for AI providers. ",g," 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((G)=>q.jsxDEV(Qq,{provider:G,isEditing:Y===G.id,apiKey:J,saving:F,testing:U,error:Y===G.id?Z:null,success:Y===G.id?M:null,onStartEdit:()=>{R(G.id),Q(null),A(null)},onCancelEdit:()=>{R(null),N(""),Q(null)},onApiKeyChange:N,onSave:k,onDelete:()=>u(G.id)},G.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-[#666]",children:["Connect to MCP gateways for tool integrations. ",_," of ",f.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:f.map((G)=>q.jsxDEV(Xq,{provider:G,isEditing:Y===G.id,apiKey:J,saving:F,testing:U,error:Y===G.id?Z:null,success:Y===G.id?M:null,onStartEdit:()=>{R(G.id),Q(null),A(null)},onCancelEdit:()=>{R(null),N(""),Q(null)},onApiKeyChange:N,onSave:k,onDelete:()=>u(G.id),projectsEnabled:W,projects:H,onRefresh:I},G.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 V=["#f97316","#6366f1","#22c55e","#ef4444","#3b82f6","#a855f7","#14b8a6","#f59e0b"];function zq(){let{projects:z,createProject:H,updateProject:W,deleteProject:L}=c(),[$,Y]=B.useState(!1),[R,J]=B.useState(null),{confirm:N,ConfirmDialog:F}=p(),O=async(Q)=>{if(!await N("Are you sure you want to delete this project? Agents in this project will become unassigned.",{confirmText:"Delete",title:"Delete Project"}))return;await L(Q)},U=()=>{J(null),Y(!0)},X=(Q)=>{J(Q),Y(!0)},Z=()=>{Y(!1),J(null)};return q.jsxDEV(q.Fragment,{children:[F,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-[#666]",children:"Organize agents into projects for better management."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:U,className:"flex items-center gap-2 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition flex-shrink-0",children:[q.jsxDEV(D,{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-[#666]",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((Q)=>q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 flex items-center gap-4",children:[q.jsxDEV("div",{className:"w-4 h-4 rounded-full flex-shrink-0",style:{backgroundColor:Q.color}},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("h3",{className:"font-medium",children:Q.name},void 0,!1,void 0,this),Q.description&&q.jsxDEV("p",{className:"text-sm text-[#666] truncate",children:Q.description},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#666] mt-1",children:[Q.agentCount," agent",Q.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:()=>X(Q),className:"text-sm text-[#888] hover:text-[#e0e0e0] px-2 py-1",children:"Edit"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>O(Q.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)]},Q.id,!0,void 0,this))},void 0,!1,void 0,this),$&&q.jsxDEV(Bq,{project:R,onSave:async(Q)=>{if(R){let M=await W(R.id,Q);if(M)Z();return!!M}else{let M=await H(Q);if(M)Z();return!!M}},onClose:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Bq({project:z,onSave:H,onClose:W}){let[L,$]=B.useState(z?.name||""),[Y,R]=B.useState(z?.description||""),[J,N]=B.useState(z?.color||V[Math.floor(Math.random()*V.length)]),[F,O]=B.useState(!1),[U,X]=B.useState(null),Z=async()=>{if(!L.trim()){X("Name is required");return}O(!0),X(null);let Q=await H({name:L,description:Y||void 0,color:J});if(O(!1),!Q)X(z?"Failed to update project":"Failed to create project")};return q.jsxDEV(j,{onClose:W,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-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:L,onChange:(Q)=>$(Q.target.value),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]",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-[#666] mb-1",children:"Description (optional)"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:Y,onChange:(Q)=>R(Q.target.value),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]",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-[#666] mb-1",children:"Color"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-3 flex-wrap",children:V.map((Q)=>q.jsxDEV("button",{type:"button",onClick:()=>N(Q),className:`w-10 h-10 rounded-full transition ${J===Q?"ring-2 ring-white ring-offset-2 ring-offset-[#111]":"hover:scale-110"}`,style:{backgroundColor:Q}},Q,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:U},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:W,className:"flex-1 border border-[#333] hover:border-[#f97316] hover:text-[#f97316] px-4 py-2 rounded font-medium transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:Z,disabled:F||!L.trim(),className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:F?"Saving...":z?"Update":"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Hq(){let{authFetch:z}=y(),[H,W]=B.useState(null),[L,$]=B.useState(!1),[Y,R]=B.useState(!1),[J,N]=B.useState(null),[F,O]=B.useState(null),[U,X]=B.useState(null),Z=async()=>{$(!0),N(null);try{let w=await z("/api/version");if(!w.ok)throw Error("Failed to check for updates");let b=await w.json();W(b)}catch(w){N("Failed to check for updates")}$(!1)},Q=async()=>{R(!0),N(null),O(null);try{let b=await(await z("/api/version/update",{method:"POST"})).json();if(!b.success)N(b.error||"Update failed");else{let I=b.restarted?.length||0,k=I>0?` ${I} running agent${I>1?"s":""} restarted.`:"";O(`Agent binary updated to v${b.version}.${k}`),await Z()}}catch(w){N("Failed to update agent")}R(!1)};B.useEffect(()=>{Z()},[]);let M=(w,b)=>{navigator.clipboard.writeText(w),X(b),setTimeout(()=>X(null),2000)},A=H?.apteva.updateAvailable||H?.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-[#666]",children:"Check for new versions of apteva and the agent binary."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L&&!H?q.jsxDEV("div",{className:"text-[#666]",children:"Checking version info..."},void 0,!1,void 0,this):J&&!H?q.jsxDEV("div",{className:"text-red-400",children:J},void 0,!1,void 0,this):H?.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-[#888]",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-[#111] border border-[#1a1a1a] rounded-lg 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-[#666]",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",H.apteva.installed||"?"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A?q.jsxDEV("div",{className:"bg-[#f97316]/10 border border-[#f97316]/30 rounded-lg p-4",children:[q.jsxDEV("p",{className:"text-sm text-[#888] mb-3",children:["A newer version (v",H.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-[#0a0a0a] px-3 py-2 rounded font-mono text-sm text-[#888]",children:"docker pull apteva/apteva:latest"},void 0,!1,void 0,this),q.jsxDEV("code",{className:"block bg-[#0a0a0a] px-3 py-2 rounded font-mono text-sm text-[#888]",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"),X("docker"),setTimeout(()=>X(null),2000)},className:"mt-3 px-3 py-1.5 bg-[#1a1a1a] hover:bg-[#222] rounded text-sm",children:U==="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(K,{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-[#555]",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):H?q.jsxDEV("div",{className:"space-y-6",children:[F&&q.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 text-green-400",children:F},void 0,!1,void 0,this),J&&q.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-red-400",children:J},void 0,!1,void 0,this),q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg 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-[#666]",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",H.apteva.installed||"?"]},void 0,!0,void 0,this),H.apteva.updateAvailable&&q.jsxDEV("div",{className:"text-sm text-[#f97316]",children:["→ v",H.apteva.latest]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.apteva.updateAvailable?q.jsxDEV("div",{className:"bg-[#f97316]/10 border border-[#f97316]/30 rounded-lg p-4",children:[q.jsxDEV("p",{className:"text-sm text-[#888] 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-[#0a0a0a] px-3 py-2 rounded font-mono text-sm text-[#888]",children:"npx apteva@latest"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>M("npx apteva@latest","apteva"),className:"px-3 py-2 bg-[#1a1a1a] hover:bg-[#222] rounded text-sm",children:U==="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(K,{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-[#111] border border-[#1a1a1a] rounded-lg 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-[#666]",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",H.agent.installed||"?"]},void 0,!0,void 0,this),H.agent.updateAvailable&&q.jsxDEV("div",{className:"text-sm text-[#f97316]",children:["→ v",H.agent.latest]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.agent.updateAvailable?q.jsxDEV("div",{className:"bg-[#f97316]/10 border border-[#f97316]/30 rounded-lg p-4",children:[q.jsxDEV("p",{className:"text-sm text-[#888] 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:Q,disabled:Y,className:"px-4 py-2 bg-[#f97316] 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(K,{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),!A&&!F&&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(K,{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:Z,disabled:L,className:"text-sm text-[#666] hover:text-[#888] disabled:opacity-50",children:L?"Checking...":"Check for updates"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)}function Qq({provider:z,isEditing:H,apiKey:W,saving:L,testing:$,error:Y,success:R,onStartEdit:J,onCancelEdit:N,onApiKeyChange:F,onSave:O,onDelete:U}){let X=z.id==="ollama",[Z,Q]=B.default.useState(null);return B.default.useEffect(()=>{if(X&&z.hasKey)fetch("/api/providers/ollama/status").then((M)=>M.json()).then((M)=>Q({connected:M.connected,modelCount:M.modelCount})).catch(()=>Q({connected:!1}))},[X,z.hasKey]),q.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 ${z.hasKey?"border-green-500/20":"border-[#1a1a1a]"}`,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-[#666] truncate",children:z.type==="integration"?z.description||"MCP integration":X?"Run models locally":`${z.models.length} models`},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 ${X&&Z?Z.connected?"text-green-400 bg-green-500/10":"text-yellow-400 bg-yellow-500/10":"text-green-400 bg-green-500/10"}`,children:X&&Z?Z.connected?q.jsxDEV(q.Fragment,{children:[q.jsxDEV(K,{className:"w-3 h-3"},void 0,!1,void 0,this),Z.modelCount," models"]},void 0,!0,void 0,this):q.jsxDEV(q.Fragment,{children:"Not running"},void 0,!1,void 0,this):q.jsxDEV(q.Fragment,{children:[q.jsxDEV(K,{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-[#666] text-xs bg-[#1a1a1a] 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-[#1a1a1a]",children:H?q.jsxDEV("div",{className:"space-y-3",children:[q.jsxDEV("input",{type:X?"text":"password",value:W,onChange:(M)=>F(M.target.value),placeholder:X?"http://localhost:11434":z.hasKey?"Enter new API key...":"Enter API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),X&&q.jsxDEV("p",{className:"text-xs text-[#666]",children:"Enter your Ollama server URL. Default is http://localhost:11434"},void 0,!1,void 0,this),Y&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:Y},void 0,!1,void 0,this),R&&q.jsxDEV("p",{className:"text-green-400 text-sm",children:R},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:N,className:"flex-1 px-3 py-1.5 border border-[#333] rounded text-sm hover:border-[#666]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:O,disabled:!W||L,className:"flex-1 px-3 py-1.5 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:$?"Validating...":L?"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",{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:X?"Download Ollama":"View docs"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-3",children:[q.jsxDEV("button",{onClick:J,className:"text-sm text-[#888] hover:text-[#e0e0e0]",children:X?"Change URL":"Update key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:U,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:X?"Download Ollama":"Get API key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:J,className:"text-sm text-[#f97316] hover:text-[#fb923c]",children:X?"Configure":"+ 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)}function Xq({provider:z,isEditing:H,apiKey:W,saving:L,testing:$,error:Y,success:R,onStartEdit:J,onCancelEdit:N,onApiKeyChange:F,onSave:O,onDelete:U,projectsEnabled:X,projects:Z,onRefresh:Q}){let{authFetch:M}=y(),[A,w]=B.useState([]),[b,I]=B.useState(""),[k,u]=B.useState(!1),[C,f]=B.useState(null),[g,_]=B.useState(!1),{confirm:G,ConfirmDialog:m}=p(),l=async()=>{try{let P=await(await M(`/api/keys/${z.id}`)).json();w(P.keys||[])}catch(T){console.error("Failed to fetch keys:",T)}};B.useEffect(()=>{if(X)l()},[z.id,X]),B.useEffect(()=>{if(H)f(null)},[H]);let h=async()=>{if(!W)return;_(!0),f(null);try{let T=await M(`/api/keys/${z.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:W,project_id:b||null})}),P=await T.json();if(T.ok)F(""),I(""),N(),l(),Q();else f(P.error||"Failed to save key")}catch(T){console.error("Failed to save key:",T),f("Failed to save key")}_(!1)},v=async(T,P)=>{if(!await G(`Are you sure you want to remove this API key${P?` (${P})`:""}?`,{confirmText:"Remove",title:"Remove API Key"}))return;try{await M(`/api/keys/by-id/${T}`,{method:"DELETE"}),l(),Q()}catch(r){console.error("Failed to delete key:",r)}},S=A.find((T)=>!T.project_id),n=A.filter((T)=>T.project_id),d=(T)=>Z.find((P)=>P.id===T)?.name||"Unknown",a=(T)=>Z.find((P)=>P.id===T)?.color||"#666";if(!X)return q.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 ${z.hasKey?"border-[#f97316]/20":"border-[#1a1a1a]"}`,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-[#666]",children:z.description||"MCP integration"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.hasKey?q.jsxDEV("span",{className:"text-[#f97316] text-xs flex items-center gap-1 bg-[#f97316]/10 px-2 py-1 rounded",children:[q.jsxDEV(K,{className:"w-3 h-3"},void 0,!1,void 0,this),z.keyHint]},void 0,!0,void 0,this):q.jsxDEV("span",{className:"text-[#666] text-xs bg-[#1a1a1a] 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-[#1a1a1a]",children:H?q.jsxDEV("div",{className:"space-y-3",children:[q.jsxDEV("input",{type:"password",value:W,onChange:(T)=>F(T.target.value),placeholder:z.hasKey?"Enter new API key...":"Enter API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),Y&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:Y},void 0,!1,void 0,this),R&&q.jsxDEV("p",{className:"text-green-400 text-sm",children:R},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:N,className:"flex-1 px-3 py-1.5 border border-[#333] rounded text-sm hover:border-[#666]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:O,disabled:!W||L,className:"flex-1 px-3 py-1.5 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:$?"Validating...":L?"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:J,className:"text-sm text-[#888] hover:text-[#e0e0e0]",children:"Update key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:U,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:J,className:"text-sm text-[#f97316] hover:text-[#fb923c]",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);return q.jsxDEV(q.Fragment,{children:[m,q.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 ${A.length>0?"border-[#f97316]/20":"border-[#1a1a1a]"}`,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-[#666]",children:z.description||"MCP integration"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A.length>0?q.jsxDEV("span",{className:"text-[#f97316] text-xs flex items-center gap-1 bg-[#f97316]/10 px-2 py-1 rounded",children:[q.jsxDEV(K,{className:"w-3 h-3"},void 0,!1,void 0,this),A.length," key",A.length!==1?"s":""]},void 0,!0,void 0,this):q.jsxDEV("span",{className:"text-[#666] text-xs bg-[#1a1a1a] px-2 py-1 rounded",children:"Not configured"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A.length>0&&q.jsxDEV("div",{className:"mt-3 space-y-2",children:[S&&q.jsxDEV("div",{className:"flex items-center justify-between text-sm bg-[#0a0a0a] rounded px-3 py-2",children:[q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("span",{className:"text-[#888]",children:"Global"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#555]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#666] font-mono text-xs",children:S.key_hint},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>v(S.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),n.slice(0,k?void 0:2).map((T)=>q.jsxDEV("div",{className:"flex items-center justify-between text-sm bg-[#0a0a0a] 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:a(T.project_id)}},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#888] truncate",children:T.name||d(T.project_id)},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#555]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#666] font-mono text-xs",children:T.key_hint},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>v(T.id,T.name||d(T.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)]},T.id,!0,void 0,this)),n.length>2&&!k&&q.jsxDEV("button",{onClick:()=>u(!0),className:"text-xs text-[#666] hover:text-[#888] w-full text-center py-1",children:["Show ",n.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-[#1a1a1a]",children:H?q.jsxDEV("div",{className:"space-y-3",children:[q.jsxDEV("input",{type:"password",value:W,onChange:(T)=>F(T.target.value),placeholder:"Enter API key...",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),q.jsxDEV(E,{value:b,onChange:I,placeholder:"Global (all projects)",options:[{value:"",label:"Global (all projects)"},...Z.map((T)=>({value:T.id,label:T.name}))]},void 0,!1,void 0,this),C&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:C},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:()=>{N(),I(""),f(null)},className:"flex-1 px-3 py-1.5 border border-[#333] rounded text-sm hover:border-[#666]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:h,disabled:!W||g,className:"flex-1 px-3 py-1.5 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:g?"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:A.length>0?"View docs":"Get API key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:J,className:"text-sm text-[#f97316] hover:text-[#fb923c]",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 Yq(){let{authFetch:z}=y(),[H,W]=B.useState([]),[L,$]=B.useState(!1),[Y,R]=B.useState(""),[J,N]=B.useState("90"),[F,O]=B.useState(!1),[U,X]=B.useState(null),[Z,Q]=B.useState(null),[M,A]=B.useState(!1),{confirm:w,ConfirmDialog:b}=p(),I=async()=>{try{let G=await(await z("/api/keys/personal")).json();W(G.keys||[])}catch{}};B.useEffect(()=>{I()},[]);let k=async()=>{if(!Y.trim()){X("Name is required");return}O(!0),X(null);try{let _=await z("/api/keys/personal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Y.trim(),expires_in_days:J?parseInt(J):null})}),G=await _.json();if(!_.ok)X(G.error||"Failed to create key");else Q(G.key),R(""),N("90"),I()}catch{X("Failed to create key")}O(!1)},u=async(_,G)=>{if(!await w(`Delete API key "${G}"? This cannot be undone.`,{confirmText:"Delete",title:"Delete API Key"}))return;try{await z(`/api/keys/personal/${_}`,{method:"DELETE"}),I()}catch{}},C=()=>{if(Z)navigator.clipboard.writeText(Z),A(!0),setTimeout(()=>A(!1),2000)},f=(_)=>{if(!_)return"Never";return new Date(_).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},g=(_)=>{if(!_)return!1;return new Date(_)<new Date};return q.jsxDEV(q.Fragment,{children:[b,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-[#666]",children:["Create personal API keys for programmatic access. Use them with the ",q.jsxDEV("code",{className:"text-[#888] bg-[#1a1a1a] 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),!L&&!Z&&q.jsxDEV("button",{onClick:()=>{$(!0),X(null)},className:"flex items-center gap-2 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition flex-shrink-0",children:[q.jsxDEV(D,{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),Z&&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(K,{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-[#888] 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-[#0a0a0a] px-3 py-2 rounded font-mono text-sm text-[#e0e0e0] break-all select-all",children:Z},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:C,className:"px-3 py-2 bg-[#1a1a1a] hover:bg-[#222] rounded text-sm flex-shrink-0",children:M?"Copied!":"Copy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>{Q(null),$(!1)},className:"mt-3 text-sm text-[#666] hover:text-[#888]",children:"Done"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L&&!Z&&q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg 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-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:Y,onChange:(_)=>R(_.target.value),placeholder:"e.g. CI Pipeline, My Script",autoFocus:!0,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Expiration"},void 0,!1,void 0,this),q.jsxDEV("select",{value:J,onChange:(_)=>N(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]",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),U&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:U},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:()=>{$(!1),X(null),R("")},className:"flex-1 px-3 py-2 border border-[#333] rounded text-sm hover:border-[#666]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:k,disabled:F||!Y.trim(),className:"flex-1 px-3 py-2 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:F?"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),H.length===0?q.jsxDEV("div",{className:"text-center py-12 text-[#666]",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:H.map((_)=>q.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 flex items-center gap-4 ${!_.is_active||g(_.expires_at)?"border-[#1a1a1a] opacity-60":"border-[#1a1a1a]"}`,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&&g(_.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-[#666]",children:[q.jsxDEV("code",{className:"font-mono text-xs bg-[#0a0a0a] px-2 py-0.5 rounded",children:[_.prefix,"..."]},void 0,!0,void 0,this),q.jsxDEV("span",{children:["Created ",f(_.created_at)]},void 0,!0,void 0,this),_.expires_at&&q.jsxDEV("span",{children:["Expires ",f(_.expires_at)]},void 0,!0,void 0,this),_.last_used_at&&q.jsxDEV("span",{children:["Last used ",f(_.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:()=>u(_.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),H.length>0&&q.jsxDEV("div",{className:"mt-6 bg-[#111] border border-[#1a1a1a] rounded-lg 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-[#0a0a0a] px-3 py-2 rounded font-mono text-xs text-[#888]",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 Zq(){let{authFetch:z,user:H}=y(),[W,L]=B.useState(""),[$,Y]=B.useState(""),[R,J]=B.useState(""),[N,F]=B.useState(!1),[O,U]=B.useState(null),X=async()=>{if(!W||!$||!R){U({type:"error",text:"All fields are required"});return}if($!==R){U({type:"error",text:"New passwords do not match"});return}if($.length<8){U({type:"error",text:"Password must be at least 8 characters"});return}F(!0),U(null);try{let Z=await z("/api/auth/password",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:W,newPassword:$})}),Q=await Z.json();if(Z.ok)U({type:"success",text:"Password updated successfully"}),L(""),Y(""),J("");else U({type:"error",text:Q.error||"Failed to update password"})}catch{U({type:"error",text:"Failed to update password"})}F(!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-[#666]",children:"Manage your account and security."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg 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-[#666]",children:"Username"},void 0,!1,void 0,this),q.jsxDEV("span",{children:H.username},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.email&&q.jsxDEV("div",{className:"flex justify-between",children:[q.jsxDEV("span",{className:"text-[#666]",children:"Email"},void 0,!1,void 0,this),q.jsxDEV("span",{children:H.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-[#666]",children:"Role"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"capitalize",children:H.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-[#111] border border-[#1a1a1a] rounded-lg 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-[#666] mb-1",children:"Current Password"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:W,onChange:(Z)=>L(Z.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"New Password"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:$,onChange:(Z)=>Y(Z.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Confirm New Password"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:R,onChange:(Z)=>J(Z.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),O&&q.jsxDEV("div",{className:`p-3 rounded text-sm ${O.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:O.text},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:X,disabled:N||!W||!$||!R,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 disabled:cursor-not-allowed text-black rounded text-sm font-medium transition",children:N?"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 $q(){let{authFetch:z}=y(),[H,W]=B.useState(!1),[L,$]=B.useState(null),[Y,R]=B.useState(null),{confirm:J,ConfirmDialog:N}=p(),F=async()=>{try{let X=await(await z("/api/telemetry/stats")).json();R(X.stats?.total_events||0)}catch{R(null)}};B.useEffect(()=>{F()},[]);let O=async()=>{if(!await J("Are you sure you want to delete all telemetry data? This cannot be undone.",{confirmText:"Clear All",title:"Clear Telemetry Data"}))return;W(!0),$(null);try{let X=await z("/api/telemetry/clear",{method:"POST"}),Z=await X.json();if(X.ok)$({type:"success",text:`Cleared ${Z.deleted||0} telemetry events.`}),R(0);else $({type:"error",text:Z.error||"Failed to clear telemetry"})}catch{$({type:"error",text:"Failed to clear telemetry"})}W(!1)};return q.jsxDEV(q.Fragment,{children:[N,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-[#666]",children:"Manage stored data and telemetry."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:[q.jsxDEV("h3",{className:"font-medium mb-2",children:"Telemetry Data"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:Y!==null?`${Y.toLocaleString()} events stored`:"Loading..."},void 0,!1,void 0,this),L&&q.jsxDEV("div",{className:`mb-4 p-3 rounded text-sm ${L.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:L.text},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:O,disabled:H||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:H?"Clearing...":"Clear All Telemetry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{Lq as c};
3
+
4
+ //# debugId=2E8C7516864699E164756E2164756E21
@@ -0,0 +1,4 @@
1
+ import{P as n,T as e}from"./App.tb0y0jmt.js";var o=n(e(),1);function t({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function i({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function a({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function s({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function c({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function l({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function u({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function h({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function d({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function k({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function p({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function v({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function L({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function M({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function m({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function g({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function f({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function w({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function I({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function C({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function W({className:r="w-5 h-5"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function P({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function N({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h5M20 20v-5h-5"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.49 9A9 9 0 005.64 5.64L4 4m16 16l-1.64-1.64A9 9 0 013.51 15"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function B({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3"},void 0,!1,void 0,this),o.jsxDEV("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function z({className:r="w-4 h-4"}){return o.jsxDEV("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"},void 0,!1,void 0,this),o.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 14l2 2 4-4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{t as j,i as k,a as l,s as m,c as n,l as o,u as p,h as q,d as r,k as s,p as t,v as u,L as v,M as w,m as x,g as y,f as z,w as A,I as B,C,W as D,P as E,N as F,B as G,z as H};
3
+
4
+ //# debugId=4B77A3DD32DFBFD364756E2164756E21
@@ -0,0 +1,4 @@
1
+ import{P as L,S as P,T as N}from"./App.tb0y0jmt.js";var z=L(P(),1),w=L(N(),1);function U({children:q,onClose:y}){return w.jsxDEV("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:w.jsxDEV("div",{className:"bg-[#111] rounded p-6 w-full max-w-xl lg:max-w-2xl border border-[#1a1a1a] max-h-[90vh] overflow-y-auto",children:q},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Q({title:q,message:y,confirmText:F="Confirm",cancelText:B="Cancel",confirmVariant:G="danger",onConfirm:I,onCancel:J}){return w.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:w.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-sm",children:[q&&w.jsxDEV("h3",{className:"font-medium mb-2",children:q},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-sm text-[#ccc] mb-4",children:y},void 0,!1,void 0,this),w.jsxDEV("div",{className:"flex gap-2",children:[w.jsxDEV("button",{onClick:J,className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:B},void 0,!1,void 0,this),w.jsxDEV("button",{onClick:I,className:`flex-1 text-sm text-white px-4 py-2 rounded transition ${G==="danger"?"bg-red-500 hover:bg-red-600":"bg-[#f97316] hover:bg-[#ea580c]"}`,children:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function R({title:q,message:y,buttonText:F="OK",variant:B="info",onClose:G}){let I={error:"bg-red-500/20 text-red-400",success:"bg-green-500/20 text-green-400",info:"bg-blue-500/20 text-blue-400"},J={error:"✕",success:"✓",info:"ℹ"};return w.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:w.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-sm text-center",children:[w.jsxDEV("div",{className:`w-12 h-12 rounded-full flex items-center justify-center mx-auto mb-3 ${I[B]}`,children:w.jsxDEV("span",{className:"text-xl",children:J[B]},void 0,!1,void 0,this)},void 0,!1,void 0,this),q&&w.jsxDEV("h3",{className:"font-medium mb-2",children:q},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-sm text-[#ccc] mb-4",children:y},void 0,!1,void 0,this),w.jsxDEV("button",{onClick:G,className:"w-full text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function W(){let[q,y]=z.useState(null),F=z.useCallback((J,K={})=>{return new Promise((O)=>{y({message:J,options:K,resolve:O})})},[]),B=z.useCallback(()=>{q?.resolve(!0),y(null)},[q]),G=z.useCallback(()=>{q?.resolve(!1),y(null)},[q]),I=q?w.jsxDEV(Q,{title:q.options.title,message:q.message,confirmText:q.options.confirmText,cancelText:q.options.cancelText,confirmVariant:q.options.confirmVariant,onConfirm:B,onCancel:G},void 0,!1,void 0,this):null;return{confirm:F,ConfirmDialog:I}}function X(){let[q,y]=z.useState(null),F=z.useCallback((I,J={})=>{return new Promise((K)=>{y({message:I,options:J,resolve:K})})},[]),B=z.useCallback(()=>{q?.resolve(),y(null)},[q]),G=q?w.jsxDEV(R,{title:q.options.title,message:q.message,buttonText:q.options.buttonText,variant:q.options.variant,onClose:B},void 0,!1,void 0,this):null;return{alert:F,AlertDialog:G}}
2
+ export{U as K,W as L,X as M};
3
+
4
+ //# debugId=CB335D675CF2597064756E2164756E21
@@ -0,0 +1,4 @@
1
+ import{P as i,S as p,T as u}from"./App.tb0y0jmt.js";var n=i(p(),1),e=i(u(),1);function g({value:o,options:c,onChange:d,placeholder:f="Select..."}){let[a,l]=n.useState(!1),s=n.useRef(null),r=c.find((t)=>t.value===o);return n.useEffect(()=>{function t(m){if(s.current&&!s.current.contains(m.target))l(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]),e.jsxDEV("div",{ref:s,className:"relative",children:[e.jsxDEV("button",{type:"button",onClick:()=>l(!a),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-left flex items-center justify-between focus:outline-none focus:border-[#f97316] text-[#e0e0e0] hover:border-[#333] transition",children:[e.jsxDEV("span",{className:r?"text-[#e0e0e0]":"text-[#666]",children:r?e.jsxDEV(e.Fragment,{children:[r.label,r.recommended&&e.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):f},void 0,!1,void 0,this),e.jsxDEV(v,{isOpen:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&e.jsxDEV("div",{className:"absolute z-50 w-full min-w-max mt-1 bg-[#111] border border-[#222] rounded shadow-lg max-h-60 overflow-y-auto scrollbar-hide",children:c.map((t)=>e.jsxDEV("button",{type:"button",onClick:()=>{d(t.value),l(!1)},className:`w-full px-3 py-2 text-left flex items-center justify-between hover:bg-[#1a1a1a] transition ${t.value===o?"bg-[#1a1a1a] text-[#f97316]":"text-[#e0e0e0]"}`,children:[e.jsxDEV("span",{children:[t.label,t.recommended&&e.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.value===o&&e.jsxDEV("svg",{className:"w-4 h-4 text-[#f97316]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},t.value,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function v({isOpen:o}){return e.jsxDEV("svg",{className:`w-4 h-4 text-[#666] transition-transform ${o?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
2
+ export{g as O};
3
+
4
+ //# debugId=2ADE39C26439DEE764756E2164756E21