fifony 0.1.12 → 0.1.13

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.
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,h as n}from"./vendor-BoGBoEwT.js";import{t as r}from"./createLucideIcon-DDy-XBQG.js";import{r as i}from"./index-CFbxnygd.js";var a=r(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),o=e(t(),1),s=n(),c=[{key:`n`,description:`Open New Issue drawer`},{key:`k`,description:`Navigate to Kanban`},{key:`i`,description:`Navigate to Issues`},{key:`a`,description:`Navigate to Agents`},{key:`t`,description:`Navigate to Analytics`},{key:`s`,description:`Navigate to Settings`},{key:`1–6`,description:`Jump to kanban column by index`},{key:`Esc`,description:`Close any open drawer / modal`},{key:`?`,description:`Show this help`}];function l({open:e,onClose:t}){let n=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let t=n.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,s.jsxs)(`dialog`,{ref:n,className:`modal modal-bottom sm:modal-middle`,onClose:t,children:[(0,s.jsxs)(`div`,{className:`modal-box max-w-md`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,s.jsxs)(`h3`,{className:`font-bold text-lg flex items-center gap-2`,children:[(0,s.jsx)(a,{className:`size-5 opacity-60`}),`Keyboard Shortcuts`]}),(0,s.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-circle`,onClick:t,children:(0,s.jsx)(i,{className:`size-4`})})]}),(0,s.jsx)(`div`,{className:`overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`table table-sm`,children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{children:`Key`}),(0,s.jsx)(`th`,{children:`Action`})]})}),(0,s.jsx)(`tbody`,{children:c.map(e=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{children:(0,s.jsx)(`kbd`,{className:`kbd kbd-sm`,children:e.key})}),(0,s.jsx)(`td`,{children:e.description})]},e.key))})]})}),(0,s.jsx)(`div`,{className:`modal-action`,children:(0,s.jsx)(`button`,{className:`btn btn-sm`,onClick:t,children:`Close`})})]}),(0,s.jsx)(`form`,{method:`dialog`,className:`modal-backdrop`,children:(0,s.jsx)(`button`,{children:`close`})})]})}export{l as default};
1
+ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,h as n}from"./vendor-BoGBoEwT.js";import{t as r}from"./createLucideIcon-DDy-XBQG.js";import{r as i}from"./index-BVJ46xCh.js";var a=r(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),o=e(t(),1),s=n(),c=[{key:`n`,description:`Open New Issue drawer`},{key:`k`,description:`Navigate to Kanban`},{key:`i`,description:`Navigate to Issues`},{key:`a`,description:`Navigate to Agents`},{key:`t`,description:`Navigate to Analytics`},{key:`s`,description:`Navigate to Settings`},{key:`1–6`,description:`Jump to kanban column by index`},{key:`Esc`,description:`Close any open drawer / modal`},{key:`?`,description:`Show this help`}];function l({open:e,onClose:t}){let n=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let t=n.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,s.jsxs)(`dialog`,{ref:n,className:`modal modal-bottom sm:modal-middle`,onClose:t,children:[(0,s.jsxs)(`div`,{className:`modal-box max-w-md`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,s.jsxs)(`h3`,{className:`font-bold text-lg flex items-center gap-2`,children:[(0,s.jsx)(a,{className:`size-5 opacity-60`}),`Keyboard Shortcuts`]}),(0,s.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-circle`,onClick:t,children:(0,s.jsx)(i,{className:`size-4`})})]}),(0,s.jsx)(`div`,{className:`overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`table table-sm`,children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{children:`Key`}),(0,s.jsx)(`th`,{children:`Action`})]})}),(0,s.jsx)(`tbody`,{children:c.map(e=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{children:(0,s.jsx)(`kbd`,{className:`kbd kbd-sm`,children:e.key})}),(0,s.jsx)(`td`,{children:e.description})]},e.key))})]})}),(0,s.jsx)(`div`,{className:`modal-action`,children:(0,s.jsx)(`button`,{className:`btn btn-sm`,onClick:t,children:`Close`})})]}),(0,s.jsx)(`form`,{method:`dialog`,className:`modal-backdrop`,children:(0,s.jsx)(`button`,{children:`close`})})]})}export{l as default};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,h as n,m as r}from"./vendor-BoGBoEwT.js";import{t as i}from"./createLucideIcon-DDy-XBQG.js";import{E as a,S as o,_ as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,l as h,n as g,o as _,s as v,t as y,v as b,w as x,x as S}from"./index-CFbxnygd.js";var C=i(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),w=i(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),T=i(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),E=i(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),D=i(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),O=i(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),k=i(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),A=i(`music`,[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),j=i(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),M=e(t(),1),N=n();function ee(){let e=(0,M.useRef)(null),t=(0,M.useRef)([]),n=(0,M.useRef)(null),r=[`♪`,`♫`,`♩`,`♬`,`★`,`●`],i=[`oklch(0.75 0.15 250 / 0.35)`,`oklch(0.80 0.14 200 / 0.30)`,`oklch(0.70 0.18 330 / 0.25)`,`oklch(0.85 0.12 85 / 0.30)`,`oklch(0.75 0.16 145 / 0.28)`,`oklch(0.80 0.10 280 / 0.22)`],a=(0,M.useCallback)((e,t)=>({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*.4,vy:-Math.random()*.3-.1,size:Math.random()*16+10,symbol:r[Math.floor(Math.random()*r.length)],color:i[Math.floor(Math.random()*i.length)],rotation:Math.random()*360,rotationSpeed:(Math.random()-.5)*.8,opacity:Math.random()*.4+.15,pulseOffset:Math.random()*Math.PI*2}),[]);return(0,M.useEffect)(()=>{let r=e.current;if(!r)return;let i=r.getContext(`2d`),o=()=>{let e=window.devicePixelRatio||1;r.width=window.innerWidth*e,r.height=window.innerHeight*e,r.style.width=window.innerWidth+`px`,r.style.height=window.innerHeight+`px`,i.scale(e,e)};o();let s=Math.min(Math.floor(window.innerWidth*window.innerHeight/18e3),40);t.current=Array.from({length:s},()=>a(window.innerWidth,window.innerHeight));let c=()=>{let e=window.innerWidth,r=window.innerHeight;i.clearRect(0,0,e,r);let a=Date.now()/1e3;for(let n of t.current){n.x+=n.vx,n.y+=n.vy,n.rotation+=n.rotationSpeed,n.y<-30&&(n.y=r+30,n.x=Math.random()*e),n.x<-30&&(n.x=e+30),n.x>e+30&&(n.x=-30);let t=Math.sin(a*1.5+n.pulseOffset)*.15+.85;i.save(),i.translate(n.x,n.y),i.rotate(n.rotation*Math.PI/180),i.globalAlpha=n.opacity*t,i.font=`${n.size}px serif`,i.textAlign=`center`,i.textBaseline=`middle`,i.fillStyle=n.color,i.fillText(n.symbol,0,0),i.restore()}n.current=requestAnimationFrame(c)};return n.current=requestAnimationFrame(c),window.addEventListener(`resize`,o),()=>{cancelAnimationFrame(n.current),window.removeEventListener(`resize`,o)}},[a]),(0,N.jsx)(`canvas`,{ref:e,className:`fixed inset-0 pointer-events-none`,style:{zIndex:0},"aria-hidden":`true`})}var P=8,F=[{value:`low`,label:`Low`,icon:g,description:`Quick and light -- fast responses, less thorough`,color:`text-info`},{value:`medium`,label:`Medium`,icon:u,description:`Balanced -- good mix of speed and quality`,color:`text-success`},{value:`high`,label:`High`,icon:w,description:`Thorough -- deeper analysis, takes more time`,color:`text-warning`},{value:`extra-high`,label:`Extra High`,icon:D,description:`Maximum depth -- most thorough, slowest`,color:`text-error`}],I={codex:F,claude:F.filter(e=>e.value!==`extra-high`)};function L(e,t){return I[t?.[e]||`claude`]||F}var R=[{label:`Technical`,domains:[{value:`frontend`,label:`Frontend`,emoji:`🎨`},{value:`backend`,label:`Backend`,emoji:`⚙️`},{value:`mobile`,label:`Mobile`,emoji:`📱`},{value:`devops`,label:`DevOps / Infra`,emoji:`🚀`},{value:`database`,label:`Database`,emoji:`🗄️`},{value:`ai-ml`,label:`AI / ML`,emoji:`🤖`},{value:`security`,label:`Security`,emoji:`🔒`},{value:`testing`,label:`Testing / QA`,emoji:`🧪`},{value:`embedded`,label:`Embedded / IoT`,emoji:`🔌`}]},{label:`Industry`,domains:[{value:`games`,label:`Games`,emoji:`🎮`},{value:`ecommerce`,label:`E-commerce`,emoji:`🛒`},{value:`saas`,label:`SaaS`,emoji:`☁️`},{value:`fintech`,label:`Fintech`,emoji:`💰`},{value:`healthcare`,label:`Healthcare`,emoji:`🏥`},{value:`education`,label:`Education`,emoji:`📚`},{value:`blockchain`,label:`Blockchain`,emoji:`⛓️`},{value:`spatial-computing`,label:`Spatial / XR`,emoji:`🥽`}]},{label:`Role`,domains:[{value:`design`,label:`Design / UX`,emoji:`✏️`},{value:`product`,label:`Product`,emoji:`📋`},{value:`marketing`,label:`Marketing`,emoji:`📢`},{value:`data-engineering`,label:`Data Engineering`,emoji:`📊`}]}],z=[{value:`auto`,label:`Auto`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`black`,label:`Black`},{value:`cupcake`,label:`Cupcake`},{value:`night`,label:`Night`},{value:`sunset`,label:`Sunset`}];async function B(e,t,n=`ui`){return a.post(`/settings/${encodeURIComponent(e)}`,{value:t,scope:n,source:`user`})}function V(e,t=`medium`){return F.some(t=>t.value===e)?e:t}function H(e){return!e||typeof e!=`object`||Array.isArray(e)?{planner:`medium`,executor:`medium`,reviewer:`medium`}:{planner:V(e.planner??e.default,`medium`),executor:V(e.executor??e.default,`medium`),reviewer:V(e.reviewer??e.default,`medium`)}}var U=[`Pipeline`,`Scan`,`Domains`,`Agents`,`Effort`,`Workers & Theme`,`Launch`];function te({current:e}){let t=e-1;return(0,N.jsx)(`ul`,{className:`steps steps-horizontal w-full max-w-2xl text-xs`,children:U.map((e,n)=>{let r=n<t,i=n===t;return(0,N.jsx)(`li`,{"data-content":r?`✓`:n+1,className:`step ${r||i?`step-primary`:``}`,style:{transition:`color 0.3s ease`},children:e},e)})})}function ne({direction:e,stepKey:t,center:n,children:r}){return(0,N.jsx)(`div`,{className:`${e===`forward`?`animate-slide-in-right`:`animate-slide-in-left`} w-full max-w-2xl mx-auto ${n?`my-auto`:``}`,children:r},t)}function re({workspacePath:e}){return(0,N.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,N.jsx)(`div`,{className:`text-6xl sm:text-7xl animate-bounce-in`,children:(0,N.jsx)(A,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,N.jsxs)(`h1`,{className:`text-3xl sm:text-4xl font-bold tracking-tight`,children:[`Welcome to `,(0,N.jsx)(`span`,{className:`text-primary`,children:`Fifony`})]}),(0,N.jsx)(`p`,{className:`text-base-content/60 text-lg max-w-md`,children:`Let's set up your AI orchestration workspace in just a few steps.`}),e&&(0,N.jsxs)(`div`,{className:`badge badge-lg badge-soft badge-primary gap-2`,children:[(0,N.jsx)(_,{className:`size-3.5`}),e]})]})}var W=[{role:`planner`,label:`Planner`,description:`Scopes the issue, breaks it into steps, and decides the approach`,icon:w,color:`text-info`},{role:`executor`,label:`Executor`,description:`Implements the plan — writes code, edits files, runs commands`,icon:g,color:`text-primary`},{role:`reviewer`,label:`Reviewer`,description:`Validates the result — checks correctness, scope, and quality`,icon:v,color:`text-secondary`}];function ie({providers:e,providersLoading:t,pipeline:n,setPipeline:r}){let i=Array.isArray(e)?e:[],a=i.filter(e=>e.available!==!1);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(j,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agent Pipeline`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which CLI runs each stage of the pipeline`})]}),t?(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8`,children:[(0,N.jsx)(h,{className:`size-8 text-primary animate-spin`}),(0,N.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Detecting available CLIs...`})]}):a.length===0?(0,N.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`No providers detected. Make sure claude or codex CLI is installed.`}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:i.map(e=>{let t=e.id||e.name||e,n=e.available!==!1;return(0,N.jsxs)(`span`,{className:`badge badge-lg gap-2 ${n?`badge-success`:`badge-ghost opacity-50`}`,children:[n?(0,N.jsx)(f,{className:`size-3.5`}):(0,N.jsx)(p,{className:`size-3.5`}),t,e.path&&(0,N.jsx)(`span`,{className:`font-mono text-[10px] opacity-60 hidden sm:inline`,children:e.path})]},t)})}),(0,N.jsx)(`div`,{className:`flex flex-col items-center gap-2`,children:W.map((e,t)=>{let i=e.icon,o=n[e.role]||a[0]?.name||``;return(0,N.jsxs)(`div`,{className:`w-full`,children:[t>0&&(0,N.jsx)(`div`,{className:`flex justify-center py-1`,children:(0,N.jsx)(E,{className:`size-5 rotate-90 opacity-30`})}),(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-4 flex-row items-center gap-4`,children:[(0,N.jsx)(`div`,{className:`size-10 rounded-full flex items-center justify-center bg-base-300 ${e.color}`,children:(0,N.jsx)(i,{className:`size-5`})}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsx)(`div`,{className:`font-semibold`,children:e.label}),(0,N.jsx)(`p`,{className:`text-xs text-base-content/50`,children:e.description})]}),(0,N.jsx)(`select`,{className:`select select-bordered select-sm w-32`,value:o,onChange:t=>r(n=>({...n,[e.role]:t.target.value})),children:a.map(e=>{let t=e.id||e.name||e;return(0,N.jsx)(`option`,{value:t,children:t},t)})})]})})]},e.role)})}),(0,N.jsx)(`p`,{className:`text-xs text-base-content/40 text-center max-w-md mx-auto`,children:`Each stage can use a different CLI. The pipeline flows top to bottom: plan, then execute, then review.`})]})]})}function ae({scanResult:e,setScanResult:t,projectDescription:n,setProjectDescription:r,analysisResult:i,setAnalysisResult:o,selectedProvider:s,analyzing:c,setAnalyzing:l}){let[u,m]=(0,M.useState)(!1),[g,v]=(0,M.useState)(null),[y,x]=(0,M.useState)(null),S=(0,M.useRef)(!1);(0,M.useEffect)(()=>{S.current||e||(S.current=!0,m(!0),v(null),a.get(`/scan/project`).then(e=>{if(t(e),!n){let t=e?.packageDescription||e?.packageInfo?.description||e?.readmeExcerpt||``;t&&r(t)}s&&!i&&(l(!0),a.post(`/scan/analyze`,{provider:s}).then(e=>{o(e),e.description&&r(e.description)}).catch(()=>{}).finally(()=>l(!1)))}).catch(e=>v(e.message||`Failed to scan project`)).finally(()=>m(!1)))},[]);let w=(0,M.useCallback)(async()=>{l(!0),x(null);try{let e=await a.post(`/scan/analyze`,{provider:s||`claude`});o(e),e.description&&r(e.description)}catch(e){x(e.message||`Analysis failed`)}finally{l(!1)}},[s,l,o,r]),T={claudeMd:`CLAUDE.md`,claudeDir:`.claude/`,codexDir:`.codex/`,readmeMd:`README.md`,packageJson:`package.json`,cargoToml:`Cargo.toml`,pyprojectToml:`pyproject.toml`,goMod:`go.mod`,buildGradle:`build.gradle`,gemfile:`Gemfile`,dockerfile:`Dockerfile`,workflowMd:`WORKFLOW.md`,agentsMd:`AGENTS.md`,claudeAgentsDir:`.claude/agents/`,claudeSkillsDir:`.claude/skills/`,codexAgentsDir:`.codex/agents/`,codexSkillsDir:`.codex/skills/`},E=e?.files||{},D=Object.entries(E).map(([e,t])=>({path:T[e]||e,exists:!!t})),k=(e?.existingAgents||[]).map(e=>typeof e==`string`?{name:e}:e),A=(e?.existingSkills||[]).map(e=>typeof e==`string`?{name:e}:e),j=i?.stack||[];return(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(O,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Scan Project`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`We'll analyze your workspace to suggest the best setup`})]}),u&&(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6`,children:[(0,N.jsx)(h,{className:`size-8 text-primary animate-spin`}),(0,N.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Scanning project files...`})]}),g&&(0,N.jsx)(`div`,{className:`alert alert-warning text-sm`,children:g}),e&&!u&&(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(d,{className:`size-4 opacity-50`}),`Project Files`]}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-1.5`,children:D.map(e=>(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[e.exists?(0,N.jsx)(f,{className:`size-4 text-success shrink-0`}):(0,N.jsx)(p,{className:`size-4 text-base-content/30 shrink-0`}),(0,N.jsx)(`span`,{className:`font-mono text-xs truncate ${e.exists?``:`text-base-content/40`}`,children:e.path})]},e.path))}),(k.length>0||A.length>0)&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k.length>0&&(0,N.jsxs)(`span`,{className:`badge badge-sm badge-info gap-1`,children:[(0,N.jsx)(b,{className:`size-3`}),k.length,` agent`,k.length===1?``:`s`,` found`]}),A.length>0&&(0,N.jsxs)(`span`,{className:`badge badge-sm badge-secondary gap-1`,children:[(0,N.jsx)(C,{className:`size-3`}),A.length,` skill`,A.length===1?``:`s`,` found`]})]})]})]})}),!c&&!i&&(0,N.jsxs)(`button`,{className:`btn btn-primary btn-lg gap-2 mx-auto`,onClick:w,disabled:u,children:[(0,N.jsx)(_,{className:`size-5`}),`Analyze with AI`]}),c&&(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-4`,children:[(0,N.jsx)(h,{className:`size-8 text-primary animate-spin`}),(0,N.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`AI is analyzing your project...`})]}),y&&(0,N.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`Analysis failed. You can describe your project manually below.`}),j.length>0&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:j.map(e=>(0,N.jsx)(`span`,{className:`badge badge-sm badge-soft badge-primary`,children:e},e))}),(e||i||y)&&!u&&!c&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`label text-sm font-medium`,children:`Project Description`}),(0,N.jsx)(`textarea`,{className:`textarea textarea-bordered w-full h-24 text-sm`,placeholder:`Describe your project so we can suggest the right agents and domains...`,value:n,onChange:e=>r(e.target.value)})]})]})}function oe({selectedDomains:e,setSelectedDomains:t,analysisResult:n}){let r=(0,M.useRef)(!1);(0,M.useEffect)(()=>{r.current||!n?.domains?.length||e.length>0||(r.current=!0,t(n.domains))},[n]);let i=(0,M.useCallback)(e=>{t(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[t]);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(k,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Domains`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Select the domains relevant to your project`})]}),R.map(t=>(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wider text-base-content/40 mb-2`,children:t.label}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.domains.map(t=>(0,N.jsxs)(`button`,{className:`btn btn-sm gap-1.5 ${e.includes(t.value)?`btn-primary`:`btn-soft`}`,onClick:()=>i(t.value),children:[(0,N.jsx)(`span`,{children:t.emoji}),t.label]},t.value))})]},t.label))]})}function se({selectedDomains:e,selectedAgents:t,setSelectedAgents:n,selectedSkills:r,setSelectedSkills:i,existingAgents:o,existingSkills:c}){let[l,u]=(0,M.useState)([]),[d,f]=(0,M.useState)([]),[p,m]=(0,M.useState)(!1),g=(0,M.useRef)(!1);(0,M.useEffect)(()=>{if(g.current)return;g.current=!0,m(!0);let s=e.length>0?`?domains=${e.join(`,`)}`:``;Promise.all([a.get(`/catalog/agents${s}`).catch(()=>({agents:[]})),a.get(`/catalog/skills`).catch(()=>({skills:[]}))]).then(([e,a])=>{let s=e?.agents||[],l=a?.skills||[];u(s),f(l);let d=new Set((o||[]).map(e=>e.name)),p=s.filter(e=>!d.has(e.name)).map(e=>e.name);p.length>0&&t.length===0&&n(p);let m=new Set((c||[]).map(e=>e.name)),h=l.filter(e=>!m.has(e.name)).map(e=>e.name);h.length>0&&r.length===0&&i(h)}).finally(()=>m(!1))},[]);let _=new Set((o||[]).map(e=>e.name)),v=new Set((c||[]).map(e=>e.name)),y=(0,M.useCallback)(e=>{n(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[n]),x=(0,M.useCallback)(e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[i]),S=(0,M.useCallback)(()=>{n(l.filter(e=>!_.has(e.name)).map(e=>e.name))},[l,_,n]),w=(0,M.useCallback)(()=>n([]),[n]),T=(0,M.useCallback)(()=>{i(d.filter(e=>!v.has(e.name)).map(e=>e.name))},[d,v,i]),E=(0,M.useCallback)(()=>i([]),[i]);return p?(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12`,children:[(0,N.jsx)(h,{className:`size-8 text-primary animate-spin`}),(0,N.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Loading catalog...`})]}):(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(b,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agents & Skills`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which agents and skills to install`})]}),l.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(b,{className:`size-4 opacity-50`}),`Agents (`,l.length,`)`]}),(0,N.jsxs)(`div`,{className:`flex gap-1`,children:[(0,N.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:S,children:`Select All`}),(0,N.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:w,children:`None`})]})]}),(0,N.jsx)(`div`,{className:`grid gap-2`,children:l.map(e=>{let n=_.has(e.name),r=n||t.includes(e.name);return(0,N.jsx)(`button`,{className:`card bg-base-200 cursor-pointer transition-all text-left ${r?`ring-2 ring-primary ring-offset-1 ring-offset-base-100`:``} ${n?`opacity-60`:``}`,onClick:()=>!n&&y(e.name),disabled:n,children:(0,N.jsxs)(`div`,{className:`card-body p-3 flex-row items-center gap-3`,children:[(0,N.jsx)(`div`,{className:`text-xl shrink-0`,children:e.emoji||`🤖`}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.displayName||e.name}),e.description&&(0,N.jsx)(`p`,{className:`text-xs text-base-content/50 truncate`,children:e.description})]}),n?(0,N.jsxs)(`span`,{className:`badge badge-sm badge-success gap-1`,children:[(0,N.jsx)(s,{className:`size-3`}),` Installed`]}):(0,N.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm`,checked:r,readOnly:!0,tabIndex:-1})]})},e.name)})})]}),d.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(C,{className:`size-4 opacity-50`}),`Skills (`,d.length,`)`]}),(0,N.jsxs)(`div`,{className:`flex gap-1`,children:[(0,N.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:T,children:`Select All`}),(0,N.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:E,children:`None`})]})]}),(0,N.jsx)(`div`,{className:`grid gap-2`,children:d.map(e=>{let t=v.has(e.name),n=t||r.includes(e.name);return(0,N.jsx)(`button`,{className:`card bg-base-200 cursor-pointer transition-all text-left ${n?`ring-2 ring-primary ring-offset-1 ring-offset-base-100`:``} ${t?`opacity-60`:``}`,onClick:()=>!t&&x(e.name),disabled:t,children:(0,N.jsxs)(`div`,{className:`card-body p-3 flex-row items-center gap-3`,children:[(0,N.jsx)(`div`,{className:`text-xl shrink-0`,children:e.emoji||`🧩`}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.displayName||e.name}),e.description&&(0,N.jsx)(`p`,{className:`text-xs text-base-content/50 truncate`,children:e.description})]}),t?(0,N.jsxs)(`span`,{className:`badge badge-sm badge-success gap-1`,children:[(0,N.jsx)(s,{className:`size-3`}),` Installed`]}):(0,N.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm`,checked:n,readOnly:!0,tabIndex:-1})]})},e.name)})})]}),l.length===0&&d.length===0&&(0,N.jsx)(`div`,{className:`alert alert-info text-sm`,children:`No agents or skills found in the catalog. You can add them later from the settings page.`})]})}function G({role:e,title:t,description:n,providerName:r,value:i,onChange:a,options:o}){return(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h3`,{className:`font-semibold`,children:t}),(0,N.jsx)(`p`,{className:`text-xs text-base-content/60 mt-1`,children:n})]}),r&&(0,N.jsx)(`span`,{className:`badge badge-sm badge-soft badge-primary capitalize`,children:r})]}),(0,N.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:o.map(t=>{let n=t.icon,r=i===t.value;return(0,N.jsx)(`button`,{className:`card card-interactive bg-base-100 cursor-pointer transition-all text-left ${r?`ring-2 ring-primary ring-offset-2 ring-offset-base-200`:``}`,onClick:()=>a(t.value),children:(0,N.jsxs)(`div`,{className:`card-body p-4 gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(n,{className:`size-5 ${t.color}`}),(0,N.jsx)(`span`,{className:`font-semibold`,children:t.label}),r&&(0,N.jsx)(s,{className:`size-4 text-primary ml-auto`})]}),(0,N.jsx)(`p`,{className:`text-xs text-base-content/60`,children:t.description})]})},`${e}-${t.value}`)})})]})})}function ce({efforts:e,setEfforts:t,pipeline:n}){return(0,M.useEffect)(()=>{for(let r of[`planner`,`executor`,`reviewer`]){let i=L(r,n),a=e[r];a&&!i.some(e=>e.value===a)&&t(e=>({...e,[r]:`high`}))}},[n,e,t]),(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(u,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Reasoning Effort By Stage`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose the depth for each pipeline stage. Options depend on the CLI selected.`})]}),(0,N.jsx)(G,{role:`planner`,title:`Planning`,description:`Scopes the issue and decides the overall approach.`,providerName:n?.planner,value:e.planner,onChange:e=>t(t=>({...t,planner:e})),options:L(`planner`,n)}),(0,N.jsx)(G,{role:`executor`,title:`Execution`,description:`Implements the plan — writes code, edits files.`,providerName:n?.executor,value:e.executor,onChange:e=>t(t=>({...t,executor:e})),options:L(`executor`,n)}),(0,N.jsx)(G,{role:`reviewer`,title:`Review`,description:`Validates the result before approving.`,providerName:n?.reviewer,value:e.reviewer,onChange:e=>t(t=>({...t,reviewer:e})),options:L(`reviewer`,n)})]})}function le({concurrency:e,setConcurrency:t,selectedTheme:n,setSelectedTheme:r}){return(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,N.jsx)(m,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Workers & Theme`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Configure parallel workers and visual theme`})]}),(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(m,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,N.jsxs)(`p`,{className:`text-xs text-base-content/60`,children:[`How many agents can work in parallel (`,e,` worker`,e===1?``:`s`,`)`]}),(0,N.jsx)(`input`,{type:`range`,min:1,max:16,value:e,onChange:e=>t(Number(e.target.value)),className:`range range-primary range-sm`}),(0,N.jsxs)(`div`,{className:`flex justify-between text-xs text-base-content/40 px-1`,children:[(0,N.jsx)(`span`,{children:`1`}),(0,N.jsx)(`span`,{children:`4`}),(0,N.jsx)(`span`,{children:`8`}),(0,N.jsx)(`span`,{children:`12`}),(0,N.jsx)(`span`,{children:`16`})]})]})})]}),(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(l,{className:`size-4 opacity-50`}),`Theme`]}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map(e=>(0,N.jsx)(`button`,{className:`btn btn-sm ${n===e.value?`btn-primary`:`btn-soft`}`,onClick:()=>r(e.value),children:e.label},e.value))})]})})]})}function ue({config:e,launching:t}){return(0,N.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,N.jsx)(`div`,{className:`animate-bounce-in`,children:(0,N.jsx)(j,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,N.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold`,children:`You're All Set!`}),(0,N.jsx)(`p`,{className:`text-base-content/60 max-w-md`,children:`Here's a summary of your configuration. Hit launch when you're ready.`}),(0,N.jsx)(`div`,{className:`card bg-base-200 w-full max-w-sm`,children:(0,N.jsxs)(`div`,{className:`card-body p-4 gap-2 text-sm text-left`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Pipeline`}),(0,N.jsxs)(`span`,{className:`font-semibold capitalize text-xs font-mono`,children:[e.pipeline?.planner||`?`,` → `,e.pipeline?.executor||`?`,` → `,e.pipeline?.reviewer||`?`]})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Domains`}),(0,N.jsx)(`span`,{className:`font-semibold`,children:e.domains?.length>0?e.domains.length+` selected`:`none`})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Agents`}),(0,N.jsxs)(`span`,{className:`font-semibold`,children:[e.agents?.length||0,` to install`]})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Skills`}),(0,N.jsxs)(`span`,{className:`font-semibold`,children:[e.skills?.length||0,` to install`]})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Plan`}),(0,N.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.planner})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Execute`}),(0,N.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.executor})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Review`}),(0,N.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.reviewer})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Workers`}),(0,N.jsx)(`span`,{className:`font-semibold`,children:e.concurrency})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Theme`}),(0,N.jsx)(`span`,{className:`font-semibold capitalize`,children:e.theme})]})]})}),t&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-base-content/50`,children:[(0,N.jsx)(h,{className:`size-4 animate-spin`}),`Saving configuration & installing agents...`]})]})}function K({onComplete:e}){let t=r(),n=x(),i=o(n.data),[s,l]=(0,M.useState)(0),[u,d]=(0,M.useState)(`forward`),[f,p]=(0,M.useState)(!1),[m,g]=(0,M.useState)(null),_=(0,M.useRef)(!1),[v,b]=(0,M.useState)(``),[C,w]=(0,M.useState)({planner:``,executor:``,reviewer:``}),[D,O]=(0,M.useState)(()=>H(null)),[k,A]=(0,M.useState)(2),[F,I]=(0,M.useState)(`auto`),[L,R]=(0,M.useState)(null),[z,V]=(0,M.useState)(null),[U,W]=(0,M.useState)(``),[G,K]=(0,M.useState)([]),[q,de]=(0,M.useState)([]),[J,fe]=(0,M.useState)([]),[pe,me]=(0,M.useState)(!1),[Y,X]=(0,M.useState)(null),[Z,Q]=(0,M.useState)(!1),[he,ge]=(0,M.useState)(``);(0,M.useEffect)(()=>{a.get(`/state`).then(e=>{ge(e?.sourceRepoUrl||e?.config?.sourceRepo||``)}).catch(()=>{})},[]),(0,M.useEffect)(()=>{if(_.current||n.isLoading)return;_.current=!0;let e=S(i,`runtime.agentProvider`,``),t=S(i,`runtime.defaultEffort`,null),r=S(i,`ui.theme`,`auto`),a=S(i,`runtime.workerConcurrency`,2);typeof e==`string`&&e.trim()&&b(e),O(H(t)),typeof r==`string`&&r.trim()&&I(r);let o=Number.parseInt(String(a??2),10);Number.isFinite(o)&&A(Math.min(16,Math.max(1,o)))},[i,n.isLoading]),(0,M.useEffect)(()=>{s===1&&Y===null&&(Q(!0),a.get(`/providers`).then(e=>{let t=Array.isArray(e)?e:e?.providers||[];X(t);let n=t.filter(e=>e.available!==!1),r=n[0]?.id||n[0]?.name||``;r&&!v&&b(r);let i=n.find(e=>(e.id||e.name)===`claude`),a=r,o=i?`claude`:a;w(e=>({planner:e.planner||o,executor:e.executor||a,reviewer:e.reviewer||o}))}).catch(()=>{X([])}).finally(()=>{Q(!1)}))},[s]),(0,M.useEffect)(()=>{let e=F===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:F;document.documentElement.setAttribute(`data-theme`,e)},[F]),(0,M.useEffect)(()=>{C.executor&&C.executor!==v&&b(C.executor)},[C.executor]);let $=(0,M.useCallback)(e=>{if(e===1){let e=[{provider:C.planner,role:`planner`},{provider:C.executor,role:`executor`},{provider:C.reviewer,role:`reviewer`}];B(`runtime.agentProvider`,C.executor,`runtime`).catch(()=>{}),B(`runtime.pipeline`,e,`runtime`).catch(()=>{})}else e===5?B(`runtime.defaultEffort`,D,`runtime`).catch(()=>{}):e===6&&(B(`ui.theme`,F,`ui`).catch(()=>{}),a.post(`/config/concurrency`,{concurrency:k}).catch(()=>{}))},[C,D,k,F]),_e=(0,M.useCallback)(()=>{s<P-1&&($(s),d(`forward`),l(e=>e+1))},[s,$]),ve=(0,M.useCallback)(()=>{s>0&&(d(`backward`),l(e=>e-1))},[s]),ye=(0,M.useCallback)(async()=>{p(!0);try{let n=[B(`ui.theme`,F,`ui`),B(`ui.onboarding.completed`,!0,`ui`)],r=[{provider:C.planner,role:`planner`},{provider:C.executor,role:`executor`},{provider:C.reviewer,role:`reviewer`}];n.push(B(`runtime.agentProvider`,C.executor,`runtime`)),n.push(B(`runtime.pipeline`,r,`runtime`)),n.push(B(`runtime.defaultEffort`,D,`runtime`)),n.push(a.post(`/config/concurrency`,{concurrency:k})),q.length>0&&n.push(a.post(`/install/agents`,{agents:q})),J.length>0&&n.push(a.post(`/install/skills`,{skills:J})),await Promise.allSettled(n),g({x:window.innerWidth/2,y:window.innerHeight/3}),setTimeout(()=>{t.invalidateQueries({queryKey:c}),e?.()},1200)}catch{await B(`ui.onboarding.completed`,!0,`ui`).catch(()=>{}),t.invalidateQueries({queryKey:c}),e?.()}},[v,D,k,F,q,J,t,e]),be=s===0||s===1&&(C.executor||Z)||s===2||s===3||s===4||s===5||s===6||s===7,xe=(L?.existingAgents||[]).map(e=>typeof e==`string`?{name:e}:e),Se=(L?.existingSkills||[]).map(e=>typeof e==`string`?{name:e}:e),Ce={pipeline:C,efforts:D,concurrency:k,theme:F,domains:G,agents:q,skills:J};return(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-base-100 flex flex-col overflow-hidden`,children:[(0,N.jsx)(ee,{}),m&&(0,N.jsx)(y,{x:m.x,y:m.y,active:!0,onDone:()=>g(null)}),s>0&&(0,N.jsx)(`div`,{className:`relative z-10 pt-6 pb-2 px-4 flex justify-center`,children:(0,N.jsx)(te,{current:s})}),(0,N.jsx)(`div`,{className:`relative z-10 flex-1 flex flex-col items-center justify-start px-4 py-6 overflow-y-auto`,children:(0,N.jsxs)(ne,{direction:u,stepKey:s,center:s===0||s===1||s===7,children:[s===0&&(0,N.jsx)(re,{workspacePath:he}),s===1&&(0,N.jsx)(ie,{providers:Y||[],providersLoading:Z,pipeline:C,setPipeline:w}),s===2&&(0,N.jsx)(ae,{scanResult:L,setScanResult:R,projectDescription:U,setProjectDescription:W,analysisResult:z,setAnalysisResult:V,selectedProvider:v,analyzing:pe,setAnalyzing:me}),s===3&&(0,N.jsx)(oe,{selectedDomains:G,setSelectedDomains:K,analysisResult:z}),s===4&&(0,N.jsx)(se,{selectedDomains:G,selectedAgents:q,setSelectedAgents:de,selectedSkills:J,setSelectedSkills:fe,existingAgents:xe,existingSkills:Se}),s===5&&(0,N.jsx)(ce,{efforts:D,setEfforts:O,pipeline:C}),s===6&&(0,N.jsx)(le,{concurrency:k,setConcurrency:A,selectedTheme:F,setSelectedTheme:I}),s===7&&(0,N.jsx)(ue,{config:Ce,launching:f})]})}),(0,N.jsxs)(`div`,{className:`relative z-10 p-4 pb-6 flex justify-between items-center max-w-2xl mx-auto w-full`,children:[s>0?(0,N.jsxs)(`button`,{className:`btn btn-ghost gap-1`,onClick:ve,disabled:f,children:[(0,N.jsx)(T,{className:`size-4`}),` Back`]}):(0,N.jsx)(`div`,{}),s<P-1?(0,N.jsxs)(`button`,{className:`btn btn-primary gap-1`,onClick:_e,disabled:!be,children:[s===0?`Get Started`:`Next`,` `,(0,N.jsx)(E,{className:`size-4`})]}):(0,N.jsx)(`button`,{className:`btn btn-primary btn-lg gap-2 animate-pulse-soft`,onClick:ye,disabled:f,children:f?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(h,{className:`size-5 animate-spin`}),` Launching...`]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(j,{className:`size-5`}),` Launch Fifony`]})})]})]})}export{K as default};
1
+ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,h as n,m as r}from"./vendor-BoGBoEwT.js";import{t as i}from"./createLucideIcon-DDy-XBQG.js";import{E as a,S as o,_ as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,l as h,n as g,o as _,s as v,t as y,v as b,w as x,x as S}from"./index-BVJ46xCh.js";var C=i(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),w=i(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),T=i(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),E=i(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),D=i(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),O=i(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),k=i(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),A=i(`music`,[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),j=i(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),M=e(t(),1),N=n();function ee(){let e=(0,M.useRef)(null),t=(0,M.useRef)([]),n=(0,M.useRef)(null),r=[`♪`,`♫`,`♩`,`♬`,`★`,`●`],i=[`oklch(0.75 0.15 250 / 0.35)`,`oklch(0.80 0.14 200 / 0.30)`,`oklch(0.70 0.18 330 / 0.25)`,`oklch(0.85 0.12 85 / 0.30)`,`oklch(0.75 0.16 145 / 0.28)`,`oklch(0.80 0.10 280 / 0.22)`],a=(0,M.useCallback)((e,t)=>({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*.4,vy:-Math.random()*.3-.1,size:Math.random()*16+10,symbol:r[Math.floor(Math.random()*r.length)],color:i[Math.floor(Math.random()*i.length)],rotation:Math.random()*360,rotationSpeed:(Math.random()-.5)*.8,opacity:Math.random()*.4+.15,pulseOffset:Math.random()*Math.PI*2}),[]);return(0,M.useEffect)(()=>{let r=e.current;if(!r)return;let i=r.getContext(`2d`),o=()=>{let e=window.devicePixelRatio||1;r.width=window.innerWidth*e,r.height=window.innerHeight*e,r.style.width=window.innerWidth+`px`,r.style.height=window.innerHeight+`px`,i.scale(e,e)};o();let s=Math.min(Math.floor(window.innerWidth*window.innerHeight/18e3),40);t.current=Array.from({length:s},()=>a(window.innerWidth,window.innerHeight));let c=()=>{let e=window.innerWidth,r=window.innerHeight;i.clearRect(0,0,e,r);let a=Date.now()/1e3;for(let n of t.current){n.x+=n.vx,n.y+=n.vy,n.rotation+=n.rotationSpeed,n.y<-30&&(n.y=r+30,n.x=Math.random()*e),n.x<-30&&(n.x=e+30),n.x>e+30&&(n.x=-30);let t=Math.sin(a*1.5+n.pulseOffset)*.15+.85;i.save(),i.translate(n.x,n.y),i.rotate(n.rotation*Math.PI/180),i.globalAlpha=n.opacity*t,i.font=`${n.size}px serif`,i.textAlign=`center`,i.textBaseline=`middle`,i.fillStyle=n.color,i.fillText(n.symbol,0,0),i.restore()}n.current=requestAnimationFrame(c)};return n.current=requestAnimationFrame(c),window.addEventListener(`resize`,o),()=>{cancelAnimationFrame(n.current),window.removeEventListener(`resize`,o)}},[a]),(0,N.jsx)(`canvas`,{ref:e,className:`fixed inset-0 pointer-events-none`,style:{zIndex:0},"aria-hidden":`true`})}var P=8,F=[{value:`low`,label:`Low`,icon:g,description:`Quick and light -- fast responses, less thorough`,color:`text-info`},{value:`medium`,label:`Medium`,icon:u,description:`Balanced -- good mix of speed and quality`,color:`text-success`},{value:`high`,label:`High`,icon:w,description:`Thorough -- deeper analysis, takes more time`,color:`text-warning`},{value:`extra-high`,label:`Extra High`,icon:D,description:`Maximum depth -- most thorough, slowest`,color:`text-error`}],I={codex:F,claude:F.filter(e=>e.value!==`extra-high`)};function L(e,t){return I[t?.[e]||`claude`]||F}var R=[{label:`Technical`,domains:[{value:`frontend`,label:`Frontend`,emoji:`🎨`},{value:`backend`,label:`Backend`,emoji:`⚙️`},{value:`mobile`,label:`Mobile`,emoji:`📱`},{value:`devops`,label:`DevOps / Infra`,emoji:`🚀`},{value:`database`,label:`Database`,emoji:`🗄️`},{value:`ai-ml`,label:`AI / ML`,emoji:`🤖`},{value:`security`,label:`Security`,emoji:`🔒`},{value:`testing`,label:`Testing / QA`,emoji:`🧪`},{value:`embedded`,label:`Embedded / IoT`,emoji:`🔌`}]},{label:`Industry`,domains:[{value:`games`,label:`Games`,emoji:`🎮`},{value:`ecommerce`,label:`E-commerce`,emoji:`🛒`},{value:`saas`,label:`SaaS`,emoji:`☁️`},{value:`fintech`,label:`Fintech`,emoji:`💰`},{value:`healthcare`,label:`Healthcare`,emoji:`🏥`},{value:`education`,label:`Education`,emoji:`📚`},{value:`blockchain`,label:`Blockchain`,emoji:`⛓️`},{value:`spatial-computing`,label:`Spatial / XR`,emoji:`🥽`}]},{label:`Role`,domains:[{value:`design`,label:`Design / UX`,emoji:`✏️`},{value:`product`,label:`Product`,emoji:`📋`},{value:`marketing`,label:`Marketing`,emoji:`📢`},{value:`data-engineering`,label:`Data Engineering`,emoji:`📊`}]}],z=[{value:`auto`,label:`Auto`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`black`,label:`Black`},{value:`cupcake`,label:`Cupcake`},{value:`night`,label:`Night`},{value:`sunset`,label:`Sunset`}];async function B(e,t,n=`ui`){return a.post(`/settings/${encodeURIComponent(e)}`,{value:t,scope:n,source:`user`})}function V(e,t=`medium`){return F.some(t=>t.value===e)?e:t}function H(e){return!e||typeof e!=`object`||Array.isArray(e)?{planner:`medium`,executor:`medium`,reviewer:`medium`}:{planner:V(e.planner??e.default,`medium`),executor:V(e.executor??e.default,`medium`),reviewer:V(e.reviewer??e.default,`medium`)}}var U=[`Pipeline`,`Scan`,`Domains`,`Agents`,`Effort`,`Workers & Theme`,`Launch`];function te({current:e}){let t=e-1;return(0,N.jsx)(`ul`,{className:`steps steps-horizontal w-full max-w-2xl text-xs`,children:U.map((e,n)=>{let r=n<t,i=n===t;return(0,N.jsx)(`li`,{"data-content":r?`✓`:n+1,className:`step ${r||i?`step-primary`:``}`,style:{transition:`color 0.3s ease`},children:e},e)})})}function ne({direction:e,stepKey:t,center:n,children:r}){return(0,N.jsx)(`div`,{className:`${e===`forward`?`animate-slide-in-right`:`animate-slide-in-left`} w-full max-w-2xl mx-auto ${n?`my-auto`:``}`,children:r},t)}function re({workspacePath:e}){return(0,N.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,N.jsx)(`div`,{className:`text-6xl sm:text-7xl animate-bounce-in`,children:(0,N.jsx)(A,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,N.jsxs)(`h1`,{className:`text-3xl sm:text-4xl font-bold tracking-tight`,children:[`Welcome to `,(0,N.jsx)(`span`,{className:`text-primary`,children:`Fifony`})]}),(0,N.jsx)(`p`,{className:`text-base-content/60 text-lg max-w-md`,children:`Let's set up your AI orchestration workspace in just a few steps.`}),e&&(0,N.jsxs)(`div`,{className:`badge badge-lg badge-soft badge-primary gap-2`,children:[(0,N.jsx)(_,{className:`size-3.5`}),e]})]})}var W=[{role:`planner`,label:`Planner`,description:`Scopes the issue, breaks it into steps, and decides the approach`,icon:w,color:`text-info`},{role:`executor`,label:`Executor`,description:`Implements the plan — writes code, edits files, runs commands`,icon:g,color:`text-primary`},{role:`reviewer`,label:`Reviewer`,description:`Validates the result — checks correctness, scope, and quality`,icon:v,color:`text-secondary`}];function ie({providers:e,providersLoading:t,pipeline:n,setPipeline:r}){let i=Array.isArray(e)?e:[],a=i.filter(e=>e.available!==!1);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(j,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agent Pipeline`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which CLI runs each stage of the pipeline`})]}),t?(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8`,children:[(0,N.jsx)(h,{className:`size-8 text-primary animate-spin`}),(0,N.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Detecting available CLIs...`})]}):a.length===0?(0,N.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`No providers detected. Make sure claude or codex CLI is installed.`}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:i.map(e=>{let t=e.id||e.name||e,n=e.available!==!1;return(0,N.jsxs)(`span`,{className:`badge badge-lg gap-2 ${n?`badge-success`:`badge-ghost opacity-50`}`,children:[n?(0,N.jsx)(f,{className:`size-3.5`}):(0,N.jsx)(p,{className:`size-3.5`}),t,e.path&&(0,N.jsx)(`span`,{className:`font-mono text-[10px] opacity-60 hidden sm:inline`,children:e.path})]},t)})}),(0,N.jsx)(`div`,{className:`flex flex-col items-center gap-2`,children:W.map((e,t)=>{let i=e.icon,o=n[e.role]||a[0]?.name||``;return(0,N.jsxs)(`div`,{className:`w-full`,children:[t>0&&(0,N.jsx)(`div`,{className:`flex justify-center py-1`,children:(0,N.jsx)(E,{className:`size-5 rotate-90 opacity-30`})}),(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-4 flex-row items-center gap-4`,children:[(0,N.jsx)(`div`,{className:`size-10 rounded-full flex items-center justify-center bg-base-300 ${e.color}`,children:(0,N.jsx)(i,{className:`size-5`})}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsx)(`div`,{className:`font-semibold`,children:e.label}),(0,N.jsx)(`p`,{className:`text-xs text-base-content/50`,children:e.description})]}),(0,N.jsx)(`select`,{className:`select select-bordered select-sm w-32`,value:o,onChange:t=>r(n=>({...n,[e.role]:t.target.value})),children:a.map(e=>{let t=e.id||e.name||e;return(0,N.jsx)(`option`,{value:t,children:t},t)})})]})})]},e.role)})}),(0,N.jsx)(`p`,{className:`text-xs text-base-content/40 text-center max-w-md mx-auto`,children:`Each stage can use a different CLI. The pipeline flows top to bottom: plan, then execute, then review.`})]})]})}function ae({scanResult:e,setScanResult:t,projectDescription:n,setProjectDescription:r,analysisResult:i,setAnalysisResult:o,selectedProvider:s,analyzing:c,setAnalyzing:l}){let[u,m]=(0,M.useState)(!1),[g,v]=(0,M.useState)(null),[y,x]=(0,M.useState)(null),S=(0,M.useRef)(!1);(0,M.useEffect)(()=>{S.current||e||(S.current=!0,m(!0),v(null),a.get(`/scan/project`).then(e=>{if(t(e),!n){let t=e?.packageDescription||e?.packageInfo?.description||e?.readmeExcerpt||``;t&&r(t)}s&&!i&&(l(!0),a.post(`/scan/analyze`,{provider:s}).then(e=>{o(e),e.description&&r(e.description)}).catch(()=>{}).finally(()=>l(!1)))}).catch(e=>v(e.message||`Failed to scan project`)).finally(()=>m(!1)))},[]);let w=(0,M.useCallback)(async()=>{l(!0),x(null);try{let e=await a.post(`/scan/analyze`,{provider:s||`claude`});o(e),e.description&&r(e.description)}catch(e){x(e.message||`Analysis failed`)}finally{l(!1)}},[s,l,o,r]),T={claudeMd:`CLAUDE.md`,claudeDir:`.claude/`,codexDir:`.codex/`,readmeMd:`README.md`,packageJson:`package.json`,cargoToml:`Cargo.toml`,pyprojectToml:`pyproject.toml`,goMod:`go.mod`,buildGradle:`build.gradle`,gemfile:`Gemfile`,dockerfile:`Dockerfile`,workflowMd:`WORKFLOW.md`,agentsMd:`AGENTS.md`,claudeAgentsDir:`.claude/agents/`,claudeSkillsDir:`.claude/skills/`,codexAgentsDir:`.codex/agents/`,codexSkillsDir:`.codex/skills/`},E=e?.files||{},D=Object.entries(E).map(([e,t])=>({path:T[e]||e,exists:!!t})),k=(e?.existingAgents||[]).map(e=>typeof e==`string`?{name:e}:e),A=(e?.existingSkills||[]).map(e=>typeof e==`string`?{name:e}:e),j=i?.stack||[];return(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(O,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Scan Project`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`We'll analyze your workspace to suggest the best setup`})]}),u&&(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6`,children:[(0,N.jsx)(h,{className:`size-8 text-primary animate-spin`}),(0,N.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Scanning project files...`})]}),g&&(0,N.jsx)(`div`,{className:`alert alert-warning text-sm`,children:g}),e&&!u&&(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(d,{className:`size-4 opacity-50`}),`Project Files`]}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-1.5`,children:D.map(e=>(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[e.exists?(0,N.jsx)(f,{className:`size-4 text-success shrink-0`}):(0,N.jsx)(p,{className:`size-4 text-base-content/30 shrink-0`}),(0,N.jsx)(`span`,{className:`font-mono text-xs truncate ${e.exists?``:`text-base-content/40`}`,children:e.path})]},e.path))}),(k.length>0||A.length>0)&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k.length>0&&(0,N.jsxs)(`span`,{className:`badge badge-sm badge-info gap-1`,children:[(0,N.jsx)(b,{className:`size-3`}),k.length,` agent`,k.length===1?``:`s`,` found`]}),A.length>0&&(0,N.jsxs)(`span`,{className:`badge badge-sm badge-secondary gap-1`,children:[(0,N.jsx)(C,{className:`size-3`}),A.length,` skill`,A.length===1?``:`s`,` found`]})]})]})]})}),!c&&!i&&(0,N.jsxs)(`button`,{className:`btn btn-primary btn-lg gap-2 mx-auto`,onClick:w,disabled:u,children:[(0,N.jsx)(_,{className:`size-5`}),`Analyze with AI`]}),c&&(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-4`,children:[(0,N.jsx)(h,{className:`size-8 text-primary animate-spin`}),(0,N.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`AI is analyzing your project...`})]}),y&&(0,N.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`Analysis failed. You can describe your project manually below.`}),j.length>0&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:j.map(e=>(0,N.jsx)(`span`,{className:`badge badge-sm badge-soft badge-primary`,children:e},e))}),(e||i||y)&&!u&&!c&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`label text-sm font-medium`,children:`Project Description`}),(0,N.jsx)(`textarea`,{className:`textarea textarea-bordered w-full h-24 text-sm`,placeholder:`Describe your project so we can suggest the right agents and domains...`,value:n,onChange:e=>r(e.target.value)})]})]})}function oe({selectedDomains:e,setSelectedDomains:t,analysisResult:n}){let r=(0,M.useRef)(!1);(0,M.useEffect)(()=>{r.current||!n?.domains?.length||e.length>0||(r.current=!0,t(n.domains))},[n]);let i=(0,M.useCallback)(e=>{t(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[t]);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(k,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Domains`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Select the domains relevant to your project`})]}),R.map(t=>(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wider text-base-content/40 mb-2`,children:t.label}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.domains.map(t=>(0,N.jsxs)(`button`,{className:`btn btn-sm gap-1.5 ${e.includes(t.value)?`btn-primary`:`btn-soft`}`,onClick:()=>i(t.value),children:[(0,N.jsx)(`span`,{children:t.emoji}),t.label]},t.value))})]},t.label))]})}function se({selectedDomains:e,selectedAgents:t,setSelectedAgents:n,selectedSkills:r,setSelectedSkills:i,existingAgents:o,existingSkills:c}){let[l,u]=(0,M.useState)([]),[d,f]=(0,M.useState)([]),[p,m]=(0,M.useState)(!1),g=(0,M.useRef)(!1);(0,M.useEffect)(()=>{if(g.current)return;g.current=!0,m(!0);let s=e.length>0?`?domains=${e.join(`,`)}`:``;Promise.all([a.get(`/catalog/agents${s}`).catch(()=>({agents:[]})),a.get(`/catalog/skills`).catch(()=>({skills:[]}))]).then(([e,a])=>{let s=e?.agents||[],l=a?.skills||[];u(s),f(l);let d=new Set((o||[]).map(e=>e.name)),p=s.filter(e=>!d.has(e.name)).map(e=>e.name);p.length>0&&t.length===0&&n(p);let m=new Set((c||[]).map(e=>e.name)),h=l.filter(e=>!m.has(e.name)).map(e=>e.name);h.length>0&&r.length===0&&i(h)}).finally(()=>m(!1))},[]);let _=new Set((o||[]).map(e=>e.name)),v=new Set((c||[]).map(e=>e.name)),y=(0,M.useCallback)(e=>{n(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[n]),x=(0,M.useCallback)(e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[i]),S=(0,M.useCallback)(()=>{n(l.filter(e=>!_.has(e.name)).map(e=>e.name))},[l,_,n]),w=(0,M.useCallback)(()=>n([]),[n]),T=(0,M.useCallback)(()=>{i(d.filter(e=>!v.has(e.name)).map(e=>e.name))},[d,v,i]),E=(0,M.useCallback)(()=>i([]),[i]);return p?(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12`,children:[(0,N.jsx)(h,{className:`size-8 text-primary animate-spin`}),(0,N.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Loading catalog...`})]}):(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(b,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agents & Skills`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which agents and skills to install`})]}),l.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(b,{className:`size-4 opacity-50`}),`Agents (`,l.length,`)`]}),(0,N.jsxs)(`div`,{className:`flex gap-1`,children:[(0,N.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:S,children:`Select All`}),(0,N.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:w,children:`None`})]})]}),(0,N.jsx)(`div`,{className:`grid gap-2`,children:l.map(e=>{let n=_.has(e.name),r=n||t.includes(e.name);return(0,N.jsx)(`button`,{className:`card bg-base-200 cursor-pointer transition-all text-left ${r?`ring-2 ring-primary ring-offset-1 ring-offset-base-100`:``} ${n?`opacity-60`:``}`,onClick:()=>!n&&y(e.name),disabled:n,children:(0,N.jsxs)(`div`,{className:`card-body p-3 flex-row items-center gap-3`,children:[(0,N.jsx)(`div`,{className:`text-xl shrink-0`,children:e.emoji||`🤖`}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.displayName||e.name}),e.description&&(0,N.jsx)(`p`,{className:`text-xs text-base-content/50 truncate`,children:e.description})]}),n?(0,N.jsxs)(`span`,{className:`badge badge-sm badge-success gap-1`,children:[(0,N.jsx)(s,{className:`size-3`}),` Installed`]}):(0,N.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm`,checked:r,readOnly:!0,tabIndex:-1})]})},e.name)})})]}),d.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(C,{className:`size-4 opacity-50`}),`Skills (`,d.length,`)`]}),(0,N.jsxs)(`div`,{className:`flex gap-1`,children:[(0,N.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:T,children:`Select All`}),(0,N.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:E,children:`None`})]})]}),(0,N.jsx)(`div`,{className:`grid gap-2`,children:d.map(e=>{let t=v.has(e.name),n=t||r.includes(e.name);return(0,N.jsx)(`button`,{className:`card bg-base-200 cursor-pointer transition-all text-left ${n?`ring-2 ring-primary ring-offset-1 ring-offset-base-100`:``} ${t?`opacity-60`:``}`,onClick:()=>!t&&x(e.name),disabled:t,children:(0,N.jsxs)(`div`,{className:`card-body p-3 flex-row items-center gap-3`,children:[(0,N.jsx)(`div`,{className:`text-xl shrink-0`,children:e.emoji||`🧩`}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.displayName||e.name}),e.description&&(0,N.jsx)(`p`,{className:`text-xs text-base-content/50 truncate`,children:e.description})]}),t?(0,N.jsxs)(`span`,{className:`badge badge-sm badge-success gap-1`,children:[(0,N.jsx)(s,{className:`size-3`}),` Installed`]}):(0,N.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm`,checked:n,readOnly:!0,tabIndex:-1})]})},e.name)})})]}),l.length===0&&d.length===0&&(0,N.jsx)(`div`,{className:`alert alert-info text-sm`,children:`No agents or skills found in the catalog. You can add them later from the settings page.`})]})}function G({role:e,title:t,description:n,providerName:r,value:i,onChange:a,options:o}){return(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h3`,{className:`font-semibold`,children:t}),(0,N.jsx)(`p`,{className:`text-xs text-base-content/60 mt-1`,children:n})]}),r&&(0,N.jsx)(`span`,{className:`badge badge-sm badge-soft badge-primary capitalize`,children:r})]}),(0,N.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:o.map(t=>{let n=t.icon,r=i===t.value;return(0,N.jsx)(`button`,{className:`card card-interactive bg-base-100 cursor-pointer transition-all text-left ${r?`ring-2 ring-primary ring-offset-2 ring-offset-base-200`:``}`,onClick:()=>a(t.value),children:(0,N.jsxs)(`div`,{className:`card-body p-4 gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(n,{className:`size-5 ${t.color}`}),(0,N.jsx)(`span`,{className:`font-semibold`,children:t.label}),r&&(0,N.jsx)(s,{className:`size-4 text-primary ml-auto`})]}),(0,N.jsx)(`p`,{className:`text-xs text-base-content/60`,children:t.description})]})},`${e}-${t.value}`)})})]})})}function ce({efforts:e,setEfforts:t,pipeline:n}){return(0,M.useEffect)(()=>{for(let r of[`planner`,`executor`,`reviewer`]){let i=L(r,n),a=e[r];a&&!i.some(e=>e.value===a)&&t(e=>({...e,[r]:`high`}))}},[n,e,t]),(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{className:`text-center`,children:[(0,N.jsx)(u,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Reasoning Effort By Stage`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose the depth for each pipeline stage. Options depend on the CLI selected.`})]}),(0,N.jsx)(G,{role:`planner`,title:`Planning`,description:`Scopes the issue and decides the overall approach.`,providerName:n?.planner,value:e.planner,onChange:e=>t(t=>({...t,planner:e})),options:L(`planner`,n)}),(0,N.jsx)(G,{role:`executor`,title:`Execution`,description:`Implements the plan — writes code, edits files.`,providerName:n?.executor,value:e.executor,onChange:e=>t(t=>({...t,executor:e})),options:L(`executor`,n)}),(0,N.jsx)(G,{role:`reviewer`,title:`Review`,description:`Validates the result before approving.`,providerName:n?.reviewer,value:e.reviewer,onChange:e=>t(t=>({...t,reviewer:e})),options:L(`reviewer`,n)})]})}function le({concurrency:e,setConcurrency:t,selectedTheme:n,setSelectedTheme:r}){return(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,N.jsx)(m,{className:`size-10 text-primary mx-auto mb-3`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Workers & Theme`}),(0,N.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Configure parallel workers and visual theme`})]}),(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(m,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,N.jsxs)(`p`,{className:`text-xs text-base-content/60`,children:[`How many agents can work in parallel (`,e,` worker`,e===1?``:`s`,`)`]}),(0,N.jsx)(`input`,{type:`range`,min:1,max:16,value:e,onChange:e=>t(Number(e.target.value)),className:`range range-primary range-sm`}),(0,N.jsxs)(`div`,{className:`flex justify-between text-xs text-base-content/40 px-1`,children:[(0,N.jsx)(`span`,{children:`1`}),(0,N.jsx)(`span`,{children:`4`}),(0,N.jsx)(`span`,{children:`8`}),(0,N.jsx)(`span`,{children:`12`}),(0,N.jsx)(`span`,{children:`16`})]})]})})]}),(0,N.jsx)(`div`,{className:`card bg-base-200`,children:(0,N.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,N.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,N.jsx)(l,{className:`size-4 opacity-50`}),`Theme`]}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map(e=>(0,N.jsx)(`button`,{className:`btn btn-sm ${n===e.value?`btn-primary`:`btn-soft`}`,onClick:()=>r(e.value),children:e.label},e.value))})]})})]})}function ue({config:e,launching:t}){return(0,N.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,N.jsx)(`div`,{className:`animate-bounce-in`,children:(0,N.jsx)(j,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,N.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold`,children:`You're All Set!`}),(0,N.jsx)(`p`,{className:`text-base-content/60 max-w-md`,children:`Here's a summary of your configuration. Hit launch when you're ready.`}),(0,N.jsx)(`div`,{className:`card bg-base-200 w-full max-w-sm`,children:(0,N.jsxs)(`div`,{className:`card-body p-4 gap-2 text-sm text-left`,children:[(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Pipeline`}),(0,N.jsxs)(`span`,{className:`font-semibold capitalize text-xs font-mono`,children:[e.pipeline?.planner||`?`,` → `,e.pipeline?.executor||`?`,` → `,e.pipeline?.reviewer||`?`]})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Domains`}),(0,N.jsx)(`span`,{className:`font-semibold`,children:e.domains?.length>0?e.domains.length+` selected`:`none`})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Agents`}),(0,N.jsxs)(`span`,{className:`font-semibold`,children:[e.agents?.length||0,` to install`]})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Skills`}),(0,N.jsxs)(`span`,{className:`font-semibold`,children:[e.skills?.length||0,` to install`]})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Plan`}),(0,N.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.planner})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Execute`}),(0,N.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.executor})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Review`}),(0,N.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.reviewer})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Workers`}),(0,N.jsx)(`span`,{className:`font-semibold`,children:e.concurrency})]}),(0,N.jsx)(`div`,{className:`divider my-0`}),(0,N.jsxs)(`div`,{className:`flex justify-between`,children:[(0,N.jsx)(`span`,{className:`text-base-content/60`,children:`Theme`}),(0,N.jsx)(`span`,{className:`font-semibold capitalize`,children:e.theme})]})]})}),t&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-base-content/50`,children:[(0,N.jsx)(h,{className:`size-4 animate-spin`}),`Saving configuration & installing agents...`]})]})}function K({onComplete:e}){let t=r(),n=x(),i=o(n.data),[s,l]=(0,M.useState)(0),[u,d]=(0,M.useState)(`forward`),[f,p]=(0,M.useState)(!1),[m,g]=(0,M.useState)(null),_=(0,M.useRef)(!1),[v,b]=(0,M.useState)(``),[C,w]=(0,M.useState)({planner:``,executor:``,reviewer:``}),[D,O]=(0,M.useState)(()=>H(null)),[k,A]=(0,M.useState)(2),[F,I]=(0,M.useState)(`auto`),[L,R]=(0,M.useState)(null),[z,V]=(0,M.useState)(null),[U,W]=(0,M.useState)(``),[G,K]=(0,M.useState)([]),[q,de]=(0,M.useState)([]),[J,fe]=(0,M.useState)([]),[pe,me]=(0,M.useState)(!1),[Y,X]=(0,M.useState)(null),[Z,Q]=(0,M.useState)(!1),[he,ge]=(0,M.useState)(``);(0,M.useEffect)(()=>{a.get(`/state`).then(e=>{ge(e?.sourceRepoUrl||e?.config?.sourceRepo||``)}).catch(()=>{})},[]),(0,M.useEffect)(()=>{if(_.current||n.isLoading)return;_.current=!0;let e=S(i,`runtime.agentProvider`,``),t=S(i,`runtime.defaultEffort`,null),r=S(i,`ui.theme`,`auto`),a=S(i,`runtime.workerConcurrency`,2);typeof e==`string`&&e.trim()&&b(e),O(H(t)),typeof r==`string`&&r.trim()&&I(r);let o=Number.parseInt(String(a??2),10);Number.isFinite(o)&&A(Math.min(16,Math.max(1,o)))},[i,n.isLoading]),(0,M.useEffect)(()=>{s===1&&Y===null&&(Q(!0),a.get(`/providers`).then(e=>{let t=Array.isArray(e)?e:e?.providers||[];X(t);let n=t.filter(e=>e.available!==!1),r=n[0]?.id||n[0]?.name||``;r&&!v&&b(r);let i=n.find(e=>(e.id||e.name)===`claude`),a=r,o=i?`claude`:a;w(e=>({planner:e.planner||o,executor:e.executor||a,reviewer:e.reviewer||o}))}).catch(()=>{X([])}).finally(()=>{Q(!1)}))},[s]),(0,M.useEffect)(()=>{let e=F===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:F;document.documentElement.setAttribute(`data-theme`,e)},[F]),(0,M.useEffect)(()=>{C.executor&&C.executor!==v&&b(C.executor)},[C.executor]);let $=(0,M.useCallback)(e=>{if(e===1){let e=[{provider:C.planner,role:`planner`},{provider:C.executor,role:`executor`},{provider:C.reviewer,role:`reviewer`}];B(`runtime.agentProvider`,C.executor,`runtime`).catch(()=>{}),B(`runtime.pipeline`,e,`runtime`).catch(()=>{})}else e===5?B(`runtime.defaultEffort`,D,`runtime`).catch(()=>{}):e===6&&(B(`ui.theme`,F,`ui`).catch(()=>{}),a.post(`/config/concurrency`,{concurrency:k}).catch(()=>{}))},[C,D,k,F]),_e=(0,M.useCallback)(()=>{s<P-1&&($(s),d(`forward`),l(e=>e+1))},[s,$]),ve=(0,M.useCallback)(()=>{s>0&&(d(`backward`),l(e=>e-1))},[s]),ye=(0,M.useCallback)(async()=>{p(!0);try{let n=[B(`ui.theme`,F,`ui`),B(`ui.onboarding.completed`,!0,`ui`)],r=[{provider:C.planner,role:`planner`},{provider:C.executor,role:`executor`},{provider:C.reviewer,role:`reviewer`}];n.push(B(`runtime.agentProvider`,C.executor,`runtime`)),n.push(B(`runtime.pipeline`,r,`runtime`)),n.push(B(`runtime.defaultEffort`,D,`runtime`)),n.push(a.post(`/config/concurrency`,{concurrency:k})),q.length>0&&n.push(a.post(`/install/agents`,{agents:q})),J.length>0&&n.push(a.post(`/install/skills`,{skills:J})),await Promise.allSettled(n),g({x:window.innerWidth/2,y:window.innerHeight/3}),setTimeout(()=>{t.invalidateQueries({queryKey:c}),e?.()},1200)}catch{await B(`ui.onboarding.completed`,!0,`ui`).catch(()=>{}),t.invalidateQueries({queryKey:c}),e?.()}},[v,D,k,F,q,J,t,e]),be=s===0||s===1&&(C.executor||Z)||s===2||s===3||s===4||s===5||s===6||s===7,xe=(L?.existingAgents||[]).map(e=>typeof e==`string`?{name:e}:e),Se=(L?.existingSkills||[]).map(e=>typeof e==`string`?{name:e}:e),Ce={pipeline:C,efforts:D,concurrency:k,theme:F,domains:G,agents:q,skills:J};return(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-base-100 flex flex-col overflow-hidden`,children:[(0,N.jsx)(ee,{}),m&&(0,N.jsx)(y,{x:m.x,y:m.y,active:!0,onDone:()=>g(null)}),s>0&&(0,N.jsx)(`div`,{className:`relative z-10 pt-6 pb-2 px-4 flex justify-center`,children:(0,N.jsx)(te,{current:s})}),(0,N.jsx)(`div`,{className:`relative z-10 flex-1 flex flex-col items-center justify-start px-4 py-6 overflow-y-auto`,children:(0,N.jsxs)(ne,{direction:u,stepKey:s,center:s===0||s===1||s===7,children:[s===0&&(0,N.jsx)(re,{workspacePath:he}),s===1&&(0,N.jsx)(ie,{providers:Y||[],providersLoading:Z,pipeline:C,setPipeline:w}),s===2&&(0,N.jsx)(ae,{scanResult:L,setScanResult:R,projectDescription:U,setProjectDescription:W,analysisResult:z,setAnalysisResult:V,selectedProvider:v,analyzing:pe,setAnalyzing:me}),s===3&&(0,N.jsx)(oe,{selectedDomains:G,setSelectedDomains:K,analysisResult:z}),s===4&&(0,N.jsx)(se,{selectedDomains:G,selectedAgents:q,setSelectedAgents:de,selectedSkills:J,setSelectedSkills:fe,existingAgents:xe,existingSkills:Se}),s===5&&(0,N.jsx)(ce,{efforts:D,setEfforts:O,pipeline:C}),s===6&&(0,N.jsx)(le,{concurrency:k,setConcurrency:A,selectedTheme:F,setSelectedTheme:I}),s===7&&(0,N.jsx)(ue,{config:Ce,launching:f})]})}),(0,N.jsxs)(`div`,{className:`relative z-10 p-4 pb-6 flex justify-between items-center max-w-2xl mx-auto w-full`,children:[s>0?(0,N.jsxs)(`button`,{className:`btn btn-ghost gap-1`,onClick:ve,disabled:f,children:[(0,N.jsx)(T,{className:`size-4`}),` Back`]}):(0,N.jsx)(`div`,{}),s<P-1?(0,N.jsxs)(`button`,{className:`btn btn-primary gap-1`,onClick:_e,disabled:!be,children:[s===0?`Get Started`:`Next`,` `,(0,N.jsx)(E,{className:`size-4`})]}):(0,N.jsx)(`button`,{className:`btn btn-primary btn-lg gap-2 animate-pulse-soft`,onClick:ye,disabled:f,children:f?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(h,{className:`size-5 animate-spin`}),` Launching...`]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(j,{className:`size-5`}),` Launch Fifony`]})})]})]})}export{K as default};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,a as n,h as r}from"./vendor-BoGBoEwT.js";import{C as i,T as a,a as o,m as s,n as c,p as l,u,y as d}from"./index-CFbxnygd.js";var f=e(t(),1),p=r();function m(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function h(e){return!e||e===0?`0`:e.toLocaleString()}function g({value:e,format:t=m,className:n=``}){let[r,i]=(0,f.useState)(()=>t(e)),a=(0,f.useRef)(e),o=(0,f.useRef)(null);return(0,f.useEffect)(()=>{let n=a.current||0,r=e||0;if(a.current=r,n===r){i(t(r));return}let s=performance.now(),c=e=>{let a=e-s,l=Math.min(a/600,1),u=1-(1-l)**3,d=n+(r-n)*u;i(t(Math.round(d))),l<1&&(o.current=requestAnimationFrame(c))};return cancelAnimationFrame(o.current),o.current=requestAnimationFrame(c),()=>cancelAnimationFrame(o.current)},[e,t]),(0,p.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}var _=[{key:`planner`,label:`Plan`,color:`bg-info`,textColor:`text-info`},{key:`executor`,label:`Execute`,color:`bg-primary`,textColor:`text-primary`},{key:`reviewer`,label:`Review`,color:`bg-secondary`,textColor:`text-secondary`}];function v({byPhase:e}){if(!e)return null;let t=_.reduce((t,n)=>t+(e[n.key]?.totalTokens||0),0);return t===0?null:(0,p.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,p.jsx)(`div`,{className:`flex h-4 rounded-full overflow-hidden bg-base-300 w-full`,children:_.map(n=>{let r=e[n.key]?.totalTokens||0,i=r/t*100;return i===0?null:(0,p.jsx)(`div`,{className:`${n.color} opacity-80 transition-all duration-500`,style:{width:`${i}%`},title:`${n.label}: ${h(r)} (${Math.round(i)}%)`},n.key)})}),(0,p.jsx)(`div`,{className:`flex items-center gap-4 flex-wrap`,children:_.map(n=>{let r=e[n.key]?.totalTokens||0,i=t>0?Math.round(r/t*100):0;return r===0?null:(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,p.jsx)(`span`,{className:`inline-block w-3 h-3 rounded-full ${n.color} shrink-0`}),(0,p.jsx)(`span`,{className:`opacity-60`,children:n.label}),(0,p.jsx)(`span`,{className:`font-mono font-semibold`,children:m(r)}),(0,p.jsxs)(`span`,{className:`opacity-40`,children:[`(`,i,`%)`]})]},n.key)})})]})}function y({data:e,height:t=160}){if(!e||e.length===0)return null;let n=Math.max(...e.map(e=>e.totalTokens||0),1);return(0,p.jsx)(`div`,{className:`flex items-end gap-2 w-full`,style:{height:t},children:e.map((e,r)=>{let i=e.totalTokens||0,a=Math.max(2,Math.round(i/n*t)),o=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`}):`Day ${r+1}`,s=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`}):`${r+1}`;return(0,p.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1.5 group`,children:[(0,p.jsx)(`span`,{className:`text-[10px] font-mono opacity-0 group-hover:opacity-70 transition-opacity`,children:m(i)}),(0,p.jsx)(`div`,{className:`w-full bg-primary rounded-t-md opacity-70 hover:opacity-100 transition-all duration-300 cursor-default`,style:{height:a},title:`${o}: ${h(i)} tokens`}),(0,p.jsx)(`span`,{className:`text-[10px] opacity-50`,children:s})]},e.date||r)})})}function b({data:e,valueKey:t=`totalTokens`,height:n=60,color:r=`stroke-primary`,label:i}){if(!e||e.length===0)return null;let a=e.map(e=>e[t]||e.count||0),o=Math.max(...a,1),s=a.map((e,t)=>`${t/Math.max(a.length-1,1)*200},${n-e/o*(n-4)-2}`).join(` `),c=a.reduce((e,t)=>e+t,0),l=a.length>0?Math.round(c/a.length):0,u=Math.max(...a);return(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 flex-1 min-w-0`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-xs font-medium opacity-60`,children:i}),(0,p.jsxs)(`span`,{className:`flex items-center gap-3 text-[10px] opacity-50`,children:[(0,p.jsxs)(`span`,{children:[`avg: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[m(l),`/h`]})]}),(0,p.jsxs)(`span`,{children:[`peak: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[m(u),`/h`]})]})]})]}),(0,p.jsxs)(`svg`,{viewBox:`0 0 200 ${n}`,className:`w-full`,style:{height:n},preserveAspectRatio:`none`,children:[(0,p.jsx)(`polyline`,{points:`0,${n} ${s} 200,${n}`,fill:`currentColor`,className:r.replace(`stroke-`,`text-`),opacity:`0.08`}),(0,p.jsx)(`polyline`,{points:s,fill:`none`,className:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`})]})]})}function x({byModel:e}){if(!e)return null;let t=Object.entries(e).map(([e,t])=>({model:e,inputTokens:t?.inputTokens||0,outputTokens:t?.outputTokens||0,totalTokens:t?.totalTokens||0})).sort((e,t)=>t.totalTokens-e.totalTokens);if(t.length===0)return null;let n=t.reduce((e,t)=>e+t.totalTokens,0);return(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`table table-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{children:`Model`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Input`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Output`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Total`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Share`})]})}),(0,p.jsx)(`tbody`,{children:t.map(e=>{let t=n>0?Math.round(e.totalTokens/n*100):0,r=e.model.includes(`claude`)?`bg-primary`:e.model.includes(`codex`)?`bg-secondary`:`bg-accent`;return(0,p.jsxs)(`tr`,{children:[(0,p.jsxs)(`td`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full ${r} shrink-0`}),(0,p.jsx)(`span`,{className:`font-mono text-xs`,children:e.model})]}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs`,children:m(e.inputTokens)}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs`,children:m(e.outputTokens)}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:m(e.totalTokens)}),(0,p.jsx)(`td`,{className:`text-right`,children:(0,p.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,p.jsx)(`div`,{className:`w-12 h-1.5 bg-base-300 rounded-full overflow-hidden`,children:(0,p.jsx)(`div`,{className:`h-full ${r} rounded-full`,style:{width:`${t}%`}})}),(0,p.jsxs)(`span`,{className:`text-xs opacity-60 w-8 text-right`,children:[t,`%`]})]})})]},e.model)})})]})})}function S({topIssues:e}){return!e||e.length===0?null:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`table table-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`w-20`,children:`Issue`}),(0,p.jsx)(`th`,{children:`Title`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Tokens`}),(0,p.jsx)(`th`,{className:`hidden sm:table-cell`,children:`Phase Split`})]})}),(0,p.jsx)(`tbody`,{children:e.slice(0,10).map(e=>{let t=e.byPhase,n=e.totalTokens||0;return(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`td`,{className:`font-mono text-xs font-semibold text-primary`,children:e.identifier}),(0,p.jsx)(`td`,{className:`max-w-[200px] truncate text-sm`,title:e.title,children:e.title||`-`}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:m(n)}),(0,p.jsx)(`td`,{className:`hidden sm:table-cell`,children:t?(0,p.jsx)(`div`,{className:`flex h-1.5 rounded-full overflow-hidden bg-base-300 w-24`,children:_.map(e=>{let r=t[e.key]?.totalTokens||0,i=n>0?r/n*100:0;return i===0?null:(0,p.jsx)(`div`,{className:`${e.color} opacity-80`,style:{width:`${i}%`},title:`${e.label}: ${m(r)}`},e.key)})}):(0,p.jsx)(`span`,{className:`opacity-30 text-xs`,children:`-`})})]},e.id||e.identifier)})})]})})}function C(){return(0,p.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,p.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6`,children:[(0,p.jsx)(`div`,{className:`skeleton-line h-8 w-48`}),(0,p.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:[...[,,,]].map((e,t)=>(0,p.jsx)(`div`,{className:`skeleton-card h-28`,style:{animationDelay:`${t*80}ms`}},t))}),(0,p.jsx)(`div`,{className:`skeleton-card h-52`}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,p.jsx)(`div`,{className:`skeleton-card h-32`}),(0,p.jsx)(`div`,{className:`skeleton-card h-32`})]}),(0,p.jsx)(`div`,{className:`skeleton-card h-64`})]})})}function w(){return(0,p.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-4 px-4 pb-20 animate-fade-in`,children:[(0,p.jsx)(o,{className:`size-16 opacity-15`}),(0,p.jsx)(`h2`,{className:`text-lg font-semibold opacity-60`,children:`No analytics data yet`}),(0,p.jsx)(`p`,{className:`text-sm opacity-40 text-center max-w-md`,children:`Token usage and pipeline metrics will appear here once issues start processing.`})]})}var T=n(`/analytics`)({component:E});function E(){let{data:e,isLoading:t}=a(),{data:n,isLoading:r}=i(24);if(t&&!e)return(0,p.jsx)(C,{});let f=e?.overall?.totalTokens||0,_=e?.byPhase||null,T=e?.byModel||{},E=e?.daily||[],D=e?.topIssues||[],O=n?.tokensPerHour||[],k=n?.eventsPerHour||[],A=new Date().toISOString().slice(0,10),j=E.find(e=>e.date===A)?.totalTokens||0,M=E.reduce((e,t)=>e+(t.totalTokens||0),0);return f===0&&E.length===0&&D.length===0?(0,p.jsx)(w,{}):(0,p.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3 overflow-y-auto`,children:(0,p.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6 stagger-children`,children:[(0,p.jsx)(`section`,{children:(0,p.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:[(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-primary`,children:(0,p.jsx)(c,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Total Tokens`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,p.jsx)(g,{value:f})}),(0,p.jsx)(`div`,{className:`stat-desc font-mono`,children:h(f)})]}),(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-accent`,children:(0,p.jsx)(s,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Today`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,p.jsx)(g,{value:j})}),(0,p.jsxs)(`div`,{className:`stat-desc`,children:[`This week: `,m(M)]})]}),(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-info`,children:(0,p.jsx)(u,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Phase Split`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl p-0`,children:_?(0,p.jsx)(v,{byPhase:_}):(0,p.jsx)(`span`,{className:`opacity-30`,children:`-`})})]})]})}),E.length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,p.jsx)(o,{className:`size-4 text-primary`}),`Daily Token Usage`]}),(0,p.jsxs)(`span`,{className:`text-xs opacity-40`,children:[`Last `,E.length,` days`]})]}),(0,p.jsx)(y,{data:E,height:160})]}),(O.length>0||k.length>0)&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(d,{className:`size-4 text-secondary`}),`Hourly Activity (last 24h)`]}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[O.length>0&&(0,p.jsx)(b,{data:O,valueKey:`totalTokens`,height:60,color:`stroke-primary`,label:`Tokens / hour`}),k.length>0&&(0,p.jsx)(b,{data:k,valueKey:`count`,height:60,color:`stroke-secondary`,label:`Events / hour`})]})]}),D.length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(c,{className:`size-4 text-accent`}),`Top Issues by Token Usage`]}),(0,p.jsx)(S,{topIssues:D})]}),Object.keys(T).length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(l,{className:`size-4 text-info`}),`Model Breakdown`]}),(0,p.jsx)(x,{byModel:T})]})]})})}export{T as Route};
1
+ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,a as n,h as r}from"./vendor-BoGBoEwT.js";import{C as i,T as a,a as o,m as s,n as c,p as l,u,y as d}from"./index-BVJ46xCh.js";var f=e(t(),1),p=r();function m(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function h(e){return!e||e===0?`0`:e.toLocaleString()}function g({value:e,format:t=m,className:n=``}){let[r,i]=(0,f.useState)(()=>t(e)),a=(0,f.useRef)(e),o=(0,f.useRef)(null);return(0,f.useEffect)(()=>{let n=a.current||0,r=e||0;if(a.current=r,n===r){i(t(r));return}let s=performance.now(),c=e=>{let a=e-s,l=Math.min(a/600,1),u=1-(1-l)**3,d=n+(r-n)*u;i(t(Math.round(d))),l<1&&(o.current=requestAnimationFrame(c))};return cancelAnimationFrame(o.current),o.current=requestAnimationFrame(c),()=>cancelAnimationFrame(o.current)},[e,t]),(0,p.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}var _=[{key:`planner`,label:`Plan`,color:`bg-info`,textColor:`text-info`},{key:`executor`,label:`Execute`,color:`bg-primary`,textColor:`text-primary`},{key:`reviewer`,label:`Review`,color:`bg-secondary`,textColor:`text-secondary`}];function v({byPhase:e}){if(!e)return null;let t=_.reduce((t,n)=>t+(e[n.key]?.totalTokens||0),0);return t===0?null:(0,p.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,p.jsx)(`div`,{className:`flex h-4 rounded-full overflow-hidden bg-base-300 w-full`,children:_.map(n=>{let r=e[n.key]?.totalTokens||0,i=r/t*100;return i===0?null:(0,p.jsx)(`div`,{className:`${n.color} opacity-80 transition-all duration-500`,style:{width:`${i}%`},title:`${n.label}: ${h(r)} (${Math.round(i)}%)`},n.key)})}),(0,p.jsx)(`div`,{className:`flex items-center gap-4 flex-wrap`,children:_.map(n=>{let r=e[n.key]?.totalTokens||0,i=t>0?Math.round(r/t*100):0;return r===0?null:(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,p.jsx)(`span`,{className:`inline-block w-3 h-3 rounded-full ${n.color} shrink-0`}),(0,p.jsx)(`span`,{className:`opacity-60`,children:n.label}),(0,p.jsx)(`span`,{className:`font-mono font-semibold`,children:m(r)}),(0,p.jsxs)(`span`,{className:`opacity-40`,children:[`(`,i,`%)`]})]},n.key)})})]})}function y({data:e,height:t=160}){if(!e||e.length===0)return null;let n=Math.max(...e.map(e=>e.totalTokens||0),1);return(0,p.jsx)(`div`,{className:`flex items-end gap-2 w-full`,style:{height:t},children:e.map((e,r)=>{let i=e.totalTokens||0,a=Math.max(2,Math.round(i/n*t)),o=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`}):`Day ${r+1}`,s=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`}):`${r+1}`;return(0,p.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1.5 group`,children:[(0,p.jsx)(`span`,{className:`text-[10px] font-mono opacity-0 group-hover:opacity-70 transition-opacity`,children:m(i)}),(0,p.jsx)(`div`,{className:`w-full bg-primary rounded-t-md opacity-70 hover:opacity-100 transition-all duration-300 cursor-default`,style:{height:a},title:`${o}: ${h(i)} tokens`}),(0,p.jsx)(`span`,{className:`text-[10px] opacity-50`,children:s})]},e.date||r)})})}function b({data:e,valueKey:t=`totalTokens`,height:n=60,color:r=`stroke-primary`,label:i}){if(!e||e.length===0)return null;let a=e.map(e=>e[t]||e.count||0),o=Math.max(...a,1),s=a.map((e,t)=>`${t/Math.max(a.length-1,1)*200},${n-e/o*(n-4)-2}`).join(` `),c=a.reduce((e,t)=>e+t,0),l=a.length>0?Math.round(c/a.length):0,u=Math.max(...a);return(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 flex-1 min-w-0`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-xs font-medium opacity-60`,children:i}),(0,p.jsxs)(`span`,{className:`flex items-center gap-3 text-[10px] opacity-50`,children:[(0,p.jsxs)(`span`,{children:[`avg: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[m(l),`/h`]})]}),(0,p.jsxs)(`span`,{children:[`peak: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[m(u),`/h`]})]})]})]}),(0,p.jsxs)(`svg`,{viewBox:`0 0 200 ${n}`,className:`w-full`,style:{height:n},preserveAspectRatio:`none`,children:[(0,p.jsx)(`polyline`,{points:`0,${n} ${s} 200,${n}`,fill:`currentColor`,className:r.replace(`stroke-`,`text-`),opacity:`0.08`}),(0,p.jsx)(`polyline`,{points:s,fill:`none`,className:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`})]})]})}function x({byModel:e}){if(!e)return null;let t=Object.entries(e).map(([e,t])=>({model:e,inputTokens:t?.inputTokens||0,outputTokens:t?.outputTokens||0,totalTokens:t?.totalTokens||0})).sort((e,t)=>t.totalTokens-e.totalTokens);if(t.length===0)return null;let n=t.reduce((e,t)=>e+t.totalTokens,0);return(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`table table-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{children:`Model`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Input`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Output`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Total`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Share`})]})}),(0,p.jsx)(`tbody`,{children:t.map(e=>{let t=n>0?Math.round(e.totalTokens/n*100):0,r=e.model.includes(`claude`)?`bg-primary`:e.model.includes(`codex`)?`bg-secondary`:`bg-accent`;return(0,p.jsxs)(`tr`,{children:[(0,p.jsxs)(`td`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full ${r} shrink-0`}),(0,p.jsx)(`span`,{className:`font-mono text-xs`,children:e.model})]}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs`,children:m(e.inputTokens)}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs`,children:m(e.outputTokens)}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:m(e.totalTokens)}),(0,p.jsx)(`td`,{className:`text-right`,children:(0,p.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,p.jsx)(`div`,{className:`w-12 h-1.5 bg-base-300 rounded-full overflow-hidden`,children:(0,p.jsx)(`div`,{className:`h-full ${r} rounded-full`,style:{width:`${t}%`}})}),(0,p.jsxs)(`span`,{className:`text-xs opacity-60 w-8 text-right`,children:[t,`%`]})]})})]},e.model)})})]})})}function S({topIssues:e}){return!e||e.length===0?null:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`table table-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`w-20`,children:`Issue`}),(0,p.jsx)(`th`,{children:`Title`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Tokens`}),(0,p.jsx)(`th`,{className:`hidden sm:table-cell`,children:`Phase Split`})]})}),(0,p.jsx)(`tbody`,{children:e.slice(0,10).map(e=>{let t=e.byPhase,n=e.totalTokens||0;return(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`td`,{className:`font-mono text-xs font-semibold text-primary`,children:e.identifier}),(0,p.jsx)(`td`,{className:`max-w-[200px] truncate text-sm`,title:e.title,children:e.title||`-`}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:m(n)}),(0,p.jsx)(`td`,{className:`hidden sm:table-cell`,children:t?(0,p.jsx)(`div`,{className:`flex h-1.5 rounded-full overflow-hidden bg-base-300 w-24`,children:_.map(e=>{let r=t[e.key]?.totalTokens||0,i=n>0?r/n*100:0;return i===0?null:(0,p.jsx)(`div`,{className:`${e.color} opacity-80`,style:{width:`${i}%`},title:`${e.label}: ${m(r)}`},e.key)})}):(0,p.jsx)(`span`,{className:`opacity-30 text-xs`,children:`-`})})]},e.id||e.identifier)})})]})})}function C(){return(0,p.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,p.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6`,children:[(0,p.jsx)(`div`,{className:`skeleton-line h-8 w-48`}),(0,p.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:[...[,,,]].map((e,t)=>(0,p.jsx)(`div`,{className:`skeleton-card h-28`,style:{animationDelay:`${t*80}ms`}},t))}),(0,p.jsx)(`div`,{className:`skeleton-card h-52`}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,p.jsx)(`div`,{className:`skeleton-card h-32`}),(0,p.jsx)(`div`,{className:`skeleton-card h-32`})]}),(0,p.jsx)(`div`,{className:`skeleton-card h-64`})]})})}function w(){return(0,p.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-4 px-4 pb-20 animate-fade-in`,children:[(0,p.jsx)(o,{className:`size-16 opacity-15`}),(0,p.jsx)(`h2`,{className:`text-lg font-semibold opacity-60`,children:`No analytics data yet`}),(0,p.jsx)(`p`,{className:`text-sm opacity-40 text-center max-w-md`,children:`Token usage and pipeline metrics will appear here once issues start processing.`})]})}var T=n(`/analytics`)({component:E});function E(){let{data:e,isLoading:t}=a(),{data:n,isLoading:r}=i(24);if(t&&!e)return(0,p.jsx)(C,{});let f=e?.overall?.totalTokens||0,_=e?.byPhase||null,T=e?.byModel||{},E=e?.daily||[],D=e?.topIssues||[],O=n?.tokensPerHour||[],k=n?.eventsPerHour||[],A=new Date().toISOString().slice(0,10),j=E.find(e=>e.date===A)?.totalTokens||0,M=E.reduce((e,t)=>e+(t.totalTokens||0),0);return f===0&&E.length===0&&D.length===0?(0,p.jsx)(w,{}):(0,p.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3 overflow-y-auto`,children:(0,p.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6 stagger-children`,children:[(0,p.jsx)(`section`,{children:(0,p.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:[(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-primary`,children:(0,p.jsx)(c,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Total Tokens`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,p.jsx)(g,{value:f})}),(0,p.jsx)(`div`,{className:`stat-desc font-mono`,children:h(f)})]}),(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-accent`,children:(0,p.jsx)(s,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Today`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,p.jsx)(g,{value:j})}),(0,p.jsxs)(`div`,{className:`stat-desc`,children:[`This week: `,m(M)]})]}),(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-info`,children:(0,p.jsx)(u,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Phase Split`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl p-0`,children:_?(0,p.jsx)(v,{byPhase:_}):(0,p.jsx)(`span`,{className:`opacity-30`,children:`-`})})]})]})}),E.length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,p.jsx)(o,{className:`size-4 text-primary`}),`Daily Token Usage`]}),(0,p.jsxs)(`span`,{className:`text-xs opacity-40`,children:[`Last `,E.length,` days`]})]}),(0,p.jsx)(y,{data:E,height:160})]}),(O.length>0||k.length>0)&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(d,{className:`size-4 text-secondary`}),`Hourly Activity (last 24h)`]}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[O.length>0&&(0,p.jsx)(b,{data:O,valueKey:`totalTokens`,height:60,color:`stroke-primary`,label:`Tokens / hour`}),k.length>0&&(0,p.jsx)(b,{data:k,valueKey:`count`,height:60,color:`stroke-secondary`,label:`Events / hour`})]})]}),D.length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(c,{className:`size-4 text-accent`}),`Top Issues by Token Usage`]}),(0,p.jsx)(S,{topIssues:D})]}),Object.keys(T).length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(l,{className:`size-4 text-info`}),`Model Breakdown`]}),(0,p.jsx)(x,{byModel:T})]})]})})}export{T as Route};