@hienlh/ppm 0.19.3 → 0.19.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 (81) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/dist/web/assets/accounts-settings-section-CCFQV-RB.js +1 -0
  5. package/dist/web/assets/{ai-resource-editor-BqFT1EUB.js → ai-resource-editor-BTWds-aC.js} +1 -1
  6. package/dist/web/assets/{ai-settings-section-CY6spbEx.js → ai-settings-section-CmoBsSpY.js} +1 -1
  7. package/dist/web/assets/{ai-settings-section-Po3K8j-g.js → ai-settings-section-DjbYj4wK.js} +1 -1
  8. package/dist/web/assets/{appearance-settings-section-L9Z-nej_.js → appearance-settings-section-vLmakLtA.js} +1 -1
  9. package/dist/web/assets/chat-tab-CLRlS8Jc.js +15 -0
  10. package/dist/web/assets/code-editor-CCwVu5F5.js +7 -0
  11. package/dist/web/assets/{conflict-editor-BoRPwL3L.js → conflict-editor-CvWYcbwD.js} +1 -1
  12. package/dist/web/assets/{csv-preview-BpoJqZQi.js → csv-preview-DzuDuyE_.js} +1 -1
  13. package/dist/web/assets/{database-viewer-I-9cER1L.js → database-viewer-D4XGEDHm.js} +1 -1
  14. package/dist/web/assets/{diff-viewer-_xHZsxvr.js → diff-viewer-B5N1X61R.js} +1 -1
  15. package/dist/web/assets/explorer-body-BxLLjthF.js +2 -0
  16. package/dist/web/assets/{explorer-window-content-DD6Z15pm.js → explorer-window-content-CL1Cipj3.js} +1 -1
  17. package/dist/web/assets/{extension-manager-section-Cu9D9Udt.js → extension-manager-section-BpyGq15A.js} +1 -1
  18. package/dist/web/assets/{extension-webview-Diz2OzVq.js → extension-webview-BM8FXhuN.js} +1 -1
  19. package/dist/web/assets/{files-settings-section-B1e7BgKQ.js → files-settings-section-B0_aR1nL.js} +1 -1
  20. package/dist/web/assets/{general-settings-section-DWdHHRDy.js → general-settings-section-C1EJzjhU.js} +1 -1
  21. package/dist/web/assets/{git-log-panel-CMMsvU64.js → git-log-panel-D1yGTUE_.js} +1 -1
  22. package/dist/web/assets/{glide-data-grid-pKQuyYFj.js → glide-data-grid-Cu0STKML.js} +11 -11
  23. package/dist/web/assets/{group-chat-tab-U5u0Loii.js → group-chat-tab-BfcvkRX5.js} +1 -1
  24. package/dist/web/assets/{index--KWVW-Ga.js → index-B1bzKRjJ.js} +4 -4
  25. package/dist/web/assets/index-nP3uxXvR.css +2 -0
  26. package/dist/web/assets/{jira-watcher-section-uA5oyB8s.js → jira-watcher-section-DZh-Z2MK.js} +1 -1
  27. package/dist/web/assets/{keybindings-store-Ccf0etMJ.js → keybindings-store-CFwgcnpZ.js} +1 -1
  28. package/dist/web/assets/{keyboard-shortcuts-section-B7IxJHiI.js → keyboard-shortcuts-section-JBtcJGM3.js} +1 -1
  29. package/dist/web/assets/{markdown-renderer-DDcIGQEd.js → markdown-renderer-Bo8GgGXl.js} +1 -1
  30. package/dist/web/assets/{markdown-renderer-CY1epGRc.js → markdown-renderer-DY60UZNW.js} +1 -1
  31. package/dist/web/assets/{mobile-explorer-sheet-CqkwbCRl.js → mobile-explorer-sheet-C59rPw7Z.js} +1 -1
  32. package/dist/web/assets/{notification-store-BNSYk3E7.js → notification-store-Bd6L0K_Q.js} +1 -1
  33. package/dist/web/assets/{notifications-settings-section-v_628h4B.js → notifications-settings-section-ARQlF-6E.js} +1 -1
  34. package/dist/web/assets/{pdf-preview-CI3q1MnH.js → pdf-preview-CRShdbBS.js} +1 -1
  35. package/dist/web/assets/{postgres-viewer-jaR0FYJ_.js → postgres-viewer-BNT-4yYl.js} +2 -2
  36. package/dist/web/assets/{ppmbot-settings-section-BET4VmKb.js → ppmbot-settings-section-Bq4YAcFW.js} +1 -1
  37. package/dist/web/assets/{process-table-D1r-Gupi.js → process-table-CjiXW0rg.js} +1 -1
  38. package/dist/web/assets/{proxy-settings-section-0DvNh1B-.js → proxy-settings-section-wRbiyQiA.js} +1 -1
  39. package/dist/web/assets/{query-audit-section-BA5rT6Sh.js → query-audit-section-C5RmhRSu.js} +1 -1
  40. package/dist/web/assets/{remote-desktop-mobile-sheet-CPa3XElX.js → remote-desktop-mobile-sheet-BF-75_03.js} +2 -2
  41. package/dist/web/assets/{remote-desktop-mobile-view-De_a4skd.js → remote-desktop-mobile-view-C9KR9I9G.js} +1 -1
  42. package/dist/web/assets/{remote-desktop-readiness-gate-CPrDIv2d.js → remote-desktop-readiness-gate-BnKJicB2.js} +1 -1
  43. package/dist/web/assets/{remote-desktop-window-content-CG1StfCE.js → remote-desktop-window-content-awXsNw_R.js} +1 -1
  44. package/dist/web/assets/{schedules-settings-section-B2f7V7Xr.js → schedules-settings-section-BOecKJzl.js} +1 -1
  45. package/dist/web/assets/{settings-body-omv04jbb.js → settings-body-DGi5DXY6.js} +2 -2
  46. package/dist/web/assets/{settings-tab-NdnBTqyj.js → settings-tab-GM9zTRul.js} +1 -1
  47. package/dist/web/assets/{settings-window-content-Chou1JGa.js → settings-window-content-Dvhxo4_H.js} +1 -1
  48. package/dist/web/assets/{sql-query-editor-Dk9y3jqy.js → sql-query-editor-BmkGFzcL.js} +1 -1
  49. package/dist/web/assets/{sqlite-viewer-4xFhkLYy.js → sqlite-viewer-DbziVQXQ.js} +1 -1
  50. package/dist/web/assets/{system-monitor-body-B_1iMVOI.js → system-monitor-body-CbHW5aYm.js} +2 -2
  51. package/dist/web/assets/{system-monitor-tab-B2j9mWBW.js → system-monitor-tab-C7EZLMIo.js} +1 -1
  52. package/dist/web/assets/{system-monitor-window-content-BOjq53uU.js → system-monitor-window-content-C_w4w81e.js} +1 -1
  53. package/dist/web/assets/{tab-host-window-content-CW_dlYlW.js → tab-host-window-content-BSP1SEXS.js} +1 -1
  54. package/dist/web/assets/{team-member-sheet-CkR4qO7V.js → team-member-sheet-C9N0iA1-.js} +2 -2
  55. package/dist/web/assets/{team-member-window-content-CmF5ia3n.js → team-member-window-content-CM2QFv-s.js} +1 -1
  56. package/dist/web/assets/{terminal-tab-HXZkicIc.js → terminal-tab-jWYELm8y.js} +2 -2
  57. package/dist/web/assets/{tool-cards-jA1BTLZj.js → tool-cards-jefdOWVJ.js} +4 -4
  58. package/dist/web/assets/use-accounts-data-MhMl0Y4Z.js +1 -0
  59. package/dist/web/assets/{use-monaco-theme-BcQqKVbE.js → use-monaco-theme-BbAd7DXr.js} +1 -1
  60. package/dist/web/assets/{use-remote-desktop-display-choice-DY5BWRTo.js → use-remote-desktop-display-choice-DlfMIWq3.js} +1 -1
  61. package/dist/web/assets/{use-websocket-DetaY8OI.js → use-websocket-Bq8X_SUI.js} +1 -1
  62. package/dist/web/assets/{video-preview-C0uH2228.js → video-preview-BGh3B0Lu.js} +1 -1
  63. package/dist/web/index.html +2 -2
  64. package/dist/web/sw.js +1 -1
  65. package/package.json +1 -1
  66. package/src/services/proxy-agent-anthropic-bridge.ts +93 -0
  67. package/src/services/proxy-agent-bridge.ts +100 -0
  68. package/src/services/proxy-agent-turn.ts +161 -0
  69. package/src/services/proxy-anthropic-format.ts +157 -0
  70. package/src/services/proxy-openai-format.ts +148 -0
  71. package/src/web/components/chat/usage-badge.tsx +41 -4
  72. package/src/web/components/settings/accounts/account-card.tsx +27 -3
  73. package/src/web/components/settings/accounts/accounts-pane-header.tsx +22 -2
  74. package/src/web/components/settings/accounts/claude-accounts-section.tsx +4 -3
  75. package/src/web/components/settings/accounts/codex-accounts-section.tsx +11 -4
  76. package/dist/web/assets/accounts-settings-section-LtSVxNNp.js +0 -1
  77. package/dist/web/assets/chat-tab-BIO-VhWT.js +0 -15
  78. package/dist/web/assets/code-editor-B9lVjElM.js +0 -7
  79. package/dist/web/assets/explorer-body-DapwsOnp.js +0 -2
  80. package/dist/web/assets/index-CvGx7wBQ.css +0 -2
  81. package/dist/web/assets/use-accounts-data-BI_5qNvr.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-desktop-mobile-view-De_a4skd.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index--KWVW-Ga.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.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-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-CvGx7wBQ.css","assets/use-remote-desktop-display-choice-DY5BWRTo.js","assets/hand-x0ejq3fS.js","assets/keyboard-DiOYrs6C.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{ft as r}from"./vendor-ui-CaeeFO0B.js";import"./api-client-oY1tC3tM.js";import{q as i}from"./vendor-mermaid-BKWscKt0.js";import"./settings-store-Brjd0QnO.js";import{n as a}from"./portal-container-context-a399Hd9F.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import{y as o}from"./index--KWVW-Ga.js";import"./run-in-terminal-bKRwuO2z.js";import{n as s,t as c}from"./remote-desktop-readiness-gate-CPrDIv2d.js";var l=e(t(),1),u=e(r(),1),d=n(),f=(0,l.lazy)(()=>i(()=>import(`./remote-desktop-mobile-view-De_a4skd.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])));function p(){let e=o(e=>e.isOpen),t=o(e=>e.close),n=a();return e?(0,u.createPortal)((0,d.jsx)(`div`,{className:`fixed inset-0 z-[45] bg-black`,"data-testid":`remote-desktop-mobile-sheet`,children:(0,d.jsx)(s,{onCancel:t,children:(0,d.jsx)(c,{onCancel:t,children:(0,d.jsx)(l.Suspense,{fallback:(0,d.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-text-2`,children:`Loading…`}),children:(0,d.jsx)(f,{onClose:t})})})})}),n??document.getElementById(`root`)??document.body):null}export{p as RemoteDesktopMobileSheet};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-desktop-mobile-view-C9KR9I9G.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-B1bzKRjJ.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.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-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-nP3uxXvR.css","assets/use-remote-desktop-display-choice-DlfMIWq3.js","assets/hand-x0ejq3fS.js","assets/keyboard-DiOYrs6C.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{ft as r}from"./vendor-ui-CaeeFO0B.js";import"./api-client-oY1tC3tM.js";import{q as i}from"./vendor-mermaid-BKWscKt0.js";import"./settings-store-Brjd0QnO.js";import{n as a}from"./portal-container-context-a399Hd9F.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import{y as o}from"./index-B1bzKRjJ.js";import"./run-in-terminal-bKRwuO2z.js";import{n as s,t as c}from"./remote-desktop-readiness-gate-BnKJicB2.js";var l=e(t(),1),u=e(r(),1),d=n(),f=(0,l.lazy)(()=>i(()=>import(`./remote-desktop-mobile-view-C9KR9I9G.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])));function p(){let e=o(e=>e.isOpen),t=o(e=>e.close),n=a();return e?(0,u.createPortal)((0,d.jsx)(`div`,{className:`fixed inset-0 z-[45] bg-black`,"data-testid":`remote-desktop-mobile-sheet`,children:(0,d.jsx)(s,{onCancel:t,children:(0,d.jsx)(c,{onCancel:t,children:(0,d.jsx)(l.Suspense,{fallback:(0,d.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-text-2`,children:`Loading…`}),children:(0,d.jsx)(f,{onClose:t})})})})}),n??document.getElementById(`root`)??document.body):null}export{p as RemoteDesktopMobileSheet};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{S as t,x as n}from"./vendor-markdown-Ls5AcU91.js";import"./vendor-ui-CaeeFO0B.js";import{t as r}from"./createLucideIcon-D8pyde1A.js";import{a as i,c as a,i as o,n as s,o as c,s as l,t as u}from"./use-remote-desktop-display-choice-DY5BWRTo.js";import{t as d}from"./hand-x0ejq3fS.js";import{t as f}from"./keyboard-DiOYrs6C.js";import{t as p}from"./monitor-C835ucWH.js";import{t as m}from"./x-YDu4m2Iq.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as h}from"./settings-store-Brjd0QnO.js";import{n as g}from"./utils-C9OjCrou.js";import{t as _}from"./use-visual-viewport-rnvuooQZ.js";import"./ws-auth-Dawx17PM.js";import{Dn as v,Wn as y}from"./index--KWVW-Ga.js";var b=r(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),x=e(t(),1);function S(e,t,n=10,r=300){let i=Math.hypot(t.x-e.x,t.y-e.y),a=t.t-e.t;return i<=n&&a<=r}function C(e,t,n=15){return Math.abs(t-e)>n?`pinch`:`scroll`}function w(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function T(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function E(e,t,n){return Math.min(Math.max(e,t),n)}function D(e,t,n){return[{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!0},{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!1}]}function O(e,t,n){return{start:{x:e,y:t,t:performance.now()},last:{x:e,y:t},moved:!1,rect:n}}function k(e,t,n,r,i,a){let s=Math.hypot(t-e.start.x,n-e.start.y);if(r===`touch`){if(!e.moved&&s>10){e.moved=!0;let r=o(e.start.x,e.start.y,e.rect,i);return e.last={x:t,y:n},{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!0}}}if(e.last={x:t,y:n},!e.moved)return{};let r=o(t,n,e.rect,i);return{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:null,down:null}}}let c=(t-e.last.x)/i.scale,l=(n-e.last.y)/i.scale;return s>10&&(e.moved=!0),e.last={x:t,y:n},{cursor:{xFrac:E(a.xFrac+c/e.rect.width,0,1),yFrac:E(a.yFrac+l/e.rect.height,0,1)},sendCursorMove:!0}}function A(e,t,n,r,i,a){let s={x:t,y:n,t:performance.now()},c=S(e.start,s,10,300);if(r===`touch`){let r=o(t,n,e.rect,i);return!e.moved&&c?D(r.xFrac,r.yFrac,`left`):e.moved?[{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!1}]:[]}return!e.moved&&c?D(a.xFrac,a.yFrac,`left`):[]}function j(e,t,n){let r=T(e,t);return{startDistance:w(e,t),startMid:r,lastMid:r,startScale:n,startTime:performance.now(),gesture:null}}function M(e,t,n,r){let i=w(t,n),a=T(t,n);if(e.gesture===null){let t=Math.abs(i-e.startDistance),n=w(e.startMid,a);if(t>15)e.gesture=C(e.startDistance,i,15);else if(n>15)e.gesture=`scroll`;else return e.lastMid=a,{}}let o;if(e.gesture===`pinch`)o={transform:{scale:E(e.startScale*(i/e.startDistance),1,4),panX:r.panX,panY:r.panY}};else if(r.scale>1.01){let t=a.x-e.lastMid.x,n=a.y-e.lastMid.y;o={transform:{scale:r.scale,panX:r.panX+t,panY:r.panY+n}}}else o={wheelDeltaPx:a.y-e.lastMid.y};return e.lastMid=a,o}function N(e,t,n){if(e.gesture===null&&performance.now()-e.startTime<=300){let r=o(e.lastMid.x,e.lastMid.y,t,n);return D(r.xFrac,r.yFrac,`right`)}return[]}var P={scale:1,panX:0,panY:0},F=40,I=120;function L({containerRef:e,canvasRef:t,mode:n,sendMessage:r,enabled:a}){let[o,s]=(0,x.useState)(P),[c,l]=(0,x.useState)({xFrac:.5,yFrac:.5}),u=(0,x.useRef)(o),d=(0,x.useRef)(c),f=(0,x.useRef)(n);f.current=n;let p=(0,x.useRef)({transform:null,cursor:null,sendCursorMove:!1,wheelPx:0}),m=(0,x.useRef)(0),h=(0,x.useCallback)(()=>{m.current=0;let e=p.current;e.transform&&=(u.current=e.transform,s(e.transform),null),e.cursor&&(d.current=e.cursor,l(e.cursor),e.sendCursorMove&&r({type:`pointer`,xFrac:e.cursor.xFrac,yFrac:e.cursor.yFrac,button:null,down:null}),e.cursor=null,e.sendCursorMove=!1),e.wheelPx!==0&&(r({type:`wheel`,dy:-(e.wheelPx/F)*I}),e.wheelPx=0)},[r]),g=(0,x.useCallback)(()=>{m.current||=requestAnimationFrame(h)},[h]),_=(0,x.useCallback)(()=>{u.current=P,s(P)},[]);return(0,x.useEffect)(()=>{let n=e.current;if(!n||!a)return;let o=null,s=null,c=e=>e.forEach(r),l=()=>{let e=n.getBoundingClientRect(),r=t.current;return!r||!r.width||!r.height?e:i(e,r.width,r.height)},h=e=>{e.preventDefault(),e.stopPropagation();let t=l();if(e.touches.length===1){s=null;let n=e.touches[0];o=O(n.clientX,n.clientY,t)}else if(e.touches.length===2){o=null;let[t,n]=[e.touches[0],e.touches[1]];s=j({x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},u.current.scale)}else o=null,s=null},_=e=>{if(e.preventDefault(),e.stopPropagation(),o&&e.touches.length===1){let t=e.touches[0],n=k(o,t.clientX,t.clientY,f.current,u.current,d.current);n.message&&r(n.message),n.cursor&&(d.current=n.cursor,p.current.cursor=n.cursor,p.current.sendCursorMove=!!n.sendCursorMove,g());return}if(s&&e.touches.length===2){let[t,n]=[e.touches[0],e.touches[1]],r=M(s,{x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},u.current);r.transform&&(u.current=r.transform,p.current.transform=r.transform,g()),r.wheelDeltaPx&&(p.current.wheelPx+=r.wheelDeltaPx,g())}},v=e=>{e.preventDefault(),e.stopPropagation();let t=e.changedTouches[0];if(o){let e=t?t.clientX:o.last.x,n=t?t.clientY:o.last.y;c(A(o,e,n,f.current,u.current,d.current)),o=null}s&&=(c(N(s,l(),u.current)),null)},y=e=>{e.stopPropagation(),o?.moved&&f.current===`touch`&&c(A(o,o.last.x,o.last.y,`touch`,u.current,d.current)),o=null,s=null};return n.addEventListener(`touchstart`,h,{passive:!1}),n.addEventListener(`touchmove`,_,{passive:!1}),n.addEventListener(`touchend`,v,{passive:!1}),n.addEventListener(`touchcancel`,y,{passive:!1}),()=>{m.current&&cancelAnimationFrame(m.current),n.removeEventListener(`touchstart`,h),n.removeEventListener(`touchmove`,_),n.removeEventListener(`touchend`,v),n.removeEventListener(`touchcancel`,y)}},[e,t,a,r,g]),{transform:o,virtualCursor:n===`mouse`?c:null,resetZoom:_}}function R(e,t,n){let r=e=>{n({type:`key`,code:e,down:!0}),n({type:`key`,code:e,down:!1})};switch(e){case`insertText`:return t&&n({type:`text`,text:t}),!0;case`insertLineBreak`:case`insertParagraph`:return r(`Enter`),!0;case`deleteContentBackward`:return r(`Backspace`),!0;case`deleteContentForward`:return r(`Delete`),!0;default:return!1}}function z(e,t){let n=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let r=n.current;if(!r||!t)return;let i=()=>e({type:`releaseAll`}),a=e=>e.code!==``&&e.key!==`Unidentified`,o=t=>{a(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!0}))},s=t=>{a(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!1}))},c=t=>{R(t.inputType,t.data,e)&&t.preventDefault()},l=t=>{t.data&&e({type:`text`,text:t.data}),r.value=``},u=()=>i(),d=()=>{document.hidden&&i()};return r.addEventListener(`keydown`,o),r.addEventListener(`keyup`,s),r.addEventListener(`beforeinput`,c),r.addEventListener(`compositionend`,l),r.addEventListener(`blur`,u),document.addEventListener(`visibilitychange`,d),()=>{r.removeEventListener(`keydown`,o),r.removeEventListener(`keyup`,s),r.removeEventListener(`beforeinput`,c),r.removeEventListener(`compositionend`,l),r.removeEventListener(`blur`,u),document.removeEventListener(`visibilitychange`,d),i()}},[t,e]),{inputRef:n,show:(0,x.useCallback)(()=>n.current?.focus(),[])}}var B=n();function V({onClick:e,label:t,active:n,children:r}){return(0,B.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":t,className:g(`flex min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-0.5 rounded-lg py-1.5 text-[10px]`,`text-white/80 active:bg-white/10 transition-colors`,n&&`bg-white/15 text-white`),children:[r,(0,B.jsx)(`span`,{children:t})]})}function H({displayLabel:e,onNextDisplay:t,mode:n,onToggleMode:r,onOpenKeyboard:i,onResetZoom:o,onClose:s}){let c=h(e=>e.remoteDesktopStatsVisible),l=h(e=>e.toggleRemoteDesktopStatsVisible);return(0,B.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-1 border-t border-white/10 bg-black/90 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5`,"data-testid":`remote-desktop-mobile-toolbar`,children:[(0,B.jsx)(V,{onClick:r,label:n===`mouse`?`Mouse`:`Touch`,active:!0,children:n===`mouse`?(0,B.jsx)(b,{className:`size-5`}):(0,B.jsx)(d,{className:`size-5`})}),(0,B.jsx)(V,{onClick:i,label:`Keyboard`,children:(0,B.jsx)(f,{className:`size-5`})}),(0,B.jsx)(V,{onClick:o,label:`Reset zoom`,children:(0,B.jsx)(v,{className:`size-5`})}),e!==null&&(0,B.jsx)(V,{onClick:t,label:e.length>10?`${e.slice(0,9)}…`:e,children:(0,B.jsx)(p,{className:`size-5`})}),(0,B.jsx)(V,{onClick:l,label:`Stats`,active:c,children:(0,B.jsx)(a,{className:`size-5`})}),(0,B.jsx)(V,{onClick:s,label:`Close`,children:(0,B.jsx)(m,{className:`size-5`})})]})}var U=[{label:`Ctrl`,code:`ControlLeft`},{label:`Alt`,code:`AltLeft`},{label:`Shift`,code:`ShiftLeft`},{label:`Win`,code:`MetaLeft`}],W=[{label:`Esc`,code:`Escape`},{label:`Tab`,code:`Tab`},{label:`←`,code:`ArrowLeft`},{label:`↑`,code:`ArrowUp`},{label:`↓`,code:`ArrowDown`},{label:`→`,code:`ArrowRight`}],G=[{label:`Ctrl+C`,codes:[`ControlLeft`,`KeyC`]},{label:`Ctrl+V`,codes:[`ControlLeft`,`KeyV`]},{label:`Ctrl+Z`,codes:[`ControlLeft`,`KeyZ`]},{label:`Ctrl+A`,codes:[`ControlLeft`,`KeyA`]},{label:`Alt+Tab`,codes:[`AltLeft`,`Tab`]},{label:`Ctrl+Alt+Del`,codes:[`ControlLeft`,`AltLeft`,`Delete`]}];function K({onClick:e,active:t,className:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,onClick:e,className:g(`min-h-11 min-w-11 shrink-0 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-white/80`,`active:bg-white/15 transition-colors`,t&&`bg-primary text-primary-foreground`,n),children:r})}function q({sendMessage:e}){let[t,n]=(0,x.useState)(new Set),r=(0,x.useRef)(t);r.current=t,(0,x.useEffect)(()=>()=>{r.current.forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);let i=(0,x.useCallback)(t=>{n(n=>{let r=n.has(t);e({type:`key`,code:t,down:!r});let i=new Set(n);return r?i.delete(t):i.add(t),i})},[e]),a=(0,x.useCallback)(t=>{e({type:`key`,code:t,down:!0}),e({type:`key`,code:t,down:!1})},[e]),o=(0,x.useCallback)(t=>{t.forEach(t=>e({type:`key`,code:t,down:!0})),[...t].reverse().forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);return(0,B.jsxs)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-t border-white/10 bg-black/90 px-2 py-1.5`,"data-testid":`remote-desktop-mobile-key-bar`,children:[U.map(e=>(0,B.jsx)(K,{onClick:()=>i(e.code),active:t.has(e.code),children:e.label},e.code)),(0,B.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),W.map(e=>(0,B.jsx)(K,{onClick:()=>a(e.code),children:e.label},e.code)),(0,B.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),G.map(e=>(0,B.jsx)(K,{onClick:()=>o(e.codes),children:e.label},e.label))]})}function J({onClose:e}){let t=(0,x.useRef)(null),n=(0,x.useRef)(null),[r,a]=(0,x.useState)(`mouse`),[o,d]=(0,x.useState)(!1),f=u(),{connState:p,errorMessage:m,decoderStatus:h,decoderErrorMessage:g,sendMessage:v,reconnect:b,getTotalBytes:S,getFrameCount:C}=c(n,{displayId:f.displayId}),w=p===`streaming`,{transform:T,virtualCursor:E,resetZoom:D}=L({containerRef:t,canvasRef:n,mode:r,sendMessage:v,enabled:w}),{inputRef:O,show:k}=z(v,w),A=_(!0)?.keyboardInset??0,j=(0,x.useCallback)(()=>a(e=>e===`mouse`?`touch`:`mouse`),[]),M=(0,x.useCallback)(()=>{k(),d(!0)},[k]),N=h===`unsupported`?g:p===`error`?m:p===`closed`?`Disconnected`:p===`connecting`?`Connecting…`:null,P={transform:`translate(${T.panX}px, ${T.panY}px) scale(${T.scale})`},F=`${(E?.xFrac??.5)*100}%`,I=`${(E?.yFrac??.5)*100}%`;if(E&&t.current&&n.current?.width&&n.current.height){let e=t.current.getBoundingClientRect(),r=i({left:0,top:0,width:e.width,height:e.height},n.current.width,n.current.height);F=`${r.left+E.xFrac*r.width}px`,I=`${r.top+E.yFrac*r.height}px`}return(0,B.jsxs)(`div`,{className:`relative h-full w-full bg-black`,"data-testid":`remote-desktop-mobile-view`,"data-conn-state":p,children:[(0,B.jsxs)(`div`,{ref:t,className:`absolute inset-x-0 top-0 flex items-center justify-center overflow-hidden`,style:{touchAction:`none`,bottom:A},"data-testid":`remote-desktop-mobile-stage-container`,children:[(0,B.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center`,style:P,children:[(0,B.jsx)(`canvas`,{ref:n,"data-testid":`remote-desktop-canvas`,className:`block h-full w-full min-h-0 min-w-0 object-contain outline-none`}),r===`mouse`&&E&&w&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute rounded-full border-2 border-white bg-primary shadow-[0_0_0_1px_rgba(0,0,0,0.6)]`,style:{left:F,top:I,width:14,height:14,transform:`translate(-50%, -50%) scale(${1/T.scale})`},"data-testid":`remote-desktop-virtual-cursor`})]}),N&&(0,B.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,B.jsx)(l,{className:`size-6 opacity-70`}),(0,B.jsx)(`span`,{className:`max-w-sm px-4 text-center`,children:N}),(p===`error`||p===`closed`)&&h!==`unsupported`&&(0,B.jsxs)(`button`,{onClick:b,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,B.jsx)(y,{className:`size-3.5`}),` Reconnect`]})]}),(0,B.jsx)(`input`,{ref:O,type:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:`absolute size-px opacity-0`,"aria-hidden":`true`,tabIndex:-1,onBlur:()=>d(!1),"data-testid":`remote-desktop-virtual-keyboard-input`})]}),(0,B.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0`,style:A>0?{transform:`translateY(-${A}px)`}:void 0,"data-testid":`remote-desktop-mobile-bottom-bar`,children:[o&&(0,B.jsx)(q,{sendMessage:v}),(0,B.jsx)(H,{displayLabel:f.displays.length>1?f.current?.label??null:null,onNextDisplay:f.next,mode:r,onToggleMode:j,onOpenKeyboard:M,onResetZoom:D,onClose:e})]}),(0,B.jsx)(s,{canvasRef:n,getFrameCount:C,getTotalBytes:S,positionClassName:`left-1 top-[calc(env(safe-area-inset-top,0px)+2.75rem)]`})]})}export{J 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"./createLucideIcon-D8pyde1A.js";import{a as i,c as a,i as o,n as s,o as c,s as l,t as u}from"./use-remote-desktop-display-choice-DlfMIWq3.js";import{t as d}from"./hand-x0ejq3fS.js";import{t as f}from"./keyboard-DiOYrs6C.js";import{t as p}from"./monitor-C835ucWH.js";import{t as m}from"./x-YDu4m2Iq.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as h}from"./settings-store-Brjd0QnO.js";import{n as g}from"./utils-C9OjCrou.js";import{t as _}from"./use-visual-viewport-rnvuooQZ.js";import"./ws-auth-Dawx17PM.js";import{Dn as v,Wn as y}from"./index-B1bzKRjJ.js";var b=r(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),x=e(t(),1);function S(e,t,n=10,r=300){let i=Math.hypot(t.x-e.x,t.y-e.y),a=t.t-e.t;return i<=n&&a<=r}function C(e,t,n=15){return Math.abs(t-e)>n?`pinch`:`scroll`}function w(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function T(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function E(e,t,n){return Math.min(Math.max(e,t),n)}function D(e,t,n){return[{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!0},{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!1}]}function O(e,t,n){return{start:{x:e,y:t,t:performance.now()},last:{x:e,y:t},moved:!1,rect:n}}function k(e,t,n,r,i,a){let s=Math.hypot(t-e.start.x,n-e.start.y);if(r===`touch`){if(!e.moved&&s>10){e.moved=!0;let r=o(e.start.x,e.start.y,e.rect,i);return e.last={x:t,y:n},{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!0}}}if(e.last={x:t,y:n},!e.moved)return{};let r=o(t,n,e.rect,i);return{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:null,down:null}}}let c=(t-e.last.x)/i.scale,l=(n-e.last.y)/i.scale;return s>10&&(e.moved=!0),e.last={x:t,y:n},{cursor:{xFrac:E(a.xFrac+c/e.rect.width,0,1),yFrac:E(a.yFrac+l/e.rect.height,0,1)},sendCursorMove:!0}}function A(e,t,n,r,i,a){let s={x:t,y:n,t:performance.now()},c=S(e.start,s,10,300);if(r===`touch`){let r=o(t,n,e.rect,i);return!e.moved&&c?D(r.xFrac,r.yFrac,`left`):e.moved?[{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!1}]:[]}return!e.moved&&c?D(a.xFrac,a.yFrac,`left`):[]}function j(e,t,n){let r=T(e,t);return{startDistance:w(e,t),startMid:r,lastMid:r,startScale:n,startTime:performance.now(),gesture:null}}function M(e,t,n,r){let i=w(t,n),a=T(t,n);if(e.gesture===null){let t=Math.abs(i-e.startDistance),n=w(e.startMid,a);if(t>15)e.gesture=C(e.startDistance,i,15);else if(n>15)e.gesture=`scroll`;else return e.lastMid=a,{}}let o;if(e.gesture===`pinch`)o={transform:{scale:E(e.startScale*(i/e.startDistance),1,4),panX:r.panX,panY:r.panY}};else if(r.scale>1.01){let t=a.x-e.lastMid.x,n=a.y-e.lastMid.y;o={transform:{scale:r.scale,panX:r.panX+t,panY:r.panY+n}}}else o={wheelDeltaPx:a.y-e.lastMid.y};return e.lastMid=a,o}function N(e,t,n){if(e.gesture===null&&performance.now()-e.startTime<=300){let r=o(e.lastMid.x,e.lastMid.y,t,n);return D(r.xFrac,r.yFrac,`right`)}return[]}var P={scale:1,panX:0,panY:0},F=40,I=120;function L({containerRef:e,canvasRef:t,mode:n,sendMessage:r,enabled:a}){let[o,s]=(0,x.useState)(P),[c,l]=(0,x.useState)({xFrac:.5,yFrac:.5}),u=(0,x.useRef)(o),d=(0,x.useRef)(c),f=(0,x.useRef)(n);f.current=n;let p=(0,x.useRef)({transform:null,cursor:null,sendCursorMove:!1,wheelPx:0}),m=(0,x.useRef)(0),h=(0,x.useCallback)(()=>{m.current=0;let e=p.current;e.transform&&=(u.current=e.transform,s(e.transform),null),e.cursor&&(d.current=e.cursor,l(e.cursor),e.sendCursorMove&&r({type:`pointer`,xFrac:e.cursor.xFrac,yFrac:e.cursor.yFrac,button:null,down:null}),e.cursor=null,e.sendCursorMove=!1),e.wheelPx!==0&&(r({type:`wheel`,dy:-(e.wheelPx/F)*I}),e.wheelPx=0)},[r]),g=(0,x.useCallback)(()=>{m.current||=requestAnimationFrame(h)},[h]),_=(0,x.useCallback)(()=>{u.current=P,s(P)},[]);return(0,x.useEffect)(()=>{let n=e.current;if(!n||!a)return;let o=null,s=null,c=e=>e.forEach(r),l=()=>{let e=n.getBoundingClientRect(),r=t.current;return!r||!r.width||!r.height?e:i(e,r.width,r.height)},h=e=>{e.preventDefault(),e.stopPropagation();let t=l();if(e.touches.length===1){s=null;let n=e.touches[0];o=O(n.clientX,n.clientY,t)}else if(e.touches.length===2){o=null;let[t,n]=[e.touches[0],e.touches[1]];s=j({x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},u.current.scale)}else o=null,s=null},_=e=>{if(e.preventDefault(),e.stopPropagation(),o&&e.touches.length===1){let t=e.touches[0],n=k(o,t.clientX,t.clientY,f.current,u.current,d.current);n.message&&r(n.message),n.cursor&&(d.current=n.cursor,p.current.cursor=n.cursor,p.current.sendCursorMove=!!n.sendCursorMove,g());return}if(s&&e.touches.length===2){let[t,n]=[e.touches[0],e.touches[1]],r=M(s,{x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},u.current);r.transform&&(u.current=r.transform,p.current.transform=r.transform,g()),r.wheelDeltaPx&&(p.current.wheelPx+=r.wheelDeltaPx,g())}},v=e=>{e.preventDefault(),e.stopPropagation();let t=e.changedTouches[0];if(o){let e=t?t.clientX:o.last.x,n=t?t.clientY:o.last.y;c(A(o,e,n,f.current,u.current,d.current)),o=null}s&&=(c(N(s,l(),u.current)),null)},y=e=>{e.stopPropagation(),o?.moved&&f.current===`touch`&&c(A(o,o.last.x,o.last.y,`touch`,u.current,d.current)),o=null,s=null};return n.addEventListener(`touchstart`,h,{passive:!1}),n.addEventListener(`touchmove`,_,{passive:!1}),n.addEventListener(`touchend`,v,{passive:!1}),n.addEventListener(`touchcancel`,y,{passive:!1}),()=>{m.current&&cancelAnimationFrame(m.current),n.removeEventListener(`touchstart`,h),n.removeEventListener(`touchmove`,_),n.removeEventListener(`touchend`,v),n.removeEventListener(`touchcancel`,y)}},[e,t,a,r,g]),{transform:o,virtualCursor:n===`mouse`?c:null,resetZoom:_}}function R(e,t,n){let r=e=>{n({type:`key`,code:e,down:!0}),n({type:`key`,code:e,down:!1})};switch(e){case`insertText`:return t&&n({type:`text`,text:t}),!0;case`insertLineBreak`:case`insertParagraph`:return r(`Enter`),!0;case`deleteContentBackward`:return r(`Backspace`),!0;case`deleteContentForward`:return r(`Delete`),!0;default:return!1}}function z(e,t){let n=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let r=n.current;if(!r||!t)return;let i=()=>e({type:`releaseAll`}),a=e=>e.code!==``&&e.key!==`Unidentified`,o=t=>{a(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!0}))},s=t=>{a(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!1}))},c=t=>{R(t.inputType,t.data,e)&&t.preventDefault()},l=t=>{t.data&&e({type:`text`,text:t.data}),r.value=``},u=()=>i(),d=()=>{document.hidden&&i()};return r.addEventListener(`keydown`,o),r.addEventListener(`keyup`,s),r.addEventListener(`beforeinput`,c),r.addEventListener(`compositionend`,l),r.addEventListener(`blur`,u),document.addEventListener(`visibilitychange`,d),()=>{r.removeEventListener(`keydown`,o),r.removeEventListener(`keyup`,s),r.removeEventListener(`beforeinput`,c),r.removeEventListener(`compositionend`,l),r.removeEventListener(`blur`,u),document.removeEventListener(`visibilitychange`,d),i()}},[t,e]),{inputRef:n,show:(0,x.useCallback)(()=>n.current?.focus(),[])}}var B=n();function V({onClick:e,label:t,active:n,children:r}){return(0,B.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":t,className:g(`flex min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-0.5 rounded-lg py-1.5 text-[10px]`,`text-white/80 active:bg-white/10 transition-colors`,n&&`bg-white/15 text-white`),children:[r,(0,B.jsx)(`span`,{children:t})]})}function H({displayLabel:e,onNextDisplay:t,mode:n,onToggleMode:r,onOpenKeyboard:i,onResetZoom:o,onClose:s}){let c=h(e=>e.remoteDesktopStatsVisible),l=h(e=>e.toggleRemoteDesktopStatsVisible);return(0,B.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-1 border-t border-white/10 bg-black/90 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5`,"data-testid":`remote-desktop-mobile-toolbar`,children:[(0,B.jsx)(V,{onClick:r,label:n===`mouse`?`Mouse`:`Touch`,active:!0,children:n===`mouse`?(0,B.jsx)(b,{className:`size-5`}):(0,B.jsx)(d,{className:`size-5`})}),(0,B.jsx)(V,{onClick:i,label:`Keyboard`,children:(0,B.jsx)(f,{className:`size-5`})}),(0,B.jsx)(V,{onClick:o,label:`Reset zoom`,children:(0,B.jsx)(v,{className:`size-5`})}),e!==null&&(0,B.jsx)(V,{onClick:t,label:e.length>10?`${e.slice(0,9)}…`:e,children:(0,B.jsx)(p,{className:`size-5`})}),(0,B.jsx)(V,{onClick:l,label:`Stats`,active:c,children:(0,B.jsx)(a,{className:`size-5`})}),(0,B.jsx)(V,{onClick:s,label:`Close`,children:(0,B.jsx)(m,{className:`size-5`})})]})}var U=[{label:`Ctrl`,code:`ControlLeft`},{label:`Alt`,code:`AltLeft`},{label:`Shift`,code:`ShiftLeft`},{label:`Win`,code:`MetaLeft`}],W=[{label:`Esc`,code:`Escape`},{label:`Tab`,code:`Tab`},{label:`←`,code:`ArrowLeft`},{label:`↑`,code:`ArrowUp`},{label:`↓`,code:`ArrowDown`},{label:`→`,code:`ArrowRight`}],G=[{label:`Ctrl+C`,codes:[`ControlLeft`,`KeyC`]},{label:`Ctrl+V`,codes:[`ControlLeft`,`KeyV`]},{label:`Ctrl+Z`,codes:[`ControlLeft`,`KeyZ`]},{label:`Ctrl+A`,codes:[`ControlLeft`,`KeyA`]},{label:`Alt+Tab`,codes:[`AltLeft`,`Tab`]},{label:`Ctrl+Alt+Del`,codes:[`ControlLeft`,`AltLeft`,`Delete`]}];function K({onClick:e,active:t,className:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,onClick:e,className:g(`min-h-11 min-w-11 shrink-0 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-white/80`,`active:bg-white/15 transition-colors`,t&&`bg-primary text-primary-foreground`,n),children:r})}function q({sendMessage:e}){let[t,n]=(0,x.useState)(new Set),r=(0,x.useRef)(t);r.current=t,(0,x.useEffect)(()=>()=>{r.current.forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);let i=(0,x.useCallback)(t=>{n(n=>{let r=n.has(t);e({type:`key`,code:t,down:!r});let i=new Set(n);return r?i.delete(t):i.add(t),i})},[e]),a=(0,x.useCallback)(t=>{e({type:`key`,code:t,down:!0}),e({type:`key`,code:t,down:!1})},[e]),o=(0,x.useCallback)(t=>{t.forEach(t=>e({type:`key`,code:t,down:!0})),[...t].reverse().forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);return(0,B.jsxs)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-t border-white/10 bg-black/90 px-2 py-1.5`,"data-testid":`remote-desktop-mobile-key-bar`,children:[U.map(e=>(0,B.jsx)(K,{onClick:()=>i(e.code),active:t.has(e.code),children:e.label},e.code)),(0,B.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),W.map(e=>(0,B.jsx)(K,{onClick:()=>a(e.code),children:e.label},e.code)),(0,B.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),G.map(e=>(0,B.jsx)(K,{onClick:()=>o(e.codes),children:e.label},e.label))]})}function J({onClose:e}){let t=(0,x.useRef)(null),n=(0,x.useRef)(null),[r,a]=(0,x.useState)(`mouse`),[o,d]=(0,x.useState)(!1),f=u(),{connState:p,errorMessage:m,decoderStatus:h,decoderErrorMessage:g,sendMessage:v,reconnect:b,getTotalBytes:S,getFrameCount:C}=c(n,{displayId:f.displayId}),w=p===`streaming`,{transform:T,virtualCursor:E,resetZoom:D}=L({containerRef:t,canvasRef:n,mode:r,sendMessage:v,enabled:w}),{inputRef:O,show:k}=z(v,w),A=_(!0)?.keyboardInset??0,j=(0,x.useCallback)(()=>a(e=>e===`mouse`?`touch`:`mouse`),[]),M=(0,x.useCallback)(()=>{k(),d(!0)},[k]),N=h===`unsupported`?g:p===`error`?m:p===`closed`?`Disconnected`:p===`connecting`?`Connecting…`:null,P={transform:`translate(${T.panX}px, ${T.panY}px) scale(${T.scale})`},F=`${(E?.xFrac??.5)*100}%`,I=`${(E?.yFrac??.5)*100}%`;if(E&&t.current&&n.current?.width&&n.current.height){let e=t.current.getBoundingClientRect(),r=i({left:0,top:0,width:e.width,height:e.height},n.current.width,n.current.height);F=`${r.left+E.xFrac*r.width}px`,I=`${r.top+E.yFrac*r.height}px`}return(0,B.jsxs)(`div`,{className:`relative h-full w-full bg-black`,"data-testid":`remote-desktop-mobile-view`,"data-conn-state":p,children:[(0,B.jsxs)(`div`,{ref:t,className:`absolute inset-x-0 top-0 flex items-center justify-center overflow-hidden`,style:{touchAction:`none`,bottom:A},"data-testid":`remote-desktop-mobile-stage-container`,children:[(0,B.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center`,style:P,children:[(0,B.jsx)(`canvas`,{ref:n,"data-testid":`remote-desktop-canvas`,className:`block h-full w-full min-h-0 min-w-0 object-contain outline-none`}),r===`mouse`&&E&&w&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute rounded-full border-2 border-white bg-primary shadow-[0_0_0_1px_rgba(0,0,0,0.6)]`,style:{left:F,top:I,width:14,height:14,transform:`translate(-50%, -50%) scale(${1/T.scale})`},"data-testid":`remote-desktop-virtual-cursor`})]}),N&&(0,B.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,B.jsx)(l,{className:`size-6 opacity-70`}),(0,B.jsx)(`span`,{className:`max-w-sm px-4 text-center`,children:N}),(p===`error`||p===`closed`)&&h!==`unsupported`&&(0,B.jsxs)(`button`,{onClick:b,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,B.jsx)(y,{className:`size-3.5`}),` Reconnect`]})]}),(0,B.jsx)(`input`,{ref:O,type:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:`absolute size-px opacity-0`,"aria-hidden":`true`,tabIndex:-1,onBlur:()=>d(!1),"data-testid":`remote-desktop-virtual-keyboard-input`})]}),(0,B.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0`,style:A>0?{transform:`translateY(-${A}px)`}:void 0,"data-testid":`remote-desktop-mobile-bottom-bar`,children:[o&&(0,B.jsx)(q,{sendMessage:v}),(0,B.jsx)(H,{displayLabel:f.displays.length>1?f.current?.label??null:null,onNextDisplay:f.next,mode:r,onToggleMode:j,onOpenKeyboard:M,onResetZoom:D,onClose:e})]}),(0,B.jsx)(s,{canvasRef:n,getFrameCount:C,getTotalBytes:S,positionClassName:`left-1 top-[calc(env(safe-area-inset-top,0px)+2.75rem)]`})]})}export{J 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{t as r}from"./circle-BCy0AUCo.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{t as a}from"./settings-store-Brjd0QnO.js";import{Bn as o,er as s,v as c,wr as l,xr as u,zn as d}from"./index--KWVW-Ga.js";import{r as f}from"./run-in-terminal-bKRwuO2z.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,c]=(0,p.useState)(!1),[l,u]=(0,p.useState)(!1);if(n||i)return(0,m.jsx)(m.Fragment,{children:t});let d=()=>{l&&r(!0),c(!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)(s,{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)(o,{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)(o,{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)(o,{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:l,onChange:e=>u(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:l}=c(!n);if(n||a?.videoReady&&a.inputReady)return(0,m.jsx)(m.Fragment,{children:t});let u=a?.requirements.filter(e=>!e.ok)??[],d=!!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)(s,{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:l,onTerminal:h},e.id))}),u.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:d?`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)(l,{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)(d,{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)(u,{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-Brjd0QnO.js";import{Bn as o,Cr as s,Er as c,er as l,v as u,zn as d}from"./index-B1bzKRjJ.js";import{r as f}from"./run-in-terminal-bKRwuO2z.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,s]=(0,p.useState)(!1),[c,u]=(0,p.useState)(!1);if(n||i)return(0,m.jsx)(m.Fragment,{children:t});let d=()=>{c&&r(!0),s(!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)(l,{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)(o,{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)(o,{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)(o,{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:c,onChange:e=>u(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}=u(!n);if(n||a?.videoReady&&a.inputReady)return(0,m.jsx)(m.Fragment,{children:t});let c=a?.requirements.filter(e=>!e.ok)??[],d=!!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)(l,{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:d?`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)(c,{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)(d,{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-DY5BWRTo.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as l}from"./settings-store-Brjd0QnO.js";import{n as u}from"./utils-C9OjCrou.js";import"./panel-store-BRrnDO_i.js";import{t as d}from"./window-store-DGKf9rPG.js";import"./ws-auth-Dawx17PM.js";import{Wn as f}from"./index--KWVW-Ga.js";import"./run-in-terminal-bKRwuO2z.js";import{n as p,t as m}from"./remote-desktop-readiness-gate-CPrDIv2d.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-DlfMIWq3.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as l}from"./settings-store-Brjd0QnO.js";import{n as u}from"./utils-C9OjCrou.js";import"./panel-store-BRrnDO_i.js";import{t as d}from"./window-store-DGKf9rPG.js";import"./ws-auth-Dawx17PM.js";import{Wn as f}from"./index-B1bzKRjJ.js";import"./run-in-terminal-bKRwuO2z.js";import{n as p,t as m}from"./remote-desktop-readiness-gate-BnKJicB2.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-oY1tC3tM.js";import{n as l}from"./utils-C9OjCrou.js";import"./portal-container-context-a399Hd9F.js";import"./context-menu-C13b1uT3.js";import{n as u}from"./use-is-mobile-CYW3FJFE.js";import{t as d}from"./button-BZtEJcUv.js";import{t as f}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{$t as p,B as m,Et as h,H as g,Jn as _,Jt as v,Nt as y,Pn as b,Qn as x,Qt as ee,Tt as S,U as C,V as w,W as T,Y as E,Yn as D,Yt as te,kt as O,q as k,wt as A,z as j}from"./index--KWVW-Ga.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)(A,{children:[(0,I.jsx)(y,{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)(S,{children:[(0,I.jsxs)(h,{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)(D,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(h,{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)(h,{onClick:t,children:[(0,I.jsx)(x,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(O,{}),(0,I.jsxs)(h,{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)(b,{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)([]),[h,_]=(0,M.useState)(!1),[y,b]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),b(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})),D=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(E,{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)(E,{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)(j,{value:a.project_path,onValueChange:e=>S(`project_path`,e),children:[(0,I.jsx)(g,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(C,{placeholder:`Select project`})}),(0,I.jsx)(m,{children:c.map(e=>(0,I.jsx)(w,{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)(j,{value:a.permission_mode,onValueChange:e=>S(`permission_mode`,e),children:[(0,I.jsx)(g,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(C,{})}),(0,I.jsx)(m,{children:le.map(e=>(0,I.jsx)(w,{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)(E,{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)(E,{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)(T,{checked:a.enabled,onCheckedChange:e=>S(`enabled`,e)})]}),y&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:y}),(0,I.jsx)(d,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){b(`Name, project, and prompt are required`);return}if(!x){b(`Invalid cron expression`);return}_(!0),b(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){b(e instanceof Error?e.message:String(e))}finally{_(!1)}},disabled:h,className:`w-full min-h-11 cursor-pointer`,children:h?`Saving…`:t?`Save changes`:`Create schedule`})]}),O=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:O}),(0,I.jsx)(k,{className:`flex-1 min-h-0 px-3 pb-3`,children:D})]}):(0,I.jsx)(v,{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)(p,{className:`text-sm`,children:O})}),D]})})}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)(_,{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)(_,{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-oY1tC3tM.js";import{n as l}from"./utils-C9OjCrou.js";import"./portal-container-context-a399Hd9F.js";import"./context-menu-C13b1uT3.js";import{n as u}from"./use-is-mobile-CYW3FJFE.js";import{t as d}from"./button-BZtEJcUv.js";import{t as f}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{$t as p,B as m,Et as h,H as g,Jn as _,Jt as v,Nt as y,Pn as b,Qn as x,Qt as ee,Tt as S,U as C,V as w,W as T,Y as E,Yn as D,Yt as te,kt as O,q as k,wt as A,z as j}from"./index-B1bzKRjJ.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)(A,{children:[(0,I.jsx)(y,{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)(S,{children:[(0,I.jsxs)(h,{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)(D,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(h,{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)(h,{onClick:t,children:[(0,I.jsx)(x,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(O,{}),(0,I.jsxs)(h,{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)(b,{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)([]),[h,_]=(0,M.useState)(!1),[y,b]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),b(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})),D=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(E,{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)(E,{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)(j,{value:a.project_path,onValueChange:e=>S(`project_path`,e),children:[(0,I.jsx)(g,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(C,{placeholder:`Select project`})}),(0,I.jsx)(m,{children:c.map(e=>(0,I.jsx)(w,{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)(j,{value:a.permission_mode,onValueChange:e=>S(`permission_mode`,e),children:[(0,I.jsx)(g,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(C,{})}),(0,I.jsx)(m,{children:le.map(e=>(0,I.jsx)(w,{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)(E,{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)(E,{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)(T,{checked:a.enabled,onCheckedChange:e=>S(`enabled`,e)})]}),y&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:y}),(0,I.jsx)(d,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){b(`Name, project, and prompt are required`);return}if(!x){b(`Invalid cron expression`);return}_(!0),b(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){b(e instanceof Error?e.message:String(e))}finally{_(!1)}},disabled:h,className:`w-full min-h-11 cursor-pointer`,children:h?`Saving…`:t?`Save changes`:`Create schedule`})]}),O=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:O}),(0,I.jsx)(k,{className:`flex-1 min-h-0 px-3 pb-3`,children:D})]}):(0,I.jsx)(v,{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)(p,{className:`text-sm`,children:O})}),D]})})}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)(_,{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)(_,{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-DWdHHRDy.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index--KWVW-Ga.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.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-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-CvGx7wBQ.css","assets/key-round-CQpDrDxg.js","assets/separator-DqGg3f9c.js","assets/appearance-settings-section-L9Z-nej_.js","assets/text-wrap-oiekm5SB.js","assets/ai-settings-section-CY6spbEx.js","assets/ai-settings-section-Po3K8j-g.js","assets/api-settings-CTMdz_VF.js","assets/accounts-settings-section-LtSVxNNp.js","assets/flask-conical-tp8gyZGh.js","assets/use-accounts-data-BI_5qNvr.js","assets/ppmbot-settings-section-BET4VmKb.js","assets/brain-KDa9jFRq.js","assets/send-Bb0jtcR6.js","assets/notifications-settings-section-v_628h4B.js","assets/jira-watcher-section-uA5oyB8s.js","assets/extension-manager-section-Cu9D9Udt.js","assets/folder-symlink-fQRoG_rV.js","assets/power-CriQkeK5.js","assets/proxy-settings-section-0DvNh1B-.js","assets/schedules-settings-section-B2f7V7Xr.js","assets/calendar-clock-C1asT-gk.js","assets/keyboard-shortcuts-section-B7IxJHiI.js","assets/files-settings-section-B1e7BgKQ.js","assets/query-audit-section-BA5rT6Sh.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-BKWscKt0.js";import{n as f}from"./utils-C9OjCrou.js";import{t as p}from"./button-BZtEJcUv.js";import{$n as m,Ar as h,Hn as g,dr as _,jr as v,q as y,qn as b}from"./index--KWVW-Ga.js";import{t as x}from"./separator-DqGg3f9c.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:m},{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:v},{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:h},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:b},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:_},{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)(y,{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)(y,{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-DWdHHRDy.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]))),appearance:(0,N.lazy)(()=>d(()=>import(`./appearance-settings-section-L9Z-nej_.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([46,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,47,45]))),"ai-provider":(0,N.lazy)(()=>d(()=>import(`./ai-settings-section-CY6spbEx.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([48,4,1,5,27,29,28,49,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,50]))),accounts:(0,N.lazy)(()=>d(()=>import(`./accounts-settings-section-LtSVxNNp.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([51,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,52,44,53,50]))),ppmbot:(0,N.lazy)(()=>d(()=>import(`./ppmbot-settings-section-BET4VmKb.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([54,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,55,56,45]))),notifications:(0,N.lazy)(()=>d(()=>import(`./notifications-settings-section-v_628h4B.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([57,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,45]))),jira:(0,N.lazy)(()=>d(()=>import(`./jira-watcher-section-uA5oyB8s.js`).then(e=>({default:e.JiraWatcherSection})),__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]))),extensions:(0,N.lazy)(()=>d(()=>import(`./extension-manager-section-Cu9D9Udt.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([59,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,60,61]))),proxy:(0,N.lazy)(()=>d(()=>import(`./proxy-settings-section-0DvNh1B-.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([62,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,52,50]))),schedules:(0,N.lazy)(()=>d(()=>import(`./schedules-settings-section-B2f7V7Xr.js`).then(e=>({default:e.SchedulesSettingsSection})),__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,64,61]))),shortcuts:(0,N.lazy)(()=>d(()=>import(`./keyboard-shortcuts-section-B7IxJHiI.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([65,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]))),files:(0,N.lazy)(()=>d(()=>import(`./files-settings-section-B1e7BgKQ.js`).then(e=>({default:e.FilesSettingsSection})),__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,45]))),"query-audit":(0,N.lazy)(()=>d(()=>import(`./query-audit-section-BA5rT6Sh.js`).then(e=>({default:e.QueryAuditSection})),__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,50])))};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)(y,{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-C1EJzjhU.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-B1bzKRjJ.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.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-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-nP3uxXvR.css","assets/key-round-CQpDrDxg.js","assets/separator-DqGg3f9c.js","assets/appearance-settings-section-vLmakLtA.js","assets/text-wrap-oiekm5SB.js","assets/ai-settings-section-CmoBsSpY.js","assets/ai-settings-section-DjbYj4wK.js","assets/api-settings-CTMdz_VF.js","assets/accounts-settings-section-CCFQV-RB.js","assets/flask-conical-tp8gyZGh.js","assets/use-accounts-data-MhMl0Y4Z.js","assets/ppmbot-settings-section-Bq4YAcFW.js","assets/brain-KDa9jFRq.js","assets/send-Bb0jtcR6.js","assets/notifications-settings-section-ARQlF-6E.js","assets/jira-watcher-section-DZh-Z2MK.js","assets/extension-manager-section-BpyGq15A.js","assets/folder-symlink-fQRoG_rV.js","assets/power-CriQkeK5.js","assets/proxy-settings-section-wRbiyQiA.js","assets/schedules-settings-section-BOecKJzl.js","assets/calendar-clock-C1asT-gk.js","assets/keyboard-shortcuts-section-JBtcJGM3.js","assets/files-settings-section-B0_aR1nL.js","assets/query-audit-section-C5RmhRSu.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-BKWscKt0.js";import{n as f}from"./utils-C9OjCrou.js";import{t as p}from"./button-BZtEJcUv.js";import{$n as m,Hn as h,Mr as g,Nr as _,pr as v,q as y,qn as b}from"./index-B1bzKRjJ.js";import{t as x}from"./separator-DqGg3f9c.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:h},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:m},{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:g},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:b},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:v},{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)(y,{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)(y,{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-C1EJzjhU.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]))),appearance:(0,N.lazy)(()=>d(()=>import(`./appearance-settings-section-vLmakLtA.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([46,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,47,45]))),"ai-provider":(0,N.lazy)(()=>d(()=>import(`./ai-settings-section-CmoBsSpY.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([48,4,1,5,27,29,28,49,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,50]))),accounts:(0,N.lazy)(()=>d(()=>import(`./accounts-settings-section-CCFQV-RB.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([51,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,52,44,53,50]))),ppmbot:(0,N.lazy)(()=>d(()=>import(`./ppmbot-settings-section-Bq4YAcFW.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([54,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,55,56,45]))),notifications:(0,N.lazy)(()=>d(()=>import(`./notifications-settings-section-ARQlF-6E.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([57,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,45]))),jira:(0,N.lazy)(()=>d(()=>import(`./jira-watcher-section-DZh-Z2MK.js`).then(e=>({default:e.JiraWatcherSection})),__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]))),extensions:(0,N.lazy)(()=>d(()=>import(`./extension-manager-section-BpyGq15A.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([59,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,60,61]))),proxy:(0,N.lazy)(()=>d(()=>import(`./proxy-settings-section-wRbiyQiA.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([62,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,52,50]))),schedules:(0,N.lazy)(()=>d(()=>import(`./schedules-settings-section-BOecKJzl.js`).then(e=>({default:e.SchedulesSettingsSection})),__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,64,61]))),shortcuts:(0,N.lazy)(()=>d(()=>import(`./keyboard-shortcuts-section-JBtcJGM3.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([65,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]))),files:(0,N.lazy)(()=>d(()=>import(`./files-settings-section-B0_aR1nL.js`).then(e=>({default:e.FilesSettingsSection})),__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,45]))),"query-audit":(0,N.lazy)(()=>d(()=>import(`./query-audit-section-C5RmhRSu.js`).then(e=>({default:e.QueryAuditSection})),__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,50])))};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)(y,{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-omv04jbb.js";import"./vendor-mermaid-BKWscKt0.js";import"./button-BZtEJcUv.js";import"./separator-DqGg3f9c.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-DGi5DXY6.js";import"./vendor-mermaid-BKWscKt0.js";import"./button-BZtEJcUv.js";import"./separator-DqGg3f9c.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-omv04jbb.js";import"./vendor-mermaid-BKWscKt0.js";import{t as r}from"./window-store-DGKf9rPG.js";import"./button-BZtEJcUv.js";import"./separator-DqGg3f9c.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-DGi5DXY6.js";import"./vendor-mermaid-BKWscKt0.js";import{t as r}from"./window-store-DGKf9rPG.js";import"./button-BZtEJcUv.js";import"./separator-DqGg3f9c.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-pKQuyYFj.js";import{o}from"./index--KWVW-Ga.js";import{t as s}from"./use-monaco-theme-BcQqKVbE.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-Cu0STKML.js";import{o}from"./index-B1bzKRjJ.js";import{t as s}from"./use-monaco-theme-BbAd7DXr.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-pKQuyYFj.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-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import"./settings-store-Brjd0QnO.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./tab-store-PZsP5ZwG.js";import{Er as u,Kn as d}from"./index--KWVW-Ga.js";import"./data-grid-types-CdAg-4W1.js";import"./use-monaco-theme-BcQqKVbE.js";import{t as f}from"./sql-query-editor-Dk9y3jqy.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-Cu0STKML.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-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import"./settings-store-Brjd0QnO.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./tab-store-PZsP5ZwG.js";import{Kn as u,Or as d}from"./index-B1bzKRjJ.js";import"./data-grid-types-CdAg-4W1.js";import"./use-monaco-theme-BbAd7DXr.js";import{t as f}from"./sql-query-editor-BmkGFzcL.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)(u,{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:u}){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)(d,{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:[!u&&(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 ${u?``:`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-mhN0qw6Q.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-markdown-Ls5AcU91.js","assets/utils-C9OjCrou.js","assets/format-bytes-CKXk9k2d.js","assets/process-table-D1r-Gupi.js","assets/index--KWVW-Ga.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/button-BZtEJcUv.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-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-CvGx7wBQ.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-BKWscKt0.js";import{n as a}from"./utils-C9OjCrou.js";import{g as o,kn as s}from"./index--KWVW-Ga.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-mhN0qw6Q.js`).then(e=>({default:e.OverviewPanel})),__vite__mapDeps([0,1,2,3,4]))),f=(0,l.lazy)(()=>i(()=>import(`./process-table-D1r-Gupi.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,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)(s,{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:s,tickCount:c}=o({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:s,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:s,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:s?`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-mhN0qw6Q.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-markdown-Ls5AcU91.js","assets/utils-C9OjCrou.js","assets/format-bytes-CKXk9k2d.js","assets/process-table-CjiXW0rg.js","assets/index-B1bzKRjJ.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/button-BZtEJcUv.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-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-nP3uxXvR.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-BKWscKt0.js";import{n as a}from"./utils-C9OjCrou.js";import{g as o,kn as s}from"./index-B1bzKRjJ.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-mhN0qw6Q.js`).then(e=>({default:e.OverviewPanel})),__vite__mapDeps([0,1,2,3,4]))),f=(0,l.lazy)(()=>i(()=>import(`./process-table-CjiXW0rg.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,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)(s,{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:s,tickCount:c}=o({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:s,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:s,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:s?`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-B_1iMVOI.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.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-CbHW5aYm.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.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-B_1iMVOI.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as n}from"./window-store-DGKf9rPG.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-CbHW5aYm.js";import"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{t as n}from"./window-store-DGKf9rPG.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-BKWscKt0.js";import"./portal-container-context-a399Hd9F.js";import{p as r,t as i}from"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./use-is-mobile-CYW3FJFE.js";import"./window-pip-registry-BEN0QNSW.js";import{qt as a}from"./index--KWVW-Ga.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-BKWscKt0.js";import"./portal-container-context-a399Hd9F.js";import{p as r,t as i}from"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./use-is-mobile-CYW3FJFE.js";import"./window-pip-registry-BEN0QNSW.js";import{qt as a}from"./index-B1bzKRjJ.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-CmF5ia3n.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index--KWVW-Ga.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.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-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-CvGx7wBQ.css","assets/tool-cards-jA1BTLZj.js","assets/circle-question-mark-CzR7YRc-.js","assets/code-DJgYrFzm.js","assets/send-Bb0jtcR6.js","assets/use-blob-url-Gfi69PtP.js","assets/image-gallery-Cj8nd4xW.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-YDu4m2Iq.js";import{q as i}from"./vendor-mermaid-BKWscKt0.js";import"./portal-container-context-a399Hd9F.js";import"./window-store-DGKf9rPG.js";import"./use-is-mobile-CYW3FJFE.js";import{t as a}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{n as o}from"./use-open-team-member-CruUTqzD.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./team-member-window-content-CmF5ia3n.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])));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-CM2QFv-s.js","assets/rolldown-runtime-FhOqtrmT.js","assets/index-B1bzKRjJ.js","assets/vendor-mermaid-BKWscKt0.js","assets/vendor-ui-CaeeFO0B.js","assets/vendor-markdown-Ls5AcU91.js","assets/button-BZtEJcUv.js","assets/utils-C9OjCrou.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-YDu4m2Iq.js","assets/api-client-oY1tC3tM.js","assets/react-X4jUntEf.js","assets/window-store-DGKf9rPG.js","assets/window-pip-registry-BEN0QNSW.js","assets/panel-store-BRrnDO_i.js","assets/context-menu-C13b1uT3.js","assets/portal-container-context-a399Hd9F.js","assets/mobile-bottom-sheet-BD5b7KJF.js","assets/use-visual-viewport-rnvuooQZ.js","assets/use-is-mobile-CYW3FJFE.js","assets/project-store-BuY7rxn_.js","assets/ws-auth-Dawx17PM.js","assets/settings-store-Brjd0QnO.js","assets/tab-store-PZsP5ZwG.js","assets/apply-theme-DxTXOAcV.js","assets/resolve-theme-DQk_YcsT.js","assets/index-nP3uxXvR.css","assets/tool-cards-jefdOWVJ.js","assets/circle-question-mark-CzR7YRc-.js","assets/code-DJgYrFzm.js","assets/send-Bb0jtcR6.js","assets/use-blob-url-Gfi69PtP.js","assets/image-gallery-Cj8nd4xW.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-YDu4m2Iq.js";import{q as i}from"./vendor-mermaid-BKWscKt0.js";import"./portal-container-context-a399Hd9F.js";import"./window-store-DGKf9rPG.js";import"./use-is-mobile-CYW3FJFE.js";import{t as a}from"./mobile-bottom-sheet-BD5b7KJF.js";import"./use-visual-viewport-rnvuooQZ.js";import{n as o}from"./use-open-team-member-CruUTqzD.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./team-member-window-content-CM2QFv-s.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])));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-jA1BTLZj.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{n as a}from"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{n as o}from"./utils-C9OjCrou.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./tab-store-PZsP5ZwG.js";import{Kn as s}from"./index--KWVW-Ga.js";import"./use-blob-url-Gfi69PtP.js";var c=e(t(),1),l=n();function u({payload:e}){let{teamName:t,memberName:n,projectName:u}=e??{},[d,f]=(0,c.useState)([]),[p,m]=(0,c.useState)(!0),[h,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(0);return(0,c.useEffect)(()=>{if(!t||!n){g(`Missing team or member`),m(!1);return}let e=!1;return m(!0),g(null),a.get(`/api/teams/${encodeURIComponent(t)}/members/${encodeURIComponent(n)}/transcript`).then(t=>{e||f(t?.events??[])}).catch(()=>{e||g(`Could not read this member's session`)}).finally(()=>{e||m(!1)}),()=>{e=!0}},[t,n,_]),(0,l.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,l.jsx)(`span`,{className:`text-xs font-medium truncate`,children:n}),(0,l.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:d.length>0?`${d.length} steps`:``}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e+1),className:`ml-auto text-text-subtle hover:text-foreground p-1 shrink-0`,"aria-label":`Reload session`,children:(0,l.jsx)(s,{className:o(`size-3`,p&&`animate-spin`)})})]}),p&&d.length===0?(0,l.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,l.jsx)(i,{className:`size-3 animate-spin`}),`Loading session…`]}):h?(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-error px-4 text-center`,children:h}):d.length===0?(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle`,children:`This member has no recorded session`}):(0,l.jsx)(r,{events:d,projectName:u,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{u 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-jefdOWVJ.js";import{t as i}from"./loader-circle-DPMrnLQ2.js";import{n as a}from"./api-client-oY1tC3tM.js";import"./vendor-mermaid-BKWscKt0.js";import{n as o}from"./utils-C9OjCrou.js";import"./panel-store-BRrnDO_i.js";import"./window-store-DGKf9rPG.js";import"./tab-store-PZsP5ZwG.js";import{Kn as s}from"./index-B1bzKRjJ.js";import"./use-blob-url-Gfi69PtP.js";var c=e(t(),1),l=n();function u({payload:e}){let{teamName:t,memberName:n,projectName:u}=e??{},[d,f]=(0,c.useState)([]),[p,m]=(0,c.useState)(!0),[h,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(0);return(0,c.useEffect)(()=>{if(!t||!n){g(`Missing team or member`),m(!1);return}let e=!1;return m(!0),g(null),a.get(`/api/teams/${encodeURIComponent(t)}/members/${encodeURIComponent(n)}/transcript`).then(t=>{e||f(t?.events??[])}).catch(()=>{e||g(`Could not read this member's session`)}).finally(()=>{e||m(!1)}),()=>{e=!0}},[t,n,_]),(0,l.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,l.jsx)(`span`,{className:`text-xs font-medium truncate`,children:n}),(0,l.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:d.length>0?`${d.length} steps`:``}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e+1),className:`ml-auto text-text-subtle hover:text-foreground p-1 shrink-0`,"aria-label":`Reload session`,children:(0,l.jsx)(s,{className:o(`size-3`,p&&`animate-spin`)})})]}),p&&d.length===0?(0,l.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,l.jsx)(i,{className:`size-3 animate-spin`}),`Loading session…`]}):h?(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-error px-4 text-center`,children:h}):d.length===0?(0,l.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle`,children:`This member has no recorded session`}):(0,l.jsx)(r,{events:d,projectName:u,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})}export{u as default};