@codeuxai/codeux 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -45
- package/dashboard/dist/assets/{AgentAvatarScene-3Fa3RQHc.js → AgentAvatarScene-CdYNjBsU.js} +1 -1
- package/dashboard/dist/assets/{AgentsPage-woorcNHq.js → AgentsPage-BKJ1Zdbv.js} +2 -2
- package/dashboard/dist/assets/{BackgroundManager-DbgGcx7x.js → BackgroundManager-B4A4jACF.js} +1 -1
- package/dashboard/dist/assets/{BranchNameSchemeEditor-Bk2p-g2z.js → BranchNameSchemeEditor-DfnH2VYW.js} +1 -1
- package/dashboard/dist/assets/{BrowserPage-BLTJo_tK.js → BrowserPage-BxfAsG3M.js} +1 -1
- package/dashboard/dist/assets/{ChatPage-BljTU3OV.js → ChatPage-MXugCDvS.js} +1 -1
- package/dashboard/dist/assets/{ErrorPage-DgYd7CGv.js → ErrorPage-Y-fEDzly.js} +1 -1
- package/dashboard/dist/assets/{FileBrowserPage-ChIelEM6.js → FileBrowserPage-B4JEdW9B.js} +1 -1
- package/dashboard/dist/assets/{KnowledgePage-DP7v0vk3.js → KnowledgePage-DVbW7o61.js} +1 -1
- package/dashboard/dist/assets/{ListWindowSelector-DtKcmXGY.js → ListWindowSelector-CPMgebqM.js} +1 -1
- package/dashboard/dist/assets/{MemoryPage-2N_EfqqO.js → MemoryPage-C3RWZJL5.js} +1 -1
- package/dashboard/dist/assets/{OverviewTelemetry-C1hoOMVQ.js → OverviewTelemetry-Cy9vzhdY.js} +1 -1
- package/dashboard/dist/assets/{ProjectsPage-CEn6QDXI.js → ProjectsPage-RmR2LMuR.js} +1 -1
- package/dashboard/dist/assets/{SchedulerPage-BDTm8Q3w.js → SchedulerPage-Bg08X7Tm.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-CvSsreD8.js → SettingsPage-DzE_F7Kw.js} +1 -1
- package/dashboard/dist/assets/{SprintBoatRace-Ryphd2ZR.js → SprintBoatRace-BeZOItMO.js} +1 -1
- package/dashboard/dist/assets/{SprintDag-BLP6gb8k.js → SprintDag-vF8f33gn.js} +1 -1
- package/dashboard/dist/assets/{SprintsPage-DORSqECT.js → SprintsPage-bRHQPfWP.js} +1 -1
- package/dashboard/dist/assets/{StatsPage-BODQk1cJ.js → StatsPage-BZl_tzUr.js} +1 -1
- package/dashboard/dist/assets/{TasksPage-PeouQ4EB.js → TasksPage-rLMlkgxX.js} +1 -1
- package/dashboard/dist/assets/{index-DddY8OV0.js → index-DdNzHP9F.js} +5 -5
- package/dashboard/dist/assets/{monaco.contribution-Bxle9Jvf.js → monaco.contribution-2KFAi0p0.js} +2 -2
- package/dashboard/dist/assets/{tsMode-BYb4cdGe.js → tsMode-dZI5bz0O.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/infrastructure/providers/cli/provider-logs/opencode-log-parser.js +174 -20
- package/dist/infrastructure/providers/cli/provider-runner.js +51 -0
- package/dist/infrastructure/providers/cli/provider-usage.js +39 -6
- package/dist/infrastructure/providers/cli/workspace-artifact-service.js +17 -7
- package/dist/repositories/execution-repository.js +77 -0
- package/dist/services/provider-execution-service.js +10 -1
- package/dist/services/runtime-startup-recovery-service.js +170 -0
- package/dist/services/sprint-task-dispatch-service.js +7 -0
- package/docs/getting-started/quickstart.md +14 -3
- package/docs/operations/runbook.md +2 -0
- package/docs/settings/configuration-and-storage.md +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentAvatarScene-
|
|
2
|
-
import{O as e,P as t,S as n,_ as r,a as i,f as a,h as o,j as s,l as c,m as l,o as u,v as d,w as f,x as p,y as m}from"./vendor-Dl0fhdV0.js";import{t as h}from"./createLucideIcon-BshUfn15.js";import{i as g,n as _,r as v,t as y}from"./route-BlhVrKsR.js";import{n as b,t as x}from"./sliders-horizontal-6rJeI8Qo.js";import{t as S}from"./save-DFYp4CAL.js";import{t as C}from"./server-Colb_cUG.js";import{t as w}from"./settings-2-B5NbDo8J.js";import{n as T,r as E,t as D}from"./user-round-B1T_51SC.js";import{t as O}from"./wrench-DSVlxBRn.js";import{X as k,r as A}from"./project-data-BSCsMQnj.js";import{r as j,t as M}from"./use-reduced-motion-Dxh6NCDM.js";import{$n as N,Ai as P,Ar as F,C as I,Ci as L,En as R,Er as ee,Gn as te,Ii as z,Jn as ne,Kn as B,Kr as re,Mr as ie,Or as ae,Pr as V,Qn as oe,St as H,Ti as U,Tr as se,Un as ce,Vr as le,Wn as W,Wr as ue,Xn as de,Yn as G,Zn as K,_r as fe,ai as q,bi as pe,dn as me,dt as he,fn as ge,fr as _e,ft as ve,hn as ye,hr as be,ii as xe,kr as Se,lt as J,mn as Ce,mr as Y,ni as X,oi as we,ot as Z,pn as Te,pr as Q,pt as Ee,qn as De,st as Oe,ti as ke,tn as Ae,un as je,ut as Me,v as Ne,wi as Pe,wr as Fe,xi as $,xt as Ie,y as Le,yr as Re}from"./index-DddY8OV0.js";import{a as ze,i as Be,l as Ve}from"./knowledge-api-BfLaCxBX.js";var He=h(`angry`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2`,key:`epbg0q`}],[`path`,{d:`M7.5 8 10 9`,key:`olxxln`}],[`path`,{d:`m14 9 2.5-1`,key:`1j6cij`}],[`path`,{d:`M9 10h.01`,key:`qbtxuw`}],[`path`,{d:`M15 10h.01`,key:`1qmjsl`}]]),Ue=h(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),We=h(`frown`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2`,key:`epbg0q`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),Ge=h(`meh`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`8`,x2:`16`,y1:`15`,y2:`15`,key:`1xb1d9`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),Ke=h(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),qe=h(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Je=h(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Ye=h(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]);s(),p();var Xe=async e=>k(`/api/projects/${encodeURIComponent(e)}/instruction-files`),Ze=async(e,t)=>k(`/api/projects/${encodeURIComponent(e)}/instruction-files/${encodeURIComponent(t)}`),Qe=async(e,t,n)=>k(`/api/projects/${encodeURIComponent(e)}/instruction-files/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n})}),$e=({selectedProject:e,presets:t,onCreate:n,onSyncAll:r,syncingAll:a})=>{let s=o(null);d(()=>{s.current&&Q.fromTo(Array.from(s.current.querySelectorAll(`[data-hero-anim]`)),{opacity:0,y:24},{opacity:1,y:0,duration:.85,stagger:.09,ease:`power4.out`})},[]);let c=t?.length??0,l=(t??[]).filter(e=>e.syncStatus===`synced`).length;return i(`div`,{ref:s,className:`relative flex flex-col gap-6 xl:flex-row xl:items-end xl:justify-between`,children:[i(`div`,{className:`space-y-5`,children:[i(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.2em] text-signal-500`,"data-hero-anim":!0,children:[i(se,{className:`h-3.5 w-3.5`,strokeWidth:2.2}),`Agent Workshop`]}),i(`div`,{className:`relative overflow-hidden`,"data-hero-anim":!0,children:[i(`div`,{className:`pointer-events-none absolute -left-2 -top-8 font-display text-[6rem] font-black leading-none tracking-tighter text-black/[0.04] dark:text-white/[0.03] md:text-[8rem]`,children:`AGENTS`}),i(`h1`,{className:`relative z-10 font-display text-5xl font-black tracking-tighter text-slate-900 dark:text-white md:text-7xl`,children:[`Your `,i(`span`,{className:`text-signal-500`,children:`Workforce.`})]})]}),i(`p`,{className:`max-w-2xl text-base leading-relaxed text-slate-500 md:text-lg dark:text-slate-400`,"data-hero-anim":!0,children:`Design, customize, and deploy AI specialists. Each agent ships with a distinct personality, an expressive avatar, and operator-grade system instructions.`}),c>0&&i(`div`,{className:`flex flex-wrap items-center gap-2`,"data-hero-anim":!0,children:[i(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-signal-500/30 bg-signal-500/10 px-3.5 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-signal-600 shadow-sm dark:border-signal-500/25 dark:bg-signal-500/15 dark:text-signal-400`,children:[i(`span`,{className:`flex h-4 w-4 items-center justify-center rounded-full bg-signal-500 font-mono text-[9px] font-black text-white dark:text-void-900`,children:c}),`Active`]}),l>0&&i(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-black/[0.08] bg-white/80 px-3.5 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 shadow-sm backdrop-blur-md dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-400`,children:[i(`span`,{className:`h-1.5 w-1.5 rounded-full bg-signal-500 shadow-[0_0_8px_rgba(0,224,160,0.6)]`}),l,` synced`]}),e&&i(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-black/[0.06] bg-white/70 px-3.5 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 backdrop-blur-md dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:[i(P,{className:`h-3 w-3`,strokeWidth:2.4}),i(`span`,{className:`max-w-[10rem] truncate`,children:e.name})]})]})]}),i(`div`,{className:`flex flex-wrap items-center gap-3`,"data-hero-anim":!0,children:[i(`button`,{type:`button`,onClick:r,disabled:!e||a,className:`inline-flex items-center gap-2 rounded-full border border-black/[0.06] bg-white/70 px-5 py-2.5 text-[11px] font-bold uppercase tracking-[0.14em] text-slate-600 backdrop-blur-md transition-all hover:bg-white hover:text-slate-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-white/70 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-300 dark:hover:bg-white/[0.06] dark:hover:text-white disabled:dark:hover:bg-white/[0.03] disabled:dark:hover:text-slate-300`,children:[i(F,{className:`h-3.5 w-3.5 ${a?`animate-spin`:``}`,strokeWidth:2.3}),`Sync All`]}),i(`button`,{type:`button`,onClick:n,disabled:!e,className:`group/btn inline-flex items-center gap-2 rounded-full bg-signal-500 px-5 py-2.5 text-[11px] font-bold uppercase tracking-[0.14em] text-void-900 shadow-[0_0_24px_rgba(0,224,160,0.28)] transition-all hover:scale-[1.03] hover:bg-signal-400 hover:shadow-[0_0_32px_rgba(0,224,160,0.36)] focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:scale-100`,children:[i(ie,{className:`h-3.5 w-3.5 transition-transform group-hover/btn:rotate-90`,strokeWidth:2.5}),`New Agent`]})]})]})};p();var et=e=>{switch(e.syncStatus){case`out_of_sync`:return{cls:`border-amber-400/30 bg-amber-400/15 text-amber-600 dark:border-amber-400/25 dark:bg-amber-400/10 dark:text-amber-400`,label:`Out of Sync`,icon:!0};case`missing_source`:return{cls:`border-status-red/20 bg-status-red/8 text-status-red`,label:`Missing`,icon:!0};case`synced`:return{cls:`border-signal-500/20 bg-signal-500/8 text-signal-600 dark:text-signal-400`,label:`Synced`,icon:!1};default:return{cls:`border-black/[0.06] bg-black/[0.03] text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,label:`Local`,icon:!1}}},tt=({preset:e,routeTags:t,isSelected:n,onClick:r})=>{let a=o(null),s=N(e.avatarConfig?.accent),c=et(e);return d(()=>{a.current&&Q.fromTo(a.current,{opacity:0,y:16,scale:.98},{opacity:1,y:0,scale:1,duration:.55,ease:`power3.out`})},[]),i(`button`,{ref:a,type:`button`,onClick:r,className:`group relative flex w-full overflow-hidden rounded-[1.4rem] border text-left backdrop-blur-xl transition-all duration-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2 ${n?`border-signal-500/40 bg-white/85 shadow-[0_8px_32px_rgba(0,224,160,0.12)] dark:border-signal-500/40 dark:bg-void-800/75 dark:shadow-[0_8px_32px_rgba(0,224,160,0.10)]`:`border-black/[0.06] bg-white/55 hover:-translate-y-0.5 hover:border-signal-500/30 hover:bg-white/80 hover:shadow-[0_8px_24px_rgba(0,224,160,0.06)] dark:border-white/[0.06] dark:bg-void-800/40 dark:hover:border-signal-500/30 dark:hover:bg-void-800/60 dark:hover:shadow-[0_8px_24px_rgba(0,0,0,0.25)]`}`,children:[i(`div`,{className:`absolute inset-y-0 left-0 w-[3px] rounded-l-full transition-opacity duration-300 ${n?`opacity-100`:`opacity-0 group-hover:opacity-50`}`,style:{backgroundColor:s}}),i(`div`,{className:`relative z-10 flex w-full items-center gap-4 px-5 py-4`,children:[i(`div`,{className:`relative flex h-14 w-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl transition-shadow duration-300 ${n?`shadow-[0_0_16px_rgba(0,224,160,0.12)]`:``}`,style:{background:`linear-gradient(135deg, ${s}12, ${s}06)`},children:i(R,{config:e.avatarConfig,expression:n?`happy`:`bored`,className:`h-full w-full`})}),i(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[i(`h3`,{className:`font-display text-[15px] font-bold tracking-tight transition-colors ${n?`text-slate-900 dark:text-white`:`text-slate-700 dark:text-slate-300 group-hover:text-slate-900 dark:group-hover:text-white`}`,children:e.name}),i(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[t.slice(0,2).map(e=>i(`span`,{className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-[0.1em]`,style:{backgroundColor:`${s}10`,color:s},children:e},e)),t.length>2&&i(`span`,{className:`text-[9px] font-bold text-slate-400`,children:[`+`,t.length-2]}),i(`span`,{className:`ml-auto inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-[0.1em] ${c.cls}`,children:[c.icon&&i(fe,{className:`h-2.5 w-2.5`,strokeWidth:2.5}),c.label]})]})]}),i(L,{className:`h-4 w-4 shrink-0 transition-all duration-300 ${n?`translate-x-0.5 text-signal-500`:`text-slate-300 group-hover:translate-x-0.5 group-hover:text-signal-400 dark:text-slate-600`}`,strokeWidth:2.5})]})]})};a();var nt=l(()=>z(()=>import(`./AgentAvatarScene-3Fa3RQHc.js`).then(e=>({default:e.AgentAvatarScene})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function rt(e){return i(c,{fallback:i(`div`,{className:e.className||`h-full w-full`,"aria-hidden":`true`}),children:i(nt,{...e})})}var it={happy:{Icon:Ye,label:`Happy`},sad:{Icon:We,label:`Sad`},angry:{Icon:He,label:`Angry`},bored:{Icon:Ge,label:`Bored`},hyped:{Icon:Y,label:`Hyped`}},at=({config:e,expression:t,accentHex:n,onExpressionChange:r,onRandomize:a,heightClass:o=`h-[300px]`,className:s=``,fallbackMode:c=!1,disabled:l=!1})=>{let u=it[t];return i(`div`,{className:`relative overflow-hidden rounded-[1.5rem] border border-black/[0.06] bg-white/40 shadow-sm backdrop-blur-2xl dark:border-white/[0.07] dark:bg-void-800/40 ${s}`,style:{backgroundImage:`radial-gradient(circle at 50% 38%, ${n}26, transparent 62%)`},children:[i(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute left-1/2 top-[38%] h-44 w-44 -translate-x-1/2 -translate-y-1/2 rounded-full blur-3xl`,style:{backgroundColor:`${n}26`}}),i(`div`,{className:`relative w-full ${o}`,children:i(rt,{config:e,expression:t,fallbackMode:c,className:`h-full w-full`})}),a&&i(`button`,{type:`button`,onClick:a,disabled:l,title:`Randomize appearance`,"aria-label":`Randomize appearance`,className:`group/rnd absolute right-3 top-3 inline-flex h-9 items-center gap-1.5 rounded-full border border-black/[0.06] bg-white/75 px-3 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 shadow-sm backdrop-blur-md transition-all hover:bg-signal-500 hover:text-void-900 hover:shadow-[0_0_18px_rgba(0,224,160,0.35)] focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:bg-white/[0.08] dark:text-slate-300 dark:hover:bg-signal-500 dark:hover:text-void-900`,children:[i(F,{className:`h-3.5 w-3.5 transition-transform duration-500 group-hover/rnd:rotate-180`,strokeWidth:2.5}),`Shuffle`]}),i(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-gradient-to-t from-white/90 via-white/45 to-transparent dark:from-void-900/90 dark:via-void-900/40`}),r&&i(`div`,{className:`absolute inset-x-0 bottom-3 flex flex-col items-center gap-1.5 px-4`,children:[i(`div`,{className:`flex items-center gap-1 rounded-full border border-black/[0.06] bg-white/75 p-1 shadow-[0_4px_16px_rgba(0,0,0,0.06)] backdrop-blur-xl dark:border-white/[0.08] dark:bg-void-800/75`,children:K.map(e=>{let n=it[e],a=t===e;return i(`button`,{type:`button`,onClick:()=>r(e),title:n.label,"aria-label":n.label,"aria-pressed":a,className:`flex h-8 w-8 items-center justify-center rounded-full transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/40 ${a?`bg-signal-500 text-void-900 shadow-[0_0_12px_rgba(0,224,160,0.4)]`:`text-slate-400 hover:bg-black/[0.04] hover:text-slate-600 dark:text-slate-500 dark:hover:bg-white/[0.06] dark:hover:text-slate-300`}`,children:i(n.Icon,{className:`h-4 w-4`,strokeWidth:2.2})},e)})}),u&&i(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:u.label})]})]})},ot=`code_ux`,st=()=>({codeUxEnabled:!0,codeUxToolToggles:[],linkedServerIds:[]}),ct=e=>({codeUxEnabled:e.codeUxEnabled!==!1,codeUxToolToggles:e.codeUxToolToggles.filter(e=>e.enabled===!1),linkedServerIds:Array.from(new Set(e.linkedServerIds))}),lt=(e,t)=>{let n=[];e?.codeUxEnabled!==!1&&n.push({id:ot,label:`Code UX`,kind:`code_ux`});for(let r of e?.linkedServerIds??[]){let e=t.find(e=>e.id===r);e&&n.push({id:r,label:e.label||e.name,kind:`custom`})}return n},ut=1/4,dt=new Intl.NumberFormat(`en-US`);function ft(e){return e?Math.ceil(e.length*ut):0}function pt(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:dt.format(e)}p(),s();var mt=320,ht=6;function gt(e){if(!e)return{excerpt:``,truncated:!1};let t=e.split(/\n/),n=!1,r=e;t.length>ht&&(r=t.slice(0,ht).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentAvatarScene-CdYNjBsU.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/index-DdNzHP9F.js","assets/project-data-BSCsMQnj.js","assets/vendor-Dl0fhdV0.js","assets/use-reduced-motion-Dxh6NCDM.js","assets/createLucideIcon-BshUfn15.js","assets/index-DBd04NId.css","assets/WebGLRenderer-D904dTMp.js","assets/Points-T2ogl268.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{O as e,P as t,S as n,_ as r,a as i,f as a,h as o,j as s,l as c,m as l,o as u,v as d,w as f,x as p,y as m}from"./vendor-Dl0fhdV0.js";import{t as h}from"./createLucideIcon-BshUfn15.js";import{i as g,n as _,r as v,t as y}from"./route-BlhVrKsR.js";import{n as b,t as x}from"./sliders-horizontal-6rJeI8Qo.js";import{t as S}from"./save-DFYp4CAL.js";import{t as C}from"./server-Colb_cUG.js";import{t as w}from"./settings-2-B5NbDo8J.js";import{n as T,r as E,t as D}from"./user-round-B1T_51SC.js";import{t as O}from"./wrench-DSVlxBRn.js";import{X as k,r as A}from"./project-data-BSCsMQnj.js";import{r as j,t as M}from"./use-reduced-motion-Dxh6NCDM.js";import{$n as N,Ai as P,Ar as F,C as I,Ci as L,En as R,Er as ee,Gn as te,Ii as z,Jn as ne,Kn as B,Kr as re,Mr as ie,Or as ae,Pr as V,Qn as oe,St as H,Ti as U,Tr as se,Un as ce,Vr as le,Wn as W,Wr as ue,Xn as de,Yn as G,Zn as K,_r as fe,ai as q,bi as pe,dn as me,dt as he,fn as ge,fr as _e,ft as ve,hn as ye,hr as be,ii as xe,kr as Se,lt as J,mn as Ce,mr as Y,ni as X,oi as we,ot as Z,pn as Te,pr as Q,pt as Ee,qn as De,st as Oe,ti as ke,tn as Ae,un as je,ut as Me,v as Ne,wi as Pe,wr as Fe,xi as $,xt as Ie,y as Le,yr as Re}from"./index-DdNzHP9F.js";import{a as ze,i as Be,l as Ve}from"./knowledge-api-BfLaCxBX.js";var He=h(`angry`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2`,key:`epbg0q`}],[`path`,{d:`M7.5 8 10 9`,key:`olxxln`}],[`path`,{d:`m14 9 2.5-1`,key:`1j6cij`}],[`path`,{d:`M9 10h.01`,key:`qbtxuw`}],[`path`,{d:`M15 10h.01`,key:`1qmjsl`}]]),Ue=h(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),We=h(`frown`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2`,key:`epbg0q`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),Ge=h(`meh`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`8`,x2:`16`,y1:`15`,y2:`15`,key:`1xb1d9`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),Ke=h(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),qe=h(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Je=h(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Ye=h(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]);s(),p();var Xe=async e=>k(`/api/projects/${encodeURIComponent(e)}/instruction-files`),Ze=async(e,t)=>k(`/api/projects/${encodeURIComponent(e)}/instruction-files/${encodeURIComponent(t)}`),Qe=async(e,t,n)=>k(`/api/projects/${encodeURIComponent(e)}/instruction-files/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n})}),$e=({selectedProject:e,presets:t,onCreate:n,onSyncAll:r,syncingAll:a})=>{let s=o(null);d(()=>{s.current&&Q.fromTo(Array.from(s.current.querySelectorAll(`[data-hero-anim]`)),{opacity:0,y:24},{opacity:1,y:0,duration:.85,stagger:.09,ease:`power4.out`})},[]);let c=t?.length??0,l=(t??[]).filter(e=>e.syncStatus===`synced`).length;return i(`div`,{ref:s,className:`relative flex flex-col gap-6 xl:flex-row xl:items-end xl:justify-between`,children:[i(`div`,{className:`space-y-5`,children:[i(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.2em] text-signal-500`,"data-hero-anim":!0,children:[i(se,{className:`h-3.5 w-3.5`,strokeWidth:2.2}),`Agent Workshop`]}),i(`div`,{className:`relative overflow-hidden`,"data-hero-anim":!0,children:[i(`div`,{className:`pointer-events-none absolute -left-2 -top-8 font-display text-[6rem] font-black leading-none tracking-tighter text-black/[0.04] dark:text-white/[0.03] md:text-[8rem]`,children:`AGENTS`}),i(`h1`,{className:`relative z-10 font-display text-5xl font-black tracking-tighter text-slate-900 dark:text-white md:text-7xl`,children:[`Your `,i(`span`,{className:`text-signal-500`,children:`Workforce.`})]})]}),i(`p`,{className:`max-w-2xl text-base leading-relaxed text-slate-500 md:text-lg dark:text-slate-400`,"data-hero-anim":!0,children:`Design, customize, and deploy AI specialists. Each agent ships with a distinct personality, an expressive avatar, and operator-grade system instructions.`}),c>0&&i(`div`,{className:`flex flex-wrap items-center gap-2`,"data-hero-anim":!0,children:[i(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-signal-500/30 bg-signal-500/10 px-3.5 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-signal-600 shadow-sm dark:border-signal-500/25 dark:bg-signal-500/15 dark:text-signal-400`,children:[i(`span`,{className:`flex h-4 w-4 items-center justify-center rounded-full bg-signal-500 font-mono text-[9px] font-black text-white dark:text-void-900`,children:c}),`Active`]}),l>0&&i(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-black/[0.08] bg-white/80 px-3.5 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 shadow-sm backdrop-blur-md dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-400`,children:[i(`span`,{className:`h-1.5 w-1.5 rounded-full bg-signal-500 shadow-[0_0_8px_rgba(0,224,160,0.6)]`}),l,` synced`]}),e&&i(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-black/[0.06] bg-white/70 px-3.5 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 backdrop-blur-md dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:[i(P,{className:`h-3 w-3`,strokeWidth:2.4}),i(`span`,{className:`max-w-[10rem] truncate`,children:e.name})]})]})]}),i(`div`,{className:`flex flex-wrap items-center gap-3`,"data-hero-anim":!0,children:[i(`button`,{type:`button`,onClick:r,disabled:!e||a,className:`inline-flex items-center gap-2 rounded-full border border-black/[0.06] bg-white/70 px-5 py-2.5 text-[11px] font-bold uppercase tracking-[0.14em] text-slate-600 backdrop-blur-md transition-all hover:bg-white hover:text-slate-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-white/70 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-300 dark:hover:bg-white/[0.06] dark:hover:text-white disabled:dark:hover:bg-white/[0.03] disabled:dark:hover:text-slate-300`,children:[i(F,{className:`h-3.5 w-3.5 ${a?`animate-spin`:``}`,strokeWidth:2.3}),`Sync All`]}),i(`button`,{type:`button`,onClick:n,disabled:!e,className:`group/btn inline-flex items-center gap-2 rounded-full bg-signal-500 px-5 py-2.5 text-[11px] font-bold uppercase tracking-[0.14em] text-void-900 shadow-[0_0_24px_rgba(0,224,160,0.28)] transition-all hover:scale-[1.03] hover:bg-signal-400 hover:shadow-[0_0_32px_rgba(0,224,160,0.36)] focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:scale-100`,children:[i(ie,{className:`h-3.5 w-3.5 transition-transform group-hover/btn:rotate-90`,strokeWidth:2.5}),`New Agent`]})]})]})};p();var et=e=>{switch(e.syncStatus){case`out_of_sync`:return{cls:`border-amber-400/30 bg-amber-400/15 text-amber-600 dark:border-amber-400/25 dark:bg-amber-400/10 dark:text-amber-400`,label:`Out of Sync`,icon:!0};case`missing_source`:return{cls:`border-status-red/20 bg-status-red/8 text-status-red`,label:`Missing`,icon:!0};case`synced`:return{cls:`border-signal-500/20 bg-signal-500/8 text-signal-600 dark:text-signal-400`,label:`Synced`,icon:!1};default:return{cls:`border-black/[0.06] bg-black/[0.03] text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,label:`Local`,icon:!1}}},tt=({preset:e,routeTags:t,isSelected:n,onClick:r})=>{let a=o(null),s=N(e.avatarConfig?.accent),c=et(e);return d(()=>{a.current&&Q.fromTo(a.current,{opacity:0,y:16,scale:.98},{opacity:1,y:0,scale:1,duration:.55,ease:`power3.out`})},[]),i(`button`,{ref:a,type:`button`,onClick:r,className:`group relative flex w-full overflow-hidden rounded-[1.4rem] border text-left backdrop-blur-xl transition-all duration-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2 ${n?`border-signal-500/40 bg-white/85 shadow-[0_8px_32px_rgba(0,224,160,0.12)] dark:border-signal-500/40 dark:bg-void-800/75 dark:shadow-[0_8px_32px_rgba(0,224,160,0.10)]`:`border-black/[0.06] bg-white/55 hover:-translate-y-0.5 hover:border-signal-500/30 hover:bg-white/80 hover:shadow-[0_8px_24px_rgba(0,224,160,0.06)] dark:border-white/[0.06] dark:bg-void-800/40 dark:hover:border-signal-500/30 dark:hover:bg-void-800/60 dark:hover:shadow-[0_8px_24px_rgba(0,0,0,0.25)]`}`,children:[i(`div`,{className:`absolute inset-y-0 left-0 w-[3px] rounded-l-full transition-opacity duration-300 ${n?`opacity-100`:`opacity-0 group-hover:opacity-50`}`,style:{backgroundColor:s}}),i(`div`,{className:`relative z-10 flex w-full items-center gap-4 px-5 py-4`,children:[i(`div`,{className:`relative flex h-14 w-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl transition-shadow duration-300 ${n?`shadow-[0_0_16px_rgba(0,224,160,0.12)]`:``}`,style:{background:`linear-gradient(135deg, ${s}12, ${s}06)`},children:i(R,{config:e.avatarConfig,expression:n?`happy`:`bored`,className:`h-full w-full`})}),i(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[i(`h3`,{className:`font-display text-[15px] font-bold tracking-tight transition-colors ${n?`text-slate-900 dark:text-white`:`text-slate-700 dark:text-slate-300 group-hover:text-slate-900 dark:group-hover:text-white`}`,children:e.name}),i(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[t.slice(0,2).map(e=>i(`span`,{className:`inline-flex items-center rounded-md px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-[0.1em]`,style:{backgroundColor:`${s}10`,color:s},children:e},e)),t.length>2&&i(`span`,{className:`text-[9px] font-bold text-slate-400`,children:[`+`,t.length-2]}),i(`span`,{className:`ml-auto inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-[0.1em] ${c.cls}`,children:[c.icon&&i(fe,{className:`h-2.5 w-2.5`,strokeWidth:2.5}),c.label]})]})]}),i(L,{className:`h-4 w-4 shrink-0 transition-all duration-300 ${n?`translate-x-0.5 text-signal-500`:`text-slate-300 group-hover:translate-x-0.5 group-hover:text-signal-400 dark:text-slate-600`}`,strokeWidth:2.5})]})]})};a();var nt=l(()=>z(()=>import(`./AgentAvatarScene-CdYNjBsU.js`).then(e=>({default:e.AgentAvatarScene})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function rt(e){return i(c,{fallback:i(`div`,{className:e.className||`h-full w-full`,"aria-hidden":`true`}),children:i(nt,{...e})})}var it={happy:{Icon:Ye,label:`Happy`},sad:{Icon:We,label:`Sad`},angry:{Icon:He,label:`Angry`},bored:{Icon:Ge,label:`Bored`},hyped:{Icon:Y,label:`Hyped`}},at=({config:e,expression:t,accentHex:n,onExpressionChange:r,onRandomize:a,heightClass:o=`h-[300px]`,className:s=``,fallbackMode:c=!1,disabled:l=!1})=>{let u=it[t];return i(`div`,{className:`relative overflow-hidden rounded-[1.5rem] border border-black/[0.06] bg-white/40 shadow-sm backdrop-blur-2xl dark:border-white/[0.07] dark:bg-void-800/40 ${s}`,style:{backgroundImage:`radial-gradient(circle at 50% 38%, ${n}26, transparent 62%)`},children:[i(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute left-1/2 top-[38%] h-44 w-44 -translate-x-1/2 -translate-y-1/2 rounded-full blur-3xl`,style:{backgroundColor:`${n}26`}}),i(`div`,{className:`relative w-full ${o}`,children:i(rt,{config:e,expression:t,fallbackMode:c,className:`h-full w-full`})}),a&&i(`button`,{type:`button`,onClick:a,disabled:l,title:`Randomize appearance`,"aria-label":`Randomize appearance`,className:`group/rnd absolute right-3 top-3 inline-flex h-9 items-center gap-1.5 rounded-full border border-black/[0.06] bg-white/75 px-3 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 shadow-sm backdrop-blur-md transition-all hover:bg-signal-500 hover:text-void-900 hover:shadow-[0_0_18px_rgba(0,224,160,0.35)] focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:bg-white/[0.08] dark:text-slate-300 dark:hover:bg-signal-500 dark:hover:text-void-900`,children:[i(F,{className:`h-3.5 w-3.5 transition-transform duration-500 group-hover/rnd:rotate-180`,strokeWidth:2.5}),`Shuffle`]}),i(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-gradient-to-t from-white/90 via-white/45 to-transparent dark:from-void-900/90 dark:via-void-900/40`}),r&&i(`div`,{className:`absolute inset-x-0 bottom-3 flex flex-col items-center gap-1.5 px-4`,children:[i(`div`,{className:`flex items-center gap-1 rounded-full border border-black/[0.06] bg-white/75 p-1 shadow-[0_4px_16px_rgba(0,0,0,0.06)] backdrop-blur-xl dark:border-white/[0.08] dark:bg-void-800/75`,children:K.map(e=>{let n=it[e],a=t===e;return i(`button`,{type:`button`,onClick:()=>r(e),title:n.label,"aria-label":n.label,"aria-pressed":a,className:`flex h-8 w-8 items-center justify-center rounded-full transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/40 ${a?`bg-signal-500 text-void-900 shadow-[0_0_12px_rgba(0,224,160,0.4)]`:`text-slate-400 hover:bg-black/[0.04] hover:text-slate-600 dark:text-slate-500 dark:hover:bg-white/[0.06] dark:hover:text-slate-300`}`,children:i(n.Icon,{className:`h-4 w-4`,strokeWidth:2.2})},e)})}),u&&i(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:u.label})]})]})},ot=`code_ux`,st=()=>({codeUxEnabled:!0,codeUxToolToggles:[],linkedServerIds:[]}),ct=e=>({codeUxEnabled:e.codeUxEnabled!==!1,codeUxToolToggles:e.codeUxToolToggles.filter(e=>e.enabled===!1),linkedServerIds:Array.from(new Set(e.linkedServerIds))}),lt=(e,t)=>{let n=[];e?.codeUxEnabled!==!1&&n.push({id:ot,label:`Code UX`,kind:`code_ux`});for(let r of e?.linkedServerIds??[]){let e=t.find(e=>e.id===r);e&&n.push({id:r,label:e.label||e.name,kind:`custom`})}return n},ut=1/4,dt=new Intl.NumberFormat(`en-US`);function ft(e){return e?Math.ceil(e.length*ut):0}function pt(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:dt.format(e)}p(),s();var mt=320,ht=6;function gt(e){if(!e)return{excerpt:``,truncated:!1};let t=e.split(/\n/),n=!1,r=e;t.length>ht&&(r=t.slice(0,ht).join(`
|
|
3
3
|
`),n=!0);let i=!1;if(r.length>mt){let e=r.slice(0,mt),t=Math.max(e.lastIndexOf(` `),e.lastIndexOf(`
|
|
4
4
|
`));r=(t>mt-80?e.slice(0,t):e).trimEnd()+`…`,i=!0}else n&&(r=r.trimEnd()+`…`);return{excerpt:r,truncated:n||i}}var _t=e=>{switch(e.syncStatus){case`out_of_sync`:return{cls:`border-amber-400/20 bg-amber-400/8 text-amber-600 dark:text-amber-400`,label:`Out of Sync`};case`missing_source`:return{cls:`border-status-red/20 bg-status-red/8 text-status-red`,label:`Source Missing`};case`synced`:return{cls:`border-signal-500/20 bg-signal-500/8 text-signal-600 dark:text-signal-400`,label:e.sourceScope===`project`?`Project`:e.sourceScope==="default"?`Default`:`Home`};default:return{cls:`border-black/[0.06] bg-black/[0.03] text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,label:`Database Only`}}},vt=({label:e,value:t,iconNode:n,accent:r,rawIcon:a})=>i(`div`,{className:`flex items-center gap-3 rounded-2xl border border-black/[0.05] bg-white/40 p-3.5 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[a?i(`span`,{className:`shrink-0`,children:n}):i(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl ${r?`bg-signal-500/10 text-signal-600 dark:bg-signal-500/15 dark:text-signal-400`:`bg-black/[0.04] text-slate-500 dark:bg-white/[0.05] dark:text-slate-300`}`,children:n}),i(`div`,{className:`min-w-0`,children:[i(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:e}),i(`div`,{className:`mt-0.5 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100`,children:t})]})]}),yt=({preset:e})=>{let[t,n]=m(null);return f(()=>{let t=!1;return n(null),Promise.all([Be(e.id).catch(()=>[]),ze(e.projectId).catch(()=>[])]).then(([e,r])=>{if(t)return;let i=new Set(e);n(r.filter(e=>i.has(e.id)))}),()=>{t=!0}},[e.id,e.projectId]),!t||t.length===0?null:i(`div`,{className:`flex flex-col gap-3`,children:[i(bt,{icon:ue,title:`Knowledge Base · ${t.length}`}),i(`div`,{className:`flex flex-wrap items-center gap-2`,children:t.map(e=>i(`span`,{title:e.summary||e.title,className:`inline-flex items-center gap-1.5 rounded-full border border-signal-500/20 bg-signal-500/[0.08] px-2.5 py-1 text-[11px] font-bold text-signal-700 dark:text-signal-200`,children:[i(X,{className:`h-3 w-3`,strokeWidth:2.4}),i(`span`,{className:`max-w-[200px] truncate`,children:e.title})]},e.id))})]})},bt=({icon:e,title:t,tone:n=`signal`,action:r})=>{let a=n===`violet`?`text-violet-600 dark:text-violet-400`:`text-signal-600 dark:text-signal-500`;return i(`div`,{className:`flex items-center justify-between gap-3`,children:[i(`div`,{className:`flex items-center gap-2`,children:[i(e,{className:`h-3.5 w-3.5 ${a}`,strokeWidth:2.4}),i(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] ${a}`,children:t})]}),r]})},xt=({preset:t,routeTags:n,providerOptions:a=[],availableMcpServers:s=[],onEdit:c,onDelete:l,onImport:u,deleting:f,importing:p})=>{let h=o(null),[g,b]=m(`happy`),[x,S]=m(!1),[w,T]=m(!1),E=N(t.avatarConfig?.accent),D=_t(t),O=a.find(e=>e.value===t.providerConfigId)||null,k=lt(t.mcpAccess,s),A=k.slice(0,6),j=k.length-A.length;d(()=>{h.current&&(Q.fromTo(h.current,{opacity:0,x:16},{opacity:1,x:0,duration:.45,ease:`power3.out`}),S(!1),T(!1))},[t.id]);let M=r(()=>gt(t.instructionMarkdown??``),[t.instructionMarkdown]),P=r(()=>ft(t.instructionMarkdown),[t.instructionMarkdown]),L=r(()=>gt(t.memoryTemplateMarkdown??``),[t.memoryTemplateMarkdown]),R=r(()=>ft(t.memoryTemplateMarkdown),[t.memoryTemplateMarkdown]);return i(`div`,{ref:h,className:`group relative flex flex-col overflow-hidden rounded-[1.9rem] border border-black/[0.06] bg-white/70 shadow-[0_2px_20px_rgba(0,0,0,0.04)] backdrop-blur-2xl dark:border-white/[0.06] dark:bg-void-800/60 dark:shadow-[0_4px_24px_rgba(0,0,0,0.2)]`,children:[i(Ee,{accentHex:E}),i(ve,{accentHex:E}),i(`div`,{className:`relative z-10 flex flex-col gap-6 p-6 md:p-8`,children:[i(`div`,{className:`flex flex-col gap-6 lg:flex-row lg:items-stretch`,children:[i(`div`,{className:`lg:w-[300px] lg:shrink-0`,children:i(at,{config:t.avatarConfig,expression:g,accentHex:E,onExpressionChange:b,heightClass:`h-[240px] lg:h-full lg:min-h-[260px]`,className:`h-full`})}),i(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4`,children:[i(`div`,{className:`flex items-start justify-between gap-4`,children:[i(`div`,{className:`flex min-w-0 flex-col gap-2.5`,children:[i(`span`,{className:`inline-flex w-fit items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.18em] text-signal-600 dark:text-signal-400`,children:[i(`span`,{className:`relative flex h-1.5 w-1.5`,children:[i(`span`,{className:`absolute inline-flex h-full w-full animate-ping rounded-full bg-signal-500/60`}),i(`span`,{className:`relative inline-flex h-1.5 w-1.5 rounded-full bg-signal-500`})]}),`Agent Profile`]}),i(`h2`,{className:`font-display text-3xl font-black tracking-tight text-slate-900 md:text-4xl dark:text-white`,children:t.name}),t.description&&i(`p`,{className:`max-w-xl text-sm leading-relaxed text-slate-500 dark:text-slate-400`,children:t.description})]}),i(`button`,{type:`button`,onClick:c,className:`inline-flex shrink-0 items-center gap-2 rounded-full bg-signal-500 px-5 py-2.5 text-sm font-bold text-slate-900 shadow-lg shadow-signal-500/15 transition-all hover:scale-[1.03] hover:bg-signal-400 hover:shadow-signal-500/25 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2 dark:text-void-900`,children:[i(qe,{className:`h-4 w-4`,strokeWidth:2.5}),`Edit`]})]}),i(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.map(e=>i(`span`,{className:`inline-flex items-center rounded-full px-2.5 py-1 text-[10px] font-bold uppercase tracking-[0.12em]`,style:{backgroundColor:`${E}10`,color:E},children:e},e)),n.length===0&&i(`span`,{className:`inline-flex items-center rounded-full border border-black/[0.06] bg-white/50 px-2.5 py-1 text-[10px] font-bold uppercase tracking-[0.12em] text-slate-400 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-500`,children:`No assigned routes`}),i(`span`,{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-[10px] font-bold uppercase tracking-[0.12em] ${D.cls}`,children:[t.syncStatus===`out_of_sync`&&i(fe,{className:`h-3 w-3`,strokeWidth:2.2}),D.label]})]}),i(`div`,{className:`mt-auto grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[i(vt,{label:`Provider`,value:O?.label||`Route default`,rawIcon:!!O,iconNode:O?i(I,{id:O.provider,disabled:!O.enabled,className:`h-10 w-10 rounded-xl`,imageClassName:`h-5 w-5`}):i(y,{className:`h-4 w-4`,strokeWidth:2.2})}),i(vt,{label:`Model`,value:t.model||`Provider default`,iconNode:i(we,{className:`h-4 w-4`,strokeWidth:2.2})}),i(vt,{label:`Connected MCPs`,value:k.length===0?`None`:`${k.length} server${k.length===1?``:`s`}`,iconNode:i(C,{className:`h-4 w-4`,strokeWidth:2.2}),accent:k.length>0}),i(vt,{label:`System Prompt`,value:t.instructionMarkdown?`~${pt(P)} tok`:`Empty`,iconNode:i(X,{className:`h-4 w-4`,strokeWidth:2.2})})]})]})]}),i(`div`,{className:`h-px bg-gradient-to-r from-transparent via-black/[0.06] to-transparent dark:via-white/[0.06]`}),i(`div`,{className:`flex flex-col gap-3`,children:[i(bt,{icon:C,title:`Connected MCPs`}),i(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A.map(e=>i(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-bold ${e.kind===`code_ux`?`border-signal-500/25 bg-signal-500/[0.1] text-signal-700 dark:text-signal-200`:`border-black/[0.08] bg-white/55 text-slate-600 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-300`}`,children:[e.kind===`code_ux`?i(C,{className:`h-3 w-3`,strokeWidth:2.4}):i(_,{className:`h-3 w-3`,strokeWidth:2.4}),e.label]},e.id)),j>0&&i(`span`,{className:`text-[11px] font-bold text-slate-400 dark:text-slate-500`,children:[`+`,j]}),k.length===0&&i(`span`,{className:`inline-flex items-center rounded-full border border-black/[0.06] bg-white/50 px-2.5 py-1 text-[11px] font-bold text-slate-400 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-500`,children:`No MCP servers`})]})]}),i(yt,{preset:t}),i(`div`,{className:`flex flex-col gap-2`,children:[i(bt,{icon:X,title:`System Instructions`,action:t.instructionMarkdown?i(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-black/[0.06] bg-white/60 px-1.5 py-0.5 font-mono text-[9px] font-bold uppercase tracking-[0.14em] text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-400`,children:[`~`,pt(P),` tok`]}):void 0}),t.instructionMarkdown?i(`div`,{className:`flex flex-col gap-2`,children:[i(`div`,{className:`rounded-2xl border border-black/[0.05] bg-white/40 p-5 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02] ${J}`,dangerouslySetInnerHTML:{__html:he(x?t.instructionMarkdown:M.excerpt)}}),M.truncated&&i(`button`,{type:`button`,onClick:()=>S(e=>!e),className:`inline-flex w-fit items-center gap-1.5 rounded-full border border-black/[0.06] bg-white/60 px-3 py-1 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 backdrop-blur-md transition-colors hover:bg-white hover:text-slate-900 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-300 dark:hover:bg-white/[0.08] dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,"aria-expanded":x,children:x?i(e,{children:[i($,{className:`h-3 w-3`,strokeWidth:2.5}),`Show less`]}):i(e,{children:[i(Pe,{className:`h-3 w-3`,strokeWidth:2.5}),`Show full (`,t.instructionMarkdown.length.toLocaleString(),` chars)`]})})]}):i(`div`,{className:`rounded-2xl border border-black/[0.05] bg-white/40 p-5 text-sm italic leading-relaxed text-slate-400 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02] dark:text-slate-500`,children:`No instructions provided.`})]}),t.memoryTemplateOverrideEnabled&&t.memoryTemplateMarkdown&&i(`div`,{className:`flex flex-col gap-2`,children:[i(bt,{icon:v,title:`Memory Template Override`,tone:`violet`,action:i(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-violet-500/20 bg-violet-500/[0.06] px-1.5 py-0.5 font-mono text-[9px] font-bold uppercase tracking-[0.14em] text-violet-600 dark:text-violet-400`,children:[`~`,pt(R),` tok`]})}),i(`div`,{className:`rounded-2xl border border-violet-500/15 bg-violet-500/[0.04] p-5 backdrop-blur-md dark:border-violet-500/15 dark:bg-violet-500/[0.06] prose prose-sm max-w-none text-slate-950 dark:text-slate-300 prose-headings:font-display prose-headings:tracking-tight prose-headings:text-slate-950 dark:prose-headings:text-white prose-p:text-slate-950 dark:prose-p:text-slate-300 prose-li:text-slate-950 dark:prose-li:text-slate-300 prose-strong:text-slate-950 dark:prose-strong:text-white prose-em:text-slate-950 dark:prose-em:text-slate-300 prose-blockquote:text-slate-600 prose-blockquote:border-slate-300 dark:prose-blockquote:text-slate-400 dark:prose-blockquote:border-slate-700 prose-table:text-slate-950 prose-th:text-slate-950 prose-td:text-slate-950 dark:prose-table:text-slate-300 dark:prose-th:text-white dark:prose-td:text-slate-300 prose-a:text-slate-600 dark:prose-a:text-slate-400 prose-a:underline prose-code:text-slate-600 dark:prose-code:text-slate-400 prose-code:bg-slate-500/[0.06] prose-code:px-1 prose-code:rounded-md prose-pre:bg-black/[0.04] dark:prose-pre:bg-white/[0.04]`,dangerouslySetInnerHTML:{__html:he(w?t.memoryTemplateMarkdown:L.excerpt)}}),L.truncated&&i(`button`,{type:`button`,onClick:()=>T(e=>!e),className:`inline-flex w-fit items-center gap-1.5 rounded-full border border-violet-500/15 bg-violet-500/[0.06] px-3 py-1 text-[10px] font-bold uppercase tracking-[0.14em] text-violet-600 transition-colors hover:bg-violet-500/[0.12] dark:text-violet-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-violet-500/30`,"aria-expanded":w,children:w?i(e,{children:[i($,{className:`h-3 w-3`,strokeWidth:2.5}),`Show less`]}):i(e,{children:[i(Pe,{className:`h-3 w-3`,strokeWidth:2.5}),`Show full (`,t.memoryTemplateMarkdown.length.toLocaleString(),` chars)`]})})]}),t.sourcePath&&i(`div`,{className:`flex items-center gap-3 rounded-2xl border border-black/[0.05] bg-white/30 px-5 py-3 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-black/[0.04] text-slate-400 dark:bg-white/[0.05] dark:text-slate-400`,children:i(ke,{className:`h-4 w-4`,strokeWidth:2.2})}),i(`div`,{className:`min-w-0`,children:[i(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Markdown Source`}),i(`div`,{className:`break-all font-mono text-[11px] text-slate-500 dark:text-slate-400`,children:t.sourcePath})]})]}),i(`div`,{className:`flex flex-wrap items-center gap-3 border-t border-black/[0.04] pt-6 dark:border-white/[0.04]`,children:[t.sourcePath&&i(`button`,{type:`button`,onClick:()=>u(t.id),disabled:p||t.syncStatus===`manual`,className:`inline-flex items-center gap-2 rounded-full border border-signal-500/20 bg-signal-500/8 px-4 py-2 text-[10px] font-bold uppercase tracking-[0.14em] text-signal-600 transition-colors hover:bg-signal-500/15 disabled:cursor-not-allowed disabled:opacity-50 dark:text-signal-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:[p?i(F,{className:`h-3.5 w-3.5 animate-spin`,strokeWidth:2.2}):i(Ue,{className:`h-3.5 w-3.5`,strokeWidth:2.2}),`Import`]}),i(`button`,{type:`button`,onClick:()=>l(t.id),disabled:f,className:`inline-flex items-center gap-2 rounded-full border border-status-red/20 bg-status-red/8 px-4 py-2 text-[10px] font-bold uppercase tracking-[0.14em] text-status-red transition-colors hover:border-status-red/30 hover:bg-status-red/20 disabled:cursor-not-allowed disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-status-red/30`,children:[f?i(F,{className:`h-3.5 w-3.5 animate-spin`,strokeWidth:2.2}):i(Re,{className:`h-3.5 w-3.5`,strokeWidth:2.2}),`Delete`]}),i(`span`,{className:`ml-auto font-mono text-[10px] text-slate-400 dark:text-slate-600`,children:t.id})]})]})]})},St=[`architecture`,`codebase`,`context`,`preferences`,`patterns`,`decision`,`error`,`learning`],Ct={tier:`both`,categories:[],minStrength:0,minStrengthPerCategory:{},maxShortTerm:0,maxLongTerm:0};p();var wt=[{value:`short_term`,label:`Short Term`},{value:`both`,label:`Both`},{value:`long_term`,label:`Long Term`}],Tt=1,Et=0,Dt=.05,Ot=e=>e.split(/[\s_-]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),kt=e=>Number.isNaN(e)?0:Math.min(Tt,Math.max(Et,e)),At=e=>`${Math.round(kt(e)*100)}%`,jt=(e,t)=>Math.abs(e-t)<1e-9,Mt=e=>e===0?``:String(e),Nt=e=>e.trim()===``?0:/^\d+$/.test(e)?Number.parseInt(e,10):null,Pt=(e,t)=>e.length===0||e.includes(t),Ft=e=>e.length===0?St:St.filter(t=>e.includes(t)),It=(e,t)=>{if(e.length===0)return St.filter(e=>e!==t);let n=e.includes(t)?e.filter(e=>e!==t):[...e,t];return n.length===St.length?[]:n},Lt=(e,t,n)=>{let r=kt(n),i={...e.minStrengthPerCategory};return jt(r,e.minStrength)?delete i[t]:i[t]=r,{minStrengthPerCategory:i}},Rt=({onClose:e,value:t,onChange:n,disabled:a=!1})=>{let[o,s]=m(!1),c=r(()=>Ft(t.categories),[t.categories]),l=e=>{a||t.tier===e||n({...t,tier:e})},u=e=>{a||n({...t,categories:It(t.categories,e)})},d=e=>{if(a)return;let r=kt(e),i={...t.minStrengthPerCategory};for(let e of St){let t=i[e];t!==void 0&&jt(t,r)&&delete i[e]}n({...t,minStrength:r,minStrengthPerCategory:i})},f=(e,r)=>{a||!Pt(t.categories,e)||n({...t,...Lt(t,e,r)})},p=(e,r)=>{if(a)return;let i=Nt(r);i!==null&&n({...t,[e]:i})};return i(`div`,{className:`flex max-h-[min(78vh,560px)] w-[min(440px,92vw)] flex-col overflow-hidden rounded-[1.9rem] border border-black/[0.06] bg-white/70 shadow-[0_2px_20px_rgba(0,0,0,0.04)] backdrop-blur-2xl dark:border-white/[0.06] dark:bg-void-800/60 dark:shadow-[0_4px_24px_rgba(0,0,0,0.2)]`,children:[i(`div`,{className:`flex items-start justify-between gap-4 border-b border-black/[0.05] bg-white/75 px-5 py-4 backdrop-blur-2xl dark:border-white/[0.05] dark:bg-void-800/70`,children:[i(`div`,{className:`flex min-w-0 items-center gap-3`,children:[i(`div`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-signal-500/10 text-signal-600 dark:bg-signal-500/15 dark:text-signal-400`,children:i(v,{className:`h-5 w-5`,strokeWidth:2.2})}),i(`div`,{className:`min-w-0`,children:[i(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-signal-600 dark:text-signal-400`,children:`Agents & Memory`}),i(`h2`,{className:`truncate font-display text-lg font-black tracking-tight text-slate-900 dark:text-white`,children:`Memory Injection`})]})]}),i(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[i(`button`,{type:`button`,onClick:e,"aria-label":`Close`,disabled:a,className:`flex h-8 w-8 items-center justify-center rounded-full border border-black/[0.08] bg-white/60 text-slate-500 transition-colors hover:bg-white hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:bg-white/[0.08] dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:i(be,{className:`h-4 w-4`,strokeWidth:2.4})}),i(`button`,{type:`button`,onClick:()=>{a||n({...Ct,categories:[],minStrengthPerCategory:{}})},disabled:a,className:`inline-flex items-center gap-1.5 rounded-full border border-black/[0.06] bg-white/60 px-2.5 py-1 text-[9px] font-bold uppercase tracking-[0.14em] text-slate-500 transition-colors hover:bg-white hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:bg-white/[0.08] dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:`Defaults`})]})]}),i(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-5 py-5`,children:[i(`section`,{className:`rounded-2xl border border-black/[0.05] bg-white/35 p-4 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:i(`div`,{children:[i(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:`Tier`}),i(`p`,{className:`mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:`Choose whether this agent receives short-term, long-term, or both memory scopes.`})]})}),i(`div`,{className:`flex items-center gap-1 rounded-full border border-black/[0.06] bg-white/50 p-1 dark:border-white/[0.06] dark:bg-white/[0.03]`,children:wt.map(e=>{let n=t.tier===e.value;return i(`button`,{type:`button`,onClick:()=>l(e.value),"aria-pressed":n,disabled:a,className:`inline-flex flex-1 items-center justify-center rounded-full px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.1em] transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 ${n?`bg-signal-500 text-void-900 shadow-[0_0_12px_rgba(0,224,160,0.25)]`:`text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-white`} disabled:cursor-not-allowed disabled:opacity-50`,children:e.label},e.value)})})]}),i(`section`,{className:`rounded-2xl border border-black/[0.05] bg-white/35 p-4 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[i(`div`,{children:[i(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:`Categories`}),i(`p`,{className:`mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:`Empty means all categories are included.`})]}),i(`button`,{type:`button`,onClick:()=>{a||n({...t,categories:[]})},disabled:a,className:`inline-flex items-center rounded-full border border-black/[0.06] bg-white/60 px-2.5 py-1 text-[9px] font-bold uppercase tracking-[0.14em] text-slate-500 transition-colors hover:bg-white hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:bg-white/[0.08] dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:`Select All`})]}),i(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:St.map(e=>{let n=Pt(t.categories,e),r=Ot(e);return i(`button`,{type:`button`,onClick:()=>u(e),"aria-pressed":n,disabled:a,className:`inline-flex items-center justify-between gap-2 rounded-2xl border px-3 py-2 text-left text-[11px] font-bold transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:cursor-not-allowed disabled:opacity-50 ${n?`border-signal-500/30 bg-signal-500/10 text-signal-700 dark:border-signal-500/25 dark:bg-signal-500/15 dark:text-signal-300`:`border-black/[0.06] bg-white/50 text-slate-500 hover:border-signal-500/20 hover:text-slate-700 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400 dark:hover:text-slate-200`}`,children:[i(`span`,{className:`min-w-0 truncate`,children:r}),n&&i(U,{className:`h-3.5 w-3.5 shrink-0`,strokeWidth:2.8})]},e)})})]}),i(`section`,{className:`rounded-2xl border border-black/[0.05] bg-white/35 p-4 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[i(`div`,{children:[i(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:`Minimum Strength`}),i(`p`,{className:`mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:`0% means no minimum.`})]}),i(`button`,{type:`button`,onClick:()=>s(e=>!e),disabled:a,className:`inline-flex items-center gap-1 rounded-full border border-black/[0.06] bg-white/60 px-2.5 py-1 text-[9px] font-bold uppercase tracking-[0.14em] text-slate-500 transition-colors hover:bg-white hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:bg-white/[0.08] dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,"aria-expanded":o,children:[`Per-category overrides`,i(o?$:Pe,{className:`h-3 w-3`,strokeWidth:2.4})]})]}),i(`div`,{className:`flex flex-col gap-3`,children:[i(`div`,{className:`rounded-2xl border border-black/[0.05] bg-white/45 p-3 dark:border-white/[0.05] dark:bg-white/[0.03]`,children:[i(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[i(`label`,{htmlFor:`agent-memory-min-strength`,className:`text-[11px] font-bold text-slate-700 dark:text-slate-200`,children:`Global minimum`}),i(`span`,{className:`font-mono text-[11px] font-bold text-slate-500 dark:text-slate-400`,children:At(t.minStrength)})]}),i(`input`,{id:`agent-memory-min-strength`,type:`range`,min:Et,max:Tt,step:Dt,value:t.minStrength,disabled:a,onInput:e=>d(Number(e.currentTarget.value)),"aria-label":`Minimum strength`,className:`w-full accent-signal-500`})]}),o&&i(`div`,{className:`flex flex-col gap-2`,children:[c.map(e=>{let n=t.minStrengthPerCategory[e]??t.minStrength,r=Ot(e),o=`agent-memory-min-strength-${e}`;return i(`div`,{className:`rounded-2xl border border-black/[0.05] bg-white/40 p-3 dark:border-white/[0.05] dark:bg-white/[0.03]`,children:[i(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[i(`label`,{htmlFor:o,className:`text-[11px] font-bold text-slate-700 dark:text-slate-200`,children:r}),i(`span`,{className:`font-mono text-[11px] font-bold text-slate-500 dark:text-slate-400`,children:At(n)})]}),i(`input`,{id:o,type:`range`,min:Et,max:Tt,step:Dt,value:n,disabled:a,onInput:t=>f(e,Number(t.currentTarget.value)),"aria-label":`${r} minimum strength`,className:`w-full accent-signal-500`})]},e)}),c.length===0&&i(`div`,{className:`rounded-2xl border border-dashed border-black/[0.08] bg-white/30 px-4 py-3 text-[12px] leading-relaxed text-slate-400 dark:border-white/[0.08] dark:bg-white/[0.02] dark:text-slate-500`,children:`No categories selected for injection.`})]})]})]}),i(`section`,{className:`rounded-2xl border border-black/[0.05] bg-white/35 p-4 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`mb-3`,children:[i(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:`Max Memories`}),i(`p`,{className:`mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:`Use 0 for unlimited.`})]}),i(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[i(`label`,{className:`flex flex-col gap-2`,children:[i(`span`,{className:`text-[11px] font-bold text-slate-700 dark:text-slate-200`,children:`Max Short Term`}),i(`input`,{type:`number`,min:0,step:1,inputMode:`numeric`,value:Mt(t.maxShortTerm),placeholder:`Unlimited`,disabled:a,onInput:e=>p(`maxShortTerm`,e.currentTarget.value),"aria-label":`Max Short Term`,className:`rounded-2xl border border-black/[0.05] bg-white/45 px-4 py-3 text-[13px] font-medium text-slate-900 outline-none transition-all placeholder-slate-400 focus:border-signal-500 focus:ring-4 focus:ring-signal-500/10 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.07] dark:bg-white/[0.03] dark:text-white dark:placeholder-slate-600 dark:focus:ring-signal-500/15`})]}),i(`label`,{className:`flex flex-col gap-2`,children:[i(`span`,{className:`text-[11px] font-bold text-slate-700 dark:text-slate-200`,children:`Max Long Term`}),i(`input`,{type:`number`,min:0,step:1,inputMode:`numeric`,value:Mt(t.maxLongTerm),placeholder:`Unlimited`,disabled:a,onInput:e=>p(`maxLongTerm`,e.currentTarget.value),"aria-label":`Max Long Term`,className:`rounded-2xl border border-black/[0.05] bg-white/45 px-4 py-3 text-[13px] font-medium text-slate-900 outline-none transition-all placeholder-slate-400 focus:border-signal-500 focus:ring-4 focus:ring-signal-500/10 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.07] dark:bg-white/[0.03] dark:text-white dark:placeholder-slate-600 dark:focus:ring-signal-500/15`})]})]})]})]})]})};p();var zt=({agentPresetId:e,projectId:t,disabled:a,onSubscriptionsChanged:o})=>{let[s,c]=m([]),[l,u]=m(new Set),[d,p]=m(``),[h,g]=m(!0),[_,v]=m(null),[y,b]=m(null);f(()=>{let n=!1;return g(!0),Promise.all([ze(t).catch(()=>[]),Be(e).catch(()=>[])]).then(([e,t])=>{n||(c(e),u(new Set(t)),p(``),g(!1))}),()=>{n=!0}},[t,e]);let x=n(async(t,n)=>{u(t),v(n),b(null);try{let n=await Ve(e,[...t]);u(new Set(n)),o?.(n)}catch(e){b(e instanceof Error?e.message:`Failed to update subscription`),u(l)}finally{v(null)}},[e,o,l]),S=n(async e=>{let t=new Set(l);t.has(e)?t.delete(e):t.add(e),await x(t,e)},[x,l]),C=l.size,w=r(()=>{let e=d.trim().toLowerCase();return e?s.filter(t=>[t.title,t.summary,t.sourceRef||``,t.sourceType].some(t=>t.toLowerCase().includes(e))):s},[s,d]),T=r(()=>w.map(e=>e.id),[w]),D=T.filter(e=>l.has(e)).length,O=T.length>0&&D===T.length,k=n(async()=>{let e=new Set(l);for(let t of T)e.add(t);await x(e,`__bulk__`)},[T,x,l]),A=n(async()=>{let e=new Set(l);for(let t of T)e.delete(t);await x(e,`__bulk__`)},[T,x,l]),j=r(()=>s.filter(e=>l.has(e.id)&&e.status===`ready`).reduce((e,t)=>e+Math.max(8,Math.ceil((t.summary.length+t.title.length)/4)),0),[s,l]);return h?i(`div`,{className:`flex items-center justify-center py-8 text-slate-400`,children:i(le,{className:`h-5 w-5 animate-spin`})}):s.length===0?i(`div`,{className:`flex flex-col items-center gap-3 rounded-2xl border border-dashed border-black/[0.08] px-6 py-10 text-center dark:border-white/[0.08]`,children:[i(ue,{className:`h-7 w-7 text-slate-300 dark:text-slate-600`,strokeWidth:1.8}),i(`p`,{className:`text-sm font-semibold text-slate-500 dark:text-slate-400`,children:`The knowledge library is empty.`}),i(`a`,{href:`/knowledge`,className:`inline-flex items-center gap-1.5 text-[12px] font-bold text-signal-600 hover:underline dark:text-signal-400`,children:[`Add documents on the Knowledge page `,i(q,{className:`h-3 w-3`})]})]}):i(`div`,{className:`flex flex-col gap-3`,children:[i(`div`,{className:`flex items-center justify-between text-[11px] font-semibold text-slate-400 dark:text-slate-500`,children:[i(`span`,{children:[C,` subscribed · `,s.length,` in library`]}),C>0&&i(`span`,{children:[`~`,j,` tok manifest`]})]}),i(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[i(`div`,{className:`relative min-w-0 flex-1`,children:[i(ae,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400`,strokeWidth:2.4}),i(`input`,{type:`search`,value:d,onInput:e=>p(e.currentTarget.value),placeholder:`Search knowledge`,className:`w-full rounded-xl border border-black/[0.06] bg-white/50 py-2 pl-8 pr-3 text-[12px] font-medium text-slate-700 outline-none transition-colors placeholder:text-slate-400 focus:border-signal-500/40 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-200 dark:placeholder:text-slate-500`})]}),i(`div`,{className:`flex items-center gap-1.5`,children:[i(`button`,{type:`button`,disabled:a||_!==null||T.length===0||O,onClick:()=>void k(),className:`inline-flex items-center gap-1.5 rounded-xl border border-black/[0.06] bg-white/45 px-2.5 py-2 text-[11px] font-bold text-slate-500 transition-colors hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-300 dark:hover:bg-white/[0.07] dark:hover:text-white`,children:[_===`__bulk__`?i(le,{className:`h-3.5 w-3.5 animate-spin`}):i(E,{className:`h-3.5 w-3.5`,strokeWidth:2.3}),`Select all`]}),i(`button`,{type:`button`,disabled:a||_!==null||T.length===0||D===0,onClick:()=>void A(),className:`inline-flex items-center gap-1.5 rounded-xl border border-black/[0.06] bg-white/45 px-2.5 py-2 text-[11px] font-bold text-slate-500 transition-colors hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-300 dark:hover:bg-white/[0.07] dark:hover:text-white`,children:[i(Fe,{className:`h-3.5 w-3.5`,strokeWidth:2.3}),`Unselect all`]})]})]}),y&&i(`p`,{className:`text-[12px] text-status-red`,children:y}),i(`div`,{className:`flex max-h-72 flex-col gap-1.5 overflow-y-auto pr-1`,children:w.length===0?i(`div`,{className:`rounded-xl border border-dashed border-black/[0.08] px-4 py-8 text-center text-[12px] font-semibold text-slate-400 dark:border-white/[0.08] dark:text-slate-500`,children:`No matching knowledge documents.`}):w.map(e=>{let t=l.has(e.id),n=e.status===`ready`;return i(`button`,{type:`button`,disabled:a||_!==null,onClick:()=>S(e.id),className:`flex items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-colors disabled:opacity-60 ${t?`border-signal-500/30 bg-signal-500/[0.07]`:`border-black/[0.06] bg-white/40 hover:bg-white/70 dark:border-white/[0.06] dark:bg-white/[0.02] dark:hover:bg-white/[0.05]`}`,children:[i(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg ${t?`bg-signal-500 text-slate-900 dark:text-void-900`:`bg-black/[0.05] text-slate-400 dark:bg-white/[0.06]`}`,children:_===e.id?i(le,{className:`h-3.5 w-3.5 animate-spin`}):t?i(U,{className:`h-4 w-4`,strokeWidth:3}):i(X,{className:`h-3.5 w-3.5`,strokeWidth:2.2})}),i(`div`,{className:`min-w-0 flex-1`,children:[i(`div`,{className:`truncate text-[13px] font-semibold text-slate-700 dark:text-slate-200`,children:e.title}),e.summary&&i(`div`,{className:`truncate text-[11px] text-slate-400 dark:text-slate-500`,children:e.summary})]}),i(`span`,{className:`shrink-0 text-[10px] font-bold ${n?`text-slate-400`:`text-amber-500`}`,children:n?`${e.chunkCount} chunks`:e.status===`error`?`error`:`embedding…`})]},e.id)})})]})};function Bt({label:e,options:t,value:n,onChange:r,disabled:a}){return i(`div`,{className:`flex flex-col gap-2`,children:[i(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:e}),i(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>{let t=n===e.id;return i(`button`,{type:`button`,disabled:a,onClick:()=>r(e.id),"aria-pressed":t,className:`rounded-xl px-3 py-2 text-[11px] font-bold transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:cursor-not-allowed disabled:opacity-50 ${t?`bg-signal-500 text-void-900 shadow-[0_0_14px_rgba(0,224,160,0.25)]`:`border border-black/[0.06] bg-white/55 text-slate-500 hover:border-signal-500/30 hover:bg-signal-500/[0.08] hover:text-signal-600 dark:border-white/[0.07] dark:bg-white/[0.03] dark:text-slate-300 dark:hover:border-signal-500/30 dark:hover:text-signal-400`}`,children:e.label},e.id)})})]})}function Vt({label:e,options:t,value:n,onChange:r,disabled:a}){let o=t.find(e=>e.id===n);return i(`div`,{className:`flex flex-col gap-2`,children:[i(`div`,{className:`flex items-baseline justify-between gap-2`,children:[i(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:e}),o&&i(`span`,{className:`text-[9px] font-semibold text-slate-400 dark:text-slate-500`,children:o.label})]}),i(`div`,{className:`flex flex-wrap gap-2.5`,children:t.map(e=>{let t=n===e.id;return i(`button`,{type:`button`,disabled:a,onClick:()=>r(e.id),title:e.label,"aria-label":e.label,"aria-pressed":t,className:`group relative h-8 w-8 rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:cursor-not-allowed disabled:opacity-50 ${t?`scale-110 ring-2 ring-signal-500/60 ring-offset-2 ring-offset-white dark:ring-offset-void-800`:`ring-1 ring-black/[0.08] hover:scale-110 dark:ring-white/[0.08]`}`,style:{backgroundColor:e.hex},children:t&&i(`span`,{className:`absolute inset-0 flex items-center justify-center text-[9px] font-black text-white drop-shadow-sm`,children:`✓`})},e.id)})})]})}function Ht({icon:e,title:t,children:n}){return i(`div`,{className:`flex flex-col gap-4 rounded-2xl border border-black/[0.05] bg-white/40 p-4 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`flex h-6 w-6 items-center justify-center rounded-lg bg-signal-500/10 text-signal-600 dark:bg-signal-500/15 dark:text-signal-400`,children:i(e,{className:`h-3.5 w-3.5`,strokeWidth:2.4})}),i(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 dark:text-slate-400`,children:t})]}),n]})}function Ut({config:e,onChange:t,className:n=``,disabled:r=!1}){let a=()=>{t(oe(Date.now().toString(36)+Math.random().toString(36).substring(2)))},o=(n,r)=>{t({...e,[n]:r})};return i(`div`,{className:`flex flex-col gap-4 ${n}`,children:[i(`div`,{className:`flex items-center justify-between`,children:[i(`p`,{className:`text-[11px] leading-relaxed text-slate-500 dark:text-slate-400`,children:`Tweak parts and colors — the portrait updates live.`}),i(`button`,{type:`button`,onClick:a,disabled:r,className:`group/rnd inline-flex shrink-0 items-center gap-1.5 rounded-full border border-black/[0.06] bg-white/60 px-3 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 transition-colors hover:bg-signal-500/[0.1] hover:text-signal-600 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:text-signal-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:[i(F,{className:`h-3 w-3 transition-transform duration-500 group-hover/rnd:rotate-180`,strokeWidth:2.4}),`Randomize`]})]}),i(Ht,{icon:Je,title:`Form`,children:[i(Bt,{label:`Chassis`,options:B,value:e.chassis,onChange:e=>o(`chassis`,e),disabled:r}),i(Bt,{label:`Eyes`,options:De,value:e.eyes,onChange:e=>o(`eyes`,e),disabled:r}),i(Bt,{label:`Antenna`,options:W,value:e.antenna,onChange:e=>o(`antenna`,e),disabled:r}),i(Bt,{label:`Headphones`,options:ne,value:e.headphones,onChange:e=>o(`headphones`,e),disabled:r}),i(Bt,{label:`Aura`,options:de,value:e.wings,onChange:e=>o(`wings`,e),disabled:r})]}),i(Ht,{icon:Ke,title:`Palette`,children:[i(Vt,{label:`Base Color`,options:te,value:e.baseColor,onChange:e=>o(`baseColor`,e),disabled:r}),i(Vt,{label:`Accent Color`,options:ce,value:e.accent,onChange:e=>o(`accent`,e),disabled:r}),i(Vt,{label:`Visor Color`,options:G,value:e.visorColor,onChange:e=>o(`visorColor`,e),disabled:r})]})]})}p();var Wt={orchestration:{label:`Orchestration`,description:`Projects, sprints, and tasks`,icon:g},agents_memory:{label:`Agents & Memory`,description:`Agent presets and project memory`,icon:v},platform:{label:`Platform`,description:`Settings, previews, and telemetry`,icon:x},advanced:{label:`Advanced`,description:`Deprecated and low-level tools`,icon:O}},Gt=[`orchestration`,`agents_memory`,`platform`,`advanced`],Kt=e=>Z.map(t=>({name:t.name,enabled:e(t.name),isInternal:!0})),qt=({onClose:e,value:t,onChange:n,availableServers:a})=>{let o=r(()=>{let e=new Map;for(let n of t.codeUxToolToggles)e.set(n.name,n.enabled);return e},[t.codeUxToolToggles]),s=e=>o.get(e)??!0,c=e=>n({...t,codeUxEnabled:e}),l=(e,r)=>n({...t,codeUxToolToggles:Kt(t=>t===e?r:s(t))}),u=(e,r)=>{let i=new Set(Z.filter(t=>t.category===e).map(e=>e.name));n({...t,codeUxToolToggles:Kt(e=>i.has(e)?r:s(e))})},d=e=>t.linkedServerIds.includes(e),f=(e,r)=>n({...t,linkedServerIds:r?Array.from(new Set([...t.linkedServerIds,e])):t.linkedServerIds.filter(t=>t!==e)}),p=Z.filter(e=>s(e.name)).length,m=a.filter(e=>d(e.id)).length;return i(`div`,{className:`flex max-h-[min(78vh,560px)] flex-col`,children:[i(`div`,{className:`flex items-start justify-between gap-4 border-b border-black/[0.06] px-5 py-4 dark:border-white/[0.06]`,children:[i(`div`,{className:`flex items-center gap-3`,children:[i(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-2xl bg-signal-500/10 text-signal-600 dark:bg-signal-500/15 dark:text-signal-400`,children:i(_,{className:`h-4.5 w-4.5`,strokeWidth:2.2})}),i(`div`,{children:[i(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.18em] text-signal-600 dark:text-signal-400`,children:`MCP Access`}),i(`h2`,{className:`font-display text-lg font-black tracking-tight text-slate-900 dark:text-white`,children:`Connected Servers`})]})]}),i(`button`,{type:`button`,onClick:e,"aria-label":`Close`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-black/[0.08] bg-white/60 text-slate-500 transition-colors hover:bg-white hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:bg-white/[0.08] dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:i(be,{className:`h-4 w-4`,strokeWidth:2.4})})]}),i(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-5 py-5`,children:[i(`section`,{className:`rounded-2xl border border-black/[0.06] bg-white/40 p-5 backdrop-blur-md dark:border-white/[0.06] dark:bg-white/[0.02]`,children:[i(`div`,{className:`flex items-start justify-between gap-4`,children:[i(`div`,{className:`flex items-center gap-3`,children:[i(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-signal-500/10 text-signal-600 dark:bg-signal-500/15 dark:text-signal-400`,children:i(C,{className:`h-4.5 w-4.5`,strokeWidth:2.2})}),i(`div`,{children:[i(`div`,{className:`text-sm font-bold text-slate-800 dark:text-slate-100`,children:`Code UX (built-in)`}),i(`p`,{className:`text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:t.codeUxEnabled?`${p}/${Z.length} tools enabled`:`Disabled for this agent`})]})]}),i(Ne,{value:t.codeUxEnabled,onChange:c,"aria-label":`Enable Code UX for this agent`})]}),t.codeUxEnabled&&i(`div`,{className:`mt-4 flex flex-col gap-3 border-t border-black/[0.05] pt-4 dark:border-white/[0.05]`,children:Gt.map(e=>{let t=Wt[e],n=Z.filter(t=>t.category===e);if(n.length===0)return null;let r=n.every(e=>s(e.name)),a=t.icon;return i(`div`,{className:`rounded-xl border border-black/[0.05] bg-white/40 p-3.5 dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`flex items-center justify-between gap-3`,children:[i(`div`,{className:`flex items-center gap-2.5`,children:[i(a,{className:`h-4 w-4 text-slate-500 dark:text-slate-400`,strokeWidth:2.2}),i(`div`,{children:[i(`div`,{className:`text-[12px] font-bold text-slate-700 dark:text-slate-200`,children:t.label}),i(`div`,{className:`text-[10px] text-slate-400 dark:text-slate-500`,children:t.description})]})]}),i(Ne,{value:r,onChange:t=>u(e,t),"aria-label":`Enable all ${t.label} tools`})]}),i(`div`,{className:`mt-2.5 flex flex-col gap-1.5 border-t border-black/[0.04] pt-2.5 dark:border-white/[0.04]`,children:n.map(e=>i(`div`,{className:`flex items-center justify-between gap-3 pl-6`,children:[i(`div`,{className:`min-w-0`,children:[i(`div`,{className:`truncate font-mono text-[11px] font-semibold text-slate-600 dark:text-slate-300`,children:e.name}),i(`div`,{className:`truncate text-[10px] text-slate-400 dark:text-slate-500`,children:e.description})]}),i(Ne,{value:s(e.name),onChange:t=>l(e.name,t),"aria-label":`Enable ${e.name}`})]},e.name))})]},e)})})]}),i(`section`,{className:`flex flex-col gap-2.5`,children:[i(`div`,{className:`flex items-center justify-between px-1`,children:[i(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:`Custom MCP servers`}),i(`span`,{className:`text-[10px] font-bold text-slate-400 dark:text-slate-500`,children:[m,`/`,a.length,` linked`]})]}),a.length===0?i(`div`,{className:`rounded-2xl border border-dashed border-black/[0.08] bg-white/30 px-5 py-6 text-center text-[12px] leading-relaxed text-slate-400 dark:border-white/[0.08] dark:bg-white/[0.02] dark:text-slate-500`,children:`No custom MCP servers configured. Add them in Settings → MCP, then link them here.`}):a.map(e=>i(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-black/[0.06] bg-white/40 px-4 py-3.5 backdrop-blur-md dark:border-white/[0.06] dark:bg-white/[0.02]`,children:[i(`div`,{className:`flex min-w-0 items-center gap-3`,children:[i(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-black/[0.04] text-slate-500 dark:bg-white/[0.05] dark:text-slate-300`,children:i(_,{className:`h-4 w-4`,strokeWidth:2.2})}),i(`div`,{className:`min-w-0`,children:[i(`div`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`truncate text-sm font-semibold text-slate-800 dark:text-slate-100`,children:e.label||e.name}),i(`span`,{className:`inline-flex h-5 items-center rounded-full border border-black/[0.08] bg-black/[0.03] px-2 text-[8px] font-bold uppercase tracking-[0.14em] text-slate-400 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-500`,children:e.transport===`stdio`?`stdio`:`HTTP`}),e.enabled===!1&&i(`span`,{className:`inline-flex h-5 items-center rounded-full border border-amber-400/20 bg-amber-400/[0.08] px-2 text-[8px] font-bold uppercase tracking-[0.14em] text-amber-600 dark:text-amber-400`,children:`Off in settings`})]}),i(`div`,{className:`truncate text-[11px] text-slate-400 dark:text-slate-500`,children:e.description||(e.transport===`stdio`?e.command:e.url)||``})]})]}),i(Ne,{value:d(e.id),onChange:t=>f(e.id,t),"aria-label":`Link ${e.label||e.name}`})]},e.id))]})]}),i(`div`,{className:`flex items-center justify-end gap-3 border-t border-black/[0.06] px-5 py-4 dark:border-white/[0.06]`,children:i(`button`,{type:`button`,onClick:e,className:`inline-flex items-center gap-2 rounded-full bg-signal-500 px-5 py-2.5 text-[12px] font-bold uppercase tracking-[0.12em] text-void-900 shadow-[0_0_24px_rgba(0,224,160,0.28)] transition-all hover:scale-[1.03] hover:bg-signal-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:[i(U,{className:`h-3.5 w-3.5`,strokeWidth:2.5}),`Done`]})})]})};p(),a();var Jt=({children:r,content:a,position:s=`bottom`,align:c=`center`,gap:l=8,className:p=``,isOpen:h,onOpenChange:g,triggerRef:_,isTooltip:v=!1})=>{let y=M(),b=_e(),[x,S]=m(!1),C=o(null),w=_||C,T=o(null),E=o(null),[D,O]=m({top:0,left:0}),[k]=m(()=>`popover-${Math.random().toString(36).substr(2,9)}`),A=n(()=>{if(!w.current||!T.current)return;let{top:e,left:t}=Ae({triggerRect:w.current.getBoundingClientRect(),contentRect:T.current.getBoundingClientRect(),position:s,align:c,gap:l,padding:8});O({top:e,left:t})},[c,l,s,w]);return f(()=>{h?(S(!0),v||(E.current=document.activeElement)):x&&(v||(!document.activeElement||document.activeElement===document.body||T.current&&T.current.contains(document.activeElement))&&(E.current?.isConnected?(E.current.focus({preventScroll:!0}),E.current=null):w.current?.isConnected&&w.current.focus({preventScroll:!0})))},[h,v]),d(()=>{h&&x&&A()},[h,x,A]),f(()=>{if(h)return window.addEventListener(`resize`,A),window.addEventListener(`scroll`,A,{capture:!0,passive:!0}),()=>{window.removeEventListener(`resize`,A),window.removeEventListener(`scroll`,A,{capture:!0})}},[h,A]),d(()=>{T.current&&(Q.killTweensOf(T.current),h?Q.fromTo(T.current,{opacity:0,scale:.95,y:s===`bottom`?-5:s===`top`?5:0},{opacity:1,scale:1,y:0,duration:y?0:b.enterExit.duration,ease:b.enterExit.ease}):x&&Q.to(T.current,{opacity:0,scale:.95,y:s===`bottom`?-5:s===`top`?5:0,duration:y?0:b.enterExit.duration,ease:b.enterExit.ease,onComplete:()=>S(!1)}))},[h,x,s,y]),f(()=>{let e=e=>{h&&T.current&&!T.current.contains(e.target)&&w.current&&!w.current.contains(e.target)&&g(!1)},t=e=>{e.key===`Escape`&&h&&g(!1)};return h&&(document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t)),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[h,g]),i(e,{children:[t(r)&&(r.type===`button`||r.props.role===`button`)?i(`div`,{ref:_?void 0:C,className:`inline-flex cursor-pointer text-left`,onClick:e=>{g(!h)},"aria-haspopup":v?`true`:`dialog`,"aria-expanded":h,"aria-controls":h?k:void 0,children:r}):i(`button`,{type:`button`,ref:_?void 0:C,className:`inline-flex cursor-pointer text-left`,onClick:()=>g(!h),"aria-haspopup":v?`true`:`dialog`,"aria-expanded":h,"aria-controls":h?k:void 0,children:r}),x&&u(i(`div`,{id:k,ref:T,role:v?`tooltip`:`dialog`,tabIndex:-1,className:`fixed z-[9999] bg-white dark:bg-void-800 border border-black/[0.08] dark:border-white/[0.08] shadow-[0_16px_36px_rgba(15,23,42,0.14)] dark:shadow-[0_16px_36px_rgba(0,0,0,0.4)] rounded-2xl p-4 ${h?``:`pointer-events-none`} ${p}`,style:{top:D.top,left:D.left},children:a}),document.body)]})};p(),s();var Yt=60,Xt=180,Zt=8e3;function Qt({name:e,description:t,instruction:n,memoryEnabled:r,memory:i}){let a={},o=e.trim();return o?o.length>Yt&&(a.name=`Name must be ${Yt} characters or fewer`):a.name=`Name is required`,t.trim().length>Xt&&(a.description=`Description must be ${Xt} characters or fewer`),n.length>Zt*1.5&&(a.instruction=`Instructions exceed safe limit (${n.length.toLocaleString()} / ${(Zt*1.5).toLocaleString()})`),r&&i.trim().length===0&&(a.memory=`Provide an override or disable the toggle`),a}var $t=({icon:e,label:t,htmlFor:n,helper:r,required:a,counter:o,error:s,errorId:c,children:l})=>i(`div`,{className:`flex flex-col gap-2`,children:[i(`div`,{className:`flex items-center justify-between gap-3`,children:[i(`label`,{htmlFor:n,className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 dark:text-slate-400`,children:[i(e,{className:`h-3 w-3`,strokeWidth:2.4}),t,a&&i(`span`,{className:`text-signal-500`,children:`*`})]}),o&&i(`span`,{className:`font-mono text-[10px] font-bold text-slate-400 dark:text-slate-500`,children:o})]}),l,r&&!s&&i(`p`,{className:`text-[11px] leading-relaxed text-slate-400 dark:text-slate-500`,children:r}),s&&i(`p`,{id:c,role:`alert`,className:`flex items-center gap-1.5 text-[11px] font-medium text-status-red`,children:[i(pe,{className:`h-3.5 w-3.5 shrink-0`,strokeWidth:2.4}),s]})]}),en=({icon:e,eyebrow:t,title:n,action:r,className:a=``,children:o})=>i(`section`,{className:`relative flex flex-col gap-5 rounded-[1.6rem] border border-black/[0.05] bg-white/40 p-6 backdrop-blur-xl dark:border-white/[0.05] dark:bg-white/[0.025] ${a}`,children:[i(`header`,{className:`flex items-start justify-between gap-3 border-b border-black/[0.04] pb-4 dark:border-white/[0.04]`,children:[i(`div`,{className:`flex items-center gap-3`,children:[i(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-signal-500/10 text-signal-600 ring-1 ring-inset ring-signal-500/15 dark:bg-signal-500/15 dark:text-signal-400`,children:i(e,{className:`h-4 w-4`,strokeWidth:2.2})}),i(`div`,{className:`flex flex-col gap-0.5`,children:[i(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.2em] text-signal-600 dark:text-signal-400`,children:t}),i(`h3`,{className:`font-display text-lg font-black tracking-tight text-slate-900 dark:text-white`,children:n})]})]}),r]}),o]}),tn=e=>e===0?`0`:e.toFixed(2).replace(/\.?0+$/,``),nn=e=>{let t=[e.tier===`both`?`Both tiers`:e.tier===`short_term`?`Short term`:`Long term`,e.categories.length===0?`All categories`:`${e.categories.length} category${e.categories.length===1?``:`s`}`];return e.minStrength>0&&t.push(`min ${tn(e.minStrength)}`),e.maxShortTerm>0&&t.push(`${e.maxShortTerm} short-term`),e.maxLongTerm>0&&t.push(`${e.maxLongTerm} long-term`),t.join(` · `)},rn=typeof navigator<`u`&&/Mac|iPhone|iPad/i.test(navigator.platform),an=({preset:t,saving:a,defaultMemoryInstruction:s=``,providerOptions:c=[],availableMcpServers:l=[],onSave:u,onCancel:p})=>{let h=o(null),[g,b]=m(t.name),[C,E]=m(t.description||``),[O,k]=m(t.instructionMarkdown),[A,j]=m(!!t.memoryTemplateOverrideEnabled),[M,P]=m(t.memoryTemplateMarkdown??``),[L,R]=m(t.providerConfigId||``),[ee,te]=m(t.model||``),[z,ne]=m(t.avatarConfig),[B,re]=m(ct(t.mcpAccess??st())),[ae,V]=m(!1),[H,ce]=m(t.memoryConfig??Ct),[le,W]=m(!1),de=o(null),[G,K]=m({}),[fe,q]=m(!1),[me,he]=m(`happy`),[ge,_e]=m(!1),ye=e=>re(ct(e)),xe=N(z?.accent),Se=()=>{ne(oe(Date.now().toString(36)+Math.random().toString(36).substring(2)))};f(()=>{b(t.name),E(t.description||``),k(t.instructionMarkdown),j(!!t.memoryTemplateOverrideEnabled),P(t.memoryTemplateMarkdown??``),R(t.providerConfigId||``),te(t.model||``),ne(t.avatarConfig),re(ct(t.mcpAccess??st())),ce(t.memoryConfig??Ct),W(!1),K({}),_e(!1)},[t.id]),d(()=>{h.current&&Q.fromTo(h.current,{opacity:0,x:16},{opacity:1,x:0,duration:.45,ease:`power3.out`})},[t.id]);let J=r(()=>Qt({name:g,description:C,instruction:O,memoryEnabled:A,memory:M}),[g,C,O,A,M]),Ce=Object.keys(J).length>0,Y=r(()=>!!(ge||g!==t.name||C!==(t.description||``)||O!==t.instructionMarkdown||A!==!!t.memoryTemplateOverrideEnabled||(t.memoryTemplateMarkdown??``)!==M&&A||L!==(t.providerConfigId||``)||ee!==(t.model||``)||JSON.stringify(z??{})!==JSON.stringify(t.avatarConfig??{})||JSON.stringify(B)!==JSON.stringify(ct(t.mcpAccess??st()))||JSON.stringify(H)!==JSON.stringify(t.memoryConfig??Ct)),[g,C,O,A,M,L,ee,z,B,H,t,ge]),Z=a||Ce||!Y,Te=e=>{e.preventDefault(),K({name:!0,description:!0,instruction:!0,memory:!0}),!(Ce||!Y)&&(u(t.id,{name:g.trim(),description:C.trim(),instructionMarkdown:O,memoryTemplateOverrideEnabled:A,memoryTemplateMarkdown:A?M:void 0,providerConfigId:L||null,model:ee.trim()||null,avatarConfig:z,mcpAccess:B,memoryConfig:H}),_e(!1))},Ee=n(()=>{a||(Y?q(!0):p())},[a,Y,p]);f(()=>{let e=e=>{let t=h.current;if(!t)return;let n=document.activeElement;n&&!t.contains(n)||((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`?(e.preventDefault(),Z||t.requestSubmit()):e.key===`Escape`&&(e.preventDefault(),Ee()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Z,Ee]);let De=()=>{P(s)},ke=M.trim()===s.trim()&&s.trim().length>0,Ae=r(()=>nn(H),[H]),je=O.length,Ne=je>Zt,Pe=ft(O),Fe=ft(M),$=c.find(e=>e.value===L)||null,Ie=r(()=>[{id:`code_ux`,label:`Code UX`,active:B.codeUxEnabled,kind:`code_ux`},...l.map(e=>({id:e.id,label:e.label||e.name,active:B.linkedServerIds.includes(e.id),kind:`custom`}))],[B,l]),Re=Ie.slice(0,5),ze=Ie.length-Re.length,Be=Ie.filter(e=>e.active).length,Ve=e=>{e.kind===`code_ux`?ye({...B,codeUxEnabled:!e.active}):ye({...B,linkedServerIds:e.active?B.linkedServerIds.filter(t=>t!==e.id):[...B.linkedServerIds,e.id]})};return i(e,{children:[i(`form`,{ref:h,onSubmit:Te,noValidate:!0,"aria-label":`Edit ${t.name}`,className:`relative flex flex-col overflow-hidden rounded-[1.9rem] border border-black/[0.06] bg-white/70 shadow-[0_2px_20px_rgba(0,0,0,0.04)] backdrop-blur-2xl dark:border-white/[0.06] dark:bg-void-800/60 dark:shadow-[0_4px_24px_rgba(0,0,0,0.2)]`,children:[i(ve,{accentHex:xe}),i(`div`,{className:`sticky top-0 z-20 flex flex-col gap-4 border-b border-black/[0.05] bg-white/75 px-6 py-5 backdrop-blur-2xl md:flex-row md:items-center md:justify-between md:px-8 md:py-6 dark:border-white/[0.05] dark:bg-void-800/70`,children:[i(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[i(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.18em] text-signal-600 dark:text-signal-400`,children:[i(se,{className:`h-3 w-3`,strokeWidth:2.4}),`Editing Agent`,Y&&!a&&i(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-amber-400/30 bg-amber-400/10 px-2 py-0.5 text-[9px] tracking-[0.14em] text-amber-600 dark:text-amber-400`,children:[i(`span`,{className:`h-1 w-1 rounded-full bg-amber-500`}),`Unsaved`]}),!Y&&!a&&i(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-black/[0.06] bg-white/60 px-2 py-0.5 text-[9px] tracking-[0.14em] text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:[i(U,{className:`h-2.5 w-2.5`,strokeWidth:3}),`Saved`]}),a&&i(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-signal-500/30 bg-signal-500/10 px-2 py-0.5 text-[9px] tracking-[0.14em] text-signal-600 dark:text-signal-400`,children:[i(F,{className:`h-2.5 w-2.5 animate-spin`,strokeWidth:2.4}),`Saving`]})]}),i(`h2`,{className:`truncate font-display text-2xl font-black tracking-tight text-slate-900 dark:text-white`,children:g.trim()||`Unnamed Agent`})]}),i(`div`,{className:`flex shrink-0 items-center gap-2`,children:[i(`span`,{className:`hidden font-mono text-[10px] text-slate-400 dark:text-slate-500 md:inline`,children:[rn?`⌘S`:`Ctrl+S`,` to save · Esc to cancel`]}),i(`button`,{type:`button`,onClick:Ee,disabled:a,className:`inline-flex items-center gap-2 rounded-full border border-black/[0.08] bg-white/40 px-4 py-2.5 text-[12px] font-bold uppercase tracking-[0.12em] text-slate-600 backdrop-blur-md transition-colors hover:bg-white/70 hover:text-slate-900 disabled:opacity-50 dark:border-white/[0.08] dark:bg-white/[0.03] dark:text-slate-300 dark:hover:bg-white/[0.06] dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:[i(be,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Cancel`]}),i(`button`,{type:`submit`,disabled:Z,"aria-disabled":Z,className:`inline-flex items-center gap-2 rounded-full bg-signal-500 px-5 py-2.5 text-[12px] font-bold uppercase tracking-[0.12em] text-void-900 shadow-[0_0_24px_rgba(0,224,160,0.28)] transition-all hover:scale-[1.03] hover:bg-signal-400 hover:shadow-[0_0_32px_rgba(0,224,160,0.36)] focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:cursor-not-allowed disabled:bg-slate-200 disabled:text-slate-400 disabled:shadow-none disabled:hover:scale-100 dark:disabled:bg-white/[0.05] dark:disabled:text-slate-500`,children:[a?i(F,{className:`h-3.5 w-3.5 animate-spin`,strokeWidth:2.4}):i(S,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Save Agent`]})]})]}),i(`div`,{className:`flex flex-col gap-6 p-6 md:p-8`,children:[i(`div`,{className:`grid grid-cols-1 gap-6 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[i(en,{icon:D,eyebrow:`Profile`,title:`Identity`,children:[i(at,{config:z,expression:me,accentHex:xe,onExpressionChange:he,onRandomize:a?void 0:Se,heightClass:`h-full`,className:`min-h-[260px] flex-1`,disabled:a}),i($t,{icon:T,label:`Agent Name`,htmlFor:`agent-name`,helper:`Shown across the dashboard, sprints, and worker logs.`,required:!0,counter:`${g.length}/${Yt}`,error:G.name?J.name:void 0,errorId:`agent-name-error`,children:i(`input`,{id:`agent-name`,type:`text`,value:g,onInput:e=>b(e.currentTarget.value),onBlur:()=>K(e=>({...e,name:!0})),placeholder:`e.g. Planning Agent`,maxLength:80,autoComplete:`off`,"aria-required":`true`,"aria-invalid":G.name&&!!J.name,"aria-errormessage":G.name&&J.name?`agent-name-error`:void 0,className:`rounded-2xl border bg-white/40 px-4 py-3 text-base font-medium text-slate-900 outline-none backdrop-blur-md transition-all placeholder-slate-400 focus:border-signal-500 focus:ring-4 focus:ring-signal-500/10 dark:bg-white/[0.03] dark:text-white dark:placeholder-slate-600 dark:focus:ring-signal-500/15 ${G.name&&J.name?`border-status-red/50`:`border-black/[0.05] dark:border-white/[0.07]`}`})}),i($t,{icon:X,label:`Short Description`,htmlFor:`agent-description`,helper:`Used by the Planning agent when it chooses the best coding specialist for each task.`,counter:`${C.length}/${Xt}`,error:G.description?J.description:void 0,errorId:`agent-description-error`,children:i(`textarea`,{id:`agent-description`,value:C,onInput:e=>E(e.currentTarget.value),onBlur:()=>K(e=>({...e,description:!0})),placeholder:`e.g. Frontend specialist for Preact, Tailwind, responsive UI, and accessibility work.`,rows:3,maxLength:240,"aria-invalid":G.description&&!!J.description,"aria-errormessage":G.description&&J.description?`agent-description-error`:void 0,className:`block w-full resize-none rounded-2xl border bg-white/40 px-4 py-3 text-[13px] leading-relaxed text-slate-900 outline-none backdrop-blur-md transition-all placeholder-slate-400 focus:border-signal-500 focus:ring-4 focus:ring-signal-500/10 dark:bg-white/[0.03] dark:text-white dark:placeholder-slate-600 dark:focus:ring-signal-500/15 ${G.description&&J.description?`border-status-red/50`:`border-black/[0.05] dark:border-white/[0.07]`}`})})]}),i(en,{icon:Ke,eyebrow:`Appearance`,title:`Customize`,children:i(Ut,{config:z||{},onChange:ne,disabled:a})})]}),i(en,{icon:X,eyebrow:`Behavior`,title:`System Prompt & Memory`,children:[i($t,{icon:X,label:`System Instructions`,htmlFor:`agent-instructions`,helper:`Markdown is supported. This becomes the system prompt prepended to every conversation.`,counter:`${je.toLocaleString()} chars · ~${pt(Pe)} tok`,error:G.instruction?J.instruction:void 0,errorId:`agent-instructions-error`,children:[i(Me,{id:`agent-instructions`,value:O,onChange:k,onBlur:()=>K(e=>({...e,instruction:!0})),placeholder:`You are a planning specialist. Decompose user goals into clear, testable subtasks…`,minRows:8,minHeightClass:`min-h-[14rem]`,invalid:G.instruction&&!!J.instruction,ariaErrorId:G.instruction&&J.instruction?`agent-instructions-error`:void 0,emptyPreviewHint:`No instructions yet — switch to Write to compose the system prompt.`,toolbarNote:Ne?i(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-amber-400/30 bg-amber-400/10 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-[0.14em] text-amber-600 dark:text-amber-400`,children:`Long`}):void 0},`instructions-${t.id}`),Ne&&!J.instruction&&i(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400`,children:[i(pe,{className:`h-3.5 w-3.5 shrink-0`,strokeWidth:2.4}),je.toLocaleString(),` characters exceeds the recommended `,Zt.toLocaleString(),` — long prompts increase latency and cost.`]})]}),i(`div`,{className:`flex flex-col gap-4 rounded-2xl border border-black/[0.05] bg-white/30 p-5 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`flex items-start gap-4`,children:[i(`span`,{className:`mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-violet-500/10 text-violet-600 dark:bg-violet-500/15 dark:text-violet-400`,children:i(v,{className:`h-4 w-4`,strokeWidth:2.2})}),i(`div`,{className:`flex-1`,children:i(`div`,{className:`flex items-start justify-between gap-3`,children:[i(`div`,{children:[i(`div`,{className:`text-sm font-bold text-slate-800 dark:text-slate-100`,children:`Memory Template Override`}),i(`p`,{className:`mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:`Replace the project default with a bespoke memory prompt for this agent only.`})]}),i(`label`,{className:`relative inline-flex cursor-pointer shrink-0 items-center`,children:[i(`input`,{type:`checkbox`,"aria-label":`Enable Memory Template Override`,checked:A,onChange:e=>{let t=e.currentTarget.checked;j(t),t&&M.trim()===``&&P(s)},className:`peer sr-only`,disabled:a}),i(`div`,{className:`h-6 w-11 rounded-full border border-black/[0.08] bg-slate-200 transition-colors peer-checked:border-signal-500/40 peer-checked:bg-signal-500/30 peer-focus-visible:ring-2 peer-focus-visible:ring-signal-500/30 dark:border-white/[0.08] dark:bg-void-800`}),i(`div`,{className:`absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-white shadow-sm transition-all peer-checked:translate-x-5 peer-checked:bg-signal-500 dark:bg-slate-500 dark:peer-checked:bg-signal-400`})]})]})})]}),A&&i(`div`,{className:`flex flex-col gap-2 pl-13`,children:[i(`div`,{className:`flex items-center justify-between gap-3`,children:[i(`label`,{htmlFor:`agent-memory`,className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 dark:text-slate-400`,children:`Memory Template Markdown`}),i(`div`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`font-mono text-[10px] font-bold text-slate-400 dark:text-slate-500`,children:[M.length.toLocaleString(),` chars · ~`,pt(Fe),` tok`]}),ke&&i(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-signal-500/20 bg-signal-500/8 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-[0.14em] text-signal-600 dark:text-signal-400`,children:[i(U,{className:`h-2.5 w-2.5`,strokeWidth:3}),`Default`]}),!ke&&s.trim().length>0&&i(`button`,{type:`button`,onClick:De,disabled:a,className:`inline-flex items-center gap-1 rounded-md border border-black/[0.06] bg-white/60 px-2 py-0.5 text-[9px] font-bold uppercase tracking-[0.14em] text-slate-500 transition-colors hover:bg-white hover:text-slate-900 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:bg-white/[0.08] dark:hover:text-white`,children:[i(F,{className:`h-2.5 w-2.5`,strokeWidth:2.4}),`Reset to default`]})]})]}),i(Me,{id:`agent-memory`,value:M,onChange:P,onBlur:()=>K(e=>({...e,memory:!0})),placeholder:`Override the default memory prompt template for this agent.`,minRows:5,minHeightClass:`min-h-[10rem]`,invalid:G.memory&&!!J.memory,ariaErrorId:G.memory&&J.memory?`agent-memory-error`:void 0,emptyPreviewHint:`No override yet — switch to Write to compose the memory template.`},`memory-${t.id}`),G.memory&&J.memory&&i(`p`,{id:`agent-memory-error`,role:`alert`,className:`flex items-center gap-1.5 text-[11px] font-medium text-status-red`,children:[i(pe,{className:`h-3.5 w-3.5 shrink-0`,strokeWidth:2.4}),J.memory]})]}),i(`div`,{className:`flex flex-col gap-3 pl-13`,children:i(`div`,{className:`flex items-start justify-between gap-3`,children:[i(`div`,{className:`min-w-0`,children:[i(`div`,{className:`text-sm font-bold text-slate-800 dark:text-slate-100`,children:`Memory Injection Filters`}),i(`p`,{className:`mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:`Control which memories are injected into this agent's prompts.`})]}),i(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[i(Jt,{isOpen:le,onOpenChange:e=>{a||W(e)},position:`bottom`,align:`end`,triggerRef:de,className:`w-[min(440px,92vw)] overflow-hidden p-0`,content:i(Rt,{value:H,onChange:ce,onClose:()=>W(!1),disabled:a}),children:i(`button`,{ref:de,type:`button`,onClick:e=>{e.stopPropagation(),a||W(e=>!e)},disabled:a,className:`inline-flex items-center gap-1.5 rounded-full border border-black/[0.08] bg-white/60 px-3 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-600 transition-colors hover:bg-white hover:text-slate-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-300 dark:hover:bg-white/[0.08] dark:hover:text-white`,children:[i(x,{className:`h-3 w-3`,strokeWidth:2.4}),`Manage Memory`]})}),i(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full border border-black/[0.06] bg-white/60 px-3 py-1.5 text-[10px] font-semibold normal-case tracking-normal text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-300`,children:[i(v,{className:`h-3 w-3 shrink-0`,strokeWidth:2.4}),i(`span`,{className:`truncate`,children:Ae})]})]})]})})]})]}),i(en,{icon:ue,eyebrow:`Grounding`,title:`Knowledge Base`,children:[i(`p`,{className:`-mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:[`Subscribe this agent to documents from the shared library. Subscribed docs appear in the agent's manifest, and it retrieves passages on demand via `,i(`code`,{className:`rounded bg-black/[0.05] px-1 py-0.5 font-mono text-[11px] dark:bg-white/[0.06]`,children:`search_knowledge`}),`.`]}),i(zt,{agentPresetId:t.id,projectId:t.projectId,disabled:a,onSubscriptionsChanged:()=>_e(!0)})]}),i(`div`,{className:`grid grid-cols-1 gap-6 xl:grid-cols-2`,children:[i(en,{icon:y,eyebrow:`Routing`,title:`Provider & Model`,children:i(`div`,{className:`rounded-2xl border border-black/[0.05] bg-white/30 p-5 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`flex items-start gap-4`,children:[i(`span`,{className:`mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-black/[0.04] text-slate-500 dark:bg-white/[0.04] dark:text-slate-300`,children:i(y,{className:`h-4 w-4`,strokeWidth:2.2})}),i(`div`,{className:`min-w-0 flex-1`,children:[i(`div`,{className:`text-sm font-bold text-slate-800 dark:text-slate-100`,children:`Optional Agent Provider`}),i(`p`,{className:`mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:`Used only when a route is set to the Agent strategy. Blank agents inherit that route's primary instance.`})]})]}),i(`div`,{className:`mt-5 grid gap-4`,children:[i($t,{icon:we,label:`Provider Instance`,helper:`Leave unset to inherit route, worker, or global defaults.`,children:i(Oe,{"aria-label":`Provider instance`,value:L,onChange:e=>{R(e),te(``)},disabled:a||c.length===0,placeholder:`Inherit route default`,options:[{value:``,label:`Inherit route default`,icon:i(y,{className:`h-4 w-4 text-slate-400`,strokeWidth:2.2})},...c.map(e=>({value:e.value,label:`${e.label}${e.enabled?``:` (paused)`}`,icon:i(I,{id:e.provider,disabled:!e.enabled,className:`h-5 w-5 rounded-md`,imageClassName:`h-3 w-3`})}))]})}),$?i(`div`,{className:`flex items-center gap-3 rounded-2xl border border-black/[0.05] bg-black/[0.025] px-4 py-3 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[i(I,{id:$.provider,disabled:!$.enabled,className:`h-9 w-9 rounded-xl`,imageClassName:`h-5 w-5`}),i(`div`,{className:`min-w-0`,children:[i(`div`,{className:`truncate text-sm font-semibold text-slate-900 dark:text-white`,children:$.label}),i(`div`,{className:`truncate text-[11px] text-slate-500 dark:text-slate-400`,children:$.model||`default model`})]})]}):null,i($t,{icon:se,label:`Model Override`,htmlFor:`agent-model`,helper:`Optional. Leave blank to use the selected provider instance model.`,children:i(`input`,{id:`agent-model`,type:`text`,value:ee,onInput:e=>te(e.currentTarget.value),disabled:a||!L,placeholder:$?.model||`Inherited`,className:`rounded-2xl border border-black/[0.05] bg-white/40 px-5 py-3 shadow-sm text-[13px] font-medium text-slate-900 outline-none backdrop-blur-md transition-all placeholder-slate-400 focus:border-signal-500 focus:ring-4 focus:ring-signal-500/10 disabled:opacity-50 dark:border-white/[0.07] dark:bg-white/[0.03] dark:text-white dark:placeholder-slate-600 dark:focus:ring-signal-500/15`})})]})]})}),i(en,{icon:_,eyebrow:`Tools`,title:`Connected MCPs`,children:i(`div`,{className:`rounded-2xl border border-black/[0.05] bg-white/30 p-5 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02]`,children:[i(`div`,{className:`flex items-start gap-4`,children:[i(`span`,{className:`mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-black/[0.04] text-slate-500 dark:bg-white/[0.04] dark:text-slate-300`,children:i(_,{className:`h-4 w-4`,strokeWidth:2.2})}),i(`div`,{className:`min-w-0 flex-1`,children:[i(`div`,{className:`flex items-center justify-between gap-3`,children:[i(`div`,{className:`text-sm font-bold text-slate-800 dark:text-slate-100`,children:`MCP Servers`}),i(Jt,{isOpen:ae,onOpenChange:e=>{a||V(e)},position:`bottom`,align:`end`,className:`w-[min(440px,92vw)] overflow-hidden p-0`,content:i(qt,{value:B,onChange:ye,availableServers:l,onClose:()=>V(!1)}),children:i(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-black/[0.08] bg-white/60 px-3 py-1.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-600 transition-colors hover:bg-white hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-300 dark:hover:bg-white/[0.08] dark:hover:text-white ${a?`pointer-events-none opacity-50`:``}`,children:[i(w,{className:`h-3 w-3`,strokeWidth:2.4}),`Manage`]})})]}),i(`p`,{className:`mt-1 text-[12px] leading-relaxed text-slate-500 dark:text-slate-400`,children:[`Tap to link or unlink. `,Be,` active. Use Manage to configure Code UX tools.`]})]})]}),i(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[Re.map(e=>i(`button`,{type:`button`,onClick:()=>Ve(e),disabled:a,"aria-pressed":e.active,className:`inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[11px] font-bold transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:opacity-50 ${e.active?`border-signal-500/30 bg-signal-500/[0.12] text-signal-700 dark:text-signal-200`:`border-black/[0.08] bg-white/50 text-slate-400 hover:text-slate-600 dark:border-white/[0.08] dark:bg-white/[0.03] dark:text-slate-500 dark:hover:text-slate-300`}`,children:[e.active?i(U,{className:`h-3 w-3`,strokeWidth:3}):i(_,{className:`h-3 w-3`,strokeWidth:2.4}),e.label]},e.id)),ze>0&&i(`button`,{type:`button`,onClick:()=>V(!0),disabled:a,className:`inline-flex items-center rounded-full border border-black/[0.08] bg-white/50 px-3 py-1.5 text-[11px] font-bold text-slate-400 transition-colors hover:text-slate-600 disabled:opacity-50 dark:border-white/[0.08] dark:bg-white/[0.03] dark:text-slate-500 dark:hover:text-slate-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:[`+`,ze,` more`]})]})]})})]}),i(`div`,{className:`flex flex-wrap items-center gap-3 rounded-2xl border border-black/[0.04] bg-white/20 px-4 py-3 text-[10px] font-mono text-slate-400 dark:border-white/[0.04] dark:bg-white/[0.01] dark:text-slate-500`,children:[i(`span`,{className:`inline-flex items-center gap-1.5`,children:[i(ie,{className:`h-3 w-3`,strokeWidth:2.2}),`Created `,new Date(t.createdAt).toLocaleDateString()]}),i(`span`,{"aria-hidden":`true`,children:`·`}),i(`span`,{children:[`Updated `,new Date(t.updatedAt).toLocaleDateString()]}),i(`span`,{"aria-hidden":`true`,children:`·`}),i(`span`,{className:`truncate`,children:[`id `,t.id]})]})]})]}),i(Le,{isOpen:fe,options:{title:`Discard unsaved changes?`,body:`Your edits to this agent will be lost. This action can't be undone.`,confirmLabel:`Discard`,cancelLabel:`Keep editing`,destructive:!0},onConfirm:()=>{q(!1),p()},onCancel:()=>q(!1)})]})},on={codex:`#10A37F`,"claude-code":`#D97757`,gemini:`#4796E3`,"qwen-code":`#7C3AED`,github:`#8B95A1`},sn=`#00E0A0`,cn=e=>e&&on[e]||sn,ln=e=>!e||e<=0?`Empty`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(1)} MB`;p(),s();var un=({file:t,isSelected:n,onClick:r})=>{let a=o(null),s=cn(t.providerId);return d(()=>{a.current&&Q.fromTo(a.current,{opacity:0,y:14,scale:.98},{opacity:1,y:0,scale:1,duration:.5,ease:`power3.out`})},[]),i(`button`,{ref:a,type:`button`,onClick:r,className:`group relative flex w-full overflow-hidden rounded-[1.4rem] border text-left backdrop-blur-xl transition-all duration-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2 ${n?`border-signal-500/40 bg-white/85 shadow-[0_8px_32px_rgba(0,224,160,0.12)] dark:border-signal-500/40 dark:bg-void-800/75 dark:shadow-[0_8px_32px_rgba(0,224,160,0.10)]`:t.exists?`border-black/[0.06] bg-white/55 hover:-translate-y-0.5 hover:border-signal-500/30 hover:bg-white/80 hover:shadow-[0_8px_24px_rgba(0,224,160,0.06)] dark:border-white/[0.06] dark:bg-void-800/40 dark:hover:border-signal-500/30 dark:hover:bg-void-800/60 dark:hover:shadow-[0_8px_24px_rgba(0,0,0,0.25)]`:`border-dashed border-black/[0.1] bg-white/30 hover:-translate-y-0.5 hover:border-signal-500/40 hover:bg-white/55 hover:shadow-[0_4px_16px_rgba(0,0,0,0.04)] dark:border-white/[0.1] dark:bg-void-800/25 dark:hover:border-signal-500/40 dark:hover:bg-void-800/45 dark:hover:shadow-[0_4px_16px_rgba(0,0,0,0.2)]`}`,children:[i(`div`,{className:`absolute inset-y-0 left-0 w-[3px] rounded-l-full transition-opacity duration-300 ${n?`opacity-100`:`opacity-0 group-hover:opacity-50`}`,style:{backgroundColor:s}}),i(`div`,{className:`relative z-10 flex w-full items-center gap-4 px-5 py-4`,children:[i(`div`,{className:`relative flex h-14 w-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl transition-shadow duration-300 ${n?`shadow-[0_0_16px_rgba(0,224,160,0.12)]`:``}`,style:{background:`linear-gradient(135deg, ${s}1f, ${s}0a)`},children:[i(X,{className:t.exists?`h-6 w-6`:`h-6 w-6 opacity-60`,style:{color:s},strokeWidth:1.8}),t.providerId&&i(I,{id:t.providerId,className:`absolute -bottom-1 -right-1 h-5 w-5 rounded-md border-white/70 shadow-sm dark:border-void-800/70`,imageClassName:`h-3 w-3`})]}),i(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[i(`h3`,{className:`font-display text-[15px] font-bold tracking-tight transition-colors ${n?`text-slate-900 dark:text-white`:`text-slate-700 dark:text-slate-300 group-hover:text-slate-900 dark:group-hover:text-white`}`,children:t.label}),i(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[i(`span`,{className:`truncate font-mono text-[9px] text-slate-400 dark:text-slate-500`,children:t.relativePath}),i(`span`,{className:`ml-auto inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-[0.1em] ${t.exists?`border-signal-500/20 bg-signal-500/8 text-signal-600 dark:text-signal-400`:`border-black/[0.06] bg-black/[0.03] text-slate-400 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-500`}`,children:t.exists?ln(t.size):i(e,{children:[i(ie,{className:`h-2.5 w-2.5`,strokeWidth:2.6}),`New`]})})]})]}),i(L,{className:`h-4 w-4 shrink-0 transition-all duration-300 ${n?`translate-x-0.5 text-signal-500`:`text-slate-300 group-hover:translate-x-0.5 group-hover:text-signal-400 dark:text-slate-600`}`,strokeWidth:2.5})]})]})};p(),s();var dn=typeof navigator<`u`&&/Mac|iPhone|iPad/i.test(navigator.platform),fn=e=>`# ${e.label.replace(/\.md$/i,``)} instructions\n\nGuidance for agents working in this repository.\n\n## Project overview\n\n- \n\n## Conventions\n\n- \n\n## Commands\n\n\`\`\`bash\n\n\`\`\`\n`,pn=({projectId:t,file:a,onSaved:s})=>{let c=o(null),l=o(null),u=cn(a.providerId),[p,h]=m(!0),[g,_]=m(null),[v,y]=m(``),[b,x]=m(``),[C,w]=m(a.exists),[T,E]=m(!1),[D,O]=m(!1),[k,A]=m(`write`),j=v!==b;f(()=>{let e=!1;return h(!0),_(null),A(`write`),O(!1),Ze(t,a.id).then(t=>{e||(y(t.content),x(t.content),w(t.exists))}).catch(t=>{e||_(t instanceof Error?t.message:String(t))}).finally(()=>{e||h(!1)}),()=>{e=!0}},[t,a.id]),d(()=>{c.current&&Q.fromTo(c.current,{opacity:0,x:16},{opacity:1,x:0,duration:.45,ease:`power3.out`})},[a.id]);let M=n(async()=>{if(!(T||!j)){E(!0),_(null);try{let e=await Qe(t,a.id,v);x(e.content),w(e.exists),s(e),O(!0),window.setTimeout(()=>O(!1),2200)}catch(e){_(e instanceof Error?e.message:String(e))}finally{E(!1)}}},[T,j,t,a.id,v,s]);f(()=>{let e=e=>{let t=c.current;if(!t)return;let n=document.activeElement;n&&!t.contains(n)||(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),M())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[M]);let N=e=>{y(e.currentTarget.value)},P=r(()=>ft(v),[v]),L=r(()=>he(v),[v]),R=T?{cls:`border-signal-500/30 bg-signal-500/10 text-signal-600 dark:text-signal-400`,label:`Saving`,icon:i(F,{className:`h-2.5 w-2.5 animate-spin`,strokeWidth:2.4})}:j?{cls:`border-amber-400/30 bg-amber-400/10 text-amber-600 dark:text-amber-400`,label:`Unsaved`,icon:i(`span`,{className:`h-1 w-1 rounded-full bg-amber-500`})}:D?{cls:`border-signal-500/30 bg-signal-500/10 text-signal-600 dark:text-signal-400`,label:`Saved`,icon:i(U,{className:`h-2.5 w-2.5`,strokeWidth:3})}:{cls:`border-black/[0.06] bg-white/60 text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,label:C?`In sync`:`Not created`,icon:i(U,{className:`h-2.5 w-2.5`,strokeWidth:3})};return i(`div`,{ref:c,className:`group relative flex flex-col overflow-hidden rounded-[1.9rem] border border-black/[0.06] bg-white/70 shadow-[0_2px_20px_rgba(0,0,0,0.04)] backdrop-blur-2xl dark:border-white/[0.06] dark:bg-void-800/60 dark:shadow-[0_4px_24px_rgba(0,0,0,0.2)]`,children:[i(ve,{accentHex:u}),i(`div`,{className:`sticky top-0 z-20 flex flex-col gap-4 border-b border-black/[0.05] bg-white/75 px-6 py-5 backdrop-blur-2xl md:flex-row md:items-center md:justify-between md:px-8 md:py-6 dark:border-white/[0.05] dark:bg-void-800/70`,children:[i(`div`,{className:`flex min-w-0 items-center gap-3.5`,children:[i(`div`,{className:`relative flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl`,style:{background:`linear-gradient(135deg, ${u}26, ${u}0d)`},children:[i(X,{className:`h-6 w-6`,style:{color:u},strokeWidth:1.9}),a.providerId&&i(I,{id:a.providerId,className:`absolute -bottom-1 -right-1 h-5 w-5 rounded-md border-white/70 shadow-sm dark:border-void-800/70`,imageClassName:`h-3 w-3`})]}),i(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[i(`div`,{className:`flex items-center gap-2`,children:[i(`h2`,{className:`truncate font-display text-xl font-black tracking-tight text-slate-900 dark:text-white`,children:a.label}),i(`span`,{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[9px] font-bold uppercase tracking-[0.14em] ${R.cls}`,children:[R.icon,R.label]})]}),i(`div`,{className:`flex items-center gap-1.5 font-mono text-[11px] text-slate-400 dark:text-slate-500`,children:[i(ke,{className:`h-3 w-3`,strokeWidth:2.2}),i(`span`,{className:`truncate`,children:a.relativePath})]})]})]}),i(`div`,{className:`flex shrink-0 items-center gap-2`,children:[i(`div`,{className:`flex items-center gap-1 rounded-full border border-black/[0.06] bg-white/50 p-1 dark:border-white/[0.06] dark:bg-white/[0.03]`,children:[`write`,`preview`].map(e=>{let t=k===e;return i(`button`,{type:`button`,onClick:()=>A(e),"aria-pressed":t,className:`inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.1em] transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 ${t?`bg-signal-500 text-void-900 shadow-[0_0_12px_rgba(0,224,160,0.25)]`:`text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-white`}`,children:[i(e===`write`?V:xe,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),e===`write`?`Write`:`Preview`]},e)})}),j&&!T&&i(`button`,{type:`button`,onClick:()=>y(b),title:`Revert changes`,className:`inline-flex items-center gap-2 rounded-full border border-black/[0.08] bg-white/40 px-4 py-2.5 text-[12px] font-bold uppercase tracking-[0.12em] text-slate-600 backdrop-blur-md transition-colors hover:bg-white/70 hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.03] dark:text-slate-300 dark:hover:bg-white/[0.06] dark:hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:[i(Se,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Revert`]}),i(`button`,{type:`button`,onClick:()=>void M(),disabled:T||!j,"aria-disabled":T||!j,className:`inline-flex items-center gap-2 rounded-full bg-signal-500 px-5 py-2.5 text-[12px] font-bold uppercase tracking-[0.12em] text-void-900 shadow-[0_0_24px_rgba(0,224,160,0.28)] transition-all hover:scale-[1.03] hover:bg-signal-400 hover:shadow-[0_0_32px_rgba(0,224,160,0.36)] focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 disabled:cursor-not-allowed disabled:bg-slate-200 disabled:text-slate-400 disabled:shadow-none disabled:hover:scale-100 dark:disabled:bg-white/[0.05] dark:disabled:text-slate-500`,children:[T?i(F,{className:`h-3.5 w-3.5 animate-spin`,strokeWidth:2.4}):i(S,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Save`]})]})]}),i(`div`,{className:`relative z-10 flex flex-col gap-3 p-6 md:p-8`,children:[g&&i(`div`,{className:`flex items-center gap-2 rounded-2xl border border-status-red/20 bg-status-red/[0.06] px-4 py-3 text-[13px] font-medium text-status-red backdrop-blur-md`,children:[i(pe,{className:`h-4 w-4 shrink-0`,strokeWidth:2.4}),g]}),i(`div`,{className:`flex flex-wrap items-center gap-3 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-400 dark:text-slate-500`,children:[i(`span`,{className:`font-mono normal-case tracking-normal`,children:[v.length.toLocaleString(),` chars`]}),i(`span`,{"aria-hidden":!0,children:`·`}),i(`span`,{className:`font-mono normal-case tracking-normal`,children:[`~`,pt(P),` tok`]}),C&&i(e,{children:[i(`span`,{"aria-hidden":!0,children:`·`}),i(`span`,{className:`font-mono normal-case tracking-normal`,children:[ln(a.size),` on disk`]})]}),i(`span`,{className:`ml-auto hidden items-center gap-1.5 font-mono normal-case tracking-normal md:inline-flex`,children:[dn?`⌘S`:`Ctrl+S`,` to save`]})]}),p?i(`div`,{className:`h-[60vh] min-h-[420px] animate-pulse rounded-2xl border border-black/[0.05] bg-white/40 dark:border-white/[0.05] dark:bg-white/[0.02]`}):k===`write`?i(`div`,{className:`relative`,children:[i(`textarea`,{ref:l,value:v,onInput:N,spellcheck:!1,placeholder:`# ${a.label}\n\nWrite the instructions agents should follow in this project…`,className:`block h-[60vh] min-h-[420px] w-full resize-y rounded-2xl border border-black/[0.05] bg-white/40 px-5 py-4 font-mono text-[13px] leading-relaxed text-slate-900 shadow-sm outline-none backdrop-blur-md transition-all placeholder-slate-400 focus:border-signal-500 focus:ring-4 focus:ring-signal-500/10 dark:border-white/[0.07] dark:bg-white/[0.03] dark:text-white dark:placeholder-slate-600 dark:focus:ring-signal-500/15`}),!C&&v.trim()===``&&i(`div`,{className:`pointer-events-none absolute inset-x-5 bottom-5 flex justify-center`,children:i(`button`,{type:`button`,onClick:()=>y(fn(a)),className:`pointer-events-auto inline-flex items-center gap-2 rounded-full border border-signal-500/25 bg-white/85 px-4 py-2 text-[11px] font-bold uppercase tracking-[0.12em] text-signal-600 shadow-sm backdrop-blur-md transition-all hover:scale-[1.03] hover:bg-signal-500/10 dark:bg-void-800/85 dark:text-signal-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30`,children:[i(se,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Insert starter template`]})})]}):v.trim()?i(`div`,{className:`h-[60vh] min-h-[420px] overflow-auto rounded-2xl border border-black/[0.05] bg-white/40 px-6 py-5 shadow-sm backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02] ${J}`,dangerouslySetInnerHTML:{__html:L}}):i(`div`,{className:`flex h-[60vh] min-h-[420px] flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-black/[0.08] bg-white/30 text-center dark:border-white/[0.08] dark:bg-white/[0.02]`,children:[i(X,{className:`h-8 w-8 text-slate-300 dark:text-slate-600`,strokeWidth:1.4}),i(`p`,{className:`text-sm text-slate-400 dark:text-slate-500`,children:`Nothing to preview yet.`})]})]})]})};p();var mn={signal:{dot:`bg-signal-500`,text:`text-signal-600 dark:text-signal-400`,glow:`shadow-[0_0_10px_rgba(0,224,160,0.5)]`},amber:{dot:`bg-amber-500`,text:`text-amber-600 dark:text-amber-400`,glow:`shadow-[0_0_10px_rgba(255,184,0,0.45)]`},rose:{dot:`bg-status-red`,text:`text-status-red`,glow:`shadow-[0_0_10px_rgba(211,47,47,0.45)]`},slate:{dot:`bg-slate-400 dark:bg-slate-500`,text:`text-slate-600 dark:text-slate-300`,glow:``}},hn=({label:e,value:t,accent:n,icon:r})=>{let a=mn[n];return i(`div`,{className:`group relative overflow-hidden rounded-[1.6rem] border border-black/[0.06] bg-white/70 p-5 shadow-[0_2px_20px_rgba(0,0,0,0.04)] backdrop-blur-2xl transition-all hover:-translate-y-0.5 hover:shadow-[0_12px_32px_rgba(0,0,0,0.06)] dark:border-white/[0.06] dark:bg-void-800/60 dark:shadow-[0_4px_24px_rgba(0,0,0,0.2)]`,children:[i(`div`,{className:`flex items-center justify-between`,children:[i(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400 dark:text-slate-500`,children:e}),i(`span`,{className:`h-2 w-2 rounded-full ${a.dot} ${a.glow}`})]}),i(`div`,{className:`mt-4 flex items-end justify-between`,children:[i(`div`,{className:`font-display text-4xl font-black tracking-tighter text-slate-900 dark:text-white`,children:t}),i(r,{className:`h-5 w-5 ${a.text}`,strokeWidth:1.8})]})]})},gn=e=>e.trim().replace(/[_-]+/g,` `).replace(/\s+/g,` `).toLowerCase(),_n=()=>{let e=o(null),{selectedProject:t,loading:n}=A(),[a,s]=m([]),[c,l]=m(!1),[u,p]=m(null),[h,g]=m(null),[_,v]=m(null),[y,x]=m(null),[S,C]=m(!1),[w,T]=m(!0),[E,D]=m(null),[O,k]=m(!1),[M,N]=m([]),[F,I]=m(null),{data:L,error:R}=j(t?.id||null);f(()=>{L?T(L.settings.agents.saveToProjectDirectory):t||T(!0)},[L,t]);let te=async()=>{if(!t){s([]),p(null);return}l(!0);try{let e=await ge(t.id);s(e),!E&&e.length>0?D(e[0].id):E&&!e.find(e=>e.id===E)&&(D(e.length>0?e[0].id:null),k(!1)),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{l(!1)}},z=async()=>{if(!t){N([]);return}try{N(await Xe(t.id))}catch{N([])}};f(()=>{I(null),te(),z()},[t?.id]);let ne=e=>{N(t=>t.map(t=>t.id===e.id?{...t,...e}:t))},B=e=>{D(e),I(null),k(!1)},ae=e=>{I(e),k(!1)};d(()=>{if(!e.current)return;let t=e.current,n=Q.context(()=>{Q.fromTo(Array.from(t.children),{opacity:0,y:28},{opacity:1,y:0,duration:.75,stagger:.08,ease:`power4.out`})});return()=>n.revert()},[]);let V=async()=>{if(t)try{let e=await je(t.id,{name:`Agent ${a.length+1}`,instructionMarkdown:``,labels:[],avatarConfig:oe(Date.now().toString())});s(t=>[e,...t]),D(e.id),k(!0),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}},U=async e=>{x(e);try{let t=await Te(e);s(e=>e.map(e=>e.id===t.id?t:e)),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{x(null)}},se=async()=>{if(t){C(!0);try{s(await Ce(t.id)),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{C(!1)}}},ce=async(e,t)=>{g(e);try{let n=await ye(e,t);s(e=>e.map(e=>e.id===n.id?n:e)),k(!1),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(null)}},le=async e=>{v(e);try{await me(e),s(t=>{let n=t.filter(t=>t.id!==e);return E===e&&(D(n.length>0?n[0].id:null),k(!1)),n}),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{v(null)}},W=r(()=>{let e=new Map,t=(t,n)=>{if(!t)return;let r=e.get(t)??[];r.includes(n)||e.set(t,[...r,n])},n=(e,n)=>{let r=a.find(e=>gn(e.name)===gn(n))?.id;t(r,e)},r=(e,r,i)=>{e?t(e,r):n(r,i)},i=L?.settings.agents.routing,o=L?.settings.agents.qualityAssurance;if(r(i?.planning.agentPresetId,`Planning`,`Planning agent`),i?.taskCoding.mode===`ORCHESTRATOR`)for(let e of i.taskCoding.orchestratorAgentPresetIds)t(e,`Coding Roster`);else r(i?.taskCoding.agentPresetId,`Coding`,`Worker`);return r(i?.ciFix.agentPresetId,`CI Fix`,`Worker`),r(i?.mergeConflict.agentPresetId,`Merge Conflict`,`Worker`),r(i?.dashboardReply.agentPresetId,`Dashboard Reply`,`Worker`),r(i?.clarificationReply.agentPresetId,`Clarification Reply`,`Project manager`),o?.enabled&&(o.taskCompletion.enabled&&r(o.taskCompletion.agentPresetId,`QA Task`,`Quality assurance agent`),o.sprintCompletion.enabled&&r(o.sprintCompletion.agentPresetId,`QA Sprint`,`Quality assurance agent`),o.completedTaskWithoutPr.enabled&&r(o.completedTaskWithoutPr.agentPresetId,`QA No PR`,`Quality assurance agent`)),e},[L,a]),ue=r(()=>Object.entries(L?.settings.aiProvider.providers||{}).map(([e,t])=>({value:e,label:t.name,provider:t.provider,model:t.model,enabled:t.enabled})),[L]),de=L?.settings.customMcpServers??[],G=a.find(e=>e.id===E),K=M.find(e=>e.id===F),q=r(()=>{let e=a.filter(e=>e.syncStatus===`synced`).length,t=a.filter(e=>e.syncStatus===`out_of_sync`||e.syncStatus===`missing_source`).length,n=a.filter(e=>!e.syncStatus||e.syncStatus===`manual`).length;return{total:a.length,synced:e,drift:t,local:n}},[a]);return i(H,{containerRef:e,padding:`agents`,className:`gap-10 md:gap-14`,children:[i($e,{selectedProject:t,projectLoading:n,loading:c,syncingAll:S,presets:a,onSyncAll:()=>void se(),onCreate:()=>void V()}),t&&a.length>0&&i(`section`,{"aria-label":`Roster Summary`,className:`grid w-full grid-cols-2 gap-4 lg:grid-cols-4`,children:[i(hn,{label:`Total Agents`,value:q.total,accent:`signal`,icon:P}),i(hn,{label:`Synced`,value:q.synced,accent:`signal`,icon:ee}),i(hn,{label:`Drift`,value:q.drift,accent:q.drift>0?`amber`:`slate`,icon:fe}),i(hn,{label:`Database Only`,value:q.local,accent:`slate`,icon:b})]}),(u||R)&&i(`div`,{className:`rounded-2xl border border-status-red/30 bg-status-red/[0.08] px-5 py-4 text-sm font-medium text-status-red backdrop-blur-md shadow-[0_0_20px_rgba(255,0,0,0.05)]`,children:u||R}),t&&i(`div`,{className:`flex items-start gap-3 rounded-2xl border border-black/[0.05] bg-white/40 px-5 py-3.5 text-[13px] leading-relaxed text-slate-500 backdrop-blur-md dark:border-white/[0.05] dark:bg-white/[0.02] dark:text-slate-400`,children:[i(re,{className:`mt-0.5 h-4 w-4 shrink-0 text-slate-400 dark:text-slate-500`,strokeWidth:2}),w?`Markdown mirroring enabled — saving writes a companion file under .code-ux/agents.`:`Markdown mirroring disabled — edits stay in the database only.`]}),t&&a.length>0&&i(Ie,{label:`Roster`,className:`py-1 md:py-2`}),t?a.length===0&&M.length===0&&!c?i(`div`,{className:`flex min-h-[320px] flex-col items-center justify-center gap-3 rounded-[1.9rem] border border-dashed border-black/[0.08] bg-white/40 px-8 py-16 text-center backdrop-blur-2xl dark:border-white/[0.08] dark:bg-void-800/40`,children:[i(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-2xl bg-signal-500/10 text-signal-600 shadow-sm ring-1 ring-slate-900/5 dark:bg-signal-500/15 dark:text-signal-400 dark:ring-white/[0.06]`,children:i(P,{className:`h-8 w-8 text-signal-600 dark:text-signal-400`,strokeWidth:1.2})}),i(`h3`,{className:`mb-2 font-display text-xl font-semibold tracking-tight text-slate-900 dark:text-white`,children:`The Workshop Is Quiet`}),i(`p`,{className:`max-w-sm text-sm leading-relaxed text-slate-500 dark:text-slate-400`,children:`Spin up your first specialist. Give it a name, a personality, an avatar — and operator-grade system instructions.`}),i(`div`,{className:`mt-4`,children:i(`button`,{type:`button`,onClick:()=>void V(),className:`group inline-flex items-center gap-2 rounded-full bg-signal-500 px-6 py-3 text-sm font-bold text-void-900 shadow-[0_0_24px_rgba(0,224,160,0.28)] transition-all hover:scale-[1.03] hover:bg-signal-400 hover:shadow-[0_0_32px_rgba(0,224,160,0.36)] focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 focus-visible:ring-offset-2`,children:[i(ie,{className:`h-4.5 w-4.5 transition-transform group-hover:rotate-90`,strokeWidth:2.5}),`Create First Agent`]})})]}):a.length>0||M.length>0?i(`div`,{className:`relative flex flex-col gap-6 xl:flex-row xl:items-start`,children:[i(`aside`,{className:`flex w-full flex-col gap-6 xl:w-[340px] xl:shrink-0`,children:[i(`div`,{className:`flex flex-col gap-3`,children:[i(`div`,{className:`flex items-center justify-between px-1`,children:[i(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:[a.length,` Agent`,a.length===1?``:`s`]}),c&&i(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-signal-500`,children:`Refreshing…`})]}),a.length>0?i(`div`,{className:`flex flex-col gap-2.5`,children:a.map(e=>i(tt,{preset:e,routeTags:W.get(e.id)??[],isSelected:E===e.id&&!F,onClick:()=>B(e.id)},e.id))}):i(`button`,{type:`button`,onClick:()=>void V(),className:`group flex items-center gap-3 rounded-[1.4rem] border border-dashed border-signal-500/25 bg-white/40 px-5 py-4 text-left transition-all hover:-translate-y-0.5 hover:border-signal-500/40 hover:bg-signal-500/[0.04] focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/30 dark:border-signal-500/25 dark:bg-void-800/30`,children:[i(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-signal-500/10 text-signal-600 dark:bg-signal-500/15 dark:text-signal-400`,children:i(ie,{className:`h-5 w-5 transition-transform group-hover:rotate-90`,strokeWidth:2.4})}),i(`span`,{className:`text-[13px] font-bold text-slate-600 dark:text-slate-300`,children:`Create your first agent`})]})]}),M.length>0&&i(`div`,{className:`flex flex-col gap-3`,children:[i(`div`,{className:`flex items-center gap-3 px-1`,children:[i(`span`,{className:`inline-flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.18em] text-slate-400 dark:text-slate-500`,children:[i(X,{className:`h-3 w-3`,strokeWidth:2.4}),`Instruction Files`]}),i(`div`,{className:`h-px flex-1 bg-gradient-to-r from-black/[0.08] to-transparent dark:from-white/[0.08]`})]}),i(`div`,{className:`flex flex-col gap-2.5`,children:M.map(e=>i(un,{file:e,isSelected:F===e.id,onClick:()=>ae(e.id)},e.id))})]})]}),i(`div`,{className:`w-full flex-1`,children:K?i(pn,{projectId:t.id,file:K,onSaved:ne},K.id):G?O?i(an,{preset:G,saving:h===G.id,defaultMemoryInstruction:L?.settings.memory.workerLearningsInstruction||``,providerOptions:ue,availableMcpServers:de,onSave:ce,onCancel:()=>k(!1)}):i(xt,{preset:G,routeTags:W.get(G.id)??[],providerOptions:ue,availableMcpServers:de,onEdit:()=>k(!0),onDelete:le,onImport:U,deleting:_===G.id,importing:y===G.id}):i(`div`,{className:`flex min-h-[320px] flex-col items-center justify-center gap-3 rounded-[1.9rem] border border-dashed border-black/[0.08] bg-white/40 px-8 py-16 text-center backdrop-blur-2xl dark:border-white/[0.08] dark:bg-void-800/40`,children:[i(`div`,{className:`flex h-14 w-14 items-center justify-center rounded-2xl bg-signal-500/10 text-signal-600 dark:bg-signal-500/15 dark:text-signal-400`,children:i(P,{className:`h-7 w-7`,strokeWidth:1.6})}),i(`p`,{className:`max-w-xs text-sm leading-relaxed text-slate-500 dark:text-slate-400`,children:`Select an agent or an instruction file from the left to view and edit it.`})]})})]}):null:i(`div`,{className:`flex min-h-[320px] flex-col items-center justify-center gap-3 rounded-[1.9rem] border border-dashed border-black/[0.08] bg-white/40 px-8 py-16 text-center backdrop-blur-2xl dark:border-white/[0.08] dark:bg-void-800/40`,children:[i(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-2xl bg-signal-500/10 text-signal-600 shadow-sm ring-1 ring-slate-900/5 dark:bg-signal-500/15 dark:text-signal-400 dark:ring-white/[0.06]`,children:i(P,{className:`h-8 w-8 text-signal-600 dark:text-signal-400`,strokeWidth:1.2})}),i(`h3`,{className:`mb-2 font-display text-xl font-semibold tracking-tight text-slate-900 dark:text-white`,children:`Pick A Project To Begin`}),i(`p`,{className:`max-w-sm text-sm leading-relaxed text-slate-500 dark:text-slate-400`,children:`Choose a project from the top navigation and your roster of agents will load here.`})]})]})};export{_n as AgentsPage};
|
package/dashboard/dist/assets/{BackgroundManager-DbgGcx7x.js → BackgroundManager-B4A4jACF.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DeepOceanBackground-BlA_aERs.js","assets/vendor-Dl0fhdV0.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/WebGLRenderer-D904dTMp.js","assets/Points-T2ogl268.js","assets/NeonDreamsBackground-CLecYjlI.js","assets/AuroraBorealisBackground-Cw3K7t28.js","assets/CosmicDustBackground-poc1XPIR.js","assets/EtherealMistBackground-bkuaf3pt.js","assets/QuantumFieldBackground-NQGMzvYP.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,f as t,l as n,m as r}from"./vendor-Dl0fhdV0.js";import{Ii as i}from"./index-
|
|
2
|
+
import{a as e,f as t,l as n,m as r}from"./vendor-Dl0fhdV0.js";import{Ii as i}from"./index-DdNzHP9F.js";t();var a=r(()=>i(()=>import(`./DeepOceanBackground-BlA_aERs.js`).then(e=>({default:e.DeepOceanBackground})),__vite__mapDeps([0,1,2,3,4]))),o=r(()=>i(()=>import(`./NeonDreamsBackground-CLecYjlI.js`).then(e=>({default:e.NeonDreamsBackground})),__vite__mapDeps([5,1,2,3]))),s=r(()=>i(()=>import(`./AuroraBorealisBackground-Cw3K7t28.js`).then(e=>({default:e.AuroraBorealisBackground})),__vite__mapDeps([6,1,2,3]))),c=r(()=>i(()=>import(`./CosmicDustBackground-poc1XPIR.js`).then(e=>({default:e.CosmicDustBackground})),__vite__mapDeps([7,1,2,3,4]))),l=r(()=>i(()=>import(`./EtherealMistBackground-bkuaf3pt.js`).then(e=>({default:e.EtherealMistBackground})),__vite__mapDeps([8,1,2,3]))),u=r(()=>i(()=>import(`./QuantumFieldBackground-NQGMzvYP.js`).then(e=>({default:e.QuantumFieldBackground})),__vite__mapDeps([9,1,2,3]))),d=({mode:t,animation:r,staticColor:i,isDark:d})=>t===`STATIC`?e(`div`,{className:`fixed inset-0 overflow-hidden`,style:{backgroundColor:i,zIndex:0,contain:`strict`},"aria-hidden":`true`}):e(n,{fallback:e(`div`,{className:`fixed inset-0 bg-[#dbe8f8] dark:bg-[#060a0d] -z-10`}),children:e(r===`neon-dreams`?o:r===`aurora-borealis`?s:r===`cosmic-dust`?c:r===`ethereal-mist`?l:r===`quantum-field`?u:a,{forceDark:d})});export{d as BackgroundManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,f as t,h as n,o as r,v as i,w as a,x as o,y as s}from"./vendor-Dl0fhdV0.js";import{t as c}from"./use-reduced-motion-Dxh6NCDM.js";import{Ar as l,At as u,Kr as d,Ti as f,Vr as p,_r as m,cr as h,dr as g,g as _,hi as v,or as y,pr as b,si as x,tn as S,w as C,yi as w}from"./index-
|
|
1
|
+
import{a as e,f as t,h as n,o as r,v as i,w as a,x as o,y as s}from"./vendor-Dl0fhdV0.js";import{t as c}from"./use-reduced-motion-Dxh6NCDM.js";import{Ar as l,At as u,Kr as d,Ti as f,Vr as p,_r as m,cr as h,dr as g,g as _,hi as v,or as y,pr as b,si as x,tn as S,w as C,yi as w}from"./index-DdNzHP9F.js";o();var T=({tone:t=`neutral`,title:r,children:a})=>{let o=n(null),s=c();g(),i(()=>{if(!o.current)return;let e=b.context(()=>{b.fromTo(o.current,{y:s?0:y.feedback.yStart,opacity:0,scale:s?1:y.feedback.scaleStart},{y:y.feedback.yEnd,opacity:1,scale:y.feedback.scaleEnd,duration:s?0:y.feedback.duration,ease:y.feedback.ease})});return()=>e.revert()},[s]);let l=`border-black/[0.06] bg-black/[0.03] text-slate-600 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-300`,u=null;return t===`warning`?(l=`bg-status-amber/10 text-status-amber border-status-amber/20`,u=m):t===`success`?(l=`bg-status-green/10 text-status-green border-status-green/20`,u=w):t===`error`?(l=`bg-status-red/10 text-status-red border-status-red/20`,u=v):t===`pending`&&(l=`bg-signal-500/10 text-signal-700 border-signal-500/20 dark:text-signal-400`,u=p),e(`div`,{ref:o,className:`rounded-[1.35rem] border px-5 py-4 ${l}`,role:t===`error`||t===`warning`?`alert`:`status`,"aria-live":t===`error`||t===`warning`?`assertive`:`polite`,children:[e(`div`,{className:`flex items-center gap-2`,children:[u?e(u,{className:`h-4 w-4 shrink-0 ${t===`pending`?`animate-spin`:``} motion-safe:animate-[icon-pop_0.18s_ease-out]`}):null,e(`div`,{className:`text-[11px] font-bold uppercase tracking-[0.16em]`,children:r})]}),e(`div`,{className:`mt-2 text-sm font-medium leading-relaxed`,children:a})]})},E=({label:t,onClick:n,tone:r=`secondary`,busy:i=!1,disabled:a=!1})=>{let o=`border border-[color:var(--border-hairline)] bg-[var(--surface-glass)] text-slate-600 hover:text-slate-900 dark:text-slate-300 dark:hover:text-white`;return r===`primary`?o=`bg-slate-900 text-white shadow-[var(--elevation-raised)] hover:bg-slate-700 dark:bg-white dark:text-void-900 dark:hover:bg-slate-100`:r===`danger`?o=`border border-status-red/30 bg-status-red/[0.06] text-status-red hover:bg-status-red/[0.12]`:r===`success`?o=`bg-status-green text-white shadow-[var(--elevation-raised)]`:r===`warning`&&(o=`bg-status-amber text-void-900 shadow-[0_4px_20px_rgba(245,158,11,0.3)] hover:bg-status-amber/80`),e(`button`,{type:`button`,onClick:e=>{if(i){e?.preventDefault();return}n()},disabled:a,"aria-disabled":a||i,"aria-busy":i,className:`inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2 text-xs font-bold relative overflow-hidden ${u} ${o}`,children:[e(`div`,{className:`flex items-center justify-center gap-2 transition-opacity duration-200 ${i?`opacity-0`:`opacity-100`}`,children:t}),i&&e(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:e(l,{className:`h-4 w-4 animate-spin`,strokeWidth:2.2})})]})},D=({icon:t,eyebrow:n,title:r,description:i,actions:a})=>e(`div`,{className:`flex flex-wrap items-start justify-between gap-5 border-b border-[color:var(--border-hairline)] px-7 py-6`,children:[e(`div`,{children:[e(`div`,{className:`flex items-center gap-2.5 font-mono text-[10px] font-bold uppercase tracking-[0.2em] text-signal-500`,children:[e(t,{className:`h-3.5 w-3.5`,strokeWidth:2.3}),n]}),e(`h2`,{className:`mt-3 font-display text-4xl font-black tracking-tight text-slate-900 dark:text-white`,children:r}),e(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-relaxed text-slate-500 dark:text-slate-400`,children:i})]}),a?e(`div`,{className:`flex flex-wrap items-center gap-2`,children:a}):null]}),O=({error:t,message:n,loading:r,loadingLabel:i=`Loading…`,children:a})=>e(`div`,{className:`px-7 py-6`,children:[t?e(`div`,{className:`mb-5`,children:e(T,{title:`Error`,tone:`error`,children:t})}):null,n?e(`div`,{className:`mb-5`,children:e(T,{title:`Success`,tone:`success`,children:n})}):null,r?e(T,{title:`Loading`,tone:`pending`,children:i}):a]});o(),t();var k=({className:t=``,title:o=`Placeholders`,items:l=[],label:u})=>{let p=c(),[m,g]=s(!1),[_,v]=s(!1),y=n(null),C=n(null),w=n(null),T=n(null),E=n(null),[D,O]=s({top:0,left:0}),[k,A]=s(null),j=l&&l.length>0,M=()=>{E.current&&clearTimeout(E.current),T.current&&clearTimeout(T.current),T.current=window.setTimeout(()=>{g(!0),v(!0)},150)},N=()=>{T.current&&clearTimeout(T.current),E.current&&clearTimeout(E.current),E.current=window.setTimeout(()=>{g(!1)},150)},P=e=>{navigator.clipboard.writeText(e),A(e),setTimeout(()=>A(null),2e3)};return a(()=>{!m&&_&&j&&(!document.activeElement||document.activeElement===document.body||C.current&&C.current.contains(document.activeElement))&&(w.current?.isConnected?(w.current.focus(),w.current=null):y.current?.isConnected&&y.current.focus())},[m]),i(()=>{if(m&&y.current&&C.current){let{top:e,left:t}=S({triggerRect:y.current.getBoundingClientRect(),contentRect:C.current.getBoundingClientRect(),position:`top`,align:`center`,gap:12,padding:12});O({top:e,left:t})}},[m]),i(()=>{C.current&&(b.killTweensOf(C.current),m?b.fromTo(C.current,{opacity:0,scale:.95,y:5},{opacity:1,scale:1,y:0,duration:p?0:parseFloat(h.timing.fast)/1e3,ease:h.easing.standard}):_&&b.to(C.current,{opacity:0,scale:.95,y:5,duration:p?0:parseFloat(h.timing.fast)/1e3,ease:h.easing.standard,onComplete:()=>v(!1)}))},[m,_,p]),a(()=>{let e=e=>{e.key===`Escape`&&m&&(T.current&&clearTimeout(T.current),E.current&&clearTimeout(E.current),g(!1))};return m&&document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),T.current&&clearTimeout(T.current),E.current&&clearTimeout(E.current)}},[m]),e(`button`,{type:`button`,ref:y,className:`inline-flex relative cursor-help text-left ${t}`,onMouseEnter:M,onMouseLeave:N,onClick:()=>{m?g(!1):(j&&(w.current=document.activeElement),g(!0),v(!0))},onFocusCapture:M,onBlurCapture:N,"aria-label":u||`More information about this field`,"aria-haspopup":j?`dialog`:`true`,"aria-expanded":m,"aria-describedby":!j&&m?`info-popover-panel`:void 0,children:[e(d,{className:`w-4 h-4 text-slate-400 hover:text-signal-500 transition-colors`,strokeWidth:1.5}),_&&r(e(`div`,{id:`info-popover-panel`,ref:C,className:`fixed z-[9999] p-4 bg-white/90 dark:bg-void-700/90 backdrop-blur-2xl rounded-xl shadow-[0_20px_40px_rgba(0,0,0,0.12)] dark:shadow-[0_20px_40px_rgba(0,0,0,0.4)] border border-black/[0.06] dark:border-white/[0.06] w-64`,style:{top:D.top,left:D.left},role:j?`dialog`:`tooltip`,tabIndex:-1,"aria-label":o||`Information`,onMouseEnter:M,onMouseLeave:N,children:[o?e(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400 mb-3`,children:o}):null,e(`ul`,{className:`space-y-2`,children:l.map(t=>e(`li`,{className:`flex flex-col gap-0.5 group`,children:[e(`div`,{className:`flex items-center gap-2`,children:[e(`span`,{className:`font-mono text-[11px] text-signal-500`,children:t.key}),e(`button`,{type:`button`,onClick:()=>P(t.key),className:`opacity-0 group-hover:opacity-100 transition-opacity focus:opacity-100 p-0.5 hover:bg-slate-100 dark:hover:bg-void-600 rounded`,title:`Copy placeholder`,children:k===t.key?e(f,{className:`w-3 h-3 text-green-500`,strokeWidth:2}):e(x,{className:`w-3 h-3 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300`,strokeWidth:1.5})})]}),e(`span`,{className:`text-[11px] text-slate-600 dark:text-slate-300`,children:t.desc})]},t.key))})]}),document.body)]})},A=({value:t,onChange:n,disabled:r})=>e(`div`,{className:`flex flex-col gap-2 min-w-[320px]`,children:[e(_,{value:t||``,onChange:n,disabled:r,mono:!0,placeholder:`e.g. feature/sprint{sprint_id}-implementation`,"aria-label":`Sprint branch scheme`,"aria-description":`Template used when naming sprint branches.`}),e(`div`,{className:`flex flex-wrap gap-x-2 gap-y-1 text-[10px] text-slate-400 dark:text-slate-500`,children:[e(`span`,{className:`font-bold uppercase tracking-wider text-slate-500`,children:`Placeholders:`}),Object.keys(C).map(t=>e(`code`,{className:`rounded bg-black/5 px-1 py-0.5 dark:bg-white/5`,children:`{${t}}`},t))]})]});export{O as a,T as i,k as n,D as o,E as r,A as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as e,_ as t,a as n,h as r,j as i,w as a,x as o,y as s}from"./vendor-Dl0fhdV0.js";import{t as c}from"./createLucideIcon-BshUfn15.js";import{t as l}from"./save-DFYp4CAL.js";import{r as u}from"./project-data-BSCsMQnj.js";import{r as d}from"./use-reduced-motion-Dxh6NCDM.js";import{Ar as ee,Ci as f,Cn as p,Jr as m,Lr as h,Nr as g,Si as _,Sn as v,St as te,Vr as y,_n as ne,ai as re,bn as ie,ci as ae,cn as oe,gn as se,hr as b,in as x,jt as ce,kr as le,nn as ue,on as de,rn as S,vi as fe,vn as pe,wr as me,xn as he,yn as ge,yr as C,zr as w}from"./index-DddY8OV0.js";var _e=c(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),T=c(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]);o(),i();var E={running:`border-signal-500/30 bg-signal-500/10 text-signal-600 dark:text-signal-400`,starting:`border-ember-500/30 bg-ember-500/10 text-ember-600 dark:text-ember-400`,stopped:`border-slate-400/25 bg-slate-500/10 text-slate-600 dark:border-slate-500/40 dark:bg-slate-500/15 dark:text-slate-300`,error:`border-status-red/30 bg-status-red/10 text-status-red`},D={healthy:`text-signal-500`,unreachable:`text-status-red`,unknown:`text-slate-400`},O=e=>{let t=typeof e.containerAppPort==`number`?e.containerAppPort:null,n=typeof e.hostPort==`number`?e.hostPort:null;return t&&n?`:${t} -> :${n}`:t?`:${t} -> pending`:n?`pending -> :${n}`:`port pending`},ve=({sessions:t,selectedSessionId:i,onSelectSession:a,onRemoveSession:o,removingSessionIds:s=[]})=>{let c=r(null),l=t.length,u=new Set(s);return n(`div`,{className:`relative w-full group`,children:[l>5&&n(e,{children:[n(`button`,{type:`button`,onClick:()=>{c.current&&c.current.scrollBy({left:-320,behavior:`smooth`})},className:`absolute -left-4 top-1/2 z-10 -translate-y-1/2 rounded-full border border-black/[0.08] bg-white/90 p-2 text-slate-600 opacity-0 shadow-sm backdrop-blur-sm transition-all hover:bg-white hover:text-slate-900 group-hover:opacity-100 dark:border-white/[0.08] dark:bg-[#05080d]/90 dark:text-slate-400 dark:hover:bg-[#05080d] dark:hover:text-white lg:flex lg:group-focus-within:flex focus-within:opacity-100 focus:opacity-100 group-focus-within:opacity-100 hidden`,title:`Scroll left`,children:n(_,{className:`h-5 w-5`,strokeWidth:2.5})}),n(`button`,{type:`button`,onClick:()=>{c.current&&c.current.scrollBy({left:320,behavior:`smooth`})},className:`absolute -right-4 top-1/2 z-10 -translate-y-1/2 rounded-full border border-black/[0.08] bg-white/90 p-2 text-slate-600 opacity-0 shadow-sm backdrop-blur-sm transition-all hover:bg-white hover:text-slate-900 group-hover:opacity-100 dark:border-white/[0.08] dark:bg-[#05080d]/90 dark:text-slate-400 dark:hover:bg-[#05080d] dark:hover:text-white lg:flex lg:group-focus-within:flex focus-within:opacity-100 focus:opacity-100 group-focus-within:opacity-100 hidden`,title:`Scroll right`,children:n(f,{className:`h-5 w-5`,strokeWidth:2.5})})]}),n(`div`,{ref:c,className:`flex w-full snap-x snap-mandatory gap-3 overflow-x-auto px-1 pb-2 pt-1 scrollbar-hide`,children:t.map(e=>{let t=i===e.id,r=S(e.id),s=!!e.hostPort,c=u.has(e.id);return n(`div`,{className:`relative w-[280px] flex-none snap-start rounded-[1.25rem] border p-4 transition-all lg:w-[calc(20%-0.6rem)] ${t?`border-signal-500/35 bg-signal-500/[0.08] shadow-[0_10px_28px_rgba(0,224,160,0.1)] ring-1 ring-signal-500/25 dark:bg-signal-500/[0.1]`:`border-black/[0.08] bg-white/68 backdrop-blur-xl hover:border-black/[0.14] hover:bg-white/80 dark:border-white/[0.08] dark:bg-void-900/35 dark:hover:border-white/[0.14] dark:hover:bg-void-900/50`}`,children:[t&&n(`div`,{className:`absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full border-2 border-white bg-signal-500 shadow-sm dark:border-void-900`,children:n(fe,{className:`w-2.5 h-2.5 text-void-900`,strokeWidth:3})}),n(`button`,{type:`button`,onClick:()=>a(e.id),className:`w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50 rounded-lg`,children:[n(`div`,{className:`flex items-center justify-between gap-3 mb-3`,children:[n(`span`,{className:`truncate text-sm font-semibold text-slate-900 dark:text-white`,children:e.sprintName}),n(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.14em] flex items-center gap-1.5 ${E[e.status]}`,children:[e.status===`starting`&&n(y,{className:`w-2.5 h-2.5 animate-spin`}),e.status]})]}),n(`div`,{className:`flex items-center gap-2 text-[11px] text-slate-600 dark:text-slate-400`,children:[n(m,{className:`h-3.5 w-3.5 ${D[e.healthStatus]}`,strokeWidth:2}),n(`span`,{children:O(e)})]}),n(`div`,{className:`mt-1 text-[11px] text-slate-500 dark:text-slate-500`,children:e.hostPort?`127.0.0.1:${e.hostPort}`:`waiting for routed port`})]}),n(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-black/[0.06] pt-3 dark:border-white/[0.06]`,children:[n(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c||o(e.id)},className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-xl border px-3 text-[11px] font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-status-red/50 ${c?`border-status-red/15 text-status-red cursor-not-allowed disabled:opacity-50`:`border-status-red/15 text-status-red hover:border-status-red/30 hover:bg-status-red/8`}`,title:`Remove preview container`,"aria-label":`Remove preview container`,disabled:c,"aria-disabled":c,"aria-busy":c,children:[c?n(y,{className:`h-3 w-3 animate-spin`,strokeWidth:2.5}):n(C,{className:`h-3 w-3`,strokeWidth:2.5}),c?`Removing...`:`Remove`]}),n(`a`,{href:s?ue(r):void 0,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-xl border border-black/[0.08] px-3 text-[11px] font-semibold text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-500/50 ${s?``:`pointer-events-none opacity-50`}`,title:`Open isolated preview in a new tab`,onClick:e=>e.stopPropagation(),"aria-disabled":!s,children:[n(re,{className:`h-3 w-3`,strokeWidth:2.5}),`Open Link`]})]})]},e.id)})})]})};o();var k={running:`border-signal-500/30 bg-signal-500/10 text-signal-600 dark:text-signal-400`,starting:`border-ember-500/30 bg-ember-500/10 text-ember-600 dark:text-ember-400`,stopped:`border-slate-400/25 bg-slate-500/10 text-slate-600 dark:border-slate-500/40 dark:bg-slate-500/15 dark:text-slate-300`,error:`border-status-red/30 bg-status-red/10 text-status-red`},ye=({session:e,onNavigateBack:t,onNavigateForward:r,onReload:i,onAddressSubmit:a,addressValue:o,onAddressChange:c,navigationEnabled:l=!0,children:u})=>{let[d,p]=s(`normal`);if(!e)return n(`div`,{className:`overflow-hidden rounded-[1.75rem] border border-black/[0.06] bg-white/72 shadow-[0_24px_72px_rgba(15,23,42,0.08)] dark:border-white/[0.06] dark:bg-void-900/55 dark:shadow-[0_30px_80px_rgba(0,0,0,0.35)]`,children:n(`div`,{className:`relative h-[calc(100vh-23rem)] min-h-[540px] bg-slate-100/70 dark:bg-void-950`,children:n(`div`,{className:`flex h-full flex-col items-center justify-center px-8 text-center`,children:[n(ae,{className:`h-12 w-12 text-slate-300 dark:text-slate-600`,strokeWidth:1.5}),n(`h2`,{className:`mt-4 text-xl font-semibold text-slate-800 dark:text-slate-100`,children:`No preview active`}),n(`p`,{className:`mt-2 max-w-xl text-sm leading-6 text-slate-500 dark:text-slate-400`,children:`Start a sprint preview to build the selected sprint into its own isolated container and browse it directly from the dashboard.`})]})})});let m=d===`fullscreen`,g=d===`minimized`,v=d===`closed`;return n(`div`,{className:m?`fixed inset-0 z-50 flex flex-col bg-white dark:bg-[#04070b]`:``,children:[g&&!m&&!v&&n(`div`,{className:`mb-5 flex items-center justify-between rounded-2xl border border-black/[0.06] bg-white/72 p-4 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`flex items-center gap-4`,children:[n(`div`,{className:`flex items-center gap-2`,children:[n(`div`,{className:`h-2.5 w-2.5 rounded-full bg-status-red/80`}),n(`div`,{className:`h-2.5 w-2.5 rounded-full bg-amber-400/80`}),n(`div`,{className:`h-2.5 w-2.5 rounded-full bg-signal-500/90`})]}),n(`span`,{className:`text-sm font-semibold text-slate-700 dark:text-slate-300`,children:e.sprintName}),n(`div`,{className:`rounded-full border px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.16em] ${k[e.status]}`,children:e.status})]}),n(`button`,{type:`button`,onClick:()=>p(`normal`),className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-xl border border-black/[0.08] px-3 text-[11px] font-semibold text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:[n(w,{className:`h-3 w-3`,strokeWidth:2.5}),`Restore`]})]}),v&&!m&&!g&&n(`div`,{className:`mb-5 overflow-hidden rounded-[1.75rem] border border-black/[0.06] bg-white/72 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:n(`div`,{className:`relative flex h-[calc(100vh-23rem)] min-h-[540px] flex-col items-center justify-center bg-slate-100/70 px-8 text-center dark:bg-void-950`,children:[n(`div`,{className:`h-12 w-12 rounded-full border border-black/[0.08] flex items-center justify-center mb-4 dark:border-white/[0.08]`,children:n(b,{className:`h-5 w-5 text-slate-400`,strokeWidth:2})}),n(`h2`,{className:`text-xl font-semibold text-slate-800 dark:text-slate-100`,children:`Window Closed`}),n(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-slate-500 dark:text-slate-400`,children:`The preview window is closed but the session is still running in the background. Stop the session to end the container, or reopen the window.`}),n(`button`,{type:`button`,onClick:()=>p(`normal`),className:`mt-6 inline-flex h-10 items-center justify-center rounded-2xl border border-black/[0.08] px-4 text-sm font-semibold text-slate-700 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:`Reopen Window`})]})}),n(`div`,{className:g||v?`hidden`:m?`flex flex-col h-full w-full`:`overflow-hidden rounded-[1.75rem] border border-black/[0.06] bg-white/72 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`border-b border-black/[0.06] bg-white/72 px-4 py-3 dark:border-white/[0.06] dark:bg-void-900/55`,children:[n(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[n(`div`,{className:`flex items-center gap-2`,children:[n(`button`,{type:`button`,title:`Close window`,onClick:()=>p(`closed`),className:`group flex h-3 w-3 items-center justify-center rounded-full bg-status-red/80 transition hover:bg-status-red focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-status-red/50`,children:n(b,{className:`h-2 w-2 text-red-900 opacity-0 group-hover:opacity-100`,strokeWidth:3})}),n(`button`,{type:`button`,title:`Minimize window`,onClick:()=>p(`minimized`),className:`group flex h-3 w-3 items-center justify-center rounded-full bg-amber-400/80 transition hover:bg-amber-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-400/50`,children:n(h,{className:`h-2 w-2 text-amber-900 opacity-0 group-hover:opacity-100`,strokeWidth:3})}),n(`button`,{type:`button`,title:m?`Restore window`:`Maximize window`,onClick:()=>p(m?`normal`:`fullscreen`),className:`group flex h-3 w-3 items-center justify-center rounded-full bg-signal-500/90 transition hover:bg-signal-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50`,children:n(m?T:w,{className:`h-2 w-2 text-green-900 opacity-0 group-hover:opacity-100`,strokeWidth:3})})]}),n(`div`,{className:`rounded-full border px-2.5 py-1 text-[10px] font-bold uppercase tracking-[0.16em] ${k[e.status]}`,children:e.status})]}),n(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n(`button`,{type:`button`,onClick:t,disabled:!l,"aria-disabled":!l,title:l?`Go back`:`Back navigation requires a running container`,className:`inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-black/[0.08] text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:n(_,{className:`h-4 w-4`,strokeWidth:2.2})}),n(`button`,{type:`button`,onClick:r,disabled:!l,"aria-disabled":!l,title:l?`Go forward`:`Forward navigation requires a running container`,className:`inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-black/[0.08] text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:n(f,{className:`h-4 w-4`,strokeWidth:2.2})}),n(`button`,{type:`button`,onClick:i,disabled:!l,"aria-disabled":!l,title:l?`Reload preview`:`Reload requires a running container`,className:`inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-black/[0.08] text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:n(ee,{className:`h-4 w-4`,strokeWidth:2.2})}),n(`form`,{className:`flex min-w-[240px] flex-1 items-center`,onSubmit:e=>{e.preventDefault(),a(o)},children:n(`input`,{value:o,onInput:e=>c(e.currentTarget.value),disabled:!l,"aria-disabled":!l,title:l?`Preview address`:`Address entry requires a running container`,placeholder:l?`Enter path...`:`Container not running...`,className:`h-10 w-full rounded-2xl border border-black/[0.08] bg-white/80 px-4 font-mono text-sm text-slate-800 outline-none transition focus:border-signal-500/40 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-100`})})]})]}),n(`div`,{className:m?`flex-1 bg-slate-100/70 dark:bg-void-950`:`relative h-[calc(100vh-23rem)] min-h-[540px] bg-slate-100/70 dark:bg-void-950`,children:u})]})]})},be=({sprints:e,launchSprintId:t,onLaunchSprintChange:r,onLaunchContainer:i,launchEnabled:a,launchBusy:o})=>n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Launch Container`}),n(`div`,{className:`mt-4 space-y-3`,children:[n(`div`,{"aria-live":`polite`,className:`text-xs text-slate-500 mb-2`,children:o?`A preview is already launching...`:e.length===0?`No active sprint to launch`:a?null:`Select a project to start`}),n(`select`,{value:t,onChange:e=>r(e.currentTarget.value),disabled:!a||o||e.length===0,"aria-disabled":!a||o||e.length===0,className:`w-full rounded-2xl border border-black/[0.08] bg-white/85 px-3 py-2.5 text-sm text-slate-700 outline-none transition focus:border-signal-500/40 dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-200 ${!a||o||e.length===0?`cursor-not-allowed disabled:opacity-50 pointer-events-none`:``}`,children:[e.length===0&&n(`option`,{value:``,children:`No sprints available`}),e.map(e=>n(`option`,{value:e.id,children:e.name},e.id))]}),n(`button`,{type:`button`,onClick:()=>{a&&!o&&e.length>0&&t&&i()},disabled:!a||o||e.length===0||!t,"aria-disabled":!a||o||e.length===0||!t,"aria-busy":o,className:`inline-flex h-10 w-full items-center justify-center gap-2 rounded-2xl px-4 text-sm font-semibold text-void-900 transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50 ${!a||o||e.length===0||!t?`bg-signal-500 cursor-not-allowed opacity-50`:`bg-signal-500 hover:bg-signal-400`}`,children:[o?n(y,{className:`h-4 w-4 animate-spin`,strokeWidth:2.5}):n(g,{className:`h-4 w-4`,strokeWidth:2.2}),o?`Starting...`:e.length===0?`No Sprints`:a?`Launch Container`:`Unavailable`]})]})]});o();var xe=`sprint-preview:state`,Se=`sprint-preview:navigate`,Ce=e=>{let t=typeof e.containerAppPort==`number`?e.containerAppPort:null,n=typeof e.hostPort==`number`?e.hostPort:null;return t&&n?`:${t} -> :${n}`:t?`:${t} -> pending`:n?`pending -> :${n}`:`port pending`},A=()=>{let e=r(null),i=r(`/`),{selectedProject:o}=u(),{data:c,selectedSprint:f,selectedSprintId:m}=de(o?.id||null),{data:h}=d(o?.id||null),[g,_]=s(null),[y,b]=s(``),[fe,C]=s(``),[w,T]=s(!1),[E,D]=s(!1),[O,k]=s(!1),[A,j]=s([]),[we,M]=s(null),[Te,N]=s(`/`),[P,F]=s(`/`),[I,Ee]=s(!1),[L,R]=s(null),[z,De]=s(``),[B,V]=s(``),[H,Oe]=s({status:`idle`,message:null}),U=ce(),{sessions:ke,selectedSession:W,loading:Ae,error:je,refresh:G}=se({projectId:o?.id||null,selectedSprintId:m,activeSessionId:L});a(()=>{M(je||null)},[je]),a(()=>{let e=f?.id||c[0]?.id||``;De(t=>t&&c.some(e=>e.id===t)?t:e)},[f?.id,c]);let K=t(()=>new Set(A),[A]),q=h?.settings.sprintPreview.enabled??!0,J=h?.settings.sprintPreview.showInAppBrowser??!0,Me=q&&J,Y=W&&!K.has(W.id)?W:null,X=!!(Y&&Y.status===`running`&&Y.hostPort),Z=t(()=>Y?c.find(e=>e.id===Y.sprintId)||null:f||null,[Y,f,c]);a(()=>{if(Y){R(Y.id);let e=x(Y.lastKnownPath||`/`);i.current=e,F(e),N(e),V(`${S(Y.id)}${e}`);return}V(``)},[Y?.id]),a(()=>{i.current=P},[P]),a(()=>{!Y||!B||V(`${S(Y.id)}${x(i.current)}`)},[Y?.status,Y?.hostPort]),a(()=>{if(!o||!Z){_(null),b(``);return}if(!I)return;if(g?.projectId===o.id&&g.sprintId===Z.id){y||b(g.content);return}let e=!1;return U.setPending(`Loading script...`),pe(o.id,Z.id).then(t=>{e||(_(t),b(t.content),U.setSuccess(`Script loaded successfully`))}).catch(t=>{e||U.setError(`Failed to load script: ${t instanceof Error?t.message:String(t)}`)}),()=>{e=!0}},[g?.content,g?.projectId,g?.sprintId,y,o?.id,Z?.id,I]),a(()=>{if(!Y){C(``);return}C(`Loading logs...`);let e=!1,t=window.setTimeout(()=>{ne(Y.id,160).then(t=>{e||C(t.logs)}).catch(()=>{e||C(``)})},250);return()=>{e=!0,window.clearTimeout(t)}},[Y?.id]),a(()=>{if(!Y)return;let e=window.setInterval(()=>{ne(Y.id,160).then(e=>C(e.logs)).catch(()=>void 0)},8e3);return()=>window.clearInterval(e)},[Y?.id]),a(()=>{let e=e=>{if(!Y||e.origin!==S(Y.id))return;let t=e.data;if(!t||t.type!==xe)return;let n=x(t.path||`/`);F(n),N(n)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[Y?.id]);let Q=(t,n)=>{!Y||!e.current?.contentWindow||e.current.contentWindow.postMessage({type:Se,action:t,path:n},S(Y.id))},Ne=(e=i.current)=>{Y&&V(`${S(Y.id)}${x(e)}`)},Pe=async(e=z)=>{if(!(!o||!e)){if(!q){M(`Browser Preview is disabled for this project.`);return}T(!0),U.setPending(`Launching container...`);try{let t=await v(o.id,e);R(t.id),await G(!0),V(`${S(t.id)}${x(i.current)}`),U.setSuccess(`Container launched successfully`)}catch(e){U.setError(`Failed to launch container: ${e instanceof Error?e.message:String(e)}`)}finally{T(!1)}}},Fe=async()=>{if(Y){if(!q){M(`Browser Preview is disabled for this project.`);return}D(!0),U.setPending(`Rebuilding container...`);try{await ge(Y.id),await G(!0),Ne(),U.setSuccess(`Container rebuilt successfully`)}catch(e){U.setError(`Failed to rebuild container: ${e instanceof Error?e.message:String(e)}`)}finally{D(!1)}}},Ie=async()=>{if(Y){D(!0),U.setPending(`Stopping container...`);try{await p(Y.id),await G(!0),U.setSuccess(`Container stopped successfully`)}catch(e){U.setError(`Failed to stop container: ${e instanceof Error?e.message:String(e)}`)}finally{D(!1)}}},Le=async e=>{if(!K.has(e)){j(t=>[...t,e]),L===e&&(R(null),C(``),F(`/`),N(`/`));try{await ie(e),await G(!0)}catch(e){U.setError(`Failed to save script: ${e instanceof Error?e.message:String(e)}`)}finally{j(t=>t.filter(t=>t!==e))}}},$=async()=>{if(!(!o||!Z)){k(!0),U.setPending(`Saving script...`);try{_(await he(o.id,Z.id,y)),Ee(!1),U.setSuccess(`Script saved successfully`)}catch(e){Oe({status:`error`,message:`Failed to launch container: ${e instanceof Error?e.message:String(e)}`})}finally{k(!1)}}},Re=()=>{let e=x(Te);F(e),N(e),X?Q(`push`,e):Y&&V(`${S(Y.id)}${e}`)},ze=ke.filter(e=>(!o||e.projectId===o.id)&&!K.has(e.id));return o?n(te,{"aria-label":`Browser`,padding:`workbench`,className:`min-h-full`,"data-testid":`browser-page-root`,children:[n(`div`,{className:`mb-8 flex flex-col justify-between gap-8 lg:flex-row lg:items-end`,"data-testid":`browser-page-header`,children:[n(`div`,{className:`flex flex-col gap-4`,children:[n(`div`,{className:`flex items-center gap-2.5 font-mono text-[10px] font-bold uppercase tracking-[0.2em] text-signal-500`,children:[n(ae,{className:`h-3.5 w-3.5`,strokeWidth:2}),`Sprint Browser`]}),n(`h1`,{className:`font-display text-5xl font-black leading-[0.92] tracking-tighter text-slate-900 dark:text-white md:text-7xl`,children:`Build previews per sprint, isolated by container.`}),n(`p`,{className:`max-w-3xl text-base leading-relaxed text-slate-500 dark:text-slate-400`,children:`Each sprint preview runs from its own exported sprint snapshot and container, bound to a private host port and surfaced through the in-app browser.`})]}),n(`div`,{className:`flex items-center gap-2.5`,children:n(`button`,{type:`button`,onClick:()=>void G(),className:`inline-flex min-h-[44px] items-center gap-2.5 rounded-full border border-black/[0.06] bg-white/75 px-5 py-2.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-600 transition-all hover:-translate-y-px hover:text-slate-900 focus-visible:ring-2 focus-visible:ring-signal-500/40 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-300 dark:hover:text-white`,children:[n(ee,{className:`h-4 w-4 ${Ae?`animate-spin`:``}`,strokeWidth:2}),`Refresh`]})})]}),we&&n(`div`,{className:`mb-5 rounded-2xl border border-status-red/20 bg-status-red/10 px-4 py-3 text-sm text-status-red`,children:we}),H.status!==`idle`&&H.message&&n(`div`,{className:`mb-5 flex items-start gap-3 p-3 rounded-xl border bg-black/[0.02] dark:bg-white/[0.03] border-black/[0.06] dark:border-white/[0.06]`,children:[n(`div`,{className:`flex-1 text-sm font-medium mt-0.5 ${H.status===`error`?`text-status-red`:H.status===`success`?`text-status-green`:`text-signal-700 dark:text-signal-400`}`,children:[H.status===`pending`&&n(`span`,{className:`mr-2 inline-block h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent`}),H.message]}),n(`button`,{type:`button`,onClick:()=>Oe({status:`idle`,message:null}),className:`shrink-0 p-1 rounded-md opacity-70 hover:opacity-100 hover:bg-black/5 dark:hover:bg-white/10 transition-colors`,children:[n(`span`,{className:`sr-only`,children:`Dismiss`}),`✕`]})]}),U.feedback.status!==`idle`&&n(`div`,{className:`mb-5`,children:n(oe,{status:U.feedback.status,message:U.feedback.message,onDismiss:()=>U.clearFeedback(),retryAction:U.feedback.status===`error`&&U.feedback.message?.includes(`launch`)?()=>Pe():U.feedback.status===`error`&&U.feedback.message?.includes(`rebuild`)?()=>Fe():U.feedback.status===`error`&&U.feedback.message?.includes(`stop`)?()=>Ie():U.feedback.status===`error`&&U.feedback.message?.includes(`script`)?()=>$():void 0})}),n(`div`,{className:`mb-5`,children:n(ve,{sessions:ze,selectedSessionId:L,onSelectSession:R,onRemoveSession:e=>void Le(e),removingSessionIds:A})}),(!J||!q)&&n(`div`,{className:`rounded-[2rem] border border-black/[0.06] bg-white/70 p-8 text-sm text-slate-500 shadow-[0_20px_60px_rgba(15,23,42,0.06)] backdrop-blur-md dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-300 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Browser Preview`}),n(`div`,{className:`mt-3 text-lg font-semibold text-slate-900 dark:text-white`,children:q?`In-app browser workspace is hidden.`:`Preview runtime is disabled.`}),n(`p`,{className:`mt-2 max-w-2xl leading-6`,children:q?"Enable `Show in-app browser workspace` in Browser Preview settings to restore the embedded browser surface in the dashboard.":"Enable `Preview runtime enabled` in Browser Preview settings to launch and rebuild preview containers again."})]}),J&&q&&n(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_340px]`,"data-testid":`browser-main-tool-panel`,children:[n(ye,{session:Y,onNavigateBack:()=>Q(`back`),onNavigateForward:()=>Q(`forward`),onReload:()=>{X?Q(`reload`):Ne()},addressValue:Te,onAddressChange:N,onAddressSubmit:e=>Re(),navigationEnabled:X,children:[n(`div`,{"aria-live":`polite`,role:`status`,className:`sr-only`,children:[Y?`Container ${Y.status}`:`No active session`,E?` Action pending.`:``]}),Y&&B?n(`div`,{className:`relative h-full w-full`,children:[!X&&n(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center justify-center p-4`,children:n(`div`,{className:`flex items-center gap-3 rounded-full border border-black/[0.08] bg-white/90 px-4 py-2.5 shadow-[0_8px_32px_rgba(0,0,0,0.08)] backdrop-blur-md dark:border-white/[0.08] dark:bg-void-900/90 dark:shadow-[0_8px_32px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-signal-500 border-t-transparent`}),n(`span`,{className:`text-xs font-semibold text-slate-700 dark:text-slate-300`,"aria-hidden":`true`,children:Y.status===`starting`?`Container starting...`:Y.status===`error`?`Container failed`:`Waiting for connection...`})]})}),n(`iframe`,{ref:e,title:`Preview: ${o?.name||`Unknown Project`} - ${Y.sprintName}`,src:B,className:`h-full w-full border-0 bg-white`},Y.id)]}):null]}),n(`div`,{className:`space-y-5`,children:[n(be,{sprints:c,launchSprintId:z,onLaunchSprintChange:De,onLaunchContainer:()=>void Pe(),launchEnabled:Me,launchBusy:w}),n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`flex items-start justify-between gap-3`,children:[n(`div`,{children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Selected Sprint`}),n(`div`,{className:`mt-2 text-lg font-semibold text-slate-900 dark:text-white`,children:Z?.name||`All sprints`})]}),n(`button`,{type:`button`,onClick:()=>Ee(e=>!e),className:`inline-flex h-10 items-center gap-2 rounded-2xl border border-black/[0.08] px-3 text-xs font-semibold text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:[n(_e,{className:`h-4 w-4`,strokeWidth:2}),`Script`]})]}),n(`div`,{className:`mt-4 space-y-3 text-sm`,children:[Y&&n(`div`,{className:`rounded-2xl border border-sky-500/20 bg-sky-500/10 px-4 py-3 dark:border-sky-500/25 dark:bg-sky-500/12`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Port routing`}),n(`div`,{className:`mt-1 font-mono text-[12px] text-slate-700 dark:text-slate-300`,children:Ce(Y)})]}),n(`div`,{className:`rounded-2xl border border-ember-500/20 bg-ember-500/10 px-4 py-3 dark:border-ember-500/25 dark:bg-ember-500/12`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Script path`}),n(`div`,{className:`mt-1 break-all font-mono text-[12px] text-slate-700 dark:text-slate-300`,children:g?.path||Y?.startupScriptPath||`Open editor to load script`})]}),n(`div`,{className:`grid grid-cols-3 gap-2`,children:[n(`button`,{type:`button`,onClick:Fe,disabled:!Y||E,"aria-disabled":!Y||E,"aria-label":`Rebuild preview container`,"aria-busy":E,className:`inline-flex h-10 items-center justify-center gap-2 rounded-2xl border border-black/[0.08] text-xs font-semibold text-slate-700 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:border-slate-300/50 disabled:bg-slate-200/60 disabled:text-slate-500 disabled:opacity-100 dark:border-white/[0.08] dark:text-slate-200 dark:hover:border-white/[0.16] dark:hover:text-white dark:disabled:border-slate-700 dark:disabled:bg-slate-800/60 dark:disabled:text-slate-500`,children:[n(le,{className:`h-4 w-4 ${E?`animate-spin`:``}`,strokeWidth:2}),E?`Rebuilding...`:`Rebuild`]}),n(`button`,{type:`button`,onClick:Ie,disabled:!Y||E,"aria-disabled":!Y||E,"aria-label":`Stop preview container`,"aria-busy":E,className:`inline-flex h-10 items-center justify-center gap-2 rounded-2xl border border-black/[0.08] text-xs font-semibold text-slate-700 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:border-slate-300/50 disabled:bg-slate-200/60 disabled:text-slate-500 disabled:opacity-100 dark:border-white/[0.08] dark:text-slate-200 dark:hover:border-white/[0.16] dark:hover:text-white dark:disabled:border-slate-700 dark:disabled:bg-slate-800/60 dark:disabled:text-slate-500`,children:[n(me,{className:`h-4 w-4`,strokeWidth:2}),E?`Stopping...`:`Stop`]}),n(`a`,{href:Y?ue(`${S(Y.id)}${x(P)}`):void 0,target:`_blank`,rel:`noopener noreferrer`,"aria-disabled":!Y,title:Y?`Open preview in new tab`:`Start container to open`,className:`inline-flex h-10 items-center justify-center gap-2 rounded-2xl border border-black/[0.08] text-xs font-semibold text-slate-700 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-200 dark:hover:border-white/[0.16] dark:hover:text-white ${Y?``:`pointer-events-none opacity-50 cursor-not-allowed`}`,children:[n(re,{className:`h-4 w-4`,strokeWidth:2}),`Open`]})]})]})]}),n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Runtime notes`}),n(`div`,{className:`mt-4 space-y-3 text-sm text-slate-600 dark:text-slate-300`,children:[n(`p`,{children:"Ports are assigned from the sprint preview range and bound to `127.0.0.1` to avoid conflicts with the main dashboard."}),n(`p`,{children:`Each preview container runs from a dedicated sprint snapshot directory, so multiple active sprints from the same project stay isolated without registering git worktrees.`})]})]}),I&&n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[n(`div`,{children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Startup script`}),n(`div`,{className:`mt-1 text-sm font-semibold text-slate-900 dark:text-white`,children:g?.mode===`script`?`Custom file`:`Auto-generated fallback`})]}),n(`button`,{type:`button`,onClick:$,disabled:O||!Z,"aria-disabled":O||!Z,"aria-busy":O,className:`inline-flex h-10 items-center gap-2 rounded-2xl bg-slate-900 px-4 text-xs font-semibold text-white transition hover:bg-slate-800 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white dark:text-slate-900 dark:hover:bg-slate-100`,children:[n(l,{className:`h-4 w-4`,strokeWidth:2}),O?`Saving...`:`Save`]})]}),n(`textarea`,{value:y,onInput:e=>b(e.currentTarget.value),className:`min-h-[18rem] w-full rounded-[1.5rem] border border-black/[0.08] bg-slate-100/80 p-4 font-mono text-[12px] leading-6 text-slate-800 outline-none transition focus:border-signal-500/40 dark:border-white/[0.08] dark:bg-void-950 dark:text-slate-100`})]}),n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`mb-3 text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Container logs`}),n(`pre`,{className:`min-h-[18rem] max-h-[360px] overflow-auto rounded-[1.5rem] bg-slate-100/80 p-4 font-mono text-[11px] leading-6 text-slate-700 dark:bg-void-950 dark:text-slate-300`,children:fe||`No logs yet.`})]})]})]})]}):n(te,{"aria-label":`Browser`,padding:`workbench`,children:n(`div`,{className:`rounded-[2rem] border border-black/[0.06] bg-white/60 p-8 text-sm text-slate-500 backdrop-blur-md dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-300`,children:`Select a project first. The in-app browser launches one isolated preview container per sprint.`})})};export{A as BrowserPage};
|
|
1
|
+
import{O as e,_ as t,a as n,h as r,j as i,w as a,x as o,y as s}from"./vendor-Dl0fhdV0.js";import{t as c}from"./createLucideIcon-BshUfn15.js";import{t as l}from"./save-DFYp4CAL.js";import{r as u}from"./project-data-BSCsMQnj.js";import{r as d}from"./use-reduced-motion-Dxh6NCDM.js";import{Ar as ee,Ci as f,Cn as p,Jr as m,Lr as h,Nr as g,Si as _,Sn as v,St as te,Vr as y,_n as ne,ai as re,bn as ie,ci as ae,cn as oe,gn as se,hr as b,in as x,jt as ce,kr as le,nn as ue,on as de,rn as S,vi as fe,vn as pe,wr as me,xn as he,yn as ge,yr as C,zr as w}from"./index-DdNzHP9F.js";var _e=c(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),T=c(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]);o(),i();var E={running:`border-signal-500/30 bg-signal-500/10 text-signal-600 dark:text-signal-400`,starting:`border-ember-500/30 bg-ember-500/10 text-ember-600 dark:text-ember-400`,stopped:`border-slate-400/25 bg-slate-500/10 text-slate-600 dark:border-slate-500/40 dark:bg-slate-500/15 dark:text-slate-300`,error:`border-status-red/30 bg-status-red/10 text-status-red`},D={healthy:`text-signal-500`,unreachable:`text-status-red`,unknown:`text-slate-400`},O=e=>{let t=typeof e.containerAppPort==`number`?e.containerAppPort:null,n=typeof e.hostPort==`number`?e.hostPort:null;return t&&n?`:${t} -> :${n}`:t?`:${t} -> pending`:n?`pending -> :${n}`:`port pending`},ve=({sessions:t,selectedSessionId:i,onSelectSession:a,onRemoveSession:o,removingSessionIds:s=[]})=>{let c=r(null),l=t.length,u=new Set(s);return n(`div`,{className:`relative w-full group`,children:[l>5&&n(e,{children:[n(`button`,{type:`button`,onClick:()=>{c.current&&c.current.scrollBy({left:-320,behavior:`smooth`})},className:`absolute -left-4 top-1/2 z-10 -translate-y-1/2 rounded-full border border-black/[0.08] bg-white/90 p-2 text-slate-600 opacity-0 shadow-sm backdrop-blur-sm transition-all hover:bg-white hover:text-slate-900 group-hover:opacity-100 dark:border-white/[0.08] dark:bg-[#05080d]/90 dark:text-slate-400 dark:hover:bg-[#05080d] dark:hover:text-white lg:flex lg:group-focus-within:flex focus-within:opacity-100 focus:opacity-100 group-focus-within:opacity-100 hidden`,title:`Scroll left`,children:n(_,{className:`h-5 w-5`,strokeWidth:2.5})}),n(`button`,{type:`button`,onClick:()=>{c.current&&c.current.scrollBy({left:320,behavior:`smooth`})},className:`absolute -right-4 top-1/2 z-10 -translate-y-1/2 rounded-full border border-black/[0.08] bg-white/90 p-2 text-slate-600 opacity-0 shadow-sm backdrop-blur-sm transition-all hover:bg-white hover:text-slate-900 group-hover:opacity-100 dark:border-white/[0.08] dark:bg-[#05080d]/90 dark:text-slate-400 dark:hover:bg-[#05080d] dark:hover:text-white lg:flex lg:group-focus-within:flex focus-within:opacity-100 focus:opacity-100 group-focus-within:opacity-100 hidden`,title:`Scroll right`,children:n(f,{className:`h-5 w-5`,strokeWidth:2.5})})]}),n(`div`,{ref:c,className:`flex w-full snap-x snap-mandatory gap-3 overflow-x-auto px-1 pb-2 pt-1 scrollbar-hide`,children:t.map(e=>{let t=i===e.id,r=S(e.id),s=!!e.hostPort,c=u.has(e.id);return n(`div`,{className:`relative w-[280px] flex-none snap-start rounded-[1.25rem] border p-4 transition-all lg:w-[calc(20%-0.6rem)] ${t?`border-signal-500/35 bg-signal-500/[0.08] shadow-[0_10px_28px_rgba(0,224,160,0.1)] ring-1 ring-signal-500/25 dark:bg-signal-500/[0.1]`:`border-black/[0.08] bg-white/68 backdrop-blur-xl hover:border-black/[0.14] hover:bg-white/80 dark:border-white/[0.08] dark:bg-void-900/35 dark:hover:border-white/[0.14] dark:hover:bg-void-900/50`}`,children:[t&&n(`div`,{className:`absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full border-2 border-white bg-signal-500 shadow-sm dark:border-void-900`,children:n(fe,{className:`w-2.5 h-2.5 text-void-900`,strokeWidth:3})}),n(`button`,{type:`button`,onClick:()=>a(e.id),className:`w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50 rounded-lg`,children:[n(`div`,{className:`flex items-center justify-between gap-3 mb-3`,children:[n(`span`,{className:`truncate text-sm font-semibold text-slate-900 dark:text-white`,children:e.sprintName}),n(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.14em] flex items-center gap-1.5 ${E[e.status]}`,children:[e.status===`starting`&&n(y,{className:`w-2.5 h-2.5 animate-spin`}),e.status]})]}),n(`div`,{className:`flex items-center gap-2 text-[11px] text-slate-600 dark:text-slate-400`,children:[n(m,{className:`h-3.5 w-3.5 ${D[e.healthStatus]}`,strokeWidth:2}),n(`span`,{children:O(e)})]}),n(`div`,{className:`mt-1 text-[11px] text-slate-500 dark:text-slate-500`,children:e.hostPort?`127.0.0.1:${e.hostPort}`:`waiting for routed port`})]}),n(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-black/[0.06] pt-3 dark:border-white/[0.06]`,children:[n(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c||o(e.id)},className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-xl border px-3 text-[11px] font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-status-red/50 ${c?`border-status-red/15 text-status-red cursor-not-allowed disabled:opacity-50`:`border-status-red/15 text-status-red hover:border-status-red/30 hover:bg-status-red/8`}`,title:`Remove preview container`,"aria-label":`Remove preview container`,disabled:c,"aria-disabled":c,"aria-busy":c,children:[c?n(y,{className:`h-3 w-3 animate-spin`,strokeWidth:2.5}):n(C,{className:`h-3 w-3`,strokeWidth:2.5}),c?`Removing...`:`Remove`]}),n(`a`,{href:s?ue(r):void 0,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-xl border border-black/[0.08] px-3 text-[11px] font-semibold text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-500/50 ${s?``:`pointer-events-none opacity-50`}`,title:`Open isolated preview in a new tab`,onClick:e=>e.stopPropagation(),"aria-disabled":!s,children:[n(re,{className:`h-3 w-3`,strokeWidth:2.5}),`Open Link`]})]})]},e.id)})})]})};o();var k={running:`border-signal-500/30 bg-signal-500/10 text-signal-600 dark:text-signal-400`,starting:`border-ember-500/30 bg-ember-500/10 text-ember-600 dark:text-ember-400`,stopped:`border-slate-400/25 bg-slate-500/10 text-slate-600 dark:border-slate-500/40 dark:bg-slate-500/15 dark:text-slate-300`,error:`border-status-red/30 bg-status-red/10 text-status-red`},ye=({session:e,onNavigateBack:t,onNavigateForward:r,onReload:i,onAddressSubmit:a,addressValue:o,onAddressChange:c,navigationEnabled:l=!0,children:u})=>{let[d,p]=s(`normal`);if(!e)return n(`div`,{className:`overflow-hidden rounded-[1.75rem] border border-black/[0.06] bg-white/72 shadow-[0_24px_72px_rgba(15,23,42,0.08)] dark:border-white/[0.06] dark:bg-void-900/55 dark:shadow-[0_30px_80px_rgba(0,0,0,0.35)]`,children:n(`div`,{className:`relative h-[calc(100vh-23rem)] min-h-[540px] bg-slate-100/70 dark:bg-void-950`,children:n(`div`,{className:`flex h-full flex-col items-center justify-center px-8 text-center`,children:[n(ae,{className:`h-12 w-12 text-slate-300 dark:text-slate-600`,strokeWidth:1.5}),n(`h2`,{className:`mt-4 text-xl font-semibold text-slate-800 dark:text-slate-100`,children:`No preview active`}),n(`p`,{className:`mt-2 max-w-xl text-sm leading-6 text-slate-500 dark:text-slate-400`,children:`Start a sprint preview to build the selected sprint into its own isolated container and browse it directly from the dashboard.`})]})})});let m=d===`fullscreen`,g=d===`minimized`,v=d===`closed`;return n(`div`,{className:m?`fixed inset-0 z-50 flex flex-col bg-white dark:bg-[#04070b]`:``,children:[g&&!m&&!v&&n(`div`,{className:`mb-5 flex items-center justify-between rounded-2xl border border-black/[0.06] bg-white/72 p-4 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`flex items-center gap-4`,children:[n(`div`,{className:`flex items-center gap-2`,children:[n(`div`,{className:`h-2.5 w-2.5 rounded-full bg-status-red/80`}),n(`div`,{className:`h-2.5 w-2.5 rounded-full bg-amber-400/80`}),n(`div`,{className:`h-2.5 w-2.5 rounded-full bg-signal-500/90`})]}),n(`span`,{className:`text-sm font-semibold text-slate-700 dark:text-slate-300`,children:e.sprintName}),n(`div`,{className:`rounded-full border px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.16em] ${k[e.status]}`,children:e.status})]}),n(`button`,{type:`button`,onClick:()=>p(`normal`),className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-xl border border-black/[0.08] px-3 text-[11px] font-semibold text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:[n(w,{className:`h-3 w-3`,strokeWidth:2.5}),`Restore`]})]}),v&&!m&&!g&&n(`div`,{className:`mb-5 overflow-hidden rounded-[1.75rem] border border-black/[0.06] bg-white/72 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:n(`div`,{className:`relative flex h-[calc(100vh-23rem)] min-h-[540px] flex-col items-center justify-center bg-slate-100/70 px-8 text-center dark:bg-void-950`,children:[n(`div`,{className:`h-12 w-12 rounded-full border border-black/[0.08] flex items-center justify-center mb-4 dark:border-white/[0.08]`,children:n(b,{className:`h-5 w-5 text-slate-400`,strokeWidth:2})}),n(`h2`,{className:`text-xl font-semibold text-slate-800 dark:text-slate-100`,children:`Window Closed`}),n(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-slate-500 dark:text-slate-400`,children:`The preview window is closed but the session is still running in the background. Stop the session to end the container, or reopen the window.`}),n(`button`,{type:`button`,onClick:()=>p(`normal`),className:`mt-6 inline-flex h-10 items-center justify-center rounded-2xl border border-black/[0.08] px-4 text-sm font-semibold text-slate-700 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:`Reopen Window`})]})}),n(`div`,{className:g||v?`hidden`:m?`flex flex-col h-full w-full`:`overflow-hidden rounded-[1.75rem] border border-black/[0.06] bg-white/72 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`border-b border-black/[0.06] bg-white/72 px-4 py-3 dark:border-white/[0.06] dark:bg-void-900/55`,children:[n(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[n(`div`,{className:`flex items-center gap-2`,children:[n(`button`,{type:`button`,title:`Close window`,onClick:()=>p(`closed`),className:`group flex h-3 w-3 items-center justify-center rounded-full bg-status-red/80 transition hover:bg-status-red focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-status-red/50`,children:n(b,{className:`h-2 w-2 text-red-900 opacity-0 group-hover:opacity-100`,strokeWidth:3})}),n(`button`,{type:`button`,title:`Minimize window`,onClick:()=>p(`minimized`),className:`group flex h-3 w-3 items-center justify-center rounded-full bg-amber-400/80 transition hover:bg-amber-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-400/50`,children:n(h,{className:`h-2 w-2 text-amber-900 opacity-0 group-hover:opacity-100`,strokeWidth:3})}),n(`button`,{type:`button`,title:m?`Restore window`:`Maximize window`,onClick:()=>p(m?`normal`:`fullscreen`),className:`group flex h-3 w-3 items-center justify-center rounded-full bg-signal-500/90 transition hover:bg-signal-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50`,children:n(m?T:w,{className:`h-2 w-2 text-green-900 opacity-0 group-hover:opacity-100`,strokeWidth:3})})]}),n(`div`,{className:`rounded-full border px-2.5 py-1 text-[10px] font-bold uppercase tracking-[0.16em] ${k[e.status]}`,children:e.status})]}),n(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n(`button`,{type:`button`,onClick:t,disabled:!l,"aria-disabled":!l,title:l?`Go back`:`Back navigation requires a running container`,className:`inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-black/[0.08] text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:n(_,{className:`h-4 w-4`,strokeWidth:2.2})}),n(`button`,{type:`button`,onClick:r,disabled:!l,"aria-disabled":!l,title:l?`Go forward`:`Forward navigation requires a running container`,className:`inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-black/[0.08] text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:n(f,{className:`h-4 w-4`,strokeWidth:2.2})}),n(`button`,{type:`button`,onClick:i,disabled:!l,"aria-disabled":!l,title:l?`Reload preview`:`Reload requires a running container`,className:`inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-black/[0.08] text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:n(ee,{className:`h-4 w-4`,strokeWidth:2.2})}),n(`form`,{className:`flex min-w-[240px] flex-1 items-center`,onSubmit:e=>{e.preventDefault(),a(o)},children:n(`input`,{value:o,onInput:e=>c(e.currentTarget.value),disabled:!l,"aria-disabled":!l,title:l?`Preview address`:`Address entry requires a running container`,placeholder:l?`Enter path...`:`Container not running...`,className:`h-10 w-full rounded-2xl border border-black/[0.08] bg-white/80 px-4 font-mono text-sm text-slate-800 outline-none transition focus:border-signal-500/40 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-100`})})]})]}),n(`div`,{className:m?`flex-1 bg-slate-100/70 dark:bg-void-950`:`relative h-[calc(100vh-23rem)] min-h-[540px] bg-slate-100/70 dark:bg-void-950`,children:u})]})]})},be=({sprints:e,launchSprintId:t,onLaunchSprintChange:r,onLaunchContainer:i,launchEnabled:a,launchBusy:o})=>n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Launch Container`}),n(`div`,{className:`mt-4 space-y-3`,children:[n(`div`,{"aria-live":`polite`,className:`text-xs text-slate-500 mb-2`,children:o?`A preview is already launching...`:e.length===0?`No active sprint to launch`:a?null:`Select a project to start`}),n(`select`,{value:t,onChange:e=>r(e.currentTarget.value),disabled:!a||o||e.length===0,"aria-disabled":!a||o||e.length===0,className:`w-full rounded-2xl border border-black/[0.08] bg-white/85 px-3 py-2.5 text-sm text-slate-700 outline-none transition focus:border-signal-500/40 dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-200 ${!a||o||e.length===0?`cursor-not-allowed disabled:opacity-50 pointer-events-none`:``}`,children:[e.length===0&&n(`option`,{value:``,children:`No sprints available`}),e.map(e=>n(`option`,{value:e.id,children:e.name},e.id))]}),n(`button`,{type:`button`,onClick:()=>{a&&!o&&e.length>0&&t&&i()},disabled:!a||o||e.length===0||!t,"aria-disabled":!a||o||e.length===0||!t,"aria-busy":o,className:`inline-flex h-10 w-full items-center justify-center gap-2 rounded-2xl px-4 text-sm font-semibold text-void-900 transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50 ${!a||o||e.length===0||!t?`bg-signal-500 cursor-not-allowed opacity-50`:`bg-signal-500 hover:bg-signal-400`}`,children:[o?n(y,{className:`h-4 w-4 animate-spin`,strokeWidth:2.5}):n(g,{className:`h-4 w-4`,strokeWidth:2.2}),o?`Starting...`:e.length===0?`No Sprints`:a?`Launch Container`:`Unavailable`]})]})]});o();var xe=`sprint-preview:state`,Se=`sprint-preview:navigate`,Ce=e=>{let t=typeof e.containerAppPort==`number`?e.containerAppPort:null,n=typeof e.hostPort==`number`?e.hostPort:null;return t&&n?`:${t} -> :${n}`:t?`:${t} -> pending`:n?`pending -> :${n}`:`port pending`},A=()=>{let e=r(null),i=r(`/`),{selectedProject:o}=u(),{data:c,selectedSprint:f,selectedSprintId:m}=de(o?.id||null),{data:h}=d(o?.id||null),[g,_]=s(null),[y,b]=s(``),[fe,C]=s(``),[w,T]=s(!1),[E,D]=s(!1),[O,k]=s(!1),[A,j]=s([]),[we,M]=s(null),[Te,N]=s(`/`),[P,F]=s(`/`),[I,Ee]=s(!1),[L,R]=s(null),[z,De]=s(``),[B,V]=s(``),[H,Oe]=s({status:`idle`,message:null}),U=ce(),{sessions:ke,selectedSession:W,loading:Ae,error:je,refresh:G}=se({projectId:o?.id||null,selectedSprintId:m,activeSessionId:L});a(()=>{M(je||null)},[je]),a(()=>{let e=f?.id||c[0]?.id||``;De(t=>t&&c.some(e=>e.id===t)?t:e)},[f?.id,c]);let K=t(()=>new Set(A),[A]),q=h?.settings.sprintPreview.enabled??!0,J=h?.settings.sprintPreview.showInAppBrowser??!0,Me=q&&J,Y=W&&!K.has(W.id)?W:null,X=!!(Y&&Y.status===`running`&&Y.hostPort),Z=t(()=>Y?c.find(e=>e.id===Y.sprintId)||null:f||null,[Y,f,c]);a(()=>{if(Y){R(Y.id);let e=x(Y.lastKnownPath||`/`);i.current=e,F(e),N(e),V(`${S(Y.id)}${e}`);return}V(``)},[Y?.id]),a(()=>{i.current=P},[P]),a(()=>{!Y||!B||V(`${S(Y.id)}${x(i.current)}`)},[Y?.status,Y?.hostPort]),a(()=>{if(!o||!Z){_(null),b(``);return}if(!I)return;if(g?.projectId===o.id&&g.sprintId===Z.id){y||b(g.content);return}let e=!1;return U.setPending(`Loading script...`),pe(o.id,Z.id).then(t=>{e||(_(t),b(t.content),U.setSuccess(`Script loaded successfully`))}).catch(t=>{e||U.setError(`Failed to load script: ${t instanceof Error?t.message:String(t)}`)}),()=>{e=!0}},[g?.content,g?.projectId,g?.sprintId,y,o?.id,Z?.id,I]),a(()=>{if(!Y){C(``);return}C(`Loading logs...`);let e=!1,t=window.setTimeout(()=>{ne(Y.id,160).then(t=>{e||C(t.logs)}).catch(()=>{e||C(``)})},250);return()=>{e=!0,window.clearTimeout(t)}},[Y?.id]),a(()=>{if(!Y)return;let e=window.setInterval(()=>{ne(Y.id,160).then(e=>C(e.logs)).catch(()=>void 0)},8e3);return()=>window.clearInterval(e)},[Y?.id]),a(()=>{let e=e=>{if(!Y||e.origin!==S(Y.id))return;let t=e.data;if(!t||t.type!==xe)return;let n=x(t.path||`/`);F(n),N(n)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[Y?.id]);let Q=(t,n)=>{!Y||!e.current?.contentWindow||e.current.contentWindow.postMessage({type:Se,action:t,path:n},S(Y.id))},Ne=(e=i.current)=>{Y&&V(`${S(Y.id)}${x(e)}`)},Pe=async(e=z)=>{if(!(!o||!e)){if(!q){M(`Browser Preview is disabled for this project.`);return}T(!0),U.setPending(`Launching container...`);try{let t=await v(o.id,e);R(t.id),await G(!0),V(`${S(t.id)}${x(i.current)}`),U.setSuccess(`Container launched successfully`)}catch(e){U.setError(`Failed to launch container: ${e instanceof Error?e.message:String(e)}`)}finally{T(!1)}}},Fe=async()=>{if(Y){if(!q){M(`Browser Preview is disabled for this project.`);return}D(!0),U.setPending(`Rebuilding container...`);try{await ge(Y.id),await G(!0),Ne(),U.setSuccess(`Container rebuilt successfully`)}catch(e){U.setError(`Failed to rebuild container: ${e instanceof Error?e.message:String(e)}`)}finally{D(!1)}}},Ie=async()=>{if(Y){D(!0),U.setPending(`Stopping container...`);try{await p(Y.id),await G(!0),U.setSuccess(`Container stopped successfully`)}catch(e){U.setError(`Failed to stop container: ${e instanceof Error?e.message:String(e)}`)}finally{D(!1)}}},Le=async e=>{if(!K.has(e)){j(t=>[...t,e]),L===e&&(R(null),C(``),F(`/`),N(`/`));try{await ie(e),await G(!0)}catch(e){U.setError(`Failed to save script: ${e instanceof Error?e.message:String(e)}`)}finally{j(t=>t.filter(t=>t!==e))}}},$=async()=>{if(!(!o||!Z)){k(!0),U.setPending(`Saving script...`);try{_(await he(o.id,Z.id,y)),Ee(!1),U.setSuccess(`Script saved successfully`)}catch(e){Oe({status:`error`,message:`Failed to launch container: ${e instanceof Error?e.message:String(e)}`})}finally{k(!1)}}},Re=()=>{let e=x(Te);F(e),N(e),X?Q(`push`,e):Y&&V(`${S(Y.id)}${e}`)},ze=ke.filter(e=>(!o||e.projectId===o.id)&&!K.has(e.id));return o?n(te,{"aria-label":`Browser`,padding:`workbench`,className:`min-h-full`,"data-testid":`browser-page-root`,children:[n(`div`,{className:`mb-8 flex flex-col justify-between gap-8 lg:flex-row lg:items-end`,"data-testid":`browser-page-header`,children:[n(`div`,{className:`flex flex-col gap-4`,children:[n(`div`,{className:`flex items-center gap-2.5 font-mono text-[10px] font-bold uppercase tracking-[0.2em] text-signal-500`,children:[n(ae,{className:`h-3.5 w-3.5`,strokeWidth:2}),`Sprint Browser`]}),n(`h1`,{className:`font-display text-5xl font-black leading-[0.92] tracking-tighter text-slate-900 dark:text-white md:text-7xl`,children:`Build previews per sprint, isolated by container.`}),n(`p`,{className:`max-w-3xl text-base leading-relaxed text-slate-500 dark:text-slate-400`,children:`Each sprint preview runs from its own exported sprint snapshot and container, bound to a private host port and surfaced through the in-app browser.`})]}),n(`div`,{className:`flex items-center gap-2.5`,children:n(`button`,{type:`button`,onClick:()=>void G(),className:`inline-flex min-h-[44px] items-center gap-2.5 rounded-full border border-black/[0.06] bg-white/75 px-5 py-2.5 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-600 transition-all hover:-translate-y-px hover:text-slate-900 focus-visible:ring-2 focus-visible:ring-signal-500/40 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-300 dark:hover:text-white`,children:[n(ee,{className:`h-4 w-4 ${Ae?`animate-spin`:``}`,strokeWidth:2}),`Refresh`]})})]}),we&&n(`div`,{className:`mb-5 rounded-2xl border border-status-red/20 bg-status-red/10 px-4 py-3 text-sm text-status-red`,children:we}),H.status!==`idle`&&H.message&&n(`div`,{className:`mb-5 flex items-start gap-3 p-3 rounded-xl border bg-black/[0.02] dark:bg-white/[0.03] border-black/[0.06] dark:border-white/[0.06]`,children:[n(`div`,{className:`flex-1 text-sm font-medium mt-0.5 ${H.status===`error`?`text-status-red`:H.status===`success`?`text-status-green`:`text-signal-700 dark:text-signal-400`}`,children:[H.status===`pending`&&n(`span`,{className:`mr-2 inline-block h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent`}),H.message]}),n(`button`,{type:`button`,onClick:()=>Oe({status:`idle`,message:null}),className:`shrink-0 p-1 rounded-md opacity-70 hover:opacity-100 hover:bg-black/5 dark:hover:bg-white/10 transition-colors`,children:[n(`span`,{className:`sr-only`,children:`Dismiss`}),`✕`]})]}),U.feedback.status!==`idle`&&n(`div`,{className:`mb-5`,children:n(oe,{status:U.feedback.status,message:U.feedback.message,onDismiss:()=>U.clearFeedback(),retryAction:U.feedback.status===`error`&&U.feedback.message?.includes(`launch`)?()=>Pe():U.feedback.status===`error`&&U.feedback.message?.includes(`rebuild`)?()=>Fe():U.feedback.status===`error`&&U.feedback.message?.includes(`stop`)?()=>Ie():U.feedback.status===`error`&&U.feedback.message?.includes(`script`)?()=>$():void 0})}),n(`div`,{className:`mb-5`,children:n(ve,{sessions:ze,selectedSessionId:L,onSelectSession:R,onRemoveSession:e=>void Le(e),removingSessionIds:A})}),(!J||!q)&&n(`div`,{className:`rounded-[2rem] border border-black/[0.06] bg-white/70 p-8 text-sm text-slate-500 shadow-[0_20px_60px_rgba(15,23,42,0.06)] backdrop-blur-md dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-300 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Browser Preview`}),n(`div`,{className:`mt-3 text-lg font-semibold text-slate-900 dark:text-white`,children:q?`In-app browser workspace is hidden.`:`Preview runtime is disabled.`}),n(`p`,{className:`mt-2 max-w-2xl leading-6`,children:q?"Enable `Show in-app browser workspace` in Browser Preview settings to restore the embedded browser surface in the dashboard.":"Enable `Preview runtime enabled` in Browser Preview settings to launch and rebuild preview containers again."})]}),J&&q&&n(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_340px]`,"data-testid":`browser-main-tool-panel`,children:[n(ye,{session:Y,onNavigateBack:()=>Q(`back`),onNavigateForward:()=>Q(`forward`),onReload:()=>{X?Q(`reload`):Ne()},addressValue:Te,onAddressChange:N,onAddressSubmit:e=>Re(),navigationEnabled:X,children:[n(`div`,{"aria-live":`polite`,role:`status`,className:`sr-only`,children:[Y?`Container ${Y.status}`:`No active session`,E?` Action pending.`:``]}),Y&&B?n(`div`,{className:`relative h-full w-full`,children:[!X&&n(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center justify-center p-4`,children:n(`div`,{className:`flex items-center gap-3 rounded-full border border-black/[0.08] bg-white/90 px-4 py-2.5 shadow-[0_8px_32px_rgba(0,0,0,0.08)] backdrop-blur-md dark:border-white/[0.08] dark:bg-void-900/90 dark:shadow-[0_8px_32px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-signal-500 border-t-transparent`}),n(`span`,{className:`text-xs font-semibold text-slate-700 dark:text-slate-300`,"aria-hidden":`true`,children:Y.status===`starting`?`Container starting...`:Y.status===`error`?`Container failed`:`Waiting for connection...`})]})}),n(`iframe`,{ref:e,title:`Preview: ${o?.name||`Unknown Project`} - ${Y.sprintName}`,src:B,className:`h-full w-full border-0 bg-white`},Y.id)]}):null]}),n(`div`,{className:`space-y-5`,children:[n(be,{sprints:c,launchSprintId:z,onLaunchSprintChange:De,onLaunchContainer:()=>void Pe(),launchEnabled:Me,launchBusy:w}),n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`flex items-start justify-between gap-3`,children:[n(`div`,{children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Selected Sprint`}),n(`div`,{className:`mt-2 text-lg font-semibold text-slate-900 dark:text-white`,children:Z?.name||`All sprints`})]}),n(`button`,{type:`button`,onClick:()=>Ee(e=>!e),className:`inline-flex h-10 items-center gap-2 rounded-2xl border border-black/[0.08] px-3 text-xs font-semibold text-slate-600 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-300 dark:hover:border-white/[0.16] dark:hover:text-white`,children:[n(_e,{className:`h-4 w-4`,strokeWidth:2}),`Script`]})]}),n(`div`,{className:`mt-4 space-y-3 text-sm`,children:[Y&&n(`div`,{className:`rounded-2xl border border-sky-500/20 bg-sky-500/10 px-4 py-3 dark:border-sky-500/25 dark:bg-sky-500/12`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Port routing`}),n(`div`,{className:`mt-1 font-mono text-[12px] text-slate-700 dark:text-slate-300`,children:Ce(Y)})]}),n(`div`,{className:`rounded-2xl border border-ember-500/20 bg-ember-500/10 px-4 py-3 dark:border-ember-500/25 dark:bg-ember-500/12`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Script path`}),n(`div`,{className:`mt-1 break-all font-mono text-[12px] text-slate-700 dark:text-slate-300`,children:g?.path||Y?.startupScriptPath||`Open editor to load script`})]}),n(`div`,{className:`grid grid-cols-3 gap-2`,children:[n(`button`,{type:`button`,onClick:Fe,disabled:!Y||E,"aria-disabled":!Y||E,"aria-label":`Rebuild preview container`,"aria-busy":E,className:`inline-flex h-10 items-center justify-center gap-2 rounded-2xl border border-black/[0.08] text-xs font-semibold text-slate-700 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:border-slate-300/50 disabled:bg-slate-200/60 disabled:text-slate-500 disabled:opacity-100 dark:border-white/[0.08] dark:text-slate-200 dark:hover:border-white/[0.16] dark:hover:text-white dark:disabled:border-slate-700 dark:disabled:bg-slate-800/60 dark:disabled:text-slate-500`,children:[n(le,{className:`h-4 w-4 ${E?`animate-spin`:``}`,strokeWidth:2}),E?`Rebuilding...`:`Rebuild`]}),n(`button`,{type:`button`,onClick:Ie,disabled:!Y||E,"aria-disabled":!Y||E,"aria-label":`Stop preview container`,"aria-busy":E,className:`inline-flex h-10 items-center justify-center gap-2 rounded-2xl border border-black/[0.08] text-xs font-semibold text-slate-700 transition hover:border-black/[0.16] hover:text-slate-900 disabled:cursor-not-allowed disabled:border-slate-300/50 disabled:bg-slate-200/60 disabled:text-slate-500 disabled:opacity-100 dark:border-white/[0.08] dark:text-slate-200 dark:hover:border-white/[0.16] dark:hover:text-white dark:disabled:border-slate-700 dark:disabled:bg-slate-800/60 dark:disabled:text-slate-500`,children:[n(me,{className:`h-4 w-4`,strokeWidth:2}),E?`Stopping...`:`Stop`]}),n(`a`,{href:Y?ue(`${S(Y.id)}${x(P)}`):void 0,target:`_blank`,rel:`noopener noreferrer`,"aria-disabled":!Y,title:Y?`Open preview in new tab`:`Start container to open`,className:`inline-flex h-10 items-center justify-center gap-2 rounded-2xl border border-black/[0.08] text-xs font-semibold text-slate-700 transition hover:border-black/[0.16] hover:text-slate-900 dark:border-white/[0.08] dark:text-slate-200 dark:hover:border-white/[0.16] dark:hover:text-white ${Y?``:`pointer-events-none opacity-50 cursor-not-allowed`}`,children:[n(re,{className:`h-4 w-4`,strokeWidth:2}),`Open`]})]})]})]}),n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Runtime notes`}),n(`div`,{className:`mt-4 space-y-3 text-sm text-slate-600 dark:text-slate-300`,children:[n(`p`,{children:"Ports are assigned from the sprint preview range and bound to `127.0.0.1` to avoid conflicts with the main dashboard."}),n(`p`,{children:`Each preview container runs from a dedicated sprint snapshot directory, so multiple active sprints from the same project stay isolated without registering git worktrees.`})]})]}),I&&n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[n(`div`,{children:[n(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Startup script`}),n(`div`,{className:`mt-1 text-sm font-semibold text-slate-900 dark:text-white`,children:g?.mode===`script`?`Custom file`:`Auto-generated fallback`})]}),n(`button`,{type:`button`,onClick:$,disabled:O||!Z,"aria-disabled":O||!Z,"aria-busy":O,className:`inline-flex h-10 items-center gap-2 rounded-2xl bg-slate-900 px-4 text-xs font-semibold text-white transition hover:bg-slate-800 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white dark:text-slate-900 dark:hover:bg-slate-100`,children:[n(l,{className:`h-4 w-4`,strokeWidth:2}),O?`Saving...`:`Save`]})]}),n(`textarea`,{value:y,onInput:e=>b(e.currentTarget.value),className:`min-h-[18rem] w-full rounded-[1.5rem] border border-black/[0.08] bg-slate-100/80 p-4 font-mono text-[12px] leading-6 text-slate-800 outline-none transition focus:border-signal-500/40 dark:border-white/[0.08] dark:bg-void-950 dark:text-slate-100`})]}),n(`div`,{className:`rounded-[1.75rem] border border-black/[0.06] bg-white/72 p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)] backdrop-blur-xl dark:border-white/[0.06] dark:bg-void-900/45 dark:shadow-[0_20px_60px_rgba(0,0,0,0.24)]`,children:[n(`div`,{className:`mb-3 text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:`Container logs`}),n(`pre`,{className:`min-h-[18rem] max-h-[360px] overflow-auto rounded-[1.5rem] bg-slate-100/80 p-4 font-mono text-[11px] leading-6 text-slate-700 dark:bg-void-950 dark:text-slate-300`,children:fe||`No logs yet.`})]})]})]})]}):n(te,{"aria-label":`Browser`,padding:`workbench`,children:n(`div`,{className:`rounded-[2rem] border border-black/[0.06] bg-white/60 p-8 text-sm text-slate-500 backdrop-blur-md dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-300`,children:`Select a project first. The in-app browser launches one isolated preview container per sprint.`})})};export{A as BrowserPage};
|