hackagent-webui 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. hackagent_webui/__init__.py +55 -0
  2. hackagent_webui/static/404.html +1 -0
  3. hackagent_webui/static/VERSION +1 -0
  4. hackagent_webui/static/_next/static/chunks/144-7c65ac1a3b9b2a8a.js +1 -0
  5. hackagent_webui/static/_next/static/chunks/151-6f51e268c96b3129.js +1 -0
  6. hackagent_webui/static/_next/static/chunks/187-849543277a4f9394.js +1 -0
  7. hackagent_webui/static/_next/static/chunks/1a258343-3a341c585963097c.js +1 -0
  8. hackagent_webui/static/_next/static/chunks/200-82851f7d6d761059.js +1 -0
  9. hackagent_webui/static/_next/static/chunks/292-fca7393c81ef214a.js +1 -0
  10. hackagent_webui/static/_next/static/chunks/326-a9081b3f86c9dd18.js +1 -0
  11. hackagent_webui/static/_next/static/chunks/377-e53ad1c182dbc31b.js +1 -0
  12. hackagent_webui/static/_next/static/chunks/391-c0e09f348021cffc.js +1 -0
  13. hackagent_webui/static/_next/static/chunks/411-da316013bbf4d70a.js +1 -0
  14. hackagent_webui/static/_next/static/chunks/493-bafbeb5ae66518b5.js +1 -0
  15. hackagent_webui/static/_next/static/chunks/4bd1b696-409494caf8c83275.js +1 -0
  16. hackagent_webui/static/_next/static/chunks/511-dd81e821519476da.js +1 -0
  17. hackagent_webui/static/_next/static/chunks/532-11a48022caced11c.js +1 -0
  18. hackagent_webui/static/_next/static/chunks/539-4b1c7db488293715.js +1 -0
  19. hackagent_webui/static/_next/static/chunks/594-97628408277cbac5.js +1 -0
  20. hackagent_webui/static/_next/static/chunks/619-7c7bed420eb7c654.js +1 -0
  21. hackagent_webui/static/_next/static/chunks/641-043f989d6143544b.js +1 -0
  22. hackagent_webui/static/_next/static/chunks/680-25d8e1ea98a28dad.js +1 -0
  23. hackagent_webui/static/_next/static/chunks/772-39e3838894a53779.js +1 -0
  24. hackagent_webui/static/_next/static/chunks/8-42d532ba984375d8.js +1 -0
  25. hackagent_webui/static/_next/static/chunks/816-19f20afc3075826e.js +1 -0
  26. hackagent_webui/static/_next/static/chunks/855-a78b13b4bd1c76cb.js +1 -0
  27. hackagent_webui/static/_next/static/chunks/9-22df388e4049bb14.js +1 -0
  28. hackagent_webui/static/_next/static/chunks/905-ff5fbcc54083c7ee.js +1 -0
  29. hackagent_webui/static/_next/static/chunks/921-18103c2d5cd6c671.js +1 -0
  30. hackagent_webui/static/_next/static/chunks/924-bbaf675cfa822d94.js +1 -0
  31. hackagent_webui/static/_next/static/chunks/959-f7b708ac280ce10a.js +1 -0
  32. hackagent_webui/static/_next/static/chunks/abf9ae41-a2ad9357d01c2a31.js +1 -0
  33. hackagent_webui/static/_next/static/chunks/app/_not-found/page-72f9264520fc0b6a.js +1 -0
  34. hackagent_webui/static/_next/static/chunks/app/agents/page-63d562af288bd470.js +1 -0
  35. hackagent_webui/static/_next/static/chunks/app/api-keys/page-efb5b8e15af445f7.js +1 -0
  36. hackagent_webui/static/_next/static/chunks/app/attacks/builder/page-4401ce40343e7239.js +1 -0
  37. hackagent_webui/static/_next/static/chunks/app/attacks/page-e34de8a5ee4cf257.js +1 -0
  38. hackagent_webui/static/_next/static/chunks/app/layout-4f66546247356e83.js +1 -0
  39. hackagent_webui/static/_next/static/chunks/app/not-found-60bbe1f5c6cf66f2.js +1 -0
  40. hackagent_webui/static/_next/static/chunks/app/page-65cb30228b8a1502.js +1 -0
  41. hackagent_webui/static/_next/static/chunks/app/profile/page-002f78d4c4a0a548.js +1 -0
  42. hackagent_webui/static/_next/static/chunks/app/reports/page-1507b6373935769e.js +1 -0
  43. hackagent_webui/static/_next/static/chunks/app/stats/page-3d8df1bcc06245db.js +1 -0
  44. hackagent_webui/static/_next/static/chunks/framework-e2c84bf8dbc6c531.js +1 -0
  45. hackagent_webui/static/_next/static/chunks/main-app-641b4390ed531d52.js +1 -0
  46. hackagent_webui/static/_next/static/chunks/main-c0161e7c327c4241.js +1 -0
  47. hackagent_webui/static/_next/static/chunks/pages/_app-fcbe3e68b26044e2.js +1 -0
  48. hackagent_webui/static/_next/static/chunks/pages/_error-394ce64747f32b60.js +1 -0
  49. hackagent_webui/static/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  50. hackagent_webui/static/_next/static/chunks/webpack-a101479ef1443c74.js +1 -0
  51. hackagent_webui/static/_next/static/css/008a05b0ad6b854a.css +31 -0
  52. hackagent_webui/static/_next/static/css/c66d365ae0bced97.css +1 -0
  53. hackagent_webui/static/_next/static/esjZ6Ucner1eQeNRDDLzS/_buildManifest.js +1 -0
  54. hackagent_webui/static/_next/static/esjZ6Ucner1eQeNRDDLzS/_ssgManifest.js +1 -0
  55. hackagent_webui/static/agents.html +1 -0
  56. hackagent_webui/static/agents.txt +23 -0
  57. hackagent_webui/static/android-chrome-192x192.png +0 -0
  58. hackagent_webui/static/android-chrome-512x512.png +0 -0
  59. hackagent_webui/static/api-keys.html +1 -0
  60. hackagent_webui/static/api-keys.txt +23 -0
  61. hackagent_webui/static/apple-touch-icon.png +0 -0
  62. hackagent_webui/static/attacks/builder.html +1 -0
  63. hackagent_webui/static/attacks/builder.txt +24 -0
  64. hackagent_webui/static/attacks.html +1 -0
  65. hackagent_webui/static/attacks.txt +23 -0
  66. hackagent_webui/static/favicon-16x16.png +0 -0
  67. hackagent_webui/static/favicon-32x32.png +0 -0
  68. hackagent_webui/static/favicon.ico +0 -0
  69. hackagent_webui/static/index.html +1 -0
  70. hackagent_webui/static/index.txt +23 -0
  71. hackagent_webui/static/profile.html +1 -0
  72. hackagent_webui/static/profile.txt +23 -0
  73. hackagent_webui/static/raccoon.png +0 -0
  74. hackagent_webui/static/reports.html +1 -0
  75. hackagent_webui/static/reports.txt +23 -0
  76. hackagent_webui/static/silent-check-sso.html +11 -0
  77. hackagent_webui/static/stats.html +1 -0
  78. hackagent_webui/static/stats.txt +23 -0
  79. hackagent_webui-0.2.0.dist-info/METADATA +59 -0
  80. hackagent_webui-0.2.0.dist-info/RECORD +81 -0
  81. hackagent_webui-0.2.0.dist-info/WHEEL +4 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[492],{84441:()=>{}},_=>{_.O(0,[441,493,358],()=>_(_.s=84441)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[165],{11186:(e,t,n)=>{"use strict";n.d(t,{bq:()=>p,eb:()=>g,gC:()=>u,l6:()=>d,yv:()=>c});var a=n(95155);n(12115);var s=n(59929),i=n(24033),r=n(5917),l=n(12108),o=n(64269);function d(e){let{...t}=e;return(0,a.jsx)(s.bL,{"data-slot":"select",...t})}function c(e){let{...t}=e;return(0,a.jsx)(s.WT,{"data-slot":"select-value",...t})}function p(e){let{className:t,size:n="default",children:r,...l}=e;return(0,a.jsxs)(s.l9,{"data-slot":"select-trigger","data-size":n,className:(0,o.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...l,children:[r,(0,a.jsx)(s.In,{asChild:!0,children:(0,a.jsx)(i.A,{className:"size-4 opacity-50"})})]})}function u(e){let{className:t,children:n,position:i="popper",...r}=e;return(0,a.jsx)(s.ZL,{children:(0,a.jsxs)(s.UC,{"data-slot":"select-content",className:(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:i,...r,children:[(0,a.jsx)(x,{}),(0,a.jsx)(s.LM,{className:(0,o.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),(0,a.jsx)(h,{})]})})}function g(e){let{className:t,children:n,...i}=e;return(0,a.jsxs)(s.q7,{"data-slot":"select-item",className:(0,o.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...i,children:[(0,a.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,a.jsx)(s.VF,{children:(0,a.jsx)(r.A,{className:"size-4"})})}),(0,a.jsx)(s.p4,{children:n})]})}function x(e){let{className:t,...n}=e;return(0,a.jsx)(s.PP,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(l.A,{className:"size-4"})})}function h(e){let{className:t,...n}=e;return(0,a.jsx)(s.wn,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(i.A,{className:"size-4"})})}},17254:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>P});var a=n(95155),s=n(12115),i=n(80230),r=n(7831),l=n(41444),o=n(22470),d=n(56419),c=n(35835),p=n(87270),u=n(20243),g=n(18332),x=n(98053),h=n(50803),m=n(78192),f=n(35299),j=n(3998),v=n(46826),y=n(18514),b=n(71360),N=n(51834),w=n(11186),A=n(46767),C=n(65142),E=n(76444);let k=[{value:"LITELLM",label:"LiteLLM"},{value:"OPENAI_SDK",label:"OpenAI SDK/API"},{value:"GOOGLE_ADK",label:"Google ADK"},{value:"OTHER",label:"Other / Proprietary"},{value:"UNKNOWN",label:"Unknown"}],I={LITELLM:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",OPENAI_SDK:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",GOOGLE_ADK:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",OTHER:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",UNKNOWN:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400"},z=(0,l.h)("AgentsPage");function P(){var e;let{isAuthenticated:t,isLoading:n}=(0,i.h)(),[l,P]=(0,s.useState)([]),[T,D]=(0,s.useState)(!0),[_,L]=(0,s.useState)(null),[O,F]=(0,s.useState)(null),[S,K]=(0,s.useState)(!1),[U,M]=(0,s.useState)({open:!1,title:"",description:""}),[$,q]=(0,s.useState)({open:!1,agent:null}),[G,J]=(0,s.useState)(null),[R,H]=(0,s.useState)(!0),[Z,V]=(0,s.useState)(null),[W,X]=(0,s.useState)(!1),[B,Q]=(0,s.useState)(!1),[Y,ee]=(0,s.useState)(null),[et,en]=(0,s.useState)({name:"",endpoint:"",agentType:"",description:""}),ea=(0,s.useCallback)(async()=>{D(!0),L(null),z.debug("Fetching agents...");try{var e;let t=await r.in.agentList();z.info({count:null==(e=t.results)?void 0:e.length},"Agents fetched successfully"),P(t.results||[])}catch(t){z.error({err:t},"Error fetching agents");let e=t.message||"Failed to load agents. Please try again later.";if(t.response){let n=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}z.error({status:n,responseBody:a},"API Error"),e=403===n?"Forbidden: Check your permissions.":401===n?"Unauthorized: Please log in again.":"API Error (".concat(n,"): ").concat(a||e)}L(e),P([])}finally{D(!1)}},[]);(0,s.useEffect)(()=>{(async()=>{if(!n&&t){H(!0),V(null);try{z.debug("Fetching user profile via /user/me...");let e=await r.userApi.userMeRetrieve();J(e),z.debug({org:e.organization},"User profile fetched")}catch(t){z.error({err:t},"Error fetching user profile");let e=t.message||"Failed to load user profile.";if(t.response){let n=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}e="Profile API Error (".concat(n,"): ").concat(a||e)}V(e)}finally{H(!1)}}})()},[n,t]);let es=()=>{en({name:"",endpoint:"",agentType:"",description:""}),X(!0)},ei=async()=>{if(!et.name||!et.endpoint)return void M({open:!0,title:"Validation Error",description:"Name and API Endpoint are required."});if(R)return void M({open:!0,title:"Please Wait",description:"User profile is still loading. Please wait a moment."});if(Z||!(null==G?void 0:G.organization))return void M({open:!0,title:"Organization Error",description:"Cannot create agent: Organization ID not found. ".concat(Z||"Organization ID missing from profile.")});K(!0);let e={name:et.name,endpoint:et.endpoint,...et.agentType&&{agentType:et.agentType},...et.description&&{description:et.description}};try{await r.in.agentCreate({agentRequest:e}),z.info({name:e.name},"Agent created successfully"),await ea(),X(!1)}catch(t){z.error({err:t},"Error creating agent");let e=t.message||"Failed to create agent. Please try again.";if(t.response){let n=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}z.error({status:n,responseBody:a},"Create API Error"),e="Create API Error (".concat(n,"): ").concat(a||e)}M({open:!0,title:"Error Creating Agent",description:e})}finally{K(!1)}},er=async()=>{if(!(null==Y?void 0:Y.id))return void M({open:!0,title:"Invalid Agent",description:"No agent selected for editing or ID is missing."});if(!et.name||!et.endpoint)return void M({open:!0,title:"Validation Error",description:"Name and API Endpoint are required."});K(!0);let e={name:et.name,endpoint:et.endpoint,...et.agentType&&{agentType:et.agentType},...void 0!==et.description&&{description:et.description}};try{await r.in.agentUpdate({id:Y.id,agentRequest:e}),z.info({agentId:Y.id},"Agent updated successfully"),await ea(),Q(!1),ee(null)}catch(t){z.error({err:t},"Error updating agent");let e=t.message||"Failed to update agent. Please try again.";if(t.response){let n=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}z.error({status:n,responseBody:a},"Update API Error"),e="Update API Error (".concat(n,"): ").concat(a||e)}M({open:!0,title:"Error Updating Agent",description:e})}finally{K(!1)}},el=async()=>{let e=$.agent;if(!(null==e?void 0:e.id))return;let t=e.id;q({open:!1,agent:null}),F(t);try{await r.in.agentDestroy({id:t}),z.info({agentId:t},"Agent deleted successfully"),P(e=>e.filter(e=>e.id!==t))}catch(n){z.error({err:n},"Error deleting agent");let t=n.message||'Failed to delete agent "'.concat(e.name,'". Please try again.');if(n.response){let e=n.response.status,a="Could not read error body";try{a=await n.response.text()}catch(e){}z.error({status:e,responseBody:a},"Delete API Error"),t="Delete API Error (".concat(e,"): ").concat(a||t)}M({open:!0,title:"Error Deleting Agent",description:t})}finally{F(null)}};return((0,s.useEffect)(()=>{!n&&t?ea():n||t||(D(!1),P([]),L(null),F(null))},[n,t,ea]),n||T&&0===l.length&&!_||R)?(0,a.jsx)(o.M,{title:"Agents",description:"Configure and monitor your AI agents for security testing.",children:(0,a.jsx)("div",{className:"px-6 space-y-3",children:[void 0,void 0,void 0].map((e,t)=>(0,a.jsxs)("div",{className:"border rounded-lg p-4 flex items-start gap-4",children:[(0,a.jsx)(u.E,{className:"h-10 w-10 rounded-md flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.jsx)(u.E,{className:"h-4 w-1/4"}),(0,a.jsx)(u.E,{className:"h-3 w-1/2"})]}),(0,a.jsx)(u.E,{className:"h-6 w-20 rounded-full"}),(0,a.jsx)(u.E,{className:"h-8 w-8 rounded"}),(0,a.jsx)(u.E,{className:"h-8 w-8 rounded"})]},"skeleton-".concat(t)))})}):(0,a.jsxs)(o.M,{title:"Agents",description:"Configure and monitor your AI agents for security testing.",action:t&&(0,a.jsxs)(j.$,{onClick:es,children:[(0,a.jsx)(v.A,{className:"mr-2 h-4 w-4"})," Create Agent"]}),children:[(0,a.jsxs)("div",{className:"px-6 space-y-4",children:[!t&&!n&&(0,a.jsxs)(g.Fc,{children:[(0,a.jsx)(h.A,{className:"h-4 w-4"}),(0,a.jsx)(g.XL,{children:"Authentication Required"}),(0,a.jsx)(g.TN,{children:"Please log in to manage agents."})]}),t&&_&&(0,a.jsxs)(g.Fc,{variant:"destructive",children:[(0,a.jsx)(h.A,{className:"h-4 w-4"}),(0,a.jsx)(g.XL,{children:"Error Loading Agents"}),(0,a.jsx)(g.TN,{children:_})]}),t&&Z&&(0,a.jsxs)(g.Fc,{variant:"destructive",children:[(0,a.jsx)(h.A,{className:"h-4 w-4"}),(0,a.jsx)(g.XL,{children:"Profile Error"}),(0,a.jsxs)(g.TN,{children:[Z," — Agent creation may not be available."]})]}),t&&!T&&0===l.length&&!_&&(0,a.jsx)(d.p,{icon:m.A,title:"No agents configured",description:"Get started by creating your first AI agent for security testing.",action:(0,a.jsxs)(j.$,{onClick:es,children:[(0,a.jsx)(v.A,{className:"mr-2 h-4 w-4"})," Create Agent"]})}),t&&l.length>0&&(0,a.jsx)(A.Bc,{children:(0,a.jsx)("div",{className:"rounded-lg border overflow-hidden",children:(0,a.jsxs)(p.XI,{children:[(0,a.jsx)(p.A0,{children:(0,a.jsxs)(p.Hj,{className:"bg-muted/50 hover:bg-muted/50",children:[(0,a.jsx)(p.nd,{className:"w-[30%] pl-4",children:"Agent"}),(0,a.jsx)(p.nd,{className:"w-[30%]",children:"Endpoint"}),(0,a.jsx)(p.nd,{className:"w-[15%]",children:"Type"}),(0,a.jsx)(p.nd,{className:"w-[12%]",children:"Created"}),(0,a.jsx)(p.nd,{className:"w-[13%] text-right pr-4",children:"Actions"})]})}),(0,a.jsx)(p.BF,{children:l.map(e=>{var t,n,s,i;return(0,a.jsxs)(p.Hj,{className:"group",children:[(0,a.jsx)(p.nA,{className:"pl-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"mt-0.5 h-8 w-8 rounded-md bg-muted flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(m.A,{className:"h-4 w-4 text-muted-foreground"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm leading-tight",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e.description}),(null==(t=e.organizationDetail)?void 0:t.name)&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-0.5",children:e.organizationDetail.name})]})]})}),(0,a.jsx)(p.nA,{children:(0,a.jsxs)(A.m_,{children:[(0,a.jsx)(A.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate block max-w-[260px] cursor-default",children:e.endpoint})}),(0,a.jsx)(A.ZI,{side:"bottom",className:"max-w-sm break-all",children:e.endpoint})]})}),(0,a.jsx)(p.nA,{children:e.agentType?(0,a.jsx)("span",{className:"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ".concat(null!=(s=I[e.agentType])?s:I.UNKNOWN),children:null!=(i=null==(n=k.find(t=>t.value===e.agentType))?void 0:n.label)?i:e.agentType}):(0,a.jsx)("span",{className:"text-xs text-muted-foreground/50",children:"—"})}),(0,a.jsx)(p.nA,{children:(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:e.createdAt?new Date(e.createdAt).toLocaleDateString():"—"})}),(0,a.jsx)(p.nA,{className:"text-right pr-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,a.jsxs)(A.m_,{children:[(0,a.jsx)(A.k$,{asChild:!0,children:(0,a.jsx)(j.$,{variant:"ghost",size:"icon",onClick:()=>(e=>{if(!e.id)return void M({open:!0,title:"Invalid Agent",description:"Cannot edit agent: ID is missing."});ee(e),en({name:e.name||"",endpoint:e.endpoint||"",agentType:e.agentType||"",description:e.description||""}),Q(!0)})(e),disabled:!!O,className:"h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(A.ZI,{children:"Edit agent"})]}),(0,a.jsxs)(A.m_,{children:[(0,a.jsx)(A.k$,{asChild:!0,children:(0,a.jsx)(j.$,{variant:"ghost",size:"icon",onClick:()=>(e=>{if(!e.id)return void M({open:!0,title:"Invalid Agent",description:"Cannot delete agent: ID missing or invalid."});q({open:!0,agent:e})})(e),disabled:!!O,className:"h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity ".concat(O===e.id?"text-destructive opacity-100":"hover:text-destructive"),children:O===e.id?(0,a.jsx)(f.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(b.A,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(A.ZI,{children:"Delete agent"})]})]})})]},e.id)})})]})})})]}),(0,a.jsx)(N.lG,{open:W,onOpenChange:X,children:(0,a.jsxs)(N.Cf,{className:"sm:max-w-[480px]",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsx)(N.L3,{children:"Create New Agent"}),(0,a.jsx)(N.rr,{children:"Configure a new AI agent for security testing. Provide the endpoint and details below."})]}),(0,a.jsxs)("div",{className:"grid gap-4 py-2",children:[(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsxs)(E.J,{htmlFor:"create-name",children:["Name ",(0,a.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,a.jsx)(C.p,{id:"create-name",value:et.name,onChange:e=>en(t=>({...t,name:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&ei()},placeholder:"My Awesome Agent"})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsxs)(E.J,{htmlFor:"create-endpoint",children:["API Endpoint ",(0,a.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,a.jsx)(C.p,{id:"create-endpoint",value:et.endpoint,onChange:e=>en(t=>({...t,endpoint:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&ei()},placeholder:"https://your-agent-api.com/invoke",className:"font-mono text-sm"})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(E.J,{htmlFor:"create-type",children:"Agent Type"}),(0,a.jsxs)(w.l6,{value:et.agentType,onValueChange:e=>en(t=>({...t,agentType:e})),children:[(0,a.jsx)(w.bq,{id:"create-type",children:(0,a.jsx)(w.yv,{placeholder:"Select agent type..."})}),(0,a.jsx)(w.gC,{children:k.map(e=>(0,a.jsx)(w.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(E.J,{htmlFor:"create-description",children:"Description"}),(0,a.jsx)("textarea",{id:"create-description",value:et.description,onChange:e=>en(t=>({...t,description:e.target.value})),placeholder:"A brief description of what this agent does...",rows:3,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-none"})]})]}),(0,a.jsxs)(N.Es,{children:[(0,a.jsx)(N.HM,{asChild:!0,children:(0,a.jsx)(j.$,{variant:"outline",disabled:S,children:"Cancel"})}),(0,a.jsxs)(j.$,{onClick:ei,disabled:S,children:[S&&(0,a.jsx)(f.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Agent"]})]})]})}),(0,a.jsx)(N.lG,{open:B,onOpenChange:e=>{Q(e),e||ee(null)},children:(0,a.jsxs)(N.Cf,{className:"sm:max-w-[480px]",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsx)(N.L3,{children:"Edit Agent"}),(0,a.jsxs)(N.rr,{children:["Update the details for ",(0,a.jsx)("strong",{children:null==Y?void 0:Y.name}),"."]})]}),(0,a.jsxs)("div",{className:"grid gap-4 py-2",children:[(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsxs)(E.J,{htmlFor:"edit-name",children:["Name ",(0,a.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,a.jsx)(C.p,{id:"edit-name",value:et.name,onChange:e=>en(t=>({...t,name:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&er()},placeholder:"My Awesome Agent"})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsxs)(E.J,{htmlFor:"edit-endpoint",children:["API Endpoint ",(0,a.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,a.jsx)(C.p,{id:"edit-endpoint",value:et.endpoint,onChange:e=>en(t=>({...t,endpoint:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&er()},placeholder:"https://your-agent-api.com/invoke",className:"font-mono text-sm"})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(E.J,{htmlFor:"edit-type",children:"Agent Type"}),(0,a.jsxs)(w.l6,{value:et.agentType,onValueChange:e=>en(t=>({...t,agentType:e})),children:[(0,a.jsx)(w.bq,{id:"edit-type",children:(0,a.jsx)(w.yv,{placeholder:"Select agent type..."})}),(0,a.jsx)(w.gC,{children:k.map(e=>(0,a.jsx)(w.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(E.J,{htmlFor:"edit-description",children:"Description"}),(0,a.jsx)("textarea",{id:"edit-description",value:et.description,onChange:e=>en(t=>({...t,description:e.target.value})),placeholder:"A brief description of what this agent does...",rows:3,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 resize-none"})]})]}),(0,a.jsxs)(N.Es,{children:[(0,a.jsx)(N.HM,{asChild:!0,children:(0,a.jsx)(j.$,{variant:"outline",disabled:S,onClick:()=>ee(null),children:"Cancel"})}),(0,a.jsxs)(j.$,{onClick:er,disabled:S,children:[S&&(0,a.jsx)(f.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Changes"]})]})]})}),(0,a.jsx)(x.Lt,{open:U.open,onOpenChange:e=>M(t=>({...t,open:e})),children:(0,a.jsxs)(x.EO,{children:[(0,a.jsxs)(x.wd,{children:[(0,a.jsx)(x.r7,{children:U.title}),(0,a.jsx)(x.$v,{children:U.description})]}),(0,a.jsx)(x.ck,{children:(0,a.jsx)(x.Rx,{onClick:()=>M(e=>({...e,open:!1})),children:"OK"})})]})}),(0,a.jsx)(c.T,{open:$.open,onOpenChange:e=>q(t=>({...t,open:e})),title:"Delete Agent",description:'Are you sure you want to delete "'.concat(null==(e=$.agent)?void 0:e.name,'"? This action cannot be undone.'),onConfirm:el,confirmText:"Delete",variant:"destructive"})]})}},34212:(e,t,n)=>{"use strict";function a(e,[t,n]){return Math.min(n,Math.max(t,e))}n.d(t,{q:()=>a})},46767:(e,t,n)=>{"use strict";n.d(t,{Bc:()=>r,ZI:()=>d,k$:()=>o,m_:()=>l});var a=n(95155);n(12115);var s=n(53583),i=n(64269);function r(e){let{delayDuration:t=0,...n}=e;return(0,a.jsx)(s.Kq,{"data-slot":"tooltip-provider",delayDuration:t,...n})}function l(e){let{...t}=e;return(0,a.jsx)(r,{children:(0,a.jsx)(s.bL,{"data-slot":"tooltip",...t})})}function o(e){let{...t}=e;return(0,a.jsx)(s.l9,{"data-slot":"tooltip-trigger",...t})}function d(e){let{className:t,sideOffset:n=0,children:r,...l}=e;return(0,a.jsx)(s.ZL,{children:(0,a.jsxs)(s.UC,{"data-slot":"tooltip-content",sideOffset:n,className:(0,i.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...l,children:[r,(0,a.jsx)(s.i3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}},50952:(e,t,n)=>{Promise.resolve().then(n.bind(n,17254))}},e=>{e.O(0,[187,539,292,8,391,594,924,905,441,493,358],()=>e(e.s=50952)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[840],{18332:(e,t,s)=>{"use strict";s.d(t,{Fc:()=>o,TN:()=>c,XL:()=>i});var a=s(95155);s(12115);var r=s(83101),l=s(64269);let n=(0,r.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function o(e){let{className:t,variant:s,...r}=e;return(0,a.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,l.cn)(n({variant:s}),t),...r})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"alert-title",className:(0,l.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...s})}function c(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"alert-description",className:(0,l.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...s})}},20243:(e,t,s)=>{"use strict";s.d(t,{E:()=>l});var a=s(95155),r=s(64269);function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"skeleton",className:(0,r.cn)("bg-accent animate-pulse rounded-md",t),...s})}},22470:(e,t,s)=>{"use strict";s.d(t,{M:()=>r});var a=s(95155);s(12115);let r=e=>{let{title:t,description:s,action:r,children:l,maxWidth:n="full"}=e;return(0,a.jsxs)("div",{className:"w-full ".concat({full:"max-w-full","8xl":"max-w-[90rem]","7xl":"max-w-7xl","6xl":"max-w-6xl","5xl":"max-w-5xl","4xl":"max-w-4xl","3xl":"max-w-3xl","2xl":"max-w-2xl"}[n]||"max-w-full"," mx-auto py-6 space-y-6"),children:[t&&(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 px-6 pb-5 border-b",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:t}),s&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:s})]}),r&&(0,a.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:r})]}),l]})}},34105:(e,t,s)=>{"use strict";s.d(t,{c:()=>a});let a=(0,s(12115).createContext)(void 0)},51283:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>V});var a=s(95155),r=s(12115),l=s(80230),n=s(7831),o=s(41444),i=s(63479),c=s(22470),d=s(56419),u=s(87270),m=s(20243),x=s(18332),h=s(3998),g=s(65142),f=s(51834),p=s(82214),y=s(35299),j=s(6132),b=s(55867),v=s(46826),k=s(71360),N=s(50803),w=s(61362),A=s(75426),I=s(96324),T=s(68425),P=s(47734),S=s(73697),C=s(86618),D=s(26265),_=s(33420),E=s(37665),F=s(64269);let L={light:"",dark:".dark"},K=r.createContext(null);function M(){let e=r.useContext(K);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}function U(e){let{id:t,className:s,children:l,config:n,...o}=e,i=r.useId(),c="chart-".concat(t||i.replace(/:/g,""));return(0,a.jsx)(K.Provider,{value:{config:n},children:(0,a.jsxs)("div",{"data-slot":"chart","data-chart":c,className:(0,F.cn)("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",s),...o,children:[(0,a.jsx)(q,{id:c,config:n}),(0,a.jsx)(D.u,{children:l})]})})}let q=e=>{let{id:t,config:s}=e,r=Object.entries(s).filter(e=>{let[,t]=e;return t.theme||t.color});return r.length?(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:Object.entries(L).map(e=>{let[s,a]=e;return"\n".concat(a," [data-chart=").concat(t,"] {\n").concat(r.map(e=>{var t;let[a,r]=e,l=(null==(t=r.theme)?void 0:t[s])||r.color;return l?" --color-".concat(a,": ").concat(l,";"):null}).join("\n"),"\n}\n")}).join("\n")}}):null},z=_.m;function O(e){let{active:t,payload:s,className:l,indicator:n="dot",hideLabel:o=!1,hideIndicator:i=!1,label:c,labelFormatter:d,labelClassName:u,formatter:m,color:x,nameKey:h,labelKey:g}=e,{config:f}=M(),p=r.useMemo(()=>{var e;if(o||!(null==s?void 0:s.length))return null;let[t]=s,r="".concat(g||(null==t?void 0:t.dataKey)||(null==t?void 0:t.name)||"value"),l=$(f,t,r),n=g||"string"!=typeof c?null==l?void 0:l.label:(null==(e=f[c])?void 0:e.label)||c;return d?(0,a.jsx)("div",{className:(0,F.cn)("font-medium",u),children:d(n,s)}):n?(0,a.jsx)("div",{className:(0,F.cn)("font-medium",u),children:n}):null},[c,d,s,o,u,f,g]);if(!t||!(null==s?void 0:s.length))return null;let y=1===s.length&&"dot"!==n;return(0,a.jsxs)("div",{className:(0,F.cn)("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",l),children:[y?null:p,(0,a.jsx)("div",{className:"grid gap-1.5",children:s.map((e,t)=>{let s="".concat(h||e.name||e.dataKey||"value"),r=$(f,e,s),l=x||e.payload.fill||e.color;return(0,a.jsx)("div",{className:(0,F.cn)("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5","dot"===n&&"items-center"),children:m&&(null==e?void 0:e.value)!==void 0&&e.name?m(e.value,e.name,e,t,e.payload):(0,a.jsxs)(a.Fragment,{children:[(null==r?void 0:r.icon)?(0,a.jsx)(r.icon,{}):!i&&(0,a.jsx)("div",{className:(0,F.cn)("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",{"h-2.5 w-2.5":"dot"===n,"w-1":"line"===n,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===n,"my-0.5":y&&"dashed"===n}),style:{"--color-bg":l,"--color-border":l}}),(0,a.jsxs)("div",{className:(0,F.cn)("flex flex-1 justify-between leading-none",y?"items-end":"items-center"),children:[(0,a.jsxs)("div",{className:"grid gap-1.5",children:[y?p:null,(0,a.jsx)("span",{className:"text-muted-foreground",children:(null==r?void 0:r.label)||e.name})]}),e.value&&(0,a.jsx)("span",{className:"text-foreground font-mono font-medium tabular-nums",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}let R=E.s;function Y(e){let{className:t,hideIcon:s=!1,payload:r,verticalAlign:l="bottom",nameKey:n}=e,{config:o}=M();return(null==r?void 0:r.length)?(0,a.jsx)("div",{className:(0,F.cn)("flex items-center justify-center gap-4","top"===l?"pb-3":"pt-3",t),children:r.map(e=>{let t="".concat(n||e.dataKey||"value"),r=$(o,e,t);return(0,a.jsxs)("div",{className:(0,F.cn)("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),children:[(null==r?void 0:r.icon)&&!s?(0,a.jsx)(r.icon,{}):(0,a.jsx)("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),null==r?void 0:r.label]},e.value)})}):null}function $(e,t,s){if("object"!=typeof t||null===t)return;let a="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,r=s;return s in t&&"string"==typeof t[s]?r=t[s]:a&&s in a&&"string"==typeof a[s]&&(r=a[s]),r in e?e[r]:e[s]}let H=e=>e>=1e9?(e/1e9).toFixed(1).replace(/\.0$/,"")+"B":e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"K":e.toString(),B=e=>{let t="string"==typeof e?new Date(e):e;if(isNaN(t.getTime()))return"";let s=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return"".concat(s,"-").concat(a,"-").concat(r)},X={inputTokens:{label:"Input Tokens",color:"#3b82f6"},outputTokens:{label:"Output Tokens",color:"#a855f7"}},G={inputTokens:{label:"Input Tokens",color:"#60a5fa"},outputTokens:{label:"Output Tokens",color:"#c084fc"}},J=(0,o.h)("APIKeysPage");function V(){let{isAuthenticated:e,isLoading:t,user:s,getAccessTokenSilently:o}=(0,l.h)(),{resolvedTheme:D}=(0,i.D)(),_="dark"===D?G:X,[E,F]=(0,r.useState)([]),[L,K]=(0,r.useState)(!1),[M,q]=(0,r.useState)(null),[$,V]=(0,r.useState)(""),[Z,W]=(0,r.useState)(null),[Q,ee]=(0,r.useState)(null),[et,es]=(0,r.useState)(!1),[ea,er]=(0,r.useState)(!1),[el,en]=(0,r.useState)([]),[eo,ei]=(0,r.useState)(!1),[ec,ed]=(0,r.useState)(""),[eu,em]=(0,r.useState)(null),ex=(0,r.useRef)(!1),[eh,eg]=(0,r.useState)({}),[ef,ep]=(0,r.useState)({}),[ey,ej]=(0,r.useState)(new Date),eb=(0,r.useCallback)(e=>{let t={},s={};e.forEach(e=>{let a=B(e.timestamp),r=Number(e.inputTokens)||0,l=Number(e.outputTokens)||0,n=0;if("string"==typeof e.creditsDeducted?n=parseFloat(e.creditsDeducted):"number"==typeof e.creditsDeducted&&(n=e.creditsDeducted),n=isNaN(n)?0:n,s[a]||(s[a]={requests:0,inputTokens:0,outputTokens:0,creditsDeducted:0}),s[a].requests+=1,s[a].inputTokens+=r,s[a].outputTokens+=l,s[a].creditsDeducted+=n,e.apiKeyPrefix){let s=e.apiKeyPrefix;t[s]||(t[s]={totalRequests:0,totalInputTokens:0,totalOutputTokens:0,totalCreditsDeducted:0,dailyUsage:{}}),t[s].dailyUsage[a]||(t[s].dailyUsage[a]={requests:0,inputTokens:0,outputTokens:0,creditsDeducted:0}),t[s].totalRequests+=1,t[s].totalInputTokens+=r,t[s].totalOutputTokens+=l,t[s].totalCreditsDeducted+=n,t[s].dailyUsage[a].requests+=1,t[s].dailyUsage[a].inputTokens+=r,t[s].dailyUsage[a].outputTokens+=l,t[s].dailyUsage[a].creditsDeducted+=n}}),eg(t),ep(s),J.debug({processedKeyUsage:t,processedOverallDailyUsage:s},"API logs processed")},[]),ev=(0,r.useCallback)(e=>{let t={},s={};e.forEach(e=>{let a=e.date,r=Number(e.input_tokens)||0,l=Number(e.output_tokens)||0,n=Number(e.requests)||0,o=parseFloat(e.credits_deducted||"0")||0;s[a]={requests:n,inputTokens:r,outputTokens:l,creditsDeducted:o},(e.by_key||[]).forEach(e=>{let s=e.api_key_prefix;if(!s)return;t[s]||(t[s]={totalRequests:0,totalInputTokens:0,totalOutputTokens:0,totalCreditsDeducted:0,dailyUsage:{}}),t[s].dailyUsage[a]||(t[s].dailyUsage[a]={requests:0,inputTokens:0,outputTokens:0,creditsDeducted:0});let r=Number(e.input_tokens)||0,l=Number(e.output_tokens)||0,n=Number(e.requests)||0,o=parseFloat(e.credits_deducted||"0")||0;t[s].totalRequests+=n,t[s].totalInputTokens+=r,t[s].totalOutputTokens+=l,t[s].totalCreditsDeducted+=o,t[s].dailyUsage[a].requests+=n,t[s].dailyUsage[a].inputTokens+=r,t[s].dailyUsage[a].outputTokens+=l,t[s].dailyUsage[a].creditsDeducted+=o})}),eg(t),ep(s),J.debug({days:e.length,keyCount:Object.keys(t).length},"Usage summary processed")},[]),ek=(0,r.useCallback)(async()=>{if(!t&&e){K(!0),q(null),J.debug({},"Attempting to fetch API keys using configured client");try{var s;let e=await o();(0,n.ki)(e);let t=await n.gb.keyList();J.debug({count:null==(s=t.results)?void 0:s.length},"API keys fetched successfully"),F(t.results||[])}catch(t){J.error({err:t},"Failed to fetch API keys");let e=t.message||"Failed to load API keys. Please try again later.";if(t.response){let s=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}J.error({status:s,responseBody:a},"Fetch Keys API Error"),e="Fetch Keys API Error (".concat(s,"): ").concat(a||e)}q(e)}finally{K(!1)}}else t||e||(F([]),K(!1),q(null))},[t,e,o]);(0,r.useEffect)(()=>{ek()},[ek]);let eN=(0,r.useCallback)(async(s,a)=>{if(ex.current)return void J.debug({},"Already fetching API logs, skipping duplicate call");if(!t&&e){var r,l,i;ex.current=!0,ei(!0),ed("Fetching usage data..."),em(null);let{startDate:e,endDate:t}={startDate:B(new Date(r=s,l=a,1)),endDate:B(new Date(r,l+1,0))};J.debug({targetYear:s,targetMonth:a,startDate:e,endDate:t},"Fetching API logs for month");try{let s=await o();(0,n.ki)(s);try{ed("Loading monthly usage summary...");let a=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",r=new URLSearchParams({start_date:e,end_date:t,tz:a,by_key:"true"}),l=(n.DR.basePath||"").replace(/\/$/,""),o=await fetch("".concat(l,"/apilogs/summary?").concat(r.toString()),{method:"GET",headers:{Authorization:"Bearer ".concat(s)}});if(!o.ok){let e=await o.text();throw Error("Summary endpoint error (".concat(o.status,"): ").concat(e))}let c=await o.json();ev(c.days||[]),en([]),J.debug({timezone:c.timezone,dayCount:(null==(i=c.days)?void 0:i.length)||0},"Usage summary fetched successfully");return}catch(e){J.warn({err:e},"Usage summary endpoint unavailable, falling back to paginated logs")}let a=[],r=1,l=!0,c=!1;for(;l&&!c&&r<=50;){ed("Loading page ".concat(r,"..."));let s=await n.KC.apilogsList({page:r}),o=s.results||[];if(0===o.length){l=!1;break}for(let s of o){let r=B(s.timestamp);if(r<e){c=!0;break}r>=e&&r<=t&&a.push(s)}l=!!s.next,r++}J.debug({totalLogs:a.length,pagesScanned:r-1},"API logs fetched for month"),en(a),eb(a)}catch(t){J.error({err:t},"Failed to fetch API logs");let e=t.message||"Failed to load API logs. Please try again later.";if(t.response){let s=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}J.error({status:s,responseBody:a},"Fetch API Logs Error"),e="Fetch API Logs Error (".concat(s,"): ").concat(a||e)}em(e)}finally{ei(!1),ed(""),ex.current=!1}}},[t,e,o,eb,ev]);(0,r.useEffect)(()=>{eN(ey.getFullYear(),ey.getMonth())},[eN,ey]);let ew=async()=>{if(!$.trim())return void alert("Please provide a name for the API key.");es(!0),q(null),ee(null),J.debug({},"Attempting to create API key using configured client");try{let e=await o();(0,n.ki)(e);let t=await n.gb.keyCreateRaw({userAPIKeyRequest:{name:$}}),s=await t.raw.json();J.debug({hasKey:!!s.key},"Key creation raw JSON response received");let a=s.key;a?(ee(a),er(!0)):(J.warn({responseJson:s},"API did not return the new key in the response body"),q("Key metadata created, but the secret key value was not returned by the API. You might not be able to see the secret.")),V(""),await ek()}catch(t){J.error({err:t},"Failed to create API key");let e=t.message||"Failed to create API key. Please try again.";if(t.response){let s=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}J.error({status:s,responseBody:a},"Create Key API Error"),e="Create Key API Error (".concat(s,"): ").concat(a||e)}q(e)}finally{es(!1)}},eA=async(e,t)=>{let s=String(e);if(confirm('Are you sure you want to delete API Key "'.concat(t,'..."? This action cannot be undone.'))){W(s),q(null),ee(null),J.debug({keyId:s,keyPrefix:t},"Attempting to delete API key using configured client");try{let e=await o();(0,n.ki)(e),await n.gb.keyDestroy({prefix:t}),J.info({keyPrefix:t},"API key deleted successfully"),F(e=>e.filter(e=>String(e.prefix)!==t))}catch(s){J.error({err:s,keyPrefix:t},"Failed to delete API key");let e=s.message||"Failed to delete API key ".concat(t,"... Please try again.");if(s.response){let a=s.response.status,r="Could not read error body";try{r=await s.response.text()}catch(e){}J.error({status:a,responseBody:r,keyPrefix:t},"Delete Key API Error"),e="Delete Key API Error (".concat(a,"): ").concat(r||e)}q(e)}finally{W(null)}}},eI=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Key";navigator.clipboard.writeText(e).then(()=>{alert("".concat(t," copied to clipboard!"))}).catch(e=>{J.error({err:e},"Failed to copy text to clipboard"),alert("Failed to copy ".concat(t,"."))})};return(0,a.jsxs)(c.M,{title:"API Keys",description:"Manage API keys and monitor usage.",children:[(()=>{let e=ey.getMonth(),t=ey.getFullYear(),s=((e,t)=>{let s=[],a=new Date(e,t,1);for(;a.getMonth()===t;)s.push(B(a)),a.setDate(a.getDate()+1);return s})(t,e),r=B(new Date),l=e===new Date().getMonth()&&t===new Date().getFullYear()?s.filter(e=>e<=r):s,n=l.map(e=>{var t,s;let a=ef[e];return{date:e,inputTokens:null!=(t=null==a?void 0:a.inputTokens)?t:0,outputTokens:null!=(s=null==a?void 0:a.outputTokens)?s:0}}),o=n.some(e=>e.inputTokens>0||e.outputTokens>0),i=n.reduce((e,t)=>e+t.inputTokens,0),c=n.reduce((e,t)=>e+t.outputTokens,0),d=l.reduce((e,t)=>{var s,a;return e+(null!=(a=null==(s=ef[t])?void 0:s.requests)?a:0)},0);return(0,a.jsxs)("div",{className:"border mx-6 mb-6 rounded-lg overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 px-4 py-3 border-b",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)(p.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("h2",{className:"text-sm font-medium",children:["API Usage — ",ey.toLocaleString("default",{month:"long"})," ",ey.getFullYear()]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Daily token consumption for the selected month."})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,a.jsx)(h.$,{variant:"outline",size:"sm",onClick:()=>ej(e=>new Date(e.getFullYear(),e.getMonth()-1,1)),children:"Previous"}),(0,a.jsx)(h.$,{variant:"outline",size:"sm",onClick:()=>ej(e=>new Date(e.getFullYear(),e.getMonth()+1,1)),disabled:ey.getMonth()===new Date().getMonth()&&ey.getFullYear()===new Date().getFullYear(),children:"Next"})]})]}),!eo&&!eu&&o&&(0,a.jsxs)("div",{className:"grid grid-cols-3 divide-x border-b bg-muted/20",children:[(0,a.jsxs)("div",{className:"px-4 py-2.5",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Total Tokens"}),(0,a.jsx)("p",{className:"text-lg font-semibold tabular-nums",children:H(i+c)})]}),(0,a.jsxs)("div",{className:"px-4 py-2.5",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Input / Output"}),(0,a.jsxs)("p",{className:"text-sm font-medium tabular-nums mt-0.5",children:[(0,a.jsx)("span",{style:{color:"hsl(var(--chart-2))"},children:H(i)}),(0,a.jsx)("span",{className:"text-muted-foreground/50 mx-1",children:"/"}),(0,a.jsx)("span",{style:{color:"hsl(var(--chart-3))"},children:H(c)})]})]}),(0,a.jsxs)("div",{className:"px-4 py-2.5",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"API Requests"}),(0,a.jsx)("p",{className:"text-lg font-semibold tabular-nums",children:d.toLocaleString()})]})]}),(0,a.jsxs)("div",{className:"p-4",children:[eo&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[(0,a.jsx)(y.A,{className:"mr-2 h-5 w-5 animate-spin"}),(0,a.jsx)("span",{className:"text-sm",children:ec||"Loading usage data..."})]}),!eo&&eu&&(0,a.jsxs)(x.Fc,{variant:"destructive",children:[(0,a.jsx)(j.A,{className:"h-4 w-4"}),(0,a.jsx)(x.XL,{children:"Error Loading Logs"}),(0,a.jsx)(x.TN,{children:eu})]}),!eo&&!eu&&!o&&(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,a.jsx)(p.A,{className:"h-8 w-8 mb-3 opacity-25"}),(0,a.jsx)("p",{className:"text-sm",children:"No usage data for this month"})]}),!eo&&!eu&&o&&(0,a.jsx)(U,{config:_,className:"min-h-[220px] w-full",children:(0,a.jsxs)(I.E,{accessibilityLayer:!0,data:n,margin:{top:4,right:8,left:0,bottom:0},children:[(0,a.jsx)(T.d,{vertical:!1,strokeDasharray:"3 3"}),(0,a.jsx)(P.W,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8,tick:{fontSize:11},tickFormatter:e=>{var t;return String(parseInt(null!=(t=e.split("-")[2])?t:"0",10))}}),(0,a.jsx)(S.h,{tickLine:!1,axisLine:!1,width:44,tick:{fontSize:11},tickFormatter:H}),(0,a.jsx)(z,{cursor:{fill:"hsl(var(--muted))",opacity:.5},content:(0,a.jsx)(O,{indicator:"dashed",labelFormatter:e=>{let[t,s,a]=String(null!=e?e:"").split("-").map(Number);return new Date(t,(null!=s?s:1)-1,a).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})},formatter:(e,t)=>[("number"==typeof e?e:0).toLocaleString(),"inputTokens"===t?"Input":"Output"]})}),(0,a.jsx)(R,{content:(0,a.jsx)(Y,{})}),(0,a.jsx)(C.yP,{dataKey:"inputTokens",stackId:"tokens",fill:_.inputTokens.color,radius:[0,0,3,3],maxBarSize:32}),(0,a.jsx)(C.yP,{dataKey:"outputTokens",stackId:"tokens",fill:_.outputTokens.color,radius:[3,3,0,0],maxBarSize:32})]})})]})]})})(),(0,a.jsxs)("div",{className:"border mx-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4 px-4 py-3 border-b",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-medium",children:"API Keys"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage your API keys for accessing HackAgent. Keys are used to authenticate your requests."})]}),e&&(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,a.jsx)(g.p,{type:"text",placeholder:"Key name (e.g., My Test Key)",value:$,onChange:e=>V(e.target.value),disabled:et,className:"w-56"}),(0,a.jsxs)(h.$,{onClick:ew,disabled:et||!$.trim(),children:[et?(0,a.jsx)(y.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,a.jsx)(b.A,{className:"mr-2 h-4 w-4"}),"Create Key"]})]})]}),(0,a.jsxs)("div",{className:"p-4",children:[M&&!ea&&(0,a.jsxs)(x.Fc,{variant:"destructive",className:"mb-4",children:[(0,a.jsx)(j.A,{className:"h-4 w-4"}),(0,a.jsx)(x.XL,{children:"Error"}),(0,a.jsx)(x.TN,{children:M})]}),e&&(L&&0===E.length&&!eo?(0,a.jsx)("div",{className:"border rounded-md mt-4",children:(0,a.jsxs)(u.XI,{children:[(0,a.jsx)(u.A0,{children:(0,a.jsxs)(u.Hj,{children:[(0,a.jsx)(u.nd,{children:(0,a.jsx)(m.E,{className:"h-5 w-1/5"})}),(0,a.jsx)(u.nd,{children:(0,a.jsx)(m.E,{className:"h-5 w-1/5"})}),(0,a.jsx)(u.nd,{children:(0,a.jsx)(m.E,{className:"h-5 w-1/5"})}),(0,a.jsx)(u.nd,{children:(0,a.jsx)(m.E,{className:"h-5 w-1/5"})}),(0,a.jsx)(u.nd,{children:(0,a.jsx)(m.E,{className:"h-5 w-1/5"})}),(0,a.jsx)(u.nd,{children:(0,a.jsx)(m.E,{className:"h-5 w-1/5"})}),(0,a.jsx)(u.nd,{className:"text-right",children:(0,a.jsx)(m.E,{className:"h-5 w-24"})})]})}),(0,a.jsx)(u.BF,{children:[void 0,void 0].map((e,t)=>(0,a.jsxs)(u.Hj,{children:[(0,a.jsx)(u.nA,{children:(0,a.jsx)(m.E,{className:"h-5 w-full"})}),(0,a.jsx)(u.nA,{children:(0,a.jsx)(m.E,{className:"h-5 w-full"})}),(0,a.jsx)(u.nA,{children:(0,a.jsx)(m.E,{className:"h-5 w-full"})}),(0,a.jsx)(u.nA,{children:(0,a.jsx)(m.E,{className:"h-5 w-full"})}),(0,a.jsx)(u.nA,{children:(0,a.jsx)(m.E,{className:"h-5 w-full"})}),(0,a.jsx)(u.nA,{children:(0,a.jsx)(m.E,{className:"h-5 w-full"})}),(0,a.jsx)(u.nA,{className:"text-right",children:(0,a.jsx)(m.E,{className:"h-5 w-20"})})]},t))})]})}):0!==E.length||L?(0,a.jsx)("div",{className:"border overflow-hidden",children:(0,a.jsxs)(u.XI,{children:[(0,a.jsx)(u.r6,{children:"Manage your API keys for accessing HackAgent."}),(0,a.jsx)(u.A0,{children:(0,a.jsxs)(u.Hj,{children:[(0,a.jsx)(u.nd,{children:"Name/Label"}),(0,a.jsx)(u.nd,{children:"Prefix"}),(0,a.jsx)(u.nd,{children:"Created"}),(0,a.jsx)(u.nd,{children:"Total Requests"}),(0,a.jsx)(u.nd,{children:"Total Tokens"}),(0,a.jsx)(u.nd,{children:"Total Credits"}),(0,a.jsx)(u.nd,{className:"text-right",children:"Actions"})]})}),(0,a.jsx)(u.BF,{children:E.map(e=>{let t=e.prefix?eh[e.prefix]:null,s=t?t.totalInputTokens+t.totalOutputTokens:0;return(0,a.jsxs)(u.Hj,{children:[(0,a.jsx)(u.nA,{className:"font-medium",children:e.name||"N/A"}),(0,a.jsx)(u.nA,{className:"font-mono",children:e.prefix}),(0,a.jsx)(u.nA,{children:(e=>{if(!e)return"N/A";try{return("string"==typeof e?new Date(e):e).toLocaleDateString()}catch(e){return"Invalid Date"}})(e.created)}),(0,a.jsx)(u.nA,{children:t?t.totalRequests.toLocaleString():eo?"...":"0"}),(0,a.jsx)(u.nA,{title:t?s.toLocaleString():"0",children:t?H(s):eo?"...":"0"}),(0,a.jsxs)(u.nA,{children:["$",t?t.totalCreditsDeducted.toFixed(2):eo?"...":"0.00"]}),(0,a.jsx)(u.nA,{className:"text-right space-x-2",children:(0,a.jsxs)(h.$,{variant:"destructive",size:"icon",onClick:()=>{var t;return eA(e.id,null!=(t=e.prefix)?t:"N/A")},title:"Delete key",disabled:L||Z===String(e.id),children:[Z===String(e.id)?(0,a.jsx)(y.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(k.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Delete API Key"})]})})]},e.id)})})]})}):(0,a.jsx)(d.p,{icon:b.A,title:"No API keys found",description:"Generate your first API key to start integrating with the HackAgent platform.",action:(0,a.jsxs)(h.$,{onClick:ew,disabled:et,children:[et?(0,a.jsx)(y.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,a.jsx)(v.A,{className:"mr-2 h-4 w-4"}),"Generate API Key"]})})),!e&&!t&&(0,a.jsxs)(x.Fc,{children:[(0,a.jsx)(N.A,{className:"h-4 w-4"}),(0,a.jsx)(x.XL,{children:"Authentication Required"}),(0,a.jsx)(x.TN,{children:"Please log in to manage API keys."})]})]})]}),(0,a.jsx)(f.lG,{open:ea,onOpenChange:e=>{er(e),e||ee(null)},children:(0,a.jsxs)(f.Cf,{className:"sm:max-w-md",children:[(0,a.jsxs)(f.c7,{children:[(0,a.jsxs)(f.L3,{className:"flex items-center",children:[(0,a.jsx)(w.A,{className:"h-6 w-6 text-green-500 mr-2"}),"API Key Generated Successfully!"]}),(0,a.jsx)(f.rr,{className:"mt-2 text-sm text-muted-foreground",children:"Please copy your new API key. You will not be able to see it again."})]}),Q&&(0,a.jsxs)("div",{className:"my-4",children:[(0,a.jsx)("p",{className:"text-sm font-semibold mb-1",children:"Your new API key:"}),(0,a.jsx)("div",{className:"p-2 bg-muted rounded-md font-mono text-sm break-all overflow-x-auto",children:Q})]}),(0,a.jsxs)(f.Es,{className:"sm:justify-start mt-4",children:[Q&&(0,a.jsxs)(h.$,{type:"button",variant:"secondary",onClick:()=>eI(Q,"API Key"),className:"w-full sm:w-auto",children:[(0,a.jsx)(A.A,{className:"mr-2 h-4 w-4"})," Copy Key"]}),(0,a.jsx)(f.HM,{asChild:!0,children:(0,a.jsx)(h.$,{type:"button",variant:"outline",className:"w-full sm:w-auto mt-2 sm:mt-0",children:"Close"})})]})]})})]})}},51834:(e,t,s)=>{"use strict";s.d(t,{Cf:()=>u,Es:()=>x,HM:()=>c,L3:()=>h,c7:()=>m,lG:()=>o,rr:()=>g});var a=s(95155);s(12115);var r=s(88292),l=s(65229),n=s(64269);function o(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"dialog",...t})}function i(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{...t}=e;return(0,a.jsx)(r.bm,{"data-slot":"dialog-close",...t})}function d(e){let{className:t,...s}=e;return(0,a.jsx)(r.hJ,{"data-slot":"dialog-overlay",className:(0,n.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function u(e){let{className:t,children:s,...o}=e;return(0,a.jsxs)(i,{"data-slot":"dialog-portal",children:[(0,a.jsx)(d,{}),(0,a.jsxs)(r.UC,{"data-slot":"dialog-content",className:(0,n.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...o,children:[s,(0,a.jsxs)(r.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(l.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,n.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function x(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,n.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(r.hE,{"data-slot":"dialog-title",className:(0,n.cn)("text-lg leading-none font-semibold",t),...s})}function g(e){let{className:t,...s}=e;return(0,a.jsx)(r.VY,{"data-slot":"dialog-description",className:(0,n.cn)("text-muted-foreground text-sm",t),...s})}},56419:(e,t,s)=>{"use strict";s.d(t,{p:()=>r});var a=s(95155);s(12115);let r=e=>{let{icon:t,title:s,description:r,action:l}=e;return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center text-center py-12 px-4",children:[(0,a.jsx)("div",{className:"rounded-full bg-muted p-3 mb-4",children:(0,a.jsx)(t,{className:"h-10 w-10 text-muted-foreground"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:s}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground max-w-sm mb-6",children:r}),l&&(0,a.jsx)("div",{children:l})]})}},63479:(e,t,s)=>{"use strict";s.d(t,{D:()=>n,N:()=>c});var a=s(95155),r=s(12115);let l=(0,r.createContext)({theme:"system",resolvedTheme:"light",setTheme:()=>{}});function n(){return(0,r.useContext)(l)}let o="hackagent-theme";function i(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function c(e){let{children:t}=e,[s,n]=(0,r.useState)("system"),[c,d]=(0,r.useState)("light"),u=e=>{let t=document.documentElement;"dark"===e?t.classList.add("dark"):t.classList.remove("dark")};return(0,r.useEffect)(()=>{var e;let t=null!=(e=localStorage.getItem(o))?e:"system";n(t);let s="system"===t?i():t;d(s),u(s)},[]),(0,r.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{if("system"===s){let e=i();d(e),u(e)}};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[s]),(0,a.jsx)(l.Provider,{value:{theme:s,resolvedTheme:c,setTheme:e=>{localStorage.setItem(o,e),n(e);let t="system"===e?i():e;d(t),u(t)}},children:t})}},65142:(e,t,s)=>{"use strict";s.d(t,{p:()=>l});var a=s(95155);s(12115);var r=s(64269);function l(e){let{className:t,type:s,...l}=e;return(0,a.jsx)("input",{type:s,"data-slot":"input",className:(0,r.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...l})}},80230:(e,t,s)=>{"use strict";s.d(t,{h:()=>n});var a=s(12115),r=s(34105);let l=async()=>"";function n(){let e=(0,a.useContext)(r.c);return e||{provider:"disabled",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:l}}},84443:(e,t,s)=>{Promise.resolve().then(s.bind(s,51283))},87270:(e,t,s)=>{"use strict";s.d(t,{A0:()=>n,BF:()=>o,Hj:()=>i,XI:()=>l,nA:()=>d,nd:()=>c,r6:()=>u});var a=s(95155);s(12115);var r=s(64269);function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,a.jsx)("table",{"data-slot":"table",className:(0,r.cn)("w-full caption-bottom text-sm",t),...s})})}function n(e){let{className:t,...s}=e;return(0,a.jsx)("thead",{"data-slot":"table-header",className:(0,r.cn)("[&_tr]:border-b",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("tbody",{"data-slot":"table-body",className:(0,r.cn)("[&_tr:last-child]:border-0",t),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("tr",{"data-slot":"table-row",className:(0,r.cn)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...s})}function c(e){let{className:t,...s}=e;return(0,a.jsx)("th",{"data-slot":"table-head",className:(0,r.cn)("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function d(e){let{className:t,...s}=e;return(0,a.jsx)("td",{"data-slot":"table-cell",className:(0,r.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function u(e){let{className:t,...s}=e;return(0,a.jsx)("caption",{"data-slot":"table-caption",className:(0,r.cn)("text-muted-foreground mt-4 text-sm",t),...s})}}},e=>{e.O(0,[187,539,292,144,855,377,924,441,493,358],()=>e(e.s=84443)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[60],{16831:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>I});var l=a(95155),r=a(12115),s=a(20063),n=a(80230),i=a(22470),d=a(3998),u=a(18332),c=a(50803),o=a(35299),g=a(7831),x=a(41444),m=a(71511),h=a(93782);function p(e){var t,a;let l=[];return(null==(t=e.target)?void 0:t.agentId)||l.push("A target agent is required"),(null==(a=e.technique)?void 0:a.type)&&(0,m._w)(e.technique.type)||l.push("A technique is required"),e.goals.some(e=>""!==e.trim())||l.push("At least one goal is required"),l}let f={goals:[]};function v(e,t){return{draggable:!0,onDragStart:a=>{a.dataTransfer.setData("application/hackagent-component",JSON.stringify({kind:e,payload:t})),a.dataTransfer.effectAllowed="move"}}}let j="cursor-grab rounded border bg-card px-2 py-1 text-sm hover:bg-accent",b=e=>{let{agents:t}=e;return(0,l.jsxs)("div",{className:"w-48 space-y-4 border-r p-3",children:[(0,l.jsx)(y,{title:"Targets",children:t.map(e=>(0,l.jsx)("div",{className:j,...v("target",{agentId:e.id}),children:e.name},e.id))}),(0,l.jsx)(y,{title:"Techniques",children:Object.values(m.K3).map(e=>(0,l.jsx)("div",{className:j,...v("technique",{type:e.type}),children:e.label},e.type))}),(0,l.jsx)(y,{title:"Judge",children:(0,l.jsx)("div",{className:j,...v("judge",{identifier:"gemma3:4b"}),children:"Judge model"})}),(0,l.jsx)(y,{title:"Goals",children:(0,l.jsx)("div",{className:j,...v("goals",{}),children:"Goal list"})})]})},y=e=>{let{title:t,children:a}=e;return(0,l.jsxs)("div",{className:"space-y-1",children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase text-muted-foreground",children:t}),a]})};var N=a(22539);a(8301);var w=a(49799),q=a(64269);let k=e=>{let{title:t,filled:a,summary:r,placeholder:s,selected:n,invalid:i}=e;return(0,l.jsxs)("div",{className:(0,q.cn)("w-56 rounded-md border bg-card p-3 shadow-sm transition",n&&"ring-2 ring-primary",i&&"ring-2 ring-destructive"),children:[(0,l.jsx)("div",{className:"text-xs font-semibold uppercase text-muted-foreground",children:t}),(0,l.jsx)("div",{className:"mt-1 text-sm",children:a?(0,l.jsx)("span",{className:"font-medium",children:r}):(0,l.jsx)("span",{className:"text-muted-foreground italic",children:s})})]})},C={target:"Drop a target agent",technique:"Drop a technique",judge:"Drop a judge model",goals:"Add goals"},S={target:"Target",technique:"Technique",judge:"Judge",goals:"Goals"};function A(e){let t=t=>{let{data:a}=t,{filled:r,summary:s}=function(e,t){var a,l,r;switch(e){case"target":return{filled:!!t.target,summary:null==(a=t.target)?void 0:a.agentId};case"technique":return{filled:!!t.technique,summary:t.technique?null==(l=(0,m._w)(t.technique.type))?void 0:l.label:void 0};case"judge":return{filled:!!t.judge,summary:null==(r=t.judge)?void 0:r.identifier};case"goals":return{filled:t.goals.length>0,summary:"".concat(t.goals.length," goal(s)")}}}(e,a.state);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(N.h7,{type:"target",position:w.yX.Left,style:{visibility:"hidden"}}),(0,l.jsx)(k,{title:S[e],placeholder:C[e],filled:r,summary:s,selected:a.selected,invalid:a.invalid}),(0,l.jsx)(N.h7,{type:"source",position:w.yX.Right,style:{visibility:"hidden"}})]})};return t.displayName="".concat(e,"Node"),t}let J={target:A("target"),technique:A("technique"),judge:A("judge"),goals:A("goals")},T={goals:{x:0,y:0},technique:{x:300,y:80},target:{x:620,y:0},judge:{x:300,y:260}},D=[{id:"goals-technique",source:"goals",target:"technique"},{id:"technique-target",source:"technique",target:"target"},{id:"technique-judge",source:"technique",target:"judge"}],F=e=>{let{state:t,selectedSlot:a,invalidSlots:s,onSelectSlot:n,onDropComponent:i}=e,d=(0,r.useMemo)(()=>["goals","technique","target","judge"].map(e=>({id:e,type:e,position:T[e],data:{slot:e,state:t,selected:a===e,invalid:s.includes(e)}})),[t,a,s]);return(0,l.jsx)("div",{className:"h-[520px] w-full","data-testid":"builder-canvas",children:(0,l.jsx)(N.Gc,{nodes:d,edges:D,nodeTypes:J,nodesDraggable:!1,nodesConnectable:!1,edgesReconnectable:!1,elementsSelectable:!0,fitView:!0,onNodeClick:(e,t)=>n(t.id),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},onDrop:e=>{e.preventDefault();let t=e.dataTransfer.getData("application/hackagent-component");if(!t)return;let{kind:a,payload:l}=JSON.parse(t);i(a,l)},children:(0,l.jsx)(N.VS,{})})})};var _=a(65142),E=a(76444);let R=e=>{var t,a,r,s,n,i;let{slot:d,state:u,agents:c,onChange:o}=e;if(!d)return(0,l.jsx)("div",{className:"w-72 border-l p-4 text-sm text-muted-foreground",children:"Select a node to edit it."});if("goals"===d)return(0,l.jsxs)("div",{className:"w-72 border-l p-4",children:[(0,l.jsx)(E.J,{htmlFor:"goals-ta",children:"Goals (one per line)"}),(0,l.jsx)("textarea",{id:"goals-ta",className:"mt-1 h-40 w-full rounded border p-2 text-sm",value:u.goals.join("\n"),onChange:e=>o({...u,goals:e.target.value.split("\n").map(e=>e.trimEnd()).filter(e=>""!==e)})})]});if("target"===d)return(0,l.jsxs)("div",{className:"w-72 border-l p-4",children:[(0,l.jsx)(E.J,{htmlFor:"target-sel",children:"Target agent"}),(0,l.jsxs)("select",{id:"target-sel",className:"mt-1 w-full rounded border p-2 text-sm",value:null!=(a=null==(t=u.target)?void 0:t.agentId)?a:"",onChange:e=>o({...u,target:{agentId:e.target.value}}),children:[(0,l.jsx)("option",{value:"",disabled:!0,children:"Select an agent…"}),c.map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})]});if("judge"===d)return(0,l.jsxs)("div",{className:"w-72 space-y-3 border-l p-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(E.J,{htmlFor:"judge-id",children:"Judge model identifier"}),(0,l.jsx)(_.p,{id:"judge-id",value:null!=(n=null==(r=u.judge)?void 0:r.identifier)?n:"",onChange:e=>o({...u,judge:{...u.judge,identifier:e.target.value}})})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(E.J,{htmlFor:"judge-ep",children:"Judge endpoint (optional)"}),(0,l.jsx)(_.p,{id:"judge-ep",value:null!=(i=null==(s=u.judge)?void 0:s.endpoint)?i:"",onChange:e=>{var t,a;return o({...u,judge:{identifier:null!=(a=null==(t=u.judge)?void 0:t.identifier)?a:"",endpoint:e.target.value}})}})]})]});let g=u.technique?(0,m._w)(u.technique.type):void 0;if(!g)return(0,l.jsx)("div",{className:"w-72 border-l p-4 text-sm text-muted-foreground",children:"Drop a technique to configure it."});let x=u.technique.values,h=(e,t)=>o({...u,technique:{type:u.technique.type,values:{...x,[e]:t}}});return(0,l.jsxs)("div",{className:"w-72 space-y-3 overflow-y-auto border-l p-4",children:[(0,l.jsx)("div",{className:"text-sm font-semibold",children:g.label}),g.fields.map(e=>{var t,a;let r="f-".concat(e.key),s=null!=(t=x[e.key])?t:e.default;if("boolean"===e.type)return(0,l.jsxs)("label",{className:"flex items-center gap-2 text-sm",htmlFor:r,children:[(0,l.jsx)("input",{id:r,type:"checkbox",checked:!!s,onChange:t=>h(e.key,t.target.checked)}),e.label,e.help&&(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.help})]},e.key);if("enum"===e.type)return(0,l.jsxs)("div",{children:[(0,l.jsx)(E.J,{htmlFor:r,children:e.label}),(0,l.jsx)("select",{id:r,className:"mt-1 w-full rounded border p-2 text-sm",value:String(s),onChange:t=>h(e.key,t.target.value),children:(null!=(a=e.enumValues)?a:[]).map(e=>(0,l.jsx)("option",{value:e,children:e},e))}),e.help&&(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.help})]},e.key);if("json"===e.type)return(0,l.jsxs)("div",{children:[(0,l.jsx)(E.J,{htmlFor:r,children:e.label}),(0,l.jsx)("textarea",{id:r,className:"mt-1 h-24 w-full rounded border p-2 font-mono text-xs",value:String(null!=s?s:""),onChange:t=>h(e.key,t.target.value)}),e.help&&(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.help})]},e.key);let n="string[]"===e.type&&Array.isArray(s)?s.join(", "):String(null!=s?s:"");return(0,l.jsxs)("div",{children:[(0,l.jsx)(E.J,{htmlFor:r,children:e.label}),(0,l.jsx)(_.p,{id:r,value:n,onChange:t=>h(e.key,function(e,t){return"number"===e.type?""===t?"":Number(t):"string[]"===e.type?t.split(",").map(e=>e.trim()).filter(Boolean):t}(e,t.target.value))}),e.help&&(0,l.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.help})]},e.key)})]})},L=(0,x.h)("AttackBuilder");function I(){let{isAuthenticated:e,isLoading:t}=(0,n.h)(),a=(0,s.useRouter)(),[x,v]=(0,r.useState)([]),[j,y]=(0,r.useState)(f),[N,w]=(0,r.useState)(null),[q,k]=(0,r.useState)([]),[C,S]=(0,r.useState)([]),[A,J]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&g.in.agentList().then(e=>v(e.results||[])).catch(e=>L.error({e},"agent list failed"))},[e]);let T=(0,r.useCallback)((e,t)=>{y(a=>{switch(e){case"target":return{...a,target:t};case"judge":return{...a,judge:t};case"goals":return{...a,goals:a.goals.length?a.goals:[""]};case"technique":{let{type:e}=t,l=(0,m._w)(e);if(!l)return a;return{...a,technique:{type:e,values:(0,h.wW)(l.fields)}}}default:return a}}),w(e)},[]),D=e=>e.includes("target")?"target":e.includes("technique")?"technique":e.includes("goal")?"goals":null,_=(0,r.useCallback)(async()=>{let e=p(j);if(e.length){S(e),k(e.map(D).filter(e=>null!==e));return}S([]),k([]),J(!0);try{let{type:e,agent:t,_configuration:l}=function(e){var t;let a=p(e);if(a.length>0)throw Error(a.join("; "));let l=(0,m._w)(e.technique.type),r=e.goals.map(e=>e.trim()).filter(e=>""!==e),s={...l.toConfig(e.technique.values),goals:r};return(null==(t=e.judge)?void 0:t.identifier)&&(s.judge={identifier:e.judge.identifier,...e.judge.endpoint?{endpoint:e.judge.endpoint}:{}}),{type:l.type,agent:e.target.agentId,_configuration:s}}(j),r=await g.vm.attackCreate({attackRequest:{type:e,agent:t,_configuration:l}});await g.ME.runRunTestsCreate({runRequest:{agent:t,attack:r.id}}),a.push("/stats")}catch(e){L.error({e},"launch failed"),S([e instanceof Error?e.message:"Failed to create or launch the attack."])}finally{J(!1)}},[j,a]);return t?null:(0,l.jsx)(i.M,{title:"Attack Builder",description:"Drag components onto the canvas to compose and launch an attack run.",children:e?(0,l.jsxs)("div",{className:"px-6",children:[C.length>0&&(0,l.jsxs)(u.Fc,{variant:"destructive",className:"mb-4",children:[(0,l.jsx)(c.A,{className:"h-4 w-4"}),(0,l.jsx)(u.XL,{children:"Cannot launch yet"}),(0,l.jsx)(u.TN,{children:(0,l.jsx)("ul",{className:"list-disc pl-4",children:C.map(e=>(0,l.jsx)("li",{children:e},e))})})]}),(0,l.jsxs)("div",{className:"flex border rounded-md overflow-hidden",children:[(0,l.jsx)(b,{agents:x}),(0,l.jsx)(F,{state:j,selectedSlot:N,invalidSlots:q,onSelectSlot:w,onDropComponent:T}),(0,l.jsx)(R,{slot:N,state:j,agents:x,onChange:y})]}),(0,l.jsx)("div",{className:"mt-4 flex justify-end",children:(0,l.jsxs)(d.$,{onClick:_,disabled:A,children:[A&&(0,l.jsx)(o.A,{className:"mr-2 h-4 w-4 animate-spin"})," Build & Launch Run"]})})]}):(0,l.jsx)("div",{className:"px-6",children:(0,l.jsxs)(u.Fc,{className:"mt-4",children:[(0,l.jsx)(c.A,{className:"h-4 w-4"}),(0,l.jsx)(u.XL,{children:"Authentication Required"}),(0,l.jsx)(u.TN,{children:"Please log in to build attacks."})]})})})}},17739:(e,t,a)=>{Promise.resolve().then(a.bind(a,16831))},18332:(e,t,a)=>{"use strict";a.d(t,{Fc:()=>i,TN:()=>u,XL:()=>d});var l=a(95155);a(12115);var r=a(83101),s=a(64269);let n=(0,r.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function i(e){let{className:t,variant:a,...r}=e;return(0,l.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,s.cn)(n({variant:a}),t),...r})}function d(e){let{className:t,...a}=e;return(0,l.jsx)("div",{"data-slot":"alert-title",className:(0,s.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...a})}function u(e){let{className:t,...a}=e;return(0,l.jsx)("div",{"data-slot":"alert-description",className:(0,s.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...a})}},22470:(e,t,a)=>{"use strict";a.d(t,{M:()=>r});var l=a(95155);a(12115);let r=e=>{let{title:t,description:a,action:r,children:s,maxWidth:n="full"}=e;return(0,l.jsxs)("div",{className:"w-full ".concat({full:"max-w-full","8xl":"max-w-[90rem]","7xl":"max-w-7xl","6xl":"max-w-6xl","5xl":"max-w-5xl","4xl":"max-w-4xl","3xl":"max-w-3xl","2xl":"max-w-2xl"}[n]||"max-w-full"," mx-auto py-6 space-y-6"),children:[t&&(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 px-6 pb-5 border-b",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:t}),a&&(0,l.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:a})]}),r&&(0,l.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:r})]}),s]})}},34105:(e,t,a)=>{"use strict";a.d(t,{c:()=>l});let l=(0,a(12115).createContext)(void 0)},65142:(e,t,a)=>{"use strict";a.d(t,{p:()=>s});var l=a(95155);a(12115);var r=a(64269);function s(e){let{className:t,type:a,...s}=e;return(0,l.jsx)("input",{type:a,"data-slot":"input",className:(0,r.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...s})}},76444:(e,t,a)=>{"use strict";a.d(t,{J:()=>n});var l=a(95155);a(12115);var r=a(85408),s=a(64269);function n(e){let{className:t,...a}=e;return(0,l.jsx)(r.b,{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...a})}},80230:(e,t,a)=>{"use strict";a.d(t,{h:()=>n});var l=a(12115),r=a(34105);let s=async()=>"";function n(){let e=(0,l.useContext)(r.c);return e||{provider:"disabled",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:s}}}},e=>{e.O(0,[714,862,187,144,326,924,511,441,493,358],()=>e(e.s=17739)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[80],{3549:(e,t,a)=>{Promise.resolve().then(a.bind(a,47393))},20063:(e,t,a)=>{"use strict";var n=a(47260);a.o(n,"usePathname")&&a.d(t,{usePathname:function(){return n.usePathname}}),a.o(n,"useRouter")&&a.d(t,{useRouter:function(){return n.useRouter}})},47393:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>b});var n=a(95155),r=a(12115),s=a(80230),i=a(20063),l=a(71511),c=a(7831),o=a(41444),d=a(22470),u=a(56419),h=a(35835),x=a(87270),g=a(20243),p=a(18332),m=a(98053),j=a(50803),f=a(35299),v=a(3998),y=a(46826),N=a(18514),k=a(71360),A=a(51834),w=a(65142),C=a(76444);let E=(0,o.h)("AttacksPage"),b=()=>{var e,t;let{isAuthenticated:a,isLoading:o}=(0,s.h)(),b=(0,i.useRouter)(),[_,I]=(0,r.useState)([]),[S,D]=(0,r.useState)(!0),[O,R]=(0,r.useState)(null),[F,P]=(0,r.useState)(null),[J,T]=(0,r.useState)({open:!1,attack:null}),[$,V]=(0,r.useState)({open:!1,title:"",description:""}),q=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";V({open:!0,title:e,description:t,variant:a})},[L,H]=(0,r.useState)(!1),[M,X]=(0,r.useState)(!1),[B,G]=(0,r.useState)(null),[U,W]=(0,r.useState)({type:"",agent:"",_configuration:"{}"}),z=(0,r.useCallback)(async()=>{D(!0),R(null);try{let e=await c.vm.attackList();I(e.results||[])}catch(t){E.error({err:t},"Error fetching attacks");let e=t.message||"Failed to load attacks.";if(t.response){let a=t.response.status,n="Could not read error body";try{n=await t.response.text()}catch(e){}e="API Error (".concat(a,"): ").concat(n||e)}R(e),I([])}finally{D(!1)}},[]),K=()=>{W({type:"",agent:"",_configuration:"{}"}),H(!0)},Z=async()=>{let e;if(!U.type||!U.agent)return void q("Validation Error","Type and Agent ID are required.");try{e=JSON.parse(U._configuration)}catch(e){q("Validation Error","Configuration must be valid JSON.");return}D(!0);try{let t={type:U.type,agent:U.agent,_configuration:e};await c.vm.attackCreate({attackRequest:t}),z(),H(!1)}catch(t){E.error({err:t},"Error creating attack");let e=t.message||"Failed to create attack.";if(t.response){let a=t.response.status,n="Could not read error body";try{n=await t.response.text()}catch(e){}e="Create API Error (".concat(a,"): ").concat(n||e)}q("Error Creating Attack",e,"destructive")}finally{D(!1)}},Q=async()=>{let e;if(!B||!B.id)return void q("Invalid Attack","No attack selected for editing or ID is missing.","destructive");if(!U.type||!U.agent)return void q("Validation Error","Type and Agent ID are required.");try{e=JSON.parse(U._configuration)}catch(e){q("Validation Error","Configuration must be valid JSON.");return}D(!0);try{let t={type:U.type,agent:U.agent,_configuration:e};await c.vm.attackUpdate({id:B.id,attackRequest:t}),z(),X(!1),G(null)}catch(t){E.error({err:t},"Error updating attack");let e=t.message||"Failed to update attack.";if(t.response){let a=t.response.status,n="Could not read error body";try{n=await t.response.text()}catch(e){}e="Update API Error (".concat(a,"): ").concat(n||e)}q("Error Updating Attack",e,"destructive")}finally{D(!1)}},Y=async()=>{let e=J.attack;if(!e||!e.id)return;let t=e.id;P(t),R(null);try{await c.vm.attackDestroy({id:t}),I(e=>e.filter(e=>e.id!==t)),T({open:!1,attack:null})}catch(t){E.error({err:t},"Error deleting attack");let e=t.message||"Failed to delete attack.";if(t.response){let a=t.response.status,n="Could not read error body";try{n=await t.response.text()}catch(e){}e="Delete API Error (".concat(a,"): ").concat(n||e)}R(e)}finally{P(null)}};return((0,r.useEffect)(()=>{!o&&a?z():o||a||(D(!1),I([]),R(null),P(null))},[o,a,z]),o||S&&0===_.length&&!O)?(0,n.jsx)(d.M,{title:"Attacks",description:"Configure and execute adversarial attacks against your AI agents.",children:(0,n.jsx)("div",{className:"border overflow-hidden mx-6",children:(0,n.jsxs)(x.XI,{children:[(0,n.jsx)(x.A0,{children:(0,n.jsxs)(x.Hj,{children:[(0,n.jsx)(x.nd,{children:(0,n.jsx)(g.E,{className:"h-5 w-1/4"})}),(0,n.jsx)(x.nd,{children:(0,n.jsx)(g.E,{className:"h-5 w-1/4"})}),(0,n.jsx)(x.nd,{children:(0,n.jsx)(g.E,{className:"h-5 w-1/4"})}),(0,n.jsx)(x.nd,{className:"text-right",children:(0,n.jsx)(g.E,{className:"h-5 w-1/4"})})]})}),(0,n.jsx)(x.BF,{children:[void 0,void 0,void 0].map((e,t)=>(0,n.jsxs)(x.Hj,{children:[(0,n.jsx)(x.nA,{children:(0,n.jsx)(g.E,{className:"h-5 w-full"})}),(0,n.jsx)(x.nA,{children:(0,n.jsx)(g.E,{className:"h-5 w-full"})}),(0,n.jsx)(x.nA,{children:(0,n.jsx)(g.E,{className:"h-5 w-full"})}),(0,n.jsx)(x.nA,{className:"text-right",children:(0,n.jsx)(g.E,{className:"h-8 w-20"})})]},"skeleton-".concat(t)))})]})})}):(0,n.jsxs)(d.M,{title:"Attacks",description:"Configure and execute adversarial attacks against your AI agents.",action:a&&(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)(v.$,{variant:"outline",onClick:()=>b.push("/attacks/builder"),children:[(0,n.jsx)(y.A,{className:"mr-2 h-4 w-4"})," Build visually"]}),(0,n.jsxs)(v.$,{onClick:K,children:[(0,n.jsx)(y.A,{className:"mr-2 h-4 w-4"})," Create Attack"]})]}),children:[(0,n.jsxs)("div",{className:"px-6 space-y-4",children:[!a&&!o&&(0,n.jsxs)(p.Fc,{className:"mt-4",children:[(0,n.jsx)(j.A,{className:"h-4 w-4"}),(0,n.jsx)(p.XL,{children:"Authentication Required"}),(0,n.jsx)(p.TN,{children:"Please log in to manage attacks."})]}),a&&O&&(0,n.jsxs)(p.Fc,{variant:"destructive",className:"my-4",children:[(0,n.jsx)(j.A,{className:"h-4 w-4"}),(0,n.jsx)(p.XL,{children:"Error"}),(0,n.jsx)(p.TN,{children:O})]}),a&&!S&&0===_.length&&!O&&(0,n.jsx)(u.p,{icon:y.A,title:"No attacks configured",description:"Get started by creating a new attack configuration.",action:(0,n.jsxs)(v.$,{onClick:K,children:[(0,n.jsx)(y.A,{className:"mr-2 h-4 w-4"})," Create Attack"]})}),a&&_.length>0&&(0,n.jsx)("div",{className:"border overflow-hidden",children:(0,n.jsxs)(x.XI,{children:[(0,n.jsx)(x.r6,{children:"A list of your configured attacks."}),(0,n.jsx)(x.A0,{children:(0,n.jsxs)(x.Hj,{children:[(0,n.jsx)(x.nd,{className:"w-[20%]",children:"ID"}),(0,n.jsx)(x.nd,{className:"w-[25%]",children:"Type"}),(0,n.jsx)(x.nd,{className:"w-[25%]",children:"Agent Name"}),(0,n.jsx)(x.nd,{className:"w-[15%]",children:"Created At"}),(0,n.jsx)(x.nd,{className:"text-right w-[15%]",children:"Actions"})]})}),(0,n.jsx)(x.BF,{children:_.map(e=>(0,n.jsxs)(x.Hj,{children:[(0,n.jsx)(x.nA,{className:"font-medium truncate max-w-[100px]",title:e.id,children:e.id}),(0,n.jsx)(x.nA,{children:e.type}),(0,n.jsx)(x.nA,{children:e.agentName}),(0,n.jsx)(x.nA,{children:e.createdAt?new Date(e.createdAt).toLocaleDateString():"N/A"}),(0,n.jsxs)(x.nA,{className:"text-right",children:[(0,n.jsx)(v.$,{variant:"ghost",size:"icon",onClick:()=>(e=>e.id?(0,l._w)(e.type)?void b.push("/attacks/builder?attackId=".concat(e.id)):void(G(e),W({type:e.type||"",agent:e.agent||"",_configuration:JSON.stringify(e._configuration||{},null,2)}),X(!0)):void q("Invalid Attack","Cannot edit attack: ID is missing.","destructive"))(e),className:"mr-2",title:"Edit Attack",disabled:!!F,children:(0,n.jsx)(N.A,{className:"h-4 w-4"})}),(0,n.jsx)(v.$,{variant:"ghost",size:"icon",onClick:()=>(e=>{if(!e.id)return void R("Cannot delete attack: ID missing.");T({open:!0,attack:e})})(e),disabled:F===e.id,title:"Delete Attack",className:F===e.id?"text-destructive":"",children:F===e.id?(0,n.jsx)(f.A,{className:"h-4 w-4 animate-spin"}):(0,n.jsx)(k.A,{className:"h-4 w-4"})})]})]},e.id))})]})})]}),(0,n.jsx)(A.lG,{open:L,onOpenChange:H,children:(0,n.jsxs)(A.Cf,{className:"sm:max-w-[500px]",children:[(0,n.jsxs)(A.c7,{children:[(0,n.jsx)(A.L3,{children:"Create New Attack"}),(0,n.jsx)(A.rr,{children:"Enter the details for your new attack. Click save when you're done."})]}),(0,n.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,n.jsxs)("div",{className:"grid grid-cols-4 items-center gap-4",children:[(0,n.jsx)(C.J,{htmlFor:"type",className:"text-right",children:"Type"}),(0,n.jsx)(w.p,{id:"type",value:U.type,onChange:e=>W({...U,type:e.target.value}),className:"col-span-3",placeholder:"e.g., PREFIX_GENERATION"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-4 items-center gap-4",children:[(0,n.jsx)(C.J,{htmlFor:"agent",className:"text-right",children:"Agent ID"}),(0,n.jsx)(w.p,{id:"agent",value:U.agent,onChange:e=>W({...U,agent:e.target.value}),className:"col-span-3",placeholder:"Enter Agent ID"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-4 items-start gap-4",children:[(0,n.jsx)(C.J,{htmlFor:"configuration",className:"text-right pt-2",children:"Configuration (JSON)"}),(0,n.jsx)("textarea",{id:"configuration",value:U._configuration,onChange:e=>W({...U,_configuration:e.target.value}),className:"col-span-3 h-32 p-2 border rounded-md text-sm font-mono",placeholder:'e.g., { "param1": "value1", "param2": true }'})]})]}),(0,n.jsxs)(A.Es,{children:[(0,n.jsx)(A.HM,{asChild:!0,children:(0,n.jsx)(v.$,{variant:"outline",children:"Cancel"})}),(0,n.jsxs)(v.$,{onClick:Z,disabled:S,children:[S&&L?(0,n.jsx)(f.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save Attack"]})]})]})}),(0,n.jsx)(A.lG,{open:M,onOpenChange:e=>{X(e),e||G(null)},children:(0,n.jsxs)(A.Cf,{className:"sm:max-w-[500px]",children:[(0,n.jsxs)(A.c7,{children:[(0,n.jsxs)(A.L3,{children:["Edit Attack: ",(null==B?void 0:B.id)?B.id.substring(0,8)+"...":""]}),(0,n.jsxs)(A.rr,{children:["Update the details for your attack (Type: ",null==B?void 0:B.type,", Agent: ",null==B?void 0:B.agentName,"). Click save when you're done."]})]}),(0,n.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,n.jsxs)("div",{className:"grid grid-cols-4 items-center gap-4",children:[(0,n.jsx)(C.J,{htmlFor:"edit-type",className:"text-right",children:"Type"}),(0,n.jsx)(w.p,{id:"edit-type",value:U.type,onChange:e=>W({...U,type:e.target.value}),className:"col-span-3"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-4 items-center gap-4",children:[(0,n.jsx)(C.J,{htmlFor:"edit-agent",className:"text-right",children:"Agent ID"}),(0,n.jsx)(w.p,{id:"edit-agent",value:U.agent,onChange:e=>W({...U,agent:e.target.value}),className:"col-span-3",placeholder:"Enter Agent ID"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-4 items-start gap-4",children:[(0,n.jsx)(C.J,{htmlFor:"edit-configuration",className:"text-right pt-2",children:"Configuration (JSON)"}),(0,n.jsx)("textarea",{id:"edit-configuration",value:U._configuration,onChange:e=>W({...U,_configuration:e.target.value}),className:"col-span-3 h-32 p-2 border rounded-md text-sm font-mono"})]})]}),(0,n.jsxs)(A.Es,{children:[(0,n.jsx)(A.HM,{asChild:!0,children:(0,n.jsx)(v.$,{variant:"outline",onClick:()=>{G(null)},children:"Cancel"})}),(0,n.jsxs)(v.$,{onClick:Q,disabled:S,children:[S&&M?(0,n.jsx)(f.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save Changes"]})]})]})}),(0,n.jsx)(m.Lt,{open:$.open,onOpenChange:e=>V({...$,open:e}),children:(0,n.jsxs)(m.EO,{children:[(0,n.jsxs)(m.wd,{children:[(0,n.jsx)(m.r7,{children:$.title}),(0,n.jsx)(m.$v,{children:$.description})]}),(0,n.jsx)(m.ck,{children:(0,n.jsx)(m.Rx,{onClick:()=>V({...$,open:!1}),children:"OK"})})]})}),(0,n.jsx)(h.T,{open:J.open,onOpenChange:e=>T({...J,open:e}),title:"Delete Attack",description:'Are you sure you want to delete attack "'.concat(null==(e=J.attack)?void 0:e.type,'" on agent "').concat(null==(t=J.attack)?void 0:t.agentName,'"? This action cannot be undone.'),onConfirm:Y,confirmText:"Delete",variant:"destructive"})]})}},50803:(e,t,a)=>{"use strict";a.d(t,{A:()=>n});let n=(0,a(71847).A)("terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]])},85408:(e,t,a)=>{"use strict";a.d(t,{b:()=>d});var n=a(12115);a(47650);var r=a(94446),s=a(95155),i=Symbol("radix.slottable");function l(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===i}var c=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let a=function(e){let t=function(e){let t=n.forwardRef((e,t)=>{var a,s,i;let l,c,{children:o,...d}=e,u=n.isValidElement(o)?(c=(l=null==(s=Object.getOwnPropertyDescriptor((a=o).props,"ref"))?void 0:s.get)&&"isReactWarning"in l&&l.isReactWarning)?a.ref:(c=(l=null==(i=Object.getOwnPropertyDescriptor(a,"ref"))?void 0:i.get)&&"isReactWarning"in l&&l.isReactWarning)?a.props.ref:a.props.ref||a.ref:void 0,h=(0,r.s)(u,t);if(n.isValidElement(o)){let e=function(e,t){let a={...t};for(let n in t){let r=e[n],s=t[n];/^on[A-Z]/.test(n)?r&&s?a[n]=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];let n=s(...t);return r(...t),n}:r&&(a[n]=r):"style"===n?a[n]={...r,...s}:"className"===n&&(a[n]=[r,s].filter(Boolean).join(" "))}return{...e,...a}}(d,o.props);return o.type!==n.Fragment&&(e.ref=h),n.cloneElement(o,e)}return n.Children.count(o)>1?n.Children.only(null):null});return t.displayName="".concat(e,".SlotClone"),t}(e),a=n.forwardRef((e,a)=>{let{children:r,...i}=e,c=n.Children.toArray(r),o=c.find(l);if(o){let e=o.props.children,r=c.map(t=>t!==o?t:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,s.jsx)(t,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,r):null})}return(0,s.jsx)(t,{...i,ref:a,children:r})});return a.displayName="".concat(e,".Slot"),a}(`Primitive.${t}`),i=n.forwardRef((e,n)=>{let{asChild:r,...i}=e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(r?a:t,{...i,ref:n})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),o=n.forwardRef((e,t)=>(0,s.jsx)(c.label,{...e,ref:t,onMouseDown:t=>{var a;t.target.closest("button, input, select, textarea")||(null==(a=e.onMouseDown)||a.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));o.displayName="Label";var d=o}},e=>{e.O(0,[187,539,292,924,905,511,441,493,358],()=>e(e.s=3549)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{6259:(e,t,a)=>{"use strict";a.d(t,{SQ:()=>o,_2:()=>c,mB:()=>d,rI:()=>i,ty:()=>l});var n=a(95155);a(12115);var s=a(24595),r=a(64269);function i(e){let{...t}=e;return(0,n.jsx)(s.bL,{"data-slot":"dropdown-menu",...t})}function l(e){let{...t}=e;return(0,n.jsx)(s.l9,{"data-slot":"dropdown-menu-trigger",...t})}function o(e){let{className:t,sideOffset:a=4,...i}=e;return(0,n.jsx)(s.ZL,{children:(0,n.jsx)(s.UC,{"data-slot":"dropdown-menu-content",sideOffset:a,className:(0,r.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...i})})}function c(e){let{className:t,inset:a,variant:i="default",...l}=e;return(0,n.jsx)(s.q7,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":i,className:(0,r.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...l})}function d(e){let{className:t,...a}=e;return(0,n.jsx)(s.wv,{"data-slot":"dropdown-menu-separator",className:(0,r.cn)("bg-border -mx-1 my-1 h-px",t),...a})}},24323:(e,t,a)=>{"use strict";a.d(t,{P:()=>x,T:()=>f});var n=a(95155),s=a(12115),r=a(52619),i=a.n(r),l=a(68321),o=a(76784),c=a(7831),d=a(41444),u=a(3998),h=a(51834);let m=(0,d.h)("AnalyticsConsent");async function f(e){await c.userApi.userMeUpdate({userProfileRequest:{analyticsConsent:e}})}function x(){let[e,t]=(0,s.useState)(null),a=(0,s.useRef)(!1);(0,s.useEffect)(()=>{let e=!1;return c.userApi.userMeRetrieve().then(a=>{var n;e||t(null!=(n=a.analyticsConsent)?n:"unset")}).catch(e=>{m.debug({err:e},"Could not load analytics consent (not authenticated yet?)")}),()=>{e=!0}},[]);let r=async e=>{a.current=!0,t(e);try{await f(e)}catch(e){m.error({err:e},"Failed to save analytics consent")}};return(0,n.jsxs)(n.Fragment,{children:["accepted"===e&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.GoogleAnalytics,{gaId:"G-2P6K2HWVEE"}),(0,n.jsx)(l.default,{id:"microsoft-clarity",strategy:"afterInteractive",children:'(function(c,l,a,r,i,t,y){\n c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};\n t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;\n y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);\n })(window, document, "clarity", "script", "xowemo04qg");'})]}),(0,n.jsx)(h.lG,{open:"unset"===e,onOpenChange:e=>{e||a.current||r("declined")},children:(0,n.jsxs)(h.Cf,{children:[(0,n.jsxs)(h.c7,{children:[(0,n.jsx)(h.L3,{children:"Help us improve HackAgent"}),(0,n.jsxs)(h.rr,{children:["We'd like to use optional analytics to understand how HackAgent is used. This is separate from the cookies that keep you signed in, and you can change it anytime in Settings. See our"," ",(0,n.jsx)(i(),{href:"https://hackagent.dev/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Privacy Policy"}),"."]})]}),(0,n.jsxs)(h.Es,{children:[(0,n.jsx)(u.$,{variant:"outline",onClick:()=>r("declined"),children:"Not now"}),(0,n.jsx)(u.$,{onClick:()=>r("accepted"),children:"Sounds good"})]})]})})]})}},24394:()=>{},25772:(e,t,a)=>{"use strict";a.d(t,{default:()=>H});var n=a(95155),s=a(12115),r=a(52619),i=a.n(r),l=a(80230),o=a(20063),c=a(15239),d=a(3998),u=a(86259),h=a(46591),m=a(64269);function f(e){let{className:t,...a}=e;return(0,n.jsx)(h.bL,{"data-slot":"avatar",className:(0,m.cn)("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...a})}function x(e){let{className:t,...a}=e;return(0,n.jsx)(h._V,{"data-slot":"avatar-image",className:(0,m.cn)("aspect-square size-full",t),...a})}function g(e){let{className:t,...a}=e;return(0,n.jsx)(h.H4,{"data-slot":"avatar-fallback",className:(0,m.cn)("bg-muted flex size-full items-center justify-center rounded-full",t),...a})}var p=a(6259),v=a(46767);let j=(0,s.createContext)(void 0),y=e=>{let{children:t}=e,[a,r]=(0,s.useState)(!1);return(0,n.jsx)(j.Provider,{value:{isCollapsed:a,toggleSidebar:()=>{r(e=>!e)}},children:t})},k=()=>{let e=(0,s.useContext)(j);if(!e)throw Error("useSidebar must be used within a SidebarProvider");return e};var w=a(77931),b=a(26550),N=a(65993),A=a(80534),C=a(78192),_=a(89715),I=a(5370),U=a(47937),L=a(12108),P=a(15870),E=a(84926);let R=()=>{let{user:e,isLoading:t,isAuthenticated:a,logout:s}=(0,l.h)(),r=(0,o.usePathname)(),{isCollapsed:h,toggleSidebar:j}=k();if(t||!a||!e)return null;let y=e.name||e.preferred_username||e.email||"User",R=(e=>{if(!e||""===e.trim())return"?";if(e.startsWith("0x")&&e.length>10)return e.substring(0,2).toUpperCase();let t=e.split(/[\s.\-_@]+/).filter(e=>e.length>0);return 0===t.length?"?":1===t.length?t[0].substring(0,2).toUpperCase():((t[0][0]||"")+(t[t.length-1][0]||"")).toUpperCase()})(y),T=e=>{let{href:t,icon:a,label:s,isActive:r}=e;return(0,n.jsxs)(v.m_,{children:[(0,n.jsx)(v.k$,{asChild:!0,children:(0,n.jsx)(i(),{href:t,children:(0,n.jsxs)(d.$,{variant:r?"secondary":"ghost",className:(0,m.cn)("w-full",h?"justify-center px-2":"justify-start",r&&"font-semibold"),children:[(0,n.jsx)(a,{className:(0,m.cn)("h-4 w-4",!h&&"mr-2")}),!h&&s]})})}),h&&(0,n.jsx)(v.ZI,{side:"right",children:(0,n.jsx)("p",{children:s})})]})};return(0,n.jsx)(v.Bc,{delayDuration:0,children:(0,n.jsxs)("aside",{className:(0,m.cn)("flex h-screen flex-col border-r bg-background p-4 fixed left-0 top-0 transition-all duration-300",h?"w-16":"w-52"),children:[(0,n.jsxs)("div",{className:(0,m.cn)("mb-6 flex",h?"flex-col items-center gap-2 px-0":"flex-row items-center justify-between px-2"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(c.default,{src:"/raccoon.png",alt:"HackAgent Logo",width:24,height:24,className:"text-primary"}),!h&&(0,n.jsx)("h3",{className:"font-semibold text-lg",children:"HackAgent"})]}),(0,n.jsxs)(v.m_,{children:[(0,n.jsx)(v.k$,{asChild:!0,children:(0,n.jsx)(d.$,{variant:"ghost",size:"icon",onClick:j,className:"h-7 w-7 shrink-0",children:h?(0,n.jsx)(w.A,{className:"h-4 w-4"}):(0,n.jsx)(b.A,{className:"h-4 w-4"})})}),(0,n.jsx)(v.ZI,{side:"right",children:(0,n.jsx)("p",{children:h?"Expand sidebar":"Collapse sidebar"})})]})]}),(0,n.jsxs)("nav",{className:(0,m.cn)("flex-1 space-y-4",h?"px-0":"px-2"),children:[(0,n.jsx)("div",{className:"space-y-1",children:(0,n.jsx)(T,{href:"/",icon:N.A,label:"Home",isActive:"/"===r})}),(0,n.jsx)(u.w,{}),(0,n.jsxs)("div",{className:"space-y-1",children:[!h&&(0,n.jsx)("div",{className:"px-2 py-1",children:(0,n.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Analytics"})}),(0,n.jsx)(T,{href:"/stats",icon:A.A,label:"Stats",isActive:"/stats"===r}),(0,n.jsx)(T,{href:"/agents",icon:C.A,label:"Agents",isActive:"/agents"===r}),(0,n.jsx)(T,{href:"/reports",icon:_.A,label:"Reports",isActive:"/reports"===r})]}),(0,n.jsx)(u.w,{}),(0,n.jsxs)("div",{className:"space-y-1",children:[!h&&(0,n.jsx)("div",{className:"px-2 py-1",children:(0,n.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Resources"})}),(0,n.jsx)(T,{href:"/api-keys",icon:I.A,label:"API Keys",isActive:"/api-keys"===r}),(0,n.jsx)(e=>{let{href:t,icon:a,label:s}=e;return(0,n.jsxs)(v.m_,{children:[(0,n.jsx)(v.k$,{asChild:!0,children:(0,n.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"block",children:(0,n.jsxs)(d.$,{variant:"ghost",className:(0,m.cn)("w-full cursor-pointer",h?"justify-center px-2":"justify-start"),children:[(0,n.jsx)(a,{className:(0,m.cn)("h-4 w-4",!h&&"mr-2")}),!h&&s]})})}),h&&(0,n.jsx)(v.ZI,{side:"right",children:(0,n.jsx)("p",{children:s})})]})},{href:"https://docs.hackagent.dev",icon:U.A,label:"Docs"})]})]}),(0,n.jsx)(u.w,{className:"my-4"}),e&&(0,n.jsx)("div",{className:"mt-auto",children:(0,n.jsxs)(p.rI,{children:[(0,n.jsx)(p.ty,{asChild:!0,children:(0,n.jsxs)(d.$,{variant:"ghost",className:(0,m.cn)("w-full p-2 h-auto hover:bg-accent hover:text-accent-foreground",h?"justify-center":"justify-between"),children:[(0,n.jsxs)("div",{className:(0,m.cn)("flex items-center",h?"justify-center":"gap-3"),children:[(0,n.jsxs)(f,{className:"h-8 w-8",children:[e.picture&&(0,n.jsx)(x,{src:e.picture,alt:y}),(0,n.jsx)(g,{children:R})]}),!h&&(0,n.jsxs)("div",{className:"text-sm text-left",children:[(0,n.jsx)("p",{className:"font-medium leading-none truncate max-w-[105px]",children:y}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Account"})]})]}),!h&&(0,n.jsx)(L.A,{className:"h-4 w-4 opacity-50"})]})}),(0,n.jsxs)(p.SQ,{align:"start",className:"w-52 mb-2",side:"top",children:[(0,n.jsx)(p._2,{asChild:!0,children:(0,n.jsxs)(i(),{href:"/profile",className:"cursor-pointer",children:[(0,n.jsx)(P.A,{className:"mr-2 h-4 w-4"}),(0,n.jsx)("span",{children:"Settings"})]})}),(0,n.jsx)(p.mB,{}),s&&(0,n.jsxs)(p._2,{onClick:()=>s(),className:"cursor-pointer text-red-600 focus:text-red-600",children:[(0,n.jsx)(E.A,{className:"mr-2 h-4 w-4"}),(0,n.jsx)("span",{children:"Log Out"})]})]})]})})]})})};var T=a(35299),z=a(63479),S=a(24323);let D=(0,a(41444).h)("ClientLayout"),B=e=>{let{children:t}=e,{isCollapsed:a}=k();return(0,n.jsx)("main",{className:"flex-1 overflow-y-auto transition-all duration-300 ".concat(a?"ml-16":"ml-52"),children:t})},H=e=>{let{children:t}=e,{isAuthenticated:a,isLoading:r,user:i,provider:o}=(0,l.h)();return((0,s.useEffect)(()=>{D.info("ClientLayout initialized - provider=".concat(o,", isLoading=").concat(r,", isAuthenticated=").concat(a))},[o,r,a]),r)?(D.info("Authentication provider loading, showing spinner"),(0,n.jsx)("div",{className:"flex items-center justify-center min-h-screen",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)(T.A,{className:"h-8 w-8 animate-spin text-muted-foreground"}),(0,n.jsx)("p",{className:"text-muted-foreground",children:"Loading Authentication..."})]})})):a?(D.info("User authenticated - provider=".concat(o,", userId=").concat(null==i?void 0:i.sub,", email=").concat(null==i?void 0:i.email)),(0,n.jsx)(z.N,{children:(0,n.jsxs)(y,{children:[(0,n.jsxs)("div",{className:"flex h-screen overflow-hidden print-layout-root",children:[(0,n.jsx)(R,{}),(0,n.jsx)(B,{children:t})]}),(0,n.jsx)(S.P,{})]})})):(D.info("User not authenticated, rendering public view"),(0,n.jsx)(n.Fragment,{children:t}))}},27180:(e,t,a)=>{"use strict";a.d(t,{Authorization:()=>A});var n=a(95155),s=a(67176),r=a(20063),i=a(12115),l=a(34105),o=a(7831),c=a(41444);let d=(0,c.h)("Auth0Adapter");function u(e){let{children:t}=e,{getAccessTokenSilently:r,isAuthenticated:c,isLoading:u,loginWithRedirect:h,logout:m,user:f}=(0,s.WB)(),[x,g]=(0,i.useState)(!1),p=(0,i.useRef)(!1),v=(0,i.useCallback)(async()=>{let e=await r()||"";return(0,o.ki)(e),e},[r]);(0,i.useEffect)(()=>{let e;if(u)return;let t=!1;if(!c){(0,o.ki)(null),g(!0),p.current=!1;return}let n=async()=>{try{if(await v(),!p.current){p.current=!0;let{userApi:e}=await Promise.resolve().then(a.bind(a,7831));e.userMeRetrieve().catch(()=>d.debug("User profile synchronization deferred"))}}catch(e){d.error({err:e},"Unable to obtain Auth0 access token"),(0,o.ki)(null)}finally{t||g(!0)}};return n(),e=setInterval(()=>void n(),6e5),()=>{t=!0,e&&clearInterval(e)}},[c,u,v]);let j=(0,i.useCallback)(async()=>{await h({appState:{returnTo:"/"}})},[h]),y=(0,i.useCallback)(async()=>{(0,o.ki)(null),await m({logoutParams:{returnTo:window.location.origin}})},[m]),k=(0,i.useMemo)(()=>({provider:"auth0",user:f,isAuthenticated:c,isLoading:u||c&&!x,login:j,logout:y,getAccessTokenSilently:v}),[f,c,u,x,j,y,v]);return(0,n.jsx)(l.c.Provider,{value:k,children:t})}function h(e){let{config:t,children:a}=e,l=(0,r.useRouter)(),o=(0,i.useCallback)(e=>{l.push((null==e?void 0:e.returnTo)||"/")},[l]);if(!t.auth0Domain||!t.auth0ClientId||!t.auth0Audience)return(0,n.jsx)(m,{provider:"Auth0"});let c=t.auth0RedirectUri||window.location.origin;return(0,n.jsx)(s.y2,{domain:t.auth0Domain,clientId:t.auth0ClientId,authorizationParams:{redirect_uri:c,audience:t.auth0Audience,scope:"openid profile email"},onRedirectCallback:o,cacheLocation:"localstorage",children:(0,n.jsx)(u,{children:a})})}function m(e){let{provider:t}=e;return(0,n.jsx)("div",{role:"alert",className:"flex min-h-screen items-center justify-center p-6 text-center",children:(0,n.jsxs)("p",{children:[t," authentication is selected but its runtime configuration is incomplete."]})})}let f=async()=>"mock-dev-token";function x(e){let{children:t}=e,[a,s]=(0,i.useState)(!1);(0,i.useEffect)(()=>((0,o.ki)("mock-dev-token"),s(!0),()=>(0,o.ki)(null)),[]);let r=(0,i.useMemo)(()=>({provider:"disabled",user:{email:"dev@hackagent.local",name:"Dev User",preferred_username:"dev",picture:'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><rect fill="%23ccc" width="48" height="48"/><text x="50%25" y="50%25" dominant-baseline="middle" text-anchor="middle" font-family="sans-serif" font-size="24" fill="%23666">D</text></svg>'},isAuthenticated:!0,isLoading:!a,login:void 0,logout:void 0,getAccessTokenSilently:f}),[a]);return(0,n.jsx)(l.c.Provider,{value:r,children:t})}var g=a(5313);let p=(0,c.h)("KeycloakAdapter"),v=async()=>"",j={provider:"keycloak",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:v};function y(e){let{config:t,children:s}=e,[r,c]=(0,i.useState)(j);return((0,i.useEffect)(()=>{let e;if(!t.keycloakRealmUrl||!t.keycloakClientId)return;let n=new URL(t.keycloakRealmUrl),s="/realms/",r=n.pathname.indexOf(s),i=r>=0?"".concat(n.origin).concat(n.pathname.slice(0,r)):n.origin,l=r>=0?n.pathname.slice(r+s.length).split("/")[0]:n.pathname.split("/").filter(Boolean).at(-1)||"hackagent",d=new g.A({url:i,realm:l,clientId:t.keycloakClientId}),u=!1,h=async()=>{await d.updateToken(60);let e=d.token||"";return(0,o.ki)(e||null),e};return(async()=>{try{var t,n,s,r,i;let l=await d.init({onLoad:"login-required",silentCheckSsoRedirectUri:"".concat(window.location.origin,"/silent-check-sso.html"),pkceMethod:"S256"});if(u)return;if(!l){(0,o.ki)(null),c({provider:"keycloak",user:void 0,isAuthenticated:!1,isLoading:!1,login:async()=>{await d.login()},logout:void 0,getAccessTokenSilently:v});return}let m={sub:d.subject,email:null==(t=d.tokenParsed)?void 0:t.email,name:null==(n=d.tokenParsed)?void 0:n.name,given_name:null==(s=d.tokenParsed)?void 0:s.given_name,family_name:null==(r=d.tokenParsed)?void 0:r.family_name,preferred_username:null==(i=d.tokenParsed)?void 0:i.preferred_username};await h();let{userApi:f}=await Promise.resolve().then(a.bind(a,7831));f.userMeRetrieve().catch(()=>p.debug("User profile synchronization deferred")),c({provider:"keycloak",user:m,isAuthenticated:!0,isLoading:!1,login:async()=>{await d.login()},logout:async()=>{(0,o.ki)(null),await d.logout({redirectUri:window.location.origin})},getAccessTokenSilently:h}),e=setInterval(()=>{h().catch(e=>p.error({err:e},"Unable to refresh Keycloak access token"))},3e4)}catch(e){p.error({err:e},"Keycloak initialization failed"),(0,o.ki)(null),u||c({...j,isLoading:!1})}})(),()=>{u=!0,e&&clearInterval(e),(0,o.ki)(null)}},[t.keycloakClientId,t.keycloakRealmUrl]),t.keycloakRealmUrl&&t.keycloakClientId)?(0,n.jsx)(l.c.Provider,{value:r,children:s}):(0,n.jsx)("div",{role:"alert",className:"flex min-h-screen items-center justify-center p-6 text-center",children:(0,n.jsx)("p",{children:"Keycloak authentication is selected but its runtime configuration is incomplete."})})}function k(e){return{authProvider:e.disableAuth?"disabled":"auth0"===e.authProvider||"keycloak"===e.authProvider||"disabled"===e.authProvider?e.authProvider:e.auth0Domain&&e.auth0ClientId?"auth0":"keycloak",auth0Domain:e.auth0Domain||"",auth0ClientId:e.auth0ClientId||"",auth0Audience:e.auth0Audience||"",auth0RedirectUri:e.auth0RedirectUri||"",keycloakRealmUrl:e.keycloakRealmUrl||"",keycloakClientId:e.keycloakClientId||"",apiUrl:e.apiUrl||""}}a(95704);var w=a(95704);let b=(0,c.h)("useRuntimeConfig"),N=k({authProvider:w.env.NEXT_PUBLIC_AUTH_PROVIDER,auth0Domain:w.env.NEXT_PUBLIC_AUTH0_DOMAIN,auth0ClientId:w.env.NEXT_PUBLIC_AUTH0_CLIENT_ID,auth0Audience:w.env.NEXT_PUBLIC_AUTH0_AUDIENCE,auth0RedirectUri:w.env.NEXT_PUBLIC_AUTH0_REDIRECT_URI,keycloakRealmUrl:w.env.NEXT_PUBLIC_KEYCLOAK_REALM_URL||"",keycloakClientId:w.env.NEXT_PUBLIC_KEYCLOAK_CLIENT_ID||"",apiUrl:w.env.NEXT_PUBLIC_API_URL||"",disableAuth:!0});function A(e){let{children:t}=e,{config:a,isLoading:s}=function(){let[e,t]=(0,i.useState)(N),[a,n]=(0,i.useState)(!0);return(0,i.useEffect)(()=>{(async()=>{try{let e=await fetch("/config.json");if(!e.ok)throw Error("Failed to load config: ".concat(e.status));let a=k(await e.json());b.info("Runtime config loaded successfully"),t(a)}catch(e){b.warn("Failed to load runtime config, using build-time defaults"),t(N)}finally{n(!1)}})()},[]),{config:e,isLoading:a}}();if(s)return null;switch(a.authProvider){case"auth0":return(0,n.jsx)(h,{config:a,children:t});case"keycloak":return(0,n.jsx)(y,{config:a,children:t});case"disabled":return(0,n.jsx)(x,{children:t})}}},34105:(e,t,a)=>{"use strict";a.d(t,{c:()=>n});let n=(0,a(12115).createContext)(void 0)},46767:(e,t,a)=>{"use strict";a.d(t,{Bc:()=>i,ZI:()=>c,k$:()=>o,m_:()=>l});var n=a(95155);a(12115);var s=a(53583),r=a(64269);function i(e){let{delayDuration:t=0,...a}=e;return(0,n.jsx)(s.Kq,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function l(e){let{...t}=e;return(0,n.jsx)(i,{children:(0,n.jsx)(s.bL,{"data-slot":"tooltip",...t})})}function o(e){let{...t}=e;return(0,n.jsx)(s.l9,{"data-slot":"tooltip-trigger",...t})}function c(e){let{className:t,sideOffset:a=0,children:i,...l}=e;return(0,n.jsx)(s.ZL,{children:(0,n.jsxs)(s.UC,{"data-slot":"tooltip-content",sideOffset:a,className:(0,r.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...l,children:[i,(0,n.jsx)(s.i3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}},51834:(e,t,a)=>{"use strict";a.d(t,{Cf:()=>u,Es:()=>m,HM:()=>c,L3:()=>f,c7:()=>h,lG:()=>l,rr:()=>x});var n=a(95155);a(12115);var s=a(88292),r=a(65229),i=a(64269);function l(e){let{...t}=e;return(0,n.jsx)(s.bL,{"data-slot":"dialog",...t})}function o(e){let{...t}=e;return(0,n.jsx)(s.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{...t}=e;return(0,n.jsx)(s.bm,{"data-slot":"dialog-close",...t})}function d(e){let{className:t,...a}=e;return(0,n.jsx)(s.hJ,{"data-slot":"dialog-overlay",className:(0,i.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function u(e){let{className:t,children:a,...l}=e;return(0,n.jsxs)(o,{"data-slot":"dialog-portal",children:[(0,n.jsx)(d,{}),(0,n.jsxs)(s.UC,{"data-slot":"dialog-content",className:(0,i.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...l,children:[a,(0,n.jsxs)(s.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,n.jsx)(r.A,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function h(e){let{className:t,...a}=e;return(0,n.jsx)("div",{"data-slot":"dialog-header",className:(0,i.cn)("flex flex-col gap-2 text-center sm:text-left",t),...a})}function m(e){let{className:t,...a}=e;return(0,n.jsx)("div",{"data-slot":"dialog-footer",className:(0,i.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function f(e){let{className:t,...a}=e;return(0,n.jsx)(s.hE,{"data-slot":"dialog-title",className:(0,i.cn)("text-lg leading-none font-semibold",t),...a})}function x(e){let{className:t,...a}=e;return(0,n.jsx)(s.VY,{"data-slot":"dialog-description",className:(0,i.cn)("text-muted-foreground text-sm",t),...a})}},63479:(e,t,a)=>{"use strict";a.d(t,{D:()=>i,N:()=>c});var n=a(95155),s=a(12115);let r=(0,s.createContext)({theme:"system",resolvedTheme:"light",setTheme:()=>{}});function i(){return(0,s.useContext)(r)}let l="hackagent-theme";function o(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function c(e){let{children:t}=e,[a,i]=(0,s.useState)("system"),[c,d]=(0,s.useState)("light"),u=e=>{let t=document.documentElement;"dark"===e?t.classList.add("dark"):t.classList.remove("dark")};return(0,s.useEffect)(()=>{var e;let t=null!=(e=localStorage.getItem(l))?e:"system";i(t);let a="system"===t?o():t;d(a),u(a)},[]),(0,s.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{if("system"===a){let e=o();d(e),u(e)}};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[a]),(0,n.jsx)(r.Provider,{value:{theme:a,resolvedTheme:c,setTheme:e=>{localStorage.setItem(l,e),i(e);let t="system"===e?o():e;d(t),u(t)}},children:t})}},75377:(e,t,a)=>{Promise.resolve().then(a.bind(a,27180)),Promise.resolve().then(a.bind(a,25772)),Promise.resolve().then(a.t.bind(a,93836,23))},80230:(e,t,a)=>{"use strict";a.d(t,{h:()=>i});var n=a(12115),s=a(34105);let r=async()=>"";function i(){let e=(0,n.useContext)(s.c);return e||{provider:"disabled",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:r}}},86259:(e,t,a)=>{"use strict";a.d(t,{w:()=>i});var n=a(95155);a(12115);var s=a(57268),r=a(64269);function i(e){let{className:t,orientation:a="horizontal",decorative:i=!0,...l}=e;return(0,n.jsx)(s.b,{"data-slot":"separator-root",decorative:i,orientation:a,className:(0,r.cn)("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...l})}},91903:()=>{},93836:()=>{}},e=>{e.O(0,[475,330,187,539,292,619,8,9,391,921,959,924,441,493,358],()=>e(e.s=75377)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[345],{47298:(e,s,_)=>{Promise.resolve().then(_.t.bind(_,52619,23))}},e=>{e.O(0,[619,441,493,358],()=>e(e.s=47298)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{11647:(e,t,s)=>{"use strict";s.d(t,{E:()=>c});var a=s(95155);s(12115);var n=s(32467),r=s(83101),l=s(64269);let i=(0,r.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function c(e){let{className:t,variant:s,asChild:r=!1,...c}=e,o=r?n.DX:"span";return(0,a.jsx)(o,{"data-slot":"badge",className:(0,l.cn)(i({variant:s}),t),...c})}},13406:(e,t,s)=>{"use strict";s.d(t,{Xi:()=>c,av:()=>o,j7:()=>i,tU:()=>l});var a=s(95155);s(12115);var n=s(49543),r=s(64269);function l(e){let{className:t,...s}=e;return(0,a.jsx)(n.bL,{"data-slot":"tabs",className:(0,r.cn)("flex flex-col gap-2",t),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)(n.B8,{"data-slot":"tabs-list",className:(0,r.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...s})}function c(e){let{className:t,...s}=e;return(0,a.jsx)(n.l9,{"data-slot":"tabs-trigger",className:(0,r.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 hover:bg-background/50 dark:hover:bg-input/20 data-[state=active]:hover:bg-background dark:data-[state=active]:hover:bg-input/30",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)(n.UC,{"data-slot":"tabs-content",className:(0,r.cn)("flex-1 outline-none",t),...s})}},17037:(e,t,s)=>{"use strict";s.d(t,{$:()=>i,F:()=>l});var a=s(95155);s(12115);var n=s(47397),r=s(64269);function l(e){let{className:t,children:s,...l}=e;return(0,a.jsxs)(n.bL,{"data-slot":"scroll-area",className:(0,r.cn)("relative",t),...l,children:[(0,a.jsx)(n.LM,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:s}),(0,a.jsx)(i,{}),(0,a.jsx)(n.OK,{})]})}function i(e){let{className:t,orientation:s="vertical",...l}=e;return(0,a.jsx)(n.VM,{"data-slot":"scroll-area-scrollbar",orientation:s,className:(0,r.cn)("flex touch-none p-px transition-colors select-none","vertical"===s&&"h-full w-2.5 border-l border-l-transparent","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent",t),...l,children:(0,a.jsx)(n.lr,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}},20243:(e,t,s)=>{"use strict";s.d(t,{E:()=>r});var a=s(95155),n=s(64269);function r(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"skeleton",className:(0,n.cn)("bg-accent animate-pulse rounded-md",t),...s})}},22470:(e,t,s)=>{"use strict";s.d(t,{M:()=>n});var a=s(95155);s(12115);let n=e=>{let{title:t,description:s,action:n,children:r,maxWidth:l="full"}=e;return(0,a.jsxs)("div",{className:"w-full ".concat({full:"max-w-full","8xl":"max-w-[90rem]","7xl":"max-w-7xl","6xl":"max-w-6xl","5xl":"max-w-5xl","4xl":"max-w-4xl","3xl":"max-w-3xl","2xl":"max-w-2xl"}[l]||"max-w-full"," mx-auto py-6 space-y-6"),children:[t&&(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 px-6 pb-5 border-b",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:t}),s&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:s})]}),n&&(0,a.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:n})]}),r]})}},29147:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>q});var a=s(95155),n=s(80230),r=s(12115),l=s(3998),i=s(86948),c=s(11647),o=s(13406),d=s(20243),m=s(17037),u=s(22470),x=s(52619),h=s.n(x),g=s(10281),p=s(56373),f=s(69386),j=s(26265),v=s(96324),b=s(68425),N=s(47734),k=s(73697),y=s(33420),w=s(86618),A=s(78192),E=s(52987),L=s(52056),S=s(7831),_=s(50113),C=s(63479),M=s(41444),R=s(87066),D=s(35795);function O(e){let{targets:t,runs:s,jailbreaks:n}=e,r=[{label:"Targets",value:t,icon:A.A,href:"/agents"},{label:"Runs",value:s,icon:R.A,href:"/stats"},{label:"Jailbreaks",value:n,icon:D.A,href:"/stats"}];return(0,a.jsx)("div",{className:"grid grid-cols-3 gap-4",children:r.map(e=>{let{label:t,value:s,icon:n,href:r}=e;return(0,a.jsx)(h(),{href:r,className:"group",children:(0,a.jsx)(i.Zp,{className:"transition-colors group-hover:bg-muted/40",children:(0,a.jsxs)(i.Wu,{className:"p-4",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:t}),(0,a.jsx)("span",{className:"flex h-8 w-8 items-center justify-center rounded-md border bg-muted/40 text-muted-foreground transition-colors group-hover:text-foreground",children:(0,a.jsx)(n,{className:"h-4 w-4"})})]}),(0,a.jsx)("span",{className:"text-3xl font-semibold tracking-tight tabular-nums",children:s})]})})},t)})})}var I=s(37397),T=s(80534);let z=[{icon:A.A,title:"Add a target agent",description:"Connect the AI agent you want to probe for vulnerabilities.",cta:"Add target",href:"/agents"},{icon:I.A,title:"Build an attack",description:"Configure jailbreak and red-team techniques to run against it.",cta:"Build attack",href:"/attacks"},{icon:T.A,title:"Review results",description:"See which attacks succeeded and read the risk reports.",cta:"View results",href:"/stats"}];function G(){return(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)(i.aR,{children:[(0,a.jsx)(i.ZB,{className:"text-lg",children:"Get started with HackAgent"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Three steps to your first agent security report."})]}),(0,a.jsx)(i.Wu,{children:(0,a.jsx)("ol",{className:"grid gap-4 md:grid-cols-3",children:z.map((e,t)=>{let{icon:s,title:n,description:r,cta:i,href:c}=e;return(0,a.jsxs)("li",{className:"flex flex-col gap-3 rounded-lg border bg-muted/20 p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full border bg-background text-xs font-semibold tabular-nums text-muted-foreground",children:t+1}),(0,a.jsx)(s,{className:"h-4 w-4 text-muted-foreground"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h3",{className:"text-sm font-medium",children:n}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:r})]}),(0,a.jsx)(l.$,{asChild:!0,variant:"outline",size:"sm",className:"mt-auto w-full",children:(0,a.jsxs)(h(),{href:c,children:[i,(0,a.jsx)(E.A,{className:"h-3.5 w-3.5"})]})})]},n)})})})]})}let H=(0,M.h)("HomeStats"),K={total:0,jailbreaks:0,mitigated:0,errors:0,pending:0};function P(e){return e.reduce((e,t)=>{var s,a,n,r,l;return{total:e.total+(null!=(s=t.totalResults)?s:0),jailbreaks:e.jailbreaks+(null!=(a=t.successfulJailbreaks)?a:0),mitigated:e.mitigated+(null!=(n=t.failedJailbreaks)?n:0),errors:e.errors+(null!=(r=t.errors)?r:0),pending:e.pending+(null!=(l=t.notEvaluated)?l:0)}},{...K})}function B(){let{hideEmptyState:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{resolvedTheme:t}=(0,C.D)(),s="dark"===t,n=s?_.xk:_.Ez,l=s?"#3f3f46":"#e5e7eb",[o,m]=(0,r.useState)(!0),[u,x]=(0,r.useState)([]),[M,R]=(0,r.useState)(0),[D,I]=(0,r.useState)(0),[T,z]=(0,r.useState)(0),[B,W]=(0,r.useState)("—"),[Z,F]=(0,r.useState)(K);(0,r.useEffect)(()=>{let e=!1;return(async()=>{m(!0);try{var t,s;let a=await S.ME.runList({page:1,pageSize:100});if(e)return;let n=null!=(t=a.results)?t:[],r=P(n),l=new Set(n.map(e=>e.agent).filter(Boolean));R(null!=(s=a.count)?s:n.length),I(l.size),z(r.jailbreaks),x(n.slice(0,5));let i=n[0];if(!i){W("—"),F(K);return}W(i.agentName||"".concat(i.agent.slice(0,8),"…")),F(P(n.filter(e=>e.agent===i.agent)))}catch(t){e||H.error({err:t},"Failed to load home stats")}finally{e||m(!1)}})(),()=>{e=!0}},[]);let J=(0,r.useMemo)(()=>0===Z.total?0:Math.round(100*Z.jailbreaks/Z.total),[Z]),U=Z.total>0,{level:V,label:X}=U?J>=70?{level:"critical",label:"Critical"}:J>=40?{level:"high",label:"High"}:J>=10?{level:"medium",label:"Medium"}:{level:"low",label:"Low"}:{level:"low",label:"No data"},$=_.xv[V],q=(0,r.useMemo)(()=>[{name:"Jailbreaks",value:Z.jailbreaks,color:n.vulnerable},{name:"Mitigated",value:Z.mitigated,color:n.safe},{name:"Errors",value:Z.errors,color:n.error},{name:"Pending",value:Z.pending,color:n.pending}],[Z,n]);return o?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"grid grid-cols-3 gap-4",children:[0,1,2].map(e=>(0,a.jsx)(d.E,{className:"h-24 w-full"},e))}),(0,a.jsx)(d.E,{className:"h-56 w-full"})]}):0===M?e?null:(0,a.jsx)(G,{}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(O,{targets:D,runs:M,jailbreaks:T}),(0,a.jsxs)(i.Zp,{children:[(0,a.jsx)(i.aR,{className:"pb-2",children:(0,a.jsxs)(i.ZB,{className:"text-lg flex flex-wrap items-center gap-2",children:["Latest Target Statistics",(0,a.jsxs)(c.E,{variant:"secondary",className:"font-mono font-normal gap-1",children:[(0,a.jsx)(A.A,{className:"h-3 w-3"}),B]})]})}),(0,a.jsx)(i.Wu,{children:U?(0,a.jsxs)("div",{className:"grid gap-6 md:grid-cols-2 items-center",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium self-start",children:"Risk Overview"}),(0,a.jsxs)(g.r,{width:200,height:180,children:[(0,a.jsxs)(p.Fq,{data:[{name:"Risk",value:J,color:$},{name:"Remaining",value:100-J,color:l}],cx:100,cy:90,innerRadius:58,outerRadius:82,startAngle:90,endAngle:-270,dataKey:"value",isAnimationActive:!1,children:[(0,a.jsx)(f.f,{fill:$}),(0,a.jsx)(f.f,{fill:l})]}),(0,a.jsxs)("text",{x:100,y:84,textAnchor:"middle",fontSize:26,fontWeight:700,fill:$,children:[J,"%"]}),(0,a.jsx)("text",{x:100,y:106,textAnchor:"middle",fontSize:12,fill:$,children:X})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"Result Distribution"}),(0,a.jsx)(j.u,{width:"100%",height:150,children:(0,a.jsxs)(v.E,{data:q,margin:{top:8,right:8,left:-16,bottom:0},children:[(0,a.jsx)(b.d,{vertical:!1,strokeDasharray:"3 3",stroke:s?"rgba(255,255,255,0.12)":"#e5e7eb"}),(0,a.jsx)(N.W,{dataKey:"name",tick:{fontSize:11},axisLine:!1,tickLine:!1}),(0,a.jsx)(k.h,{allowDecimals:!1,tick:{fontSize:11},axisLine:!1,tickLine:!1}),(0,a.jsx)(y.m,{wrapperStyle:{fontSize:12},cursor:{fill:"rgba(0,0,0,0.04)"}}),(0,a.jsx)(w.yP,{dataKey:"value",radius:[4,4,0,0],isAnimationActive:!1,children:q.map(e=>(0,a.jsx)(f.f,{fill:e.color},e.name))})]})}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:[Z.total," total results"]})]})]}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground py-6 text-center",children:"No evaluated results for this target yet."})})]}),(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)(i.aR,{className:"pb-2 flex-row items-center justify-between",children:[(0,a.jsx)(i.ZB,{className:"text-base",children:"Recent Runs"}),(0,a.jsxs)(h(),{href:"/stats",className:"text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",children:["View all ",(0,a.jsx)(E.A,{className:"h-3 w-3"})]})]}),(0,a.jsx)(i.Wu,{className:"p-0",children:(0,a.jsx)("div",{className:"divide-y",children:u.map(e=>{var t,s;return(0,a.jsxs)(h(),{href:"/stats",className:"flex items-center justify-between gap-3 px-4 py-2.5 hover:bg-muted/50 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsxs)("span",{className:"font-mono text-xs text-muted-foreground shrink-0",children:[e.id.slice(0,8),"…"]}),(0,a.jsx)("span",{className:"text-sm truncate",children:e.agentName||"—"}),e.attackType&&(0,a.jsx)(c.E,{variant:"outline",className:"text-xs shrink-0",children:e.attackType})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(null!=(t=e.successfulJailbreaks)?t:0)>0&&(0,a.jsxs)("span",{className:"flex items-center gap-1 text-xs",style:{color:_.Ez.vulnerable},children:[(0,a.jsx)(L.A,{className:"h-3 w-3"}),e.successfulJailbreaks]}),(0,a.jsx)(c.E,{variant:function(e){switch(e){case"COMPLETED":return"default";case"FAILED":return"destructive";case"RUNNING":return"secondary";default:return"outline"}}(e.status),className:"text-xs",children:null!=(s=e.status)?s:"PENDING"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right",children:function(e){if(!e)return"—";let t=Math.round((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let s=Math.round(t/60);if(s<60)return"".concat(s,"m ago");let a=Math.round(s/60);if(a<24)return"".concat(a,"h ago");let n=Math.round(a/24);if(n<30)return"".concat(n,"d ago");let r=Math.round(n/30);return r<12?"".concat(r,"mo ago"):"".concat(Math.round(r/12),"y ago")}(e.timestamp)})]})]},e.id)})})})]})]})}var W=s(17910),Z=s(28150),F=s(50803),J=s(61362),U=s(75426),V=s(89715),X=s(85921);let $={google_adk:{name:"Google ADK",description:"Test a Google Agent Development Kit agent for jailbreaking and prompt injection. HackAgent sends adversarial goals via the ADK protocol and uses an LLM judge to evaluate whether safety guardrails were bypassed.",installCmd:"pip install hackagent",sdkCode:'from hackagent import HackAgent\n\nagent = HackAgent(\n name="my_adk_agent",\n endpoint="http://localhost:8000",\n agent_type="google-adk",\n)\n\nresults = agent.hack(attack_config={\n "attack_type": "advprefix",\n "goals": ["Bypass the agent\'s safety guidelines"],\n "generator": {\n "identifier": "gpt-4o-mini",\n "endpoint": "https://api.openai.com/v1",\n },\n "judges": [{\n "identifier": "gpt-4o-mini",\n "endpoint": "https://api.openai.com/v1",\n "type": "harmbench",\n }],\n})',riskAreas:["Jailbreaking","Prompt Injection","Goal Hijacking"]},openai_sdk:{name:"OpenAI SDK",description:"Test any OpenAI-compatible endpoint — including custom deployments, Azure OpenAI, or local models via LM Studio. HackAgent runs adversarial attack campaigns and streams results to your dashboard.",installCmd:"pip install hackagent",sdkCode:'from hackagent import HackAgent\n\nagent = HackAgent(\n name="my_openai_agent",\n endpoint="http://localhost:8000/v1", # /v1 base path\n agent_type="openai-sdk",\n)\n\nresults = agent.hack(attack_config={\n "attack_type": "pair",\n "goals": ["Extract system prompt", "Ignore previous instructions"],\n "generator": {\n "identifier": "gpt-4o-mini",\n "endpoint": "https://api.openai.com/v1",\n },\n "judges": [{\n "identifier": "gpt-4o-mini",\n "endpoint": "https://api.openai.com/v1",\n "type": "harmbench",\n }],\n})',riskAreas:["System Prompt Extraction","Instruction Override","Data Leakage"]},litellm:{name:"LiteLLM / Ollama",description:"Test any local or remote model via LiteLLM or Ollama — including Llama, Mistral, Gemma, and more. Run full jailbreak evaluations entirely offline with no external API dependencies.",installCmd:"pip install hackagent",sdkCode:'from hackagent import HackAgent\n\n# Ollama example — runs fully locally\nagent = HackAgent(\n name="llama3",\n endpoint="http://localhost:11434",\n agent_type="ollama",\n)\n\nresults = agent.hack(attack_config={\n "attack_type": "advprefix",\n "dataset": {"preset": "harmbench", "limit": 50},\n "generator": {\n "identifier": "llama2-uncensored",\n "endpoint": "http://localhost:11434",\n "agent_type": "ollama",\n },\n "judges": [{\n "identifier": "llama2-uncensored",\n "endpoint": "http://localhost:11434",\n "agent_type": "ollama",\n "type": "harmbench",\n }],\n})',riskAreas:["Jailbreaking","Safety Guardrail Bypass","Harmful Content Generation"]}};function q(){let{user:e,isAuthenticated:t,isLoading:s,login:x}=(0,n.h)(),[g,p]=(0,r.useState)("google_adk"),[f,j]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(t||s||!x)return;let e=new URLSearchParams(window.location.search);e.has("code")&&e.has("state")||x()},[s,t,x]);let v=(e,t)=>{navigator.clipboard.writeText(e),j(t),setTimeout(()=>j(null),2e3)};if(s)return(0,a.jsx)(u.M,{title:"Welcome",children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(d.E,{className:"h-8 w-64 mx-auto"}),(0,a.jsx)(d.E,{className:"h-5 w-96 mx-auto"})]}),(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)(i.aR,{children:[(0,a.jsx)(d.E,{className:"h-6 w-48"}),(0,a.jsx)(d.E,{className:"h-4 w-72"})]}),(0,a.jsxs)(i.Wu,{className:"space-y-4",children:[(0,a.jsx)(d.E,{className:"h-10 w-full"}),(0,a.jsx)(d.E,{className:"h-32 w-full"}),(0,a.jsx)(d.E,{className:"h-32 w-full"})]})]})]})});if(!t)return null;let b=$[g];return(0,a.jsx)(u.M,{maxWidth:"5xl",children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"text-center space-y-2",children:[(0,a.jsxs)("h1",{className:"text-3xl font-bold",children:["Welcome, ",e&&(e.name||e.preferred_username||e.nickname||e.email)||"User","!"]}),(0,a.jsx)("p",{className:"text-lg text-muted-foreground",children:"Get a security risk assessment for your AI agent in minutes"})]}),(0,a.jsx)(B,{hideEmptyState:!0}),(0,a.jsxs)(i.Zp,{className:"shadow-lg",children:[(0,a.jsxs)(i.aR,{className:"pb-4",children:[(0,a.jsxs)(i.ZB,{className:"text-xl flex items-center gap-2",children:[(0,a.jsx)(W.A,{className:"h-5 w-5 text-primary"}),"Quick Start: Run Your First Attack"]}),(0,a.jsx)(i.BT,{children:"Select your agent framework, then copy the Python snippet to get started"})]}),(0,a.jsx)(i.Wu,{className:"space-y-6",children:(0,a.jsxs)(o.tU,{value:g,onValueChange:e=>p(e),className:"w-full",children:[(0,a.jsxs)(o.j7,{className:"grid w-full grid-cols-3",children:[(0,a.jsxs)(o.Xi,{value:"google_adk",className:"gap-2",children:[(0,a.jsx)(A.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Google ADK"})]}),(0,a.jsxs)(o.Xi,{value:"openai_sdk",className:"gap-2",children:[(0,a.jsx)(Z.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"OpenAI SDK"})]}),(0,a.jsxs)(o.Xi,{value:"litellm",className:"gap-2",children:[(0,a.jsx)(F.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"LiteLLM / Ollama"})]})]}),(0,a.jsxs)(o.av,{value:g,className:"mt-4 space-y-6",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground bg-muted/50 p-3 rounded-lg",children:b.description}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(c.E,{variant:"default",className:"h-7 w-7 rounded-full p-0 flex items-center justify-center",children:"1"}),(0,a.jsx)("h3",{className:"font-semibold",children:"Install HackAgent"}),(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>v(b.installCmd,"install"),children:"install"===f?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(J.A,{className:"h-4 w-4 text-green-500 mr-1"}),"Copied!"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(U.A,{className:"h-4 w-4 mr-1"}),"Copy"]})})]}),(0,a.jsx)("div",{className:"ml-10 bg-muted rounded-lg p-4 font-mono text-xs",children:(0,a.jsx)("pre",{children:b.installCmd})})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(c.E,{variant:"secondary",className:"h-7 w-7 rounded-full p-0 flex items-center justify-center",children:"2"}),(0,a.jsx)("h3",{className:"font-semibold",children:"Configure and run the attack"}),(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>v(b.sdkCode,"sdk"),children:"sdk"===f?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(J.A,{className:"h-4 w-4 text-green-500 mr-1"}),"Copied!"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(U.A,{className:"h-4 w-4 mr-1"}),"Copy"]})})]}),(0,a.jsx)(m.F,{className:"ml-10",children:(0,a.jsx)("div",{className:"bg-muted rounded-lg p-4 font-mono text-xs overflow-x-auto",children:(0,a.jsx)("pre",{children:b.sdkCode})})})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(c.E,{variant:"outline",className:"h-7 w-7 rounded-full p-0 flex items-center justify-center",children:"3"}),(0,a.jsx)("h3",{className:"font-semibold",children:"Review your risk report"})]}),(0,a.jsxs)("div",{className:"ml-10 space-y-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"Vulnerabilities tested:"}),b.riskAreas.map(e=>(0,a.jsxs)(c.E,{variant:"secondary",className:"flex items-center gap-1",children:[(0,a.jsx)(L.A,{className:"h-3 w-3"}),e]},e))]}),(0,a.jsxs)("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(V.A,{className:"h-4 w-4"}),"Vulnerability summary"]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(T.A,{className:"h-4 w-4"}),"Attack success rates"]})]})]})]}),(0,a.jsxs)("div",{className:"pt-4 border-t flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Ready to test your agent?"}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)(h(),{href:"/agents",children:(0,a.jsxs)(l.$,{variant:"outline",children:[(0,a.jsx)(A.A,{className:"h-4 w-4"}),"Configure Agent"]})}),(0,a.jsx)(h(),{href:"/reports",children:(0,a.jsxs)(l.$,{children:[(0,a.jsx)(X.A,{className:"h-4 w-4"}),"View Reports",(0,a.jsx)(E.A,{className:"h-4 w-4"})]})})]})]})]})]})})]})]})})}},34105:(e,t,s)=>{"use strict";s.d(t,{c:()=>a});let a=(0,s(12115).createContext)(void 0)},50113:(e,t,s)=>{"use strict";s.d(t,{CG:()=>i,Ez:()=>a,JX:()=>l,xk:()=>n,xv:()=>r});let a={vulnerable:"#ef4444",safe:"#22c55e",error:"#f59e0b",pending:"#94a3b8"},n={vulnerable:"#f87171",safe:"#4ade80",error:"#fbbf24",pending:"#cbd5e1"},r={low:"#22c55e",medium:"#eab308",high:"#f97316",critical:"#ef4444"},l={LITELLM:"LiteLLM",OPENAI_SDK:"OpenAI SDK / API",GOOGLE_ADK:"Google ADK",OTHER:"Other / Proprietary",UNKNOWN:"Unknown"},i=new Set(["attack_type","generator"])},63479:(e,t,s)=>{"use strict";s.d(t,{D:()=>l,N:()=>o});var a=s(95155),n=s(12115);let r=(0,n.createContext)({theme:"system",resolvedTheme:"light",setTheme:()=>{}});function l(){return(0,n.useContext)(r)}let i="hackagent-theme";function c(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function o(e){let{children:t}=e,[s,l]=(0,n.useState)("system"),[o,d]=(0,n.useState)("light"),m=e=>{let t=document.documentElement;"dark"===e?t.classList.add("dark"):t.classList.remove("dark")};return(0,n.useEffect)(()=>{var e;let t=null!=(e=localStorage.getItem(i))?e:"system";l(t);let s="system"===t?c():t;d(s),m(s)},[]),(0,n.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{if("system"===s){let e=c();d(e),m(e)}};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[s]),(0,a.jsx)(r.Provider,{value:{theme:s,resolvedTheme:o,setTheme:e=>{localStorage.setItem(i,e),l(e);let t="system"===e?c():e;d(t),m(t)}},children:t})}},65761:(e,t,s)=>{Promise.resolve().then(s.bind(s,29147))},80230:(e,t,s)=>{"use strict";s.d(t,{h:()=>l});var a=s(12115),n=s(34105);let r=async()=>"";function l(){let e=(0,a.useContext)(n.c);return e||{provider:"disabled",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:r}}},86948:(e,t,s)=>{"use strict";s.d(t,{BT:()=>c,Wu:()=>o,ZB:()=>i,Zp:()=>r,aR:()=>l});var a=s(95155);s(12115);var n=s(64269);function r(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,n.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded border py-6",t),...s})}function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,n.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,n.cn)("leading-none font-semibold",t),...s})}function c(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,n.cn)("text-muted-foreground text-sm",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,n.cn)("px-6",t),...s})}}},e=>{e.O(0,[187,619,144,855,532,641,816,924,441,493,358],()=>e(e.s=65761)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[636],{11647:(e,t,s)=>{"use strict";s.d(t,{E:()=>d});var a=s(95155);s(12115);var r=s(32467),l=s(83101),n=s(64269);let i=(0,l.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function d(e){let{className:t,variant:s,asChild:l=!1,...d}=e,o=l?r.DX:"span";return(0,a.jsx)(o,{"data-slot":"badge",className:(0,n.cn)(i({variant:s}),t),...d})}},18332:(e,t,s)=>{"use strict";s.d(t,{Fc:()=>i,TN:()=>o,XL:()=>d});var a=s(95155);s(12115);var r=s(83101),l=s(64269);let n=(0,r.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function i(e){let{className:t,variant:s,...r}=e;return(0,a.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,l.cn)(n({variant:s}),t),...r})}function d(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"alert-title",className:(0,l.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"alert-description",className:(0,l.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...s})}},20243:(e,t,s)=>{"use strict";s.d(t,{E:()=>l});var a=s(95155),r=s(64269);function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"skeleton",className:(0,r.cn)("bg-accent animate-pulse rounded-md",t),...s})}},22470:(e,t,s)=>{"use strict";s.d(t,{M:()=>r});var a=s(95155);s(12115);let r=e=>{let{title:t,description:s,action:r,children:l,maxWidth:n="full"}=e;return(0,a.jsxs)("div",{className:"w-full ".concat({full:"max-w-full","8xl":"max-w-[90rem]","7xl":"max-w-7xl","6xl":"max-w-6xl","5xl":"max-w-5xl","4xl":"max-w-4xl","3xl":"max-w-3xl","2xl":"max-w-2xl"}[n]||"max-w-full"," mx-auto py-6 space-y-6"),children:[t&&(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 px-6 pb-5 border-b",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:t}),s&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:s})]}),r&&(0,a.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:r})]}),l]})}},24323:(e,t,s)=>{"use strict";s.d(t,{P:()=>p,T:()=>g});var a=s(95155),r=s(12115),l=s(52619),n=s.n(l),i=s(68321),d=s(76784),o=s(7831),c=s(41444),m=s(3998),u=s(51834);let x=(0,c.h)("AnalyticsConsent");async function g(e){await o.userApi.userMeUpdate({userProfileRequest:{analyticsConsent:e}})}function p(){let[e,t]=(0,r.useState)(null),s=(0,r.useRef)(!1);(0,r.useEffect)(()=>{let e=!1;return o.userApi.userMeRetrieve().then(s=>{var a;e||t(null!=(a=s.analyticsConsent)?a:"unset")}).catch(e=>{x.debug({err:e},"Could not load analytics consent (not authenticated yet?)")}),()=>{e=!0}},[]);let l=async e=>{s.current=!0,t(e);try{await g(e)}catch(e){x.error({err:e},"Failed to save analytics consent")}};return(0,a.jsxs)(a.Fragment,{children:["accepted"===e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.GoogleAnalytics,{gaId:"G-2P6K2HWVEE"}),(0,a.jsx)(i.default,{id:"microsoft-clarity",strategy:"afterInteractive",children:'(function(c,l,a,r,i,t,y){\n c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};\n t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;\n y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);\n })(window, document, "clarity", "script", "xowemo04qg");'})]}),(0,a.jsx)(u.lG,{open:"unset"===e,onOpenChange:e=>{e||s.current||l("declined")},children:(0,a.jsxs)(u.Cf,{children:[(0,a.jsxs)(u.c7,{children:[(0,a.jsx)(u.L3,{children:"Help us improve HackAgent"}),(0,a.jsxs)(u.rr,{children:["We'd like to use optional analytics to understand how HackAgent is used. This is separate from the cookies that keep you signed in, and you can change it anytime in Settings. See our"," ",(0,a.jsx)(n(),{href:"https://hackagent.dev/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Privacy Policy"}),"."]})]}),(0,a.jsxs)(u.Es,{children:[(0,a.jsx)(m.$,{variant:"outline",onClick:()=>l("declined"),children:"Not now"}),(0,a.jsx)(m.$,{onClick:()=>l("accepted"),children:"Sounds good"})]})]})})]})}},34105:(e,t,s)=>{"use strict";s.d(t,{c:()=>a});let a=(0,s(12115).createContext)(void 0)},44345:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>$});var a=s(95155),r=s(12115),l=s(20063),n=s(80230),i=s(7831),d=s(41444),o=s(22470),c=s(63479),m=s(24323),u=s(3998),x=s(65142),g=s(76444),p=s(11647),h=s(86259),f=s(18332),v=s(61362),j=s(50803),N=s(20508),y=s(18514),b=s(65229),w=s(19408),k=s(78519),C=s(16485),A=s(10512),z=s(35299),S=s(6132),E=s(59427),F=s(37494),L=s(79451),P=s(26341),U=s(71360),R=s(20243),q=s(98053);let D=(0,d.h)("ProfilePage");function T(e){return e?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric"}).format(e):"N/A"}let $=()=>{var e;let{logout:t}=(0,n.h)(),s=(0,l.useRouter)(),{theme:d,setTheme:$}=(0,c.D)(),[O,_]=(0,r.useState)(null),[I,M]=(0,r.useState)(null),[J,Y]=(0,r.useState)(""),[H,Z]=(0,r.useState)(""),[V,G]=(0,r.useState)(""),[B,W]=(0,r.useState)(!0),[X,K]=(0,r.useState)(!1),[Q,ee]=(0,r.useState)(!1),[et,es]=(0,r.useState)(!1),[ea,er]=(0,r.useState)(""),[el,en]=(0,r.useState)(""),[ei,ed]=(0,r.useState)(!1),[eo,ec]=(0,r.useState)(null),[em,eu]=(0,r.useState)(!1),[ex,eg]=(0,r.useState)(!1),[ep,eh]=(0,r.useState)(!1),[ef,ev]=(0,r.useState)(null),[ej,eN]=(0,r.useState)(!1),ey=async e=>{if(O){eN(!0);try{await (0,m.T)(e),_({...O,analyticsConsent:e})}catch(e){D.error({err:e},"Failed to update analytics consent"),ev({type:"error",message:"Failed to update your analytics preference. Please try again."})}finally{eN(!1)}}},eb=(0,r.useCallback)(async()=>{W(!0),ev(null);try{let e=await i.userApi.userMeRetrieve();if(_(e),Y(e.firstName||""),Z(e.lastName||""),e.organization)try{let e=await i.Iu.organizationMeRetrieve();M(e),G(e.name||"")}catch(e){D.error({err:e},"Failed to fetch organization details"),ev({type:"error",message:"Could not load organization details: ".concat(e.message)})}}catch(e){D.error({err:e},"Failed to fetch profile data"),ev({type:"error",message:"Failed to load your profile: ".concat(e.message)})}finally{W(!1)}},[]);(0,r.useEffect)(()=>{eb()},[eb]);let ew=async()=>{if(O){K(!0),ev(null),D.debug("Attempting to update user profile");try{let e=await i.userApi.userMeUpdate({userProfileRequest:{firstName:J,lastName:H}});D.info({},"User profile updated successfully"),_(e),Y(e.firstName||""),Z(e.lastName||""),ev({type:"success",message:"Profile updated successfully!"}),eu(!1),eg(!1)}catch(a){var e,t,s;D.error({err:a,details:null==(e=a.response)?void 0:e.data},"Failed to update user profile"),ev({type:"error",message:"Failed to update profile: ".concat((null==(s=a.response)||null==(t=s.data)?void 0:t.detail)||a.message||"Unknown error")})}finally{K(!1)}}},ek=async()=>{if(I){ee(!0),ev(null),D.debug({orgId:I.id},"Attempting to update organization");try{let e=await i.Iu.organizationPartialUpdate({id:I.id,patchedOrganizationRequest:{name:V}});D.info({},"Organization updated successfully"),M(e),G(e.name||""),ev({type:"success",message:"Organization name updated successfully!"}),eh(!1)}catch(a){var e,t,s;D.error({err:a,details:null==(e=a.response)?void 0:e.data},"Failed to update organization name"),ev({type:"error",message:"Failed to update organization name: ".concat((null==(s=a.response)||null==(t=s.data)?void 0:t.detail)||a.message||"Unknown error")})}finally{ee(!1)}}},eC=async()=>{ed(!0),ec(null),ev(null);try{await i.nu.creditsRequestCreate({creditRequestRequest:{amount:ea.trim()||void 0,reason:el.trim()||void 0}}),ev({type:"success",message:"Request sent — an admin has been notified."}),er(""),en("")}catch(s){var e,t;D.error({err:s},"Credit request failed"),ec((null==(t=s.response)||null==(e=t.data)?void 0:e.detail)||s.message||"Failed to send the credit request. Please try again later.")}finally{ed(!1)}},eA=async()=>{if(!O||!O.id)return void ev({type:"error",message:"User profile not loaded or profile ID is missing."});es(!0),ev(null);try{await i.userApi.userDestroy({id:O.id}),ev({type:"success",message:"Account deleted successfully. You will be logged out."}),t&&await t(),s.push("/login")}catch(e){D.error({err:e},"Failed to delete account"),ev({type:"error",message:"Failed to delete account: ".concat(e.message)})}finally{es(!1)}};if(B)return(0,a.jsx)(o.M,{title:"Settings",children:(0,a.jsxs)("div",{className:"border divide-y mx-6",children:[(0,a.jsxs)("div",{className:"p-6 flex items-center gap-4",children:[(0,a.jsx)(R.E,{className:"h-14 w-14 rounded-full"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(R.E,{className:"h-5 w-40"}),(0,a.jsx)(R.E,{className:"h-4 w-24"})]})]}),[1,2,3].map(e=>(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 p-6",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(R.E,{className:"h-4 w-32"}),(0,a.jsx)(R.E,{className:"h-3 w-48"})]}),(0,a.jsx)("div",{className:"lg:col-span-2 grid grid-cols-1 md:grid-cols-2 gap-4",children:[1,2].map(e=>(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(R.E,{className:"h-3 w-20"}),(0,a.jsx)(R.E,{className:"h-9 w-full"})]},e))})]},e))]})});let ez=[null==O?void 0:O.firstName,null==O?void 0:O.lastName].filter(Boolean).join(" ")||(null==O?void 0:O.username)||"User",eS=function(e,t,s){return e&&t?"".concat(e[0]).concat(t[0]).toUpperCase():e?e[0].toUpperCase():s?s[0].toUpperCase():"?"}(null==O?void 0:O.firstName,null==O?void 0:O.lastName,null==O?void 0:O.username);return(0,a.jsxs)(o.M,{title:"Settings",children:[ef&&(0,a.jsxs)(f.Fc,{variant:"error"===ef.type?"destructive":"default",className:"mx-6 mb-4 border-l-4",children:["success"===ef.type?(0,a.jsx)(v.A,{className:"h-4 w-4"}):(0,a.jsx)(j.A,{className:"h-4 w-4"}),(0,a.jsx)(f.XL,{children:"success"===ef.type?"Success":"Error"}),(0,a.jsx)(f.TN,{children:ef.message})]}),(0,a.jsxs)("div",{className:"border divide-y mx-6",children:[(0,a.jsxs)("div",{className:"p-6 flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[(0,a.jsx)("div",{className:"flex-shrink-0 h-14 w-14 rounded-full bg-primary/10 border-2 border-primary/20 flex items-center justify-center text-xl font-bold text-primary select-none",children:eS}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h2",{className:"text-base font-semibold truncate",children:ez}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-0.5",children:[(null==O?void 0:O.username)&&(0,a.jsxs)(p.E,{variant:"secondary",className:"font-mono text-xs",children:["@",O.username]}),(null==O?void 0:O.email)&&(0,a.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:O.email})]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 p-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(N.A,{className:"h-4 w-4 text-muted-foreground"}),(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Personal Information"})]}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Your name and account details. Name changes are reflected across the platform."})]}),(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-5",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(g.J,{htmlFor:em?"firstName":"staticFirstName",className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"First Name"}),(0,a.jsx)("div",{className:"relative group",children:em?(0,a.jsx)(x.p,{id:"firstName",value:J,onChange:e=>Y(e.target.value),placeholder:"Your first name",disabled:X,className:"h-9 pr-10"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{id:"staticFirstName",className:"text-sm px-3 h-9 flex items-center border rounded bg-muted/40 w-full pr-10",children:(null==O?void 0:O.firstName)||(0,a.jsx)("span",{className:"text-muted-foreground italic",children:"Not set"})}),(0,a.jsx)(u.$,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 opacity-0 group-hover:opacity-100 focus-visible:opacity-100",onClick:()=>{eu(!0),Y((null==O?void 0:O.firstName)||"")},"aria-label":"Edit first name",children:(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"})})]})})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(g.J,{htmlFor:ex?"lastName":"staticLastName",className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Last Name"}),(0,a.jsx)("div",{className:"relative group",children:ex?(0,a.jsx)(x.p,{id:"lastName",value:H,onChange:e=>Z(e.target.value),placeholder:"Your last name",disabled:X,className:"h-9 pr-10"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{id:"staticLastName",className:"text-sm px-3 h-9 flex items-center border rounded bg-muted/40 w-full pr-10",children:(null==O?void 0:O.lastName)||(0,a.jsx)("span",{className:"text-muted-foreground italic",children:"Not set"})}),(0,a.jsx)(u.$,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 opacity-0 group-hover:opacity-100 focus-visible:opacity-100",onClick:()=>{eg(!0),Z((null==O?void 0:O.lastName)||"")},"aria-label":"Edit last name",children:(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"})})]})})]})]}),(0,a.jsx)(h.w,{}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Username"}),(0,a.jsx)("div",{className:"text-sm px-3 h-9 flex items-center border rounded bg-muted/20 font-mono text-muted-foreground",children:(null==O?void 0:O.username)||"—"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Email Address"}),(0,a.jsx)("div",{className:"text-sm px-3 h-9 flex items-center border rounded bg-muted/20 text-muted-foreground truncate",children:(null==O?void 0:O.email)||"—"})]})]}),(em||ex)&&(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsxs)(u.$,{variant:"outline",onClick:()=>{Y((null==O?void 0:O.firstName)||""),Z((null==O?void 0:O.lastName)||""),eu(!1),eg(!1)},disabled:X,children:[(0,a.jsx)(b.A,{className:"mr-2 h-4 w-4"})," Cancel"]}),(0,a.jsx)(u.$,{onClick:ew,disabled:X,children:X?"Saving…":"Save Changes"})]})]})]}),(I||!B)&&(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 p-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(w.A,{className:"h-4 w-4 text-muted-foreground"}),(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Organization"})]}),I?(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Details and billing credits for your organization."}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"No organization associated with this account."})]}),I&&(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-5",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(g.J,{htmlFor:ep?"orgName":"staticOrgName",className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Organization Name"}),(0,a.jsx)("div",{className:"relative group",children:ep?(0,a.jsx)(x.p,{id:"orgName",value:V,onChange:e=>G(e.target.value),placeholder:"Your organization's name",disabled:Q,className:"h-9 pr-10"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{id:"staticOrgName",className:"text-sm px-3 h-9 flex items-center border rounded bg-muted/40 w-full pr-10",children:I.name||(0,a.jsx)("span",{className:"text-muted-foreground italic",children:"Not set"})}),(0,a.jsx)(u.$,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 opacity-0 group-hover:opacity-100 focus-visible:opacity-100",onClick:()=>{eh(!0),G(I.name||"")},"aria-label":"Edit organization name",children:(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"})})]})})]}),(0,a.jsx)(h.w,{}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{className:"sm:col-span-1 border bg-muted/30 px-4 py-3 flex flex-col gap-0.5",children:[(0,a.jsxs)("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground flex items-center gap-1.5",children:[(0,a.jsx)(k.A,{className:"h-3 w-3"})," API Credits"]}),(0,a.jsxs)("span",{className:"text-2xl font-bold tabular-nums mt-1",children:["$",parseFloat(null!=(e=I.credits)?e:"0").toFixed(2)]}),I.creditsLastUpdated&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground mt-0.5",children:["Updated ",T(I.creditsLastUpdated)]})]}),(0,a.jsxs)("div",{className:"border bg-muted/30 px-4 py-3 flex flex-col gap-0.5",children:[(0,a.jsxs)("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground flex items-center gap-1.5",children:[(0,a.jsx)(C.A,{className:"h-3 w-3"})," Created"]}),(0,a.jsx)("span",{className:"text-sm font-medium mt-1",children:T(I.createdAt)})]}),(0,a.jsxs)("div",{className:"border bg-muted/30 px-4 py-3 flex flex-col gap-0.5",children:[(0,a.jsxs)("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground flex items-center gap-1.5",children:[(0,a.jsx)(C.A,{className:"h-3 w-3"})," Last Updated"]}),(0,a.jsx)("span",{className:"text-sm font-medium mt-1",children:T(I.updatedAt)})]})]}),(0,a.jsxs)("div",{className:"border border-dashed px-4 py-4 bg-muted/10 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-sm font-medium flex items-center gap-2",children:[(0,a.jsx)(A.A,{className:"h-4 w-4 text-muted-foreground"})," Request Credits"]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Ask an admin to add credits to your organization. They'll be notified by email."})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end gap-2",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(g.J,{htmlFor:"requestAmount",className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Amount (USD, optional)"}),(0,a.jsx)(x.p,{id:"requestAmount",type:"number",placeholder:"e.g., 50",value:ea,onChange:e=>er(e.target.value),disabled:ei,className:"max-w-[10rem] h-9"})]}),(0,a.jsxs)("div",{className:"space-y-1 flex-1",children:[(0,a.jsx)(g.J,{htmlFor:"requestReason",className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Reason (optional)"}),(0,a.jsx)(x.p,{id:"requestReason",type:"text",placeholder:"What are the credits for?",value:el,onChange:e=>en(e.target.value),disabled:ei,className:"h-9"})]}),(0,a.jsxs)(u.$,{onClick:eC,disabled:ei,className:"h-9 shrink-0",children:[ei?(0,a.jsx)(z.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,a.jsx)(A.A,{className:"mr-2 h-4 w-4"}),ei?"Sending…":"Request credits"]})]}),eo&&(0,a.jsxs)(f.Fc,{variant:"destructive",children:[(0,a.jsx)(S.A,{className:"h-4 w-4"}),(0,a.jsx)(f.TN,{children:eo})]})]}),ep&&(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsxs)(u.$,{variant:"outline",onClick:()=>{G((null==I?void 0:I.name)||""),eh(!1)},disabled:Q,children:[(0,a.jsx)(b.A,{className:"mr-2 h-4 w-4"})," Cancel"]}),(0,a.jsx)(u.$,{onClick:ek,disabled:Q,children:Q?"Saving…":"Save Organization"})]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 p-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(E.A,{className:"h-4 w-4 text-muted-foreground"}),(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Appearance"})]}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Choose how HackAgent looks for you."})]}),(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Theme"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"system"===d?"Follows your OS setting":"dark"===d?"Dark mode active":"Light mode active"})]}),(0,a.jsx)("div",{className:"flex items-center gap-1 border bg-muted/40 p-1",children:[["light",E.A,"Light"],["dark",F.A,"Dark"],["system",L.A,"System"]].map(e=>{let[t,s,r]=e;return(0,a.jsxs)(u.$,{variant:d===t?"secondary":"ghost",size:"sm",className:"gap-1.5 h-8 px-3",onClick:()=>$(t),children:[(0,a.jsx)(s,{className:"h-3.5 w-3.5"}),r]},t)})})]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 p-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(P.A,{className:"h-4 w-4 text-muted-foreground"}),(0,a.jsx)("h2",{className:"text-sm font-medium",children:"Privacy"})]}),(0,a.jsxs)("p",{className:"text-sm text-muted-foreground mt-1",children:["Control analytics cookies. See our"," ",(0,a.jsx)("a",{href:"https://hackagent.dev/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Privacy Policy"}),"."]})]}),(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Analytics"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:(null==O?void 0:O.analyticsConsent)==="accepted"?"Enabled — helps us understand how HackAgent is used.":(null==O?void 0:O.analyticsConsent)==="declined"?"Disabled — no analytics are collected for your account.":"Not yet decided."})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 border bg-muted/40 p-1",children:[(0,a.jsx)(u.$,{variant:(null==O?void 0:O.analyticsConsent)==="declined"?"secondary":"ghost",size:"sm",className:"h-8 px-3",disabled:ej,onClick:()=>ey("declined"),children:"Disabled"}),(0,a.jsx)(u.$,{variant:(null==O?void 0:O.analyticsConsent)==="accepted"?"secondary":"ghost",size:"sm",className:"h-8 px-3",disabled:ej,onClick:()=>ey("accepted"),children:"Enabled"})]})]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 p-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-destructive",children:"Danger Zone"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Irreversible actions. Please read carefully before proceeding."})]}),(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 border border-destructive/30 bg-destructive/5 px-4 py-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Delete Account"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Permanently remove your account and all associated data. This cannot be undone."})]}),(0,a.jsxs)(q.Lt,{children:[(0,a.jsx)(q.tv,{asChild:!0,children:(0,a.jsxs)(u.$,{variant:"destructive",size:"sm",disabled:et,className:"shrink-0",children:[(0,a.jsx)(U.A,{className:"mr-2 h-4 w-4"}),et?"Deleting…":"Delete Account"]})}),(0,a.jsxs)(q.EO,{children:[(0,a.jsxs)(q.wd,{children:[(0,a.jsx)(q.r7,{children:"Are you absolutely sure?"}),(0,a.jsx)(q.$v,{children:"This action cannot be undone. This will permanently delete your account and remove all your data from our servers."})]}),(0,a.jsxs)(q.ck,{children:[(0,a.jsx)(q.Zr,{children:"Cancel"}),(0,a.jsx)(q.Rx,{onClick:eA,disabled:et,className:"bg-destructive hover:bg-destructive/90",children:et?"Deleting…":"Yes, delete my account"})]})]})]})]})})]})]})]})}},51834:(e,t,s)=>{"use strict";s.d(t,{Cf:()=>m,Es:()=>x,HM:()=>o,L3:()=>g,c7:()=>u,lG:()=>i,rr:()=>p});var a=s(95155);s(12115);var r=s(88292),l=s(65229),n=s(64269);function i(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"dialog",...t})}function d(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"dialog-portal",...t})}function o(e){let{...t}=e;return(0,a.jsx)(r.bm,{"data-slot":"dialog-close",...t})}function c(e){let{className:t,...s}=e;return(0,a.jsx)(r.hJ,{"data-slot":"dialog-overlay",className:(0,n.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function m(e){let{className:t,children:s,...i}=e;return(0,a.jsxs)(d,{"data-slot":"dialog-portal",children:[(0,a.jsx)(c,{}),(0,a.jsxs)(r.UC,{"data-slot":"dialog-content",className:(0,n.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...i,children:[s,(0,a.jsxs)(r.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(l.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function u(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,n.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function x(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,n.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function g(e){let{className:t,...s}=e;return(0,a.jsx)(r.hE,{"data-slot":"dialog-title",className:(0,n.cn)("text-lg leading-none font-semibold",t),...s})}function p(e){let{className:t,...s}=e;return(0,a.jsx)(r.VY,{"data-slot":"dialog-description",className:(0,n.cn)("text-muted-foreground text-sm",t),...s})}},63479:(e,t,s)=>{"use strict";s.d(t,{D:()=>n,N:()=>o});var a=s(95155),r=s(12115);let l=(0,r.createContext)({theme:"system",resolvedTheme:"light",setTheme:()=>{}});function n(){return(0,r.useContext)(l)}let i="hackagent-theme";function d(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function o(e){let{children:t}=e,[s,n]=(0,r.useState)("system"),[o,c]=(0,r.useState)("light"),m=e=>{let t=document.documentElement;"dark"===e?t.classList.add("dark"):t.classList.remove("dark")};return(0,r.useEffect)(()=>{var e;let t=null!=(e=localStorage.getItem(i))?e:"system";n(t);let s="system"===t?d():t;c(s),m(s)},[]),(0,r.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{if("system"===s){let e=d();c(e),m(e)}};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[s]),(0,a.jsx)(l.Provider,{value:{theme:s,resolvedTheme:o,setTheme:e=>{localStorage.setItem(i,e),n(e);let t="system"===e?d():e;c(t),m(t)}},children:t})}},65142:(e,t,s)=>{"use strict";s.d(t,{p:()=>l});var a=s(95155);s(12115);var r=s(64269);function l(e){let{className:t,type:s,...l}=e;return(0,a.jsx)("input",{type:s,"data-slot":"input",className:(0,r.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...l})}},76444:(e,t,s)=>{"use strict";s.d(t,{J:()=>n});var a=s(95155);s(12115);var r=s(85408),l=s(64269);function n(e){let{className:t,...s}=e;return(0,a.jsx)(r.b,{"data-slot":"label",className:(0,l.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}},76853:(e,t,s)=>{Promise.resolve().then(s.bind(s,44345))},80230:(e,t,s)=>{"use strict";s.d(t,{h:()=>n});var a=s(12115),r=s(34105);let l=async()=>"";function n(){let e=(0,a.useContext)(r.c);return e||{provider:"disabled",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:l}}},86259:(e,t,s)=>{"use strict";s.d(t,{w:()=>n});var a=s(95155);s(12115);var r=s(57268),l=s(64269);function n(e){let{className:t,orientation:s="horizontal",decorative:n=!0,...i}=e;return(0,a.jsx)(r.b,{"data-slot":"separator-root",decorative:n,orientation:s,className:(0,l.cn)("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...i})}},98053:(e,t,s)=>{"use strict";s.d(t,{$v:()=>p,EO:()=>m,Lt:()=>i,Rx:()=>h,Zr:()=>f,ck:()=>x,r7:()=>g,tv:()=>d,wd:()=>u});var a=s(95155);s(12115);var r=s(35646),l=s(64269),n=s(3998);function i(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"alert-dialog",...t})}function d(e){let{...t}=e;return(0,a.jsx)(r.l9,{"data-slot":"alert-dialog-trigger",...t})}function o(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"alert-dialog-portal",...t})}function c(e){let{className:t,...s}=e;return(0,a.jsx)(r.hJ,{"data-slot":"alert-dialog-overlay",className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function m(e){let{className:t,...s}=e;return(0,a.jsxs)(o,{children:[(0,a.jsx)(c,{}),(0,a.jsx)(r.UC,{"data-slot":"alert-dialog-content",className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...s})]})}function u(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,l.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function x(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,l.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function g(e){let{className:t,...s}=e;return(0,a.jsx)(r.hE,{"data-slot":"alert-dialog-title",className:(0,l.cn)("text-lg font-semibold",t),...s})}function p(e){let{className:t,...s}=e;return(0,a.jsx)(r.VY,{"data-slot":"alert-dialog-description",className:(0,l.cn)("text-muted-foreground text-sm",t),...s})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(r.rc,{className:(0,l.cn)((0,n.r)(),t),...s})}function f(e){let{className:t,...s}=e;return(0,a.jsx)(r.ZD,{className:(0,l.cn)((0,n.r)({variant:"outline"}),t),...s})}}},e=>{e.O(0,[187,539,292,619,921,772,924,441,493,358],()=>e(e.s=76853)),_N_E=e.O()}]);