@cosmicstack/mercury-agent 1.1.13 → 1.2.2

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 (122) hide show
  1. package/README.md +9 -6
  2. package/dist/index.js +27909 -22358
  3. package/dist/index.js.map +1 -1
  4. package/dist/web/ui/assets/Chat-CajL8sV3.js +27 -0
  5. package/dist/web/ui/assets/{Dashboard-1rlAqQ-Y.js → Dashboard-ClnaDoDG.js} +1 -2
  6. package/dist/web/ui/assets/{Goals-CgSUAXLH.js → Goals-Rm3s3OGd.js} +1 -2
  7. package/dist/web/ui/assets/{Graph-DnlOWkay.js → Graph-hYGmN5vp.js} +1 -2
  8. package/dist/web/ui/assets/{Kanban-DRlNiNRF.js → Kanban-BK_Oi6am.js} +1 -2
  9. package/dist/web/ui/assets/{Login-BP5524pC.js → Login-Bl8tq7KA.js} +1 -2
  10. package/dist/web/ui/assets/MarkdownRenderer-DKGKZih7.js +21 -0
  11. package/dist/web/ui/assets/{Memory-BOQEY0H8.js → Memory-kKRHTUyC.js} +1 -2
  12. package/dist/web/ui/assets/{Permissions-jbFH-toa.js → Permissions-CDRBOdMO.js} +1 -2
  13. package/dist/web/ui/assets/{PersonDetail-Ca8B9io8.js → PersonDetail-DLbZBUS0.js} +1 -2
  14. package/dist/web/ui/assets/{Persons-epdmUeBM.js → Persons-C-GjzdmT.js} +1 -2
  15. package/dist/web/ui/assets/{Providers-Bm8sZNZo.js → Providers-L32issLd.js} +1 -2
  16. package/dist/web/ui/assets/{Schedules-BZKhm9R7.js → Schedules-BvGLrPPD.js} +1 -2
  17. package/dist/web/ui/assets/{Settings-Hii-5oku.js → Settings-BP9_1JW3.js} +1 -2
  18. package/dist/web/ui/assets/{Skills-BHJp2CgD.js → Skills-CvXlgjZK.js} +1 -2
  19. package/dist/web/ui/assets/{Tasks-D36pqkro.js → Tasks-XcAVd2Ff.js} +1 -2
  20. package/dist/web/ui/assets/{Usage-CmjaYrsT.js → Usage--2hxK31f.js} +1 -2
  21. package/dist/web/ui/assets/{Workspace-BYLf-wTJ.js → Workspace-BPChIyBc.js} +11 -12
  22. package/dist/web/ui/assets/{activity-MOTqH8zM.js → activity-CDTOZzUZ.js} +1 -2
  23. package/dist/web/ui/assets/{alert-dialog-MbYSbZx5.js → alert-dialog-B3JUwsIN.js} +1 -2
  24. package/dist/web/ui/assets/{arrow-left-CtqQsBC6.js → arrow-left-CkDXNwR2.js} +1 -2
  25. package/dist/web/ui/assets/{avatar-BIYaY7pR.js → avatar-NU204zr9.js} +1 -2
  26. package/dist/web/ui/assets/{badge-CUJiWF1y.js → badge-DpVeNL8j.js} +1 -2
  27. package/dist/web/ui/assets/{button-CNasMlFE.js → button-V3Fu7_kO.js} +1 -2
  28. package/dist/web/ui/assets/{card-BdsEOP7t.js → card-CjAvp22k.js} +1 -2
  29. package/dist/web/ui/assets/{chevron-down-CB9J_vvZ.js → chevron-down-C66c9kfo.js} +1 -2
  30. package/dist/web/ui/assets/{circle-check-DvGSe1uZ.js → circle-check-Cch4Kwja.js} +1 -2
  31. package/dist/web/ui/assets/{circle-x-CyaGJ_BM.js → circle-x-DK0DQPGB.js} +1 -2
  32. package/dist/web/ui/assets/collapsible-BU_K9n8f.js +0 -1
  33. package/dist/web/ui/assets/{dialog-Bd1rELXb.js → dialog-FHqlAspv.js} +1 -2
  34. package/dist/web/ui/assets/{download-C8RvlFqO.js → download-D73EX-Ki.js} +1 -2
  35. package/dist/web/ui/assets/{eye-BJ0NucMz.js → eye-CxEb5_L8.js} +1 -2
  36. package/dist/web/ui/assets/{file-text-BWWBuD_N.js → file-text-CDTjVG9h.js} +1 -2
  37. package/dist/web/ui/assets/{folder-open-BwjemFy7.js → folder-open-CF5wm-xS.js} +1 -2
  38. package/dist/web/ui/assets/{git-branch-D9JVASpC.js → git-branch-CYWJZoQx.js} +1 -2
  39. package/dist/web/ui/assets/{index-C3YiF4qv.js → index-B1xAjISP.js} +4 -5
  40. package/dist/web/ui/assets/{index-CaqLZNof.js → index-CufYpqmV.js} +1 -2
  41. package/dist/web/ui/assets/{input-CH3dmo9r.js → input-CF6e2HL4.js} +1 -2
  42. package/dist/web/ui/assets/{loader-circle-DbYKk0_Q.js → loader-circle-CJko6bz6.js} +1 -2
  43. package/dist/web/ui/assets/{pencil-gNDEMhav.js → pencil-DGvW-dl_.js} +1 -2
  44. package/dist/web/ui/assets/{plus-7rbHkByr.js → plus-DhHrgqcD.js} +1 -2
  45. package/dist/web/ui/assets/{power-BS7gCDWs.js → power-BFKfrVvI.js} +1 -2
  46. package/dist/web/ui/assets/{progress-ZzhsBV2v.js → progress-CsRtYJ3t.js} +1 -2
  47. package/dist/web/ui/assets/{search-BZsbhO0B.js → search-BwE8vRR_.js} +1 -2
  48. package/dist/web/ui/assets/{select-vRSgBrHz.js → select-Xy3UJnp-.js} +1 -2
  49. package/dist/web/ui/assets/{send-BkyTIUtJ.js → send-DHy23R-c.js} +1 -2
  50. package/dist/web/ui/assets/{sparkles-DcP24GEL.js → sparkles-wNQvP7So.js} +1 -2
  51. package/dist/web/ui/assets/{switch-LRN9wWy2.js → switch-CGgMESDf.js} +1 -2
  52. package/dist/web/ui/assets/{terminal-CWG62zdD.js → terminal-BvZc6N0C.js} +1 -2
  53. package/dist/web/ui/assets/{textarea-CXh3tmJ1.js → textarea-BTxEQ_C2.js} +1 -2
  54. package/dist/web/ui/assets/vendor-dnd-DRBSMxXo.js +0 -1
  55. package/dist/web/ui/assets/vendor-markdown-DwTbvico.js +0 -1
  56. package/dist/web/ui/assets/vendor-motion-Dwx3-JO5.js +0 -1
  57. package/dist/web/ui/assets/vendor-radix-3UdfCgs_.js +0 -1
  58. package/dist/web/ui/assets/vendor-react-C7pctHW3.js +0 -1
  59. package/dist/web/ui/assets/vendor-syntax-xZUI6Op9.js +0 -1
  60. package/dist/web/ui/assets/{zap-BEfqVtvZ.js → zap-CK8xUBKc.js} +1 -2
  61. package/dist/web/ui/index.html +1 -1
  62. package/dist/web/ui/workbox-0bb07689.js +1 -0
  63. package/package.json +3 -1
  64. package/dist/web/ui/assets/Chat-DXSn2dY8.js +0 -28
  65. package/dist/web/ui/assets/Chat-DXSn2dY8.js.map +0 -1
  66. package/dist/web/ui/assets/Dashboard-1rlAqQ-Y.js.map +0 -1
  67. package/dist/web/ui/assets/Goals-CgSUAXLH.js.map +0 -1
  68. package/dist/web/ui/assets/Graph-DnlOWkay.js.map +0 -1
  69. package/dist/web/ui/assets/Kanban-DRlNiNRF.js.map +0 -1
  70. package/dist/web/ui/assets/Login-BP5524pC.js.map +0 -1
  71. package/dist/web/ui/assets/MarkdownRenderer-B9KGVD0X.js +0 -22
  72. package/dist/web/ui/assets/MarkdownRenderer-B9KGVD0X.js.map +0 -1
  73. package/dist/web/ui/assets/Memory-BOQEY0H8.js.map +0 -1
  74. package/dist/web/ui/assets/Permissions-jbFH-toa.js.map +0 -1
  75. package/dist/web/ui/assets/PersonDetail-Ca8B9io8.js.map +0 -1
  76. package/dist/web/ui/assets/Persons-epdmUeBM.js.map +0 -1
  77. package/dist/web/ui/assets/Providers-Bm8sZNZo.js.map +0 -1
  78. package/dist/web/ui/assets/Schedules-BZKhm9R7.js.map +0 -1
  79. package/dist/web/ui/assets/Settings-Hii-5oku.js.map +0 -1
  80. package/dist/web/ui/assets/Skills-BHJp2CgD.js.map +0 -1
  81. package/dist/web/ui/assets/Tasks-D36pqkro.js.map +0 -1
  82. package/dist/web/ui/assets/Usage-CmjaYrsT.js.map +0 -1
  83. package/dist/web/ui/assets/Workspace-BYLf-wTJ.js.map +0 -1
  84. package/dist/web/ui/assets/activity-MOTqH8zM.js.map +0 -1
  85. package/dist/web/ui/assets/alert-dialog-MbYSbZx5.js.map +0 -1
  86. package/dist/web/ui/assets/arrow-left-CtqQsBC6.js.map +0 -1
  87. package/dist/web/ui/assets/avatar-BIYaY7pR.js.map +0 -1
  88. package/dist/web/ui/assets/badge-CUJiWF1y.js.map +0 -1
  89. package/dist/web/ui/assets/button-CNasMlFE.js.map +0 -1
  90. package/dist/web/ui/assets/card-BdsEOP7t.js.map +0 -1
  91. package/dist/web/ui/assets/chevron-down-CB9J_vvZ.js.map +0 -1
  92. package/dist/web/ui/assets/circle-check-DvGSe1uZ.js.map +0 -1
  93. package/dist/web/ui/assets/circle-x-CyaGJ_BM.js.map +0 -1
  94. package/dist/web/ui/assets/collapsible-BU_K9n8f.js.map +0 -1
  95. package/dist/web/ui/assets/dialog-Bd1rELXb.js.map +0 -1
  96. package/dist/web/ui/assets/download-C8RvlFqO.js.map +0 -1
  97. package/dist/web/ui/assets/eye-BJ0NucMz.js.map +0 -1
  98. package/dist/web/ui/assets/file-text-BWWBuD_N.js.map +0 -1
  99. package/dist/web/ui/assets/folder-open-BwjemFy7.js.map +0 -1
  100. package/dist/web/ui/assets/git-branch-D9JVASpC.js.map +0 -1
  101. package/dist/web/ui/assets/index-C3YiF4qv.js.map +0 -1
  102. package/dist/web/ui/assets/index-CaqLZNof.js.map +0 -1
  103. package/dist/web/ui/assets/input-CH3dmo9r.js.map +0 -1
  104. package/dist/web/ui/assets/loader-circle-DbYKk0_Q.js.map +0 -1
  105. package/dist/web/ui/assets/pencil-gNDEMhav.js.map +0 -1
  106. package/dist/web/ui/assets/plus-7rbHkByr.js.map +0 -1
  107. package/dist/web/ui/assets/power-BS7gCDWs.js.map +0 -1
  108. package/dist/web/ui/assets/progress-ZzhsBV2v.js.map +0 -1
  109. package/dist/web/ui/assets/search-BZsbhO0B.js.map +0 -1
  110. package/dist/web/ui/assets/select-vRSgBrHz.js.map +0 -1
  111. package/dist/web/ui/assets/send-BkyTIUtJ.js.map +0 -1
  112. package/dist/web/ui/assets/sparkles-DcP24GEL.js.map +0 -1
  113. package/dist/web/ui/assets/switch-LRN9wWy2.js.map +0 -1
  114. package/dist/web/ui/assets/terminal-CWG62zdD.js.map +0 -1
  115. package/dist/web/ui/assets/textarea-CXh3tmJ1.js.map +0 -1
  116. package/dist/web/ui/assets/vendor-dnd-DRBSMxXo.js.map +0 -1
  117. package/dist/web/ui/assets/vendor-markdown-DwTbvico.js.map +0 -1
  118. package/dist/web/ui/assets/vendor-motion-Dwx3-JO5.js.map +0 -1
  119. package/dist/web/ui/assets/vendor-radix-3UdfCgs_.js.map +0 -1
  120. package/dist/web/ui/assets/vendor-react-C7pctHW3.js.map +0 -1
  121. package/dist/web/ui/assets/vendor-syntax-xZUI6Op9.js.map +0 -1
  122. package/dist/web/ui/assets/zap-BEfqVtvZ.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ import{j as e,m as A,A as E}from"./vendor-motion-Dwx3-JO5.js";import{r as d,j as pe,e as fe}from"./vendor-react-C7pctHW3.js";import{e as $,S as X,M as Z,c as j,a as k,X as J,g as Y,u as Q,h as ge,i as be}from"./index-B1xAjISP.js";import{B as C}from"./button-V3Fu7_kO.js";import{P as ye}from"./progress-CsRtYJ3t.js";import{A as je,F as ve,o as we,u as y,M as ee,C as Ne,a as ke,b as Se}from"./MarkdownRenderer-DKGKZih7.js";import{A as Ce,a as Te,b as De,c as Me,d as Ae,e as Pe,f as Le,g as Be,T as ze}from"./alert-dialog-B3JUwsIN.js";import{P as Ee}from"./plus-DhHrgqcD.js";import{L as M}from"./loader-circle-CJko6bz6.js";import{h as $e}from"./vendor-syntax-xZUI6Op9.js";import{B as Ie}from"./badge-DpVeNL8j.js";import{f as Oe,g as Re,h as Fe,i as te}from"./vendor-radix-3UdfCgs_.js";import{C as Ue,a as R}from"./chevron-down-C66c9kfo.js";import{C as We,a as _e,b as qe}from"./collapsible-BU_K9n8f.js";import{C as He}from"./circle-x-DK0DQPGB.js";import{C as Ge}from"./circle-check-Cch4Kwja.js";import{F as Ke}from"./folder-open-CF5wm-xS.js";import{Z as Ve}from"./zap-CK8xUBKc.js";import{S as Xe}from"./send-DHy23R-c.js";import"./index-CufYpqmV.js";import"./vendor-markdown-DwTbvico.js";/**
2
+ * @license lucide-react v0.511.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Ze=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Je=$("file",Ze);/**
7
+ * @license lucide-react v0.511.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ye=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Qe=$("panel-left-close",Ye);/**
12
+ * @license lucide-react v0.511.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const et=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],tt=$("panel-left-open",et);/**
17
+ * @license lucide-react v0.511.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const st=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]],at=$("wrench",st);function K({threads:t,activeThreadId:i,onSelect:r,onDelete:c,onNew:a,onExport:l}){const[o,m]=d.useState(null);function p(h){const f=new Date(h),v=new Date().getTime()-f.getTime(),w=Math.floor(v/(1e3*60*60*24));return w===0?f.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):w===1?"Yesterday":w<7?`${w} days ago`:f.toLocaleDateString(void 0,{month:"short",day:"numeric"})}return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Conversations"}),e.jsxs(C,{size:"sm",onClick:a,className:"h-7 gap-1 px-2 text-xs",children:[e.jsx(Ee,{className:"h-3.5 w-3.5"}),"New Chat"]})]}),e.jsx(X,{className:"flex-1",children:t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center",children:[e.jsx(Z,{className:"h-8 w-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No conversations yet"})]}):e.jsx("div",{className:"p-2",children:t.map(h=>{const f=h.id===i;return e.jsx(rt,{thread:h,isActive:f,formatDate:p,onSelect:()=>r(h.id),onDelete:()=>m(h.id),onExport:()=>l(h.id)},h.id)})})}),e.jsx(Ce,{open:o!==null,onOpenChange:h=>{h||m(null)},children:e.jsxs(Te,{children:[e.jsxs(De,{children:[e.jsx(Me,{children:"Delete conversation?"}),e.jsx(Ae,{children:"This will permanently remove this conversation and all its messages. This action cannot be undone."})]}),e.jsxs(Pe,{children:[e.jsx(Le,{children:"Cancel"}),e.jsx(Be,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{o&&(c(o),m(null))},children:"Delete"})]})]})})]})}function rt({thread:t,isActive:i,formatDate:r,onSelect:c,onDelete:a,onExport:l}){return e.jsxs("div",{onClick:c,className:j("group flex w-full cursor-pointer items-center rounded-lg pl-2 pr-1 py-2 text-left transition-all duration-150",i?"border-l-2 border-l-primary bg-primary/10 text-foreground":"border-l-2 border-l-transparent hover:bg-muted/60 text-foreground/80"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium leading-snug text-left",children:t.title||"New conversation"}),e.jsx("div",{className:"text-xs text-muted-foreground text-left",children:r(t.createdAt)})]}),e.jsx("button",{onClick:o=>{o.stopPropagation(),a()},className:j("shrink-0 rounded-md p-1 text-red-500 hover:bg-red-500/10 hover:text-red-600 transition-opacity",i?"opacity-100":"opacity-0 group-hover:opacity-100"),title:"Delete",children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]})}const nt={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",go:"go",rs:"rust",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",css:"css",html:"html",sh:"bash",bash:"bash",sql:"sql",toml:"toml",xml:"xml",dockerfile:"docker"};function ot(t){return nt[t.toLowerCase().replace(/^\./,"")]||"text"}function V(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function lt({open:t,onClose:i}){const[r,c]=d.useState(null),[a,l]=d.useState(null),[o,m]=d.useState(!1),[p,h]=d.useState(!1),[f,S]=d.useState(null),v=d.useCallback(async u=>{m(!0),S(null),l(null);try{const g=await k.workspace.tree(u);c(g)}catch(g){S(g instanceof Error?g.message:"Failed to load workspace")}finally{m(!1)}},[]),w=d.useCallback(async u=>{h(!0);try{const g=await k.workspace.file(u);l(g)}catch(g){S(g instanceof Error?g.message:"Failed to load file")}finally{h(!1)}},[]),[D,x]=d.useState(!1);if(t&&!D&&(x(!0),v()),!t&&D&&x(!1),!t)return null;const n=[];if(r){const u=r.currentPath.replace(r.root,"").replace(/^\//,"");if(u){const g=u.split("/");let T="";for(const P of g)T=T?`${T}/${P}`:P,n.push({label:P,path:T})}}function b(){if(!r)return;const g=r.currentPath.replace(r.root,"").replace(/^\//,"").split("/").filter(Boolean);g.length<=1?v():(g.pop(),v(g.join("/")))}return e.jsxs("div",{className:"flex h-full w-full flex-col border-l border-border bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Workspace"}),r&&e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:r.root})]}),e.jsx(C,{variant:"ghost",size:"icon",onClick:i,className:"h-7 w-7 shrink-0",children:e.jsx(J,{className:"h-4 w-4"})})]}),r&&n.length>0&&e.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2 text-xs",children:[e.jsx("button",{onClick:()=>v(),className:"text-primary hover:underline",children:"root"}),n.map(u=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("button",{onClick:()=>v(u.path),className:"text-primary hover:underline",children:u.label})]},u.path))]}),e.jsx(X,{className:"flex-1",children:o?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(M,{className:"h-5 w-5 animate-spin text-primary"})}):f?e.jsx("div",{className:"px-4 py-8 text-center text-sm text-destructive",children:f}):e.jsxs("div",{className:"flex flex-col",children:[r&&e.jsxs("div",{className:"border-b border-border",children:[n.length>0&&e.jsxs("button",{onClick:b,className:"flex w-full items-center gap-2 px-4 py-2 text-sm text-muted-foreground hover:bg-muted/50 transition-colors",children:[e.jsx(je,{className:"h-4 w-4"}),e.jsx("span",{children:".."})]}),r.items.map(u=>e.jsxs("button",{onClick:()=>{if(u.type==="directory"){const g=r.currentPath.replace(r.root,"").replace(/^\//,""),T=g?`${g}/${u.name}`:u.name;v(T)}else{const g=r.currentPath.replace(r.root,"").replace(/^\//,""),T=g?`${g}/${u.name}`:u.name;w(T)}},className:j("flex w-full items-center gap-2 px-4 py-2 text-sm transition-colors hover:bg-muted/50",u.type==="directory"?"text-foreground":"text-foreground/80"),children:[u.type==="directory"?e.jsx(ve,{className:"h-4 w-4 shrink-0 text-primary/70"}):e.jsx(Je,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:u.name}),u.size!==void 0&&u.type==="file"&&e.jsx("span",{className:"ml-auto shrink-0 text-xs text-muted-foreground",children:V(u.size)})]},u.name)),r.items.length===0&&e.jsx("p",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Empty directory"})]}),p&&e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(M,{className:"h-5 w-5 animate-spin text-primary"})}),a&&!p&&e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[V(a.size),a.truncated&&" (truncated)"]})]}),e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>l(null),className:"h-6 text-xs",children:"Close"})]}),e.jsx("div",{className:"overflow-auto text-xs",children:e.jsx($e,{language:ot(a.ext),style:we,customStyle:{margin:0,borderRadius:0,fontSize:"0.75rem",lineHeight:"1.5"},showLineNumbers:!0,wrapLongLines:!0,children:a.content})})]})]})})]})}const it=Oe,ct=Re,se=d.forwardRef(({className:t,align:i="center",sideOffset:r=4,...c},a)=>e.jsx(Fe,{children:e.jsx(te,{ref:a,align:i,sideOffset:r,className:j("z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...c})}));se.displayName=te.displayName;function dt({currentProvider:t,currentModel:i}){const[r,c]=d.useState(!1),[a,l]=d.useState(null),[o,m]=d.useState(!1),[p,h]=d.useState(null),f=y(x=>x.setProvider),S=y(x=>x.setModel),v=d.useCallback(async()=>{if(!a){m(!0);try{const x=await k.chat.models.list();l(x)}catch{}finally{m(!1)}}},[a]);async function w(x){h(x);try{await k.chat.models.switch(x);const n=await k.chat.models.list();l(n);const b=n.providers.find(u=>u.name===x);b&&(f(b.name),S(b.model)),c(!1)}catch{}finally{h(null)}}const D=i.length>24?i.slice(0,22)+"...":i||t||"Model";return e.jsxs(it,{open:r,onOpenChange:x=>{c(x),x&&v()},children:[e.jsx(ct,{asChild:!0,children:e.jsxs(C,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs font-medium text-muted-foreground hover:text-foreground",children:[e.jsx("span",{className:"max-w-[140px] truncate",children:D}),e.jsx(Ue,{className:"h-3 w-3"})]})}),e.jsxs(se,{align:"start",className:"w-72 p-2",children:[e.jsx("p",{className:"px-2 pb-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Providers"}),o?e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(M,{className:"h-4 w-4 animate-spin text-primary"})}):a?e.jsx("div",{className:"flex flex-col gap-0.5",children:a.providers.map(x=>{const n=x.name===t,b=p===x.name;return e.jsxs("button",{disabled:!x.available||b,onClick:()=>{!n&&x.available&&w(x.name)},className:j("flex items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors",x.available?"hover:bg-muted/60":"cursor-not-allowed opacity-40",n&&"bg-primary/10"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-foreground",children:x.name}),n&&e.jsx(R,{className:"h-3.5 w-3.5 text-primary"})]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:x.model})]}),b?e.jsx(M,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-primary"}):e.jsx(Ie,{variant:x.available?"success":"secondary",className:"shrink-0 text-[10px] px-1.5 py-0",children:x.available?"Ready":"Unavailable"})]},x.name)})}):e.jsx("p",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No providers found"})]})]})}const mt=[{value:"off",label:"Off"},{value:"plan",label:"Plan"},{value:"execute",label:"Exec"}];function ut(){const[t,i]=d.useState(null),[r,c]=d.useState(!1),a=d.useCallback(async()=>{try{const o=await k.code.status();i(o)}catch{}},[]);d.useEffect(()=>{a()},[a]);async function l(o){if(!(!t||r||o===t.state)){c(!0);try{const m=await k.code.set(o);i(p=>p&&{...p,state:m.state,active:m.active})}catch{}finally{c(!1)}}}return t!=null&&t.available?e.jsx("div",{className:"flex items-center rounded-lg border border-border bg-muted/40 p-0.5",children:mt.map(o=>{const m=t.state===o.value;return e.jsx("button",{disabled:r,onClick:()=>l(o.value),className:j("rounded-md px-2.5 py-1 text-xs font-medium transition-all duration-150",m?o.value==="plan"?"bg-amber-500/15 text-amber-600 dark:text-amber-400 shadow-sm":o.value==="execute"?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 shadow-sm":"bg-background text-muted-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:o.label},o.value)})}):null}const xt={running:{icon:M,label:"Running...",color:"text-mercury-500",border:"border-l-mercury-500",iconClass:"animate-spin"},done:{icon:Ge,label:"Complete",color:"text-emerald-500",border:"border-l-emerald-500",iconClass:""},error:{icon:He,label:"Failed",color:"text-red-500",border:"border-l-red-500",iconClass:""}};function ae({tool:t,status:i,result:r}){const[c,a]=d.useState(!1),l=xt[i],o=l.icon;return e.jsx(We,{open:c,onOpenChange:a,children:e.jsxs("div",{className:j("my-1.5 overflow-hidden rounded-md border border-border/60 border-l-2 bg-muted/30",l.border),children:[e.jsxs(_e,{className:"flex w-full items-center gap-2 px-3 py-2 text-xs transition-colors hover:bg-muted/50",children:[e.jsx(Y,{className:j("h-3 w-3 text-muted-foreground transition-transform",c&&"rotate-90")}),e.jsx(at,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:t}),e.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.jsx(o,{className:j("h-3.5 w-3.5",l.color,l.iconClass)}),e.jsx("span",{className:j("text-[0.6875rem]",l.color),children:l.label})]})]}),e.jsx(qe,{children:r&&e.jsx("div",{className:"max-h-40 overflow-auto border-t border-border/40 bg-background/50 px-3 py-2",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[0.75rem] leading-relaxed text-muted-foreground",children:r})})})]})})}function ht({message:t,isLast:i}){var m;const[r,c]=d.useState(!1),a=t.role==="user",l=Q(p=>p.resolved),o=d.useCallback(()=>{navigator.clipboard.writeText(t.content),c(!0),setTimeout(()=>c(!1),2e3)},[t.content]);return e.jsxs(A.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,ease:"easeOut"},className:j("group flex gap-3",a?"flex-row-reverse":"flex-row"),children:[e.jsx("div",{className:j("flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-xs font-semibold",a?"bg-primary text-primary-foreground":"bg-card"),children:a?"U":e.jsx("img",{src:l==="dark"?"/logo-dark.png":"/logo-light.png",alt:"Mercury",className:"h-full w-full object-contain"})}),e.jsxs("div",{className:j("relative max-w-[80%] space-y-1",a?"items-end":"items-start"),children:[(m=t.steps)==null?void 0:m.map((p,h)=>e.jsx(ae,{tool:p.tool,status:p.status,result:p.result},`${t.id}-step-${h}`)),e.jsxs("div",{className:j("relative rounded-2xl px-4 py-2.5",a?"rounded-br-sm bg-mercury-500 text-white":"rounded-bl-sm border border-border/60 bg-card text-card-foreground"),children:[a?e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:t.content}):e.jsx(ee,{content:t.content}),e.jsx("div",{className:j("absolute -top-3 flex items-center gap-1 rounded-md border border-border bg-popover px-1 py-0.5 opacity-0 shadow-sm transition-opacity group-hover:opacity-100",a?"right-0":"left-0"),children:e.jsx("button",{onClick:o,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r?e.jsx(R,{className:"h-3 w-3 text-emerald-500"}):e.jsx(Ne,{className:"h-3 w-3"})})})]}),e.jsx("p",{className:j("px-1 text-[0.6875rem] text-muted-foreground",a?"text-right":"text-left"),children:ge(t.timestamp)})]})]})}function pt({text:t,steps:i}){const r=!t,c=Q(a=>a.resolved);return e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full bg-card",children:e.jsx("img",{src:c==="dark"?"/logo-dark.png":"/logo-light.png",alt:"Mercury",className:"h-full w-full object-contain"})}),e.jsxs("div",{className:"max-w-[80%] space-y-1",children:[i==null?void 0:i.map((a,l)=>e.jsx(ae,{tool:a.tool,status:a.status},`stream-step-${l}`)),e.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border/60 bg-card px-4 py-2.5 text-card-foreground",children:r?e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx("span",{children:"Thinking"}),e.jsx("span",{className:"inline-flex w-5",children:e.jsx("span",{className:"animate-pulse",children:"..."})})]}):e.jsxs("div",{className:"inline",children:[e.jsx(ee,{content:t}),e.jsx("span",{className:"ml-0.5 inline-block h-4 w-[3px] translate-y-[2px] rounded-sm bg-mercury-500 animate-cursor-blink"})]})})]})]})}function ft(){const t=y(o=>o.setThreads),i=y(o=>o.threads),r=y(o=>o.threadVersion),[c,a]=d.useState(!0),l=d.useCallback(async()=>{try{const o=await k.chat.threads.list();t(o.threads)}catch{}finally{a(!1)}},[t]);return d.useEffect(()=>{l()},[l,r]),{threads:i,loading:c,reload:l}}function gt(t){const i=d.useRef(null),[r,c]=d.useState(!0),a=d.useRef(!1),l=d.useCallback(()=>{const m=i.current;m&&(m.scrollTop=m.scrollHeight,a.current=!1,c(!0))},[]);d.useEffect(()=>{a.current||l()},t);const o=d.useCallback(()=>{const m=i.current;if(!m)return;const h=m.scrollHeight-m.scrollTop-m.clientHeight<80;c(h),h?a.current=!1:a.current=!0},[]);return{containerRef:i,atBottom:r,scrollToBottom:l,handleScroll:o}}function bt(){return e.jsx("div",{className:"flex w-full justify-start",children:e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl bg-muted px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(M,{className:"h-4 w-4 animate-spin text-primary"}),"Thinking..."]})})}function yt({data:t}){const[i,r]=d.useState(!1);async function c(a){r(!0);try{await k.chat.permission(t.id,a)}catch{}finally{r(!1)}}return e.jsx("div",{className:"flex w-full justify-start",children:e.jsxs("div",{className:"max-w-[85%] rounded-2xl border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-600 dark:text-amber-400",children:[e.jsx(Ve,{className:"h-4 w-4"}),"Permission Required"]}),t.tool&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Tool: ",e.jsx("span",{className:"font-medium text-foreground",children:t.tool})]}),t.description&&e.jsx("p",{className:"mt-1 text-sm text-foreground",children:t.description}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsxs(C,{size:"sm",className:"h-7 gap-1 text-xs",disabled:i,onClick:()=>c("allow"),children:[i?e.jsx(M,{className:"h-3 w-3 animate-spin"}):e.jsx(R,{className:"h-3 w-3"}),"Allow"]}),e.jsxs(C,{size:"sm",variant:"outline",className:"h-7 gap-1 text-xs",disabled:i,onClick:()=>c("deny"),children:[e.jsx(J,{className:"h-3 w-3"}),"Deny"]})]})]})})}const re=[{command:"/help",description:"Show all available commands",category:"General"},{command:"/progress",description:"Show current task progress",category:"General"},{command:"/halt",description:"Stop all sub-agents",category:"General"},{command:"/stop",description:"Stop all agents and clear tasks",category:"General"},{command:"/agents",description:"List active sub-agents and status",category:"Agents"},{command:"/agents kill",description:"Kill a specific sub-agent",category:"Agents"},{command:"/bg",description:"Run a shell command in background",category:"Background"},{command:"/bg:",description:"Delegate an LLM task to background",category:"Background"},{command:"/bg list",description:"Show all background tasks",category:"Background"},{command:"/bg current",description:"Move active task to background",category:"Background"},{command:"/bg stop",description:"Stop a background task",category:"Background"},{command:"/bg killall",description:"Stop all background tasks",category:"Background"},{command:"/bg clear",description:"Prune completed background tasks",category:"Background"},{command:"/models",description:"List available models",category:"Models"},{command:"/models use",description:"Switch to a different model",category:"Models"},{command:"/code",description:"Toggle programming mode",category:"Code"},{command:"/code plan",description:"Set plan-only mode",category:"Code"},{command:"/code execute",description:"Set execute mode",category:"Code"},{command:"/code off",description:"Disable programming mode",category:"Code"},{command:"/spotify",description:"Spotify status and controls",category:"Spotify"},{command:"/spotify play",description:"Play or search for music",category:"Spotify"},{command:"/spotify pause",description:"Pause playback",category:"Spotify"},{command:"/spotify next",description:"Skip to next track",category:"Spotify"},{command:"/spotify prev",description:"Previous track",category:"Spotify"},{command:"/spotify queue",description:"Show play queue",category:"Spotify"},{command:"/budget",description:"Show token budget status",category:"Budget"},{command:"/budget override",description:"Override budget for next request",category:"Budget"},{command:"/budget reset",description:"Reset daily usage counter",category:"Budget"},{command:"/budget set",description:"Set new daily budget limit",category:"Budget"},{command:"/memory",description:"Manage second-brain memory",category:"Memory"},{command:"/permissions",description:"Toggle permission mode",category:"General"},{command:"/ws",description:"Workspace file operations",category:"Workspace"},{command:"/exit",description:"Shutdown Mercury",category:"General"}];function jt({filter:t,selectedIndex:i,onSelect:r}){const c=re.filter(a=>a.command.startsWith(t.toLowerCase()));return c.length===0?null:e.jsx(A.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.15},className:"absolute bottom-full left-0 right-0 mb-2 max-h-64 overflow-y-auto rounded-xl border border-border bg-popover shadow-xl",children:e.jsx("div",{className:"p-1",children:c.map((a,l)=>e.jsxs("button",{onMouseDown:o=>{o.preventDefault(),r(a.command)},className:j("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",l===i?"bg-primary/10 text-primary":"text-foreground hover:bg-muted"),children:[e.jsx("span",{className:"font-mono font-medium text-xs shrink-0",children:a.command}),e.jsx("span",{className:"text-muted-foreground text-xs truncate",children:a.description}),e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60 shrink-0",children:a.category})]},a.command))})})}function vt({onSend:t,disabled:i}){const[r,c]=d.useState(""),[a,l]=d.useState(!1),[o,m]=d.useState(0),p=d.useRef(null),h=a?r.split(`
22
+ `)[0]:"",f=re.filter(n=>n.command.startsWith(h.toLowerCase()));function S(){const n=r.trim();!n||i||(l(!1),t(n),c(""),p.current&&(p.current.style.height="auto"))}function v(n){var u;const b=["/bg","/bg:","/bg stop","/models use","/agents kill","/spotify play","/budget set"].includes(n);c(b?n+" ":n),l(!1),m(0),(u=p.current)==null||u.focus()}function w(n){if(a&&f.length>0){if(n.key==="ArrowDown"){n.preventDefault(),m(b=>Math.min(b+1,f.length-1));return}if(n.key==="ArrowUp"){n.preventDefault(),m(b=>Math.max(b-1,0));return}if(n.key==="Tab"||n.key==="Enter"&&!n.shiftKey){n.preventDefault(),v(f[o].command);return}if(n.key==="Escape"){n.preventDefault(),l(!1);return}}n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),S())}function D(n){c(n);const b=n.split(`
23
+ `)[0];b.startsWith("/")&&!b.includes(" ")||b.startsWith("/")&&b.split(" ").length<=2?(l(!0),m(0)):l(!1)}function x(){const n=p.current;n&&(n.style.height="auto",n.style.height=Math.min(n.scrollHeight,200)+"px")}return e.jsx("div",{className:"border-t border-border bg-background/80 backdrop-blur-xl px-4 py-3",children:e.jsxs("div",{className:"mx-auto flex max-w-3xl items-end gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(E,{children:a&&f.length>0&&e.jsx(jt,{filter:h,selectedIndex:o,onSelect:v})}),e.jsx("textarea",{ref:p,value:r,onChange:n=>{D(n.target.value),x()},onKeyDown:w,onBlur:()=>{setTimeout(()=>l(!1),200)},placeholder:"Send a message... (type / for commands)",rows:1,className:j("w-full resize-none rounded-xl border border-border bg-muted/40 px-4 py-3 pr-12 text-sm text-foreground placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary/40","transition-all duration-150"),style:{maxHeight:200}})]}),e.jsx(C,{size:"icon",disabled:i||!r.trim(),onClick:S,className:"h-10 w-10 shrink-0 rounded-xl",children:e.jsx(Xe,{className:"h-4 w-4"})})]})})}function _t(){const{threadId:t}=pe(),i=fe(),{connected:r}=ke(),{threads:c,loading:a,reload:l}=ft(),o=y(s=>s.messages),m=y(s=>s.streamingText),p=y(s=>s.isStreaming),h=y(s=>s.waiting),f=y(s=>s.activeThreadId),S=y(s=>s.provider),v=y(s=>s.model),w=y(s=>s.totalSteps),D=y(s=>s.completedSteps),x=y(s=>s.currentStepTool),n=y(s=>s.setActiveThread),b=y(s=>s.addMessage),u=y(s=>s.clearMessages),g=y(s=>s.setWaiting),T=y(s=>s.clearStreaming),P=y(s=>s.resetSteps),ne=y(s=>s.bumpThreadVersion);d.useEffect(()=>{t&&t!==f&&n(t)},[t]);const[L,B]=d.useState(!0),[I,F]=d.useState(!1),{containerRef:oe,atBottom:le,scrollToBottom:ie,handleScroll:ce}=gt([o,m,h]);d.useEffect(()=>{if(!f){u();return}(async()=>{try{const s=await k.chat.threads.get(f);u(),s.messages&&s.messages.length>0&&s.messages.forEach(N=>b(N))}catch{u()}})()},[f]);async function de(s){let N=f;N||(N=(await k.chat.threads.create()).id,n(N)),b({id:crypto.randomUUID(),role:"user",content:s,timestamp:new Date().toISOString()}),g(!0);try{await k.chat.send(s,N),ne(),l()}catch{g(!1),T(),P(),b({id:crypto.randomUUID(),role:"system",content:"Failed to send message. Please try again.",timestamp:new Date().toISOString()})}}async function U(s){try{await k.chat.threads.delete(s),f===s&&(n(null),u()),l()}catch{}}function W(){const s=`web:${Date.now()}_${Math.random().toString(36).slice(2,8)}`;n(s),u(),l(),i(`/chat/${s}`)}function _(s){n(s),i(`/chat/${s}`)}function q(s){const N=c.find(z=>z.id===s);if(!N)return;const H=N.messages.map(z=>`[${z.role}] ${z.content}`).join(`
24
+
25
+ ---
26
+
27
+ `),he=new Blob([H],{type:"text/plain"}),G=URL.createObjectURL(he),O=document.createElement("a");O.href=G,O.download=`${N.title||"conversation"}-${s.slice(0,8)}.txt`,O.click(),URL.revokeObjectURL(G)}const me=p||h,ue=w>0,xe=w>0?D/w*100:0;return e.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[e.jsx("div",{className:j("hidden h-full shrink-0 border-r border-border bg-background transition-[width] duration-200 ease-in-out md:block overflow-hidden",L?"w-[240px]":"w-0 border-r-0"),children:e.jsx("div",{className:"h-full w-[240px]",children:e.jsx(K,{threads:c,activeThreadId:f,onSelect:_,onDelete:U,onNew:W,onExport:q})})}),e.jsx(E,{children:L&&e.jsxs(e.Fragment,{children:[e.jsx(A.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-40 bg-black/50 backdrop-blur-sm md:hidden",onClick:()=>B(!1)}),e.jsx(A.div,{initial:{x:-260},animate:{x:0},exit:{x:-260},transition:{duration:.2,ease:"easeInOut"},className:"fixed inset-y-0 left-0 z-50 w-[260px] bg-background shadow-xl md:hidden",children:e.jsx(K,{threads:c,activeThreadId:f,onSelect:s=>{_(s),B(!1)},onDelete:U,onNew:()=>{W(),B(!1)},onExport:q})})]})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-12 items-center gap-2 border-b border-border bg-background/80 backdrop-blur-xl px-3",children:[e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>B(!L),children:L?e.jsx(Qe,{className:"h-4 w-4"}):e.jsx(tt,{className:"h-4 w-4"})}),e.jsx("span",{className:"hidden text-sm font-bold mercury-gradient-text sm:inline",children:"Mercury"}),e.jsx("div",{className:"mx-1 h-4 w-px bg-border"}),e.jsx(dt,{currentProvider:S,currentModel:v}),e.jsx("div",{className:"flex-1"}),e.jsx(ut,{}),e.jsx("div",{className:j("h-2 w-2 rounded-full",r?"bg-emerald-500":"bg-destructive"),title:r?"Connected":"Disconnected"}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>F(!I),children:e.jsx(Ke,{className:"h-4 w-4"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8 hidden md:inline-flex",onClick:()=>window.location.href="/settings",children:e.jsx(be,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:oe,onScroll:ce,className:"h-full overflow-y-auto",children:e.jsx("div",{className:"mx-auto max-w-3xl space-y-4 px-4 py-6",children:a&&o.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center py-24",children:e.jsx(M,{className:"h-6 w-6 animate-spin text-primary"})}):o.length===0&&!p&&!h?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-24 text-center",children:[e.jsx("div",{className:"rounded-2xl bg-primary/10 p-4",children:e.jsx(Z,{className:"h-8 w-8 text-primary"})}),e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Start a conversation"}),e.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Send a message to begin. Mercury is ready to assist you."})]}):e.jsxs(e.Fragment,{children:[o.map(s=>{if(s.role==="system")try{const N=JSON.parse(s.content);if(N.id&&(N.tool||N.description))return e.jsx(yt,{data:N},s.id)}catch{}return e.jsx(ht,{message:s},s.id)}),p&&m&&e.jsx(pt,{text:m}),h&&!p&&e.jsx(bt,{})]})})}),e.jsx(E,{children:!le&&e.jsx(A.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:"absolute bottom-4 right-4",children:e.jsx(C,{variant:"outline",size:"icon",className:"h-9 w-9 rounded-full shadow-lg border-border bg-background/90 backdrop-blur-sm",onClick:ie,children:e.jsx(Se,{className:"h-4 w-4"})})})})]}),ue&&e.jsx("div",{className:"px-4 py-1.5",children:e.jsxs("div",{className:"mx-auto max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-1",children:[e.jsx(M,{className:"h-3 w-3 animate-spin text-primary"}),e.jsxs("span",{children:["Step ",D," of ",w,x&&e.jsxs("span",{className:"ml-1 text-foreground font-medium",children:["— ",x]})]})]}),e.jsx(ye,{value:xe,className:"h-1"})]})}),e.jsx(vt,{onSend:de,disabled:me})]}),e.jsx(E,{mode:"wait",children:I&&e.jsx(A.div,{initial:{width:0,opacity:0},animate:{width:320,opacity:1},exit:{width:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"hidden h-full shrink-0 overflow-hidden md:block",children:e.jsx("div",{className:"h-full w-[320px]",children:e.jsx(lt,{open:I,onClose:()=>F(!1)})})})})]})}export{_t as ChatPage};
@@ -1,2 +1 @@
1
- import{j as e,m as c}from"./vendor-motion-Dwx3-JO5.js";import{r as x}from"./vendor-react-C7pctHW3.js";import{C as u,a as p,b as j,c as f}from"./card-BdsEOP7t.js";import{P as w}from"./progress-ZzhsBV2v.js";import{B as h}from"./badge-CUJiWF1y.js";import{a as k,c as N,C as B,f as P,b,B as y,d as S}from"./index-C3YiF4qv.js";import{Z as T}from"./zap-BEfqVtvZ.js";import{A as E}from"./activity-MOTqH8zM.js";import{C as U}from"./circle-check-DvGSe1uZ.js";import{C as A}from"./circle-x-CyaGJ_BM.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CaqLZNof.js";import"./vendor-syntax-xZUI6Op9.js";const g={hidden:{opacity:0,y:12},visible:s=>({opacity:1,y:0,transition:{delay:s*.07,duration:.35,ease:"easeOut"}})};function i({className:s}){return e.jsx("div",{className:N("animate-pulse rounded-lg bg-muted",s)})}function n({icon:s,label:d,children:r,index:m,glow:o}){return e.jsx(c.div,{custom:m,variants:g,initial:"hidden",animate:"visible",children:e.jsxs(u,{className:N(o&&"mercury-glow-sm"),children:[e.jsxs(p,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(j,{className:"text-sm font-medium text-muted-foreground",children:d}),e.jsx(s,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(f,{children:r})]})})}function I(){const[s,d]=x.useState(null),[r,m]=x.useState("");if(x.useEffect(()=>{k.status.get().then(d).catch(a=>m(a.message))},[]),r)return e.jsx("div",{className:"flex h-full items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-destructive",children:r})});if(!s)return e.jsxs("div",{className:"space-y-6 p-6 lg:p-8",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(i,{className:"h-8 w-40"}),e.jsx(i,{className:"h-4 w-56"})]}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((a,t)=>e.jsx(i,{className:"h-[120px]"},t))}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(i,{className:"h-[200px]"}),e.jsx(i,{className:"h-[200px]"})]})]});const o=s.tokens.dailyBudget?Math.min(Math.round(s.tokens.dailyUsed/s.tokens.dailyBudget*100),100):0,l=Object.entries(s.providers),C=l.filter(([,a])=>a.enabled).length,v=Object.entries(s.memory.byType);return e.jsxs("div",{className:"space-y-6 p-6 lg:p-8",children:[e.jsxs(c.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.3},children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Status"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Agent is"," ",e.jsx("span",{className:N("font-medium",s.running?"text-emerald-500":"text-muted-foreground"),children:s.state})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(n,{icon:B,label:"Uptime",index:0,glow:!0,children:e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:P(s.uptime)})}),e.jsxs(n,{icon:T,label:"Tokens Used",index:1,children:[e.jsxs("p",{className:"text-2xl font-bold tabular-nums",children:[b(s.tokens.dailyUsed),e.jsxs("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:["/ ",b(s.tokens.dailyBudget)]})]}),e.jsx(w,{value:o,className:"mt-3"})]}),e.jsx(n,{icon:y,label:"Total Memories",index:2,children:e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:s.memory.total.toLocaleString()})}),e.jsx(n,{icon:S,label:"Active Providers",index:3,children:e.jsxs("p",{className:"text-2xl font-bold tabular-nums",children:[C,e.jsxs("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:["/ ",l.length]})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(c.div,{custom:4,variants:g,initial:"hidden",animate:"visible",children:e.jsxs(u,{children:[e.jsx(p,{children:e.jsxs(j,{className:"flex items-center gap-2 text-base",children:[e.jsx(y,{className:"h-4 w-4"}),"Memory by Type"]})}),e.jsx(f,{children:v.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No memories stored yet."}):e.jsx("div",{className:"flex flex-col gap-3",children:v.map(([a,t])=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(h,{variant:"secondary",className:"capitalize",children:a}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:t.toLocaleString()})]},a))})})]})}),e.jsx(c.div,{custom:5,variants:g,initial:"hidden",animate:"visible",children:e.jsxs(u,{children:[e.jsx(p,{children:e.jsxs(j,{className:"flex items-center gap-2 text-base",children:[e.jsx(E,{className:"h-4 w-4"}),"Providers"]})}),e.jsx(f,{children:l.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured."}):e.jsx("div",{className:"flex flex-col gap-3",children:l.map(([a,t])=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:a}),t.enabled?e.jsxs(h,{variant:"success",className:"gap-1",children:[e.jsx(U,{className:"h-3 w-3"}),"Enabled"]}):e.jsxs(h,{variant:"outline",className:"gap-1 text-muted-foreground",children:[e.jsx(A,{className:"h-3 w-3"}),"Disabled"]})]},a))})})]})})]})]})}export{I as DashboardPage};
2
- //# sourceMappingURL=Dashboard-1rlAqQ-Y.js.map
1
+ import{j as e,m as c}from"./vendor-motion-Dwx3-JO5.js";import{r as x}from"./vendor-react-C7pctHW3.js";import{C as u,a as p,b as j,c as f}from"./card-CjAvp22k.js";import{P as w}from"./progress-CsRtYJ3t.js";import{B as h}from"./badge-DpVeNL8j.js";import{a as k,c as N,C as B,f as P,b,B as y,d as S}from"./index-B1xAjISP.js";import{Z as T}from"./zap-CK8xUBKc.js";import{A as E}from"./activity-CDTOZzUZ.js";import{C as U}from"./circle-check-Cch4Kwja.js";import{C as A}from"./circle-x-DK0DQPGB.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CufYpqmV.js";import"./vendor-syntax-xZUI6Op9.js";const g={hidden:{opacity:0,y:12},visible:s=>({opacity:1,y:0,transition:{delay:s*.07,duration:.35,ease:"easeOut"}})};function i({className:s}){return e.jsx("div",{className:N("animate-pulse rounded-lg bg-muted",s)})}function n({icon:s,label:d,children:r,index:m,glow:o}){return e.jsx(c.div,{custom:m,variants:g,initial:"hidden",animate:"visible",children:e.jsxs(u,{className:N(o&&"mercury-glow-sm"),children:[e.jsxs(p,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(j,{className:"text-sm font-medium text-muted-foreground",children:d}),e.jsx(s,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(f,{children:r})]})})}function I(){const[s,d]=x.useState(null),[r,m]=x.useState("");if(x.useEffect(()=>{k.status.get().then(d).catch(a=>m(a.message))},[]),r)return e.jsx("div",{className:"flex h-full items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-destructive",children:r})});if(!s)return e.jsxs("div",{className:"space-y-6 p-6 lg:p-8",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(i,{className:"h-8 w-40"}),e.jsx(i,{className:"h-4 w-56"})]}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((a,t)=>e.jsx(i,{className:"h-[120px]"},t))}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(i,{className:"h-[200px]"}),e.jsx(i,{className:"h-[200px]"})]})]});const o=s.tokens.dailyBudget?Math.min(Math.round(s.tokens.dailyUsed/s.tokens.dailyBudget*100),100):0,l=Object.entries(s.providers),C=l.filter(([,a])=>a.enabled).length,v=Object.entries(s.memory.byType);return e.jsxs("div",{className:"space-y-6 p-6 lg:p-8",children:[e.jsxs(c.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.3},children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Status"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Agent is"," ",e.jsx("span",{className:N("font-medium",s.running?"text-emerald-500":"text-muted-foreground"),children:s.state})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(n,{icon:B,label:"Uptime",index:0,glow:!0,children:e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:P(s.uptime)})}),e.jsxs(n,{icon:T,label:"Tokens Used",index:1,children:[e.jsxs("p",{className:"text-2xl font-bold tabular-nums",children:[b(s.tokens.dailyUsed),e.jsxs("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:["/ ",b(s.tokens.dailyBudget)]})]}),e.jsx(w,{value:o,className:"mt-3"})]}),e.jsx(n,{icon:y,label:"Total Memories",index:2,children:e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:s.memory.total.toLocaleString()})}),e.jsx(n,{icon:S,label:"Active Providers",index:3,children:e.jsxs("p",{className:"text-2xl font-bold tabular-nums",children:[C,e.jsxs("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:["/ ",l.length]})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(c.div,{custom:4,variants:g,initial:"hidden",animate:"visible",children:e.jsxs(u,{children:[e.jsx(p,{children:e.jsxs(j,{className:"flex items-center gap-2 text-base",children:[e.jsx(y,{className:"h-4 w-4"}),"Memory by Type"]})}),e.jsx(f,{children:v.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No memories stored yet."}):e.jsx("div",{className:"flex flex-col gap-3",children:v.map(([a,t])=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(h,{variant:"secondary",className:"capitalize",children:a}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:t.toLocaleString()})]},a))})})]})}),e.jsx(c.div,{custom:5,variants:g,initial:"hidden",animate:"visible",children:e.jsxs(u,{children:[e.jsx(p,{children:e.jsxs(j,{className:"flex items-center gap-2 text-base",children:[e.jsx(E,{className:"h-4 w-4"}),"Providers"]})}),e.jsx(f,{children:l.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured."}):e.jsx("div",{className:"flex flex-col gap-3",children:l.map(([a,t])=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:a}),t.enabled?e.jsxs(h,{variant:"success",className:"gap-1",children:[e.jsx(U,{className:"h-3 w-3"}),"Enabled"]}):e.jsxs(h,{variant:"outline",className:"gap-1 text-muted-foreground",children:[e.jsx(A,{className:"h-3 w-3"}),"Disabled"]})]},a))})})]})})]})]})}export{I as DashboardPage};
@@ -1,4 +1,4 @@
1
- import{j as e,m as y,A as B}from"./vendor-motion-Dwx3-JO5.js";import{r}from"./vendor-react-C7pctHW3.js";import{C as k,c as A}from"./card-BdsEOP7t.js";import{B as b}from"./button-CNasMlFE.js";import{I as R}from"./input-CH3dmo9r.js";import{B as ae}from"./badge-CUJiWF1y.js";import{T as re}from"./textarea-CXh3tmJ1.js";import{J as oe,K as H,M as O,N as _}from"./vendor-radix-3UdfCgs_.js";import{e as K,c as p,a as j,T as S,h as ie}from"./index-C3YiF4qv.js";import{D as le,a as ne,b as ce,c as de,d as me,e as xe}from"./dialog-Bd1rELXb.js";import{A as ue,h as ge,T as he,a as pe,b as fe,c as je,d as ye,e as be,f as ve,g as Ne}from"./alert-dialog-MbYSbZx5.js";import{P as q}from"./plus-7rbHkByr.js";import{C as $}from"./circle-x-CyaGJ_BM.js";import{L as we}from"./loader-circle-DbYKk0_Q.js";import{C as Ce}from"./circle-check-DvGSe1uZ.js";import"./index-CaqLZNof.js";import"./vendor-syntax-xZUI6Op9.js";/**
1
+ import{j as e,m as y,A as B}from"./vendor-motion-Dwx3-JO5.js";import{r}from"./vendor-react-C7pctHW3.js";import{C as k,c as A}from"./card-CjAvp22k.js";import{B as b}from"./button-V3Fu7_kO.js";import{I as R}from"./input-CF6e2HL4.js";import{B as ae}from"./badge-DpVeNL8j.js";import{T as re}from"./textarea-BTxEQ_C2.js";import{J as oe,K as H,M as O,N as _}from"./vendor-radix-3UdfCgs_.js";import{e as K,c as p,a as j,T as S,h as ie}from"./index-B1xAjISP.js";import{D as le,a as ne,b as ce,c as de,d as me,e as xe}from"./dialog-FHqlAspv.js";import{A as ue,h as ge,T as he,a as pe,b as fe,c as je,d as ye,e as be,f as ve,g as Ne}from"./alert-dialog-B3JUwsIN.js";import{P as q}from"./plus-DhHrgqcD.js";import{C as $}from"./circle-x-DK0DQPGB.js";import{L as we}from"./loader-circle-CJko6bz6.js";import{C as Ce}from"./circle-check-Cch4Kwja.js";import"./index-CufYpqmV.js";import"./vendor-syntax-xZUI6Op9.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -9,4 +9,3 @@ import{j as e,m as y,A as B}from"./vendor-motion-Dwx3-JO5.js";import{r}from"./ve
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
11
  */const ke=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],Ae=K("rocket",ke),Se=oe,W=r.forwardRef(({className:s,...a},o)=>e.jsx(H,{ref:o,className:p("inline-flex h-9 items-center justify-center gap-1 border-b border-border bg-transparent p-0 text-muted-foreground",s),...a}));W.displayName=H.displayName;const L=r.forwardRef(({className:s,...a},o)=>e.jsx(O,{ref:o,className:p("inline-flex items-center justify-center whitespace-nowrap px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:text-foreground data-[state=active]:shadow-none",s),...a}));L.displayName=O.displayName;const M=r.forwardRef(({className:s,...a},o)=>e.jsx(_,{ref:o,className:p("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...a}));M.displayName=_.displayName;const Te={hidden:{opacity:0,y:12},visible:s=>({opacity:1,y:0,transition:{delay:s*.05,duration:.3,ease:"easeOut"}}),exit:{opacity:0,y:-8,transition:{duration:.2}}},Pe={visible:{transition:{staggerChildren:.05}}};function Ge({toasts:s}){return e.jsx("div",{className:"fixed bottom-6 right-6 z-50 flex flex-col gap-2",children:e.jsx(B,{children:s.map(a=>e.jsxs(y.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:40},className:p("flex items-center gap-2 rounded-lg border px-4 py-3 text-sm shadow-lg backdrop-blur-sm",a.type==="success"?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-destructive/30 bg-destructive/10 text-destructive"),children:[a.type==="success"?e.jsx(Ce,{className:"h-4 w-4"}):e.jsx($,{className:"h-4 w-4"}),a.message]},a.id))})})}function D({className:s}){return e.jsx("div",{className:p("animate-pulse rounded-lg bg-muted",s)})}function Ee(){return e.jsx(k,{children:e.jsxs(A,{className:"p-5 space-y-3",children:[e.jsx(D,{className:"h-5 w-3/4"}),e.jsx(D,{className:"h-3 w-full"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(D,{className:"h-3 w-16"}),e.jsx(D,{className:"h-3 w-20"})]})]})})}function Le({importance:s}){const a=s>=8?"Critical":s>=6?"High":s>=4?"Medium":"Low",o=s>=8?"text-red-400 bg-red-500/15":s>=6?"text-amber-400 bg-amber-500/15":s>=4?"text-[#00d4ff] bg-[#00d4ff]/15":"text-muted-foreground bg-muted";return e.jsx("span",{className:p("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium",o),children:a})}function Me({item:s,onDelete:a,index:o,kind:i}){return e.jsx(y.div,{custom:o,variants:Te,initial:"hidden",animate:"visible",exit:"exit",layout:!0,children:e.jsx(k,{className:"group transition-colors hover:border-[#00d4ff]/20",children:e.jsx(A,{className:"p-5",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[i==="goal"?e.jsx(S,{className:"h-4 w-4 text-amber-400 shrink-0"}):e.jsx(V,{className:"h-4 w-4 text-cyan-400 shrink-0"}),e.jsx("h3",{className:"text-sm font-semibold text-foreground leading-tight",children:s.summary})]}),s.detail&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-3",children:s.detail}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-0.5",children:[s.importance!=null&&e.jsx(Le,{importance:s.importance}),e.jsx("span",{className:"text-xs text-muted-foreground/50",children:ie(s.createdAt)})]})]}),e.jsxs(ue,{children:[e.jsx(ge,{asChild:!0,children:e.jsx(b,{size:"sm",variant:"ghost",className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive shrink-0",children:e.jsx(he,{className:"h-3.5 w-3.5"})})}),e.jsxs(pe,{children:[e.jsxs(fe,{children:[e.jsxs(je,{children:["Delete ",i==="goal"?"Goal":"Project"]}),e.jsxs(ye,{children:["Are you sure you want to delete this"," ",i==="goal"?"goal":"project","? This action cannot be undone."]})]}),e.jsxs(be,{children:[e.jsx(ve,{children:"Cancel"}),e.jsx(Ne,{onClick:()=>a(s.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})})})})}function Ie({open:s,onOpenChange:a,onSubmit:o,submitting:i,kind:c}){const[d,u]=r.useState(""),[m,x]=r.useState(""),[f,v]=r.useState("5"),N=l=>{l.preventDefault(),d.trim()&&o({type:c,summary:d.trim(),detail:m.trim()||void 0,importance:parseInt(f)})},T=()=>{u(""),x(""),v("5")};return e.jsx(le,{open:s,onOpenChange:l=>{l||T(),a(l)},children:e.jsxs(ne,{className:"sm:max-w-md",children:[e.jsxs(ce,{children:[e.jsxs(de,{children:["Add ",c==="goal"?"Goal":"Project"]}),e.jsxs(me,{children:["Create a new ",c==="goal"?"goal":"project"," in the Second Brain."]})]}),e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Summary ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(R,{placeholder:c==="goal"?"What do you want to achieve?":"What are you working on?",value:d,onChange:l=>u(l.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Detail"}),e.jsx(re,{placeholder:"Additional context...",value:m,onChange:l=>x(l.target.value),rows:3})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Importance (1–10)"}),e.jsx(R,{type:"number",min:"1",max:"10",step:"1",value:f,onChange:l=>v(l.target.value)})]}),e.jsx(xe,{children:e.jsx(b,{type:"submit",disabled:i||!d.trim(),children:i?e.jsxs(e.Fragment,{children:[e.jsx(we,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):`Add ${c==="goal"?"Goal":"Project"}`})})]})]})})}function z({items:s,loading:a,error:o,kind:i,onDelete:c,onRetry:d,onAdd:u}){return o?e.jsx(k,{className:"border-destructive/30",children:e.jsxs(A,{className:"flex items-center gap-3 p-4 text-sm text-destructive",children:[e.jsx($,{className:"h-4 w-4 shrink-0"}),o,e.jsx(b,{size:"sm",variant:"outline",className:"ml-auto",onClick:d,children:"Retry"})]})}):a?e.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((m,x)=>e.jsx(Ee,{},x))}):s.length===0?e.jsx(k,{children:e.jsxs(A,{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-muted mb-4",children:i==="goal"?e.jsx(S,{className:"h-7 w-7 text-muted-foreground"}):e.jsx(Ae,{className:"h-7 w-7 text-muted-foreground"})}),e.jsxs("h3",{className:"text-base font-medium text-foreground mb-1",children:["No ",i==="goal"?"goals":"projects"," yet"]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:i==="goal"?"Add goals to help Mercury understand what you're working towards.":"Track active projects so Mercury can provide better context."}),e.jsxs(b,{className:"mt-4",onClick:u,children:[e.jsx(q,{className:"h-4 w-4"}),"Add ",i==="goal"?"Goal":"Project"]})]})}):e.jsx(y.div,{className:"space-y-3",variants:Pe,initial:"hidden",animate:"visible",children:e.jsx(B,{mode:"popLayout",children:s.map((m,x)=>e.jsx(Me,{item:m,onDelete:c,index:x,kind:i},m.id))})})}function Ye(){const[s,a]=r.useState([]),[o,i]=r.useState([]),[c,d]=r.useState(!0),[u,m]=r.useState(!0),[x,f]=r.useState(null),[v,N]=r.useState(null),[T,l]=r.useState(!1),[J,U]=r.useState("goal"),[X,I]=r.useState(!1),[P,Z]=r.useState("goals"),[Q,F]=r.useState([]),g=r.useCallback((t,n)=>{const h=Date.now();F(E=>[...E,{id:h,type:t,message:n}]),setTimeout(()=>{F(E=>E.filter(te=>te.id!==h))},3500)},[]),w=r.useCallback(async()=>{try{d(!0),f(null);const t=await j.brain.memory.list({type:"goal"});a(t.memories)}catch(t){f(t instanceof Error?t.message:"Failed to load goals")}finally{d(!1)}},[]),C=r.useCallback(async()=>{try{m(!0),N(null);const t=await j.brain.memory.list({type:"project"});i(t.memories)}catch(t){N(t instanceof Error?t.message:"Failed to load projects")}finally{m(!1)}},[]);r.useEffect(()=>{w(),C()},[w,C]);const G=t=>{U(t),l(!0)},Y=async t=>{I(!0);try{await j.brain.memory.create(t),g("success",`${t.type==="goal"?"Goal":"Project"} created`),l(!1),t.type==="goal"?w():C()}catch(n){g("error",n instanceof Error?n.message:"Failed to create")}finally{I(!1)}},ee=async t=>{try{await j.brain.memory.delete(t),a(n=>n.filter(h=>h.id!==t)),g("success","Goal deleted")}catch(n){g("error",n instanceof Error?n.message:"Failed to delete")}},se=async t=>{try{await j.brain.memory.delete(t),i(n=>n.filter(h=>h.id!==t)),g("success","Project deleted")}catch(n){g("error",n instanceof Error?n.message:"Failed to delete")}};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs(y.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.3},className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-[#00d4ff]/10",children:e.jsx(S,{className:"h-5 w-5 text-[#00d4ff]"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Goals & Projects"}),e.jsx(ae,{variant:"secondary",className:"tabular-nums",children:s.length+o.length})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track objectives and active initiatives"})]})]}),e.jsxs(b,{onClick:()=>G(P==="goals"?"goal":"project"),children:[e.jsx(q,{className:"h-4 w-4"}),"Add ",P==="goals"?"Goal":"Project"]})]}),e.jsx(y.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.1,duration:.3},children:e.jsxs(Se,{value:P,onValueChange:Z,className:"space-y-4",children:[e.jsxs(W,{className:"w-full sm:w-auto",children:[e.jsxs(L,{value:"goals",className:"gap-1.5",children:[e.jsx(S,{className:"h-3.5 w-3.5"}),"Goals",!c&&e.jsxs("span",{className:"ml-1 text-xs text-muted-foreground/60 tabular-nums",children:["(",s.length,")"]})]}),e.jsxs(L,{value:"projects",className:"gap-1.5",children:[e.jsx(V,{className:"h-3.5 w-3.5"}),"Projects",!u&&e.jsxs("span",{className:"ml-1 text-xs text-muted-foreground/60 tabular-nums",children:["(",o.length,")"]})]})]}),e.jsx(M,{value:"goals",children:e.jsx(z,{items:s,loading:c,error:x,kind:"goal",onDelete:ee,onRetry:w,onAdd:()=>G("goal")})}),e.jsx(M,{value:"projects",children:e.jsx(z,{items:o,loading:u,error:v,kind:"project",onDelete:se,onRetry:C,onAdd:()=>G("project")})})]})}),e.jsx(Ie,{open:T,onOpenChange:l,onSubmit:Y,submitting:X,kind:J}),e.jsx(Ge,{toasts:Q})]})}export{Ye as GoalsPage};
12
- //# sourceMappingURL=Goals-CgSUAXLH.js.map
@@ -1,7 +1,6 @@
1
- import{j as s}from"./vendor-motion-Dwx3-JO5.js";import{r as d}from"./vendor-react-C7pctHW3.js";import{e as Se,a as pe}from"./index-C3YiF4qv.js";import{D as Ce,a as Ee,b as ze,c as De}from"./dialog-Bd1rELXb.js";import{L as me}from"./loader-circle-DbYKk0_Q.js";import{S as Fe}from"./search-BZsbhO0B.js";import"./vendor-syntax-xZUI6Op9.js";import"./vendor-radix-3UdfCgs_.js";/**
1
+ import{j as s}from"./vendor-motion-Dwx3-JO5.js";import{r as d}from"./vendor-react-C7pctHW3.js";import{e as Se,a as pe}from"./index-B1xAjISP.js";import{D as Ce,a as Ee,b as ze,c as De}from"./dialog-FHqlAspv.js";import{L as me}from"./loader-circle-CJko6bz6.js";import{S as Fe}from"./search-BwE8vRR_.js";import"./vendor-syntax-xZUI6Op9.js";import"./vendor-radix-3UdfCgs_.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
6
  */const Le=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],ge=Se("network",Le),he={fact:"#3b82f6",preference:"#a78bfa",experience:"#22c55e",goal:"#f59e0b",project:"#00d4ff",person:"#ec4899",skill:"#6366f1",belief:"#f97316",observation:"#14b8a6",default:"#6b7280"};function Q(p){return he[p]||he.default}function Re(){return document.documentElement.classList.contains("dark")||document.documentElement.getAttribute("data-theme")!=="light"}function Qe(){const p=d.useRef(null),S=d.useRef(null),[b,u]=d.useState(!0),[F,q]=d.useState([]),[$,B]=d.useState([]),[R,O]=d.useState(""),[v,H]=d.useState(null),[be,J]=d.useState(!1),[G,ve]=d.useState(null),[ye,ee]=d.useState(null),[Ne,te]=d.useState(!1),[je,se]=d.useState(null),m=d.useRef({nodes:[],edges:[],positions:new Map,anchors:new Map,velocities:new Map,pan:{x:0,y:0},zoom:1,dragging:!1,dragNode:null,hoveredNode:null,selectedNode:null,lastMouse:{x:0,y:0},pressNode:null,pressX:0,pressY:0,pressT:0,moved:!1,searchQuery:"",animFrame:0,dpr:1});d.useEffect(()=>{m.current.searchQuery=R},[R]);const K=d.useCallback((e,o)=>{let t=0;for(const n of o)(n.source===e||n.target===e)&&t++;return t},[]),ne=d.useCallback((e,o,t)=>{const n=m.current,a=o/2,c=t/2;n.positions.clear(),n.anchors.clear(),n.velocities.clear(),e.forEach((l,r)=>{const i=r/e.length*Math.PI*2,D=150+Math.random()*100,C=a+D*Math.cos(i),N=c+D*Math.sin(i);n.positions.set(l.id,{x:C,y:N}),n.anchors.set(l.id,{x:C,y:N}),n.velocities.set(l.id,{seed:Math.random(),freq:9e-5+Math.random()*7e-5,amp:.25+Math.random()*.25})})},[]),oe=d.useCallback((e,o,t,n)=>{const a=m.current,c=80;for(let l=0;l<c;l++){const r=t*n,i=Math.sqrt(r/Math.max(1,e.length)),D=i*i,C=.01,N=new Map;e.forEach(x=>N.set(x.id,{fx:0,fy:0}));for(let x=0;x<e.length;x++)for(let f=x+1;f<e.length;f++){const h=a.positions.get(e[x].id),L=a.positions.get(e[f].id);if(!h||!L)continue;const z=h.x-L.x,j=h.y-L.y,E=Math.max(Math.sqrt(z*z+j*j),1),P=D/(E*E),W=z/E*P,T=j/E*P;N.get(e[x].id).fx+=W,N.get(e[x].id).fy+=T,N.get(e[f].id).fx-=W,N.get(e[f].id).fy-=T}o.forEach(x=>{const f=a.positions.get(x.source),h=a.positions.get(x.target);if(!f||!h)return;const L=h.x-f.x,z=h.y-f.y,j=N.get(x.source),E=N.get(x.target);j&&(j.fx+=L*C,j.fy+=z*C),E&&(E.fx-=L*C,E.fy-=z*C)});const g=t/2,y=n/2,k=.001;e.forEach(x=>{const f=a.positions.get(x.id),h=N.get(x.id);!f||!h||(h.fx+=(g-f.x)*k,h.fy+=(y-f.y)*k)});const M=.1;e.forEach(x=>{const f=N.get(x.id),h=a.positions.get(x.id);!f||!h||(h.x+=f.fx*M,h.y+=f.fy*M)})}e.forEach(l=>{const r=a.positions.get(l.id),i=a.anchors.get(l.id);r&&i&&(i.x=r.x,i.y=r.y)})},[]),Y=d.useCallback(()=>{const e=p.current,o=S.current;if(!e||!o)return;const t=window.devicePixelRatio||1;m.current.dpr=t;const n=o.clientWidth,a=o.clientHeight;e.width=n*t,e.height=a*t,e.style.width=`${n}px`,e.style.height=`${a}px`},[]),X=d.useCallback((e,o)=>{const t=m.current,n=t.dpr;return{x:(e*n-t.pan.x)/t.zoom,y:(o*n-t.pan.y)/t.zoom}},[]),I=d.useCallback((e,o)=>{const t=m.current;for(let n=t.nodes.length-1;n>=0;n--){const a=t.nodes[n],c=t.positions.get(a.id);if(!c)continue;const l=(a.size||8)*1.5,r=e-c.x,i=o-c.y;if(r*r+i*i<l*l)return a}return null},[]),ae=d.useCallback(e=>{const o=p.current;if(!o)return;const t=o.getContext("2d");if(!t)return;const n=m.current,a=n.dpr,c=o.width,l=o.height,r=Re();t.clearRect(0,0,c,l),t.fillStyle=r?"#0a0e14":"#ffffff",t.fillRect(0,0,c,l),t.save(),t.translate(n.pan.x,n.pan.y),t.scale(n.zoom,n.zoom);const i=n.hoveredNode||n.selectedNode,D=new Set,C=new Set;i&&(n.edges.forEach((g,y)=>{g.source===i.id&&(D.add(g.target),C.add(y)),g.target===i.id&&(D.add(g.source),C.add(y))}),D.add(i.id)),n.edges.forEach((g,y)=>{const k=n.positions.get(g.source),M=n.positions.get(g.target);if(!k||!M)return;if(C.has(y))t.strokeStyle=r?"rgba(0,212,255,0.7)":"rgba(0,136,170,0.6)",t.lineWidth=2*a/n.zoom;else if(i)t.strokeStyle=r?"rgba(0,212,255,0.06)":"rgba(0,136,170,0.05)",t.lineWidth=.6*a/n.zoom;else{const f=(Math.sin(e*22e-5+y*1.3)+1)*.5,h=(r?.16:.13)+f*.06;t.strokeStyle=r?`rgba(0,212,255,${h.toFixed(3)})`:`rgba(0,136,170,${h.toFixed(3)})`,t.lineWidth=(.7+f*.3)*a/n.zoom}t.beginPath(),t.moveTo(k.x,k.y),t.lineTo(M.x,M.y),t.stroke()});const N=n.searchQuery.toLowerCase();n.nodes.forEach(g=>{var E,P,W;const y=n.positions.get(g.id);if(!y)return;const k=((E=n.hoveredNode)==null?void 0:E.id)===g.id,M=((P=n.selectedNode)==null?void 0:P.id)===g.id,x=D.has(g.id),f=n.velocities.get(g.id),h=1+Math.sin(e*35e-5+((f==null?void 0:f.seed)??0)*11.7)*.01,z=(g.size||8)*a*(k||M?1.4:h);let j=1;if(N?j=(g.fullLabel||g.label).toLowerCase().includes(N)?1:.12:i&&(j=k||M||x?1:.18),t.globalAlpha=j,(k||M)&&(t.beginPath(),t.arc(y.x,y.y,z+5*a/n.zoom,0,Math.PI*2),t.fillStyle=r?"rgba(0,212,255,0.14)":"rgba(0,136,170,0.12)",t.fill()),t.beginPath(),t.arc(y.x,y.y,z,0,Math.PI*2),t.fillStyle=Q(g.type),t.fill(),k||M?(t.strokeStyle=r?"#f0f0f0":"#1a1a1a",t.lineWidth=2*a/n.zoom,t.stroke()):x&&i&&(t.strokeStyle=r?"rgba(0,212,255,0.65)":"rgba(0,136,170,0.55)",t.lineWidth=1.8*a/n.zoom,t.stroke()),k||M){const T=Math.max(10*a,11*a/n.zoom);t.font=`${T}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,t.textAlign="center",t.textBaseline="top";const ie=g.label,de=t.measureText(ie),ue=6*a,fe=3*a,we=y.x-de.width/2-ue,xe=y.y+z+4*a,ke=de.width+ue*2,Me=T+fe*2;t.fillStyle=r?"rgba(10,14,20,0.92)":"rgba(255,255,255,0.95)",t.beginPath(),(W=t.roundRect)==null||W.call(t,we,xe,ke,Me,4*a),t.fill(),t.fillStyle=r?`rgba(240,240,240,${j})`:`rgba(20,20,20,${j})`,t.fillText(ie,y.x,xe+fe)}t.globalAlpha=1}),t.restore()},[]),re=d.useCallback(e=>{const o=m.current;o.nodes.forEach(t=>{var l;if(((l=o.dragNode)==null?void 0:l.id)===t.id)return;const n=o.positions.get(t.id),a=o.anchors.get(t.id),c=o.velocities.get(t.id);!n||!a||!c||(n.x=a.x+Math.sin(e*c.freq+c.seed*11.1)*c.amp,n.y=a.y+Math.cos(e*c.freq*.87+c.seed*17.3)*c.amp)})},[]),ce=d.useCallback(async e=>{ve(e),ee(null),se(null),J(!0),te(!0),m.current.selectedNode=e;try{const o=await pe.brain.memory.get(e.id);ee(o)}catch(o){se(o instanceof Error?o.message:"Failed to load details")}finally{te(!1)}},[]),U=d.useCallback(e=>{const o=p.current;if(!o)return;const t=o.getBoundingClientRect(),n=e.clientX-t.left,a=e.clientY-t.top,c=X(n,a),l=I(c.x,c.y),r=m.current;r.pressNode=l,r.pressX=e.clientX,r.pressY=e.clientY,r.pressT=performance.now(),r.moved=!1,l?r.dragNode=l:r.dragging=!0,r.lastMouse={x:e.clientX,y:e.clientY}},[X,I]),_=d.useCallback(e=>{const o=p.current;if(!o)return;const t=o.getBoundingClientRect(),n=e.clientX-t.left,a=e.clientY-t.top,c=m.current;if(c.pressT&&!c.moved){const l=e.clientX-c.pressX,r=e.clientY-c.pressY;l*l+r*r>16&&(c.moved=!0)}if(c.dragNode){const l=X(n,a),r=c.positions.get(c.dragNode.id),i=c.anchors.get(c.dragNode.id);r&&(r.x=l.x,r.y=l.y),i&&(i.x=l.x,i.y=l.y)}else if(c.dragging){const l=c.dpr;c.pan.x+=(e.clientX-c.lastMouse.x)*l,c.pan.y+=(e.clientY-c.lastMouse.y)*l}else{const l=X(n,a),r=I(l.x,l.y);r!==c.hoveredNode?(c.hoveredNode=r,H(r?{x:e.clientX-t.left+14,y:e.clientY-t.top+14,node:r,connections:K(r.id,c.edges)}:null)):r&&v&&H(i=>i?{...i,x:e.clientX-t.left+14,y:e.clientY-t.top+14}:null)}c.lastMouse={x:e.clientX,y:e.clientY}},[X,I,K,v]),A=d.useCallback(()=>{const e=m.current,o=!e.moved&&e.pressNode!==null&&performance.now()-e.pressT<500,t=e.pressNode;e.dragNode=null,e.dragging=!1,e.pressNode=null,e.pressT=0,e.moved=!1,o&&t&&ce(t)},[ce]),V=d.useCallback(e=>{e.preventDefault();const o=m.current,t=e.deltaY>0?.92:1.08,n=Math.min(3,Math.max(.3,o.zoom*t)),a=n/o.zoom,c=p.current;if(!c)return;const l=c.getBoundingClientRect(),r=(e.clientX-l.left)*o.dpr,i=(e.clientY-l.top)*o.dpr;o.pan.x=r-(r-o.pan.x)*a,o.pan.y=i-(i-o.pan.y)*a,o.zoom=n},[]);d.useEffect(()=>{let e=!1;async function o(){u(!0);try{const t=await pe.brain.graph();if(e)return;const n=t.nodes||[],a=t.edges||[];q(n),B(a);const c=m.current;c.nodes=n,c.edges=a,Y();const l=p.current,r=l?l.width:800,i=l?l.height:600;ne(n,r,i),oe(n,a,r,i)}catch(t){console.error("Failed to load graph data:",t)}e||u(!1)}return o(),()=>{e=!0}},[ne,oe,Y]),d.useEffect(()=>{const e=p.current;if(!e||b)return;Y();let o=!0;const t=a=>{o&&(re(a),ae(a),m.current.animFrame=requestAnimationFrame(t))};m.current.animFrame=requestAnimationFrame(t),e.addEventListener("mousedown",U),e.addEventListener("mousemove",_),e.addEventListener("mouseup",A),e.addEventListener("mouseleave",A),e.addEventListener("wheel",V,{passive:!1});const n=()=>{Y()};return window.addEventListener("resize",n),()=>{o=!1,cancelAnimationFrame(m.current.animFrame),e.removeEventListener("mousedown",U),e.removeEventListener("mousemove",_),e.removeEventListener("mouseup",A),e.removeEventListener("mouseleave",A),e.removeEventListener("wheel",V),window.removeEventListener("resize",n)}},[b,Y,re,ae,U,_,A,V]);const le=F.length?[...new Set(F.map(e=>e.type))].sort():[];return s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx("div",{className:"flex items-center justify-between border-b border-border/50 bg-background/80 px-6 py-4 backdrop-blur-sm",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-[#00d4ff]/10",children:s.jsx(ge,{className:"h-5 w-5 text-[#00d4ff]"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Knowledge Graph"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Visualize connections in Mercury's memory"})]})]})}),s.jsxs("div",{ref:S,className:"relative flex-1",style:{minHeight:500},children:[b&&s.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/60 backdrop-blur-sm",children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx(me,{className:"h-8 w-8 animate-spin text-[#00d4ff]"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading knowledge graph..."})]})}),!b&&F.length===0&&s.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[s.jsx(ge,{className:"h-12 w-12 text-muted-foreground/40"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"No knowledge graph data available yet"})]})}),s.jsx("canvas",{ref:p,className:`absolute inset-0 h-full w-full ${v?"cursor-pointer":"cursor-grab"}`}),s.jsx("div",{className:"absolute right-4 top-4 z-10",children:s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/60 bg-background/90 px-3 py-1.5 shadow-lg backdrop-blur-sm",children:[s.jsx(Fe,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("input",{type:"text",placeholder:"Search nodes...",value:R,onChange:e=>O(e.target.value),className:"w-48 border-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground/60"})]})}),le.length>0&&s.jsxs("div",{className:"absolute bottom-4 left-4 z-10 rounded-lg border border-border/60 bg-background/90 px-3 py-2.5 shadow-lg backdrop-blur-sm",children:[s.jsx("p",{className:"mb-1.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Node Types"}),s.jsx("div",{className:"flex flex-col gap-1",children:le.map(e=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full",style:{backgroundColor:Q(e)}}),s.jsx("span",{className:"text-[11px] capitalize text-foreground/80",children:e})]},e))})]}),v&&s.jsxs("div",{className:"pointer-events-none absolute z-30 rounded-lg border border-border/60 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur-sm",style:{left:v.x,top:v.y,maxWidth:320,transform:S.current&&v.x+340>S.current.clientWidth?"translateX(calc(-100% - 28px))":void 0},children:[s.jsx("p",{className:"break-words text-sm font-medium leading-snug text-foreground",children:v.node.fullLabel||v.node.label}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full",style:{backgroundColor:Q(v.node.type)}}),s.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:v.node.type}),s.jsx("span",{className:"text-xs text-muted-foreground/60",children:"·"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[v.connections," connection",v.connections!==1?"s":""]})]}),s.jsx("p",{className:"mt-1.5 text-[10px] uppercase tracking-wider text-muted-foreground/70",children:"Click for details"})]})]}),s.jsx(Te,{open:be,onOpenChange:e=>{J(e),e||(m.current.selectedNode=null)},node:G,memory:ye,loading:Ne,error:je,connections:G?K(G.id,$):0})]})}function Z(p){if(!p)return"—";const S=typeof p=="number"?new Date(p):new Date(p);return Number.isNaN(S.getTime())?String(p):S.toLocaleString()}function Te({open:p,onOpenChange:S,node:b,memory:u,loading:F,error:q,connections:$}){if(!b)return null;const B=Q(b.type),R=b.fullLabel||b.label,O=(u==null?void 0:u.summary)||R,v=u==null?void 0:u.detail;return s.jsx(Ce,{open:p,onOpenChange:S,children:s.jsxs(Ee,{className:"max-w-2xl",children:[s.jsxs(ze,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"inline-block h-3 w-3 rounded-full",style:{backgroundColor:B}}),s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:b.type})]}),s.jsx(De,{className:"mt-1 break-words text-lg leading-snug",children:O})]}),F&&s.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-muted-foreground",children:[s.jsx(me,{className:"h-4 w-4 animate-spin"}),"Loading details…"]}),!F&&u&&s.jsxs("div",{className:"space-y-4",children:[v&&s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Detail"}),s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground/90",children:v})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs sm:grid-cols-3",children:[u.scope&&s.jsx(w,{label:"Scope",value:u.scope}),typeof u.importance=="number"&&s.jsx(w,{label:"Importance",value:u.importance.toFixed(2)}),typeof u.confidence=="number"&&s.jsx(w,{label:"Confidence",value:u.confidence.toFixed(2)}),typeof u.evidenceCount=="number"&&s.jsx(w,{label:"Evidence",value:String(u.evidenceCount)}),s.jsx(w,{label:"Connections",value:String($)}),u.evidenceKind&&s.jsx(w,{label:"Source",value:u.evidenceKind}),s.jsx(w,{label:"Created",value:Z(u.createdAt)}),u.updatedAt&&s.jsx(w,{label:"Updated",value:Z(u.updatedAt)}),u.lastSeenAt&&s.jsx(w,{label:"Last seen",value:Z(u.lastSeenAt)})]}),s.jsx("div",{className:"border-t border-border/40 pt-2",children:s.jsx("p",{className:"font-mono text-[10px] text-muted-foreground/70",children:u.id})})]}),!F&&!u&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground/90",children:R}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[s.jsx(w,{label:"Type",value:b.type}),s.jsx(w,{label:"Connections",value:String($)}),typeof b.importance=="number"&&s.jsx(w,{label:"Importance",value:b.importance.toFixed(2)}),typeof b.confidence=="number"&&s.jsx(w,{label:"Confidence",value:b.confidence.toFixed(2)})]}),q&&s.jsxs("p",{className:"text-xs text-muted-foreground/70",children:["Could not load full record: ",q]}),s.jsx("p",{className:"font-mono text-[10px] text-muted-foreground/70",children:b.id})]})]})})}function w({label:p,value:S}){return s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:p}),s.jsx("p",{className:"mt-0.5 break-words text-foreground/90",children:S})]})}export{Qe as GraphPage};
7
- //# sourceMappingURL=Graph-DnlOWkay.js.map
@@ -1,4 +1,4 @@
1
- import{j as e,m as Ke,A as Ve}from"./vendor-motion-Dwx3-JO5.js";import{r,j as Ps,e as Ls}from"./vendor-react-C7pctHW3.js";import{u as Es,a as es,D as Bs,c as Us,b as Ms,K as Rs,P as zs,S as cs,v as xs,d as Fs,C as Os}from"./vendor-dnd-DRBSMxXo.js";import{C as ss,c as ts,a as _s,b as Hs}from"./card-BdsEOP7t.js";import{B as j}from"./button-CNasMlFE.js";import{B as z}from"./badge-CUJiWF1y.js";import{I as ke}from"./input-CH3dmo9r.js";import{T as re}from"./textarea-CXh3tmJ1.js";import{D as be,a as ve,b as ye,c as we,d as We,e as Ge,f as Ze}from"./dialog-Bd1rELXb.js";import{A as Ce,h as Se,a as De,b as Ae,c as Te,d as Pe,e as Le,f as Ee,g as Be,T as Ue}from"./alert-dialog-MbYSbZx5.js";import{S as Fe,a as Oe,b as _e,c as He,d as q}from"./select-vRSgBrHz.js";import{j as qs,k as $s,l as ms,m as Is,n as us,D as hs,O as ps}from"./vendor-radix-3UdfCgs_.js";import{c as Ks}from"./index-CaqLZNof.js";import{e as I,X as qe,c as D,a as b,b as S,P as Je,t as $,h as ne,S as Vs,g as fs,M as Ws}from"./index-C3YiF4qv.js";import{C as Gs,a as Zs,b as Js}from"./collapsible-BU_K9n8f.js";import{A as as}from"./arrow-left-CtqQsBC6.js";import{P as gs}from"./pencil-gNDEMhav.js";import{P as js}from"./plus-7rbHkByr.js";import{L as ee}from"./loader-circle-DbYKk0_Q.js";import{S as Xs}from"./sparkles-DcP24GEL.js";import{Z as ns}from"./zap-BEfqVtvZ.js";import{G as ie}from"./git-branch-D9JVASpC.js";import{C as Ys}from"./circle-check-DvGSe1uZ.js";import{P as Qs,a as et}from"./power-BS7gCDWs.js";import{C as st}from"./chevron-down-CB9J_vvZ.js";import{S as Ns}from"./send-BkyTIUtJ.js";import{F as ze}from"./file-text-BWWBuD_N.js";import{E as tt}from"./eye-BJ0NucMz.js";import{D as at}from"./download-C8RvlFqO.js";import"./vendor-syntax-xZUI6Op9.js";/**
1
+ import{j as e,m as Ke,A as Ve}from"./vendor-motion-Dwx3-JO5.js";import{r,j as Ps,e as Ls}from"./vendor-react-C7pctHW3.js";import{u as Es,a as es,D as Bs,c as Us,b as Ms,K as Rs,P as zs,S as cs,v as xs,d as Fs,C as Os}from"./vendor-dnd-DRBSMxXo.js";import{C as ss,c as ts,a as _s,b as Hs}from"./card-CjAvp22k.js";import{B as j}from"./button-V3Fu7_kO.js";import{B as z}from"./badge-DpVeNL8j.js";import{I as ke}from"./input-CF6e2HL4.js";import{T as re}from"./textarea-BTxEQ_C2.js";import{D as be,a as ve,b as ye,c as we,d as We,e as Ge,f as Ze}from"./dialog-FHqlAspv.js";import{A as Ce,h as Se,a as De,b as Ae,c as Te,d as Pe,e as Le,f as Ee,g as Be,T as Ue}from"./alert-dialog-B3JUwsIN.js";import{S as Fe,a as Oe,b as _e,c as He,d as q}from"./select-Xy3UJnp-.js";import{j as qs,k as $s,l as ms,m as Is,n as us,D as hs,O as ps}from"./vendor-radix-3UdfCgs_.js";import{c as Ks}from"./index-CufYpqmV.js";import{e as I,X as qe,c as D,a as b,b as S,P as Je,t as $,h as ne,S as Vs,g as fs,M as Ws}from"./index-B1xAjISP.js";import{C as Gs,a as Zs,b as Js}from"./collapsible-BU_K9n8f.js";import{A as as}from"./arrow-left-CkDXNwR2.js";import{P as gs}from"./pencil-DGvW-dl_.js";import{P as js}from"./plus-DhHrgqcD.js";import{L as ee}from"./loader-circle-CJko6bz6.js";import{S as Xs}from"./sparkles-wNQvP7So.js";import{Z as ns}from"./zap-CK8xUBKc.js";import{G as ie}from"./git-branch-CYWJZoQx.js";import{C as Ys}from"./circle-check-Cch4Kwja.js";import{P as Qs,a as et}from"./power-BFKfrVvI.js";import{C as st}from"./chevron-down-C66c9kfo.js";import{S as Ns}from"./send-DHy23R-c.js";import{F as ze}from"./file-text-CDTjVG9h.js";import{E as tt}from"./eye-CxEb5_L8.js";import{D as at}from"./download-D73EX-Ki.js";import"./vendor-syntax-xZUI6Op9.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -42,4 +42,3 @@ import{j as e,m as Ke,A as Ve}from"./vendor-motion-Dwx3-JO5.js";import{r,j as Ps
42
42
  `),t=[];let h=!1,m=[];for(let u=0;u<l.length;u++){const i=l[u];if(i.startsWith("```")){h?(t.push(e.jsx("pre",{className:"rounded-md bg-muted p-3 text-[11px] font-mono overflow-x-auto my-2",children:e.jsx("code",{children:m.join(`
43
43
  `)})},u)),m=[],h=!1):(h=!0,i.slice(3).trim());continue}if(h){m.push(i);continue}i.startsWith("# ")?t.push(e.jsx("h1",{className:"text-lg font-bold mt-3 mb-1",children:K(i.slice(2))},u)):i.startsWith("## ")?t.push(e.jsx("h2",{className:"text-base font-semibold mt-2 mb-1",children:K(i.slice(3))},u)):i.startsWith("### ")?t.push(e.jsx("h3",{className:"text-sm font-semibold mt-2 mb-0.5",children:K(i.slice(4))},u)):i.startsWith("- ")||i.startsWith("* ")?t.push(e.jsx("li",{className:"ml-4 list-disc text-foreground/80",children:K(i.slice(2))},u)):/^\d+\.\s/.test(i)?t.push(e.jsx("li",{className:"ml-4 list-decimal text-foreground/80",children:K(i.replace(/^\d+\.\s/,""))},u)):i.startsWith("> ")?t.push(e.jsx("blockquote",{className:"border-l-2 border-[#00d4ff]/40 pl-3 text-muted-foreground italic my-1",children:K(i.slice(2))},u)):i.trim()===""?t.push(e.jsx("div",{className:"h-2"},u)):t.push(e.jsx("p",{className:"text-foreground/80 my-0.5",children:K(i)},u))}return h&&m.length>0&&t.push(e.jsx("pre",{className:"rounded-md bg-muted p-3 text-[11px] font-mono overflow-x-auto my-2",children:e.jsx("code",{children:m.join(`
44
44
  `)})},"unclosed")),e.jsx(e.Fragment,{children:t})}function K(s){const l=[];let t=s,h=0;for(;t.length>0;){const m=t.match(/^(.*?)`([^`]+)`/);if(m){m[1]&&l.push(e.jsx("span",{children:m[1]},h++)),l.push(e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-[10px] font-mono text-[#00d4ff]",children:m[2]},h++)),t=t.slice(m[0].length);continue}const u=t.match(/^(.*?)\*\*([^*]+)\*\*/);if(u){u[1]&&l.push(e.jsx("span",{children:u[1]},h++)),l.push(e.jsx("strong",{children:u[2]},h++)),t=t.slice(u[0].length);continue}l.push(e.jsx("span",{children:t},h++));break}return e.jsx(e.Fragment,{children:l})}export{la as KanbanPage};
45
- //# sourceMappingURL=Kanban-DRlNiNRF.js.map
@@ -1,2 +1 @@
1
- import{j as e}from"./vendor-motion-Dwx3-JO5.js";import{r as a}from"./vendor-react-C7pctHW3.js";import{I as c}from"./input-CH3dmo9r.js";import{B as g}from"./button-CNasMlFE.js";import{u as f,c as h,a as b}from"./index-C3YiF4qv.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CaqLZNof.js";import"./vendor-syntax-xZUI6Op9.js";function P(){const[n,m]=a.useState(""),[o,u]=a.useState(""),[l,r]=a.useState(""),[i,d]=a.useState(!1),x=f(s=>s.resolved);async function p(s){s.preventDefault(),r(""),d(!0);try{const t=await b.auth.login(n,o);if(t.type==="opaqueredirect"||t.status===0||t.ok||t.status===302){window.location.href="/";return}t.status===401?r("Invalid username or password."):r(`Login failed (${t.status}). Please try again.`)}catch{r("Unable to reach the server. Please try again.")}finally{d(!1)}}return e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center bg-background overflow-hidden",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse 60% 50% at 50% 40%, rgba(0,212,255,0.06) 0%, transparent 70%)"}}),e.jsxs("div",{className:"relative z-10 w-full max-w-sm px-4",children:[e.jsxs("div",{className:h("rounded-2xl border border-border bg-card p-8 shadow-lg","mercury-glow-sm"),children:[e.jsxs("div",{className:"mb-6 flex flex-col items-center gap-3",children:[e.jsx("img",{src:x==="dark"?"/logo-dark.png":"/logo-light.png",alt:"Mercury",className:"w-16 h-16"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome back"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign in to Mercury"})]}),e.jsxs("form",{onSubmit:p,className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"username",className:"text-xs font-medium text-muted-foreground",children:"Username"}),e.jsx(c,{id:"username",type:"text",autoComplete:"username",autoFocus:!0,required:!0,value:n,onChange:s=>m(s.target.value),placeholder:"Enter username"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"password",className:"text-xs font-medium text-muted-foreground",children:"Password"}),e.jsx(c,{id:"password",type:"password",autoComplete:"current-password",required:!0,value:o,onChange:s=>u(s.target.value),placeholder:"Enter password"})]}),l&&e.jsx("p",{className:"text-sm text-destructive leading-snug",children:l}),e.jsx(g,{type:"submit",size:"lg",disabled:i,className:"mt-1 w-full font-semibold",children:i?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Signing in…"]}):"Sign in"})]})]}),e.jsx("p",{className:"mt-6 text-center text-xs text-muted-foreground/60",children:"Mercury Agent Dashboard"})]})]})}export{P as LoginPage};
2
- //# sourceMappingURL=Login-BP5524pC.js.map
1
+ import{j as e}from"./vendor-motion-Dwx3-JO5.js";import{r as a}from"./vendor-react-C7pctHW3.js";import{I as c}from"./input-CF6e2HL4.js";import{B as g}from"./button-V3Fu7_kO.js";import{u as f,c as h,a as b}from"./index-B1xAjISP.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CufYpqmV.js";import"./vendor-syntax-xZUI6Op9.js";function P(){const[n,m]=a.useState(""),[o,u]=a.useState(""),[l,r]=a.useState(""),[i,d]=a.useState(!1),x=f(s=>s.resolved);async function p(s){s.preventDefault(),r(""),d(!0);try{const t=await b.auth.login(n,o);if(t.type==="opaqueredirect"||t.status===0||t.ok||t.status===302){window.location.href="/";return}t.status===401?r("Invalid username or password."):r(`Login failed (${t.status}). Please try again.`)}catch{r("Unable to reach the server. Please try again.")}finally{d(!1)}}return e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center bg-background overflow-hidden",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse 60% 50% at 50% 40%, rgba(0,212,255,0.06) 0%, transparent 70%)"}}),e.jsxs("div",{className:"relative z-10 w-full max-w-sm px-4",children:[e.jsxs("div",{className:h("rounded-2xl border border-border bg-card p-8 shadow-lg","mercury-glow-sm"),children:[e.jsxs("div",{className:"mb-6 flex flex-col items-center gap-3",children:[e.jsx("img",{src:x==="dark"?"/logo-dark.png":"/logo-light.png",alt:"Mercury",className:"w-16 h-16"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome back"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign in to Mercury"})]}),e.jsxs("form",{onSubmit:p,className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"username",className:"text-xs font-medium text-muted-foreground",children:"Username"}),e.jsx(c,{id:"username",type:"text",autoComplete:"username",autoFocus:!0,required:!0,value:n,onChange:s=>m(s.target.value),placeholder:"Enter username"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"password",className:"text-xs font-medium text-muted-foreground",children:"Password"}),e.jsx(c,{id:"password",type:"password",autoComplete:"current-password",required:!0,value:o,onChange:s=>u(s.target.value),placeholder:"Enter password"})]}),l&&e.jsx("p",{className:"text-sm text-destructive leading-snug",children:l}),e.jsx(g,{type:"submit",size:"lg",disabled:i,className:"mt-1 w-full font-semibold",children:i?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Signing in…"]}):"Sign in"})]})]}),e.jsx("p",{className:"mt-6 text-center text-xs text-muted-foreground/60",children:"Mercury Agent Dashboard"})]})]})}export{P as LoginPage};
@@ -0,0 +1,21 @@
1
+ import{e as g,q as w,c as x}from"./index-B1xAjISP.js";import{r as d}from"./vendor-react-C7pctHW3.js";import{j as t}from"./vendor-motion-Dwx3-JO5.js";import{a as v}from"./chevron-down-C66c9kfo.js";import{h as y}from"./vendor-syntax-xZUI6Op9.js";import{M as C,r as j}from"./vendor-markdown-DwTbvico.js";/**
2
+ * @license lucide-react v0.511.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const N=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],q=g("arrow-down",N);/**
7
+ * @license lucide-react v0.511.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const T=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],W=g("arrow-up",T);/**
12
+ * @license lucide-react v0.511.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const M=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],z=g("copy",M);/**
17
+ * @license lucide-react v0.511.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const R=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],J=g("folder",R),b="mercury-chat-active-thread";function E(){return typeof window>"u"?null:localStorage.getItem(b)}const f=w(o=>({messages:[],streamingText:"",isStreaming:!1,waiting:!1,threads:[],activeThreadId:E(),provider:"",model:"",totalSteps:0,completedSteps:0,currentStepTool:"",settings:null,addMessage:e=>o(i=>({messages:[...i.messages,e]})),updateLastAssistantMessage:e=>o(i=>{const l=[...i.messages];for(let a=l.length-1;a>=0;a--)if(l[a].role==="assistant"){l[a]={...l[a],content:e};break}return{messages:l}}),appendStreamingText:e=>o(i=>({streamingText:i.streamingText+e,isStreaming:!0})),clearStreaming:()=>o({streamingText:"",isStreaming:!1}),setStreaming:e=>o({isStreaming:e}),setWaiting:e=>o({waiting:e}),setThreads:e=>o({threads:e}),setActiveThread:e=>{e?localStorage.setItem(b,e):localStorage.removeItem(b),o({activeThreadId:e})},setProvider:e=>o({provider:e}),setModel:e=>o({model:e}),setSteps:(e,i,l)=>o({totalSteps:e,completedSteps:i,currentStepTool:l}),resetSteps:()=>o({totalSteps:0,completedSteps:0,currentStepTool:""}),setSettings:e=>o({settings:e}),clearMessages:()=>o({messages:[],streamingText:"",isStreaming:!1}),threadVersion:0,bumpThreadVersion:()=>o(e=>({threadVersion:e.threadVersion+1}))}));function U(){const[o,e]=d.useState(!1),[i,l]=d.useState(!1),a=d.useRef(null),h=d.useRef(null),r=f,p=f(m=>m.activeThreadId),u=d.useCallback(()=>{a.current&&a.current.close();const m=p?`?sessionId=${encodeURIComponent(p)}`:"",s=new EventSource(`/api/chat/events${m}`);a.current=s,s.onopen=()=>{e(!0),l(!1)},s.onerror=()=>{e(!1),s.close(),a.current=null,l(!0),h.current=setTimeout(()=>{u()},3e3)},s.addEventListener("connected",c=>{try{const n=JSON.parse(c.data);r.getState().setProvider(n.provider??""),r.getState().setModel(n.model??"")}catch{}}),s.addEventListener("thinking",()=>{r.getState().setWaiting(!0)}),s.addEventListener("provider",c=>{try{const n=JSON.parse(c.data);r.getState().setProvider(n.provider??""),r.getState().setModel(n.model??"")}catch{}}),s.addEventListener("step_start",c=>{try{const n=JSON.parse(c.data);r.getState().setSteps(n.totalSteps??0,n.stepNumber??0,n.tool??"")}catch{}}),s.addEventListener("step_done",c=>{try{const n=JSON.parse(c.data);r.getState().setSteps(n.totalSteps??0,n.stepNumber??0,n.tool??"")}catch{}}),s.addEventListener("text_delta",c=>{try{const n=JSON.parse(c.data);r.getState().setWaiting(!1),r.getState().appendStreamingText(n.text??"")}catch{}}),s.addEventListener("text_done",c=>{try{const n=c.data,k=JSON.parse(n),S=k.fullText??k.text??n;r.getState().clearStreaming(),r.getState().setWaiting(!1),r.getState().resetSteps(),r.getState().addMessage({id:crypto.randomUUID(),role:"assistant",content:S,timestamp:new Date().toISOString()}),r.getState().bumpThreadVersion()}catch{r.getState().clearStreaming(),r.getState().setWaiting(!1),r.getState().resetSteps()}}),s.addEventListener("permission_request",c=>{try{const n=JSON.parse(c.data);r.getState().addMessage({id:n.id??crypto.randomUUID(),role:"system",content:JSON.stringify(n),timestamp:new Date().toISOString()})}catch{}}),s.addEventListener("permission_continue",()=>{}),s.addEventListener("permission_mode",()=>{}),s.addEventListener("loop_warning",()=>{}),s.addEventListener("error",c=>{const n=c.data??"An error occurred";r.getState().setWaiting(!1),r.getState().clearStreaming(),r.getState().resetSteps(),r.getState().addMessage({id:crypto.randomUUID(),role:"system",content:n,timestamp:new Date().toISOString()})})},[r,p]);return d.useEffect(()=>(u(),()=>{h.current&&clearTimeout(h.current),a.current&&(a.current.close(),a.current=null)}),[u]),{connected:o,reconnecting:i}}const L={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};function _({code:o,language:e}){const[i,l]=d.useState(!1),a=d.useCallback(()=>{navigator.clipboard.writeText(o),l(!0),setTimeout(()=>l(!1),2e3)},[o]),h=e||"text";return t.jsxs("div",{className:"group relative my-3 overflow-hidden rounded-lg border border-border bg-[#282c34]",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 px-4 py-1.5 text-xs",children:[t.jsx("span",{className:"font-mono text-muted-foreground",children:h}),t.jsx("button",{onClick:a,className:x("inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors","text-muted-foreground hover:bg-white/10 hover:text-foreground"),children:i?t.jsxs(t.Fragment,{children:[t.jsx(v,{className:"h-3.5 w-3.5 text-emerald-400"}),t.jsx("span",{className:"text-emerald-400",children:"Copied!"})]}):t.jsxs(t.Fragment,{children:[t.jsx(z,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:"Copy"})]})})]}),t.jsx(y,{language:e||"text",style:L,customStyle:{margin:0,padding:"1rem",background:"transparent",fontSize:"0.8125rem",lineHeight:"1.6"},showLineNumbers:!1,wrapLongLines:!1,children:o})]})}const I={code({className:o,children:e,...i}){const l=/language-(\w+)/.exec(o||""),a=String(e).replace(/\n$/,"");return l?t.jsx(_,{code:a,language:l[1]}):t.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[0.8125rem] text-foreground",...i,children:e})},pre({children:o}){return t.jsx(t.Fragment,{children:o})},a({href:o,children:e,...i}){return t.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-mercury-500 underline decoration-mercury-500/40 underline-offset-2 transition-colors hover:text-mercury-400 hover:decoration-mercury-400",...i,children:e})},h1({children:o,...e}){return t.jsx("h1",{className:"mb-2 mt-4 text-lg font-semibold tracking-tight",...e,children:o})},h2({children:o,...e}){return t.jsx("h2",{className:"mb-2 mt-3 text-base font-semibold tracking-tight",...e,children:o})},h3({children:o,...e}){return t.jsx("h3",{className:"mb-1.5 mt-2.5 text-sm font-semibold",...e,children:o})},p({children:o,...e}){return t.jsx("p",{className:"mb-2 leading-relaxed last:mb-0",...e,children:o})},ul({children:o,...e}){return t.jsx("ul",{className:"mb-2 ml-4 list-disc space-y-1 last:mb-0",...e,children:o})},ol({children:o,...e}){return t.jsx("ol",{className:"mb-2 ml-4 list-decimal space-y-1 last:mb-0",...e,children:o})},li({children:o,...e}){return t.jsx("li",{className:"leading-relaxed",...e,children:o})},blockquote({children:o,...e}){return t.jsx("blockquote",{className:"my-2 border-l-2 border-mercury-500/50 pl-3 italic text-muted-foreground",...e,children:o})},table({children:o,...e}){return t.jsx("div",{className:"my-3 overflow-x-auto rounded-lg border border-border",children:t.jsx("table",{className:"w-full text-sm",...e,children:o})})},thead({children:o,...e}){return t.jsx("thead",{className:"border-b border-border bg-muted/50",...e,children:o})},tr({children:o,...e}){return t.jsx("tr",{className:"border-b border-border/50 transition-colors hover:bg-muted/30",...e,children:o})},th({children:o,...e}){return t.jsx("th",{className:"px-3 py-2 text-left font-medium",...e,children:o})},td({children:o,...e}){return t.jsx("td",{className:"px-3 py-2",...e,children:o})},hr(){return t.jsx("hr",{className:"my-4 border-border"})}};function $({content:o,className:e}){return t.jsx("div",{className:x("text-sm",e),children:t.jsx(C,{remarkPlugins:[j],components:I,children:o})})}export{W as A,z as C,J as F,$ as M,U as a,q as b,L as o,f as u};
@@ -1,4 +1,4 @@
1
- import{j as e,m as S,A as _}from"./vendor-motion-Dwx3-JO5.js";import{r as a}from"./vendor-react-C7pctHW3.js";import{C as O,c as B}from"./card-BdsEOP7t.js";import{B as w}from"./button-CNasMlFE.js";import{I as k}from"./input-CH3dmo9r.js";import{B as R}from"./badge-CUJiWF1y.js";import{T as ie}from"./textarea-CXh3tmJ1.js";import{D as re,a as le,b as ce,c as oe,d as de,e as me}from"./dialog-Bd1rELXb.js";import{S as ke,a as Te,b as Ee,c as Le,d as ze}from"./select-vRSgBrHz.js";import{A as Fe,h as Oe,T as Be,a as Ie,b as Pe,c as _e,d as Re,e as qe,f as Ve,g as He}from"./alert-dialog-MbYSbZx5.js";import{e as ue,a as v,B as se,c as C,j as Y,g as Ue,h as Z,C as Ye}from"./index-C3YiF4qv.js";import{P as Ze}from"./plus-7rbHkByr.js";import{S as Ge}from"./search-BZsbhO0B.js";import{C as xe}from"./circle-x-CyaGJ_BM.js";import{L as q}from"./loader-circle-DbYKk0_Q.js";import{C as G}from"./chevron-down-CB9J_vvZ.js";import{P as Qe}from"./pencil-gNDEMhav.js";import{C as We}from"./circle-check-DvGSe1uZ.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CaqLZNof.js";import"./vendor-syntax-xZUI6Op9.js";/**
1
+ import{j as e,m as S,A as _}from"./vendor-motion-Dwx3-JO5.js";import{r as a}from"./vendor-react-C7pctHW3.js";import{C as O,c as B}from"./card-CjAvp22k.js";import{B as w}from"./button-V3Fu7_kO.js";import{I as k}from"./input-CF6e2HL4.js";import{B as R}from"./badge-DpVeNL8j.js";import{T as ie}from"./textarea-BTxEQ_C2.js";import{D as re,a as le,b as ce,c as oe,d as de,e as me}from"./dialog-FHqlAspv.js";import{S as ke,a as Te,b as Ee,c as Le,d as ze}from"./select-Xy3UJnp-.js";import{A as Fe,h as Oe,T as Be,a as Ie,b as Pe,c as _e,d as Re,e as qe,f as Ve,g as He}from"./alert-dialog-B3JUwsIN.js";import{e as ue,a as v,B as se,c as C,j as Y,g as Ue,h as Z,C as Ye}from"./index-B1xAjISP.js";import{P as Ze}from"./plus-DhHrgqcD.js";import{S as Ge}from"./search-BwE8vRR_.js";import{C as xe}from"./circle-x-DK0DQPGB.js";import{L as q}from"./loader-circle-CJko6bz6.js";import{C as G}from"./chevron-down-C66c9kfo.js";import{P as Qe}from"./pencil-DGvW-dl_.js";import{C as We}from"./circle-check-Cch4Kwja.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CufYpqmV.js";import"./vendor-syntax-xZUI6Op9.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -9,4 +9,3 @@ import{j as e,m as S,A as _}from"./vendor-motion-Dwx3-JO5.js";import{r as a}from
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
11
  */const Je=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Ke=ue("pin",Je),he=["identity","preference","goal","project","habit","decision","constraint","relationship","episode","reflection"],pe={identity:"bg-blue-500/15 text-blue-400",preference:"bg-purple-500/15 text-purple-400",goal:"bg-amber-500/15 text-amber-400",project:"bg-cyan-500/15 text-cyan-400",habit:"bg-emerald-500/15 text-emerald-400",decision:"bg-indigo-500/15 text-indigo-400",constraint:"bg-red-500/15 text-red-400",relationship:"bg-pink-500/15 text-pink-400",episode:"bg-orange-500/15 text-orange-400",reflection:"bg-teal-500/15 text-teal-400"},P=30,es={hidden:{opacity:0,y:12},visible:s=>({opacity:1,y:0,transition:{delay:s*.03,duration:.25,ease:"easeOut"}}),exit:{opacity:0,y:-8,transition:{duration:.15}}},te={visible:{transition:{staggerChildren:.03}}};function ss({toasts:s}){return e.jsx("div",{className:"fixed bottom-6 right-6 z-50 flex flex-col gap-2",children:e.jsx(_,{children:s.map(c=>e.jsxs(S.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:40},className:C("flex items-center gap-2 rounded-lg border px-4 py-3 text-sm shadow-lg backdrop-blur-sm",c.type==="success"?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-destructive/30 bg-destructive/10 text-destructive"),children:[c.type==="success"?e.jsx(We,{className:"h-4 w-4"}):e.jsx(xe,{className:"h-4 w-4"}),c.message]},c.id))})})}function z({className:s}){return e.jsx("div",{className:C("animate-pulse rounded-lg bg-muted",s)})}function ts(){return e.jsx(O,{children:e.jsxs(B,{className:"p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(z,{className:"h-5 w-20 rounded-md"}),e.jsx(z,{className:"h-4 w-full"})]}),e.jsx(z,{className:"h-3 w-3/4"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(z,{className:"h-3 w-16"}),e.jsx(z,{className:"h-3 w-16"}),e.jsx(z,{className:"h-3 w-20"})]})]})})}function as({value:s}){const c=Math.round(s*10);return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground/70 shrink-0",children:"Imp"}),e.jsx("div",{className:"flex gap-0.5",children:Array.from({length:10}).map((u,d)=>e.jsx("div",{className:C("h-1.5 w-1.5 rounded-full transition-colors",d<c?"bg-[#00d4ff]":"bg-muted-foreground/15")},d))})]})}function ns({scope:s}){return s==="durable"?e.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-amber-400/80",title:"Durable memory",children:e.jsx(Ke,{className:"h-3 w-3"})}):s==="subconscious"?e.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-violet-400/80",title:"Subconscious memory",children:e.jsx(Y,{className:"h-3 w-3"})}):e.jsx("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground/50",title:"Active memory",children:e.jsx(Ye,{className:"h-3 w-3"})})}function ae({memory:s,onDelete:c,onEdit:u,index:d,showLastSeen:h}){const[m,o]=a.useState(!1),f=s.lastSeenAt?Math.round((Date.now()-new Date(s.lastSeenAt).getTime())/(1e3*60*60*24)):null;return e.jsx(S.div,{custom:d,variants:es,initial:"hidden",animate:"visible",exit:"exit",layout:!0,children:e.jsx(O,{className:"group transition-colors hover:border-[#00d4ff]/20",children:e.jsx(B,{className:"p-5",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("span",{className:C("inline-flex shrink-0 items-center rounded-md px-2 py-0.5 text-xs font-semibold capitalize",pe[s.type]??"bg-muted text-muted-foreground"),children:s.type}),e.jsx(ns,{scope:s.scope}),e.jsx("p",{className:"text-sm font-medium text-foreground leading-relaxed",children:s.summary})]}),s.detail&&e.jsxs("button",{onClick:()=>o(!m),className:"w-full text-left",children:[e.jsx("p",{className:C("text-sm text-muted-foreground leading-relaxed transition-all",!m&&"line-clamp-2"),children:s.detail}),s.detail.length>120&&e.jsx("span",{className:"text-xs text-[#00d4ff]/70 hover:text-[#00d4ff] mt-0.5 inline-block",children:m?"Show less":"Show more"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 pt-1",children:[s.importance!=null&&e.jsx(as,{value:s.importance}),s.confidence!=null&&e.jsxs("span",{className:"text-xs text-muted-foreground/70",children:[Math.round(s.confidence*100),"% conf"]}),s.evidenceCount!=null&&s.evidenceCount>1&&e.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["Seen ",s.evidenceCount,"x"]}),h&&f!=null&&e.jsxs("span",{className:"text-xs text-violet-400/70",children:["Last seen: ",f,"d ago"]}),e.jsx("span",{className:"text-xs text-muted-foreground/50",children:Z(s.createdAt)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[e.jsx(w,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-[#00d4ff]",onClick:()=>u(s),children:e.jsx(Qe,{className:"h-3.5 w-3.5"})}),e.jsxs(Fe,{children:[e.jsx(Oe,{asChild:!0,children:e.jsx(w,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-destructive",children:e.jsx(Be,{className:"h-3.5 w-3.5"})})}),e.jsxs(Ie,{children:[e.jsxs(Pe,{children:[e.jsx(_e,{children:"Delete Memory"}),e.jsx(Re,{children:"Are you sure you want to delete this memory? This action cannot be undone."})]}),e.jsxs(qe,{children:[e.jsx(Ve,{children:"Cancel"}),e.jsx(He,{onClick:()=>c(s.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})})})})}function is({memory:s,open:c,onOpenChange:u,onSave:d,saving:h}){const[m,o]=a.useState(""),[f,p]=a.useState(""),[M,b]=a.useState("0.8"),[y,N]=a.useState("0.7");a.useEffect(()=>{s&&(o(s.summary),p(s.detail||""),b(String(s.confidence??.8)),N(String(s.importance??.7)))},[s]);const D=x=>{x.preventDefault(),!(!s||!m.trim())&&d(s.id,{summary:m.trim(),detail:f.trim()||void 0,confidence:parseFloat(M),importance:parseFloat(y)})};if(!s)return null;const A=s.lastSeenAt?Math.round((Date.now()-new Date(s.lastSeenAt).getTime())/(1e3*60*60*24)):null;return e.jsx(re,{open:c,onOpenChange:u,children:e.jsxs(le,{className:"sm:max-w-md",children:[e.jsxs(ce,{children:[e.jsx(oe,{children:"Edit Memory"}),e.jsx(de,{children:"Update this memory entry."})]}),e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:C("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold capitalize",pe[s.type]??"bg-muted text-muted-foreground"),children:s.type}),e.jsx(R,{variant:"secondary",className:"text-xs capitalize",children:s.scope}),A!=null&&s.scope==="subconscious"&&e.jsxs("span",{className:"text-xs text-violet-400/70",children:["Last seen ",A,"d ago"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Summary ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(k,{value:m,onChange:x=>o(x.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Detail"}),e.jsx(ie,{value:f,onChange:x=>p(x.target.value),rows:3})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Confidence (0-1)"}),e.jsx(k,{type:"number",min:"0",max:"1",step:"0.05",value:M,onChange:x=>b(x.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Importance (0-1)"}),e.jsx(k,{type:"number",min:"0",max:"1",step:"0.05",value:y,onChange:x=>N(x.target.value)})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground/60",children:[e.jsxs("span",{children:["Created: ",Z(s.createdAt)]}),s.updatedAt&&e.jsxs("span",{children:["Updated: ",Z(s.updatedAt)]})]}),e.jsx(me,{children:e.jsx(w,{type:"submit",disabled:h||!m.trim(),children:h?e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})})]})]})})}function rs({open:s,onOpenChange:c,onSubmit:u,submitting:d}){const[h,m]=a.useState("preference"),[o,f]=a.useState(""),[p,M]=a.useState(""),[b,y]=a.useState("0.8"),[N,D]=a.useState("0.7"),A=l=>{l.preventDefault(),o.trim()&&u({type:h,summary:o.trim(),detail:p.trim()||void 0,confidence:parseFloat(b),importance:parseFloat(N),durability:"0.8"})},x=()=>{m("preference"),f(""),M(""),y("0.8"),D("0.7")};return e.jsx(re,{open:s,onOpenChange:l=>{l||x(),c(l)},children:e.jsxs(le,{className:"sm:max-w-md",children:[e.jsxs(ce,{children:[e.jsx(oe,{children:"Add Memory"}),e.jsx(de,{children:"Create a new memory entry in the Second Brain."})]}),e.jsxs("form",{onSubmit:A,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Type"}),e.jsxs(ke,{value:h,onValueChange:m,children:[e.jsx(Te,{children:e.jsx(Ee,{})}),e.jsx(Le,{children:he.map(l=>e.jsx(ze,{value:l,className:"capitalize",children:l},l))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Summary ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(k,{placeholder:"What should Mercury remember?",value:o,onChange:l=>f(l.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Detail"}),e.jsx(ie,{placeholder:"Additional context or details...",value:p,onChange:l=>M(l.target.value),rows:3})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Confidence (0-1)"}),e.jsx(k,{type:"number",min:"0",max:"1",step:"0.05",value:b,onChange:l=>y(l.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Importance (0-1)"}),e.jsx(k,{type:"number",min:"0",max:"1",step:"0.05",value:N,onChange:l=>D(l.target.value)})]})]}),e.jsx(me,{children:e.jsx(w,{type:"submit",disabled:d||!o.trim(),children:d?e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):"Add Memory"})})]})]})})}function ne({title:s,icon:c,count:u,defaultOpen:d,children:h,actions:m}){const[o,f]=a.useState(d);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:()=>f(!o),className:"flex items-center gap-2 w-full text-left group",children:[o?e.jsx(G,{className:"h-4 w-4 text-muted-foreground transition-transform"}):e.jsx(Ue,{className:"h-4 w-4 text-muted-foreground transition-transform"}),e.jsxs("span",{className:"flex items-center gap-2",children:[c,e.jsx("span",{className:"text-sm font-semibold text-foreground",children:s})]}),e.jsx(R,{variant:"secondary",className:"tabular-nums text-xs",children:u}),m&&e.jsx("div",{className:"ml-auto",onClick:p=>p.stopPropagation(),children:m})]}),e.jsx(_,{children:o&&e.jsx(S.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"overflow-hidden",children:h})})]})}function As(){const[s,c]=a.useState([]),[u,d]=a.useState([]),[h,m]=a.useState(0),[o,f]=a.useState(0),[p,M]=a.useState(null),[b,y]=a.useState(!0),[N,D]=a.useState(!1),[A,x]=a.useState(!1),[l,Q]=a.useState(null),[j,fe]=a.useState(""),[T,ge]=a.useState(new Set),[je,V]=a.useState(!1),[be,W]=a.useState(!1),[ye,X]=a.useState(null),[Ne,H]=a.useState(!1),[ve,$]=a.useState(!1),[Se,J]=a.useState([]),U=a.useRef(),E=a.useCallback((t,n)=>{const i=Date.now();J(r=>[...r,{id:i,type:t,message:n}]),setTimeout(()=>{J(r=>r.filter(g=>g.id!==i))},3500)},[]),I=a.useCallback(async()=>{try{const t=await v.brain.status();M(t)}catch{}},[]),L=a.useCallback(async(t,n=0,i=!1)=>{try{if(i||y(!0),Q(null),t==="conscious"||t==="both"){i&&D(!0);let r;if(j.trim())r=await v.brain.memory.list({limit:P,offset:t==="conscious"?n:0,q:j.trim(),scope:"conscious"});else{const F=T.size===1?Array.from(T)[0]:void 0;r=await v.brain.memory.list({limit:P,offset:t==="conscious"?n:0,type:F,scope:"conscious"})}let g=r.memories;T.size>1&&!j.trim()&&(g=g.filter(F=>T.has(F.type))),c(i&&t==="conscious"?F=>[...F,...g]:g),m(r.total),D(!1)}if(t==="subconscious"||t==="both"){i&&x(!0);let r;j.trim()?r=await v.brain.memory.list({limit:P,offset:t==="subconscious"?n:0,q:j.trim(),scope:"subconscious"}):r=await v.brain.memory.list({limit:P,offset:t==="subconscious"?n:0,scope:"subconscious"}),d(i&&t==="subconscious"?g=>[...g,...r.memories]:r.memories),f(r.total),x(!1)}}catch(r){Q(r instanceof Error?r.message:"Failed to load memories")}finally{y(!1)}},[j,T]);a.useEffect(()=>{I()},[I]),a.useEffect(()=>(clearTimeout(U.current),U.current=setTimeout(()=>{L("both",0,!1)},300),()=>clearTimeout(U.current)),[L]);const we=t=>{ge(n=>{const i=new Set(n);return i.has(t)?i.delete(t):i.add(t),i})},Ce=async t=>{W(!0);try{await v.brain.memory.create(t),E("success","Memory created"),V(!1),L("both",0,!1),I()}catch(n){E("error",n instanceof Error?n.message:"Failed to create")}finally{W(!1)}},K=async t=>{try{await v.brain.memory.delete(t),c(n=>n.filter(i=>i.id!==t)),d(n=>n.filter(i=>i.id!==t)),E("success","Memory deleted"),I()}catch(n){E("error",n instanceof Error?n.message:"Failed to delete")}},ee=t=>{X(t),H(!0)},Me=async(t,n)=>{$(!0);try{await v.brain.memory.update(t,n),E("success","Memory updated"),H(!1),X(null);const i=r=>r.map(g=>g.id===t?{...g,...n}:g);c(i),d(i)}catch(i){E("error",i instanceof Error?i.message:"Failed to update")}finally{$(!1)}},De=s.length<h,Ae=u.length<o;return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs(S.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.3},className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-[#00d4ff]/10",children:e.jsx(se,{className:"h-5 w-5 text-[#00d4ff]"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Memory"}),p&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(R,{variant:"secondary",className:"tabular-nums",children:[p.total," conscious"]}),e.jsxs(R,{variant:"secondary",className:"tabular-nums text-violet-400",children:[p.subconsciousTotal??0," subconscious"]})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse and manage Mercury's knowledge"})]})]}),e.jsxs(w,{onClick:()=>V(!0),children:[e.jsx(Ze,{className:"h-4 w-4"}),"Add Memory"]})]}),e.jsxs(S.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.05,duration:.3},className:"relative",children:[e.jsx(Ge,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(k,{placeholder:"Search across all memories...",value:j,onChange:t=>fe(t.target.value),className:"pl-9"})]}),p&&e.jsx(S.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.1,duration:.3},className:"flex flex-wrap gap-2",children:he.map(t=>{var r;const n=((r=p.byType)==null?void 0:r[t])??0,i=T.has(t);return e.jsxs("button",{onClick:()=>we(t),className:C("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium capitalize transition-all",i?"border-[#00d4ff]/40 bg-[#00d4ff]/10 text-[#00d4ff]":"border-border bg-secondary/50 text-muted-foreground hover:border-border hover:bg-secondary"),children:[t,n>0&&e.jsx("span",{className:C("tabular-nums",i?"text-[#00d4ff]/70":"text-muted-foreground/50"),children:n})]},t)})}),l&&e.jsx(O,{className:"border-destructive/30",children:e.jsxs(B,{className:"flex items-center gap-3 p-4 text-sm text-destructive",children:[e.jsx(xe,{className:"h-4 w-4 shrink-0"}),l,e.jsx(w,{size:"sm",variant:"outline",className:"ml-auto",onClick:()=>L("both",0,!1),children:"Retry"})]})}),b&&e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((t,n)=>e.jsx(ts,{},n))}),!b&&!l&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(ne,{title:"Conscious",icon:e.jsx(se,{className:"h-4 w-4 text-[#00d4ff]"}),count:h,defaultOpen:!0,children:s.length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsx(S.div,{className:"space-y-3",variants:te,initial:"hidden",animate:"visible",children:e.jsx(_,{mode:"popLayout",children:s.map((t,n)=>e.jsx(ae,{memory:t,onDelete:K,onEdit:ee,index:n},t.id))})}),De&&e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(w,{variant:"outline",onClick:()=>L("conscious",s.length,!0),disabled:N,children:N?e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"h-4 w-4"}),"Load More (",s.length," / ",h,")"]})})})]}):e.jsx(O,{children:e.jsxs(B,{className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-muted mb-3",children:e.jsx($e,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j.trim()?"No conscious memories match your search.":"No conscious memories yet. Start a conversation or add one manually."})]})})}),e.jsx(ne,{title:"Subconscious",icon:e.jsx(Y,{className:"h-4 w-4 text-violet-400"}),count:o,defaultOpen:!1,children:u.length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground/70 px-1",children:"Dormant memories not referenced in 30+ days. Automatically recalled when relevant."}),e.jsx(S.div,{className:"space-y-3",variants:te,initial:"hidden",animate:"visible",children:e.jsx(_,{mode:"popLayout",children:u.map((t,n)=>e.jsx(ae,{memory:t,onDelete:K,onEdit:ee,index:n,showLastSeen:!0},t.id))})}),Ae&&e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(w,{variant:"outline",onClick:()=>L("subconscious",u.length,!0),disabled:A,children:A?e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"h-4 w-4"}),"Load More (",u.length," / ",o,")"]})})})]}):e.jsx(O,{children:e.jsxs(B,{className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-muted mb-3",children:e.jsx(Y,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:j.trim()?"No subconscious memories match your search.":"No subconscious memories yet. Memories move here after 30 days of not being referenced."})]})})})]}),e.jsx(rs,{open:je,onOpenChange:V,onSubmit:Ce,submitting:be}),e.jsx(is,{memory:ye,open:Ne,onOpenChange:H,onSave:Me,saving:ve}),e.jsx(ss,{toasts:Se})]})}export{As as MemoryPage};
12
- //# sourceMappingURL=Memory-BOQEY0H8.js.map
@@ -1,4 +1,4 @@
1
- import{j as e,m,A as O}from"./vendor-motion-Dwx3-JO5.js";import{r as c}from"./vendor-react-C7pctHW3.js";import{C as h,c as u,a as P,b as H,d as I}from"./card-BdsEOP7t.js";import{B as L}from"./button-CNasMlFE.js";import{S as R}from"./switch-LRN9wWy2.js";import{e as f,a as S,l as A,c as y}from"./index-C3YiF4qv.js";import{G as z}from"./git-branch-D9JVASpC.js";import{T as D}from"./terminal-CWG62zdD.js";import{L as G}from"./loader-circle-DbYKk0_Q.js";import{C as V}from"./circle-check-DvGSe1uZ.js";import{C as U}from"./circle-x-CyaGJ_BM.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CaqLZNof.js";import"./vendor-syntax-xZUI6Op9.js";/**
1
+ import{j as e,m,A as O}from"./vendor-motion-Dwx3-JO5.js";import{r as c}from"./vendor-react-C7pctHW3.js";import{C as h,c as u,a as P,b as H,d as I}from"./card-CjAvp22k.js";import{B as L}from"./button-V3Fu7_kO.js";import{S as R}from"./switch-CGgMESDf.js";import{e as f,a as S,l as A,c as y}from"./index-B1xAjISP.js";import{G as z}from"./git-branch-CYWJZoQx.js";import{T as D}from"./terminal-BvZc6N0C.js";import{L as G}from"./loader-circle-CJko6bz6.js";import{C as V}from"./circle-check-Cch4Kwja.js";import{C as U}from"./circle-x-DK0DQPGB.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CufYpqmV.js";import"./vendor-syntax-xZUI6Op9.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -14,4 +14,3 @@ import{j as e,m,A as O}from"./vendor-motion-Dwx3-JO5.js";import{r as c}from"./ve
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
16
  */const q=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Q=f("save",q),Z={hidden:{opacity:0,y:12},visible:a=>({opacity:1,y:0,transition:{delay:a*.08,duration:.35,ease:"easeOut"}})},K={filesystem:{icon:W,label:"Filesystem",description:"Access to read, write, and manage files on the local system",permissions:{read:{label:"Read Files",description:"Read file contents and directory listings"},write:{label:"Write Files",description:"Create and modify files on disk"},delete:{label:"Delete Files",description:"Remove files and directories permanently"}}},shell:{icon:D,label:"Shell",description:"Execute commands in the system shell",permissions:{execute:{label:"Execute Commands",description:"Run shell commands and scripts"}}},git:{icon:z,label:"Git",description:"Version control operations on repositories",permissions:{commit:{label:"Commit",description:"Create commits in repositories"},push:{label:"Push",description:"Push commits to remote repositories"},pull:{label:"Pull",description:"Pull changes from remote repositories"}}}};function ee({toasts:a}){return e.jsx("div",{className:"fixed bottom-6 right-6 z-50 flex flex-col gap-2",children:e.jsx(O,{children:a.map(n=>e.jsxs(m.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:40},className:y("flex items-center gap-2 rounded-lg border px-4 py-3 text-sm shadow-lg backdrop-blur-sm",n.type==="success"?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-destructive/30 bg-destructive/10 text-destructive"),children:[n.type==="success"?e.jsx(V,{className:"h-4 w-4"}):e.jsx(U,{className:"h-4 w-4"}),n.message]},n.id))})})}function d({className:a}){return e.jsx("div",{className:y("animate-pulse rounded-lg bg-muted",a)})}function se(){return e.jsxs(h,{children:[e.jsxs(P,{children:[e.jsx(d,{className:"h-5 w-28"}),e.jsx(d,{className:"h-4 w-64 mt-1"})]}),e.jsx(u,{className:"space-y-4",children:Array.from({length:3}).map((a,n)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"h-4 w-24"}),e.jsx(d,{className:"h-3 w-48"})]}),e.jsx(d,{className:"h-5 w-9 rounded-full"})]},n))})]})}function fe(){const[a,n]=c.useState({}),[j,b]=c.useState({}),[T,E]=c.useState(!0),[g,v]=c.useState(!1),[F,N]=c.useState([]),p=c.useCallback((s,t)=>{const r=Date.now();N(i=>[...i,{id:r,type:s,message:t}]),setTimeout(()=>{N(i=>i.filter(x=>x.id!==r))},3500)},[]),C=c.useCallback(async()=>{try{const t=(await S.permissions.get()).manifest.capabilities;n(structuredClone(t)),b(structuredClone(t))}catch(s){p("error",s instanceof Error?s.message:"Failed to load permissions")}finally{E(!1)}},[p]);c.useEffect(()=>{C()},[C]);const k=c.useMemo(()=>JSON.stringify(a)!==JSON.stringify(j),[a,j]),_=(s,t,r)=>{n(i=>({...i,[s]:{...i[s],[t]:r}}))},M=async()=>{v(!0);try{const s=await S.permissions.update(a);if(s.success){const t=s.manifest.capabilities;n(structuredClone(t)),b(structuredClone(t)),p("success","Permissions updated successfully")}}catch(s){p("error",s instanceof Error?s.message:"Failed to save permissions")}finally{v(!1)}},w=c.useMemo(()=>{const s=[];for(const[t,r]of Object.entries(a)){const i=K[t],$=Object.entries(typeof r=="object"&&r!==null?r:{}).map(([o,B])=>{const l=i==null?void 0:i.permissions[o];return{key:o,label:(l==null?void 0:l.label)??o.charAt(0).toUpperCase()+o.slice(1),description:(l==null?void 0:l.description)??`${o} permission`,value:!!B}});s.push({key:t,icon:(i==null?void 0:i.icon)??Y,label:(i==null?void 0:i.label)??t.charAt(0).toUpperCase()+t.slice(1),description:(i==null?void 0:i.description)??`Manage ${t} permissions`,permissions:$})}return s},[a]);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx(m.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},transition:{duration:.3},className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-[#00d4ff]/10",children:e.jsx(A,{className:"h-5 w-5 text-[#00d4ff]"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Permissions"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control what Mercury can access"})]})]})}),T?e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((s,t)=>e.jsx(se,{},t))}):w.length===0?e.jsx(m.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:e.jsx(h,{children:e.jsxs(u,{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-muted mb-4",children:e.jsx(A,{className:"h-7 w-7 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-1",children:"No permissions configured"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:"The permission manifest is empty. Capabilities will appear here once configured."})]})})}):e.jsxs("div",{className:"space-y-4",children:[w.map((s,t)=>{const r=s.icon;return e.jsx(m.div,{custom:t,variants:Z,initial:"hidden",animate:"visible",children:e.jsxs(h,{children:[e.jsx(P,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md bg-muted",children:e.jsx(r,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx(H,{className:"text-base",children:s.label}),e.jsx(I,{children:s.description})]})]})}),e.jsx(u,{children:e.jsx("div",{className:"divide-y divide-border",children:s.permissions.map(i=>e.jsxs("div",{className:"flex items-center justify-between py-3 first:pt-0 last:pb-0",children:[e.jsxs("div",{className:"space-y-0.5 pr-4",children:[e.jsx("label",{htmlFor:`${s.key}-${i.key}`,className:"text-sm font-medium text-foreground cursor-pointer",children:i.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]}),e.jsx(R,{id:`${s.key}-${i.key}`,checked:i.value,onCheckedChange:x=>_(s.key,i.key,x)})]},i.key))})})]})},s.key)}),e.jsx(m.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"flex justify-end pt-2",children:e.jsx(L,{onClick:M,disabled:g||!k,size:"lg",className:y(k&&"mercury-glow-sm"),children:g?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"h-4 w-4 animate-spin"}),"Saving"]}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"h-4 w-4"}),"Save Changes"]})})})]}),e.jsx(ee,{toasts:F})]})}export{fe as PermissionsPage};
17
- //# sourceMappingURL=Permissions-jbFH-toa.js.map
@@ -1,2 +1 @@
1
- import{j as e,m as n}from"./vendor-motion-Dwx3-JO5.js";import{j as C,r,L as i}from"./vendor-react-C7pctHW3.js";import{a as j,B as k,C as A,h as P,c as B}from"./index-C3YiF4qv.js";import{C as d,c as o}from"./card-BdsEOP7t.js";import{B as l}from"./badge-CUJiWF1y.js";import{C as S,A as E,a as D}from"./avatar-BIYaY7pR.js";import{A as g}from"./arrow-left-CtqQsBC6.js";import"./vendor-syntax-xZUI6Op9.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CaqLZNof.js";const c={hidden:{opacity:0,y:10},show:{opacity:1,y:0,transition:{duration:.35,ease:"easeOut"}}},L={hidden:{},show:{transition:{staggerChildren:.03}}},R={hidden:{opacity:0,x:-8},show:{opacity:1,x:0,transition:{duration:.25}}};function M(){return e.jsxs("div",{className:"space-y-6 p-6 animate-pulse",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-muted"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-16 w-16 rounded-full bg-muted"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 w-40 rounded bg-muted"}),e.jsx("div",{className:"h-4 w-20 rounded bg-muted"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 w-full rounded bg-muted"}),e.jsx("div",{className:"h-4 w-3/4 rounded bg-muted"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-5 w-16 rounded bg-muted"}),e.jsx("div",{className:"h-5 w-14 rounded bg-muted"}),e.jsx("div",{className:"h-5 w-18 rounded bg-muted"})]}),e.jsx("div",{className:"h-5 w-28 rounded bg-muted mt-8"}),Array.from({length:4}).map((t,a)=>e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsx("div",{className:"h-4 w-full rounded bg-muted"}),e.jsx("div",{className:"h-3 w-24 rounded bg-muted"})]},a))]})}function T(t){switch(t){case"fact":return"default";case"preference":return"success";case"observation":return"warning";default:return"secondary"}}function J(){const{id:t}=C(),[a,N]=r.useState(null),[m,v]=r.useState([]),[w,y]=r.useState(0),[b,x]=r.useState(!0),[h,u]=r.useState(null),p=r.useCallback(async()=>{if(t)try{u(null),x(!0);const[s,f]=await Promise.all([j.brain.persons.get(t),j.brain.persons.memories(t,50)]);N(s.person),v(f.memories),y(f.total)}catch(s){u(s instanceof Error?s.message:"Failed to load person")}finally{x(!1)}},[t]);return r.useEffect(()=>{p()},[p]),b?e.jsx(M,{}):h||!a?e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs(i,{to:"/second-brain/persons",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(g,{className:"h-4 w-4"}),"Back to Persons"]}),e.jsx(d,{children:e.jsxs(o,{className:"flex flex-col items-center gap-3 py-12 text-center text-muted-foreground",children:[e.jsx(S,{className:"h-10 w-10"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:"Person not found"}),e.jsx("p",{className:"text-sm",children:h||"This person doesn't exist or has been removed."})]}),e.jsx(i,{to:"/second-brain/persons",className:"mt-2 text-sm text-[#00d4ff] hover:underline",children:"Return to directory"})]})})]}):e.jsxs("div",{className:"space-y-8 p-6",children:[e.jsx(n.div,{variants:c,initial:"hidden",animate:"show",children:e.jsxs(i,{to:"/second-brain/persons",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(g,{className:"h-4 w-4"}),"Back to Persons"]})}),e.jsxs(n.div,{className:"space-y-4",variants:c,initial:"hidden",animate:"show",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(E,{className:"h-16 w-16",children:e.jsx(D,{className:"bg-[#00d4ff]/10 text-[#00d4ff] text-xl font-semibold",children:a.name.charAt(0).toUpperCase()})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.name}),a.relationship&&e.jsx(l,{variant:"secondary",className:"mt-1 capitalize",children:a.relationship})]})]}),a.summary&&e.jsx("p",{className:"max-w-2xl text-sm leading-relaxed text-muted-foreground",children:a.summary}),a.traits&&a.traits.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.traits.map(s=>e.jsx(l,{variant:"outline",className:"text-xs",children:s},s))})]}),e.jsxs(n.div,{className:"space-y-4",variants:c,initial:"hidden",animate:"show",transition:{delay:.1},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-5 w-5 text-[#00d4ff]"}),e.jsxs("h2",{className:"text-lg font-semibold text-foreground",children:["Memories",e.jsxs("span",{className:"ml-1.5 text-sm font-normal text-muted-foreground",children:["(",w,")"]})]})]}),m.length===0?e.jsx(d,{children:e.jsx(o,{className:"py-8 text-center text-sm text-muted-foreground",children:"No memories associated with this person yet."})}):e.jsx(n.div,{className:"space-y-2",variants:L,initial:"hidden",animate:"show",children:m.map(s=>e.jsx(n.div,{variants:R,children:e.jsx(d,{className:B("transition-colors hover:border-[#00d4ff]/20"),children:e.jsxs(o,{className:"flex items-start gap-3 p-4",children:[e.jsx(l,{variant:T(s.type),className:"mt-0.5 shrink-0 text-[10px] capitalize",children:s.type}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm text-foreground",children:s.summary}),e.jsxs("span",{className:"mt-1 flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(A,{className:"h-3 w-3"}),P(s.createdAt)]})]})]})})},s.id))})]})]})}export{J as PersonDetailPage};
2
- //# sourceMappingURL=PersonDetail-Ca8B9io8.js.map
1
+ import{j as e,m as n}from"./vendor-motion-Dwx3-JO5.js";import{j as C,r,L as i}from"./vendor-react-C7pctHW3.js";import{a as j,B as k,C as A,h as P,c as B}from"./index-B1xAjISP.js";import{C as d,c as o}from"./card-CjAvp22k.js";import{B as l}from"./badge-DpVeNL8j.js";import{C as S,A as E,a as D}from"./avatar-NU204zr9.js";import{A as g}from"./arrow-left-CkDXNwR2.js";import"./vendor-syntax-xZUI6Op9.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CufYpqmV.js";const c={hidden:{opacity:0,y:10},show:{opacity:1,y:0,transition:{duration:.35,ease:"easeOut"}}},L={hidden:{},show:{transition:{staggerChildren:.03}}},R={hidden:{opacity:0,x:-8},show:{opacity:1,x:0,transition:{duration:.25}}};function M(){return e.jsxs("div",{className:"space-y-6 p-6 animate-pulse",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-muted"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-16 w-16 rounded-full bg-muted"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 w-40 rounded bg-muted"}),e.jsx("div",{className:"h-4 w-20 rounded bg-muted"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 w-full rounded bg-muted"}),e.jsx("div",{className:"h-4 w-3/4 rounded bg-muted"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"h-5 w-16 rounded bg-muted"}),e.jsx("div",{className:"h-5 w-14 rounded bg-muted"}),e.jsx("div",{className:"h-5 w-18 rounded bg-muted"})]}),e.jsx("div",{className:"h-5 w-28 rounded bg-muted mt-8"}),Array.from({length:4}).map((t,a)=>e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsx("div",{className:"h-4 w-full rounded bg-muted"}),e.jsx("div",{className:"h-3 w-24 rounded bg-muted"})]},a))]})}function T(t){switch(t){case"fact":return"default";case"preference":return"success";case"observation":return"warning";default:return"secondary"}}function J(){const{id:t}=C(),[a,N]=r.useState(null),[m,v]=r.useState([]),[w,y]=r.useState(0),[b,x]=r.useState(!0),[h,u]=r.useState(null),p=r.useCallback(async()=>{if(t)try{u(null),x(!0);const[s,f]=await Promise.all([j.brain.persons.get(t),j.brain.persons.memories(t,50)]);N(s.person),v(f.memories),y(f.total)}catch(s){u(s instanceof Error?s.message:"Failed to load person")}finally{x(!1)}},[t]);return r.useEffect(()=>{p()},[p]),b?e.jsx(M,{}):h||!a?e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs(i,{to:"/second-brain/persons",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(g,{className:"h-4 w-4"}),"Back to Persons"]}),e.jsx(d,{children:e.jsxs(o,{className:"flex flex-col items-center gap-3 py-12 text-center text-muted-foreground",children:[e.jsx(S,{className:"h-10 w-10"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:"Person not found"}),e.jsx("p",{className:"text-sm",children:h||"This person doesn't exist or has been removed."})]}),e.jsx(i,{to:"/second-brain/persons",className:"mt-2 text-sm text-[#00d4ff] hover:underline",children:"Return to directory"})]})})]}):e.jsxs("div",{className:"space-y-8 p-6",children:[e.jsx(n.div,{variants:c,initial:"hidden",animate:"show",children:e.jsxs(i,{to:"/second-brain/persons",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(g,{className:"h-4 w-4"}),"Back to Persons"]})}),e.jsxs(n.div,{className:"space-y-4",variants:c,initial:"hidden",animate:"show",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(E,{className:"h-16 w-16",children:e.jsx(D,{className:"bg-[#00d4ff]/10 text-[#00d4ff] text-xl font-semibold",children:a.name.charAt(0).toUpperCase()})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.name}),a.relationship&&e.jsx(l,{variant:"secondary",className:"mt-1 capitalize",children:a.relationship})]})]}),a.summary&&e.jsx("p",{className:"max-w-2xl text-sm leading-relaxed text-muted-foreground",children:a.summary}),a.traits&&a.traits.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.traits.map(s=>e.jsx(l,{variant:"outline",className:"text-xs",children:s},s))})]}),e.jsxs(n.div,{className:"space-y-4",variants:c,initial:"hidden",animate:"show",transition:{delay:.1},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-5 w-5 text-[#00d4ff]"}),e.jsxs("h2",{className:"text-lg font-semibold text-foreground",children:["Memories",e.jsxs("span",{className:"ml-1.5 text-sm font-normal text-muted-foreground",children:["(",w,")"]})]})]}),m.length===0?e.jsx(d,{children:e.jsx(o,{className:"py-8 text-center text-sm text-muted-foreground",children:"No memories associated with this person yet."})}):e.jsx(n.div,{className:"space-y-2",variants:L,initial:"hidden",animate:"show",children:m.map(s=>e.jsx(n.div,{variants:R,children:e.jsx(d,{className:B("transition-colors hover:border-[#00d4ff]/20"),children:e.jsxs(o,{className:"flex items-start gap-3 p-4",children:[e.jsx(l,{variant:T(s.type),className:"mt-0.5 shrink-0 text-[10px] capitalize",children:s.type}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm text-foreground",children:s.summary}),e.jsxs("span",{className:"mt-1 flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(A,{className:"h-3 w-3"}),P(s.createdAt)]})]})]})})},s.id))})]})]})}export{J as PersonDetailPage};
@@ -1,2 +1 @@
1
- import{j as e,m as f}from"./vendor-motion-Dwx3-JO5.js";import{r as t,L as y}from"./vendor-react-C7pctHW3.js";import{a as w,U as C,B as S,c as P}from"./index-C3YiF4qv.js";import{I as k}from"./input-CH3dmo9r.js";import{C as c,c as o}from"./card-BdsEOP7t.js";import{B as p}from"./badge-CUJiWF1y.js";import{C as A,A as E,a as B}from"./avatar-BIYaY7pR.js";import{S as T}from"./search-BZsbhO0B.js";import"./vendor-syntax-xZUI6Op9.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CaqLZNof.js";function U(){return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 animate-pulse",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"h-11 w-11 rounded-full bg-muted"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),e.jsx("div",{className:"h-3 w-16 rounded bg-muted"})]})]}),e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsx("div",{className:"h-3 w-full rounded bg-muted"}),e.jsx("div",{className:"h-3 w-3/4 rounded bg-muted"})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("div",{className:"h-5 w-14 rounded bg-muted"}),e.jsx("div",{className:"h-5 w-12 rounded bg-muted"})]})]})}const L={hidden:{},show:{transition:{staggerChildren:.04}}},R={hidden:{opacity:0,y:12},show:{opacity:1,y:0,transition:{duration:.3,ease:"easeOut"}}};function H(){const[n,g]=t.useState([]),[j,N]=t.useState(0),[m,v]=t.useState(""),[r,x]=t.useState(!0),[l,u]=t.useState(null),i=t.useRef(null),d=t.useCallback(async s=>{try{u(null),x(!0);const a=await w.brain.persons.list({q:s||void 0,limit:200});g(a.persons),N(a.total)}catch(a){u(a instanceof Error?a.message:"Failed to load persons")}finally{x(!1)}},[]);t.useEffect(()=>{d("")},[d]);const b=s=>{v(s),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>d(s),300)};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(C,{className:"h-6 w-6 text-[#00d4ff]"}),e.jsxs("h1",{className:"text-2xl font-semibold text-foreground",children:["Persons",!r&&e.jsxs("span",{className:"ml-2 text-base font-normal text-muted-foreground",children:["(",j,")"]})]})]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"People Mercury knows about"})]}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(T,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(k,{placeholder:"Search by name...",value:m,onChange:s=>b(s.target.value),className:"pl-9"})]}),l&&e.jsx(c,{children:e.jsx(o,{className:"py-8 text-center text-destructive",children:l})}),r&&e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6}).map((s,a)=>e.jsx(U,{},a))}),!r&&!l&&n.length===0&&e.jsx(c,{children:e.jsxs(o,{className:"flex flex-col items-center gap-3 py-12 text-center text-muted-foreground",children:[e.jsx(A,{className:"h-10 w-10"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:"No persons found"}),e.jsx("p",{className:"text-sm",children:m?"Try a different search term.":"Mercury hasn't recorded any people yet."})]})]})}),!r&&!l&&n.length>0&&e.jsx(f.div,{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",variants:L,initial:"hidden",animate:"show",children:n.map(s=>{var a;return e.jsx(f.div,{variants:R,children:e.jsx(y,{to:`/second-brain/persons/${s.id}`,className:"block",children:e.jsx(c,{className:P("cursor-pointer transition-all duration-200","hover:-translate-y-0.5 hover:shadow-lg hover:border-[#00d4ff]/30"),children:e.jsxs(o,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(E,{className:"h-11 w-11",children:e.jsx(B,{className:"bg-[#00d4ff]/10 text-[#00d4ff] font-semibold text-sm",children:s.name.charAt(0).toUpperCase()})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-base font-semibold text-foreground",children:s.name}),s.relationship&&e.jsx(p,{variant:"secondary",className:"mt-0.5 text-[10px] capitalize",children:s.relationship})]})]}),s.summary&&e.jsx("p",{className:"mb-3 line-clamp-2 text-sm text-muted-foreground",children:s.summary}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[(a=s.traits)==null?void 0:a.slice(0,4).map(h=>e.jsx(p,{variant:"outline",className:"text-[10px]",children:h},h)),s.memoryCount!=null&&s.memoryCount>0&&e.jsxs("span",{className:"ml-auto flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(S,{className:"h-3 w-3"}),s.memoryCount," memories"]})]})]})})})},s.id)})})]})}export{H as PersonsPage};
2
- //# sourceMappingURL=Persons-epdmUeBM.js.map
1
+ import{j as e,m as f}from"./vendor-motion-Dwx3-JO5.js";import{r as t,L as y}from"./vendor-react-C7pctHW3.js";import{a as w,U as C,B as S,c as P}from"./index-B1xAjISP.js";import{I as k}from"./input-CF6e2HL4.js";import{C as c,c as o}from"./card-CjAvp22k.js";import{B as p}from"./badge-DpVeNL8j.js";import{C as A,A as E,a as B}from"./avatar-NU204zr9.js";import{S as T}from"./search-BwE8vRR_.js";import"./vendor-syntax-xZUI6Op9.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CufYpqmV.js";function U(){return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 animate-pulse",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"h-11 w-11 rounded-full bg-muted"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),e.jsx("div",{className:"h-3 w-16 rounded bg-muted"})]})]}),e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsx("div",{className:"h-3 w-full rounded bg-muted"}),e.jsx("div",{className:"h-3 w-3/4 rounded bg-muted"})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("div",{className:"h-5 w-14 rounded bg-muted"}),e.jsx("div",{className:"h-5 w-12 rounded bg-muted"})]})]})}const L={hidden:{},show:{transition:{staggerChildren:.04}}},R={hidden:{opacity:0,y:12},show:{opacity:1,y:0,transition:{duration:.3,ease:"easeOut"}}};function H(){const[n,g]=t.useState([]),[j,N]=t.useState(0),[m,v]=t.useState(""),[r,x]=t.useState(!0),[l,u]=t.useState(null),i=t.useRef(null),d=t.useCallback(async s=>{try{u(null),x(!0);const a=await w.brain.persons.list({q:s||void 0,limit:200});g(a.persons),N(a.total)}catch(a){u(a instanceof Error?a.message:"Failed to load persons")}finally{x(!1)}},[]);t.useEffect(()=>{d("")},[d]);const b=s=>{v(s),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>d(s),300)};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(C,{className:"h-6 w-6 text-[#00d4ff]"}),e.jsxs("h1",{className:"text-2xl font-semibold text-foreground",children:["Persons",!r&&e.jsxs("span",{className:"ml-2 text-base font-normal text-muted-foreground",children:["(",j,")"]})]})]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"People Mercury knows about"})]}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(T,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(k,{placeholder:"Search by name...",value:m,onChange:s=>b(s.target.value),className:"pl-9"})]}),l&&e.jsx(c,{children:e.jsx(o,{className:"py-8 text-center text-destructive",children:l})}),r&&e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6}).map((s,a)=>e.jsx(U,{},a))}),!r&&!l&&n.length===0&&e.jsx(c,{children:e.jsxs(o,{className:"flex flex-col items-center gap-3 py-12 text-center text-muted-foreground",children:[e.jsx(A,{className:"h-10 w-10"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:"No persons found"}),e.jsx("p",{className:"text-sm",children:m?"Try a different search term.":"Mercury hasn't recorded any people yet."})]})]})}),!r&&!l&&n.length>0&&e.jsx(f.div,{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",variants:L,initial:"hidden",animate:"show",children:n.map(s=>{var a;return e.jsx(f.div,{variants:R,children:e.jsx(y,{to:`/second-brain/persons/${s.id}`,className:"block",children:e.jsx(c,{className:P("cursor-pointer transition-all duration-200","hover:-translate-y-0.5 hover:shadow-lg hover:border-[#00d4ff]/30"),children:e.jsxs(o,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(E,{className:"h-11 w-11",children:e.jsx(B,{className:"bg-[#00d4ff]/10 text-[#00d4ff] font-semibold text-sm",children:s.name.charAt(0).toUpperCase()})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-base font-semibold text-foreground",children:s.name}),s.relationship&&e.jsx(p,{variant:"secondary",className:"mt-0.5 text-[10px] capitalize",children:s.relationship})]})]}),s.summary&&e.jsx("p",{className:"mb-3 line-clamp-2 text-sm text-muted-foreground",children:s.summary}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[(a=s.traits)==null?void 0:a.slice(0,4).map(h=>e.jsx(p,{variant:"outline",className:"text-[10px]",children:h},h)),s.memoryCount!=null&&s.memoryCount>0&&e.jsxs("span",{className:"ml-auto flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(S,{className:"h-3 w-3"}),s.memoryCount," memories"]})]})]})})})},s.id)})})]})}export{H as PersonsPage};
@@ -1,7 +1,6 @@
1
- import{j as e,A as b,m as j}from"./vendor-motion-Dwx3-JO5.js";import{r as c}from"./vendor-react-C7pctHW3.js";import{e as I,a as h,d as y,c as m}from"./index-C3YiF4qv.js";import{C as f,c as p,a as S}from"./card-BdsEOP7t.js";import{I as v}from"./input-CH3dmo9r.js";import{B as N}from"./button-CNasMlFE.js";import{S as L}from"./switch-LRN9wWy2.js";import{B as w}from"./badge-CUJiWF1y.js";import{C as K}from"./circle-x-CyaGJ_BM.js";import{E as M}from"./eye-BJ0NucMz.js";import{C as B}from"./circle-check-DvGSe1uZ.js";import{L as E}from"./loader-circle-DbYKk0_Q.js";import"./vendor-syntax-xZUI6Op9.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CaqLZNof.js";/**
1
+ import{j as e,A as b,m as j}from"./vendor-motion-Dwx3-JO5.js";import{r as c}from"./vendor-react-C7pctHW3.js";import{e as I,a as h,d as y,c as m}from"./index-B1xAjISP.js";import{C as f,c as p,a as S}from"./card-CjAvp22k.js";import{I as v}from"./input-CF6e2HL4.js";import{B as N}from"./button-V3Fu7_kO.js";import{S as L}from"./switch-CGgMESDf.js";import{B as w}from"./badge-DpVeNL8j.js";import{C as K}from"./circle-x-DK0DQPGB.js";import{E as M}from"./eye-CxEb5_L8.js";import{C as B}from"./circle-check-Cch4Kwja.js";import{L as E}from"./loader-circle-CJko6bz6.js";import"./vendor-syntax-xZUI6Op9.js";import"./vendor-radix-3UdfCgs_.js";import"./index-CufYpqmV.js";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
6
  */const z=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],O=I("eye-off",z),_=d=>({apiKey:"",baseUrl:d.baseUrl,model:d.model,enabled:d.enabled,showKey:!1,saving:!1,testing:!1,feedback:null,testResult:null});function D(){return e.jsxs(f,{className:"border-border/50 bg-card/60 backdrop-blur",children:[e.jsx(S,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-9 w-9 animate-pulse rounded-lg bg-muted"}),e.jsx("div",{className:"h-5 w-28 animate-pulse rounded bg-muted"})]}),e.jsx("div",{className:"h-5 w-9 animate-pulse rounded-full bg-muted"})]})}),e.jsxs(p,{className:"space-y-4",children:[[1,2,3].map(d=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3.5 w-16 animate-pulse rounded bg-muted"}),e.jsx("div",{className:"h-9 w-full animate-pulse rounded-md bg-muted"})]},d)),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("div",{className:"h-9 w-20 animate-pulse rounded-md bg-muted"}),e.jsx("div",{className:"h-9 w-32 animate-pulse rounded-md bg-muted"})]})]})]})}function re(){const[d,P]=c.useState([]),[k,C]=c.useState({}),[u,T]=c.useState(!0),[g,R]=c.useState(null),x=c.useRef({}),n=c.useCallback(async()=>{try{const s=await h.providers.list();P(s),C(t=>{const a={};for(const i of s)a[i.name]=t[i.name]?{...t[i.name],enabled:i.enabled}:_(i);return a}),R(null)}catch(s){R(s instanceof Error?s.message:"Failed to load providers")}finally{T(!1)}},[]);c.useEffect(()=>(n(),()=>{Object.values(x.current).forEach(clearTimeout)}),[n]);const r=(s,t)=>{C(a=>({...a,[s]:{...a[s],...t}}))},o=(s,t,a)=>{x.current[s]&&clearTimeout(x.current[s]),r(s,{feedback:{type:t,message:a}}),x.current[s]=setTimeout(()=>{r(s,{feedback:null})},4e3)},U=async s=>{const t=k[s];if(t){r(s,{saving:!0});try{await h.providers.update(s,{...t.apiKey?{apiKey:t.apiKey}:{},baseUrl:t.baseUrl,model:t.model,enabled:t.enabled}),o(s,"success","Configuration saved"),r(s,{apiKey:"",saving:!1}),n()}catch(a){o(s,"error",a instanceof Error?a.message:"Save failed"),r(s,{saving:!1})}}},A=async s=>{r(s,{testing:!0,testResult:null});try{const t=await h.providers.test(s);r(s,{testing:!1,testResult:t}),o(s,t.success?"success":"error",t.success?"Connection successful":"Connection failed")}catch(t){r(s,{testing:!1}),o(s,"error",t instanceof Error?t.message:"Test failed")}},F=async(s,t)=>{r(s,{enabled:t});try{await h.providers.update(s,{enabled:t}),n()}catch{o(s,"error","Failed to toggle provider"),r(s,{enabled:!t})}};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-[#00d4ff]/20 to-[#a78bfa]/20 ring-1 ring-[#00d4ff]/30",children:e.jsx(y,{className:"h-5 w-5 text-[#00d4ff]"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Providers"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure your AI model providers"})]})]})}),g&&!u&&e.jsx(f,{className:"border-destructive/50 bg-destructive/5",children:e.jsxs(p,{className:"flex items-center gap-3 py-4",children:[e.jsx(K,{className:"h-5 w-5 text-destructive"}),e.jsx("p",{className:"text-sm text-destructive",children:g}),e.jsx(N,{variant:"outline",size:"sm",className:"ml-auto",onClick:n,children:"Retry"})]})}),u&&e.jsx("div",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2",children:[1,2,3,4].map(s=>e.jsx(D,{},s))}),!u&&d.length>0&&e.jsx("div",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2",children:e.jsx(b,{mode:"popLayout",children:d.map((s,t)=>{var i;const a=k[s.name];return a?e.jsx(j.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.3,delay:t*.05},children:e.jsxs(f,{className:m("border-border/50 bg-card/60 backdrop-blur transition-all duration-300",a.enabled&&"ring-1 ring-[#00d4ff]/20"),children:[e.jsx(S,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:m("flex h-9 w-9 items-center justify-center rounded-lg transition-colors",a.enabled?"bg-gradient-to-br from-[#00d4ff]/20 to-[#a78bfa]/20":"bg-muted"),children:e.jsx(y,{className:m("h-4.5 w-4.5 transition-colors",a.enabled?"text-[#00d4ff]":"text-muted-foreground")})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base font-medium text-foreground",children:s.name}),e.jsx(w,{variant:a.enabled?"default":"secondary",className:m("text-[10px] px-1.5 py-0",a.enabled&&"bg-[#00d4ff]/15 text-[#00d4ff] border-[#00d4ff]/30 hover:bg-[#00d4ff]/20"),children:a.enabled?"Active":"Disabled"})]})]}),e.jsx(L,{checked:a.enabled,onCheckedChange:l=>F(s.name,l)})]})}),e.jsxs(p,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),e.jsxs("div",{className:"relative",children:[e.jsx(v,{type:a.showKey?"text":"password",placeholder:s.maskedKey||"Enter API key",value:a.apiKey,onChange:l=>r(s.name,{apiKey:l.target.value}),className:"pr-9 bg-background/50"}),e.jsx("button",{type:"button",onClick:()=>r(s.name,{showKey:!a.showKey}),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:a.showKey?e.jsx(O,{className:"h-4 w-4"}):e.jsx(M,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Base URL"," ",e.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),e.jsx(v,{placeholder:"https://api.openai.com/v1",value:a.baseUrl,onChange:l=>r(s.name,{baseUrl:l.target.value}),className:"bg-background/50"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Model"}),e.jsx(v,{placeholder:"gpt-4o",value:a.model,onChange:l=>r(s.name,{model:l.target.value}),className:"bg-background/50"})]}),e.jsx(b,{children:a.feedback&&e.jsx(j.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:e.jsxs("div",{className:m("flex items-center gap-2 rounded-md px-3 py-2 text-sm",a.feedback.type==="success"?"bg-emerald-500/10 text-emerald-400":"bg-destructive/10 text-destructive"),children:[a.feedback.type==="success"?e.jsx(B,{className:"h-4 w-4 shrink-0"}):e.jsx(K,{className:"h-4 w-4 shrink-0"}),a.feedback.message]})})}),e.jsx(b,{children:((i=a.testResult)==null?void 0:i.success)&&a.testResult.models&&e.jsx(j.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:e.jsxs("div",{className:"rounded-md border border-border/50 bg-background/30 p-3 space-y-2",children:[a.testResult.recommendedModel&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Recommended:"," ",e.jsx("span",{className:"font-medium text-[#00d4ff]",children:a.testResult.recommendedModel})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[a.testResult.models.slice(0,12).map(l=>e.jsx(w,{variant:"secondary",className:"text-[10px] cursor-pointer hover:bg-[#00d4ff]/15 hover:text-[#00d4ff] transition-colors",onClick:()=>r(s.name,{model:l}),children:l},l)),a.testResult.models.length>12&&e.jsxs(w,{variant:"secondary",className:"text-[10px]",children:["+",a.testResult.models.length-12," more"]})]})]})})}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs(N,{size:"sm",onClick:()=>U(s.name),disabled:a.saving,className:"bg-gradient-to-r from-[#00d4ff] to-[#a78bfa] text-white hover:opacity-90 transition-opacity",children:[a.saving&&e.jsx(E,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Save"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>A(s.name),disabled:a.testing,children:[a.testing&&e.jsx(E,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Test Connection"]})]})]})]})},s.name):null})})}),!u&&!g&&d.length===0&&e.jsx(f,{className:"border-border/50 bg-card/60",children:e.jsxs(p,{className:"py-12 text-center",children:[e.jsx(y,{className:"mx-auto h-10 w-10 text-muted-foreground/40 mb-3"}),e.jsx("p",{className:"text-muted-foreground",children:"No providers configured yet."})]})})]})}export{re as ProvidersPage};
7
- //# sourceMappingURL=Providers-Bm8sZNZo.js.map