apteva 0.4.20 → 0.4.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivityPage.cycn14ck.js +3 -0
- package/dist/{ApiDocsPage.kf6bbwkk.js → ApiDocsPage.3q5x9hhg.js} +2 -2
- package/dist/App.0wwyytz2.js +4 -0
- package/dist/{App.c90t3dxg.js → App.2prdcxgq.js} +3 -3
- package/dist/{App.2yy66bnp.js → App.40azyqz6.js} +3 -3
- package/dist/App.6ftxk387.js +4 -0
- package/dist/{App.jfx3der4.js → App.9bzz8dqh.js} +3 -3
- package/dist/App.a7h91mxr.js +4 -0
- package/dist/{App.7v1w3ys9.js → App.e54ynjf2.js} +3 -3
- package/dist/{App.edwahsvz.js → App.fq11mvc7.js} +2 -2
- package/dist/{App.2jmkqm8c.js → App.h6k4j1w9.js} +3 -3
- package/dist/App.jq5tmjws.js +267 -0
- package/dist/{App.q3bpx15d.js → App.k377qek6.js} +2 -2
- package/dist/{App.039re6cf.js → App.r2c5nw36.js} +3 -3
- package/dist/{App.n4jb3c22.js → App.sb2fg71h.js} +3 -3
- package/dist/App.wnap3h7r.js +4 -0
- package/dist/ConnectionsPage.6fyhqfhz.js +3 -0
- package/dist/McpPage.hk2qt1qt.js +3 -0
- package/dist/SettingsPage.gwpx9v7v.js +3 -0
- package/dist/SkillsPage.j5zech2z.js +3 -0
- package/dist/TasksPage.65dcf4vw.js +3 -0
- package/dist/TelemetryPage.07xrbd7k.js +3 -0
- package/dist/TestsPage.q6zfephf.js +3 -0
- package/dist/index.html +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/integrations/agentdojo.ts +1 -1
- package/src/providers.ts +2 -0
- package/src/routes/api/triggers.ts +45 -5
- package/src/web/App.tsx +1 -0
- package/src/web/components/activity/ActivityPage.tsx +347 -212
- package/src/web/components/agents/AgentCard.tsx +32 -3
- package/src/web/components/agents/AgentPanel.tsx +188 -4
- package/src/web/components/connections/IntegrationsTab.tsx +57 -31
- package/src/web/components/connections/TriggersTab.tsx +336 -159
- package/src/web/components/dashboard/Dashboard.tsx +39 -7
- package/src/web/components/layout/Header.tsx +0 -34
- package/src/web/components/layout/Sidebar.tsx +43 -3
- package/src/web/components/tasks/TasksPage.tsx +32 -6
- package/dist/ActivityPage.h769ek3a.js +0 -3
- package/dist/App.3515wsb4.js +0 -4
- package/dist/App.r0a2nmqs.js +0 -267
- package/dist/App.s2yrcz15.js +0 -4
- package/dist/App.s5j82a5j.js +0 -4
- package/dist/App.tg1b94tx.js +0 -4
- package/dist/ConnectionsPage.a67fjgbf.js +0 -3
- package/dist/McpPage.d4p3xvtk.js +0 -3
- package/dist/SettingsPage.46sqpe39.js +0 -3
- package/dist/SkillsPage.j9hkqm99.js +0 -3
- package/dist/TasksPage.6pvkb7s7.js +0 -3
- package/dist/TelemetryPage.5zq9msb5.js +0 -3
- package/dist/TestsPage.24432yqt.js +0 -3
|
@@ -15,6 +15,6 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
|
|
|
15
15
|
<%s {...props} />
|
|
16
16
|
React keys must be passed directly to JSX without using spread:
|
|
17
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
|
|
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 S,fW as T,DZ as U,UW as V,MW as W,XZ as X,zW as Y,BZ as Z,GZ as _,HZ as $,YZ as aa,zZ as ba,KW as ca,QZ as da,$Z as ea,UZ as fa,OZ as ga};
|
|
19
19
|
|
|
20
|
-
//# debugId=
|
|
20
|
+
//# debugId=2A49A0ADC7B429D064756E2164756E21
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{g as
|
|
1
|
+
import{S as i,V as p,W as u}from"./App.k377qek6.js";var n=i(p(),1),e=i(u(),1);function g({value:o,options:c,onChange:d,placeholder:f="Select..."}){let[a,l]=n.useState(!1),s=n.useRef(null),r=c.find((t)=>t.value===o);return n.useEffect(()=>{function t(m){if(s.current&&!s.current.contains(m.target))l(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]),e.jsxDEV("div",{ref:s,className:"relative",children:[e.jsxDEV("button",{type:"button",onClick:()=>l(!a),className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-left flex items-center justify-between focus:outline-none focus:border-[#f97316] text-[#e0e0e0] hover:border-[#333] transition",children:[e.jsxDEV("span",{className:r?"text-[#e0e0e0]":"text-[#666]",children:r?e.jsxDEV(e.Fragment,{children:[r.label,r.recommended&&e.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):f},void 0,!1,void 0,this),e.jsxDEV(v,{isOpen:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&e.jsxDEV("div",{className:"absolute z-50 w-full min-w-max mt-1 bg-[#111] border border-[#222] rounded shadow-lg max-h-60 overflow-y-auto scrollbar-hide",children:c.map((t)=>e.jsxDEV("button",{type:"button",onClick:()=>{d(t.value),l(!1)},className:`w-full px-3 py-2 text-left flex items-center justify-between hover:bg-[#1a1a1a] transition ${t.value===o?"bg-[#1a1a1a] text-[#f97316]":"text-[#e0e0e0]"}`,children:[e.jsxDEV("span",{children:[t.label,t.recommended&&e.jsxDEV("span",{className:"text-[#f97316] text-xs ml-2",children:"(Recommended)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.value===o&&e.jsxDEV("svg",{className:"w-4 h-4 text-[#f97316]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},t.value,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function v({isOpen:o}){return e.jsxDEV("svg",{className:`w-4 h-4 text-[#666] transition-transform ${o?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
+
export{g as R};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=B9FC446FE21094E364756E2164756E21
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
1
|
+
import{O as Oz,P as Wz}from"./App.40azyqz6.js";import{R as j}from"./App.r2c5nw36.js";import{S as n,V as Qz,W as zz,ca as Jz,fa as Kz}from"./App.k377qek6.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
2
|
|
|
3
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
4
|
name: skill-name
|
|
@@ -8,6 +8,6 @@ description: What this skill does...
|
|
|
8
8
|
# Instructions
|
|
9
9
|
|
|
10
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
|
|
11
|
+
export{Rz as L};
|
|
12
12
|
|
|
13
|
-
//# debugId=
|
|
13
|
+
//# debugId=AAB8FFD9C3B0D3B464756E2164756E21
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{k as _0}from"./App.e54ynjf2.js";import{R as x}from"./App.r2c5nw36.js";import{S as O,V as X1,W as n,ca as g,fa as j}from"./App.k377qek6.js";var $0=O(X1(),1);var D=O(X1(),1);var U=O(n(),1);function m0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=D.useState([]),[Q,V]=D.useState([]),[W,T]=D.useState(!0);if(D.useEffect(()=>{(async()=>{T(!0);let y=H&&H!=="unassigned"?`?project_id=${H}`:"";try{let[I,a]=await Promise.all([R(`/api/subscriptions${y}`).catch(()=>null),R("/api/agents").catch(()=>null)]);if(I?.ok){let G=await I.json();F(G.subscriptions||[])}if(a?.ok){let G=await a.json();V(G.agents||[])}}catch(I){console.error("Failed to fetch overview data:",I)}T(!1)})()},[R,H]),W)return U.jsxDEV("div",{className:"text-center py-12 text-[#666]",children:"Loading..."},void 0,!1,void 0,this);let A=J.filter((Y)=>Y.enabled),S=J.filter((Y)=>!Y.enabled),l=new Map(Q.map((Y)=>[Y.id,Y]));return U.jsxDEV("div",{className:"space-y-6",children:[U.jsxDEV("div",{className:"grid grid-cols-3 gap-4",children:[U.jsxDEV(C1,{label:"Active",value:A.length},void 0,!1,void 0,this),U.jsxDEV(C1,{label:"Disabled",value:S.length},void 0,!1,void 0,this),U.jsxDEV(C1,{label:"Total",value:J.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("section",{children:[U.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Subscriptions (",J.length,")"]},void 0,!0,void 0,this),J.length===0?U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No subscriptions yet. Go to the Triggers tab to create one."},void 0,!1,void 0,this):U.jsxDEV("div",{className:"space-y-2",children:J.map((Y)=>{let y=l.get(Y.agent_id);return U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[U.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Y.enabled?"bg-green-400":"bg-[#555]"}`},void 0,!1,void 0,this),U.jsxDEV("div",{className:"flex-1 min-w-0",children:[U.jsxDEV("div",{className:"text-sm font-medium truncate",children:Y.trigger_slug.replace(/_/g," ").replace(/-/g," ")},void 0,!1,void 0,this),U.jsxDEV("div",{className:"text-xs text-[#666]",children:Y.trigger_instance_id?`ID: ${Y.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("div",{className:"text-xs text-[#888] flex-shrink-0",children:[U.jsxDEV("span",{className:"text-[#555]",children:"→"},void 0,!1,void 0,this)," ",U.jsxDEV("span",{className:"text-[#f97316]",children:y?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("span",{className:`text-xs px-2 py-0.5 rounded flex-shrink-0 ${Y.enabled?"bg-green-500/10 text-green-400":"bg-[#1a1a1a] text-[#555]"}`,children:Y.enabled?"active":"disabled"},void 0,!1,void 0,this)]},Y.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function C1({label:R,value:H,valueColor:J}){return U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:[U.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:R},void 0,!1,void 0,this),U.jsxDEV("div",{className:`text-2xl font-bold ${J||"text-[#e0e0e0]"}`,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var $=O(X1(),1);var i=O(n(),1);function I0({message:R="Loading...",fullScreen:H=!1}){let J=i.jsxDEV("div",{className:"flex items-center gap-3 text-[#666]",children:[i.jsxDEV("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[i.jsxDEV("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"},void 0,!1,void 0,this),i.jsxDEV("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.jsxDEV("span",{children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(H)return i.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center",children:J},void 0,!1,void 0,this);return i.jsxDEV("div",{className:"flex items-center justify-center py-20",children:J},void 0,!1,void 0,this)}var m=O(n(),1);function v0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=$.useState([]),[Q,V]=$.useState(""),[W,T]=$.useState([]),[A,S]=$.useState(!0),[l,Y]=$.useState([]),[y,I]=$.useState([]),[a,G]=$.useState(!1),[b,k]=$.useState(""),[o,F1]=$.useState(""),[R0,v1]=$.useState(!1),[B,_1]=$.useState(null),[f1,z0]=$.useState([]),[$1,I1]=$.useState(""),[Y1,R1]=$.useState(!1),[r,n1]=$.useState(""),[Z1,P1]=$.useState({}),[l1,G0]=$.useState(""),[H0,q1]=$.useState(!1),[p,J0]=$.useState([]),[K0,k1]=$.useState(!1),[A1,U0]=$.useState([]),[Q1,X0]=$.useState([]),[s,y1]=$.useState(""),[t,W1]=$.useState(""),[e,h1]=$.useState(""),[i1,T1]=$.useState(!1),[B1,z1]=$.useState({}),[S1,Y0]=$.useState(""),[a1,G1]=$.useState(!1),[M1,p1]=$.useState(""),[u1,H1]=$.useState(!1),[O1,x1]=$.useState(""),[Z0,J1]=$.useState(!1),[c,L1]=$.useState(""),[K1,b1]=$.useState(""),[V1,c1]=$.useState(!1),[h,q0]=$.useState([]),[d1,Z]=$.useState(null),X=H&&H!=="unassigned"?`?project_id=${H}`:"",E1=$.useCallback(async()=>{try{let N=await R(`/api/triggers/providers${X}`);if(N.ok){let _=((await N.json()).providers||[]).filter((f)=>f.connected);if(F(_),_.length>0)V((f)=>{if(!f||!_.find((K)=>K.id===f))return _[0].id;return f})}}catch(N){console.error("Failed to fetch providers:",N)}},[R]),u=$.useCallback(async()=>{S(!0);try{let N=`provider=${Q}`,v=X?"&":"?",_=X?`/api/triggers${X}&${N}`:`/api/triggers?${N}`,f=await R(_);if(f.ok){let K=await f.json();T(K.triggers||[])}}catch(N){console.error("Failed to fetch triggers:",N)}S(!1)},[R,X,Q]),N1=$.useCallback(async()=>{try{let N=await R(`/api/subscriptions${X}`);if(N.ok){let v=await N.json();Y(v.subscriptions||[])}}catch(N){console.error("Failed to fetch subscriptions:",N)}},[R,X]),D1=$.useCallback(async()=>{try{let N=await R(`/api/agents${X}`);if(N.ok){let v=await N.json();q0(v.agents||[])}}catch(N){}},[R,X]);$.useEffect(()=>{E1(),u(),N1(),D1()},[E1,u,N1,D1]);let Q0=async(N)=>{G(!0);try{let v=`/api/triggers/types?provider=${Q}`;if(N)v+=`&toolkit_slugs=${N}`;if(H&&H!=="unassigned")v+=`&project_id=${H}`;let _=await R(v);if(_.ok){let f=await _.json();I(f.types||[])}else{let f=await _.json();Z(f.error||"Failed to fetch trigger types")}}catch(v){Z("Failed to fetch trigger types")}G(!1)},W0=async()=>{try{let N=await R(`/api/integrations/${Q}/connected${X}`);if(N.ok){let v=await N.json();z0((v.accounts||[]).filter((_)=>_.status==="active"))}}catch(N){}},B0=(N)=>{_1(N),I1(""),n1(""),P1({}),G0(""),v1(!0),W0()},C=Q==="agentdojo",M0=async()=>{q1(!0),W1(""),y1(""),h1(""),z1({}),Y0("");let N=async()=>{if(p.length>0)return;k1(!0);try{let f="/api/triggers/types?provider=agentdojo";if(H&&H!=="unassigned")f+=`&project_id=${H}`;let L=await(await R(f)).json();J0(L.types||[])}catch(f){console.error("Failed to load trigger types:",f)}k1(!1)},v=async()=>{try{let f=`/api/integrations/agentdojo/connected${X}`,q=((await(await R(f)).json()).accounts||[]).filter((E)=>E.status==="active");U0(q)}catch(f){console.error("Failed to load connected accounts:",f)}},_=async()=>{if(Q1.length>0)return;try{let f=`/api/integrations/agentdojo/apps${X}`,L=await(await R(f)).json();X0((L.apps||[]).map((q)=>({id:q.id,name:q.name,slug:q.slug,logo:q.logo})))}catch(f){console.error("Failed to load apps:",f)}};await Promise.all([N(),v(),_()])},O0=async()=>{let N=p.find((_)=>_.slug===t),v=U1;if(!N||!e||!v)return;T1(!0),Z(null);try{let _=h.find((F0)=>F0.id===e),f="provider=agentdojo",K=X?`/api/triggers${X}&provider=agentdojo`:"/api/triggers?provider=agentdojo",L={callback_url:`${window.location.origin}/api/webhooks/agentdojo`,title:`${N.name} → ${_?.name||"Agent"}`,server:N.toolkit_slug,agent_id:e,...B1},q=await R(K,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:N.slug,connectedAccountId:v.id,config:L})}),E=await q.json();if(!q.ok)Z(E.error||"Failed to create subscription");else q1(!1),u()}catch(_){Z(_.message||"Failed to create subscription")}T1(!1)},L0=async()=>{if(!B)return;if(C){if(!r||!m1)return;R1(!0),Z(null);try{let N=h.find((q)=>q.id===r),v=window.location.origin,_=`provider=${Q}`,f=X?`/api/triggers${X}&${_}`:`/api/triggers?${_}`,K=await R(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:m1.id,config:{callback_url:`${v}/api/webhooks/agentdojo`,title:`${B.name} → ${N?.name||"Agent"}`,server:B.toolkit_slug,agent_id:r,...Z1}})}),L=await K.json();if(!K.ok)Z(L.error||"Failed to create subscription");else v1(!1),_1(null),u()}catch(N){Z(N.message||"Failed to create subscription")}R1(!1);return}if(!$1)return;R1(!0),Z(null);try{let N=`provider=${Q}`,v=X?`/api/triggers${X}&${N}`:`/api/triggers?${N}`,_=await R(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:$1})}),f=await _.json();if(!_.ok)Z(f.error||"Failed to create trigger");else v1(!1),_1(null),u()}catch(N){Z(N.message||"Failed to create trigger")}R1(!1)},g1=async(N,v)=>{let _=v==="active"?"disable":"enable";try{let f=X?`&provider=${Q}`:`?provider=${Q}`,K=await R(`/api/triggers/${N}/${_}${X}${f}`,{method:"POST"});if(K.ok)u();else{let L=await K.json();Z(L.error||`Failed to ${_} trigger`)}}catch(f){Z(`Failed to ${_} trigger`)}},j1=async(N)=>{try{let v=X?`&provider=${Q}`:`?provider=${Q}`,_=await R(`/api/triggers/${N}${X}${v}`,{method:"DELETE"});if(_.ok)u();else{let f=await _.json();Z(f.error||"Failed to delete trigger")}}catch(v){Z("Failed to delete trigger")}},b0=async()=>{if(!c||!K1)return;let N=W.find((v)=>v.id===c);if(!N)return;c1(!0),Z(null);try{let v=await R("/api/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trigger_slug:N.trigger_slug,trigger_instance_id:N.id,agent_id:K1,provider:Q,project_id:H&&H!=="unassigned"?H:null,public_url:window.location.origin})}),_=await v.json();if(!v.ok)Z(_.error||"Failed to create subscription");else J1(!1),L1(""),b1(""),N1()}catch(v){Z(v.message||"Failed to create subscription")}c1(!1)},w0=async(N)=>{let v=N.enabled?"disable":"enable";try{if((await R(`/api/subscriptions/${N.id}/${v}`,{method:"POST"})).ok)N1()}catch(_){Z(`Failed to ${v} subscription`)}},C0=async(N)=>{try{if((await R(`/api/subscriptions/${N}`,{method:"DELETE"})).ok)N1()}catch(v){Z("Failed to delete subscription")}},w1=y.filter((N)=>{if(!o)return!0;let v=o.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)||N.description.toLowerCase().includes(v)}),o1=(N,v)=>{if(!v||N.length===0)return null;let _=v.toLowerCase().replace(/[-_]/g," "),f=N.find((q)=>q.appId?.toLowerCase()===v.toLowerCase()||q.appName?.toLowerCase()===v.toLowerCase());if(f)return f;let K=N.find((q)=>q.appId?.toLowerCase().includes(_)||q.appName?.toLowerCase().replace(/[-_]/g," ").includes(_)||_.includes(q.appId?.toLowerCase()||"")||_.includes(q.appName?.toLowerCase().replace(/[-_]/g," ")||""));if(K)return K;let L=_.split(/\s+/);return N.find((q)=>{let E=(q.appName||"").toLowerCase().replace(/[-_]/g," ").split(/\s+/);return L[0]&&E[0]&&L[0]===E[0]})||null},M=p.find((N)=>N.slug===t),r1=M?o1(A1,M.toolkit_slug):null,U1=S1?A1.find((N)=>N.id===S1)||r1:r1,s1=B&&C?o1(f1,B.toolkit_slug):null,m1=l1?f1.find((N)=>N.id===l1)||s1:s1,t1=$.default.useMemo(()=>{let N=new Map;for(let _ of Q1)if(_.logo)N.set(_.slug,_.logo);let v=new Map;for(let _ of p){let f=v.get(_.toolkit_slug);if(f)f.count++;else{let K=N.get(_.toolkit_slug)||_.logo||null;v.set(_.toolkit_slug,{slug:_.toolkit_slug,name:_.toolkit_name,logo:K,count:1})}}return Array.from(v.values()).sort((_,f)=>_.name.localeCompare(f.name))},[p,Q1]),e1=s?p.filter((N)=>N.toolkit_slug===s):[],d=t1.find((N)=>N.slug===s),N0=new Map(h.map((N)=>[N.id,N]));if(J.length===0&&!A)return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[m.jsxDEV("p",{className:"text-[#666]",children:"No trigger providers configured."},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-sm text-[#555] mt-1",children:"Add API keys for Composio or AgentDojo in Settings to enable triggers."},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return m.jsxDEV("div",{className:"space-y-6",children:[d1&&m.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg flex items-center justify-between",children:[m.jsxDEV("span",{children:d1},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>Z(null),className:"text-red-400 hover:text-red-300",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.length>1&&m.jsxDEV("div",{className:"flex items-center gap-2",children:[m.jsxDEV("span",{className:"text-xs text-[#666]",children:"Provider:"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex gap-1 bg-[#111] border border-[#1a1a1a] rounded-lg p-0.5",children:J.map((N)=>m.jsxDEV("button",{onClick:()=>{V(N.id),I([]),k(""),F1("")},className:`px-3 py-1 rounded text-xs font-medium transition ${Q===N.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:N.name},N.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&m.jsxDEV("section",{children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Subscriptions (",l.length,")"]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:()=>J1(!0),className:"text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No subscriptions yet. Add one to route trigger events to an agent."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:l.map((N)=>{let v=N0.get(N.agent_id);return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.enabled?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:[N.trigger_slug.replace(/_/g," "),m.jsxDEV("span",{className:"text-[#555] mx-1.5",children:"→"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#f97316]",children:v?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:N.trigger_instance_id?`Instance: ${N.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>w0(N),className:`text-xs px-3 py-1 rounded transition ${N.enabled?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.enabled?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>C0(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&m.jsxDEV("section",{children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Trigger Instances (",W.length,")"]},void 0,!0,void 0,this),A?m.jsxDEV("div",{className:"text-center py-6 text-[#666] text-sm",children:"Loading triggers..."},void 0,!1,void 0,this):W.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No trigger instances. Browse trigger types below to create one."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:W.map((N)=>m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.status==="active"?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:N.trigger_slug.replace(/_/g," ")},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:["ID: ",N.id.slice(0,12),"... | Created: ",new Date(N.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>g1(N.id,N.status),className:`text-xs px-3 py-1 rounded transition ${N.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>j1(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&m.jsxDEV("section",{children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Active Subscriptions (",W.length,")"]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:M0,className:"text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A?m.jsxDEV("div",{className:"text-center py-6 text-[#666] text-sm",children:"Loading subscriptions..."},void 0,!1,void 0,this):W.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No active subscriptions. Browse trigger types below to create one."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:W.map((N)=>{let v=l.find((f)=>f.trigger_instance_id===N.id),_=v?N0.get(v.agent_id):null;return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.status==="active"?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:[N.config?.title||N.trigger_slug.replace(/_/g," "),_&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("span",{className:"text-[#555] mx-1.5",children:"→"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#f97316]",children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:[N.config?.server&&m.jsxDEV("span",{children:[String(N.config.server)," | "]},void 0,!0,void 0,this),"ID: ",String(N.id).slice(0,8)," | Created: ",new Date(N.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>g1(N.id,N.status),className:`text-xs px-3 py-1 rounded transition ${N.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>j1(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("section",{children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:"Browse Trigger Types"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mb-3",children:[m.jsxDEV("input",{type:"text",value:b,onChange:(N)=>k(N.target.value),placeholder:"Toolkit filter (e.g. github, gmail, slack)",className:"flex-1 bg-[#111] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>Q0(b||void 0),disabled:a,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-4 py-2 rounded transition disabled:opacity-50",children:a?"Loading...":"Browse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.length>0&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("input",{type:"text",value:o,onChange:(N)=>F1(N.target.value),placeholder:"Search trigger types...",className:"w-full bg-[#111] border border-[#333] rounded px-3 py-2 text-sm mb-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:w1.slice(0,30).map((N)=>m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] hover:border-[#333] rounded-lg p-3 transition",children:[m.jsxDEV("div",{className:"flex items-start gap-3",children:[N.logo?m.jsxDEV("img",{src:N.logo,alt:N.toolkit_name,className:"w-8 h-8 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-8 h-8 rounded bg-[#1a1a1a] flex items-center justify-center text-xs flex-shrink-0",children:N.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:N.toolkit_name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#555] mt-1 line-clamp-2",children:N.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:()=>B0(N),className:"w-full mt-3 text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:C?"Subscribe":"Create Trigger"},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this),w1.length>30&&m.jsxDEV("p",{className:"text-xs text-[#555] mt-3 text-center",children:["Showing first 30 of ",w1.length," types. Use search to filter."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R0&&B&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:C?"Create Subscription":"Create Trigger"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:[B.name,B.toolkit_name&&m.jsxDEV("span",{className:"text-[#555]",children:[" (",B.toolkit_name,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"space-y-4",children:[!C&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),f1.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No connected accounts available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):m.jsxDEV(x,{value:$1,onChange:I1,placeholder:"Select account...",options:f1.map((N)=>({value:N.id,label:`${N.appName} (${N.id.slice(0,8)}...)`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Route to Agent"},void 0,!1,void 0,this),h.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):m.jsxDEV(x,{value:r,onChange:n1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this),m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),m1?m.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",m1.appName]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",B?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.config_schema&&Object.keys(B.config_schema.properties||{}).length>0&&m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"space-y-2",children:Object.entries(B.config_schema.properties||{}).map(([N,v])=>{let _=(B.config_schema.required||[]).includes(N);return m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-[11px] text-[#888] mb-1",children:[v.title||N,_&&m.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("input",{type:"text",value:Z1[N]||"",onChange:(f)=>P1((K)=>({...K,[N]:f.target.value})),placeholder:v.description||`Enter ${v.title||N}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-4",children:[m.jsxDEV("button",{onClick:()=>{v1(!1),_1(null)},className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:L0,disabled:C?!r||!m1||Y1||B?.config_schema&&(B.config_schema.required||[]).some((N)=>!Z1[N]?.trim()):!$1||Y1,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:Y1?"Creating...":C?"Subscribe":"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Z0&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:"Route Trigger to Agent"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:W.length===0?"No trigger instances yet. Create one first from the Browse section below.":"Select a trigger instance and the agent that should handle its events."},void 0,!1,void 0,this),W.length>0?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"space-y-4",children:[m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Trigger Instance"},void 0,!1,void 0,this),m.jsxDEV(x,{value:c,onChange:L1,placeholder:"Select trigger...",options:W.map((N)=>({value:N.id,label:`${N.trigger_slug.replace(/_/g," ")}`}))},void 0,!1,void 0,this),c&&m.jsxDEV("div",{className:"text-xs text-[#555] mt-1 font-mono",children:["ID: ",c.slice(0,16),"..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),m.jsxDEV(x,{value:K1,onChange:b1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-5",children:[m.jsxDEV("button",{onClick:()=>{J1(!1),L1(""),b1("")},className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:b0,disabled:!c||!K1||V1,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:V1?"Adding...":"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"flex gap-2 mt-4",children:m.jsxDEV("button",{onClick:()=>J1(!1),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H0&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-lg mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:"Add Subscription"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:"Select an app and trigger, then route it to an agent."},void 0,!1,void 0,this),K0?m.jsxDEV("div",{className:"text-center py-8 text-[#666] text-sm",children:"Loading..."},void 0,!1,void 0,this):p.length===0?m.jsxDEV("div",{className:"text-center py-8 text-[#666] text-sm",children:"No triggers available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-4",children:[m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"App"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("button",{onClick:()=>{G1(!a1),H1(!1),p1("")},className:"w-full flex items-center gap-2 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm text-left hover:border-[#555] transition",children:[d?m.jsxDEV(m.Fragment,{children:[d.logo?m.jsxDEV("img",{src:d.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-5 h-5 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0",children:d.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"flex-1 truncate",children:d.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[10px] text-[#666]",children:[d.count," triggers"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("span",{className:"text-[#666] flex-1",children:"Select app..."},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#666] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a1&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>G1(!1)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#0a0a0a] border border-[#333] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[m.jsxDEV("div",{className:"p-2 border-b border-[#1a1a1a] flex-shrink-0",children:m.jsxDEV("input",{type:"text",value:M1,onChange:(N)=>p1(N.target.value),placeholder:"Search apps...",className:"w-full bg-[#111] border border-[#333] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"overflow-y-auto flex-1",children:t1.filter((N)=>{if(!M1)return!0;let v=M1.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)}).map((N)=>m.jsxDEV("button",{onClick:()=>{y1(N.slug),W1(""),z1({}),G1(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[#1a1a1a] ${s===N.slug?"bg-[#1a1a1a] text-[#f97316]":""}`,children:[N.logo?m.jsxDEV("img",{src:N.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-5 h-5 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0",children:N.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"flex-1 truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[10px] text-[#666]",children:N.count},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Trigger"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("button",{onClick:()=>{H1(!u1),G1(!1),x1("")},className:"w-full flex items-center gap-2 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm text-left hover:border-[#555] transition",children:[M?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("span",{className:"flex-1 truncate",children:M.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${M.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:M.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("span",{className:"text-[#666] flex-1",children:"Select trigger..."},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#666] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u1&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>H1(!1)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#0a0a0a] border border-[#333] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[e1.length>3&&m.jsxDEV("div",{className:"p-2 border-b border-[#1a1a1a] flex-shrink-0",children:m.jsxDEV("input",{type:"text",value:O1,onChange:(N)=>x1(N.target.value),placeholder:"Search triggers...",className:"w-full bg-[#111] border border-[#333] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"overflow-y-auto flex-1",children:e1.filter((N)=>{if(!O1)return!0;let v=O1.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)||N.description.toLowerCase().includes(v)}).map((N)=>m.jsxDEV("button",{onClick:()=>{W1(N.slug),z1({}),H1(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[#1a1a1a] ${t===N.slug?"bg-[#1a1a1a] text-[#f97316]":""}`,children:[m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-[10px] text-[#666] truncate",children:N.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${N.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:N.type},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),U1?m.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",U1.appName]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",M?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M&&M.config_schema&&Object.keys(M.config_schema.properties||{}).length>0&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"space-y-2",children:Object.entries(M.config_schema.properties||{}).map(([N,v])=>{let _=(M.config_schema.required||[]).includes(N);return m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-[11px] text-[#888] mb-1",children:[v.title||N,_&&m.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("input",{type:"text",value:B1[N]||"",onChange:(f)=>z1((K)=>({...K,[N]:f.target.value})),placeholder:v.description||`Enter ${v.title||N}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),h.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):m.jsxDEV(x,{value:e,onChange:h1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-5",children:[m.jsxDEV("button",{onClick:()=>q1(!1),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:O0,disabled:!t||!e||!U1||i1||M?.config_schema&&(M.config_schema.required||[]).some((N)=>!B1[N]?.trim()),className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:i1?"Creating...":"Subscribe"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var P=O(X1(),1);var z=O(n(),1);function f0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),J=H&&H!=="unassigned"?H:null,F=J?`?project_id=${J}`:"",[Q,V]=P.useState([]),[W,T]=P.useState("");P.useEffect(()=>{R(`/api/triggers/providers${F}`).then((G)=>G.json()).then((G)=>{let b=(G.providers||[]).filter((k)=>k.connected);if(V(b),b.length>0&&!b.find((k)=>k.id===W))T(b[0].id)}).catch(()=>{})},[R]);let[A,S]=P.useState(null),[l,Y]=P.useState([]),[y,I]=P.useState(!1),a=P.useCallback(async(G)=>{S(G),I(!0);try{let b=`/api/triggers/types?provider=${W}&toolkit_slugs=${G}`;if(J)b+=`&project_id=${J}`;let k=await R(b);if(k.ok){let o=await k.json();Y(o.types||[])}}catch(b){console.error("Failed to fetch trigger types:",b)}I(!1)},[R,J,W]);return z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Connect external apps via OAuth or API Key. Connected apps can be used for triggers and MCP integrations."},void 0,!1,void 0,this),Q.length>1&&z.jsxDEV("div",{className:"flex items-center gap-2 mb-4",children:[z.jsxDEV("span",{className:"text-xs text-[#666]",children:"Provider:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-1 bg-[#111] border border-[#1a1a1a] rounded-lg p-0.5",children:Q.map((G)=>z.jsxDEV("button",{onClick:()=>T(G.id),className:`px-3 py-1 rounded text-xs font-medium transition ${W===G.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:G.name},G.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV("p",{className:"text-[#666]",children:"No integration providers configured."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#555] mt-1",children:"Add API keys for Composio or AgentDojo in Settings."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV(_0,{providerId:W,projectId:J,hideMcpConfig:!0,onBrowseTriggers:a},void 0,!1,void 0,this),A&&z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:z.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h3",{className:"font-medium",children:"Trigger Types"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#666]",children:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>{S(null),Y([])},className:"text-[#666] hover:text-white transition text-lg px-2",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:y?z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading trigger types..."},void 0,!1,void 0,this):l.length===0?z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"No trigger types available for this app."},void 0,!1,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:l.map((G)=>z.jsxDEV("div",{className:"bg-[#0a0a0a] border border-[#1a1a1a] rounded-lg p-3",children:z.jsxDEV("div",{className:"flex items-start gap-3",children:[G.logo?z.jsxDEV("img",{src:G.logo,alt:G.toolkit_name,className:"w-6 h-6 rounded object-contain flex-shrink-0 mt-0.5"},void 0,!1,void 0,this):z.jsxDEV("div",{className:"w-6 h-6 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0 mt-0.5",children:G.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"text-sm font-medium",children:G.name},void 0,!1,void 0,this),z.jsxDEV("div",{className:"text-xs text-[#666] mt-0.5",children:G.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-1.5",children:[z.jsxDEV("span",{className:"text-[10px] bg-[#1a1a1a] text-[#555] px-1.5 py-0.5 rounded font-mono",children:G.slug},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${G.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:G.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},G.slug,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var w=O(n(),1);function JN(){let[R,H]=$0.useState("overview");return w.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:w.jsxDEV("div",{className:"max-w-6xl",children:[w.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:w.jsxDEV("div",{children:[w.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Connections"},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-[#666]",children:"Manage external app connections, triggers, and webhooks."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-1 w-fit",children:[{id:"overview",label:"Overview"},{id:"triggers",label:"Triggers"},{id:"integrations",label:"Integrations"}].map((F)=>w.jsxDEV("button",{onClick:()=>H(F.id),className:`px-4 py-2 rounded text-sm font-medium transition ${R===F.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:F.label},F.id,!1,void 0,this))},void 0,!1,void 0,this),R==="overview"&&w.jsxDEV(m0,{},void 0,!1,void 0,this),R==="triggers"&&w.jsxDEV(v0,{},void 0,!1,void 0,this),R==="integrations"&&w.jsxDEV(f0,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
+
export{I0 as a,JN as b};
|
|
3
|
+
|
|
4
|
+
//# debugId=59BAB8E2425680DC64756E2164756E21
|