@wkoutre/teamwork-os 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +0 -10
  2. package/cli.js +14 -2
  3. package/cli.jsc +0 -0
  4. package/dist/assets/AnalyticsPage-C24BvG1R.js +1 -0
  5. package/dist/assets/{BriefsPage-BsBjNIJT.js → BriefsPage-DrMSESEG.js} +1 -1
  6. package/dist/assets/{ChatPanel-BUNJ-rXp.js → ChatPanel-CC0ta99_.js} +1 -1
  7. package/dist/assets/{ContinuousImprovementPage-F6fizSUr.js → ContinuousImprovementPage-DyTwV7gP.js} +1 -1
  8. package/dist/assets/{HeartbeatPanel-q7mW5VDk.js → HeartbeatPanel-Dk6plplc.js} +1 -1
  9. package/dist/assets/IdeasContainer-DeZZF8d9.js +3 -0
  10. package/dist/assets/{MemoryExplore-wFiVBkXu.js → MemoryExplore-DS4IYHl2.js} +1 -1
  11. package/dist/assets/{MemoryHygiene-C_lFMujk.js → MemoryHygiene-DxUcjusq.js} +2 -2
  12. package/dist/assets/{MemoryInjections-F6D1_uAX.js → MemoryInjections-BO_kUrBn.js} +1 -1
  13. package/dist/assets/{MemoryPage-DS6LWMdS.js → MemoryPage-C2hIk5fW.js} +2 -2
  14. package/dist/assets/{MemoryWiki-cypT6R3l.js → MemoryWiki-Dh1MtBZV.js} +2 -2
  15. package/dist/assets/OrgPage-BAbdwx53.js +33 -0
  16. package/dist/assets/{SessionHistory-DwX-i9Io.js → SessionHistory-DXsOaHFV.js} +1 -1
  17. package/dist/assets/{SettingsPage-C6Xq22uB.js → SettingsPage-C1QRyGEh.js} +2 -2
  18. package/dist/assets/SupervisorDashboardPage-5IZyxfvh.css +1 -0
  19. package/dist/assets/SupervisorDashboardPage-Cnd1zMt9.js +1 -0
  20. package/dist/assets/{UsagePage-Cm8NsPw7.js → UsagePage-BcK454ym.js} +2 -2
  21. package/dist/assets/{events-CCBP4a9s.js → events-BK5ucyUu.js} +1 -1
  22. package/dist/assets/index-CiIY3MTP.css +1 -0
  23. package/dist/assets/index-DzJsiq8q.js +93 -0
  24. package/dist/assets/{lib-osArdP58.js → lib-CncUdc6D.js} +4 -4
  25. package/dist/assets/{types-CNhs8RVF.js → types-BeZJlDCI.js} +1 -1
  26. package/dist/assets/ui-DvNuX5MF.js +1 -0
  27. package/dist/index.html +5 -5
  28. package/gateway.jsc +0 -0
  29. package/onboarding-plugin/.claude-plugin/plugin.json +5 -0
  30. package/onboarding-plugin/skills/onboarding/SKILL.md +54 -0
  31. package/package.json +2 -1
  32. package/dist/assets/AnalyticsPage-BoafbdRY.js +0 -1
  33. package/dist/assets/IdeasContainer-DDhsyl1f.js +0 -3
  34. package/dist/assets/OrgPage-DP2-hcbf.js +0 -33
  35. package/dist/assets/SupervisorDashboardPage-BEuElLHE.css +0 -1
  36. package/dist/assets/SupervisorDashboardPage-CrsOGBZ8.js +0 -1
  37. package/dist/assets/index-C57L9wdB.css +0 -1
  38. package/dist/assets/index-tOLuwPW6.js +0 -93
  39. package/dist/assets/ui-Bx41p7g8.js +0 -1
  40. /package/dist/assets/{Button-xBBZQ0ie.js → Button-DTO6bgnL.js} +0 -0
  41. /package/dist/assets/{Input-HhV6M0tu.js → Input-iymdcwsf.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{t as r}from"./react-dom-Cnw6SoYl.js";import{r as i}from"./useWebSocket-Hg3RO6sx.js";import{r as a,t as o}from"./Input-HhV6M0tu.js";import{t as s}from"./Button-xBBZQ0ie.js";import{t as c}from"./useGet-CU5_p7vA.js";import{A as l,k as u}from"./index-tOLuwPW6.js";var d=t(e(),1);function f(e){let[t,n]=(0,d.useState)([]),[r,a]=(0,d.useState)(!0),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(0);(0,d.useEffect)(()=>{let t=!1,r=new AbortController;a(!0),s(null);let i=new URLSearchParams;e?.status&&i.set(`status`,e.status),e?.project&&i.set(`project`,e.project);let o=`/api/memory/hygiene/proposals${i.toString()?`?${i}`:``}`;return fetch(o,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return e.json()}).then(e=>{t||n(e)}).catch(e=>{t||s(e.message)}).finally(()=>{t||a(!1)}),()=>{t=!0,r.abort()}},[e?.status,e?.project,c]),i(`memory:proposal`,t=>{let r=t;e?.status&&r.status!==e.status||e?.project&&r.project!==e.project||n(e=>[r,...e])});let u=(0,d.useCallback)(async(e,t,r)=>{try{let i=await fetch(`/api/memory/hygiene/proposals/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,...r?{reason:r}:{}})});if(!i.ok)throw Error(`${i.status} ${i.statusText}`);let a=await i.json();n(t=>t.map(t=>t.id===e?a:t).filter(e=>e.status===`pending`))}catch(n){let r=n.message;throw console.warn(`[memory-proposals] ${t} ${e} failed:`,r),n}},[]);return{proposals:t,loading:r,error:o,approve:(0,d.useCallback)(e=>u(e,`approve`),[u]),reject:(0,d.useCallback)((e,t)=>u(e,`reject`,t),[u]),refresh:(0,d.useCallback)(()=>l(e=>e+1),[])}}function p(e=10){let[t,n]=(0,d.useState)([]),[r,a]=(0,d.useState)([]),[o,s]=(0,d.useState)(!0),[c,l]=(0,d.useState)(null),[u,f]=(0,d.useState)(0);return(0,d.useEffect)(()=>{let t=!1,r=new AbortController;return s(!0),l(null),Promise.all([fetch(`/api/memory/hygiene/runs?limit=${e}`,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(e.statusText);return e.json()}),fetch(`/api/memory/hygiene/runs/timeline`,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(e.statusText);return e.json()})]).then(([e,r])=>{t||(n(e),a(r))}).catch(e=>{t||l(e.message)}).finally(()=>{t||s(!1)}),()=>{t=!0,r.abort()}},[e,u]),i(`memory:steward-run-complete`,()=>{f(e=>e+1)}),{runs:t,timeline:r,loading:o,error:c}}var m={container:`_container_z76tk_1`,empty:`_empty_z76tk_7`,emptyTitle:`_emptyTitle_z76tk_20`,emptySub:`_emptySub_z76tk_26`,card:`_card_z76tk_31`,cardIn:`_cardIn_z76tk_1`,cardHeader:`_cardHeader_z76tk_51`,typeBadge:`_typeBadge_z76tk_59`,typeBadgeSynthesis:`_typeBadgeSynthesis_z76tk_71`,typeBadgeTombstone:`_typeBadgeTombstone_z76tk_77`,typeBadgeContradiction:`_typeBadgeContradiction_z76tk_83`,targetRow:`_targetRow_z76tk_89`,primaryFile:`_primaryFile_z76tk_97`,extraFilesToggle:`_extraFilesToggle_z76tk_111`,timestamp:`_timestamp_z76tk_146`,extraFilesList:`_extraFilesList_z76tk_153`,action:`_action_z76tk_172`,bodyDisclosure:`_bodyDisclosure_z76tk_180`,bodySummary:`_bodySummary_z76tk_187`,bodyMeta:`_bodyMeta_z76tk_228`,bodyPre:`_bodyPre_z76tk_235`,actions:`_actions_z76tk_250`,rejectGroup:`_rejectGroup_z76tk_257`,rejectLabel:`_rejectLabel_z76tk_265`,rejectHint:`_rejectHint_z76tk_272`,rejectInput:`_rejectInput_z76tk_277`,kbdHint:`_kbdHint_z76tk_282`,actionError:`_actionError_z76tk_296`},h=n(),g={synthesis:`Synthesis`,tombstone:`Tombstone`,contradiction:`Contradiction`},_={synthesis:m.typeBadgeSynthesis,tombstone:m.typeBadgeTombstone,contradiction:m.typeBadgeContradiction};function v(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function y({proposal:e,onApprove:t,onReject:n}){let[r,i]=(0,d.useState)(!1),[o,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(null),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(!1),C=g[e.type]??e.type,w=_[e.type]??m.typeBadgeSynthesis,T=e.targetFiles[0],E=e.targetFiles.slice(1),D=e.draftBody.split(`
2
- `).length,O=e.draftBody.length,k=`extra-files-${e.id}`,A=async()=>{u(!0),p(null);try{await t()}catch(e){p(`Approve failed: ${e.message}`)}finally{u(!1)}},j=async()=>{if(o.trim()){u(!0),p(null);try{await n(o.trim())}catch(e){p(`Reject failed: ${e.message}`)}finally{u(!1)}}},M=()=>{i(!1),c(``),p(null)};return(0,h.jsxs)(`article`,{className:m.card,"aria-label":`${C} proposal for ${T}${E.length?` and ${E.length} more`:``}`,"aria-busy":l,children:[(0,h.jsxs)(`div`,{className:m.cardHeader,children:[(0,h.jsx)(`span`,{className:`${m.typeBadge} ${w}`,children:C}),(0,h.jsxs)(`div`,{className:m.targetRow,children:[(0,h.jsx)(`code`,{className:m.primaryFile,children:T}),E.length>0&&(0,h.jsxs)(`button`,{type:`button`,className:m.extraFilesToggle,onClick:()=>b(e=>!e),"aria-expanded":y,"aria-controls":k,"aria-label":y?`Hide additional files`:`Show ${E.length} more file${E.length===1?``:`s`}`,children:[y?`−`:`+`,` `,E.length,` more`]})]}),(0,h.jsx)(`span`,{className:m.timestamp,children:v(e.createdAt)})]}),y&&E.length>0&&(0,h.jsx)(`ul`,{className:m.extraFilesList,id:k,children:E.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{children:e})},e))}),(0,h.jsx)(`p`,{className:m.action,children:e.proposedAction}),(0,h.jsxs)(`details`,{className:m.bodyDisclosure,open:x,onToggle:e=>S(e.target.open),children:[(0,h.jsxs)(`summary`,{className:m.bodySummary,children:[(0,h.jsx)(`span`,{children:x?`Hide proposed body`:`Show proposed body`}),(0,h.jsxs)(`span`,{className:m.bodyMeta,children:[D,` line`,D===1?``:`s`,` · `,O.toLocaleString(),` chars`]})]}),(0,h.jsx)(`pre`,{className:m.bodyPre,children:e.draftBody})]}),r?(0,h.jsxs)(`div`,{className:m.rejectGroup,onKeyDown:e=>{e.key===`Escape`&&!l&&(e.stopPropagation(),M())},children:[(0,h.jsxs)(`label`,{htmlFor:`reason-${e.id}`,className:m.rejectLabel,children:[`Why reject? `,(0,h.jsx)(`span`,{className:m.rejectHint,children:`(required)`})]}),(0,h.jsx)(a,{id:`reason-${e.id}`,className:m.rejectInput,placeholder:`e.g. duplicates existing canonical file; topic too broad; etc.`,value:o,onChange:e=>c(e.target.value),rows:2,autoFocus:!0}),(0,h.jsxs)(`div`,{className:m.actions,children:[(0,h.jsx)(s,{variant:`danger`,size:`sm`,disabled:l||!o.trim(),onClick:j,children:l?`Rejecting…`:`Confirm reject`}),(0,h.jsxs)(s,{variant:`ghost`,size:`sm`,disabled:l,onClick:M,children:[`Cancel `,(0,h.jsx)(`kbd`,{className:m.kbdHint,"aria-hidden":`true`,children:`Esc`})]})]})]}):(0,h.jsxs)(`div`,{className:m.actions,children:[(0,h.jsx)(s,{variant:`primary`,size:`sm`,disabled:l,onClick:A,"aria-label":`Approve proposal ${e.id}`,children:l?`Approving…`:`Approve`}),(0,h.jsx)(s,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>{i(!0),p(null)},"aria-label":`Reject proposal ${e.id}`,children:`Reject`})]}),f&&(0,h.jsx)(`div`,{className:m.actionError,role:`alert`,children:f})]})}function b({proposals:e,loading:t,error:n,approve:r,reject:i}){return t?(0,h.jsx)(`p`,{className:m.empty,children:`Loading proposals…`}):n?(0,h.jsxs)(`p`,{className:m.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:m.empty,children:[(0,h.jsx)(`span`,{className:m.emptyTitle,children:`Inbox zero.`}),(0,h.jsx)(`span`,{className:m.emptySub,children:`The steward has no pending proposals right now.`})]}):(0,h.jsx)(`div`,{className:m.container,"aria-live":`polite`,children:e.map(e=>(0,h.jsx)(y,{proposal:e,onApprove:()=>r(e.id),onReject:t=>i(e.id,t)},e.id))})}var x={wrap:`_wrap_1t8pi_1`,tableHeader:`_tableHeader_1t8pi_10`,chevronSpacer:`_chevronSpacer_1t8pi_25`,empty:`_empty_1t8pi_29`,emptyTitle:`_emptyTitle_1t8pi_42`,emptySub:`_emptySub_1t8pi_48`,runGroup:`_runGroup_1t8pi_53`,row:`_row_1t8pi_61`,rowOpen:`_rowOpen_1t8pi_86`,chevron:`_chevron_1t8pi_25`,col:`_col_1t8pi_105`,colPrimary:`_colPrimary_1t8pi_112`,colSecondary:`_colSecondary_1t8pi_117`,colValue:`_colValue_1t8pi_126`,status:`_status_1t8pi_132`,statusDot:`_statusDot_1t8pi_146`,statusOk:`_statusOk_1t8pi_153`,statusError:`_statusError_1t8pi_159`,detail:`_detail_1t8pi_165`,detailOpen:`_detailOpen_1t8pi_173`,detailInner:`_detailInner_1t8pi_179`,detailEmpty:`_detailEmpty_1t8pi_186`,projectList:`_projectList_1t8pi_193`,projectRow:`_projectRow_1t8pi_202`,projectName:`_projectName_1t8pi_214`,metric:`_metric_1t8pi_223`,metricLabel:`_metricLabel_1t8pi_230`,metricValue:`_metricValue_1t8pi_237`,metricWarn:`_metricWarn_1t8pi_244`,errorBlock:`_errorBlock_1t8pi_248`},S=10;function C(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`}function w(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function T({run:e,isOpen:t,onToggle:n}){let r=e.projects.length,i=!e.error,a=`run-detail-${e.id}`,o=(0,d.useRef)(null);return(0,d.useEffect)(()=>{let e=o.current;e&&(t?e.removeAttribute(`inert`):e.setAttribute(`inert`,``))},[t]),(0,h.jsxs)(`div`,{className:x.runGroup,children:[(0,h.jsxs)(`button`,{type:`button`,className:`${x.row} ${t?x.rowOpen:``}`,onClick:n,"aria-expanded":t,"aria-controls":a,children:[(0,h.jsx)(`span`,{className:x.chevron,"aria-hidden":`true`,children:`▸`}),(0,h.jsxs)(`span`,{className:x.col,"data-label":`When`,children:[(0,h.jsx)(`span`,{className:x.colPrimary,children:w(e.startedAt)}),(0,h.jsx)(`span`,{className:x.colSecondary,children:new Date(e.startedAt).toLocaleString()})]}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Duration`,children:(0,h.jsx)(`span`,{className:x.colValue,children:C(e.durationMs)})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Projects`,children:(0,h.jsx)(`span`,{className:x.colValue,children:r})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Fixes`,children:(0,h.jsx)(`span`,{className:x.colValue,children:e.totalAutoFixes})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Judgments`,children:(0,h.jsx)(`span`,{className:x.colValue,children:e.totalJudgments})}),(0,h.jsxs)(`span`,{className:`${x.status} ${i?x.statusOk:x.statusError}`,children:[(0,h.jsx)(`span`,{className:x.statusDot,"aria-hidden":`true`}),i?`OK`:`Error`]})]}),(0,h.jsx)(`div`,{id:a,ref:o,className:`${x.detail} ${t?x.detailOpen:``}`,role:`region`,"aria-label":`Details for run at ${new Date(e.startedAt).toLocaleString()}`,children:(0,h.jsxs)(`div`,{className:x.detailInner,children:[e.projects.length===0?(0,h.jsx)(`p`,{className:x.detailEmpty,children:`No projects scanned.`}):(0,h.jsx)(`ul`,{className:x.projectList,children:e.projects.map(e=>{let t=e.structureCompliancePct<90,n=e.freshnessPct<90;return(0,h.jsxs)(`li`,{className:x.projectRow,children:[(0,h.jsx)(`span`,{className:x.projectName,children:e.project}),(0,h.jsxs)(`span`,{className:`${x.metric} ${t?x.metricWarn:``}`,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Structure`}),(0,h.jsxs)(`span`,{className:x.metricValue,children:[e.structureCompliancePct,`%`]})]}),(0,h.jsxs)(`span`,{className:`${x.metric} ${n?x.metricWarn:``}`,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Freshness`}),(0,h.jsxs)(`span`,{className:x.metricValue,children:[e.freshnessPct,`%`]})]}),(0,h.jsxs)(`span`,{className:x.metric,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Fixes`}),(0,h.jsx)(`span`,{className:x.metricValue,children:e.autoFixCount})]})]},e.project)})}),e.error&&(0,h.jsxs)(`div`,{className:x.errorBlock,role:`alert`,children:[(0,h.jsx)(`strong`,{children:`Error:`}),` `,e.error]})]})})]})}function E({runs:e,loading:t,error:n}){let[r,i]=(0,d.useState)(null),a=e.slice(0,S);return t?(0,h.jsx)(`p`,{className:x.empty,children:`Loading runs…`}):n?(0,h.jsxs)(`p`,{className:x.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:x.empty,children:[(0,h.jsx)(`span`,{className:x.emptyTitle,children:`No steward runs yet.`}),(0,h.jsx)(`span`,{className:x.emptySub,children:`Runs will appear here once the steward fires.`})]}):(0,h.jsxs)(`div`,{className:x.wrap,"aria-label":`Steward run history`,children:[(0,h.jsxs)(`div`,{className:x.tableHeader,children:[(0,h.jsx)(`span`,{className:x.chevronSpacer,"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:`When`}),(0,h.jsx)(`span`,{children:`Duration`}),(0,h.jsx)(`span`,{children:`Projects`}),(0,h.jsx)(`span`,{children:`Fixes`}),(0,h.jsx)(`span`,{children:`Judgments`}),(0,h.jsx)(`span`,{children:`Status`})]}),a.map(e=>(0,h.jsx)(T,{run:e,isOpen:r===e.id,onToggle:()=>i(r===e.id?null:e.id)},e.id))]})}var D={wrap:`_wrap_1xug7_1`,empty:`_empty_1xug7_7`,emptyTitle:`_emptyTitle_1xug7_20`,emptySub:`_emptySub_1xug7_26`,row:`_row_1xug7_31`,project:`_project_1xug7_47`,projectName:`_projectName_1xug7_54`,projectMeta:`_projectMeta_1xug7_64`,metric:`_metric_1xug7_70`,metricLabel:`_metricLabel_1xug7_77`,sparkWrap:`_sparkWrap_1xug7_85`,spark:`_spark_1xug7_85`,sparkEmpty:`_sparkEmpty_1xug7_98`,sparkMeta:`_sparkMeta_1xug7_105`,sparkValue:`_sparkValue_1xug7_112`,sparkValueWarn:`_sparkValueWarn_1xug7_119`,sparkDelta:`_sparkDelta_1xug7_123`,sparkDeltaUp:`_sparkDeltaUp_1xug7_130`,sparkDeltaDown:`_sparkDeltaDown_1xug7_134`},O={structure:`Structure compliance`,freshness:`Freshness`};function k({points:e,metric:t}){if(e.length<2)return(0,h.jsx)(`div`,{className:D.sparkEmpty,children:`not enough data`});let n=e.map(e=>t===`structure`?e.structurePct:e.freshnessPct),r=Math.max(100,...n),i=Math.min(0,...n),a=Math.max(1,r-i),o=200/(e.length-1),s=n.map((e,t)=>{let n=t*o,r=36-(e-i)/a*36;return`${t===0?`M`:`L`} ${n.toFixed(1)} ${r.toFixed(1)}`}).join(` `),c=`${s} L 200 36 L 0 36 Z`,l=n[n.length-1],u=l-n[0],d=Math.round(u),f=l<90,p=d>0,m=d<0;return(0,h.jsxs)(`div`,{className:D.sparkWrap,children:[(0,h.jsxs)(`svg`,{className:D.spark,viewBox:`0 0 200 36`,preserveAspectRatio:`none`,role:`img`,"aria-label":`${O[t]}: ${l}% now (${d>=0?`+`:``}${d}% from ${e.length} runs ago)`,children:[(0,h.jsx)(`title`,{children:`${O[t]}: ${l}% (${d>=0?`+`:``}${d}%)`}),(0,h.jsx)(`path`,{d:c,fill:f?`var(--color-warning)`:`var(--color-positive)`,fillOpacity:`0.12`}),(0,h.jsx)(`path`,{d:s,fill:`none`,stroke:f?`var(--color-warning)`:`var(--color-positive)`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),(0,h.jsxs)(`div`,{className:D.sparkMeta,children:[(0,h.jsxs)(`span`,{className:`${D.sparkValue} ${f?D.sparkValueWarn:``}`,children:[l,`%`]}),Math.abs(d)>=1&&(0,h.jsxs)(`span`,{className:`${D.sparkDelta} ${p?D.sparkDeltaUp:``} ${m?D.sparkDeltaDown:``}`,"aria-hidden":`true`,children:[p?`▲`:`▼`,Math.abs(d)]})]})]})}function A({timeline:e,loading:t,error:n}){return t?(0,h.jsx)(`p`,{className:D.empty,children:`Loading trends…`}):n?(0,h.jsxs)(`p`,{className:D.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:D.empty,children:[(0,h.jsx)(`span`,{className:D.emptyTitle,children:`No timeline data yet.`}),(0,h.jsx)(`span`,{className:D.emptySub,children:`Trends will appear here after a few steward runs.`})]}):(0,h.jsx)(`div`,{className:D.wrap,children:e.map(e=>(0,h.jsxs)(`div`,{className:D.row,children:[(0,h.jsxs)(`div`,{className:D.project,children:[(0,h.jsx)(`span`,{className:D.projectName,children:e.project}),(0,h.jsxs)(`span`,{className:D.projectMeta,children:[e.points.length,` point`,e.points.length===1?``:`s`]})]}),(0,h.jsxs)(`div`,{className:D.metric,children:[(0,h.jsx)(`div`,{className:D.metricLabel,children:`Structure compliance`}),(0,h.jsx)(k,{points:e.points,metric:`structure`})]}),(0,h.jsxs)(`div`,{className:D.metric,children:[(0,h.jsx)(`div`,{className:D.metricLabel,children:`Freshness`}),(0,h.jsx)(k,{points:e.points,metric:`freshness`})]})]},e.project))})}var j=t(r(),1),M={backdrop:`_backdrop_37dat_1`,fadeIn:`_fadeIn_37dat_1`,panel:`_panel_37dat_7`,slideUp:`_slideUp_37dat_1`,header:`_header_37dat_17`,close:`_close_37dat_18`,member:`_member_37dat_19`,synthBtn:`_synthBtn_37dat_20`};function N({cluster:e,project:t,onClose:n}){let r=(0,d.useRef)(null),[i,a]=(0,d.useState)(!1),[o,c]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n()};document.addEventListener(`keydown`,t);let i=document.getElementById(`root`);return i&&i.setAttribute(`inert`,``),r.current?.focus(),()=>{document.removeEventListener(`keydown`,t),i&&i.removeAttribute(`inert`)}},[e,n]),e?(0,j.createPortal)((0,h.jsx)(`div`,{className:M.backdrop,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`cluster-drill-title`,onClick:n,children:(0,h.jsxs)(`div`,{ref:r,className:M.panel,tabIndex:-1,onClick:e=>e.stopPropagation(),children:[(0,h.jsxs)(`div`,{className:M.header,children:[(0,h.jsxs)(`h2`,{id:`cluster-drill-title`,children:[`Cluster: `,e.topic,` (`,e.size,` files)`]}),(0,h.jsx)(s,{className:M.close,onClick:n,"aria-label":`Close`,children:`×`})]}),e.files.map(t=>(0,h.jsxs)(`div`,{className:M.member,children:[(0,h.jsx)(`strong`,{children:t}),(0,h.jsxs)(`p`,{children:[`Keywords: `,e.keywords.join(`, `)]})]},t)),(0,h.jsx)(s,{variant:`primary`,className:M.synthBtn,disabled:i,onClick:async()=>{a(!0),c(null);try{let n=await fetch(`/api/memory/hygiene/synthesize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:t,clusterTopic:e.topic})});if(!n.ok)throw Error(`${n.status} ${n.statusText}`);c(`Proposal queued. Check the inbox.`)}catch(e){c(`Failed: ${e.message}`)}finally{a(!1)}},children:i?`Queueing…`:`Synthesize`}),o&&(0,h.jsx)(`p`,{role:`status`,children:o})]})}),document.body):null}function P(e=`claude-cron`,t){return c(`/api/memory/hygiene?${new URLSearchParams({project:e}).toString()}`,{refreshToken:t})}var F={card:`_card_u7jav_1`,header:`_header_u7jav_12`,headerLeft:`_headerLeft_u7jav_19`,title:`_title_u7jav_26`,generatedAt:`_generatedAt_u7jav_33`,refreshBtn:`_refreshBtn_u7jav_39`,loading:`_loading_u7jav_43`,error:`_error_u7jav_49`,metaRow:`_metaRow_u7jav_59`,metaChip:`_metaChip_u7jav_65`,metaChipLabel:`_metaChipLabel_u7jav_78`,metaChipValue:`_metaChipValue_u7jav_85`,metaWarn:`_metaWarn_u7jav_91`,gaugeGrid:`_gaugeGrid_u7jav_99`,gaugeItem:`_gaugeItem_u7jav_105`,gaugeLabel:`_gaugeLabel_u7jav_111`,gaugeValue:`_gaugeValue_u7jav_122`,gaugeTrack:`_gaugeTrack_u7jav_131`,gaugeFill:`_gaugeFill_u7jav_139`,issueList:`_issueList_u7jav_148`,issueRow:`_issueRow_u7jav_157`,issueKind:`_issueKind_u7jav_172`,issueFile:`_issueFile_u7jav_180`,issueAction:`_issueAction_u7jav_190`,issueDetail:`_issueDetail_u7jav_217`,allClear:`_allClear_u7jav_225`,clusters:`_clusters_u7jav_232`,clustersHeader:`_clustersHeader_u7jav_241`,clustersTitleRow:`_clustersTitleRow_u7jav_247`,clustersTitle:`_clustersTitle_u7jav_247`,clustersCount:`_clustersCount_u7jav_260`,clustersControls:`_clustersControls_u7jav_266`,clustersSearch:`_clustersSearch_u7jav_273`,minSizeControl:`_minSizeControl_u7jav_279`,minSizeLabel:`_minSizeLabel_u7jav_289`,minSizeSlider:`_minSizeSlider_u7jav_295`,minSizeValue:`_minSizeValue_u7jav_301`,emptyClusters:`_emptyClusters_u7jav_308`,clusterGrid:`_clusterGrid_u7jav_315`,clustersFadeIn:`_clustersFadeIn_u7jav_1`,showAllBtn:`_showAllBtn_u7jav_333`,showAllHint:`_showAllHint_u7jav_362`},I=24,L=3,R={orphan:`Orphan`,dangling:`Dangling pointer`,frontmatter:`Frontmatter`,structure:`Structure`,"undocumented-type":`Unknown type`,"stale-ref":`Stale ref`};function z({pct:e,warn:t}){let n={"--hc-gauge-fill":`${e}%`,"--hc-gauge-color":t?`var(--color-warning)`:`var(--color-positive)`};return(0,h.jsx)(`div`,{className:F.gaugeTrack,role:`progressbar`,"aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:(0,h.jsx)(`div`,{className:F.gaugeFill,style:n})})}function B({issue:e,onCopy:t,copied:n}){return(0,h.jsxs)(`div`,{className:F.issueRow,children:[(0,h.jsx)(`span`,{className:F.issueKind,children:R[e.kind]??e.kind}),(0,h.jsxs)(`span`,{className:F.issueFile,children:[e.file,e.line==null?``:`:${e.line}`]}),(0,h.jsx)(`span`,{className:F.issueDetail,children:e.detail}),(0,h.jsx)(`button`,{type:`button`,className:F.issueAction,onClick:()=>t(e.file),"aria-label":`Copy path ${e.file}`,children:n?`Copied`:`Copy path`})]})}function V({onClusterClick:e}={}){let[t,n]=(0,d.useState)(0),[r,i]=(0,d.useState)(``),[a,c]=(0,d.useState)(L),[f,p]=(0,d.useState)(!1),[m,g]=(0,d.useState)(null),_=(0,d.useRef)(null),v=(0,d.useRef)(!0),y=P(`claude-cron`,t);(0,d.useEffect)(()=>(v.current=!0,()=>{v.current=!1,_.current!==null&&window.clearTimeout(_.current)}),[]);let b=(0,d.useDeferredValue)(r),x=y.status===`ok`?y.data.clusters??[]:[],S=(0,d.useMemo)(()=>x.reduce((e,t)=>t.size>e?t.size:e,0),[x]),C=(0,d.useMemo)(()=>{let e=b.trim().toLowerCase();return x.filter(t=>t.size<a?!1:e?t.topic.toLowerCase().includes(e):!0)},[x,b,a]),w=(0,d.useMemo)(()=>f?C:C.slice(0,I),[C,f]),T=x.length,E=T-C.length,D=C.length-w.length,O=e=>{v.current&&(g(e),_.current!==null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{_.current=null,g(t=>t===e?null:t)},1500))},k=e=>{if(!navigator.clipboard){window.prompt(`Copy memory file path:`,e),O(e);return}let t;try{t=navigator.clipboard.writeText(e)}catch{window.prompt(`Copy memory file path:`,e),O(e);return}t.then(()=>O(e)).catch(t=>{v.current&&(console.warn(`[memory-health] clipboard.writeText failed; falling back to prompt`,t),window.prompt(`Copy memory file path:`,e),O(e))})};return(0,h.jsxs)(`section`,{className:F.card,"aria-label":`Memory hygiene`,children:[(0,h.jsxs)(`div`,{className:F.header,children:[(0,h.jsxs)(`div`,{className:F.headerLeft,children:[(0,h.jsx)(`h3`,{className:F.title,children:`Memory Health`}),y.status===`ok`&&(0,h.jsxs)(`span`,{className:F.generatedAt,children:[`Updated `,new Date(y.data.generatedAt).toLocaleTimeString()]})]}),(0,h.jsx)(s,{size:`sm`,className:F.refreshBtn,onClick:()=>n(e=>e+1),"aria-label":`Refresh memory health`,children:`Refresh`})]}),y.status===`loading`&&(0,h.jsx)(`p`,{className:F.loading,children:`Loading…`}),y.status===`error`&&(0,h.jsx)(`p`,{className:F.error,children:y.error}),y.status===`ok`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:F.metaRow,children:[(0,h.jsxs)(`span`,{className:F.metaChip,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Memory files`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.totalFiles})]}),y.data.orphanCount>0&&(0,h.jsxs)(`span`,{className:`${F.metaChip} ${F.metaWarn}`,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Orphans`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.orphanCount})]}),y.data.danglingCount>0&&(0,h.jsxs)(`span`,{className:`${F.metaChip} ${F.metaWarn}`,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Dangling`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.danglingCount})]})]}),(0,h.jsxs)(`div`,{className:F.gaugeGrid,children:[(0,h.jsxs)(`div`,{className:F.gaugeItem,children:[(0,h.jsxs)(`div`,{className:F.gaugeLabel,children:[`Structure compliance`,(0,h.jsxs)(`span`,{className:F.gaugeValue,children:[y.data.structureCompliancePct,`%`]})]}),(0,h.jsx)(z,{pct:y.data.structureCompliancePct,warn:y.data.structureCompliancePct<90})]}),(0,h.jsxs)(`div`,{className:F.gaugeItem,children:[(0,h.jsxs)(`div`,{className:F.gaugeLabel,children:[`Freshness`,(0,h.jsxs)(`span`,{className:F.gaugeValue,children:[y.data.freshnessPct,`%`]})]}),(0,h.jsx)(z,{pct:y.data.freshnessPct,warn:y.data.freshnessPct<90})]})]}),y.data.issues.length>0?(0,h.jsx)(`div`,{className:F.issueList,children:y.data.issues.map((e,t)=>(0,h.jsx)(B,{issue:e,copied:m===e.file,onCopy:k},`${e.file}-${e.kind}-${t}`))}):(0,h.jsx)(`p`,{className:F.allClear,children:`No issues found.`}),T>0&&(0,h.jsxs)(`div`,{className:F.clusters,children:[(0,h.jsxs)(`div`,{className:F.clustersHeader,children:[(0,h.jsxs)(`div`,{className:F.clustersTitleRow,children:[(0,h.jsx)(`h4`,{className:F.clustersTitle,children:`Topic clusters`}),(0,h.jsx)(`span`,{className:F.clustersCount,children:C.length===T?`${T} topics`:`${C.length} of ${T}`})]}),(0,h.jsxs)(`div`,{className:F.clustersControls,children:[(0,h.jsx)(o,{type:`search`,placeholder:`Filter topics…`,value:r,onChange:e=>i(e.target.value),className:F.clustersSearch,"aria-label":`Filter topic clusters`}),(0,h.jsxs)(`label`,{className:F.minSizeControl,children:[(0,h.jsx)(`span`,{className:F.minSizeLabel,children:`Min size`}),(0,h.jsx)(`input`,{type:`range`,min:2,max:Math.max(S,2),value:a,onChange:e=>c(Number(e.target.value)),className:F.minSizeSlider,"aria-label":`Minimum cluster size`}),(0,h.jsxs)(`span`,{className:F.minSizeValue,children:[a,`+`]})]})]})]}),C.length===0?(0,h.jsx)(`p`,{className:F.emptyClusters,children:E===T&&r?`No topics match "${r}".`:`No topics meet the current filters.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:F.clusterGrid,children:w.map(t=>(0,h.jsx)(u,{topic:t.topic,count:t.size,weight:l(t.size,S),onClick:()=>e?.(t),disabled:!e},t.topic))}),D>0&&!f&&(0,h.jsxs)(`button`,{type:`button`,className:F.showAllBtn,onClick:()=>p(!0),children:[`Show all `,C.length,` topics`,(0,h.jsxs)(`span`,{className:F.showAllHint,children:[`(+`,D,`)`]})]}),f&&C.length>I&&(0,h.jsxs)(`button`,{type:`button`,className:F.showAllBtn,onClick:()=>p(!1),children:[`Show top `,I]})]})]})]})]})}var H={root:`_root_c6kv5_1`,section:`_section_c6kv5_7`,sectionHead:`_sectionHead_c6kv5_14`,sectionTitle:`_sectionTitle_c6kv5_20`,sectionCount:`_sectionCount_c6kv5_31`,sectionDescription:`_sectionDescription_c6kv5_46`},U=50;function W({id:e,title:t,count:n,description:r}){return(0,h.jsxs)(`div`,{className:H.sectionHead,children:[(0,h.jsxs)(`h2`,{id:e,className:H.sectionTitle,children:[t,n!==void 0&&n>0&&(0,h.jsx)(`span`,{className:H.sectionCount,"aria-label":`${n} item${n===1?``:`s`}`,children:n})]}),r&&(0,h.jsx)(`p`,{className:H.sectionDescription,children:r})]})}function G(){let[e,t]=(0,d.useState)(null),{proposals:n,loading:r,error:i,approve:a,reject:o}=f({status:`pending`}),{runs:s,timeline:c,loading:l,error:u}=p(U);return(0,h.jsxs)(`div`,{className:H.root,children:[(0,h.jsx)(`section`,{className:H.section,children:(0,h.jsx)(V,{onClusterClick:t})}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`proposals-heading`,children:[(0,h.jsx)(W,{id:`proposals-heading`,title:`Proposals Inbox`,count:n.length,description:`Synthesis, tombstone, and contradiction proposals queued by the steward. Approve to apply, reject with a reason to skip.`}),(0,h.jsx)(b,{proposals:n,loading:r,error:i,approve:a,reject:o})]}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`runlog-heading`,children:[(0,h.jsx)(W,{id:`runlog-heading`,title:`Steward Run Log`,description:`Last 10 runs. Expand a row for per-project metrics.`}),(0,h.jsx)(E,{runs:s,loading:l,error:u})]}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`trends-heading`,children:[(0,h.jsx)(W,{id:`trends-heading`,title:`Cross-Project Trends`,description:`Structure compliance and freshness over the last 50 runs, per project.`}),(0,h.jsx)(A,{timeline:c,loading:l,error:u})]}),(0,h.jsx)(N,{cluster:e,project:`claude-cron`,onClose:()=>t(null)})]})}export{G as MemoryHygiene};
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{t as r}from"./react-dom-Cnw6SoYl.js";import{r as i}from"./useWebSocket-Hg3RO6sx.js";import{t as a}from"./Button-DTO6bgnL.js";import{r as o,t as s}from"./Input-iymdcwsf.js";import{t as c}from"./useGet-CU5_p7vA.js";import{D as l,O as u}from"./index-DzJsiq8q.js";var d=t(e(),1);function f(e){let[t,n]=(0,d.useState)([]),[r,a]=(0,d.useState)(!0),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(0);(0,d.useEffect)(()=>{let t=!1,r=new AbortController;a(!0),s(null);let i=new URLSearchParams;e?.status&&i.set(`status`,e.status),e?.project&&i.set(`project`,e.project);let o=`/api/memory/hygiene/proposals${i.toString()?`?${i}`:``}`;return fetch(o,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return e.json()}).then(e=>{t||n(e)}).catch(e=>{t||s(e.message)}).finally(()=>{t||a(!1)}),()=>{t=!0,r.abort()}},[e?.status,e?.project,c]),i(`memory:proposal`,t=>{let r=t;e?.status&&r.status!==e.status||e?.project&&r.project!==e.project||n(e=>[r,...e])});let u=(0,d.useCallback)(async(e,t,r)=>{try{let i=await fetch(`/api/memory/hygiene/proposals/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,...r?{reason:r}:{}})});if(!i.ok)throw Error(`${i.status} ${i.statusText}`);let a=await i.json();n(t=>t.map(t=>t.id===e?a:t).filter(e=>e.status===`pending`))}catch(n){let r=n.message;throw console.warn(`[memory-proposals] ${t} ${e} failed:`,r),n}},[]);return{proposals:t,loading:r,error:o,approve:(0,d.useCallback)(e=>u(e,`approve`),[u]),reject:(0,d.useCallback)((e,t)=>u(e,`reject`,t),[u]),refresh:(0,d.useCallback)(()=>l(e=>e+1),[])}}function p(e=10){let[t,n]=(0,d.useState)([]),[r,a]=(0,d.useState)([]),[o,s]=(0,d.useState)(!0),[c,l]=(0,d.useState)(null),[u,f]=(0,d.useState)(0);return(0,d.useEffect)(()=>{let t=!1,r=new AbortController;return s(!0),l(null),Promise.all([fetch(`/api/memory/hygiene/runs?limit=${e}`,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(e.statusText);return e.json()}),fetch(`/api/memory/hygiene/runs/timeline`,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(e.statusText);return e.json()})]).then(([e,r])=>{t||(n(e),a(r))}).catch(e=>{t||l(e.message)}).finally(()=>{t||s(!1)}),()=>{t=!0,r.abort()}},[e,u]),i(`memory:steward-run-complete`,()=>{f(e=>e+1)}),{runs:t,timeline:r,loading:o,error:c}}var m={container:`_container_z76tk_1`,empty:`_empty_z76tk_7`,emptyTitle:`_emptyTitle_z76tk_20`,emptySub:`_emptySub_z76tk_26`,card:`_card_z76tk_31`,cardIn:`_cardIn_z76tk_1`,cardHeader:`_cardHeader_z76tk_51`,typeBadge:`_typeBadge_z76tk_59`,typeBadgeSynthesis:`_typeBadgeSynthesis_z76tk_71`,typeBadgeTombstone:`_typeBadgeTombstone_z76tk_77`,typeBadgeContradiction:`_typeBadgeContradiction_z76tk_83`,targetRow:`_targetRow_z76tk_89`,primaryFile:`_primaryFile_z76tk_97`,extraFilesToggle:`_extraFilesToggle_z76tk_111`,timestamp:`_timestamp_z76tk_146`,extraFilesList:`_extraFilesList_z76tk_153`,action:`_action_z76tk_172`,bodyDisclosure:`_bodyDisclosure_z76tk_180`,bodySummary:`_bodySummary_z76tk_187`,bodyMeta:`_bodyMeta_z76tk_228`,bodyPre:`_bodyPre_z76tk_235`,actions:`_actions_z76tk_250`,rejectGroup:`_rejectGroup_z76tk_257`,rejectLabel:`_rejectLabel_z76tk_265`,rejectHint:`_rejectHint_z76tk_272`,rejectInput:`_rejectInput_z76tk_277`,kbdHint:`_kbdHint_z76tk_282`,actionError:`_actionError_z76tk_296`},h=n(),g={synthesis:`Synthesis`,tombstone:`Tombstone`,contradiction:`Contradiction`},_={synthesis:m.typeBadgeSynthesis,tombstone:m.typeBadgeTombstone,contradiction:m.typeBadgeContradiction};function v(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function y({proposal:e,onApprove:t,onReject:n}){let[r,i]=(0,d.useState)(!1),[s,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(null),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(!1),C=g[e.type]??e.type,w=_[e.type]??m.typeBadgeSynthesis,T=e.targetFiles[0],E=e.targetFiles.slice(1),D=e.draftBody.split(`
2
+ `).length,O=e.draftBody.length,k=`extra-files-${e.id}`,A=async()=>{u(!0),p(null);try{await t()}catch(e){p(`Approve failed: ${e.message}`)}finally{u(!1)}},j=async()=>{if(s.trim()){u(!0),p(null);try{await n(s.trim())}catch(e){p(`Reject failed: ${e.message}`)}finally{u(!1)}}},M=()=>{i(!1),c(``),p(null)};return(0,h.jsxs)(`article`,{className:m.card,"aria-label":`${C} proposal for ${T}${E.length?` and ${E.length} more`:``}`,"aria-busy":l,children:[(0,h.jsxs)(`div`,{className:m.cardHeader,children:[(0,h.jsx)(`span`,{className:`${m.typeBadge} ${w}`,children:C}),(0,h.jsxs)(`div`,{className:m.targetRow,children:[(0,h.jsx)(`code`,{className:m.primaryFile,children:T}),E.length>0&&(0,h.jsxs)(`button`,{type:`button`,className:m.extraFilesToggle,onClick:()=>b(e=>!e),"aria-expanded":y,"aria-controls":k,"aria-label":y?`Hide additional files`:`Show ${E.length} more file${E.length===1?``:`s`}`,children:[y?`−`:`+`,` `,E.length,` more`]})]}),(0,h.jsx)(`span`,{className:m.timestamp,children:v(e.createdAt)})]}),y&&E.length>0&&(0,h.jsx)(`ul`,{className:m.extraFilesList,id:k,children:E.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{children:e})},e))}),(0,h.jsx)(`p`,{className:m.action,children:e.proposedAction}),(0,h.jsxs)(`details`,{className:m.bodyDisclosure,open:x,onToggle:e=>S(e.target.open),children:[(0,h.jsxs)(`summary`,{className:m.bodySummary,children:[(0,h.jsx)(`span`,{children:x?`Hide proposed body`:`Show proposed body`}),(0,h.jsxs)(`span`,{className:m.bodyMeta,children:[D,` line`,D===1?``:`s`,` · `,O.toLocaleString(),` chars`]})]}),(0,h.jsx)(`pre`,{className:m.bodyPre,children:e.draftBody})]}),r?(0,h.jsxs)(`div`,{className:m.rejectGroup,onKeyDown:e=>{e.key===`Escape`&&!l&&(e.stopPropagation(),M())},children:[(0,h.jsxs)(`label`,{htmlFor:`reason-${e.id}`,className:m.rejectLabel,children:[`Why reject? `,(0,h.jsx)(`span`,{className:m.rejectHint,children:`(required)`})]}),(0,h.jsx)(o,{id:`reason-${e.id}`,className:m.rejectInput,placeholder:`e.g. duplicates existing canonical file; topic too broad; etc.`,value:s,onChange:e=>c(e.target.value),rows:2,autoFocus:!0}),(0,h.jsxs)(`div`,{className:m.actions,children:[(0,h.jsx)(a,{variant:`danger`,size:`sm`,disabled:l||!s.trim(),onClick:j,children:l?`Rejecting…`:`Confirm reject`}),(0,h.jsxs)(a,{variant:`ghost`,size:`sm`,disabled:l,onClick:M,children:[`Cancel `,(0,h.jsx)(`kbd`,{className:m.kbdHint,"aria-hidden":`true`,children:`Esc`})]})]})]}):(0,h.jsxs)(`div`,{className:m.actions,children:[(0,h.jsx)(a,{variant:`primary`,size:`sm`,disabled:l,onClick:A,"aria-label":`Approve proposal ${e.id}`,children:l?`Approving…`:`Approve`}),(0,h.jsx)(a,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>{i(!0),p(null)},"aria-label":`Reject proposal ${e.id}`,children:`Reject`})]}),f&&(0,h.jsx)(`div`,{className:m.actionError,role:`alert`,children:f})]})}function b({proposals:e,loading:t,error:n,approve:r,reject:i}){return t?(0,h.jsx)(`p`,{className:m.empty,children:`Loading proposals…`}):n?(0,h.jsxs)(`p`,{className:m.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:m.empty,children:[(0,h.jsx)(`span`,{className:m.emptyTitle,children:`Inbox zero.`}),(0,h.jsx)(`span`,{className:m.emptySub,children:`The steward has no pending proposals right now.`})]}):(0,h.jsx)(`div`,{className:m.container,"aria-live":`polite`,children:e.map(e=>(0,h.jsx)(y,{proposal:e,onApprove:()=>r(e.id),onReject:t=>i(e.id,t)},e.id))})}var x={wrap:`_wrap_1t8pi_1`,tableHeader:`_tableHeader_1t8pi_10`,chevronSpacer:`_chevronSpacer_1t8pi_25`,empty:`_empty_1t8pi_29`,emptyTitle:`_emptyTitle_1t8pi_42`,emptySub:`_emptySub_1t8pi_48`,runGroup:`_runGroup_1t8pi_53`,row:`_row_1t8pi_61`,rowOpen:`_rowOpen_1t8pi_86`,chevron:`_chevron_1t8pi_25`,col:`_col_1t8pi_105`,colPrimary:`_colPrimary_1t8pi_112`,colSecondary:`_colSecondary_1t8pi_117`,colValue:`_colValue_1t8pi_126`,status:`_status_1t8pi_132`,statusDot:`_statusDot_1t8pi_146`,statusOk:`_statusOk_1t8pi_153`,statusError:`_statusError_1t8pi_159`,detail:`_detail_1t8pi_165`,detailOpen:`_detailOpen_1t8pi_173`,detailInner:`_detailInner_1t8pi_179`,detailEmpty:`_detailEmpty_1t8pi_186`,projectList:`_projectList_1t8pi_193`,projectRow:`_projectRow_1t8pi_202`,projectName:`_projectName_1t8pi_214`,metric:`_metric_1t8pi_223`,metricLabel:`_metricLabel_1t8pi_230`,metricValue:`_metricValue_1t8pi_237`,metricWarn:`_metricWarn_1t8pi_244`,errorBlock:`_errorBlock_1t8pi_248`},S=10;function C(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`}function w(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function T({run:e,isOpen:t,onToggle:n}){let r=e.projects.length,i=!e.error,a=`run-detail-${e.id}`,o=(0,d.useRef)(null);return(0,d.useEffect)(()=>{let e=o.current;e&&(t?e.removeAttribute(`inert`):e.setAttribute(`inert`,``))},[t]),(0,h.jsxs)(`div`,{className:x.runGroup,children:[(0,h.jsxs)(`button`,{type:`button`,className:`${x.row} ${t?x.rowOpen:``}`,onClick:n,"aria-expanded":t,"aria-controls":a,children:[(0,h.jsx)(`span`,{className:x.chevron,"aria-hidden":`true`,children:`▸`}),(0,h.jsxs)(`span`,{className:x.col,"data-label":`When`,children:[(0,h.jsx)(`span`,{className:x.colPrimary,children:w(e.startedAt)}),(0,h.jsx)(`span`,{className:x.colSecondary,children:new Date(e.startedAt).toLocaleString()})]}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Duration`,children:(0,h.jsx)(`span`,{className:x.colValue,children:C(e.durationMs)})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Projects`,children:(0,h.jsx)(`span`,{className:x.colValue,children:r})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Fixes`,children:(0,h.jsx)(`span`,{className:x.colValue,children:e.totalAutoFixes})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Judgments`,children:(0,h.jsx)(`span`,{className:x.colValue,children:e.totalJudgments})}),(0,h.jsxs)(`span`,{className:`${x.status} ${i?x.statusOk:x.statusError}`,children:[(0,h.jsx)(`span`,{className:x.statusDot,"aria-hidden":`true`}),i?`OK`:`Error`]})]}),(0,h.jsx)(`div`,{id:a,ref:o,className:`${x.detail} ${t?x.detailOpen:``}`,role:`region`,"aria-label":`Details for run at ${new Date(e.startedAt).toLocaleString()}`,children:(0,h.jsxs)(`div`,{className:x.detailInner,children:[e.projects.length===0?(0,h.jsx)(`p`,{className:x.detailEmpty,children:`No projects scanned.`}):(0,h.jsx)(`ul`,{className:x.projectList,children:e.projects.map(e=>{let t=e.structureCompliancePct<90,n=e.freshnessPct<90;return(0,h.jsxs)(`li`,{className:x.projectRow,children:[(0,h.jsx)(`span`,{className:x.projectName,children:e.project}),(0,h.jsxs)(`span`,{className:`${x.metric} ${t?x.metricWarn:``}`,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Structure`}),(0,h.jsxs)(`span`,{className:x.metricValue,children:[e.structureCompliancePct,`%`]})]}),(0,h.jsxs)(`span`,{className:`${x.metric} ${n?x.metricWarn:``}`,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Freshness`}),(0,h.jsxs)(`span`,{className:x.metricValue,children:[e.freshnessPct,`%`]})]}),(0,h.jsxs)(`span`,{className:x.metric,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Fixes`}),(0,h.jsx)(`span`,{className:x.metricValue,children:e.autoFixCount})]})]},e.project)})}),e.error&&(0,h.jsxs)(`div`,{className:x.errorBlock,role:`alert`,children:[(0,h.jsx)(`strong`,{children:`Error:`}),` `,e.error]})]})})]})}function E({runs:e,loading:t,error:n}){let[r,i]=(0,d.useState)(null),a=e.slice(0,S);return t?(0,h.jsx)(`p`,{className:x.empty,children:`Loading runs…`}):n?(0,h.jsxs)(`p`,{className:x.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:x.empty,children:[(0,h.jsx)(`span`,{className:x.emptyTitle,children:`No steward runs yet.`}),(0,h.jsx)(`span`,{className:x.emptySub,children:`Runs will appear here once the steward fires.`})]}):(0,h.jsxs)(`div`,{className:x.wrap,"aria-label":`Steward run history`,children:[(0,h.jsxs)(`div`,{className:x.tableHeader,children:[(0,h.jsx)(`span`,{className:x.chevronSpacer,"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:`When`}),(0,h.jsx)(`span`,{children:`Duration`}),(0,h.jsx)(`span`,{children:`Projects`}),(0,h.jsx)(`span`,{children:`Fixes`}),(0,h.jsx)(`span`,{children:`Judgments`}),(0,h.jsx)(`span`,{children:`Status`})]}),a.map(e=>(0,h.jsx)(T,{run:e,isOpen:r===e.id,onToggle:()=>i(r===e.id?null:e.id)},e.id))]})}var D={wrap:`_wrap_1xug7_1`,empty:`_empty_1xug7_7`,emptyTitle:`_emptyTitle_1xug7_20`,emptySub:`_emptySub_1xug7_26`,row:`_row_1xug7_31`,project:`_project_1xug7_47`,projectName:`_projectName_1xug7_54`,projectMeta:`_projectMeta_1xug7_64`,metric:`_metric_1xug7_70`,metricLabel:`_metricLabel_1xug7_77`,sparkWrap:`_sparkWrap_1xug7_85`,spark:`_spark_1xug7_85`,sparkEmpty:`_sparkEmpty_1xug7_98`,sparkMeta:`_sparkMeta_1xug7_105`,sparkValue:`_sparkValue_1xug7_112`,sparkValueWarn:`_sparkValueWarn_1xug7_119`,sparkDelta:`_sparkDelta_1xug7_123`,sparkDeltaUp:`_sparkDeltaUp_1xug7_130`,sparkDeltaDown:`_sparkDeltaDown_1xug7_134`},O={structure:`Structure compliance`,freshness:`Freshness`};function k({points:e,metric:t}){if(e.length<2)return(0,h.jsx)(`div`,{className:D.sparkEmpty,children:`not enough data`});let n=e.map(e=>t===`structure`?e.structurePct:e.freshnessPct),r=Math.max(100,...n),i=Math.min(0,...n),a=Math.max(1,r-i),o=200/(e.length-1),s=n.map((e,t)=>{let n=t*o,r=36-(e-i)/a*36;return`${t===0?`M`:`L`} ${n.toFixed(1)} ${r.toFixed(1)}`}).join(` `),c=`${s} L 200 36 L 0 36 Z`,l=n[n.length-1],u=l-n[0],d=Math.round(u),f=l<90,p=d>0,m=d<0;return(0,h.jsxs)(`div`,{className:D.sparkWrap,children:[(0,h.jsxs)(`svg`,{className:D.spark,viewBox:`0 0 200 36`,preserveAspectRatio:`none`,role:`img`,"aria-label":`${O[t]}: ${l}% now (${d>=0?`+`:``}${d}% from ${e.length} runs ago)`,children:[(0,h.jsx)(`title`,{children:`${O[t]}: ${l}% (${d>=0?`+`:``}${d}%)`}),(0,h.jsx)(`path`,{d:c,fill:f?`var(--color-warning)`:`var(--color-positive)`,fillOpacity:`0.12`}),(0,h.jsx)(`path`,{d:s,fill:`none`,stroke:f?`var(--color-warning)`:`var(--color-positive)`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),(0,h.jsxs)(`div`,{className:D.sparkMeta,children:[(0,h.jsxs)(`span`,{className:`${D.sparkValue} ${f?D.sparkValueWarn:``}`,children:[l,`%`]}),Math.abs(d)>=1&&(0,h.jsxs)(`span`,{className:`${D.sparkDelta} ${p?D.sparkDeltaUp:``} ${m?D.sparkDeltaDown:``}`,"aria-hidden":`true`,children:[p?`▲`:`▼`,Math.abs(d)]})]})]})}function A({timeline:e,loading:t,error:n}){return t?(0,h.jsx)(`p`,{className:D.empty,children:`Loading trends…`}):n?(0,h.jsxs)(`p`,{className:D.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:D.empty,children:[(0,h.jsx)(`span`,{className:D.emptyTitle,children:`No timeline data yet.`}),(0,h.jsx)(`span`,{className:D.emptySub,children:`Trends will appear here after a few steward runs.`})]}):(0,h.jsx)(`div`,{className:D.wrap,children:e.map(e=>(0,h.jsxs)(`div`,{className:D.row,children:[(0,h.jsxs)(`div`,{className:D.project,children:[(0,h.jsx)(`span`,{className:D.projectName,children:e.project}),(0,h.jsxs)(`span`,{className:D.projectMeta,children:[e.points.length,` point`,e.points.length===1?``:`s`]})]}),(0,h.jsxs)(`div`,{className:D.metric,children:[(0,h.jsx)(`div`,{className:D.metricLabel,children:`Structure compliance`}),(0,h.jsx)(k,{points:e.points,metric:`structure`})]}),(0,h.jsxs)(`div`,{className:D.metric,children:[(0,h.jsx)(`div`,{className:D.metricLabel,children:`Freshness`}),(0,h.jsx)(k,{points:e.points,metric:`freshness`})]})]},e.project))})}var j=t(r(),1),M={backdrop:`_backdrop_37dat_1`,fadeIn:`_fadeIn_37dat_1`,panel:`_panel_37dat_7`,slideUp:`_slideUp_37dat_1`,header:`_header_37dat_17`,close:`_close_37dat_18`,member:`_member_37dat_19`,synthBtn:`_synthBtn_37dat_20`};function N({cluster:e,project:t,onClose:n}){let r=(0,d.useRef)(null),[i,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n()};document.addEventListener(`keydown`,t);let i=document.getElementById(`root`);return i&&i.setAttribute(`inert`,``),r.current?.focus(),()=>{document.removeEventListener(`keydown`,t),i&&i.removeAttribute(`inert`)}},[e,n]),e?(0,j.createPortal)((0,h.jsx)(`div`,{className:M.backdrop,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`cluster-drill-title`,onClick:n,children:(0,h.jsxs)(`div`,{ref:r,className:M.panel,tabIndex:-1,onClick:e=>e.stopPropagation(),children:[(0,h.jsxs)(`div`,{className:M.header,children:[(0,h.jsxs)(`h2`,{id:`cluster-drill-title`,children:[`Cluster: `,e.topic,` (`,e.size,` files)`]}),(0,h.jsx)(a,{className:M.close,onClick:n,"aria-label":`Close`,children:`×`})]}),e.files.map(t=>(0,h.jsxs)(`div`,{className:M.member,children:[(0,h.jsx)(`strong`,{children:t}),(0,h.jsxs)(`p`,{children:[`Keywords: `,e.keywords.join(`, `)]})]},t)),(0,h.jsx)(a,{variant:`primary`,className:M.synthBtn,disabled:i,onClick:async()=>{o(!0),c(null);try{let n=await fetch(`/api/memory/hygiene/synthesize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:t,clusterTopic:e.topic})});if(!n.ok)throw Error(`${n.status} ${n.statusText}`);c(`Proposal queued. Check the inbox.`)}catch(e){c(`Failed: ${e.message}`)}finally{o(!1)}},children:i?`Queueing…`:`Synthesize`}),s&&(0,h.jsx)(`p`,{role:`status`,children:s})]})}),document.body):null}function P(e=`claude-cron`,t){return c(`/api/memory/hygiene?${new URLSearchParams({project:e}).toString()}`,{refreshToken:t})}var F={card:`_card_u7jav_1`,header:`_header_u7jav_12`,headerLeft:`_headerLeft_u7jav_19`,title:`_title_u7jav_26`,generatedAt:`_generatedAt_u7jav_33`,refreshBtn:`_refreshBtn_u7jav_39`,loading:`_loading_u7jav_43`,error:`_error_u7jav_49`,metaRow:`_metaRow_u7jav_59`,metaChip:`_metaChip_u7jav_65`,metaChipLabel:`_metaChipLabel_u7jav_78`,metaChipValue:`_metaChipValue_u7jav_85`,metaWarn:`_metaWarn_u7jav_91`,gaugeGrid:`_gaugeGrid_u7jav_99`,gaugeItem:`_gaugeItem_u7jav_105`,gaugeLabel:`_gaugeLabel_u7jav_111`,gaugeValue:`_gaugeValue_u7jav_122`,gaugeTrack:`_gaugeTrack_u7jav_131`,gaugeFill:`_gaugeFill_u7jav_139`,issueList:`_issueList_u7jav_148`,issueRow:`_issueRow_u7jav_157`,issueKind:`_issueKind_u7jav_172`,issueFile:`_issueFile_u7jav_180`,issueAction:`_issueAction_u7jav_190`,issueDetail:`_issueDetail_u7jav_217`,allClear:`_allClear_u7jav_225`,clusters:`_clusters_u7jav_232`,clustersHeader:`_clustersHeader_u7jav_241`,clustersTitleRow:`_clustersTitleRow_u7jav_247`,clustersTitle:`_clustersTitle_u7jav_247`,clustersCount:`_clustersCount_u7jav_260`,clustersControls:`_clustersControls_u7jav_266`,clustersSearch:`_clustersSearch_u7jav_273`,minSizeControl:`_minSizeControl_u7jav_279`,minSizeLabel:`_minSizeLabel_u7jav_289`,minSizeSlider:`_minSizeSlider_u7jav_295`,minSizeValue:`_minSizeValue_u7jav_301`,emptyClusters:`_emptyClusters_u7jav_308`,clusterGrid:`_clusterGrid_u7jav_315`,clustersFadeIn:`_clustersFadeIn_u7jav_1`,showAllBtn:`_showAllBtn_u7jav_333`,showAllHint:`_showAllHint_u7jav_362`},I=24,L=3,R={orphan:`Orphan`,dangling:`Dangling pointer`,frontmatter:`Frontmatter`,structure:`Structure`,"undocumented-type":`Unknown type`,"stale-ref":`Stale ref`};function z({pct:e,warn:t}){let n={"--hc-gauge-fill":`${e}%`,"--hc-gauge-color":t?`var(--color-warning)`:`var(--color-positive)`};return(0,h.jsx)(`div`,{className:F.gaugeTrack,role:`progressbar`,"aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:(0,h.jsx)(`div`,{className:F.gaugeFill,style:n})})}function B({issue:e,onCopy:t,copied:n}){return(0,h.jsxs)(`div`,{className:F.issueRow,children:[(0,h.jsx)(`span`,{className:F.issueKind,children:R[e.kind]??e.kind}),(0,h.jsxs)(`span`,{className:F.issueFile,children:[e.file,e.line==null?``:`:${e.line}`]}),(0,h.jsx)(`span`,{className:F.issueDetail,children:e.detail}),(0,h.jsx)(`button`,{type:`button`,className:F.issueAction,onClick:()=>t(e.file),"aria-label":`Copy path ${e.file}`,children:n?`Copied`:`Copy path`})]})}function V({onClusterClick:e}={}){let[t,n]=(0,d.useState)(0),[r,i]=(0,d.useState)(``),[o,c]=(0,d.useState)(L),[f,p]=(0,d.useState)(!1),[m,g]=(0,d.useState)(null),_=(0,d.useRef)(null),v=(0,d.useRef)(!0),y=P(`claude-cron`,t);(0,d.useEffect)(()=>(v.current=!0,()=>{v.current=!1,_.current!==null&&window.clearTimeout(_.current)}),[]);let b=(0,d.useDeferredValue)(r),x=y.status===`ok`?y.data.clusters??[]:[],S=(0,d.useMemo)(()=>x.reduce((e,t)=>t.size>e?t.size:e,0),[x]),C=(0,d.useMemo)(()=>{let e=b.trim().toLowerCase();return x.filter(t=>t.size<o?!1:e?t.topic.toLowerCase().includes(e):!0)},[x,b,o]),w=(0,d.useMemo)(()=>f?C:C.slice(0,I),[C,f]),T=x.length,E=T-C.length,D=C.length-w.length,O=e=>{v.current&&(g(e),_.current!==null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{_.current=null,g(t=>t===e?null:t)},1500))},k=e=>{if(!navigator.clipboard){window.prompt(`Copy memory file path:`,e),O(e);return}let t;try{t=navigator.clipboard.writeText(e)}catch{window.prompt(`Copy memory file path:`,e),O(e);return}t.then(()=>O(e)).catch(t=>{v.current&&(console.warn(`[memory-health] clipboard.writeText failed; falling back to prompt`,t),window.prompt(`Copy memory file path:`,e),O(e))})};return(0,h.jsxs)(`section`,{className:F.card,"aria-label":`Memory hygiene`,children:[(0,h.jsxs)(`div`,{className:F.header,children:[(0,h.jsxs)(`div`,{className:F.headerLeft,children:[(0,h.jsx)(`h3`,{className:F.title,children:`Memory Health`}),y.status===`ok`&&(0,h.jsxs)(`span`,{className:F.generatedAt,children:[`Updated `,new Date(y.data.generatedAt).toLocaleTimeString()]})]}),(0,h.jsx)(a,{size:`sm`,className:F.refreshBtn,onClick:()=>n(e=>e+1),"aria-label":`Refresh memory health`,children:`Refresh`})]}),y.status===`loading`&&(0,h.jsx)(`p`,{className:F.loading,children:`Loading…`}),y.status===`error`&&(0,h.jsx)(`p`,{className:F.error,children:y.error}),y.status===`ok`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:F.metaRow,children:[(0,h.jsxs)(`span`,{className:F.metaChip,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Memory files`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.totalFiles})]}),y.data.orphanCount>0&&(0,h.jsxs)(`span`,{className:`${F.metaChip} ${F.metaWarn}`,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Orphans`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.orphanCount})]}),y.data.danglingCount>0&&(0,h.jsxs)(`span`,{className:`${F.metaChip} ${F.metaWarn}`,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Dangling`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.danglingCount})]})]}),(0,h.jsxs)(`div`,{className:F.gaugeGrid,children:[(0,h.jsxs)(`div`,{className:F.gaugeItem,children:[(0,h.jsxs)(`div`,{className:F.gaugeLabel,children:[`Structure compliance`,(0,h.jsxs)(`span`,{className:F.gaugeValue,children:[y.data.structureCompliancePct,`%`]})]}),(0,h.jsx)(z,{pct:y.data.structureCompliancePct,warn:y.data.structureCompliancePct<90})]}),(0,h.jsxs)(`div`,{className:F.gaugeItem,children:[(0,h.jsxs)(`div`,{className:F.gaugeLabel,children:[`Freshness`,(0,h.jsxs)(`span`,{className:F.gaugeValue,children:[y.data.freshnessPct,`%`]})]}),(0,h.jsx)(z,{pct:y.data.freshnessPct,warn:y.data.freshnessPct<90})]})]}),y.data.issues.length>0?(0,h.jsx)(`div`,{className:F.issueList,children:y.data.issues.map((e,t)=>(0,h.jsx)(B,{issue:e,copied:m===e.file,onCopy:k},`${e.file}-${e.kind}-${t}`))}):(0,h.jsx)(`p`,{className:F.allClear,children:`No issues found.`}),T>0&&(0,h.jsxs)(`div`,{className:F.clusters,children:[(0,h.jsxs)(`div`,{className:F.clustersHeader,children:[(0,h.jsxs)(`div`,{className:F.clustersTitleRow,children:[(0,h.jsx)(`h4`,{className:F.clustersTitle,children:`Topic clusters`}),(0,h.jsx)(`span`,{className:F.clustersCount,children:C.length===T?`${T} topics`:`${C.length} of ${T}`})]}),(0,h.jsxs)(`div`,{className:F.clustersControls,children:[(0,h.jsx)(s,{type:`search`,placeholder:`Filter topics…`,value:r,onChange:e=>i(e.target.value),className:F.clustersSearch,"aria-label":`Filter topic clusters`}),(0,h.jsxs)(`label`,{className:F.minSizeControl,children:[(0,h.jsx)(`span`,{className:F.minSizeLabel,children:`Min size`}),(0,h.jsx)(`input`,{type:`range`,min:2,max:Math.max(S,2),value:o,onChange:e=>c(Number(e.target.value)),className:F.minSizeSlider,"aria-label":`Minimum cluster size`}),(0,h.jsxs)(`span`,{className:F.minSizeValue,children:[o,`+`]})]})]})]}),C.length===0?(0,h.jsx)(`p`,{className:F.emptyClusters,children:E===T&&r?`No topics match "${r}".`:`No topics meet the current filters.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:F.clusterGrid,children:w.map(t=>(0,h.jsx)(l,{topic:t.topic,count:t.size,weight:u(t.size,S),onClick:()=>e?.(t),disabled:!e},t.topic))}),D>0&&!f&&(0,h.jsxs)(`button`,{type:`button`,className:F.showAllBtn,onClick:()=>p(!0),children:[`Show all `,C.length,` topics`,(0,h.jsxs)(`span`,{className:F.showAllHint,children:[`(+`,D,`)`]})]}),f&&C.length>I&&(0,h.jsxs)(`button`,{type:`button`,className:F.showAllBtn,onClick:()=>p(!1),children:[`Show top `,I]})]})]})]})]})}var H={root:`_root_c6kv5_1`,section:`_section_c6kv5_7`,sectionHead:`_sectionHead_c6kv5_14`,sectionTitle:`_sectionTitle_c6kv5_20`,sectionCount:`_sectionCount_c6kv5_31`,sectionDescription:`_sectionDescription_c6kv5_46`},U=50;function W({id:e,title:t,count:n,description:r}){return(0,h.jsxs)(`div`,{className:H.sectionHead,children:[(0,h.jsxs)(`h2`,{id:e,className:H.sectionTitle,children:[t,n!==void 0&&n>0&&(0,h.jsx)(`span`,{className:H.sectionCount,"aria-label":`${n} item${n===1?``:`s`}`,children:n})]}),r&&(0,h.jsx)(`p`,{className:H.sectionDescription,children:r})]})}function G(){let[e,t]=(0,d.useState)(null),{proposals:n,loading:r,error:i,approve:a,reject:o}=f({status:`pending`}),{runs:s,timeline:c,loading:l,error:u}=p(U);return(0,h.jsxs)(`div`,{className:H.root,children:[(0,h.jsx)(`section`,{className:H.section,children:(0,h.jsx)(V,{onClusterClick:t})}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`proposals-heading`,children:[(0,h.jsx)(W,{id:`proposals-heading`,title:`Proposals Inbox`,count:n.length,description:`Synthesis, tombstone, and contradiction proposals queued by the steward. Approve to apply, reject with a reason to skip.`}),(0,h.jsx)(b,{proposals:n,loading:r,error:i,approve:a,reject:o})]}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`runlog-heading`,children:[(0,h.jsx)(W,{id:`runlog-heading`,title:`Steward Run Log`,description:`Last 10 runs. Expand a row for per-project metrics.`}),(0,h.jsx)(E,{runs:s,loading:l,error:u})]}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`trends-heading`,children:[(0,h.jsx)(W,{id:`trends-heading`,title:`Cross-Project Trends`,description:`Structure compliance and freshness over the last 50 runs, per project.`}),(0,h.jsx)(A,{timeline:c,loading:l,error:u})]}),(0,h.jsx)(N,{cluster:e,project:`claude-cron`,onClose:()=>t(null)})]})}export{G as MemoryHygiene};
@@ -1 +1 @@
1
- import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{d as r}from"./index-tOLuwPW6.js";import"./ui-Bx41p7g8.js";import{n as i}from"./shared-wI40KN7Y.js";var a=t(e(),1),o={root:`_root_1ifrf_1`,header:`_header_1ifrf_8`,headerMeta:`_headerMeta_1ifrf_14`,errorText:`_errorText_1ifrf_19`,controls:`_controls_1ifrf_23`,control:`_control_1ifrf_23`,controlLabel:`_controlLabel_1ifrf_40`,controlInput:`_controlInput_1ifrf_48`,controlButtons:`_controlButtons_1ifrf_65`,button:`_button_1ifrf_72`,buttonSecondary:`_buttonSecondary_1ifrf_73`,emptyState:`_emptyState_1ifrf_104`,tableWrap:`_tableWrap_1ifrf_121`,table:`_table_1ifrf_121`,hideOnMobile:`_hideOnMobile_1ifrf_175`,codeChip:`_codeChip_1ifrf_184`,numericCell:`_numericCell_1ifrf_190`,numericHeader:`_numericHeader_1ifrf_218`,row:`_row_1ifrf_233`,rowSelected:`_rowSelected_1ifrf_246`,timestampCell:`_timestampCell_1ifrf_250`,timestampAbs:`_timestampAbs_1ifrf_257`,idCell:`_idCell_1ifrf_262`,semanticBadge:`_semanticBadge_1ifrf_289`,metadataBadge:`_metadataBadge_1ifrf_290`,queryCell:`_queryCell_1ifrf_310`,muted:`_muted_1ifrf_321`,drawerBackdrop:`_drawerBackdrop_1ifrf_327`,drawer:`_drawer_1ifrf_327`,drawerHeader:`_drawerHeader_1ifrf_349`,drawerTitle:`_drawerTitle_1ifrf_355`,closeButton:`_closeButton_1ifrf_362`,drawerMeta:`_drawerMeta_1ifrf_377`,drawerMetaRow:`_drawerMetaRow_1ifrf_388`,drawerQuery:`_drawerQuery_1ifrf_410`,drawerSection:`_drawerSection_1ifrf_420`,drawerSectionLabel:`_drawerSectionLabel_1ifrf_426`,observationList:`_observationList_1ifrf_434`,observationItem:`_observationItem_1ifrf_443`,obsId:`_obsId_1ifrf_453`,jumpLink:`_jumpLink_1ifrf_464`},s=n(),c=50;function l(e){try{return new Date(e).toLocaleString()}catch{return e}}function u(e){try{let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}catch{return e}}function d(e){let[t,n]=(0,a.useState)([]),[d,f]=(0,a.useState)(``),[p,m]=(0,a.useState)(``),[h,g]=(0,a.useState)(``),[_,v]=(0,a.useState)(null),[y,b]=(0,a.useState)({status:`idle`}),[x,S]=(0,a.useState)(0),C=(0,a.useRef)(null),[w,T]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=new AbortController;return fetch(`/api/memory/stats`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);T(((await e.json()).byEmployee??[]).filter(e=>e.employee!==null).map(e=>({value:e.employee,count:e.count})).sort((e,t)=>(t.count??0)-(e.count??0)))}).catch(()=>{T([])}),()=>e.abort()},[x]);let E=(0,a.useMemo)(()=>{let e=new URLSearchParams;for(let n of t)e.append(`employee`,n);return d.trim()&&e.set(`jobId`,d.trim()),p.trim()&&e.set(`sessionId`,p.trim()),h.trim()&&e.set(`observationId`,h.trim()),e.set(`limit`,String(c)),e.toString()},[t,d,p,h]);(0,a.useEffect)(()=>{let e=window.setTimeout(()=>{C.current?.abort();let e=new AbortController;C.current=e,b({status:`loading`}),fetch(`/api/memory/injections?${E}`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);b({status:`ok`,data:await e.json()})}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||b({status:`error`,error:e instanceof Error?e.message:String(e)})})},200);return()=>{window.clearTimeout(e),C.current?.abort()}},[E,x]);let D=(0,a.useCallback)(()=>S(e=>e+1),[]),O=(0,a.useCallback)(()=>{n([]),f(``),m(``),g(``)},[]),k=y.status===`ok`?y.data.injections:[],A=y.status===`ok`?y.data.total:0,j=k.length;return(0,s.jsxs)(`div`,{className:o.root,children:[(0,s.jsxs)(`div`,{className:o.header,children:[(0,s.jsx)(i,{title:`Retrieval observability`,subtitle:`Every call to retrieveContext() logs which observations actually landed in the agent prompt. Use this to judge whether retrieval is surfacing the right material.`}),(0,s.jsxs)(`div`,{className:o.headerMeta,children:[y.status===`loading`&&`Loading…`,y.status===`error`&&(0,s.jsxs)(`span`,{className:o.errorText,children:[`Error: `,y.error]}),y.status===`ok`&&(0,s.jsxs)(s.Fragment,{children:[`Showing `,j,` of `,A.toLocaleString(),` injection`,A===1?``:`s`,j<A?` — narrow the filters to drill in`:``]})]})]}),(0,s.jsxs)(`div`,{className:o.controls,children:[(0,s.jsxs)(`div`,{className:o.control,children:[(0,s.jsx)(`span`,{className:o.controlLabel,children:`Employee`}),(0,s.jsx)(r,{options:w??[],selected:t,onChange:n,emptyLabel:`Any employee`,searchPlaceholder:`Filter employees…`,loading:w===null})]}),(0,s.jsxs)(`div`,{className:o.control,children:[(0,s.jsx)(`label`,{className:o.controlLabel,htmlFor:`inj-job`,children:`Job ID contains`}),(0,s.jsx)(`input`,{id:`inj-job`,className:o.controlInput,value:d,onChange:e=>f(e.target.value),placeholder:`e.g. update-linear`})]}),(0,s.jsxs)(`div`,{className:o.control,children:[(0,s.jsx)(`label`,{className:o.controlLabel,htmlFor:`inj-session`,children:`Session ID contains`}),(0,s.jsx)(`input`,{id:`inj-session`,className:o.controlInput,value:p,onChange:e=>m(e.target.value),placeholder:`e.g. sess-abc`})]}),(0,s.jsxs)(`div`,{className:o.control,children:[(0,s.jsx)(`label`,{className:o.controlLabel,htmlFor:`inj-obs`,children:`Observation ID contains`}),(0,s.jsx)(`input`,{id:`inj-obs`,className:o.controlInput,value:h,onChange:e=>g(e.target.value),placeholder:`full ID (paste from drawer)`})]}),(0,s.jsxs)(`div`,{className:o.controlButtons,children:[(0,s.jsx)(`button`,{type:`button`,className:o.buttonSecondary,onClick:O,children:`Clear`}),(0,s.jsx)(`button`,{type:`button`,className:o.button,onClick:D,children:`Refresh`})]})]}),y.status===`ok`&&k.length===0?(0,s.jsxs)(`div`,{className:o.emptyState,children:[(0,s.jsx)(`strong`,{children:`No injections logged yet.`}),(0,s.jsx)(`br`,{}),`Run a cron job or trigger a session — every `,(0,s.jsx)(`code`,{children:`retrieveContext()`}),` call will append a row here.`]}):null,k.length>0?(0,s.jsx)(`div`,{className:o.tableWrap,children:(0,s.jsxs)(`table`,{className:o.table,children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{scope:`col`,children:`When`}),(0,s.jsx)(`th`,{scope:`col`,children:`Employee`}),(0,s.jsx)(`th`,{scope:`col`,children:`Job / Session`}),(0,s.jsx)(`th`,{scope:`col`,className:o.numericHeader,children:`Obs`}),(0,s.jsx)(`th`,{scope:`col`,className:`${o.numericHeader} ${o.hideOnMobile}`,children:`Chars`}),(0,s.jsx)(`th`,{scope:`col`,className:o.hideOnMobile,children:`Retrieval`}),(0,s.jsx)(`th`,{scope:`col`,className:o.hideOnMobile,children:`Query`})]})}),(0,s.jsx)(`tbody`,{children:k.map(e=>(0,s.jsxs)(`tr`,{className:`${o.row} ${_?.id===e.id?o.rowSelected:``}`,onClick:()=>v(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),v(e))},tabIndex:0,role:`button`,"aria-label":`Injection for ${e.employee??`unknown employee`}, ${e.count} observations`,children:[(0,s.jsx)(`td`,{children:(0,s.jsxs)(`div`,{className:o.timestampCell,children:[(0,s.jsx)(`span`,{children:u(e.injectedAt)}),(0,s.jsx)(`span`,{className:o.timestampAbs,children:l(e.injectedAt)})]})}),(0,s.jsx)(`td`,{children:e.employee??(0,s.jsx)(`span`,{className:o.muted,children:`unattributed`})}),(0,s.jsxs)(`td`,{className:o.idCell,children:[e.jobId?(0,s.jsx)(`code`,{className:o.codeChip,children:e.jobId}):null,e.sessionId?(0,s.jsxs)(`code`,{className:o.codeChip,children:[`sess: `,e.sessionId.slice(0,12),`…`]}):null,!e.jobId&&!e.sessionId?(0,s.jsx)(`span`,{className:o.muted,children:`—`}):null]}),(0,s.jsx)(`td`,{className:o.numericCell,children:e.count}),(0,s.jsx)(`td`,{className:`${o.numericCell} ${o.hideOnMobile}`,children:e.charCount.toLocaleString()}),(0,s.jsx)(`td`,{className:o.hideOnMobile,children:e.semanticUsed?(0,s.jsx)(`span`,{className:o.semanticBadge,children:`hybrid`}):(0,s.jsx)(`span`,{className:o.metadataBadge,children:`metadata`})}),(0,s.jsx)(`td`,{className:o.hideOnMobile,children:(0,s.jsx)(`span`,{className:o.queryCell,title:e.query??``,children:e.query??(0,s.jsx)(`span`,{className:o.muted,children:`—`})})})]},e.id))})]})}):null,_?(0,s.jsx)(`div`,{className:o.drawerBackdrop,onClick:()=>v(null),role:`presentation`,children:(0,s.jsxs)(`div`,{className:o.drawer,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`injection-drawer-title`,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&v(null)},children:[(0,s.jsxs)(`div`,{className:o.drawerHeader,children:[(0,s.jsxs)(`h3`,{id:`injection-drawer-title`,className:o.drawerTitle,children:[`Injection #`,_.id]}),(0,s.jsx)(`button`,{type:`button`,className:o.closeButton,onClick:()=>v(null),"aria-label":`Close`,children:`✕`})]}),(0,s.jsxs)(`dl`,{className:o.drawerMeta,children:[(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`When`}),(0,s.jsx)(`dd`,{children:l(_.injectedAt)})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Employee`}),(0,s.jsx)(`dd`,{children:_.employee??`unattributed`})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Job`}),(0,s.jsx)(`dd`,{children:_.jobId??`—`})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Session`}),(0,s.jsx)(`dd`,{children:_.sessionId??`—`})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Retrieval`}),(0,s.jsx)(`dd`,{children:_.semanticUsed?`hybrid (semantic + metadata)`:`metadata-only`})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Prompt size`}),(0,s.jsxs)(`dd`,{children:[_.charCount.toLocaleString(),` chars (`,_.count,` obs)`]})]}),_.query?(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Query`}),(0,s.jsx)(`dd`,{className:o.drawerQuery,children:_.query})]}):null]}),(0,s.jsxs)(`div`,{className:o.drawerSection,children:[(0,s.jsxs)(`div`,{className:o.drawerSectionLabel,children:[`Injected observations (`,_.observationIds.length,`)`]}),(0,s.jsx)(`ul`,{className:o.observationList,children:_.observationIds.map(e=>(0,s.jsxs)(`li`,{className:o.observationItem,children:[(0,s.jsx)(`code`,{className:o.obsId,children:e}),(0,s.jsx)(`button`,{type:`button`,className:o.jumpLink,onClick:()=>{g(e),v(null)},title:`Filter injections containing this observation ID`,children:`Filter`})]},e))})]})]})}):null]})}export{d as MemoryInjections};
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{u as r}from"./index-DzJsiq8q.js";import"./ui-DvNuX5MF.js";import{n as i}from"./shared-wI40KN7Y.js";var a=t(e(),1),o={root:`_root_1ifrf_1`,header:`_header_1ifrf_8`,headerMeta:`_headerMeta_1ifrf_14`,errorText:`_errorText_1ifrf_19`,controls:`_controls_1ifrf_23`,control:`_control_1ifrf_23`,controlLabel:`_controlLabel_1ifrf_40`,controlInput:`_controlInput_1ifrf_48`,controlButtons:`_controlButtons_1ifrf_65`,button:`_button_1ifrf_72`,buttonSecondary:`_buttonSecondary_1ifrf_73`,emptyState:`_emptyState_1ifrf_104`,tableWrap:`_tableWrap_1ifrf_121`,table:`_table_1ifrf_121`,hideOnMobile:`_hideOnMobile_1ifrf_175`,codeChip:`_codeChip_1ifrf_184`,numericCell:`_numericCell_1ifrf_190`,numericHeader:`_numericHeader_1ifrf_218`,row:`_row_1ifrf_233`,rowSelected:`_rowSelected_1ifrf_246`,timestampCell:`_timestampCell_1ifrf_250`,timestampAbs:`_timestampAbs_1ifrf_257`,idCell:`_idCell_1ifrf_262`,semanticBadge:`_semanticBadge_1ifrf_289`,metadataBadge:`_metadataBadge_1ifrf_290`,queryCell:`_queryCell_1ifrf_310`,muted:`_muted_1ifrf_321`,drawerBackdrop:`_drawerBackdrop_1ifrf_327`,drawer:`_drawer_1ifrf_327`,drawerHeader:`_drawerHeader_1ifrf_349`,drawerTitle:`_drawerTitle_1ifrf_355`,closeButton:`_closeButton_1ifrf_362`,drawerMeta:`_drawerMeta_1ifrf_377`,drawerMetaRow:`_drawerMetaRow_1ifrf_388`,drawerQuery:`_drawerQuery_1ifrf_410`,drawerSection:`_drawerSection_1ifrf_420`,drawerSectionLabel:`_drawerSectionLabel_1ifrf_426`,observationList:`_observationList_1ifrf_434`,observationItem:`_observationItem_1ifrf_443`,obsId:`_obsId_1ifrf_453`,jumpLink:`_jumpLink_1ifrf_464`},s=n(),c=50;function l(e){try{return new Date(e).toLocaleString()}catch{return e}}function u(e){try{let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}catch{return e}}function d(e){let[t,n]=(0,a.useState)([]),[d,f]=(0,a.useState)(``),[p,m]=(0,a.useState)(``),[h,g]=(0,a.useState)(``),[_,v]=(0,a.useState)(null),[y,b]=(0,a.useState)({status:`idle`}),[x,S]=(0,a.useState)(0),C=(0,a.useRef)(null),[w,T]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=new AbortController;return fetch(`/api/memory/stats`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);T(((await e.json()).byEmployee??[]).filter(e=>e.employee!==null).map(e=>({value:e.employee,count:e.count})).sort((e,t)=>(t.count??0)-(e.count??0)))}).catch(()=>{T([])}),()=>e.abort()},[x]);let E=(0,a.useMemo)(()=>{let e=new URLSearchParams;for(let n of t)e.append(`employee`,n);return d.trim()&&e.set(`jobId`,d.trim()),p.trim()&&e.set(`sessionId`,p.trim()),h.trim()&&e.set(`observationId`,h.trim()),e.set(`limit`,String(c)),e.toString()},[t,d,p,h]);(0,a.useEffect)(()=>{let e=window.setTimeout(()=>{C.current?.abort();let e=new AbortController;C.current=e,b({status:`loading`}),fetch(`/api/memory/injections?${E}`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);b({status:`ok`,data:await e.json()})}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||b({status:`error`,error:e instanceof Error?e.message:String(e)})})},200);return()=>{window.clearTimeout(e),C.current?.abort()}},[E,x]);let D=(0,a.useCallback)(()=>S(e=>e+1),[]),O=(0,a.useCallback)(()=>{n([]),f(``),m(``),g(``)},[]),k=y.status===`ok`?y.data.injections:[],A=y.status===`ok`?y.data.total:0,j=k.length;return(0,s.jsxs)(`div`,{className:o.root,children:[(0,s.jsxs)(`div`,{className:o.header,children:[(0,s.jsx)(i,{title:`Retrieval observability`,subtitle:`Every call to retrieveContext() logs which observations actually landed in the agent prompt. Use this to judge whether retrieval is surfacing the right material.`}),(0,s.jsxs)(`div`,{className:o.headerMeta,children:[y.status===`loading`&&`Loading…`,y.status===`error`&&(0,s.jsxs)(`span`,{className:o.errorText,children:[`Error: `,y.error]}),y.status===`ok`&&(0,s.jsxs)(s.Fragment,{children:[`Showing `,j,` of `,A.toLocaleString(),` injection`,A===1?``:`s`,j<A?` — narrow the filters to drill in`:``]})]})]}),(0,s.jsxs)(`div`,{className:o.controls,children:[(0,s.jsxs)(`div`,{className:o.control,children:[(0,s.jsx)(`span`,{className:o.controlLabel,children:`Employee`}),(0,s.jsx)(r,{options:w??[],selected:t,onChange:n,emptyLabel:`Any employee`,searchPlaceholder:`Filter employees…`,loading:w===null})]}),(0,s.jsxs)(`div`,{className:o.control,children:[(0,s.jsx)(`label`,{className:o.controlLabel,htmlFor:`inj-job`,children:`Job ID contains`}),(0,s.jsx)(`input`,{id:`inj-job`,className:o.controlInput,value:d,onChange:e=>f(e.target.value),placeholder:`e.g. update-linear`})]}),(0,s.jsxs)(`div`,{className:o.control,children:[(0,s.jsx)(`label`,{className:o.controlLabel,htmlFor:`inj-session`,children:`Session ID contains`}),(0,s.jsx)(`input`,{id:`inj-session`,className:o.controlInput,value:p,onChange:e=>m(e.target.value),placeholder:`e.g. sess-abc`})]}),(0,s.jsxs)(`div`,{className:o.control,children:[(0,s.jsx)(`label`,{className:o.controlLabel,htmlFor:`inj-obs`,children:`Observation ID contains`}),(0,s.jsx)(`input`,{id:`inj-obs`,className:o.controlInput,value:h,onChange:e=>g(e.target.value),placeholder:`full ID (paste from drawer)`})]}),(0,s.jsxs)(`div`,{className:o.controlButtons,children:[(0,s.jsx)(`button`,{type:`button`,className:o.buttonSecondary,onClick:O,children:`Clear`}),(0,s.jsx)(`button`,{type:`button`,className:o.button,onClick:D,children:`Refresh`})]})]}),y.status===`ok`&&k.length===0?(0,s.jsxs)(`div`,{className:o.emptyState,children:[(0,s.jsx)(`strong`,{children:`No injections logged yet.`}),(0,s.jsx)(`br`,{}),`Run a cron job or trigger a session — every `,(0,s.jsx)(`code`,{children:`retrieveContext()`}),` call will append a row here.`]}):null,k.length>0?(0,s.jsx)(`div`,{className:o.tableWrap,children:(0,s.jsxs)(`table`,{className:o.table,children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{scope:`col`,children:`When`}),(0,s.jsx)(`th`,{scope:`col`,children:`Employee`}),(0,s.jsx)(`th`,{scope:`col`,children:`Job / Session`}),(0,s.jsx)(`th`,{scope:`col`,className:o.numericHeader,children:`Obs`}),(0,s.jsx)(`th`,{scope:`col`,className:`${o.numericHeader} ${o.hideOnMobile}`,children:`Chars`}),(0,s.jsx)(`th`,{scope:`col`,className:o.hideOnMobile,children:`Retrieval`}),(0,s.jsx)(`th`,{scope:`col`,className:o.hideOnMobile,children:`Query`})]})}),(0,s.jsx)(`tbody`,{children:k.map(e=>(0,s.jsxs)(`tr`,{className:`${o.row} ${_?.id===e.id?o.rowSelected:``}`,onClick:()=>v(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),v(e))},tabIndex:0,role:`button`,"aria-label":`Injection for ${e.employee??`unknown employee`}, ${e.count} observations`,children:[(0,s.jsx)(`td`,{children:(0,s.jsxs)(`div`,{className:o.timestampCell,children:[(0,s.jsx)(`span`,{children:u(e.injectedAt)}),(0,s.jsx)(`span`,{className:o.timestampAbs,children:l(e.injectedAt)})]})}),(0,s.jsx)(`td`,{children:e.employee??(0,s.jsx)(`span`,{className:o.muted,children:`unattributed`})}),(0,s.jsxs)(`td`,{className:o.idCell,children:[e.jobId?(0,s.jsx)(`code`,{className:o.codeChip,children:e.jobId}):null,e.sessionId?(0,s.jsxs)(`code`,{className:o.codeChip,children:[`sess: `,e.sessionId.slice(0,12),`…`]}):null,!e.jobId&&!e.sessionId?(0,s.jsx)(`span`,{className:o.muted,children:`—`}):null]}),(0,s.jsx)(`td`,{className:o.numericCell,children:e.count}),(0,s.jsx)(`td`,{className:`${o.numericCell} ${o.hideOnMobile}`,children:e.charCount.toLocaleString()}),(0,s.jsx)(`td`,{className:o.hideOnMobile,children:e.semanticUsed?(0,s.jsx)(`span`,{className:o.semanticBadge,children:`hybrid`}):(0,s.jsx)(`span`,{className:o.metadataBadge,children:`metadata`})}),(0,s.jsx)(`td`,{className:o.hideOnMobile,children:(0,s.jsx)(`span`,{className:o.queryCell,title:e.query??``,children:e.query??(0,s.jsx)(`span`,{className:o.muted,children:`—`})})})]},e.id))})]})}):null,_?(0,s.jsx)(`div`,{className:o.drawerBackdrop,onClick:()=>v(null),role:`presentation`,children:(0,s.jsxs)(`div`,{className:o.drawer,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`injection-drawer-title`,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&v(null)},children:[(0,s.jsxs)(`div`,{className:o.drawerHeader,children:[(0,s.jsxs)(`h3`,{id:`injection-drawer-title`,className:o.drawerTitle,children:[`Injection #`,_.id]}),(0,s.jsx)(`button`,{type:`button`,className:o.closeButton,onClick:()=>v(null),"aria-label":`Close`,children:`✕`})]}),(0,s.jsxs)(`dl`,{className:o.drawerMeta,children:[(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`When`}),(0,s.jsx)(`dd`,{children:l(_.injectedAt)})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Employee`}),(0,s.jsx)(`dd`,{children:_.employee??`unattributed`})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Job`}),(0,s.jsx)(`dd`,{children:_.jobId??`—`})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Session`}),(0,s.jsx)(`dd`,{children:_.sessionId??`—`})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Retrieval`}),(0,s.jsx)(`dd`,{children:_.semanticUsed?`hybrid (semantic + metadata)`:`metadata-only`})]}),(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Prompt size`}),(0,s.jsxs)(`dd`,{children:[_.charCount.toLocaleString(),` chars (`,_.count,` obs)`]})]}),_.query?(0,s.jsxs)(`div`,{className:o.drawerMetaRow,children:[(0,s.jsx)(`dt`,{children:`Query`}),(0,s.jsx)(`dd`,{className:o.drawerQuery,children:_.query})]}):null]}),(0,s.jsxs)(`div`,{className:o.drawerSection,children:[(0,s.jsxs)(`div`,{className:o.drawerSectionLabel,children:[`Injected observations (`,_.observationIds.length,`)`]}),(0,s.jsx)(`ul`,{className:o.observationList,children:_.observationIds.map(e=>(0,s.jsxs)(`li`,{className:o.observationItem,children:[(0,s.jsx)(`code`,{className:o.obsId,children:e}),(0,s.jsx)(`button`,{type:`button`,className:o.jumpLink,onClick:()=>{g(e),v(null)},title:`Filter injections containing this observation ID`,children:`Filter`})]},e))})]})]})}):null]})}export{d as MemoryInjections};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryOverview-BG2lpis1.js","assets/jsx-runtime-Bq3x7umQ.js","assets/shared-wI40KN7Y.js","assets/shared-CHkcO7VT.css","assets/useGet-CU5_p7vA.js","assets/MemoryOverview-BuFrUzre.css","assets/MemoryExplore-wFiVBkXu.js","assets/index-tOLuwPW6.js","assets/react-dom-Cnw6SoYl.js","assets/events-CCBP4a9s.js","assets/RelativeTime-CARWwY-H.js","assets/useWebSocket-Hg3RO6sx.js","assets/styles-Ds5gMQAQ.js","assets/Button-xBBZQ0ie.js","assets/Button-BOCZ-tMU.css","assets/Card-u29day7d.js","assets/Card-Q-x7mRn3.css","assets/Input-HhV6M0tu.js","assets/Input-C6Eciq4Y.css","assets/index-C57L9wdB.css","assets/ui-Bx41p7g8.js","assets/SettingsRow-4w9Ab9mk.js","assets/MemoryExplore-DXgmdeOp.css","assets/MemoryInjections-F6D1_uAX.js","assets/MemoryInjections-CG5Jnfc2.css","assets/MemoryHygiene-C_lFMujk.js","assets/MemoryHygiene-D9-lcjQc.css","assets/MemoryWiki-cypT6R3l.js","assets/MemoryWiki-Mh-mjN1m.css"])))=>i.map(i=>d[i]);
2
- import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{a as r,i,s as a}from"./index-tOLuwPW6.js";var o=t(e(),1),s={page:`_page_laiz0_1`,header:`_header_laiz0_7`,title:`_title_laiz0_16`,subtitle:`_subtitle_laiz0_23`,liveToggleRow:`_liveToggleRow_laiz0_29`,liveToggleLabel:`_liveToggleLabel_laiz0_35`,tabHint:`_tabHint_laiz0_41`,tabHintFadeIn:`_tabHintFadeIn_laiz0_1`,tab:`_tab_laiz0_41`,srOnly:`_srOnly_laiz0_59`,tabBar:`_tabBar_laiz0_71`,tabActive:`_tabActive_laiz0_116`,viewShell:`_viewShell_laiz0_126`,loading:`_loading_laiz0_133`,snapshotMeta:`_snapshotMeta_laiz0_142`},c=n(),l={overview:(0,o.lazy)(()=>a(()=>import(`./MemoryOverview-BG2lpis1.js`).then(e=>({default:e.MemoryOverview})),__vite__mapDeps([0,1,2,3,4,5]))),explore:(0,o.lazy)(()=>a(()=>import(`./MemoryExplore-wFiVBkXu.js`).then(e=>({default:e.MemoryExplore})),__vite__mapDeps([6,1,7,8,9,10,4,11,12,13,14,15,16,17,18,19,2,3,20,21,22]))),injections:(0,o.lazy)(()=>a(()=>import(`./MemoryInjections-F6D1_uAX.js`).then(e=>({default:e.MemoryInjections})),__vite__mapDeps([23,1,7,8,9,10,4,11,12,13,14,15,16,17,18,19,2,3,20,21,24]))),hygiene:(0,o.lazy)(()=>a(()=>import(`./MemoryHygiene-C_lFMujk.js`).then(e=>({default:e.MemoryHygiene})),__vite__mapDeps([25,1,7,8,9,10,4,11,12,13,14,15,16,17,18,19,26]))),wiki:(0,o.lazy)(()=>a(()=>import(`./MemoryWiki-cypT6R3l.js`).then(e=>({default:e.MemoryWiki})),__vite__mapDeps([27,1,7,8,9,10,4,11,12,13,14,15,16,17,18,19,2,3,28])))},u=[{id:`injections`,label:`Injections`,hint:`Live retrieval log: which observations get injected into which prompts.`},{id:`overview`,label:`Overview`,hint:`Live stats, top-retrieved observations, dead-weight signals.`},{id:`explore`,label:`Explore`,hint:`Filterable observation table with a nearest-neighbor drawer.`},{id:`hygiene`,label:`Hygiene`,hint:`Memory steward: health, clusters, proposals, run log, trends.`},{id:`wiki`,label:`Wiki`,hint:`Compile-pages run history and wiki-page library with ancestor drilldown.`}];function d(){let{subView:e,navigateMemory:t}=r(),n=e??`injections`;(0,o.useEffect)(()=>{e===null&&t(i)},[e,t]);let a=(0,o.useCallback)(e=>{t(e)},[t]),d=(0,o.useMemo)(()=>u.find(e=>e.id===n)?.hint??``,[n]),f=(0,o.useMemo)(()=>{let e=l[n];return(0,c.jsx)(o.Suspense,{fallback:(0,c.jsx)(`div`,{className:s.loading,children:`Loading view…`}),children:(0,c.jsx)(e,{})})},[n]);return(0,c.jsxs)(`div`,{className:`page-content-frame ${s.page}`,children:[(0,c.jsx)(`div`,{className:s.header,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h1`,{className:s.title,children:`Memory`}),(0,c.jsx)(`p`,{className:s.subtitle,children:`Live view of the observation store powering long-term agent context. All data comes directly from the running gateway.`})]})}),(0,c.jsx)(`div`,{className:s.tabBar,role:`tablist`,"aria-label":`Memory views`,children:u.map(e=>{let t=e.id===n,r=`memory-tab-hint-${e.id}`;return(0,c.jsxs)(`button`,{role:`tab`,type:`button`,"aria-selected":t,"aria-controls":`memory-view-${e.id}`,"aria-describedby":r,className:`${s.tab} ${t?s.tabActive:``}`,onClick:()=>a(e.id),children:[e.label,(0,c.jsx)(`span`,{id:r,className:s.srOnly,children:e.hint})]},e.id)})}),d&&(0,c.jsx)(`p`,{className:s.tabHint,"aria-live":`polite`,children:d},n),(0,c.jsx)(`div`,{id:`memory-view-${n}`,role:`tabpanel`,"aria-labelledby":`memory-tab-${n}`,className:s.viewShell,children:f})]})}export{d as MemoryPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryOverview-BG2lpis1.js","assets/jsx-runtime-Bq3x7umQ.js","assets/shared-wI40KN7Y.js","assets/shared-CHkcO7VT.css","assets/useGet-CU5_p7vA.js","assets/MemoryOverview-BuFrUzre.css","assets/MemoryExplore-DS4IYHl2.js","assets/index-DzJsiq8q.js","assets/react-dom-Cnw6SoYl.js","assets/events-BK5ucyUu.js","assets/RelativeTime-CARWwY-H.js","assets/useWebSocket-Hg3RO6sx.js","assets/styles-Ds5gMQAQ.js","assets/Button-DTO6bgnL.js","assets/Button-BOCZ-tMU.css","assets/Card-u29day7d.js","assets/Card-Q-x7mRn3.css","assets/Input-iymdcwsf.js","assets/Input-C6Eciq4Y.css","assets/index-CiIY3MTP.css","assets/ui-DvNuX5MF.js","assets/SettingsRow-4w9Ab9mk.js","assets/MemoryExplore-DXgmdeOp.css","assets/MemoryInjections-BO_kUrBn.js","assets/MemoryInjections-CG5Jnfc2.css","assets/MemoryHygiene-DxUcjusq.js","assets/MemoryHygiene-D9-lcjQc.css","assets/MemoryWiki-Dh1MtBZV.js","assets/MemoryWiki-Mh-mjN1m.css"])))=>i.map(i=>d[i]);
2
+ import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{a as r,i,s as a}from"./index-DzJsiq8q.js";var o=t(e(),1),s={page:`_page_laiz0_1`,header:`_header_laiz0_7`,title:`_title_laiz0_16`,subtitle:`_subtitle_laiz0_23`,liveToggleRow:`_liveToggleRow_laiz0_29`,liveToggleLabel:`_liveToggleLabel_laiz0_35`,tabHint:`_tabHint_laiz0_41`,tabHintFadeIn:`_tabHintFadeIn_laiz0_1`,tab:`_tab_laiz0_41`,srOnly:`_srOnly_laiz0_59`,tabBar:`_tabBar_laiz0_71`,tabActive:`_tabActive_laiz0_116`,viewShell:`_viewShell_laiz0_126`,loading:`_loading_laiz0_133`,snapshotMeta:`_snapshotMeta_laiz0_142`},c=n(),l={overview:(0,o.lazy)(()=>a(()=>import(`./MemoryOverview-BG2lpis1.js`).then(e=>({default:e.MemoryOverview})),__vite__mapDeps([0,1,2,3,4,5]))),explore:(0,o.lazy)(()=>a(()=>import(`./MemoryExplore-DS4IYHl2.js`).then(e=>({default:e.MemoryExplore})),__vite__mapDeps([6,1,7,8,9,10,4,11,12,13,14,15,16,17,18,19,2,3,20,21,22]))),injections:(0,o.lazy)(()=>a(()=>import(`./MemoryInjections-BO_kUrBn.js`).then(e=>({default:e.MemoryInjections})),__vite__mapDeps([23,1,7,8,9,10,4,11,12,13,14,15,16,17,18,19,2,3,20,21,24]))),hygiene:(0,o.lazy)(()=>a(()=>import(`./MemoryHygiene-DxUcjusq.js`).then(e=>({default:e.MemoryHygiene})),__vite__mapDeps([25,1,7,8,9,10,4,11,12,13,14,15,16,17,18,19,26]))),wiki:(0,o.lazy)(()=>a(()=>import(`./MemoryWiki-Dh1MtBZV.js`).then(e=>({default:e.MemoryWiki})),__vite__mapDeps([27,1,7,8,9,10,4,11,12,13,14,15,16,17,18,19,2,3,28])))},u=[{id:`injections`,label:`Injections`,hint:`Live retrieval log: which observations get injected into which prompts.`},{id:`overview`,label:`Overview`,hint:`Live stats, top-retrieved observations, dead-weight signals.`},{id:`explore`,label:`Explore`,hint:`Filterable observation table with a nearest-neighbor drawer.`},{id:`hygiene`,label:`Hygiene`,hint:`Memory steward: health, clusters, proposals, run log, trends.`},{id:`wiki`,label:`Wiki`,hint:`Compile-pages run history and wiki-page library with ancestor drilldown.`}];function d(){let{subView:e,navigateMemory:t}=r(),n=e??`injections`;(0,o.useEffect)(()=>{e===null&&t(i)},[e,t]);let a=(0,o.useCallback)(e=>{t(e)},[t]),d=(0,o.useMemo)(()=>u.find(e=>e.id===n)?.hint??``,[n]),f=(0,o.useMemo)(()=>{let e=l[n];return(0,c.jsx)(o.Suspense,{fallback:(0,c.jsx)(`div`,{className:s.loading,children:`Loading view…`}),children:(0,c.jsx)(e,{})})},[n]);return(0,c.jsxs)(`div`,{className:`page-content-frame ${s.page}`,children:[(0,c.jsx)(`div`,{className:s.header,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h1`,{className:s.title,children:`Memory`}),(0,c.jsx)(`p`,{className:s.subtitle,children:`Live view of the observation store powering long-term agent context. All data comes directly from the running gateway.`})]})}),(0,c.jsx)(`div`,{className:s.tabBar,role:`tablist`,"aria-label":`Memory views`,children:u.map(e=>{let t=e.id===n,r=`memory-tab-hint-${e.id}`;return(0,c.jsxs)(`button`,{role:`tab`,type:`button`,"aria-selected":t,"aria-controls":`memory-view-${e.id}`,"aria-describedby":r,className:`${s.tab} ${t?s.tabActive:``}`,onClick:()=>a(e.id),children:[e.label,(0,c.jsx)(`span`,{id:r,className:s.srOnly,children:e.hint})]},e.id)})}),d&&(0,c.jsx)(`p`,{className:s.tabHint,"aria-live":`polite`,children:d},n),(0,c.jsx)(`div`,{id:`memory-view-${n}`,role:`tabpanel`,"aria-labelledby":`memory-tab-${n}`,className:s.viewShell,children:f})]})}export{d as MemoryPage};
@@ -1,3 +1,3 @@
1
- import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{t as r}from"./Button-xBBZQ0ie.js";import{F as i,lt as a}from"./index-tOLuwPW6.js";import{n as o,t as s}from"./shared-wI40KN7Y.js";var c=t(e(),1);function l(e){let[t,n]=(0,c.useState)({status:`loading`});return(0,c.useEffect)(()=>{let e=new AbortController;return n({status:`loading`}),fetch(`/api/memory/compile-pages/runs?limit=50`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);n({status:`ok`,data:await e.json()})}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||n({status:`error`,error:e instanceof Error?e.message:String(e)})}),()=>e.abort()},[e]),t}function u(e){let[t,n]=(0,c.useState)({status:`loading`});return(0,c.useEffect)(()=>{let e=new AbortController;return n({status:`loading`}),fetch(`/api/memory/compile-pages/wiki-pages?limit=100`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);n({status:`ok`,data:await e.json()})}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||n({status:`error`,error:e instanceof Error?e.message:String(e)})}),()=>e.abort()},[e]),t}function d(e,t){let[n,r]=(0,c.useState)({status:`loading`});return(0,c.useEffect)(()=>{if(!e){r({status:`loading`});return}let t=new AbortController;return r({status:`loading`}),fetch(`/api/memory/compile-pages/wiki-pages/${encodeURIComponent(e)}/ancestors`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);r({status:`ok`,data:await e.json()})}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||r({status:`error`,error:e instanceof Error?e.message:String(e)})}),()=>t.abort()},[e,t]),n}var f={root:`_root_ecd9u_1`,section:`_section_ecd9u_8`,runsTableWrap:`_runsTableWrap_ecd9u_14`,runsTable:`_runsTable_ecd9u_14`,numericCell:`_numericCell_ecd9u_58`,compiledPositive:`_compiledPositive_ecd9u_63`,pagesList:`_pagesList_ecd9u_68`,pageCard:`_pageCard_ecd9u_74`,pageTitle:`_pageTitle_ecd9u_89`,pageContent:`_pageContent_ecd9u_98`,pageMeta:`_pageMeta_ecd9u_107`,tagRow:`_tagRow_ecd9u_116`,tagChip:`_tagChip_ecd9u_122`,expandRow:`_expandRow_ecd9u_132`,drilldown:`_drilldown_ecd9u_137`,drilldownInner:`_drilldownInner_ecd9u_141`,ancestorList:`_ancestorList_ecd9u_149`,ancestorRow:`_ancestorRow_ecd9u_155`,ancestorIdLine:`_ancestorIdLine_ecd9u_165`,ancestorIdMono:`_ancestorIdMono_ecd9u_176`,ancestorContent:`_ancestorContent_ecd9u_182`,uncompileArea:`_uncompileArea_ecd9u_191`,confirmRow:`_confirmRow_ecd9u_200`,confirmText:`_confirmText_ecd9u_207`,successText:`_successText_ecd9u_214`,errorText:`_errorText_ecd9u_220`,emptyState:`_emptyState_ecd9u_226`,footerRow:`_footerRow_ecd9u_237`},p=n();function m(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:new Date(t).toISOString().slice(0,10)}function h(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function g(e){return`$${e.toFixed(4)}`}function _(e){return e.replace(/\\n/g,`
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{t as r}from"./Button-DTO6bgnL.js";import{at as i,j as a}from"./index-DzJsiq8q.js";import{n as o,t as s}from"./shared-wI40KN7Y.js";var c=t(e(),1);function l(e){let[t,n]=(0,c.useState)({status:`loading`});return(0,c.useEffect)(()=>{let e=new AbortController;return n({status:`loading`}),fetch(`/api/memory/compile-pages/runs?limit=50`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);n({status:`ok`,data:await e.json()})}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||n({status:`error`,error:e instanceof Error?e.message:String(e)})}),()=>e.abort()},[e]),t}function u(e){let[t,n]=(0,c.useState)({status:`loading`});return(0,c.useEffect)(()=>{let e=new AbortController;return n({status:`loading`}),fetch(`/api/memory/compile-pages/wiki-pages?limit=100`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);n({status:`ok`,data:await e.json()})}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||n({status:`error`,error:e instanceof Error?e.message:String(e)})}),()=>e.abort()},[e]),t}function d(e,t){let[n,r]=(0,c.useState)({status:`loading`});return(0,c.useEffect)(()=>{if(!e){r({status:`loading`});return}let t=new AbortController;return r({status:`loading`}),fetch(`/api/memory/compile-pages/wiki-pages/${encodeURIComponent(e)}/ancestors`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);r({status:`ok`,data:await e.json()})}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||r({status:`error`,error:e instanceof Error?e.message:String(e)})}),()=>t.abort()},[e,t]),n}var f={root:`_root_ecd9u_1`,section:`_section_ecd9u_8`,runsTableWrap:`_runsTableWrap_ecd9u_14`,runsTable:`_runsTable_ecd9u_14`,numericCell:`_numericCell_ecd9u_58`,compiledPositive:`_compiledPositive_ecd9u_63`,pagesList:`_pagesList_ecd9u_68`,pageCard:`_pageCard_ecd9u_74`,pageTitle:`_pageTitle_ecd9u_89`,pageContent:`_pageContent_ecd9u_98`,pageMeta:`_pageMeta_ecd9u_107`,tagRow:`_tagRow_ecd9u_116`,tagChip:`_tagChip_ecd9u_122`,expandRow:`_expandRow_ecd9u_132`,drilldown:`_drilldown_ecd9u_137`,drilldownInner:`_drilldownInner_ecd9u_141`,ancestorList:`_ancestorList_ecd9u_149`,ancestorRow:`_ancestorRow_ecd9u_155`,ancestorIdLine:`_ancestorIdLine_ecd9u_165`,ancestorIdMono:`_ancestorIdMono_ecd9u_176`,ancestorContent:`_ancestorContent_ecd9u_182`,uncompileArea:`_uncompileArea_ecd9u_191`,confirmRow:`_confirmRow_ecd9u_200`,confirmText:`_confirmText_ecd9u_207`,successText:`_successText_ecd9u_214`,errorText:`_errorText_ecd9u_220`,emptyState:`_emptyState_ecd9u_226`,footerRow:`_footerRow_ecd9u_237`},p=n();function m(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:new Date(t).toISOString().slice(0,10)}function h(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function g(e){return`$${e.toFixed(4)}`}function _(e){return e.replace(/\\n/g,`
2
2
  `).replace(/\\t/g,` `).trimEnd()}function v(e){let t=_(e),n=t.match(/^\s*#\s+(.+?)\s*(?:\n+([\s\S]*))?$/);if(n)return{title:n[1],body:n[2]??``};let r=t.indexOf(`
3
- `);return r===-1?{title:t,body:``}:{title:t.slice(0,r).trim(),body:t.slice(r+1)}}function y(e,t){return e.length<=t?e:`${e.slice(0,t).trimEnd()}…`}function b({page:e,expanded:t,onToggle:n,onUncompiled:o,refreshToken:l}){let u=d(t?e.id:null,l),[h,g]=(0,c.useState)({phase:`idle`}),b=(0,c.useRef)(null);(0,c.useEffect)(()=>()=>{b.current?.abort()},[]);let x=(0,c.useCallback)(async()=>{if(h.phase===`submitting`)return;let t=new AbortController;b.current=t,g({phase:`submitting`});try{let n=await fetch(`/api/memory/compile-pages/wiki-pages/${encodeURIComponent(e.id)}`,{method:`DELETE`,signal:t.signal});if(!n.ok){let e,t;try{let r=await n.json();typeof r.error==`string`&&(t=r.error),typeof r.detail==`string`&&(e=r.detail)}catch{}let r=t?e?`${t}: ${e}`:t:`HTTP ${n.status}`;throw Error(r)}let r=await n.json();g({phase:`success`,message:`Restored ${r.ancestorsRestored} ancestors.`}),o(e.id,r.ancestorsRestored)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;g({phase:`error`,message:e instanceof Error?e.message:String(e)})}},[e.id,o,h.phase]),{title:S,body:C}=v(e.content),w=t?C:y(C,240);return(0,p.jsxs)(`div`,{className:f.pageCard,children:[(0,p.jsx)(`h3`,{className:f.pageTitle,children:S}),w&&(0,p.jsx)(`p`,{className:f.pageContent,children:w}),(0,p.jsxs)(`div`,{className:f.pageMeta,children:[e.employee&&(0,p.jsx)(`span`,{children:e.employee}),(0,p.jsx)(`span`,{children:m(e.timestamp)}),e.tags.length>0&&(0,p.jsx)(`span`,{className:f.tagRow,children:e.tags.map(e=>(0,p.jsx)(`span`,{className:f.tagChip,children:e},e))})]}),(0,p.jsx)(`div`,{className:f.expandRow,children:(0,p.jsx)(r,{variant:`ghost`,size:`sm`,onClick:n,children:t?`Hide ancestors`:`Show ancestors`})}),(0,p.jsx)(a,{initial:!1,children:t&&(0,p.jsx)(i.div,{className:f.drilldown,initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.22,ease:`easeInOut`},children:(0,p.jsxs)(`div`,{className:f.drilldownInner,children:[u.status===`loading`&&(0,p.jsx)(`p`,{className:f.emptyState,children:`Loading ancestors…`}),u.status===`error`&&(0,p.jsx)(s,{children:u.error}),u.status===`ok`&&(0,p.jsxs)(`div`,{className:f.ancestorList,children:[u.data.ancestors.length===0?(0,p.jsx)(`p`,{className:f.emptyState,children:`No ancestor observations found.`}):u.data.ancestors.map(e=>(0,p.jsxs)(`div`,{className:f.ancestorRow,children:[(0,p.jsxs)(`div`,{className:f.ancestorIdLine,children:[(0,p.jsx)(`span`,{className:f.ancestorIdMono,children:e.id.slice(0,12)}),(0,p.jsx)(`span`,{children:m(e.timestamp)}),e.employee&&(0,p.jsx)(`span`,{children:e.employee})]}),(0,p.jsx)(`p`,{className:f.ancestorContent,children:y(_(e.content),240)})]},e.id)),(0,p.jsxs)(`div`,{className:f.uncompileArea,children:[h.phase===`idle`&&(0,p.jsx)(r,{variant:`danger`,size:`sm`,onClick:()=>g({phase:`confirming`}),children:`Uncompile this page`}),h.phase===`confirming`&&(0,p.jsxs)(`div`,{className:f.confirmRow,children:[(0,p.jsxs)(`span`,{className:f.confirmText,children:[`Restore `,u.data.ancestors.length,` observation`,u.data.ancestors.length===1?``:`s`,` and delete this page?`]}),(0,p.jsx)(r,{variant:`default`,size:`sm`,onClick:()=>g({phase:`idle`}),children:`Cancel`}),(0,p.jsx)(r,{variant:`danger`,size:`sm`,onClick:x,children:`Confirm`})]}),h.phase===`submitting`&&(0,p.jsx)(`p`,{className:f.confirmText,children:`Uncompiling…`}),h.phase===`success`&&(0,p.jsx)(`p`,{className:f.successText,children:h.message}),h.phase===`error`&&(0,p.jsxs)(`p`,{className:f.errorText,children:[`Error: `,h.message]})]})]})]})},e.id)})]})}function x(e){let[t,n]=(0,c.useState)(0),[d,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(new Set),x=(0,c.useRef)(null),S=(0,c.useRef)(!0);(0,c.useEffect)(()=>(S.current=!0,()=>{S.current=!1,x.current!==null&&(clearTimeout(x.current),x.current=null)}),[]);let C=l(t),w=u(t),T=(0,c.useCallback)(e=>{_(t=>t===e?null:e)},[]),E=(0,c.useCallback)((e,t)=>{y(t=>{let n=new Set(t);return n.add(e),n}),_(null),x.current!==null&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,S.current&&(n(e=>e+1),y(new Set))},800)},[]),D=(0,c.useCallback)(()=>n(e=>e+1),[]),O=w.status===`ok`?w.data.pages.filter(e=>!v.has(e.id)):[];return(0,p.jsxs)(`div`,{className:f.root,children:[(0,p.jsxs)(`section`,{className:f.section,children:[(0,p.jsx)(o,{title:`Run history`,subtitle:`Recent nightly compile-pages runs`}),C.status===`loading`&&(0,p.jsx)(`p`,{className:f.emptyState,children:`Loading…`}),C.status===`error`&&(0,p.jsx)(s,{children:C.error}),C.status===`ok`&&C.data.runs.length===0&&(0,p.jsx)(`p`,{className:f.emptyState,children:`No runs yet. The compile-pages job hasn't run.`}),C.status===`ok`&&C.data.runs.length>0&&(0,p.jsx)(`div`,{className:f.runsTableWrap,children:(0,p.jsxs)(`table`,{className:f.runsTable,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{children:`Run at`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Clusters`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Compiled`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Skipped`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Cost`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Duration`})]})}),(0,p.jsx)(`tbody`,{children:(0,p.jsx)(a,{initial:!1,children:C.data.runs.map((e,t)=>(0,p.jsxs)(i.tr,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:.18,delay:Math.min(t,12)*.03},children:[(0,p.jsx)(`td`,{children:m(e.runAt)}),(0,p.jsx)(`td`,{className:f.numericCell,children:e.clustersFound}),(0,p.jsx)(`td`,{className:[f.numericCell,e.pagesCompiled>0?f.compiledPositive:``].filter(Boolean).join(` `),children:e.pagesCompiled}),(0,p.jsx)(`td`,{className:f.numericCell,children:e.pagesSkipped}),(0,p.jsx)(`td`,{className:f.numericCell,children:g(e.totalCostUsd)}),(0,p.jsx)(`td`,{className:f.numericCell,children:h(e.durationMs)})]},e.id))})})]})})]}),(0,p.jsxs)(`section`,{className:f.section,children:[(0,p.jsx)(o,{title:`Wiki-pages`,subtitle:`Compiled knowledge pages synthesized from memory observations`}),w.status===`loading`&&(0,p.jsx)(`p`,{className:f.emptyState,children:`Loading…`}),w.status===`error`&&(0,p.jsx)(s,{children:w.error}),w.status===`ok`&&O.length===0&&(0,p.jsx)(`p`,{className:f.emptyState,children:`No wiki-pages yet. Run the compile-pages job to generate them.`}),w.status===`ok`&&(0,p.jsx)(`div`,{className:f.pagesList,children:O.map(e=>(0,p.jsx)(b,{page:e,expanded:d===e.id,onToggle:()=>T(e.id),onUncompiled:E,refreshToken:t},e.id))})]}),(0,p.jsx)(`div`,{className:f.footerRow,children:(0,p.jsx)(r,{variant:`ghost`,size:`sm`,onClick:D,children:`Refresh`})})]})}export{x as MemoryWiki};
3
+ `);return r===-1?{title:t,body:``}:{title:t.slice(0,r).trim(),body:t.slice(r+1)}}function y(e,t){return e.length<=t?e:`${e.slice(0,t).trimEnd()}…`}function b({page:e,expanded:t,onToggle:n,onUncompiled:o,refreshToken:l}){let u=d(t?e.id:null,l),[h,g]=(0,c.useState)({phase:`idle`}),b=(0,c.useRef)(null);(0,c.useEffect)(()=>()=>{b.current?.abort()},[]);let x=(0,c.useCallback)(async()=>{if(h.phase===`submitting`)return;let t=new AbortController;b.current=t,g({phase:`submitting`});try{let n=await fetch(`/api/memory/compile-pages/wiki-pages/${encodeURIComponent(e.id)}`,{method:`DELETE`,signal:t.signal});if(!n.ok){let e,t;try{let r=await n.json();typeof r.error==`string`&&(t=r.error),typeof r.detail==`string`&&(e=r.detail)}catch{}let r=t?e?`${t}: ${e}`:t:`HTTP ${n.status}`;throw Error(r)}let r=await n.json();g({phase:`success`,message:`Restored ${r.ancestorsRestored} ancestors.`}),o(e.id,r.ancestorsRestored)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;g({phase:`error`,message:e instanceof Error?e.message:String(e)})}},[e.id,o,h.phase]),{title:S,body:C}=v(e.content),w=t?C:y(C,240);return(0,p.jsxs)(`div`,{className:f.pageCard,children:[(0,p.jsx)(`h3`,{className:f.pageTitle,children:S}),w&&(0,p.jsx)(`p`,{className:f.pageContent,children:w}),(0,p.jsxs)(`div`,{className:f.pageMeta,children:[e.employee&&(0,p.jsx)(`span`,{children:e.employee}),(0,p.jsx)(`span`,{children:m(e.timestamp)}),e.tags.length>0&&(0,p.jsx)(`span`,{className:f.tagRow,children:e.tags.map(e=>(0,p.jsx)(`span`,{className:f.tagChip,children:e},e))})]}),(0,p.jsx)(`div`,{className:f.expandRow,children:(0,p.jsx)(r,{variant:`ghost`,size:`sm`,onClick:n,children:t?`Hide ancestors`:`Show ancestors`})}),(0,p.jsx)(i,{initial:!1,children:t&&(0,p.jsx)(a.div,{className:f.drilldown,initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.22,ease:`easeInOut`},children:(0,p.jsxs)(`div`,{className:f.drilldownInner,children:[u.status===`loading`&&(0,p.jsx)(`p`,{className:f.emptyState,children:`Loading ancestors…`}),u.status===`error`&&(0,p.jsx)(s,{children:u.error}),u.status===`ok`&&(0,p.jsxs)(`div`,{className:f.ancestorList,children:[u.data.ancestors.length===0?(0,p.jsx)(`p`,{className:f.emptyState,children:`No ancestor observations found.`}):u.data.ancestors.map(e=>(0,p.jsxs)(`div`,{className:f.ancestorRow,children:[(0,p.jsxs)(`div`,{className:f.ancestorIdLine,children:[(0,p.jsx)(`span`,{className:f.ancestorIdMono,children:e.id.slice(0,12)}),(0,p.jsx)(`span`,{children:m(e.timestamp)}),e.employee&&(0,p.jsx)(`span`,{children:e.employee})]}),(0,p.jsx)(`p`,{className:f.ancestorContent,children:y(_(e.content),240)})]},e.id)),(0,p.jsxs)(`div`,{className:f.uncompileArea,children:[h.phase===`idle`&&(0,p.jsx)(r,{variant:`danger`,size:`sm`,onClick:()=>g({phase:`confirming`}),children:`Uncompile this page`}),h.phase===`confirming`&&(0,p.jsxs)(`div`,{className:f.confirmRow,children:[(0,p.jsxs)(`span`,{className:f.confirmText,children:[`Restore `,u.data.ancestors.length,` observation`,u.data.ancestors.length===1?``:`s`,` and delete this page?`]}),(0,p.jsx)(r,{variant:`default`,size:`sm`,onClick:()=>g({phase:`idle`}),children:`Cancel`}),(0,p.jsx)(r,{variant:`danger`,size:`sm`,onClick:x,children:`Confirm`})]}),h.phase===`submitting`&&(0,p.jsx)(`p`,{className:f.confirmText,children:`Uncompiling…`}),h.phase===`success`&&(0,p.jsx)(`p`,{className:f.successText,children:h.message}),h.phase===`error`&&(0,p.jsxs)(`p`,{className:f.errorText,children:[`Error: `,h.message]})]})]})]})},e.id)})]})}function x(e){let[t,n]=(0,c.useState)(0),[d,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(new Set),x=(0,c.useRef)(null),S=(0,c.useRef)(!0);(0,c.useEffect)(()=>(S.current=!0,()=>{S.current=!1,x.current!==null&&(clearTimeout(x.current),x.current=null)}),[]);let C=l(t),w=u(t),T=(0,c.useCallback)(e=>{_(t=>t===e?null:e)},[]),E=(0,c.useCallback)((e,t)=>{y(t=>{let n=new Set(t);return n.add(e),n}),_(null),x.current!==null&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,S.current&&(n(e=>e+1),y(new Set))},800)},[]),D=(0,c.useCallback)(()=>n(e=>e+1),[]),O=w.status===`ok`?w.data.pages.filter(e=>!v.has(e.id)):[];return(0,p.jsxs)(`div`,{className:f.root,children:[(0,p.jsxs)(`section`,{className:f.section,children:[(0,p.jsx)(o,{title:`Run history`,subtitle:`Recent nightly compile-pages runs`}),C.status===`loading`&&(0,p.jsx)(`p`,{className:f.emptyState,children:`Loading…`}),C.status===`error`&&(0,p.jsx)(s,{children:C.error}),C.status===`ok`&&C.data.runs.length===0&&(0,p.jsx)(`p`,{className:f.emptyState,children:`No runs yet. The compile-pages job hasn't run.`}),C.status===`ok`&&C.data.runs.length>0&&(0,p.jsx)(`div`,{className:f.runsTableWrap,children:(0,p.jsxs)(`table`,{className:f.runsTable,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{children:`Run at`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Clusters`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Compiled`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Skipped`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Cost`}),(0,p.jsx)(`th`,{className:f.numericCell,children:`Duration`})]})}),(0,p.jsx)(`tbody`,{children:(0,p.jsx)(i,{initial:!1,children:C.data.runs.map((e,t)=>(0,p.jsxs)(a.tr,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:.18,delay:Math.min(t,12)*.03},children:[(0,p.jsx)(`td`,{children:m(e.runAt)}),(0,p.jsx)(`td`,{className:f.numericCell,children:e.clustersFound}),(0,p.jsx)(`td`,{className:[f.numericCell,e.pagesCompiled>0?f.compiledPositive:``].filter(Boolean).join(` `),children:e.pagesCompiled}),(0,p.jsx)(`td`,{className:f.numericCell,children:e.pagesSkipped}),(0,p.jsx)(`td`,{className:f.numericCell,children:g(e.totalCostUsd)}),(0,p.jsx)(`td`,{className:f.numericCell,children:h(e.durationMs)})]},e.id))})})]})})]}),(0,p.jsxs)(`section`,{className:f.section,children:[(0,p.jsx)(o,{title:`Wiki-pages`,subtitle:`Compiled knowledge pages synthesized from memory observations`}),w.status===`loading`&&(0,p.jsx)(`p`,{className:f.emptyState,children:`Loading…`}),w.status===`error`&&(0,p.jsx)(s,{children:w.error}),w.status===`ok`&&O.length===0&&(0,p.jsx)(`p`,{className:f.emptyState,children:`No wiki-pages yet. Run the compile-pages job to generate them.`}),w.status===`ok`&&(0,p.jsx)(`div`,{className:f.pagesList,children:O.map(e=>(0,p.jsx)(b,{page:e,expanded:d===e.id,onToggle:()=>T(e.id),onUncompiled:E,refreshToken:t},e.id))})]}),(0,p.jsx)(`div`,{className:f.footerRow,children:(0,p.jsx)(r,{variant:`ghost`,size:`sm`,onClick:D,children:`Refresh`})})]})}export{x as MemoryWiki};
@@ -0,0 +1,33 @@
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{t as r}from"./react-dom-Cnw6SoYl.js";import{r as i}from"./useWebSocket-Hg3RO6sx.js";import{c as a,n as o}from"./styles-Ds5gMQAQ.js";import{$t as s,a as c,c as l,en as u,k as d}from"./index-DzJsiq8q.js";import{a as f,c as p,i as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./dagre.esm-DBOl5nQa.js";var x=t(e(),1),S=n(),C=220,w=80,T={executive:o.warning,manager:`var(--color-info)`,senior:`var(--color-text-muted)`,employee:o.textSecondary},E=[`#bc8cff`,`var(--color-info)`,`var(--color-positive)`,o.warning,`var(--color-negative)`,`#56d4dd`,`#f0883e`,`#db61a2`,`var(--color-text-muted)`,`var(--color-code)`];function ee(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return E[Math.abs(t)%E.length]}var D={width:20,height:10,borderRadius:`4px 4px 0 0`,background:o.hover,border:`1.5px solid ${o.muted}`,top:-5,cursor:`crosshair`},te={width:20,height:10,borderRadius:`0 0 4px 4px`,background:o.hover,border:`1.5px solid ${o.muted}`,bottom:-5,cursor:`crosshair`};function O({data:e}){let{employee:t,deptColor:n}=e,r=T[t.rank]||T.employee;return(0,S.jsxs)(`div`,{className:`org-node`,style:{width:C,height:w,background:o.cardBg,border:`2px solid ${n}`,borderRadius:10,padding:`10px 14px`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:10,transition:`box-shadow 0.15s`,boxShadow:`0 2px 8px rgba(0,0,0,0.3)`},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`0 4px 16px ${n}44`},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`0 2px 8px rgba(0,0,0,0.3)`},children:[(0,S.jsx)(m,{type:`target`,position:b.Top,id:`target`,style:D}),(0,S.jsx)(m,{type:`source`,position:b.Bottom,id:`source`,style:te}),(0,S.jsx)(`span`,{style:{fontSize:24,flexShrink:0},children:t.emoji||`👤`}),(0,S.jsxs)(`div`,{style:{overflow:`hidden`,minWidth:0},children:[(0,S.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:o.text,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:s(t)}),(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginTop:3},children:[(0,S.jsx)(`span`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,padding:`1px 6px`,borderRadius:3,background:`${r}22`,color:r,letterSpacing:.3},children:t.rank}),(0,S.jsx)(`span`,{style:{fontSize:10,color:o.muted,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:t.department}),t.engine&&t.engine!==`claude`&&(0,S.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`1px 6px`,borderRadius:3,background:`rgba(86,212,221,0.15)`,color:`#56d4dd`,letterSpacing:.3,flexShrink:0},children:t.engine.toUpperCase()})]})]})]})}var ne={employeeNode:O};function re(e,t){let n=new y.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:`TB`,nodesep:60,ranksep:80});for(let t of e)n.setNode(t.name,{width:C+40,height:w+20});let r=t.nodes,i=[];for(let[e,t]of Object.entries(r))for(let r of t.directReports)n.setEdge(e,r),i.push({id:`${e}->${r}`,source:e,sourceHandle:`source`,target:r,targetHandle:`target`,type:`smoothstep`,style:{stroke:o.border,strokeWidth:2},animated:!1});return y.layout(n),{nodes:e.map(e=>{let t=n.node(e.name),r=ee(e.department);return{id:e.name,type:`employeeNode`,position:{x:(t?.x??0)-C/2,y:(t?.y??0)-w/2},data:{employee:e,deptColor:r},sourcePosition:b.Bottom,targetPosition:b.Top,draggable:!1}}),edges:i}}function k({employees:e,hierarchy:t,onSelect:n,onReparent:r}){let i=v(),a=(0,x.useMemo)(()=>re(e,t),[e,t]);(0,x.useEffect)(()=>{i.fitView({padding:.2})},[a,i]);let s=(0,x.useCallback)((e,t)=>{n(t.id)},[n]),c=(0,x.useCallback)(e=>{let{source:t,target:n,sourceHandle:i,targetHandle:a}=e;!t||!n||t===n||!i||!a||i===a||r&&r(i===`target`?t:n,i===`target`?n:t)},[r]),l=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let e=l.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e.isIntersecting&&setTimeout(()=>i.fitView({padding:.2}),50)},{threshold:.1});return t.observe(e),()=>t.disconnect()},[i]),(0,S.jsx)(`div`,{ref:l,style:{width:`100%`,height:`100%`,minHeight:500,background:o.darkBg,borderRadius:8,border:`1px solid ${o.border}`},children:(0,S.jsxs)(g,{nodes:a.nodes,edges:a.edges,onNodeClick:s,onConnect:c,isValidConnection:()=>!0,connectionMode:p.Loose,connectionLineStyle:{stroke:`var(--color-primary)`,strokeWidth:2,strokeDasharray:`5 5`},nodesDraggable:!1,nodeTypes:ne,fitView:!0,fitViewOptions:{padding:.2},minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},style:{background:o.darkBg},children:[(0,S.jsx)(h,{color:o.border,gap:20}),(0,S.jsx)(_,{showInteractive:!1,style:{background:o.cardBg,borderColor:o.border},className:`dark-controls`}),(0,S.jsx)(`style`,{children:`
2
+ .dark-controls .react-flow__controls-button {
3
+ background: #21262d;
4
+ border: 1px solid ${o.border};
5
+ fill: #e6edf3;
6
+ color: #e6edf3;
7
+ }
8
+ .dark-controls .react-flow__controls-button:hover {
9
+ background: #30363d;
10
+ }
11
+ .dark-controls .react-flow__controls-button svg {
12
+ fill: #e6edf3;
13
+ }
14
+ .org-node .react-flow__handle {
15
+ opacity: 0.3;
16
+ transition: opacity 0.15s, background 0.15s, border-color 0.15s;
17
+ }
18
+ .org-node:hover .react-flow__handle {
19
+ opacity: 0.8;
20
+ }
21
+ .org-node .react-flow__handle:hover {
22
+ opacity: 1;
23
+ background: rgba(201,160,255,0.3) !important;
24
+ border-color: #c9a0ff !important;
25
+ }
26
+ .react-flow__connection-line {
27
+ stroke: #c9a0ff;
28
+ }
29
+ `})]},`org-map`)})}function A(e){return(0,S.jsx)(f,{children:(0,S.jsx)(k,{...e})})}var ie={executive:o.warning,manager:`var(--color-info)`,senior:`var(--color-text-muted)`,employee:o.textSecondary};function ae({employees:e,onSelect:t}){let n={executive:0,manager:1,senior:2,employee:3};return(0,S.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(240px, 1fr))`,gap:12},children:[...e].sort((e,t)=>(n[e.rank]??3)-(n[t.rank]??3)).map(e=>{let n=ie[e.rank]||ie.employee;return(0,S.jsxs)(`button`,{onClick:()=>t(e.name),style:{background:o.cardBg,border:`1px solid ${o.border}`,borderRadius:10,padding:`16px 18px`,cursor:`pointer`,textAlign:`left`,display:`flex`,alignItems:`center`,gap:12,transition:`border-color 0.15s, box-shadow 0.15s`,width:`100%`},onMouseEnter:e=>{e.currentTarget.style.borderColor=n,e.currentTarget.style.boxShadow=`0 2px 12px ${n}22`},onMouseLeave:e=>{e.currentTarget.style.borderColor=o.border,e.currentTarget.style.boxShadow=`none`},children:[(0,S.jsx)(`span`,{style:{fontSize:28,flexShrink:0},children:e.emoji||`👤`}),(0,S.jsxs)(`div`,{style:{overflow:`hidden`,minWidth:0},children:[(0,S.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:o.text,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:s(e)}),(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:4},children:[(0,S.jsx)(`span`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,padding:`2px 8px`,borderRadius:4,background:`${n}22`,color:n,letterSpacing:.3},children:e.rank}),(0,S.jsx)(`span`,{style:{fontSize:11,color:o.muted,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.department}),e.engine&&e.engine!==`claude`&&(0,S.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`1px 6px`,borderRadius:3,background:`rgba(86,212,221,0.15)`,color:`#56d4dd`,letterSpacing:.3,flexShrink:0},children:e.engine.toUpperCase()})]})]})]},e.name)})})}var j={executive:o.warning,manager:`var(--color-info)`,senior:`var(--color-text-muted)`,employee:o.textSecondary};function oe({name:e,hierarchy:t,employeeMap:n,depth:r,expanded:i,onToggle:a,onSelect:c}){let l=t.nodes[e],u=n.get(e);if(!l||!u)return null;let d=l.directReports.length>0,f=i.has(e),p=j[u.rank]||j.employee;return(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,paddingLeft:r*24,padding:`6px 12px 6px ${r*24+12}px`,cursor:`pointer`,borderRadius:6,transition:`background 0.1s`},onMouseEnter:e=>{e.currentTarget.style.background=`${o.cardBg}`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},onClick:()=>c(e),children:[(0,S.jsx)(`button`,{onClick:t=>{t.stopPropagation(),d&&a(e)},style:{width:20,height:20,flexShrink:0,background:`none`,border:`none`,cursor:d?`pointer`:`default`,color:d?o.muted:`transparent`,fontSize:12,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`transform 0.15s`,transform:f?`rotate(90deg)`:`rotate(0deg)`},children:d?`▶`:``}),(0,S.jsx)(`span`,{style:{fontSize:18,flexShrink:0},children:u.emoji||`👤`}),(0,S.jsx)(`span`,{style:{fontSize:13,fontWeight:500,color:o.text},children:s(u)}),(0,S.jsx)(`span`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,padding:`1px 6px`,borderRadius:3,background:`${p}22`,color:p,letterSpacing:.3},children:u.rank}),(0,S.jsx)(`span`,{style:{fontSize:11,color:o.muted},children:u.department})]}),d&&f&&(0,S.jsx)(`div`,{children:l.directReports.map(e=>(0,S.jsx)(oe,{name:e,hierarchy:t,employeeMap:n,depth:r+1,expanded:i,onToggle:a,onSelect:c},e))})]})}function M({employees:e,hierarchy:t,onSelect:n}){let[r,i]=(0,x.useState)(()=>new Set(e.map(e=>e.name))),a=new Map(e.map(e=>[e.name,e])),s=(0,x.useCallback)(e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),c=[];t.root&&c.push(t.root);for(let n of e)!t.nodes[n.name]?.parentName&&n.name!==t.root&&c.push(n.name);return c.length===0?(0,S.jsx)(`div`,{style:{padding:20,color:o.muted,fontSize:13},children:`No hierarchy data available`}):(0,S.jsx)(`div`,{style:{background:o.darkBg,border:`1px solid ${o.border}`,borderRadius:8,padding:`8px 0`},children:c.map(e=>(0,S.jsx)(oe,{name:e,hierarchy:t,employeeMap:a,depth:0,expanded:r,onToggle:s,onSelect:n},e))})}var se=t(r());function ce(){var e=[...arguments];return(0,x.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var N=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function P(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function F(e){return`nodeType`in e}function I(e){return e?P(e)?e:F(e)?e.ownerDocument?.defaultView??window:window:window}function L(e){let{Document:t}=I(e);return e instanceof t}function R(e){return P(e)?!1:e instanceof I(e).HTMLElement}function z(e){return e instanceof I(e).SVGElement}function B(e){return e?P(e)?e.document:F(e)?L(e)?e:R(e)||z(e)?e.ownerDocument:document:document:document}var V=N?x.useLayoutEffect:x.useEffect;function le(e){let t=(0,x.useRef)(e);return V(()=>{t.current=e}),(0,x.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function ue(){let e=(0,x.useRef)(null);return[(0,x.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,x.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function de(e,t){t===void 0&&(t=[e]);let n=(0,x.useRef)(e);return V(()=>{n.current!==e&&(n.current=e)},t),n}function H(e,t){let n=(0,x.useRef)();return(0,x.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function U(e){let t=le(e),n=(0,x.useRef)(null);return[n,(0,x.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function W(e){let t=(0,x.useRef)();return(0,x.useEffect)(()=>{t.current=e},[e]),t.current}var G={};function fe(e,t){return(0,x.useMemo)(()=>{if(t)return t;let n=G[e]==null?0:G[e]+1;return G[e]=n,e+`-`+n},[e,t])}function pe(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var me=pe(1),he=pe(-1);function ge(e){return`clientX`in e&&`clientY`in e}function _e(e){if(!e)return!1;let{KeyboardEvent:t}=I(e.target);return t&&e instanceof t}function ve(e){if(!e)return!1;let{TouchEvent:t}=I(e.target);return t&&e instanceof t}function ye(e){if(ve(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ge(e)?{x:e.clientX,y:e.clientY}:null}var K=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[K.Translate.toString(e),K.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),be=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function xe(e){return e.matches(be)?e:e.querySelector(be)}var q={display:`none`};function Se(e){let{id:t,value:n}=e;return x.createElement(`div`,{id:t,style:q},n)}function Ce(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return x.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function we(){let[e,t]=(0,x.useState)(``);return{announce:(0,x.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Te=(0,x.createContext)(null);function Ee(e){let t=(0,x.useContext)(Te);(0,x.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function De(){let[e]=(0,x.useState)(()=>new Set),t=(0,x.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,x.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Oe={draggable:`
30
+ To pick up a draggable item, press the space bar.
31
+ While dragging, use the arrow keys to move the item.
32
+ Press space again to drop the item in its new position, or press escape to cancel.
33
+ `},ke={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Ae(e){let{announcements:t=ke,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Oe}=e,{announce:a,announcement:o}=we(),s=fe(`DndLiveRegion`),[c,l]=(0,x.useState)(!1);if((0,x.useEffect)(()=>{l(!0)},[]),Ee((0,x.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=x.createElement(x.Fragment,null,x.createElement(Se,{id:r,value:i.draggable}),x.createElement(Ce,{id:s,announcement:o}));return n?(0,se.createPortal)(u,n):u}var J;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(J||={});function je(){}function Me(e,t){return(0,x.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Ne(){var e=[...arguments];return(0,x.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Y=Object.freeze({x:0,y:0});function Pe(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Fe(e,t){let n=ye(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function Ie(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Le(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Re(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function ze(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Be=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ze(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Pe(ze(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Ie)};function Ve(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var He=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Ve(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Le)};function Ue(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function We(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Y}function Ge(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Ke=Ge(1);function qe(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Je(e,t,n){let r=qe(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Ye={ignoreTransform:!1};function Xe(e,t){t===void 0&&(t=Ye);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=I(e).getComputedStyle(e);t&&(n=Je(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function Ze(e){return Xe(e,{ignoreTransform:!0})}function Qe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $e(e,t){return t===void 0&&(t=I(e).getComputedStyle(e)),t.position===`fixed`}function et(e,t){t===void 0&&(t=I(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function tt(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(L(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!R(i)||z(i)||n.includes(i))return n;let a=I(e).getComputedStyle(i);return i!==e&&et(i,a)&&n.push(i),$e(i,a)?n:r(i.parentNode)}return e?r(e):n}function nt(e){let[t]=tt(e,1);return t??null}function rt(e){return!N||!e?null:P(e)?e:F(e)?L(e)||e===B(e).scrollingElement?window:R(e)?e:null:null}function it(e){return P(e)?e.scrollX:e.scrollLeft}function at(e){return P(e)?e.scrollY:e.scrollTop}function ot(e){return{x:it(e),y:at(e)}}var X;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(X||={});function st(e){return!N||!e?!1:e===document.scrollingElement}function ct(e){let t={x:0,y:0},n=st(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var lt={x:.2,y:.2};function ut(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=lt);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=ct(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=X.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=X.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=X.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=X.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function dt(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function ft(e){return e.reduce((e,t)=>me(e,ot(t)),Y)}function pt(e){return e.reduce((e,t)=>e+it(t),0)}function mt(e){return e.reduce((e,t)=>e+at(t),0)}function ht(e,t){if(t===void 0&&(t=Xe),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);nt(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var gt=[[`x`,[`left`,`right`],pt],[`y`,[`top`,`bottom`],mt]],_t=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=tt(t),r=ft(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of gt)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},vt=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function yt(e){let{EventTarget:t}=I(e);return e instanceof t?e:B(e)}function bt(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Z;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Z||={});function xt(e){e.preventDefault()}function St(e){e.stopPropagation()}var Q;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Q||={});var Ct={start:[Q.Space,Q.Enter],cancel:[Q.Esc],end:[Q.Space,Q.Enter,Q.Tab]},wt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Q.Right:return{...n,x:n.x+25};case Q.Left:return{...n,x:n.x-25};case Q.Down:return{...n,y:n.y+25};case Q.Up:return{...n,y:n.y-25}}},Tt=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new vt(B(t)),this.windowListeners=new vt(I(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&ht(n),t(Y)}handleKeyDown(e){if(_e(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Ct,coordinateGetter:a=wt,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Y;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=he(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=ct(n),p=dt(n),m={x:Math.min(i===Q.Right?p.right-p.width/2:p.right,Math.max(i===Q.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Q.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Q.Down?p.top:p.top+p.height/2,u.y))},h=i===Q.Right&&!s||i===Q.Left&&!c,g=i===Q.Down&&!l||i===Q.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Q.Right&&e<=d.x||i===Q.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Q.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Q.Down&&e<=d.y||i===Q.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Q.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,me(he(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Tt.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Ct,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Et(e){return!!(e&&`distance`in e)}function Dt(e){return!!(e&&`delay`in e)}var Ot=class{constructor(e,t,n){n===void 0&&(n=yt(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=B(i),this.documentListeners=new vt(this.document),this.listeners=new vt(n),this.windowListeners=new vt(I(i)),this.initialCoordinates=ye(r)??Y,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,xt),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,xt),this.documentListeners.add(Z.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Dt(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Et(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Z.Click,St,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=ye(e)??Y,s=he(n,o);if(!t&&a){if(Et(a)){if(a.tolerance!=null&&bt(s,a.tolerance))return this.handleCancel();if(bt(s,a.distance))return this.handleStart()}if(Dt(a)&&bt(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Q.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},kt={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},At=class extends Ot{constructor(e){let{event:t}=e,n=B(t.target);super(e,kt,n)}};At.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var jt={move:{name:`mousemove`},end:{name:`mouseup`}},Mt;(function(e){e[e.RightClick=2]=`RightClick`})(Mt||={});var Nt=class extends Ot{constructor(e){super(e,jt,B(e.event.target))}};Nt.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Mt.RightClick?!1:(r?.({event:n}),!0)}}];var Pt={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Ft=class extends Ot{constructor(e){super(e,Pt)}static setup(){return window.addEventListener(Pt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Pt.move.name,e)};function e(){}}};Ft.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var It;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(It||={});var Lt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Lt||={});function Rt(e){let{acceleration:t,activator:n=It.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Lt.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Bt({delta:d,disabled:!a}),[m,h]=ue(),g=(0,x.useRef)({x:0,y:0}),_=(0,x.useRef)({x:0,y:0}),v=(0,x.useMemo)(()=>{switch(n){case It.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case It.DraggableRect:return i}},[n,i,c]),y=(0,x.useRef)(null),b=(0,x.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,x.useMemo)(()=>s===Lt.TreeOrder?[...l].reverse():l,[s,l]);(0,x.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=ut(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var zt={x:{[X.Backward]:!1,[X.Forward]:!1},y:{[X.Backward]:!1,[X.Forward]:!1}};function Bt(e){let{delta:t,disabled:n}=e,r=W(t);return H(e=>{if(n||!r||!e)return zt;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[X.Backward]:e.x[X.Backward]||i.x===-1,[X.Forward]:e.x[X.Forward]||i.x===1},y:{[X.Backward]:e.y[X.Backward]||i.y===-1,[X.Forward]:e.y[X.Forward]||i.y===1}}},[n,t,r])}function Vt(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return H(e=>t==null?null:r??e??null,[r,t])}function Ht(e,t){return(0,x.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var Ut;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Ut||={});var Wt;(function(e){e.Optimized=`optimized`})(Wt||={});var Gt=new Map;function Kt(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,x.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,x.useRef)(e),d=g(),f=de(d),p=(0,x.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,x.useRef)(null),h=H(t=>{if(d&&!n)return Gt;if(!t||t===Gt||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new _t(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,x.useEffect)(()=>{u.current=e},[e]),(0,x.useEffect)(()=>{d||p()},[n,d]),(0,x.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,x.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case Ut.Always:return!1;case Ut.BeforeDragging:return n;default:return!n}}}function qt(e,t){return H(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Jt(e,t){return qt(e,t)}function Yt(e){let{callback:t,disabled:n}=e,r=le(t),i=(0,x.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,x.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Xt(e){let{callback:t,disabled:n}=e,r=le(t),i=(0,x.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,x.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Zt(e){return new _t(Xe(e),e)}function Qt(e,t,n){t===void 0&&(t=Zt);let[r,i]=(0,x.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Yt({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Xt({callback:a});return V(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function $t(e){return We(e,qt(e))}var en=[];function tn(e){let t=(0,x.useRef)(e),n=H(n=>e?n&&n!==en&&e&&t.current&&e.parentNode===t.current.parentNode?n:tt(e):en,[e]);return(0,x.useEffect)(()=>{t.current=e},[e]),n}function nn(e){let[t,n]=(0,x.useState)(null),r=(0,x.useRef)(e),i=(0,x.useCallback)(e=>{let t=rt(e.target);t&&n(e=>e?(e.set(t,ot(t)),new Map(e)):null)},[]);return(0,x.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=rt(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,ot(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{rt(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,x.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>me(e,t),Y):ft(e):Y,[e,t])}function rn(e,t){t===void 0&&(t=[]);let n=(0,x.useRef)(null);return(0,x.useEffect)(()=>{n.current=null},t),(0,x.useEffect)(()=>{let t=e!==Y;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?he(e,n.current):Y}function an(e){(0,x.useEffect)(()=>{if(!N)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function on(e,t){return(0,x.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function sn(e){return(0,x.useMemo)(()=>e?Qe(e):null,[e])}var cn=[];function ln(e,t){t===void 0&&(t=Xe);let[n]=e,r=sn(n?I(n):null),[i,a]=(0,x.useState)(cn);function o(){a(()=>e.length?e.map(e=>st(e)?r:new _t(t(e),e)):cn)}let s=Xt({callback:o});return V(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function un(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return R(t)?t:e}function dn(e){let{measure:t}=e,[n,r]=(0,x.useState)(null),i=Xt({callback:(0,x.useCallback)(e=>{for(let{target:n}of e)if(R(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=U((0,x.useCallback)(e=>{let n=un(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,x.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var fn=[{sensor:At,options:{}},{sensor:Tt,options:{}}],pn={current:{}},mn={draggable:{measure:Ze},droppable:{measure:Ze,strategy:Ut.WhileDragging,frequency:Wt.Optimized},dragOverlay:{measure:Xe}},hn=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},gn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:je},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:mn,measureDroppableContainers:je,windowRect:null,measuringScheduled:!1},_n={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:je,draggableNodes:new Map,over:null,measureDroppableContainers:je},vn=(0,x.createContext)(_n),yn=(0,x.createContext)(gn);function bn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hn}}}function xn(e,t){switch(t.type){case J.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case J.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case J.DragEnd:case J.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case J.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new hn(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case J.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new hn(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case J.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new hn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Sn(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,x.useContext)(vn),a=W(r),o=W(n?.id);return(0,x.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!_e(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=xe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Cn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function wn(e){return(0,x.useMemo)(()=>({draggable:{...mn.draggable,...e?.draggable},droppable:{...mn.droppable,...e?.droppable},dragOverlay:{...mn.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Tn(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,x.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;V(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=We(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=nt(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var En=(0,x.createContext)({...Y,scaleX:1,scaleY:1}),Dn;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Dn||={});var On=(0,x.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=fn,collisionDetection:o=He,measuring:s,modifiers:c,...l}=e,[u,d]=(0,x.useReducer)(xn,void 0,bn),[f,p]=De(),[m,h]=(0,x.useState)(Dn.Uninitialized),g=m===Dn.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,S=_==null?null:v.get(_),C=(0,x.useRef)({initial:null,translated:null}),w=(0,x.useMemo)(()=>_==null?null:{id:_,data:S?.data??pn,rect:C},[_,S]),T=(0,x.useRef)(null),[E,ee]=(0,x.useState)(null),[D,te]=(0,x.useState)(null),O=de(l,Object.values(l)),ne=fe(`DndDescribedBy`,t),re=(0,x.useMemo)(()=>b.getEnabled(),[b]),k=wn(s),{droppableRects:A,measureDroppableContainers:ie,measuringScheduled:ae}=Kt(re,{dragging:g,dependencies:[y.x,y.y],config:k.droppable}),j=Vt(v,_),oe=(0,x.useMemo)(()=>D?ye(D):null,[D]),M=Me(),ce=Jt(j,k.draggable.measure);Tn({activeNode:_==null?null:v.get(_),config:M.layoutShiftCompensation,initialRect:ce,measure:k.draggable.measure});let N=Qt(j,k.draggable.measure,ce),P=Qt(j?j.parentElement:null),F=(0,x.useRef)({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:A,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),L=b.getNodeFor(F.current.over?.id),R=dn({measure:k.dragOverlay.measure}),z=R.nodeRef.current??j,B=g?R.rect??N:null,le=!!(R.nodeRef.current&&R.rect),ue=$t(le?null:N),H=sn(z?I(z):null),U=tn(g?L??j:null),W=ln(U),G=Cn(c,{transform:{x:y.x-ue.x,y:y.y-ue.y,scaleX:1,scaleY:1},activatorEvent:D,active:w,activeNodeRect:N,containerNodeRect:P,draggingNodeRect:B,over:F.current.over,overlayNodeRect:R.rect,scrollableAncestors:U,scrollableAncestorRects:W,windowRect:H}),pe=oe?me(oe,y):null,he=nn(U),ge=rn(he),_e=rn(he,[N]),ve=me(G,ge),K=B?Ke(B,G):null,be=w&&K?o({active:w,collisionRect:K,droppableRects:A,droppableContainers:re,pointerCoordinates:pe}):null,xe=Re(be,`id`),[q,Se]=(0,x.useState)(null),Ce=Ue(le?G:me(G,_e),q?.rect??null,N),we=(0,x.useRef)(null),Ee=(0,x.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;we.current=new n({active:T.current,activeNode:i,event:a,options:r,context:F,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=O.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=O.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=O.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,se.unstable_batchedUpdates)(()=>{r?.(i),h(Dn.Initializing),d({type:J.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),ee(we.current),te(a)})},onMove(e){d({type:J.DragMove,coordinates:e})},onEnd:o(J.DragEnd),onCancel:o(J.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=F.current,o=null;if(t&&i){let{cancelDrop:s}=O.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===J.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=J.DragCancel)}T.current=null,(0,se.unstable_batchedUpdates)(()=>{d({type:e}),h(Dn.Uninitialized),Se(null),ee(null),te(null),we.current=null;let t=e===J.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=O.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Oe=Ht(a,(0,x.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Ee(n,t))},[v,Ee]));an(a),V(()=>{N&&m===Dn.Initializing&&h(Dn.Initialized)},[N,m]),(0,x.useEffect)(()=>{let{onDragMove:e}=O.current,{active:t,activatorEvent:n,collisions:r,over:i}=F.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ve.x,y:ve.y},over:i};(0,se.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ve.x,ve.y]),(0,x.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=F.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=O.current,o=r.get(xe),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,se.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[xe]),V(()=>{F.current={activatorEvent:D,active:w,activeNode:j,collisionRect:K,collisions:be,droppableRects:A,draggableNodes:v,draggingNode:z,draggingNodeRect:B,droppableContainers:b,over:q,scrollableAncestors:U,scrollAdjustedTranslate:ve},C.current={initial:B,translated:K}},[w,j,be,K,v,z,B,A,b,q,U,ve]),Rt({...M,delta:y,draggingRect:K,pointerCoordinates:pe,scrollableAncestors:U,scrollableAncestorRects:W});let ke=(0,x.useMemo)(()=>({active:w,activeNode:j,activeNodeRect:N,activatorEvent:D,collisions:be,containerNodeRect:P,dragOverlay:R,draggableNodes:v,droppableContainers:b,droppableRects:A,over:q,measureDroppableContainers:ie,scrollableAncestors:U,scrollableAncestorRects:W,measuringConfiguration:k,measuringScheduled:ae,windowRect:H}),[w,j,N,D,be,P,R,v,b,A,q,ie,U,W,k,ae,H]),je=(0,x.useMemo)(()=>({activatorEvent:D,activators:Oe,active:w,activeNodeRect:N,ariaDescribedById:{draggable:ne},dispatch:d,draggableNodes:v,over:q,measureDroppableContainers:ie}),[D,Oe,w,N,d,ne,v,q,ie]);return x.createElement(Te.Provider,{value:p},x.createElement(vn.Provider,{value:je},x.createElement(yn.Provider,{value:ke},x.createElement(En.Provider,{value:Ce},i)),x.createElement(Sn,{disabled:n?.restoreFocus===!1})),x.createElement(Ae,{...n,hiddenTextDescribedById:ne}));function Me(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),kn=(0,x.createContext)(null),An=`button`,jn=`Draggable`;function Mn(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=fe(jn),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,x.useContext)(vn),{role:p=An,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,x.useContext)(g?En:kn),[v,y]=U(),[b,S]=U(),C=on(o,t),w=de(n);return V(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,x.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===An?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:v,over:f,setNodeRef:y,setActivatorNodeRef:S,transform:_}}function Nn(){return(0,x.useContext)(yn)}var Pn=`Droppable`,Fn={timeout:25};function In(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=fe(Pn),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,x.useContext)(vn),u=(0,x.useRef)({disabled:n}),d=(0,x.useRef)(!1),f=(0,x.useRef)(null),p=(0,x.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Fn,...i},_=de(h??r),v=Xt({callback:(0,x.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=U((0,x.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),S=de(t);return(0,x.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,x.useEffect)(()=>(s({type:J.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:S}}),()=>s({type:J.UnregisterDroppable,key:a,id:r})),[r]),(0,x.useEffect)(()=>{n!==u.current.disabled&&(s({type:J.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Ln(e){let{animation:t,children:n}=e,[r,i]=(0,x.useState)(null),[a,o]=(0,x.useState)(null),s=W(n);return!n&&!r&&s&&i(s),V(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),x.createElement(x.Fragment,null,n,r?(0,x.cloneElement)(r,{ref:o}):null)}var Rn={x:0,y:0,scaleX:1,scaleY:1};function zn(e){let{children:t}=e;return x.createElement(vn.Provider,{value:_n},x.createElement(En.Provider,{value:Rn},t))}var Bn={position:`fixed`,touchAction:`none`},Vn=e=>_e(e)?`transform 250ms ease`:void 0,Hn=(0,x.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Vn}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Bn,width:s.width,height:s.height,top:s.top,left:s.left,transform:K.Transform.toString(d),transformOrigin:i&&r?Fe(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return x.createElement(n,{className:o,style:f,ref:t},a)}),Un={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:K.Transform.toString(t)},{transform:K.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Wn(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return le((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=un(a);if(!c)return;let{transform:l}=I(a).getComputedStyle(a),u=qe(l);if(!u)return;let d=typeof t==`function`?t:Gn(t);return ht(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function Gn(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Un,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var Kn=0;function qn(e){return(0,x.useMemo)(()=>{if(e!=null)return Kn++,Kn},[e])}var Jn=x.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:S}=Nn(),C=(0,x.useContext)(En),w=qn(d?.id),T=Cn(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:C,windowRect:S}),E=qt(f),ee=Wn({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=E?g.setRef:void 0;return x.createElement(zn,null,x.createElement(Ln,{animation:ee},d&&w?x.createElement(Hn,{key:w,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:E,style:{zIndex:l,...i},transform:T},n):null))});function Yn(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Xn(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Zn(e){return e!==null&&e>=0}function Qn(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function $n(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var er=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Yn(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},tr={scaleX:1,scaleY:1},nr=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...tr}:null}let s=rr(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...tr}:r<t&&r>=a?{x:0,y:o.height+s,...tr}:{x:0,y:0,...tr}};function rr(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var ir=`Sortable`,ar=x.createContext({activeIndex:-1,containerId:ir,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:er,disabled:{draggable:!1,droppable:!1}});function or(e){let{children:t,id:n,items:r,strategy:i=er,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Nn(),d=fe(ir,n),f=s.rect!==null,p=(0,x.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,x.useRef)(p),v=!Qn(p,_.current),y=g!==-1&&h===-1||v,b=$n(a);V(()=>{v&&m&&u(p)},[v,p,m,u]),(0,x.useEffect)(()=>{_.current=p},[p]);let S=(0,x.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:Xn(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return x.createElement(ar.Provider,{value:S},t)}var sr=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Yn(n,r,i).indexOf(t)},cr=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},lr={duration:200,easing:`ease`},ur=`transform`,dr=K.Transition.toString({property:ur,duration:0,easing:`linear`}),fr={roleDescription:`sortable`};function pr(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,x.useState)(null),s=(0,x.useRef)(n);return V(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Xe(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,x.useEffect)(()=>{a&&o(null)},[a]),a}function mr(e){let{animateLayoutChanges:t=cr,attributes:n,disabled:r,data:i,getNewIndex:a=sr,id:o,strategy:s,resizeObserverConfig:c,transition:l=lr}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,x.useContext)(ar),y=hr(r,p),b=u.indexOf(o),S=(0,x.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),C=(0,x.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:ee}=In({id:o,data:S,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:D,activatorEvent:te,activeNodeRect:O,attributes:ne,setNodeRef:re,listeners:k,isDragging:A,over:ie,setActivatorNodeRef:ae,transform:j}=Mn({id:o,data:S,attributes:{...fr,...n},disabled:y.draggable}),oe=ce(ee,re),M=!!D,se=M&&!m&&Zn(f)&&Zn(g),N=!_&&A,P=se?(N&&se?j:null)??(s??v)({rects:h,activeNodeRect:O,activeIndex:f,overIndex:g,index:b}):null,F=Zn(f)&&Zn(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,I=D?.id,L=(0,x.useRef)({activeId:I,items:u,newIndex:F,containerId:d}),R=u!==L.current.items,z=t({active:D,containerId:d,isDragging:A,isSorting:M,id:o,index:b,items:u,newIndex:L.current.newIndex,previousItems:L.current.items,previousContainerId:L.current.containerId,transition:l,wasDragging:L.current.activeId!=null}),B=pr({disabled:!z,index:b,node:T,rect:w});return(0,x.useEffect)(()=>{M&&L.current.newIndex!==F&&(L.current.newIndex=F),d!==L.current.containerId&&(L.current.containerId=d),u!==L.current.items&&(L.current.items=u)},[M,F,d,u]),(0,x.useEffect)(()=>{if(I===L.current.activeId)return;if(I!=null&&L.current.activeId==null){L.current.activeId=I;return}let e=setTimeout(()=>{L.current.activeId=I},50);return()=>clearTimeout(e)},[I]),{active:D,activeIndex:f,attributes:ne,data:S,rect:w,index:b,newIndex:F,items:u,isOver:E,isSorting:M,isDragging:A,listeners:k,node:T,overIndex:g,over:ie,setNodeRef:oe,setActivatorNodeRef:ae,setDroppableNodeRef:ee,setDraggableNodeRef:re,transform:B??P,transition:V()};function V(){if(B||R&&L.current.newIndex===b)return dr;if(!(N&&!_e(te)||!l)&&(M||z))return K.Transition.toString({...l,property:ur})}}function hr(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}Q.Down,Q.Right,Q.Up,Q.Left;var gr=[{id:`backlog`,label:`Backlog`,color:o.muted},{id:`in-progress`,label:`In Progress`,color:o.blue},{id:`done`,label:`Done`,color:o.green}],_r={high:o.red,medium:o.warning,low:o.muted};function vr({departments:e,initialDepartment:t}){let[n,r]=(0,x.useState)(t||e[0]||``),[a,s]=(0,x.useState)([]),[c,l]=(0,x.useState)(!0),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1),m=Ne(Me(At,{activationConstraint:{distance:5}})),h=(0,x.useCallback)(async()=>{if(n)try{let e=await fetch(`/api/org/departments/${encodeURIComponent(n)}/board`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();s(Array.isArray(t)?t:[])}catch{s([])}finally{l(!1)}},[n]);(0,x.useEffect)(()=>{l(!0),h()},[h]),i(`board:updated`,(0,x.useCallback)(e=>{e.department===n&&h()},[n,h])),i(`ws:reconnected`,h);let g=(0,x.useCallback)(async e=>{s(e),await fetch(`/api/org/departments/${encodeURIComponent(n)}/board`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})},[n]),_=(0,x.useCallback)(e=>{d(a.find(t=>t.id===e.active.id)||null)},[a]),v=(0,x.useRef)(null),y=(0,x.useCallback)(e=>{let{over:t}=e;if(!t){v.current=null;return}let n=gr.find(e=>e.id===t.id);if(n)v.current=n.id;else{let e=a.find(e=>e.id===t.id);e&&(v.current=e.status)}},[a]),b=(0,x.useCallback)(e=>{d(null);let{active:t,over:n}=e;if(!n)return;let r=t.id,i=null,o=gr.find(e=>e.id===n.id);if(o)i=o.id;else{let e=a.find(e=>e.id===n.id);e&&(i=e.status)}if(!i)return;let s=a.find(e=>e.id===r);!s||s.status===i||g(a.map(e=>e.id===r?{...e,status:i}:e))},[a,g]),C=(0,x.useCallback)((e,t)=>{let n={id:`task-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,title:e,status:`backlog`,priority:t,createdAt:new Date().toISOString()};g([...a,n]),p(!1)},[a,g]),w=e=>a.filter(t=>t.status===e);return n?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:16},children:e.map(e=>(0,S.jsx)(`button`,{onClick:()=>r(e),style:{padding:`6px 14px`,fontSize:12,borderRadius:6,cursor:`pointer`,border:`1px solid ${n===e?`var(--color-primary)66`:o.border}`,background:n===e?`var(--color-primary)22`:o.cardBg,color:n===e?`var(--color-primary)`:o.muted,fontWeight:n===e?600:400,transition:`all 0.15s`,textTransform:`capitalize`},children:e},e))}),c?(0,S.jsx)(`div`,{style:{padding:40,textAlign:`center`,color:o.muted},children:`Loading board...`}):(0,S.jsxs)(On,{sensors:m,collisionDetection:Be,onDragStart:_,onDragOver:y,onDragEnd:b,children:[(0,S.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:12,minHeight:300},children:gr.map(e=>(0,S.jsx)(yr,{column:e,tasks:w(e.id),onShowAddForm:e.id===`backlog`?()=>p(!0):void 0},e.id))}),(0,S.jsx)(Jn,{children:u?(0,S.jsx)(xr,{task:u,isDragging:!0}):null})]}),f&&(0,S.jsx)(Sr,{onAdd:C,onCancel:()=>p(!1)})]}):(0,S.jsx)(`div`,{style:{padding:40,textAlign:`center`,color:o.muted},children:`No departments found`})}function yr({column:e,tasks:t,onShowAddForm:n}){let{setNodeRef:r}=mr({id:e.id});return(0,S.jsxs)(`div`,{ref:r,style:{background:o.cardBg,borderRadius:8,border:`1px solid ${o.border}`,padding:12,minHeight:200,display:`flex`,flexDirection:`column`},children:[(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:12,paddingBottom:8,borderBottom:`2px solid ${e.color}44`},children:[(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,S.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:e.color,display:`inline-block`}}),(0,S.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:o.textSecondary},children:e.label}),(0,S.jsx)(`span`,{style:{fontSize:11,color:o.muted,background:`var(--color-muted-bg)`,padding:`1px 6px`,borderRadius:8},children:t.length})]}),n&&(0,S.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,color:o.muted,cursor:`pointer`,fontSize:18,padding:`0 4px`,lineHeight:1},title:`Add task`,children:`+`})]}),(0,S.jsx)(or,{items:t.map(e=>e.id),strategy:nr,children:(0,S.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,flex:1},children:t.length===0?(0,S.jsx)(`div`,{style:{padding:20,textAlign:`center`,fontSize:12,color:o.muted,border:`1px dashed ${o.border}`,borderRadius:6},children:`No tasks`}):t.map(e=>(0,S.jsx)(br,{task:e},e.id))})})]})}function br({task:e}){let{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:o}=mr({id:e.id});return(0,S.jsx)(`div`,{ref:r,style:{transform:K.Transform.toString(i),transition:a,opacity:o?.4:1},...t,...n,children:(0,S.jsx)(xr,{task:e})})}function xr({task:e,isDragging:t}){return(0,S.jsxs)(`div`,{style:{background:t?o.focusBg:o.darkBg,border:`1px solid ${t?`var(--color-primary)66`:o.border}`,borderRadius:6,padding:`10px 12px`,cursor:`grab`,boxShadow:t?`0 4px 12px rgba(0,0,0,0.4)`:`none`,transition:`box-shadow 0.15s, border-color 0.15s`},children:[(0,S.jsx)(`div`,{style:{fontSize:13,color:o.textSecondary,marginBottom:6,lineHeight:1.4},children:e.title}),(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[e.priority&&(0,S.jsx)(`span`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,padding:`1px 6px`,borderRadius:4,color:_r[e.priority],background:_r[e.priority]+`18`,letterSpacing:.3},children:e.priority}),e.assignee&&(0,S.jsx)(`span`,{style:{fontSize:11,color:o.muted},children:e.assignee})]})]})}function Sr({onAdd:e,onCancel:t}){let[n,r]=(0,x.useState)(``),[i,a]=(0,x.useState)(``),s=(0,x.useRef)(null);return(0,x.useEffect)(()=>{s.current?.focus()},[]),(0,S.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:300,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(0,0,0,0.5)`},onClick:t,children:(0,S.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),n.trim()&&e(n.trim(),i||void 0)},onClick:e=>e.stopPropagation(),style:{background:o.cardBg,border:`1px solid ${o.border}`,borderRadius:10,padding:20,width:360,maxWidth:`90vw`},children:[(0,S.jsx)(`div`,{style:{fontSize:14,fontWeight:600,marginBottom:16,color:o.textSecondary},children:`Add Task`}),(0,S.jsx)(`input`,{ref:s,value:n,onChange:e=>r(e.target.value),placeholder:`Task title...`,style:{width:`100%`,padding:`8px 12px`,fontSize:13,background:o.darkBg,border:`1px solid ${o.border}`,borderRadius:6,color:o.textSecondary,marginBottom:12,boxSizing:`border-box`}}),(0,S.jsx)(`div`,{style:{display:`flex`,gap:6,marginBottom:16},children:[`high`,`medium`,`low`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>a(t=>t===e?``:e),style:{fontSize:11,padding:`4px 10px`,borderRadius:4,border:`1px solid ${i===e?_r[e]+`66`:o.border}`,background:i===e?_r[e]+`22`:`transparent`,color:i===e?_r[e]:o.muted,cursor:`pointer`,textTransform:`capitalize`},children:e},e))}),(0,S.jsxs)(`div`,{style:{display:`flex`,gap:8,justifyContent:`flex-end`},children:[(0,S.jsx)(`button`,{type:`button`,onClick:t,style:{padding:`8px 16px`,fontSize:13,borderRadius:6,background:`transparent`,border:`1px solid ${o.border}`,color:o.muted,cursor:`pointer`},children:`Cancel`}),(0,S.jsx)(`button`,{type:`submit`,disabled:!n.trim(),style:{padding:`8px 16px`,fontSize:13,borderRadius:6,background:`var(--color-primary)22`,border:`1px solid var(--color-primary)44`,color:`var(--color-primary)`,cursor:n.trim()?`pointer`:`not-allowed`,opacity:n.trim()?1:.5},children:`Add`})]})]})})}var Cr={executive:0,manager:1,senior:2,employee:3},wr={executive:`var(--color-warning)`,manager:`var(--color-info)`,senior:`var(--color-text-muted)`,employee:`var(--color-text)`};function Tr({employees:e,onSelect:t}){let[n,r]=(0,x.useState)(``),[i,a]=(0,x.useState)(``),[c,l]=(0,x.useState)(``),[u,d]=(0,x.useState)(``),[f,p]=(0,x.useState)(`rank`),[m,h]=(0,x.useState)(`asc`),[g,_]=(0,x.useState)({});(0,x.useEffect)(()=>{fetch(`/api/jobs`).then(e=>e.json()).then(e=>{let t={};for(let n of e)n.employee&&(t[n.employee]=(t[n.employee]||0)+1);_(t)}).catch(()=>{})},[]);let v=(0,x.useMemo)(()=>[...new Set(e.map(e=>e.department))].sort(),[e]),y=(0,x.useMemo)(()=>[...new Set(e.map(e=>e.rank))].sort((e,t)=>(Cr[e]??3)-(Cr[t]??3)),[e]),b=(0,x.useMemo)(()=>{let t=new Set;for(let n of e)t.add(n.engine||`claude`);return[...t].sort()},[e]),C=(0,x.useMemo)(()=>{let t=n.toLowerCase();return e.filter(e=>!(i&&e.department!==i||c&&e.rank!==c||u&&(e.engine||`claude`)!==u||t&&![e.name,e.displayName,e.department,e.rank,e.engine,e.model,e.reportsTo,e.persona].filter(Boolean).join(` `).toLowerCase().includes(t))).sort((e,t)=>{let n=m===`asc`?1:-1;switch(f){case`name`:return n*s(e).localeCompare(s(t));case`department`:return n*e.department.localeCompare(t.department);case`rank`:return n*((Cr[e.rank]??3)-(Cr[t.rank]??3));case`engine`:return n*(e.engine||`claude`).localeCompare(t.engine||`claude`);case`model`:return n*(e.model||``).localeCompare(t.model||``);case`reportsTo`:return n*(e.reportsTo||``).localeCompare(t.reportsTo||``);case`jobs`:return n*((g[e.name]||0)-(g[t.name]||0));default:return 0}})},[e,n,i,c,u,f,m,g]);function w(e){f===e?h(e=>e===`asc`?`desc`:`asc`):(p(e),h(`asc`))}let T=e=>f===e?m===`asc`?` ↑`:` ↓`:``,E=n||i||c||u;return(0,S.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,height:`100%`},children:[(0,S.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,alignItems:`center`},children:[(0,S.jsx)(`input`,{type:`text`,placeholder:`Search employees...`,value:n,onChange:e=>r(e.target.value),style:{flex:`1 1 200px`,minWidth:160,padding:`7px 12px`,fontSize:12,background:o.cardBg,border:`1px solid ${o.border}`,borderRadius:6,color:`var(--color-text)`,outline:`none`}}),(0,S.jsx)(Or,{label:`Department`,value:i,onChange:a,options:v}),(0,S.jsx)(Or,{label:`Rank`,value:c,onChange:l,options:y}),(0,S.jsx)(Or,{label:`Engine`,value:u,onChange:d,options:b}),E&&(0,S.jsx)(`button`,{onClick:()=>{r(``),a(``),l(``),d(``)},style:{fontSize:11,padding:`5px 10px`,borderRadius:6,background:`rgba(248,81,73,0.12)`,color:o.red,border:`none`,cursor:`pointer`},children:`Clear`}),(0,S.jsxs)(`span`,{style:{fontSize:11,color:o.muted,marginLeft:`auto`},children:[C.length,` of `,e.length]})]}),(0,S.jsx)(`div`,{style:{flex:1,minHeight:0,overflow:`auto`,borderRadius:8,border:`1px solid ${o.border}`},children:(0,S.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12},children:[(0,S.jsx)(`thead`,{children:(0,S.jsx)(`tr`,{children:Er.map(e=>(0,S.jsxs)(`th`,{onClick:()=>w(e.key),style:{position:`sticky`,top:0,zIndex:2,padding:`8px 12px`,textAlign:`left`,cursor:`pointer`,background:`var(--color-bg-raised)`,borderBottom:`1px solid ${o.border}`,color:f===e.key?`var(--color-primary)`:o.muted,fontWeight:600,fontSize:11,whiteSpace:`nowrap`,userSelect:`none`,transition:`color 0.1s`},children:[e.label,T(e.key)]},e.key))})}),(0,S.jsxs)(`tbody`,{children:[C.map(e=>{let n=wr[e.rank]||wr.employee,r=g[e.name]||0;return(0,S.jsxs)(`tr`,{onClick:()=>t(e.name),style:{cursor:`pointer`,transition:`background 0.1s`},onMouseEnter:e=>{e.currentTarget.style.background=o.focusBg},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,S.jsx)(`td`,{style:Dr,children:(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,S.jsx)(`span`,{style:{fontSize:18,flexShrink:0},children:e.emoji||`👤`}),(0,S.jsxs)(`div`,{style:{minWidth:0},children:[(0,S.jsx)(`div`,{style:{fontWeight:500,color:`var(--color-text)`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:s(e)}),e.displayName&&(0,S.jsx)(`div`,{style:{fontSize:10,color:o.muted},children:e.name})]})]})}),(0,S.jsx)(`td`,{style:Dr,children:e.department}),(0,S.jsx)(`td`,{style:Dr,children:(0,S.jsx)(`span`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,padding:`2px 7px`,borderRadius:4,background:`${n}22`,color:n},children:e.rank})}),(0,S.jsx)(`td`,{style:Dr,children:(0,S.jsx)(`span`,{style:{fontSize:10,fontWeight:500,padding:`2px 6px`,borderRadius:3,background:e.engine&&e.engine!==`claude`?`rgba(86,212,221,0.15)`:`rgba(188,140,255,0.1)`,color:e.engine&&e.engine!==`claude`?`#56d4dd`:`var(--color-primary)`},children:(e.engine||`claude`).toUpperCase()})}),(0,S.jsx)(`td`,{style:{...Dr,color:o.muted,fontSize:11},children:e.model?e.model.replace(/^claude-/,``):`—`}),(0,S.jsx)(`td`,{style:{...Dr,color:o.muted},children:e.reportsTo||`—`}),(0,S.jsx)(`td`,{style:{...Dr,textAlign:`center`},children:r>0?(0,S.jsx)(`span`,{style:{fontSize:11,fontWeight:600,padding:`2px 8px`,borderRadius:10,background:`rgba(63,185,80,0.12)`,color:o.green},children:r}):(0,S.jsx)(`span`,{style:{color:o.muted},children:`—`})})]},e.name)}),C.length===0&&(0,S.jsx)(`tr`,{children:(0,S.jsx)(`td`,{colSpan:Er.length,style:{padding:32,textAlign:`center`,color:o.muted},children:`No employees match the current filters.`})})]})]})})]})}var Er=[{key:`name`,label:`Name`},{key:`department`,label:`Department`},{key:`rank`,label:`Rank`},{key:`engine`,label:`Engine`},{key:`model`,label:`Model`},{key:`reportsTo`,label:`Reports To`},{key:`jobs`,label:`Jobs`}],Dr={padding:`10px 12px`,borderBottom:`1px solid ${o.border}`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,maxWidth:200};function Or({label:e,value:t,onChange:n,options:r}){return(0,S.jsxs)(`select`,{value:t,onChange:e=>n(e.target.value),style:{padding:`6px 8px`,fontSize:11,borderRadius:6,background:o.cardBg,border:`1px solid ${o.border}`,color:t?`var(--color-text)`:o.muted,cursor:`pointer`,outline:`none`},children:[(0,S.jsx)(`option`,{value:``,children:e}),r.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))]})}var $={section:`_section_177cr_1`,row:`_row_177cr_5`,rowExceeded:`_rowExceeded_177cr_18`,empName:`_empName_177cr_25`,gaugeArea:`_gaugeArea_177cr_36`,gaugeTrack:`_gaugeTrack_177cr_44`,gaugeFill:`_gaugeFill_177cr_51`,gaugeFillExceeded:`_gaugeFillExceeded_177cr_58`,gaugeLabel:`_gaugeLabel_177cr_62`,exceededBadge:`_exceededBadge_177cr_70`,noCapLabel:`_noCapLabel_177cr_78`,empty:`_empty_177cr_84`,errorMsg:`_errorMsg_177cr_91`};function kr(e){return[...e].sort((e,t)=>{if(e.exceeded!==t.exceeded)return e.exceeded?-1:1;if(e.capped&&t.capped){let n=e.maxCostUsd?e.spentToday/e.maxCostUsd:0;return(t.maxCostUsd?t.spentToday/t.maxCostUsd:0)-n}return e.capped===t.capped?e.displayName.localeCompare(t.displayName):e.capped?-1:1})}async function Ar(e){let t=await fetch(`/api/budget/daily`,{signal:e});if(!t.ok)throw Error(`budget/daily: ${t.statusText||t.status}`);return t.json()}function jr(){let[e,t]=(0,x.useState)([]),[n,r]=(0,x.useState)(null),a=(0,x.useRef)(null),o=(0,x.useRef)(!0),s=(0,x.useCallback)(e=>{a.current?.abort();let n=new AbortController;a.current=n,Ar(n.signal).then(e=>{!o.current||n.signal.aborted||(t(e),r(null))}).catch(t=>{if(!o.current||n.signal.aborted||t instanceof Error&&t.name===`AbortError`)return;let i=t instanceof Error?t.message:String(t);e?r(i):console.warn(`[BudgetPanel] refresh failed:`,i)})},[]);(0,x.useEffect)(()=>(o.current=!0,s(!0),()=>{o.current=!1,a.current?.abort()}),[s]),i(`budget:daily-updated`,(0,x.useCallback)(()=>{s(!1)},[s]));let c=e.some(e=>e.capped),l=kr(e);return(0,S.jsxs)(d,{title:`Daily Budget`,defaultExpanded:c,persistKey:`budgetPanel`,className:$.section,children:[n&&(0,S.jsx)(`p`,{className:$.errorMsg,children:n}),!n&&e.length===0&&(0,S.jsx)(`p`,{className:$.empty,children:`No employees configured.`}),!n&&e.length>0&&!c&&(0,S.jsx)(`p`,{className:$.empty,children:`No employees have a daily cap configured.`}),l.map(e=>(0,S.jsxs)(`div`,{className:`${$.row} ${e.exceeded?$.rowExceeded:``}`,children:[(0,S.jsx)(`span`,{className:$.empName,children:e.displayName}),e.capped&&e.maxCostUsd!==null?(0,S.jsxs)(`div`,{className:$.gaugeArea,children:[(0,S.jsx)(`div`,{className:$.gaugeTrack,children:(0,S.jsx)(`div`,{className:`${$.gaugeFill} ${e.exceeded?$.gaugeFillExceeded:``}`,style:{width:`${Math.min(100,e.spentToday/e.maxCostUsd*100)}%`}})}),(0,S.jsxs)(`span`,{className:$.gaugeLabel,children:[`$`,e.spentToday.toFixed(2),` / $`,e.maxCostUsd.toFixed(2),` today`,e.exceeded&&(0,S.jsx)(`span`,{className:$.exceededBadge,children:`exceeded`})]})]}):(0,S.jsx)(`span`,{className:$.noCapLabel,children:`no cap`})]},e.name))]})}var Mr=[{id:`map`,label:`Map`},{id:`grid`,label:`Grid`},{id:`tree`,label:`Tree`},{id:`board`,label:`Board`},{id:`list`,label:`List`}],Nr=`/create-agent`;function Pr({onClose:e,onGoToChat:t}){let[n,r]=(0,x.useState)(!1);function i(){navigator.clipboard.writeText(Nr).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})}return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{onClick:e,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.5)`,zIndex:999,transition:`opacity 0.2s ease`}}),(0,S.jsxs)(`div`,{style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:420,maxWidth:`calc(100vw - 32px)`,background:`var(--color-bg)`,border:`1px solid ${o.border}`,borderRadius:12,padding:24,zIndex:1e3},children:[(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:16},children:[(0,S.jsx)(`h3`,{style:{fontSize:15,fontWeight:600,margin:0},children:`Create New Agent`}),(0,S.jsx)(`button`,{onClick:e,style:{background:`none`,border:`none`,color:o.muted,fontSize:18,cursor:`pointer`,padding:`2px 6px`},children:`×`})]}),(0,S.jsxs)(`p`,{style:{fontSize:13,color:o.muted,lineHeight:1.5,marginBottom:16},children:[`New agents are created through Claude Code using the `,(0,S.jsx)(`code`,{style:{background:`rgba(110,118,129,0.25)`,padding:`1px 5px`,borderRadius:3,fontSize:12},children:`/create-agent`}),` skill. Use one of the options below:`]}),(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 12px`,background:`var(--color-bg-raised)`,border:`1px solid ${o.border}`,borderRadius:8,marginBottom:10},children:[(0,S.jsx)(`code`,{style:{flex:1,fontSize:13,color:o.text,fontFamily:a},children:Nr}),(0,S.jsx)(`button`,{onClick:i,style:{background:n?`var(--color-positive-soft)`:`var(--color-muted-bg)`,border:`1px solid ${n?`rgba(63,185,80,0.4)`:o.border}`,color:n?o.green:o.text,fontSize:12,fontWeight:500,padding:`5px 12px`,borderRadius:6,cursor:`pointer`,whiteSpace:`nowrap`,minHeight:32,transition:`all 0.15s ease`},children:n?`Copied!`:`Copy`})]}),(0,S.jsx)(`div`,{style:{fontSize:11,color:o.muted,marginBottom:16,lineHeight:1.5},children:`Paste this in Claude Code (terminal or IDE) to start the guided agent creation workflow.`}),(0,S.jsx)(`div`,{style:{borderTop:`1px solid ${o.border}`,marginBottom:16}}),(0,S.jsx)(`button`,{onClick:()=>{t(),e()},style:{width:`100%`,padding:`10px 0`,background:`rgba(188,140,255,0.1)`,border:`1px solid rgba(188,140,255,0.3)`,color:`var(--color-primary)`,fontSize:13,fontWeight:500,borderRadius:8,cursor:`pointer`,transition:`all 0.15s ease`,minHeight:44},children:`Create via Dashboard Chat`}),(0,S.jsx)(`div`,{style:{fontSize:11,color:o.muted,marginTop:6,textAlign:`center`,lineHeight:1.5},children:`Opens the chat panel where you can ask the assistant to create an agent for you.`})]})]})}function Fr(){let{employees:e,hierarchy:t,warnings:n,loading:r,error:i,refresh:a}=u(),{navigate:s}=c(),[d,f]=(0,x.useState)(()=>typeof window<`u`&&window.matchMedia?.(`(max-width: 767px)`).matches?`grid`:`map`),[p,m]=(0,x.useState)(null),[h,g]=(0,x.useState)(void 0),[_,v]=(0,x.useState)(!1),[y,b]=(0,x.useState)(!1),C=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!y)return;let e=e=>{C.current&&!C.current.contains(e.target)&&b(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[y]);let w=(0,x.useCallback)(e=>{m(e)},[]),T=(0,x.useCallback)(()=>{m(null)},[]),E=(0,x.useCallback)(e=>{g(e),f(`board`),m(null)},[]),ee=(0,x.useCallback)(e=>{localStorage.setItem(`pendingChatSession`,e),m(null),s(`chat`)},[s]),D=p?e.find(e=>e.name===p):null,te=p&&t?t.nodes[p]:null;return r?(0,S.jsx)(`div`,{style:{padding:40,textAlign:`center`,color:o.muted},children:`Loading org data...`}):i?(0,S.jsxs)(`div`,{style:{padding:40,textAlign:`center`,color:o.red},children:[`Error: `,i]}):e.length===0?(0,S.jsxs)(`div`,{style:{textAlign:`center`,padding:`60px 20px`,color:o.muted},children:[(0,S.jsx)(`div`,{style:{fontSize:48,marginBottom:16,opacity:.5},children:`👥`}),(0,S.jsxs)(`p`,{style:{fontSize:14},children:[`No employees defined. Add JSON files to the `,(0,S.jsx)(`code`,{children:`org/`}),` directory to get started.`]})]}):(0,S.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`calc(100dvh - 64px)`,minHeight:0},children:[(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:16,flexWrap:`wrap`,gap:10,rowGap:10},children:[(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,S.jsx)(`h2`,{style:{fontSize:20,fontWeight:600,margin:0,letterSpacing:`-0.01em`},children:`Organization`}),(0,S.jsx)(`button`,{onClick:()=>v(!0),title:`Create new agent`,style:{background:`var(--color-positive-soft)`,border:`1px solid rgba(63,185,80,0.3)`,color:o.green,fontSize:16,fontWeight:600,width:28,height:28,borderRadius:6,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.15s ease`,lineHeight:1},children:`+`}),(0,S.jsxs)(`span`,{style:{fontSize:12,color:o.muted},children:[e.length,` employee`,e.length===1?``:`s`]}),n.length>0&&(0,S.jsxs)(`div`,{ref:C,style:{position:`relative`},children:[(0,S.jsxs)(`button`,{onClick:()=>b(e=>!e),style:{fontSize:11,padding:`2px 8px`,borderRadius:10,background:`var(--color-negative-soft)`,color:o.red,border:`none`,cursor:`pointer`,transition:`background 0.15s`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(248,81,73,0.25)`},onMouseLeave:e=>{e.currentTarget.style.background=`var(--color-negative-soft)`},children:[n.length,` warning`,n.length===1?``:`s`]}),y&&(0,S.jsxs)(`div`,{style:{position:`absolute`,top:`100%`,left:0,marginTop:6,background:o.cardBg,border:`1px solid ${o.border}`,borderRadius:8,padding:8,minWidth:280,maxWidth:400,zIndex:100,boxShadow:`0 8px 24px rgba(0,0,0,0.4)`},children:[(0,S.jsx)(`div`,{style:{fontSize:11,fontWeight:600,color:o.muted,marginBottom:6,padding:`0 4px`},children:`Org Warnings`}),n.map((e,t)=>(0,S.jsxs)(`div`,{style:{fontSize:12,padding:`6px 8px`,borderRadius:4,background:t%2==0?`rgba(248,81,73,0.06)`:`transparent`,display:`flex`,flexDirection:`column`,gap:2},children:[(0,S.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,S.jsx)(`span`,{style:{fontSize:10,padding:`1px 5px`,borderRadius:4,background:`var(--color-negative-soft)`,color:o.red,fontWeight:600,textTransform:`uppercase`,whiteSpace:`nowrap`},children:e.type}),(0,S.jsx)(`span`,{style:{fontWeight:500,color:o.text},children:e.employee})]}),(0,S.jsx)(`span`,{style:{color:o.muted},children:e.message})]},t))]})]})]}),(0,S.jsx)(`div`,{className:`tw-org-tabs`,style:{display:`flex`,gap:0,flexShrink:0,maxWidth:`100%`,overflowX:`auto`},children:Mr.map((e,t)=>(0,S.jsx)(`button`,{onClick:()=>f(e.id),style:{padding:`8px 16px`,fontSize:13,border:`1px solid ${o.border}`,background:d===e.id?`rgba(188,140,255,0.15)`:`var(--color-hover)`,color:d===e.id?`var(--color-primary)`:o.textSecondary,borderRadius:t===0?`8px 0 0 8px`:t===Mr.length-1?`0 8px 8px 0`:0,cursor:`pointer`,marginLeft:t>0?-1:0,fontWeight:d===e.id?600:500,transition:`background 0.1s, color 0.1s`,whiteSpace:`nowrap`,minHeight:40},children:e.label},e.id))})]}),(0,S.jsxs)(`div`,{style:{flex:1,minHeight:0,border:`1px solid ${o.border}`,borderRadius:12,overflow:`hidden`,background:o.cardBg},children:[d===`map`&&t&&(0,S.jsx)(`div`,{style:{height:`100%`},children:(0,S.jsx)(A,{employees:e,hierarchy:t,onSelect:w,onReparent:async(e,t)=>{try{(await fetch(`/api/org/employees/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({reportsTo:t})})).ok&&a()}catch{}}})}),d===`grid`&&(0,S.jsx)(ae,{employees:e,onSelect:w}),d===`tree`&&t&&(0,S.jsx)(M,{employees:e,hierarchy:t,onSelect:w}),d===`board`&&(0,S.jsx)(vr,{departments:[...new Set(e.map(e=>e.department))].sort(),initialDepartment:h}),d===`list`&&(0,S.jsx)(Tr,{employees:e,onSelect:w})]}),(0,S.jsx)(jr,{}),D&&(0,S.jsx)(l,{employee:D,node:te||null,allEmployees:e,onClose:T,onSelectEmployee:w,onViewBoard:E,onStartSession:ee,onDelete:T}),_&&(0,S.jsx)(Pr,{onClose:()=>v(!1),onGoToChat:()=>s(`chat`)})]})}export{Fr as OrgPage};
@@ -1,2 +1,2 @@
1
- import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{r}from"./useWebSocket-Hg3RO6sx.js";import{c as i,n as a}from"./styles-Ds5gMQAQ.js";import{Nt as o,c as s,d as c}from"./index-tOLuwPW6.js";import"./ui-Bx41p7g8.js";var l=t(e(),1),u=50;function d(){let[e,t]=(0,l.useState)([]),[n,i]=(0,l.useState)({}),[a,o]=(0,l.useState)(0),[s,c]=(0,l.useState)(!0),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(0),[h,g]=(0,l.useState)({}),_=(0,l.useCallback)(async()=>{try{let e=new URLSearchParams;for(let t of h.employees??[])e.append(`employee`,t);h.status&&e.set(`status`,h.status),h.from&&e.set(`from`,h.from),h.to&&e.set(`to`,h.to),e.set(`limit`,String(u)),e.set(`offset`,String(p*u));let n=await fetch(`/api/sessions?${e}`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();t(r.sessions),o(r.total),i(r.messageCounts??{}),f(null)}catch(e){f(e instanceof Error?e.message:`Failed to fetch sessions`)}finally{c(!1)}},[h,p]);return(0,l.useEffect)(()=>{_()},[_]),r(`session:created`,_),r(`session:completed`,_),r(`session:error`,_),r(`session:deleted`,_),r(`ws:reconnected`,_),{sessions:e,total:a,messageCounts:n,loading:s,error:d,page:p,pageSize:u,setPage:m,filters:h,setFilters:g,refetch:_}}var f=n();function p(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function m(e){return`${`$${e.costUsd.toFixed(2)} USD`} \u00b7 ${`${e.numTurns} turn${e.numTurns===1?``:`s`}`} \u00b7 ${p(e.durationMs)}`}var h={user:{borderLeft:`3px solid ${a.blue}`,paddingLeft:12,background:`rgba(88,166,255,0.06)`},assistant:{borderLeft:`3px solid #484f58`,paddingLeft:12,background:`var(--color-subtle-bg)`},system:{borderLeft:`3px solid ${a.muted}`,paddingLeft:12,background:`rgba(139,148,158,0.06)`,fontSize:13,color:a.muted}},g={user:`👤 User`,assistant:`🤖 Assistant`,system:`🔔 System`},_={idle:a.muted,running:a.blue,error:a.red,waiting:a.warning,interrupted:`var(--color-primary)`},v={p:({children:e})=>(0,f.jsx)(`p`,{style:{margin:`4px 0`},children:e}),strong:({children:e})=>(0,f.jsx)(`strong`,{children:e}),em:({children:e})=>(0,f.jsx)(`em`,{children:e}),code:({children:e,className:t})=>{let n=t?.startsWith(`language-`),r=typeof e==`string`&&e.includes(`
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{r}from"./useWebSocket-Hg3RO6sx.js";import{c as i,n as a}from"./styles-Ds5gMQAQ.js";import{Mt as o,en as s,u as c}from"./index-DzJsiq8q.js";import"./ui-DvNuX5MF.js";var l=t(e(),1),u=50;function d(){let[e,t]=(0,l.useState)([]),[n,i]=(0,l.useState)({}),[a,o]=(0,l.useState)(0),[s,c]=(0,l.useState)(!0),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(0),[h,g]=(0,l.useState)({}),_=(0,l.useCallback)(async()=>{try{let e=new URLSearchParams;for(let t of h.employees??[])e.append(`employee`,t);h.status&&e.set(`status`,h.status),h.from&&e.set(`from`,h.from),h.to&&e.set(`to`,h.to),e.set(`limit`,String(u)),e.set(`offset`,String(p*u));let n=await fetch(`/api/sessions?${e}`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();t(r.sessions),o(r.total),i(r.messageCounts??{}),f(null)}catch(e){f(e instanceof Error?e.message:`Failed to fetch sessions`)}finally{c(!1)}},[h,p]);return(0,l.useEffect)(()=>{_()},[_]),r(`session:created`,_),r(`session:completed`,_),r(`session:error`,_),r(`session:deleted`,_),r(`ws:reconnected`,_),{sessions:e,total:a,messageCounts:n,loading:s,error:d,page:p,pageSize:u,setPage:m,filters:h,setFilters:g,refetch:_}}var f=n();function p(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function m(e){return`${`$${e.costUsd.toFixed(2)} USD`} \u00b7 ${`${e.numTurns} turn${e.numTurns===1?``:`s`}`} \u00b7 ${p(e.durationMs)}`}var h={user:{borderLeft:`3px solid ${a.blue}`,paddingLeft:12,background:`rgba(88,166,255,0.06)`},assistant:{borderLeft:`3px solid #484f58`,paddingLeft:12,background:`var(--color-subtle-bg)`},system:{borderLeft:`3px solid ${a.muted}`,paddingLeft:12,background:`rgba(139,148,158,0.06)`,fontSize:13,color:a.muted}},g={user:`👤 User`,assistant:`🤖 Assistant`,system:`🔔 System`},_={idle:a.muted,running:a.blue,error:a.red,waiting:a.warning,interrupted:`var(--color-primary)`},v={p:({children:e})=>(0,f.jsx)(`p`,{style:{margin:`4px 0`},children:e}),strong:({children:e})=>(0,f.jsx)(`strong`,{children:e}),em:({children:e})=>(0,f.jsx)(`em`,{children:e}),code:({children:e,className:t})=>{let n=t?.startsWith(`language-`),r=typeof e==`string`&&e.includes(`
2
2
  `);return n||r?(0,f.jsx)(`code`,{style:{display:`block`,background:`var(--color-bg)`,padding:`10px 12px`,borderRadius:6,fontSize:12,overflowX:`auto`,whiteSpace:`pre`},children:e}):(0,f.jsx)(`code`,{style:{background:`rgba(110,118,129,0.2)`,padding:`1px 5px`,borderRadius:3,fontSize:12},children:e})},pre:({children:e})=>(0,f.jsx)(`pre`,{style:{margin:`6px 0`,background:`var(--color-bg)`,borderRadius:6,overflow:`auto`},children:e}),ol:({children:e})=>(0,f.jsx)(`ol`,{style:{margin:`4px 0`,paddingLeft:20},children:e}),ul:({children:e})=>(0,f.jsx)(`ul`,{style:{margin:`4px 0`,paddingLeft:20},children:e}),li:({children:e})=>(0,f.jsx)(`li`,{style:{marginBottom:2},children:e}),h1:({children:e})=>(0,f.jsx)(`div`,{style:{fontSize:16,fontWeight:600,margin:`8px 0 4px`},children:e}),h2:({children:e})=>(0,f.jsx)(`div`,{style:{fontSize:15,fontWeight:600,margin:`6px 0 3px`},children:e}),h3:({children:e})=>(0,f.jsx)(`div`,{style:{fontSize:14,fontWeight:600,margin:`4px 0 2px`},children:e}),blockquote:({children:e})=>(0,f.jsx)(`blockquote`,{style:{borderLeft:`3px solid #484f58`,margin:`4px 0`,paddingLeft:12,color:`var(--color-text-muted)`},children:e}),a:({href:e,children:t})=>(0,f.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,style:{color:a.blue},children:t})};function y({session:e,onBack:t}){let[n,r]=(0,l.useState)([]),[s,c]=(0,l.useState)(!0);return(0,l.useEffect)(()=>{let t=!1;return c(!0),fetch(`/api/sessions/${e.id}/messages`).then(e=>e.json()).then(e=>{t||(r(e.messages),c(!1))}).catch(()=>{t||c(!1)}),()=>{t=!0}},[e.id]),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`12px 16px`,borderBottom:`1px solid ${a.border}`,background:a.cardBg,flexShrink:0},children:[(0,f.jsx)(`button`,{onClick:t,style:{background:`none`,border:`none`,color:a.blue,cursor:`pointer`,fontSize:14,padding:`4px 8px`,borderRadius:6},children:`← Back`}),(0,f.jsxs)(`div`,{style:{flex:1},children:[(0,f.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:a.text},children:e.title||`Session ${e.id.slice(0,8)}`}),(0,f.jsx)(`div`,{style:{fontSize:12,color:a.muted,marginTop:2,fontFamily:i},children:m(e)})]}),(0,f.jsx)(`span`,{style:{padding:`2px 8px`,borderRadius:10,fontSize:11,fontWeight:600,textTransform:`uppercase`,background:`${_[e.status]??a.muted}22`,color:_[e.status]??a.muted},children:e.status})]}),(0,f.jsxs)(`div`,{style:{padding:`8px 16px`,fontSize:12,color:a.muted,borderBottom:`1px solid ${a.border}`,display:`flex`,gap:16,flexWrap:`wrap`},children:[e.employee&&(0,f.jsxs)(`span`,{children:[`Employee: `,(0,f.jsx)(`strong`,{style:{color:a.text},children:e.employee})]}),(0,f.jsxs)(`span`,{children:[`Created: `,new Date(e.createdAt).toLocaleString()]}),(0,f.jsxs)(`span`,{children:[`Messages: `,n.length]})]}),(0,f.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:16,display:`flex`,flexDirection:`column`,gap:12},children:s?(0,f.jsx)(`div`,{style:{color:a.muted,textAlign:`center`,padding:32},children:`Loading messages...`}):n.length===0?(0,f.jsx)(`div`,{style:{color:a.muted,textAlign:`center`,padding:32},children:`No messages in this session`}):n.map(e=>(0,f.jsxs)(`div`,{style:{padding:`10px 12px`,borderRadius:8,...h[e.role]??h.system},children:[(0,f.jsxs)(`div`,{style:{fontSize:11,color:a.muted,marginBottom:4,display:`flex`,justifyContent:`space-between`},children:[(0,f.jsx)(`span`,{children:g[e.role]??e.role}),(0,f.jsx)(`span`,{style:{fontFamily:i,fontSize:10},children:new Date(e.createdAt).toLocaleTimeString()})]}),(0,f.jsx)(`div`,{style:{fontSize:13,lineHeight:1.5,wordBreak:`break-word`,color:e.role===`system`?a.muted:a.text,...e.role===`assistant`?{}:{whiteSpace:`pre-wrap`}},children:e.role===`assistant`?(0,f.jsx)(o,{components:v,children:e.content}):e.content})]},e.id))})]})}function b(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function x(e){return`$${e.toFixed(2)}`}var S={idle:a.muted,running:a.blue,error:a.red,waiting:a.warning,interrupted:`var(--color-primary)`},C=[{value:``,label:`All Statuses`},{value:`idle`,label:`Idle`},{value:`running`,label:`Running`},{value:`error`,label:`Error`},{value:`interrupted`,label:`Interrupted`},{value:`waiting`,label:`Waiting`}],w={display:`flex`,flexDirection:`column`,height:`100%`,background:a.darkBg,borderRadius:12,border:`1px solid ${a.border}`,overflow:`hidden`},T={display:`flex`,gap:8,padding:`10px 16px`,borderBottom:`1px solid ${a.border}`,background:a.cardBg,flexWrap:`wrap`,alignItems:`center`,flexShrink:0},E={background:`var(--color-bg)`,color:a.text,border:`1px solid ${a.border}`,borderRadius:6,padding:`6px 10px`,fontSize:12,fontFamily:i,minHeight:32},D={...E,colorScheme:`dark`},O={display:`flex`,flexDirection:`column`,gap:4,padding:`12px 16px`,borderBottom:`1px solid ${a.border}`,cursor:`pointer`,transition:`background 0.15s`},k={display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 16px`,borderTop:`1px solid ${a.border}`,background:a.cardBg,flexShrink:0,fontSize:12,color:a.muted};function A(){let{sessions:e,total:t,messageCounts:n,loading:r,page:i,pageSize:o,setPage:u,filters:p,setFilters:m}=d(),{employees:h}=s(),[g,_]=(0,l.useState)(null),v=(0,l.useMemo)(()=>h.map(e=>({value:e.name,label:`${e.emoji??``} ${e.displayName??e.name}`.trim()})),[h]),b=Math.max(1,Math.ceil(t/o));return g?(0,f.jsx)(`div`,{style:w,children:(0,f.jsx)(y,{session:g,onBack:()=>_(null)})}):(0,f.jsxs)(`div`,{style:w,children:[(0,f.jsxs)(`div`,{style:T,children:[(0,f.jsx)(`div`,{style:{minWidth:220},children:(0,f.jsx)(c,{options:v,selected:p.employees??[],onChange:e=>{m({...p,employees:e.length>0?e:void 0}),u(0)},emptyLabel:`All employees`,searchPlaceholder:`Filter employees…`})}),(0,f.jsx)(`select`,{value:p.status??``,onChange:e=>{m({...p,status:e.target.value||void 0}),u(0)},style:E,children:C.map(e=>(0,f.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,f.jsx)(`input`,{type:`date`,value:p.from??``,onChange:e=>{let t=e.target.value;m({...p,from:t?`${t}T00:00:00.000Z`:void 0}),u(0)},style:D,title:`From date`}),(0,f.jsx)(`input`,{type:`date`,value:p.to??``,onChange:e=>{let t=e.target.value;m({...p,to:t?`${t}T23:59:59.999Z`:void 0}),u(0)},style:D,title:`To date`}),(0,f.jsxs)(`span`,{style:{fontSize:11,color:a.muted,marginLeft:`auto`},children:[t,` session`,t===1?``:`s`]})]}),(0,f.jsx)(`div`,{style:{flex:1,overflowY:`auto`},children:r?(0,f.jsx)(`div`,{style:{color:a.muted,textAlign:`center`,padding:32},children:`Loading sessions...`}):e.length===0?(0,f.jsx)(`div`,{style:{color:a.muted,textAlign:`center`,padding:32},children:`No sessions found`}):e.map(e=>(0,f.jsx)(j,{session:e,messageCount:n[e.id]??0,onClick:()=>_(e)},e.id))}),t>o&&(0,f.jsxs)(`div`,{style:k,children:[(0,f.jsx)(`button`,{onClick:()=>u(Math.max(0,i-1)),disabled:i===0,style:{background:`none`,border:`1px solid ${a.border}`,color:i===0?`var(--color-border-strong)`:a.blue,borderRadius:6,padding:`4px 12px`,cursor:i===0?`default`:`pointer`,fontSize:12},children:`Prev`}),(0,f.jsxs)(`span`,{children:[`Page `,i+1,` of `,b]}),(0,f.jsx)(`button`,{onClick:()=>u(Math.min(b-1,i+1)),disabled:i>=b-1,style:{background:`none`,border:`1px solid ${a.border}`,color:i>=b-1?`var(--color-border-strong)`:a.blue,borderRadius:6,padding:`4px 12px`,cursor:i>=b-1?`default`:`pointer`,fontSize:12},children:`Next`})]})]})}function j({session:e,messageCount:t,onClick:n}){let[r,o]=(0,l.useState)(!1);return(0,f.jsxs)(`div`,{style:{...O,background:r?`rgba(88,166,255,0.04)`:`transparent`},onClick:n,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,minWidth:0},children:[(0,f.jsx)(`div`,{style:{flex:1,minWidth:0,fontSize:14,fontWeight:500,color:a.text,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,letterSpacing:`-0.005em`},children:e.title||`Session ${e.id.slice(0,8)}`}),(0,f.jsx)(`span`,{style:{padding:`2px 8px`,borderRadius:10,fontSize:10,fontWeight:600,textTransform:`uppercase`,letterSpacing:.3,background:`${S[e.status]??a.muted}22`,color:S[e.status]??a.muted,flexShrink:0},children:e.status})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`,fontSize:11,color:a.muted,fontFamily:i},children:[(0,f.jsx)(`span`,{style:{color:a.textSecondary},children:e.employee||`No employee`}),(0,f.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()}),(0,f.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,f.jsx)(`span`,{children:b(e.durationMs)}),(0,f.jsxs)(`span`,{children:[e.numTurns,`t`]}),(0,f.jsxs)(`span`,{children:[t,`m`]}),(0,f.jsx)(`span`,{style:{marginLeft:`auto`,color:a.green},children:x(e.costUsd)})]})]})}export{A as SessionHistory};