@jingyi0605/codingns 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/public/assets/{AdaptiveButlerPage-B8mg25ze.js → AdaptiveButlerPage-174Mg-9X.js} +1 -1
  2. package/dist/public/assets/{App-C2lNmeKL.js → App-BRupl2Ul.js} +3 -3
  3. package/dist/public/assets/{BootstrapPage-CAVA-a8h.js → BootstrapPage-BKzDRWtn.js} +1 -1
  4. package/dist/public/assets/ConversationPage-BLQXBsBc.js +6 -0
  5. package/dist/public/assets/{DesktopDetachPreviewPage-B37DUL15.js → DesktopDetachPreviewPage-DtHzSQOX.js} +1 -1
  6. package/dist/public/assets/{DesktopWindowPage-CDA6l7lm.js → DesktopWindowPage-ppc3h5sO.js} +1 -1
  7. package/dist/public/assets/{FileContextPanel-CMGTtAB6.js → FileContextPanel-h0kvRbSR.js} +1 -1
  8. package/dist/public/assets/GitSidebar-TlaPNhxG.js +6 -0
  9. package/dist/public/assets/{MobileCreateSessionSheet-THIrIzJ3.js → MobileCreateSessionSheet-Bp4xOKdt.js} +1 -1
  10. package/dist/public/assets/{MobileTopHeaderFrame-D-X7pVnV.js → MobileTopHeaderFrame-BawK1vUE.js} +1 -1
  11. package/dist/public/assets/{MobileWorkspaceSwitcherHeader-Cczi7RYu.js → MobileWorkspaceSwitcherHeader-CWPXAMoX.js} +1 -1
  12. package/dist/public/assets/{RelayConnectEntryPage-D417tgWj.js → RelayConnectEntryPage-B0-OBZXu.js} +1 -1
  13. package/dist/public/assets/{ServerSettingsModal-BdTxbRbU.js → ServerSettingsModal-P_pcDvyR.js} +1 -1
  14. package/dist/public/assets/{SessionIndexPage-D5iefVcc.js → SessionIndexPage-r8AZ0pJv.js} +1 -1
  15. package/dist/public/assets/{SettingsPage-iCFe_DHP.js → SettingsPage-B-uNuML1.js} +1 -1
  16. package/dist/public/assets/{TerminalManagerPanel-CtldwWz8.js → TerminalManagerPanel-Bkgr9ZNV.js} +1 -1
  17. package/dist/public/assets/{TerminalPage-DAzQTmQC.js → TerminalPage-BpFpA3My.js} +1 -1
  18. package/dist/public/assets/{TerminalRuntimeFallbackModal-DLOhAvaq.js → TerminalRuntimeFallbackModal-D_BUt6HD.js} +1 -1
  19. package/dist/public/assets/ToolFilesPage-BE9-iHL0.js +1 -0
  20. package/dist/public/assets/ToolGitPage-ChUkwKgK.js +1 -0
  21. package/dist/public/assets/ToolProcessesPage-C4dli_mi.js +1 -0
  22. package/dist/public/assets/{ToolsHomePage-rU3V8mmh.js → ToolsHomePage-ZmcEotg4.js} +1 -1
  23. package/dist/public/assets/{WorkbenchLandingPage-BudM2C69.js → WorkbenchLandingPage-DZzbQZHt.js} +1 -1
  24. package/dist/public/assets/WorkbenchLayout-Cht6Un5X.js +244 -0
  25. package/dist/public/assets/{WorkbenchModal-DMQutm1x.js → WorkbenchModal-CAj_TqWW.js} +1 -1
  26. package/dist/public/assets/WorkbenchShellRoute-DzbO05cD.js +1 -0
  27. package/dist/public/assets/{WorkspaceDebugDetailPage-CHqo-uDf.js → WorkspaceDebugDetailPage-qku5AzZQ.js} +1 -1
  28. package/dist/public/assets/{WorkspaceDetailPage-CGkAH1W-.js → WorkspaceDetailPage-BtrSsZVP.js} +1 -1
  29. package/dist/public/assets/{WorkspaceHomePage-CfuPVITd.js → WorkspaceHomePage-BhekFDSu.js} +1 -1
  30. package/dist/public/assets/{client-runtime-manager-CKbtaemV.js → client-runtime-manager-CgogHxt0.js} +1 -1
  31. package/dist/public/assets/file-tree-icon-CLfk31E7.js +3 -0
  32. package/dist/public/assets/index-CkkzIvxs.css +1 -0
  33. package/dist/public/assets/index-DvkfRpBe.js +42 -0
  34. package/dist/public/assets/{login-direct-candidate-resolver-DjJMbqB7.js → login-direct-candidate-resolver-DvJnjQCi.js} +1 -1
  35. package/dist/public/assets/{model-switch-api-T55eW6D4.js → model-switch-api-Dps4yN2t.js} +1 -1
  36. package/dist/public/assets/{preferences-service-BTKBl5xM.js → preferences-service-ohVuseA-.js} +1 -1
  37. package/dist/public/assets/realtime-client-CIci6rCd.js +1 -0
  38. package/dist/public/assets/{relay-entry-sdeFnTbY.js → relay-entry-WiotM2TL.js} +1 -1
  39. package/dist/public/assets/styles-DkbkRgWw.css +1 -0
  40. package/dist/public/assets/{terminal-runtime-meta-Cvt1ID92.js → terminal-runtime-meta-C3Mr0zW5.js} +1 -1
  41. package/dist/public/assets/{useRegisteredDebugTemplates-O-ymgLd9.js → useRegisteredDebugTemplates-DVQBPV-V.js} +1 -1
  42. package/dist/public/index.html +2 -2
  43. package/dist/server/modules/git/git-controller.d.ts +3 -1
  44. package/dist/server/modules/git/git-controller.js +9 -2
  45. package/dist/server/modules/git/git-controller.js.map +1 -1
  46. package/dist/server/modules/git/git-read-service.js +2 -1
  47. package/dist/server/modules/git/git-read-service.js.map +1 -1
  48. package/dist/server/modules/git/git-remote-credential-service.d.ts +1 -0
  49. package/dist/server/modules/git/git-remote-credential-service.js +4 -0
  50. package/dist/server/modules/git/git-remote-credential-service.js.map +1 -1
  51. package/dist/server/modules/git/types.d.ts +1 -0
  52. package/dist/server/modules/provider/codex-model-options.js +14 -15
  53. package/dist/server/modules/provider/codex-model-options.js.map +1 -1
  54. package/dist/server/modules/provider/provider-discovery-helper-process.js +2 -1
  55. package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -1
  56. package/dist/server/server/create-server.js +1 -1
  57. package/dist/server/server/create-server.js.map +1 -1
  58. package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +6 -0
  59. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +398 -0
  60. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -1
  61. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +47 -4
  62. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
  63. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +32 -4
  64. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
  65. package/package.json +5 -1
  66. package/dist/public/assets/ConversationPage-B6BGOX4C.js +0 -6
  67. package/dist/public/assets/GitSidebar--DCqBiGL.js +0 -6
  68. package/dist/public/assets/ToolFilesPage-D7thcDEv.js +0 -1
  69. package/dist/public/assets/ToolGitPage-uPRsxdcn.js +0 -1
  70. package/dist/public/assets/ToolProcessesPage-B1uOk0Ef.js +0 -1
  71. package/dist/public/assets/WorkbenchLayout-Dybarc1V.js +0 -244
  72. package/dist/public/assets/WorkbenchShellRoute-Cy4WBbzq.js +0 -1
  73. package/dist/public/assets/file-tree-icon-Bc0KADEl.js +0 -3
  74. package/dist/public/assets/index-DNRyROOG.css +0 -1
  75. package/dist/public/assets/index-oGylLBIX.js +0 -42
  76. package/dist/public/assets/realtime-client-ww7MnbTD.js +0 -1
  77. package/dist/public/assets/styles-BjPytabP.css +0 -1
  78. package/dist/server/modules/channels/wechat-claw-client.d.ts +0 -51
  79. package/dist/server/modules/channels/wechat-claw-client.js +0 -245
  80. package/dist/server/modules/channels/wechat-claw-client.js.map +0 -1
  81. /package/dist/public/assets/{styles-lhQGDlPF.js → styles-JKFlsYFv.js} +0 -0
@@ -1 +1 @@
1
- import{j as e,t as E,b as x}from"./index-oGylLBIX.js";import{g as D}from"./App-C2lNmeKL.js";function I(){return e.jsx("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:e.jsx("path",{d:"M4.2 4.2l7.6 7.6M11.8 4.2l-7.6 7.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function g({className:o,"aria-label":r,...a}){return e.jsx("button",{type:"button",className:o?`workbench-modal-close ${o}`:"workbench-modal-close","aria-label":r??E("common.close"),...a,children:e.jsx(I,{})})}function $({open:o,title:r,description:a,hideHeader:l=!1,size:c="compact",layout:d="form",dismissible:n=!0,closeOnBackdrop:h=!0,closeOnEscape:k=!0,className:s,bodyClassName:i,headerActions:u,footer:m,showCloseButton:b=!0,onClose:t,children:f}){const w=x.useId(),p=x.useId(),j=n&&h,v=n&&k,M=!n;return x.useEffect(()=>{if(!o||!v)return;function y(N){N.key==="Escape"&&t()}return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[v,t,o]),!o||typeof document>"u"?null:D.createPortal(e.jsxs("div",{className:"workbench-modal-layer desktop-modal-layer","data-fullscreen":c==="full"?"true":void 0,"data-layout":d,children:[e.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":E("common.close"),disabled:!j,onClick:()=>{j&&t()}}),e.jsxs("section",{className:`workbench-modal-card surface-card desktop-modal-card${s?` ${s}`:""}`,"data-size":c,"data-layout":d,role:"dialog","aria-modal":"true","aria-labelledby":l?void 0:w,"aria-label":l?r:void 0,"aria-describedby":!l&&a?p:void 0,children:[l?null:e.jsxs("div",{className:"workbench-modal-header",children:[e.jsxs("div",{className:"workbench-modal-title-wrap",children:[e.jsx("h2",{id:w,children:r}),a?e.jsx("p",{id:p,children:a}):null]}),u||b?e.jsxs("div",{className:"workbench-modal-header-actions",children:[u,b?e.jsx(g,{disabled:M,onClick:()=>{n&&t()}}):null]}):null]}),e.jsx("div",{className:i?`workbench-modal-body ${i}`:"workbench-modal-body",children:f}),m?e.jsx("div",{className:"workbench-modal-footer",children:m}):null]})]}),document.body)}function W({open:o,title:r,description:a,hideHeader:l=!1,size:c="compact",layout:d="form",className:n,bodyClassName:h,headerActions:k,footer:s,showCloseButton:i=!0,dismissible:u=!0,closeOnBackdrop:m=!0,closeOnEscape:b=!0,onClose:t,children:f}){return e.jsx($,{open:o,title:r,description:a,hideHeader:l,size:c,layout:d,dismissible:u,closeOnBackdrop:m,closeOnEscape:b,className:n,bodyClassName:h,headerActions:k,footer:s,showCloseButton:i,onClose:t,children:f})}export{$ as D,g as M,W};
1
+ import{j as e,t as E,b as x}from"./index-DvkfRpBe.js";import{g as D}from"./App-BRupl2Ul.js";function I(){return e.jsx("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:e.jsx("path",{d:"M4.2 4.2l7.6 7.6M11.8 4.2l-7.6 7.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function g({className:o,"aria-label":r,...a}){return e.jsx("button",{type:"button",className:o?`workbench-modal-close ${o}`:"workbench-modal-close","aria-label":r??E("common.close"),...a,children:e.jsx(I,{})})}function $({open:o,title:r,description:a,hideHeader:l=!1,size:c="compact",layout:d="form",dismissible:n=!0,closeOnBackdrop:h=!0,closeOnEscape:k=!0,className:s,bodyClassName:i,headerActions:u,footer:m,showCloseButton:b=!0,onClose:t,children:f}){const w=x.useId(),p=x.useId(),j=n&&h,v=n&&k,M=!n;return x.useEffect(()=>{if(!o||!v)return;function y(N){N.key==="Escape"&&t()}return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[v,t,o]),!o||typeof document>"u"?null:D.createPortal(e.jsxs("div",{className:"workbench-modal-layer desktop-modal-layer","data-fullscreen":c==="full"?"true":void 0,"data-layout":d,children:[e.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":E("common.close"),disabled:!j,onClick:()=>{j&&t()}}),e.jsxs("section",{className:`workbench-modal-card surface-card desktop-modal-card${s?` ${s}`:""}`,"data-size":c,"data-layout":d,role:"dialog","aria-modal":"true","aria-labelledby":l?void 0:w,"aria-label":l?r:void 0,"aria-describedby":!l&&a?p:void 0,children:[l?null:e.jsxs("div",{className:"workbench-modal-header",children:[e.jsxs("div",{className:"workbench-modal-title-wrap",children:[e.jsx("h2",{id:w,children:r}),a?e.jsx("p",{id:p,children:a}):null]}),u||b?e.jsxs("div",{className:"workbench-modal-header-actions",children:[u,b?e.jsx(g,{disabled:M,onClick:()=>{n&&t()}}):null]}):null]}),e.jsx("div",{className:i?`workbench-modal-body ${i}`:"workbench-modal-body",children:f}),m?e.jsx("div",{className:"workbench-modal-footer",children:m}):null]})]}),document.body)}function W({open:o,title:r,description:a,hideHeader:l=!1,size:c="compact",layout:d="form",className:n,bodyClassName:h,headerActions:k,footer:s,showCloseButton:i=!0,dismissible:u=!0,closeOnBackdrop:m=!0,closeOnEscape:b=!0,onClose:t,children:f}){return e.jsx($,{open:o,title:r,description:a,hideHeader:l,size:c,layout:d,dismissible:u,closeOnBackdrop:m,closeOnEscape:b,className:n,bodyClassName:h,headerActions:k,footer:s,showCloseButton:i,onClose:t,children:f})}export{$ as D,g as M,W};
@@ -0,0 +1 @@
1
+ import{j as t}from"./index-DvkfRpBe.js";import{a as e}from"./WorkbenchLayout-Cht6Un5X.js";import{e as m,r as s}from"./App-BRupl2Ul.js";import"./model-switch-api-Dps4yN2t.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-CAj_TqWW.js";import"./relay-entry-WiotM2TL.js";function u(){const o=m(),r=s(o);return t.jsx(e,{shellMode:r})}export{u as WorkbenchShellRoute};
@@ -1 +1 @@
1
- import{b as c,j as e,t as s}from"./index-oGylLBIX.js";import{j as $,u as q,b as R,f as z,k as H,r as _,a as L,D as J,h as T,d as y,e as A,l as K,m as Q,c as U,g as X,i as Y}from"./useRegisteredDebugTemplates-O-ymgLd9.js";import{u as Z,t as ee,s as se}from"./WorkbenchLayout-Dybarc1V.js";import{c as C}from"./model-switch-api-T55eW6D4.js";import{g as I,r as ae}from"./terminal-runtime-meta-Cvt1ID92.js";import{c as le,u as te,f as ne}from"./App-C2lNmeKL.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-DMQutm1x.js";import"./relay-entry-sdeFnTbY.js";function be(){var S;const{workspaceId:u=""}=le(),j=te(),{showToast:d}=ne(),{navigationGroups:E,selectWorkspace:f}=Z(),r=((S=E.find(a=>a.workspace.id===u))==null?void 0:S.workspace)??null,[h,m]=c.useState(null),[N,o]=c.useState(null),[n,k]=c.useState(null),w=c.useRef(null);c.useEffect(()=>{u&&f(u)},[f,u]);const P=c.useMemo(()=>r?{id:r.id,path:r.path,name:r.name}:null,[r]),l=$(P),b=q(P),g=c.useMemo(()=>n??R(l.templates,l.runtimeStatuses),[n,l.runtimeStatuses,l.templates]),M=c.useMemo(()=>(n==null?void 0:n.items.some(a=>{var t;return(t=a.planItem)==null?void 0:t.missingRequirements.includes("service_discovery")}))??!1,[n]),O=c.useMemo(()=>new Map(l.runtimeStatuses.map(a=>[a.templateId,a])),[l.runtimeStatuses]);if(c.useEffect(()=>{!n||!w.current||typeof w.current.scrollIntoView=="function"&&w.current.scrollIntoView({behavior:"smooth",block:"start"})},[n]),!r)return e.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:e.jsxs("div",{className:"workbench-empty-guide surface-card",children:[e.jsx("h1",{children:s("shell.workspaceDetailMissingTitle")}),e.jsx("p",{children:s("shell.workspaceDetailMissingBody")})]})});return e.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:e.jsxs("div",{className:"debug-readiness-page",children:[e.jsxs("section",{className:"debug-readiness-hero surface-card",children:[e.jsx("div",{className:"debug-readiness-hero-header",children:e.jsxs("div",{className:"debug-readiness-hero-copy",children:[e.jsx("h2",{children:s("shell.workspaceDetailDebugPageTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugPageDescription")})]})}),e.jsxs("div",{className:"debug-readiness-hero-toolbar",children:[e.jsxs("div",{className:"workbench-modal-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>j(ee(r.id)),children:s("shell.goBack")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{B()},children:h==="sync"?s("shell.workspaceDetailRegisteredDebugActionSyncingTemplates"):s("shell.workspaceDetailRegisteredDebugActionSyncTemplates")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{F()},children:h==="plan"?s("shell.workspaceDetailDebugActionPlanning"):s("shell.workspaceDetailDebugActionPlan")}),e.jsx("button",{type:"button",className:"primary-button",disabled:h!==null,onClick:()=>{W()},children:h==="run"?s("shell.workspaceDetailRegisteredDebugActionRunningRegistered"):s("shell.workspaceDetailRegisteredDebugActionRunRegistered")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{V()},children:h==="refresh"?s("shell.workspaceDetailDebugActionRefreshing"):s("shell.workspaceDetailDebugActionRefresh")})]}),N?e.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:N}):null]}),e.jsxs("div",{className:"debug-readiness-summary-grid debug-readiness-summary-grid-hero",children:[e.jsxs("article",{className:"debug-readiness-summary-card","data-tone":_(g,l.templates.length),children:[e.jsx("span",{children:s("shell.workspaceDetailDebugOverallStatusLabel")}),e.jsx("strong",{children:z(g,l.templates.length)}),e.jsx("small",{children:H(g,l.templates.length)})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRegisteredCountLabel")}),e.jsx("strong",{children:l.templates.length})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryConfiguredPortLabel")}),e.jsx("strong",{children:l.templates.filter(a=>a.port!==null).length}),e.jsx("small",{children:s("shell.workspaceDetailRegisteredDebugRuntimeScopeNote")})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRunnableCountLabel")}),e.jsx("strong",{children:g.runnableCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryOrchestratedCountLabel")}),e.jsx("strong",{children:g.orchestratedCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryBlockedCountLabel")}),e.jsx("strong",{children:g.blockedCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryLastRefreshLabel")}),e.jsx("strong",{children:L(l.lastRefreshedAt)}),e.jsx("small",{children:r.path})]})]})]}),e.jsx(J,{workspace:{id:r.id,path:r.path,name:r.name},state:b,variant:"page"}),n?e.jsxs("section",{ref:w,className:"debug-readiness-section surface-card",children:[e.jsxs("div",{className:"debug-readiness-section-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:s("shell.workspaceDetailDebugLaunchPlanTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanDescription")})]}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>k(null),children:s("shell.workspaceDetailDebugLaunchPlanDismissAction")})]}),e.jsxs("div",{className:"workbench-manage-kv-list",children:[e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanGeneratedAtLabel")}),e.jsx("span",{children:L(n.generatedAt)})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailDebugLaunchPlanAutoStartLabel")}),e.jsx("span",{children:n.autoStartAllowed?s("shell.workspaceDetailDebugLaunchPlanAutoStartAllowed"):s("shell.workspaceDetailDebugLaunchPlanAutoStartBlocked")})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanRunnableLabel")}),e.jsx("span",{children:n.runnableCount})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanOrchestratedLabel")}),e.jsx("span",{children:n.orchestratedCount})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanBlockedLabel")}),e.jsx("span",{children:n.blockedCount})]})]}),e.jsx("p",{className:"workbench-manage-hint",children:s("shell.workspaceDetailRegisteredDebugLaunchPlanNote")}),M?e.jsx("p",{className:"workbench-manage-hint",children:s("shell.workspaceDetailRegisteredDebugLaunchPlanServiceDiscoveryHelp")}):null,n.items.length>0?e.jsx("div",{className:"debug-readiness-runtime-list",children:n.items.map(a=>e.jsxs("article",{className:"debug-readiness-runtime-item",children:[e.jsxs("div",{className:"debug-readiness-runtime-item-header",children:[e.jsx("strong",{children:a.template.name}),e.jsx("span",{children:T(a.template)})]}),e.jsxs("div",{className:"debug-readiness-runtime-item-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:a.template.cwd,children:y(a.template.cwd,r.path)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:A(a.assignedPort)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemRuntimeLabel")}),e.jsx("strong",{children:I(a.template.runtimeType)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemActionLabel")}),e.jsx("strong",{children:K(a.decision)})]})]}),e.jsxs("p",{className:"workbench-manage-hint",children:[s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel"),": ",a.reason]})]},a.template.id))}):e.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")})]}):null,e.jsxs("section",{className:"debug-readiness-section surface-card",children:[e.jsxs("div",{className:"debug-readiness-section-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:s("shell.workspaceDetailRegisteredDebugTemplatesTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugTemplatesDescription")})]}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>j(se(r.id)),children:s("shell.workspaceDetailRegisteredDebugOpenProcessManagerAction")})]}),l.loading&&l.templates.length===0?e.jsx("p",{className:"workbench-section-empty",children:s("common.loading")}):null,l.error&&l.templates.length===0?e.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:l.error}):null,!l.loading&&l.templates.length===0?e.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")}):null,l.templates.length>0?e.jsx("div",{className:"debug-readiness-service-grid",children:l.templates.map(a=>{const t=O.get(a.id)??null,p=Q(a,t);return e.jsxs("article",{className:"debug-readiness-service-card",children:[e.jsxs("div",{className:"debug-readiness-service-card-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a.name}),e.jsx("p",{title:a.cwd,children:y(a.cwd,r.path)})]}),e.jsx("span",{className:"debug-readiness-chip","data-tone":p,children:U(a,t)})]}),e.jsxs("div",{className:"debug-readiness-service-card-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:a.cwd,children:y(a.cwd,r.path)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:A(a.port)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplateRuntimeTypeLabel")}),e.jsx("strong",{children:I(a.runtimeType)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugRuntimeProcessLabel")}),e.jsx("strong",{children:X(t)})]})]}),e.jsxs("div",{className:"debug-readiness-service-card-list",children:[e.jsxs("p",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemCommandLabel")}),e.jsx("strong",{children:T(a)})]}),e.jsxs("p",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel")}),e.jsx("strong",{children:Y(a,t)})]})]})]},a.id)})}):null]})]})});async function B(){m("sync"),o(null);try{await l.refreshAll(),k(null),d({title:s("shell.workspaceDetailRegisteredDebugActionSyncTemplatesSuccess"),tone:"success"})}catch(a){const t=x(a,s("shell.workspaceDetailRegisteredDebugActionSyncTemplatesFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}async function F(){m("plan"),o(null);try{if(!b.targetId)throw new Error(s("shell.workspaceDetailDebugActionTargetMissing"));const a=await C(b.targetId),t=R(l.templates,l.runtimeStatuses,a);k(t),d({title:s("shell.workspaceDetailDebugActionPlanSuccess"),tone:"info"})}catch(a){const t=x(a,s("shell.workspaceDetailDebugActionPlanFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}async function W(){var a,t;m("run"),o(null);try{const p=n??(b.targetId?R(l.templates,l.runtimeStatuses,await C(b.targetId)):R(l.templates,l.runtimeStatuses));k(p);const D=p.items.filter(i=>i.decision!=="blocked");if(D.length===0){const i=s("shell.workspaceDetailRegisteredDebugActionRunRegisteredSkipped");o(i),d({title:i,tone:"info"});return}const v=[];for(const i of D)try{await ae(i.template.id,{runtimeType:i.template.runtimeType??void 0,argsOverride:(a=i.planItem)==null?void 0:a.args,envPatch:(t=i.planItem)==null?void 0:t.envPatch,portOverride:i.assignedPort})}catch(G){v.push(`${i.template.name}: ${x(G,s("shell.workspaceDetailRegisteredDebugActionRunRegisteredFailed"))}`)}if(await l.refreshRuntime(),v.length>0)throw new Error(v.join(";"));d({title:s("shell.workspaceDetailRegisteredDebugActionRunRegisteredSuccess"),tone:"success"})}catch(p){const D=x(p,s("shell.workspaceDetailRegisteredDebugActionRunRegisteredFailed"));o(D),d({title:D,tone:"error"})}finally{m(null)}}async function V(){m("refresh"),o(null);try{await l.refreshRuntime(),d({title:s("shell.workspaceDetailDebugActionRefreshSuccess"),tone:"success"})}catch(a){const t=x(a,s("shell.workspaceDetailRegisteredDebugActionRefreshFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}}function x(u,j){return u instanceof Error&&u.message.trim()?u.message:j}export{be as WorkspaceDebugDetailPage};
1
+ import{b as c,j as e,t as s}from"./index-DvkfRpBe.js";import{j as $,u as q,b as R,f as z,k as H,r as _,a as L,D as J,h as T,d as y,e as A,l as K,m as Q,c as U,g as X,i as Y}from"./useRegisteredDebugTemplates-DVQBPV-V.js";import{u as Z,t as ee,s as se}from"./WorkbenchLayout-Cht6Un5X.js";import{c as C}from"./model-switch-api-Dps4yN2t.js";import{g as I,r as ae}from"./terminal-runtime-meta-C3Mr0zW5.js";import{c as le,u as te,f as ne}from"./App-BRupl2Ul.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-CAj_TqWW.js";import"./relay-entry-WiotM2TL.js";function be(){var S;const{workspaceId:u=""}=le(),j=te(),{showToast:d}=ne(),{navigationGroups:E,selectWorkspace:f}=Z(),r=((S=E.find(a=>a.workspace.id===u))==null?void 0:S.workspace)??null,[h,m]=c.useState(null),[N,o]=c.useState(null),[n,k]=c.useState(null),w=c.useRef(null);c.useEffect(()=>{u&&f(u)},[f,u]);const P=c.useMemo(()=>r?{id:r.id,path:r.path,name:r.name}:null,[r]),l=$(P),b=q(P),g=c.useMemo(()=>n??R(l.templates,l.runtimeStatuses),[n,l.runtimeStatuses,l.templates]),M=c.useMemo(()=>(n==null?void 0:n.items.some(a=>{var t;return(t=a.planItem)==null?void 0:t.missingRequirements.includes("service_discovery")}))??!1,[n]),O=c.useMemo(()=>new Map(l.runtimeStatuses.map(a=>[a.templateId,a])),[l.runtimeStatuses]);if(c.useEffect(()=>{!n||!w.current||typeof w.current.scrollIntoView=="function"&&w.current.scrollIntoView({behavior:"smooth",block:"start"})},[n]),!r)return e.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:e.jsxs("div",{className:"workbench-empty-guide surface-card",children:[e.jsx("h1",{children:s("shell.workspaceDetailMissingTitle")}),e.jsx("p",{children:s("shell.workspaceDetailMissingBody")})]})});return e.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:e.jsxs("div",{className:"debug-readiness-page",children:[e.jsxs("section",{className:"debug-readiness-hero surface-card",children:[e.jsx("div",{className:"debug-readiness-hero-header",children:e.jsxs("div",{className:"debug-readiness-hero-copy",children:[e.jsx("h2",{children:s("shell.workspaceDetailDebugPageTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugPageDescription")})]})}),e.jsxs("div",{className:"debug-readiness-hero-toolbar",children:[e.jsxs("div",{className:"workbench-modal-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>j(ee(r.id)),children:s("shell.goBack")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{B()},children:h==="sync"?s("shell.workspaceDetailRegisteredDebugActionSyncingTemplates"):s("shell.workspaceDetailRegisteredDebugActionSyncTemplates")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{F()},children:h==="plan"?s("shell.workspaceDetailDebugActionPlanning"):s("shell.workspaceDetailDebugActionPlan")}),e.jsx("button",{type:"button",className:"primary-button",disabled:h!==null,onClick:()=>{W()},children:h==="run"?s("shell.workspaceDetailRegisteredDebugActionRunningRegistered"):s("shell.workspaceDetailRegisteredDebugActionRunRegistered")}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h!==null,onClick:()=>{V()},children:h==="refresh"?s("shell.workspaceDetailDebugActionRefreshing"):s("shell.workspaceDetailDebugActionRefresh")})]}),N?e.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:N}):null]}),e.jsxs("div",{className:"debug-readiness-summary-grid debug-readiness-summary-grid-hero",children:[e.jsxs("article",{className:"debug-readiness-summary-card","data-tone":_(g,l.templates.length),children:[e.jsx("span",{children:s("shell.workspaceDetailDebugOverallStatusLabel")}),e.jsx("strong",{children:z(g,l.templates.length)}),e.jsx("small",{children:H(g,l.templates.length)})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRegisteredCountLabel")}),e.jsx("strong",{children:l.templates.length})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryConfiguredPortLabel")}),e.jsx("strong",{children:l.templates.filter(a=>a.port!==null).length}),e.jsx("small",{children:s("shell.workspaceDetailRegisteredDebugRuntimeScopeNote")})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRunnableCountLabel")}),e.jsx("strong",{children:g.runnableCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryOrchestratedCountLabel")}),e.jsx("strong",{children:g.orchestratedCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryBlockedCountLabel")}),e.jsx("strong",{children:g.blockedCount})]}),e.jsxs("article",{className:"debug-readiness-summary-card",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryLastRefreshLabel")}),e.jsx("strong",{children:L(l.lastRefreshedAt)}),e.jsx("small",{children:r.path})]})]})]}),e.jsx(J,{workspace:{id:r.id,path:r.path,name:r.name},state:b,variant:"page"}),n?e.jsxs("section",{ref:w,className:"debug-readiness-section surface-card",children:[e.jsxs("div",{className:"debug-readiness-section-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:s("shell.workspaceDetailDebugLaunchPlanTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanDescription")})]}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>k(null),children:s("shell.workspaceDetailDebugLaunchPlanDismissAction")})]}),e.jsxs("div",{className:"workbench-manage-kv-list",children:[e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanGeneratedAtLabel")}),e.jsx("span",{children:L(n.generatedAt)})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailDebugLaunchPlanAutoStartLabel")}),e.jsx("span",{children:n.autoStartAllowed?s("shell.workspaceDetailDebugLaunchPlanAutoStartAllowed"):s("shell.workspaceDetailDebugLaunchPlanAutoStartBlocked")})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanRunnableLabel")}),e.jsx("span",{children:n.runnableCount})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanOrchestratedLabel")}),e.jsx("span",{children:n.orchestratedCount})]}),e.jsxs("div",{className:"workbench-manage-kv-item",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugLaunchPlanBlockedLabel")}),e.jsx("span",{children:n.blockedCount})]})]}),e.jsx("p",{className:"workbench-manage-hint",children:s("shell.workspaceDetailRegisteredDebugLaunchPlanNote")}),M?e.jsx("p",{className:"workbench-manage-hint",children:s("shell.workspaceDetailRegisteredDebugLaunchPlanServiceDiscoveryHelp")}):null,n.items.length>0?e.jsx("div",{className:"debug-readiness-runtime-list",children:n.items.map(a=>e.jsxs("article",{className:"debug-readiness-runtime-item",children:[e.jsxs("div",{className:"debug-readiness-runtime-item-header",children:[e.jsx("strong",{children:a.template.name}),e.jsx("span",{children:T(a.template)})]}),e.jsxs("div",{className:"debug-readiness-runtime-item-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:a.template.cwd,children:y(a.template.cwd,r.path)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:A(a.assignedPort)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemRuntimeLabel")}),e.jsx("strong",{children:I(a.template.runtimeType)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemActionLabel")}),e.jsx("strong",{children:K(a.decision)})]})]}),e.jsxs("p",{className:"workbench-manage-hint",children:[s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel"),": ",a.reason]})]},a.template.id))}):e.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")})]}):null,e.jsxs("section",{className:"debug-readiness-section surface-card",children:[e.jsxs("div",{className:"debug-readiness-section-header",children:[e.jsxs("div",{children:[e.jsx("h3",{children:s("shell.workspaceDetailRegisteredDebugTemplatesTitle")}),e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugTemplatesDescription")})]}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>j(se(r.id)),children:s("shell.workspaceDetailRegisteredDebugOpenProcessManagerAction")})]}),l.loading&&l.templates.length===0?e.jsx("p",{className:"workbench-section-empty",children:s("common.loading")}):null,l.error&&l.templates.length===0?e.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:l.error}):null,!l.loading&&l.templates.length===0?e.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")}):null,l.templates.length>0?e.jsx("div",{className:"debug-readiness-service-grid",children:l.templates.map(a=>{const t=O.get(a.id)??null,p=Q(a,t);return e.jsxs("article",{className:"debug-readiness-service-card",children:[e.jsxs("div",{className:"debug-readiness-service-card-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a.name}),e.jsx("p",{title:a.cwd,children:y(a.cwd,r.path)})]}),e.jsx("span",{className:"debug-readiness-chip","data-tone":p,children:U(a,t)})]}),e.jsxs("div",{className:"debug-readiness-service-card-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:a.cwd,children:y(a.cwd,r.path)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:A(a.port)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplateRuntimeTypeLabel")}),e.jsx("strong",{children:I(a.runtimeType)})]}),e.jsxs("div",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugRuntimeProcessLabel")}),e.jsx("strong",{children:X(t)})]})]}),e.jsxs("div",{className:"debug-readiness-service-card-list",children:[e.jsxs("p",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemCommandLabel")}),e.jsx("strong",{children:T(a)})]}),e.jsxs("p",{children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel")}),e.jsx("strong",{children:Y(a,t)})]})]})]},a.id)})}):null]})]})});async function B(){m("sync"),o(null);try{await l.refreshAll(),k(null),d({title:s("shell.workspaceDetailRegisteredDebugActionSyncTemplatesSuccess"),tone:"success"})}catch(a){const t=x(a,s("shell.workspaceDetailRegisteredDebugActionSyncTemplatesFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}async function F(){m("plan"),o(null);try{if(!b.targetId)throw new Error(s("shell.workspaceDetailDebugActionTargetMissing"));const a=await C(b.targetId),t=R(l.templates,l.runtimeStatuses,a);k(t),d({title:s("shell.workspaceDetailDebugActionPlanSuccess"),tone:"info"})}catch(a){const t=x(a,s("shell.workspaceDetailDebugActionPlanFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}async function W(){var a,t;m("run"),o(null);try{const p=n??(b.targetId?R(l.templates,l.runtimeStatuses,await C(b.targetId)):R(l.templates,l.runtimeStatuses));k(p);const D=p.items.filter(i=>i.decision!=="blocked");if(D.length===0){const i=s("shell.workspaceDetailRegisteredDebugActionRunRegisteredSkipped");o(i),d({title:i,tone:"info"});return}const v=[];for(const i of D)try{await ae(i.template.id,{runtimeType:i.template.runtimeType??void 0,argsOverride:(a=i.planItem)==null?void 0:a.args,envPatch:(t=i.planItem)==null?void 0:t.envPatch,portOverride:i.assignedPort})}catch(G){v.push(`${i.template.name}: ${x(G,s("shell.workspaceDetailRegisteredDebugActionRunRegisteredFailed"))}`)}if(await l.refreshRuntime(),v.length>0)throw new Error(v.join(";"));d({title:s("shell.workspaceDetailRegisteredDebugActionRunRegisteredSuccess"),tone:"success"})}catch(p){const D=x(p,s("shell.workspaceDetailRegisteredDebugActionRunRegisteredFailed"));o(D),d({title:D,tone:"error"})}finally{m(null)}}async function V(){m("refresh"),o(null);try{await l.refreshRuntime(),d({title:s("shell.workspaceDetailDebugActionRefreshSuccess"),tone:"success"})}catch(a){const t=x(a,s("shell.workspaceDetailRegisteredDebugActionRefreshFailed"));o(t),d({title:t,tone:"error"})}finally{m(null)}}}function x(u,j){return u instanceof Error&&u.message.trim()?u.message:j}export{be as WorkspaceDebugDetailPage};
@@ -1 +1 @@
1
- import{b as d,j as e,t as s}from"./index-oGylLBIX.js";import{u as J,b as N,v as Q,x as U,y as Y,o as ee,t as se,z as ae,s as L,A as le,C as ie,c as oe,g as O}from"./WorkbenchLayout-Dybarc1V.js";import{a as F,r as ne}from"./model-switch-api-T55eW6D4.js";import{b as te,f as re,a as ce,c as de,d as me,e as he,g as ue,h as pe,i as be,u as je,j as ge,D as xe}from"./useRegisteredDebugTemplates-O-ymgLd9.js";import{g as ke}from"./terminal-runtime-meta-Cvt1ID92.js";import{f as fe,a as ve,M as we}from"./MobileWorkspaceSwitcherHeader-Cczi7RYu.js";import{M as Ne}from"./MobileCreateSessionSheet-THIrIzJ3.js";import{c as Ce,u as ye,f as Re}from"./App-C2lNmeKL.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-DMQutm1x.js";import"./relay-entry-sdeFnTbY.js";import"./MobileTopHeaderFrame-D-X7pVnV.js";function De({workspaceId:a,workspacePath:o,state:t,onOpenProcessManager:b}){const u=d.useMemo(()=>te(t.templates,t.runtimeStatuses),[t.runtimeStatuses,t.templates]),k=d.useMemo(()=>new Map(t.runtimeStatuses.map(c=>[c.templateId,c])),[t.runtimeStatuses]);return e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.workspaceDetailRegisteredDebugTemplatesTitle")})}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>b(a),children:s("shell.workspaceDetailRegisteredDebugOpenProcessManagerAction")})]}),e.jsx("p",{className:"mobile-workspace-composition-note",children:s("shell.workspaceDetailRegisteredDebugTemplatesDescription")}),e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailDebugOverallStatusLabel")}),e.jsx("strong",{children:re(u,t.templates.length)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRegisteredCountLabel")}),e.jsx("strong",{children:t.templates.length})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRunnableCountLabel")}),e.jsx("strong",{children:u.runnableCount})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryOrchestratedCountLabel")}),e.jsx("strong",{children:u.orchestratedCount})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryBlockedCountLabel")}),e.jsx("strong",{children:u.blockedCount})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryLastRefreshLabel")}),e.jsx("strong",{children:ce(t.lastRefreshedAt)})]})]}),t.loading&&t.templates.length===0?e.jsx("p",{children:s("common.loading")}):null,t.error&&t.templates.length===0?e.jsx("p",{className:"status-text","data-tone":"error",children:t.error}):null,!t.loading&&t.templates.length===0?e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")}):null,t.templates.length>0?e.jsx("div",{className:"mobile-feature-stack",children:t.templates.map(c=>{const m=k.get(c.id)??null;return e.jsxs("article",{className:"surface-card mobile-session-row",children:[e.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[e.jsx("span",{className:"mobile-session-row-title",children:c.name}),e.jsx("span",{className:"mobile-session-row-provider",children:de(c,m)})]}),e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:c.cwd,children:me(c.cwd,o)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:he(c.port)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplateRuntimeTypeLabel")}),e.jsx("strong",{children:ke(c.runtimeType)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugRuntimeProcessLabel")}),e.jsx("strong",{children:ue(m)})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemCommandLabel")}),e.jsx("strong",{children:pe(c)})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel")}),e.jsx("strong",{children:be(c,m)})]})]})]},c.id)})}):null]})}function We(a){return a.isArchived!==!0&&!O(a)}function Me(a){return a.isArchived===!0&&!O(a)}const C=60*1e3,y=10;function ze(){var E;const{workspaceId:a=""}=Ce(),o=ye(),{showToast:t}=Re(),{navigationGroups:b,currentWorkspaceId:u,favoriteSessionIds:k,workspaceManagementStateById:c,selectWorkspace:m,subscribeGitSnapshot:R,requestGitRefresh:D,subscribeWorkspaceManagementSnapshot:W,requestWorkspaceManagementRefresh:M,toggleFavoriteSession:_,archiveSession:G,unarchiveSession:V,startDraftSession:H}=J(),[S,T]=d.useState(!1),[Z,f]=d.useState(!1),[A,P]=d.useState(y),v=fe(b),h=ve(b,a),i=(h==null?void 0:h.workspace)??null,p=v.find(l=>l.workspace.id===(i==null?void 0:i.id))??(i?{workspace:i,label:i.name,subtitle:i.path}:null),w=d.useMemo(()=>[...(h==null?void 0:h.sessions)??[]].filter(We),[h]),g=d.useMemo(()=>[...(h==null?void 0:h.sessions)??[]].filter(Me),[h]);d.useEffect(()=>{a&&m(a)},[m,a]),d.useEffect(()=>{if(!a)return;const l=N(Ae(a),C),r=N(B(a),C);R(a,{knownRevision:(l==null?void 0:l.revision)??null}),W(a,{knownRevision:(r==null?void 0:r.revision)??null}),l||D(a),r||M(a)},[D,M,R,W,a]),d.useEffect(()=>{P(y)},[a]);const n=d.useMemo(()=>{if(!a)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const l=N(B(a),C),r=c[a]??null,j=(r==null?void 0:r.detail)??(i?Pe(i,l):l??null);return{loading:(r==null?void 0:r.loading)??!1,error:(r==null?void 0:r.error)??null,hasMeaningfulSummary:Ie(j),summary:j}},[i,a,c]),x=d.useMemo(()=>n.summary?Q(n.summary.codeComposition.items,s("shell.manageWorkspaceCodeCompositionOther")):[],[n.summary]),K=d.useMemo(()=>x.length>0?U(x):void 0,[x]),I=d.useMemo(()=>g.slice(0,A),[g,A]),q=je(i?{id:i.id,path:i.path,name:i.name}:null),$=ge(i?{id:i.id,path:i.path,name:i.name}:null);async function z(){if(!(!i||!(typeof window>"u"||window.confirm(s("shell.manageWorkspaceRemoveConfirmTarget",{name:i.name}))))){T(!0);try{await ne(i.id),t({title:s("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),o("/workspaces",{replace:!0})}catch(r){t({title:r instanceof Error?r.message:s("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{T(!1)}}}function X(l,r){f(!1),H(l,r)}return i?e.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[e.jsx(we,{currentWorkspace:p?{id:p.workspace.id,name:p.label,path:p.subtitle}:null,workspaces:b.map(l=>l.workspace),workspaceOptions:v,heading:s("shell.workspaceDetailTitle"),triggerLabel:(p==null?void 0:p.label)??i.name,onSelectWorkspace:l=>{m(l),o(se(l))},content:e.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[e.jsx("button",{type:"button",className:"primary-button",onClick:()=>f(!0),children:s("shell.createSession")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(Y(i.id))},children:s("shell.filesEntry")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(ee(i.id))},children:s("shell.terminalsEntry")})]})}),e.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.workspaceDetailSummaryTitle")})}),u!==i.id?e.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>m(i.id),children:s("shell.switchWorkspace")}):null]}),n.loading&&n.summary===null?e.jsx("p",{children:s("common.loading")}):null,n.error?e.jsx("p",{className:"status-text","data-tone":"error",children:n.error}):null,n.summary?e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.manageWorkspacePathLabel")}),e.jsx("strong",{title:n.summary.path,children:n.summary.path})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceCurrentBranch")}),e.jsx("strong",{title:n.summary.git.currentBranch??s("common.unknown"),children:n.summary.git.currentBranch??s("common.unknown")})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceGitCommitCount")}),e.jsx("strong",{children:n.hasMeaningfulSummary?n.summary.git.commitCount??0:"—"})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceCodeCompositionFiles")}),e.jsx("strong",{children:n.hasMeaningfulSummary?n.summary.codeComposition.scannedFileCount:"—"})]})]}):null,e.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(ae(i.id))},children:s("shell.gitEntry")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(L(i.id))},children:s("shell.terminalManagerEntry")}),e.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:S,onClick:()=>{z()},children:S?s("shell.manageWorkspaceRemoving"):s("shell.manageWorkspaceRemoveAction")})]})]}),e.jsx(xe,{workspace:i?{id:i.id,path:i.path,name:i.name}:null,state:q,variant:"mobile"}),i?e.jsx(De,{workspaceId:i.id,workspacePath:i.path,state:$,onOpenProcessManager:l=>{m(l),o(L(l))}}):null,e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.manageWorkspaceCodeCompositionLabel")})}),n.summary?e.jsx("span",{className:"mobile-feature-counter",children:n.summary.codeComposition.scannedFileCount}):null]}),n.loading&&n.summary===null?e.jsx("p",{children:s("common.loading")}):null,n.summary?x.length>0?e.jsxs("div",{className:"workbench-manage-type-chart",children:[e.jsxs("div",{className:"workbench-manage-type-chart-ring",style:K,"aria-hidden":"true",children:[e.jsx("strong",{className:"workbench-manage-type-chart-total",children:n.summary.codeComposition.scannedFileCount}),e.jsx("span",{className:"workbench-manage-type-chart-caption",children:s("shell.manageWorkspaceCodeCompositionFiles")})]}),e.jsx("div",{className:"workbench-manage-type-list",children:x.map(l=>e.jsxs("div",{className:"workbench-manage-type-item",children:[e.jsxs("span",{className:"workbench-manage-type-meta",children:[e.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:l.color},"aria-hidden":"true"}),e.jsx("span",{className:"workbench-manage-type-name",children:l.type})]}),e.jsxs("span",{children:[l.count," · ",le(l)]})]},l.key))})]}):e.jsx("p",{children:n.summary.codeComposition.error??s("shell.manageWorkspaceNoCodeComposition")}):null,(E=n.summary)!=null&&E.codeComposition.truncated?e.jsx("p",{className:"mobile-workspace-composition-note",children:s("shell.manageWorkspaceCodeTruncated",{count:n.summary.codeComposition.scannedFileCount})}):null]}),e.jsxs("section",{className:"mobile-feature-section",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.recentSessionsSectionTitle")})}),e.jsx("span",{className:"mobile-feature-counter",children:w.length})]}),e.jsx("div",{className:"mobile-feature-stack",children:w.length===0?e.jsx("article",{className:"mobile-feature-empty surface-card",children:e.jsx("p",{children:s("shell.emptyWorkspaceSessions")})}):w.map(l=>{const r=ie(l.title,s("common.unknown")),j=k.includes(l.sessionId);return e.jsxs("article",{className:"mobile-session-row surface-card",children:[e.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>o(oe(i.id,l.sessionId)),children:[e.jsx("span",{className:"mobile-session-row-title",title:r.fullTitle,children:r.displayTitle}),e.jsx("span",{className:"mobile-session-row-provider",children:F(l.provider)})]}),e.jsxs("div",{className:"mobile-session-row-actions",children:[e.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:l.messageCount}),e.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":j?s("shell.unfavoriteAction"):s("shell.favoriteAction"),title:j?s("shell.unfavoriteAction"):s("shell.favoriteAction"),onClick:()=>{_(l.sessionId)},children:e.jsx(Se,{active:j})}),e.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":s("shell.archiveAction"),title:s("shell.archiveAction"),onClick:()=>{G(l.sessionId)},children:e.jsx(Te,{})})]})]},l.sessionId)})})]}),g.length>0?e.jsxs("section",{className:"mobile-feature-section",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.archiveModalTitle")})}),e.jsx("span",{className:"mobile-feature-counter",children:g.length})]}),e.jsx("div",{className:"mobile-feature-stack",children:I.map(l=>e.jsxs("article",{className:"mobile-session-row surface-card",children:[e.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[e.jsx("span",{className:"mobile-session-row-title",title:l.title,children:l.title}),e.jsx("span",{className:"mobile-session-row-provider",children:F(l.provider)})]}),e.jsx("div",{className:"mobile-session-row-actions",children:e.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{V(l.sessionId)},children:s("shell.unarchiveAction")})})]},l.sessionId))}),I.length<g.length?e.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{P(l=>l+y)},children:s("shell.archiveExpandMore")}):null]}):null]}),e.jsx(Ne,{open:Z,workspaces:b.map(l=>l.workspace),workspaceOptions:v,initialWorkspaceId:u??i.id,onClose:()=>f(!1),onSelect:X})]}):e.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:e.jsxs("article",{className:"mobile-feature-empty surface-card",children:[e.jsx("h1",{children:s("shell.workspaceDetailMissingTitle")}),e.jsx("p",{children:s("shell.workspaceDetailMissingBody")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>o("/workspaces"),children:s("shell.mobileWorkspacesEntry")})]})})}function Se({active:a}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function Te(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("path",{d:"M4 7.5h16"}),e.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),e.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),e.jsx("path",{d:"M10 11.5h4"})]})}function B(a){return`workspace-management.summary.${a}`}function Ae(a){return`git-sidebar.snapshot.${a}`}function Pe(a,o){const t=(o==null?void 0:o.git.repoRoot)??a.repoRoot??null;return{workspaceId:a.id,name:a.name,path:a.path,git:{isRepository:(o==null?void 0:o.git.isRepository)??!!t,repoRoot:t,currentBranch:(o==null?void 0:o.git.currentBranch)??null,commitCount:(o==null?void 0:o.git.commitCount)??null,remotes:(o==null?void 0:o.git.remotes)??[],error:(o==null?void 0:o.git.error)??null},codeComposition:(o==null?void 0:o.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function Ie(a){return a?a.git.isRepository||a.git.repoRoot!==null||a.git.currentBranch!==null||a.git.commitCount!==null||a.git.remotes.length>0||a.codeComposition.scannedFileCount>0||a.codeComposition.items.length>0||a.codeComposition.error!==null:!1}export{ze as WorkspaceDetailPage};
1
+ import{b as d,j as e,t as s}from"./index-DvkfRpBe.js";import{u as J,b as N,v as Q,x as U,y as Y,o as ee,t as se,z as ae,s as L,A as le,C as ie,c as oe,g as O}from"./WorkbenchLayout-Cht6Un5X.js";import{a as F,r as ne}from"./model-switch-api-Dps4yN2t.js";import{b as te,f as re,a as ce,c as de,d as me,e as he,g as ue,h as pe,i as be,u as je,j as ge,D as xe}from"./useRegisteredDebugTemplates-DVQBPV-V.js";import{g as ke}from"./terminal-runtime-meta-C3Mr0zW5.js";import{f as fe,a as ve,M as we}from"./MobileWorkspaceSwitcherHeader-CWPXAMoX.js";import{M as Ne}from"./MobileCreateSessionSheet-Bp4xOKdt.js";import{c as Ce,u as ye,f as Re}from"./App-BRupl2Ul.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./WorkbenchModal-CAj_TqWW.js";import"./relay-entry-WiotM2TL.js";import"./MobileTopHeaderFrame-BawK1vUE.js";function De({workspaceId:a,workspacePath:o,state:t,onOpenProcessManager:b}){const u=d.useMemo(()=>te(t.templates,t.runtimeStatuses),[t.runtimeStatuses,t.templates]),k=d.useMemo(()=>new Map(t.runtimeStatuses.map(c=>[c.templateId,c])),[t.runtimeStatuses]);return e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.workspaceDetailRegisteredDebugTemplatesTitle")})}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>b(a),children:s("shell.workspaceDetailRegisteredDebugOpenProcessManagerAction")})]}),e.jsx("p",{className:"mobile-workspace-composition-note",children:s("shell.workspaceDetailRegisteredDebugTemplatesDescription")}),e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailDebugOverallStatusLabel")}),e.jsx("strong",{children:re(u,t.templates.length)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRegisteredCountLabel")}),e.jsx("strong",{children:t.templates.length})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryRunnableCountLabel")}),e.jsx("strong",{children:u.runnableCount})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryOrchestratedCountLabel")}),e.jsx("strong",{children:u.orchestratedCount})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryBlockedCountLabel")}),e.jsx("strong",{children:u.blockedCount})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugSummaryLastRefreshLabel")}),e.jsx("strong",{children:ce(t.lastRefreshedAt)})]})]}),t.loading&&t.templates.length===0?e.jsx("p",{children:s("common.loading")}):null,t.error&&t.templates.length===0?e.jsx("p",{className:"status-text","data-tone":"error",children:t.error}):null,!t.loading&&t.templates.length===0?e.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugTemplatesEmpty")}):null,t.templates.length>0?e.jsx("div",{className:"mobile-feature-stack",children:t.templates.map(c=>{const m=k.get(c.id)??null;return e.jsxs("article",{className:"surface-card mobile-session-row",children:[e.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[e.jsx("span",{className:"mobile-session-row-title",children:c.name}),e.jsx("span",{className:"mobile-session-row-provider",children:de(c,m)})]}),e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePathLabel")}),e.jsx("strong",{title:c.cwd,children:me(c.cwd,o)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplatePortLabel")}),e.jsx("strong",{children:he(c.port)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugTemplateRuntimeTypeLabel")}),e.jsx("strong",{children:ke(c.runtimeType)})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugRuntimeProcessLabel")}),e.jsx("strong",{children:ue(m)})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemCommandLabel")}),e.jsx("strong",{children:pe(c)})]}),e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.workspaceDetailRegisteredDebugPlanItemReasonLabel")}),e.jsx("strong",{children:be(c,m)})]})]})]},c.id)})}):null]})}function We(a){return a.isArchived!==!0&&!O(a)}function Me(a){return a.isArchived===!0&&!O(a)}const C=60*1e3,y=10;function ze(){var E;const{workspaceId:a=""}=Ce(),o=ye(),{showToast:t}=Re(),{navigationGroups:b,currentWorkspaceId:u,favoriteSessionIds:k,workspaceManagementStateById:c,selectWorkspace:m,subscribeGitSnapshot:R,requestGitRefresh:D,subscribeWorkspaceManagementSnapshot:W,requestWorkspaceManagementRefresh:M,toggleFavoriteSession:_,archiveSession:G,unarchiveSession:V,startDraftSession:H}=J(),[S,T]=d.useState(!1),[Z,f]=d.useState(!1),[A,P]=d.useState(y),v=fe(b),h=ve(b,a),i=(h==null?void 0:h.workspace)??null,p=v.find(l=>l.workspace.id===(i==null?void 0:i.id))??(i?{workspace:i,label:i.name,subtitle:i.path}:null),w=d.useMemo(()=>[...(h==null?void 0:h.sessions)??[]].filter(We),[h]),g=d.useMemo(()=>[...(h==null?void 0:h.sessions)??[]].filter(Me),[h]);d.useEffect(()=>{a&&m(a)},[m,a]),d.useEffect(()=>{if(!a)return;const l=N(Ae(a),C),r=N(B(a),C);R(a,{knownRevision:(l==null?void 0:l.revision)??null}),W(a,{knownRevision:(r==null?void 0:r.revision)??null}),l||D(a),r||M(a)},[D,M,R,W,a]),d.useEffect(()=>{P(y)},[a]);const n=d.useMemo(()=>{if(!a)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const l=N(B(a),C),r=c[a]??null,j=(r==null?void 0:r.detail)??(i?Pe(i,l):l??null);return{loading:(r==null?void 0:r.loading)??!1,error:(r==null?void 0:r.error)??null,hasMeaningfulSummary:Ie(j),summary:j}},[i,a,c]),x=d.useMemo(()=>n.summary?Q(n.summary.codeComposition.items,s("shell.manageWorkspaceCodeCompositionOther")):[],[n.summary]),K=d.useMemo(()=>x.length>0?U(x):void 0,[x]),I=d.useMemo(()=>g.slice(0,A),[g,A]),q=je(i?{id:i.id,path:i.path,name:i.name}:null),$=ge(i?{id:i.id,path:i.path,name:i.name}:null);async function z(){if(!(!i||!(typeof window>"u"||window.confirm(s("shell.manageWorkspaceRemoveConfirmTarget",{name:i.name}))))){T(!0);try{await ne(i.id),t({title:s("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),o("/workspaces",{replace:!0})}catch(r){t({title:r instanceof Error?r.message:s("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{T(!1)}}}function X(l,r){f(!1),H(l,r)}return i?e.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[e.jsx(we,{currentWorkspace:p?{id:p.workspace.id,name:p.label,path:p.subtitle}:null,workspaces:b.map(l=>l.workspace),workspaceOptions:v,heading:s("shell.workspaceDetailTitle"),triggerLabel:(p==null?void 0:p.label)??i.name,onSelectWorkspace:l=>{m(l),o(se(l))},content:e.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[e.jsx("button",{type:"button",className:"primary-button",onClick:()=>f(!0),children:s("shell.createSession")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(Y(i.id))},children:s("shell.filesEntry")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(ee(i.id))},children:s("shell.terminalsEntry")})]})}),e.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.workspaceDetailSummaryTitle")})}),u!==i.id?e.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>m(i.id),children:s("shell.switchWorkspace")}):null]}),n.loading&&n.summary===null?e.jsx("p",{children:s("common.loading")}):null,n.error?e.jsx("p",{className:"status-text","data-tone":"error",children:n.error}):null,n.summary?e.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[e.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[e.jsx("span",{children:s("shell.manageWorkspacePathLabel")}),e.jsx("strong",{title:n.summary.path,children:n.summary.path})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceCurrentBranch")}),e.jsx("strong",{title:n.summary.git.currentBranch??s("common.unknown"),children:n.summary.git.currentBranch??s("common.unknown")})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceGitCommitCount")}),e.jsx("strong",{children:n.hasMeaningfulSummary?n.summary.git.commitCount??0:"—"})]}),e.jsxs("div",{className:"mobile-detail-metric",children:[e.jsx("span",{children:s("shell.manageWorkspaceCodeCompositionFiles")}),e.jsx("strong",{children:n.hasMeaningfulSummary?n.summary.codeComposition.scannedFileCount:"—"})]})]}):null,e.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(ae(i.id))},children:s("shell.gitEntry")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{m(i.id),o(L(i.id))},children:s("shell.terminalManagerEntry")}),e.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:S,onClick:()=>{z()},children:S?s("shell.manageWorkspaceRemoving"):s("shell.manageWorkspaceRemoveAction")})]})]}),e.jsx(xe,{workspace:i?{id:i.id,path:i.path,name:i.name}:null,state:q,variant:"mobile"}),i?e.jsx(De,{workspaceId:i.id,workspacePath:i.path,state:$,onOpenProcessManager:l=>{m(l),o(L(l))}}):null,e.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.manageWorkspaceCodeCompositionLabel")})}),n.summary?e.jsx("span",{className:"mobile-feature-counter",children:n.summary.codeComposition.scannedFileCount}):null]}),n.loading&&n.summary===null?e.jsx("p",{children:s("common.loading")}):null,n.summary?x.length>0?e.jsxs("div",{className:"workbench-manage-type-chart",children:[e.jsxs("div",{className:"workbench-manage-type-chart-ring",style:K,"aria-hidden":"true",children:[e.jsx("strong",{className:"workbench-manage-type-chart-total",children:n.summary.codeComposition.scannedFileCount}),e.jsx("span",{className:"workbench-manage-type-chart-caption",children:s("shell.manageWorkspaceCodeCompositionFiles")})]}),e.jsx("div",{className:"workbench-manage-type-list",children:x.map(l=>e.jsxs("div",{className:"workbench-manage-type-item",children:[e.jsxs("span",{className:"workbench-manage-type-meta",children:[e.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:l.color},"aria-hidden":"true"}),e.jsx("span",{className:"workbench-manage-type-name",children:l.type})]}),e.jsxs("span",{children:[l.count," · ",le(l)]})]},l.key))})]}):e.jsx("p",{children:n.summary.codeComposition.error??s("shell.manageWorkspaceNoCodeComposition")}):null,(E=n.summary)!=null&&E.codeComposition.truncated?e.jsx("p",{className:"mobile-workspace-composition-note",children:s("shell.manageWorkspaceCodeTruncated",{count:n.summary.codeComposition.scannedFileCount})}):null]}),e.jsxs("section",{className:"mobile-feature-section",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.recentSessionsSectionTitle")})}),e.jsx("span",{className:"mobile-feature-counter",children:w.length})]}),e.jsx("div",{className:"mobile-feature-stack",children:w.length===0?e.jsx("article",{className:"mobile-feature-empty surface-card",children:e.jsx("p",{children:s("shell.emptyWorkspaceSessions")})}):w.map(l=>{const r=ie(l.title,s("common.unknown")),j=k.includes(l.sessionId);return e.jsxs("article",{className:"mobile-session-row surface-card",children:[e.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>o(oe(i.id,l.sessionId)),children:[e.jsx("span",{className:"mobile-session-row-title",title:r.fullTitle,children:r.displayTitle}),e.jsx("span",{className:"mobile-session-row-provider",children:F(l.provider)})]}),e.jsxs("div",{className:"mobile-session-row-actions",children:[e.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:l.messageCount}),e.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":j?s("shell.unfavoriteAction"):s("shell.favoriteAction"),title:j?s("shell.unfavoriteAction"):s("shell.favoriteAction"),onClick:()=>{_(l.sessionId)},children:e.jsx(Se,{active:j})}),e.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":s("shell.archiveAction"),title:s("shell.archiveAction"),onClick:()=>{G(l.sessionId)},children:e.jsx(Te,{})})]})]},l.sessionId)})})]}),g.length>0?e.jsxs("section",{className:"mobile-feature-section",children:[e.jsxs("div",{className:"mobile-feature-section-header",children:[e.jsx("div",{children:e.jsx("h2",{children:s("shell.archiveModalTitle")})}),e.jsx("span",{className:"mobile-feature-counter",children:g.length})]}),e.jsx("div",{className:"mobile-feature-stack",children:I.map(l=>e.jsxs("article",{className:"mobile-session-row surface-card",children:[e.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[e.jsx("span",{className:"mobile-session-row-title",title:l.title,children:l.title}),e.jsx("span",{className:"mobile-session-row-provider",children:F(l.provider)})]}),e.jsx("div",{className:"mobile-session-row-actions",children:e.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{V(l.sessionId)},children:s("shell.unarchiveAction")})})]},l.sessionId))}),I.length<g.length?e.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{P(l=>l+y)},children:s("shell.archiveExpandMore")}):null]}):null]}),e.jsx(Ne,{open:Z,workspaces:b.map(l=>l.workspace),workspaceOptions:v,initialWorkspaceId:u??i.id,onClose:()=>f(!1),onSelect:X})]}):e.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:e.jsxs("article",{className:"mobile-feature-empty surface-card",children:[e.jsx("h1",{children:s("shell.workspaceDetailMissingTitle")}),e.jsx("p",{children:s("shell.workspaceDetailMissingBody")}),e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>o("/workspaces"),children:s("shell.mobileWorkspacesEntry")})]})})}function Se({active:a}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function Te(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("path",{d:"M4 7.5h16"}),e.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),e.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),e.jsx("path",{d:"M10 11.5h4"})]})}function B(a){return`workspace-management.summary.${a}`}function Ae(a){return`git-sidebar.snapshot.${a}`}function Pe(a,o){const t=(o==null?void 0:o.git.repoRoot)??a.repoRoot??null;return{workspaceId:a.id,name:a.name,path:a.path,git:{isRepository:(o==null?void 0:o.git.isRepository)??!!t,repoRoot:t,currentBranch:(o==null?void 0:o.git.currentBranch)??null,commitCount:(o==null?void 0:o.git.commitCount)??null,remotes:(o==null?void 0:o.git.remotes)??[],error:(o==null?void 0:o.git.error)??null},codeComposition:(o==null?void 0:o.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function Ie(a){return a?a.git.isRepository||a.git.repoRoot!==null||a.git.currentBranch!==null||a.git.commitCount!==null||a.git.remotes.length>0||a.codeComposition.scannedFileCount>0||a.codeComposition.items.length>0||a.codeComposition.error!==null:!1}export{ze as WorkspaceDetailPage};
@@ -1 +1 @@
1
- import{b as r,j as e,t}from"./index-oGylLBIX.js";import{u as Be,i as re,b as y,w as ie,B as oe,c as ne,d as Fe,e as Oe,f as qe,g as Ue,h as De,j as Ve,l as Ke,k as Ge,n as We,o as Qe,p as Xe,q as $e,s as ze,t as H}from"./WorkbenchLayout-Dybarc1V.js";import{s as Je}from"./butler-records-events-DgWCG364.js";import{a as se}from"./model-switch-api-T55eW6D4.js";import{f as Ye,a as te,M as Ze}from"./MobileWorkspaceSwitcherHeader-Cczi7RYu.js";import{u as ei,f as ii}from"./App-C2lNmeKL.js";import{M as oi}from"./MobileCreateSessionSheet-THIrIzJ3.js";import{W as ni}from"./WorkbenchModal-DMQutm1x.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-sdeFnTbY.js";import"./MobileTopHeaderFrame-D-X7pVnV.js";function si(n){return n.status==="active"}function ti(n){return n.status==="queued"||n.status==="running"}function ai(n,m){return n.filter(si).length+m.filter(ti).length}function li(n){const m=r.useMemo(()=>n.notifications.filter(a=>n.showArchivedNotifications||!n.archivedNotificationIds.has(a.id)),[n.archivedNotificationIds,n.notifications,n.showArchivedNotifications]);return e.jsx(ni,{open:n.open,title:t("shell.globalNotificationsPanelTitle"),description:t("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card mobile-notification-modal-card",onClose:n.onClose,children:e.jsxs("div",{className:"workbench-notification-pane mobile-notification-pane",role:"tabpanel","aria-label":t("shell.globalNotificationsAction"),children:[e.jsx("div",{className:"workbench-notification-toolbar",children:e.jsxs("label",{className:"workbench-notification-filter",children:[e.jsx("input",{type:"checkbox",checked:n.showArchivedNotifications,onChange:a=>n.onToggleShowArchivedNotifications(a.target.checked)}),e.jsx("span",{children:t("shell.globalNotificationsShowArchived")})]})}),m.length>0?e.jsx("div",{className:"workbench-notification-list",children:m.map(a=>{const u=n.archivedNotificationIds.has(a.id);return e.jsxs("article",{className:"workbench-notification-item","data-archived":u,children:[e.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{n.onSelectNotification(a)},children:[e.jsx("span",{className:"workbench-notification-item-kind",children:ci(a.kind)}),e.jsx("strong",{children:a.title}),e.jsx("p",{children:a.body})]}),e.jsxs("div",{className:"workbench-notification-item-side",children:[e.jsx("time",{children:ri(a.createdAt)}),e.jsx("button",{type:"button",className:"secondary-button workbench-notification-item-action-button",onClick:()=>{if(u){n.onUnarchiveNotification(a.id);return}n.onArchiveNotification(a.id)},children:u?t("shell.globalNotificationsRemoveArchiveAction"):t("shell.globalNotificationsArchiveAction")})]})]},a.id)})}):e.jsx("p",{className:"workbench-notification-empty",children:t("shell.globalNotificationsEmpty")})]})})}function ci(n){switch(n){case"follow_up_waiting_user":return t("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return t("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return t("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return t("shell.globalNotificationKindVerificationFailed");default:return t("shell.globalNotificationsPanelTitle")}}function ri(n){const m=new Date(n);return Number.isNaN(m.getTime())?n:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(m)}function di(n){return n.isArchived!==!0&&!Ue(n)}function mi(n){return n.activityState==="idle"&&re(n)===!1}function ae(n){return n==="creating"||n==="running"}function le(n){return n.lastEventAt??n.lastMessageAt??n.updatedAt??n.createdAt}function ce(n){return n?new Date(n).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):t("common.unknown")}function x(n){return n!==null&&n>0}const A=60*1e3,ui=15e3;function Si(){var ee;const n=ei(),{showToast:m}=ii(),a=Be(),{navigationGroups:u,currentWorkspaceId:O,refreshNavigation:q,selectWorkspace:p,startDraftSession:de,subscribeGitSnapshot:U,requestGitRefresh:D,addGitSnapshotListener:V,subscribeTerminalManagerSnapshot:K,requestTerminalManagerRefresh:G,addTerminalManagerSnapshotListener:W}=a,me=a.globalNotifications??[],ue=new Set(a.archivedNotificationIds??[]),he=a.showArchivedNotifications??!1,Q=a.unreadNotificationCount??0,pe=a.setShowArchivedNotifications??(()=>{}),be=a.archiveNotification??(()=>{}),fe=a.unarchiveNotification??(()=>{}),[X,b]=r.useState(null),[we,R]=r.useState(!1),[ke,$]=r.useState(!1),[ge,M]=r.useState(!1),[d,g]=r.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),[f,C]=r.useState({loading:!0,activeTaskCount:0,pendingInboxCount:0}),E=Ye(u),j=te(u,O)??te(u,((ee=u[0])==null?void 0:ee.workspace.id)??null),i=(j==null?void 0:j.workspace)??null,I=E.find(o=>o.workspace.id===(i==null?void 0:i.id))??(i?{workspace:i,label:i.name,subtitle:i.path}:null),S=[...(j==null?void 0:j.sessions)??[]].filter(di),P=S.filter(re),z=S.filter(mi),ve=S.filter(o=>o.isFavorite===!0),J=P.slice(0,6),Y=ve.slice(0,6),Ne=d.quickLaunchRunning===null?"…":d.quickLaunchRunning?t("shell.workspaceHomeQuickLaunchRunning"):t("shell.workspaceHomeQuickLaunchStopped");r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const s=y(B(o),A);g(c=>{var l,v,w;return{...c,gitLoading:s===null,branch:((l=s==null?void 0:s.status)==null?void 0:l.snapshot.enabled)===!1?null:((v=s==null?void 0:s.status)==null?void 0:v.snapshot.branch)??null,changedFileCount:((w=s==null?void 0:s.status)==null?void 0:w.changes.length)??null}})},[i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(o)return V(s=>{s.workspaceId===o&&(ie(B(o),s),g(c=>{var l,v,w,T;return{...c,gitLoading:!1,branch:((l=s.status)==null?void 0:l.snapshot.enabled)===!1?null:((v=s.status)==null?void 0:v.snapshot.branch)??((w=s.branches)==null?void 0:w.currentBranch)??null,changedFileCount:((T=s.status)==null?void 0:T.changes.length)??null}}))})},[V,i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g(c=>({...c,gitLoading:!1,branch:null,changedFileCount:null}));return}const s=y(F(o),A);g(c=>({...c,terminalLoading:s===null,activeTerminalCount:s?s.terminals.filter(l=>ae(l.status)).length:null,quickLaunchRunning:s?s.templateStatuses.some(l=>l.occupied):null}))},[i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g(s=>({...s,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return W(s=>{s.workspaceId===o&&(ie(F(o),{revision:s.revision??null,terminals:s.terminals,templates:s.templates,templateStatuses:s.templateStatuses}),g(c=>({...c,terminalLoading:!1,activeTerminalCount:s.terminals.filter(l=>ae(l.status)).length,quickLaunchRunning:s.templateStatuses.some(l=>l.occupied)})))})},[W,i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o)return;const s=y(B(o),A);U(o,{knownRevision:(s==null?void 0:s.revision)??null}),!s&&D(o)},[i==null?void 0:i.id,D,U]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o)return;const s=y(F(o),A);K(o,{knownRevision:(s==null?void 0:s.revision)??null}),!s&&G(o)},[i==null?void 0:i.id,G,K]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){C({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}let s=!1;async function c(T){C(N=>({...N,loading:!0}));try{const N=await De();if(!N.initialized||!N.profile){s||C({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}const[L,Ee,Pe]=await Promise.all([Ve(),Ke(),Ge({workspaceId:o})]);if(s)return;const _e=new Set(L.overview.projects.filter(h=>h.workspaceId===o).map(h=>h.id)),He=L.overview.verifications.filter(h=>h.projectId?_e.has(h.projectId):!1);C({loading:!1,activeTaskCount:ai(Ee.items.filter(h=>h.workspaceId===o),He),pendingInboxCount:Pe.items.filter(h=>h.status!=="closed").length})}catch(N){if(s)return;C(L=>({...L,loading:!1})),T&&m({title:t("shell.butlerLoadFailed"),description:N instanceof Error?N.message:void 0,tone:"error"})}}c(!0);const l=window.setInterval(()=>{c(!1)},ui),v=Je(()=>{c(!1)}),w=()=>{c(!1)};return window.addEventListener(oe,w),()=>{s=!0,window.clearInterval(l),v(),window.removeEventListener(oe,w)}},[i==null?void 0:i.id,m]);async function xe(o){await q(),p(o.id),b(null),n(H(o.id))}async function je(o){await q(),p(o.id),b(null),n(H(o.id))}function Ce(){i&&(p(i.id),n(Xe(i.id,"git")))}function Se(){i&&(p(i.id),n(Qe(i.id)))}function Ie(){i&&(p(i.id),n(ze(i.id)))}function Te(){i&&(p(i.id),n($e(i.id)))}function _(){i&&n(We(i.id))}function Z(){i&&R(!0)}function Le(o,s){R(!1),de(o,s)}function ye(){i&&(p(i.id),n(H(i.id)))}function Ae(o){p(o)}const Re=[{label:t("shell.workspaceHomeMetricActive"),value:P.length,accent:x(P.length),onClick:S.length>0?_:void 0},{label:t("shell.workspaceHomeMetricUnread"),value:Q,accent:x(Q),onClick:()=>M(!0)},{label:t("shell.workspaceHomeMetricTerminal"),value:d.terminalLoading?"…":d.activeTerminalCount??"—",accent:d.terminalLoading===!1&&x(d.activeTerminalCount),onClick:i?Se:void 0},{label:t("shell.workspaceHomeMetricChanges"),value:d.gitLoading?"…":d.changedFileCount??"—",accent:d.gitLoading===!1&&x(d.changedFileCount),onClick:i?Ce:void 0}],Me=[{label:t("shell.workspaceHomeWaitingInputLabel"),value:z.length,accent:x(z.length),onClick:S.length>0?_:void 0},{label:t("shell.workspaceHomeButlerLabel"),value:f.loading?"…":f.activeTaskCount,accent:f.loading===!1&&x(f.activeTaskCount),onClick:i?Te:void 0},{label:t("shell.workspaceHomeQuickLaunchStatusLabel"),value:Ne,accent:d.quickLaunchRunning===!0,onClick:i?Ie:void 0},{label:t("shell.butlerInboxAction"),value:f.loading?"…":f.pendingInboxCount,accent:f.loading===!1&&x(f.pendingInboxCount),onClick:i?()=>$(!0):void 0}];return e.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[e.jsx(Ze,{currentWorkspace:I?{id:I.workspace.id,name:I.label,path:I.subtitle}:null,workspaces:u.map(o=>o.workspace),workspaceOptions:E,onSelectWorkspace:Ae,sheetContent:o=>e.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{o(),b("import")},children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.importWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}),e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{o(),b("clone")},children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.cloneWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]})]})}),i?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":t("shell.workspaceHomeStatusSectionTitle"),children:e.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:Re.map(o=>o.onClick?e.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric","data-accent":o.accent?"true":void 0,onClick:o.onClick,children:[e.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:o.value}),e.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:o.label})]},o.label):e.jsxs("div",{className:"mobile-workspace-home-toolbar-metric","data-accent":o.accent?"true":void 0,role:"listitem",children:[e.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:o.value}),e.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:o.label})]},o.label))})})}),e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:ye,children:t("shell.workspaceDetailTitle")}),e.jsx("button",{type:"button",className:"primary-button",onClick:Z,children:t("shell.createSession")})]})}),e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsx("div",{className:"mobile-workspace-home-group",children:Me.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row","data-accent":o.accent?"true":void 0,onClick:o.onClick,children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:o.label}),e.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[e.jsx("strong",{children:o.value}),e.jsx(k,{})]})]},o.label))})}),e.jsxs("section",{className:"mobile-workspace-home-section",children:[e.jsxs("div",{className:"mobile-workspace-home-section-header",children:[e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.workspaceHomeActiveSessionsSectionTitle")}),i?e.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:_,children:t("shell.workspaceHomeViewAllAction")}):null]}),e.jsx("div",{className:"mobile-workspace-home-group",children:J.length===0?e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:Z,children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:t("shell.createSession")}),e.jsx("span",{className:"mobile-workspace-home-session-meta",children:i.name})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}):J.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>n(ne(i.id,o.sessionId)),children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:o.title||t("common.unknown")}),e.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[se(o.provider,"full")," · ",ce(le(o))]})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]},o.sessionId))})]}),Y.length>0?e.jsxs("section",{className:"mobile-workspace-home-section",children:[e.jsx("div",{className:"mobile-workspace-home-section-header",children:e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.favoriteSectionTitle")})}),e.jsx("div",{className:"mobile-workspace-home-group",children:Y.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>n(ne(i.id,o.sessionId)),children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:o.title||t("common.unknown")}),e.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[se(o.provider,"full")," · ",ce(le(o))]})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]},o.sessionId))})]}):null]})}):e.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:e.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.workspaceHomeSwitcherTitle")}),e.jsxs("div",{className:"mobile-workspace-home-group",children:[e.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("import"),children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.importWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}),e.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("clone"),children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.cloneWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]})]})]})}),e.jsx(Fe,{open:X==="import",onClose:()=>b(null),onImported:xe}),e.jsx(Oe,{open:X==="clone",onClose:()=>b(null),onCloned:je}),e.jsx(oi,{open:we,workspaces:u.map(o=>o.workspace),workspaceOptions:E,initialWorkspaceId:(i==null?void 0:i.id)??O??null,onClose:()=>R(!1),onSelect:Le}),e.jsx(qe,{open:ke,preferredWorkspaceId:(i==null?void 0:i.id)??null,compactComposer:!0,onClose:()=>$(!1)}),e.jsx(li,{open:ge,notifications:me,archivedNotificationIds:ue,showArchivedNotifications:he,onClose:()=>M(!1),onToggleShowArchivedNotifications:pe,onArchiveNotification:be,onUnarchiveNotification:fe,onSelectNotification:o=>{M(!1),o.routePath&&n(o.routePath)}})]})}function B(n){return`git-sidebar.snapshot.${n}`}function F(n){return`terminal-manager.snapshot.${n}`}function k(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}export{Si as WorkspaceHomePage};
1
+ import{b as r,j as e,t}from"./index-DvkfRpBe.js";import{u as Be,i as re,b as y,w as ie,B as oe,c as ne,d as Fe,e as Oe,f as qe,g as Ue,h as De,j as Ve,l as Ke,k as Ge,n as We,o as Qe,p as Xe,q as $e,s as ze,t as H}from"./WorkbenchLayout-Cht6Un5X.js";import{s as Je}from"./butler-records-events-DgWCG364.js";import{a as se}from"./model-switch-api-Dps4yN2t.js";import{f as Ye,a as te,M as Ze}from"./MobileWorkspaceSwitcherHeader-CWPXAMoX.js";import{u as ei,f as ii}from"./App-BRupl2Ul.js";import{M as oi}from"./MobileCreateSessionSheet-Bp4xOKdt.js";import{W as ni}from"./WorkbenchModal-CAj_TqWW.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-WiotM2TL.js";import"./MobileTopHeaderFrame-BawK1vUE.js";function si(n){return n.status==="active"}function ti(n){return n.status==="queued"||n.status==="running"}function ai(n,m){return n.filter(si).length+m.filter(ti).length}function li(n){const m=r.useMemo(()=>n.notifications.filter(a=>n.showArchivedNotifications||!n.archivedNotificationIds.has(a.id)),[n.archivedNotificationIds,n.notifications,n.showArchivedNotifications]);return e.jsx(ni,{open:n.open,title:t("shell.globalNotificationsPanelTitle"),description:t("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card mobile-notification-modal-card",onClose:n.onClose,children:e.jsxs("div",{className:"workbench-notification-pane mobile-notification-pane",role:"tabpanel","aria-label":t("shell.globalNotificationsAction"),children:[e.jsx("div",{className:"workbench-notification-toolbar",children:e.jsxs("label",{className:"workbench-notification-filter",children:[e.jsx("input",{type:"checkbox",checked:n.showArchivedNotifications,onChange:a=>n.onToggleShowArchivedNotifications(a.target.checked)}),e.jsx("span",{children:t("shell.globalNotificationsShowArchived")})]})}),m.length>0?e.jsx("div",{className:"workbench-notification-list",children:m.map(a=>{const u=n.archivedNotificationIds.has(a.id);return e.jsxs("article",{className:"workbench-notification-item","data-archived":u,children:[e.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{n.onSelectNotification(a)},children:[e.jsx("span",{className:"workbench-notification-item-kind",children:ci(a.kind)}),e.jsx("strong",{children:a.title}),e.jsx("p",{children:a.body})]}),e.jsxs("div",{className:"workbench-notification-item-side",children:[e.jsx("time",{children:ri(a.createdAt)}),e.jsx("button",{type:"button",className:"secondary-button workbench-notification-item-action-button",onClick:()=>{if(u){n.onUnarchiveNotification(a.id);return}n.onArchiveNotification(a.id)},children:u?t("shell.globalNotificationsRemoveArchiveAction"):t("shell.globalNotificationsArchiveAction")})]})]},a.id)})}):e.jsx("p",{className:"workbench-notification-empty",children:t("shell.globalNotificationsEmpty")})]})})}function ci(n){switch(n){case"follow_up_waiting_user":return t("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return t("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return t("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return t("shell.globalNotificationKindVerificationFailed");default:return t("shell.globalNotificationsPanelTitle")}}function ri(n){const m=new Date(n);return Number.isNaN(m.getTime())?n:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(m)}function di(n){return n.isArchived!==!0&&!Ue(n)}function mi(n){return n.activityState==="idle"&&re(n)===!1}function ae(n){return n==="creating"||n==="running"}function le(n){return n.lastEventAt??n.lastMessageAt??n.updatedAt??n.createdAt}function ce(n){return n?new Date(n).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):t("common.unknown")}function x(n){return n!==null&&n>0}const A=60*1e3,ui=15e3;function Si(){var ee;const n=ei(),{showToast:m}=ii(),a=Be(),{navigationGroups:u,currentWorkspaceId:O,refreshNavigation:q,selectWorkspace:p,startDraftSession:de,subscribeGitSnapshot:U,requestGitRefresh:D,addGitSnapshotListener:V,subscribeTerminalManagerSnapshot:K,requestTerminalManagerRefresh:G,addTerminalManagerSnapshotListener:W}=a,me=a.globalNotifications??[],ue=new Set(a.archivedNotificationIds??[]),he=a.showArchivedNotifications??!1,Q=a.unreadNotificationCount??0,pe=a.setShowArchivedNotifications??(()=>{}),be=a.archiveNotification??(()=>{}),fe=a.unarchiveNotification??(()=>{}),[X,b]=r.useState(null),[we,R]=r.useState(!1),[ke,$]=r.useState(!1),[ge,M]=r.useState(!1),[d,g]=r.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),[f,C]=r.useState({loading:!0,activeTaskCount:0,pendingInboxCount:0}),E=Ye(u),j=te(u,O)??te(u,((ee=u[0])==null?void 0:ee.workspace.id)??null),i=(j==null?void 0:j.workspace)??null,I=E.find(o=>o.workspace.id===(i==null?void 0:i.id))??(i?{workspace:i,label:i.name,subtitle:i.path}:null),S=[...(j==null?void 0:j.sessions)??[]].filter(di),P=S.filter(re),z=S.filter(mi),ve=S.filter(o=>o.isFavorite===!0),J=P.slice(0,6),Y=ve.slice(0,6),Ne=d.quickLaunchRunning===null?"…":d.quickLaunchRunning?t("shell.workspaceHomeQuickLaunchRunning"):t("shell.workspaceHomeQuickLaunchStopped");r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const s=y(B(o),A);g(c=>{var l,v,w;return{...c,gitLoading:s===null,branch:((l=s==null?void 0:s.status)==null?void 0:l.snapshot.enabled)===!1?null:((v=s==null?void 0:s.status)==null?void 0:v.snapshot.branch)??null,changedFileCount:((w=s==null?void 0:s.status)==null?void 0:w.changes.length)??null}})},[i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(o)return V(s=>{s.workspaceId===o&&(ie(B(o),s),g(c=>{var l,v,w,T;return{...c,gitLoading:!1,branch:((l=s.status)==null?void 0:l.snapshot.enabled)===!1?null:((v=s.status)==null?void 0:v.snapshot.branch)??((w=s.branches)==null?void 0:w.currentBranch)??null,changedFileCount:((T=s.status)==null?void 0:T.changes.length)??null}}))})},[V,i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g(c=>({...c,gitLoading:!1,branch:null,changedFileCount:null}));return}const s=y(F(o),A);g(c=>({...c,terminalLoading:s===null,activeTerminalCount:s?s.terminals.filter(l=>ae(l.status)).length:null,quickLaunchRunning:s?s.templateStatuses.some(l=>l.occupied):null}))},[i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){g(s=>({...s,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return W(s=>{s.workspaceId===o&&(ie(F(o),{revision:s.revision??null,terminals:s.terminals,templates:s.templates,templateStatuses:s.templateStatuses}),g(c=>({...c,terminalLoading:!1,activeTerminalCount:s.terminals.filter(l=>ae(l.status)).length,quickLaunchRunning:s.templateStatuses.some(l=>l.occupied)})))})},[W,i==null?void 0:i.id]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o)return;const s=y(B(o),A);U(o,{knownRevision:(s==null?void 0:s.revision)??null}),!s&&D(o)},[i==null?void 0:i.id,D,U]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o)return;const s=y(F(o),A);K(o,{knownRevision:(s==null?void 0:s.revision)??null}),!s&&G(o)},[i==null?void 0:i.id,G,K]),r.useEffect(()=>{const o=(i==null?void 0:i.id)??null;if(!o){C({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}let s=!1;async function c(T){C(N=>({...N,loading:!0}));try{const N=await De();if(!N.initialized||!N.profile){s||C({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}const[L,Ee,Pe]=await Promise.all([Ve(),Ke(),Ge({workspaceId:o})]);if(s)return;const _e=new Set(L.overview.projects.filter(h=>h.workspaceId===o).map(h=>h.id)),He=L.overview.verifications.filter(h=>h.projectId?_e.has(h.projectId):!1);C({loading:!1,activeTaskCount:ai(Ee.items.filter(h=>h.workspaceId===o),He),pendingInboxCount:Pe.items.filter(h=>h.status!=="closed").length})}catch(N){if(s)return;C(L=>({...L,loading:!1})),T&&m({title:t("shell.butlerLoadFailed"),description:N instanceof Error?N.message:void 0,tone:"error"})}}c(!0);const l=window.setInterval(()=>{c(!1)},ui),v=Je(()=>{c(!1)}),w=()=>{c(!1)};return window.addEventListener(oe,w),()=>{s=!0,window.clearInterval(l),v(),window.removeEventListener(oe,w)}},[i==null?void 0:i.id,m]);async function xe(o){await q(),p(o.id),b(null),n(H(o.id))}async function je(o){await q(),p(o.id),b(null),n(H(o.id))}function Ce(){i&&(p(i.id),n(Xe(i.id,"git")))}function Se(){i&&(p(i.id),n(Qe(i.id)))}function Ie(){i&&(p(i.id),n(ze(i.id)))}function Te(){i&&(p(i.id),n($e(i.id)))}function _(){i&&n(We(i.id))}function Z(){i&&R(!0)}function Le(o,s){R(!1),de(o,s)}function ye(){i&&(p(i.id),n(H(i.id)))}function Ae(o){p(o)}const Re=[{label:t("shell.workspaceHomeMetricActive"),value:P.length,accent:x(P.length),onClick:S.length>0?_:void 0},{label:t("shell.workspaceHomeMetricUnread"),value:Q,accent:x(Q),onClick:()=>M(!0)},{label:t("shell.workspaceHomeMetricTerminal"),value:d.terminalLoading?"…":d.activeTerminalCount??"—",accent:d.terminalLoading===!1&&x(d.activeTerminalCount),onClick:i?Se:void 0},{label:t("shell.workspaceHomeMetricChanges"),value:d.gitLoading?"…":d.changedFileCount??"—",accent:d.gitLoading===!1&&x(d.changedFileCount),onClick:i?Ce:void 0}],Me=[{label:t("shell.workspaceHomeWaitingInputLabel"),value:z.length,accent:x(z.length),onClick:S.length>0?_:void 0},{label:t("shell.workspaceHomeButlerLabel"),value:f.loading?"…":f.activeTaskCount,accent:f.loading===!1&&x(f.activeTaskCount),onClick:i?Te:void 0},{label:t("shell.workspaceHomeQuickLaunchStatusLabel"),value:Ne,accent:d.quickLaunchRunning===!0,onClick:i?Ie:void 0},{label:t("shell.butlerInboxAction"),value:f.loading?"…":f.pendingInboxCount,accent:f.loading===!1&&x(f.pendingInboxCount),onClick:i?()=>$(!0):void 0}];return e.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[e.jsx(Ze,{currentWorkspace:I?{id:I.workspace.id,name:I.label,path:I.subtitle}:null,workspaces:u.map(o=>o.workspace),workspaceOptions:E,onSelectWorkspace:Ae,sheetContent:o=>e.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{o(),b("import")},children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.importWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}),e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{o(),b("clone")},children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.cloneWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]})]})}),i?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":t("shell.workspaceHomeStatusSectionTitle"),children:e.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:Re.map(o=>o.onClick?e.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric","data-accent":o.accent?"true":void 0,onClick:o.onClick,children:[e.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:o.value}),e.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:o.label})]},o.label):e.jsxs("div",{className:"mobile-workspace-home-toolbar-metric","data-accent":o.accent?"true":void 0,role:"listitem",children:[e.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:o.value}),e.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:o.label})]},o.label))})})}),e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:ye,children:t("shell.workspaceDetailTitle")}),e.jsx("button",{type:"button",className:"primary-button",onClick:Z,children:t("shell.createSession")})]})}),e.jsx("section",{className:"mobile-workspace-home-section",children:e.jsx("div",{className:"mobile-workspace-home-group",children:Me.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row","data-accent":o.accent?"true":void 0,onClick:o.onClick,children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:o.label}),e.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[e.jsx("strong",{children:o.value}),e.jsx(k,{})]})]},o.label))})}),e.jsxs("section",{className:"mobile-workspace-home-section",children:[e.jsxs("div",{className:"mobile-workspace-home-section-header",children:[e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.workspaceHomeActiveSessionsSectionTitle")}),i?e.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:_,children:t("shell.workspaceHomeViewAllAction")}):null]}),e.jsx("div",{className:"mobile-workspace-home-group",children:J.length===0?e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:Z,children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:t("shell.createSession")}),e.jsx("span",{className:"mobile-workspace-home-session-meta",children:i.name})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}):J.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>n(ne(i.id,o.sessionId)),children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:o.title||t("common.unknown")}),e.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[se(o.provider,"full")," · ",ce(le(o))]})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]},o.sessionId))})]}),Y.length>0?e.jsxs("section",{className:"mobile-workspace-home-section",children:[e.jsx("div",{className:"mobile-workspace-home-section-header",children:e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.favoriteSectionTitle")})}),e.jsx("div",{className:"mobile-workspace-home-group",children:Y.map(o=>e.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>n(ne(i.id,o.sessionId)),children:[e.jsxs("div",{className:"mobile-workspace-home-session-main",children:[e.jsx("span",{className:"mobile-workspace-home-session-title",children:o.title||t("common.unknown")}),e.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[se(o.provider,"full")," · ",ce(le(o))]})]}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]},o.sessionId))})]}):null]})}):e.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:e.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[e.jsx("p",{className:"mobile-workspace-home-section-title",children:t("shell.workspaceHomeSwitcherTitle")}),e.jsxs("div",{className:"mobile-workspace-home-group",children:[e.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("import"),children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.importWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]}),e.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>b("clone"),children:[e.jsx("span",{className:"mobile-workspace-home-row-label",children:t("shell.cloneWorkspaceTitle")}),e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.jsx(k,{})})]})]})]})}),e.jsx(Fe,{open:X==="import",onClose:()=>b(null),onImported:xe}),e.jsx(Oe,{open:X==="clone",onClose:()=>b(null),onCloned:je}),e.jsx(oi,{open:we,workspaces:u.map(o=>o.workspace),workspaceOptions:E,initialWorkspaceId:(i==null?void 0:i.id)??O??null,onClose:()=>R(!1),onSelect:Le}),e.jsx(qe,{open:ke,preferredWorkspaceId:(i==null?void 0:i.id)??null,compactComposer:!0,onClose:()=>$(!1)}),e.jsx(li,{open:ge,notifications:me,archivedNotificationIds:ue,showArchivedNotifications:he,onClose:()=>M(!1),onToggleShowArchivedNotifications:pe,onArchiveNotification:be,onUnarchiveNotification:fe,onSelectNotification:o=>{M(!1),o.routePath&&n(o.routePath)}})]})}function B(n){return`git-sidebar.snapshot.${n}`}function F(n){return`terminal-manager.snapshot.${n}`}function k(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}export{Si as WorkspaceHomePage};
@@ -1 +1 @@
1
- import{e as d,C as a,h as u,i as c}from"./index-oGylLBIX.js";async function l(){const t=d.getState().platform==="web"?"web":"desktop";return await a.request(`/api/client/runtime-config?platform=${encodeURIComponent(t)}`)}async function g(){const n=d.getState(),t=u(n);if(!t)return;const s=await l(),r=p(s.relayTunnel);if(m(t.relayTunnel??null,r))return;const e=new Date().toISOString();if(c(t)){d.updateRuntime({discoveredHosts:n.discoveredHosts.map(i=>i.id===t.id?{...i,relayTunnel:r,updatedAt:e}:i)});return}await d.update({hosts:n.hosts.map(i=>i.id===t.id?{...i,relayTunnel:r,updatedAt:e}:i)})}function p(n){return!n||n.provider!=="codingns_relay"||!n.controlBaseUrl||!n.tunnelDomain||!n.bindingId?null:{provider:n.provider,enabled:n.enabled,controlBaseUrl:n.controlBaseUrl,tunnelDomain:n.tunnelDomain.trim().toLowerCase(),bindingId:n.bindingId,hostFingerprint:n.hostFingerprint,candidateEndpoints:n.candidateEndpoints}}function m(n,t){if(n===t)return!0;if(!n||!t)return n===t;if(n.provider!==t.provider||n.enabled!==t.enabled||n.controlBaseUrl!==t.controlBaseUrl||n.tunnelDomain!==t.tunnelDomain||(n.bindingId??null)!==(t.bindingId??null)||(n.hostFingerprint??null)!==(t.hostFingerprint??null))return!1;const s=n.candidateEndpoints??[],r=t.candidateEndpoints??[];return s.length!==r.length?!1:s.every((e,i)=>{const o=r[i];return e.endpointId===(o==null?void 0:o.endpointId)&&e.kind===o.kind&&e.url===o.url&&e.priority===o.priority&&e.expiresAt===o.expiresAt&&e.source===o.source})}export{l as fetchAuthenticatedClientRuntimeConfig,g as syncActiveHostAuthenticatedRuntimeConfig};
1
+ import{e as d,C as a,h as u,i as c}from"./index-DvkfRpBe.js";async function l(){const t=d.getState().platform==="web"?"web":"desktop";return await a.request(`/api/client/runtime-config?platform=${encodeURIComponent(t)}`)}async function g(){const n=d.getState(),t=u(n);if(!t)return;const s=await l(),r=p(s.relayTunnel);if(m(t.relayTunnel??null,r))return;const e=new Date().toISOString();if(c(t)){d.updateRuntime({discoveredHosts:n.discoveredHosts.map(i=>i.id===t.id?{...i,relayTunnel:r,updatedAt:e}:i)});return}await d.update({hosts:n.hosts.map(i=>i.id===t.id?{...i,relayTunnel:r,updatedAt:e}:i)})}function p(n){return!n||n.provider!=="codingns_relay"||!n.controlBaseUrl||!n.tunnelDomain||!n.bindingId?null:{provider:n.provider,enabled:n.enabled,controlBaseUrl:n.controlBaseUrl,tunnelDomain:n.tunnelDomain.trim().toLowerCase(),bindingId:n.bindingId,hostFingerprint:n.hostFingerprint,candidateEndpoints:n.candidateEndpoints}}function m(n,t){if(n===t)return!0;if(!n||!t)return n===t;if(n.provider!==t.provider||n.enabled!==t.enabled||n.controlBaseUrl!==t.controlBaseUrl||n.tunnelDomain!==t.tunnelDomain||(n.bindingId??null)!==(t.bindingId??null)||(n.hostFingerprint??null)!==(t.hostFingerprint??null))return!1;const s=n.candidateEndpoints??[],r=t.candidateEndpoints??[];return s.length!==r.length?!1:s.every((e,i)=>{const o=r[i];return e.endpointId===(o==null?void 0:o.endpointId)&&e.kind===o.kind&&e.url===o.url&&e.priority===o.priority&&e.expiresAt===o.expiresAt&&e.source===o.source})}export{l as fetchAuthenticatedClientRuntimeConfig,g as syncActiveHostAuthenticatedRuntimeConfig};
@@ -0,0 +1,3 @@
1
+ import{b as d,j as a,t as u,J as Ze,H as Be,D as Ge,A as qe}from"./index-DvkfRpBe.js";import{D as Ye}from"./WorkbenchModal-CAj_TqWW.js";import{f as ve,e as ke}from"./App-BRupl2Ul.js";import{bD as ne,bE as Je,bF as Xe,bG as Ke}from"./WorkbenchLayout-Cht6Un5X.js";const Z="allow-forms allow-modals allow-scripts",Qe=`${Z} allow-same-origin`,et=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]),tt=new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"]),nt=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),rt=new Set(["add","alter","and","as","asc","between","by","create","delete","desc","drop","from","group","having","insert","into","join","left","like","limit","not","null","offset","on","or","order","right","select","set","table","union","update","values","where"]),it=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),st=new Set(["trace","debug","info","warn","warning","error","fatal"]);function on({workspaceId:e,filePath:t,open:n,onClose:r,onSaved:i,diffContent:s}){var ge,we;const[o,l]=d.useState(null),[c,f]=d.useState(""),[h,m]=d.useState(!1),[v,k]=d.useState(!1),[g,w]=d.useState("preview"),[R,V]=d.useState("regular"),[b,y]=d.useState(0),[D,j]=d.useState("fit"),[de,W]=d.useState(1),[Y,E]=d.useState(1),[J,T]=d.useState(110),[X,z]=d.useState(!0),{showToast:S}=ve(),M=ke(),fe=d.useRef(r),he=d.useRef(S),O=d.useMemo(()=>ce(t),[t]),C=d.useMemo(()=>Kt(s),[s]),F=d.useMemo(()=>Qt(c,C),[c,C]),N=(o==null?void 0:o.kind)??null,A=!!((ge=o==null?void 0:o.capabilities)!=null&&ge.canEdit),Re=!!((we=o==null?void 0:o.capabilities)!=null&&we.canRefresh),Ve=dt(N,O),L=d.useMemo(()=>ft(o,M.isDesktop),[M.isDesktop,o]),K=d.useMemo(()=>ht(o,M.isDesktop),[M.isDesktop,o]),We=d.useMemo(()=>oe(L,b),[L,b]),Ee=d.useMemo(()=>pt(L,b,Y,J,X),[L,b,Y,J,X]),Te=d.useMemo(()=>oe(L,b),[L,b]),ze=(o==null?void 0:o.content)??"",Fe=d.useDeferredValue(c),Q=A&&c!==ze,Ae=Ne(N),Ue=se(N),Ie=at(N,O),$=M.isMobile,me=$?"full":R;if(d.useEffect(()=>{fe.current=r},[r]),d.useEffect(()=>{he.current=S},[S]),d.useEffect(()=>{if(!n){l(null),f(""),m(!1),k(!1),w(be(t,null)),ye({setResourceRefreshVersion:y,setImageScale:W,setImageScaleMode:j,setPdfPage:E,setPdfScale:T,setPdfFitWidth:z}),V("regular");return}if(!e||!t)return;const p=e,_=t;let H=!1;async function He(){m(!0);try{const te=await ne(p,_);H||re(te,_,{preserveMode:!1,setPreview:l,setEditorContent:f,setMode:w,setResourceRefreshVersion:y,setImageScale:W,setImageScaleMode:j,setPdfPage:E,setPdfScale:T,setPdfFitWidth:z})}catch(te){H||(he.current({title:ie(te,u("conversation.filePanelOpenFailed")),tone:"error"}),fe.current())}finally{H||m(!1)}}return He(),()=>{H=!0}},[t,n,e]),!n||!t)return null;const P=t,U=e;async function De(){if(!(!U||!(o!=null&&o.version)||!A)){k(!0);try{await Je(U,P,c,o.version);const p=await ne(U,P);re(p,P,{preserveMode:!1,setPreview:l,setEditorContent:f,setMode:w,setResourceRefreshVersion:y,setImageScale:W,setImageScaleMode:j,setPdfPage:E,setPdfScale:T,setPdfFitWidth:z}),await i(P),S({title:u("conversation.filePanelSaveSuccess"),tone:"success"})}catch(p){S({title:ie(p,u("conversation.filePanelSaveFailed")),tone:"error"})}finally{k(!1)}}}async function Oe(){if(!(!U||!Re||Q)){m(!0);try{const p=await ne(U,P);re(p,P,{preserveMode:!0,setPreview:l,setEditorContent:f,setMode:w,setResourceRefreshVersion:y,setImageScale:W,setImageScaleMode:j,setPdfPage:E,setPdfScale:T,setPdfFitWidth:z}),y(_=>_+1)}catch(p){S({title:ie(p,u("conversation.fileViewerRefreshFailed")),tone:"error"})}finally{m(!1)}}}async function $e(){if(!K)return;const p=await M.bridge.openExternal(K);p.ok||S({title:p.detail??u("conversation.fileViewerOpenExternalFailed"),tone:"error"})}const ee=lt({canShowPreviewTab:Ae,canShowCodeTab:Ue,canEdit:A}),pe=ct({preview:o,canOpenExternal:!!K,isDirty:Q,handleRefreshPreview:Oe,handleOpenExternal:$e,imageScaleMode:D,imageScale:de,setImageScale:W,setImageScaleMode:j,pdfPage:Y,setPdfPage:E,pdfScale:J,setPdfScale:T,pdfFitWidth:X,setPdfFitWidth:z}),_e=$?pe.filter(ut):pe;return a.jsxs(Ye,{open:n,title:t,size:me,layout:"viewer",className:`file-viewer-modal${M.isDesktop&&me!=="full"?" is-resizable":""}`,bodyClassName:"file-viewer-modal-body",onClose:r,children:[a.jsxs("div",{className:"file-viewer-toolbar",children:[a.jsxs("div",{className:"file-viewer-toolbar-start",children:[a.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":u("conversation.fileViewerModeLabel"),children:[ee.includes("preview")?a.jsx("button",{type:"button",className:"file-viewer-tab","data-active":g==="preview",role:"tab","aria-selected":g==="preview",onClick:()=>w("preview"),children:u("conversation.fileViewerPreview")}):null,ee.includes("code")?a.jsx("button",{type:"button",className:"file-viewer-tab","data-active":g==="code",role:"tab","aria-selected":g==="code",onClick:()=>w("code"),children:u("conversation.fileViewerCode")}):null,ee.includes("edit")?a.jsx("button",{type:"button",className:"file-viewer-tab","data-active":g==="edit",role:"tab","aria-selected":g==="edit",onClick:()=>w("edit"),disabled:!A,children:u("conversation.fileViewerEdit")}):null]}),$?null:a.jsx("span",{className:"file-viewer-language",children:Ve})]}),a.jsxs("div",{className:"file-viewer-toolbar-end",children:[$?null:a.jsxs("div",{className:"file-viewer-size-group",role:"group","aria-label":u("conversation.fileViewerSizeLabel"),children:[a.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":R==="regular",onClick:()=>V("regular"),children:u("conversation.fileViewerSizeDefault")}),a.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":R==="full",onClick:()=>V("full"),children:u("conversation.fileViewerSizeFull")})]}),a.jsx("div",{className:"file-viewer-actions",children:_e.map(p=>a.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":p.active?"true":void 0,onClick:()=>void p.onClick(),disabled:p.disabled,children:p.label},p.id))}),A?a.jsx("button",{type:"button",className:"primary-button",onClick:()=>void De(),disabled:!Q||v,children:v?u("conversation.filePanelSaving"):u("conversation.filePanelSave")}):null]})]}),a.jsx("div",{className:"file-viewer-body",children:h?a.jsx("p",{className:"status-text",children:u("common.loading")}):(o==null?void 0:o.supported)===!1?a.jsx("p",{className:"status-text",children:o.reason??u("conversation.filePanelUnsupported")}):g==="edit"?a.jsx(vt,{content:c,deferredContent:Fe,language:O,useInlineRenderedEditor:Ie,onContentChange:f}):g==="preview"&&N==="html"?a.jsx(wt,{src:Te,filePath:t,overviewMarkers:C,overviewTotalLines:F}):g==="preview"&&N==="image"?a.jsx(yt,{src:We,filePath:t,scale:de,scaleMode:D,overviewMarkers:C,overviewTotalLines:F}):g==="preview"&&N==="pdf"?a.jsx(Nt,{src:Ee,filePath:t,overviewMarkers:C,overviewTotalLines:F}):g==="preview"&&N==="markdown"?a.jsx(jt,{content:c,overviewMarkers:C,overviewTotalLines:F}):a.jsx(Lt,{content:c,language:O,overviewMarkers:C,overviewTotalLines:F})})]})}function be(e,t){return t==="markdown"||t==="html"||t==="image"||t==="pdf"||qt(e??"")||Yt(e??"")?"preview":"code"}function re(e,t,n){n.setPreview(e),n.setEditorContent(e.content??""),n.setMode(r=>n.preserveMode&&ot(r,e.kind)?r:be(t,e.kind)),ye(n)}function ye(e){e.setResourceRefreshVersion(0),e.setImageScale(1),e.setImageScaleMode("fit"),e.setPdfPage(1),e.setPdfScale(110),e.setPdfFitWidth(!0)}function Ne(e){return e==="markdown"||e==="html"||e==="image"||e==="pdf"}function se(e){return e==="text"||e==="markdown"||e==="html"}function ot(e,t){return e==="preview"?Ne(t):se(t)}function at(e,t){return e==="text"&&Gt(t)}function lt(e){const t=[];return e.canShowPreviewTab&&t.push("preview"),e.canShowCodeTab?(t.push("code"),t.push("edit")):e.canEdit&&t.push("edit"),t}function ct(e){var r,i;if(!((r=e.preview)!=null&&r.supported))return[];const t=[],n=!((i=e.preview.capabilities)!=null&&i.canRefresh)||e.isDirty;return e.preview.kind==="image"&&t.push({id:"image-zoom-out",label:u("conversation.fileViewerZoomOut"),onClick:()=>{e.setImageScaleMode("custom"),e.setImageScale(s=>Math.max(.25,xe(s-.25)))}},{id:"image-zoom-in",label:u("conversation.fileViewerZoomIn"),onClick:()=>{e.setImageScaleMode("custom"),e.setImageScale(s=>Math.min(4,xe(s+.25)))}},{id:"image-fit",label:u("conversation.fileViewerFit"),active:e.imageScaleMode==="fit",onClick:()=>{e.setImageScaleMode("fit"),e.setImageScale(1)}},{id:"image-actual",label:u("conversation.fileViewerActualSize"),active:e.imageScaleMode==="actual",onClick:()=>{e.setImageScaleMode("actual"),e.setImageScale(1)}},{id:"image-refresh",label:u("conversation.fileViewerRefreshPreview"),disabled:n,onClick:e.handleRefreshPreview}),e.preview.kind==="pdf"&&t.push({id:"pdf-prev-page",label:u("conversation.fileViewerPreviousPage"),disabled:e.pdfPage<=1,onClick:()=>e.setPdfPage(s=>Math.max(1,s-1))},{id:"pdf-page-indicator",label:u("conversation.fileViewerPageIndicator").replace("{page}",String(e.pdfPage)),disabled:!0,onClick:()=>{}},{id:"pdf-next-page",label:u("conversation.fileViewerNextPage"),onClick:()=>e.setPdfPage(s=>s+1)},{id:"pdf-zoom-out",label:u("conversation.fileViewerZoomOut"),onClick:()=>{e.setPdfFitWidth(!1),e.setPdfScale(s=>Math.max(50,Math.round(s-10)))}},{id:"pdf-zoom-in",label:u("conversation.fileViewerZoomIn"),onClick:()=>{e.setPdfFitWidth(!1),e.setPdfScale(s=>Math.min(300,Math.round(s+10)))}},{id:"pdf-fit-width",label:u("conversation.fileViewerFitWidth"),active:e.pdfFitWidth,onClick:()=>e.setPdfFitWidth(!0)},{id:"pdf-refresh",label:u("conversation.fileViewerRefreshPreview"),disabled:n,onClick:e.handleRefreshPreview}),(e.preview.kind==="html"||e.preview.kind==="markdown"||e.preview.kind==="text")&&t.push({id:"text-refresh",label:u("conversation.fileViewerRefreshPreview"),disabled:n,onClick:e.handleRefreshPreview}),e.canOpenExternal&&t.push({id:"open-external",label:u("conversation.fileViewerOpenExternal"),onClick:e.handleOpenExternal}),t}function ut(e){return e.id.endsWith("-refresh")||e.id==="text-refresh"}function dt(e,t){switch(e){case"image":return u("conversation.fileViewerImage");case"pdf":return u("conversation.fileViewerPdf");case"html":return"HTML";case"markdown":return"Markdown";default:return ue(t)}}function oe(e,t){if(!e)return null;const n=new URL(e,window.location.origin);return n.searchParams.set("_preview",String(t)),n.hash="",n.toString()}function ft(e,t){var n;return e?!t&&e.previewPath&&typeof window<"u"&&((n=window.location)!=null&&n.origin)?new URL(e.previewPath,window.location.origin).toString():e.previewUrl??null:null}function ht(e,t){var n;if(!e)return null;if(e.previewPath){if(!t&&typeof window<"u"&&((n=window.location)!=null&&n.origin))return new URL(e.previewPath,window.location.origin).toString();if(t){const r=mt(e.previewPath);if(r)return r}}return e.previewUrl??null}function mt(e){try{const t=Ze(Be()).baseUrl;return Ge(e,t)}catch{return null}}function pt(e,t,n,r,i){const s=oe(e,t);if(!s)return null;const o=new URL(s,window.location.origin),l=new URLSearchParams;return l.set("page",String(n)),l.set("zoom",i?"page-width":String(r)),o.hash=l.toString(),o.toString()}function gt(e){var t;if(typeof window>"u"||!((t=window.location)!=null&&t.origin))return Z;try{if(new URL(e,window.location.origin).origin!==window.location.origin)return Qe}catch{return Z}return Z}function xe(e){return Math.round(e*100)/100}function wt({src:e,filePath:t,overviewMarkers:n,overviewTotalLines:r}){const i=d.useRef(null);if(!e)return a.jsx("p",{className:"status-text",children:u("conversation.fileViewerHtmlPreviewUnavailable")});const s=gt(e);return a.jsx(B,{overviewMarkers:n,overviewTotalLines:r,scrollContainerRef:i,children:a.jsx("div",{className:"file-viewer-html-frame-shell",ref:i,children:a.jsx("iframe",{className:"file-viewer-html-frame","data-testid":"file-viewer-html-preview",title:t,src:e,sandbox:s},e)})})}function B({children:e,overviewMarkers:t,overviewTotalLines:n,scrollContainerRef:r}){const i=xt(t);return a.jsxs("div",{className:"file-viewer-preview-overview-shell",children:[e,i?a.jsx("div",{className:"file-viewer-preview-diff-badge","data-kind":i,children:i==="modify"?u("conversation.fileViewerDiffModified"):u("conversation.fileViewerDiffAdded")}):null,a.jsx(Pe,{markers:t,totalLines:n,scrollContainerRef:r,hideWithoutMarkers:!0})]})}function xt(e){return e.some(t=>t.kind==="modify")?"modify":e.some(t=>t.kind==="add")?"add":null}function vt(e){return e.useInlineRenderedEditor?a.jsx(kt,{content:e.content,deferredContent:e.deferredContent,language:e.language,onContentChange:e.onContentChange}):a.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:e.content,onChange:t=>e.onContentChange(t.target.value),spellCheck:!1})}function kt(e){const t=d.useRef(null);function n(r){const i=t.current;i&&(i.scrollTop=r.currentTarget.scrollTop,i.scrollLeft=r.currentTarget.scrollLeft)}return a.jsxs("div",{className:"file-viewer-inline-editor-shell",children:[a.jsx("div",{ref:t,className:"file-viewer-inline-editor-render","data-testid":"file-viewer-inline-render","aria-hidden":"true",children:a.jsx(bt,{content:e.deferredContent,language:e.language})}),a.jsx("textarea",{className:"file-viewer-editor file-viewer-editor-input","data-testid":"file-viewer-editor",value:e.content,onChange:r=>e.onContentChange(r.target.value),onScroll:n,spellCheck:!1})]})}function bt({content:e,language:t}){const n=e.split(/\r?\n/);return a.jsx("div",{className:"file-viewer-inline-editor-content",children:n.map((r,i)=>{const s=Ce(r,t);return a.jsx("div",{className:"file-viewer-inline-editor-line",children:a.jsx("code",{className:"file-viewer-inline-editor-code",children:s.length?s.map((o,l)=>a.jsx("span",{className:`code-token ${o.kind}`,children:o.text},`${i}-${l}-${o.text}`)):a.jsx("span",{className:"code-token plain",children:" "})})},`${i}-${r}`)})})}function yt({src:e,filePath:t,scale:n,scaleMode:r,overviewMarkers:i,overviewTotalLines:s}){const o=d.useRef(null);return e?a.jsx(B,{overviewMarkers:i,overviewTotalLines:s,scrollContainerRef:o,children:a.jsx("div",{className:"file-viewer-media-shell","data-mode":r,ref:o,children:a.jsx("div",{className:"file-viewer-image-stage",children:a.jsx("img",{className:"file-viewer-image","data-testid":"file-viewer-image-preview","data-mode":r,src:e,alt:t,style:r==="fit"?void 0:{transform:`scale(${n})`}})})})}):a.jsx("p",{className:"status-text",children:u("conversation.fileViewerImageUnavailable")})}function Nt({src:e,filePath:t,overviewMarkers:n,overviewTotalLines:r}){const i=d.useRef(null);return e?a.jsx(B,{overviewMarkers:n,overviewTotalLines:r,scrollContainerRef:i,children:a.jsx("div",{className:"file-viewer-pdf-shell",ref:i,children:a.jsx("iframe",{className:"file-viewer-pdf-frame","data-testid":"file-viewer-pdf-preview",title:t,src:e},e)})}):a.jsx("p",{className:"status-text",children:u("conversation.fileViewerPdfUnavailable")})}function jt({content:e,overviewMarkers:t,overviewTotalLines:n}){const r=d.useRef(null),i=d.useMemo(()=>St(t),[t]),s=d.useMemo(()=>Mt(i),[i]);return a.jsx(B,{overviewMarkers:t,overviewTotalLines:n,scrollContainerRef:r,children:a.jsx("div",{className:"markdown-content file-viewer-markdown",ref:r,children:a.jsx(Xe,{remarkPlugins:[Ke],components:s,children:e})})})}function St(e){return{ranges:e.map(t=>({start:t.line,end:t.line+t.span-1,kind:t.kind})).sort((t,n)=>t.start-n.start)}}function Mt(e){return{h1(t){const{node:n,className:r,...i}=t;return a.jsx("h1",{...i,className:x(r,n,e)})},h2(t){const{node:n,className:r,...i}=t;return a.jsx("h2",{...i,className:x(r,n,e)})},h3(t){const{node:n,className:r,...i}=t;return a.jsx("h3",{...i,className:x(r,n,e)})},h4(t){const{node:n,className:r,...i}=t;return a.jsx("h4",{...i,className:x(r,n,e)})},h5(t){const{node:n,className:r,...i}=t;return a.jsx("h5",{...i,className:x(r,n,e)})},h6(t){const{node:n,className:r,...i}=t;return a.jsx("h6",{...i,className:x(r,n,e)})},p(t){const{node:n,className:r,...i}=t;return a.jsx("p",{...i,className:x(r,n,e)})},li(t){const{node:n,className:r,...i}=t;return a.jsx("li",{...i,className:x(r,n,e)})},blockquote(t){const{node:n,className:r,...i}=t;return a.jsx("blockquote",{...i,className:x(r,n,e)})},table(t){const{node:n,className:r,...i}=t;return a.jsx("table",{...i,className:x(r,n,e)})},pre(t){const{node:n,className:r}=t,i=Rt(t.children);return i?a.jsx(Pt,{content:i.content,language:i.language,codeClassName:i.codeClassName,changeKind:je(n,e)}):a.jsx("pre",{className:x(r,n,e),children:t.children})},code(t){const n=typeof t.className=="string"?t.className:"";return a.jsx("code",{className:n||void 0,children:t.children})}}}function x(e,t,n){const r=typeof e=="string"?e:"",i=je(t,n);return Se(r,i?"markdown-diff-block":null,i?`diff-block-${i}`:null)}function je(e,t){var o,l,c,f;const n=(l=(o=e==null?void 0:e.position)==null?void 0:o.start)==null?void 0:l.line,r=(f=(c=e==null?void 0:e.position)==null?void 0:c.end)==null?void 0:f.line;if(!n||!r)return null;let i=!1;const s=Ct(t.ranges,n);for(let h=s;h<t.ranges.length;h+=1){const m=t.ranges[h];if(!m||m.start>r)break;if(m.end>=n){if(m.kind==="modify")return"modify";i=!0}}return i?"add":null}function Ct(e,t){let n=0,r=e.length;for(;n<r;){const i=Math.floor((n+r)/2),s=e[i];s&&s.end<t?n=i+1:r=i}return n}function Lt({content:e,language:t,overviewMarkers:n=[],overviewTotalLines:r}){const i=e.split(/\r?\n/),s=d.useRef(null),o=d.useMemo(()=>{const l=new Map;for(const c of n)for(let f=0;f<c.span;f++)l.set(c.line+f,c.kind);return l},[n]);return a.jsxs("div",{className:"file-viewer-code-block",children:[a.jsxs("div",{className:"file-viewer-code-header",children:[a.jsx("span",{className:"file-viewer-code-header-label",children:ue(t)}),a.jsx(Me,{content:e})]}),a.jsxs("div",{className:"file-viewer-scroll-shell",children:[a.jsx("div",{className:"file-viewer-code-body",ref:s,children:i.map((l,c)=>{const f=Ce(l,t),h=c+1,m=o.get(h);return a.jsxs("div",{className:`file-viewer-code-line${m?` diff-line-${m}`:""}`,children:[a.jsx("span",{className:"file-viewer-code-gutter",children:h}),a.jsx("code",{className:"file-viewer-code-content",children:f.length?f.map((v,k)=>a.jsx("span",{className:`code-token ${v.kind}`,children:v.text},`${c}-${k}-${v.text}`)):a.jsx("span",{className:"code-token plain",children:" "})})]},`${c}-${l}`)})}),a.jsx(Pe,{markers:n,totalLines:r,scrollContainerRef:s})]})]})}function Pt({content:e,language:t,codeClassName:n,changeKind:r=null}){const i=t?q(t):null;return a.jsxs("div",{className:Se("file-viewer-markdown-copy-block",r?"markdown-diff-block":null,r?`diff-block-${r}`:null),children:[a.jsxs("div",{className:"file-viewer-markdown-copy-header",children:[a.jsx("span",{className:"file-viewer-markdown-copy-label",children:i?ue(i):u("conversation.fileViewerPlainText")}),a.jsx(Me,{content:e})]}),a.jsx("pre",{className:n,children:a.jsx("code",{children:e})})]})}function Se(...e){return e.filter(Boolean).join(" ")||void 0}function Me({content:e}){const{showToast:t}=ve(),n=ke(),[r,i]=d.useState(!1);if(!e.trim())return null;async function s(){if(!r){i(!0);try{await Wt(e,n),t({title:u("conversation.copyContentSuccess"),tone:"success"})}catch(o){t({title:o instanceof Error?o.message:u("conversation.copyContentFailed"),tone:"error"})}finally{i(!1)}}}return a.jsx("button",{type:"button",className:"file-viewer-copy-button","aria-label":u("conversation.copyAction"),title:u("conversation.copyAction"),onClick:()=>void s(),disabled:r,children:a.jsx(Jt,{})})}function ae(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(n=>ae(n)).join(""):d.isValidElement(e)?ae(((t=e.props)==null?void 0:t.children)??""):""}function Rt(e){const t=Array.isArray(e)?e[0]:e;if(!d.isValidElement(t))return null;const n=t.props,r=typeof n.className=="string"?n.className:"",i=/language-([^\s]+)/.exec(r);return{content:ae(n.children).replace(/\n$/,""),codeClassName:r||void 0,language:(i==null?void 0:i[1])??null}}function Vt(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Wt(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!Vt(e))throw new Error(u("conversation.copyContentFailed"))}}function Ce(e,t){const n=q(t);return n==="json"?Et(e):n==="yaml"?At(e):n==="toml"?Ut(e):n==="ini"?Le(e):n==="env"?It(e):n==="properties"?Dt(e):n==="conf"?Ot(e):n==="editorconfig"?$t(e):n==="dockerfile"?_t(e):n==="gitignore"?Ht(e):n==="log"?Zt(e):n==="python"?I(e,tt,"#"):n==="shell"?I(e,nt,"#"):n==="sql"?Ft(e):n==="html"||n==="xml"?Tt(e):n==="css"?zt(e):n==="markdown"?[{text:e,kind:"plain"}]:I(e,et,"//")}function I(e,t,n){const r=[];let i=0;for(;i<e.length;){const s=e.slice(i);if(s.startsWith(n)){r.push({text:s,kind:"comment"});break}const o=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(s);if(o){r.push({text:o[0],kind:"string"}),i+=o[0].length;continue}const l=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(s);if(l){r.push({text:l[0],kind:"number"}),i+=l[0].length;continue}const c=/^[A-Za-z_][\w$-]*/.exec(s);if(c){const h=c[0],m=h.toLowerCase();h==="true"||h==="false"||m==="true"||m==="false"?r.push({text:h,kind:"boolean"}):h==="null"||h==="None"||m==="none"?r.push({text:h,kind:"null"}):t.has(h)||t.has(m)?r.push({text:h,kind:"keyword"}):r.push({text:h,kind:"plain"}),i+=h.length;continue}const f=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(s);if(f){r.push({text:f[0],kind:"operator"}),i+=f[0].length;continue}r.push({text:s[0]??"",kind:"plain"}),i+=1}return r}function Et(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n),i=/^"(?:[^"\\]|\\.)*"/.exec(r);if(i){const c=e.slice(n+i[0].length).trimStart()[0];t.push({text:i[0],kind:c===":"?"attr":"string"}),n+=i[0].length;continue}const s=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(r);if(s){t.push({text:s[0],kind:"number"}),n+=s[0].length;continue}const o=/^(?:true|false|null)\b/.exec(r);if(o){const c=o[0]==="null"?"null":"boolean";t.push({text:o[0],kind:c}),n+=o[0].length;continue}const l=/^(?::|,|\{|\}|\[|\])/.exec(r);if(l){t.push({text:l[0],kind:"operator"}),n+=l[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function Tt(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("<!--")){t.push({text:r,kind:"comment"});break}const i=/^(<\/?[\w:-]+)/.exec(r);if(i){t.push({text:i[0],kind:"tag"}),n+=i[0].length;continue}const s=/^([\w:-]+)(=)/.exec(r);if(s){t.push({text:s[1]??"",kind:"attr"}),t.push({text:s[2]??"",kind:"operator"}),n+=s[0].length;continue}const o=/^(?:'[^']*'|"[^"]*")/.exec(r);if(o){t.push({text:o[0],kind:"string"}),n+=o[0].length;continue}const l=/^(?:\/?>)/.exec(r);if(l){t.push({text:l[0],kind:"operator"}),n+=l[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function zt(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("/*")){t.push({text:r,kind:"comment"});break}const i=/^(?:'[^']*'|"[^"]*")/.exec(r);if(i){t.push({text:i[0],kind:"string"}),n+=i[0].length;continue}const s=/^([A-Za-z-]+)(\s*:)/.exec(r);if(s){t.push({text:s[1]??"",kind:"attr"}),t.push({text:s[2]??"",kind:"operator"}),n+=s[0].length;continue}const o=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(r);if(o){t.push({text:o[0],kind:"number"}),n+=o[0].length;continue}const l=/^(?:@media|@supports|@import|@keyframes)\b/.exec(r);if(l){t.push({text:l[0],kind:"keyword"}),n+=l[0].length;continue}const c=/^(?:[{}:;(),.>])/.exec(r);if(c){t.push({text:c[0],kind:"operator"}),n+=c[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function Ft(e){return I(e,rt,"--")}function At(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("#")){t.push({text:r,kind:"comment"});break}const i=/^([A-Za-z0-9_.-]+)(\s*:)/.exec(r);if(i){t.push({text:i[1]??"",kind:"attr"}),t.push({text:i[2]??"",kind:"operator"}),n+=i[0].length;continue}const s=/^(?:'[^']*'|"[^"]*")/.exec(r);if(s){t.push({text:s[0],kind:"string"}),n+=s[0].length;continue}const o=/^(?:-?\d+(?:\.\d+)?)/.exec(r);if(o){t.push({text:o[0],kind:"number"}),n+=o[0].length;continue}const l=/^(?:true|false|yes|no|null|~)\b/i.exec(r);if(l){const f=l[0].toLowerCase(),h=f==="null"||f==="~"?"null":"boolean";t.push({text:l[0],kind:h}),n+=l[0].length;continue}const c=/^(?:[-?:,[\]{}|>])/.exec(r);if(c){t.push({text:c[0],kind:"operator"}),n+=c[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function Ut(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("#")){t.push({text:r,kind:"comment"});break}const i=/^(\[\[?[^\]]+\]?\])/.exec(r);if(i){t.push({text:i[0],kind:"tag"}),n+=i[0].length;continue}const s=/^([A-Za-z0-9_.-]+)(\s*=)/.exec(r);if(s){t.push({text:s[1]??"",kind:"attr"}),t.push({text:s[2]??"",kind:"operator"}),n+=s[0].length;continue}const o=G(r,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(o){t.push(...o.tokens),n+=o.length;continue}const l=/^(?:[,[\]{}])/.exec(r);if(l){t.push({text:l[0],kind:"operator"}),n+=l[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function Le(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n),i=r.trimStart();if(i.startsWith(";")||i.startsWith("#")){t.push({text:r,kind:"comment"});break}const s=/^(\[[^\]]+\])/.exec(r);if(s){t.push({text:s[0],kind:"tag"}),n+=s[0].length;continue}const o=/^([A-Za-z0-9_.-]+)(\s*[=:])/.exec(r);if(o){t.push({text:o[1]??"",kind:"attr"}),t.push({text:o[2]??"",kind:"operator"}),n+=o[0].length;continue}const l=G(r,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(l){t.push(...l.tokens),n+=l.length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function It(e){if(e.trimStart().startsWith("#"))return[{text:e,kind:"comment"}];const n=/^(\s*)(export)(\s+)/.exec(e),r=n?n[0].length:0,i=[];n&&(i.push({text:n[1]??"",kind:"plain"}),i.push({text:n[2]??"",kind:"keyword"}),i.push({text:n[3]??"",kind:"plain"}));const s=e.slice(r),o=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(s);if(!o)return Le(e);i.push({text:o[1]??"",kind:"attr"}),i.push({text:o[2]??"",kind:"operator"});const l=s.slice(o[0].length),c=G(l,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return c?(i.push(...c.tokens),i):(i.push({text:l,kind:"plain"}),i)}function Dt(e){return le(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function Ot(e){return le(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function $t(e){return le(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function _t(e){return I(e,it,"#")}function Ht(e){const t=e.trimStart();if(!t)return[];if(t.startsWith("#"))return[{text:e,kind:"comment"}];if(t.startsWith("!")){const n=e.length-t.length,r=e.slice(0,n),i=t.slice(1);return[{text:r,kind:"plain"},{text:"!",kind:"operator"},{text:i,kind:"string"}]}return[{text:e,kind:"string"}]}function Zt(e){const t=[];let n=0;for(;n<e.length;){const r=e.slice(n);if(r.startsWith("#")){t.push({text:r,kind:"comment"});break}const i=/^(?:\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:[.,]\d{3,6})?(?:Z|[+-]\d{2}:\d{2})?)/.exec(r);if(i){t.push({text:i[0],kind:"tag"}),n+=i[0].length;continue}const s=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(r);if(s){t.push({text:r.slice(0,s[0].length),kind:"keyword"}),n+=s[0].length;continue}const o=/^[A-Za-z_][\w-]*/.exec(r);if(o){const c=o[0];st.has(c.toLowerCase())?t.push({text:c,kind:"keyword"}):t.push({text:c,kind:"plain"}),n+=c.length;continue}const l=/^(?:\d+(?:\.\d+)?)/.exec(r);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function le(e,t){const n=e.trimStart();if(t.commentPrefixes.some(c=>n.startsWith(c)))return[{text:e,kind:"comment"}];if(t.allowSection){const c=/^(\[[^\]]+\])/.exec(e);if(c)return[{text:c[0],kind:"tag"}]}const r=/^([A-Za-z0-9_.\-*?]+)(\s*(?:=|:))/.exec(e);if(!r)return[{text:e,kind:"plain"}];const i=(r[2]??"").trim();if(!t.delimiters.includes(i))return[{text:e,kind:"plain"}];const s=[{text:r[1]??"",kind:"attr"},{text:r[2]??"",kind:"operator"}],o=e.slice(r[0].length),l=Bt(o);return l.length&&s.push(...l),s}function Bt(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const r=e.slice(n),i=G(r,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(i){t.push(...i.tokens),n+=i.length;continue}if(r.startsWith("#")||r.startsWith(";")){t.push({text:r,kind:"comment"});break}t.push({text:r[0]??"",kind:"plain"}),n+=1}return t}function G(e,t){const n=/^(?:'[^']*'|"[^"]*")/.exec(e);if(n)return{tokens:[{text:n[0],kind:"string"}],length:n[0].length};const r=/^(?:-?\d+(?:\.\d+)?)/.exec(e);if(r)return{tokens:[{text:r[0],kind:"number"}],length:r[0].length};const i=/^[A-Za-z0-9_.:+/-]+/.exec(e);if(!i)return null;const s=i[0],o=s.toLowerCase();return t.trueValues.includes(o)?{tokens:[{text:s,kind:"boolean"}],length:s.length}:t.falseValues.includes(o)?{tokens:[{text:s,kind:"boolean"}],length:s.length}:t.nullValues.includes(o)?{tokens:[{text:s,kind:"null"}],length:s.length}:{tokens:[{text:s,kind:"plain"}],length:s.length}}function ce(e){var r,i;if(!e)return"plain";const t=((r=e.split(/[\\/]/).pop())==null?void 0:r.toLowerCase())??"";if(t===".env"||t.startsWith(".env."))return"env";if(t===".editorconfig")return"editorconfig";if(t==="dockerfile"||t.endsWith(".dockerfile"))return"dockerfile";if(t===".gitignore")return"gitignore";switch(((i=e.split(".").pop())==null?void 0:i.toLowerCase())??""){case"md":case"markdown":return"markdown";case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"log":return"log";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"conf":return"conf";case"dockerfile":return"dockerfile";case"css":case"scss":case"less":return"css";case"html":case"htm":return"html";case"xml":case"svg":return"xml";case"py":return"python";case"sh":case"bash":case"zsh":return"shell";case"sql":return"sql";case"yml":case"yaml":return"yaml";case"rs":return"rust";case"go":return"go";case"java":return"java";case"c":case"h":case"cpp":case"cc":case"hpp":return"cpp";default:return"plain"}}function q(e){const t=e.toLowerCase();switch(t){case"ts":case"tsx":case"typescript":return"typescript";case"js":case"jsx":case"javascript":return"javascript";case"bash":case"shell":case"sh":case"zsh":return"shell";case"md":case"markdown":return"markdown";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"env":return"env";case"conf":return"conf";case"editorconfig":return"editorconfig";case"dockerfile":return"dockerfile";case"gitignore":return"gitignore";case"log":return"log";default:return t}}function Gt(e){const t=q(e);return t==="json"||t==="yaml"||t==="toml"||t==="ini"||t==="env"||t==="properties"||t==="conf"||t==="editorconfig"||t==="dockerfile"||t==="gitignore"}function ue(e){switch(q(e)){case"typescript":return"TypeScript";case"javascript":return"JavaScript";case"markdown":return"Markdown";case"json":return"JSON";case"properties":return"Properties";case"toml":return"TOML";case"ini":return"INI";case"env":return"ENV";case"conf":return"CONF";case"editorconfig":return"EditorConfig";case"dockerfile":return"Dockerfile";case"gitignore":return"GitIgnore";case"log":return"Log";case"css":return"CSS";case"html":return"HTML";case"xml":return"XML";case"python":return"Python";case"shell":return"Shell";case"sql":return"SQL";case"yaml":return"YAML";case"rust":return"Rust";case"go":return"Go";case"java":return"Java";case"cpp":return"C/C++";default:return u("conversation.fileViewerPlainText")}}function qt(e){return ce(e)==="markdown"}function Yt(e){return ce(e)==="html"}function Jt(){return a.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[a.jsx("path",{d:"M5 2.5h7.5v9H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),a.jsx("path",{d:"M3.5 5H2.4V13.5H10V12.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function ie(e,t){return e instanceof qe?e.message:t}function Xt(e){const t=[],n=e.replace(/\r\n/g,`
2
+ `).split(`
3
+ `);let r=0,i=0;for(const s of n){if(s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")){t.push({kind:"meta",text:s,oldLineNo:null,newLineNo:null});continue}const o=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(s);if(o){r=parseInt(o[1],10),i=parseInt(o[2],10),t.push({kind:"hunk",text:s,oldLineNo:null,newLineNo:null});continue}if(s.startsWith(" ")||s===""){t.push({kind:"context",text:s.slice(1),oldLineNo:r,newLineNo:i}),r++,i++;continue}if(s.startsWith("+")){t.push({kind:"add",text:s.slice(1),oldLineNo:null,newLineNo:i}),i++;continue}if(s.startsWith("-")){t.push({kind:"remove",text:s.slice(1),oldLineNo:r,newLineNo:null}),r++;continue}t.push({kind:"meta",text:s,oldLineNo:null,newLineNo:null})}return t}function Kt(e){if(!(e!=null&&e.trim()))return[];const t=Xt(e),n=[];let r=0,i=[];function s(){if(i.length===0){r=0;return}const o=r>0?"modify":"add";en(n,i,o),r=0,i=[]}for(const o of t){if(o.kind==="remove"){r+=1;continue}if(o.kind==="add"){o.newLineNo!==null&&i.push(o.newLineNo);continue}s()}return s(),n}function Qt(e,t){const n=e?e.split(/\r?\n/).length:1,r=t.reduce((i,s)=>Math.max(i,s.line+s.span-1),0);return Math.max(n,r,1)}function en(e,t,n){const r=t.filter(o=>o>0);if(r.length===0)return;let i=r[0]??1,s=i;for(let o=1;o<r.length;o+=1){const l=r[o]??s;if(l===s+1){s=l;continue}e.push({line:i,span:s-i+1,kind:n}),i=l,s=l}e.push({line:i,span:s-i+1,kind:n})}function Pe({markers:e,totalLines:t,scrollContainerRef:n,hideWithoutMarkers:r=!1}){const i=d.useRef(null),s=!r||e.length>0;if(d.useEffect(()=>{const l=n.current,c=i.current;if(!l||!c||!s)return;const f=l,h=c;let m=null;function v(){m=null;const{clientHeight:g,scrollHeight:w,scrollTop:R}=f;if(w<=0||g<=0||w<=g){h.style.display="none";return}const V=g/w,b=Math.min(100,Math.max(12,V*100)),y=w-g,D=Math.max(0,100-b),j=y<=0?0:R/y*D;h.style.display="block",h.style.top=`${j}%`,h.style.height=`${b}%`}function k(){m===null&&(m=window.requestAnimationFrame(v))}return v(),f.addEventListener("scroll",k,{passive:!0}),window.addEventListener("resize",k),()=>{m!==null&&window.cancelAnimationFrame(m),f.removeEventListener("scroll",k),window.removeEventListener("resize",k)}},[n,s]),r&&e.length===0)return null;const o=Math.max(t,1);return a.jsxs("div",{className:"file-overview-ruler","data-testid":"file-overview-ruler","aria-hidden":"true",children:[e.map(l=>{const c=(l.line-1)/o*100,f=Math.max(2,l.span/o*100);return a.jsx("div",{className:`file-overview-marker is-${l.kind}`,"data-kind":l.kind,style:{top:`${c}%`,height:`${f}%`}},`${l.kind}-${l.line}-${l.span}`)}),s?a.jsx("div",{ref:i,className:"file-overview-viewport"}):null]})}function an(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ENV";if(t.endsWith(".d.ts"))return"DTS";switch(t.includes(".")?t.slice(t.lastIndexOf(".")+1):""){case"ts":return"TS";case"tsx":return"TSX";case"js":return"JS";case"jsx":return"JSX";case"json":return"{}";case"md":return"MD";case"css":return"CSS";case"scss":return"SASS";case"html":return"HTML";case"yml":case"yaml":return"YAML";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"IMG";case"txt":return"TXT";default:return"FILE"}}function ln(e){const t=e.toLowerCase();return t===".env"||t.startsWith(".env.")?"env":t.endsWith(".md")?"md":t.endsWith(".css")||t.endsWith(".scss")?"style":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".svg")||t.endsWith(".webp")?"image":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")?"code":t.endsWith(".json")||t.endsWith(".yml")||t.endsWith(".yaml")?"data":"default"}export{on as F,ln as a,an as r};