apteva 0.4.18 → 0.4.20

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 (84) hide show
  1. package/dist/ActivityPage.h769ek3a.js +3 -0
  2. package/dist/ApiDocsPage.kf6bbwkk.js +4 -0
  3. package/dist/{App.nps62kvt.js → App.039re6cf.js} +3 -3
  4. package/dist/App.2jmkqm8c.js +4 -0
  5. package/dist/{App.np463xvy.js → App.2yy66bnp.js} +3 -3
  6. package/dist/App.3515wsb4.js +4 -0
  7. package/dist/App.7v1w3ys9.js +4 -0
  8. package/dist/{App.nft7h9jt.js → App.c90t3dxg.js} +3 -3
  9. package/dist/App.edwahsvz.js +4 -0
  10. package/dist/App.jfx3der4.js +4 -0
  11. package/dist/App.n4jb3c22.js +13 -0
  12. package/dist/{App.mq6jqare.js → App.p02f4ret.js} +1 -1
  13. package/dist/App.q3bpx15d.js +20 -0
  14. package/dist/App.r0a2nmqs.js +267 -0
  15. package/dist/App.s2yrcz15.js +4 -0
  16. package/dist/App.s5j82a5j.js +4 -0
  17. package/dist/App.tg1b94tx.js +4 -0
  18. package/dist/ConnectionsPage.a67fjgbf.js +3 -0
  19. package/dist/McpPage.d4p3xvtk.js +3 -0
  20. package/dist/SettingsPage.46sqpe39.js +3 -0
  21. package/dist/SkillsPage.j9hkqm99.js +3 -0
  22. package/dist/TasksPage.6pvkb7s7.js +3 -0
  23. package/dist/TelemetryPage.5zq9msb5.js +3 -0
  24. package/dist/TestsPage.24432yqt.js +3 -0
  25. package/dist/apteva-kit.css +1 -1
  26. package/dist/index.html +1 -1
  27. package/dist/styles.css +1 -1
  28. package/package.json +9 -4
  29. package/src/channels/index.ts +40 -0
  30. package/src/channels/telegram.ts +306 -0
  31. package/src/db.ts +180 -0
  32. package/src/integrations/agentdojo.ts +1 -1
  33. package/src/mcp-handler.ts +31 -24
  34. package/src/mcp-platform.ts +353 -2
  35. package/src/providers.ts +22 -9
  36. package/src/routes/api/agents.ts +15 -2
  37. package/src/routes/api/channels.ts +182 -0
  38. package/src/routes/api/integrations.ts +13 -5
  39. package/src/routes/api/mcp.ts +27 -9
  40. package/src/routes/api/system.ts +12 -1
  41. package/src/routes/api/telemetry.ts +30 -0
  42. package/src/routes/api/triggers.ts +22 -2
  43. package/src/routes/api.ts +3 -1
  44. package/src/routes/auth.ts +11 -2
  45. package/src/server.ts +39 -4
  46. package/src/triggers/agentdojo.ts +23 -18
  47. package/src/tui/AgentList.tsx +145 -0
  48. package/src/tui/App.tsx +102 -0
  49. package/src/tui/Login.tsx +104 -0
  50. package/src/tui/api.ts +72 -0
  51. package/src/tui/index.tsx +7 -0
  52. package/src/web/App.tsx +2 -2
  53. package/src/web/components/agents/AgentPanel.tsx +4 -37
  54. package/src/web/components/common/Icons.tsx +8 -0
  55. package/src/web/components/connections/OverviewTab.tsx +22 -68
  56. package/src/web/components/connections/TriggersTab.tsx +549 -70
  57. package/src/web/components/dashboard/Dashboard.tsx +5 -4
  58. package/src/web/components/layout/Header.tsx +196 -4
  59. package/src/web/components/settings/SettingsPage.tsx +269 -1
  60. package/src/web/context/AuthContext.tsx +18 -11
  61. package/src/web/context/TelemetryContext.tsx +14 -1
  62. package/src/web/context/index.ts +1 -1
  63. package/src/web/hooks/useAgents.ts +7 -3
  64. package/src/web/hooks/useOnboarding.ts +9 -30
  65. package/dist/ActivityPage.yv28a2vj.js +0 -3
  66. package/dist/ApiDocsPage.4ccwjjbk.js +0 -4
  67. package/dist/App.155wke5v.js +0 -4
  68. package/dist/App.2e19nvn4.js +0 -13
  69. package/dist/App.2ye1b5n0.js +0 -4
  70. package/dist/App.4da4ycbe.js +0 -4
  71. package/dist/App.b6wtzd1j.js +0 -4
  72. package/dist/App.fjrh28tf.js +0 -4
  73. package/dist/App.htc36cy8.js +0 -4
  74. package/dist/App.me6reaa6.js +0 -4
  75. package/dist/App.n5q6p960.js +0 -4
  76. package/dist/App.q8ws33cc.js +0 -181
  77. package/dist/App.tb0y0jmt.js +0 -40
  78. package/dist/ConnectionsPage.52evzrp7.js +0 -3
  79. package/dist/McpPage.bjqrp0n2.js +0 -3
  80. package/dist/SettingsPage.es76hnj2.js +0 -3
  81. package/dist/SkillsPage.06h8yf0h.js +0 -3
  82. package/dist/TasksPage.99df66mk.js +0 -3
  83. package/dist/TelemetryPage.bmdnxhq7.js +0 -3
  84. package/dist/TestsPage.denxrg8c.js +0 -3
@@ -0,0 +1,4 @@
1
+ import{E as x,j as C,k as j}from"./App.c90t3dxg.js";import{L as o,M as v}from"./App.2yy66bnp.js";import{P as n}from"./App.039re6cf.js";import{Q as D,T as t,U as E,aa as y,da as c}from"./App.q3bpx15d.js";var B=D(t(),1);var q=D(E(),1);function Nq(){let{projectsEnabled:z}=c(),[H,L]=B.useState("general"),T=[{key:"general",label:"General"},{key:"providers",label:"Providers"},...z?[{key:"projects",label:"Projects"}]:[],{key:"channels",label:"Channels"},{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:T.map((J)=>q.jsxDEV("button",{onClick:()=>L(J.key),className:`flex-shrink-0 px-4 py-3 text-sm font-medium border-b-2 transition ${H===J.key?"border-[#f97316] text-[#f97316]":"border-transparent text-[#666] hover:text-[#888]"}`,children:J.label},J.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:T.map((J)=>q.jsxDEV(s,{label:J.label,active:H===J.key,onClick:()=>L(J.key)},J.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==="channels"&&q.jsxDEV(Gq,{},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:L}){return q.jsxDEV("button",{onClick:L,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,L]=B.useState(""),[T,J]=B.useState(!0),[G,N]=B.useState(!1),[_,U]=B.useState(null);B.useEffect(()=>{(async()=>{try{let Y=await(await z("/api/settings/instance-url")).json();L(Y.instance_url||"")}catch{}J(!1)})()},[]);let R=async()=>{N(!0),U(null);try{let O=await z("/api/settings/instance-url",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({instance_url:H})}),M=await O.json();if(O.ok)L(M.instance_url||""),U({type:"success",text:"Instance URL saved"});else U({type:"error",text:M.error||"Failed to save"})}catch{U({type:"error",text:"Failed to save"})}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:"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),T?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)=>L(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),_&&q.jsxDEV("div",{className:`p-3 rounded text-sm ${_.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:_.text},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:R,disabled:G,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black rounded text-sm font-medium transition",children:G?"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:L}=c(),[T,J]=B.useState([]),[G,N]=B.useState(null),[_,U]=B.useState(""),[R,O]=B.useState(!1),[M,Y]=B.useState(!1),[W,Q]=B.useState(null),[b,F]=B.useState(null),{confirm:I,ConfirmDialog:K}=v(),w=async()=>{let m=await(await z("/api/providers")).json();J(m.providers||[])};B.useEffect(()=>{w()},[]);let f=async()=>{if(!G||!_)return;O(!0),Q(null),F(null);try{Y(!0);let m=await(await z(`/api/keys/${G}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:_})})).json();if(Y(!1),!m.valid){Q(m.error||"API key is invalid"),O(!1);return}let l=await z(`/api/keys/${G}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:_})}),h=await l.json();if(!l.ok)Q(h.error||"Failed to save key");else{let p="API key saved!";if(h.restartedAgents&&h.restartedAgents.length>0){let u=h.restartedAgents.filter((V)=>V.success).length;if(h.restartedAgents.length-u===0)p+=` Restarted ${u} agent${u>1?"s":""} with new key.`;else p+=` Restarted ${u}/${h.restartedAgents.length} agents.`}F(p),U(""),N(null),w()}}catch($){Q("Failed to save key")}O(!1)},g=async($)=>{if(!await I("Are you sure you want to remove this API key?",{confirmText:"Remove",title:"Remove API Key"}))return;await z(`/api/keys/${$}`,{method:"DELETE"}),w()},k=T.filter(($)=>$.type==="llm"),P=T.filter(($)=>$.type==="integration"),Z=k.filter(($)=>$.hasKey).length,X=P.filter(($)=>$.hasKey).length;return B.useEffect(()=>{if(b&&!G){let $=setTimeout(()=>F(null),5000);return()=>clearTimeout($)}},[b,G]),q.jsxDEV(q.Fragment,{children:[K,q.jsxDEV("div",{className:"space-y-10",children:[b&&!G&&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(C,{className:"w-5 h-5"},void 0,!1,void 0,this),q.jsxDEV("span",{children:b},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>F(null),className:"text-green-400 hover:text-green-300",children:q.jsxDEV(j,{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. ",Z," of ",k.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:k.map(($)=>q.jsxDEV(Qq,{provider:$,isEditing:G===$.id,apiKey:_,saving:R,testing:M,error:G===$.id?W:null,success:G===$.id?b:null,onStartEdit:()=>{N($.id),Q(null),F(null)},onCancelEdit:()=>{N(null),U(""),Q(null)},onApiKeyChange:U,onSave:f,onDelete:()=>g($.id)},$.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. ",X," 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.jsxDEV(Xq,{provider:$,isEditing:G===$.id,apiKey:_,saving:R,testing:M,error:G===$.id?W:null,success:G===$.id?b:null,onStartEdit:()=>{N($.id),Q(null),F(null)},onCancelEdit:()=>{N(null),U(""),Q(null)},onApiKeyChange:U,onSave:f,onDelete:()=>g($.id),projectsEnabled:L,projects:H,onRefresh:w},$.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 i=["#f97316","#6366f1","#22c55e","#ef4444","#3b82f6","#a855f7","#14b8a6","#f59e0b"];function zq(){let{projects:z,createProject:H,updateProject:L,deleteProject:T}=c(),[J,G]=B.useState(!1),[N,_]=B.useState(null),{confirm:U,ConfirmDialog:R}=v(),O=async(Q)=>{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 T(Q)},M=()=>{_(null),G(!0)},Y=(Q)=>{_(Q),G(!0)},W=()=>{G(!1),_(null)};return q.jsxDEV(q.Fragment,{children:[R,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:M,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(x,{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:()=>Y(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),J&&q.jsxDEV(Bq,{project:N,onSave:async(Q)=>{if(N){let b=await L(N.id,Q);if(b)W();return!!b}else{let b=await H(Q);if(b)W();return!!b}},onClose:W},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:L}){let[T,J]=B.useState(z?.name||""),[G,N]=B.useState(z?.description||""),[_,U]=B.useState(z?.color||i[Math.floor(Math.random()*i.length)]),[R,O]=B.useState(!1),[M,Y]=B.useState(null),W=async()=>{if(!T.trim()){Y("Name is required");return}O(!0),Y(null);let Q=await H({name:T,description:G||void 0,color:_});if(O(!1),!Q)Y(z?"Failed to update project":"Failed to create project")};return q.jsxDEV(o,{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-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:T,onChange:(Q)=>J(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:G,onChange:(Q)=>N(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:i.map((Q)=>q.jsxDEV("button",{type:"button",onClick:()=>U(Q),className:`w-10 h-10 rounded-full transition ${_===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),M&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:M},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-[#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:W,disabled:R||!T.trim(),className:"flex-1 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:R?"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,L]=B.useState(null),[T,J]=B.useState(!1),[G,N]=B.useState(!1),[_,U]=B.useState(null),[R,O]=B.useState(null),[M,Y]=B.useState(null),W=async()=>{J(!0),U(null);try{let I=await z("/api/version");if(!I.ok)throw Error("Failed to check for updates");let K=await I.json();L(K)}catch(I){U("Failed to check for updates")}J(!1)},Q=async()=>{N(!0),U(null),O(null);try{let K=await(await z("/api/version/update",{method:"POST"})).json();if(!K.success)U(K.error||"Update failed");else{let w=K.restarted?.length||0,f=w>0?` ${w} running agent${w>1?"s":""} restarted.`:"";O(`Agent binary updated to v${K.version}.${f}`),await W()}}catch(I){U("Failed to update agent")}N(!1)};B.useEffect(()=>{W()},[]);let b=(I,K)=>{navigator.clipboard.writeText(I),Y(K),setTimeout(()=>Y(null),2000)},F=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),T&&!H?q.jsxDEV("div",{className:"text-[#666]",children:"Checking version info..."},void 0,!1,void 0,this):_&&!H?q.jsxDEV("div",{className:"text-red-400",children:_},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),F?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"),Y("docker"),setTimeout(()=>Y(null),2000)},className:"mt-3 px-3 py-1.5 bg-[#1a1a1a] hover:bg-[#222] rounded text-sm",children:M==="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(C,{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:[R&&q.jsxDEV("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4 text-green-400",children:R},void 0,!1,void 0,this),_&&q.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4 text-red-400",children:_},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:()=>b("npx apteva@latest","apteva"),className:"px-3 py-2 bg-[#1a1a1a] hover:bg-[#222] rounded text-sm",children:M==="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(C,{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:G,className:"px-4 py-2 bg-[#f97316] text-black rounded font-medium text-sm disabled:opacity-50",children:G?"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(C,{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),!F&&!R&&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(C,{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:W,disabled:T,className:"text-sm text-[#666] hover:text-[#888] disabled:opacity-50",children:T?"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:L,saving:T,testing:J,error:G,success:N,onStartEdit:_,onCancelEdit:U,onApiKeyChange:R,onSave:O,onDelete:M}){let Y=z.id==="ollama",[W,Q]=B.default.useState(null);return B.default.useEffect(()=>{if(Y&&z.hasKey)fetch("/api/providers/ollama/status").then((b)=>b.json()).then((b)=>Q({connected:b.connected,modelCount:b.modelCount})).catch(()=>Q({connected:!1}))},[Y,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":Y?"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 ${Y&&W?W.connected?"text-green-400 bg-green-500/10":"text-yellow-400 bg-yellow-500/10":"text-green-400 bg-green-500/10"}`,children:Y&&W?W.connected?q.jsxDEV(q.Fragment,{children:[q.jsxDEV(C,{className:"w-3 h-3"},void 0,!1,void 0,this),W.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(C,{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:Y?"text":"password",value:L,onChange:(b)=>R(b.target.value),placeholder:Y?"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),Y&&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),G&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:G},void 0,!1,void 0,this),N&&q.jsxDEV("p",{className:"text-green-400 text-sm",children:N},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-[#333] rounded text-sm hover:border-[#666]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:O,disabled:!L||T,className:"flex-1 px-3 py-1.5 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:J?"Validating...":T?"Saving...":Y?"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:Y?"Download Ollama":"View docs"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-3",children:[q.jsxDEV("button",{onClick:_,className:"text-sm text-[#888] hover:text-[#e0e0e0]",children:Y?"Change URL":"Update key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:M,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:Y?"Download Ollama":"Get API key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:_,className:"text-sm text-[#f97316] hover:text-[#fb923c]",children:Y?"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:L,saving:T,testing:J,error:G,success:N,onStartEdit:_,onCancelEdit:U,onApiKeyChange:R,onSave:O,onDelete:M,projectsEnabled:Y,projects:W,onRefresh:Q}){let{authFetch:b}=y(),[F,I]=B.useState([]),[K,w]=B.useState(""),[f,g]=B.useState(!1),[k,P]=B.useState(null),[Z,X]=B.useState(!1),{confirm:$,ConfirmDialog:m}=v(),l=async()=>{try{let S=await(await b(`/api/keys/${z.id}`)).json();I(S.keys||[])}catch(A){console.error("Failed to fetch keys:",A)}};B.useEffect(()=>{if(Y)l()},[z.id,Y]),B.useEffect(()=>{if(H)P(null)},[H]);let h=async()=>{if(!L)return;X(!0),P(null);try{let A=await b(`/api/keys/${z.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:L,project_id:K||null})}),S=await A.json();if(A.ok)R(""),w(""),U(),l(),Q();else P(S.error||"Failed to save key")}catch(A){console.error("Failed to save key:",A),P("Failed to save key")}X(!1)},p=async(A,S)=>{if(!await $(`Are you sure you want to remove this API key${S?` (${S})`:""}?`,{confirmText:"Remove",title:"Remove API Key"}))return;try{await b(`/api/keys/by-id/${A}`,{method:"DELETE"}),l(),Q()}catch(r){console.error("Failed to delete key:",r)}},u=F.find((A)=>!A.project_id),d=F.filter((A)=>A.project_id),V=(A)=>W.find((S)=>S.id===A)?.name||"Unknown",a=(A)=>W.find((S)=>S.id===A)?.color||"#666";if(!Y)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(C,{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:L,onChange:(A)=>R(A.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),G&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:G},void 0,!1,void 0,this),N&&q.jsxDEV("p",{className:"text-green-400 text-sm",children:N},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-[#333] rounded text-sm hover:border-[#666]",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:O,disabled:!L||T,className:"flex-1 px-3 py-1.5 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:J?"Validating...":T?"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:_,className:"text-sm text-[#888] hover:text-[#e0e0e0]",children:"Update key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:M,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:_,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 ${F.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),F.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(C,{className:"w-3 h-3"},void 0,!1,void 0,this),F.length," key",F.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),F.length>0&&q.jsxDEV("div",{className:"mt-3 space-y-2",children:[u&&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:u.key_hint},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>p(u.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,f?void 0:2).map((A)=>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(A.project_id)}},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#888] truncate",children:A.name||V(A.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:A.key_hint},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("button",{onClick:()=>p(A.id,A.name||V(A.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)]},A.id,!0,void 0,this)),d.length>2&&!f&&q.jsxDEV("button",{onClick:()=>g(!0),className:"text-xs text-[#666] hover:text-[#888] 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-[#1a1a1a]",children:H?q.jsxDEV("div",{className:"space-y-3",children:[q.jsxDEV("input",{type:"password",value:L,onChange:(A)=>R(A.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(n,{value:K,onChange:w,placeholder:"Global (all projects)",options:[{value:"",label:"Global (all projects)"},...W.map((A)=>({value:A.id,label:A.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(),w(""),P(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:!L||Z,className:"flex-1 px-3 py-1.5 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:Z?"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:F.length>0?"View docs":"Get API key"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:_,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,L]=B.useState([]),[T,J]=B.useState(!1),[G,N]=B.useState(""),[_,U]=B.useState("90"),[R,O]=B.useState(!1),[M,Y]=B.useState(null),[W,Q]=B.useState(null),[b,F]=B.useState(!1),{confirm:I,ConfirmDialog:K}=v(),w=async()=>{try{let $=await(await z("/api/keys/personal")).json();L($.keys||[])}catch{}};B.useEffect(()=>{w()},[]);let f=async()=>{if(!G.trim()){Y("Name is required");return}O(!0),Y(null);try{let X=await z("/api/keys/personal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:G.trim(),expires_in_days:_?parseInt(_):null})}),$=await X.json();if(!X.ok)Y($.error||"Failed to create key");else Q($.key),N(""),U("90"),w()}catch{Y("Failed to create key")}O(!1)},g=async(X,$)=>{if(!await I(`Delete API key "${$}"? This cannot be undone.`,{confirmText:"Delete",title:"Delete API Key"}))return;try{await z(`/api/keys/personal/${X}`,{method:"DELETE"}),w()}catch{}},k=()=>{if(W)navigator.clipboard.writeText(W),F(!0),setTimeout(()=>F(!1),2000)},P=(X)=>{if(!X)return"Never";return new Date(X).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},Z=(X)=>{if(!X)return!1;return new Date(X)<new Date};return q.jsxDEV(q.Fragment,{children:[K,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),!T&&!W&&q.jsxDEV("button",{onClick:()=>{J(!0),Y(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(x,{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),W&&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(C,{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:W},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:k,className:"px-3 py-2 bg-[#1a1a1a] hover:bg-[#222] 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:()=>{Q(null),J(!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),T&&!W&&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:G,onChange:(X)=>N(X.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:_,onChange:(X)=>U(X.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),M&&q.jsxDEV("p",{className:"text-red-400 text-sm",children:M},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[q.jsxDEV("button",{onClick:()=>{J(!1),Y(null),N("")},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:f,disabled:R||!G.trim(),className:"flex-1 px-3 py-2 bg-[#f97316] text-black rounded text-sm font-medium disabled:opacity-50",children:R?"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((X)=>q.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 flex items-center gap-4 ${!X.is_active||Z(X.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:X.name},void 0,!1,void 0,this),!X.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),X.is_active&&Z(X.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:[X.prefix,"..."]},void 0,!0,void 0,this),q.jsxDEV("span",{children:["Created ",P(X.created_at)]},void 0,!0,void 0,this),X.expires_at&&q.jsxDEV("span",{children:["Expires ",P(X.expires_at)]},void 0,!0,void 0,this),X.last_used_at&&q.jsxDEV("span",{children:["Last used ",P(X.last_used_at)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X.is_active&&q.jsxDEV("button",{onClick:()=>g(X.id,X.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)]},X.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(),[L,T]=B.useState(""),[J,G]=B.useState(""),[N,_]=B.useState(""),[U,R]=B.useState(!1),[O,M]=B.useState(null),Y=async()=>{if(!L||!J||!N){M({type:"error",text:"All fields are required"});return}if(J!==N){M({type:"error",text:"New passwords do not match"});return}if(J.length<8){M({type:"error",text:"Password must be at least 8 characters"});return}R(!0),M(null);try{let W=await z("/api/auth/password",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:L,newPassword:J})}),Q=await W.json();if(W.ok)M({type:"success",text:"Password updated successfully"}),T(""),G(""),_("");else M({type:"error",text:Q.error||"Failed to update password"})}catch{M({type:"error",text:"Failed to update password"})}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:"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:L,onChange:(W)=>T(W.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:J,onChange:(W)=>G(W.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:N,onChange:(W)=>_(W.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:Y,disabled:U||!L||!J||!N,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: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 $q(){let{authFetch:z}=y(),[H,L]=B.useState(!1),[T,J]=B.useState(null),[G,N]=B.useState(null),{confirm:_,ConfirmDialog:U}=v(),R=async()=>{try{let Y=await(await z("/api/telemetry/stats")).json();N(Y.stats?.total_events||0)}catch{N(null)}};B.useEffect(()=>{R()},[]);let O=async()=>{if(!await _("Are you sure you want to delete all telemetry data? This cannot be undone.",{confirmText:"Clear All",title:"Clear Telemetry Data"}))return;L(!0),J(null);try{let Y=await z("/api/telemetry/clear",{method:"POST"}),W=await Y.json();if(Y.ok)J({type:"success",text:`Cleared ${W.deleted||0} telemetry events.`}),N(0);else J({type:"error",text:W.error||"Failed to clear telemetry"})}catch{J({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-[#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:G!==null?`${G.toLocaleString()} events stored`:"Loading..."},void 0,!1,void 0,this),T&&q.jsxDEV("div",{className:`mb-4 p-3 rounded text-sm ${T.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:T.text},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:O,disabled:H||G===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)}function Gq(){let{authFetch:z}=y(),[H,L]=B.useState([]),[T,J]=B.useState([]),[G,N]=B.useState(!0),[_,U]=B.useState(!1),[R,O]=B.useState({name:"",agent_id:"",botToken:""}),[M,Y]=B.useState(!1),[W,Q]=B.useState(null),{confirm:b,ConfirmDialog:F}=v(),I=async()=>{try{let X=await(await z("/api/channels")).json();L(X.channels||[])}catch{}finally{N(!1)}},K=async()=>{try{let X=await(await z("/api/agents")).json();J((X.agents||[]).map(($)=>({id:$.id,name:$.name,status:$.status})))}catch{}};B.useEffect(()=>{I(),K()},[]);let w=async()=>{if(!R.name||!R.agent_id||!R.botToken)return;Y(!0),Q(null);try{let Z=await z("/api/channels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"telegram",name:R.name,agent_id:R.agent_id,config:{botToken:R.botToken}})});if(!Z.ok){let X=await Z.json();Q(X.error||"Failed to create channel")}else O({name:"",agent_id:"",botToken:""}),U(!1),await I()}catch(Z){Q(Z.message)}finally{Y(!1)}},f=async(Z)=>{let X=Z.status==="running"?"stop":"start";try{let $=await z(`/api/channels/${Z.id}/${X}`,{method:"POST"});if(!$.ok){let m=await $.json();Q(m.error||`Failed to ${X} channel`)}await I()}catch{Q(`Failed to ${X} channel`)}},g=async(Z)=>{if(!await b(`Delete channel "${Z.name}"?`,{confirmText:"Delete",title:"Delete Channel"}))return;try{await z(`/api/channels/${Z.id}`,{method:"DELETE"}),await I()}catch{}},k={running:"bg-green-500/20 text-green-400",stopped:"bg-[#333] text-[#666]",error:"bg-red-500/20 text-red-400"},P=(Z)=>{return T.find((X)=>X.id===Z)?.name||Z};return q.jsxDEV(q.Fragment,{children:[F,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-[#666]",children:"Connect agents to external messaging platforms"},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-3 py-1.5 rounded text-sm font-medium transition",children:[q.jsxDEV(x,{},void 0,!1,void 0,this)," Add Channel"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W&&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:W},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>Q(null),className:"text-red-400 hover:text-red-300 ml-2",children:q.jsxDEV(j,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_&&q.jsxDEV("div",{className:"mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-4 space-y-3",children:[q.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-2",children:"New Telegram Channel"},void 0,!1,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Channel Name"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"text",value:R.name,onChange:(Z)=>O((X)=>({...X,name:Z.target.value})),placeholder:"e.g. My Telegram Bot",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Agent"},void 0,!1,void 0,this),q.jsxDEV(n,{value:R.agent_id,options:T.map((Z)=>({value:Z.id,label:Z.name})),onChange:(Z)=>O((X)=>({...X,agent_id:Z})),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-[#666] mb-1",children:"Bot Token"},void 0,!1,void 0,this),q.jsxDEV("input",{type:"password",value:R.botToken,onChange:(Z)=>O((X)=>({...X,botToken:Z.target.value})),placeholder:"From @BotFather on Telegram",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:["Create a bot via ",q.jsxDEV("a",{href:"https://t.me/BotFather",target:"_blank",className:"text-[#f97316] 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:w,disabled:M||!R.name||!R.agent_id||!R.botToken,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-1.5 rounded text-sm font-medium transition",children:M?"Creating...":"Create"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>{U(!1),O({name:"",agent_id:"",botToken:""})},className:"border border-[#333] hover:border-[#444] 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),G?q.jsxDEV("p",{className:"text-[#666] text-sm",children:"Loading channels..."},void 0,!1,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 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:H.map((Z)=>q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg 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:Z.name},void 0,!1,void 0,this),q.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${k[Z.status]||k.stopped}`,children:Z.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("p",{className:"text-sm text-[#666]",children:[Z.type==="telegram"?"Telegram":Z.type," → ",P(Z.agent_id)]},void 0,!0,void 0,this),Z.status==="error"&&Z.error&&q.jsxDEV("p",{className:"text-xs text-red-400 mt-1",children:Z.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:()=>f(Z),className:`px-3 py-1 rounded text-xs font-medium transition ${Z.status==="running"?"bg-[#f97316]/20 text-[#f97316] hover:bg-[#f97316]/30":"bg-[#3b82f6]/20 text-[#3b82f6] hover:bg-[#3b82f6]/30"}`,children:Z.status==="running"?"Stop":"Start"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>g(Z),className:"text-[#666] 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)},Z.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{Nq as c};
3
+
4
+ //# debugId=94748AB622E888B364756E2164756E21
@@ -0,0 +1,4 @@
1
+ import{M as V}from"./App.2yy66bnp.js";import{P as D}from"./App.039re6cf.js";import{Q as P,T as Kk,U as v,X as i,aa as o,da as d}from"./App.q3bpx15d.js";var J=P(Kk(),1);var q=P(v(),1);function Yk(){let{authFetch:K}=o(),{currentProjectId:X}=d(),{confirm:j,ConfirmDialog:E}=V(),[$,x]=J.useState([]),[A,c]=J.useState([]),[a,u]=J.useState(!0),[r,Y]=J.useState(!1),[H,C]=J.useState(null),[T,Q]=J.useState(new Set),[F,R]=J.useState(!1),[y,I]=J.useState(null),[w,f]=J.useState(null),[S,U]=J.useState({}),[M,N]=J.useState(""),[b,L]=J.useState(""),[g,B]=J.useState(""),Z=X&&X!=="all"&&X!=="unassigned"?X:null,n=Z?A.filter((k)=>k.projectId===Z):A,{events:p}=i({category:"test",limit:50}),_=J.useRef(new Set);J.useEffect(()=>{for(let k of p){if(_.current.has(k.id))continue;_.current.add(k.id);let z=k.data?.test_case_id;if(!z)continue;if(k.type==="test_started")U((G)=>({...G,[z]:{phase:"starting"}})),Q((G)=>new Set(G).add(z));else if(k.type==="test_planning")U((G)=>({...G,[z]:{phase:"planning"}}));else if(k.type==="test_executing"){let G=k.data?.agent_name;U((O)=>({...O,[z]:{phase:"executing",detail:G}}))}else if(k.type==="test_judging")U((G)=>({...G,[z]:{phase:"judging"}}));else if(k.type==="test_completed")U((G)=>{let O={...G};return delete O[z],O}),Q((G)=>{let O=new Set(G);return O.delete(z),O}),W()}if(_.current.size>500)_.current=new Set([..._.current].slice(-200))},[p]);let W=async()=>{try{let k=Z?`?project_id=${Z}`:"",z=await K(`/api/tests${k}`);if(z.ok)x(await z.json())}catch{}u(!1)},s=async()=>{try{let k=await K("/api/agents");if(k.ok){let z=await k.json();c((z.agents||z).map((G)=>({id:G.id,name:G.name,status:G.status,provider:G.provider,model:G.model,projectId:G.projectId||null})))}}catch{}};J.useEffect(()=>{Promise.all([W(),s()])},[X]);let l=()=>{C(null),N(""),L(""),B(""),Y(!0)},t=(k)=>{C(k),N(k.name),L(k.behavior||""),B(k.agent_id||""),Y(!0)},e=async()=>{if(!M||!b)return;let k={name:M,behavior:b,agent_id:g||null,project_id:Z||void 0};if(H)await K(`/api/tests/${H.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});else await K("/api/tests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});Y(!1),W()},kk=async(k)=>{if(!await j("Delete this test case? Run history will also be deleted."))return;await K(`/api/tests/${k}`,{method:"DELETE"}),W()},qk=async(k)=>{Q((z)=>new Set(z).add(k));try{await K(`/api/tests/${k}/run`,{method:"POST"}),await W()}catch{}Q((z)=>{let G=new Set(z);return G.delete(k),G}),U((z)=>{let G={...z};return delete G[k],G})},zk=async()=>{R(!0);try{let k=$.map((z)=>z.id);Q(new Set(k)),await K("/api/tests/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({test_case_ids:k})}),await W()}catch{}Q(new Set),R(!1)},Gk=async(k)=>{try{let z=await K(`/api/tests/${k}/runs`);if(z.ok)I({testId:k,runs:await z.json()})}catch{}},h={starting:{label:"Starting",color:"bg-blue-900/50 text-blue-400 border-blue-500/30"},planning:{label:"Planning",color:"bg-purple-900/50 text-purple-400 border-purple-500/30"},executing:{label:"Executing",color:"bg-cyan-900/50 text-cyan-400 border-cyan-500/30"},judging:{label:"Judging",color:"bg-amber-900/50 text-amber-400 border-amber-500/30"}},m=(k)=>{return q.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${{passed:"bg-green-900/50 text-green-400",failed:"bg-red-900/50 text-red-400",error:"bg-yellow-900/50 text-yellow-400",running:"bg-blue-900/50 text-blue-400"}[k]||"bg-[#222] text-[#666]"}`,children:k.toUpperCase()},void 0,!1,void 0,this)},Jk=(k)=>{let z=S[k];if(!z)return null;let G=h[z.phase]||h.starting;return q.jsxDEV("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-medium border ${G.color} animate-pulse`,children:[q.jsxDEV("span",{className:"w-1.5 h-1.5 rounded-full bg-current"},void 0,!1,void 0,this),G.label,z.detail?` · ${z.detail}`:""]},void 0,!0,void 0,this)};return q.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[E,q.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-xl font-bold",children:"Tests"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[#666] mt-1",children:"Describe behavior, AI handles the rest"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[$.length>0&&q.jsxDEV("button",{onClick:zk,disabled:F,className:"px-4 py-2 bg-[#1a1a1a] hover:bg-[#222] text-[#e0e0e0] rounded text-sm font-medium transition disabled:opacity-50",children:F?"Running...":"Run All"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-white rounded text-sm font-medium transition",children:"+ New Test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a?q.jsxDEV("div",{className:"text-[#666] text-sm",children:"Loading..."},void 0,!1,void 0,this):$.length===0?q.jsxDEV("div",{className:"text-center py-16",children:[q.jsxDEV("div",{className:"text-[#333] text-4xl mb-4",children:q.jsxDEV("svg",{className:"w-12 h-12 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:q.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,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)},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[#666] mb-2",children:"No tests yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mb-4",children:"Describe what your agents should do and let AI verify it"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-white rounded text-sm font-medium transition",children:"Create your first test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"space-y-3",children:$.map((k)=>q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg 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("span",{className:"font-medium text-sm",children:k.name},void 0,!1,void 0,this),S[k.id]?Jk(k.id):k.last_run&&q.jsxDEV(q.Fragment,{children:[m(k.last_run.status),k.last_run.score!=null&&q.jsxDEV("span",{className:"text-xs text-[#888] font-mono",children:[k.last_run.score,"/10"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.behavior&&q.jsxDEV("p",{className:"text-xs text-[#888] mb-1.5 line-clamp-2",children:k.behavior},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[#666] space-y-0.5",children:[q.jsxDEV("div",{children:["Agent:"," ",q.jsxDEV("span",{className:"text-[#888]",children:k.agent_name||(k.last_run?.selected_agent_name?`${k.last_run.selected_agent_name} (auto-selected)`:"Auto (AI picks)")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[#888]",children:['"',k.last_run.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.input_message&&!k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[#888]",children:['"',k.input_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.last_run&&q.jsxDEV("div",{children:["Last run:"," ",q.jsxDEV("span",{className:"text-[#888]",children:[k.last_run.duration_ms?`${(k.last_run.duration_ms/1000).toFixed(1)}s`:"---",k.last_run.judge_reasoning&&` --- "${k.last_run.judge_reasoning.slice(0,80)}${k.last_run.judge_reasoning.length>80?"...":""}"`]},void 0,!0,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:"flex items-center gap-1 ml-3 shrink-0",children:[q.jsxDEV("button",{onClick:()=>Gk(k.id),className:"px-2 py-1 text-xs text-[#666] hover:text-[#888] hover:bg-[#1a1a1a] rounded transition",title:"View run history",children:"History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>qk(k.id),disabled:T.has(k.id),className:"px-3 py-1 text-xs bg-[#1a1a1a] hover:bg-[#222] text-[#e0e0e0] rounded transition disabled:opacity-50",children:T.has(k.id)?"Running...":"Run"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>t(k),className:"px-2 py-1 text-xs text-[#666] hover:text-[#888] hover:bg-[#1a1a1a] rounded transition",children:"Edit"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>kk(k.id),className:"px-2 py-1 text-xs text-[#666] hover:text-red-400 hover:bg-[#1a1a1a] rounded transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},k.id,!1,void 0,this))},void 0,!1,void 0,this),y&&q.jsxDEV("div",{className:"mt-6",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[q.jsxDEV("h2",{className:"text-sm font-bold text-[#888]",children:"Run History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>{I(null),f(null)},className:"text-xs text-[#666] hover:text-[#888]",children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.runs.length===0?q.jsxDEV("p",{className:"text-sm text-[#666]",children:"No runs yet"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"space-y-2",children:y.runs.map((k)=>q.jsxDEV("div",{className:"bg-[#0d0d0d] border border-[#1a1a1a] rounded p-3",children:[q.jsxDEV("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>f(w===k.id?null:k.id),children:[q.jsxDEV("div",{className:"flex items-center gap-3",children:[m(k.status),q.jsxDEV("span",{className:"text-xs text-[#666]",children:k.duration_ms?`${(k.duration_ms/1000).toFixed(1)}s`:"---"},void 0,!1,void 0,this),k.score!=null&&q.jsxDEV("span",{className:"text-xs text-[#888] font-mono",children:[k.score,"/10"]},void 0,!0,void 0,this),k.selected_agent_name&&q.jsxDEV("span",{className:"text-xs text-[#555]",children:["Agent: ",k.selected_agent_name]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[#555]",children:new Date(k.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[#555]",children:w===k.id?"---":"+"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w===k.id&&q.jsxDEV("div",{className:"mt-3 space-y-2",children:[k.planner_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Planner:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:[k.selected_agent_name&&q.jsxDEV("span",{className:"text-[#f97316]",children:k.selected_agent_name},void 0,!1,void 0,this),k.selected_agent_name&&" --- ",k.planner_reasoning]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.generated_message&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Generated Message:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:['"',k.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.judge_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Judge:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:k.judge_reasoning},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.error&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-red-400 mb-1",children:"Error:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-red-300 bg-[#0a0a0a] p-2 rounded",children:k.error},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.agent_response&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Agent Response (Thread):"},void 0,!1,void 0,this),q.jsxDEV("pre",{className:"text-xs text-[#888] bg-[#0a0a0a] p-2 rounded overflow-auto max-h-64",children:k.agent_response},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},k.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>Y(!1),children:q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-lg mx-4 p-6",onClick:(k)=>k.stopPropagation(),children:[q.jsxDEV("h2",{className:"text-lg font-bold mb-4",children:H?"Edit Test":"New Test"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{value:M,onChange:(k)=>N(k.target.value),placeholder:"e.g. Social Media Posting",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Behavior"},void 0,!1,void 0,this),q.jsxDEV("textarea",{value:b,onChange:(k)=>L(k.target.value),placeholder:"Describe what should happen, e.g. 'When asked to post on social media, the agent creates a proper post with relevant hashtags and confirms it was published'",rows:3,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316] resize-none"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"AI will generate the test message and evaluate results based on this"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Agent"},void 0,!1,void 0,this),q.jsxDEV(D,{value:g,onChange:B,placeholder:"Auto (AI picks the best agent)",options:n.map((k)=>({value:k.id,label:`${k.name} (${k.status})`}))},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Leave empty to let AI choose the right agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex justify-end gap-2 mt-6",children:[q.jsxDEV("button",{onClick:()=>Y(!1),className:"px-4 py-2 text-sm text-[#888] hover:text-[#e0e0e0] transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:e,disabled:!M||!b,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-white rounded text-sm font-medium transition",children:H?"Save":"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)]},void 0,!0,void 0,this)}
2
+ export{Yk as K};
3
+
4
+ //# debugId=DEEF9B76DDF5823464756E2164756E21
@@ -0,0 +1,13 @@
1
+ import{M as Oz,N as Wz}from"./App.2yy66bnp.js";import{P as j}from"./App.039re6cf.js";import{Q as n,T as Qz,U as zz,aa as Jz,da as Kz}from"./App.q3bpx15d.js";var W=n(Qz(),1);var z=n(zz(),1);function Rz(){let{authFetch:K}=Jz(),{projects:Z,currentProjectId:Y}=Kz(),[B,N]=W.useState([]),[y,M]=W.useState(!0),[X,U]=W.useState("installed"),[G,Q]=W.useState(!1),[C,H]=W.useState(!1),[v,T]=W.useState(null),{confirm:f,ConfirmDialog:w}=Oz(),{alert:P,AlertDialog:d}=Wz(),_=Z.length>0,[m,p]=W.useState(""),[h,Xz]=W.useState([]),[c,r]=W.useState(!1),[Yz,o]=W.useState(null),[a,i]=W.useState(""),[R,t]=W.useState([]),[I,u]=W.useState(!1),[V,b]=W.useState(null),[q,l]=W.useState(null),[e,S]=W.useState(null),[x,Zz]=W.useState(Y&&Y!=="unassigned"?Y:null),D=B.filter((J)=>{if(!Y)return!0;if(Y==="unassigned")return J.project_id===null;return J.project_id===null||J.project_id===Y}),F=async()=>{try{let O=await(await K("/api/skills")).json();N(O.skills||[])}catch(J){console.error("Failed to fetch skills:",J)}M(!1)},E=async(J)=>{r(!0);try{let O=J!==void 0?J:m,$=O?`/api/skills/marketplace/search?q=${encodeURIComponent(O)}`:"/api/skills/marketplace/featured",A=await(await K($)).json();Xz(A.skills||[])}catch(O){console.error("Failed to search marketplace:",O)}r(!1)};W.useEffect(()=>{F()},[K]),W.useEffect(()=>{if(X==="marketplace"&&h.length===0)E("")},[X]);let _z=async(J)=>{try{await K(`/api/skills/${J}/toggle`,{method:"POST"}),F()}catch(O){console.error("Failed to toggle skill:",O)}},$z=async(J)=>{if(!await f("Delete this skill?",{confirmText:"Delete",title:"Delete Skill"}))return;try{if(await K(`/api/skills/${J}`,{method:"DELETE"}),v?.id===J)T(null);F()}catch($){console.error("Failed to delete skill:",$)}},Bz=async(J)=>{o(J.id);try{let O=await K(`/api/skills/marketplace/${J.id}/install`,{method:"POST"}),$=await O.json();if(O.ok)await P(`Installed "${J.name}" successfully!`,{title:"Skill Installed"}),F(),U("installed");else await P($.error||"Failed to install skill",{title:"Installation Failed"})}catch(O){console.error("Failed to install skill:",O),await P("Failed to install skill",{title:"Error"})}o(null)},g=(J)=>B.some((O)=>O.name===J),s=async(J)=>{let O=J||a;if(!O.trim())return;let $="",L="";if(O.includes("github.com")){let A=O.match(/github\.com\/([^/]+)\/([^/]+)/);if(A)$=A[1],L=A[2].replace(/\.git$/,"")}else if(O.includes("/")){let A=O.split("/");$=A[0],L=A[1]}if(!$||!L){b("Invalid repo format. Use 'owner/repo' or GitHub URL");return}u(!0),b(null),t([]),l(null);try{let A=await K(`/api/skills/github/${$}/${L}`),k=await A.json();if(!A.ok){b(k.error||"Failed to fetch repository"),u(!1);return}t(k.skills||[]),l(k.repo||null)}catch(A){b("Failed to fetch repository")}u(!1)},Nz=async(J)=>{if(!q)return;S(J.name);try{let O=await K("/api/skills/github/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:q.owner,repo:q.repo,skillName:J.name,downloadUrl:J.downloadUrl,projectId:x})}),$=await O.json();if(O.ok)await P(`Installed "${J.name}" successfully!`,{title:"Skill Installed"}),F();else await P($.error||"Failed to install skill",{title:"Installation Failed",variant:"error"})}catch(O){await P("Failed to install skill",{title:"Error",variant:"error"})}S(null)},Uz=async()=>{if(!q||R.length===0)return;let J=R.filter((L)=>!g(L.name));if(J.length===0){await P("All skills are already installed",{title:"Info"});return}if(!await f(`Install ${J.length} skill(s) from ${q.owner}/${q.repo}?`,{confirmText:"Install All",title:"Install Skills"}))return;let $=0;for(let L of J){S(L.name);try{if((await K("/api/skills/github/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:q.owner,repo:q.repo,skillName:L.name,downloadUrl:L.downloadUrl,projectId:x})})).ok)$++}catch(A){}}S(null),F(),await P(`Installed ${$} of ${J.length} skills`,{title:"Installation Complete"})};return z.jsxDEV(z.Fragment,{children:[w,d,z.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:z.jsxDEV("div",{className:"max-w-6xl",children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[z.jsxDEV("div",{children:[z.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Skills"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[#666]",children:"Manage agent skills - instructions that teach agents how to perform tasks."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="installed"&&z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("button",{onClick:()=>H(!0),className:"bg-[#1a1a1a] hover:bg-[#222] text-white px-4 py-2 rounded font-medium transition border border-[#333]",children:"Import"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>Q(!0),className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"+ Create Skill"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-1 w-fit",children:[z.jsxDEV("button",{onClick:()=>U("installed"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="installed"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:["Installed (",D.length,")"]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>U("github"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="github"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Browse GitHub"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>U("marketplace"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="marketplace"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Marketplace"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="installed"&&z.jsxDEV(z.Fragment,{children:y?z.jsxDEV("div",{className:"text-[#666]",children:"Loading skills..."},void 0,!1,void 0,this):B.length===0?z.jsxDEV("div",{className:"text-center py-20 text-[#666]",children:[z.jsxDEV("p",{className:"text-lg",children:"No skills installed"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm mt-1",children:"Create a skill or browse the marketplace"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>U("marketplace"),className:"mt-4 bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"Browse Marketplace"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):D.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center",children:z.jsxDEV("p",{className:"text-[#666]",children:"No skills match this filter."},void 0,!1,void 0,this)},void 0,!1,void 0,this):z.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:D.map((J)=>{let O=_&&J.project_id?Z.find(($)=>$.id===J.project_id):null;return z.jsxDEV(Hz,{skill:J,project:O,onToggle:()=>_z(J.id),onDelete:()=>$z(J.id),onView:()=>T(J)},J.id,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),X==="github"&&z.jsxDEV("div",{className:"space-y-6",children:[z.jsxDEV("form",{onSubmit:(J)=>{J.preventDefault(),s()},className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:a,onChange:(J)=>i(J.target.value),placeholder:"Enter GitHub repo (e.g., WordPress/agent-skills)",className:"flex-1 bg-[#111] border border-[#333] rounded-lg px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{type:"submit",disabled:I,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-6 py-3 rounded-lg font-medium transition",children:I?"...":"Browse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_&&R.length>0&&z.jsxDEV("div",{className:"flex items-center gap-3 p-3 bg-[#0a0a0a] border border-[#222] rounded-lg",children:[z.jsxDEV("span",{className:"text-sm text-[#666]",children:"Install to:"},void 0,!1,void 0,this),z.jsxDEV(j,{value:x||"",onChange:(J)=>Zz(J||null),options:[{value:"",label:"Global (all projects)"},...Z.map((J)=>({value:J.id,label:J.name}))],placeholder:"Select scope..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),V&&z.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:V},void 0,!1,void 0,this),q&&R.length>0&&z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex items-center gap-3",children:[z.jsxDEV("a",{href:q.url,target:"_blank",rel:"noopener noreferrer",className:"text-[#f97316] hover:underline font-medium",children:[q.owner,"/",q.repo]},void 0,!0,void 0,this),z.jsxDEV("span",{className:"text-sm text-[#666]",children:[R.length," skill",R.length!==1?"s":""," found"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R.some((J)=>!g(J.name))&&z.jsxDEV("button",{onClick:Uz,disabled:!!e,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-4 py-2 rounded transition disabled:opacity-50",children:"Install All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Fetching skills from repository..."},void 0,!1,void 0,this),!I&&!q&&!V&&z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV("div",{className:"text-4xl mb-4",children:"\uD83D\uDCE6"},void 0,!1,void 0,this),z.jsxDEV("h3",{className:"text-lg font-medium mb-2",children:"Browse Skills from GitHub"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[#666] mb-6 max-w-md mx-auto",children:"Enter a GitHub repository to browse and install skills. Skills are markdown files with instructions that teach agents how to perform specific tasks."},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap gap-2 justify-center",children:[{label:"WordPress Skills",repo:"WordPress/agent-skills"}].map(({label:J,repo:O})=>z.jsxDEV("button",{onClick:()=>{i(O),s(O)},className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:J},O,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!I&&q&&R.length===0&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"No skills found in this repository. Skills should be in subdirectories with a SKILL.md file."},void 0,!1,void 0,this),R.length>0&&z.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2",children:R.map((J)=>{let O=g(J.name),$=e===J.name;return z.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 transition ${O?"border-green-500/30":"border-[#1a1a1a] hover:border-[#333]"}`,children:z.jsxDEV("div",{className:"flex items-start justify-between gap-3",children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("h3",{className:"font-medium truncate",children:J.name},void 0,!1,void 0,this),O&&z.jsxDEV("span",{className:"text-xs text-green-400",children:"✓ Installed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mt-1 line-clamp-2",children:J.description||"No description"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-2 text-xs text-[#555]",children:[z.jsxDEV("span",{children:[(J.size/1024).toFixed(1),"KB"]},void 0,!0,void 0,this),z.jsxDEV("span",{className:"px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:"GitHub"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-shrink-0",children:O?z.jsxDEV("span",{className:"text-xs text-[#555] px-3 py-1.5",children:"Added"},void 0,!1,void 0,this):z.jsxDEV("button",{onClick:()=>Nz(J),disabled:$,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition disabled:opacity-50",children:$?"Installing...":"Install"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},J.name,!1,void 0,this)})},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-4 bg-[#111] border border-[#1a1a1a] rounded-lg text-sm text-[#666]",children:z.jsxDEV("p",{children:["Skills are sourced from GitHub repositories. Each skill should be in its own directory with a"," ",z.jsxDEV("code",{className:"text-[#888] bg-[#0a0a0a] px-1 rounded",children:"SKILL.md"},void 0,!1,void 0,this)," file containing instructions."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="marketplace"&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("div",{className:"mb-6",children:z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:m,onChange:(J)=>p(J.target.value),onKeyDown:(J)=>J.key==="Enter"&&E(),placeholder:"Search skills...",className:"flex-1 bg-[#111] border border-[#1a1a1a] rounded px-4 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>E(),disabled:c,className:"bg-[#1a1a1a] hover:bg-[#222] text-white px-4 py-2 rounded font-medium transition border border-[#333]",children:c?"...":"Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),c?z.jsxDEV("div",{className:"text-[#666]",children:"Loading..."},void 0,!1,void 0,this):h.length===0?z.jsxDEV("div",{className:"text-center py-20 text-[#666]",children:[z.jsxDEV("p",{className:"text-lg",children:"No skills found"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm mt-1",children:"Try a different search term"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:h.map((J)=>z.jsxDEV(qz,{skill:J,installed:g(J.name),installing:Yz===J.id,onInstall:()=>Bz(J)},J.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),G&&z.jsxDEV(Az,{authFetch:K,onClose:()=>Q(!1),onCreated:()=>{Q(!1),F()},projects:_?Z:void 0,defaultProjectId:Y&&Y!=="unassigned"?Y:null},void 0,!1,void 0,this),C&&z.jsxDEV(yz,{authFetch:K,onClose:()=>H(!1),onImported:()=>{H(!1),F()}},void 0,!1,void 0,this),v&&z.jsxDEV(Mz,{skill:v,authFetch:K,onClose:()=>T(null),onUpdated:()=>{T(null),F()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Hz({skill:K,project:Z,onToggle:Y,onDelete:B,onView:N}){let y={local:"Local",skillsmp:"SkillsMP",github:"GitHub",import:"Imported"}[K.source],M=()=>{if(Z)return z.jsxDEV("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:`${Z.color}20`,color:Z.color},children:Z.name},void 0,!1,void 0,this);if(K.project_id===null)return z.jsxDEV("span",{className:"text-xs text-[#666] bg-[#1a1a1a] px-1.5 py-0.5 rounded",children:"Global"},void 0,!1,void 0,this);return null};return z.jsxDEV("div",{className:`bg-[#111] rounded-lg p-5 border transition cursor-pointer ${K.enabled?"border-[#1a1a1a]":"border-[#1a1a1a] opacity-60"} hover:border-[#333]`,onClick:N,children:[z.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("h3",{className:"font-semibold text-lg truncate",children:K.name},void 0,!1,void 0,this),M()]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#666] flex items-center gap-2 mt-0.5",children:[z.jsxDEV("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${K.source==="skillsmp"?"bg-purple-500/20 text-purple-400":K.source==="github"?"bg-blue-500/20 text-blue-400":"bg-[#222] text-[#888]"}`,children:y},void 0,!1,void 0,this),K.metadata?.version&&z.jsxDEV("span",{children:["v",K.metadata.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:(X)=>{X.stopPropagation(),Y()},className:`w-10 h-5 rounded-full transition-colors relative ${K.enabled?"bg-[#f97316]":"bg-[#333]"}`,children:z.jsxDEV("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${K.enabled?"left-5":"left-0.5"}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#888] line-clamp-2 mb-4",children:K.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex gap-1 flex-wrap",children:[K.allowed_tools.slice(0,2).map((X)=>z.jsxDEV("span",{className:"text-xs bg-[#222] px-2 py-0.5 rounded text-[#666]",children:X},X,!1,void 0,this)),K.allowed_tools.length>2&&z.jsxDEV("span",{className:"text-xs text-[#666]",children:["+",K.allowed_tools.length-2]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:(X)=>{X.stopPropagation(),B()},className:"text-red-400 hover:text-red-300 text-sm",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function qz({skill:K,installed:Z,installing:Y,onInstall:B}){return z.jsxDEV("div",{className:"bg-[#111] rounded-lg p-5 border border-[#1a1a1a] hover:border-[#333] transition",children:[z.jsxDEV("div",{className:"flex items-start justify-between mb-3",children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("h3",{className:"font-semibold text-lg truncate",children:K.name},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#666] mt-0.5",children:["by ",K.author," · v",K.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-1 text-yellow-500 text-sm",children:["★ ",K.rating.toFixed(1)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#888] line-clamp-2 mb-4",children:K.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex gap-1 flex-wrap",children:K.tags.slice(0,3).map((N)=>z.jsxDEV("span",{className:"text-xs bg-[#222] px-2 py-0.5 rounded text-[#666]",children:N},N,!1,void 0,this))},void 0,!1,void 0,this),Z?z.jsxDEV("span",{className:"text-green-400 text-sm",children:"✓ Installed"},void 0,!1,void 0,this):z.jsxDEV("button",{onClick:B,disabled:Y,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-3 py-1 rounded text-sm font-medium transition",children:Y?"Installing...":"Install"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"mt-3 text-xs text-[#555]",children:[K.downloads.toLocaleString()," downloads"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Az({authFetch:K,onClose:Z,onCreated:Y,projects:B,defaultProjectId:N}){let[y,M]=W.useState(""),[X,U]=W.useState(""),[G,Q]=W.useState(""),[C,H]=W.useState(N||null),[v,T]=W.useState(!1),[f,w]=W.useState(null),P=B&&B.length>0,d=async()=>{if(!y||!X||!G){w("All fields are required");return}T(!0),w(null);try{let _={name:y,description:X,content:G,source:"local"};if(C)_.project_id=C;let m=await K("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}),p=await m.json();if(!m.ok){w(p.error||"Failed to create skill"),T(!1);return}Y()}catch(_){w("Failed to create skill"),T(!1)}};return z.jsxDEV("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:Z,children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-2xl max-h-[90vh] overflow-auto",onClick:(_)=>_.stopPropagation(),children:[z.jsxDEV("div",{className:"p-6 border-b border-[#1a1a1a]",children:z.jsxDEV("h2",{className:"text-xl font-semibold",children:"Create Skill"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-6 space-y-4",children:[f&&z.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded p-3 text-red-400 text-sm",children:f},void 0,!1,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#888] mb-1",children:"Name"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:y,onChange:(_)=>M(_.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"my-skill-name",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Lowercase letters, numbers, and hyphens only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#888] mb-1",children:"Description"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:X,onChange:(_)=>U(_.target.value),placeholder:"What this skill does and when to use it...",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#888] mb-1",children:"Scope"},void 0,!1,void 0,this),z.jsxDEV(j,{value:C||"",onChange:(_)=>H(_||null),options:[{value:"",label:"Global (all projects)"},...B.map((_)=>({value:_.id,label:_.name}))],placeholder:"Select scope..."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Global skills are available to all agents. Project-scoped skills are only available to agents in that project."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#888] mb-1",children:"Instructions (Markdown)"},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:G,onChange:(_)=>Q(_.target.value),placeholder:`# Skill Instructions
2
+
3
+ Write detailed instructions here...`,rows:12,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] font-mono text-sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-6 border-t border-[#1a1a1a] flex justify-end gap-3",children:[z.jsxDEV("button",{onClick:Z,className:"px-4 py-2 text-[#888] hover:text-white transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:d,disabled:v,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:v?"Creating...":"Create Skill"},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 yz({authFetch:K,onClose:Z,onImported:Y}){let[B,N]=W.useState(""),[y,M]=W.useState(!1),[X,U]=W.useState(null);return z.jsxDEV("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:Z,children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-2xl max-h-[90vh] overflow-auto",onClick:(Q)=>Q.stopPropagation(),children:[z.jsxDEV("div",{className:"p-6 border-b border-[#1a1a1a]",children:[z.jsxDEV("h2",{className:"text-xl font-semibold",children:"Import Skill"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mt-1",children:"Paste the contents of a SKILL.md file"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-6 space-y-4",children:[X&&z.jsxDEV("div",{className:"bg-red-500/10 border border-red-500/30 rounded p-3 text-red-400 text-sm",children:X},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:B,onChange:(Q)=>N(Q.target.value),placeholder:`---
4
+ name: skill-name
5
+ description: What this skill does...
6
+ ---
7
+
8
+ # Instructions
9
+
10
+ Your skill instructions here...`,rows:16,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] font-mono text-sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-6 border-t border-[#1a1a1a] flex justify-end gap-3",children:[z.jsxDEV("button",{onClick:Z,className:"px-4 py-2 text-[#888] hover:text-white transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:async()=>{if(!B.trim()){U("Paste SKILL.md content");return}M(!0),U(null);try{let Q=await K("/api/skills/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:B})}),C=await Q.json();if(!Q.ok){U(C.error||"Failed to import skill"),M(!1);return}Y()}catch(Q){U("Failed to import skill"),M(!1)}},disabled:y,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:y?"Importing...":"Import Skill"},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 Mz({skill:K,authFetch:Z,onClose:Y,onUpdated:B}){let[N,y]=W.useState(!1),[M,X]=W.useState(K.content),[U,G]=W.useState(!1),Q=async()=>{G(!0);try{await Z(`/api/skills/${K.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:M})}),B()}catch(H){console.error("Failed to save:",H)}G(!1)},C=async()=>{try{let v=await(await Z(`/api/skills/${K.id}/export`)).text(),T=new Blob([v],{type:"text/markdown"}),f=URL.createObjectURL(T),w=document.createElement("a");w.href=f,w.download=`${K.name}-SKILL.md`,w.click(),URL.revokeObjectURL(f)}catch(H){console.error("Failed to export:",H)}};return z.jsxDEV("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",onClick:Y,children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-3xl max-h-[90vh] overflow-auto",onClick:(H)=>H.stopPropagation(),children:[z.jsxDEV("div",{className:"p-6 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h2",{className:"text-xl font-semibold",children:K.name},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mt-0.5",children:K.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("button",{onClick:C,className:"text-sm text-[#888] hover:text-white transition px-3 py-1 rounded border border-[#333]",children:"Export"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>y(!N),className:"text-sm text-[#888] hover:text-white transition px-3 py-1 rounded border border-[#333]",children:N?"View":"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-6",children:N?z.jsxDEV("textarea",{value:M,onChange:(H)=>X(H.target.value),rows:20,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 focus:outline-none focus:border-[#f97316] font-mono text-sm"},void 0,!1,void 0,this):z.jsxDEV("pre",{className:"bg-[#0a0a0a] border border-[#222] rounded p-4 font-mono text-sm overflow-auto max-h-[60vh] whitespace-pre-wrap",children:K.content},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-6 border-t border-[#1a1a1a] flex justify-between",children:[z.jsxDEV("div",{className:"text-xs text-[#555]",children:K.source!=="local"&&K.source_url&&z.jsxDEV("a",{href:K.source_url,target:"_blank",rel:"noopener noreferrer",className:"text-[#f97316] hover:underline",children:"View source →"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-3",children:[z.jsxDEV("button",{onClick:Y,className:"px-4 py-2 text-[#888] hover:text-white transition",children:"Close"},void 0,!1,void 0,this),N&&z.jsxDEV("button",{onClick:Q,disabled:U,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:U?"Saving...":"Save Changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
11
+ export{Rz as J};
12
+
13
+ //# debugId=8006A7378C06918C64756E2164756E21
@@ -1 +1 @@
1
- @layer components{@keyframes blink{0%,to{opacity:1}50%{opacity:0}}@keyframes slideUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-slideUp{animation:.2s ease-out slideUp}.apteva-scrollbar-hidden{-ms-overflow-style:none;scrollbar-width:none}.apteva-scrollbar-hidden::-webkit-scrollbar{display:none}.apteva-md{white-space:pre-wrap!important;color:inherit!important;word-wrap:break-word!important;overflow-wrap:break-word!important;font-size:.875rem!important;line-height:1.625!important}.apteva-md-h2{all:unset!important;display:block!important;margin-top:.75rem!important;margin-bottom:.25rem!important;font-size:1.125rem!important;font-weight:600!important;line-height:1.3!important}.apteva-md-h3{all:unset!important;display:block!important;margin-top:.5rem!important;margin-bottom:.125rem!important;font-size:1rem!important;font-weight:600!important;line-height:1.3!important}.apteva-md-ul{all:unset!important;list-style-type:disc!important;list-style-position:outside!important;display:block!important;margin-top:.5rem!important;margin-bottom:.5rem!important;padding-left:1.5rem!important}.apteva-md-ol{all:unset!important;list-style-type:decimal!important;list-style-position:outside!important;display:block!important;margin-top:.5rem!important;margin-bottom:.5rem!important;padding-left:1.5rem!important}.apteva-md-li{all:unset!important;display:list-item!important;margin-bottom:.25rem!important;padding-left:.25rem!important}.apteva-tool-call{all:unset!important;display:flex!important;background-color:#8080801a!important;border:1px solid #80808033!important;border-radius:.5rem!important;align-items: center!important;gap:.5rem!important;margin:.5rem 0!important;padding:.5rem .75rem!important;font-size:.875rem!important}.apteva-tool-call-dot{all:unset!important;display:block!important;border-radius:50%!important;flex-shrink:0!important;width:.5rem!important;height:.5rem!important}.apteva-tool-call-dot-running{animation:1s infinite blink!important;background-color:#3b82f6!important}.apteva-tool-call-dot-completed{background-color:#22c55e!important}.apteva-tool-call-dot-error{background-color:#ef4444!important}.apteva-tool-call-name{all:unset!important;color:inherit!important;font-family:ui-monospace,monospace!important}.apteva-tool-call-status{all:unset!important;color:#808080cc!important;margin-left:auto!important}.apteva-tool-call-status-completed{color:#22c55e!important}.apteva-tool-call-status-error{color:#ef4444!important}.apteva-md-table-wrapper{overflow-x:auto!important;margin:.75rem 0!important}.apteva-md-table{border-collapse:collapse!important;width:100%!important;font-size:.8125rem!important;line-height:1.4!important}.apteva-md-th{text-align:left!important;white-space:nowrap!important;border-bottom:2px solid #8080804d!important;padding:.5rem .75rem!important;font-weight:600!important}.apteva-md-td{border-bottom:1px solid #80808026!important;padding:.5rem .75rem!important}.apteva-md-table tbody tr:hover{background-color:#8080800d!important}.apteva-md-table tbody tr:last-child .apteva-md-td{border-bottom:none!important}.apteva-md-img{display:block!important;border-radius:.5rem!important;max-width:100%!important;height:auto!important;margin:.5rem 0!important}.apteva-md-link{color:#3b82f6!important;text-underline-offset:2px!important;text-decoration:underline!important}.apteva-md-link:hover{color:#2563eb!important}.apteva-md-inline-code{background-color:#80808026!important;border-radius:.25rem!important;padding:.125rem .375rem!important;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace!important;font-size:.8125rem!important}.apteva-typing-indicator{display:inline-flex!important;align-items: center!important;gap:2px!important}.apteva-typing-indicator span{opacity:.4!important;animation:1.4s infinite both apteva-typing-blink!important;background-color:currentColor!important;border-radius:50%!important;width:6px!important;height:6px!important}.apteva-typing-indicator span:nth-child(2){animation-delay:.2s!important}.apteva-typing-indicator span:nth-child(3){animation-delay:.4s!important}@keyframes apteva-typing-blink{0%,80%,to{opacity:.4}40%{opacity:1}}.apteva-chat-header{all:unset!important;box-sizing:border-box!important;display:flex!important;justify-content:space-between!important;align-items: center!important;padding:.75rem 1rem!important}.apteva-chat-title{all:unset!important;color:#111827!important;display:block!important;font-size:1.125rem!important;font-weight:600!important;line-height:1.4!important}@media (prefers-color-scheme:dark){.apteva-chat-title{color:#fff!important}}.dark .apteva-chat-title{color:#fff!important}.apteva-chat-status{all:unset!important;display:block!important;margin-top:.125rem!important;font-size:.75rem!important;line-height:1.4!important}.apteva-chat-status-ready,.apteva-chat-status-thinking{color:#737373!important}.apteva-chat-status-tool{color:#3b82f6!important}@media (prefers-color-scheme:dark){.apteva-chat-status-ready,.apteva-chat-status-thinking{color:#525252!important}.apteva-chat-status-tool{color:#60a5fa!important}}.dark .apteva-chat-status-ready,.dark .apteva-chat-status-thinking{color:#525252!important}.dark .apteva-chat-status-tool{color:#60a5fa!important}.apteva-message-list{box-sizing:border-box!important;display:block!important;overflow-y:auto!important;flex:1!important;padding:1rem!important}.apteva-message-row-user{display:flex!important;justify-content:flex-end!important;margin-bottom:.75rem!important}.apteva-message-row-assistant{display:flex!important;justify-content:flex-start!important;margin-bottom:.75rem!important}.apteva-message-bubble{box-sizing:border-box!important;display:block!important;border-radius:1rem!important;max-width:95%!important;padding:.625rem 1rem!important;font-size:.875rem!important;line-height:1.5!important}.apteva-message-user{color:#fff!important;background-color:#2563eb!important;border-bottom-right-radius:.375rem!important}.apteva-message-assistant{color:#0a0a0a!important;background-color:#fafafa!important;border-bottom-left-radius:.375rem!important}@media (prefers-color-scheme:dark){.apteva-message-assistant{color:#fafafa!important;background-color:#262626!important}}.dark .apteva-message-assistant{color:#fafafa!important;background-color:#262626!important}.apteva-message-content-user,.apteva-message-content-assistant{display:block!important}.apteva-message-text{white-space:pre-wrap!important;color:inherit!important;display:block!important;font-size:.875rem!important;line-height:1.625!important}.apteva-message-widgets{display:block!important;margin-top:.5rem!important}.apteva-message-timestamp{display:block!important;margin-top:.375rem!important;font-size:.75rem!important}.apteva-message-timestamp-user{color:#bfdbfe!important}.apteva-message-timestamp-assistant{color:#737373!important}.apteva-message-segmented{display:flex!important;flex-direction:column!important;gap:.5rem!important;width:95%!important;max-width:95%!important}.apteva-message-segmented .apteva-message-bubble{width:-moz-fit-content!important;width:fit-content!important;max-width:100%!important}.apteva-tool-call-standalone,.apteva-widget-standalone{display:block!important}.apteva-widget{color:#171717!important;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif!important;font-size:.875rem!important;line-height:1.5!important}.apteva-widget *{box-sizing:border-box!important}.apteva-widget-skeleton{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif!important}.apteva-widget-skeleton *{box-sizing:border-box!important}.apteva-widget-skeleton [class*=bg-neutral-200]{background-color:#e5e5e5!important}.apteva-widget-skeleton [class*=bg-neutral-100]{background-color:#f5f5f5!important}.apteva-widget-skeleton [class*=bg-neutral-300]{background-color:#d4d4d4!important}.apteva-widget-skeleton [class*=border-neutral]{border-color:#e5e5e5!important}@media (prefers-color-scheme:dark){.apteva-widget-skeleton [class*=bg-neutral-700]{background-color:#404040!important}.apteva-widget-skeleton [class*=bg-neutral-800]{background-color:#262626!important}.apteva-widget-skeleton [class*=bg-neutral-600]{background-color:#525252!important}.apteva-widget-skeleton [class*=border-neutral]{border-color:#262626!important}}.dark .apteva-widget-skeleton [class*=bg-neutral-700]{background-color:#404040!important}.dark .apteva-widget-skeleton [class*=bg-neutral-800]{background-color:#262626!important}.dark .apteva-widget-skeleton [class*=bg-neutral-600]{background-color:#525252!important}.dark .apteva-widget-skeleton [class*=border-neutral]{border-color:#262626!important}.apteva-widget>div{background-color:#fff!important}.apteva-widget h3,.apteva-widget h4{color:#171717!important}.apteva-widget p,.apteva-widget span{color:#525252!important}.apteva-widget>div[class*=border]{border-color:#e5e5e5!important}@media (prefers-color-scheme:dark){.apteva-widget{color:#fafafa!important}.apteva-widget>div{background-color:#171717!important}.apteva-widget h3,.apteva-widget h4{color:#fafafa!important}.apteva-widget p,.apteva-widget span{color:#a3a3a3!important}.apteva-widget>div[class*=border]{border-color:#262626!important}}.dark .apteva-widget{color:#fafafa!important}.dark .apteva-widget>div{background-color:#171717!important}.dark .apteva-widget h3,.dark .apteva-widget h4{color:#fafafa!important}.dark .apteva-widget p,.dark .apteva-widget span{color:#a3a3a3!important}.dark .apteva-widget>div[class*=border]{border-color:#262626!important}@media (prefers-color-scheme:dark){.apteva-message-timestamp-assistant{color:#525252!important}}.dark .apteva-message-timestamp-assistant{color:#525252!important}.apteva-tool-card{box-sizing:border-box!important;display:flex!important;border-style:solid!important;border-width:1px!important;border-radius:.75rem!important;align-items: center!important;gap:.5rem!important;padding:.5rem .75rem!important;font-size:.875rem!important}.apteva-tool-card-running{color:#1d4ed8!important;background-color:#eff6ff!important;border-color:#bfdbfe!important}.apteva-tool-card-completed{color:#15803d!important;background-color:#f0fdf4!important;border-color:#bbf7d0!important}.apteva-tool-card-error{color:#b91c1c!important;background-color:#fef2f2!important;border-color:#fecaca!important}@media (prefers-color-scheme:dark){.apteva-tool-card-running{color:#60a5fa!important;background-color:#3b82f61a!important;border-color:#3b82f64d!important}.apteva-tool-card-completed{color:#4ade80!important;background-color:#22c55e1a!important;border-color:#22c55e4d!important}.apteva-tool-card-error{color:#f87171!important;background-color:#ef44441a!important;border-color:#ef44444d!important}}.dark .apteva-tool-card-running{color:#60a5fa!important;background-color:#3b82f61a!important;border-color:#3b82f64d!important}.dark .apteva-tool-card-completed{color:#4ade80!important;background-color:#22c55e1a!important;border-color:#22c55e4d!important}.dark .apteva-tool-card-error{color:#f87171!important;background-color:#ef44441a!important;border-color:#ef44444d!important}.apteva-tool-icon{flex-shrink:0!important;width:1rem!important;height:1rem!important}.apteva-tool-icon-spin{animation:1s linear infinite apteva-spin!important}.apteva-tool-spinner-track{opacity:.25!important}.apteva-tool-spinner-fill{opacity:.75!important}.apteva-tool-label{font-size:inherit!important}.apteva-tool-label strong{font-weight:600!important}@keyframes apteva-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.apteva-tool-card-preparing{color:#92400e!important;background-color:#fef3c7!important;border-color:#fcd34d!important}@media (prefers-color-scheme:dark){.apteva-tool-card-preparing{color:#fbbf24!important;background-color:#fbbf2426!important;border-color:#fbbf2466!important}}.dark .apteva-tool-card-preparing{color:#fbbf24!important;background-color:#fbbf2426!important;border-color:#fbbf2466!important}@keyframes apteva-pulse-glow{0%,to{box-shadow:0 0 #fbbf2400}50%{box-shadow:0 0 8px 2px #fbbf2480}}.apteva-tool-receiving{animation:.4s ease-in-out apteva-pulse-glow!important}.apteva-tool-status-text{opacity:.7!important;font-weight:400!important}.apteva-tool-char-count{opacity:.6!important;font-variant-numeric:tabular-nums!important;font-size:.85em!important;font-weight:400!important}.apteva-tool-dots{display:inline-flex!important;margin-left:1px!important}.apteva-tool-dots span{opacity:.3!important;animation:1.4s ease-in-out infinite apteva-dot-pulse!important}.apteva-tool-dots span:first-child{animation-delay:0s!important}.apteva-tool-dots span:nth-child(2){animation-delay:.2s!important}.apteva-tool-dots span:nth-child(3){animation-delay:.4s!important}@keyframes apteva-dot-pulse{0%,60%,to{opacity:.3}30%{opacity:1}}.apteva-tool-stream-separator{opacity:.5!important}.apteva-tool-stream-output{opacity:.85!important;white-space:nowrap!important;text-overflow:ellipsis!important;vertical-align:bottom!important;display:inline-block!important;overflow:hidden!important;max-width:300px!important;font-weight:400!important}.apteva-composer{display:grid!important;position:relative!important;background-color:#fff!important;border:2px solid #d4d4d4!important;border-radius:1rem!important;gap:.5rem .75rem!important;padding:.5rem .75rem!important;transition:all .3s!important}.apteva-composer textarea{color:#171717!important;background-color:#0000!important}.apteva-composer textarea::placeholder{color:#a3a3a3!important}button.apteva-composer-menu-btn{background:0 0!important;border:none!important}.apteva-composer-menu{background-color:#262626!important}.apteva-composer-menu button{color:#fff!important;background-color:#0000!important}.apteva-composer-menu button:hover{background-color:#404040!important}.apteva-composer-send-btn{color:#404040!important;background-color:#fff!important;border:1px solid #d4d4d4!important}.apteva-composer-send-btn svg{stroke:currentColor!important}.apteva-composer-stop-btn{all:unset!important;box-sizing:border-box!important;cursor:pointer!important;color:#dc2626!important;display:flex!important;background-color:#fef2f2!important;border:1px solid #f87171!important;border-radius:.5rem!important;flex-shrink:0!important;justify-content:center!important;align-items: center!important;width:2rem!important;height:2rem!important;margin:0!important;padding:0!important;transition:background-color .15s!important}.apteva-composer-stop-btn:hover{background-color:#fee2e2!important}.apteva-composer-stop-btn svg{fill:currentColor!important;width:14px!important;height:14px!important}@media (prefers-color-scheme:dark){.apteva-composer{background-color:#171717!important;border-color:#404040!important}.apteva-composer textarea{color:#fafafa!important}.apteva-composer textarea::placeholder{color:#525252!important}button.apteva-composer-menu-btn{background:0 0!important}.apteva-composer-send-btn{color:#d4d4d4!important;background-color:#262626!important;border-color:#404040!important}.apteva-composer-stop-btn{color:#f87171!important;background-color:#7f1d1d4d!important;border-color:#f87171!important}.apteva-composer-stop-btn:hover{background-color:#7f1d1d80!important}}.dark .apteva-composer{background-color:#171717!important;border-color:#404040!important}.dark .apteva-composer textarea{color:#fafafa!important}.dark .apteva-composer textarea::placeholder{color:#525252!important}.dark button.apteva-composer-menu-btn{background:0 0!important}.dark .apteva-composer-send-btn{color:#d4d4d4!important;background-color:#262626!important;border-color:#404040!important}.dark .apteva-composer-stop-btn{color:#f87171!important;background-color:#7f1d1d4d!important;border-color:#f87171!important}.dark .apteva-composer-stop-btn:hover{background-color:#7f1d1d80!important}.apteva-composer-textarea{-ms-overflow-style:none!important;scrollbar-width:none!important}.apteva-composer-textarea::-webkit-scrollbar{display:none!important}.apteva-chat{background-color:#fff!important}.apteva-chat-header{background-color:#fff!important;border-color:#e5e5e5!important}.apteva-message-list{background-color:#f5f5f5!important}@media (prefers-color-scheme:dark){.apteva-chat{background-color:#0a0a0a!important}.apteva-chat-header{background-color:#171717!important;border-color:#262626!important}.apteva-message-list{background-color:#0a0a0a!important}}.dark .apteva-chat{background-color:#0a0a0a!important}.dark .apteva-chat-header{background-color:#171717!important;border-color:#262626!important}.dark .apteva-message-list{background-color:#0a0a0a!important}@keyframes apteva-slide-in{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes apteva-highlight-fade{0%{background-color:#3b82f626}to{background-color:#0000}}.apteva-list-item-new,.apteva-table-row-new{animation:.3s ease-out apteva-slide-in,.5s ease-out .3s apteva-highlight-fade!important}.apteva-table-row-new td{background-color:#3b82f61a!important}.apteva-list-streaming,.apteva-table-streaming{border-top:1px dashed #8080804d!important}@media (prefers-color-scheme:dark){.apteva-list-item-new,.apteva-table-row-new{animation:.3s ease-out apteva-slide-in,.5s ease-out .3s apteva-highlight-fade-dark!important}.apteva-table-row-new td{background-color:#3b82f626!important}}.dark .apteva-list-item-new,.dark .apteva-table-row-new{animation:.3s ease-out apteva-slide-in,.5s ease-out .3s apteva-highlight-fade-dark!important}.dark .apteva-table-row-new td{background-color:#3b82f626!important}@keyframes apteva-highlight-fade-dark{0%{background-color:#3b82f633}to{background-color:#0000}}.apteva-chat-minimal{background-color:#0000!important}.apteva-chat-minimal .apteva-chat-header{background-color:#0000!important;border:none!important}.apteva-chat-minimal .apteva-message-list{background-color:#0000!important}.apteva-chat-minimal .apteva-composer{background-color:#0000!important;border:1px solid #80808033!important}.apteva-chat-minimal .apteva-message-assistant{background-color:#80808014!important}.apteva-chat-minimal .apteva-message-user{color:inherit!important;background-color:#3b82f626!important}.apteva-chat-terminal{background-color:#0a0a0a!important;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,monospace!important}.apteva-chat-terminal *{font-family:inherit!important}.apteva-chat-terminal .apteva-chat-header{background-color:#0a0a0a!important;border-color:#1a1a1a!important}.apteva-chat-terminal .apteva-chat-title{color:#e0e0e0!important;font-size:.875rem!important}.apteva-chat-terminal .apteva-chat-status{color:#666!important}.apteva-chat-terminal .apteva-chat-status-tool{color:#f97316!important}.apteva-chat-terminal .apteva-message-list{background-color:#0a0a0a!important}.apteva-chat-terminal .apteva-message-user{color:#e0e0e0!important;background-color:#1a1a1a!important;border-radius:4px!important}.apteva-chat-terminal .apteva-message-assistant{color:#e0e0e0!important;background-color:#111!important;border:1px solid #1a1a1a!important;border-radius:4px!important}.apteva-chat-terminal .apteva-message-timestamp{color:#444!important}.apteva-chat-terminal .apteva-message-timestamp-user{color:#666!important}.apteva-chat-terminal .apteva-composer{background-color:#111!important;border:1px solid #1a1a1a!important;border-radius:4px!important}.apteva-chat-terminal .apteva-composer textarea{color:#e0e0e0!important}.apteva-chat-terminal .apteva-composer textarea::placeholder{color:#666!important}.apteva-chat-terminal .apteva-composer-send-btn{color:#888!important;background-color:#1a1a1a!important;border-color:#333!important}.apteva-chat-terminal .apteva-composer-send-btn:hover{color:#f97316!important;border-color:#f97316!important}.apteva-chat-terminal .apteva-composer-stop-btn{color:#f97316!important;background-color:#f9731626!important;border-color:#f97316!important}.apteva-chat-terminal .apteva-composer-menu-btn{color:#666!important}.apteva-chat-terminal .apteva-composer-menu-btn:hover{color:#f97316!important;background-color:#1a1a1a!important}.apteva-chat-terminal .apteva-tool-card-running{color:#f97316!important;background-color:#f973161a!important;border-color:#f973164d!important}.apteva-chat-terminal .apteva-tool-card-completed{color:#4ade80!important;background-color:#22c55e1a!important;border-color:#22c55e4d!important}.apteva-chat-terminal .apteva-tool-card-preparing{color:#f97316!important;background-color:#f973161a!important;border-color:#f973164d!important}.apteva-chat-terminal .apteva-md-link{color:#f97316!important}.apteva-chat-terminal .apteva-md-link:hover{color:#fb923c!important}.apteva-chat-terminal .apteva-md-inline-code{color:#3b82f6!important;background-color:#1a1a1a!important}}
1
+ @layer components{@keyframes blink{0%,to{opacity:1}50%{opacity:0}}@keyframes slideUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-slideUp{animation:.2s ease-out slideUp}.apteva-scrollbar-hidden{-ms-overflow-style:none;scrollbar-width:none}.apteva-scrollbar-hidden::-webkit-scrollbar{display:none}.apteva-md{white-space:pre-wrap!important;color:inherit!important;word-wrap:break-word!important;overflow-wrap:break-word!important;font-size:.875rem!important;line-height:1.625!important}.apteva-md-h2{all:unset!important;display:block!important;margin-top:.75rem!important;margin-bottom:.25rem!important;font-size:1.125rem!important;font-weight:600!important;line-height:1.3!important}.apteva-md-h3{all:unset!important;display:block!important;margin-top:.5rem!important;margin-bottom:.125rem!important;font-size:1rem!important;font-weight:600!important;line-height:1.3!important}.apteva-md-ul{all:unset!important;list-style-type:disc!important;list-style-position:outside!important;display:block!important;margin-top:.5rem!important;margin-bottom:.5rem!important;padding-left:1.5rem!important}.apteva-md-ol{all:unset!important;list-style-type:decimal!important;list-style-position:outside!important;display:block!important;margin-top:.5rem!important;margin-bottom:.5rem!important;padding-left:1.5rem!important}.apteva-md-li{all:unset!important;display:list-item!important;margin-bottom:.25rem!important;padding-left:.25rem!important}.apteva-tool-call{all:unset!important;display:flex!important;background-color:#8080801a!important;border:1px solid #80808033!important;border-radius:.5rem!important;align-items: center!important;gap:.5rem!important;margin:.5rem 0!important;padding:.5rem .75rem!important;font-size:.875rem!important}.apteva-tool-call-dot{all:unset!important;display:block!important;border-radius:50%!important;flex-shrink:0!important;width:.5rem!important;height:.5rem!important}.apteva-tool-call-dot-running{animation:1s infinite blink!important;background-color:#3b82f6!important}.apteva-tool-call-dot-completed{background-color:#22c55e!important}.apteva-tool-call-dot-error{background-color:#ef4444!important}.apteva-tool-call-name{all:unset!important;color:inherit!important;font-family:ui-monospace,monospace!important}.apteva-tool-call-status{all:unset!important;color:#808080cc!important;margin-left:auto!important}.apteva-tool-call-status-completed{color:#22c55e!important}.apteva-tool-call-status-error{color:#ef4444!important}.apteva-md-table-wrapper{overflow-x:auto!important;margin:.75rem 0!important}.apteva-md-table{border-collapse:collapse!important;width:100%!important;font-size:.8125rem!important;line-height:1.4!important}.apteva-md-th{text-align:left!important;white-space:nowrap!important;border-bottom:2px solid #8080804d!important;padding:.5rem .75rem!important;font-weight:600!important}.apteva-md-td{border-bottom:1px solid #80808026!important;padding:.5rem .75rem!important}.apteva-md-table tbody tr:hover{background-color:#8080800d!important}.apteva-md-table tbody tr:last-child .apteva-md-td{border-bottom:none!important}.apteva-md-img{display:block!important;border-radius:.5rem!important;max-width:100%!important;height:auto!important;margin:.5rem 0!important}.apteva-md-link{color:#3b82f6!important;text-underline-offset:2px!important;text-decoration:underline!important}.apteva-md-link:hover{color:#2563eb!important}.apteva-md-inline-code{background-color:#80808026!important;border-radius:.25rem!important;padding:.125rem .375rem!important;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace!important;font-size:.8125rem!important}.apteva-typing-indicator{display:inline-flex!important;align-items: center!important;gap:2px!important}.apteva-typing-indicator span{opacity:.4!important;animation:1.4s infinite both apteva-typing-blink!important;background-color:currentColor!important;border-radius:50%!important;width:6px!important;height:6px!important}.apteva-typing-indicator span:nth-child(2){animation-delay:.2s!important}.apteva-typing-indicator span:nth-child(3){animation-delay:.4s!important}@keyframes apteva-typing-blink{0%,80%,to{opacity:.4}40%{opacity:1}}.apteva-chat-header{all:unset!important;box-sizing:border-box!important;display:flex!important;justify-content:space-between!important;align-items: center!important;padding:.75rem 1rem!important}.apteva-chat-title{all:unset!important;color:#111827!important;display:block!important;font-size:1.125rem!important;font-weight:600!important;line-height:1.4!important}@media (prefers-color-scheme:dark){.apteva-chat-title{color:#fff!important}}.dark .apteva-chat-title{color:#fff!important}.apteva-chat-status{all:unset!important;display:block!important;margin-top:.125rem!important;font-size:.75rem!important;line-height:1.4!important}.apteva-chat-status-ready,.apteva-chat-status-thinking{color:#737373!important}.apteva-chat-status-tool{color:#3b82f6!important}@media (prefers-color-scheme:dark){.apteva-chat-status-ready,.apteva-chat-status-thinking{color:#525252!important}.apteva-chat-status-tool{color:#60a5fa!important}}.dark .apteva-chat-status-ready,.dark .apteva-chat-status-thinking{color:#525252!important}.dark .apteva-chat-status-tool{color:#60a5fa!important}.apteva-message-list{box-sizing:border-box!important;display:block!important;overflow-y:auto!important;flex:1!important;padding:1rem!important}.apteva-message-row-user{display:flex!important;justify-content:flex-end!important;margin-bottom:.75rem!important}.apteva-message-row-assistant{display:flex!important;justify-content:flex-start!important;margin-bottom:.75rem!important}.apteva-message-bubble{box-sizing:border-box!important;display:block!important;border-radius:1rem!important;max-width:95%!important;padding:.625rem 1rem!important;font-size:.875rem!important;line-height:1.5!important}.apteva-message-user{color:#fff!important;background-color:#2563eb!important;border-bottom-right-radius:.375rem!important}.apteva-message-assistant{color:#0a0a0a!important;background-color:#fafafa!important;border-bottom-left-radius:.375rem!important}@media (prefers-color-scheme:dark){.apteva-message-assistant{color:#fafafa!important;background-color:#262626!important}}.dark .apteva-message-assistant{color:#fafafa!important;background-color:#262626!important}.apteva-message-content-user,.apteva-message-content-assistant{display:block!important}.apteva-message-text{white-space:pre-wrap!important;color:inherit!important;display:block!important;font-size:.875rem!important;line-height:1.625!important}.apteva-message-widgets{display:block!important;margin-top:.5rem!important}.apteva-message-timestamp{display:block!important;margin-top:.375rem!important;font-size:.75rem!important}.apteva-message-timestamp-user{color:#bfdbfe!important}.apteva-message-timestamp-assistant{color:#737373!important}.apteva-message-segmented{display:flex!important;flex-direction:column!important;gap:.5rem!important;width:95%!important;max-width:95%!important}.apteva-message-segmented .apteva-message-bubble{width:-moz-fit-content!important;width:fit-content!important;max-width:100%!important}.apteva-tool-call-standalone,.apteva-widget-standalone{display:block!important}.apteva-widget{color:#171717!important;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif!important;font-size:.875rem!important;line-height:1.5!important}.apteva-widget *{box-sizing:border-box!important}.apteva-widget-skeleton{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif!important}.apteva-widget-skeleton *{box-sizing:border-box!important}.apteva-widget-skeleton [class*=bg-neutral-200]{background-color:#e5e5e5!important}.apteva-widget-skeleton [class*=bg-neutral-100]{background-color:#f5f5f5!important}.apteva-widget-skeleton [class*=bg-neutral-300]{background-color:#d4d4d4!important}.apteva-widget-skeleton [class*=border-neutral]{border-color:#e5e5e5!important}@media (prefers-color-scheme:dark){.apteva-widget-skeleton [class*=bg-neutral-700]{background-color:#404040!important}.apteva-widget-skeleton [class*=bg-neutral-800]{background-color:#262626!important}.apteva-widget-skeleton [class*=bg-neutral-600]{background-color:#525252!important}.apteva-widget-skeleton [class*=border-neutral]{border-color:#262626!important}}.dark .apteva-widget-skeleton [class*=bg-neutral-700]{background-color:#404040!important}.dark .apteva-widget-skeleton [class*=bg-neutral-800]{background-color:#262626!important}.dark .apteva-widget-skeleton [class*=bg-neutral-600]{background-color:#525252!important}.dark .apteva-widget-skeleton [class*=border-neutral]{border-color:#262626!important}.apteva-widget>div{background-color:#fff!important}.apteva-widget h3,.apteva-widget h4{color:#171717!important}.apteva-widget p,.apteva-widget span{color:#525252!important}.apteva-widget>div[class*=border]{border-color:#e5e5e5!important}@media (prefers-color-scheme:dark){.apteva-widget{color:#fafafa!important}.apteva-widget>div{background-color:#171717!important}.apteva-widget h3,.apteva-widget h4{color:#fafafa!important}.apteva-widget p,.apteva-widget span{color:#a3a3a3!important}.apteva-widget>div[class*=border]{border-color:#262626!important}}.dark .apteva-widget{color:#fafafa!important}.dark .apteva-widget>div{background-color:#171717!important}.dark .apteva-widget h3,.dark .apteva-widget h4{color:#fafafa!important}.dark .apteva-widget p,.dark .apteva-widget span{color:#a3a3a3!important}.dark .apteva-widget>div[class*=border]{border-color:#262626!important}@media (prefers-color-scheme:dark){.apteva-message-timestamp-assistant{color:#525252!important}}.dark .apteva-message-timestamp-assistant{color:#525252!important}.apteva-tool-card{box-sizing:border-box!important;display:flex!important;border-style:solid!important;border-width:1px!important;border-radius:.75rem!important;align-items: center!important;gap:.5rem!important;padding:.5rem .75rem!important;font-size:.875rem!important}.apteva-tool-card-running{color:#1d4ed8!important;background-color:#eff6ff!important;border-color:#bfdbfe!important}.apteva-tool-card-completed{color:#15803d!important;background-color:#f0fdf4!important;border-color:#bbf7d0!important}.apteva-tool-card-error{color:#b91c1c!important;background-color:#fef2f2!important;border-color:#fecaca!important}@media (prefers-color-scheme:dark){.apteva-tool-card-running{color:#60a5fa!important;background-color:#3b82f61a!important;border-color:#3b82f64d!important}.apteva-tool-card-completed{color:#4ade80!important;background-color:#22c55e1a!important;border-color:#22c55e4d!important}.apteva-tool-card-error{color:#f87171!important;background-color:#ef44441a!important;border-color:#ef44444d!important}}.dark .apteva-tool-card-running{color:#60a5fa!important;background-color:#3b82f61a!important;border-color:#3b82f64d!important}.dark .apteva-tool-card-completed{color:#4ade80!important;background-color:#22c55e1a!important;border-color:#22c55e4d!important}.dark .apteva-tool-card-error{color:#f87171!important;background-color:#ef44441a!important;border-color:#ef44444d!important}.apteva-tool-icon{flex-shrink:0!important;width:1rem!important;height:1rem!important}.apteva-tool-icon-spin{animation:1s linear infinite apteva-spin!important}.apteva-tool-spinner-track{opacity:.25!important}.apteva-tool-spinner-fill{opacity:.75!important}.apteva-tool-label{font-size:inherit!important}.apteva-tool-label strong{font-weight:600!important}@keyframes apteva-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.apteva-tool-card-preparing{color:#92400e!important;background-color:#fef3c7!important;border-color:#fcd34d!important}@media (prefers-color-scheme:dark){.apteva-tool-card-preparing{color:#fbbf24!important;background-color:#fbbf2426!important;border-color:#fbbf2466!important}}.dark .apteva-tool-card-preparing{color:#fbbf24!important;background-color:#fbbf2426!important;border-color:#fbbf2466!important}@keyframes apteva-pulse-glow{0%,to{box-shadow:0 0 #fbbf2400}50%{box-shadow:0 0 8px 2px #fbbf2480}}.apteva-tool-receiving{animation:.4s ease-in-out apteva-pulse-glow!important}.apteva-tool-status-text{opacity:.7!important;font-weight:400!important}.apteva-tool-char-count{opacity:.6!important;font-variant-numeric:tabular-nums!important;font-size:.85em!important;font-weight:400!important}.apteva-tool-dots{display:inline-flex!important;margin-left:1px!important}.apteva-tool-dots span{opacity:.3!important;animation:1.4s ease-in-out infinite apteva-dot-pulse!important}.apteva-tool-dots span:first-child{animation-delay:0s!important}.apteva-tool-dots span:nth-child(2){animation-delay:.2s!important}.apteva-tool-dots span:nth-child(3){animation-delay:.4s!important}@keyframes apteva-dot-pulse{0%,60%,to{opacity:.3}30%{opacity:1}}.apteva-tool-stream-separator{opacity:.5!important}.apteva-tool-stream-output{opacity:.85!important;white-space:nowrap!important;text-overflow:ellipsis!important;vertical-align:bottom!important;display:inline-block!important;overflow:hidden!important;max-width:300px!important;font-weight:400!important}.apteva-composer{display:grid!important;position:relative!important;background-color:#fff!important;border:2px solid #d4d4d4!important;border-radius:1rem!important;gap:.5rem .75rem!important;padding:.5rem .75rem!important;transition:all .3s!important}.apteva-composer textarea{color:#171717!important;background-color:#0000!important}.apteva-composer textarea::placeholder{color:#a3a3a3!important}button.apteva-composer-menu-btn{background:0 0!important;border:none!important}.apteva-composer-menu{background-color:#262626!important}.apteva-composer-menu button{color:#fff!important;background-color:#0000!important}.apteva-composer-menu button:hover{background-color:#404040!important}.apteva-composer-send-btn{color:#404040!important;background-color:#fff!important;border:1px solid #d4d4d4!important}.apteva-composer-send-btn svg{stroke:currentColor!important}.apteva-composer-stop-btn{all:unset!important;box-sizing:border-box!important;cursor:pointer!important;color:#dc2626!important;display:flex!important;background-color:#fef2f2!important;border:1px solid #f87171!important;border-radius:.5rem!important;flex-shrink:0!important;justify-content:center!important;align-items: center!important;width:2rem!important;height:2rem!important;margin:0!important;padding:0!important;transition:background-color .15s!important}.apteva-composer-stop-btn:hover{background-color:#fee2e2!important}.apteva-composer-stop-btn svg{fill:currentColor!important;width:14px!important;height:14px!important}@media (prefers-color-scheme:dark){.apteva-composer{background-color:#171717!important;border-color:#404040!important}.apteva-composer textarea{color:#fafafa!important}.apteva-composer textarea::placeholder{color:#525252!important}button.apteva-composer-menu-btn{background:0 0!important}.apteva-composer-send-btn{color:#d4d4d4!important;background-color:#262626!important;border-color:#404040!important}.apteva-composer-stop-btn{color:#f87171!important;background-color:#7f1d1d4d!important;border-color:#f87171!important}.apteva-composer-stop-btn:hover{background-color:#7f1d1d80!important}}.dark .apteva-composer{background-color:#171717!important;border-color:#404040!important}.dark .apteva-composer textarea{color:#fafafa!important}.dark .apteva-composer textarea::placeholder{color:#525252!important}.dark button.apteva-composer-menu-btn{background:0 0!important}.dark .apteva-composer-send-btn{color:#d4d4d4!important;background-color:#262626!important;border-color:#404040!important}.dark .apteva-composer-stop-btn{color:#f87171!important;background-color:#7f1d1d4d!important;border-color:#f87171!important}.dark .apteva-composer-stop-btn:hover{background-color:#7f1d1d80!important}.apteva-file-preview{display:flex!important;flex-wrap:wrap!important;gap:.5rem!important;margin-bottom:.5rem!important}.apteva-file-item{all:unset!important;box-sizing:border-box!important;display:flex!important;position:relative!important;background-color:#f5f5f5!important;border:1px solid #e5e5e5!important;border-radius:.5rem!important;align-items: center!important;gap:.5rem!important;padding:.5rem .75rem!important;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif!important}.apteva-file-item:hover .apteva-file-remove{opacity:1!important}.apteva-file-thumb{object-fit:cover!important;border-radius:.25rem!important;flex-shrink:0!important;width:2rem!important;height:2rem!important}.apteva-file-icon{color:#737373!important;display:flex!important;background-color:#e5e5e5!important;border-radius:.25rem!important;flex-shrink:0!important;justify-content:center!important;align-items: center!important;width:2rem!important;height:2rem!important}.apteva-file-icon svg{width:1rem!important;height:1rem!important}.apteva-file-info{display:flex!important;flex-direction:column!important;min-width:0!important}.apteva-file-name{color:#404040!important;text-overflow:ellipsis!important;white-space:nowrap!important;overflow:hidden!important;max-width:120px!important;font-size:.75rem!important;font-weight:500!important}.apteva-file-size{color:#737373!important;font-size:.75rem!important}.apteva-file-remove{all:unset!important;box-sizing:border-box!important;color:#fff!important;opacity:0!important;cursor:pointer!important;display:flex!important;position:absolute!important;background-color:#737373!important;border-radius:50%!important;justify-content:center!important;align-items: center!important;width:1.25rem!important;height:1.25rem!important;transition:opacity .15s,background-color .15s!important;top:-.375rem!important;right:-.375rem!important}.apteva-file-remove:hover{background-color:#ef4444!important}.apteva-file-remove svg{width:.75rem!important;height:.75rem!important}.apteva-file-error{all:unset!important;box-sizing:border-box!important;z-index:20!important;position:absolute!important;background-color:#fef2f2!important;border:1px solid #fecaca!important;border-radius:.5rem!important;margin-bottom:.5rem!important;padding:.75rem!important;bottom:100%!important;left:1rem!important;right:1rem!important}.apteva-file-error-content{color:#b91c1c!important;display:flex!important;align-items: center!important;gap:.5rem!important;font-size:.875rem!important}.apteva-file-error-content svg{flex-shrink:0!important;width:1rem!important;height:1rem!important}@media (prefers-color-scheme:dark){.apteva-file-item{background-color:#262626!important;border-color:#404040!important}.apteva-file-icon{color:#a3a3a3!important;background-color:#404040!important}.apteva-file-name{color:#d4d4d4!important}.apteva-file-size{color:#a3a3a3!important}.apteva-file-error{background-color:#7f1d1d4d!important;border-color:#f87171!important}.apteva-file-error-content{color:#fca5a5!important}}.dark .apteva-file-item{background-color:#262626!important;border-color:#404040!important}.dark .apteva-file-icon{color:#a3a3a3!important;background-color:#404040!important}.dark .apteva-file-name{color:#d4d4d4!important}.dark .apteva-file-size{color:#a3a3a3!important}.dark .apteva-file-error{background-color:#7f1d1d4d!important;border-color:#f87171!important}.dark .apteva-file-error-content{color:#fca5a5!important}.apteva-file-badges{display:flex!important;flex-shrink:0!important;align-items: center!important;gap:.25rem!important}.apteva-file-badge{all:unset!important;box-sizing:border-box!important;display:flex!important;position:relative!important;overflow:hidden!important;background-color:#f5f5f5!important;border-radius:.25rem!important;justify-content:center!important;align-items: center!important;width:1.5rem!important;height:1.5rem!important}.apteva-file-badge:hover .apteva-file-badge-remove{opacity:1!important}.apteva-file-badge-img{object-fit:cover!important;width:1.5rem!important;height:1.5rem!important}.apteva-file-badge-icon{color:#737373!important;font-size:.75rem!important}.apteva-file-badge-icon svg{width:1rem!important;height:1rem!important}.apteva-file-badge-remove{all:unset!important;box-sizing:border-box!important;opacity:0!important;cursor:pointer!important;display:flex!important;position:absolute!important;background-color:#00000080!important;justify-content:center!important;align-items: center!important;transition:opacity .15s!important;inset:0!important}.apteva-file-badge-remove svg{color:#fff!important;width:.75rem!important;height:.75rem!important}@media (prefers-color-scheme:dark){.apteva-file-badge{background-color:#262626!important}.apteva-file-badge-icon{color:#a3a3a3!important}}.dark .apteva-file-badge{background-color:#262626!important}.dark .apteva-file-badge-icon{color:#a3a3a3!important}.apteva-composer-textarea{-ms-overflow-style:none!important;scrollbar-width:none!important}.apteva-composer-textarea::-webkit-scrollbar{display:none!important}.apteva-chat{background-color:#fff!important}.apteva-chat-header{background-color:#fff!important;border-color:#e5e5e5!important}.apteva-message-list{background-color:#f5f5f5!important}@media (prefers-color-scheme:dark){.apteva-chat{background-color:#0a0a0a!important}.apteva-chat-header{background-color:#171717!important;border-color:#262626!important}.apteva-message-list{background-color:#0a0a0a!important}}.dark .apteva-chat{background-color:#0a0a0a!important}.dark .apteva-chat-header{background-color:#171717!important;border-color:#262626!important}.dark .apteva-message-list{background-color:#0a0a0a!important}@keyframes apteva-slide-in{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes apteva-highlight-fade{0%{background-color:#3b82f626}to{background-color:#0000}}.apteva-list-item-new,.apteva-table-row-new{animation:.3s ease-out apteva-slide-in,.5s ease-out .3s apteva-highlight-fade!important}.apteva-table-row-new td{background-color:#3b82f61a!important}.apteva-list-streaming,.apteva-table-streaming{border-top:1px dashed #8080804d!important}@media (prefers-color-scheme:dark){.apteva-list-item-new,.apteva-table-row-new{animation:.3s ease-out apteva-slide-in,.5s ease-out .3s apteva-highlight-fade-dark!important}.apteva-table-row-new td{background-color:#3b82f626!important}}.dark .apteva-list-item-new,.dark .apteva-table-row-new{animation:.3s ease-out apteva-slide-in,.5s ease-out .3s apteva-highlight-fade-dark!important}.dark .apteva-table-row-new td{background-color:#3b82f626!important}@keyframes apteva-highlight-fade-dark{0%{background-color:#3b82f633}to{background-color:#0000}}.apteva-chat-minimal{background-color:#0000!important}.apteva-chat-minimal .apteva-chat-header{background-color:#0000!important;border:none!important}.apteva-chat-minimal .apteva-message-list{background-color:#0000!important}.apteva-chat-minimal .apteva-composer{background-color:#0000!important;border:1px solid #80808033!important}.apteva-chat-minimal .apteva-message-assistant{background-color:#80808014!important}.apteva-chat-minimal .apteva-message-user{color:inherit!important;background-color:#3b82f626!important}.apteva-chat-terminal{background-color:#0a0a0a!important;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,monospace!important}.apteva-chat-terminal *{font-family:inherit!important}.apteva-chat-terminal .apteva-chat-header{background-color:#0a0a0a!important;border-color:#1a1a1a!important}.apteva-chat-terminal .apteva-chat-title{color:#e0e0e0!important;font-size:.875rem!important}.apteva-chat-terminal .apteva-chat-status{color:#666!important}.apteva-chat-terminal .apteva-chat-status-tool{color:#f97316!important}.apteva-chat-terminal .apteva-message-list{background-color:#0a0a0a!important}.apteva-chat-terminal .apteva-message-user{color:#e0e0e0!important;background-color:#1a1a1a!important;border-radius:4px!important}.apteva-chat-terminal .apteva-message-assistant{color:#e0e0e0!important;background-color:#111!important;border:1px solid #1a1a1a!important;border-radius:4px!important}.apteva-chat-terminal .apteva-message-timestamp{color:#444!important}.apteva-chat-terminal .apteva-message-timestamp-user{color:#666!important}.apteva-chat-terminal .apteva-composer{background-color:#111!important;border:1px solid #1a1a1a!important;border-radius:4px!important}.apteva-chat-terminal .apteva-composer textarea{color:#e0e0e0!important}.apteva-chat-terminal .apteva-composer textarea::placeholder{color:#666!important}.apteva-chat-terminal .apteva-composer-send-btn{color:#888!important;background-color:#1a1a1a!important;border-color:#333!important}.apteva-chat-terminal .apteva-composer-send-btn:hover{color:#f97316!important;border-color:#f97316!important}.apteva-chat-terminal .apteva-composer-stop-btn{color:#f97316!important;background-color:#f9731626!important;border-color:#f97316!important}.apteva-chat-terminal .apteva-composer-menu-btn{color:#666!important}.apteva-chat-terminal .apteva-composer-menu-btn:hover{color:#f97316!important;background-color:#1a1a1a!important}.apteva-chat-terminal .apteva-tool-card-running{color:#f97316!important;background-color:#f973161a!important;border-color:#f973164d!important}.apteva-chat-terminal .apteva-tool-card-completed{color:#4ade80!important;background-color:#22c55e1a!important;border-color:#22c55e4d!important}.apteva-chat-terminal .apteva-tool-card-preparing{color:#f97316!important;background-color:#f973161a!important;border-color:#f973164d!important}.apteva-chat-terminal .apteva-md-link{color:#f97316!important}.apteva-chat-terminal .apteva-md-link:hover{color:#fb923c!important}.apteva-chat-terminal .apteva-md-inline-code{color:#3b82f6!important;background-color:#1a1a1a!important}}
@@ -0,0 +1,20 @@
1
+ var rW=Object.create;var{getPrototypeOf:aW,defineProperty:mW,getOwnPropertyNames:tW}=Object;var eW=Object.prototype.hasOwnProperty;var n=(H,R,w)=>{w=H!=null?rW(aW(H)):{};let F=R||!H||!H.__esModule?mW(w,"default",{value:H,enumerable:!0}):w;for(let k of tW(H))if(!eW.call(F,k))mW(F,k,{get:()=>H[k],enumerable:!0});return F};var fW=(H,R)=>()=>(R||H((R={exports:{}}).exports,R),R.exports);var DZ=((H)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(H,{get:(R,w)=>(typeof require<"u"?require:R)[w]}):H)(function(H){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+H+'" is not supported')});var UW=fW((WZ,RW)=>{(function(){function H(W,Z){Object.defineProperty(F.prototype,W,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",Z[0],Z[1])}})}function R(W){if(W===null||typeof W!=="object")return null;return W=NW&&W[NW]||W["@@iterator"],typeof W==="function"?W:null}function w(W,Z){W=(W=W.constructor)&&(W.displayName||W.name)||"ReactClass";var X=W+"."+Z;PW[X]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",Z,W),PW[X]=!0)}function F(W,Z,X){this.props=W,this.context=Z,this.refs=FW,this.updater=X||xW}function k(){}function C(W,Z,X){this.props=W,this.context=Z,this.refs=FW,this.updater=X||xW}function _(){}function A(W){return""+W}function S(W){try{A(W);var Z=!1}catch(Y){Z=!0}if(Z){Z=console;var X=Z.error,B=typeof Symbol==="function"&&Symbol.toStringTag&&W[Symbol.toStringTag]||W.constructor.name||"Object";return X.call(Z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",B),A(W)}}function y(W){if(W==null)return null;if(typeof W==="function")return W.$$typeof===iW?null:W.displayName||W.name||null;if(typeof W==="string")return W;switch(W){case GW:return"Fragment";case U:return"Profiler";case M:return"StrictMode";case HW:return"Suspense";case x:return"SuspenseList";case DW:return"Activity"}if(typeof W==="object")switch(typeof W.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),W.$$typeof){case OW:return"Portal";case b:return W.displayName||"Context";case N:return(W._context.displayName||"Context")+".Consumer";case o:var Z=W.render;return W=W.displayName,W||(W=Z.displayName||Z.name||"",W=W!==""?"ForwardRef("+W+")":"ForwardRef"),W;case l:return Z=W.displayName||null,Z!==null?Z:y(W.type)||"Memo";case r:Z=W._payload,W=W._init;try{return y(W(Z))}catch(X){}}return null}function c(W){if(W===GW)return"<>";if(typeof W==="object"&&W!==null&&W.$$typeof===r)return"<...>";try{var Z=y(W);return Z?"<"+Z+">":"<...>"}catch(X){return"<...>"}}function p(){var W=O.A;return W===null?null:W.getOwner()}function s(){return Error("react-stack-top-frame")}function u(W){if(LW.call(W,"key")){var Z=Object.getOwnPropertyDescriptor(W,"key").get;if(Z&&Z.isReactWarning)return!1}return W.key!==void 0}function f(W,Z){function X(){jW||(jW=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Z))}X.isReactWarning=!0,Object.defineProperty(W,"key",{get:X,configurable:!0})}function g(){var W=y(this.type);return vW[W]||(vW[W]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),W=this.props.ref,W!==void 0?W:null}function K(W,Z,X,B,Y,D){var $=X.ref;return W={$$typeof:QW,type:W,key:Z,props:X,_owner:B},($!==void 0?$:null)!==null?Object.defineProperty(W,"ref",{enumerable:!1,get:g}):Object.defineProperty(W,"ref",{enumerable:!1,value:null}),W._store={},Object.defineProperty(W._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(W,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(W,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.defineProperty(W,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.freeze&&(Object.freeze(W.props),Object.freeze(W)),W}function m(W,Z){return Z=K(W.type,Z,W.props,W._owner,W._debugStack,W._debugTask),W._store&&(Z._store.validated=W._store.validated),Z}function I(W){j(W)?W._store&&(W._store.validated=1):typeof W==="object"&&W!==null&&W.$$typeof===r&&(W._payload.status==="fulfilled"?j(W._payload.value)&&W._payload.value._store&&(W._payload.value._store.validated=1):W._store&&(W._store.validated=1))}function j(W){return typeof W==="object"&&W!==null&&W.$$typeof===QW}function d(W){var Z={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(X){return Z[X]})}function T(W,Z){return typeof W==="object"&&W!==null&&W.key!=null?(S(W.key),d(""+W.key)):Z.toString(36)}function J(W){switch(W.status){case"fulfilled":return W.value;case"rejected":throw W.reason;default:switch(typeof W.status==="string"?W.then(_,_):(W.status="pending",W.then(function(Z){W.status==="pending"&&(W.status="fulfilled",W.value=Z)},function(Z){W.status==="pending"&&(W.status="rejected",W.reason=Z)})),W.status){case"fulfilled":return W.value;case"rejected":throw W.reason}}throw W}function Q(W,Z,X,B,Y){var D=typeof W;if(D==="undefined"||D==="boolean")W=null;var $=!1;if(W===null)$=!0;else switch(D){case"bigint":case"string":case"number":$=!0;break;case"object":switch(W.$$typeof){case QW:case OW:$=!0;break;case r:return $=W._init,Q($(W._payload),Z,X,B,Y)}}if($){$=W,Y=Y($);var V=B===""?"."+T($,0):B;return AW(Y)?(X="",V!=null&&(X=V.replace(SW,"$&/")+"/"),Q(Y,Z,X,"",function(a){return a})):Y!=null&&(j(Y)&&(Y.key!=null&&($&&$.key===Y.key||S(Y.key)),X=m(Y,X+(Y.key==null||$&&$.key===Y.key?"":(""+Y.key).replace(SW,"$&/")+"/")+V),B!==""&&$!=null&&j($)&&$.key==null&&$._store&&!$._store.validated&&(X._store.validated=2),Y=X),Z.push(Y)),1}if($=0,V=B===""?".":B+":",AW(W))for(var L=0;L<W.length;L++)B=W[L],D=V+T(B,L),$+=Q(B,Z,X,D,Y);else if(L=R(W),typeof L==="function")for(L===W.entries&&(CW||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),CW=!0),W=L.call(W),L=0;!(B=W.next()).done;)B=B.value,D=V+T(B,L++),$+=Q(B,Z,X,D,Y);else if(D==="object"){if(typeof W.then==="function")return Q(J(W),Z,X,B,Y);throw Z=String(W),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return $}function G(W,Z,X){if(W==null)return W;var B=[],Y=0;return Q(W,B,"","",function(D){return Z.call(X,D,Y++)}),B}function q(W){if(W._status===-1){var Z=W._ioInfo;Z!=null&&(Z.start=Z.end=performance.now()),Z=W._result;var X=Z();if(X.then(function(Y){if(W._status===0||W._status===-1){W._status=1,W._result=Y;var D=W._ioInfo;D!=null&&(D.end=performance.now()),X.status===void 0&&(X.status="fulfilled",X.value=Y)}},function(Y){if(W._status===0||W._status===-1){W._status=2,W._result=Y;var D=W._ioInfo;D!=null&&(D.end=performance.now()),X.status===void 0&&(X.status="rejected",X.reason=Y)}}),Z=W._ioInfo,Z!=null){Z.value=X;var B=X.displayName;typeof B==="string"&&(Z.name=B)}W._status===-1&&(W._status=0,W._result=X)}if(W._status===1)return Z=W._result,Z===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
2
+
3
+ Your code should look like:
4
+ const MyComponent = lazy(() => import('./MyComponent'))
5
+
6
+ Did you accidentally put curly braces around the import?`,Z),"default"in Z||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
7
+
8
+ Your code should look like:
9
+ const MyComponent = lazy(() => import('./MyComponent'))`,Z),Z.default;throw W._result}function z(){var W=O.H;return W===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
10
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
11
+ 2. You might be breaking the Rules of Hooks
12
+ 3. You might have more than one copy of React in the same app
13
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),W}function h(){O.asyncTransitions--}function t(W){if(JW===null)try{var Z=("require"+Math.random()).slice(0,7);JW=(RW&&RW[Z]).call(RW,"timers").setImmediate}catch(X){JW=function(B){kW===!1&&(kW=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var Y=new MessageChannel;Y.port1.onmessage=B,Y.port2.postMessage(void 0)}}return JW(W)}function e(W){return 1<W.length&&typeof AggregateError==="function"?AggregateError(W):W[0]}function WW(W,Z){Z!==qW-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),qW=Z}function XW(W,Z,X){var B=O.actQueue;if(B!==null)if(B.length!==0)try{BW(B),t(function(){return XW(W,Z,X)});return}catch(Y){O.thrownErrors.push(Y)}else O.actQueue=null;0<O.thrownErrors.length?(B=e(O.thrownErrors),O.thrownErrors.length=0,X(B)):Z(W)}function BW(W){if(!VW){VW=!0;var Z=0;try{for(;Z<W.length;Z++){var X=W[Z];do{O.didUsePromise=!1;var B=X(!1);if(B!==null){if(O.didUsePromise){W[Z]=X,W.splice(0,Z);return}X=B}else break}while(1)}W.length=0}catch(Y){W.splice(0,Z+1),O.thrownErrors.push(Y)}finally{VW=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var QW=Symbol.for("react.transitional.element"),OW=Symbol.for("react.portal"),GW=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),b=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),HW=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),r=Symbol.for("react.lazy"),DW=Symbol.for("react.activity"),NW=Symbol.iterator,PW={},xW={isMounted:function(){return!1},enqueueForceUpdate:function(W){w(W,"forceUpdate")},enqueueReplaceState:function(W){w(W,"replaceState")},enqueueSetState:function(W){w(W,"setState")}},_W=Object.assign,FW={};Object.freeze(FW),F.prototype.isReactComponent={},F.prototype.setState=function(W,Z){if(typeof W!=="object"&&typeof W!=="function"&&W!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,Z,"setState")},F.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};var i={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for($W in i)i.hasOwnProperty($W)&&H($W,i[$W]);k.prototype=F.prototype,i=C.prototype=new k,i.constructor=C,_W(i,F.prototype),i.isPureReactComponent=!0;var AW=Array.isArray,iW=Symbol.for("react.client.reference"),O={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},LW=Object.prototype.hasOwnProperty,IW=console.createTask?console.createTask:function(){return null};i={react_stack_bottom_frame:function(W){return W()}};var jW,TW,vW={},cW=i.react_stack_bottom_frame.bind(i,s)(),oW=IW(c(s)),CW=!1,SW=/\/+/g,gW=typeof reportError==="function"?reportError:function(W){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof W==="object"&&W!==null&&typeof W.message==="string"?String(W.message):String(W),error:W});if(!window.dispatchEvent(Z))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",W);return}console.error(W)},kW=!1,JW=null,qW=0,wW=!1,VW=!1,bW=typeof queueMicrotask==="function"?function(W){queueMicrotask(function(){return queueMicrotask(W)})}:t;i=Object.freeze({__proto__:null,c:function(W){return z().useMemoCache(W)}});var $W={map:G,forEach:function(W,Z,X){G(W,function(){Z.apply(this,arguments)},X)},count:function(W){var Z=0;return G(W,function(){Z++}),Z},toArray:function(W){return G(W,function(Z){return Z})||[]},only:function(W){if(!j(W))throw Error("React.Children.only expected to receive a single React element child.");return W}};WZ.Activity=DW,WZ.Children=$W,WZ.Component=F,WZ.Fragment=GW,WZ.Profiler=U,WZ.PureComponent=C,WZ.StrictMode=M,WZ.Suspense=HW,WZ.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,WZ.__COMPILER_RUNTIME=i,WZ.act=function(W){var Z=O.actQueue,X=qW;qW++;var B=O.actQueue=Z!==null?Z:[],Y=!1;try{var D=W()}catch(L){O.thrownErrors.push(L)}if(0<O.thrownErrors.length)throw WW(Z,X),W=e(O.thrownErrors),O.thrownErrors.length=0,W;if(D!==null&&typeof D==="object"&&typeof D.then==="function"){var $=D;return bW(function(){Y||wW||(wW=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(L,a){Y=!0,$.then(function(YW){if(WW(Z,X),X===0){try{BW(B),t(function(){return XW(YW,L,a)})}catch(nW){O.thrownErrors.push(nW)}if(0<O.thrownErrors.length){var lW=e(O.thrownErrors);O.thrownErrors.length=0,a(lW)}}else L(YW)},function(YW){WW(Z,X),0<O.thrownErrors.length?(YW=e(O.thrownErrors),O.thrownErrors.length=0,a(YW)):a(YW)})}}}var V=D;if(WW(Z,X),X===0&&(BW(B),B.length!==0&&bW(function(){Y||wW||(wW=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),O.actQueue=null),0<O.thrownErrors.length)throw W=e(O.thrownErrors),O.thrownErrors.length=0,W;return{then:function(L,a){Y=!0,X===0?(O.actQueue=B,t(function(){return XW(V,L,a)})):L(V)}}},WZ.cache=function(W){return function(){return W.apply(null,arguments)}},WZ.cacheSignal=function(){return null},WZ.captureOwnerStack=function(){var W=O.getCurrentStack;return W===null?null:W()},WZ.cloneElement=function(W,Z,X){if(W===null||W===void 0)throw Error("The argument must be a React element, but you passed "+W+".");var B=_W({},W.props),Y=W.key,D=W._owner;if(Z!=null){var $;W:{if(LW.call(Z,"ref")&&($=Object.getOwnPropertyDescriptor(Z,"ref").get)&&$.isReactWarning){$=!1;break W}$=Z.ref!==void 0}$&&(D=p()),u(Z)&&(S(Z.key),Y=""+Z.key);for(V in Z)!LW.call(Z,V)||V==="key"||V==="__self"||V==="__source"||V==="ref"&&Z.ref===void 0||(B[V]=Z[V])}var V=arguments.length-2;if(V===1)B.children=X;else if(1<V){$=Array(V);for(var L=0;L<V;L++)$[L]=arguments[L+2];B.children=$}B=K(W.type,Y,B,D,W._debugStack,W._debugTask);for(Y=2;Y<arguments.length;Y++)I(arguments[Y]);return B},WZ.createContext=function(W){return W={$$typeof:b,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null},W.Provider=W,W.Consumer={$$typeof:N,_context:W},W._currentRenderer=null,W._currentRenderer2=null,W},WZ.createElement=function(W,Z,X){for(var B=2;B<arguments.length;B++)I(arguments[B]);B={};var Y=null;if(Z!=null)for(L in TW||!("__self"in Z)||"key"in Z||(TW=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),u(Z)&&(S(Z.key),Y=""+Z.key),Z)LW.call(Z,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&(B[L]=Z[L]);var D=arguments.length-2;if(D===1)B.children=X;else if(1<D){for(var $=Array(D),V=0;V<D;V++)$[V]=arguments[V+2];Object.freeze&&Object.freeze($),B.children=$}if(W&&W.defaultProps)for(L in D=W.defaultProps,D)B[L]===void 0&&(B[L]=D[L]);Y&&f(B,typeof W==="function"?W.displayName||W.name||"Unknown":W);var L=1e4>O.recentlyCreatedOwnerStacks++;return K(W,Y,B,p(),L?Error("react-stack-top-frame"):cW,L?IW(c(W)):oW)},WZ.createRef=function(){var W={current:null};return Object.seal(W),W},WZ.forwardRef=function(W){W!=null&&W.$$typeof===l?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof W!=="function"?console.error("forwardRef requires a render function but was given %s.",W===null?"null":typeof W):W.length!==0&&W.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",W.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),W!=null&&W.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var Z={$$typeof:o,render:W},X;return Object.defineProperty(Z,"displayName",{enumerable:!1,configurable:!0,get:function(){return X},set:function(B){X=B,W.name||W.displayName||(Object.defineProperty(W,"name",{value:B}),W.displayName=B)}}),Z},WZ.isValidElement=j,WZ.lazy=function(W){W={_status:-1,_result:W};var Z={$$typeof:r,_payload:W,_init:q},X={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return W._ioInfo=X,Z._debugInfo=[{awaited:X}],Z},WZ.memo=function(W,Z){W==null&&console.error("memo: The first argument must be a component. Instead received: %s",W===null?"null":typeof W),Z={$$typeof:l,type:W,compare:Z===void 0?null:Z};var X;return Object.defineProperty(Z,"displayName",{enumerable:!1,configurable:!0,get:function(){return X},set:function(B){X=B,W.name||W.displayName||(Object.defineProperty(W,"name",{value:B}),W.displayName=B)}}),Z},WZ.startTransition=function(W){var Z=O.T,X={};X._updatedFibers=new Set,O.T=X;try{var B=W(),Y=O.S;Y!==null&&Y(X,B),typeof B==="object"&&B!==null&&typeof B.then==="function"&&(O.asyncTransitions++,B.then(h,h),B.then(_,gW))}catch(D){gW(D)}finally{Z===null&&X._updatedFibers&&(W=X._updatedFibers.size,X._updatedFibers.clear(),10<W&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),Z!==null&&X.types!==null&&(Z.types!==null&&Z.types!==X.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),Z.types=X.types),O.T=Z}},WZ.unstable_useCacheRefresh=function(){return z().useCacheRefresh()},WZ.use=function(W){return z().use(W)},WZ.useActionState=function(W,Z,X){return z().useActionState(W,Z,X)},WZ.useCallback=function(W,Z){return z().useCallback(W,Z)},WZ.useContext=function(W){var Z=z();return W.$$typeof===N&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),Z.useContext(W)},WZ.useDebugValue=function(W,Z){return z().useDebugValue(W,Z)},WZ.useDeferredValue=function(W,Z){return z().useDeferredValue(W,Z)},WZ.useEffect=function(W,Z){return W==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),z().useEffect(W,Z)},WZ.useEffectEvent=function(W){return z().useEffectEvent(W)},WZ.useId=function(){return z().useId()},WZ.useImperativeHandle=function(W,Z,X){return z().useImperativeHandle(W,Z,X)},WZ.useInsertionEffect=function(W,Z){return W==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),z().useInsertionEffect(W,Z)},WZ.useLayoutEffect=function(W,Z){return W==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),z().useLayoutEffect(W,Z)},WZ.useMemo=function(W,Z){return z().useMemo(W,Z)},WZ.useOptimistic=function(W,Z){return z().useOptimistic(W,Z)},WZ.useReducer=function(W,Z,X){return z().useReducer(W,Z,X)},WZ.useRef=function(W){return z().useRef(W)},WZ.useState=function(W){return z().useState(W)},WZ.useSyncExternalStore=function(W,Z,X){return z().useSyncExternalStore(W,Z,X)},WZ.useTransition=function(){return z().useTransition()},WZ.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var MW=fW((ZZ)=>{var ZW=n(UW());(function(){function H(M){if(M==null)return null;if(typeof M==="function")return M.$$typeof===z?null:M.displayName||M.name||null;if(typeof M==="string")return M;switch(M){case g:return"Fragment";case m:return"Profiler";case K:return"StrictMode";case T:return"Suspense";case J:return"SuspenseList";case q:return"Activity"}if(typeof M==="object")switch(typeof M.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),M.$$typeof){case f:return"Portal";case j:return M.displayName||"Context";case I:return(M._context.displayName||"Context")+".Consumer";case d:var U=M.render;return M=M.displayName,M||(M=U.displayName||U.name||"",M=M!==""?"ForwardRef("+M+")":"ForwardRef"),M;case Q:return U=M.displayName||null,U!==null?U:H(M.type)||"Memo";case G:U=M._payload,M=M._init;try{return H(M(U))}catch(N){}}return null}function R(M){return""+M}function w(M){try{R(M);var U=!1}catch(o){U=!0}if(U){U=console;var N=U.error,b=typeof Symbol==="function"&&Symbol.toStringTag&&M[Symbol.toStringTag]||M.constructor.name||"Object";return N.call(U,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),R(M)}}function F(M){if(M===g)return"<>";if(typeof M==="object"&&M!==null&&M.$$typeof===G)return"<...>";try{var U=H(M);return U?"<"+U+">":"<...>"}catch(N){return"<...>"}}function k(){var M=h.A;return M===null?null:M.getOwner()}function C(){return Error("react-stack-top-frame")}function _(M){if(t.call(M,"key")){var U=Object.getOwnPropertyDescriptor(M,"key").get;if(U&&U.isReactWarning)return!1}return M.key!==void 0}function A(M,U){function N(){XW||(XW=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",U))}N.isReactWarning=!0,Object.defineProperty(M,"key",{get:N,configurable:!0})}function S(){var M=H(this.type);return BW[M]||(BW[M]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),M=this.props.ref,M!==void 0?M:null}function y(M,U,N,b,o,HW){var x=N.ref;return M={$$typeof:u,type:M,key:U,props:N,_owner:b},(x!==void 0?x:null)!==null?Object.defineProperty(M,"ref",{enumerable:!1,get:S}):Object.defineProperty(M,"ref",{enumerable:!1,value:null}),M._store={},Object.defineProperty(M._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(M,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(M,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.defineProperty(M,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:HW}),Object.freeze&&(Object.freeze(M.props),Object.freeze(M)),M}function c(M,U,N,b,o,HW){var x=U.children;if(x!==void 0)if(b)if(e(x)){for(b=0;b<x.length;b++)p(x[b]);Object.freeze&&Object.freeze(x)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(x);if(t.call(U,"key")){x=H(M);var l=Object.keys(U).filter(function(DW){return DW!=="key"});b=0<l.length?"{key: someKey, "+l.join(": ..., ")+": ...}":"{key: someKey}",GW[x+b]||(l=0<l.length?"{"+l.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
14
+ let props = %s;
15
+ <%s {...props} />
16
+ React keys must be passed directly to JSX without using spread:
17
+ let props = %s;
18
+ <%s key={someKey} {...props} />`,b,x,l,x),GW[x+b]=!0)}if(x=null,N!==void 0&&(w(N),x=""+N),_(U)&&(w(U.key),x=""+U.key),"key"in U){N={};for(var r in U)r!=="key"&&(N[r]=U[r])}else N=U;return x&&A(N,typeof M==="function"?M.displayName||M.name||"Unknown":M),y(M,x,N,k(),o,HW)}function p(M){s(M)?M._store&&(M._store.validated=1):typeof M==="object"&&M!==null&&M.$$typeof===G&&(M._payload.status==="fulfilled"?s(M._payload.value)&&M._payload.value._store&&(M._payload.value._store.validated=1):M._store&&(M._store.validated=1))}function s(M){return typeof M==="object"&&M!==null&&M.$$typeof===u}var u=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),j=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),z=Symbol.for("react.client.reference"),h=ZW.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,t=Object.prototype.hasOwnProperty,e=Array.isArray,WW=console.createTask?console.createTask:function(){return null};ZW={react_stack_bottom_frame:function(M){return M()}};var XW,BW={},QW=ZW.react_stack_bottom_frame.bind(ZW,C)(),OW=WW(F(C)),GW={};ZZ.Fragment=g,ZZ.jsxDEV=function(M,U,N,b){var o=1e4>h.recentlyCreatedOwnerStacks++;return c(M,U,N,b,o?Error("react-stack-top-frame"):QW,o?WW(F(M)):OW)}})()});var P=n(UW(),1),yW=n(MW(),1),hW=P.createContext(null),MZ=200;function XZ({children:H}){let[R,w]=P.useState(!1),[F,k]=P.useState([]),[C,_]=P.useState({}),[A,S]=P.useState({}),[y,c]=P.useState(0),[p,s]=P.useState(0),[u,f]=P.useState(0),g=P.useRef(null),K=P.useRef(null);P.useEffect(()=>{let j=setInterval(()=>{let d=Date.now();S((T)=>{let J={};for(let[Q,G]of Object.entries(T))if(G.expiresAt>d)J[Q]=G;return J})},500);return()=>clearInterval(j)},[]);let m=P.useCallback(()=>{if(g.current)g.current.close(),g.current=null;try{let j=new EventSource("/api/telemetry/stream");g.current=j,j.onopen=()=>{w(!0)},j.onmessage=(d)=>{if(!d.data||d.data.trim()==="")return;try{let T=JSON.parse(d.data);if(T.connected){w(!0);return}if(Array.isArray(T)){if(k((J)=>{return[...T,...J].slice(0,MZ)}),_((J)=>{let Q={...J};for(let G of T){let q=Q[G.agent_id];if(!q||new Date(G.timestamp)>new Date(q.timestamp))Q[G.agent_id]={timestamp:G.timestamp,category:G.category,type:G.type}}return Q}),S((J)=>{let Q={...J},G=Date.now()+3000;for(let q of T)Q[q.agent_id]={type:q.type,expiresAt:G};return Q}),T.some((J)=>J.category==="system"&&(J.type==="agent_started"||J.type==="agent_stopped")))c((J)=>J+1);if(T.some((J)=>J.category==="TASK"&&(J.type==="task_created"||J.type==="task_updated"||J.type==="task_deleted")))s((J)=>J+1);if(T.some((J)=>J.level==="error"||J.category==="ERROR"||J.category==="system"&&J.type==="agent_stopped"))f((J)=>J+1)}}catch{}},j.onerror=()=>{if(w(!1),j.close(),g.current=null,K.current)clearTimeout(K.current);K.current=setTimeout(m,2000)}}catch{if(w(!1),K.current)clearTimeout(K.current);K.current=setTimeout(m,2000)}},[]);P.useEffect(()=>{return m(),()=>{if(g.current)g.current.close();if(K.current)clearTimeout(K.current)}},[m]);let I=P.useCallback(()=>{k([])},[]);return yW.jsxDEV(hW.Provider,{value:{connected:R,events:F,lastActivityByAgent:C,activeAgents:A,statusChangeCounter:y,taskChangeCounter:p,notificationCounter:u,clearEvents:I},children:H},void 0,!1,void 0,this)}function zW(){let H=P.useContext(hW);if(!H)throw Error("useTelemetryContext must be used within TelemetryProvider");return H}function BZ(H){let{connected:R,events:w,lastActivityByAgent:F}=zW(),k=P.default.useMemo(()=>{let A=w;if(H?.agent_id)A=A.filter((S)=>S.agent_id===H.agent_id);if(H?.category)A=A.filter((S)=>S.category===H.category);if(H?.limit)A=A.slice(0,H.limit);return A},[w,H?.agent_id,H?.category,H?.limit]),C=H?.agent_id?F[H.agent_id]:void 0,_=P.default.useMemo(()=>{if(!C)return!1;let A=new Date(C.timestamp).getTime();return Date.now()-A<1e4},[C]);return{connected:R,events:k,lastActivity:C,isActive:_}}function GZ(H){let{activeAgents:R}=zW(),w=R[H];return{isActive:!!w,type:w?.type}}function HZ(){let{statusChangeCounter:H}=zW();return H}function YZ(){let{taskChangeCounter:H}=zW();return H}function zZ(){let{notificationCounter:H}=zW();return H}var E=n(UW(),1),sW=n(MW(),1),uW=E.createContext(null);function KW(){let H=E.useContext(uW);if(!H)throw Error("useAuth must be used within an AuthProvider");return H}function QZ({children:H}){let[R,w]=E.useState(null),[F,k]=E.useState(null),[C,_]=E.useState(!0),[A,S]=E.useState(null),[y,c]=E.useState(!1),[p,s]=E.useState(null),u=E.useRef(null),f=E.useRef(!1),g=E.useRef(!1),K=E.useCallback((G)=>{u.current=G,k(G)},[]),m=E.useCallback(async()=>{if(f.current)return!1;f.current=!0;try{let G=await fetch("/api/auth/refresh",{method:"POST",credentials:"include"});if(!G.ok)return!1;let q=await G.json();if(K(q.accessToken),q.user)w(q.user);if(q.onboarding)s(q.onboarding.completed||q.onboarding.has_any_keys);return!!q.user}catch(G){return console.error("Token refresh failed:",G),!1}finally{f.current=!1}},[K]),I=E.useCallback(async()=>{try{let G=u.current,z=await(await fetch("/api/auth/check",{headers:G?{Authorization:`Bearer ${G}`}:{}})).json();if(S(z.hasUsers),c(z.isDev??!1),z.onboarding)s(z.onboarding.completed||z.onboarding.has_any_keys);if(z.authenticated&&z.user)w(z.user);else if(w(null),z.hasUsers){if(!await m())K(null)}}catch(G){console.error("Auth check failed:",G),w(null),K(null)}finally{_(!1)}},[m,K]),j=E.useCallback(async(G,q)=>{try{let z=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:G,password:q})}),h=await z.json();if(!z.ok)return{success:!1,error:h.error||"Login failed"};return K(h.accessToken),w(h.user),S(!0),{success:!0}}catch(z){return console.error("Login failed:",z),{success:!1,error:"Login failed"}}},[K]),d=E.useCallback(async()=>{try{let G=u.current;await fetch("/api/auth/logout",{method:"POST",credentials:"include",headers:G?{Authorization:`Bearer ${G}`}:{}})}catch(G){console.error("Logout failed:",G)}finally{w(null),K(null)}},[K]),T=E.useCallback(async(G,q={})=>{let z=new Headers(q.headers),h=u.current;if(h)z.set("Authorization",`Bearer ${h}`);return fetch(G,{...q,headers:z})},[]),J=E.useCallback(async()=>{return m()},[m]);E.useEffect(()=>{if(g.current)return;g.current=!0,I()},[I]),E.useEffect(()=>{if(!F)return;let G=setInterval(()=>{m()},840000);return()=>clearInterval(G)},[F,m]);let Q={user:R,isAuthenticated:!!R,isLoading:C,hasUsers:A,isDev:y,accessToken:F,onboardingComplete:p,setOnboardingComplete:s,login:j,logout:d,refreshToken:J,checkAuth:I,authFetch:T};return sW.jsxDEV(uW.Provider,{value:Q,children:H},void 0,!1,void 0,this)}function $Z(){let{accessToken:H}=KW();return H?{Authorization:`Bearer ${H}`}:{}}var v=n(UW(),1);var pW=n(MW(),1),dW=v.createContext(null);function UZ(){let H=v.useContext(dW);if(!H)throw Error("useProjects must be used within a ProjectProvider");return H}var EW="apteva_current_project";function OZ({children:H}){let{authFetch:R,isAuthenticated:w,isLoading:F}=KW(),[k,C]=v.useState([]),[_,A]=v.useState(()=>{if(typeof window<"u")return localStorage.getItem(EW);return null}),[S,y]=v.useState(!0),[c,p]=v.useState(null),[s,u]=v.useState(0),[f,g]=v.useState(!1);v.useEffect(()=>{fetch("/api/features").then((Q)=>Q.json()).then((Q)=>{g(Q.projects===!0)}).catch(()=>{g(!1)})},[]);let K=v.useCallback((Q)=>{if(A(Q),typeof window<"u")if(Q===null)localStorage.removeItem(EW);else localStorage.setItem(EW,Q)},[]),m=k.find((Q)=>Q.id===_)||null,I=v.useCallback(async()=>{if(!f){C([]),y(!1);return}if(!w&&!F){C([]),y(!1);return}try{p(null);let Q=await R("/api/projects");if(!Q.ok)throw Error("Failed to fetch projects");let G=await Q.json();if(C(G.projects||[]),u(G.unassignedCount||0),_&&_!=="unassigned"&&!G.projects.find((q)=>q.id===_))K(null)}catch(Q){console.error("Failed to fetch projects:",Q),p("Failed to load projects")}finally{y(!1)}},[R,w,F,_,K,f]),j=v.useCallback(async(Q)=>{try{let G=await R("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)});if(!G.ok){let z=await G.json();throw Error(z.error||"Failed to create project")}let q=await G.json();return await I(),q.project}catch(G){return console.error("Failed to create project:",G),null}},[R,I]),d=v.useCallback(async(Q,G)=>{try{let q=await R(`/api/projects/${Q}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)});if(!q.ok){let h=await q.json();throw Error(h.error||"Failed to update project")}let z=await q.json();return await I(),z.project}catch(q){return console.error("Failed to update project:",q),null}},[R,I]),T=v.useCallback(async(Q)=>{try{let G=await R(`/api/projects/${Q}`,{method:"DELETE"});if(!G.ok){let q=await G.json();throw Error(q.error||"Failed to delete project")}if(_===Q)K(null);return await I(),!0}catch(G){return console.error("Failed to delete project:",G),!1}},[R,_,K,I]);v.useEffect(()=>{if(!F&&f)I()},[F,f,I]);let J={projects:k,currentProjectId:_,currentProject:m,isLoading:S,error:c,unassignedCount:s,projectsEnabled:f,setCurrentProjectId:K,createProject:j,updateProject:d,deleteProject:T,refreshProjects:I};return pW.jsxDEV(dW.Provider,{value:J,children:H},void 0,!1,void 0,this)}export{n as Q,fW as R,DZ as S,UW as T,MW as U,XZ as V,zW as W,BZ as X,GZ as Y,HZ as Z,YZ as _,zZ as $,KW as aa,QZ as ba,$Z as ca,UZ as da,OZ as ea};
19
+
20
+ //# debugId=7C0ACD18FC193FD464756E2164756E21