@hienlh/ppm 0.20.3 → 0.20.4

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 (79) hide show
  1. package/.release-node-shim.sh +10 -0
  2. package/CHANGELOG.md +8 -0
  3. package/assets/skills/ppm/SKILL.md +1 -1
  4. package/assets/skills/ppm/references/cli-reference.md +4 -4
  5. package/assets/skills/ppm/references/http-api.md +1 -1
  6. package/dist/web/assets/{accounts-settings-section-DzDmIsPe.js → accounts-settings-section-BcI3ithh.js} +1 -1
  7. package/dist/web/assets/{ai-resource-editor-D7C9wmwA.js → ai-resource-editor-C3i7VkUS.js} +1 -1
  8. package/dist/web/assets/{ai-settings-section-DZuwllLy.js → ai-settings-section-COdsN_5h.js} +1 -1
  9. package/dist/web/assets/{ai-settings-section-BW5a07-Z.js → ai-settings-section-DIqSLISN.js} +1 -1
  10. package/dist/web/assets/{appearance-settings-section-RfH2N1rj.js → appearance-settings-section-B9n42QPH.js} +1 -1
  11. package/dist/web/assets/{chat-tab-Bz0pk0_E.js → chat-tab-D9sk38e8.js} +3 -3
  12. package/dist/web/assets/{code-editor-C4o1SyuO.js → code-editor-iTD62P14.js} +2 -2
  13. package/dist/web/assets/{conflict-editor-Dk65mBIe.js → conflict-editor-idh_kBSa.js} +1 -1
  14. package/dist/web/assets/{csv-preview-DENi3CFz.js → csv-preview-B2PR7z0o.js} +1 -1
  15. package/dist/web/assets/{database-viewer-BiBC7ulB.js → database-viewer-DSv_pvEq.js} +1 -1
  16. package/dist/web/assets/{diff-viewer-CSvZJHak.js → diff-viewer-6X5S1lw3.js} +1 -1
  17. package/dist/web/assets/{explorer-body-QXS0h4AF.js → explorer-body-CrtXpmZM.js} +1 -1
  18. package/dist/web/assets/{explorer-window-content-CQgqoRsj.js → explorer-window-content-D11FZUgq.js} +1 -1
  19. package/dist/web/assets/{extension-manager-section-CyC7wX35.js → extension-manager-section-Cz8fvK1u.js} +1 -1
  20. package/dist/web/assets/{extension-webview-Da8SIlRa.js → extension-webview-DzZeXQsO.js} +1 -1
  21. package/dist/web/assets/{files-settings-section-D8cebM51.js → files-settings-section-pc4jOun8.js} +1 -1
  22. package/dist/web/assets/{general-settings-section-1HVTvlIw.js → general-settings-section-DIZIA54q.js} +1 -1
  23. package/dist/web/assets/{git-log-panel-C7a4rp8f.js → git-log-panel-BkcIfZIE.js} +1 -1
  24. package/dist/web/assets/{glide-data-grid-BT9p_4AN.js → glide-data-grid-nA5LsoJK.js} +1 -1
  25. package/dist/web/assets/{group-chat-tab-BUHGnUyW.js → group-chat-tab-DyzfaPol.js} +1 -1
  26. package/dist/web/assets/{index-kGmcC9cb.js → index-DJM59ogE.js} +4 -4
  27. package/dist/web/assets/{jira-watcher-section-BxzwW4uQ.js → jira-watcher-section-UEtpcxM9.js} +1 -1
  28. package/dist/web/assets/{keybindings-store-DjJum4OS.js → keybindings-store-BV0MMt1c.js} +1 -1
  29. package/dist/web/assets/{keyboard-shortcuts-section-DDKG3BU1.js → keyboard-shortcuts-section-sY56ThaI.js} +1 -1
  30. package/dist/web/assets/{markdown-renderer-dHeak2mE.js → markdown-renderer-Bkrk39pO.js} +1 -1
  31. package/dist/web/assets/{markdown-renderer-iBw1fCI_.js → markdown-renderer-Bthd7hxl.js} +1 -1
  32. package/dist/web/assets/{mobile-explorer-sheet-CzL8SLtz.js → mobile-explorer-sheet--NKsnNJn.js} +1 -1
  33. package/dist/web/assets/{notification-store-DVi6Ds71.js → notification-store-Bv4fnyvR.js} +1 -1
  34. package/dist/web/assets/{notifications-settings-section-shQ-ugKh.js → notifications-settings-section-BGSLkMuE.js} +1 -1
  35. package/dist/web/assets/{pdf-preview-DB26KSzm.js → pdf-preview-DE0wVfyM.js} +1 -1
  36. package/dist/web/assets/{postgres-viewer-CJe2meyF.js → postgres-viewer-C0S8dCbA.js} +1 -1
  37. package/dist/web/assets/{ppmbot-settings-section-Ba4c9AI9.js → ppmbot-settings-section-B2AZ8whe.js} +1 -1
  38. package/dist/web/assets/{process-table-PXwLsMuG.js → process-table-BmT34-_s.js} +1 -1
  39. package/dist/web/assets/{proxy-settings-section-BHBhK6HC.js → proxy-settings-section-BYwWFWvn.js} +1 -1
  40. package/dist/web/assets/{query-audit-section-BD5ZVqDz.js → query-audit-section-Dj1-npew.js} +1 -1
  41. package/dist/web/assets/{remote-desktop-mobile-sheet-Di4QG8VX.js → remote-desktop-mobile-sheet-bFIYIQIj.js} +2 -2
  42. package/dist/web/assets/{remote-desktop-mobile-view-DzoZvAqc.js → remote-desktop-mobile-view-BbrHPmPU.js} +1 -1
  43. package/dist/web/assets/{remote-desktop-readiness-gate-CHO-KJ9Z.js → remote-desktop-readiness-gate-Dme8r7Jp.js} +1 -1
  44. package/dist/web/assets/{remote-desktop-window-content-X324gYbW.js → remote-desktop-window-content-BdbszoSx.js} +1 -1
  45. package/dist/web/assets/{schedules-settings-section-a4-h6THc.js → schedules-settings-section-rczhjkeM.js} +1 -1
  46. package/dist/web/assets/{settings-body-Fq7BVDw2.js → settings-body-CwaQg_uc.js} +2 -2
  47. package/dist/web/assets/{settings-tab-CVLQy-ie.js → settings-tab-C8l9-_9E.js} +1 -1
  48. package/dist/web/assets/{settings-window-content-Bi7M0iaZ.js → settings-window-content-EA1489gi.js} +1 -1
  49. package/dist/web/assets/{sql-query-editor-D1r265fl.js → sql-query-editor-BQsKZVtz.js} +1 -1
  50. package/dist/web/assets/{sqlite-viewer-DHkIotRl.js → sqlite-viewer-Di8s3Z1m.js} +1 -1
  51. package/dist/web/assets/{system-monitor-body-y6VUkYTL.js → system-monitor-body-Dlknm4Uo.js} +2 -2
  52. package/dist/web/assets/{system-monitor-tab-DRAOejhk.js → system-monitor-tab-LZRO6_DP.js} +1 -1
  53. package/dist/web/assets/{system-monitor-window-content-B5i57xHD.js → system-monitor-window-content-BFDfhqDd.js} +1 -1
  54. package/dist/web/assets/{tab-host-window-content-SkyPFFlc.js → tab-host-window-content-Bh7064Yw.js} +1 -1
  55. package/dist/web/assets/{team-member-sheet-BB63u-Lf.js → team-member-sheet-CU68IqU0.js} +2 -2
  56. package/dist/web/assets/{team-member-window-content-D6tVTXuV.js → team-member-window-content-BYtro89j.js} +1 -1
  57. package/dist/web/assets/{terminal-tab-BYaHAkI5.js → terminal-tab-qfSPxRtZ.js} +1 -1
  58. package/dist/web/assets/{tool-cards-DRJu20sL.js → tool-cards-CY9J4ux4.js} +2 -2
  59. package/dist/web/assets/{use-accounts-data-Ba1_uvEE.js → use-accounts-data-pAQw6nCa.js} +1 -1
  60. package/dist/web/assets/{use-monaco-theme-Uakgj3hJ.js → use-monaco-theme-DT5Q8kuf.js} +1 -1
  61. package/dist/web/assets/{use-remote-desktop-display-choice-Cd3Xalca.js → use-remote-desktop-display-choice-CYQsrOMC.js} +1 -1
  62. package/dist/web/assets/{use-websocket-BC_EGf5q.js → use-websocket-mkNA1M8U.js} +1 -1
  63. package/dist/web/assets/{video-preview-BUb43zWb.js → video-preview-B2dk48oQ.js} +1 -1
  64. package/dist/web/index.html +1 -1
  65. package/dist/web/sw.js +1 -1
  66. package/package.json +1 -1
  67. package/src/providers/codex-app-server/codex-event-mapper.ts +4 -0
  68. package/src/providers/codex-app-server/codex-history.ts +4 -2
  69. package/src/providers/codex-app-server/codex-protocol.ts +4 -0
  70. package/src/providers/codex-app-server/codex-provider.ts +69 -5
  71. package/src/server/routes/chat.ts +22 -3
  72. package/src/server/ws/chat.ts +5 -0
  73. package/src/services/edge-forwarder.ts +191 -191
  74. package/src/services/windows-process-tree.ts +351 -351
  75. package/src/web/hooks/use-chat.ts +22 -11
  76. package/packages/vscode-compat/node_modules/.bin/tsc.bunx +0 -0
  77. package/packages/vscode-compat/node_modules/.bin/tsc.exe +0 -0
  78. package/packages/vscode-compat/node_modules/.bin/tsserver.bunx +0 -0
  79. package/packages/vscode-compat/node_modules/.bin/tsserver.exe +0 -0
@@ -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{t as r}from"./circle-BCy0AUCo.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{t as a}from"./settings-store-CzLnTR8p.js";import{Ar as o,Dr as s,Un as c,Wn as l,ir as u,y as d}from"./index-kGmcC9cb.js";import{r as f}from"./run-in-terminal-wHKwAnWP.js";var p=e(t(),1),m=n();function h({onCancel:e,children:t}){let n=a(e=>e.remoteDesktopWarningDismissed),r=a(e=>e.setRemoteDesktopWarningDismissed),[i,o]=(0,p.useState)(!1),[s,c]=(0,p.useState)(!1);if(n||i)return(0,m.jsx)(m.Fragment,{children:t});let d=()=>{s&&r(!0),o(!0)};return(0,m.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-warning-gate`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(u,{className:`size-5 shrink-0 text-primary`}),(0,m.jsx)(`h2`,{className:`text-base font-semibold`,children:`Remote Desktop`}),(0,m.jsx)(`span`,{className:`ml-auto rounded-full bg-amber-500/20 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-300`,children:`Beta`})]}),(0,m.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm text-white/80`,children:[(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsxs)(`span`,{children:[`This streams the host's `,(0,m.jsx)(`strong`,{children:`whole screen`}),` and lets you `,(0,m.jsx)(`strong`,{children:`move its mouse and type`}),` as if you were sitting at it. Anything you do here happens on the real desktop.`]})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsx)(`span`,{children:`Anyone signed in to this PPM can do the same. Avoid opening it over a public share link you don't fully trust; a private network (Tailscale, LAN) is safer.`})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsx)(`span`,{children:`Still beta: the host must be unlocked with an active session, UAC prompts stay hidden, and a person at the host will fight you for the cursor.`})]})]}),(0,m.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 text-sm text-white/70`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),className:`size-4 accent-primary`,"data-testid":`remote-desktop-warning-dont-show`}),`Don't show this again`]}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,"data-testid":`remote-desktop-warning-cancel`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,onClick:d,className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`remote-desktop-warning-continue`,children:`Continue`})]})]})})}function g({onCancel:e,children:t}){let[n,r]=(0,p.useState)(!1),{caps:a,failed:o,runHostAction:s}=d(!n);if(n||a?.videoReady&&a.inputReady)return(0,m.jsx)(m.Fragment,{children:t});let c=a?.requirements.filter(e=>!e.ok)??[],l=!!a?.videoReady&&!a.inputReady,h=t=>{f(t),e()};return(0,m.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-readiness-gate`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(u,{className:`size-5 shrink-0 text-primary`}),(0,m.jsx)(`h2`,{className:`text-base font-semibold`,children:`This host needs a few things`})]}),!a&&!o&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-white/70`,children:[(0,m.jsx)(i,{className:`size-4 animate-spin`}),` Checking the host…`]}),o&&(0,m.jsx)(`p`,{className:`text-sm text-red-300`,children:`Could not reach the host's remote-desktop service.`}),(0,m.jsx)(`ul`,{className:`flex flex-col gap-3`,children:a?.requirements.map(e=>(0,m.jsx)(_,{req:e,onHostAction:s,onTerminal:h},e.id))}),c.length>0&&(0,m.jsx)(`p`,{className:`text-xs text-white/50`,children:`Re-checking every few seconds — this updates by itself once fixed.`}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,disabled:!a?.videoReady,onClick:()=>r(!0),className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40`,"data-testid":`remote-desktop-readiness-continue`,children:l?`Continue (view only)`:`Continue`})]})]})})}function _({req:e,...t}){return(0,m.jsxs)(`li`,{className:`flex gap-2`,"data-testid":`remote-desktop-requirement-${e.id}`,"data-ok":e.ok,children:[e.ok?(0,m.jsx)(o,{className:`mt-0.5 size-4 shrink-0 text-emerald-400`}):(0,m.jsx)(r,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm font-medium`,children:[e.title,!e.ok&&(0,m.jsx)(`span`,{className:`ml-2 text-xs font-normal text-white/50`,children:e.gates===`video`?`required`:`for mouse & keyboard`})]}),!e.ok&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`text-sm text-white/70`,children:e.detail}),(0,m.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions.map(n=>(0,m.jsx)(v,{action:n,reqId:e.id,...t},n.label))})]})]})]})}function v({action:e,reqId:t,onHostAction:n,onTerminal:r}){let i=`inline-flex min-h-11 items-center gap-1.5 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`;return e.kind===`terminal`?(0,m.jsxs)(`button`,{type:`button`,className:i,onClick:()=>r(e.command),title:e.command,children:[(0,m.jsx)(c,{className:`size-4`}),` `,e.label]}):e.kind===`link`?(0,m.jsxs)(`a`,{className:i,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,m.jsx)(s,{className:`size-4`}),` `,e.label]}):(0,m.jsx)(`button`,{type:`button`,className:i,onClick:()=>void n(t,e.action),children:e.label})}export{h as n,g as t};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./circle-BCy0AUCo.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{t as a}from"./settings-store-CzLnTR8p.js";import{Ar as o,Dr as s,Un as c,Wn as l,ir as u,y as d}from"./index-DJM59ogE.js";import{r as f}from"./run-in-terminal-wHKwAnWP.js";var p=e(t(),1),m=n();function h({onCancel:e,children:t}){let n=a(e=>e.remoteDesktopWarningDismissed),r=a(e=>e.setRemoteDesktopWarningDismissed),[i,o]=(0,p.useState)(!1),[s,c]=(0,p.useState)(!1);if(n||i)return(0,m.jsx)(m.Fragment,{children:t});let d=()=>{s&&r(!0),o(!0)};return(0,m.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-warning-gate`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(u,{className:`size-5 shrink-0 text-primary`}),(0,m.jsx)(`h2`,{className:`text-base font-semibold`,children:`Remote Desktop`}),(0,m.jsx)(`span`,{className:`ml-auto rounded-full bg-amber-500/20 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-300`,children:`Beta`})]}),(0,m.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm text-white/80`,children:[(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsxs)(`span`,{children:[`This streams the host's `,(0,m.jsx)(`strong`,{children:`whole screen`}),` and lets you `,(0,m.jsx)(`strong`,{children:`move its mouse and type`}),` as if you were sitting at it. Anything you do here happens on the real desktop.`]})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsx)(`span`,{children:`Anyone signed in to this PPM can do the same. Avoid opening it over a public share link you don't fully trust; a private network (Tailscale, LAN) is safer.`})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsx)(`span`,{children:`Still beta: the host must be unlocked with an active session, UAC prompts stay hidden, and a person at the host will fight you for the cursor.`})]})]}),(0,m.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 text-sm text-white/70`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),className:`size-4 accent-primary`,"data-testid":`remote-desktop-warning-dont-show`}),`Don't show this again`]}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,"data-testid":`remote-desktop-warning-cancel`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,onClick:d,className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`remote-desktop-warning-continue`,children:`Continue`})]})]})})}function g({onCancel:e,children:t}){let[n,r]=(0,p.useState)(!1),{caps:a,failed:o,runHostAction:s}=d(!n);if(n||a?.videoReady&&a.inputReady)return(0,m.jsx)(m.Fragment,{children:t});let c=a?.requirements.filter(e=>!e.ok)??[],l=!!a?.videoReady&&!a.inputReady,h=t=>{f(t),e()};return(0,m.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-readiness-gate`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(u,{className:`size-5 shrink-0 text-primary`}),(0,m.jsx)(`h2`,{className:`text-base font-semibold`,children:`This host needs a few things`})]}),!a&&!o&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-white/70`,children:[(0,m.jsx)(i,{className:`size-4 animate-spin`}),` Checking the host…`]}),o&&(0,m.jsx)(`p`,{className:`text-sm text-red-300`,children:`Could not reach the host's remote-desktop service.`}),(0,m.jsx)(`ul`,{className:`flex flex-col gap-3`,children:a?.requirements.map(e=>(0,m.jsx)(_,{req:e,onHostAction:s,onTerminal:h},e.id))}),c.length>0&&(0,m.jsx)(`p`,{className:`text-xs text-white/50`,children:`Re-checking every few seconds — this updates by itself once fixed.`}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,disabled:!a?.videoReady,onClick:()=>r(!0),className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40`,"data-testid":`remote-desktop-readiness-continue`,children:l?`Continue (view only)`:`Continue`})]})]})})}function _({req:e,...t}){return(0,m.jsxs)(`li`,{className:`flex gap-2`,"data-testid":`remote-desktop-requirement-${e.id}`,"data-ok":e.ok,children:[e.ok?(0,m.jsx)(o,{className:`mt-0.5 size-4 shrink-0 text-emerald-400`}):(0,m.jsx)(r,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm font-medium`,children:[e.title,!e.ok&&(0,m.jsx)(`span`,{className:`ml-2 text-xs font-normal text-white/50`,children:e.gates===`video`?`required`:`for mouse & keyboard`})]}),!e.ok&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`text-sm text-white/70`,children:e.detail}),(0,m.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions.map(n=>(0,m.jsx)(v,{action:n,reqId:e.id,...t},n.label))})]})]})]})}function v({action:e,reqId:t,onHostAction:n,onTerminal:r}){let i=`inline-flex min-h-11 items-center gap-1.5 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`;return e.kind===`terminal`?(0,m.jsxs)(`button`,{type:`button`,className:i,onClick:()=>r(e.command),title:e.command,children:[(0,m.jsx)(c,{className:`size-4`}),` `,e.label]}):e.kind===`link`?(0,m.jsxs)(`a`,{className:i,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,m.jsx)(s,{className:`size-4`}),` `,e.label]}):(0,m.jsx)(`button`,{type:`button`,className:i,onClick:()=>void n(t,e.action),children:e.label})}export{h as n,g as t};
@@ -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{c as r,n as i,o as a,r as o,s,t as c}from"./use-remote-desktop-display-choice-Cd3Xalca.js";import"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import{t as l}from"./settings-store-CzLnTR8p.js";import{n as u}from"./utils-IrnQujwR.js";import"./panel-store-BmdcSBNb.js";import{t as d}from"./window-store-D0HbQ1pM.js";import"./ws-auth-D111jj32.js";import{Jn as f}from"./index-kGmcC9cb.js";import"./run-in-terminal-wHKwAnWP.js";import{n as p,t as m}from"./remote-desktop-readiness-gate-CHO-KJ9Z.js";var h=e(t(),1);function g(e,t,n){let r=(0,h.useCallback)((n,r,i,a)=>{let s=e.current;if(!s)return;let{xFrac:c,yFrac:l}=o(n,r,s.getBoundingClientRect());t({type:`pointer`,xFrac:c,yFrac:l,button:i,down:a})},[e,t]);(0,h.useEffect)(()=>{let i=e.current;if(!i||!n)return;let a=e=>e===0?`left`:e===2?`right`:null,o=()=>t({type:`releaseAll`}),s=null,c=0,l=()=>{c=0,s&&=(r(s.x,s.y,null,null),null)},u=()=>{c&&=(cancelAnimationFrame(c),0),s&&=(r(s.x,s.y,null,null),null)},d=e=>{e.preventDefault(),i.setPointerCapture(e.pointerId),i.focus(),u(),r(e.clientX,e.clientY,a(e.button),!0)},f=e=>{s={x:e.clientX,y:e.clientY},c||=requestAnimationFrame(l)},p=e=>{u(),r(e.clientX,e.clientY,a(e.button),!1)},m=e=>e.preventDefault(),h=e=>{e.preventDefault(),t({type:`key`,code:e.code,down:!0})},g=e=>{e.preventDefault(),t({type:`key`,code:e.code,down:!1})},_=()=>{document.hidden&&o()};return i.tabIndex=0,i.addEventListener(`pointerdown`,d),i.addEventListener(`pointermove`,f),i.addEventListener(`pointerup`,p),i.addEventListener(`contextmenu`,m),i.addEventListener(`keydown`,h),i.addEventListener(`keyup`,g),i.addEventListener(`blur`,o),document.addEventListener(`visibilitychange`,_),()=>{c&&cancelAnimationFrame(c),i.removeEventListener(`pointerdown`,d),i.removeEventListener(`pointermove`,f),i.removeEventListener(`pointerup`,p),i.removeEventListener(`contextmenu`,m),i.removeEventListener(`keydown`,h),i.removeEventListener(`keyup`,g),i.removeEventListener(`blur`,o),document.removeEventListener(`visibilitychange`,_)}},[e,n,r,t])}var _=n();function v({id:e}){let t=d(e=>e.close),n=(0,h.useCallback)(()=>t(e),[t,e]);return(0,_.jsx)(p,{onCancel:n,children:(0,_.jsx)(m,{onCancel:n,children:(0,_.jsx)(y,{})})})}function y(){let e=(0,h.useRef)(null),t=c(),{connState:n,errorMessage:o,decoderStatus:d,decoderErrorMessage:p,sendMessage:m,reconnect:v,getFrameCount:y,getTotalBytes:b}=a(e,{displayId:t.displayId}),x=l(e=>e.remoteDesktopStatsVisible),S=l(e=>e.toggleRemoteDesktopStatsVisible);g(e,m,n===`streaming`);let C=d===`unsupported`?p:n===`error`?o:n===`closed`?`Disconnected`:n===`connecting`?`Connecting…`:null;return(0,_.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center bg-black`,"data-testid":`remote-desktop-window`,"data-conn-state":n,children:[(0,_.jsx)(`canvas`,{ref:e,"data-testid":`remote-desktop-canvas`,className:`max-h-full max-w-full outline-none`}),(0,_.jsx)(i,{canvasRef:e,getFrameCount:y,getTotalBytes:b}),t.displays.length>1&&(0,_.jsx)(`select`,{value:t.current?.id??``,onChange:e=>t.select(e.target.value),"aria-label":`Display`,className:`absolute right-8 top-1 z-40 h-6 max-w-[45%] rounded bg-black/40 px-1.5 text-xs text-white/80 hover:bg-black/60`,"data-testid":`remote-desktop-display-select`,children:t.displays.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.label,e.primary?` (main)`:``,` · `,e.width,`×`,e.height]},e.id))}),(0,_.jsx)(`button`,{type:`button`,onClick:S,"aria-label":`Toggle stats overlay`,"aria-pressed":x,className:u(`absolute right-1 top-1 z-40 flex size-6 items-center justify-center rounded bg-black/40 text-white/70 hover:bg-black/60 hover:text-white`,x&&`bg-primary/70 text-primary-foreground hover:bg-primary/80`),children:(0,_.jsx)(r,{className:`size-3.5`})}),C&&(0,_.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,_.jsx)(s,{className:`size-6 opacity-70`}),(0,_.jsx)(`span`,{className:`max-w-sm text-center px-4`,children:C}),(n===`error`||n===`closed`)&&d!==`unsupported`&&(0,_.jsxs)(`button`,{onClick:v,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,_.jsx)(f,{className:`size-3.5`}),` Reconnect`]})]})]})}export{v as default};
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{c as r,n as i,o as a,r as o,s,t as c}from"./use-remote-desktop-display-choice-CYQsrOMC.js";import"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import{t as l}from"./settings-store-CzLnTR8p.js";import{n as u}from"./utils-IrnQujwR.js";import"./panel-store-BmdcSBNb.js";import{t as d}from"./window-store-D0HbQ1pM.js";import"./ws-auth-D111jj32.js";import{Jn as f}from"./index-DJM59ogE.js";import"./run-in-terminal-wHKwAnWP.js";import{n as p,t as m}from"./remote-desktop-readiness-gate-Dme8r7Jp.js";var h=e(t(),1);function g(e,t,n){let r=(0,h.useCallback)((n,r,i,a)=>{let s=e.current;if(!s)return;let{xFrac:c,yFrac:l}=o(n,r,s.getBoundingClientRect());t({type:`pointer`,xFrac:c,yFrac:l,button:i,down:a})},[e,t]);(0,h.useEffect)(()=>{let i=e.current;if(!i||!n)return;let a=e=>e===0?`left`:e===2?`right`:null,o=()=>t({type:`releaseAll`}),s=null,c=0,l=()=>{c=0,s&&=(r(s.x,s.y,null,null),null)},u=()=>{c&&=(cancelAnimationFrame(c),0),s&&=(r(s.x,s.y,null,null),null)},d=e=>{e.preventDefault(),i.setPointerCapture(e.pointerId),i.focus(),u(),r(e.clientX,e.clientY,a(e.button),!0)},f=e=>{s={x:e.clientX,y:e.clientY},c||=requestAnimationFrame(l)},p=e=>{u(),r(e.clientX,e.clientY,a(e.button),!1)},m=e=>e.preventDefault(),h=e=>{e.preventDefault(),t({type:`key`,code:e.code,down:!0})},g=e=>{e.preventDefault(),t({type:`key`,code:e.code,down:!1})},_=()=>{document.hidden&&o()};return i.tabIndex=0,i.addEventListener(`pointerdown`,d),i.addEventListener(`pointermove`,f),i.addEventListener(`pointerup`,p),i.addEventListener(`contextmenu`,m),i.addEventListener(`keydown`,h),i.addEventListener(`keyup`,g),i.addEventListener(`blur`,o),document.addEventListener(`visibilitychange`,_),()=>{c&&cancelAnimationFrame(c),i.removeEventListener(`pointerdown`,d),i.removeEventListener(`pointermove`,f),i.removeEventListener(`pointerup`,p),i.removeEventListener(`contextmenu`,m),i.removeEventListener(`keydown`,h),i.removeEventListener(`keyup`,g),i.removeEventListener(`blur`,o),document.removeEventListener(`visibilitychange`,_)}},[e,n,r,t])}var _=n();function v({id:e}){let t=d(e=>e.close),n=(0,h.useCallback)(()=>t(e),[t,e]);return(0,_.jsx)(p,{onCancel:n,children:(0,_.jsx)(m,{onCancel:n,children:(0,_.jsx)(y,{})})})}function y(){let e=(0,h.useRef)(null),t=c(),{connState:n,errorMessage:o,decoderStatus:d,decoderErrorMessage:p,sendMessage:m,reconnect:v,getFrameCount:y,getTotalBytes:b}=a(e,{displayId:t.displayId}),x=l(e=>e.remoteDesktopStatsVisible),S=l(e=>e.toggleRemoteDesktopStatsVisible);g(e,m,n===`streaming`);let C=d===`unsupported`?p:n===`error`?o:n===`closed`?`Disconnected`:n===`connecting`?`Connecting…`:null;return(0,_.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center bg-black`,"data-testid":`remote-desktop-window`,"data-conn-state":n,children:[(0,_.jsx)(`canvas`,{ref:e,"data-testid":`remote-desktop-canvas`,className:`max-h-full max-w-full outline-none`}),(0,_.jsx)(i,{canvasRef:e,getFrameCount:y,getTotalBytes:b}),t.displays.length>1&&(0,_.jsx)(`select`,{value:t.current?.id??``,onChange:e=>t.select(e.target.value),"aria-label":`Display`,className:`absolute right-8 top-1 z-40 h-6 max-w-[45%] rounded bg-black/40 px-1.5 text-xs text-white/80 hover:bg-black/60`,"data-testid":`remote-desktop-display-select`,children:t.displays.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.label,e.primary?` (main)`:``,` · `,e.width,`×`,e.height]},e.id))}),(0,_.jsx)(`button`,{type:`button`,onClick:S,"aria-label":`Toggle stats overlay`,"aria-pressed":x,className:u(`absolute right-1 top-1 z-40 flex size-6 items-center justify-center rounded bg-black/40 text-white/70 hover:bg-black/60 hover:text-white`,x&&`bg-primary/70 text-primary-foreground hover:bg-primary/80`),children:(0,_.jsx)(r,{className:`size-3.5`})}),C&&(0,_.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,_.jsx)(s,{className:`size-6 opacity-70`}),(0,_.jsx)(`span`,{className:`max-w-sm text-center px-4`,children:C}),(n===`error`||n===`closed`)&&d!==`unsupported`&&(0,_.jsxs)(`button`,{onClick:v,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,_.jsx)(f,{className:`size-3.5`}),` Reconnect`]})]})]})}export{v as default};
@@ -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"./calendar-clock-C1asT-gk.js";import{t as i}from"./chevron-down-Dp0rpHb8.js";import{t as a}from"./chevron-right-De-Wz5Lz.js";import{t as o}from"./power-CriQkeK5.js";import{n as s,s as c}from"./api-client-CEYCBt_0.js";import{n as l}from"./utils-IrnQujwR.js";import"./portal-container-context-DKymYOY-.js";import"./context-menu-CJL8L98s.js";import{n as u}from"./use-is-mobile-D1weanbj.js";import{t as d}from"./button-DX32ffge.js";import{t as f}from"./mobile-bottom-sheet-CmySDB6I.js";import"./use-visual-viewport-Bfl3Bxxb.js";import{$n as p,$t as ee,At as m,B as h,Dt as g,Et as _,G as v,H as y,J as b,Ln as x,Pt as S,Qn as C,Tt as w,U as T,V as E,W as D,X as O,Xt as te,Yt as k,en as A,nr as j}from"./index-kGmcC9cb.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await s.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await s.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:l(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:l(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[r,u]=(0,M.useState)(!1),[d,f]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(w,{children:[(0,I.jsx)(S,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>u(!r),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[r?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(a,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:l(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(_,{children:[(0,I.jsxs)(g,{onClick:async()=>{try{let t=await s.post(`/api/schedules/${e.id}/run-now`);c.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),u(!0),f(e=>e+1)}catch(e){c.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(p,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(g,{onClick:async()=>{try{await s.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){c.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(o,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(g,{onClick:t,children:[(0,I.jsx)(j,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(m,{}),(0,I.jsxs)(g,{variant:`destructive`,onClick:async()=>{try{await s.del(`/api/schedules/${e.id}`),c.success(`Schedule deleted`),n()}catch(e){c.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(x,{className:`size-3.5`}),` Delete`]})]})]}),r&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},d)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=u(),[a,o]=(0,M.useState)(()=>$(t)),[c,l]=(0,M.useState)([]),[p,m]=(0,M.useState)(!1),[g,_]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),_(null),s.get(`/api/projects`).then(l).catch(()=>l([])))},[e,t]);let x=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),S=(e,t)=>o(n=>({...n,[e]:t})),C=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(O,{value:a.name,onChange:e=>S(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(O,{value:a.cron_expr,onChange:e=>S(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:x?`Next: ${x.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(h,{value:a.project_path,onValueChange:e=>S(`project_path`,e),children:[(0,I.jsx)(T,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(D,{placeholder:`Select project`})}),(0,I.jsx)(E,{children:c.map(e=>(0,I.jsx)(y,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>S(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(h,{value:a.permission_mode,onValueChange:e=>S(`permission_mode`,e),children:[(0,I.jsx)(T,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(D,{})}),(0,I.jsx)(E,{children:le.map(e=>(0,I.jsx)(y,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(O,{type:`number`,min:1,value:a.max_turns,onChange:e=>S(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(O,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>S(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(v,{checked:a.enabled,onCheckedChange:e=>S(`enabled`,e)})]}),g&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:g}),(0,I.jsx)(d,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){_(`Name, project, and prompt are required`);return}if(!x){_(`Invalid cron expression`);return}m(!0),_(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await s.patch(`/api/schedules/${t.id}`,e):await s.post(`/api/schedules`,e),r(),n()}catch(e){_(e instanceof Error?e.message:String(e))}finally{m(!1)}},disabled:p,className:`w-full min-h-11 cursor-pointer`,children:p?`Saving…`:t?`Save changes`:`Create schedule`})]}),w=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(f,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:w}),(0,I.jsx)(b,{className:`flex-1 min-h-0 px-3 pb-3`,children:C})]}):(0,I.jsx)(k,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(te,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(A,{className:`text-sm`,children:w})}),C]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null),c=()=>{s(null),a(!0)},l=e=>{s(e),a(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(d,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(C,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(r,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(d,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(C,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>l(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:i,schedule:o,onClose:()=>a(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
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"./calendar-clock-C1asT-gk.js";import{t as i}from"./chevron-down-Dp0rpHb8.js";import{t as a}from"./chevron-right-De-Wz5Lz.js";import{t as o}from"./power-CriQkeK5.js";import{n as s,s as c}from"./api-client-CEYCBt_0.js";import{n as l}from"./utils-IrnQujwR.js";import"./portal-container-context-DKymYOY-.js";import"./context-menu-CJL8L98s.js";import{n as u}from"./use-is-mobile-D1weanbj.js";import{t as d}from"./button-DX32ffge.js";import{t as f}from"./mobile-bottom-sheet-CmySDB6I.js";import"./use-visual-viewport-Bfl3Bxxb.js";import{$n as p,$t as ee,At as m,B as h,Dt as g,Et as _,G as v,H as y,J as b,Ln as x,Pt as S,Qn as C,Tt as w,U as T,V as E,W as D,X as O,Xt as te,Yt as k,en as A,nr as j}from"./index-DJM59ogE.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await s.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await s.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:l(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:l(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[r,u]=(0,M.useState)(!1),[d,f]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(w,{children:[(0,I.jsx)(S,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>u(!r),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[r?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(a,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:l(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(_,{children:[(0,I.jsxs)(g,{onClick:async()=>{try{let t=await s.post(`/api/schedules/${e.id}/run-now`);c.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),u(!0),f(e=>e+1)}catch(e){c.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(p,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(g,{onClick:async()=>{try{await s.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){c.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(o,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(g,{onClick:t,children:[(0,I.jsx)(j,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(m,{}),(0,I.jsxs)(g,{variant:`destructive`,onClick:async()=>{try{await s.del(`/api/schedules/${e.id}`),c.success(`Schedule deleted`),n()}catch(e){c.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(x,{className:`size-3.5`}),` Delete`]})]})]}),r&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},d)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=u(),[a,o]=(0,M.useState)(()=>$(t)),[c,l]=(0,M.useState)([]),[p,m]=(0,M.useState)(!1),[g,_]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),_(null),s.get(`/api/projects`).then(l).catch(()=>l([])))},[e,t]);let x=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),S=(e,t)=>o(n=>({...n,[e]:t})),C=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(O,{value:a.name,onChange:e=>S(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(O,{value:a.cron_expr,onChange:e=>S(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:x?`Next: ${x.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(h,{value:a.project_path,onValueChange:e=>S(`project_path`,e),children:[(0,I.jsx)(T,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(D,{placeholder:`Select project`})}),(0,I.jsx)(E,{children:c.map(e=>(0,I.jsx)(y,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>S(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(h,{value:a.permission_mode,onValueChange:e=>S(`permission_mode`,e),children:[(0,I.jsx)(T,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(D,{})}),(0,I.jsx)(E,{children:le.map(e=>(0,I.jsx)(y,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(O,{type:`number`,min:1,value:a.max_turns,onChange:e=>S(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(O,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>S(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(v,{checked:a.enabled,onCheckedChange:e=>S(`enabled`,e)})]}),g&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:g}),(0,I.jsx)(d,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){_(`Name, project, and prompt are required`);return}if(!x){_(`Invalid cron expression`);return}m(!0),_(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await s.patch(`/api/schedules/${t.id}`,e):await s.post(`/api/schedules`,e),r(),n()}catch(e){_(e instanceof Error?e.message:String(e))}finally{m(!1)}},disabled:p,className:`w-full min-h-11 cursor-pointer`,children:p?`Saving…`:t?`Save changes`:`Create schedule`})]}),w=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(f,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:w}),(0,I.jsx)(b,{className:`flex-1 min-h-0 px-3 pb-3`,children:C})]}):(0,I.jsx)(k,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(te,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(A,{className:`text-sm`,children:w})}),C]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null),c=()=>{s(null),a(!0)},l=e=>{s(e),a(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(d,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(C,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(r,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(d,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(C,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>l(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:i,schedule:o,onClose:()=>a(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/general-settings-section-1HVTvlIw.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-kGmcC9cb.js","assets/vendor-mermaid-CfY1-PkA.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-DX32ffge.js","assets/utils-IrnQujwR.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-CxoBA0po.js","assets/api-client-CEYCBt_0.js","assets/react-D1Yg256j.js","assets/window-store-D0HbQ1pM.js","assets/window-pip-registry-CrCYYTTf.js","assets/panel-store-BmdcSBNb.js","assets/context-menu-CJL8L98s.js","assets/portal-container-context-DKymYOY-.js","assets/mobile-bottom-sheet-CmySDB6I.js","assets/use-visual-viewport-Bfl3Bxxb.js","assets/use-is-mobile-D1weanbj.js","assets/project-store-wWZ6bjwq.js","assets/ws-auth-D111jj32.js","assets/settings-store-CzLnTR8p.js","assets/streaming-store-9XVmAMfV.js","assets/tab-store-1xYJb0gM.js","assets/apply-theme-BVXAUYoN.js","assets/resolve-theme-CMp5xxCW.js","assets/index-CuYtJ5xF.css","assets/key-round-CQpDrDxg.js","assets/separator-W_hJcXPk.js","assets/appearance-settings-section-RfH2N1rj.js","assets/text-wrap-oiekm5SB.js","assets/ai-settings-section-BW5a07-Z.js","assets/ai-settings-section-DZuwllLy.js","assets/api-settings-D18Q4Ocp.js","assets/accounts-settings-section-DzDmIsPe.js","assets/flask-conical-tp8gyZGh.js","assets/use-accounts-data-Ba1_uvEE.js","assets/ppmbot-settings-section-Ba4c9AI9.js","assets/brain-KDa9jFRq.js","assets/send-Bb0jtcR6.js","assets/notifications-settings-section-shQ-ugKh.js","assets/jira-watcher-section-BxzwW4uQ.js","assets/extension-manager-section-CyC7wX35.js","assets/folder-symlink-fQRoG_rV.js","assets/power-CriQkeK5.js","assets/proxy-settings-section-BHBhK6HC.js","assets/schedules-settings-section-a4-h6THc.js","assets/calendar-clock-C1asT-gk.js","assets/keyboard-shortcuts-section-DDKG3BU1.js","assets/files-settings-section-D8cebM51.js","assets/query-audit-section-BD5ZVqDz.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./arrow-left-CyFcsyzD.js";import{t as a}from"./bot-D6sx11y0.js";import{t as o}from"./calendar-clock-C1asT-gk.js";import{t as s}from"./chevron-right-De-Wz5Lz.js";import{t as c}from"./key-round-CQpDrDxg.js";import{t as l}from"./keyboard-DiOYrs6C.js";import{t as u}from"./loader-circle-DPMrnLQ2.js";import{q as d}from"./vendor-mermaid-CfY1-PkA.js";import{n as f}from"./utils-IrnQujwR.js";import{t as p}from"./button-DX32ffge.js";import{Ir as m,J as h,Kn as g,Lr as _,Zn as v,_r as y,rr as b}from"./index-kGmcC9cb.js";import{t as x}from"./separator-W_hJcXPk.js";var S=r(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),C=r(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),w=r(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),T=[{id:`core`,label:null},{id:`ai`,label:`AI & Accounts`},{id:`integrations`,label:`Integrations`},{id:`advanced`,label:`Advanced`}],E=[{id:`general`,group:`core`,label:`General`,subtitle:`Device name, password, version`,icon:g},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:b},{id:`ai-provider`,group:`ai`,label:`AI Provider`,subtitle:`Model, execution mode, limits`,icon:a},{id:`accounts`,group:`ai`,label:`Accounts`,subtitle:`Claude and Codex sign-ins, rotation`,icon:c},{id:`ppmbot`,group:`integrations`,label:`PPMBot`,subtitle:`Telegram AI bot`,icon:_},{id:`notifications`,group:`integrations`,label:`Notifications`,subtitle:`Push & Telegram alerts`,icon:S},{id:`jira`,group:`integrations`,label:`Jira Watcher`,subtitle:`Auto-debug Jira tickets`,icon:m},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:v},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:y},{id:`schedules`,group:`advanced`,label:`Scheduled Agents`,subtitle:`Run Claude on a cron schedule`,icon:o},{id:`shortcuts`,group:`advanced`,label:`Keyboard Shortcuts`,subtitle:`Customize key bindings`,icon:l},{id:`files`,group:`advanced`,label:`File Filters`,subtitle:`Exclude patterns, ignore files`,icon:w},{id:`query-audit`,group:`advanced`,label:`Query Audit Log`,subtitle:`SQL history retention and size`,icon:C}];function D(e){return typeof e==`string`&&E.some(t=>t.id===e)}function O(e){return E.find(t=>t.id===e)}function k(e){return E.filter(t=>t.group===e)}var A=n();function j({active:e,onSelect:t}){return(0,A.jsx)(h,{className:`h-full`,children:(0,A.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:T.map(n=>{let r=k(n.id);return r.length===0?null:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,A.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),r.map(n=>{let r=n.icon,i=n.id===e;return(0,A.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:f(`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left cursor-pointer transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 active:bg-accent`),children:[(0,A.jsx)(r,{className:f(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,A.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},n.id)})})})}function M({onSelect:e}){return(0,A.jsx)(h,{className:`h-full`,children:(0,A.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:T.map(t=>{let n=k(t.id);return n.length===0?null:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[t.label&&(0,A.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:t.label}),n.map(t=>{let n=t.icon;return(0,A.jsxs)(`button`,{onClick:()=>e(t.id),"data-testid":`settings-index-${t.id}`,className:`w-full flex items-center gap-3 px-2.5 py-3 rounded-lg text-left cursor-pointer group hover:bg-accent/50 active:bg-accent transition-colors`,children:[(0,A.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,A.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,A.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},t.id)})})})}var N=e(t(),1),P={general:(0,N.lazy)(()=>d(()=>import(`./general-settings-section-1HVTvlIw.js`).then(e=>({default:e.GeneralSettingsSection})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46]))),appearance:(0,N.lazy)(()=>d(()=>import(`./appearance-settings-section-RfH2N1rj.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([47,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,48,46]))),"ai-provider":(0,N.lazy)(()=>d(()=>import(`./ai-settings-section-BW5a07-Z.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([49,4,1,5,27,29,28,50,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,51]))),accounts:(0,N.lazy)(()=>d(()=>import(`./accounts-settings-section-DzDmIsPe.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([52,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,53,45,54,51]))),ppmbot:(0,N.lazy)(()=>d(()=>import(`./ppmbot-settings-section-Ba4c9AI9.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([55,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,56,57,46]))),notifications:(0,N.lazy)(()=>d(()=>import(`./notifications-settings-section-shQ-ugKh.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([58,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,46]))),jira:(0,N.lazy)(()=>d(()=>import(`./jira-watcher-section-BxzwW4uQ.js`).then(e=>({default:e.JiraWatcherSection})),__vite__mapDeps([59,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44]))),extensions:(0,N.lazy)(()=>d(()=>import(`./extension-manager-section-CyC7wX35.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([60,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,61,62]))),proxy:(0,N.lazy)(()=>d(()=>import(`./proxy-settings-section-BHBhK6HC.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,53,51]))),schedules:(0,N.lazy)(()=>d(()=>import(`./schedules-settings-section-a4-h6THc.js`).then(e=>({default:e.SchedulesSettingsSection})),__vite__mapDeps([64,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,65,62]))),shortcuts:(0,N.lazy)(()=>d(()=>import(`./keyboard-shortcuts-section-DDKG3BU1.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44]))),files:(0,N.lazy)(()=>d(()=>import(`./files-settings-section-D8cebM51.js`).then(e=>({default:e.FilesSettingsSection})),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,46]))),"query-audit":(0,N.lazy)(()=>d(()=>import(`./query-audit-section-BD5ZVqDz.js`).then(e=>({default:e.QueryAuditSection})),__vite__mapDeps([68,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,51])))};function F({category:e}){let t=P[e];return(0,A.jsx)(N.Suspense,{fallback:(0,A.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,A.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})}),children:(0,A.jsx)(t,{})})}function I({initialCategory:e,onCategoryChange:t}){let[n,r]=(0,N.useState)(e??`general`),[a,o]=(0,N.useState)(e===void 0),s=O(n),c=s.icon;function l(e){r(e),o(!1),t?.(e)}return(0,A.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":n,children:(0,A.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,A.jsx)(`aside`,{className:`hidden @[640px]:flex @[640px]:flex-col w-[210px] shrink-0 border-r border-border min-h-0`,"data-testid":`settings-rail`,children:(0,A.jsx)(j,{active:n,onSelect:l})}),(0,A.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,A.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,A.jsx)(p,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>o(!0),children:(0,A.jsx)(i,{className:`size-4`})}),(0,A.jsx)(c,{className:`size-4 text-muted-foreground shrink-0`}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:s.label})]}),(0,A.jsx)(x,{}),(0,A.jsx)(h,{className:`flex-1 min-h-0`,children:(0,A.jsx)(`div`,{className:`p-4 pb-8`,children:(0,A.jsx)(F,{category:n})})})]}),a&&(0,A.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,A.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,A.jsx)(x,{}),(0,A.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,A.jsx)(M,{onSelect:l})})]})]})]})})}export{D as n,I as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/general-settings-section-DIZIA54q.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-DJM59ogE.js","assets/vendor-mermaid-CfY1-PkA.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-DX32ffge.js","assets/utils-IrnQujwR.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-CxoBA0po.js","assets/api-client-CEYCBt_0.js","assets/react-D1Yg256j.js","assets/window-store-D0HbQ1pM.js","assets/window-pip-registry-CrCYYTTf.js","assets/panel-store-BmdcSBNb.js","assets/context-menu-CJL8L98s.js","assets/portal-container-context-DKymYOY-.js","assets/mobile-bottom-sheet-CmySDB6I.js","assets/use-visual-viewport-Bfl3Bxxb.js","assets/use-is-mobile-D1weanbj.js","assets/project-store-wWZ6bjwq.js","assets/ws-auth-D111jj32.js","assets/settings-store-CzLnTR8p.js","assets/streaming-store-9XVmAMfV.js","assets/tab-store-1xYJb0gM.js","assets/apply-theme-BVXAUYoN.js","assets/resolve-theme-CMp5xxCW.js","assets/index-CuYtJ5xF.css","assets/key-round-CQpDrDxg.js","assets/separator-W_hJcXPk.js","assets/appearance-settings-section-B9n42QPH.js","assets/text-wrap-oiekm5SB.js","assets/ai-settings-section-DIqSLISN.js","assets/ai-settings-section-COdsN_5h.js","assets/api-settings-D18Q4Ocp.js","assets/accounts-settings-section-BcI3ithh.js","assets/flask-conical-tp8gyZGh.js","assets/use-accounts-data-pAQw6nCa.js","assets/ppmbot-settings-section-B2AZ8whe.js","assets/brain-KDa9jFRq.js","assets/send-Bb0jtcR6.js","assets/notifications-settings-section-BGSLkMuE.js","assets/jira-watcher-section-UEtpcxM9.js","assets/extension-manager-section-Cz8fvK1u.js","assets/folder-symlink-fQRoG_rV.js","assets/power-CriQkeK5.js","assets/proxy-settings-section-BYwWFWvn.js","assets/schedules-settings-section-rczhjkeM.js","assets/calendar-clock-C1asT-gk.js","assets/keyboard-shortcuts-section-sY56ThaI.js","assets/files-settings-section-pc4jOun8.js","assets/query-audit-section-Dj1-npew.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{t as i}from"./arrow-left-CyFcsyzD.js";import{t as a}from"./bot-D6sx11y0.js";import{t as o}from"./calendar-clock-C1asT-gk.js";import{t as s}from"./chevron-right-De-Wz5Lz.js";import{t as c}from"./key-round-CQpDrDxg.js";import{t as l}from"./keyboard-DiOYrs6C.js";import{t as u}from"./loader-circle-DPMrnLQ2.js";import{q as d}from"./vendor-mermaid-CfY1-PkA.js";import{n as f}from"./utils-IrnQujwR.js";import{t as p}from"./button-DX32ffge.js";import{Ir as m,J as h,Kn as g,Lr as _,Zn as v,_r as y,rr as b}from"./index-DJM59ogE.js";import{t as x}from"./separator-W_hJcXPk.js";var S=r(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),C=r(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),w=r(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),T=[{id:`core`,label:null},{id:`ai`,label:`AI & Accounts`},{id:`integrations`,label:`Integrations`},{id:`advanced`,label:`Advanced`}],E=[{id:`general`,group:`core`,label:`General`,subtitle:`Device name, password, version`,icon:g},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:b},{id:`ai-provider`,group:`ai`,label:`AI Provider`,subtitle:`Model, execution mode, limits`,icon:a},{id:`accounts`,group:`ai`,label:`Accounts`,subtitle:`Claude and Codex sign-ins, rotation`,icon:c},{id:`ppmbot`,group:`integrations`,label:`PPMBot`,subtitle:`Telegram AI bot`,icon:_},{id:`notifications`,group:`integrations`,label:`Notifications`,subtitle:`Push & Telegram alerts`,icon:S},{id:`jira`,group:`integrations`,label:`Jira Watcher`,subtitle:`Auto-debug Jira tickets`,icon:m},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:v},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:y},{id:`schedules`,group:`advanced`,label:`Scheduled Agents`,subtitle:`Run Claude on a cron schedule`,icon:o},{id:`shortcuts`,group:`advanced`,label:`Keyboard Shortcuts`,subtitle:`Customize key bindings`,icon:l},{id:`files`,group:`advanced`,label:`File Filters`,subtitle:`Exclude patterns, ignore files`,icon:w},{id:`query-audit`,group:`advanced`,label:`Query Audit Log`,subtitle:`SQL history retention and size`,icon:C}];function D(e){return typeof e==`string`&&E.some(t=>t.id===e)}function O(e){return E.find(t=>t.id===e)}function k(e){return E.filter(t=>t.group===e)}var A=n();function j({active:e,onSelect:t}){return(0,A.jsx)(h,{className:`h-full`,children:(0,A.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:T.map(n=>{let r=k(n.id);return r.length===0?null:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,A.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),r.map(n=>{let r=n.icon,i=n.id===e;return(0,A.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:f(`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left cursor-pointer transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 active:bg-accent`),children:[(0,A.jsx)(r,{className:f(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,A.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},n.id)})})})}function M({onSelect:e}){return(0,A.jsx)(h,{className:`h-full`,children:(0,A.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:T.map(t=>{let n=k(t.id);return n.length===0?null:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[t.label&&(0,A.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:t.label}),n.map(t=>{let n=t.icon;return(0,A.jsxs)(`button`,{onClick:()=>e(t.id),"data-testid":`settings-index-${t.id}`,className:`w-full flex items-center gap-3 px-2.5 py-3 rounded-lg text-left cursor-pointer group hover:bg-accent/50 active:bg-accent transition-colors`,children:[(0,A.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,A.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,A.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},t.id)})})})}var N=e(t(),1),P={general:(0,N.lazy)(()=>d(()=>import(`./general-settings-section-DIZIA54q.js`).then(e=>({default:e.GeneralSettingsSection})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46]))),appearance:(0,N.lazy)(()=>d(()=>import(`./appearance-settings-section-B9n42QPH.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([47,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,48,46]))),"ai-provider":(0,N.lazy)(()=>d(()=>import(`./ai-settings-section-DIqSLISN.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([49,4,1,5,27,29,28,50,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,51]))),accounts:(0,N.lazy)(()=>d(()=>import(`./accounts-settings-section-BcI3ithh.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([52,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,53,45,54,51]))),ppmbot:(0,N.lazy)(()=>d(()=>import(`./ppmbot-settings-section-B2AZ8whe.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([55,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,56,57,46]))),notifications:(0,N.lazy)(()=>d(()=>import(`./notifications-settings-section-BGSLkMuE.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([58,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,46]))),jira:(0,N.lazy)(()=>d(()=>import(`./jira-watcher-section-UEtpcxM9.js`).then(e=>({default:e.JiraWatcherSection})),__vite__mapDeps([59,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44]))),extensions:(0,N.lazy)(()=>d(()=>import(`./extension-manager-section-Cz8fvK1u.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([60,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,61,62]))),proxy:(0,N.lazy)(()=>d(()=>import(`./proxy-settings-section-BYwWFWvn.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,53,51]))),schedules:(0,N.lazy)(()=>d(()=>import(`./schedules-settings-section-rczhjkeM.js`).then(e=>({default:e.SchedulesSettingsSection})),__vite__mapDeps([64,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,65,62]))),shortcuts:(0,N.lazy)(()=>d(()=>import(`./keyboard-shortcuts-section-sY56ThaI.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44]))),files:(0,N.lazy)(()=>d(()=>import(`./files-settings-section-pc4jOun8.js`).then(e=>({default:e.FilesSettingsSection})),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,46]))),"query-audit":(0,N.lazy)(()=>d(()=>import(`./query-audit-section-Dj1-npew.js`).then(e=>({default:e.QueryAuditSection})),__vite__mapDeps([68,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,51])))};function F({category:e}){let t=P[e];return(0,A.jsx)(N.Suspense,{fallback:(0,A.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,A.jsx)(u,{className:`size-5 animate-spin text-muted-foreground`})}),children:(0,A.jsx)(t,{})})}function I({initialCategory:e,onCategoryChange:t}){let[n,r]=(0,N.useState)(e??`general`),[a,o]=(0,N.useState)(e===void 0),s=O(n),c=s.icon;function l(e){r(e),o(!1),t?.(e)}return(0,A.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":n,children:(0,A.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,A.jsx)(`aside`,{className:`hidden @[640px]:flex @[640px]:flex-col w-[210px] shrink-0 border-r border-border min-h-0`,"data-testid":`settings-rail`,children:(0,A.jsx)(j,{active:n,onSelect:l})}),(0,A.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,A.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,A.jsx)(p,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>o(!0),children:(0,A.jsx)(i,{className:`size-4`})}),(0,A.jsx)(c,{className:`size-4 text-muted-foreground shrink-0`}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:s.label})]}),(0,A.jsx)(x,{}),(0,A.jsx)(h,{className:`flex-1 min-h-0`,children:(0,A.jsx)(`div`,{className:`p-4 pb-8`,children:(0,A.jsx)(F,{category:n})})})]}),a&&(0,A.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,A.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,A.jsx)(x,{}),(0,A.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,A.jsx)(M,{onSelect:l})})]})]})]})})}export{D as n,I as t};
@@ -1 +1 @@
1
- import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{n as t,t as n}from"./settings-body-Fq7BVDw2.js";import"./vendor-mermaid-CfY1-PkA.js";import"./button-DX32ffge.js";import"./separator-W_hJcXPk.js";var r=e(),i=({metadata:e})=>(0,r.jsx)(n,{initialCategory:t(e?.category)?e.category:void 0});export{i as SettingsTab};
1
+ import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{n as t,t as n}from"./settings-body-CwaQg_uc.js";import"./vendor-mermaid-CfY1-PkA.js";import"./button-DX32ffge.js";import"./separator-W_hJcXPk.js";var r=e(),i=({metadata:e})=>(0,r.jsx)(n,{initialCategory:t(e?.category)?e.category:void 0});export{i as SettingsTab};
@@ -1 +1 @@
1
- import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{n as t,t as n}from"./settings-body-Fq7BVDw2.js";import"./vendor-mermaid-CfY1-PkA.js";import{t as r}from"./window-store-D0HbQ1pM.js";import"./button-DX32ffge.js";import"./separator-W_hJcXPk.js";var i=e();function a({id:e,payload:a}){let o=r(e=>e.setPayload);return(0,i.jsx)(n,{initialCategory:t(a?.category)?a.category:void 0,onCategoryChange:t=>o(e,{category:t})})}export{a as default};
1
+ import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{n as t,t as n}from"./settings-body-CwaQg_uc.js";import"./vendor-mermaid-CfY1-PkA.js";import{t as r}from"./window-store-D0HbQ1pM.js";import"./button-DX32ffge.js";import"./separator-W_hJcXPk.js";var i=e();function a({id:e,payload:a}){let o=r(e=>e.setPayload);return(0,i.jsx)(n,{initialCategory:t(a?.category)?a.category:void 0,onCategoryChange:t=>o(e,{category:t})})}export{a as default};
@@ -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{a as r,i,r as a}from"./glide-data-grid-BT9p_4AN.js";import{s as o}from"./index-kGmcC9cb.js";import{t as s}from"./use-monaco-theme-Uakgj3hJ.js";var c=e(t(),1),l=n();function u({onExecute:e,loading:t,defaultValue:n=`SELECT * FROM `,schemaInfo:u,onSqlChange:d,persistedSql:f}){let[p,m]=(0,c.useState)(()=>f??n),h=(0,c.useRef)(!!f),g=(0,c.useRef)(null),_=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(e);y.current=e;let b=s();(0,c.useEffect)(()=>{if(!(!_.current||!u))return v.current?.dispose(),a(),v.current=_.current.languages.registerCompletionItemProvider(`sql`,i(_.current,u)),()=>{v.current?.dispose()}},[u]);let x=(0,c.useCallback)((e,t)=>{g.current=e,_.current=t,e.addAction({id:`run-query-at-cursor`,label:`Run Statement at Cursor`,keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.Enter],run:e=>{let t=e.getPosition();if(!t)return;let n=r(e.getValue(),t.lineNumber);n&&y.current(n)}}),u&&(v.current?.dispose(),v.current=t.languages.registerCompletionItemProvider(`sql`,i(t,u)))},[u]);return(0,c.useEffect)(()=>{h.current||m(n)},[n]),(0,l.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,l.jsx)(o,{height:`100%`,language:`sql`,theme:b,value:p,onChange:e=>{let t=e??``;m(t),h.current=!0,d?.(t)},onMount:x,options:{minimap:{enabled:!1},lineNumbers:`off`,scrollBeyondLastLine:!1,wordWrap:`on`,fontSize:12,tabSize:2,renderLineHighlight:`none`,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:6,horizontalScrollbarSize:6},padding:{top:4,bottom:4},lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,fixedOverflowWidgets:!0}})})}export{u as t};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{a as r,i,r as a}from"./glide-data-grid-nA5LsoJK.js";import{s as o}from"./index-DJM59ogE.js";import{t as s}from"./use-monaco-theme-DT5Q8kuf.js";var c=e(t(),1),l=n();function u({onExecute:e,loading:t,defaultValue:n=`SELECT * FROM `,schemaInfo:u,onSqlChange:d,persistedSql:f}){let[p,m]=(0,c.useState)(()=>f??n),h=(0,c.useRef)(!!f),g=(0,c.useRef)(null),_=(0,c.useRef)(null),v=(0,c.useRef)(null),y=(0,c.useRef)(e);y.current=e;let b=s();(0,c.useEffect)(()=>{if(!(!_.current||!u))return v.current?.dispose(),a(),v.current=_.current.languages.registerCompletionItemProvider(`sql`,i(_.current,u)),()=>{v.current?.dispose()}},[u]);let x=(0,c.useCallback)((e,t)=>{g.current=e,_.current=t,e.addAction({id:`run-query-at-cursor`,label:`Run Statement at Cursor`,keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.Enter],run:e=>{let t=e.getPosition();if(!t)return;let n=r(e.getValue(),t.lineNumber);n&&y.current(n)}}),u&&(v.current?.dispose(),v.current=t.languages.registerCompletionItemProvider(`sql`,i(t,u)))},[u]);return(0,c.useEffect)(()=>{h.current||m(n)},[n]),(0,l.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,l.jsx)(o,{height:`100%`,language:`sql`,theme:b,value:p,onChange:e=>{let t=e??``;m(t),h.current=!0,d?.(t)},onMount:x,options:{minimap:{enabled:!1},lineNumbers:`off`,scrollBeyondLastLine:!1,wordWrap:`on`,fontSize:12,tabSize:2,renderLineHighlight:`none`,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:6,horizontalScrollbarSize:6},padding:{top:4,bottom:4},lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,fixedOverflowWidgets:!0}})})}export{u as t};
@@ -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"./database-Y3ESDK4-.js";import{t as i}from"./glide-data-grid-BT9p_4AN.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{t as o}from"./table-CRJsmfeg.js";import{i as s,n as c,s as l}from"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import"./settings-store-CzLnTR8p.js";import"./panel-store-BmdcSBNb.js";import"./window-store-D0HbQ1pM.js";import"./tab-store-1xYJb0gM.js";import{Mr as u,Xn as d}from"./index-kGmcC9cb.js";import"./data-grid-types-DeY60CLU.js";import"./use-monaco-theme-Uakgj3hJ.js";import{t as f}from"./sql-query-editor-D1r265fl.js";var p=e(t(),1);function m(e,t,n){let[r,i]=(0,p.useState)([]),[a,o]=(0,p.useState)(null),[u,d]=(0,p.useState)(null),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(1),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!1),D=n?`/api/db/connections/${n}`:null,O=!n&&!e&&/^(\/|[A-Za-z]:[/\\])/.test(t),k=D??(O?`/api/fs/sqlite`:`${s(e)}/sqlite`),A=D?``:`path=${encodeURIComponent(t)}`,j=(0,p.useCallback)(async()=>{g(!0),v(null);try{let e=D?`?cached=1`:A?`?${A}`:``,t=await c.get(`${k}/tables${e}`);i(t),!D&&t.length>0&&!a&&o(t[0].name)}catch(e){v(e.message)}finally{g(!1)}},[k,A,D]);(0,p.useEffect)(()=>{j()},[j]);let M=(0,p.useCallback)(async()=>{if(a){g(!0);try{let e=A?`${A}&`:``,[t,n]=await Promise.all([c.get(`${k}/data?${e}table=${encodeURIComponent(a)}&page=${y}&limit=100`),c.get(`${k}/schema?${e}table=${encodeURIComponent(a)}`)]);d(t),m(n)}catch(e){v(e.message)}finally{g(!1)}}},[k,A,a,y]);(0,p.useEffect)(()=>{M()},[M]);let N=(0,p.useCallback)(e=>{o(e),b(1),S(null)},[]),P=(0,p.useCallback)(async e=>{E(!0),w(null);try{let n=D?{sql:e}:{path:t,sql:e},r=await c.post(`${k}/query`,n);S(r),r.changeType===`modify`&&M()}catch(e){w(e.message)}finally{E(!1)}},[k,D,t,M]),F=(0,p.useCallback)((e,t)=>{let n=t.message;v(n),l.error(`${e} failed`,{description:n})},[]);return{tables:r,selectedTable:a,selectTable:N,tableData:u,schema:f,loading:h,error:_,page:y,setPage:b,queryResult:x,queryError:C,queryLoading:T,executeQuery:P,updateCell:(0,p.useCallback)(async(e,n,r)=>{if(a)try{D?await c.put(`${k}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await c.put(`${k}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),M()}catch(e){F(`Update cell`,e)}},[k,D,t,a,M,F]),deleteRow:(0,p.useCallback)(async e=>{if(a)try{D?await c.del(`${k}/row`,{table:a,pkColumn:`rowid`,pkValue:e}):await c.del(`${k}/row`,{path:t,table:a,rowid:e}),M(),j()}catch(e){F(`Delete row`,e)}},[k,D,t,a,M,j,F]),refreshTables:j,refreshData:M}}var h=n();function g({tables:e,selectedTable:t,onSelect:n,onRefresh:r}){return(0,h.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,h.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,h.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,h.jsx)(d,{className:`size-3`})})]}),(0,h.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,h.jsx)(o,{className:`size-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,h.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function _({onExecute:e,loading:t}){return(0,h.jsx)(f,{onExecute:e,loading:t})}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,i=e?.connectionId,a=e?.tableName,[o,s]=(0,p.useState)(!1);if(i)return(0,h.jsx)(y,{projectName:``,dbPath:``,connectionId:i,connectionName:e?.connectionName,initialTable:a,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e),hideTableList:!0});let c=!!t&&!n&&/^(\/|[A-Za-z]:[/\\])/.test(t);return!t||!n&&!c?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,h.jsx)(r,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,h.jsx)(y,{projectName:n??``,dbPath:t,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e)})}function y({projectName:e,dbPath:t,connectionId:n,connectionName:o,initialTable:s,queryPanelOpen:c,onToggleQueryPanel:l,hideTableList:d}){let f=m(e,t,n),v=(0,p.useRef)(!1);return(0,p.useEffect)(()=>{s&&!v.current&&f.tables.length>0&&(v.current=!0,f.selectTable(s))},[s,f.tables]),f.error&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,h.jsx)(u,{className:`size-10 text-destructive`}),(0,h.jsx)(`p`,{className:`text-sm`,children:f.error})]}):f.loading&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,h.jsx)(a,{className:`size-5 animate-spin`}),(0,h.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,h.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!d&&(0,h.jsx)(g,{tables:f.tables,selectedTable:f.selectedTable,onSelect:f.selectTable,onRefresh:f.refreshTables}),(0,h.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${d?``:`border-l border-border`}`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,h.jsx)(r,{className:`size-3.5 text-muted-foreground`}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:o??t}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.selectedTable&&`/ ${f.selectedTable}`}),(0,h.jsx)(`div`,{className:`ml-auto`,children:(0,h.jsx)(`button`,{type:`button`,onClick:l,className:`px-2 py-1 rounded text-xs transition-colors ${c?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,h.jsx)(`div`,{className:`flex-1 overflow-hidden ${c?`max-h-[60%]`:``}`,children:f.tableData?(0,h.jsx)(i,{columns:f.tableData.columns,rows:f.tableData.rows,total:f.tableData.total,limit:f.tableData.limit,schema:f.schema.map(e=>({name:e.name,type:e.type,nullable:!e.notnull,pk:!!e.pk,defaultValue:e.dflt_value,fk:e.fk??null})),loading:f.loading,page:f.page,onPageChange:f.setPage,onCellUpdate:(e,t,n,r)=>f.updateCell(t,n,r),onRowDelete:(e,t)=>f.deleteRow(t)}):(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:f.loading?(0,h.jsx)(a,{className:`size-4 animate-spin`}):`Select a table`})}),c&&(0,h.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,h.jsx)(_,{onExecute:f.executeQuery,loading:f.queryLoading})})]})]})}export{v as SqliteViewer};
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"./database-Y3ESDK4-.js";import{t as i}from"./glide-data-grid-nA5LsoJK.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{t as o}from"./table-CRJsmfeg.js";import{i as s,n as c,s as l}from"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import"./settings-store-CzLnTR8p.js";import"./panel-store-BmdcSBNb.js";import"./window-store-D0HbQ1pM.js";import"./tab-store-1xYJb0gM.js";import{Mr as u,Xn as d}from"./index-DJM59ogE.js";import"./data-grid-types-DeY60CLU.js";import"./use-monaco-theme-DT5Q8kuf.js";import{t as f}from"./sql-query-editor-BQsKZVtz.js";var p=e(t(),1);function m(e,t,n){let[r,i]=(0,p.useState)([]),[a,o]=(0,p.useState)(null),[u,d]=(0,p.useState)(null),[f,m]=(0,p.useState)([]),[h,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(null),[y,b]=(0,p.useState)(1),[x,S]=(0,p.useState)(null),[C,w]=(0,p.useState)(null),[T,E]=(0,p.useState)(!1),D=n?`/api/db/connections/${n}`:null,O=!n&&!e&&/^(\/|[A-Za-z]:[/\\])/.test(t),k=D??(O?`/api/fs/sqlite`:`${s(e)}/sqlite`),A=D?``:`path=${encodeURIComponent(t)}`,j=(0,p.useCallback)(async()=>{g(!0),v(null);try{let e=D?`?cached=1`:A?`?${A}`:``,t=await c.get(`${k}/tables${e}`);i(t),!D&&t.length>0&&!a&&o(t[0].name)}catch(e){v(e.message)}finally{g(!1)}},[k,A,D]);(0,p.useEffect)(()=>{j()},[j]);let M=(0,p.useCallback)(async()=>{if(a){g(!0);try{let e=A?`${A}&`:``,[t,n]=await Promise.all([c.get(`${k}/data?${e}table=${encodeURIComponent(a)}&page=${y}&limit=100`),c.get(`${k}/schema?${e}table=${encodeURIComponent(a)}`)]);d(t),m(n)}catch(e){v(e.message)}finally{g(!1)}}},[k,A,a,y]);(0,p.useEffect)(()=>{M()},[M]);let N=(0,p.useCallback)(e=>{o(e),b(1),S(null)},[]),P=(0,p.useCallback)(async e=>{E(!0),w(null);try{let n=D?{sql:e}:{path:t,sql:e},r=await c.post(`${k}/query`,n);S(r),r.changeType===`modify`&&M()}catch(e){w(e.message)}finally{E(!1)}},[k,D,t,M]),F=(0,p.useCallback)((e,t)=>{let n=t.message;v(n),l.error(`${e} failed`,{description:n})},[]);return{tables:r,selectedTable:a,selectTable:N,tableData:u,schema:f,loading:h,error:_,page:y,setPage:b,queryResult:x,queryError:C,queryLoading:T,executeQuery:P,updateCell:(0,p.useCallback)(async(e,n,r)=>{if(a)try{D?await c.put(`${k}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await c.put(`${k}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),M()}catch(e){F(`Update cell`,e)}},[k,D,t,a,M,F]),deleteRow:(0,p.useCallback)(async e=>{if(a)try{D?await c.del(`${k}/row`,{table:a,pkColumn:`rowid`,pkValue:e}):await c.del(`${k}/row`,{path:t,table:a,rowid:e}),M(),j()}catch(e){F(`Delete row`,e)}},[k,D,t,a,M,j,F]),refreshTables:j,refreshData:M}}var h=n();function g({tables:e,selectedTable:t,onSelect:n,onRefresh:r}){return(0,h.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,h.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,h.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,h.jsx)(d,{className:`size-3`})})]}),(0,h.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,h.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,h.jsx)(o,{className:`size-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,h.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function _({onExecute:e,loading:t}){return(0,h.jsx)(f,{onExecute:e,loading:t})}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,i=e?.connectionId,a=e?.tableName,[o,s]=(0,p.useState)(!1);if(i)return(0,h.jsx)(y,{projectName:``,dbPath:``,connectionId:i,connectionName:e?.connectionName,initialTable:a,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e),hideTableList:!0});let c=!!t&&!n&&/^(\/|[A-Za-z]:[/\\])/.test(t);return!t||!n&&!c?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,h.jsx)(r,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,h.jsx)(y,{projectName:n??``,dbPath:t,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e)})}function y({projectName:e,dbPath:t,connectionId:n,connectionName:o,initialTable:s,queryPanelOpen:c,onToggleQueryPanel:l,hideTableList:d}){let f=m(e,t,n),v=(0,p.useRef)(!1);return(0,p.useEffect)(()=>{s&&!v.current&&f.tables.length>0&&(v.current=!0,f.selectTable(s))},[s,f.tables]),f.error&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,h.jsx)(u,{className:`size-10 text-destructive`}),(0,h.jsx)(`p`,{className:`text-sm`,children:f.error})]}):f.loading&&f.tables.length===0?(0,h.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,h.jsx)(a,{className:`size-5 animate-spin`}),(0,h.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,h.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!d&&(0,h.jsx)(g,{tables:f.tables,selectedTable:f.selectedTable,onSelect:f.selectTable,onRefresh:f.refreshTables}),(0,h.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${d?``:`border-l border-border`}`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,h.jsx)(r,{className:`size-3.5 text-muted-foreground`}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:o??t}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.selectedTable&&`/ ${f.selectedTable}`}),(0,h.jsx)(`div`,{className:`ml-auto`,children:(0,h.jsx)(`button`,{type:`button`,onClick:l,className:`px-2 py-1 rounded text-xs transition-colors ${c?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,h.jsx)(`div`,{className:`flex-1 overflow-hidden ${c?`max-h-[60%]`:``}`,children:f.tableData?(0,h.jsx)(i,{columns:f.tableData.columns,rows:f.tableData.rows,total:f.tableData.total,limit:f.tableData.limit,schema:f.schema.map(e=>({name:e.name,type:e.type,nullable:!e.notnull,pk:!!e.pk,defaultValue:e.dflt_value,fk:e.fk??null})),loading:f.loading,page:f.page,onPageChange:f.setPage,onCellUpdate:(e,t,n,r)=>f.updateCell(t,n,r),onRowDelete:(e,t)=>f.deleteRow(t)}):(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:f.loading?(0,h.jsx)(a,{className:`size-4 animate-spin`}):`Select a table`})}),c&&(0,h.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,h.jsx)(_,{onExecute:f.executeQuery,loading:f.queryLoading})})]})]})}export{v as SqliteViewer};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/overview-panel-DiiA3B_Z.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-markdown-Ls5AcU91.js","assets/utils-IrnQujwR.js","assets/format-bytes-Bc6SqF7M.js","assets/process-table-PXwLsMuG.js","assets/index-kGmcC9cb.js","assets/vendor-mermaid-CfY1-PkA.js","assets/vendor-ui-CaeeFO0B.js","assets/button-DX32ffge.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-CxoBA0po.js","assets/api-client-CEYCBt_0.js","assets/react-D1Yg256j.js","assets/window-store-D0HbQ1pM.js","assets/window-pip-registry-CrCYYTTf.js","assets/panel-store-BmdcSBNb.js","assets/context-menu-CJL8L98s.js","assets/portal-container-context-DKymYOY-.js","assets/mobile-bottom-sheet-CmySDB6I.js","assets/use-visual-viewport-Bfl3Bxxb.js","assets/use-is-mobile-D1weanbj.js","assets/project-store-wWZ6bjwq.js","assets/ws-auth-D111jj32.js","assets/settings-store-CzLnTR8p.js","assets/streaming-store-9XVmAMfV.js","assets/tab-store-1xYJb0gM.js","assets/apply-theme-BVXAUYoN.js","assets/resolve-theme-CMp5xxCW.js","assets/index-CuYtJ5xF.css"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{q as i}from"./vendor-mermaid-CfY1-PkA.js";import{n as a}from"./utils-IrnQujwR.js";import{Mn as o,_ as s}from"./index-kGmcC9cb.js";var c=r(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),l=e(t(),1),u=n(),d=(0,l.lazy)(()=>i(()=>import(`./overview-panel-DiiA3B_Z.js`).then(e=>({default:e.OverviewPanel})),__vite__mapDeps([0,1,2,3,4]))),f=(0,l.lazy)(()=>i(()=>import(`./process-table-PXwLsMuG.js`).then(e=>({default:e.ProcessTable})),__vite__mapDeps([5,1,6,7,8,2,9,3,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,4])));function p({isConnected:e,elapsed:t,tickCount:n}){return(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-text-subtle`,"data-testid":`sysmon-connection`,"data-tick-count":n,children:[e?(0,u.jsx)(c,{className:`size-3 text-success`}):(0,u.jsx)(o,{className:`size-3 text-error`}),(0,u.jsx)(`span`,{children:e?`Updated ${t}s ago`:`Disconnected`})]})}var m=(0,l.memo)(function({initialTab:e=`overview`,onTabChange:t,variant:n=`tab`}){let{latest:r,history:i,isConnected:o,tickCount:c}=s({processes:!0}),[m,h]=(0,l.useState)(e),g=e=>{h(e),t?.(e)},_=r?Math.round((Date.now()-r.ts)/1e3):0,v=r?.warnings??[];return(0,u.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,"data-testid":`system-monitor-window`,children:[n===`tab`&&(0,u.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[(0,u.jsx)(`h2`,{className:`text-sm font-medium`,children:`System Monitor`}),(0,u.jsx)(p,{isConnected:o,elapsed:_,tickCount:c})]}),v.length>0&&(0,u.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0 space-y-0.5`,"data-testid":`sysmon-warnings`,children:v.map((e,t)=>(0,u.jsx)(`div`,{children:e},t))}),(0,u.jsxs)(`div`,{className:`flex items-center border-b border-border shrink-0`,role:`tablist`,children:[(0,u.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`overview`,"data-testid":`sysmon-tab-overview`,onClick:()=>g(`overview`),className:a(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`overview`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Overview`}),(0,u.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`processes`,"data-testid":`sysmon-tab-processes`,onClick:()=>g(`processes`),className:a(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`processes`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Processes`}),n===`window`&&(0,u.jsx)(`div`,{className:`ml-auto pr-3`,children:(0,u.jsx)(p,{isConnected:o,elapsed:_,tickCount:c})})]}),(0,u.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsx)(`div`,{className:`p-4 text-xs text-text-subtle`,children:`Loading…`}),children:r?m===`overview`?(0,u.jsx)(d,{system:r.system,history:i}):(0,u.jsx)(f,{snapshot:r}):(0,u.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-subtle text-sm p-4`,children:o?`Waiting for data…`:`Connecting to resource monitor…`})})})]})});export{m as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/overview-panel-DiiA3B_Z.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-markdown-Ls5AcU91.js","assets/utils-IrnQujwR.js","assets/format-bytes-Bc6SqF7M.js","assets/process-table-BmT34-_s.js","assets/index-DJM59ogE.js","assets/vendor-mermaid-CfY1-PkA.js","assets/vendor-ui-CaeeFO0B.js","assets/button-DX32ffge.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-CxoBA0po.js","assets/api-client-CEYCBt_0.js","assets/react-D1Yg256j.js","assets/window-store-D0HbQ1pM.js","assets/window-pip-registry-CrCYYTTf.js","assets/panel-store-BmdcSBNb.js","assets/context-menu-CJL8L98s.js","assets/portal-container-context-DKymYOY-.js","assets/mobile-bottom-sheet-CmySDB6I.js","assets/use-visual-viewport-Bfl3Bxxb.js","assets/use-is-mobile-D1weanbj.js","assets/project-store-wWZ6bjwq.js","assets/ws-auth-D111jj32.js","assets/settings-store-CzLnTR8p.js","assets/streaming-store-9XVmAMfV.js","assets/tab-store-1xYJb0gM.js","assets/apply-theme-BVXAUYoN.js","assets/resolve-theme-CMp5xxCW.js","assets/index-CuYtJ5xF.css"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{q as i}from"./vendor-mermaid-CfY1-PkA.js";import{n as a}from"./utils-IrnQujwR.js";import{Mn as o,_ as s}from"./index-DJM59ogE.js";var c=r(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),l=e(t(),1),u=n(),d=(0,l.lazy)(()=>i(()=>import(`./overview-panel-DiiA3B_Z.js`).then(e=>({default:e.OverviewPanel})),__vite__mapDeps([0,1,2,3,4]))),f=(0,l.lazy)(()=>i(()=>import(`./process-table-BmT34-_s.js`).then(e=>({default:e.ProcessTable})),__vite__mapDeps([5,1,6,7,8,2,9,3,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,4])));function p({isConnected:e,elapsed:t,tickCount:n}){return(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-text-subtle`,"data-testid":`sysmon-connection`,"data-tick-count":n,children:[e?(0,u.jsx)(c,{className:`size-3 text-success`}):(0,u.jsx)(o,{className:`size-3 text-error`}),(0,u.jsx)(`span`,{children:e?`Updated ${t}s ago`:`Disconnected`})]})}var m=(0,l.memo)(function({initialTab:e=`overview`,onTabChange:t,variant:n=`tab`}){let{latest:r,history:i,isConnected:o,tickCount:c}=s({processes:!0}),[m,h]=(0,l.useState)(e),g=e=>{h(e),t?.(e)},_=r?Math.round((Date.now()-r.ts)/1e3):0,v=r?.warnings??[];return(0,u.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,"data-testid":`system-monitor-window`,children:[n===`tab`&&(0,u.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[(0,u.jsx)(`h2`,{className:`text-sm font-medium`,children:`System Monitor`}),(0,u.jsx)(p,{isConnected:o,elapsed:_,tickCount:c})]}),v.length>0&&(0,u.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0 space-y-0.5`,"data-testid":`sysmon-warnings`,children:v.map((e,t)=>(0,u.jsx)(`div`,{children:e},t))}),(0,u.jsxs)(`div`,{className:`flex items-center border-b border-border shrink-0`,role:`tablist`,children:[(0,u.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`overview`,"data-testid":`sysmon-tab-overview`,onClick:()=>g(`overview`),className:a(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`overview`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Overview`}),(0,u.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":m===`processes`,"data-testid":`sysmon-tab-processes`,onClick:()=>g(`processes`),className:a(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,m===`processes`?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:`Processes`}),n===`window`&&(0,u.jsx)(`div`,{className:`ml-auto pr-3`,children:(0,u.jsx)(p,{isConnected:o,elapsed:_,tickCount:c})})]}),(0,u.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,u.jsx)(l.Suspense,{fallback:(0,u.jsx)(`div`,{className:`p-4 text-xs text-text-subtle`,children:`Loading…`}),children:r?m===`overview`?(0,u.jsx)(d,{system:r.system,history:i}):(0,u.jsx)(f,{snapshot:r}):(0,u.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-subtle text-sm p-4`,children:o?`Waiting for data…`:`Connecting to resource monitor…`})})})]})});export{m as t};
@@ -1 +1 @@
1
- import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t}from"./system-monitor-body-y6VUkYTL.js";import"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";var n=e(),r=()=>(0,n.jsx)(t,{});export{r as SystemMonitorTab};
1
+ import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t}from"./system-monitor-body-Dlknm4Uo.js";import"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";var n=e(),r=()=>(0,n.jsx)(t,{});export{r as SystemMonitorTab};
@@ -1 +1 @@
1
- import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t}from"./system-monitor-body-y6VUkYTL.js";import"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import{t as n}from"./window-store-D0HbQ1pM.js";var r=e();function i({id:e,payload:i}){let a=n(e=>e.setPayload);return(0,r.jsx)(t,{initialTab:i?.tab===`processes`?`processes`:`overview`,onTabChange:t=>a(e,{tab:t}),variant:`window`})}export{i as default};
1
+ import{x as e}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t}from"./system-monitor-body-Dlknm4Uo.js";import"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import{t as n}from"./window-store-D0HbQ1pM.js";var r=e();function i({id:e,payload:i}){let a=n(e=>e.setPayload);return(0,r.jsx)(t,{initialTab:i?.tab===`processes`?`processes`:`overview`,onTabChange:t=>a(e,{tab:t}),variant:`window`})}export{i as default};
@@ -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"./vendor-mermaid-CfY1-PkA.js";import"./portal-container-context-DKymYOY-.js";import{p as r,t as i}from"./panel-store-BmdcSBNb.js";import"./window-store-D0HbQ1pM.js";import"./use-is-mobile-D1weanbj.js";import"./window-pip-registry-CrCYYTTf.js";import{Jt as a}from"./index-kGmcC9cb.js";var o=e(t(),1),s=n();function c({id:e,payload:t}){let n=r(e),c=(i(e=>e.panels[n])?.tabs.length??0)>0,l=(0,o.useRef)(!1);c&&(l.current=!0);let u=typeof t?.originPanelId==`string`?t.originPanelId:null,d=(0,o.useRef)(u);d.current=u;let f=(0,o.useCallback)(e=>a(n,e),[n]),p=(0,o.useRef)(null);return(0,o.useLayoutEffect)(()=>(p.current=null,()=>{let t={};p.current=t,queueMicrotask(()=>{p.current===t&&(p.current=null,i.getState().redockFromWindow(e,d.current))})}),[e]),(0,s.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,s.jsx)(`div`,{ref:f,className:`absolute inset-0`}),!c&&!l.current&&(0,s.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs text-text-2 pointer-events-none`,children:`Loading…`})]})}export{c as default};
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"./vendor-mermaid-CfY1-PkA.js";import"./portal-container-context-DKymYOY-.js";import{p as r,t as i}from"./panel-store-BmdcSBNb.js";import"./window-store-D0HbQ1pM.js";import"./use-is-mobile-D1weanbj.js";import"./window-pip-registry-CrCYYTTf.js";import{Jt as a}from"./index-DJM59ogE.js";var o=e(t(),1),s=n();function c({id:e,payload:t}){let n=r(e),c=(i(e=>e.panels[n])?.tabs.length??0)>0,l=(0,o.useRef)(!1);c&&(l.current=!0);let u=typeof t?.originPanelId==`string`?t.originPanelId:null,d=(0,o.useRef)(u);d.current=u;let f=(0,o.useCallback)(e=>a(n,e),[n]),p=(0,o.useRef)(null);return(0,o.useLayoutEffect)(()=>(p.current=null,()=>{let t={};p.current=t,queueMicrotask(()=>{p.current===t&&(p.current=null,i.getState().redockFromWindow(e,d.current))})}),[e]),(0,s.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,s.jsx)(`div`,{ref:f,className:`absolute inset-0`}),!c&&!l.current&&(0,s.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs text-text-2 pointer-events-none`,children:`Loading…`})]})}export{c as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/team-member-window-content-D6tVTXuV.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-kGmcC9cb.js","assets/vendor-mermaid-CfY1-PkA.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-DX32ffge.js","assets/utils-IrnQujwR.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-CxoBA0po.js","assets/api-client-CEYCBt_0.js","assets/react-D1Yg256j.js","assets/window-store-D0HbQ1pM.js","assets/window-pip-registry-CrCYYTTf.js","assets/panel-store-BmdcSBNb.js","assets/context-menu-CJL8L98s.js","assets/portal-container-context-DKymYOY-.js","assets/mobile-bottom-sheet-CmySDB6I.js","assets/use-visual-viewport-Bfl3Bxxb.js","assets/use-is-mobile-D1weanbj.js","assets/project-store-wWZ6bjwq.js","assets/ws-auth-D111jj32.js","assets/settings-store-CzLnTR8p.js","assets/streaming-store-9XVmAMfV.js","assets/tab-store-1xYJb0gM.js","assets/apply-theme-BVXAUYoN.js","assets/resolve-theme-CMp5xxCW.js","assets/index-CuYtJ5xF.css","assets/tool-cards-DRJu20sL.js","assets/circle-question-mark-CzR7YRc-.js","assets/code-DJgYrFzm.js","assets/send-Bb0jtcR6.js","assets/use-blob-url-CrwoZJUJ.js","assets/image-gallery-J8h8IY0c.js"])))=>i.map(i=>d[i]);
2
- 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-CxoBA0po.js";import{q as i}from"./vendor-mermaid-CfY1-PkA.js";import"./portal-container-context-DKymYOY-.js";import"./window-store-D0HbQ1pM.js";import"./use-is-mobile-D1weanbj.js";import{t as a}from"./mobile-bottom-sheet-CmySDB6I.js";import"./use-visual-viewport-Bfl3Bxxb.js";import{n as o}from"./use-open-team-member-CSUU7Z8N.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./team-member-window-content-D6tVTXuV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50])));function u(){let e=o(e=>e.payload),t=o(e=>e.close);return e?(0,c.jsxs)(a,{open:!0,onClose:t,zIndex:45,className:`flex h-[var(--sheet-vh)] flex-col p-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,c.jsxs)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:[`Session — `,e.memberName]}),(0,c.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto flex size-11 items-center justify-center rounded text-text-secondary hover:text-text-primary`,"aria-label":`Close`,children:(0,c.jsx)(r,{className:`size-5`})})]}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(`div`,{className:`p-4 text-sm text-text-2`,children:`Loading…`}),children:(0,c.jsx)(l,{id:`sheet-${e.memberName}`,payload:e})})})]}):null}export{u as TeamMemberSheet};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/team-member-window-content-BYtro89j.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-DJM59ogE.js","assets/vendor-mermaid-CfY1-PkA.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-DX32ffge.js","assets/utils-IrnQujwR.js","assets/createLucideIcon-D8pyde1A.js","assets/arrow-left-CyFcsyzD.js","assets/bot-D6sx11y0.js","assets/check-DN75Ucvz.js","assets/chevron-down-Dp0rpHb8.js","assets/chevron-right-De-Wz5Lz.js","assets/chevron-up-8PbsNiJp.js","assets/circle-BCy0AUCo.js","assets/clock-C1CQUQPZ.js","assets/sparkles-Dh-_J2Rd.js","assets/copy-BewHj66E.js","assets/database-Y3ESDK4-.js","assets/download-DG3_9xXy.js","assets/use-coarse-long-press-BmI_GVW5.js","assets/eye-off-GjXVuAOn.js","assets/eye-gWwaF4Lg.js","assets/loader-circle-DPMrnLQ2.js","assets/monitor-C835ucWH.js","assets/x-CxoBA0po.js","assets/api-client-CEYCBt_0.js","assets/react-D1Yg256j.js","assets/window-store-D0HbQ1pM.js","assets/window-pip-registry-CrCYYTTf.js","assets/panel-store-BmdcSBNb.js","assets/context-menu-CJL8L98s.js","assets/portal-container-context-DKymYOY-.js","assets/mobile-bottom-sheet-CmySDB6I.js","assets/use-visual-viewport-Bfl3Bxxb.js","assets/use-is-mobile-D1weanbj.js","assets/project-store-wWZ6bjwq.js","assets/ws-auth-D111jj32.js","assets/settings-store-CzLnTR8p.js","assets/streaming-store-9XVmAMfV.js","assets/tab-store-1xYJb0gM.js","assets/apply-theme-BVXAUYoN.js","assets/resolve-theme-CMp5xxCW.js","assets/index-CuYtJ5xF.css","assets/tool-cards-CY9J4ux4.js","assets/circle-question-mark-CzR7YRc-.js","assets/code-DJgYrFzm.js","assets/send-Bb0jtcR6.js","assets/use-blob-url-CrwoZJUJ.js","assets/image-gallery-J8h8IY0c.js"])))=>i.map(i=>d[i]);
2
+ 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-CxoBA0po.js";import{q as i}from"./vendor-mermaid-CfY1-PkA.js";import"./portal-container-context-DKymYOY-.js";import"./window-store-D0HbQ1pM.js";import"./use-is-mobile-D1weanbj.js";import{t as a}from"./mobile-bottom-sheet-CmySDB6I.js";import"./use-visual-viewport-Bfl3Bxxb.js";import{n as o}from"./use-open-team-member-CSUU7Z8N.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./team-member-window-content-BYtro89j.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50])));function u(){let e=o(e=>e.payload),t=o(e=>e.close);return e?(0,c.jsxs)(a,{open:!0,onClose:t,zIndex:45,className:`flex h-[var(--sheet-vh)] flex-col p-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,c.jsxs)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:[`Session — `,e.memberName]}),(0,c.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto flex size-11 items-center justify-center rounded text-text-secondary hover:text-text-primary`,"aria-label":`Close`,children:(0,c.jsx)(r,{className:`size-5`})})]}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(`div`,{className:`p-4 text-sm text-text-2`,children:`Loading…`}),children:(0,c.jsx)(l,{id:`sheet-${e.memberName}`,payload:e})})})]}):null}export{u as TeamMemberSheet};
@@ -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"./tool-cards-DRJu20sL.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{n as a}from"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import{n as o}from"./utils-IrnQujwR.js";import"./panel-store-BmdcSBNb.js";import"./window-store-D0HbQ1pM.js";import"./tab-store-1xYJb0gM.js";import{Xn as s}from"./index-kGmcC9cb.js";import"./use-blob-url-CrwoZJUJ.js";var c=e(t(),1),l=3e3,u=2e3;function d(e,t){let[n,r]=(0,c.useState)([]),[i,o]=(0,c.useState)(!0),[s,d]=(0,c.useState)(null),[f,p]=(0,c.useState)(0);return(0,c.useEffect)(()=>{if(!e||!t){d(`Missing team or member`),o(!1);return}let n=!1,i=0,s=!1;r([]),o(!0),d(null);let c=async()=>{if(s)return;s=!0;let c=i===0;try{let o=await a.get(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}/transcript?sinceBytes=${i}`);if(n)return;i=o?.nextBytes??i;let s=o?.events??[];c||o?.restarted?r(s.slice(-u)):s.length>0&&r(e=>[...e,...s].slice(-u)),d(null)}catch{!n&&c&&d(`Could not read this member's session`)}finally{s=!1,n||o(!1)}};c();let f=setInterval(()=>void c(),l);return()=>{n=!0,clearInterval(f)}},[e,t,f]),{events:n,loading:i,error:s,refresh:(0,c.useCallback)(()=>p(e=>e+1),[])}}var f=n();function p({payload:e}){let{teamName:t,memberName:n,projectName:a}=e??{},{events:c,loading:l,error:u,refresh:p}=d(t,n);return(0,f.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium truncate`,children:n}),(0,f.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:c.length>0?`${c.length} steps`:``}),(0,f.jsx)(`button`,{type:`button`,onClick:p,className:`ml-auto text-text-subtle hover:text-foreground p-1 shrink-0`,"aria-label":`Reload session`,children:(0,f.jsx)(s,{className:o(`size-3`,l&&`animate-spin`)})})]}),l&&c.length===0?(0,f.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,f.jsx)(i,{className:`size-3 animate-spin`}),`Loading session…`]}):u?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-error px-4 text-center`,children:u}):c.length===0?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle`,children:`This member has no recorded session`}):(0,f.jsx)(r,{events:c,projectName:a,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{p as default};
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"./tool-cards-CY9J4ux4.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{n as a}from"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import{n as o}from"./utils-IrnQujwR.js";import"./panel-store-BmdcSBNb.js";import"./window-store-D0HbQ1pM.js";import"./tab-store-1xYJb0gM.js";import{Xn as s}from"./index-DJM59ogE.js";import"./use-blob-url-CrwoZJUJ.js";var c=e(t(),1),l=3e3,u=2e3;function d(e,t){let[n,r]=(0,c.useState)([]),[i,o]=(0,c.useState)(!0),[s,d]=(0,c.useState)(null),[f,p]=(0,c.useState)(0);return(0,c.useEffect)(()=>{if(!e||!t){d(`Missing team or member`),o(!1);return}let n=!1,i=0,s=!1;r([]),o(!0),d(null);let c=async()=>{if(s)return;s=!0;let c=i===0;try{let o=await a.get(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}/transcript?sinceBytes=${i}`);if(n)return;i=o?.nextBytes??i;let s=o?.events??[];c||o?.restarted?r(s.slice(-u)):s.length>0&&r(e=>[...e,...s].slice(-u)),d(null)}catch{!n&&c&&d(`Could not read this member's session`)}finally{s=!1,n||o(!1)}};c();let f=setInterval(()=>void c(),l);return()=>{n=!0,clearInterval(f)}},[e,t,f]),{events:n,loading:i,error:s,refresh:(0,c.useCallback)(()=>p(e=>e+1),[])}}var f=n();function p({payload:e}){let{teamName:t,memberName:n,projectName:a}=e??{},{events:c,loading:l,error:u,refresh:p}=d(t,n);return(0,f.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium truncate`,children:n}),(0,f.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:c.length>0?`${c.length} steps`:``}),(0,f.jsx)(`button`,{type:`button`,onClick:p,className:`ml-auto text-text-subtle hover:text-foreground p-1 shrink-0`,"aria-label":`Reload session`,children:(0,f.jsx)(s,{className:o(`size-3`,l&&`animate-spin`)})})]}),l&&c.length===0?(0,f.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,f.jsx)(i,{className:`size-3 animate-spin`}),`Loading session…`]}):u?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-error px-4 text-center`,children:u}):c.length===0?(0,f.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle`,children:`This member has no recorded session`}):(0,f.jsx)(r,{events:c,projectName:a,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{p as default};
@@ -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"./createLucideIcon-D8pyde1A.js";import{t as i}from"./copy-BewHj66E.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{n as o,s}from"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import{t as c}from"./settings-store-CzLnTR8p.js";import{n as l}from"./utils-IrnQujwR.js";import"./portal-container-context-DKymYOY-.js";import{t as u}from"./panel-store-BmdcSBNb.js";import"./window-store-D0HbQ1pM.js";import{r as d,t as f}from"./apply-theme-BVXAUYoN.js";import{t as p}from"./mobile-bottom-sheet-CmySDB6I.js";import"./use-visual-viewport-Bfl3Bxxb.js";import{t as m}from"./resolve-theme-CMp5xxCW.js";import{t as h}from"./ws-auth-D111jj32.js";import{Dr as g,Yn as _,an as v,dr as y,kr as b,nn as x,sr as S}from"./index-kGmcC9cb.js";import{r as C}from"./send-to-chat-BI7-fFpG.js";import{n as w,t as T}from"./run-in-terminal-wHKwAnWP.js";import{i as E,n as D,r as O,t as k}from"./vendor-xterm-YQlzIWv2.js";var A=r(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),j=r(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),M=r(`text-select`,[[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 14v1`,key:`169vum`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M9 3h1`,key:`1yesri`}]]),N=e(t(),1);function P(e){let t=e.tokens;if(e.terminal){let n=e.terminal.ansi;return{background:t.bgSolid,foreground:t.text,cursor:e.terminal.cursor,cursorAccent:e.terminal.cursorAccent??t.bgSolid,selectionBackground:e.terminal.selection,black:n[0],red:n[1],green:n[2],yellow:n[3],blue:n[4],magenta:n[5],cyan:n[6],white:n[7],brightBlack:n[8],brightRed:n[9],brightGreen:n[10],brightYellow:n[11],brightBlue:n[12],brightMagenta:n[13],brightCyan:n[14],brightWhite:n[15]}}let n=e.mode===`dark`,r=n?`#1b1f2a`:`#2b2f38`,i=n?`#d7dce8`:`#e9edf5`,a=t.text3,o=n?`#f7f9ff`:`#ffffff`;return{background:t.bgSolid,foreground:t.text,cursor:t.accent,cursorAccent:t.bgSolid,selectionBackground:t.accentWash,black:r,red:t.error,green:t.success,yellow:t.warning,blue:t.accent,magenta:t.accent2,cyan:t.info,white:i,brightBlack:a,brightRed:t.error,brightGreen:t.success,brightYellow:t.warning,brightBlue:t.accent,brightMagenta:t.accent2,brightCyan:t.info,brightWhite:o}}function F(){let e=c.getState();return P(d()??m(e.themeStyle,e.themeMode,e.customThemes,e.customThemeId))}var ee=/[).,;:'"\]}>]+$/,te=/\bhttps?:\/\/[^\s<>"'`]+/g,I=5e3,L=100,R=250,z=3e3,B=`RESIZE:`,ne=`PING`,re=`PONG`,ie=15e3,ae=35e3;function V(e){let{sessionId:t,containerRef:n}=e,r=(0,N.useRef)(null),i=(0,N.useRef)(null),a=(0,N.useRef)(null),o=(0,N.useRef)(null),s=(0,N.useRef)(0),c=(0,N.useRef)(!1),l=(0,N.useRef)(Date.now()),[u,d]=(0,N.useState)(!1),[p,m]=(0,N.useState)(!1),[g,_]=(0,N.useState)(!1),[y,b]=(0,N.useState)(!1),x=(0,N.useRef)(null),S=(0,N.useRef)(null),C=e.tabId?`ppm:terminal-session:${e.tabId}`:null,w=(0,N.useRef)((()=>{if(C)try{return localStorage.getItem(C)??t}catch{}return t})()),T=(0,N.useRef)(0),A=(0,N.useRef)(-1),j=(0,N.useCallback)(e=>{let t=a.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),M=(0,N.useCallback)(()=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>b(!0),R)},[]),P=(0,N.useCallback)(()=>r.current?.getSelection()??``,[]),V=(0,N.useCallback)(()=>{let e=r.current;if(!e)return``;let t=e.buffer.active,n=T.current,i=t.baseY+t.cursorY,a=[];for(let e=n;e<=i;e++){let n=t.getLine(e);n&&a.push(n.translateToString(!0))}for(;a.length>0&&a[a.length-1].trim()===``;)a.pop();return a.join(`
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"./copy-BewHj66E.js";import{t as a}from"./loader-circle-DPMrnLQ2.js";import{n as o,s}from"./api-client-CEYCBt_0.js";import"./vendor-mermaid-CfY1-PkA.js";import{t as c}from"./settings-store-CzLnTR8p.js";import{n as l}from"./utils-IrnQujwR.js";import"./portal-container-context-DKymYOY-.js";import{t as u}from"./panel-store-BmdcSBNb.js";import"./window-store-D0HbQ1pM.js";import{r as d,t as f}from"./apply-theme-BVXAUYoN.js";import{t as p}from"./mobile-bottom-sheet-CmySDB6I.js";import"./use-visual-viewport-Bfl3Bxxb.js";import{t as m}from"./resolve-theme-CMp5xxCW.js";import{t as h}from"./ws-auth-D111jj32.js";import{Dr as g,Yn as _,an as v,dr as y,kr as b,nn as x,sr as S}from"./index-DJM59ogE.js";import{r as C}from"./send-to-chat-BI7-fFpG.js";import{n as w,t as T}from"./run-in-terminal-wHKwAnWP.js";import{i as E,n as D,r as O,t as k}from"./vendor-xterm-YQlzIWv2.js";var A=r(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),j=r(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),M=r(`text-select`,[[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 14v1`,key:`169vum`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M9 3h1`,key:`1yesri`}]]),N=e(t(),1);function P(e){let t=e.tokens;if(e.terminal){let n=e.terminal.ansi;return{background:t.bgSolid,foreground:t.text,cursor:e.terminal.cursor,cursorAccent:e.terminal.cursorAccent??t.bgSolid,selectionBackground:e.terminal.selection,black:n[0],red:n[1],green:n[2],yellow:n[3],blue:n[4],magenta:n[5],cyan:n[6],white:n[7],brightBlack:n[8],brightRed:n[9],brightGreen:n[10],brightYellow:n[11],brightBlue:n[12],brightMagenta:n[13],brightCyan:n[14],brightWhite:n[15]}}let n=e.mode===`dark`,r=n?`#1b1f2a`:`#2b2f38`,i=n?`#d7dce8`:`#e9edf5`,a=t.text3,o=n?`#f7f9ff`:`#ffffff`;return{background:t.bgSolid,foreground:t.text,cursor:t.accent,cursorAccent:t.bgSolid,selectionBackground:t.accentWash,black:r,red:t.error,green:t.success,yellow:t.warning,blue:t.accent,magenta:t.accent2,cyan:t.info,white:i,brightBlack:a,brightRed:t.error,brightGreen:t.success,brightYellow:t.warning,brightBlue:t.accent,brightMagenta:t.accent2,brightCyan:t.info,brightWhite:o}}function F(){let e=c.getState();return P(d()??m(e.themeStyle,e.themeMode,e.customThemes,e.customThemeId))}var ee=/[).,;:'"\]}>]+$/,te=/\bhttps?:\/\/[^\s<>"'`]+/g,I=5e3,L=100,R=250,z=3e3,B=`RESIZE:`,ne=`PING`,re=`PONG`,ie=15e3,ae=35e3;function V(e){let{sessionId:t,containerRef:n}=e,r=(0,N.useRef)(null),i=(0,N.useRef)(null),a=(0,N.useRef)(null),o=(0,N.useRef)(null),s=(0,N.useRef)(0),c=(0,N.useRef)(!1),l=(0,N.useRef)(Date.now()),[u,d]=(0,N.useState)(!1),[p,m]=(0,N.useState)(!1),[g,_]=(0,N.useState)(!1),[y,b]=(0,N.useState)(!1),x=(0,N.useRef)(null),S=(0,N.useRef)(null),C=e.tabId?`ppm:terminal-session:${e.tabId}`:null,w=(0,N.useRef)((()=>{if(C)try{return localStorage.getItem(C)??t}catch{}return t})()),T=(0,N.useRef)(0),A=(0,N.useRef)(-1),j=(0,N.useCallback)(e=>{let t=a.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),M=(0,N.useCallback)(()=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>b(!0),R)},[]),P=(0,N.useCallback)(()=>r.current?.getSelection()??``,[]),V=(0,N.useCallback)(()=>{let e=r.current;if(!e)return``;let t=e.buffer.active,n=T.current,i=t.baseY+t.cursorY,a=[];for(let e=n;e<=i;e++){let n=t.getLine(e);n&&a.push(n.translateToString(!0))}for(;a.length>0&&a[a.length-1].trim()===``;)a.pop();return a.join(`
2
2
  `)},[]),H=(0,N.useCallback)(()=>{let e=r.current;return!e||A.current<0?``:e.buffer.active.getLine(A.current)?.translateToString(!0).trimEnd()??``},[]),U=(0,N.useCallback)(()=>{let e=r.current;if(!e)return[];let t=e.buffer.active,n=t.baseY+t.cursorY,i=Math.max(0,n-I),a=[],o=``;for(let e=i;e<=n;e++){let n=t.getLine(e);n&&(o+=n.translateToString(!0),!t.getLine(e+1)?.isWrapped&&(a.push(o),o=``))}o&&a.push(o);let s=new Set,c=[];for(let e of a)for(let t of e.match(te)??[]){let e=t.replace(ee,``);!e||s.has(e)||(s.add(e),c.push(e))}return c.reverse()},[]),W=(0,N.useCallback)(()=>{let e=r.current,t=a.current;e&&t?.readyState===WebSocket.OPEN&&t.send(`${B}${e.cols},${e.rows}`)},[]),G=(0,N.useCallback)(()=>{if(o.current&&clearTimeout(o.current),a.current?.close(),a.current=null,w.current=`new`,C)try{localStorage.removeItem(C)}catch{}s.current=0,_(!1),b(!1),d(!1),m(!1),setTimeout(()=>K(),0)},[]),K=(0,N.useCallback)(()=>{o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.onclose=null,a.current.close(),null);let t=r.current;if(!t)return;let n=window.location.protocol===`https:`?`wss:`:`ws:`,i=e.projectName??``,u=w.current,f=u===`new`&&e.cwd?`?cwd=${encodeURIComponent(e.cwd)}`:``,p=h(`/ws/project/${encodeURIComponent(i)}/terminal/${u}${f}`),g=`${n}//${window.location.host}${p}`,v=new WebSocket(g);a.current=v,v.onopen=()=>{c.current&&r.current&&r.current.clear(),c.current=!0,l.current=Date.now(),d(!0),m(!1),s.current=0,w.current===`new`&&b(!1),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>b(!0),z),W()},v.onmessage=e=>{if(l.current=Date.now(),typeof e.data==`string`){if(e.data===re)return;if(e.data.startsWith(`{`))try{let n=JSON.parse(e.data);if(n.type){if(n.type===`session`&&n.id&&(w.current=n.id,C))try{localStorage.setItem(C,n.id)}catch{}n.type===`error`&&t.write(`\r\n\x1b[31mError: ${n.message}\x1b[0m\r\n`),n.type===`exited`&&_(!0);return}}catch{}M(),t.write(e.data)}},v.onclose=()=>{d(!1),J()},v.onerror=()=>{v.close()}},[W]),q=(0,N.useCallback)(()=>{if(document.visibilityState!==`visible`)return;let e=a.current;if(!e||e.readyState!==WebSocket.OPEN){K();return}if(Date.now()-l.current>ae){K();return}try{e.send(ne)}catch{K()}},[K]);function J(){let e=Math.min(1e3*2**s.current,3e4);s.current++,m(!0),o.current=setTimeout(()=>{K()},e)}return(0,N.useEffect)(()=>{let e=n.current;if(!e)return;let t=new E({cursorBlink:!0,fontSize:13,scrollback:5e4,fontFamily:`Consolas, 'Cascadia Mono', Menlo, 'DejaVu Sans Mono', 'Courier New', monospace`,theme:F()}),s=new O,c=new D;if(t.loadAddon(s),t.loadAddon(c),t.open(e),!(`ontouchstart`in window||navigator.maxTouchPoints>0))try{let e=new k;e.onContextLoss(()=>e.dispose()),t.loadAddon(e)}catch{}s.fit(),r.current=t,i.current=s,t.onData(e=>{if(e.includes(`\r`)||e.includes(`
3
3
  `)){let e=t.buffer.active;A.current=e.baseY+e.cursorY,T.current=A.current+1}let n=a.current;n?.readyState===WebSocket.OPEN&&n.send(e)}),K();let l=setInterval(q,ie),u=e.ownerDocument,d=()=>{u.visibilityState===`visible`&&q()};u.addEventListener(`visibilitychange`,d);let p=null,m=new ResizeObserver(e=>{let t=e[0];!t||t.contentRect.width===0||t.contentRect.height===0||(p&&clearTimeout(p),p=setTimeout(()=>{try{s.fit(),W()}catch{}},L))});m.observe(e);let h=v(e,()=>{try{s.fit(),W()}catch{}}),g=()=>{t.options.theme=F()};window.addEventListener(f,g);let _=()=>window.removeEventListener(f,g);return()=>{_(),h(),p&&clearTimeout(p),m.disconnect(),clearInterval(l),u.removeEventListener(`visibilitychange`,d),o.current&&clearTimeout(o.current),x.current&&clearTimeout(x.current),S.current&&clearTimeout(S.current),a.current?.close(),a.current=null,t.dispose(),r.current=null,i.current=null}},[]),{connected:u,reconnecting:p,exited:g,shellReady:y,sendData:j,getSelection:P,getLastCommandOutput:V,getLastCommand:H,getBufferUrls:U,restart:G}}function H(e,t,n){return new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,clientX:t.clientX,clientY:t.clientY,screenX:t.screenX,screenY:t.screenY,button:0,buttons:n,detail:1})}function U(e,t){(0,N.useEffect)(()=>{let n=e.current;if(!t||!n)return;let r=n.querySelector(`.xterm`);if(!r)return;let i=e=>{let t=e.touches[0];!t||e.touches.length>1||(e.preventDefault(),e.stopPropagation(),r.dispatchEvent(H(`mousedown`,t,1)))},a=e=>{let t=e.touches[0];t&&(e.preventDefault(),e.stopPropagation(),document.dispatchEvent(H(`mousemove`,t,1)))},o=e=>{let t=e.changedTouches[0];t&&(e.preventDefault(),e.stopPropagation(),document.dispatchEvent(H(`mouseup`,t,0)))},s={capture:!0,passive:!1};return n.addEventListener(`touchstart`,i,s),n.addEventListener(`touchmove`,a,s),n.addEventListener(`touchend`,o,s),n.addEventListener(`touchcancel`,o,s),()=>{n.removeEventListener(`touchstart`,i,s),n.removeEventListener(`touchmove`,a,s),n.removeEventListener(`touchend`,o,s),n.removeEventListener(`touchcancel`,o,s)}},[e,t])}var W=40;function G(e){if(!e||typeof e.checkVisibility==`function`&&!e.checkVisibility({visibilityProperty:!0}))return!1;let t=e.getBoundingClientRect();return t.width<W||t.height<W?!1:t.bottom>0&&t.right>0&&t.top<window.innerHeight&&t.left<window.innerWidth}function K({tabId:e,metadata:t,shellReady:n,sendData:r,focusTerminal:i,containerRef:a}){let o=(0,N.useRef)(null),[s,c]=(0,N.useState)(0),l=(0,N.useCallback)(e=>{o.current=e,c(e=>e+1)},[]),d=t?.pendingCommand;(0,N.useEffect)(()=>{if(!(typeof d!=`string`||!d)&&(l(d),e)){let n={...t??{}};delete n.pendingCommand,u.getState().updateTab(e,{metadata:n})}},[d,e,l]),(0,N.useEffect)(()=>{let e=e=>{let t=e.detail;t?.command&&G(a.current)&&(l(t.command),window.dispatchEvent(new Event(T)))};return window.addEventListener(w,e),()=>window.removeEventListener(w,e)},[a,l]),(0,N.useEffect)(()=>{if(!n)return;let e=o.current;e&&(o.current=null,r(e),i())},[n,s,r,i])}var q=n(),J=[{label:`Tab`,value:` `},{label:`Esc`,value:`\x1B`},{label:`Ctrl`,value:null},{label:`↑`,value:`\x1B[A`},{label:`↓`,value:`\x1B[B`},{label:`←`,value:`\x1B[D`},{label:`→`,value:`\x1B[C`},{label:`^C`,value:``}],Y=`flex items-center justify-center shrink-0 min-w-11 min-h-11 rounded text-xs bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`;function oe({ctrlMode:e,onToggleCtrl:t,selectMode:n,onToggleSelect:r,onKey:a,onCopy:o,onPaste:s,onSendToChat:c,onOpenLinks:u}){return(0,q.jsxs)(`div`,{className:`relative shrink-0 bg-surface border-t border-border`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:[(0,q.jsx)(`button`,{onClick:r,"aria-label":`Select text`,"aria-pressed":n,className:l(Y,n&&`bg-primary text-primary-foreground`),children:(0,q.jsx)(M,{size:16})}),(0,q.jsx)(`button`,{onClick:o,"aria-label":`Copy`,className:Y,children:(0,q.jsx)(i,{size:16})}),(0,q.jsx)(`button`,{onClick:s,"aria-label":`Paste`,className:Y,children:(0,q.jsx)(b,{size:16})}),(0,q.jsx)(`button`,{onClick:u,"aria-label":`Links`,className:Y,children:(0,q.jsx)(y,{size:16})}),(0,q.jsx)(`button`,{onClick:c,"aria-label":`Send to Chat`,className:Y,children:(0,q.jsx)(S,{size:16})}),(0,q.jsx)(`div`,{className:`w-px h-6 shrink-0 bg-border mx-0.5`}),J.map(n=>(0,q.jsx)(`button`,{onClick:()=>n.value===null?t():a(n.value),className:l(Y,`font-mono`,n.value===null&&e&&`bg-primary text-primary-foreground`),children:n.label},n.label)),(0,q.jsx)(`div`,{className:`w-6 shrink-0`,"aria-hidden":!0})]}),(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-surface to-transparent`,"aria-hidden":!0})]})}var se=new Set([`localhost`,`::1`]);function X(e){let t=e.replace(/^\[|\]$/g,``).toLowerCase();return se.has(t)?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)}function Z(e){let t;try{t=new URL(e)}catch{return null}let n=t.searchParams.get(`redirect_uri`)??t.searchParams.get(`redirectUri`);if(!n)return null;try{let e=new URL(n);return X(e.hostname)?e.port||(e.protocol===`https:`?`443`:`80`):null}catch{return null}}function Q(e){try{let t=new URL(e.trim());return(t.protocol===`http:`||t.protocol===`https:`)&&X(t.hostname)}catch{return!1}}function ce({onDone:e}){let[t,n]=(0,N.useState)(``),[r,i]=(0,N.useState)(!1),c=t.trim(),l=!r&&Q(c),u=async()=>{i(!0);try{await o.post(`/api/loopback/callback`,{url:c}),s.success(`Sent to the waiting command`,{duration:2e3}),n(``),e()}catch(e){s.error(e.message,{duration:4e3})}finally{i(!1)}};return(0,q.jsxs)(`div`,{className:`shrink-0 border-t border-border px-3 py-3`,children:[(0,q.jsx)(`p`,{className:`pb-2 text-[11px] leading-snug text-text-secondary`,children:`Finished signing in and landed on a page that would not load? Paste that address here — the machine will deliver it to the command still waiting.`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),inputMode:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,placeholder:`http://127.0.0.1:54132/oauth/callback?code=…`,"aria-label":`Callback address`,className:`h-11 min-w-0 flex-1 rounded-lg border border-border bg-surface px-3 font-mono text-xs text-foreground placeholder:text-text-subtle`}),(0,q.jsx)(`button`,{onClick:()=>void u(),disabled:!l,"aria-label":`Finish login`,className:`flex size-11 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground disabled:opacity-40 active:opacity-80 transition-opacity`,children:r?(0,q.jsx)(a,{className:`size-4 animate-spin`}):(0,q.jsx)(j,{className:`size-4`})})]}),c!==``&&!Q(c)&&(0,q.jsx)(`p`,{className:`pt-1.5 text-[11px] text-error`,children:`Needs to be the http://127.0.0.1:… address the sign-in redirected to.`})]})}function le({open:e,onClose:t,urls:n}){let r=async e=>{let n=await x(e);s[n?`success`:`error`](n?`Link copied`:`Could not copy link`,{duration:1500}),t()},a=[...new Set(n.map(Z).filter(e=>!!e))];return(0,q.jsxs)(p,{open:e,onClose:t,zIndex:70,className:`flex flex-col max-h-[70vh]`,children:[(0,q.jsx)(`div`,{className:`shrink-0 px-4 pb-2 text-xs font-medium text-text-secondary`,children:n.length>0?`Links in terminal (${n.length})`:`Links in terminal`}),(0,q.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2`,children:n.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-8 text-center text-sm text-text-secondary`,children:[(0,q.jsx)(A,{className:`size-5 text-text-subtle`}),`No links found in the visible scrollback.`]}):n.map(e=>{let n=Z(e);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-stretch gap-1`,children:[(0,q.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,onClick:t,className:`flex min-h-11 flex-1 min-w-0 items-center gap-2 rounded-lg px-3 py-2 text-sm text-foreground active:bg-accent transition-colors`,children:[(0,q.jsx)(g,{className:`size-4 shrink-0 text-text-subtle`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left font-mono text-xs`,children:e})]}),(0,q.jsx)(`button`,{onClick:()=>void r(e),"aria-label":`Copy ${e}`,className:`flex size-11 shrink-0 items-center justify-center rounded-lg text-text-secondary active:bg-accent transition-colors`,children:(0,q.jsx)(i,{className:`size-4`})})]}),n&&(0,q.jsxs)(`p`,{className:`px-3 pb-2 text-[11px] leading-snug text-text-secondary`,children:[`Signing in here sends you back to port `,n,` `,(0,q.jsx)(`strong`,{children:`on the machine`}),`, not this device — so the terminal keeps waiting. Afterwards, paste the address bar below to finish it.`]})]},e)})}),a.length>0&&(0,q.jsx)(ce,{onDone:t})]})}var $=(0,N.memo)(function({metadata:e,tabId:t}){let n=e?.sessionId??`new`,r=e?.projectName,i=e?.cwd,a=(0,N.useRef)(null),{connected:o,reconnecting:c,exited:u,shellReady:d,sendData:f,getSelection:p,getLastCommandOutput:m,getLastCommand:h,getBufferUrls:g,restart:v}=V({sessionId:n,projectName:r,cwd:i,containerRef:a,tabId:t}),[y,b]=(0,N.useState)(!1),[w,T]=(0,N.useState)(!1),[E,D]=(0,N.useState)(!1);U(a,w);let O=(0,N.useCallback)(()=>{(a.current?.querySelector(`.xterm-helper-textarea`))?.focus()},[]);K({tabId:t,metadata:e,shellReady:d,sendData:f,focusTerminal:O,containerRef:a}),(0,N.useEffect)(()=>{let e=a.current;if(!e||w)return;let t=()=>O();return e.addEventListener(`touchend`,t,{capture:!0}),()=>e.removeEventListener(`touchend`,t,{capture:!0})},[O,w]);let k=(0,N.useCallback)(e=>{if(O(),y&&e.length===1){let t=e.toLowerCase().charCodeAt(0)-96;t>=1&&t<=26&&f(String.fromCharCode(t)),b(!1);return}f(e)},[y,f,O]),A=(0,N.useCallback)(async()=>{let e=p(),t=e||m();if(!t.trim()){s(`Nothing to copy`,{duration:1500});return}let n=await x(t);s[n?`success`:`error`](n?e?`Selection copied`:`Last output copied`:`Could not copy`,{duration:1500})},[p,m]),j=(0,N.useCallback)(async()=>{try{let e=await navigator.clipboard.readText();e&&(f(e),O())}catch{s.error(`Clipboard blocked — paste with the keyboard instead`,{duration:2500})}},[f,O]),M=(0,N.useCallback)(()=>{let e=p(),t=e||m();if(!t.trim())return;let n=e?``:h();C({text:"```bash\n"+(n?`${n}\n${t}`:t)+"\n```",label:e?`Terminal selection`:`Terminal output`,projectName:r}),s.success(`Sent to chat`,{duration:1500})},[p,m,h,r]),P=typeof window<`u`&&`ontouchstart`in window;return(0,q.jsxs)(`div`,{className:`flex flex-col h-full min-h-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1 bg-surface border-b border-border text-xs`,children:[(0,q.jsx)(`span`,{className:l(`size-2 rounded-full`,u?`bg-error`:o?`bg-success`:c?`bg-warning`:`bg-error`)}),(0,q.jsx)(`span`,{className:`text-text-secondary`,children:u?`Process exited`:o?`Connected`:c?`Reconnecting...`:`Disconnected`}),u&&(0,q.jsxs)(`button`,{onClick:v,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors`,children:[(0,q.jsx)(_,{size:10}),`Restart`]}),(0,q.jsxs)(`button`,{onClick:M,title:`Send to Chat`,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors ml-auto`,children:[(0,q.jsx)(S,{size:10}),`Chat`]}),(0,q.jsx)(`span`,{className:`text-text-subtle font-mono`,children:n})]}),(0,q.jsx)(`div`,{ref:a,onClick:w?void 0:O,className:l(`flex-1 min-h-0 bg-background p-1`,w&&`touch-none`)}),P&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(oe,{ctrlMode:y,onToggleCtrl:()=>b(!y),selectMode:w,onToggleSelect:()=>T(!w),onKey:k,onCopy:()=>void A(),onPaste:()=>void j(),onSendToChat:M,onOpenLinks:()=>D(!0)}),(0,q.jsx)(le,{open:E,onClose:()=>D(!1),urls:E?g():[]})]})]})});export{$ as TerminalTab};