loki-mode 7.5.27 → 7.5.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/autonomy/lib/project-graph.sh +24 -14
- package/autonomy/loki +50 -18
- package/bin/loki +2 -1
- package/dashboard/__init__.py +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/MERGE-DEDUP-MAP.md +420 -0
- package/docs/MERGE-ROUTE-MAP.md +139 -0
- package/docs/MERGE3-PLAN.md +119 -0
- package/loki-ts/dist/loki.js +196 -171
- package/mcp/__init__.py +1 -1
- package/package.json +2 -2
- package/web-app/dist/assets/{AdminPage-DwVUK4v9.js → AdminPage-CKUOsWZW.js} +3 -3
- package/web-app/dist/assets/{Avatar-B7gqhcg3.js → Avatar-CL9Id9Hi.js} +1 -1
- package/web-app/dist/assets/{Badge-DA3xNJAS.js → Badge-B12zwlD7.js} +1 -1
- package/web-app/dist/assets/{Button-BPXURLaK.js → Button-CFLVoduT.js} +1 -1
- package/web-app/dist/assets/{ComparePage-B0JQMhKG.js → ComparePage-Dg0UdZAk.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-D38-fy29.js → GitHubIssuesPanel-CSitxtAX.js} +2 -2
- package/web-app/dist/assets/{GitHubPRsPanel-DLPcW3N0.js → GitHubPRsPanel-BIT06FRo.js} +1 -1
- package/web-app/dist/assets/HomePage-pU_0fGny.js +28 -0
- package/web-app/dist/assets/{LoginPage-DqCzxsfx.js → LoginPage-DTZtt2Yb.js} +1 -1
- package/web-app/dist/assets/MagicPage-10zfra8o.js +31 -0
- package/web-app/dist/assets/{MetricsPage-CPYQR0zr.js → MetricsPage-C-wiKUkv.js} +1 -1
- package/web-app/dist/assets/NotFoundPage-BDkcmhYe.js +1 -0
- package/web-app/dist/assets/{ProjectPage-DNujSl6j.js → ProjectPage-CiCavQ8n.js} +71 -71
- package/web-app/dist/assets/ProjectsPage-BLCXQwwC.js +6 -0
- package/web-app/dist/assets/{SettingsPage-BaQJbOgL.js → SettingsPage-PkxtaMyg.js} +3 -3
- package/web-app/dist/assets/{ShowcasePage-DQR_e-kg.js → ShowcasePage-iECp8Tha.js} +1 -1
- package/web-app/dist/assets/SystemSettingsPage-DS6Anno1.js +6 -0
- package/web-app/dist/assets/{TeamsPage-DOFErDqX.js → TeamsPage-ls6h6bNL.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-Ty72hILN.js → TemplatesPage-Bk0QzlPt.js} +3 -3
- package/web-app/dist/assets/{TerminalOutput-DqOVnR1p.js → TerminalOutput-4-1hWCtZ.js} +1 -1
- package/web-app/dist/assets/{activity-BgBZ4s4c.js → activity-DH3ih2nS.js} +1 -1
- package/web-app/dist/assets/{bell-C-UezVWi.js → bell-Gn17S6uv.js} +1 -1
- package/web-app/dist/assets/{bot-D70fEnm5.js → bot-Cbycc3VE.js} +1 -1
- package/web-app/dist/assets/{check-CBohulxQ.js → check-nIAqa-kf.js} +1 -1
- package/web-app/dist/assets/{chevron-left-C-emzUhB.js → chevron-left-D2jcWDll.js} +1 -1
- package/web-app/dist/assets/{circle-alert-8SRY0_GX.js → circle-alert-CpL4Bhvt.js} +1 -1
- package/web-app/dist/assets/{clock-mfq4XnPQ.js → clock-IW4Wq86N.js} +1 -1
- package/web-app/dist/assets/{cloud-DpRM7T8t.js → cloud-Cn8nNuH2.js} +1 -1
- package/web-app/dist/assets/{code-xml-1N2Ui-4c.js → code-xml-BiJBteXf.js} +1 -1
- package/web-app/dist/assets/{copy-LXquTgzI.js → copy-CnqkyNsi.js} +1 -1
- package/web-app/dist/assets/{database-S1dyXnuT.js → database-CKSReqa5.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-CRqk0dW5.js → dollar-sign-CDzDY64R.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-B99CwY_6.js → file-code-corner-Box4IwG1.js} +1 -1
- package/web-app/dist/assets/{file-plus-DZ5qnz5b.js → file-plus-DpGqlXF8.js} +1 -1
- package/web-app/dist/assets/{folder-open-DBCm7yuF.js → folder-open-B57dAoBv.js} +1 -1
- package/web-app/dist/assets/{git-commit-horizontal-DM1ERuNd.js → git-commit-horizontal-BVbucmO5.js} +1 -1
- package/web-app/dist/assets/{globe-B7xEJSL_.js → globe-BkOnKl4x.js} +1 -1
- package/web-app/dist/assets/{hammer-Cgi3LTuS.js → hammer-DRbIQ4QU.js} +1 -1
- package/web-app/dist/assets/{index-BN52-GQT.js → index-CM_b_EhP.js} +77 -77
- package/web-app/dist/assets/{layers-Bi8RPIBC.js → layers-B78BiFiU.js} +1 -1
- package/web-app/dist/assets/{lightbulb-Doc_n8JX.js → lightbulb-B-Itbm9g.js} +1 -1
- package/web-app/dist/assets/{loader-circle-BB932A7A.js → loader-circle-Oq6NQhW2.js} +1 -1
- package/web-app/dist/assets/{lock-Bt6gpMrs.js → lock-DbJ9zxbw.js} +1 -1
- package/web-app/dist/assets/{mail-BuzAu1IP.js → mail-CzMRod6m.js} +1 -1
- package/web-app/dist/assets/{package-BE5FHxQ8.js → package-WZ5osvej.js} +1 -1
- package/web-app/dist/assets/{plus-CNqABexN.js → plus-j08lFR-K.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-34B13ztx.js → refresh-cw-CIr7E-g2.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-CrD2QB29.js → rotate-ccw-gwoXxDeE.js} +1 -1
- package/web-app/dist/assets/{save-DsJcqdnI.js → save-B8fV_ZpE.js} +1 -1
- package/web-app/dist/assets/{server-BcgRMArA.js → server-D5dO1paz.js} +1 -1
- package/web-app/dist/assets/{shield-alert-DLYLdVJ0.js → shield-alert-Du08zhdg.js} +1 -1
- package/web-app/dist/assets/{trash-2-Cc-VTvzt.js → trash-2-DEKSVae5.js} +1 -1
- package/web-app/dist/assets/{trending-down-CrDpO2a_.js → trending-down-DBiXUtxJ.js} +1 -1
- package/web-app/dist/assets/{trending-up-CNVsmM3G.js → trending-up-BgmK_tHq.js} +1 -1
- package/web-app/dist/assets/{upload-LuDuB7Wc.js → upload-IaViyeVD.js} +1 -1
- package/web-app/dist/assets/{usePolling-C8rvc-CG.js → usePolling-PiRLqNu6.js} +1 -1
- package/web-app/dist/assets/{user-BT79cI-o.js → user-BB5J8wAF.js} +1 -1
- package/web-app/dist/index.html +2 -3
- package/web-app/server.py +45 -7
- package/web-app/dist/assets/HomePage-CzeoS2V_.js +0 -28
- package/web-app/dist/assets/MagicPage-CBLqpa55.js +0 -31
- package/web-app/dist/assets/NotFoundPage-B62u4iCs.js +0 -1
- package/web-app/dist/assets/ProjectsPage-uHG7kxB-.js +0 -6
- package/web-app/dist/assets/SystemSettingsPage-C_Q_1WK4.js +0 -6
package/mcp/__init__.py
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loki-mode",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.29",
|
|
4
4
|
"description": "Loki Mode by Autonomi. Multi-agent autonomous SDLC framework. Spec to deployed app: PRD, GitHub issue, OpenAPI/JSON/YAML, or one-line brief. 4 AI providers (Claude Code, OpenAI Codex, Cline, Aider). 11 quality gates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
],
|
|
104
104
|
"scripts": {
|
|
105
105
|
"prepack": "find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null; find . -name '*.pyc' -delete 2>/dev/null; if command -v bun >/dev/null 2>&1; then (cd loki-ts && bun install --production && bun run build) || echo 'WARN: loki-ts build failed, using existing dist if present'; else echo 'WARN: bun not on PATH, skipping loki-ts build (using committed dist if present)'; fi; true",
|
|
106
|
-
"prepublishOnly": "cd dashboard-ui && npm ci && npm run build:all && test -f ../dashboard/static/index.html",
|
|
106
|
+
"prepublishOnly": "cd dashboard-ui && npm ci && npm run build:all && test -f ../dashboard/static/index.html && cd ../web-app && npm ci && npm run build && test -f dist/index.html && grep -q /lab/assets/ dist/index.html",
|
|
107
107
|
"test": "bash -n autonomy/run.sh && bash -n autonomy/loki && bash -n autonomy/completion-council.sh && bash -n autonomy/app-runner.sh && bash -n autonomy/prd-checklist.sh && bash -n autonomy/playwright-verify.sh && node --test tests/protocols/*.test.js && node --test tests/protocols/a2a/*.test.js && node --test tests/observability/*.test.js && node --test tests/policies/*.test.js && node --test tests/audit/*.test.js && node --test tests/integrations/*.test.js && node --test tests/integrations/jira/*.test.js && node --test tests/integrations/github/*.test.js && node --test tests/integrations/slack/*.test.js && bash tests/managed_memory/test_flag_matrix.sh && bash tests/managed_memory/test_sdk_isolation.sh && bash tests/managed_memory/test_kill_switch.sh && python3 -m unittest tests.managed_memory.test_shadow_write_mock tests.managed_memory.test_retrieve_mock && echo 'All checks passed'",
|
|
108
108
|
"test:visual": "node --experimental-vm-modules node_modules/jest/bin/jest.js dashboard-ui/tests/visual-regression.test.js",
|
|
109
109
|
"test:parity": "node --experimental-vm-modules dashboard-ui/scripts/check-parity.js",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as L,j as e,r as m,
|
|
1
|
+
import{c as L,j as e,r as m,w as _,Z as X,n as Q,i as ee,b as R,F as ge,U as z,X as te,L as se,x as je,M as fe,T as G,S as be,m as ae,l as ne,y as ve,E as Ee,V as Ne,$ as re}from"./index-CM_b_EhP.js";import{B as w}from"./Button-CFLVoduT.js";import{T as ye}from"./trending-up-BgmK_tHq.js";import{C as I}from"./clock-IW4Wq86N.js";import{A as ke,U as ie}from"./Avatar-CL9Id9Hi.js";import{A as H}from"./activity-DH3ih2nS.js";import{R as le}from"./refresh-cw-CIr7E-g2.js";import{G as Ae}from"./globe-BkOnKl4x.js";import{C as we}from"./chevron-left-D2jcWDll.js";import{M as Ce}from"./mail-CzMRod6m.js";import{C as ce}from"./check-nIAqa-kf.js";import{D as W}from"./dollar-sign-CDzDY64R.js";import{U as Se}from"./user-BB5J8wAF.js";import{D as De}from"./database-CKSReqa5.js";import{L as Fe}from"./lock-DbJ9zxbw.js";import{H as Me}from"./hammer-DRbIQ4QU.js";import{S as Be}from"./shield-alert-Du08zhdg.js";import{S as $e}from"./server-D5dO1paz.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -28,5 +28,5 @@ import{c as L,j as e,r as m,v as _,Z as Q,m as X,h as ee,b as R,F as ge,U as z,X
|
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Ge=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],He=L("toggle-right",Ge);function We({percentage:n,size:a=64,strokeWidth:t=4,color:l="#553DE9",trackColor:c="rgba(0,0,0,0.08)",className:s="",children:r}){const o=(a-t)/2,g=2*Math.PI*o,j=Math.max(0,Math.min(100,n)),u=g-j/100*g;return e.jsxs("div",{className:`relative inline-flex items-center justify-center ${s}`,style:{width:a,height:a},children:[e.jsxs("svg",{width:a,height:a,className:"transform -rotate-90",children:[e.jsx("circle",{cx:a/2,cy:a/2,r:o,fill:"none",stroke:c,strokeWidth:t}),e.jsx("circle",{cx:a/2,cy:a/2,r:o,fill:"none",stroke:l,strokeWidth:t,strokeLinecap:"round",strokeDasharray:g,strokeDashoffset:u,style:{transition:"stroke-dashoffset 0.6s ease-out"}})]}),r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r})]})}function Ve(){const n=Date.now(),a=864e5,t=Array.from({length:30},(r,o)=>({date:new Date(n-(29-o)*a).toISOString().split("T")[0],tokens:Math.floor(Math.random()*5e5)+1e5})),l=[{provider:"Claude",cost:124.5,percentage:62,color:"#553DE9"},{provider:"Codex",cost:48.3,percentage:24,color:"#1FC5A8"},{provider:"Gemini",cost:28.2,percentage:14,color:"#F59E0B"}],c=[{name:"SaaS App",count:45},{name:"CLI Tool",count:32},{name:"Discord Bot",count:28},{name:"REST API",count:21},{name:"Chrome Extension",count:14}],s=Array.from({length:7},()=>Array.from({length:24},(r,o)=>o>=9&&o<=17?Math.floor(Math.random()*80)+20:o>=18&&o<=22?Math.floor(Math.random()*40)+10:Math.floor(Math.random()*15)));return{tokenUsage:t,costBreakdown:l,buildSuccessRate:87,totalBuilds:342,successfulBuilds:298,failedBuilds:44,templateUsage:c,peakHours:s}}function Je({data:n}){const[a,t]=m.useState(null);if(n.length===0)return null;const l=600,c=200,s={top:20,right:20,bottom:30,left:60},r=l-s.left-s.right,o=c-s.top-s.bottom,g=Math.max(...n.map(x=>x.tokens)),j=0,u=g-j||1,b=n.map((x,N)=>({x:s.left+N/(n.length-1)*r,y:s.top+o-(x.tokens-j)/u*o,...x})),h=b.map((x,N)=>`${N===0?"M":"L"} ${x.x} ${x.y}`).join(" "),y=`${h} L ${b[b.length-1].x} ${s.top+o} L ${b[0].x} ${s.top+o} Z`,v=x=>x>=1e6?`${(x/1e6).toFixed(1)}M`:x>=1e3?`${(x/1e3).toFixed(0)}K`:String(x),E=Array.from({length:5},(x,N)=>({value:j+u*N/4,y:s.top+o-N/4*o}));return e.jsxs("svg",{viewBox:`0 0 ${l} ${c}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[E.map((x,N)=>e.jsxs("g",{children:[e.jsx("line",{x1:s.left,y1:x.y,x2:l-s.right,y2:x.y,stroke:"currentColor",strokeOpacity:"0.08",strokeDasharray:"4 4"}),e.jsx("text",{x:s.left-8,y:x.y+4,textAnchor:"end",className:"text-[10px] fill-[#939084]",children:v(x.value)})]},N)),e.jsx("path",{d:y,fill:"url(#tokenGradient)",opacity:"0.15"}),e.jsx("path",{d:h,fill:"none",stroke:"#553DE9",strokeWidth:"2",strokeLinejoin:"round"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#553DE9"}),e.jsx("stop",{offset:"100%",stopColor:"#553DE9",stopOpacity:"0"})]})}),b.map((x,N)=>e.jsxs("g",{children:[e.jsx("circle",{cx:x.x,cy:x.y,r:a===N?5:3,fill:a===N?"#553DE9":"white",stroke:"#553DE9",strokeWidth:"2",className:"cursor-pointer transition-all",onMouseEnter:()=>t(N),onMouseLeave:()=>t(null)}),a===N&&e.jsxs("g",{children:[e.jsx("rect",{x:x.x-50,y:x.y-36,width:"100",height:"24",rx:"4",fill:"#36342E"}),e.jsxs("text",{x:x.x,y:x.y-20,textAnchor:"middle",className:"text-[10px] fill-white font-mono",children:[v(x.tokens)," | ",x.date.slice(5)]})]})]},N)),[0,Math.floor(n.length/2),n.length-1].map(x=>e.jsx("text",{x:b[x].x,y:c-4,textAnchor:"middle",className:"text-[10px] fill-[#939084]",children:n[x].date.slice(5)},x))]})}function qe({data:n}){const[a,t]=m.useState(null),l=n.reduce((u,b)=>u+b.cost,0),c=160,s=c/2,r=60,o=40;let g=-90;const j=n.map((u,b)=>{const h=u.percentage/100*360,y=g,v=g+h;g=v;const E=y*Math.PI/180,x=v*Math.PI/180,N=h>180?1:0,f=a===b?r+4:r,D=[`M ${s+o*Math.cos(E)} ${s+o*Math.sin(E)}`,`L ${s+f*Math.cos(E)} ${s+f*Math.sin(E)}`,`A ${f} ${f} 0 ${N} 1 ${s+f*Math.cos(x)} ${s+f*Math.sin(x)}`,`L ${s+o*Math.cos(x)} ${s+o*Math.sin(x)}`,`A ${o} ${o} 0 ${N} 0 ${s+o*Math.cos(E)} ${s+o*Math.sin(E)}`,"Z"].join(" ");return{...u,path:D,index:b}});return e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("svg",{width:c,height:c,viewBox:`0 0 ${c} ${c}`,children:[j.map(u=>e.jsx("path",{d:u.path,fill:u.color,opacity:a!==null&&a!==u.index?.4:1,className:"cursor-pointer transition-opacity",onMouseEnter:()=>t(u.index),onMouseLeave:()=>t(null)},u.index)),e.jsx("text",{x:s,y:s-6,textAnchor:"middle",className:"text-xs fill-[#939084]",children:"Total"}),e.jsxs("text",{x:s,y:s+12,textAnchor:"middle",className:"text-sm fill-[#36342E] dark:fill-[#E8E6E3] font-semibold",children:["$",l.toFixed(0)]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:n.map((u,b)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",onMouseEnter:()=>t(b),onMouseLeave:()=>t(null),children:[e.jsx("span",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:u.color}}),e.jsx("span",{className:"text-[#36342E] dark:text-[#E8E6E3]",children:u.provider}),e.jsxs("span",{className:"text-[#939084] ml-auto font-mono",children:["$",u.cost.toFixed(2)]})]},b))})]})}function Ye({data:n}){const a=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],t=Math.max(...n.flat()),l=c=>{const s=t>0?c/t:0;return s===0?"bg-[#F8F4F0] dark:bg-[#1A1A1E]":s<.25?"bg-[#553DE9]/10":s<.5?"bg-[#553DE9]/25":s<.75?"bg-[#553DE9]/50":"bg-[#553DE9]/80"};return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("div",{className:"inline-block",children:[e.jsx("div",{className:"flex gap-0.5 mb-1 ml-10",children:Array.from({length:24},(c,s)=>e.jsx("div",{className:"w-4 text-center text-[9px] text-[#939084]",children:s%6===0?`${s}`:""},s))}),n.map((c,s)=>e.jsxs("div",{className:"flex items-center gap-0.5 mb-0.5",children:[e.jsx("span",{className:"w-8 text-right text-[10px] text-[#939084] mr-1",children:a[s]}),c.map((r,o)=>e.jsx("div",{className:`w-4 h-4 rounded-sm ${l(r)} transition-colors`,title:`${a[s]} ${o}:00 - ${r} builds`},o))]},s)),e.jsxs("div",{className:"flex items-center gap-1 mt-2 ml-10",children:[e.jsx("span",{className:"text-[10px] text-[#939084]",children:"Less"}),["bg-[#F8F4F0] dark:bg-[#1A1A1E]","bg-[#553DE9]/10","bg-[#553DE9]/25","bg-[#553DE9]/50","bg-[#553DE9]/80"].map((c,s)=>e.jsx("div",{className:`w-3 h-3 rounded-sm ${c}`},s)),e.jsx("span",{className:"text-[10px] text-[#939084]",children:"More"})]})]})})}function Ze({data:n,className:a=""}){const t=n||Ve(),l=m.useCallback(()=>{const c=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),s=URL.createObjectURL(c),r=document.createElement("a");r.href=s,r.download=`usage-analytics-${new Date().toISOString().split("T")[0]}.json`,r.click(),URL.revokeObjectURL(s)},[t]);return e.jsxs("div",{className:`space-y-6 ${a}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"Usage Analytics"})]}),e.jsx(w,{size:"sm",variant:"ghost",icon:V,onClick:l,children:"Export"})]}),e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ye,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Token Usage (30 Days)"})]}),e.jsx(Je,{data:t.tokenUsage})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Re,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Cost by Provider"})]}),e.jsx(qe,{data:t.costBreakdown})]}),e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Q,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Build Success Rate"})]}),e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsxs("span",{className:"text-3xl font-bold text-[#36342E] dark:text-[#E8E6E3]",children:[t.buildSuccessRate,"%"]}),e.jsxs("div",{className:"text-xs text-[#939084]",children:[e.jsxs("div",{children:[t.successfulBuilds," passed"]}),e.jsxs("div",{children:[t.failedBuilds," failed"]}),e.jsxs("div",{children:[t.totalBuilds," total"]})]})]}),e.jsx("div",{className:"h-3 bg-[#F8F4F0] dark:bg-[#1A1A1E] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${t.buildSuccessRate}%`,background:t.buildSuccessRate>=80?"#1FC5A8":t.buildSuccessRate>=60?"#F59E0B":"#C45B5B"}})}),e.jsxs("div",{className:"mt-6",children:[e.jsx("h4",{className:"text-xs font-medium text-[#939084] uppercase tracking-wider mb-2",children:"Top Templates"}),e.jsx("div",{className:"space-y-2",children:t.templateUsage.slice(0,5).map((c,s)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-[#36342E] dark:text-[#E8E6E3]",children:[s+1,". ",c.name]}),e.jsxs("span",{className:"text-xs font-mono text-[#939084]",children:[c.count," builds"]})]},s))})]})]})]}),e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(I,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Peak Usage Hours"})]}),e.jsx(Ye,{data:t.peakHours})]})]})}const Y=["user.login","user.logout","user.invited","project.created","project.deleted","project.deployed","key.created","key.revoked","role.changed","settings.updated","build.started","build.completed","build.failed"];function Ke(){const n=["admin@company.com","dev@company.com","lead@company.com","ops@company.com"],a=["192.168.1.10","10.0.0.42","172.16.0.5","192.168.1.22"],t=["my-saas-app","cli-tool","api-service","staging","production"],l=["auth","project","admin","deploy","api","system"];return Array.from({length:50},(c,s)=>{const r=Y[Math.floor(Math.random()*Y.length)],o=r.startsWith("user")?"auth":r.startsWith("project")?"project":r.startsWith("key")?"api":r.startsWith("build")?"deploy":r.startsWith("role")||r.startsWith("settings")?"admin":l[Math.floor(Math.random()*l.length)];return{id:`evt-${s}`,timestamp:new Date(Date.now()-s*18e5-Math.random()*6e5).toISOString(),user:n[Math.floor(Math.random()*n.length)],action:r,target:t[Math.floor(Math.random()*t.length)],details:`${r.replace(".",": ")} by user on ${t[Math.floor(Math.random()*t.length)]}`,ip:a[Math.floor(Math.random()*a.length)],category:o}})}const Z={auth:"#553DE9",project:"#1FC5A8",admin:"#F59E0B",deploy:"#C45B5B",api:"#6366F1",system:"#939084"};function Qe({category:n}){return e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide",style:{backgroundColor:`${Z[n]}15`,color:Z[n]},children:n})}function Xe({events:n,onFetch:a,pollInterval:t=3e4,className:l=""}){const[c,s]=m.useState(n||Ke()),[r,o]=m.useState(""),[g,j]=m.useState(""),[u,b]=m.useState(""),[h,y]=m.useState(""),[v,E]=m.useState(""),[x,N]=m.useState(!1),[f,D]=m.useState(null),[d,p]=m.useState(1),[A,C]=m.useState(!1),B=m.useRef(null),T=15;m.useEffect(()=>{if(!a||t<=0)return;const i=async()=>{try{const k=await a({search:r,user:g,actionType:u,dateFrom:h,dateTo:v});s(k)}catch{}};return B.current=setInterval(i,t),()=>{B.current&&clearInterval(B.current)}},[a,t,r,g,u,h,v]);const de=[...new Set(c.map(i=>i.user))].sort(),xe=[...new Set(c.map(i=>i.action))].sort(),M=c.filter(i=>{if(r){const k=r.toLowerCase();if(!(i.action.toLowerCase().includes(k)||i.user.toLowerCase().includes(k)||i.target.toLowerCase().includes(k)||i.details.toLowerCase().includes(k)||i.ip.includes(k)))return!1}return!(g&&i.user!==g||u&&i.action!==u||h&&i.timestamp<h||v&&i.timestamp>v+"T23:59:59")}),$=Math.ceil(M.length/T),J=M.slice((d-1)*T,d*T);m.useEffect(()=>{p(1)},[r,g,u,h,v]);const me=m.useCallback(()=>{const i=["Timestamp","User","Action","Target","Details","IP","Category"],k=M.map(F=>[F.timestamp,F.user,F.action,F.target,`"${F.details.replace(/"/g,'""')}"`,F.ip,F.category]),S=[i.join(","),...k.map(F=>F.join(","))].join(`
|
|
32
|
-
`),pe=new Blob([S],{type:"text/csv"}),q=URL.createObjectURL(pe),U=document.createElement("a");U.href=q,U.download=`audit-log-${new Date().toISOString().split("T")[0]}.csv`,U.click(),URL.revokeObjectURL(q)},[M]),he=m.useCallback(async()=>{if(a){C(!0);try{const i=await a({search:r,user:g,actionType:u,dateFrom:h,dateTo:v});s(i)}catch{}finally{C(!1)}}},[a,r,g,u,h,v]),ue=i=>new Date(i).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1});return e.jsxs("div",{className:`space-y-4 ${l}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"Audit Trail"}),e.jsxs("span",{className:"text-xs text-[#939084] ml-1",children:[M.length," event",M.length!==1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:"sm",variant:"ghost",icon:le,onClick:he,loading:A,children:"Refresh"}),e.jsx(w,{size:"sm",variant:"ghost",icon:V,onClick:me,children:"CSV"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(X,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#939084]"}),e.jsx("input",{type:"text",value:r,onChange:i=>o(i.target.value),placeholder:"Search events...",className:"w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084]"})]}),e.jsx(w,{size:"sm",variant:x?"secondary":"ghost",icon:Pe,onClick:()=>N(!x),children:"Filters"})]}),x&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 p-3 border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg bg-[#F8F4F0] dark:bg-[#222228]",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"User"}),e.jsxs("select",{value:g,onChange:i=>j(i.target.value),className:"w-full px-2 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"",children:"All Users"}),de.map(i=>e.jsx("option",{value:i,children:i},i))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Action"}),e.jsxs("select",{value:u,onChange:i=>b(i.target.value),className:"w-full px-2 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"",children:"All Actions"}),xe.map(i=>e.jsx("option",{value:i,children:i},i))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"From"}),e.jsx("input",{type:"date",value:h,onChange:i=>y(i.target.value),className:"w-full px-2 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"To"}),e.jsx("input",{type:"date",value:v,onChange:i=>E(i.target.value),className:"w-full px-2 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]})]})]}),e.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#F8F4F0] dark:bg-[#222228]",children:[e.jsx("th",{className:"w-8 px-2 py-2.5"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960]",children:"Timestamp"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960]",children:"User"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960]",children:"Action"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960]",children:"Target"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960] hidden md:table-cell",children:"IP"})]})}),e.jsxs("tbody",{children:[J.map(i=>e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"border-t border-[#ECEAE3] dark:border-[#2A2A30] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors cursor-pointer",onClick:()=>D(f===i.id?null:i.id),children:[e.jsx("td",{className:"px-2 py-2.5 text-center",children:f===i.id?e.jsx(ee,{size:12,className:"text-[#939084]"}):e.jsx(R,{size:12,className:"text-[#939084]"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[#939084]",children:[e.jsx(I,{size:12}),e.jsx("span",{className:"font-mono",children:ue(i.timestamp)})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ke,{name:i.user.split("@")[0],size:"sm"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] truncate max-w-[150px]",children:i.user})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{category:i.category}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:i.action})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx("span",{className:"text-[#6B6960] truncate max-w-[120px] block",children:i.target||"--"})}),e.jsx("td",{className:"px-3 py-2.5 hidden md:table-cell",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-[#939084]",children:[e.jsx(Ae,{size:12}),e.jsx("span",{className:"font-mono",children:i.ip})]})})]},i.id),f===i.id&&e.jsx("tr",{className:"bg-[#F8F4F0] dark:bg-[#222228]",children:e.jsx("td",{colSpan:6,className:"px-6 py-3",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ge,{size:14,className:"text-[#939084] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-[#6B6960]",children:[e.jsx("p",{className:"font-medium text-[#201515] dark:text-[#E8E6E3] mb-1",children:"Details"}),e.jsx("p",{children:i.details}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-[#939084]",children:[e.jsxs("span",{children:["Event ID: ",i.id]}),e.jsxs("span",{children:["Full timestamp: ",new Date(i.timestamp).toISOString()]}),e.jsxs("span",{children:["IP: ",i.ip]})]})]})]})})},`${i.id}-details`)]})),J.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-sm text-[#939084]",children:"No events match your filters."})})]})]})}),$>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[#939084]",children:["Showing ",(d-1)*T+1,"-",Math.min(d*T,M.length)," of ",M.length]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>p(i=>Math.max(1,i-1)),disabled:d===1,className:"p-1.5 rounded-lg text-[#939084] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] disabled:opacity-40 transition-colors",children:e.jsx(we,{size:16})}),Array.from({length:Math.min($,5)},(i,k)=>{let S;return $<=5||d<=3?S=k+1:d>=$-2?S=$-4+k:S=d-2+k,e.jsx("button",{onClick:()=>p(S),className:`w-8 h-8 rounded-lg text-xs font-medium transition-colors ${d===S?"bg-[#553DE9] text-white":"text-[#939084] hover:bg-[#F8F4F0] dark:hover:bg-[#222228]"}`,children:S},S)}),e.jsx("button",{onClick:()=>p(i=>Math.min($,i+1)),disabled:d===$,className:"p-1.5 rounded-lg text-[#939084] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] disabled:opacity-40 transition-colors",children:e.jsx(R,{size:16})})]})]})]})}const et=[{id:"u-1",name:"Alex Chen",email:"alex@company.com",role:"admin",status:"active",lastActive:new Date(Date.now()-3e5).toISOString(),joinedAt:new Date(Date.now()-180*864e5).toISOString()},{id:"u-2",name:"Sarah Johnson",email:"sarah@company.com",role:"editor",status:"active",lastActive:new Date(Date.now()-36e5).toISOString(),joinedAt:new Date(Date.now()-90*864e5).toISOString()},{id:"u-3",name:"Mike Davis",email:"mike@company.com",role:"editor",status:"active",lastActive:new Date(Date.now()-864e5).toISOString(),joinedAt:new Date(Date.now()-60*864e5).toISOString()},{id:"u-4",name:"Emily Park",email:"emily@company.com",role:"viewer",status:"inactive",lastActive:new Date(Date.now()-30*864e5).toISOString(),joinedAt:new Date(Date.now()-120*864e5).toISOString()},{id:"u-5",name:"Jordan Lee",email:"jordan@company.com",role:"editor",status:"invited",lastActive:null,joinedAt:new Date(Date.now()-2*864e5).toISOString()}],P={admin:{label:"Admin",color:"#553DE9"},editor:{label:"Editor",color:"#1FC5A8"},viewer:{label:"Viewer",color:"#939084"}},K={active:{label:"Active",color:"#1FC5A8"},inactive:{label:"Inactive",color:"#939084"},invited:{label:"Invited",color:"#F59E0B"}};function O(n){if(!n)return"Never";const a=Date.now()-new Date(n).getTime(),t=Math.floor(a/6e4);if(t<1)return"Just now";if(t<60)return`${t}m ago`;const l=Math.floor(t/60);if(l<24)return`${l}h ago`;const c=Math.floor(l/24);return c<30?`${c}d ago`:`${Math.floor(c/30)}mo ago`}function oe(n){return n.split(" ").map(a=>a[0]).join("").toUpperCase().slice(0,2)}function tt({onSubmit:n,onCancel:a}){const[t,l]=m.useState(""),[c,s]=m.useState("editor");return e.jsxs("div",{className:"border border-[#553DE9]/20 bg-[#553DE9]/5 dark:bg-[#553DE9]/10 rounded-lg p-4 space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3]",children:"Invite New User"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Email"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ce,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#939084]"}),e.jsx("input",{type:"email",value:t,onChange:r=>l(r.target.value),placeholder:"colleague@company.com",className:"w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084]",autoFocus:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Role"}),e.jsxs("select",{value:c,onChange:r=>s(r.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"viewer",children:"Viewer"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:"sm",icon:ie,onClick:()=>n(t,c),disabled:!t.trim()||!t.includes("@"),children:"Send Invite"}),e.jsx(w,{size:"sm",variant:"ghost",onClick:a,children:"Cancel"})]})]})}function st({user:n,onClose:a,onChangeRole:t,onToggleStatus:l}){return e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[n.avatar_url?e.jsx("img",{src:n.avatar_url,alt:"",className:"w-10 h-10 rounded-full"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-[#553DE9] flex items-center justify-center text-white text-sm font-bold",children:oe(n.name)}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:n.name}),e.jsx("p",{className:"text-xs text-[#939084]",children:n.email})]})]}),e.jsx("button",{onClick:a,className:"p-1 rounded-lg text-[#939084] hover:bg-[#F8F4F0] dark:hover:bg-[#222228]",children:e.jsx(te,{size:16})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Role"}),e.jsxs("select",{value:n.role,onChange:c=>t(c.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"viewer",children:"Viewer"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Status"}),e.jsx("button",{onClick:l,className:"flex items-center gap-2 px-3 py-2 w-full rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-sm text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:n.status==="active"?e.jsxs(e.Fragment,{children:[e.jsx(He,{size:16,className:"text-[#1FC5A8]"}),e.jsx("span",{className:"text-[#1FC5A8]",children:"Active"})]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{size:16,className:"text-[#939084]"}),e.jsx("span",{className:"text-[#939084]",children:"Inactive"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-6 text-xs text-[#939084] pt-2 border-t border-[#ECEAE3] dark:border-[#2A2A30]",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(I,{size:12}),e.jsxs("span",{children:["Last active: ",O(n.lastActive)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(I,{size:12}),e.jsxs("span",{children:["Joined: ",O(n.joinedAt)]})]})]})]})}function at({users:n,onChangeRole:a,onToggleStatus:t,onInviteUser:l,className:c=""}){const[s,r]=m.useState(n||et),[o,g]=m.useState(""),[j,u]=m.useState(""),[b,h]=m.useState(!1),[y,v]=m.useState(null),E=s.filter(d=>{if(o){const p=o.toLowerCase();if(!d.name.toLowerCase().includes(p)&&!d.email.toLowerCase().includes(p))return!1}return!(j&&d.role!==j)}),x=s.find(d=>d.id===y)||null,N=m.useCallback(async(d,p)=>{l&&await l(d,p);const A={id:`u-${Date.now()}`,name:d.split("@")[0],email:d,role:p,status:"invited",lastActive:null,joinedAt:new Date().toISOString()};r(C=>[...C,A]),h(!1)},[l]),f=m.useCallback(async(d,p)=>{a&&await a(d,p),r(A=>A.map(C=>C.id===d?{...C,role:p}:C))},[a]),D=m.useCallback(async d=>{const p=s.find(C=>C.id===d);if(!p)return;const A=p.status!=="active";t&&await t(d,A),r(C=>C.map(B=>B.id===d?{...B,status:A?"active":"inactive"}:B))},[s,t]);return e.jsxs("div",{className:`space-y-4 ${c}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"User Management"}),e.jsxs("span",{className:"text-xs text-[#939084]",children:[s.length," users"]})]}),!b&&e.jsx(w,{size:"sm",variant:"secondary",icon:ie,onClick:()=>h(!0),children:"Invite User"})]}),b&&e.jsx(tt,{onSubmit:N,onCancel:()=>h(!1)}),x&&e.jsx(st,{user:x,onClose:()=>v(null),onChangeRole:d=>f(x.id,d),onToggleStatus:()=>D(x.id)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(X,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#939084]"}),e.jsx("input",{type:"text",value:o,onChange:d=>g(d.target.value),placeholder:"Search users...",className:"w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084]"})]}),e.jsxs("select",{value:j,onChange:d=>u(d.target.value),className:"px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"",children:"All Roles"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"viewer",children:"Viewer"})]})]}),e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden divide-y divide-[#ECEAE3] dark:divide-[#2A2A30]",children:[E.map(d=>e.jsxs("button",{type:"button",onClick:()=>v(y===d.id?null:d.id),className:`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors ${y===d.id?"bg-[#F8F4F0] dark:bg-[#222228]":""}`,children:[d.avatar_url?e.jsx("img",{src:d.avatar_url,alt:"",className:"w-8 h-8 rounded-full flex-shrink-0"}):e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#553DE9] flex items-center justify-center text-white text-xs font-bold flex-shrink-0",children:oe(d.name)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3] truncate",children:d.name}),e.jsx("p",{className:"text-xs text-[#939084] truncate",children:d.email})]}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium flex-shrink-0",style:{backgroundColor:`${P[d.role].color}15`,color:P[d.role].color},children:P[d.role].label}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:K[d.status].color}}),e.jsx("span",{className:"text-xs text-[#939084] hidden md:inline",children:K[d.status].label})]}),e.jsx("span",{className:"text-xs text-[#939084] flex-shrink-0 hidden lg:inline w-16 text-right",children:O(d.lastActive)}),e.jsx(R,{size:14,className:"text-[#939084] flex-shrink-0"})]},d.id)),E.length===0&&e.jsx("div",{className:"px-4 py-8 text-center text-sm text-[#939084]",children:"No users match your search."})]})]})}const nt=[{id:"proj-1",name:"Customer Portal v2",submittedBy:"sarah@company.com",template:"SaaS App",provider:"Claude",estimatedCost:12.5,estimatedIterations:15,submittedAt:new Date(Date.now()-36e5).toISOString(),description:"Complete redesign of the customer-facing portal with new billing integration.",status:"pending"},{id:"proj-2",name:"Internal CLI Tools",submittedBy:"mike@company.com",template:"CLI Tool",provider:"Claude",estimatedCost:4.2,estimatedIterations:8,submittedAt:new Date(Date.now()-72e5).toISOString(),description:"Set of internal CLI tools for deployment automation.",status:"pending"},{id:"proj-3",name:"Analytics Dashboard",submittedBy:"jordan@company.com",template:"SaaS App",provider:"Codex",estimatedCost:8.9,estimatedIterations:12,submittedAt:new Date(Date.now()-144e5).toISOString(),description:"Real-time analytics dashboard for product metrics.",status:"pending"}],rt=[{projectId:"p-1",projectName:"Main Platform",budgetLimit:100,budgetUsed:67.4,alertThreshold:80},{projectId:"p-2",projectName:"Mobile App",budgetLimit:50,budgetUsed:12.3,alertThreshold:75},{projectId:"p-3",projectName:"Data Pipeline",budgetLimit:30,budgetUsed:28.5,alertThreshold:90}],it=["SaaS App","CLI Tool","REST API","Discord Bot","Chrome Extension","Mobile App","Data Pipeline","Landing Page","Docs Site"];function lt({project:n,onApprove:a,onReject:t}){const[l,c]=m.useState(!1),[s,r]=m.useState(""),[o,g]=m.useState(!1);return e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>c(!l),className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[l?e.jsx(ee,{size:14,className:"text-[#939084]"}):e.jsx(R,{size:14,className:"text-[#939084]"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:n.name}),e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-[#F59E0B]/10 text-[#F59E0B]",children:"Pending"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[#939084] mt-0.5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Se,{size:10}),n.submittedBy]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(se,{size:10}),n.template]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{size:10}),"~$",n.estimatedCost.toFixed(2)]})]})]}),e.jsx("span",{className:"text-xs text-[#939084] flex-shrink-0",children:new Date(n.submittedAt).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})})]}),l&&e.jsxs("div",{className:"px-4 pb-4 pt-2 border-t border-[#ECEAE3] dark:border-[#2A2A30] space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[#6B6960]",children:"Template"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:n.template})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[#6B6960]",children:"Provider"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:n.provider})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[#6B6960]",children:"Est. Cost"}),e.jsxs("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:["$",n.estimatedCost.toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[#6B6960]",children:"Est. Iterations"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:n.estimatedIterations})]})]}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:n.description}),o?e.jsxs("div",{className:"space-y-2",children:[e.jsx("textarea",{value:s,onChange:j=>r(j.target.value),placeholder:"Add a comment (optional)...",rows:2,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084] resize-none"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:"sm",icon:ce,onClick:()=>a(s),children:"Approve"}),e.jsx(w,{size:"sm",variant:"danger",icon:te,onClick:()=>t(s),children:"Reject"}),e.jsx(w,{size:"sm",variant:"ghost",onClick:()=>g(!1),children:"Cancel"})]})]}):e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(w,{size:"sm",variant:"secondary",icon:fe,onClick:()=>g(!0),children:"Review"})})]})]})}function ct({configs:n}){return e.jsx("div",{className:"space-y-3",children:n.map(a=>{const t=a.budgetLimit>0?a.budgetUsed/a.budgetLimit*100:0,l=t>=a.alertThreshold,c=t>=100;return e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:a.projectName}),e.jsxs("div",{className:"flex items-center gap-2",children:[l&&e.jsx(G,{size:14,className:c?"text-[#C45B5B]":"text-[#F59E0B]"}),e.jsxs("span",{className:"text-xs font-mono text-[#939084]",children:["$",a.budgetUsed.toFixed(2)," / $",a.budgetLimit.toFixed(2)]})]})]}),e.jsx("div",{className:"h-2 bg-[#F8F4F0] dark:bg-[#1A1A1E] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.min(t,100)}%`,background:c?"#C45B5B":l?"#F59E0B":"#1FC5A8"}})}),e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsxs("span",{className:"text-[10px] text-[#939084]",children:[t.toFixed(0),"% used"]}),e.jsxs("span",{className:"text-[10px] text-[#939084]",children:["Alert at ",a.alertThreshold,"%"]})]})]},a.projectId)})})}function ot({allTemplates:n}){const[a,t]=m.useState({Engineering:new Set(["SaaS App","CLI Tool","REST API","Data Pipeline"]),Design:new Set(["SaaS App","Landing Page","Mobile App"]),Marketing:new Set(["Landing Page","Docs Site"])}),l=Object.keys(a),c=(s,r)=>{t(o=>{const g={...o},j=new Set(g[s]);return j.has(r)?j.delete(r):j.add(r),g[s]=j,g})};return e.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#F8F4F0] dark:bg-[#222228]",children:[e.jsx("th",{className:"text-left px-3 py-2 text-xs font-medium text-[#6B6960]",children:"Template"}),l.map(s=>e.jsx("th",{className:"text-center px-3 py-2 text-xs font-medium text-[#6B6960]",children:s},s))]})}),e.jsx("tbody",{children:n.map(s=>e.jsxs("tr",{className:"border-t border-[#ECEAE3] dark:border-[#2A2A30] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[e.jsx("td",{className:"px-3 py-2 text-[#201515] dark:text-[#E8E6E3]",children:s}),l.map(r=>{var o;return e.jsx("td",{className:"text-center px-3 py-2",children:e.jsx("input",{type:"checkbox",checked:((o=a[r])==null?void 0:o.has(s))||!1,onChange:()=>c(r,s),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"})},r)})]},s))})]})})}function dt({pendingProjects:n,budgetConfigs:a,className:t=""}){const[l,c]=m.useState(n||nt),[s]=m.useState(a||rt),[r,o]=m.useState("approvals"),g=l.filter(h=>h.status==="pending").length,j=m.useCallback((h,y)=>{c(v=>v.map(E=>E.id===h?{...E,status:"approved"}:E))},[]),u=m.useCallback((h,y)=>{c(v=>v.map(E=>E.id===h?{...E,status:"rejected"}:E))},[]),b=[{id:"approvals",label:"Approvals",icon:ce,count:g},{id:"budgets",label:"Budgets",icon:W},{id:"templates",label:"Templates",icon:se}];return e.jsxs("div",{className:`space-y-4 ${t}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Le,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"Project Governance"})]}),e.jsx("div",{className:"flex items-center gap-1 border-b border-[#ECEAE3] dark:border-[#2A2A30]",children:b.map(h=>e.jsxs("button",{onClick:()=>o(h.id),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors ${r===h.id?"border-[#553DE9] text-[#553DE9]":"border-transparent text-[#939084] hover:text-[#36342E] dark:hover:text-[#E8E6E3]"}`,children:[e.jsx(h.icon,{size:14}),h.label,h.count!==void 0&&h.count>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 rounded-full text-[10px] bg-[#553DE9]/10 text-[#553DE9]",children:h.count})]},h.id))}),r==="approvals"&&e.jsx("div",{className:"space-y-3",children:l.filter(h=>h.status==="pending").length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(je,{size:24,className:"mx-auto text-[#939084] mb-2"}),e.jsx("p",{className:"text-sm text-[#939084]",children:"No pending approvals"}),e.jsx("p",{className:"text-xs text-[#939084] mt-1",children:"All project requests have been reviewed."})]}):l.filter(h=>h.status==="pending").map(h=>e.jsx(lt,{project:h,onApprove:y=>j(h.id,y),onReject:y=>u(h.id,y)},h.id))}),r==="budgets"&&e.jsx(ct,{configs:s}),r==="templates"&&e.jsx(ot,{allTemplates:it})]})}function xt(){return[{id:"c-1",title:"API Keys Rotated Within 90 Days",description:"All active API keys should be rotated at least every 90 days to minimize exposure risk.",status:"warning",category:"security",lastChecked:new Date(Date.now()-36e5).toISOString(),remediationUrl:"/admin/settings",details:"2 of 3 keys are within 90 days. 1 key (Production CI/CD) is 120 days old."},{id:"c-2",title:"All Users Have MFA Enabled",description:"Multi-factor authentication should be enabled for all user accounts.",status:"fail",category:"access",lastChecked:new Date(Date.now()-36e5).toISOString(),remediationUrl:"/admin/settings",details:"3 of 5 users have MFA enabled. 2 users need to enable MFA."},{id:"c-3",title:"Audit Logging Enabled",description:"All user actions should be captured in the audit log.",status:"pass",category:"audit",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"Audit logging is active. 1,247 events captured in the last 30 days."},{id:"c-4",title:"Data Retention Policy Set",description:"A data retention policy must be configured specifying how long logs and data are kept.",status:"pass",category:"data",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"Retention policy: 90 days for logs, 365 days for audit events."},{id:"c-5",title:"Access Review Completed",description:"User access should be reviewed quarterly to ensure least-privilege principle.",status:"warning",category:"access",lastChecked:new Date(Date.now()-36e5).toISOString(),remediationUrl:"/admin",details:"Last access review was 85 days ago. Due for review within 5 days."},{id:"c-6",title:"Encryption at Rest Enabled",description:"All stored data including project files and secrets must be encrypted at rest.",status:"pass",category:"security",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"AES-256 encryption enabled for all storage backends."},{id:"c-7",title:"Session Timeout Configured",description:"User sessions should expire after a configured period of inactivity.",status:"pass",category:"security",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"Session timeout set to 30 minutes of inactivity."},{id:"c-8",title:"Rate Limiting Active",description:"API rate limiting should be enabled to prevent abuse and ensure fair usage.",status:"pass",category:"security",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"Rate limit: 100 requests/minute per API key."}]}function mt({status:n}){switch(n){case"pass":return e.jsx(ae,{size:18,className:"text-[#1FC5A8]"});case"fail":return e.jsx(ne,{size:18,className:"text-[#C45B5B]"});case"warning":return e.jsx(G,{size:18,className:"text-[#F59E0B]"})}}const ht={security:Fe,access:z,data:De,audit:ve};function ut({score:n}){const s=2*Math.PI*56,o=270/360*s,g=n/100*o,j=n>=80?"#1FC5A8":n>=60?"#F59E0B":"#C45B5B",u=135;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[e.jsxs("svg",{width:140,height:140,viewBox:"0 0 140 140",children:[e.jsx("circle",{cx:70,cy:70,r:56,fill:"none",stroke:"currentColor",strokeOpacity:"0.08",strokeWidth:10,strokeDasharray:`${o} ${s}`,strokeLinecap:"round",transform:`rotate(${u} 70 70)`}),e.jsx("circle",{cx:70,cy:70,r:56,fill:"none",stroke:j,strokeWidth:10,strokeDasharray:`${g} ${s}`,strokeLinecap:"round",transform:`rotate(${u} 70 70)`,className:"transition-all duration-700"})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsxs("span",{className:"text-3xl font-bold text-[#36342E] dark:text-[#E8E6E3]",children:[n,"%"]}),e.jsx("span",{className:"text-xs text-[#939084]",children:"Compliant"})]})]})}function pt({items:n,onRefresh:a,className:t=""}){const[l,c]=m.useState(n||xt()),[s,r]=m.useState(!1),[o,g]=m.useState(null),[j,u]=m.useState(!1),b=l.filter(f=>f.status==="pass").length,h=l.filter(f=>f.status==="warning").length,y=l.filter(f=>f.status==="fail").length,v=l.length>0?Math.round(b/l.length*100):0,E=m.useCallback(async()=>{r(!0);try{if(a){const f=await a();c(f)}}catch{}finally{r(!1)}},[a]),x=m.useCallback(()=>{u(!0);const f={generatedAt:new Date().toISOString(),overallScore:v,summary:{pass:b,warning:h,fail:y,total:l.length},items:l.map(A=>({title:A.title,status:A.status,category:A.category,details:A.details,lastChecked:A.lastChecked}))},D=new Blob([JSON.stringify(f,null,2)],{type:"application/json"}),d=URL.createObjectURL(D),p=document.createElement("a");p.href=d,p.download=`compliance-report-${new Date().toISOString().split("T")[0]}.json`,p.click(),URL.revokeObjectURL(d),setTimeout(()=>u(!1),1e3)},[l,v,b,h,y]),N=["security","access","data","audit"];return e.jsxs("div",{className:`space-y-6 ${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"Compliance"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:"sm",variant:"ghost",icon:le,onClick:E,loading:s,children:"Refresh"}),e.jsx(w,{size:"sm",variant:"secondary",icon:V,onClick:x,loading:j,children:"Generate Report"})]})]}),e.jsx("div",{className:"card p-6",children:e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsx(ut,{score:v}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Compliance Score"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{size:16,className:"text-[#1FC5A8]"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-lg font-bold text-[#36342E] dark:text-[#E8E6E3]",children:b}),e.jsx("span",{className:"text-xs text-[#939084] ml-1",children:"Passing"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{size:16,className:"text-[#F59E0B]"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-lg font-bold text-[#36342E] dark:text-[#E8E6E3]",children:h}),e.jsx("span",{className:"text-xs text-[#939084] ml-1",children:"Warnings"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{size:16,className:"text-[#C45B5B]"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-lg font-bold text-[#36342E] dark:text-[#E8E6E3]",children:y}),e.jsx("span",{className:"text-xs text-[#939084] ml-1",children:"Failing"})]})]})]})]})]})}),N.map(f=>{const D=l.filter(p=>p.category===f);if(D.length===0)return null;const d=ht[f];return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-xs font-semibold text-[#6B6960] uppercase tracking-wider",children:f})]}),e.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden divide-y divide-[#ECEAE3] dark:divide-[#2A2A30]",children:D.map(p=>e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>g(o===p.id?null:p.id),className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[e.jsx(mt,{status:p.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:p.title}),e.jsx("p",{className:"text-xs text-[#939084] truncate",children:p.description})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-[#939084] flex-shrink-0",children:[e.jsx(I,{size:10}),"Checked ",new Date(p.lastChecked).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]})]}),o===p.id&&e.jsxs("div",{className:"px-4 pb-3 pt-1 bg-[#F8F4F0] dark:bg-[#222228]",children:[p.details&&e.jsx("p",{className:"text-sm text-[#6B6960] mb-2",children:p.details}),p.remediationUrl&&p.status!=="pass"&&e.jsxs("a",{href:p.remediationUrl,className:"inline-flex items-center gap-1 text-xs text-[#553DE9] hover:underline",children:[e.jsx(Ee,{size:12}),"Fix this issue"]})]})]},p.id))})]},f)})]})}function gt(){return[{label:"Total Users",value:"24",change:"+3 this month",changePositive:!0,icon:z,color:"#553DE9"},{label:"Active Projects",value:"18",change:"+5 this week",changePositive:!0,icon:re,color:"#1FC5A8"},{label:"Total Builds",value:"342",change:"+47 this week",changePositive:!0,icon:Me,color:"#F59E0B"},{label:"Monthly Cost",value:"$201.00",change:"-12% vs last month",changePositive:!0,icon:W,color:"#C45B5B"}]}function jt(){return[{name:"API Server",status:"healthy",latency:45},{name:"Claude Provider",status:"healthy",latency:230},{name:"Codex Provider",status:"degraded",latency:890},{name:"Gemini Provider",status:"healthy",latency:310},{name:"Task Queue",status:"healthy",latency:12},{name:"WebSocket",status:"healthy",latency:8}]}function ft(){return[{user:"alex@company.com",action:"started build",target:"customer-portal"},{user:"sarah@company.com",action:"deployed",target:"analytics-dashboard"},{user:"mike@company.com",action:"created project",target:"cli-tools"},{user:"jordan@company.com",action:"completed build",target:"api-service"},{user:"alex@company.com",action:"updated settings",target:"provider config"},{user:"emily@company.com",action:"invited user",target:"new-dev@company.com"},{user:"sarah@company.com",action:"rotated API key",target:"production"},{user:"mike@company.com",action:"started build",target:"mobile-app"},{user:"jordan@company.com",action:"approved project",target:"data-pipeline"},{user:"alex@company.com",action:"failed build",target:"legacy-service"},{user:"sarah@company.com",action:"created checkpoint",target:"analytics-dashboard"},{user:"emily@company.com",action:"changed role",target:"mike -> editor"},{user:"mike@company.com",action:"deployed",target:"cli-tools"},{user:"alex@company.com",action:"started build",target:"landing-page"},{user:"jordan@company.com",action:"reviewed project",target:"api-service"},{user:"sarah@company.com",action:"completed build",target:"analytics-dashboard"},{user:"emily@company.com",action:"updated template",target:"saas-app"},{user:"mike@company.com",action:"started build",target:"discord-bot"},{user:"alex@company.com",action:"approved project",target:"chrome-ext"},{user:"jordan@company.com",action:"deployed",target:"data-pipeline"}].map((a,t)=>({id:`act-${t}`,...a,timestamp:new Date(Date.now()-t*9e5).toISOString()}))}function bt(){return[{name:"Alex C.",builds:87},{name:"Sarah J.",builds:64},{name:"Mike D.",builds:52},{name:"Jordan L.",builds:41},{name:"Emily P.",builds:38},{name:"Others",builds:60}]}function vt({cards:n}){return e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:n.map(a=>e.jsx("div",{className:"card p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-[#6B6960] uppercase tracking-wider",children:a.label}),e.jsx("p",{className:"text-2xl font-bold text-[#36342E] dark:text-[#E8E6E3] mt-1",children:a.value}),a.change&&e.jsx("p",{className:`text-xs mt-1 ${a.changePositive?"text-[#1FC5A8]":"text-[#C45B5B]"}`,children:a.change})]}),e.jsx("div",{className:"p-2 rounded-lg",style:{backgroundColor:`${a.color}10`,color:a.color},children:e.jsx(a.icon,{size:20})})]})},a.label))})}function Et({data:n}){const a=Math.max(...n.map(t=>t.builds));return e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(_,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Builds per User"})]}),e.jsx("div",{className:"space-y-3",children:n.map(t=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-[#6B6960] w-16 text-right flex-shrink-0",children:t.name}),e.jsx("div",{className:"flex-1 h-6 bg-[#F8F4F0] dark:bg-[#1A1A1E] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-[#553DE9] transition-all duration-500 flex items-center justify-end pr-2",style:{width:`${t.builds/a*100}%`},children:e.jsx("span",{className:"text-[10px] text-white font-mono",children:t.builds})})})]},t.name))})]})}function Nt({health:n}){const a={healthy:"#1FC5A8",degraded:"#F59E0B",down:"#C45B5B"};return e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx($e,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"System Health"})]}),e.jsx("div",{className:"space-y-2",children:n.map(t=>e.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:a[t.status]}}),e.jsx("span",{className:"text-sm text-[#36342E] dark:text-[#E8E6E3]",children:t.name})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.latency!==void 0&&e.jsxs("span",{className:"text-xs font-mono text-[#939084]",children:[t.latency,"ms"]}),e.jsx("span",{className:"text-[10px] font-medium uppercase",style:{color:a[t.status]},children:t.status})]})]},t.name))})]})}function yt({actions:n}){const a=t=>new Date(t).toLocaleString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(H,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Recent Activity"})]}),e.jsx("div",{className:"space-y-1 max-h-[400px] overflow-y-auto terminal-scroll",children:n.map(t=>e.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 rounded-lg hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[e.jsx("span",{className:"text-[10px] font-mono text-[#939084] flex-shrink-0 w-10",children:a(t.timestamp)}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("span",{className:"text-xs",children:[e.jsx("span",{className:"text-[#553DE9] font-medium",children:t.user.split("@")[0]}),e.jsxs("span",{className:"text-[#6B6960]",children:[" ",t.action," "]}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:t.target})]})})]},t.id))})]})}function kt(){return e.jsxs("div",{className:"max-w-[500px] mx-auto px-6 py-20 text-center",children:[e.jsx(Be,{size:48,className:"mx-auto text-[#C45B5B] mb-4"}),e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] dark:text-[#E8E6E3] mb-2",children:"Access Denied"}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:"You do not have permission to access the admin dashboard. Contact your organization administrator for access."})]})}const At=[{id:"overview",label:"Overview",icon:H},{id:"users",label:"Users",icon:z},{id:"analytics",label:"Analytics",icon:_},{id:"governance",label:"Governance",icon:re},{id:"audit",label:"Audit Trail",icon:I},{id:"compliance",label:"Compliance",icon:Q}];function Ht(){const{user:n,isLocalMode:a}=Ne(),[t,l]=m.useState("overview"),c=a||(n==null?void 0:n.authenticated)===!0,[s]=m.useState(gt),[r]=m.useState(jt),[o]=m.useState(ft),[g]=m.useState(bt);return c?e.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 py-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] dark:text-[#E8E6E3]",children:"Admin"})}),e.jsx("div",{className:"flex items-center gap-1 border-b border-[#ECEAE3] dark:border-[#2A2A30] mb-6 overflow-x-auto",children:At.map(j=>e.jsxs("button",{onClick:()=>l(j.id),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap ${t===j.id?"border-[#553DE9] text-[#553DE9]":"border-transparent text-[#939084] hover:text-[#36342E] dark:hover:text-[#E8E6E3]"}`,children:[e.jsx(j.icon,{size:14}),j.label]},j.id))}),t==="overview"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(vt,{cards:s}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"card p-4 flex flex-col items-center justify-center",children:[e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3] mb-3",children:"Build Success Rate"}),e.jsx(We,{percentage:94,size:96,strokeWidth:6,color:"#1FC5A8",children:e.jsx("span",{className:"text-lg font-bold text-[#36342E] dark:text-[#E8E6E3]",children:"94%"})}),e.jsx("p",{className:"text-xs text-[#939084] mt-2",children:"342 total builds"})]}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(Nt,{health:r})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsx(Et,{data:g}),e.jsx(yt,{actions:o})]})]}),t==="users"&&e.jsx(at,{}),t==="analytics"&&e.jsx(Ze,{}),t==="governance"&&e.jsx(dt,{}),t==="audit"&&e.jsx(Xe,{}),t==="compliance"&&e.jsx(pt,{})]}):e.jsx(kt,{})}export{Ht as default};
|
|
31
|
+
*/const Ge=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],He=L("toggle-right",Ge);function We({percentage:n,size:a=64,strokeWidth:t=4,color:l="#553DE9",trackColor:c="rgba(0,0,0,0.08)",className:s="",children:r}){const o=(a-t)/2,g=2*Math.PI*o,j=Math.max(0,Math.min(100,n)),u=g-j/100*g;return e.jsxs("div",{className:`relative inline-flex items-center justify-center ${s}`,style:{width:a,height:a},children:[e.jsxs("svg",{width:a,height:a,className:"transform -rotate-90",children:[e.jsx("circle",{cx:a/2,cy:a/2,r:o,fill:"none",stroke:c,strokeWidth:t}),e.jsx("circle",{cx:a/2,cy:a/2,r:o,fill:"none",stroke:l,strokeWidth:t,strokeLinecap:"round",strokeDasharray:g,strokeDashoffset:u,style:{transition:"stroke-dashoffset 0.6s ease-out"}})]}),r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r})]})}function Ve(){const n=Date.now(),a=864e5,t=Array.from({length:30},(r,o)=>({date:new Date(n-(29-o)*a).toISOString().split("T")[0],tokens:Math.floor(Math.random()*5e5)+1e5})),l=[{provider:"Claude",cost:124.5,percentage:62,color:"#553DE9"},{provider:"Codex",cost:48.3,percentage:24,color:"#1FC5A8"},{provider:"Gemini",cost:28.2,percentage:14,color:"#F59E0B"}],c=[{name:"SaaS App",count:45},{name:"CLI Tool",count:32},{name:"Discord Bot",count:28},{name:"REST API",count:21},{name:"Chrome Extension",count:14}],s=Array.from({length:7},()=>Array.from({length:24},(r,o)=>o>=9&&o<=17?Math.floor(Math.random()*80)+20:o>=18&&o<=22?Math.floor(Math.random()*40)+10:Math.floor(Math.random()*15)));return{tokenUsage:t,costBreakdown:l,buildSuccessRate:87,totalBuilds:342,successfulBuilds:298,failedBuilds:44,templateUsage:c,peakHours:s}}function Je({data:n}){const[a,t]=m.useState(null);if(n.length===0)return null;const l=600,c=200,s={top:20,right:20,bottom:30,left:60},r=l-s.left-s.right,o=c-s.top-s.bottom,g=Math.max(...n.map(x=>x.tokens)),j=0,u=g-j||1,b=n.map((x,N)=>({x:s.left+N/(n.length-1)*r,y:s.top+o-(x.tokens-j)/u*o,...x})),h=b.map((x,N)=>`${N===0?"M":"L"} ${x.x} ${x.y}`).join(" "),y=`${h} L ${b[b.length-1].x} ${s.top+o} L ${b[0].x} ${s.top+o} Z`,v=x=>x>=1e6?`${(x/1e6).toFixed(1)}M`:x>=1e3?`${(x/1e3).toFixed(0)}K`:String(x),E=Array.from({length:5},(x,N)=>({value:j+u*N/4,y:s.top+o-N/4*o}));return e.jsxs("svg",{viewBox:`0 0 ${l} ${c}`,className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[E.map((x,N)=>e.jsxs("g",{children:[e.jsx("line",{x1:s.left,y1:x.y,x2:l-s.right,y2:x.y,stroke:"currentColor",strokeOpacity:"0.08",strokeDasharray:"4 4"}),e.jsx("text",{x:s.left-8,y:x.y+4,textAnchor:"end",className:"text-[10px] fill-[#939084]",children:v(x.value)})]},N)),e.jsx("path",{d:y,fill:"url(#tokenGradient)",opacity:"0.15"}),e.jsx("path",{d:h,fill:"none",stroke:"#553DE9",strokeWidth:"2",strokeLinejoin:"round"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#553DE9"}),e.jsx("stop",{offset:"100%",stopColor:"#553DE9",stopOpacity:"0"})]})}),b.map((x,N)=>e.jsxs("g",{children:[e.jsx("circle",{cx:x.x,cy:x.y,r:a===N?5:3,fill:a===N?"#553DE9":"white",stroke:"#553DE9",strokeWidth:"2",className:"cursor-pointer transition-all",onMouseEnter:()=>t(N),onMouseLeave:()=>t(null)}),a===N&&e.jsxs("g",{children:[e.jsx("rect",{x:x.x-50,y:x.y-36,width:"100",height:"24",rx:"4",fill:"#36342E"}),e.jsxs("text",{x:x.x,y:x.y-20,textAnchor:"middle",className:"text-[10px] fill-white font-mono",children:[v(x.tokens)," | ",x.date.slice(5)]})]})]},N)),[0,Math.floor(n.length/2),n.length-1].map(x=>e.jsx("text",{x:b[x].x,y:c-4,textAnchor:"middle",className:"text-[10px] fill-[#939084]",children:n[x].date.slice(5)},x))]})}function qe({data:n}){const[a,t]=m.useState(null),l=n.reduce((u,b)=>u+b.cost,0),c=160,s=c/2,r=60,o=40;let g=-90;const j=n.map((u,b)=>{const h=u.percentage/100*360,y=g,v=g+h;g=v;const E=y*Math.PI/180,x=v*Math.PI/180,N=h>180?1:0,f=a===b?r+4:r,D=[`M ${s+o*Math.cos(E)} ${s+o*Math.sin(E)}`,`L ${s+f*Math.cos(E)} ${s+f*Math.sin(E)}`,`A ${f} ${f} 0 ${N} 1 ${s+f*Math.cos(x)} ${s+f*Math.sin(x)}`,`L ${s+o*Math.cos(x)} ${s+o*Math.sin(x)}`,`A ${o} ${o} 0 ${N} 0 ${s+o*Math.cos(E)} ${s+o*Math.sin(E)}`,"Z"].join(" ");return{...u,path:D,index:b}});return e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("svg",{width:c,height:c,viewBox:`0 0 ${c} ${c}`,children:[j.map(u=>e.jsx("path",{d:u.path,fill:u.color,opacity:a!==null&&a!==u.index?.4:1,className:"cursor-pointer transition-opacity",onMouseEnter:()=>t(u.index),onMouseLeave:()=>t(null)},u.index)),e.jsx("text",{x:s,y:s-6,textAnchor:"middle",className:"text-xs fill-[#939084]",children:"Total"}),e.jsxs("text",{x:s,y:s+12,textAnchor:"middle",className:"text-sm fill-[#36342E] dark:fill-[#E8E6E3] font-semibold",children:["$",l.toFixed(0)]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:n.map((u,b)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",onMouseEnter:()=>t(b),onMouseLeave:()=>t(null),children:[e.jsx("span",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:u.color}}),e.jsx("span",{className:"text-[#36342E] dark:text-[#E8E6E3]",children:u.provider}),e.jsxs("span",{className:"text-[#939084] ml-auto font-mono",children:["$",u.cost.toFixed(2)]})]},b))})]})}function Ze({data:n}){const a=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],t=Math.max(...n.flat()),l=c=>{const s=t>0?c/t:0;return s===0?"bg-[#F8F4F0] dark:bg-[#1A1A1E]":s<.25?"bg-[#553DE9]/10":s<.5?"bg-[#553DE9]/25":s<.75?"bg-[#553DE9]/50":"bg-[#553DE9]/80"};return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("div",{className:"inline-block",children:[e.jsx("div",{className:"flex gap-0.5 mb-1 ml-10",children:Array.from({length:24},(c,s)=>e.jsx("div",{className:"w-4 text-center text-[9px] text-[#939084]",children:s%6===0?`${s}`:""},s))}),n.map((c,s)=>e.jsxs("div",{className:"flex items-center gap-0.5 mb-0.5",children:[e.jsx("span",{className:"w-8 text-right text-[10px] text-[#939084] mr-1",children:a[s]}),c.map((r,o)=>e.jsx("div",{className:`w-4 h-4 rounded-sm ${l(r)} transition-colors`,title:`${a[s]} ${o}:00 - ${r} builds`},o))]},s)),e.jsxs("div",{className:"flex items-center gap-1 mt-2 ml-10",children:[e.jsx("span",{className:"text-[10px] text-[#939084]",children:"Less"}),["bg-[#F8F4F0] dark:bg-[#1A1A1E]","bg-[#553DE9]/10","bg-[#553DE9]/25","bg-[#553DE9]/50","bg-[#553DE9]/80"].map((c,s)=>e.jsx("div",{className:`w-3 h-3 rounded-sm ${c}`},s)),e.jsx("span",{className:"text-[10px] text-[#939084]",children:"More"})]})]})})}function Ye({data:n,className:a=""}){const t=n||Ve(),l=m.useCallback(()=>{const c=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),s=URL.createObjectURL(c),r=document.createElement("a");r.href=s,r.download=`usage-analytics-${new Date().toISOString().split("T")[0]}.json`,r.click(),URL.revokeObjectURL(s)},[t]);return e.jsxs("div",{className:`space-y-6 ${a}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"Usage Analytics"})]}),e.jsx(w,{size:"sm",variant:"ghost",icon:V,onClick:l,children:"Export"})]}),e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ye,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Token Usage (30 Days)"})]}),e.jsx(Je,{data:t.tokenUsage})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Re,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Cost by Provider"})]}),e.jsx(qe,{data:t.costBreakdown})]}),e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(X,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Build Success Rate"})]}),e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsxs("span",{className:"text-3xl font-bold text-[#36342E] dark:text-[#E8E6E3]",children:[t.buildSuccessRate,"%"]}),e.jsxs("div",{className:"text-xs text-[#939084]",children:[e.jsxs("div",{children:[t.successfulBuilds," passed"]}),e.jsxs("div",{children:[t.failedBuilds," failed"]}),e.jsxs("div",{children:[t.totalBuilds," total"]})]})]}),e.jsx("div",{className:"h-3 bg-[#F8F4F0] dark:bg-[#1A1A1E] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${t.buildSuccessRate}%`,background:t.buildSuccessRate>=80?"#1FC5A8":t.buildSuccessRate>=60?"#F59E0B":"#C45B5B"}})}),e.jsxs("div",{className:"mt-6",children:[e.jsx("h4",{className:"text-xs font-medium text-[#939084] uppercase tracking-wider mb-2",children:"Top Templates"}),e.jsx("div",{className:"space-y-2",children:t.templateUsage.slice(0,5).map((c,s)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-[#36342E] dark:text-[#E8E6E3]",children:[s+1,". ",c.name]}),e.jsxs("span",{className:"text-xs font-mono text-[#939084]",children:[c.count," builds"]})]},s))})]})]})]}),e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(I,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Peak Usage Hours"})]}),e.jsx(Ze,{data:t.peakHours})]})]})}const Z=["user.login","user.logout","user.invited","project.created","project.deleted","project.deployed","key.created","key.revoked","role.changed","settings.updated","build.started","build.completed","build.failed"];function Ke(){const n=["admin@company.com","dev@company.com","lead@company.com","ops@company.com"],a=["192.168.1.10","10.0.0.42","172.16.0.5","192.168.1.22"],t=["my-saas-app","cli-tool","api-service","staging","production"],l=["auth","project","admin","deploy","api","system"];return Array.from({length:50},(c,s)=>{const r=Z[Math.floor(Math.random()*Z.length)],o=r.startsWith("user")?"auth":r.startsWith("project")?"project":r.startsWith("key")?"api":r.startsWith("build")?"deploy":r.startsWith("role")||r.startsWith("settings")?"admin":l[Math.floor(Math.random()*l.length)];return{id:`evt-${s}`,timestamp:new Date(Date.now()-s*18e5-Math.random()*6e5).toISOString(),user:n[Math.floor(Math.random()*n.length)],action:r,target:t[Math.floor(Math.random()*t.length)],details:`${r.replace(".",": ")} by user on ${t[Math.floor(Math.random()*t.length)]}`,ip:a[Math.floor(Math.random()*a.length)],category:o}})}const Y={auth:"#553DE9",project:"#1FC5A8",admin:"#F59E0B",deploy:"#C45B5B",api:"#6366F1",system:"#939084"};function Xe({category:n}){return e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide",style:{backgroundColor:`${Y[n]}15`,color:Y[n]},children:n})}function Qe({events:n,onFetch:a,pollInterval:t=3e4,className:l=""}){const[c,s]=m.useState(n||Ke()),[r,o]=m.useState(""),[g,j]=m.useState(""),[u,b]=m.useState(""),[h,y]=m.useState(""),[v,E]=m.useState(""),[x,N]=m.useState(!1),[f,D]=m.useState(null),[d,p]=m.useState(1),[A,C]=m.useState(!1),B=m.useRef(null),T=15;m.useEffect(()=>{if(!a||t<=0)return;const i=async()=>{try{const k=await a({search:r,user:g,actionType:u,dateFrom:h,dateTo:v});s(k)}catch{}};return B.current=setInterval(i,t),()=>{B.current&&clearInterval(B.current)}},[a,t,r,g,u,h,v]);const de=[...new Set(c.map(i=>i.user))].sort(),xe=[...new Set(c.map(i=>i.action))].sort(),M=c.filter(i=>{if(r){const k=r.toLowerCase();if(!(i.action.toLowerCase().includes(k)||i.user.toLowerCase().includes(k)||i.target.toLowerCase().includes(k)||i.details.toLowerCase().includes(k)||i.ip.includes(k)))return!1}return!(g&&i.user!==g||u&&i.action!==u||h&&i.timestamp<h||v&&i.timestamp>v+"T23:59:59")}),$=Math.ceil(M.length/T),J=M.slice((d-1)*T,d*T);m.useEffect(()=>{p(1)},[r,g,u,h,v]);const me=m.useCallback(()=>{const i=["Timestamp","User","Action","Target","Details","IP","Category"],k=M.map(F=>[F.timestamp,F.user,F.action,F.target,`"${F.details.replace(/"/g,'""')}"`,F.ip,F.category]),S=[i.join(","),...k.map(F=>F.join(","))].join(`
|
|
32
|
+
`),pe=new Blob([S],{type:"text/csv"}),q=URL.createObjectURL(pe),U=document.createElement("a");U.href=q,U.download=`audit-log-${new Date().toISOString().split("T")[0]}.csv`,U.click(),URL.revokeObjectURL(q)},[M]),he=m.useCallback(async()=>{if(a){C(!0);try{const i=await a({search:r,user:g,actionType:u,dateFrom:h,dateTo:v});s(i)}catch{}finally{C(!1)}}},[a,r,g,u,h,v]),ue=i=>new Date(i).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1});return e.jsxs("div",{className:`space-y-4 ${l}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"Audit Trail"}),e.jsxs("span",{className:"text-xs text-[#939084] ml-1",children:[M.length," event",M.length!==1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:"sm",variant:"ghost",icon:le,onClick:he,loading:A,children:"Refresh"}),e.jsx(w,{size:"sm",variant:"ghost",icon:V,onClick:me,children:"CSV"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Q,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#939084]"}),e.jsx("input",{type:"text",value:r,onChange:i=>o(i.target.value),placeholder:"Search events...",className:"w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084]"})]}),e.jsx(w,{size:"sm",variant:x?"secondary":"ghost",icon:Pe,onClick:()=>N(!x),children:"Filters"})]}),x&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 p-3 border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg bg-[#F8F4F0] dark:bg-[#222228]",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"User"}),e.jsxs("select",{value:g,onChange:i=>j(i.target.value),className:"w-full px-2 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"",children:"All Users"}),de.map(i=>e.jsx("option",{value:i,children:i},i))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Action"}),e.jsxs("select",{value:u,onChange:i=>b(i.target.value),className:"w-full px-2 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"",children:"All Actions"}),xe.map(i=>e.jsx("option",{value:i,children:i},i))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"From"}),e.jsx("input",{type:"date",value:h,onChange:i=>y(i.target.value),className:"w-full px-2 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"To"}),e.jsx("input",{type:"date",value:v,onChange:i=>E(i.target.value),className:"w-full px-2 py-1.5 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]})]})]}),e.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#F8F4F0] dark:bg-[#222228]",children:[e.jsx("th",{className:"w-8 px-2 py-2.5"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960]",children:"Timestamp"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960]",children:"User"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960]",children:"Action"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960]",children:"Target"}),e.jsx("th",{className:"text-left px-3 py-2.5 text-xs font-medium text-[#6B6960] hidden md:table-cell",children:"IP"})]})}),e.jsxs("tbody",{children:[J.map(i=>e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"border-t border-[#ECEAE3] dark:border-[#2A2A30] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors cursor-pointer",onClick:()=>D(f===i.id?null:i.id),children:[e.jsx("td",{className:"px-2 py-2.5 text-center",children:f===i.id?e.jsx(ee,{size:12,className:"text-[#939084]"}):e.jsx(R,{size:12,className:"text-[#939084]"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[#939084]",children:[e.jsx(I,{size:12}),e.jsx("span",{className:"font-mono",children:ue(i.timestamp)})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ke,{name:i.user.split("@")[0],size:"sm"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] truncate max-w-[150px]",children:i.user})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{category:i.category}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:i.action})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx("span",{className:"text-[#6B6960] truncate max-w-[120px] block",children:i.target||"--"})}),e.jsx("td",{className:"px-3 py-2.5 hidden md:table-cell",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-[#939084]",children:[e.jsx(Ae,{size:12}),e.jsx("span",{className:"font-mono",children:i.ip})]})})]},i.id),f===i.id&&e.jsx("tr",{className:"bg-[#F8F4F0] dark:bg-[#222228]",children:e.jsx("td",{colSpan:6,className:"px-6 py-3",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ge,{size:14,className:"text-[#939084] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-[#6B6960]",children:[e.jsx("p",{className:"font-medium text-[#201515] dark:text-[#E8E6E3] mb-1",children:"Details"}),e.jsx("p",{children:i.details}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-[#939084]",children:[e.jsxs("span",{children:["Event ID: ",i.id]}),e.jsxs("span",{children:["Full timestamp: ",new Date(i.timestamp).toISOString()]}),e.jsxs("span",{children:["IP: ",i.ip]})]})]})]})})},`${i.id}-details`)]})),J.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-sm text-[#939084]",children:"No events match your filters."})})]})]})}),$>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[#939084]",children:["Showing ",(d-1)*T+1,"-",Math.min(d*T,M.length)," of ",M.length]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>p(i=>Math.max(1,i-1)),disabled:d===1,className:"p-1.5 rounded-lg text-[#939084] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] disabled:opacity-40 transition-colors",children:e.jsx(we,{size:16})}),Array.from({length:Math.min($,5)},(i,k)=>{let S;return $<=5||d<=3?S=k+1:d>=$-2?S=$-4+k:S=d-2+k,e.jsx("button",{onClick:()=>p(S),className:`w-8 h-8 rounded-lg text-xs font-medium transition-colors ${d===S?"bg-[#553DE9] text-white":"text-[#939084] hover:bg-[#F8F4F0] dark:hover:bg-[#222228]"}`,children:S},S)}),e.jsx("button",{onClick:()=>p(i=>Math.min($,i+1)),disabled:d===$,className:"p-1.5 rounded-lg text-[#939084] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] disabled:opacity-40 transition-colors",children:e.jsx(R,{size:16})})]})]})]})}const et=[{id:"u-1",name:"Alex Chen",email:"alex@company.com",role:"admin",status:"active",lastActive:new Date(Date.now()-3e5).toISOString(),joinedAt:new Date(Date.now()-180*864e5).toISOString()},{id:"u-2",name:"Sarah Johnson",email:"sarah@company.com",role:"editor",status:"active",lastActive:new Date(Date.now()-36e5).toISOString(),joinedAt:new Date(Date.now()-90*864e5).toISOString()},{id:"u-3",name:"Mike Davis",email:"mike@company.com",role:"editor",status:"active",lastActive:new Date(Date.now()-864e5).toISOString(),joinedAt:new Date(Date.now()-60*864e5).toISOString()},{id:"u-4",name:"Emily Park",email:"emily@company.com",role:"viewer",status:"inactive",lastActive:new Date(Date.now()-30*864e5).toISOString(),joinedAt:new Date(Date.now()-120*864e5).toISOString()},{id:"u-5",name:"Jordan Lee",email:"jordan@company.com",role:"editor",status:"invited",lastActive:null,joinedAt:new Date(Date.now()-2*864e5).toISOString()}],P={admin:{label:"Admin",color:"#553DE9"},editor:{label:"Editor",color:"#1FC5A8"},viewer:{label:"Viewer",color:"#939084"}},K={active:{label:"Active",color:"#1FC5A8"},inactive:{label:"Inactive",color:"#939084"},invited:{label:"Invited",color:"#F59E0B"}};function O(n){if(!n)return"Never";const a=Date.now()-new Date(n).getTime(),t=Math.floor(a/6e4);if(t<1)return"Just now";if(t<60)return`${t}m ago`;const l=Math.floor(t/60);if(l<24)return`${l}h ago`;const c=Math.floor(l/24);return c<30?`${c}d ago`:`${Math.floor(c/30)}mo ago`}function oe(n){return n.split(" ").map(a=>a[0]).join("").toUpperCase().slice(0,2)}function tt({onSubmit:n,onCancel:a}){const[t,l]=m.useState(""),[c,s]=m.useState("editor");return e.jsxs("div",{className:"border border-[#553DE9]/20 bg-[#553DE9]/5 dark:bg-[#553DE9]/10 rounded-lg p-4 space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3]",children:"Invite New User"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Email"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ce,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#939084]"}),e.jsx("input",{type:"email",value:t,onChange:r=>l(r.target.value),placeholder:"colleague@company.com",className:"w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084]",autoFocus:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Role"}),e.jsxs("select",{value:c,onChange:r=>s(r.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"viewer",children:"Viewer"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:"sm",icon:ie,onClick:()=>n(t,c),disabled:!t.trim()||!t.includes("@"),children:"Send Invite"}),e.jsx(w,{size:"sm",variant:"ghost",onClick:a,children:"Cancel"})]})]})}function st({user:n,onClose:a,onChangeRole:t,onToggleStatus:l}){return e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[n.avatar_url?e.jsx("img",{src:n.avatar_url,alt:"",className:"w-10 h-10 rounded-full"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-[#553DE9] flex items-center justify-center text-white text-sm font-bold",children:oe(n.name)}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:n.name}),e.jsx("p",{className:"text-xs text-[#939084]",children:n.email})]})]}),e.jsx("button",{onClick:a,className:"p-1 rounded-lg text-[#939084] hover:bg-[#F8F4F0] dark:hover:bg-[#222228]",children:e.jsx(te,{size:16})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Role"}),e.jsxs("select",{value:n.role,onChange:c=>t(c.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"viewer",children:"Viewer"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Status"}),e.jsx("button",{onClick:l,className:"flex items-center gap-2 px-3 py-2 w-full rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-sm text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:n.status==="active"?e.jsxs(e.Fragment,{children:[e.jsx(He,{size:16,className:"text-[#1FC5A8]"}),e.jsx("span",{className:"text-[#1FC5A8]",children:"Active"})]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{size:16,className:"text-[#939084]"}),e.jsx("span",{className:"text-[#939084]",children:"Inactive"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-6 text-xs text-[#939084] pt-2 border-t border-[#ECEAE3] dark:border-[#2A2A30]",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(I,{size:12}),e.jsxs("span",{children:["Last active: ",O(n.lastActive)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(I,{size:12}),e.jsxs("span",{children:["Joined: ",O(n.joinedAt)]})]})]})]})}function at({users:n,onChangeRole:a,onToggleStatus:t,onInviteUser:l,className:c=""}){const[s,r]=m.useState(n||et),[o,g]=m.useState(""),[j,u]=m.useState(""),[b,h]=m.useState(!1),[y,v]=m.useState(null),E=s.filter(d=>{if(o){const p=o.toLowerCase();if(!d.name.toLowerCase().includes(p)&&!d.email.toLowerCase().includes(p))return!1}return!(j&&d.role!==j)}),x=s.find(d=>d.id===y)||null,N=m.useCallback(async(d,p)=>{l&&await l(d,p);const A={id:`u-${Date.now()}`,name:d.split("@")[0],email:d,role:p,status:"invited",lastActive:null,joinedAt:new Date().toISOString()};r(C=>[...C,A]),h(!1)},[l]),f=m.useCallback(async(d,p)=>{a&&await a(d,p),r(A=>A.map(C=>C.id===d?{...C,role:p}:C))},[a]),D=m.useCallback(async d=>{const p=s.find(C=>C.id===d);if(!p)return;const A=p.status!=="active";t&&await t(d,A),r(C=>C.map(B=>B.id===d?{...B,status:A?"active":"inactive"}:B))},[s,t]);return e.jsxs("div",{className:`space-y-4 ${c}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"User Management"}),e.jsxs("span",{className:"text-xs text-[#939084]",children:[s.length," users"]})]}),!b&&e.jsx(w,{size:"sm",variant:"secondary",icon:ie,onClick:()=>h(!0),children:"Invite User"})]}),b&&e.jsx(tt,{onSubmit:N,onCancel:()=>h(!1)}),x&&e.jsx(st,{user:x,onClose:()=>v(null),onChangeRole:d=>f(x.id,d),onToggleStatus:()=>D(x.id)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Q,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#939084]"}),e.jsx("input",{type:"text",value:o,onChange:d=>g(d.target.value),placeholder:"Search users...",className:"w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084]"})]}),e.jsxs("select",{value:j,onChange:d=>u(d.target.value),className:"px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]",children:[e.jsx("option",{value:"",children:"All Roles"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"viewer",children:"Viewer"})]})]}),e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden divide-y divide-[#ECEAE3] dark:divide-[#2A2A30]",children:[E.map(d=>e.jsxs("button",{type:"button",onClick:()=>v(y===d.id?null:d.id),className:`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors ${y===d.id?"bg-[#F8F4F0] dark:bg-[#222228]":""}`,children:[d.avatar_url?e.jsx("img",{src:d.avatar_url,alt:"",className:"w-8 h-8 rounded-full flex-shrink-0"}):e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#553DE9] flex items-center justify-center text-white text-xs font-bold flex-shrink-0",children:oe(d.name)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3] truncate",children:d.name}),e.jsx("p",{className:"text-xs text-[#939084] truncate",children:d.email})]}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium flex-shrink-0",style:{backgroundColor:`${P[d.role].color}15`,color:P[d.role].color},children:P[d.role].label}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:K[d.status].color}}),e.jsx("span",{className:"text-xs text-[#939084] hidden md:inline",children:K[d.status].label})]}),e.jsx("span",{className:"text-xs text-[#939084] flex-shrink-0 hidden lg:inline w-16 text-right",children:O(d.lastActive)}),e.jsx(R,{size:14,className:"text-[#939084] flex-shrink-0"})]},d.id)),E.length===0&&e.jsx("div",{className:"px-4 py-8 text-center text-sm text-[#939084]",children:"No users match your search."})]})]})}const nt=[{id:"proj-1",name:"Customer Portal v2",submittedBy:"sarah@company.com",template:"SaaS App",provider:"Claude",estimatedCost:12.5,estimatedIterations:15,submittedAt:new Date(Date.now()-36e5).toISOString(),description:"Complete redesign of the customer-facing portal with new billing integration.",status:"pending"},{id:"proj-2",name:"Internal CLI Tools",submittedBy:"mike@company.com",template:"CLI Tool",provider:"Claude",estimatedCost:4.2,estimatedIterations:8,submittedAt:new Date(Date.now()-72e5).toISOString(),description:"Set of internal CLI tools for deployment automation.",status:"pending"},{id:"proj-3",name:"Analytics Dashboard",submittedBy:"jordan@company.com",template:"SaaS App",provider:"Codex",estimatedCost:8.9,estimatedIterations:12,submittedAt:new Date(Date.now()-144e5).toISOString(),description:"Real-time analytics dashboard for product metrics.",status:"pending"}],rt=[{projectId:"p-1",projectName:"Main Platform",budgetLimit:100,budgetUsed:67.4,alertThreshold:80},{projectId:"p-2",projectName:"Mobile App",budgetLimit:50,budgetUsed:12.3,alertThreshold:75},{projectId:"p-3",projectName:"Data Pipeline",budgetLimit:30,budgetUsed:28.5,alertThreshold:90}],it=["SaaS App","CLI Tool","REST API","Discord Bot","Chrome Extension","Mobile App","Data Pipeline","Landing Page","Docs Site"];function lt({project:n,onApprove:a,onReject:t}){const[l,c]=m.useState(!1),[s,r]=m.useState(""),[o,g]=m.useState(!1);return e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>c(!l),className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[l?e.jsx(ee,{size:14,className:"text-[#939084]"}):e.jsx(R,{size:14,className:"text-[#939084]"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:n.name}),e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-[#F59E0B]/10 text-[#F59E0B]",children:"Pending"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[#939084] mt-0.5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Se,{size:10}),n.submittedBy]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(se,{size:10}),n.template]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{size:10}),"~$",n.estimatedCost.toFixed(2)]})]})]}),e.jsx("span",{className:"text-xs text-[#939084] flex-shrink-0",children:new Date(n.submittedAt).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})})]}),l&&e.jsxs("div",{className:"px-4 pb-4 pt-2 border-t border-[#ECEAE3] dark:border-[#2A2A30] space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[#6B6960]",children:"Template"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:n.template})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[#6B6960]",children:"Provider"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:n.provider})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[#6B6960]",children:"Est. Cost"}),e.jsxs("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:["$",n.estimatedCost.toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[#6B6960]",children:"Est. Iterations"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:n.estimatedIterations})]})]}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:n.description}),o?e.jsxs("div",{className:"space-y-2",children:[e.jsx("textarea",{value:s,onChange:j=>r(j.target.value),placeholder:"Add a comment (optional)...",rows:2,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084] resize-none"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:"sm",icon:ce,onClick:()=>a(s),children:"Approve"}),e.jsx(w,{size:"sm",variant:"danger",icon:te,onClick:()=>t(s),children:"Reject"}),e.jsx(w,{size:"sm",variant:"ghost",onClick:()=>g(!1),children:"Cancel"})]})]}):e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(w,{size:"sm",variant:"secondary",icon:fe,onClick:()=>g(!0),children:"Review"})})]})]})}function ct({configs:n}){return e.jsx("div",{className:"space-y-3",children:n.map(a=>{const t=a.budgetLimit>0?a.budgetUsed/a.budgetLimit*100:0,l=t>=a.alertThreshold,c=t>=100;return e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:a.projectName}),e.jsxs("div",{className:"flex items-center gap-2",children:[l&&e.jsx(G,{size:14,className:c?"text-[#C45B5B]":"text-[#F59E0B]"}),e.jsxs("span",{className:"text-xs font-mono text-[#939084]",children:["$",a.budgetUsed.toFixed(2)," / $",a.budgetLimit.toFixed(2)]})]})]}),e.jsx("div",{className:"h-2 bg-[#F8F4F0] dark:bg-[#1A1A1E] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.min(t,100)}%`,background:c?"#C45B5B":l?"#F59E0B":"#1FC5A8"}})}),e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsxs("span",{className:"text-[10px] text-[#939084]",children:[t.toFixed(0),"% used"]}),e.jsxs("span",{className:"text-[10px] text-[#939084]",children:["Alert at ",a.alertThreshold,"%"]})]})]},a.projectId)})})}function ot({allTemplates:n}){const[a,t]=m.useState({Engineering:new Set(["SaaS App","CLI Tool","REST API","Data Pipeline"]),Design:new Set(["SaaS App","Landing Page","Mobile App"]),Marketing:new Set(["Landing Page","Docs Site"])}),l=Object.keys(a),c=(s,r)=>{t(o=>{const g={...o},j=new Set(g[s]);return j.has(r)?j.delete(r):j.add(r),g[s]=j,g})};return e.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#F8F4F0] dark:bg-[#222228]",children:[e.jsx("th",{className:"text-left px-3 py-2 text-xs font-medium text-[#6B6960]",children:"Template"}),l.map(s=>e.jsx("th",{className:"text-center px-3 py-2 text-xs font-medium text-[#6B6960]",children:s},s))]})}),e.jsx("tbody",{children:n.map(s=>e.jsxs("tr",{className:"border-t border-[#ECEAE3] dark:border-[#2A2A30] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[e.jsx("td",{className:"px-3 py-2 text-[#201515] dark:text-[#E8E6E3]",children:s}),l.map(r=>{var o;return e.jsx("td",{className:"text-center px-3 py-2",children:e.jsx("input",{type:"checkbox",checked:((o=a[r])==null?void 0:o.has(s))||!1,onChange:()=>c(r,s),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"})},r)})]},s))})]})})}function dt({pendingProjects:n,budgetConfigs:a,className:t=""}){const[l,c]=m.useState(n||nt),[s]=m.useState(a||rt),[r,o]=m.useState("approvals"),g=l.filter(h=>h.status==="pending").length,j=m.useCallback((h,y)=>{c(v=>v.map(E=>E.id===h?{...E,status:"approved"}:E))},[]),u=m.useCallback((h,y)=>{c(v=>v.map(E=>E.id===h?{...E,status:"rejected"}:E))},[]),b=[{id:"approvals",label:"Approvals",icon:ce,count:g},{id:"budgets",label:"Budgets",icon:W},{id:"templates",label:"Templates",icon:se}];return e.jsxs("div",{className:`space-y-4 ${t}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Le,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"Project Governance"})]}),e.jsx("div",{className:"flex items-center gap-1 border-b border-[#ECEAE3] dark:border-[#2A2A30]",children:b.map(h=>e.jsxs("button",{onClick:()=>o(h.id),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors ${r===h.id?"border-[#553DE9] text-[#553DE9]":"border-transparent text-[#939084] hover:text-[#36342E] dark:hover:text-[#E8E6E3]"}`,children:[e.jsx(h.icon,{size:14}),h.label,h.count!==void 0&&h.count>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 rounded-full text-[10px] bg-[#553DE9]/10 text-[#553DE9]",children:h.count})]},h.id))}),r==="approvals"&&e.jsx("div",{className:"space-y-3",children:l.filter(h=>h.status==="pending").length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(je,{size:24,className:"mx-auto text-[#939084] mb-2"}),e.jsx("p",{className:"text-sm text-[#939084]",children:"No pending approvals"}),e.jsx("p",{className:"text-xs text-[#939084] mt-1",children:"All project requests have been reviewed."})]}):l.filter(h=>h.status==="pending").map(h=>e.jsx(lt,{project:h,onApprove:y=>j(h.id,y),onReject:y=>u(h.id,y)},h.id))}),r==="budgets"&&e.jsx(ct,{configs:s}),r==="templates"&&e.jsx(ot,{allTemplates:it})]})}function xt(){return[{id:"c-1",title:"API Keys Rotated Within 90 Days",description:"All active API keys should be rotated at least every 90 days to minimize exposure risk.",status:"warning",category:"security",lastChecked:new Date(Date.now()-36e5).toISOString(),remediationUrl:"/admin/settings",details:"2 of 3 keys are within 90 days. 1 key (Production CI/CD) is 120 days old."},{id:"c-2",title:"All Users Have MFA Enabled",description:"Multi-factor authentication should be enabled for all user accounts.",status:"fail",category:"access",lastChecked:new Date(Date.now()-36e5).toISOString(),remediationUrl:"/admin/settings",details:"3 of 5 users have MFA enabled. 2 users need to enable MFA."},{id:"c-3",title:"Audit Logging Enabled",description:"All user actions should be captured in the audit log.",status:"pass",category:"audit",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"Audit logging is active. 1,247 events captured in the last 30 days."},{id:"c-4",title:"Data Retention Policy Set",description:"A data retention policy must be configured specifying how long logs and data are kept.",status:"pass",category:"data",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"Retention policy: 90 days for logs, 365 days for audit events."},{id:"c-5",title:"Access Review Completed",description:"User access should be reviewed quarterly to ensure least-privilege principle.",status:"warning",category:"access",lastChecked:new Date(Date.now()-36e5).toISOString(),remediationUrl:"/admin",details:"Last access review was 85 days ago. Due for review within 5 days."},{id:"c-6",title:"Encryption at Rest Enabled",description:"All stored data including project files and secrets must be encrypted at rest.",status:"pass",category:"security",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"AES-256 encryption enabled for all storage backends."},{id:"c-7",title:"Session Timeout Configured",description:"User sessions should expire after a configured period of inactivity.",status:"pass",category:"security",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"Session timeout set to 30 minutes of inactivity."},{id:"c-8",title:"Rate Limiting Active",description:"API rate limiting should be enabled to prevent abuse and ensure fair usage.",status:"pass",category:"security",lastChecked:new Date(Date.now()-36e5).toISOString(),details:"Rate limit: 100 requests/minute per API key."}]}function mt({status:n}){switch(n){case"pass":return e.jsx(ae,{size:18,className:"text-[#1FC5A8]"});case"fail":return e.jsx(ne,{size:18,className:"text-[#C45B5B]"});case"warning":return e.jsx(G,{size:18,className:"text-[#F59E0B]"})}}const ht={security:Fe,access:z,data:De,audit:ve};function ut({score:n}){const s=2*Math.PI*56,o=270/360*s,g=n/100*o,j=n>=80?"#1FC5A8":n>=60?"#F59E0B":"#C45B5B",u=135;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[e.jsxs("svg",{width:140,height:140,viewBox:"0 0 140 140",children:[e.jsx("circle",{cx:70,cy:70,r:56,fill:"none",stroke:"currentColor",strokeOpacity:"0.08",strokeWidth:10,strokeDasharray:`${o} ${s}`,strokeLinecap:"round",transform:`rotate(${u} 70 70)`}),e.jsx("circle",{cx:70,cy:70,r:56,fill:"none",stroke:j,strokeWidth:10,strokeDasharray:`${g} ${s}`,strokeLinecap:"round",transform:`rotate(${u} 70 70)`,className:"transition-all duration-700"})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsxs("span",{className:"text-3xl font-bold text-[#36342E] dark:text-[#E8E6E3]",children:[n,"%"]}),e.jsx("span",{className:"text-xs text-[#939084]",children:"Compliant"})]})]})}function pt({items:n,onRefresh:a,className:t=""}){const[l,c]=m.useState(n||xt()),[s,r]=m.useState(!1),[o,g]=m.useState(null),[j,u]=m.useState(!1),b=l.filter(f=>f.status==="pass").length,h=l.filter(f=>f.status==="warning").length,y=l.filter(f=>f.status==="fail").length,v=l.length>0?Math.round(b/l.length*100):0,E=m.useCallback(async()=>{r(!0);try{if(a){const f=await a();c(f)}}catch{}finally{r(!1)}},[a]),x=m.useCallback(()=>{u(!0);const f={generatedAt:new Date().toISOString(),overallScore:v,summary:{pass:b,warning:h,fail:y,total:l.length},items:l.map(A=>({title:A.title,status:A.status,category:A.category,details:A.details,lastChecked:A.lastChecked}))},D=new Blob([JSON.stringify(f,null,2)],{type:"application/json"}),d=URL.createObjectURL(D),p=document.createElement("a");p.href=d,p.download=`compliance-report-${new Date().toISOString().split("T")[0]}.json`,p.click(),URL.revokeObjectURL(d),setTimeout(()=>u(!1),1e3)},[l,v,b,h,y]),N=["security","access","data","audit"];return e.jsxs("div",{className:`space-y-6 ${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"Compliance"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:"sm",variant:"ghost",icon:le,onClick:E,loading:s,children:"Refresh"}),e.jsx(w,{size:"sm",variant:"secondary",icon:V,onClick:x,loading:j,children:"Generate Report"})]})]}),e.jsx("div",{className:"card p-6",children:e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsx(ut,{score:v}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Compliance Score"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{size:16,className:"text-[#1FC5A8]"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-lg font-bold text-[#36342E] dark:text-[#E8E6E3]",children:b}),e.jsx("span",{className:"text-xs text-[#939084] ml-1",children:"Passing"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{size:16,className:"text-[#F59E0B]"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-lg font-bold text-[#36342E] dark:text-[#E8E6E3]",children:h}),e.jsx("span",{className:"text-xs text-[#939084] ml-1",children:"Warnings"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{size:16,className:"text-[#C45B5B]"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-lg font-bold text-[#36342E] dark:text-[#E8E6E3]",children:y}),e.jsx("span",{className:"text-xs text-[#939084] ml-1",children:"Failing"})]})]})]})]})]})}),N.map(f=>{const D=l.filter(p=>p.category===f);if(D.length===0)return null;const d=ht[f];return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-xs font-semibold text-[#6B6960] uppercase tracking-wider",children:f})]}),e.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden divide-y divide-[#ECEAE3] dark:divide-[#2A2A30]",children:D.map(p=>e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>g(o===p.id?null:p.id),className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[e.jsx(mt,{status:p.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:p.title}),e.jsx("p",{className:"text-xs text-[#939084] truncate",children:p.description})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-[#939084] flex-shrink-0",children:[e.jsx(I,{size:10}),"Checked ",new Date(p.lastChecked).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})]})]}),o===p.id&&e.jsxs("div",{className:"px-4 pb-3 pt-1 bg-[#F8F4F0] dark:bg-[#222228]",children:[p.details&&e.jsx("p",{className:"text-sm text-[#6B6960] mb-2",children:p.details}),p.remediationUrl&&p.status!=="pass"&&e.jsxs("a",{href:p.remediationUrl,className:"inline-flex items-center gap-1 text-xs text-[#553DE9] hover:underline",children:[e.jsx(Ee,{size:12}),"Fix this issue"]})]})]},p.id))})]},f)})]})}function gt(){return[{label:"Total Users",value:"24",change:"+3 this month",changePositive:!0,icon:z,color:"#553DE9"},{label:"Active Projects",value:"18",change:"+5 this week",changePositive:!0,icon:re,color:"#1FC5A8"},{label:"Total Builds",value:"342",change:"+47 this week",changePositive:!0,icon:Me,color:"#F59E0B"},{label:"Monthly Cost",value:"$201.00",change:"-12% vs last month",changePositive:!0,icon:W,color:"#C45B5B"}]}function jt(){return[{name:"API Server",status:"healthy",latency:45},{name:"Claude Provider",status:"healthy",latency:230},{name:"Codex Provider",status:"degraded",latency:890},{name:"Gemini Provider",status:"healthy",latency:310},{name:"Task Queue",status:"healthy",latency:12},{name:"WebSocket",status:"healthy",latency:8}]}function ft(){return[{user:"alex@company.com",action:"started build",target:"customer-portal"},{user:"sarah@company.com",action:"deployed",target:"analytics-dashboard"},{user:"mike@company.com",action:"created project",target:"cli-tools"},{user:"jordan@company.com",action:"completed build",target:"api-service"},{user:"alex@company.com",action:"updated settings",target:"provider config"},{user:"emily@company.com",action:"invited user",target:"new-dev@company.com"},{user:"sarah@company.com",action:"rotated API key",target:"production"},{user:"mike@company.com",action:"started build",target:"mobile-app"},{user:"jordan@company.com",action:"approved project",target:"data-pipeline"},{user:"alex@company.com",action:"failed build",target:"legacy-service"},{user:"sarah@company.com",action:"created checkpoint",target:"analytics-dashboard"},{user:"emily@company.com",action:"changed role",target:"mike -> editor"},{user:"mike@company.com",action:"deployed",target:"cli-tools"},{user:"alex@company.com",action:"started build",target:"landing-page"},{user:"jordan@company.com",action:"reviewed project",target:"api-service"},{user:"sarah@company.com",action:"completed build",target:"analytics-dashboard"},{user:"emily@company.com",action:"updated template",target:"saas-app"},{user:"mike@company.com",action:"started build",target:"discord-bot"},{user:"alex@company.com",action:"approved project",target:"chrome-ext"},{user:"jordan@company.com",action:"deployed",target:"data-pipeline"}].map((a,t)=>({id:`act-${t}`,...a,timestamp:new Date(Date.now()-t*9e5).toISOString()}))}function bt(){return[{name:"Alex C.",builds:87},{name:"Sarah J.",builds:64},{name:"Mike D.",builds:52},{name:"Jordan L.",builds:41},{name:"Emily P.",builds:38},{name:"Others",builds:60}]}function vt({cards:n}){return e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:n.map(a=>e.jsx("div",{className:"card p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-[#6B6960] uppercase tracking-wider",children:a.label}),e.jsx("p",{className:"text-2xl font-bold text-[#36342E] dark:text-[#E8E6E3] mt-1",children:a.value}),a.change&&e.jsx("p",{className:`text-xs mt-1 ${a.changePositive?"text-[#1FC5A8]":"text-[#C45B5B]"}`,children:a.change})]}),e.jsx("div",{className:"p-2 rounded-lg",style:{backgroundColor:`${a.color}10`,color:a.color},children:e.jsx(a.icon,{size:20})})]})},a.label))})}function Et({data:n}){const a=Math.max(...n.map(t=>t.builds));return e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(_,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Builds per User"})]}),e.jsx("div",{className:"space-y-3",children:n.map(t=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-[#6B6960] w-16 text-right flex-shrink-0",children:t.name}),e.jsx("div",{className:"flex-1 h-6 bg-[#F8F4F0] dark:bg-[#1A1A1E] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-[#553DE9] transition-all duration-500 flex items-center justify-end pr-2",style:{width:`${t.builds/a*100}%`},children:e.jsx("span",{className:"text-[10px] text-white font-mono",children:t.builds})})})]},t.name))})]})}function Nt({health:n}){const a={healthy:"#1FC5A8",degraded:"#F59E0B",down:"#C45B5B"};return e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx($e,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"System Health"})]}),e.jsx("div",{className:"space-y-2",children:n.map(t=>e.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:a[t.status]}}),e.jsx("span",{className:"text-sm text-[#36342E] dark:text-[#E8E6E3]",children:t.name})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.latency!==void 0&&e.jsxs("span",{className:"text-xs font-mono text-[#939084]",children:[t.latency,"ms"]}),e.jsx("span",{className:"text-[10px] font-medium uppercase",style:{color:a[t.status]},children:t.status})]})]},t.name))})]})}function yt({actions:n}){const a=t=>new Date(t).toLocaleString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});return e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(H,{size:14,className:"text-[#553DE9]"}),e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3]",children:"Recent Activity"})]}),e.jsx("div",{className:"space-y-1 max-h-[400px] overflow-y-auto terminal-scroll",children:n.map(t=>e.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 rounded-lg hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[e.jsx("span",{className:"text-[10px] font-mono text-[#939084] flex-shrink-0 w-10",children:a(t.timestamp)}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("span",{className:"text-xs",children:[e.jsx("span",{className:"text-[#553DE9] font-medium",children:t.user.split("@")[0]}),e.jsxs("span",{className:"text-[#6B6960]",children:[" ",t.action," "]}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:t.target})]})})]},t.id))})]})}function kt(){return e.jsxs("div",{className:"max-w-[500px] mx-auto px-6 py-20 text-center",children:[e.jsx(Be,{size:48,className:"mx-auto text-[#C45B5B] mb-4"}),e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] dark:text-[#E8E6E3] mb-2",children:"Access Denied"}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:"You do not have permission to access the admin dashboard. Contact your organization administrator for access."})]})}const At=[{id:"overview",label:"Overview",icon:H},{id:"users",label:"Users",icon:z},{id:"analytics",label:"Analytics",icon:_},{id:"governance",label:"Governance",icon:re},{id:"audit",label:"Audit Trail",icon:I},{id:"compliance",label:"Compliance",icon:X}];function Ht(){const{user:n,isLocalMode:a}=Ne(),[t,l]=m.useState("overview"),c=a||(n==null?void 0:n.authenticated)===!0,[s]=m.useState(gt),[r]=m.useState(jt),[o]=m.useState(ft),[g]=m.useState(bt);return c?e.jsxs("div",{className:"max-w-[1200px] mx-auto px-6 py-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] dark:text-[#E8E6E3]",children:"Admin"})}),e.jsx("div",{className:"flex items-center gap-1 border-b border-[#ECEAE3] dark:border-[#2A2A30] mb-6 overflow-x-auto",children:At.map(j=>e.jsxs("button",{onClick:()=>l(j.id),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap ${t===j.id?"border-[#553DE9] text-[#553DE9]":"border-transparent text-[#939084] hover:text-[#36342E] dark:hover:text-[#E8E6E3]"}`,children:[e.jsx(j.icon,{size:14}),j.label]},j.id))}),t==="overview"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(vt,{cards:s}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"card p-4 flex flex-col items-center justify-center",children:[e.jsx("h4",{className:"text-sm font-medium text-[#36342E] dark:text-[#E8E6E3] mb-3",children:"Build Success Rate"}),e.jsx(We,{percentage:94,size:96,strokeWidth:6,color:"#1FC5A8",children:e.jsx("span",{className:"text-lg font-bold text-[#36342E] dark:text-[#E8E6E3]",children:"94%"})}),e.jsx("p",{className:"text-xs text-[#939084] mt-2",children:"342 total builds"})]}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(Nt,{health:r})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsx(Et,{data:g}),e.jsx(yt,{actions:o})]})]}),t==="users"&&e.jsx(at,{}),t==="analytics"&&e.jsx(Ye,{}),t==="governance"&&e.jsx(dt,{}),t==="audit"&&e.jsx(Qe,{}),t==="compliance"&&e.jsx(pt,{})]}):e.jsx(kt,{})}export{Ht as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-CM_b_EhP.js";import{C as r}from"./clock-IW4Wq86N.js";import{C as a}from"./circle-alert-CpL4Bhvt.js";import{C as l}from"./check-nIAqa-kf.js";const i={completed:"bg-[#1FC5A8]/10 text-[#1FC5A8]",running:"bg-[#553DE9]/10 text-[#553DE9]",failed:"bg-[#C45B5B]/10 text-[#C45B5B]",started:"bg-[#D4A03C]/10 text-[#D4A03C]",empty:"bg-[#F8F4F0] text-[#6B6960]",version:"bg-[#553DE9]/10 text-[#553DE9]"};function o({status:t}){switch(t){case"completed":return e.jsx(l,{size:12});case"running":return e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping motion-reduce:animate-none absolute inline-flex h-full w-full rounded-full bg-current opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-current"})]});case"failed":return e.jsx(a,{size:12});case"started":return e.jsx(r,{size:12});default:return null}}function f({status:t,children:n,className:s=""}){return e.jsxs("span",{className:["inline-flex items-center gap-1 rounded-btn px-2.5 py-0.5 text-xs font-semibold",i[t],s].filter(Boolean).join(" "),children:[e.jsx(o,{status:t}),n]})}export{f as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,j as t}from"./index-
|
|
1
|
+
import{r as p,j as t}from"./index-CM_b_EhP.js";const m={primary:"bg-[#553DE9] text-white hover:bg-[#4432c4] shadow-button rounded-btn",secondary:"border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] bg-transparent rounded-btn",ghost:"text-[#36342E] hover:bg-[#F8F4F0] rounded-btn",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border border-[#C45B5B]/20 hover:bg-[#C45B5B]/20 rounded-btn"},b={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u={sm:14,md:16,lg:18};function h({size:e}){return t.jsxs("svg",{className:"animate-spin",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}const B=p.forwardRef(({variant:e="primary",size:o="md",icon:n,iconRight:i,loading:r=!1,disabled:a,className:c="",children:l,...x},d)=>{const s=u[o];return t.jsxs("button",{ref:d,disabled:a||r,className:["inline-flex items-center justify-center gap-2 font-medium transition-colors",m[e],b[o],(a||r)&&"opacity-60 cursor-not-allowed",c].filter(Boolean).join(" "),...x,children:[r?t.jsx(h,{size:s}):n?t.jsx(n,{size:s}):null,l,i&&!r&&t.jsx(i,{size:s})]})});B.displayName="Button";export{B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e}from"./index-BN52-GQT.js";function p({value:r,prefix:t="",suffix:s=""}){const[i,l]=n.useState(0),o=n.useRef(0);return n.useEffect(()=>{const c=o.current,d=r-c;if(d===0)return;const x=600,h=performance.now();function u(a){const b=a-h,f=Math.min(b/x,1),g=1-Math.pow(1-f,3),j=Math.round(c+d*g);l(j),o.current=j,f<1&&requestAnimationFrame(u)}requestAnimationFrame(u)},[r]),e.jsxs("span",{className:"tabular-nums",children:[t,i.toLocaleString(),s]})}function N(){const[r,t]=n.useState(5),[s,i]=n.useState(30),[l,o]=n.useState(75),x=Math.round(r*s*.4*4.33),h=Math.round(x*l),u=1/0;return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 shadow-sm",children:[e.jsx("h3",{className:"text-lg font-bold text-[#36342E] mb-1",children:"ROI Calculator"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-6",children:"Estimate how much your team could save with autonomous development."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Team size"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[r," developers"]})]}),e.jsx("input",{type:"range",min:1,max:50,value:r,onChange:a=>t(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"50"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Hours coding per week"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[s,"h"]})]}),e.jsx("input",{type:"range",min:5,max:60,value:s,onChange:a=>i(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"5h"}),e.jsx("span",{children:"60h"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Average hourly rate"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:["$",l,"/hr"]})]}),e.jsx("input",{type:"range",min:25,max:250,step:5,value:l,onChange:a=>o(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"$25"}),e.jsx("span",{children:"$250"})]})]})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t border-[#ECEAE3]",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#553DE9]",children:e.jsx(p,{value:x,suffix:"h"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Hours saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#1FC5A8]",children:e.jsx(p,{value:h,prefix:"$"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Cost saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#36342E]",children:u===1/0?"Free":e.jsx(p,{value:u,suffix:"%"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"ROI (open source)"})]})]}),e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-[#553DE9]/5 border border-[#553DE9]/10",children:e.jsxs("p",{className:"text-sm text-[#36342E] text-center",children:["With Loki Mode, your team could save"," ",e.jsxs("span",{className:"font-bold text-[#553DE9]",children:[x.toLocaleString()," hours"]})," ","and"," ",e.jsxs("span",{className:"font-bold text-[#1FC5A8]",children:["$",h.toLocaleString()]})," ","per month."]})})]})]})}function y({count:r=5}){return e.jsx("div",{className:"flex gap-0.5",children:Array.from({length:r}).map((t,s)=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#553DE9",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})},s))})}function w(){return e.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#553DE9]/15",children:e.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1zm12 0c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",fill:"currentColor"})})}function k({quote:r,name:t,role:s,company:i,avatar:l,rating:o=5}){const c=t.split(" ").map(d=>d[0]).join("").toUpperCase().slice(0,2);return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 flex flex-col gap-4 shadow-sm hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(w,{}),e.jsx(y,{count:o})]}),e.jsxs("p",{className:"text-[#36342E] text-sm leading-relaxed flex-1",children:['"',r,'"']}),e.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-[#ECEAE3]",children:[l?e.jsx("img",{src:l,alt:"",className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-[#553DE9] to-[#7B6BEF] flex items-center justify-center text-white text-sm font-bold flex-shrink-0",children:c}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[#36342E]",children:t}),e.jsxs("p",{className:"text-xs text-[#6B6960]",children:[s,", ",i]})]})]})]})}const E=[{quote:"Loki Mode turned a weekend project into a production app in 45 minutes. The RARV cycle caught bugs I would have shipped. Easily 10x faster than writing everything by hand.",name:"Sarah Chen",role:"Full-Stack Developer",company:"Nimbus Labs"},{quote:"The quality gates are what sold me. Three blind reviewers, anti-sycophancy checks, severity blocking -- it catches issues that even our senior engineers miss in code review.",name:"Marcus Rivera",role:"CTO",company:"Forgepoint Systems"},{quote:"As a solo founder, Loki Mode is like having a senior engineering team on demand. I shipped our MVP in a day instead of two weeks. The autonomous iteration is the real game changer.",name:"Priya Sharma",role:"Founder",company:"Seedcraft"},{quote:"Self-hosted, no data leaves our network, and the multi-provider failover means we never hit rate limits. Exactly what our compliance team needed. Enterprise-ready out of the box.",name:"Daniel Okafor",role:"DevOps Lead",company:"Vaultline Security"}],v=[{feature:"Claude (Opus/Sonnet/Haiku)",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!0},{feature:"GPT-4o / Codex",category:"AI Models",lokiMode:!0,boltNew:!0,replit:!0,lovable:!1},{feature:"Gemini",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"5-provider auto-failover",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"9 automated quality gates",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Blind 3-reviewer code review",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Anti-sycophancy checks",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Automated test generation",category:"Quality",lokiMode:!0,boltNew:!1,replit:"Partial",lovable:!1},{feature:"Docker container generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"CI/CD pipeline generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"One-click cloud deploy",category:"Deployment",lokiMode:"Planned",boltNew:!0,replit:!0,lovable:!0},{feature:"Self-hosted (your keys)",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Free tier available",category:"Cost",lokiMode:"Open source",boltNew:!0,replit:!0,lovable:!0},{feature:"No vendor lock-in",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"SSO / OIDC authentication",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"RBAC access control",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Audit logging",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Air-gapped deployment",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1}];function C(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function M(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#C45B5B]/40",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function m({value:r}){return typeof r=="string"?e.jsx("span",{className:"text-xs text-[#6B6960] font-medium",children:r}):r?e.jsx(C,{}):e.jsx(M,{})}const A=[{title:"Full Autonomy",description:"Describe what you want. Loki Mode handles planning, coding, testing, and verification automatically.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#553DE9]",children:e.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Production Quality",description:"9 quality gates, blind code review, and anti-sycophancy checks ensure code that actually works.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Your Infrastructure",description:"Self-hosted, open source, no data leaves your network. Use your own API keys across 5 providers.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#2F71E3]",children:[e.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor"})]})},{title:"Built for Teams",description:"Enterprise auth, RBAC, audit logs, and parallel workflows for teams of any size.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#E93D82]",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"9",cy:"7",r:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}];function D(){const r=[...new Set(v.map(t=>t.category))];return e.jsx("div",{className:"min-h-screen bg-[#FAF9F6]",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-[#36342E]",children:"Compare"}),e.jsx("p",{className:"text-[#6B6960] mt-1",children:"See how Loki Mode stacks up against other AI development platforms."})]}),e.jsx("div",{className:"bg-white border border-[#ECEAE3] rounded-xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[#ECEAE3]",children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium text-[#6B6960] w-[240px]",children:"Feature"}),e.jsx("th",{className:"text-center px-4 py-3 font-bold text-[#553DE9] bg-[#553DE9]/5 w-[130px]",children:"Loki Mode"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"bolt.new"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Replit"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Lovable"})]})}),e.jsx("tbody",{children:r.map(t=>e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-[#FAF9F6]",children:e.jsx("td",{colSpan:5,className:"px-4 py-2 text-xs font-bold text-[#939084] uppercase tracking-wider",children:t})},`cat-${t}`),v.filter(s=>s.category===t).map(s=>e.jsxs("tr",{className:"border-b border-[#ECEAE3] last:border-b-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-[#36342E]",children:s.feature}),e.jsx("td",{className:"px-4 py-2.5 text-center bg-[#553DE9]/5",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lokiMode})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.boltNew})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.replit})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lovable})})})]},s.feature))]}))})]})})}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"Why developers choose Loki Mode"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:A.map(t=>e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow",children:[e.jsx("div",{className:"mb-3",children:t.icon}),e.jsx("h3",{className:"text-base font-bold text-[#36342E] mb-1",children:t.title}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:t.description})]},t.title))})]}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"What developers are saying"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:E.map(t=>e.jsx(k,{...t},t.name))})]}),e.jsx("div",{className:"mt-12 max-w-xl mx-auto",children:e.jsx(N,{})})]})})}export{D as default};
|
|
1
|
+
import{r as n,j as e}from"./index-CM_b_EhP.js";function p({value:r,prefix:t="",suffix:s=""}){const[i,l]=n.useState(0),o=n.useRef(0);return n.useEffect(()=>{const c=o.current,d=r-c;if(d===0)return;const x=600,h=performance.now();function u(a){const b=a-h,f=Math.min(b/x,1),g=1-Math.pow(1-f,3),j=Math.round(c+d*g);l(j),o.current=j,f<1&&requestAnimationFrame(u)}requestAnimationFrame(u)},[r]),e.jsxs("span",{className:"tabular-nums",children:[t,i.toLocaleString(),s]})}function N(){const[r,t]=n.useState(5),[s,i]=n.useState(30),[l,o]=n.useState(75),x=Math.round(r*s*.4*4.33),h=Math.round(x*l),u=1/0;return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 shadow-sm",children:[e.jsx("h3",{className:"text-lg font-bold text-[#36342E] mb-1",children:"ROI Calculator"}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-6",children:"Estimate how much your team could save with autonomous development."}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Team size"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[r," developers"]})]}),e.jsx("input",{type:"range",min:1,max:50,value:r,onChange:a=>t(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"1"}),e.jsx("span",{children:"50"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Hours coding per week"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:[s,"h"]})]}),e.jsx("input",{type:"range",min:5,max:60,value:s,onChange:a=>i(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"5h"}),e.jsx("span",{children:"60h"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-[#36342E]",children:"Average hourly rate"}),e.jsxs("span",{className:"text-sm font-semibold text-[#553DE9] tabular-nums",children:["$",l,"/hr"]})]}),e.jsx("input",{type:"range",min:25,max:250,step:5,value:l,onChange:a=>o(Number(a.target.value)),className:"w-full h-2 bg-[#ECEAE3] rounded-full appearance-none cursor-pointer accent-[#553DE9]"}),e.jsxs("div",{className:"flex justify-between text-xs text-[#939084] mt-1",children:[e.jsx("span",{children:"$25"}),e.jsx("span",{children:"$250"})]})]})]}),e.jsxs("div",{className:"mt-6 pt-6 border-t border-[#ECEAE3]",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#553DE9]",children:e.jsx(p,{value:x,suffix:"h"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Hours saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#1FC5A8]",children:e.jsx(p,{value:h,prefix:"$"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"Cost saved / month"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-[#36342E]",children:u===1/0?"Free":e.jsx(p,{value:u,suffix:"%"})}),e.jsx("div",{className:"text-xs text-[#6B6960] mt-1",children:"ROI (open source)"})]})]}),e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-[#553DE9]/5 border border-[#553DE9]/10",children:e.jsxs("p",{className:"text-sm text-[#36342E] text-center",children:["With Loki Mode, your team could save"," ",e.jsxs("span",{className:"font-bold text-[#553DE9]",children:[x.toLocaleString()," hours"]})," ","and"," ",e.jsxs("span",{className:"font-bold text-[#1FC5A8]",children:["$",h.toLocaleString()]})," ","per month."]})})]})]})}function y({count:r=5}){return e.jsx("div",{className:"flex gap-0.5",children:Array.from({length:r}).map((t,s)=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"#553DE9",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})},s))})}function w(){return e.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#553DE9]/15",children:e.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1zm12 0c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",fill:"currentColor"})})}function k({quote:r,name:t,role:s,company:i,avatar:l,rating:o=5}){const c=t.split(" ").map(d=>d[0]).join("").toUpperCase().slice(0,2);return e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-6 flex flex-col gap-4 shadow-sm hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(w,{}),e.jsx(y,{count:o})]}),e.jsxs("p",{className:"text-[#36342E] text-sm leading-relaxed flex-1",children:['"',r,'"']}),e.jsxs("div",{className:"flex items-center gap-3 pt-2 border-t border-[#ECEAE3]",children:[l?e.jsx("img",{src:l,alt:"",className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-[#553DE9] to-[#7B6BEF] flex items-center justify-center text-white text-sm font-bold flex-shrink-0",children:c}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[#36342E]",children:t}),e.jsxs("p",{className:"text-xs text-[#6B6960]",children:[s,", ",i]})]})]})]})}const E=[{quote:"Loki Mode turned a weekend project into a production app in 45 minutes. The RARV cycle caught bugs I would have shipped. Easily 10x faster than writing everything by hand.",name:"Sarah Chen",role:"Full-Stack Developer",company:"Nimbus Labs"},{quote:"The quality gates are what sold me. Three blind reviewers, anti-sycophancy checks, severity blocking -- it catches issues that even our senior engineers miss in code review.",name:"Marcus Rivera",role:"CTO",company:"Forgepoint Systems"},{quote:"As a solo founder, Loki Mode is like having a senior engineering team on demand. I shipped our MVP in a day instead of two weeks. The autonomous iteration is the real game changer.",name:"Priya Sharma",role:"Founder",company:"Seedcraft"},{quote:"Self-hosted, no data leaves our network, and the multi-provider failover means we never hit rate limits. Exactly what our compliance team needed. Enterprise-ready out of the box.",name:"Daniel Okafor",role:"DevOps Lead",company:"Vaultline Security"}],v=[{feature:"Claude (Opus/Sonnet/Haiku)",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!0},{feature:"GPT-4o / Codex",category:"AI Models",lokiMode:!0,boltNew:!0,replit:!0,lovable:!1},{feature:"Gemini",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"5-provider auto-failover",category:"AI Models",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"9 automated quality gates",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Blind 3-reviewer code review",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Anti-sycophancy checks",category:"Quality",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Automated test generation",category:"Quality",lokiMode:!0,boltNew:!1,replit:"Partial",lovable:!1},{feature:"Docker container generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"CI/CD pipeline generation",category:"Deployment",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"One-click cloud deploy",category:"Deployment",lokiMode:"Planned",boltNew:!0,replit:!0,lovable:!0},{feature:"Self-hosted (your keys)",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"Free tier available",category:"Cost",lokiMode:"Open source",boltNew:!0,replit:!0,lovable:!0},{feature:"No vendor lock-in",category:"Cost",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1},{feature:"SSO / OIDC authentication",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"RBAC access control",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Audit logging",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!0,lovable:!1},{feature:"Air-gapped deployment",category:"Enterprise",lokiMode:!0,boltNew:!1,replit:!1,lovable:!1}];function C(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function M(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"text-[#C45B5B]/40",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function m({value:r}){return typeof r=="string"?e.jsx("span",{className:"text-xs text-[#6B6960] font-medium",children:r}):r?e.jsx(C,{}):e.jsx(M,{})}const A=[{title:"Full Autonomy",description:"Describe what you want. Loki Mode handles planning, coding, testing, and verification automatically.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#553DE9]",children:e.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Production Quality",description:"9 quality gates, blind code review, and anti-sycophancy checks ensure code that actually works.",icon:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#1FC5A8]",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},{title:"Your Infrastructure",description:"Self-hosted, open source, no data leaves your network. Use your own API keys across 5 providers.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#2F71E3]",children:[e.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor"})]})},{title:"Built for Teams",description:"Enterprise auth, RBAC, audit logs, and parallel workflows for teams of any size.",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"text-[#E93D82]",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"9",cy:"7",r:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}];function D(){const r=[...new Set(v.map(t=>t.category))];return e.jsx("div",{className:"min-h-screen bg-[#FAF9F6]",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-[#36342E]",children:"Compare"}),e.jsx("p",{className:"text-[#6B6960] mt-1",children:"See how Loki Mode stacks up against other AI development platforms."})]}),e.jsx("div",{className:"bg-white border border-[#ECEAE3] rounded-xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[#ECEAE3]",children:[e.jsx("th",{className:"text-left px-4 py-3 font-medium text-[#6B6960] w-[240px]",children:"Feature"}),e.jsx("th",{className:"text-center px-4 py-3 font-bold text-[#553DE9] bg-[#553DE9]/5 w-[130px]",children:"Loki Mode"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"bolt.new"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Replit"}),e.jsx("th",{className:"text-center px-4 py-3 font-medium text-[#6B6960] w-[130px]",children:"Lovable"})]})}),e.jsx("tbody",{children:r.map(t=>e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-[#FAF9F6]",children:e.jsx("td",{colSpan:5,className:"px-4 py-2 text-xs font-bold text-[#939084] uppercase tracking-wider",children:t})},`cat-${t}`),v.filter(s=>s.category===t).map(s=>e.jsxs("tr",{className:"border-b border-[#ECEAE3] last:border-b-0",children:[e.jsx("td",{className:"px-4 py-2.5 text-[#36342E]",children:s.feature}),e.jsx("td",{className:"px-4 py-2.5 text-center bg-[#553DE9]/5",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lokiMode})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.boltNew})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.replit})})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(m,{value:s.lovable})})})]},s.feature))]}))})]})})}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"Why developers choose Loki Mode"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:A.map(t=>e.jsxs("div",{className:"bg-white border border-[#ECEAE3] rounded-xl p-5 shadow-sm hover:shadow-md transition-shadow",children:[e.jsx("div",{className:"mb-3",children:t.icon}),e.jsx("h3",{className:"text-base font-bold text-[#36342E] mb-1",children:t.title}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:t.description})]},t.title))})]}),e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-xl font-bold text-[#36342E] mb-6",children:"What developers are saying"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:E.map(t=>e.jsx(k,{...t},t.name))})]}),e.jsx("div",{className:"mt-12 max-w-xl mx-auto",children:e.jsx(N,{})})]})})}export{D as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as M,r as o,a as C,j as e,
|
|
1
|
+
import{c as M,r as o,a as C,j as e,n as P,J as w,N as f,a2 as B,M as R,m as A,E as H}from"./index-CM_b_EhP.js";import{B as v}from"./Button-CFLVoduT.js";import{C as k,G as q}from"./ProjectPage-CiCavQ8n.js";import{R as F}from"./refresh-cw-CIr7E-g2.js";import{C as S}from"./circle-alert-CpL4Bhvt.js";import{U as D}from"./user-BB5J8wAF.js";import{R as T}from"./rotate-ccw-gwoXxDeE.js";import{L as U}from"./loader-circle-Oq6NQhW2.js";import"./TerminalOutput-4-1hWCtZ.js";import"./lock-DbJ9zxbw.js";import"./package-WZ5osvej.js";import"./file-code-corner-Box4IwG1.js";import"./file-plus-DpGqlXF8.js";import"./clock-IW4Wq86N.js";import"./activity-DH3ih2nS.js";import"./bot-Cbycc3VE.js";import"./check-nIAqa-kf.js";import"./hammer-DRbIQ4QU.js";import"./dollar-sign-CDzDY64R.js";import"./globe-BkOnKl4x.js";import"./copy-CnqkyNsi.js";import"./git-commit-horizontal-BVbucmO5.js";import"./upload-IaViyeVD.js";import"./plus-j08lFR-K.js";import"./trash-2-DEKSVae5.js";import"./trending-down-DBiXUtxJ.js";import"./save-B8fV_ZpE.js";import"./code-xml-BiJBteXf.js";import"./trending-up-BgmK_tHq.js";import"./layers-B78BiFiU.js";import"./folder-open-B57dAoBv.js";import"./server-D5dO1paz.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -9,4 +9,4 @@ import{c as M,r as o,a as C,j as e,m as H,H as w,J as f,a1 as P,M as R,l as A,E
|
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/const Q=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],V=M("tag",Q),X={"creating-branch":"Creating branch...",analyzing:"Analyzing issue...","writing-fix":"Writing fix...","running-tests":"Running tests...","creating-pr":"Creating PR..."},E=["creating-branch","analyzing","writing-fix","running-tests","creating-pr"];function z(s){const r=Date.now(),n=new Date(s).getTime(),t=r-n,a=Math.floor(t/1e3),i=Math.floor(a/60),m=Math.floor(i/60),x=Math.floor(m/24);return x>30?`${Math.floor(x/30)}mo ago`:x>0?`${x}d ago`:m>0?`${m}h ago`:i>0?`${i}m ago`:"just now"}function J(s){return s.slice(0,2).toUpperCase()}function K(s){const r=parseInt(s.slice(0,2),16),n=parseInt(s.slice(2,4),16),t=parseInt(s.slice(4,6),16);return(.299*r+.587*n+.114*t)/255>.5?"#1a1a1a":"#ffffff"}function _(s){if(!s)return[];const r=s.split(`
|
|
12
|
-
`),n=[];for(let t=0;t<r.length;t++){const a=r[t];if(/^\s*[-*]\s/.test(a)){const i=a.replace(/^\s*[-*]\s/,"");n.push(e.jsx("li",{className:"ml-4 list-disc text-xs text-secondary leading-relaxed",children:L(i)},t));continue}if(a.trim()===""){n.push(e.jsx("br",{},t));continue}n.push(e.jsx("p",{className:"text-xs text-secondary leading-relaxed",children:L(a)},t))}return n}function L(s){const r=[],n=/(\*\*[^*]+\*\*|`[^`]+`)/g;let t=0,a;for(;(a=n.exec(s))!==null;){a.index>t&&r.push(s.slice(t,a.index));const i=a[0];i.startsWith("**")?r.push(e.jsx("strong",{className:"font-semibold text-ink",children:i.slice(2,-2)},a.index)):i.startsWith("`")&&r.push(e.jsx("code",{className:"px-1 py-0.5 rounded bg-hover text-xs font-mono text-primary",children:i.slice(1,-1)},a.index)),t=a.index+i.length}return t<s.length&&r.push(s.slice(t)),r}function $({label:s}){const r=`#${s.color}`,n=K(s.color);return e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-btn px-2 py-0.5 text-[11px] font-medium leading-none",style:{backgroundColor:r,color:n},children:[e.jsx(V,{size:10}),s.name]})}function I({login:s}){return e.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 rounded-full bg-primary/10 text-primary text-[10px] font-bold flex-shrink-0",title:s,children:J(s)})}function N(){return e.jsxs("div",{className:"px-4 py-3 border border-border rounded-card space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"text",width:"2.5rem",height:"0.625rem"}),e.jsx(f,{variant:"text",width:"60%",height:"0.75rem"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"text",width:"4rem",height:"0.5rem"}),e.jsx(f,{variant:"text",width:"4rem",height:"0.5rem"})]})]})}function Y({issue:s,onClick:r}){return e.jsx("button",{onClick:r,className:"w-full text-left px-4 py-3 border border-border rounded-card hover:bg-hover transition-colors cursor-pointer group",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{size:16,className:`mt-0.5 flex-shrink-0 ${s.state==="open"?"text-success":"text-primary"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-xs font-mono text-muted flex-shrink-0",children:["#",s.number]}),e.jsx("span",{className:"text-sm font-medium text-ink truncate group-hover:text-primary transition-colors",children:s.title})]}),e.jsx("div",{className:"flex items-center flex-wrap gap-1.5 mt-1.5",children:s.labels.map(n=>e.jsx($,{label:n},n.name))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[11px] text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{login:s.author.login}),s.author.login]}),e.jsx("span",{children:z(s.createdAt)}),s.comments>0&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(R,{size:11}),s.comments]})]})]})]})})}function Z({fixState:s,onRetry:r}){if(s.status==="idle")return null;if(s.status==="success"&&s.result)return e.jsxs("div",{className:"rounded-card border border-success/30 bg-success/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-success",children:[e.jsx(A,{size:16}),"Pull request created"]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted",children:[e.jsx(q,{size:14,className:"text-success"}),e.jsxs("span",{className:"font-mono",children:["PR #",s.result.pr_number]}),e.jsx("span",{className:"text-secondary",children:"on branch"}),e.jsx("span",{className:"font-mono bg-hover px-1.5 py-0.5 rounded-btn",children:s.result.branch})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("a",{href:s.result.pr_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline",children:[e.jsx(B,{size:12}),"View on GitHub"]})})]});if(s.status==="error")return e.jsxs("div",{className:"rounded-card border border-danger/30 bg-danger/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-danger",children:[e.jsx(S,{size:16}),"Fix failed"]}),e.jsx("p",{className:"text-xs text-muted font-mono bg-danger/5 border border-danger/10 rounded px-2 py-1.5",children:s.error||"Unknown error"}),e.jsx(v,{variant:"secondary",size:"sm",icon:T,onClick:r,children:"Retry"})]});const n=E.indexOf(s.status);return e.jsx("div",{className:"rounded-card border border-primary/20 bg-primary/5 p-4 space-y-2",children:E.map((t,a)=>{const i=a===n,m=a<n;return e.jsxs("div",{className:`flex items-center gap-2 text-xs ${m?"text-success":i?"text-primary font-medium":"text-muted"}`,children:[m?e.jsx(A,{size:14}):i?e.jsx(U,{size:14,className:"animate-spin"}):e.jsx(O,{size:14,className:"opacity-40"}),X[t]]},t)})})}function ee({sessionId:s,issueNumber:r,onBack:n}){const[t,a]=o.useState(null),[i,m]=o.useState(!0),[x,g]=o.useState(null),[u,p]=o.useState({status:"idle"});o.useEffect(()=>{let l=!1;return m(!0),(async()=>{try{const d=await C.getGitHubIssue(s,r);l||(a(d),g(null))}catch(d){l||g(d instanceof Error?d.message:"Failed to load issue")}finally{l||m(!1)}})(),()=>{l=!0}},[s,r]);const j=o.useCallback(async()=>{const l=["creating-branch","analyzing","writing-fix","running-tests","creating-pr"];let d=0;p({status:l[0]});const y=setInterval(()=>{d++,d<l.length&&p({status:l[d]})},2e3);try{const h=await C.fixGitHubIssue(s,r);clearInterval(y),p({status:"success",result:h})}catch(h){clearInterval(y),p({status:"error",error:h instanceof Error?h.message:"Fix failed"})}},[s,r]);return i?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsx(f,{variant:"text",width:"70%",height:"1rem"}),e.jsx(f,{variant:"block",width:"100%",height:"6rem"}),e.jsx(f,{variant:"text",width:"40%",height:"0.75rem"})]}):x||!t?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-danger",children:[e.jsx(S,{size:16}),x||"Issue not found"]})]}):e.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto terminal-scroll h-full",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{size:18,className:`mt-0.5 flex-shrink-0 ${t.state==="open"?"text-success":"text-primary"}`}),e.jsxs("h3",{className:"text-base font-semibold text-ink leading-snug",children:[e.jsxs("span",{className:"text-muted font-mono mr-1.5",children:["#",t.number]}),t.title]})]}),e.jsx("div",{className:"flex items-center flex-wrap gap-2 mt-2 ml-6",children:t.labels.map(l=>e.jsx($,{label:l},l.name))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 ml-6 text-[11px] text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{login:t.author.login}),t.author.login]}),e.jsx("span",{children:z(t.createdAt)})]}),t.assignees.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 ml-6 text-[11px] text-muted",children:[e.jsx(D,{size:11}),"Assigned to:"," ",t.assignees.map(l=>l.login).join(", ")]})]}),t.body&&e.jsx("div",{className:"ml-6 border-l-2 border-border pl-4 space-y-1",children:_(t.body)}),e.jsx("div",{className:"ml-6",children:u.status==="idle"?e.jsx(v,{variant:"primary",size:"md",icon:P,onClick:j,children:"Fix with AI"}):e.jsx(Z,{fixState:u,onRetry:j})}),t.comments_data&&t.comments_data.length>0&&e.jsxs("div",{className:"ml-6 space-y-3",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(R,{size:12}),"Comments (",t.comments_data.length,")"]}),t.comments_data.map((l,d)=>e.jsxs("div",{className:"border border-border rounded-card p-3 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted",children:[e.jsx(I,{login:l.author.login}),e.jsx("span",{className:"font-medium text-ink",children:l.author.login}),e.jsx("span",{children:z(l.createdAt)})]}),e.jsx("div",{className:"mt-1 space-y-1",children:_(l.body)})]},d))]})]})}function Le({sessionId:s}){const[r,n]=o.useState("open"),[t,a]=o.useState(""),[i,m]=o.useState(null),[x,g]=o.useState(!0),[u,p]=o.useState(null),[j,l]=o.useState(null),d=o.useCallback(async()=>{g(!0),p(null);try{const c=r==="all"?"all":r,b=await C.getGitHubIssues(s,c);m(b)}catch(c){p(c instanceof Error?c.message:"Failed to load issues")}finally{g(!1)}},[s,r]);o.useEffect(()=>{d()},[d]);const y=o.useCallback(c=>{n(c),l(null)},[]),h=o.useMemo(()=>{if(!i)return[];if(!t.trim())return i;const c=t.toLowerCase();return i.filter(b=>b.title.toLowerCase().includes(c)||String(b.number).includes(c)||b.labels.some(G=>G.name.toLowerCase().includes(c)))},[i,t]);return j!==null?e.jsx(ee,{sessionId:s,issueNumber:j,onBack:()=>l(null)}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-border space-y-3 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold text-ink flex items-center gap-2",children:[e.jsx(k,{size:16,className:"text-primary"}),"GitHub Issues"]}),e.jsx(v,{variant:"ghost",size:"sm",icon:F,onClick:d,loading:x,children:"Refresh"})]}),e.jsx("div",{className:"flex items-center gap-1 bg-hover rounded-btn p-0.5",children:["open","closed","all"].map(c=>e.jsx("button",{onClick:()=>y(c),className:`flex-1 text-xs font-medium py-1.5 px-3 rounded-btn transition-colors capitalize ${r===c?"bg-white text-ink shadow-sm":"text-muted hover:text-secondary"}`,children:c},c))}),e.jsxs("div",{className:"relative",children:[e.jsx(H,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted pointer-events-none"}),e.jsx("input",{type:"text",placeholder:"Filter issues...",value:t,onChange:c=>a(c.target.value),className:"w-full pl-8 pr-3 py-2 text-xs border border-border rounded-btn bg-white text-ink placeholder:text-muted focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/10"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll p-3 space-y-2",children:[x&&!i&&e.jsxs(e.Fragment,{children:[e.jsx(N,{}),e.jsx(N,{}),e.jsx(N,{}),e.jsx(N,{})]}),u&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(S,{size:24,className:"text-danger mb-2"}),e.jsx("p",{className:"text-xs font-medium text-ink",children:"Failed to load issues"}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:u}),e.jsx(v,{variant:"secondary",size:"sm",icon:F,onClick:d,className:"mt-3",children:"Retry"})]}),!x&&!u&&h.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(k,{size:24,className:"text-muted/30 mb-2"}),e.jsx("p",{className:"text-xs font-medium text-ink",children:"No issues found"}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:t?"Try adjusting your search query":`No ${r==="all"?"":r} issues in this repository`})]}),!u&&h.map(c=>e.jsx(Y,{issue:c,onClick:()=>l(c.number)},c.number))]})]})}export{Le as GitHubIssuesPanel};
|
|
12
|
+
`),n=[];for(let t=0;t<r.length;t++){const a=r[t];if(/^\s*[-*]\s/.test(a)){const i=a.replace(/^\s*[-*]\s/,"");n.push(e.jsx("li",{className:"ml-4 list-disc text-xs text-secondary leading-relaxed",children:L(i)},t));continue}if(a.trim()===""){n.push(e.jsx("br",{},t));continue}n.push(e.jsx("p",{className:"text-xs text-secondary leading-relaxed",children:L(a)},t))}return n}function L(s){const r=[],n=/(\*\*[^*]+\*\*|`[^`]+`)/g;let t=0,a;for(;(a=n.exec(s))!==null;){a.index>t&&r.push(s.slice(t,a.index));const i=a[0];i.startsWith("**")?r.push(e.jsx("strong",{className:"font-semibold text-ink",children:i.slice(2,-2)},a.index)):i.startsWith("`")&&r.push(e.jsx("code",{className:"px-1 py-0.5 rounded bg-hover text-xs font-mono text-primary",children:i.slice(1,-1)},a.index)),t=a.index+i.length}return t<s.length&&r.push(s.slice(t)),r}function $({label:s}){const r=`#${s.color}`,n=K(s.color);return e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-btn px-2 py-0.5 text-[11px] font-medium leading-none",style:{backgroundColor:r,color:n},children:[e.jsx(V,{size:10}),s.name]})}function I({login:s}){return e.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 rounded-full bg-primary/10 text-primary text-[10px] font-bold flex-shrink-0",title:s,children:J(s)})}function N(){return e.jsxs("div",{className:"px-4 py-3 border border-border rounded-card space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"text",width:"2.5rem",height:"0.625rem"}),e.jsx(f,{variant:"text",width:"60%",height:"0.75rem"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"text",width:"4rem",height:"0.5rem"}),e.jsx(f,{variant:"text",width:"4rem",height:"0.5rem"})]})]})}function Y({issue:s,onClick:r}){return e.jsx("button",{onClick:r,className:"w-full text-left px-4 py-3 border border-border rounded-card hover:bg-hover transition-colors cursor-pointer group",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{size:16,className:`mt-0.5 flex-shrink-0 ${s.state==="open"?"text-success":"text-primary"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-xs font-mono text-muted flex-shrink-0",children:["#",s.number]}),e.jsx("span",{className:"text-sm font-medium text-ink truncate group-hover:text-primary transition-colors",children:s.title})]}),e.jsx("div",{className:"flex items-center flex-wrap gap-1.5 mt-1.5",children:s.labels.map(n=>e.jsx($,{label:n},n.name))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[11px] text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{login:s.author.login}),s.author.login]}),e.jsx("span",{children:z(s.createdAt)}),s.comments>0&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(R,{size:11}),s.comments]})]})]})]})})}function Z({fixState:s,onRetry:r}){if(s.status==="idle")return null;if(s.status==="success"&&s.result)return e.jsxs("div",{className:"rounded-card border border-success/30 bg-success/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-success",children:[e.jsx(A,{size:16}),"Pull request created"]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted",children:[e.jsx(q,{size:14,className:"text-success"}),e.jsxs("span",{className:"font-mono",children:["PR #",s.result.pr_number]}),e.jsx("span",{className:"text-secondary",children:"on branch"}),e.jsx("span",{className:"font-mono bg-hover px-1.5 py-0.5 rounded-btn",children:s.result.branch})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("a",{href:s.result.pr_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary hover:underline",children:[e.jsx(H,{size:12}),"View on GitHub"]})})]});if(s.status==="error")return e.jsxs("div",{className:"rounded-card border border-danger/30 bg-danger/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-danger",children:[e.jsx(S,{size:16}),"Fix failed"]}),e.jsx("p",{className:"text-xs text-muted font-mono bg-danger/5 border border-danger/10 rounded px-2 py-1.5",children:s.error||"Unknown error"}),e.jsx(v,{variant:"secondary",size:"sm",icon:T,onClick:r,children:"Retry"})]});const n=E.indexOf(s.status);return e.jsx("div",{className:"rounded-card border border-primary/20 bg-primary/5 p-4 space-y-2",children:E.map((t,a)=>{const i=a===n,m=a<n;return e.jsxs("div",{className:`flex items-center gap-2 text-xs ${m?"text-success":i?"text-primary font-medium":"text-muted"}`,children:[m?e.jsx(A,{size:14}):i?e.jsx(U,{size:14,className:"animate-spin"}):e.jsx(O,{size:14,className:"opacity-40"}),X[t]]},t)})})}function ee({sessionId:s,issueNumber:r,onBack:n}){const[t,a]=o.useState(null),[i,m]=o.useState(!0),[x,g]=o.useState(null),[u,p]=o.useState({status:"idle"});o.useEffect(()=>{let l=!1;return m(!0),(async()=>{try{const d=await C.getGitHubIssue(s,r);l||(a(d),g(null))}catch(d){l||g(d instanceof Error?d.message:"Failed to load issue")}finally{l||m(!1)}})(),()=>{l=!0}},[s,r]);const j=o.useCallback(async()=>{const l=["creating-branch","analyzing","writing-fix","running-tests","creating-pr"];let d=0;p({status:l[0]});const y=setInterval(()=>{d++,d<l.length&&p({status:l[d]})},2e3);try{const h=await C.fixGitHubIssue(s,r);clearInterval(y),p({status:"success",result:h})}catch(h){clearInterval(y),p({status:"error",error:h instanceof Error?h.message:"Fix failed"})}},[s,r]);return i?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsx(f,{variant:"text",width:"70%",height:"1rem"}),e.jsx(f,{variant:"block",width:"100%",height:"6rem"}),e.jsx(f,{variant:"text",width:"40%",height:"0.75rem"})]}):x||!t?e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-danger",children:[e.jsx(S,{size:16}),x||"Issue not found"]})]}):e.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto terminal-scroll h-full",children:[e.jsxs("button",{onClick:n,className:"flex items-center gap-1 text-xs text-muted hover:text-ink transition-colors",children:[e.jsx(w,{size:14}),"Back to issues"]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(k,{size:18,className:`mt-0.5 flex-shrink-0 ${t.state==="open"?"text-success":"text-primary"}`}),e.jsxs("h3",{className:"text-base font-semibold text-ink leading-snug",children:[e.jsxs("span",{className:"text-muted font-mono mr-1.5",children:["#",t.number]}),t.title]})]}),e.jsx("div",{className:"flex items-center flex-wrap gap-2 mt-2 ml-6",children:t.labels.map(l=>e.jsx($,{label:l},l.name))}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 ml-6 text-[11px] text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{login:t.author.login}),t.author.login]}),e.jsx("span",{children:z(t.createdAt)})]}),t.assignees.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 ml-6 text-[11px] text-muted",children:[e.jsx(D,{size:11}),"Assigned to:"," ",t.assignees.map(l=>l.login).join(", ")]})]}),t.body&&e.jsx("div",{className:"ml-6 border-l-2 border-border pl-4 space-y-1",children:_(t.body)}),e.jsx("div",{className:"ml-6",children:u.status==="idle"?e.jsx(v,{variant:"primary",size:"md",icon:B,onClick:j,children:"Fix with AI"}):e.jsx(Z,{fixState:u,onRetry:j})}),t.comments_data&&t.comments_data.length>0&&e.jsxs("div",{className:"ml-6 space-y-3",children:[e.jsxs("h4",{className:"text-xs font-semibold text-muted uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(R,{size:12}),"Comments (",t.comments_data.length,")"]}),t.comments_data.map((l,d)=>e.jsxs("div",{className:"border border-border rounded-card p-3 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted",children:[e.jsx(I,{login:l.author.login}),e.jsx("span",{className:"font-medium text-ink",children:l.author.login}),e.jsx("span",{children:z(l.createdAt)})]}),e.jsx("div",{className:"mt-1 space-y-1",children:_(l.body)})]},d))]})]})}function Le({sessionId:s}){const[r,n]=o.useState("open"),[t,a]=o.useState(""),[i,m]=o.useState(null),[x,g]=o.useState(!0),[u,p]=o.useState(null),[j,l]=o.useState(null),d=o.useCallback(async()=>{g(!0),p(null);try{const c=r==="all"?"all":r,b=await C.getGitHubIssues(s,c);m(b)}catch(c){p(c instanceof Error?c.message:"Failed to load issues")}finally{g(!1)}},[s,r]);o.useEffect(()=>{d()},[d]);const y=o.useCallback(c=>{n(c),l(null)},[]),h=o.useMemo(()=>{if(!i)return[];if(!t.trim())return i;const c=t.toLowerCase();return i.filter(b=>b.title.toLowerCase().includes(c)||String(b.number).includes(c)||b.labels.some(G=>G.name.toLowerCase().includes(c)))},[i,t]);return j!==null?e.jsx(ee,{sessionId:s,issueNumber:j,onBack:()=>l(null)}):e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-border space-y-3 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold text-ink flex items-center gap-2",children:[e.jsx(k,{size:16,className:"text-primary"}),"GitHub Issues"]}),e.jsx(v,{variant:"ghost",size:"sm",icon:F,onClick:d,loading:x,children:"Refresh"})]}),e.jsx("div",{className:"flex items-center gap-1 bg-hover rounded-btn p-0.5",children:["open","closed","all"].map(c=>e.jsx("button",{onClick:()=>y(c),className:`flex-1 text-xs font-medium py-1.5 px-3 rounded-btn transition-colors capitalize ${r===c?"bg-white text-ink shadow-sm":"text-muted hover:text-secondary"}`,children:c},c))}),e.jsxs("div",{className:"relative",children:[e.jsx(P,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted pointer-events-none"}),e.jsx("input",{type:"text",placeholder:"Filter issues...",value:t,onChange:c=>a(c.target.value),className:"w-full pl-8 pr-3 py-2 text-xs border border-border rounded-btn bg-white text-ink placeholder:text-muted focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/10"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto terminal-scroll p-3 space-y-2",children:[x&&!i&&e.jsxs(e.Fragment,{children:[e.jsx(N,{}),e.jsx(N,{}),e.jsx(N,{}),e.jsx(N,{})]}),u&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(S,{size:24,className:"text-danger mb-2"}),e.jsx("p",{className:"text-xs font-medium text-ink",children:"Failed to load issues"}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:u}),e.jsx(v,{variant:"secondary",size:"sm",icon:F,onClick:d,className:"mt-3",children:"Retry"})]}),!x&&!u&&h.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(k,{size:24,className:"text-muted/30 mb-2"}),e.jsx("p",{className:"text-xs font-medium text-ink",children:"No issues found"}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:t?"Try adjusting your search query":`No ${r==="all"?"":r} issues in this repository`})]}),!u&&h.map(c=>e.jsx(Y,{issue:c,onClick:()=>l(c.number)},c.number))]})]})}export{Le as GitHubIssuesPanel};
|