@hienlh/ppm 0.19.11 → 0.19.12

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 (67) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/dist/web/assets/{accounts-settings-section-C1YP1iCb.js → accounts-settings-section-Cd1Nh04o.js} +1 -1
  5. package/dist/web/assets/{ai-resource-editor-iMqzzz5c.js → ai-resource-editor-CqL-X2zu.js} +1 -1
  6. package/dist/web/assets/{ai-settings-section-B-1z-PRb.js → ai-settings-section-CcqokdzF.js} +1 -1
  7. package/dist/web/assets/{ai-settings-section-BJPgHUqk.js → ai-settings-section-OaYGT5OF.js} +1 -1
  8. package/dist/web/assets/{appearance-settings-section-2XZgB0mV.js → appearance-settings-section-2hZBnpPS.js} +1 -1
  9. package/dist/web/assets/{chat-tab-Bn4vZVZJ.js → chat-tab-Cc1W2pTu.js} +5 -5
  10. package/dist/web/assets/{code-editor-DN5GJXT3.js → code-editor-gLRyCPWE.js} +2 -2
  11. package/dist/web/assets/{conflict-editor-BpdoTEfv.js → conflict-editor-NqFAJP47.js} +1 -1
  12. package/dist/web/assets/{csv-preview-C3DoHISX.js → csv-preview-Dvriy18_.js} +1 -1
  13. package/dist/web/assets/{database-viewer-CxZ2fdcd.js → database-viewer-Bs2RMm5a.js} +1 -1
  14. package/dist/web/assets/{diff-viewer-DxzD_YSO.js → diff-viewer-ix1Ko0xk.js} +1 -1
  15. package/dist/web/assets/{explorer-body-Bpe6UX0b.js → explorer-body-DfWunSf9.js} +1 -1
  16. package/dist/web/assets/{explorer-window-content-DixZaLLP.js → explorer-window-content-B7HmteDI.js} +1 -1
  17. package/dist/web/assets/{extension-manager-section-D_rKLp-o.js → extension-manager-section-Zc9yag2c.js} +1 -1
  18. package/dist/web/assets/{extension-webview-kEtrZoRZ.js → extension-webview-B5FayDPz.js} +1 -1
  19. package/dist/web/assets/{files-settings-section-B0wLfQ9S.js → files-settings-section-CxAtO3GL.js} +1 -1
  20. package/dist/web/assets/{general-settings-section-DZ3xpgwh.js → general-settings-section-9DfKrBns.js} +1 -1
  21. package/dist/web/assets/{git-log-panel-BNicD2In.js → git-log-panel-BsmDZurR.js} +1 -1
  22. package/dist/web/assets/{glide-data-grid-CdK5dW5L.js → glide-data-grid-BuYwXIoS.js} +1 -1
  23. package/dist/web/assets/{group-chat-tab-D-HXdnoU.js → group-chat-tab-DmZ1vLk-.js} +1 -1
  24. package/dist/web/assets/{index-DdMq4zqb.js → index-yV5RgBDh.js} +4 -4
  25. package/dist/web/assets/{jira-watcher-section-DL_boZNh.js → jira-watcher-section-rJVz40wR.js} +1 -1
  26. package/dist/web/assets/{keybindings-store-DQkz4a35.js → keybindings-store-88_Zkn5F.js} +1 -1
  27. package/dist/web/assets/{keyboard-shortcuts-section-DzQzV49E.js → keyboard-shortcuts-section-Dv4e3M8h.js} +1 -1
  28. package/dist/web/assets/{markdown-renderer-BfoCOrL8.js → markdown-renderer-CEloCR06.js} +1 -1
  29. package/dist/web/assets/{markdown-renderer-C35QMvZp.js → markdown-renderer-UhszMWSn.js} +1 -1
  30. package/dist/web/assets/{mobile-explorer-sheet-ZHfT5IN3.js → mobile-explorer-sheet-D9cqcU3X.js} +1 -1
  31. package/dist/web/assets/{notification-store-J1yP_Ebb.js → notification-store-B6X6RYqQ.js} +1 -1
  32. package/dist/web/assets/{notifications-settings-section-BXCaGBVc.js → notifications-settings-section-B2GkfB0l.js} +1 -1
  33. package/dist/web/assets/{pdf-preview-DbRFOtQD.js → pdf-preview-Dmz8jkZZ.js} +1 -1
  34. package/dist/web/assets/{postgres-viewer-BrQRqTso.js → postgres-viewer-BtZbfC3f.js} +1 -1
  35. package/dist/web/assets/{ppmbot-settings-section-BEV23_SM.js → ppmbot-settings-section-OYfVG5-l.js} +1 -1
  36. package/dist/web/assets/{process-table-CG8d5eXs.js → process-table-DRu3NyO_.js} +1 -1
  37. package/dist/web/assets/{proxy-settings-section-Cw0Wtsv0.js → proxy-settings-section-xMbrcyr8.js} +1 -1
  38. package/dist/web/assets/{query-audit-section-50B7mQal.js → query-audit-section-CC5Mf6qp.js} +1 -1
  39. package/dist/web/assets/{remote-desktop-mobile-sheet-DhcAyXE5.js → remote-desktop-mobile-sheet-DefltAPl.js} +2 -2
  40. package/dist/web/assets/{remote-desktop-mobile-view-DPF_b_jd.js → remote-desktop-mobile-view-B4BSHIxU.js} +1 -1
  41. package/dist/web/assets/{remote-desktop-readiness-gate-J7E6355i.js → remote-desktop-readiness-gate-C0d0PSX4.js} +1 -1
  42. package/dist/web/assets/{remote-desktop-window-content-0xsAifZH.js → remote-desktop-window-content-DjeCZzqq.js} +1 -1
  43. package/dist/web/assets/{schedules-settings-section-BFzMEPTd.js → schedules-settings-section-D76Ob6tI.js} +1 -1
  44. package/dist/web/assets/{settings-body-CUTsPLea.js → settings-body-CXTQwhbM.js} +2 -2
  45. package/dist/web/assets/{settings-tab-DVV26vPK.js → settings-tab-DToHQXfC.js} +1 -1
  46. package/dist/web/assets/{settings-window-content-z64J3tfm.js → settings-window-content-B2rlq-Dv.js} +1 -1
  47. package/dist/web/assets/{sql-query-editor-CwOcDbp4.js → sql-query-editor-B-VwfyTf.js} +1 -1
  48. package/dist/web/assets/{sqlite-viewer-DYdcqZv1.js → sqlite-viewer-CpUhDEhN.js} +1 -1
  49. package/dist/web/assets/{system-monitor-body-CugdEvdh.js → system-monitor-body-DzWXd1wM.js} +2 -2
  50. package/dist/web/assets/{system-monitor-tab-jnPQtmvK.js → system-monitor-tab-CuDpwAZU.js} +1 -1
  51. package/dist/web/assets/{system-monitor-window-content-CJfcQqc2.js → system-monitor-window-content-DIIP3dff.js} +1 -1
  52. package/dist/web/assets/{tab-host-window-content-5Ga7BheG.js → tab-host-window-content-CLdcz84K.js} +1 -1
  53. package/dist/web/assets/{team-member-sheet-8FDCVZMG.js → team-member-sheet-DLrT_Kxo.js} +2 -2
  54. package/dist/web/assets/{team-member-window-content-0JRiWRdG.js → team-member-window-content-S8cdLcg3.js} +1 -1
  55. package/dist/web/assets/{terminal-tab-CkxJIjii.js → terminal-tab-BeKLpaPM.js} +1 -1
  56. package/dist/web/assets/{tool-cards-DuTlfeWN.js → tool-cards-CLxrQlUs.js} +2 -2
  57. package/dist/web/assets/{use-accounts-data--pdg01TI.js → use-accounts-data-snYPJED_.js} +1 -1
  58. package/dist/web/assets/{use-monaco-theme-DOhDvEKJ.js → use-monaco-theme-Kj2OGDlm.js} +1 -1
  59. package/dist/web/assets/{use-remote-desktop-display-choice-B3VIBQxC.js → use-remote-desktop-display-choice-8AkPpM_0.js} +1 -1
  60. package/dist/web/assets/{use-websocket-D9MsDysx.js → use-websocket-kR1omKO1.js} +1 -1
  61. package/dist/web/assets/{video-preview-VL2Br0YM.js → video-preview-BdV7LjbZ.js} +1 -1
  62. package/dist/web/index.html +1 -1
  63. package/dist/web/sw.js +1 -1
  64. package/package.json +1 -1
  65. package/src/web/components/chat/chat-history-bar.tsx +2 -2
  66. package/src/web/components/chat/codex-usage-panel.tsx +18 -2
  67. package/src/web/hooks/use-usage.ts +3 -3
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./folder-symlink-fQRoG_rV.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{t as o}from"./power-CriQkeK5.js";import{n as s,s as c}from"./api-client-oY1tC3tM.js";import{t as l}from"./button-2WCAS8dI.js";import{Jn as u,Pn as d,X as f,Yn as p}from"./index-DdMq4zqb.js";var m=r(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),h=e(t(),1),g=n();function _(){let[e,t]=(0,h.useState)([]),[n,r]=(0,h.useState)(!0),[_,v]=(0,h.useState)(``),[y,b]=(0,h.useState)(!1),[x,S]=(0,h.useState)(``),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(null),[D,O]=(0,h.useState)(null),k=(0,h.useCallback)(async()=>{try{t(await s.get(`/api/extensions`))}catch(e){console.error(`Failed to load extensions:`,e)}finally{r(!1)}},[]);(0,h.useEffect)(()=>{k()},[k]);let A=async()=>{let e=_.trim();if(e){b(!0);try{await s.post(`/api/extensions/install`,{name:e}),c.success(`Installed ${e}`),v(``),k()}catch(e){c.error(e.message||`Install failed`)}finally{b(!1)}}},j=async e=>{E(e.id);try{await s.patch(`/api/extensions/${e.id}`,{enabled:!e.enabled}),k()}catch(e){c.error(e.message||`Toggle failed`)}finally{E(null)}},M=async e=>{O(e);try{await s.del(`/api/extensions/${e}`),c.success(`Removed ${e}`),k()}catch(e){c.error(e.message||`Remove failed`)}finally{O(null)}};return n?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,g.jsx)(a,{className:`size-4 animate-spin text-muted-foreground`})}):(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`section`,{className:`space-y-2`,children:[(0,g.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Install Extension`}),(0,g.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,g.jsx)(f,{value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&A()},placeholder:`npm package name (e.g. @ppm/ext-myext)`,className:`h-8 text-xs flex-1`}),(0,g.jsxs)(l,{variant:`outline`,size:`sm`,className:`h-8 text-xs px-3 gap-1 cursor-pointer`,disabled:!_.trim()||y,onClick:A,children:[y?(0,g.jsx)(a,{className:`size-3 animate-spin`}):(0,g.jsx)(p,{className:`size-3`}),`Install`]})]}),(0,g.jsx)(`button`,{onClick:()=>w(!C),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:C?`Hide`:`Dev link local extension...`}),C&&(0,g.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,g.jsx)(f,{value:x,onChange:e=>S(e.target.value),placeholder:`Local path (e.g. ./packages/ext-myext)`,className:`h-8 text-xs flex-1`}),(0,g.jsxs)(l,{variant:`outline`,size:`sm`,className:`h-8 text-xs px-3 gap-1 cursor-pointer`,disabled:!x.trim(),onClick:async()=>{try{await s.post(`/api/extensions/dev-link`,{path:x.trim()}),c.success(`Dev-linked successfully`),S(``),k()}catch(e){c.error(e.message||`Dev link failed`)}},children:[(0,g.jsx)(i,{className:`size-3`}),`Link`]})]})]}),(0,g.jsxs)(`section`,{className:`space-y-2`,children:[(0,g.jsxs)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:[`Installed (`,e.length,`)`]}),e.length===0?(0,g.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-4 text-center`,children:`No extensions installed`}):(0,g.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-2 rounded-lg bg-muted/50 hover:bg-muted transition-colors`,children:[(0,g.jsx)(`div`,{className:`size-8 rounded-md bg-background flex items-center justify-center shrink-0`,children:(0,g.jsx)(u,{className:`size-4 text-muted-foreground`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.displayName||e.id}),(0,g.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[e.id,` v`,e.version,e.activated&&(0,g.jsx)(`span`,{className:`ml-1 text-success`,children:`active`})]})]}),(0,g.jsx)(l,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 cursor-pointer`,title:e.enabled?`Disable`:`Enable`,disabled:T===e.id,onClick:()=>j(e),children:T===e.id?(0,g.jsx)(a,{className:`size-3.5 animate-spin`}):e.enabled?(0,g.jsx)(o,{className:`size-3.5 text-success`}):(0,g.jsx)(m,{className:`size-3.5 text-muted-foreground`})}),(0,g.jsx)(l,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 cursor-pointer text-destructive hover:text-destructive`,title:`Remove`,disabled:D===e.id,onClick:()=>M(e.id),children:D===e.id?(0,g.jsx)(a,{className:`size-3.5 animate-spin`}):(0,g.jsx)(d,{className:`size-3.5`})})]},e.id))})]})]})}export{_ as ExtensionManagerSection};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./folder-symlink-fQRoG_rV.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{t as o}from"./power-CriQkeK5.js";import{n as s,s as c}from"./api-client-oY1tC3tM.js";import{t as l}from"./button-2WCAS8dI.js";import{Jn as u,Pn as d,X as f,Yn as p}from"./index-yV5RgBDh.js";var m=r(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),h=e(t(),1),g=n();function _(){let[e,t]=(0,h.useState)([]),[n,r]=(0,h.useState)(!0),[_,v]=(0,h.useState)(``),[y,b]=(0,h.useState)(!1),[x,S]=(0,h.useState)(``),[C,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(null),[D,O]=(0,h.useState)(null),k=(0,h.useCallback)(async()=>{try{t(await s.get(`/api/extensions`))}catch(e){console.error(`Failed to load extensions:`,e)}finally{r(!1)}},[]);(0,h.useEffect)(()=>{k()},[k]);let A=async()=>{let e=_.trim();if(e){b(!0);try{await s.post(`/api/extensions/install`,{name:e}),c.success(`Installed ${e}`),v(``),k()}catch(e){c.error(e.message||`Install failed`)}finally{b(!1)}}},j=async e=>{E(e.id);try{await s.patch(`/api/extensions/${e.id}`,{enabled:!e.enabled}),k()}catch(e){c.error(e.message||`Toggle failed`)}finally{E(null)}},M=async e=>{O(e);try{await s.del(`/api/extensions/${e}`),c.success(`Removed ${e}`),k()}catch(e){c.error(e.message||`Remove failed`)}finally{O(null)}};return n?(0,g.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,g.jsx)(a,{className:`size-4 animate-spin text-muted-foreground`})}):(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`section`,{className:`space-y-2`,children:[(0,g.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Install Extension`}),(0,g.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,g.jsx)(f,{value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&A()},placeholder:`npm package name (e.g. @ppm/ext-myext)`,className:`h-8 text-xs flex-1`}),(0,g.jsxs)(l,{variant:`outline`,size:`sm`,className:`h-8 text-xs px-3 gap-1 cursor-pointer`,disabled:!_.trim()||y,onClick:A,children:[y?(0,g.jsx)(a,{className:`size-3 animate-spin`}):(0,g.jsx)(p,{className:`size-3`}),`Install`]})]}),(0,g.jsx)(`button`,{onClick:()=>w(!C),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:C?`Hide`:`Dev link local extension...`}),C&&(0,g.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,g.jsx)(f,{value:x,onChange:e=>S(e.target.value),placeholder:`Local path (e.g. ./packages/ext-myext)`,className:`h-8 text-xs flex-1`}),(0,g.jsxs)(l,{variant:`outline`,size:`sm`,className:`h-8 text-xs px-3 gap-1 cursor-pointer`,disabled:!x.trim(),onClick:async()=>{try{await s.post(`/api/extensions/dev-link`,{path:x.trim()}),c.success(`Dev-linked successfully`),S(``),k()}catch(e){c.error(e.message||`Dev link failed`)}},children:[(0,g.jsx)(i,{className:`size-3`}),`Link`]})]})]}),(0,g.jsxs)(`section`,{className:`space-y-2`,children:[(0,g.jsxs)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:[`Installed (`,e.length,`)`]}),e.length===0?(0,g.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-4 text-center`,children:`No extensions installed`}):(0,g.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-2 rounded-lg bg-muted/50 hover:bg-muted transition-colors`,children:[(0,g.jsx)(`div`,{className:`size-8 rounded-md bg-background flex items-center justify-center shrink-0`,children:(0,g.jsx)(u,{className:`size-4 text-muted-foreground`})}),(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.displayName||e.id}),(0,g.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[e.id,` v`,e.version,e.activated&&(0,g.jsx)(`span`,{className:`ml-1 text-success`,children:`active`})]})]}),(0,g.jsx)(l,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 cursor-pointer`,title:e.enabled?`Disable`:`Enable`,disabled:T===e.id,onClick:()=>j(e),children:T===e.id?(0,g.jsx)(a,{className:`size-3.5 animate-spin`}):e.enabled?(0,g.jsx)(o,{className:`size-3.5 text-success`}):(0,g.jsx)(m,{className:`size-3.5 text-muted-foreground`})}),(0,g.jsx)(l,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 cursor-pointer text-destructive hover:text-destructive`,title:`Remove`,disabled:D===e.id,onClick:()=>M(e.id),children:D===e.id?(0,g.jsx)(a,{className:`size-3.5 animate-spin`}):(0,g.jsx)(d,{className:`size-3.5`})})]},e.id))})]})]})}export{_ as ExtensionManagerSection};
@@ -1,3 +1,3 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./loader-circle-DPMrnLQ2.js";import{r as i}from"./api-client-oY1tC3tM.js";import{ln as a}from"./index-DdMq4zqb.js";var o=e(t(),1),s=n(),c=`<script>
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./loader-circle-DPMrnLQ2.js";import{r as i}from"./api-client-oY1tC3tM.js";import{ln as a}from"./index-yV5RgBDh.js";var o=e(t(),1),s=n(),c=`<script>
2
2
  function acquireVsCodeApi(){return{postMessage:function(m){window.parent.postMessage(m,"*")},getState:function(){try{return JSON.parse(sessionStorage.getItem("vscode-state")||"null")}catch{return null}},setState:function(s){sessionStorage.setItem("vscode-state",JSON.stringify(s));return s}}}
3
3
  <\/script>`;function l(e){if(!e)return e;let t=e.indexOf(`<head>`);return t===-1?c+e:e.slice(0,t+6)+c+e.slice(t+6)}function u({metadata:e}){let t=e?.panelId,n=e?.viewType,c=e?.projectName||void 0,[u,d]=(0,o.useState)(!1),f=a(e=>e.contributions!==null),p=a(e=>{if(t&&e.webviewPanels[t])return e.webviewPanels[t];if(n){let t=n.includes(`.`)?n:`${n}.view`,r=Object.values(e.webviewPanels).filter(e=>e.viewType===n||e.viewType===t);return r.find(e=>e.projectName&&e.projectName===c)??r.find(e=>!e.projectName||!c)}}),m=p?.id??t,h=(0,o.useRef)(null),g=p?.html??``,_=l(g),v=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(p||!n||!f||c&&c===v.current)return;c&&(v.current=c);let e=n.includes(`.`)?n:`${n}.view`,t=!1;async function r(){let n=[];if(c)try{let e=i(),t=(await(await fetch(`/api/projects`,e?{headers:{Authorization:`Bearer ${e}`}}:{})).json()).data?.find(e=>e.name===c);t&&(n=[t.path])}catch{}t||window.dispatchEvent(new CustomEvent(`ext:command:execute`,{detail:{command:e,args:n,recovery:!0}}))}return r(),()=>{t=!0}},[p,n,c,f]);let y=e?.extensionId,b=a(e=>{if(y&&e.activationErrors[y])return e.activationErrors[y];if(n){for(let[t,r]of Object.entries(e.activationErrors))if(t===`ext-${n}`)return r}}),x=(0,o.useCallback)(()=>{if(d(!1),!n)return;let e=n.includes(`.`)?n:`${n}.view`;(async()=>{try{let t=i(),n=(await(await fetch(`/api/projects`,t?{headers:{Authorization:`Bearer ${t}`}}:{})).json()).data?.find(e=>e.name===c),r=n?[n.path]:[];window.dispatchEvent(new CustomEvent(`ext:command:execute`,{detail:{command:e,args:r,recovery:!0}}))}catch{}})()},[n,c]),S=(0,o.useRef)(null),C=(0,o.useRef)(n),w=(0,o.useRef)(c);return(0,o.useEffect)(()=>{S.current=m??null},[m]),(0,o.useEffect)(()=>{C.current=n},[n]),(0,o.useEffect)(()=>{w.current=c},[c]),(0,o.useEffect)(()=>()=>{let e=S.current;if(e){let t=C.current;a.getState().removeWebviewPanel(e),window.dispatchEvent(new CustomEvent(`ext:webview:close`,{detail:{panelId:e,viewType:t,projectName:w.current}}))}},[]),(0,o.useEffect)(()=>{if(p){d(!1);return}if(!f||!n)return;let e=0,t=setInterval(()=>{if(e++,e>3){clearInterval(t),d(!0);return}x()},2e3);return()=>clearInterval(t)},[p,f,n,x]),(0,o.useEffect)(()=>{if(!m)return;let e=e=>{h.current&&e.source===h.current.contentWindow&&window.dispatchEvent(new CustomEvent(`ext:webview:send`,{detail:{panelId:m,message:e.data}}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[m]),(0,o.useEffect)(()=>{if(!m)return;let e=e=>{let{panelId:t,message:n}=e.detail;t===m&&h.current?.contentWindow?.postMessage(n,`*`)};return window.addEventListener(`ext:webview:message`,e),()=>window.removeEventListener(`ext:webview:message`,e)},[m]),!p||!g?(0,s.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-sm text-text-subtle`,children:u?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{className:`text-destructive font-medium`,children:`Extension failed to load`}),b&&(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground max-w-md text-center`,children:b}),(0,s.jsx)(`button`,{onClick:x,className:`text-xs text-primary hover:underline`,children:`Retry`})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r,{className:`size-5 animate-spin`}),(0,s.jsx)(`span`,{children:`Loading extension...`})]})}):(0,s.jsx)(`div`,{className:`h-full w-full relative`,children:(0,s.jsx)(`iframe`,{ref:h,srcDoc:_,sandbox:`allow-scripts`,className:`w-full h-full border-0 bg-white dark:bg-bg`,title:p.title},m)})}export{u as ExtensionWebview};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./x-YDu4m2Iq.js";import{n as i}from"./api-client-oY1tC3tM.js";import{i as a}from"./project-store-BuY7rxn_.js";import{t as o}from"./button-2WCAS8dI.js";import{G as s,X as c,Y as l,Yn as u,gn as d}from"./index-DdMq4zqb.js";import{t as f}from"./separator-BzGoTlR7.js";var p=e(t(),1);function m(){return i.get(`/api/settings/files`)}function h(e){return i.patch(`/api/settings/files`,e)}function g(e){return i.get(`/api/projects/${encodeURIComponent(e)}/settings`)}function _(e,t){return i.patch(`/api/projects/${encodeURIComponent(e)}/settings`,t)}var v=n();function y({value:e,onChange:t,placeholder:n=`e.g. **/*.log`,disabled:i=!1}){let a=(0,p.useRef)([]);function s(n,r){let i=[...e];i[n]=r,t(i)}function l(n){t(e.filter((e,t)=>t!==n)),setTimeout(()=>{let e=Math.max(n-1,0);a.current[e]?.focus()},0)}function d(){t([...e,``]),setTimeout(()=>{a.current[e.length]?.focus()},0)}function f(t,n){n.key===`Enter`?(n.preventDefault(),e[t]?.trim()&&d()):n.key===`Backspace`&&e[t]===``&&(n.preventDefault(),l(t))}return(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[e.length===0&&(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No patterns. Click "Add pattern" to start.`}),e.map((e,t)=>(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(c,{ref:e=>{a.current[t]=e},value:e,onChange:e=>s(t,e.target.value),onKeyDown:e=>f(t,e),placeholder:n,disabled:i,className:`h-8 text-xs flex-1 font-mono`,"aria-label":`Pattern ${t+1}`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>l(t),disabled:i,"aria-label":`Remove pattern ${t+1}`,className:`shrink-0 flex items-center justify-center p-2.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-40 disabled:pointer-events-none`,children:(0,v.jsx)(r,{className:`size-3.5`})})]},t)),(0,v.jsxs)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:d,disabled:i,className:`h-8 text-xs gap-1.5 w-full cursor-pointer`,children:[(0,v.jsx)(u,{className:`size-3.5`}),`Add pattern`]})]})}var b={filesExclude:[],searchExclude:[],useIgnoreFiles:!0};function x(){let e=a(e=>e.activeProject),[t,n]=(0,p.useState)(`global`),[r,i]=(0,p.useState)([]),[c,u]=(0,p.useState)([]),[x,S]=(0,p.useState)(!0),[C,w]=(0,p.useState)(!1),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(!1),j=(0,p.useRef)(null);(0,p.useEffect)(()=>{j.current?.abort();let n=new AbortController;return j.current=n,A(!0),O(null),(async()=>{try{if(t===`global`){let e=await m();if(n.signal.aborted)return;i(e.filesExclude),u(e.searchExclude),S(e.useIgnoreFiles)}else{if(!e)return;let t=await g(e.name);if(n.signal.aborted)return;let r=t.files??{};i(r.filesExclude??b.filesExclude),u(r.searchExclude??b.searchExclude),S(r.useIgnoreFiles??b.useIgnoreFiles)}}catch(e){if(n.signal.aborted)return;O(e.message)}finally{n.signal.aborted||A(!1)}})(),()=>n.abort()},[t,e?.name]);let M=async()=>{w(!0),E(!1),O(null);try{let n={filesExclude:r.filter(e=>e.trim()!==``),searchExclude:c.filter(e=>e.trim()!==``),useIgnoreFiles:x};if(t===`global`)await h(n);else{if(!e)throw Error(`No active project`);await _(e.name,{files:n})}let i=d.getState();i.invalidateIndex(),e&&i.loadIndex(e.name),E(!0),setTimeout(()=>E(!1),2e3)}catch(e){O(e.message)}finally{w(!1)}},N=!!e;return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`File Filters`}),(0,v.jsxs)(`div`,{className:`flex gap-1`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>n(`global`),className:`flex-1 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer ${t===`global`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`}`,children:`Global`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>N&&n(`project`),disabled:!N,title:N?void 0:`Open a project to edit per-project overrides`,className:`flex-1 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${t===`project`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`}`,children:e?e.name:`Per-project`})]}),t===`project`&&e&&(0,v.jsxs)(`p`,{className:`text-[11px] text-muted-foreground -mt-2`,children:[`Overrides for `,(0,v.jsx)(`span`,{className:`font-medium`,children:e.name}),`. Leave empty to use global settings.`]}),k?(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading...`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(l,{className:`text-xs`,children:`Files to Exclude`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Glob patterns hidden from the file tree and palette.`}),(0,v.jsx)(y,{value:r,onChange:i,placeholder:`e.g. **/*.log or node_modules/**`,disabled:C})]}),(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(l,{className:`text-xs`,children:`Search to Exclude`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Glob patterns excluded from file index / palette search.`}),(0,v.jsx)(y,{value:c,onChange:u,placeholder:`e.g. dist/** or **/*.min.js`,disabled:C})]}),(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(l,{className:`text-xs`,children:`Use .gitignore rules`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Respect .gitignore when filtering the file tree and index.`})]}),(0,v.jsx)(s,{checked:x,onCheckedChange:S,disabled:C})]}),D&&(0,v.jsx)(`p`,{className:`text-[11px] text-destructive`,children:D}),(0,v.jsx)(o,{onClick:M,disabled:C||k,size:`sm`,className:`h-8 text-xs w-full cursor-pointer`,children:C?`Saving...`:T?`Saved`:`Save`})]})]})}export{x as FilesSettingsSection};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./x-YDu4m2Iq.js";import{n as i}from"./api-client-oY1tC3tM.js";import{i as a}from"./project-store-BuY7rxn_.js";import{t as o}from"./button-2WCAS8dI.js";import{G as s,X as c,Y as l,Yn as u,gn as d}from"./index-yV5RgBDh.js";import{t as f}from"./separator-BzGoTlR7.js";var p=e(t(),1);function m(){return i.get(`/api/settings/files`)}function h(e){return i.patch(`/api/settings/files`,e)}function g(e){return i.get(`/api/projects/${encodeURIComponent(e)}/settings`)}function _(e,t){return i.patch(`/api/projects/${encodeURIComponent(e)}/settings`,t)}var v=n();function y({value:e,onChange:t,placeholder:n=`e.g. **/*.log`,disabled:i=!1}){let a=(0,p.useRef)([]);function s(n,r){let i=[...e];i[n]=r,t(i)}function l(n){t(e.filter((e,t)=>t!==n)),setTimeout(()=>{let e=Math.max(n-1,0);a.current[e]?.focus()},0)}function d(){t([...e,``]),setTimeout(()=>{a.current[e.length]?.focus()},0)}function f(t,n){n.key===`Enter`?(n.preventDefault(),e[t]?.trim()&&d()):n.key===`Backspace`&&e[t]===``&&(n.preventDefault(),l(t))}return(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[e.length===0&&(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No patterns. Click "Add pattern" to start.`}),e.map((e,t)=>(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(c,{ref:e=>{a.current[t]=e},value:e,onChange:e=>s(t,e.target.value),onKeyDown:e=>f(t,e),placeholder:n,disabled:i,className:`h-8 text-xs flex-1 font-mono`,"aria-label":`Pattern ${t+1}`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>l(t),disabled:i,"aria-label":`Remove pattern ${t+1}`,className:`shrink-0 flex items-center justify-center p-2.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-40 disabled:pointer-events-none`,children:(0,v.jsx)(r,{className:`size-3.5`})})]},t)),(0,v.jsxs)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:d,disabled:i,className:`h-8 text-xs gap-1.5 w-full cursor-pointer`,children:[(0,v.jsx)(u,{className:`size-3.5`}),`Add pattern`]})]})}var b={filesExclude:[],searchExclude:[],useIgnoreFiles:!0};function x(){let e=a(e=>e.activeProject),[t,n]=(0,p.useState)(`global`),[r,i]=(0,p.useState)([]),[c,u]=(0,p.useState)([]),[x,S]=(0,p.useState)(!0),[C,w]=(0,p.useState)(!1),[T,E]=(0,p.useState)(!1),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(!1),j=(0,p.useRef)(null);(0,p.useEffect)(()=>{j.current?.abort();let n=new AbortController;return j.current=n,A(!0),O(null),(async()=>{try{if(t===`global`){let e=await m();if(n.signal.aborted)return;i(e.filesExclude),u(e.searchExclude),S(e.useIgnoreFiles)}else{if(!e)return;let t=await g(e.name);if(n.signal.aborted)return;let r=t.files??{};i(r.filesExclude??b.filesExclude),u(r.searchExclude??b.searchExclude),S(r.useIgnoreFiles??b.useIgnoreFiles)}}catch(e){if(n.signal.aborted)return;O(e.message)}finally{n.signal.aborted||A(!1)}})(),()=>n.abort()},[t,e?.name]);let M=async()=>{w(!0),E(!1),O(null);try{let n={filesExclude:r.filter(e=>e.trim()!==``),searchExclude:c.filter(e=>e.trim()!==``),useIgnoreFiles:x};if(t===`global`)await h(n);else{if(!e)throw Error(`No active project`);await _(e.name,{files:n})}let i=d.getState();i.invalidateIndex(),e&&i.loadIndex(e.name),E(!0),setTimeout(()=>E(!1),2e3)}catch(e){O(e.message)}finally{w(!1)}},N=!!e;return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`File Filters`}),(0,v.jsxs)(`div`,{className:`flex gap-1`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>n(`global`),className:`flex-1 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer ${t===`global`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`}`,children:`Global`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>N&&n(`project`),disabled:!N,title:N?void 0:`Open a project to edit per-project overrides`,className:`flex-1 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${t===`project`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-accent`}`,children:e?e.name:`Per-project`})]}),t===`project`&&e&&(0,v.jsxs)(`p`,{className:`text-[11px] text-muted-foreground -mt-2`,children:[`Overrides for `,(0,v.jsx)(`span`,{className:`font-medium`,children:e.name}),`. Leave empty to use global settings.`]}),k?(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading...`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(l,{className:`text-xs`,children:`Files to Exclude`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Glob patterns hidden from the file tree and palette.`}),(0,v.jsx)(y,{value:r,onChange:i,placeholder:`e.g. **/*.log or node_modules/**`,disabled:C})]}),(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(l,{className:`text-xs`,children:`Search to Exclude`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Glob patterns excluded from file index / palette search.`}),(0,v.jsx)(y,{value:c,onChange:u,placeholder:`e.g. dist/** or **/*.min.js`,disabled:C})]}),(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(l,{className:`text-xs`,children:`Use .gitignore rules`}),(0,v.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Respect .gitignore when filtering the file tree and index.`})]}),(0,v.jsx)(s,{checked:x,onCheckedChange:S,disabled:C})]}),D&&(0,v.jsx)(`p`,{className:`text-[11px] text-destructive`,children:D}),(0,v.jsx)(o,{onClick:M,disabled:C||k,size:`sm`,className:`h-8 text-xs w-full cursor-pointer`,children:C?`Saving...`:T?`Saved`:`Save`})]})]})}export{x as FilesSettingsSection};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./check-DN75Ucvz.js";import{t as i}from"./eye-off-GjXVuAOn.js";import{t as a}from"./eye-gWwaF4Lg.js";import{t as o}from"./key-round-CQpDrDxg.js";import{a as s,n as c}from"./api-client-oY1tC3tM.js";import"./vendor-mermaid-CKKtYuTV.js";import{t as l}from"./settings-store-DWUx3865.js";import"./streaming-store-9_9j70zt.js";import{t as u}from"./button-2WCAS8dI.js";import{G as d,It as f,Rn as p,X as m,Y as h,a as g}from"./index-DdMq4zqb.js";import{t as _}from"./separator-BzGoTlR7.js";var v=e(t(),1),y=n();function b(){let[e,t]=(0,v.useState)(!1),[n,l]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),w=d.length>0&&n!==d,T=n.trim().length>=4&&n===d&&!g,E=(0,v.useCallback)(async()=>{if(T){_(!0),C(null);try{let{token:e}=await c.put(`/api/settings/auth/password`,{password:n.trim(),confirm:d.trim()});s(e),x(!0),l(``),f(``),setTimeout(()=>{x(!1),t(!1)},1500)}catch(e){C(e instanceof Error?e.message:`Failed to change password`)}finally{_(!1)}}},[T,n,d]);return e?(0,y.jsxs)(`section`,{className:`space-y-2`,children:[(0,y.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Change Password`}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(m,{type:p?`text`:`password`,placeholder:`New password`,value:n,onChange:e=>l(e.target.value),className:`h-8 text-xs pr-8`,autoFocus:!0}),(0,y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground cursor-pointer`,onClick:()=>h(!p),tabIndex:-1,children:p?(0,y.jsx)(i,{className:`size-3.5`}):(0,y.jsx)(a,{className:`size-3.5`})})]}),(0,y.jsx)(m,{type:p?`text`:`password`,placeholder:`Confirm password`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&E()},className:`h-8 text-xs`}),w&&(0,y.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Passwords do not match`}),S&&(0,y.jsx)(`p`,{className:`text-[11px] text-destructive`,children:S}),(0,y.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,y.jsx)(u,{variant:`outline`,size:`sm`,className:`h-8 text-xs flex-1 cursor-pointer`,onClick:()=>{t(!1),l(``),f(``),C(null)},children:`Cancel`}),(0,y.jsx)(u,{variant:b?`default`:`outline`,size:`sm`,className:`h-8 text-xs flex-1 cursor-pointer`,disabled:!T,onClick:E,children:g?`...`:b?(0,y.jsx)(r,{className:`size-3.5`}):`Save`})]}),(0,y.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Min 4 characters. You'll stay logged in on this device.`})]})]}):(0,y.jsxs)(`section`,{className:`space-y-2`,children:[(0,y.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Security`}),(0,y.jsxs)(u,{variant:`outline`,size:`sm`,className:`h-8 text-xs gap-1.5 cursor-pointer`,onClick:()=>t(!0),children:[(0,y.jsx)(o,{className:`size-3.5`}),`Change Password`]})]})}function x(){let{deviceName:e,setDeviceName:t,version:n,keepScreenAwake:i,setKeepScreenAwake:a}=l(f(e=>({deviceName:e.deviceName,setDeviceName:e.setDeviceName,version:e.version,keepScreenAwake:e.keepScreenAwake,setKeepScreenAwake:e.setKeepScreenAwake}))),[o]=(0,v.useState)(g),[s,c]=(0,v.useState)(e??``),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(!1),T=(0,v.useRef)(void 0),E=s.trim()!==(e??``),D=(0,v.useCallback)(async()=>{if(E){S(!0);try{await t(s),w(!0),clearTimeout(T.current),T.current=setTimeout(()=>w(!1),2e3)}finally{S(!1)}}},[s,E,t]);return(0,y.jsxs)(`div`,{className:`space-y-6`,children:[(0,y.jsxs)(`section`,{className:`space-y-2`,children:[(0,y.jsx)(h,{htmlFor:`device-name`,children:`Device Name`}),(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(m,{id:`device-name`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&D()},placeholder:`My Device`,className:`flex-1`,maxLength:100}),(0,y.jsx)(u,{variant:C?`default`:`outline`,className:`cursor-pointer shrink-0`,disabled:!E||x,onClick:D,children:x?`...`:C?(0,y.jsx)(r,{className:`size-4`}):`Save`})]}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shown in page title and synced to PPM Cloud.`})]}),(0,y.jsx)(_,{}),(0,y.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,y.jsx)(p,{className:`size-4 text-muted-foreground shrink-0`}),(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium`,children:`Keep Screen Awake`}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o===`insecure`?`Unavailable over plain HTTP — reach PPM through its HTTPS tunnel address to use this.`:o===`unsupported`?`This browser does not support screen wake locks.`:`Stop this device dimming while a chat turn is running.`})]})]}),(0,y.jsx)(d,{checked:i&&o===`ok`,disabled:o!==`ok`,onCheckedChange:a})]}),(0,y.jsx)(_,{}),(0,y.jsx)(b,{}),(0,y.jsx)(_,{}),(0,y.jsxs)(`section`,{className:`space-y-1`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-medium`,children:`About`}),(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`PPM — Personal Project Manager`}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A mobile-first web IDE for managing your projects.`}),n&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums`,children:[`Version `,n]})]})]})}export{x as GeneralSettingsSection};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./check-DN75Ucvz.js";import{t as i}from"./eye-off-GjXVuAOn.js";import{t as a}from"./eye-gWwaF4Lg.js";import{t as o}from"./key-round-CQpDrDxg.js";import{a as s,n as c}from"./api-client-oY1tC3tM.js";import"./vendor-mermaid-CKKtYuTV.js";import{t as l}from"./settings-store-DWUx3865.js";import"./streaming-store-9_9j70zt.js";import{t as u}from"./button-2WCAS8dI.js";import{G as d,It as f,Rn as p,X as m,Y as h,a as g}from"./index-yV5RgBDh.js";import{t as _}from"./separator-BzGoTlR7.js";var v=e(t(),1),y=n();function b(){let[e,t]=(0,v.useState)(!1),[n,l]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),w=d.length>0&&n!==d,T=n.trim().length>=4&&n===d&&!g,E=(0,v.useCallback)(async()=>{if(T){_(!0),C(null);try{let{token:e}=await c.put(`/api/settings/auth/password`,{password:n.trim(),confirm:d.trim()});s(e),x(!0),l(``),f(``),setTimeout(()=>{x(!1),t(!1)},1500)}catch(e){C(e instanceof Error?e.message:`Failed to change password`)}finally{_(!1)}}},[T,n,d]);return e?(0,y.jsxs)(`section`,{className:`space-y-2`,children:[(0,y.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Change Password`}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(m,{type:p?`text`:`password`,placeholder:`New password`,value:n,onChange:e=>l(e.target.value),className:`h-8 text-xs pr-8`,autoFocus:!0}),(0,y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground cursor-pointer`,onClick:()=>h(!p),tabIndex:-1,children:p?(0,y.jsx)(i,{className:`size-3.5`}):(0,y.jsx)(a,{className:`size-3.5`})})]}),(0,y.jsx)(m,{type:p?`text`:`password`,placeholder:`Confirm password`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&E()},className:`h-8 text-xs`}),w&&(0,y.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Passwords do not match`}),S&&(0,y.jsx)(`p`,{className:`text-[11px] text-destructive`,children:S}),(0,y.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,y.jsx)(u,{variant:`outline`,size:`sm`,className:`h-8 text-xs flex-1 cursor-pointer`,onClick:()=>{t(!1),l(``),f(``),C(null)},children:`Cancel`}),(0,y.jsx)(u,{variant:b?`default`:`outline`,size:`sm`,className:`h-8 text-xs flex-1 cursor-pointer`,disabled:!T,onClick:E,children:g?`...`:b?(0,y.jsx)(r,{className:`size-3.5`}):`Save`})]}),(0,y.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Min 4 characters. You'll stay logged in on this device.`})]})]}):(0,y.jsxs)(`section`,{className:`space-y-2`,children:[(0,y.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Security`}),(0,y.jsxs)(u,{variant:`outline`,size:`sm`,className:`h-8 text-xs gap-1.5 cursor-pointer`,onClick:()=>t(!0),children:[(0,y.jsx)(o,{className:`size-3.5`}),`Change Password`]})]})}function x(){let{deviceName:e,setDeviceName:t,version:n,keepScreenAwake:i,setKeepScreenAwake:a}=l(f(e=>({deviceName:e.deviceName,setDeviceName:e.setDeviceName,version:e.version,keepScreenAwake:e.keepScreenAwake,setKeepScreenAwake:e.setKeepScreenAwake}))),[o]=(0,v.useState)(g),[s,c]=(0,v.useState)(e??``),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(!1),T=(0,v.useRef)(void 0),E=s.trim()!==(e??``),D=(0,v.useCallback)(async()=>{if(E){S(!0);try{await t(s),w(!0),clearTimeout(T.current),T.current=setTimeout(()=>w(!1),2e3)}finally{S(!1)}}},[s,E,t]);return(0,y.jsxs)(`div`,{className:`space-y-6`,children:[(0,y.jsxs)(`section`,{className:`space-y-2`,children:[(0,y.jsx)(h,{htmlFor:`device-name`,children:`Device Name`}),(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(m,{id:`device-name`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&D()},placeholder:`My Device`,className:`flex-1`,maxLength:100}),(0,y.jsx)(u,{variant:C?`default`:`outline`,className:`cursor-pointer shrink-0`,disabled:!E||x,onClick:D,children:x?`...`:C?(0,y.jsx)(r,{className:`size-4`}):`Save`})]}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shown in page title and synced to PPM Cloud.`})]}),(0,y.jsx)(_,{}),(0,y.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,y.jsx)(p,{className:`size-4 text-muted-foreground shrink-0`}),(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium`,children:`Keep Screen Awake`}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o===`insecure`?`Unavailable over plain HTTP — reach PPM through its HTTPS tunnel address to use this.`:o===`unsupported`?`This browser does not support screen wake locks.`:`Stop this device dimming while a chat turn is running.`})]})]}),(0,y.jsx)(d,{checked:i&&o===`ok`,disabled:o!==`ok`,onCheckedChange:a})]}),(0,y.jsx)(_,{}),(0,y.jsx)(b,{}),(0,y.jsx)(_,{}),(0,y.jsxs)(`section`,{className:`space-y-1`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-medium`,children:`About`}),(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`PPM — Personal Project Manager`}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A mobile-first web IDE for managing your projects.`}),n&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums`,children:[`Version `,n]})]})]})}export{x as GeneralSettingsSection};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{i as a,n as o}from"./api-client-oY1tC3tM.js";import{n as s}from"./utils-C9OjCrou.js";import{i as c}from"./project-store-BuY7rxn_.js";import{It as l,Ln as u,Lr as d,Rr as f,Tr as p,hr as m,qn as h}from"./index-DdMq4zqb.js";var g=r(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_=e(t(),1),v=n(),y=[`#2563eb`,`#16a34a`,`#d97706`,`#9333ea`,`#dc2626`,`#0891b2`,`#c026d3`,`#ea580c`];function b(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return y[Math.abs(t)%y.length]}function x({name:e,syncState:t,isHead:n,isTag:r,className:i}){let a=r?`#d97706`:b(e),o=r?u:t===`synced`?p:t===`ahead`?d:t===`behind`?f:t===`remote-only`?p:g,c=r?`Tag: ${e}`:t===`synced`?`${e} — synced with remote`:t===`ahead`?`${e} — ahead of remote`:t===`behind`?`${e} — behind remote`:t===`remote-only`?`${e} — remote only`:`${e} — local only`;return(0,v.jsxs)(`span`,{className:s(`inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium leading-tight max-w-[220px]`,n&&`ring-1 ring-offset-1 ring-offset-background`,t===`remote-only`&&`opacity-70`,i),style:{borderColor:a,backgroundColor:a+`1A`,color:`var(--text)`,...n?{"--tw-ring-color":a}:{}},title:c,children:[(0,v.jsx)(o,{className:`size-3 shrink-0`,style:{color:a}}),(0,v.jsx)(`span`,{className:`truncate`,children:e})]})}function S(e,t,n,r){let i=[],a=e===r;for(let e of t)e.startsWith(`tag: `)&&i.push({name:e.slice(5),syncState:`synced`,isTag:!0});let o=n.filter(t=>t.commitHash===e),s=o.filter(e=>!e.remote),c=o.filter(e=>e.remote);new Set(s.map(e=>e.name));let l=new Set;for(let e of s){let t=`local-only`;e.remotes.length>0&&(t=e.ahead>0&&e.behind===0?`ahead`:e.behind>0&&e.ahead===0?`behind`:`synced`),i.push({name:e.name,syncState:t,isHead:a&&e.current});for(let t of c){let n=t.name.replace(/^remotes\//,``),r=n.indexOf(`/`);r<0||n.slice(r+1)===e.name&&l.add(t.name)}}for(let e of c){if(l.has(e.name))continue;let t=e.name.replace(/^remotes\//,``);i.push({name:t,syncState:`remote-only`})}return i}var C=100;function w({metadata:e}){let t=e?.projectName??c(l(e=>e.activeProject))?.name,[n,r]=(0,_.useState)(null),[s,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!0),p=(0,_.useRef)(null),g=(0,_.useCallback)(async(e=0,n=!1)=>{if(t){u(!0);try{let i=await o.get(`${a(t)}/git/graph?max=${C}&skip=${e}`);r(e=>n&&e?{...i,commits:[...e.commits,...i.commits]}:i),f(i.commits.length===C)}catch{}u(!1)}},[t]);(0,_.useEffect)(()=>{g()},[g]);let y=(0,_.useCallback)(()=>{s||!d||!n||g(n.commits.length,!0)},[s,d,n,g]),b=(0,_.useCallback)(e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&y()},[y]);return t?(0,v.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[(0,v.jsx)(m,{className:`size-4 text-text-secondary`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:`Git Log`}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:n?`${n.commits.length} commits`:``}),(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`button`,{onClick:()=>g(),disabled:s,className:`p-1 rounded text-text-subtle hover:text-text-secondary transition-colors`,title:`Refresh`,children:(0,v.jsx)(h,{className:`size-3.5 ${s?`animate-spin`:``}`})})]}),!n&&s?(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,v.jsx)(i,{className:`size-5 animate-spin text-primary`})}):n&&n.commits.length===0?(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No commits yet`}):n?(0,v.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto min-h-0`,onScroll:b,children:[n.commits.map(e=>(0,v.jsx)(T,{commit:e,branches:n.branches,head:n.head},e.hash)),s&&(0,v.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,v.jsx)(i,{className:`size-4 animate-spin text-text-subtle`})}),!d&&n.commits.length>0&&(0,v.jsx)(`div`,{className:`text-center text-[10px] text-text-subtle py-3`,children:`End of history`})]}):null]}):(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`Select a project to view git log`})}function T({commit:e,branches:t,head:n}){let r=e.hash===n,i=S(e.hash,e.refs,t,n);return(0,v.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-1.5 border-b border-border/50 hover:bg-surface-elevated transition-colors ${r?`bg-primary/5`:``}`,children:[(0,v.jsx)(`div`,{className:`flex items-center pt-1 shrink-0`,children:(0,v.jsx)(`span`,{className:`size-2.5 rounded-full border-2 ${r?`border-primary bg-primary`:`border-text-subtle bg-transparent`}`})}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[i.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 mb-0.5`,children:i.map(e=>(0,v.jsx)(x,{...e},`${e.name}-${e.syncState}`))}),(0,v.jsx)(`p`,{className:`text-xs text-text-primary truncate leading-snug`,children:e.subject}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,v.jsx)(`span`,{className:`text-[10px] font-mono text-text-subtle`,children:e.abbreviatedHash}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle truncate`,children:e.authorName}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:E(e.authorDate)})]})]})]})}function E(e){let t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<30?`${a}d`:t.toLocaleDateString(`en`,{month:`short`,day:`numeric`})}export{w as GitLogPanel};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{i as a,n as o}from"./api-client-oY1tC3tM.js";import{n as s}from"./utils-C9OjCrou.js";import{i as c}from"./project-store-BuY7rxn_.js";import{It as l,Ln as u,Lr as d,Rr as f,Tr as p,hr as m,qn as h}from"./index-yV5RgBDh.js";var g=r(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_=e(t(),1),v=n(),y=[`#2563eb`,`#16a34a`,`#d97706`,`#9333ea`,`#dc2626`,`#0891b2`,`#c026d3`,`#ea580c`];function b(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return y[Math.abs(t)%y.length]}function x({name:e,syncState:t,isHead:n,isTag:r,className:i}){let a=r?`#d97706`:b(e),o=r?u:t===`synced`?p:t===`ahead`?d:t===`behind`?f:t===`remote-only`?p:g,c=r?`Tag: ${e}`:t===`synced`?`${e} — synced with remote`:t===`ahead`?`${e} — ahead of remote`:t===`behind`?`${e} — behind remote`:t===`remote-only`?`${e} — remote only`:`${e} — local only`;return(0,v.jsxs)(`span`,{className:s(`inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium leading-tight max-w-[220px]`,n&&`ring-1 ring-offset-1 ring-offset-background`,t===`remote-only`&&`opacity-70`,i),style:{borderColor:a,backgroundColor:a+`1A`,color:`var(--text)`,...n?{"--tw-ring-color":a}:{}},title:c,children:[(0,v.jsx)(o,{className:`size-3 shrink-0`,style:{color:a}}),(0,v.jsx)(`span`,{className:`truncate`,children:e})]})}function S(e,t,n,r){let i=[],a=e===r;for(let e of t)e.startsWith(`tag: `)&&i.push({name:e.slice(5),syncState:`synced`,isTag:!0});let o=n.filter(t=>t.commitHash===e),s=o.filter(e=>!e.remote),c=o.filter(e=>e.remote);new Set(s.map(e=>e.name));let l=new Set;for(let e of s){let t=`local-only`;e.remotes.length>0&&(t=e.ahead>0&&e.behind===0?`ahead`:e.behind>0&&e.ahead===0?`behind`:`synced`),i.push({name:e.name,syncState:t,isHead:a&&e.current});for(let t of c){let n=t.name.replace(/^remotes\//,``),r=n.indexOf(`/`);r<0||n.slice(r+1)===e.name&&l.add(t.name)}}for(let e of c){if(l.has(e.name))continue;let t=e.name.replace(/^remotes\//,``);i.push({name:t,syncState:`remote-only`})}return i}var C=100;function w({metadata:e}){let t=e?.projectName??c(l(e=>e.activeProject))?.name,[n,r]=(0,_.useState)(null),[s,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!0),p=(0,_.useRef)(null),g=(0,_.useCallback)(async(e=0,n=!1)=>{if(t){u(!0);try{let i=await o.get(`${a(t)}/git/graph?max=${C}&skip=${e}`);r(e=>n&&e?{...i,commits:[...e.commits,...i.commits]}:i),f(i.commits.length===C)}catch{}u(!1)}},[t]);(0,_.useEffect)(()=>{g()},[g]);let y=(0,_.useCallback)(()=>{s||!d||!n||g(n.commits.length,!0)},[s,d,n,g]),b=(0,_.useCallback)(e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&y()},[y]);return t?(0,v.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[(0,v.jsx)(m,{className:`size-4 text-text-secondary`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:`Git Log`}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:n?`${n.commits.length} commits`:``}),(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`button`,{onClick:()=>g(),disabled:s,className:`p-1 rounded text-text-subtle hover:text-text-secondary transition-colors`,title:`Refresh`,children:(0,v.jsx)(h,{className:`size-3.5 ${s?`animate-spin`:``}`})})]}),!n&&s?(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,v.jsx)(i,{className:`size-5 animate-spin text-primary`})}):n&&n.commits.length===0?(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No commits yet`}):n?(0,v.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto min-h-0`,onScroll:b,children:[n.commits.map(e=>(0,v.jsx)(T,{commit:e,branches:n.branches,head:n.head},e.hash)),s&&(0,v.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,v.jsx)(i,{className:`size-4 animate-spin text-text-subtle`})}),!d&&n.commits.length>0&&(0,v.jsx)(`div`,{className:`text-center text-[10px] text-text-subtle py-3`,children:`End of history`})]}):null]}):(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`Select a project to view git log`})}function T({commit:e,branches:t,head:n}){let r=e.hash===n,i=S(e.hash,e.refs,t,n);return(0,v.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-1.5 border-b border-border/50 hover:bg-surface-elevated transition-colors ${r?`bg-primary/5`:``}`,children:[(0,v.jsx)(`div`,{className:`flex items-center pt-1 shrink-0`,children:(0,v.jsx)(`span`,{className:`size-2.5 rounded-full border-2 ${r?`border-primary bg-primary`:`border-text-subtle bg-transparent`}`})}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[i.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 mb-0.5`,children:i.map(e=>(0,v.jsx)(x,{...e},`${e.name}-${e.syncState}`))}),(0,v.jsx)(`p`,{className:`text-xs text-text-primary truncate leading-snug`,children:e.subject}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,v.jsx)(`span`,{className:`text-[10px] font-mono text-text-subtle`,children:e.abbreviatedHash}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle truncate`,children:e.authorName}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:E(e.authorDate)})]})]})]})}function E(e){let t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<30?`${a}d`:t.toLocaleDateString(`en`,{month:`short`,day:`numeric`})}export{w as GitLogPanel};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/data-grid-overlay-editor-iRrpAV0e.js","assets/rolldown-runtime-FhOqtrmT.js","assets/dist-Bv4zQpS1.js","assets/vendor-markdown-Ls5AcU91.js","assets/vendor-ui-CaeeFO0B.js","assets/data-grid-types-B6kUrF-M.js","assets/number-overlay-editor-C_eD-Bdr.js"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./rolldown-runtime-FhOqtrmT.js";import{S as n,x as r}from"./vendor-markdown-Ls5AcU91.js";import{ft as i}from"./vendor-ui-CaeeFO0B.js";import{t as a}from"./createLucideIcon-D8pyde1A.js";import{t as o}from"./chevron-right-De-Wz5Lz.js";import{n as s,t as c}from"./sparkles-Dh-_J2Rd.js";import{t as l}from"./download-DG3_9xXy.js";import{t as u}from"./eye-gWwaF4Lg.js";import{t as d}from"./loader-circle-DPMrnLQ2.js";import{t as f}from"./save-CipGrG1k.js";import{t as p}from"./text-wrap-oiekm5SB.js";import{t as m}from"./x-YDu4m2Iq.js";import{M as h,q as g}from"./vendor-mermaid-CKKtYuTV.js";import{t as _}from"./tab-store-PZsP5ZwG.js";import{It as v,Lr as y,Mn as b,Pn as x,Qn as S,Rr as C,Wn as w,Yn as T,Zn as E,jr as D,nn as O,on as k,pr as ee,s as te,wr as ne}from"./index-DdMq4zqb.js";import{A,B as re,C as j,D as ie,E as ae,F as oe,G as M,H as se,I as N,L as ce,M as le,N as ue,O as P,P as F,R as I,S as de,T as fe,U as pe,V as me,W as he,_ as ge,a as _e,b as ve,c as L,d as ye,f as be,g as xe,h as R,i as Se,j as z,k as B,l as V,m as Ce,n as H,o as U,p as we,r as Te,s as Ee,t as W,u as De,v as Oe,w as ke,x as Ae,y as je,z as Me}from"./data-grid-types-B6kUrF-M.js";import{t as Ne}from"./dist-Bv4zQpS1.js";import{t as Pe}from"./use-monaco-theme-DOhDvEKJ.js";import{n as Fe}from"./csv-parser-CBbALsFU.js";var Ie=a(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Le=/[A-Za-z0-9_]/,Re=/^\$([A-Za-z_][A-Za-z0-9_]*)?\$/;function ze(e){let t=[],n=1,r=-1,i=1,a=0,o=(n,a)=>{if(r===-1)return;let o=e.slice(r,n).trim();o&&t.push({sql:o,startLine:i,endLine:a}),r=-1};for(;a<e.length;){let t=e[a];if(t===`
2
+ import{o as e,t}from"./rolldown-runtime-FhOqtrmT.js";import{S as n,x as r}from"./vendor-markdown-Ls5AcU91.js";import{ft as i}from"./vendor-ui-CaeeFO0B.js";import{t as a}from"./createLucideIcon-D8pyde1A.js";import{t as o}from"./chevron-right-De-Wz5Lz.js";import{n as s,t as c}from"./sparkles-Dh-_J2Rd.js";import{t as l}from"./download-DG3_9xXy.js";import{t as u}from"./eye-gWwaF4Lg.js";import{t as d}from"./loader-circle-DPMrnLQ2.js";import{t as f}from"./save-CipGrG1k.js";import{t as p}from"./text-wrap-oiekm5SB.js";import{t as m}from"./x-YDu4m2Iq.js";import{M as h,q as g}from"./vendor-mermaid-CKKtYuTV.js";import{t as _}from"./tab-store-PZsP5ZwG.js";import{It as v,Lr as y,Mn as b,Pn as x,Qn as S,Rr as C,Wn as w,Yn as T,Zn as E,jr as D,nn as O,on as k,pr as ee,s as te,wr as ne}from"./index-yV5RgBDh.js";import{A,B as re,C as j,D as ie,E as ae,F as oe,G as M,H as se,I as N,L as ce,M as le,N as ue,O as P,P as F,R as I,S as de,T as fe,U as pe,V as me,W as he,_ as ge,a as _e,b as ve,c as L,d as ye,f as be,g as xe,h as R,i as Se,j as z,k as B,l as V,m as Ce,n as H,o as U,p as we,r as Te,s as Ee,t as W,u as De,v as Oe,w as ke,x as Ae,y as je,z as Me}from"./data-grid-types-B6kUrF-M.js";import{t as Ne}from"./dist-Bv4zQpS1.js";import{t as Pe}from"./use-monaco-theme-Kj2OGDlm.js";import{n as Fe}from"./csv-parser-CBbALsFU.js";var Ie=a(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Le=/[A-Za-z0-9_]/,Re=/^\$([A-Za-z_][A-Za-z0-9_]*)?\$/;function ze(e){let t=[],n=1,r=-1,i=1,a=0,o=(n,a)=>{if(r===-1)return;let o=e.slice(r,n).trim();o&&t.push({sql:o,startLine:i,endLine:a}),r=-1};for(;a<e.length;){let t=e[a];if(t===`
3
3
  `){n++,a++;continue}if(t===` `||t===` `||t===`\r`){a++;continue}if(t===`-`&&e[a+1]===`-`){for(;a<e.length&&e[a]!==`
4
4
  `;)a++;continue}if(t===`/`&&e[a+1]===`*`){let t=1;for(a+=2;a<e.length&&t>0;){if(e[a]===`/`&&e[a+1]===`*`){t++,a+=2;continue}if(e[a]===`*`&&e[a+1]===`/`){t--,a+=2;continue}e[a]===`
5
5
  `&&n++,a++}continue}if(r===-1&&(r=a,i=n),t===`;`){o(a+1,n),a++;continue}if(t===`'`||t===`"`){let r=e[a-1],i=e[a-2],o=t===`'`&&(r===`e`||r===`E`)&&!(i!==void 0&&Le.test(i));for(a++;a<e.length;){let r=e[a];if(r===`
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./brain-KDa9jFRq.js";import{t as a}from"./chevron-right-De-Wz5Lz.js";import{n as o}from"./tool-cards-DuTlfeWN.js";import{t as s}from"./loader-circle-DPMrnLQ2.js";import{t as c}from"./send-Bb0jtcR6.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-CKKtYuTV.js";import"./settings-store-DWUx3865.js";import{n as l}from"./utils-C9OjCrou.js";import"./portal-container-context-a399Hd9F.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import{i as u}from"./project-store-BuY7rxn_.js";import"./tab-store-PZsP5ZwG.js";import"./context-menu-C13b1uT3.js";import{n as d}from"./use-is-mobile-CYW3FJFE.js";import{t as f}from"./button-2WCAS8dI.js";import{t as p}from"./mobile-bottom-sheet-B3uDlD79.js";import"./use-visual-viewport-D9O48HQt.js";import"./ws-auth-ZSZkAT6p.js";import{$n as m,$t as h,A as g,An as _,C as v,D as y,Dt as b,E as x,Et as S,It as C,O as w,Pn as T,Pt as E,S as D,T as O,Tt as k,Un as A,Xn as ee,Xt as j,Yt as M,en as N,j as te,k as P,w as ne,x as F,zn as re}from"./index-DdMq4zqb.js";import{t as I}from"./use-websocket-D9MsDysx.js";import"./use-blob-url-De-ZtcpX.js";import{t as L}from"./markdown-renderer-BfoCOrL8.js";import"./run-in-terminal-DHAvC1AG.js";var R=r(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),z=r(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),B=e(t(),1),V=8e3;function ie(e,t){let[n,r]=(0,B.useState)([]),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)(`idle`),[c,l]=(0,B.useState)({}),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(null),b=(0,B.useRef)(new Map),x=(0,B.useCallback)(e=>{l(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})},[]),S=(0,B.useCallback)(e=>{let t;try{t=JSON.parse(e.data)}catch{return}switch(t.type){case`ping`:return;case`group_state`:p(!0),s(t.status),a(t.members),h(t.status===`active`);return;case`group_message`:x(t.message.fromMember),r(e=>e.some(e=>e.id===t.message.id)?e:[...e,t.message]);return;case`member_status`:a(e=>e.map(e=>e.id===t.memberId?{...e,status:t.status}:e));return;case`typing`:{l(e=>({...e,[t.member]:!0}));let e=b.current,n=e.get(t.member);n&&clearTimeout(n),e.set(t.member,setTimeout(()=>x(t.member),V));return}case`turn_done`:return;case`group_done`:h(!1),s(`idle`),l({});return;case`error`:_(t.message),h(!1);return}},[x]),{send:C}=I({url:e&&t?`/ws/project/${encodeURIComponent(t)}/group/${encodeURIComponent(e)}`:``,onMessage:S,autoConnect:!!e&&!!t});return(0,B.useEffect)(()=>{let t=!1;r([]),a([]),l({}),s(`idle`),h(!1),_(null),p(!1);for(let e of b.current.values())clearTimeout(e);if(b.current.clear(),e)return d(!0),v(e,{limit:200}).then(e=>{t||r(t=>{let n=new Set(e.messages.map(e=>e.id)),r=t.filter(e=>!n.has(e.id));return[...e.messages,...r]})}).catch(e=>{t||_(e instanceof Error?e.message:`Failed to load feed`)}).finally(()=>{t||d(!1)}),()=>{t=!0}},[e]),{messages:n,members:i,status:o,typing:c,loading:u,isConnected:f,isRunning:m,error:g,sendMessage:(0,B.useCallback)(t=>{let n=t.trim();!n||!e||(_(null),h(!0),f?C(JSON.stringify({type:`message`,content:n})):w(e,n).catch(e=>{_(e instanceof Error?e.message:`Failed to send message`),h(!1)}))},[e,f,C]),stop:(0,B.useCallback)(()=>{e&&(f?C(JSON.stringify({type:`stop`})):P(e).catch(()=>{}),s(`paused`),h(!1))},[e,f,C]),resume:(0,B.useCallback)(()=>{e&&y(e).then(()=>{s(`active`),h(!0)}).catch(e=>_(e instanceof Error?e.message:`Failed to resume`))},[e])}}var H=n();function U(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}function W(e){try{let t=e<0xe8d4a51000?e*1e3:e;return new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{return``}}function G(e,t){return e.split(/(@[\p{L}\p{N}_]+)/gu).map((e,n)=>{if(e.startsWith(`@`)&&e.length>1){let r=t(e.slice(1));return(0,H.jsx)(`span`,{className:l(`font-semibold`,!r&&`text-primary`),style:r?{color:r}:void 0,children:e},n)}return e})}var ae=(0,B.memo)(function({message:e,colorFor:t,isLeader:n,onViewFull:r}){let i=e.fromMember===`user`,a=i?`You`:e.fromMember,o=i?`var(--color-primary)`:t(e.fromMember)??`var(--accent)`,s=!i&&n(e.fromMember),c=e.summary??``,u=e.toMember&&e.toMember!==`all`?e.toMember:null,d=(0,H.jsxs)(`div`,{className:l(`group relative flex gap-2.5 px-3 py-2 transition-colors hover:bg-surface-elevated/50`,i&&`bg-primary/5`),style:{boxShadow:`inset 3px 0 0 0 ${o}`},children:[e.fullSessionRef&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(e),title:`View full transcript (AI's raw thinking / debug)`,"aria-label":`View full transcript`,className:`absolute right-1.5 top-1.5 hidden items-center rounded p-1 text-text-subtle/60 hover:bg-surface-elevated hover:text-text-secondary can-hover:group-hover:inline-flex`,children:(0,H.jsx)(R,{className:`size-3.5`})}),(0,H.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold text-white ring-2 ring-background`,style:{backgroundColor:o},"aria-hidden":!0,children:U(a)}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 can-hover:pr-6`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-semibold`,style:{color:i?`var(--color-foreground)`:o},children:a}),s&&(0,H.jsx)(`span`,{className:`rounded bg-surface-elevated px-1.5 py-px text-[10px] font-medium text-text-secondary`,children:`leader`}),u&&(0,H.jsxs)(`span`,{className:`text-[11px] text-text-subtle`,children:[`→ `,u]}),(0,H.jsx)(`span`,{className:`text-[11px] text-text-subtle`,children:W(e.createdAt)})]}),(0,H.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-relaxed text-text-secondary`,children:G(c,t)})]})]});return e.fullSessionRef?(0,H.jsxs)(k,{children:[(0,H.jsx)(E,{asChild:!0,children:d}),(0,H.jsx)(S,{children:(0,H.jsxs)(b,{onClick:()=>r(e),children:[(0,H.jsx)(R,{className:`size-4`}),` View full transcript`]})})]}):d}),K={idle:`bg-text-subtle`,working:`bg-primary animate-pulse`,done:`bg-emerald-500`,error:`bg-destructive`},q={idle:`Idle`,working:`Working`,done:`Done`,error:`Error`},J=(0,B.memo)(function({members:e,liveStatus:t,typing:n,busy:r,onAdd:i,onEdit:a,onRemove:o}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5 p-2`,children:[e.map(e=>{let i=n[e.name],s=t.get(e.id)??e.status;return(0,H.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md px-2 py-1.5`,children:[(0,H.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-[10px] font-semibold text-white ring-2 ring-background`,style:{backgroundColor:e.color??`var(--accent)`},"aria-hidden":!0,children:e.name.slice(0,1).toUpperCase()}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`truncate text-xs font-medium`,style:{color:e.color??`var(--color-foreground)`},children:e.name}),e.role===`leader`&&(0,H.jsx)(`span`,{className:`rounded-sm bg-accent-wash px-1 text-[9px] font-semibold uppercase text-primary`,children:`lead`})]}),(0,H.jsx)(`span`,{className:`block truncate text-[10px] text-text-subtle`,children:i?`typing…`:e.persona||q[s]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 can-hover:opacity-0 can-hover:group-hover:opacity-100`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(e),disabled:r,"aria-label":`Edit ${e.name}`,className:`flex size-8 items-center justify-center rounded-md text-text-subtle hover:bg-surface-elevated hover:text-foreground active:bg-surface-elevated disabled:opacity-40`,children:(0,H.jsx)(m,{className:`size-3.5`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>o(e),disabled:r,"aria-label":`Remove ${e.name}`,className:`flex size-8 items-center justify-center rounded-md text-text-subtle hover:bg-surface-elevated hover:text-destructive active:bg-surface-elevated disabled:opacity-40`,children:(0,H.jsx)(T,{className:`size-3.5`})})]}),(0,H.jsx)(`span`,{className:l(`size-2 shrink-0 rounded-full`,K[s]),title:q[s],"aria-hidden":!0})]},e.id)}),(0,H.jsxs)(`button`,{type:`button`,onClick:i,disabled:r,className:`mt-1 flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium text-primary hover:bg-surface-elevated active:bg-surface-elevated disabled:opacity-40`,children:[(0,H.jsx)(z,{className:`size-4`}),` Add member`]})]})}),Y=`w-full min-h-[40px] rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-text-subtle focus:outline-none focus:ring-1 focus:ring-primary`;function oe({open:e,member:t,projectName:n,providerId:r=`claude`,onSubmit:i,onClose:a}){let o=d(),[c,l]=(0,B.useState)(t?.name??``),[u,m]=(0,B.useState)(t?.persona??``),[g,_]=(0,B.useState)(t?.model??null),[v,y]=(0,B.useState)(t?.role===`leader`),[b,x]=(0,B.useState)(!1),[S,C]=(0,B.useState)(null),w=(0,B.useCallback)(async()=>{let e=c.trim();if(!e){C(`Name is required`);return}x(!0),C(null);try{await i({name:e,persona:u.trim()||null,model:g,role:v?`leader`:`member`}),a()}catch(e){C(e instanceof Error?e.message:`Failed to save member`),x(!1)}},[c,u,g,v,i,a]),T=t?.role===`leader`,E=(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 px-1 py-1`,children:[(0,H.jsx)(`input`,{className:Y,value:c,onChange:e=>l(e.target.value),placeholder:`Member name`,autoFocus:!0}),(0,H.jsx)(`input`,{className:Y,value:u,onChange:e=>m(e.target.value),placeholder:`Persona (optional)`}),(0,H.jsx)(F,{value:g,onChange:_,projectName:n,providerId:r}),(0,H.jsxs)(`label`,{className:X(T),children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-primary)]`,checked:v,disabled:T,onChange:e=>y(e.target.checked)}),(0,H.jsx)(`span`,{children:T?`Leader (reassign from another member)`:`Set as leader`})]}),S&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:S}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,H.jsx)(f,{variant:`outline`,onClick:a,disabled:b,children:`Cancel`}),(0,H.jsxs)(f,{onClick:w,disabled:b,children:[b&&(0,H.jsx)(s,{className:`mr-1.5 size-4 animate-spin`}),t?`Save`:`Add member`]})]})]});if(!e)return null;let D=t?`Edit member`:`Add member`;return o?(0,H.jsx)(p,{open:!0,onClose:a,className:`flex max-h-[90vh] flex-col`,children:(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col px-4 pb-2`,children:[(0,H.jsx)(`h2`,{className:`mb-2 text-base font-semibold text-foreground`,children:D}),E]})}):(0,H.jsx)(M,{open:!0,onOpenChange:e=>{e||a()},children:(0,H.jsxs)(j,{className:`flex flex-col sm:max-w-md`,children:[(0,H.jsx)(h,{children:(0,H.jsx)(N,{children:D})}),E]})})}function X(e){return`flex items-center gap-2 text-sm text-text-secondary ${e?`opacity-60`:``}`}function se({messages:e,config:t,projectName:n}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t&&(0,H.jsx)(Z,{config:t}),e.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-text-subtle`,children:e.role===`user`?`User`:e.role===`assistant`?`Assistant`:e.role}),(0,H.jsx)(ce,{message:e,projectName:n})]},e.id)),e.length===0&&(0,H.jsx)(`p`,{className:`py-6 text-center text-sm text-text-subtle`,children:`Transcript is empty.`})]})}function ce({message:e,projectName:t}){let n=e.events??[];if(n.length===0)return e.content.trim()?(0,H.jsx)(L,{content:e.content}):null;let r=new Map;for(let e of n)e.type===`tool_result`&&e.toolUseId&&r.set(e.toolUseId,e);return(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.map((e,n)=>{if(e.type===`text`)return e.content.trim()?(0,H.jsx)(L,{content:e.content},n):null;if(e.type===`thinking`)return(0,H.jsx)(le,{content:e.content},n);if(e.type===`tool_use`){let i=e.toolUseId?r.get(e.toolUseId):void 0;return(0,H.jsx)(o,{tool:e,result:i,completed:!!i,projectName:t},n)}return null})})}function le({content:e}){let[t,n]=(0,B.useState)(!1);return(0,H.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-elevated/40`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-xs text-text-subtle hover:text-text-secondary`,children:[(0,H.jsx)(a,{className:l(`size-3.5 transition-transform`,t&&`rotate-90`)}),(0,H.jsx)(i,{className:`size-3.5`}),(0,H.jsx)(`span`,{children:`Thinking`})]}),t&&(0,H.jsx)(`div`,{className:`border-t border-border px-3 py-2 text-xs leading-relaxed text-text-secondary`,children:(0,H.jsx)(L,{content:e})})]})}function Z({config:e}){let[t,n]=(0,B.useState)(!1),r=[[`Model`,e.model],[`Permission`,e.permissionMode],[`CWD`,e.cwd],[`Git branch`,e.gitBranch],[`CLI version`,e.version]].filter(([,e])=>e);return r.length===0?null:(0,H.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-elevated/40`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-text-secondary hover:text-foreground`,children:[(0,H.jsx)(a,{className:l(`size-3.5 transition-transform`,t&&`rotate-90`)}),(0,H.jsx)(A,{className:`size-3.5`}),(0,H.jsx)(`span`,{children:`Input config`})]}),t&&(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 border-t border-border px-3 py-2 text-xs`,children:r.map(([e,t])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{className:`text-text-subtle`,children:e}),(0,H.jsx)(`dd`,{className:`break-all font-mono text-text-secondary`,children:t})]},e))})]})}function ue({groupId:e,message:t,onClose:n}){let r=d(),[i,a]=(0,B.useState)(null),[o,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),f=t?.fullSessionRef??null;if((0,B.useEffect)(()=>{if(!t||!f)return;let n=!1;return a(null),u(null),c(!0),O(e,f).then(e=>{n||a(e)}).catch(e=>{n||u(e instanceof Error?e.message:`Failed to load transcript`)}).finally(()=>{n||c(!1)}),()=>{n=!0}},[e,f,t]),!t)return null;let m=(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[o&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,H.jsx)(s,{className:`size-5 animate-spin text-primary`})}),l&&(0,H.jsxs)(`div`,{className:`px-1 py-4 text-sm text-text-secondary`,children:[(0,H.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Full transcript unavailable`}),(0,H.jsx)(`p`,{className:`text-xs text-text-subtle`,children:l}),t.summary&&(0,H.jsx)(`pre`,{className:`mt-4 whitespace-pre-wrap break-words rounded-md bg-surface-elevated p-3 text-xs leading-relaxed text-text-secondary`,children:t.summary})]}),!o&&!l&&i!=null&&(0,H.jsx)(`div`,{className:`px-1 py-1`,children:(0,H.jsx)(se,{messages:i.messages,config:i.config})})]}),g=`${t.fromMember} — full transcript`;return r?(0,H.jsx)(p,{open:!0,onClose:n,className:`max-h-[85vh] flex flex-col`,children:(0,H.jsxs)(`div`,{className:`flex flex-col min-h-0 px-4 pb-2`,children:[(0,H.jsx)(`h2`,{className:`mb-2 text-sm font-semibold text-foreground`,children:g}),m]})}):(0,H.jsx)(M,{open:!0,onOpenChange:e=>{e||n()},children:(0,H.jsxs)(j,{className:`flex max-h-[80vh] flex-col sm:max-w-2xl`,children:[(0,H.jsx)(h,{children:(0,H.jsx)(N,{className:`text-sm`,children:g})}),m]})})}function Q({metadata:e}){let t=e?.groupId??null,{activeProject:n}=u(C(e=>({activeProject:e.activeProject}))),r=e?.projectName??n?.name??``,i=d(),{messages:a,members:o,status:m,typing:h,loading:v,isRunning:y,error:b,sendMessage:S,stop:w,resume:T}=ie(t,r),[E,O]=(0,B.useState)(``),[k,A]=(0,B.useState)(null),[j,M]=(0,B.useState)(!1),N=(0,B.useRef)(null),[P,F]=(0,B.useState)([]),[I,L]=(0,B.useState)(null),[R,z]=(0,B.useState)(!1),[V,U]=(0,B.useState)(null),[W,G]=(0,B.useState)(null),K=(0,B.useCallback)(async()=>{if(t)try{let e=await ne(t);F(e.members),L(e.maxTurns)}catch{}},[t]),q=(0,B.useCallback)(async e=>{if(!t)return;let n=Math.max(1,Math.min(50,Math.floor(e)||1));L(n);try{await te(t,{maxTurns:n})}catch{K()}},[t,K]);(0,B.useEffect)(()=>{F([]),K()},[t,K]),(0,B.useEffect)(()=>{N.current?.scrollIntoView({block:`end`})},[a.length,h]);let Y=(0,B.useMemo)(()=>new Map(o.map(e=>[e.id,e.status])),[o]),X=P.length?P:o,se=(0,B.useMemo)(()=>{let e=new Map(X.map(e=>[e.name,e.color]));return t=>e.get(t)??null},[X]),ce=(0,B.useMemo)(()=>{let e=new Set(X.filter(e=>e.role===`leader`).map(e=>e.name));return t=>e.has(t)},[X]),le=(0,B.useCallback)(async e=>{t&&(W?.member?await g(t,W.member.id,e):await D(t,e),await K())},[t,W,K]),Z=(0,B.useCallback)(async e=>{if(t){z(!0),U(null);try{await x(t,e.id),await K()}catch(e){U(e instanceof Error?e.message:`Failed to remove member`)}finally{z(!1)}}},[t,K]),Q=(0,B.useCallback)(()=>{let e=E.trim();e&&(S(e),O(``))},[E,S]),$=Object.keys(h).filter(e=>h[e]);return t?(0,H.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-border px-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,H.jsx)(`span`,{className:l(`size-2 rounded-full`,m===`active`?`bg-primary animate-pulse`:m===`paused`?`bg-amber-500`:`bg-text-subtle`)}),(0,H.jsx)(`span`,{className:`capitalize`,children:m})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[y?(0,H.jsxs)(f,{size:`sm`,variant:`outline`,onClick:w,className:`h-8`,children:[(0,H.jsx)(re,{className:`mr-1 size-3.5`}),` Stop`]}):m===`paused`?(0,H.jsxs)(f,{size:`sm`,variant:`outline`,onClick:T,className:`h-8`,children:[(0,H.jsx)(ee,{className:`mr-1 size-3.5`}),` Resume`]}):null,(0,H.jsx)(`button`,{type:`button`,onClick:()=>M(e=>!e),className:`flex size-8 items-center justify-center rounded-md text-text-subtle hover:bg-surface-elevated hover:text-foreground`,"aria-label":`Toggle roster`,children:(0,H.jsx)(_,{className:`size-4`})})]})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:v?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,H.jsx)(s,{className:`size-5 animate-spin text-primary`})}):a.length===0?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-sm text-text-subtle`,children:`Send a message to start the group.`}):(0,H.jsxs)(`div`,{className:`flex flex-col py-2`,children:[a.map(e=>(0,H.jsx)(ae,{message:e,colorFor:se,isLeader:ce,onViewFull:A},e.id)),$.length>0&&(0,H.jsxs)(`div`,{className:`px-3 py-1.5 text-xs italic text-text-subtle`,children:[$.join(`, `),` `,$.length===1?`is`:`are`,` typing…`]}),(0,H.jsx)(`div`,{ref:N})]})}),b&&(0,H.jsx)(`div`,{className:`shrink-0 border-t border-border bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:b}),(0,H.jsx)(`div`,{className:`shrink-0 border-t border-border p-2`,children:(0,H.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,H.jsx)(`textarea`,{value:E,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!i&&(e.preventDefault(),Q())},rows:1,placeholder:`Message the group…`,className:`max-h-32 min-h-[44px] flex-1 resize-none rounded-md border border-border bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-text-subtle focus:outline-none focus:ring-1 focus:ring-primary`}),(0,H.jsx)(f,{onClick:Q,disabled:!E.trim(),className:`size-11 shrink-0 p-0`,"aria-label":`Send`,children:(0,H.jsx)(c,{className:`size-4`})})]})})]}),i?(0,H.jsxs)(p,{open:j,onClose:()=>M(!1),className:`flex max-h-[72vh] flex-col`,children:[(0,H.jsx)(`div`,{className:`flex h-11 shrink-0 items-center px-4 text-sm font-medium text-foreground`,children:`Members`}),(0,H.jsxs)(`div`,{className:`min-h-0 overflow-y-auto`,children:[I!==null&&(0,H.jsxs)(`label`,{className:`flex items-center gap-2 px-4 py-2 text-xs text-text-secondary`,children:[(0,H.jsx)(`span`,{children:`Reply cap`}),(0,H.jsx)(`input`,{type:`number`,min:1,max:50,value:I,onChange:e=>q(Number(e.target.value)),className:`w-14 rounded border border-border bg-background px-1.5 py-1 text-xs text-foreground`}),(0,H.jsx)(`span`,{className:`text-text-subtle`,children:`turns/msg`})]}),V&&(0,H.jsx)(`p`,{className:`px-3 py-1 text-xs text-destructive`,children:V}),(0,H.jsx)(J,{members:P,liveStatus:Y,typing:h,busy:R,onAdd:()=>G({member:null}),onEdit:e=>G({member:e}),onRemove:Z})]})]}):j&&(0,H.jsxs)(`div`,{className:`flex w-60 shrink-0 flex-col border-l border-border bg-panel`,children:[(0,H.jsx)(`div`,{className:`flex h-11 shrink-0 items-center border-b border-border px-3 text-sm font-medium text-foreground`,children:`Members`}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[I!==null&&(0,H.jsxs)(`label`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-text-secondary`,children:[(0,H.jsx)(`span`,{children:`Reply cap`}),(0,H.jsx)(`input`,{type:`number`,min:1,max:50,value:I,onChange:e=>q(Number(e.target.value)),className:`w-14 rounded border border-border bg-background px-1.5 py-1 text-xs text-foreground`}),(0,H.jsx)(`span`,{className:`text-text-subtle`,children:`turns/msg`})]}),V&&(0,H.jsx)(`p`,{className:`px-3 py-1 text-xs text-destructive`,children:V}),(0,H.jsx)(J,{members:P,liveStatus:Y,typing:h,busy:R,onAdd:()=>G({member:null}),onEdit:e=>G({member:e}),onRemove:Z})]})]}),W&&(0,H.jsx)(oe,{open:!0,member:W.member,projectName:r,onSubmit:le,onClose:()=>G(null)},W.member?.id??`add`),(0,H.jsx)(ue,{groupId:t,message:k,onClose:()=>A(null)})]}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-sm text-text-subtle`,children:`No group selected.`})}export{Q as GroupChatTab};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./brain-KDa9jFRq.js";import{t as a}from"./chevron-right-De-Wz5Lz.js";import{n as o}from"./tool-cards-CLxrQlUs.js";import{t as s}from"./loader-circle-DPMrnLQ2.js";import{t as c}from"./send-Bb0jtcR6.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-CKKtYuTV.js";import"./settings-store-DWUx3865.js";import{n as l}from"./utils-C9OjCrou.js";import"./portal-container-context-a399Hd9F.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import{i as u}from"./project-store-BuY7rxn_.js";import"./tab-store-PZsP5ZwG.js";import"./context-menu-C13b1uT3.js";import{n as d}from"./use-is-mobile-CYW3FJFE.js";import{t as f}from"./button-2WCAS8dI.js";import{t as p}from"./mobile-bottom-sheet-B3uDlD79.js";import"./use-visual-viewport-D9O48HQt.js";import"./ws-auth-ZSZkAT6p.js";import{$n as m,$t as h,A as g,An as _,C as v,D as y,Dt as b,E as x,Et as S,It as C,O as w,Pn as T,Pt as E,S as D,T as O,Tt as k,Un as A,Xn as ee,Xt as j,Yt as M,en as N,j as te,k as P,w as ne,x as F,zn as re}from"./index-yV5RgBDh.js";import{t as I}from"./use-websocket-kR1omKO1.js";import"./use-blob-url-De-ZtcpX.js";import{t as L}from"./markdown-renderer-CEloCR06.js";import"./run-in-terminal-DHAvC1AG.js";var R=r(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),z=r(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),B=e(t(),1),V=8e3;function ie(e,t){let[n,r]=(0,B.useState)([]),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)(`idle`),[c,l]=(0,B.useState)({}),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(null),b=(0,B.useRef)(new Map),x=(0,B.useCallback)(e=>{l(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})},[]),S=(0,B.useCallback)(e=>{let t;try{t=JSON.parse(e.data)}catch{return}switch(t.type){case`ping`:return;case`group_state`:p(!0),s(t.status),a(t.members),h(t.status===`active`);return;case`group_message`:x(t.message.fromMember),r(e=>e.some(e=>e.id===t.message.id)?e:[...e,t.message]);return;case`member_status`:a(e=>e.map(e=>e.id===t.memberId?{...e,status:t.status}:e));return;case`typing`:{l(e=>({...e,[t.member]:!0}));let e=b.current,n=e.get(t.member);n&&clearTimeout(n),e.set(t.member,setTimeout(()=>x(t.member),V));return}case`turn_done`:return;case`group_done`:h(!1),s(`idle`),l({});return;case`error`:_(t.message),h(!1);return}},[x]),{send:C}=I({url:e&&t?`/ws/project/${encodeURIComponent(t)}/group/${encodeURIComponent(e)}`:``,onMessage:S,autoConnect:!!e&&!!t});return(0,B.useEffect)(()=>{let t=!1;r([]),a([]),l({}),s(`idle`),h(!1),_(null),p(!1);for(let e of b.current.values())clearTimeout(e);if(b.current.clear(),e)return d(!0),v(e,{limit:200}).then(e=>{t||r(t=>{let n=new Set(e.messages.map(e=>e.id)),r=t.filter(e=>!n.has(e.id));return[...e.messages,...r]})}).catch(e=>{t||_(e instanceof Error?e.message:`Failed to load feed`)}).finally(()=>{t||d(!1)}),()=>{t=!0}},[e]),{messages:n,members:i,status:o,typing:c,loading:u,isConnected:f,isRunning:m,error:g,sendMessage:(0,B.useCallback)(t=>{let n=t.trim();!n||!e||(_(null),h(!0),f?C(JSON.stringify({type:`message`,content:n})):w(e,n).catch(e=>{_(e instanceof Error?e.message:`Failed to send message`),h(!1)}))},[e,f,C]),stop:(0,B.useCallback)(()=>{e&&(f?C(JSON.stringify({type:`stop`})):P(e).catch(()=>{}),s(`paused`),h(!1))},[e,f,C]),resume:(0,B.useCallback)(()=>{e&&y(e).then(()=>{s(`active`),h(!0)}).catch(e=>_(e instanceof Error?e.message:`Failed to resume`))},[e])}}var H=n();function U(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}function W(e){try{let t=e<0xe8d4a51000?e*1e3:e;return new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}catch{return``}}function G(e,t){return e.split(/(@[\p{L}\p{N}_]+)/gu).map((e,n)=>{if(e.startsWith(`@`)&&e.length>1){let r=t(e.slice(1));return(0,H.jsx)(`span`,{className:l(`font-semibold`,!r&&`text-primary`),style:r?{color:r}:void 0,children:e},n)}return e})}var ae=(0,B.memo)(function({message:e,colorFor:t,isLeader:n,onViewFull:r}){let i=e.fromMember===`user`,a=i?`You`:e.fromMember,o=i?`var(--color-primary)`:t(e.fromMember)??`var(--accent)`,s=!i&&n(e.fromMember),c=e.summary??``,u=e.toMember&&e.toMember!==`all`?e.toMember:null,d=(0,H.jsxs)(`div`,{className:l(`group relative flex gap-2.5 px-3 py-2 transition-colors hover:bg-surface-elevated/50`,i&&`bg-primary/5`),style:{boxShadow:`inset 3px 0 0 0 ${o}`},children:[e.fullSessionRef&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(e),title:`View full transcript (AI's raw thinking / debug)`,"aria-label":`View full transcript`,className:`absolute right-1.5 top-1.5 hidden items-center rounded p-1 text-text-subtle/60 hover:bg-surface-elevated hover:text-text-secondary can-hover:group-hover:inline-flex`,children:(0,H.jsx)(R,{className:`size-3.5`})}),(0,H.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold text-white ring-2 ring-background`,style:{backgroundColor:o},"aria-hidden":!0,children:U(a)}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 can-hover:pr-6`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-semibold`,style:{color:i?`var(--color-foreground)`:o},children:a}),s&&(0,H.jsx)(`span`,{className:`rounded bg-surface-elevated px-1.5 py-px text-[10px] font-medium text-text-secondary`,children:`leader`}),u&&(0,H.jsxs)(`span`,{className:`text-[11px] text-text-subtle`,children:[`→ `,u]}),(0,H.jsx)(`span`,{className:`text-[11px] text-text-subtle`,children:W(e.createdAt)})]}),(0,H.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-relaxed text-text-secondary`,children:G(c,t)})]})]});return e.fullSessionRef?(0,H.jsxs)(k,{children:[(0,H.jsx)(E,{asChild:!0,children:d}),(0,H.jsx)(S,{children:(0,H.jsxs)(b,{onClick:()=>r(e),children:[(0,H.jsx)(R,{className:`size-4`}),` View full transcript`]})})]}):d}),K={idle:`bg-text-subtle`,working:`bg-primary animate-pulse`,done:`bg-emerald-500`,error:`bg-destructive`},q={idle:`Idle`,working:`Working`,done:`Done`,error:`Error`},J=(0,B.memo)(function({members:e,liveStatus:t,typing:n,busy:r,onAdd:i,onEdit:a,onRemove:o}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5 p-2`,children:[e.map(e=>{let i=n[e.name],s=t.get(e.id)??e.status;return(0,H.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md px-2 py-1.5`,children:[(0,H.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-[10px] font-semibold text-white ring-2 ring-background`,style:{backgroundColor:e.color??`var(--accent)`},"aria-hidden":!0,children:e.name.slice(0,1).toUpperCase()}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`truncate text-xs font-medium`,style:{color:e.color??`var(--color-foreground)`},children:e.name}),e.role===`leader`&&(0,H.jsx)(`span`,{className:`rounded-sm bg-accent-wash px-1 text-[9px] font-semibold uppercase text-primary`,children:`lead`})]}),(0,H.jsx)(`span`,{className:`block truncate text-[10px] text-text-subtle`,children:i?`typing…`:e.persona||q[s]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 can-hover:opacity-0 can-hover:group-hover:opacity-100`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(e),disabled:r,"aria-label":`Edit ${e.name}`,className:`flex size-8 items-center justify-center rounded-md text-text-subtle hover:bg-surface-elevated hover:text-foreground active:bg-surface-elevated disabled:opacity-40`,children:(0,H.jsx)(m,{className:`size-3.5`})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>o(e),disabled:r,"aria-label":`Remove ${e.name}`,className:`flex size-8 items-center justify-center rounded-md text-text-subtle hover:bg-surface-elevated hover:text-destructive active:bg-surface-elevated disabled:opacity-40`,children:(0,H.jsx)(T,{className:`size-3.5`})})]}),(0,H.jsx)(`span`,{className:l(`size-2 shrink-0 rounded-full`,K[s]),title:q[s],"aria-hidden":!0})]},e.id)}),(0,H.jsxs)(`button`,{type:`button`,onClick:i,disabled:r,className:`mt-1 flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium text-primary hover:bg-surface-elevated active:bg-surface-elevated disabled:opacity-40`,children:[(0,H.jsx)(z,{className:`size-4`}),` Add member`]})]})}),Y=`w-full min-h-[40px] rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-text-subtle focus:outline-none focus:ring-1 focus:ring-primary`;function oe({open:e,member:t,projectName:n,providerId:r=`claude`,onSubmit:i,onClose:a}){let o=d(),[c,l]=(0,B.useState)(t?.name??``),[u,m]=(0,B.useState)(t?.persona??``),[g,_]=(0,B.useState)(t?.model??null),[v,y]=(0,B.useState)(t?.role===`leader`),[b,x]=(0,B.useState)(!1),[S,C]=(0,B.useState)(null),w=(0,B.useCallback)(async()=>{let e=c.trim();if(!e){C(`Name is required`);return}x(!0),C(null);try{await i({name:e,persona:u.trim()||null,model:g,role:v?`leader`:`member`}),a()}catch(e){C(e instanceof Error?e.message:`Failed to save member`),x(!1)}},[c,u,g,v,i,a]),T=t?.role===`leader`,E=(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 px-1 py-1`,children:[(0,H.jsx)(`input`,{className:Y,value:c,onChange:e=>l(e.target.value),placeholder:`Member name`,autoFocus:!0}),(0,H.jsx)(`input`,{className:Y,value:u,onChange:e=>m(e.target.value),placeholder:`Persona (optional)`}),(0,H.jsx)(F,{value:g,onChange:_,projectName:n,providerId:r}),(0,H.jsxs)(`label`,{className:X(T),children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-[var(--color-primary)]`,checked:v,disabled:T,onChange:e=>y(e.target.checked)}),(0,H.jsx)(`span`,{children:T?`Leader (reassign from another member)`:`Set as leader`})]}),S&&(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:S}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,H.jsx)(f,{variant:`outline`,onClick:a,disabled:b,children:`Cancel`}),(0,H.jsxs)(f,{onClick:w,disabled:b,children:[b&&(0,H.jsx)(s,{className:`mr-1.5 size-4 animate-spin`}),t?`Save`:`Add member`]})]})]});if(!e)return null;let D=t?`Edit member`:`Add member`;return o?(0,H.jsx)(p,{open:!0,onClose:a,className:`flex max-h-[90vh] flex-col`,children:(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col px-4 pb-2`,children:[(0,H.jsx)(`h2`,{className:`mb-2 text-base font-semibold text-foreground`,children:D}),E]})}):(0,H.jsx)(M,{open:!0,onOpenChange:e=>{e||a()},children:(0,H.jsxs)(j,{className:`flex flex-col sm:max-w-md`,children:[(0,H.jsx)(h,{children:(0,H.jsx)(N,{children:D})}),E]})})}function X(e){return`flex items-center gap-2 text-sm text-text-secondary ${e?`opacity-60`:``}`}function se({messages:e,config:t,projectName:n}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t&&(0,H.jsx)(Z,{config:t}),e.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-text-subtle`,children:e.role===`user`?`User`:e.role===`assistant`?`Assistant`:e.role}),(0,H.jsx)(ce,{message:e,projectName:n})]},e.id)),e.length===0&&(0,H.jsx)(`p`,{className:`py-6 text-center text-sm text-text-subtle`,children:`Transcript is empty.`})]})}function ce({message:e,projectName:t}){let n=e.events??[];if(n.length===0)return e.content.trim()?(0,H.jsx)(L,{content:e.content}):null;let r=new Map;for(let e of n)e.type===`tool_result`&&e.toolUseId&&r.set(e.toolUseId,e);return(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.map((e,n)=>{if(e.type===`text`)return e.content.trim()?(0,H.jsx)(L,{content:e.content},n):null;if(e.type===`thinking`)return(0,H.jsx)(le,{content:e.content},n);if(e.type===`tool_use`){let i=e.toolUseId?r.get(e.toolUseId):void 0;return(0,H.jsx)(o,{tool:e,result:i,completed:!!i,projectName:t},n)}return null})})}function le({content:e}){let[t,n]=(0,B.useState)(!1);return(0,H.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-elevated/40`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-xs text-text-subtle hover:text-text-secondary`,children:[(0,H.jsx)(a,{className:l(`size-3.5 transition-transform`,t&&`rotate-90`)}),(0,H.jsx)(i,{className:`size-3.5`}),(0,H.jsx)(`span`,{children:`Thinking`})]}),t&&(0,H.jsx)(`div`,{className:`border-t border-border px-3 py-2 text-xs leading-relaxed text-text-secondary`,children:(0,H.jsx)(L,{content:e})})]})}function Z({config:e}){let[t,n]=(0,B.useState)(!1),r=[[`Model`,e.model],[`Permission`,e.permissionMode],[`CWD`,e.cwd],[`Git branch`,e.gitBranch],[`CLI version`,e.version]].filter(([,e])=>e);return r.length===0?null:(0,H.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-elevated/40`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-text-secondary hover:text-foreground`,children:[(0,H.jsx)(a,{className:l(`size-3.5 transition-transform`,t&&`rotate-90`)}),(0,H.jsx)(A,{className:`size-3.5`}),(0,H.jsx)(`span`,{children:`Input config`})]}),t&&(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 border-t border-border px-3 py-2 text-xs`,children:r.map(([e,t])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{className:`text-text-subtle`,children:e}),(0,H.jsx)(`dd`,{className:`break-all font-mono text-text-secondary`,children:t})]},e))})]})}function ue({groupId:e,message:t,onClose:n}){let r=d(),[i,a]=(0,B.useState)(null),[o,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),f=t?.fullSessionRef??null;if((0,B.useEffect)(()=>{if(!t||!f)return;let n=!1;return a(null),u(null),c(!0),O(e,f).then(e=>{n||a(e)}).catch(e=>{n||u(e instanceof Error?e.message:`Failed to load transcript`)}).finally(()=>{n||c(!1)}),()=>{n=!0}},[e,f,t]),!t)return null;let m=(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[o&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,H.jsx)(s,{className:`size-5 animate-spin text-primary`})}),l&&(0,H.jsxs)(`div`,{className:`px-1 py-4 text-sm text-text-secondary`,children:[(0,H.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Full transcript unavailable`}),(0,H.jsx)(`p`,{className:`text-xs text-text-subtle`,children:l}),t.summary&&(0,H.jsx)(`pre`,{className:`mt-4 whitespace-pre-wrap break-words rounded-md bg-surface-elevated p-3 text-xs leading-relaxed text-text-secondary`,children:t.summary})]}),!o&&!l&&i!=null&&(0,H.jsx)(`div`,{className:`px-1 py-1`,children:(0,H.jsx)(se,{messages:i.messages,config:i.config})})]}),g=`${t.fromMember} — full transcript`;return r?(0,H.jsx)(p,{open:!0,onClose:n,className:`max-h-[85vh] flex flex-col`,children:(0,H.jsxs)(`div`,{className:`flex flex-col min-h-0 px-4 pb-2`,children:[(0,H.jsx)(`h2`,{className:`mb-2 text-sm font-semibold text-foreground`,children:g}),m]})}):(0,H.jsx)(M,{open:!0,onOpenChange:e=>{e||n()},children:(0,H.jsxs)(j,{className:`flex max-h-[80vh] flex-col sm:max-w-2xl`,children:[(0,H.jsx)(h,{children:(0,H.jsx)(N,{className:`text-sm`,children:g})}),m]})})}function Q({metadata:e}){let t=e?.groupId??null,{activeProject:n}=u(C(e=>({activeProject:e.activeProject}))),r=e?.projectName??n?.name??``,i=d(),{messages:a,members:o,status:m,typing:h,loading:v,isRunning:y,error:b,sendMessage:S,stop:w,resume:T}=ie(t,r),[E,O]=(0,B.useState)(``),[k,A]=(0,B.useState)(null),[j,M]=(0,B.useState)(!1),N=(0,B.useRef)(null),[P,F]=(0,B.useState)([]),[I,L]=(0,B.useState)(null),[R,z]=(0,B.useState)(!1),[V,U]=(0,B.useState)(null),[W,G]=(0,B.useState)(null),K=(0,B.useCallback)(async()=>{if(t)try{let e=await ne(t);F(e.members),L(e.maxTurns)}catch{}},[t]),q=(0,B.useCallback)(async e=>{if(!t)return;let n=Math.max(1,Math.min(50,Math.floor(e)||1));L(n);try{await te(t,{maxTurns:n})}catch{K()}},[t,K]);(0,B.useEffect)(()=>{F([]),K()},[t,K]),(0,B.useEffect)(()=>{N.current?.scrollIntoView({block:`end`})},[a.length,h]);let Y=(0,B.useMemo)(()=>new Map(o.map(e=>[e.id,e.status])),[o]),X=P.length?P:o,se=(0,B.useMemo)(()=>{let e=new Map(X.map(e=>[e.name,e.color]));return t=>e.get(t)??null},[X]),ce=(0,B.useMemo)(()=>{let e=new Set(X.filter(e=>e.role===`leader`).map(e=>e.name));return t=>e.has(t)},[X]),le=(0,B.useCallback)(async e=>{t&&(W?.member?await g(t,W.member.id,e):await D(t,e),await K())},[t,W,K]),Z=(0,B.useCallback)(async e=>{if(t){z(!0),U(null);try{await x(t,e.id),await K()}catch(e){U(e instanceof Error?e.message:`Failed to remove member`)}finally{z(!1)}}},[t,K]),Q=(0,B.useCallback)(()=>{let e=E.trim();e&&(S(e),O(``))},[E,S]),$=Object.keys(h).filter(e=>h[e]);return t?(0,H.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-border px-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,H.jsx)(`span`,{className:l(`size-2 rounded-full`,m===`active`?`bg-primary animate-pulse`:m===`paused`?`bg-amber-500`:`bg-text-subtle`)}),(0,H.jsx)(`span`,{className:`capitalize`,children:m})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[y?(0,H.jsxs)(f,{size:`sm`,variant:`outline`,onClick:w,className:`h-8`,children:[(0,H.jsx)(re,{className:`mr-1 size-3.5`}),` Stop`]}):m===`paused`?(0,H.jsxs)(f,{size:`sm`,variant:`outline`,onClick:T,className:`h-8`,children:[(0,H.jsx)(ee,{className:`mr-1 size-3.5`}),` Resume`]}):null,(0,H.jsx)(`button`,{type:`button`,onClick:()=>M(e=>!e),className:`flex size-8 items-center justify-center rounded-md text-text-subtle hover:bg-surface-elevated hover:text-foreground`,"aria-label":`Toggle roster`,children:(0,H.jsx)(_,{className:`size-4`})})]})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:v?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,H.jsx)(s,{className:`size-5 animate-spin text-primary`})}):a.length===0?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-sm text-text-subtle`,children:`Send a message to start the group.`}):(0,H.jsxs)(`div`,{className:`flex flex-col py-2`,children:[a.map(e=>(0,H.jsx)(ae,{message:e,colorFor:se,isLeader:ce,onViewFull:A},e.id)),$.length>0&&(0,H.jsxs)(`div`,{className:`px-3 py-1.5 text-xs italic text-text-subtle`,children:[$.join(`, `),` `,$.length===1?`is`:`are`,` typing…`]}),(0,H.jsx)(`div`,{ref:N})]})}),b&&(0,H.jsx)(`div`,{className:`shrink-0 border-t border-border bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:b}),(0,H.jsx)(`div`,{className:`shrink-0 border-t border-border p-2`,children:(0,H.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,H.jsx)(`textarea`,{value:E,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!i&&(e.preventDefault(),Q())},rows:1,placeholder:`Message the group…`,className:`max-h-32 min-h-[44px] flex-1 resize-none rounded-md border border-border bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-text-subtle focus:outline-none focus:ring-1 focus:ring-primary`}),(0,H.jsx)(f,{onClick:Q,disabled:!E.trim(),className:`size-11 shrink-0 p-0`,"aria-label":`Send`,children:(0,H.jsx)(c,{className:`size-4`})})]})})]}),i?(0,H.jsxs)(p,{open:j,onClose:()=>M(!1),className:`flex max-h-[72vh] flex-col`,children:[(0,H.jsx)(`div`,{className:`flex h-11 shrink-0 items-center px-4 text-sm font-medium text-foreground`,children:`Members`}),(0,H.jsxs)(`div`,{className:`min-h-0 overflow-y-auto`,children:[I!==null&&(0,H.jsxs)(`label`,{className:`flex items-center gap-2 px-4 py-2 text-xs text-text-secondary`,children:[(0,H.jsx)(`span`,{children:`Reply cap`}),(0,H.jsx)(`input`,{type:`number`,min:1,max:50,value:I,onChange:e=>q(Number(e.target.value)),className:`w-14 rounded border border-border bg-background px-1.5 py-1 text-xs text-foreground`}),(0,H.jsx)(`span`,{className:`text-text-subtle`,children:`turns/msg`})]}),V&&(0,H.jsx)(`p`,{className:`px-3 py-1 text-xs text-destructive`,children:V}),(0,H.jsx)(J,{members:P,liveStatus:Y,typing:h,busy:R,onAdd:()=>G({member:null}),onEdit:e=>G({member:e}),onRemove:Z})]})]}):j&&(0,H.jsxs)(`div`,{className:`flex w-60 shrink-0 flex-col border-l border-border bg-panel`,children:[(0,H.jsx)(`div`,{className:`flex h-11 shrink-0 items-center border-b border-border px-3 text-sm font-medium text-foreground`,children:`Members`}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[I!==null&&(0,H.jsxs)(`label`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-text-secondary`,children:[(0,H.jsx)(`span`,{children:`Reply cap`}),(0,H.jsx)(`input`,{type:`number`,min:1,max:50,value:I,onChange:e=>q(Number(e.target.value)),className:`w-14 rounded border border-border bg-background px-1.5 py-1 text-xs text-foreground`}),(0,H.jsx)(`span`,{className:`text-text-subtle`,children:`turns/msg`})]}),V&&(0,H.jsx)(`p`,{className:`px-3 py-1 text-xs text-destructive`,children:V}),(0,H.jsx)(J,{members:P,liveStatus:Y,typing:h,busy:R,onAdd:()=>G({member:null}),onEdit:e=>G({member:e}),onRemove:Z})]})]}),W&&(0,H.jsx)(oe,{open:!0,member:W.member,projectName:r,onSubmit:le,onClose:()=>G(null)},W.member?.id??`add`),(0,H.jsx)(ue,{groupId:t,message:k,onClose:()=>A(null)})]}):(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-sm text-text-subtle`,children:`No group selected.`})}export{Q as GroupChatTab};