@xopcai/xopc 0.0.199 → 0.0.201

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 (152) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-DYVN1hRp.js → activity-store-DOhnAQOQ.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bt70bZjv.js → agent-avatar-dicebear-D8Cw0Mve.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-ANavi648.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-B8mzbAle.js → api-E9Bk-Idp.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-B4x7JfL8.js → app-management-settings-panel-BubrReXg.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-Dwdagf-Q.js → appearance-settings-BY5Az2p4.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-DkTiesxe.js → apps-page-CFh9MBxc.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-Cv0VXKLm.js → archive-plugin-BY8843mB.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CgidKrXn.js → attachment-load-DG45KScf.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-751CeNI3.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-DN3CQgIq.js → binary-plugins-DGIF2ZAv.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-BwkSl1F_.js → block-editor-C1Qktr1g.js} +5 -5
  15. package/dist/gateway/static/root/assets/browser-settings-page-CGAWs-TT.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-_ndaecsf.js → browser-workflow-inputs-D_jnndyz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-C_I31wLm.js → browser-workflows-page-DyIRvPaq.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-CghUK68J.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api-Dy1jZJKs.js → capability-presets-api--tz0mGLY.js} +1 -1
  20. package/dist/gateway/static/root/assets/capability-presets-settings-panel-XsTfkvUn.js +3 -0
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-D-9qiuio.js → channel-recipient-api-CkOKF9nc.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-settings-DV5BhAeu.js → channels-settings-DkoAZZMe.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-status-swr-DNDvMWpl.js +1 -0
  24. package/dist/gateway/static/root/assets/{connectors-api-5FEBYguL.js → connectors-api-FBOe9SWC.js} +1 -1
  25. package/dist/gateway/static/root/assets/connectors-page-e4vekkAu.js +2 -0
  26. package/dist/gateway/static/root/assets/{cron-expression-SEFx5rnr.js → cron-expression-Q4QaYjpI.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-D4zCUQJL.js → date-picker-Dtn7e6TW.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-DpQAxS2k.js → dependency-picker-Br6nPaM6.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-B_5G3lQl.js → desktop-pet-DzTM6aH8.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-ClEyoUJe.js → desktop-pet-settings-FDmaty3P.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-AsFWmOjG.js → directory-picker-path-field-X2e8xn8j.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-C22Y2o5l.js → extension-debug-page-Dx4MBfga.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-C61Ikawk.js → extension-page-Bf_FEDhM.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-WlWWcDFr.js → extension-settings-page-CrOgZxkf.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-config-api-ByIOMQdc.js → gateway-config-api-CZ4r-7qT.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-jB0hAhWO.js → gateway-config-swr-Cv2ywpdb.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-CzzS9A17.js → gateway-settings-DpWmVi0w.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-C-fRlHCL.js → gateway-startup-retry-undf-k5g.js} +1 -1
  39. package/dist/gateway/static/root/assets/heartbeat-settings-DSQZhSvT.js +1 -0
  40. package/dist/gateway/static/root/assets/home-page-L0uHiu0T.js +3 -0
  41. package/dist/gateway/static/root/assets/{index-CR233S0Q.css → index-Bp8I_eX4.css} +1 -1
  42. package/dist/gateway/static/root/assets/index-DRrjYYzZ.js +152 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BD_TFz0_.js → keyboard-shortcuts-settings-Bc3Quw42.js} +1 -1
  44. package/dist/gateway/static/root/assets/local-app-workbench-page-Copi3sdP.js +2 -0
  45. package/dist/gateway/static/root/assets/{local-apps-page-BwbUeLfm.js → local-apps-page-CP9X_vtz.js} +1 -1
  46. package/dist/gateway/static/root/assets/{locale-store-xULEcFVs.js → locale-store-CnamlR07.js} +1 -1
  47. package/dist/gateway/static/root/assets/logs-page-DMKq6e29.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-CW2VpqtT.js → management-settings-CJmcaVje.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-split-B1M9KO16.js → markdown-split-AcuFp0TH.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-B_QlNdqZ.js → media-plugins-BvFgsiJL.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-D7kOD_o_.js +3 -0
  52. package/dist/gateway/static/root/assets/{notes-page-BTbD4GmH.js → notes-page-IW7IQ9nJ.js} +1 -1
  53. package/dist/gateway/static/root/assets/notes-workbench-Zb8U0anO.js +4 -0
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-CeqtArlZ.js → preview-open-alternatives-C-b34dgQ.js} +1 -1
  55. package/dist/gateway/static/root/assets/{product-open-page-DnalBZZs.js → product-open-page-CWEzLykF.js} +1 -1
  56. package/dist/gateway/static/root/assets/project-detail-page-BuIbLnan.js +1 -0
  57. package/dist/gateway/static/root/assets/projects-page-BwUfRqNV.js +1 -0
  58. package/dist/gateway/static/root/assets/remote-access-hub-BTaXxcEi.js +1 -0
  59. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-cGkBEfg4.js → runtime-tools-settings-panel-DAohEZrX.js} +2 -2
  60. package/dist/gateway/static/root/assets/{schema-form-CmsrLlxu.js → schema-form-C_OBW8A5.js} +1 -1
  61. package/dist/gateway/static/root/assets/sessions-page-BnHoTCD3.js +1 -0
  62. package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +1 -0
  63. package/dist/gateway/static/root/assets/{settings-form-section-DUWCbaMJ.js → settings-form-section-C7w2WS-A.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bvy5rdMY.js → settings-loading-skeleton-zwibve4m.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-page-cZSAwsRR.js → settings-page-B9W03dSW.js} +1 -1
  66. package/dist/gateway/static/root/assets/setup-status-panel-C8Hec2Af.js +1 -0
  67. package/dist/gateway/static/root/assets/{share-preview-page-BzA2NCAH.js → share-preview-page-6e3ks2be.js} +1 -1
  68. package/dist/gateway/static/root/assets/shares-settings-Bwc5HfLI.js +1 -0
  69. package/dist/gateway/static/root/assets/skill-reload-api-D7kunhqy.js +1 -0
  70. package/dist/gateway/static/root/assets/{skills-page-Bvde7_i5.js → skills-page-WgkaNzpc.js} +1 -1
  71. package/dist/gateway/static/root/assets/{skills-page.utils-vXSqHR7g.js → skills-page.utils-D9QT5cxj.js} +1 -1
  72. package/dist/gateway/static/root/assets/{system-settings-panel-9cQGOGCK.js → system-settings-panel-c1HVtv1Y.js} +1 -1
  73. package/dist/gateway/static/root/assets/task-detail-page-CjP-6WVU.js +1 -0
  74. package/dist/gateway/static/root/assets/{theme-store-CHQRiuCF.js → theme-store-BDyUTObE.js} +1 -1
  75. package/dist/gateway/static/root/assets/{use-autosave-7XfKULPI.js → use-autosave-D6UkH_Ga.js} +1 -1
  76. package/dist/gateway/static/root/assets/{user-context-page-CZ9m9aC_.js → user-context-page-D8ZhPDNF.js} +1 -1
  77. package/dist/gateway/static/root/assets/{voice-api-key-field-DXr21v-3.js → voice-api-key-field-BOxkKbGh.js} +1 -1
  78. package/dist/gateway/static/root/assets/{work-discovery-overlay-CeG7g_DZ.js → work-discovery-overlay-Dd19yK9t.js} +1 -1
  79. package/dist/gateway/static/root/assets/work-discovery-page-DUkdJl1e.js +1 -0
  80. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DSQQZP9T.js → workflow-run-setup-panel-ZA3bP65I.js} +2 -2
  81. package/dist/gateway/static/root/assets/workflows-page-C2b5W5bw.js +5 -0
  82. package/dist/gateway/static/root/assets/{working-directory-picker-modal-D-IgcHPp.js → working-directory-picker-modal-BcyiDXU3.js} +1 -1
  83. package/dist/gateway/static/root/index.html +9 -9
  84. package/dist/package.js +1 -1
  85. package/dist/packages/gateway-contract/src/tasks.js +51 -9
  86. package/dist/src/agent/context/execution-scope.js +3 -1
  87. package/dist/src/agent/tasks/task-judge-service.d.ts +1 -1
  88. package/dist/src/agent/tasks/task-judge-service.js +3 -2
  89. package/dist/src/agent/tools/xopc-use-tool.js +13 -3
  90. package/dist/src/auth/oauth/types.d.ts +2 -0
  91. package/dist/src/auth/oauth/xopc-cloud.js +24 -2
  92. package/dist/src/automations/domain/validation.d.ts +0 -12
  93. package/dist/src/automations/draft/automation-draft-validator.d.ts +0 -3
  94. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  95. package/dist/src/gateway/hono/app.js +1 -1
  96. package/dist/src/gateway/hono/oauth-async.js +2 -0
  97. package/dist/src/gateway/hono/routes/agent-stream.js +2 -74
  98. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +62 -0
  99. package/dist/src/gateway/hono/routes/session-input-handler.js +82 -0
  100. package/dist/src/gateway/hono/routes/tasks.js +161 -2
  101. package/dist/src/gateway/service/task-conversation-query-service.d.ts +58 -0
  102. package/dist/src/gateway/service/task-conversation-query-service.js +84 -0
  103. package/dist/src/gateway/service.d.ts +10 -0
  104. package/dist/src/gateway/service.js +75 -42
  105. package/dist/src/projects/project-agent.js +1 -1
  106. package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +112 -0
  107. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  108. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  109. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  110. package/dist/src/storage/sqlite/schema.js +1 -1
  111. package/dist/src/tasks/execution-context.js +8 -4
  112. package/dist/src/tasks/index.d.ts +2 -0
  113. package/dist/src/tasks/index.js +3 -1
  114. package/dist/src/tasks/task-application-service.js +10 -17
  115. package/dist/src/tasks/task-context-assembler.js +9 -4
  116. package/dist/src/tasks/task-context-repository.d.ts +0 -6
  117. package/dist/src/tasks/task-context-repository.js +0 -4
  118. package/dist/src/tasks/task-conversation-repository.d.ts +71 -0
  119. package/dist/src/tasks/task-conversation-repository.js +194 -0
  120. package/dist/src/tasks/task-handoff-service.d.ts +31 -0
  121. package/dist/src/tasks/task-handoff-service.js +143 -0
  122. package/dist/src/tasks/task-read-model-projector.js +1 -5
  123. package/dist/src/tasks/task-repository.d.ts +0 -2
  124. package/dist/src/tasks/task-repository.js +2 -9
  125. package/dist/src/tasks/task-run-coordinator.js +3 -1
  126. package/dist/src/workflows/service/workflow-run-service.js +4 -2
  127. package/package.json +2 -2
  128. package/dist/gateway/static/root/assets/agents-D19uNmJf.js +0 -68
  129. package/dist/gateway/static/root/assets/automations-page-BR6qMOVr.js +0 -6
  130. package/dist/gateway/static/root/assets/browser-settings-page-CDFQWAxI.js +0 -8
  131. package/dist/gateway/static/root/assets/capabilities-settings-panel-D41mssOq.js +0 -7
  132. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BXgCyuu2.js +0 -3
  133. package/dist/gateway/static/root/assets/channels-status-swr-B4Rbh3bM.js +0 -1
  134. package/dist/gateway/static/root/assets/connectors-page-C_qkEN0T.js +0 -2
  135. package/dist/gateway/static/root/assets/heartbeat-settings-B4A_CXUL.js +0 -1
  136. package/dist/gateway/static/root/assets/home-page-FVGYYPWo.js +0 -3
  137. package/dist/gateway/static/root/assets/index-CGbKTCST.js +0 -152
  138. package/dist/gateway/static/root/assets/local-app-workbench-page-BNpkigNb.js +0 -2
  139. package/dist/gateway/static/root/assets/logs-page-DXP9OQQt.js +0 -2
  140. package/dist/gateway/static/root/assets/messages-3qRsLZuX.js +0 -3
  141. package/dist/gateway/static/root/assets/notes-workbench-JRiq7QDW.js +0 -4
  142. package/dist/gateway/static/root/assets/project-detail-page-CjWA13aE.js +0 -1
  143. package/dist/gateway/static/root/assets/projects-page-jsCkScbG.js +0 -1
  144. package/dist/gateway/static/root/assets/remote-access-hub-CGPJTEkM.js +0 -1
  145. package/dist/gateway/static/root/assets/sessions-page-BBHzziMd.js +0 -1
  146. package/dist/gateway/static/root/assets/settings-advanced-gate-2cGg8-9h.js +0 -1
  147. package/dist/gateway/static/root/assets/setup-status-panel-Cf06b66-.js +0 -1
  148. package/dist/gateway/static/root/assets/shares-settings-xlNKydYY.js +0 -1
  149. package/dist/gateway/static/root/assets/skill-reload-api-C5Xu93c_.js +0 -1
  150. package/dist/gateway/static/root/assets/task-detail-page-Bkno4tTe.js +0 -1
  151. package/dist/gateway/static/root/assets/work-discovery-page-CQWZD03N.js +0 -1
  152. package/dist/gateway/static/root/assets/workflows-page-Cs-MXFJ1.js +0 -5
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-BwkSl1F_.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-CGbKTCST.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/dist-BPoKqzeH.js","assets/chunk-KS7C4IRE-BMhrPKJC.js","assets/dist-DY4Af0fY.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/working-directory-picker-modal-D-IgcHPp.js","assets/loader-circle-CifKLtgG.js","assets/locale-store-xULEcFVs.js","assets/messages-3qRsLZuX.js","assets/cn-JdwAhgNB.js","assets/button-CSEbl4zT.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-BzdnTy3h.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/globe-DSSGFWFn.js","assets/middleware-Pd0e8Igk.js","assets/schemas-zIBW3wiV.js","assets/product-delivery-tRr-7IxY.js","assets/tool-activity-R8V9l6nk.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-jB0hAhWO.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-C-fRlHCL.js","assets/activity-store-DYVN1hRp.js","assets/theme-store-CHQRiuCF.js","assets/index-CR233S0Q.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./button-CSEbl4zT.js";import{t as d}from"./messages-3qRsLZuX.js";import{l as f,n as p}from"./locale-store-xULEcFVs.js";import{i as m}from"./theme-store-CHQRiuCF.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BPoKqzeH.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{r as C}from"./settings-form-draft-Dy10ldo8.js";import{$t as w,As as T,Bl as E,Fl as D,Gs as O,Jc as k,Kl as A,Ko as j,Ks as M,Na as N,Nc as P,Oc as F,Ps as I,Qc as L,Qt as ee,Sl as R,Us as z,Va as te,Vs as ne,Wl as re,Xl as B,Xt as V,Ys as H,Zs as U,Zt as W,_r as G,ac as K,an as ie,as as ae,c as oe,cl as se,cn as ce,cr as le,cs as ue,dl as de,dn as fe,dr as q,el as J,en as pe,fn as me,fr as he,gn as ge,gr as _e,gs as ve,hn as ye,hr as be,in as xe,jc as Se,kc as Ce,ks as Y,l as we,lc as Te,ln as Ee,lr as De,mr as Oe,nn as ke,o as Ae,on as je,os as X,pn as Me,pr as Ne,ps as Pe,ql as Fe,qs as Ie,rn as Le,s as Re,sn as ze,ss as Be,tn as Ve,u as He,un as Ue,ur as We,vr as Ge,vs as Ke,wc as qe,yc as Je,ys as Ye}from"./index-CGbKTCST.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Q.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:c},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||o(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(h,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=l(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=g):g=t[4];let S=a?.alt||`Image preview`,C;t[5]===S?C=t[6]:(C=(0,$.jsx)(b,{className:`sr-only`,children:S}),t[5]=S,t[6]=C);let w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(j,{className:`size-5`,"aria-hidden":!0}),t[7]=w):w=t[7];let T;t[8]===i?T=t[9]:(T=(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:w})}),t[8]=i,t[9]=T);let E;t[10]===a?E=t[11]:(E=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=E);let D;t[12]!==T||t[13]!==E||t[14]!==C?(D=(0,$.jsxs)(v,{children:[m,(0,$.jsxs)(y,{className:g,"aria-describedby":void 0,children:[C,T,E]})]}),t[12]=T,t[13]=E,t[14]=C,t[15]=D):D=t[15];let O;t[16]!==D||t[17]!==f?(O=(0,$.jsx)(x,{open:f,onOpenChange:p,children:D}),t[16]=D,t[17]=f,t[18]=O):O=t[18];let k;return t[19]!==n||t[20]!==O?(k=(0,$.jsxs)(Xe.Provider,{value:d,children:[n,O]}),t[19]=n,t[20]=O,t[21]=k):k=t[21],k}function et(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=Ge(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=l(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Se,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>o(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=l(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==c||t[13]!==d?(f=(0,$.jsx)(ge,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=c,t[13]=d,t[14]=f):f=t[14],f}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function lt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:u,duration:d,noteId:f,attachmentId:p}=G(),m=G(dt),h=f===n&&p===r,g=h&&o,_=h&&s,v=h?u:0,y=h&&d>0?d:i??0,b=y>0?Math.min(v/y*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==m?(x=e=>{e.stopPropagation(),m(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=m,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==m?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),m(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=m,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=l(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=g?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=l(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=g?`Pause`:`Play`,k;t[14]!==_||t[15]!==g?(k=_?(0,$.jsx)(c,{className:`size-3.5 animate-spin`}):g?(0,$.jsx)(H,{className:`size-3.5`}):(0,$.jsx)(z,{className:`size-3.5 ml-0.5`}),t[14]=_,t[15]=g,t[16]=k):k=t[16];let A;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,$.jsx)(`button`,{type:`button`,onClick:S,onKeyDown:w,className:D,"aria-label":O,children:k}),t[17]=S,t[18]=w,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${b}%`,M;t[23]===j?M=t[24]:(M=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==y||t[26]!==h||t[27]!==v?(N=ct(h&&v>0?v:y),t[25]=y,t[26]=h,t[27]=v,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==T||t[36]!==A?(I=(0,$.jsxs)(`div`,{className:T,onClick:ut,children:[A,F]}),t[34]=F,t[35]=T,t[36]=A,t[37]=I):I=t[37],I}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(e){let t=(0,Z.c)(83),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==c||t[1]!==n?(f=ft(n,c),t[0]=c,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,Q.useState)(_t),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==u?(g=at(n.createdAt,h,u),t[3]=n.createdAt,t[4]=h,t[5]=u,t[6]=g):g=t[6];let _=g,v,y;t[7]!==n.id||t[8]!==i?(v=()=>i(n.id),y=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=v,t[10]=y):(v=t[9],y=t[10]);let b=d?`bg-surface-panel hover:bg-surface-panel`:`bg-transparent hover:bg-surface-panel/70`,x;t[11]===b?x=t[12]:(x=l(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,b),t[11]=b,t[12]=x);let S=d?`true`:void 0,C;t[13]===d?C=t[14]:(C=d?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=d,t[14]=C);let w;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(w=n.coverAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=w):w=t[20];let T;t[21]===n.title?T=t[22]:(T=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=T);let E=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,D;t[23]===E?D=t[24]:(D=l(`truncate text-sm leading-5`,E),t[23]=E,t[24]=D);let k;t[25]!==p||t[26]!==D?(k=(0,$.jsx)(`p`,{className:D,children:p}),t[25]=p,t[26]=D,t[27]=k):k=t[27];let A;t[28]!==T||t[29]!==k?(A=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,k]}),t[28]=T,t[29]=k,t[30]=A):A=t[30];let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(Ne,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(J,{className:`size-4`})})}),t[31]=j):j=t[31];let N;t[32]!==n.id||t[33]!==n.pinned||t[34]!==a?(N=()=>a(n.id,!n.pinned),t[32]=n.id,t[33]=n.pinned,t[34]=a,t[35]=N):N=t[35];let P;t[36]===n.pinned?P=t[37]:(P=n.pinned?(0,$.jsx)(O,{className:`size-4`}):(0,$.jsx)(M,{className:`size-4`}),t[36]=n.pinned,t[37]=P);let F=n.pinned?c.unpin:c.pin,I;t[38]!==N||t[39]!==P||t[40]!==F?(I=(0,$.jsxs)(De,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:N,children:[P,F]}),t[38]=N,t[39]=P,t[40]=F,t[41]=I):I=t[41];let L;t[42]!==n.id||t[43]!==o?(L=()=>o(n.id),t[42]=n.id,t[43]=o,t[44]=L):L=t[44];let ee;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Fe,{className:`size-4`}),t[45]=ee):ee=t[45];let R;t[46]!==c.archive||t[47]!==L?(R=(0,$.jsxs)(De,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:L,children:[ee,c.archive]}),t[46]=c.archive,t[47]=L,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(he,{className:`my-1 h-px bg-edge-subtle`}),t[49]=z):z=t[49];let te;t[50]!==n.id||t[51]!==s?(te=()=>s(n.id),t[50]=n.id,t[51]=s,t[52]=te):te=t[52];let ne;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(X,{className:`size-4`}),t[53]=ne):ne=t[53];let re;t[54]!==c.delete||t[55]!==te?(re=(0,$.jsxs)(De,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:te,children:[ne,c.delete]}),t[54]=c.delete,t[55]=te,t[56]=re):re=t[56];let B;t[57]!==I||t[58]!==R||t[59]!==re?(B=(0,$.jsxs)(q,{children:[j,(0,$.jsx)(We,{children:(0,$.jsxs)(le,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[I,R,z,re]})})]}),t[57]=I,t[58]=R,t[59]=re,t[60]=B):B=t[60];let V;t[61]!==w||t[62]!==A||t[63]!==B?(V=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[w,A,B]}),t[61]=w,t[62]=A,t[63]=B,t[64]=V):V=t[64];let H;t[65]===n.pinned?H=t[66]:(H=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(M,{className:`size-3`})}),t[65]=n.pinned,t[66]=H);let U;t[67]===n.tags?U=t[68]:(U=n.tags?.slice(0,2).map(mt),t[67]=n.tags,t[68]=U);let W;t[69]===_?W=t[70]:(W=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:_}),t[69]=_,t[70]=W);let G;t[71]!==H||t[72]!==U||t[73]!==W?(G=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[H,U,W]}),t[71]=H,t[72]=U,t[73]=W,t[74]=G):G=t[74];let K;return t[75]!==V||t[76]!==G||t[77]!==v||t[78]!==y||t[79]!==x||t[80]!==S||t[81]!==C?(K=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:v,onKeyDown:y,className:x,"aria-current":S,children:[C,V,G]}),t[75]=V,t[76]=G,t[77]=v,t[78]=y,t[79]=x,t[80]=S,t[81]=C,t[82]=K):K=t[82],K}function mt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,f=c===void 0?`card`:c,m=p(xt),h=d(m).automations.suggestions,g=d(m).automations,_=a(),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=v):v=t[0];let{data:y}=S(o?`automation-suggestion-coverage`:null,bt,v),b=o?y?.automations.find(e=>we(e,o)):void 0,x=b?Re(b,g):[];if(f===`titleAction`){if(b){let e;t[1]===s?e=t[2]:(e=l(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(R,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===_?r=t[5]:(r=()=>_(`/automations`),t[4]=_,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:h.coveredTitle}),(0,$.jsx)(u,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:h.manage})]})}let e;t[6]===s?e=t[7]:(e=l(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Je,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==_||t[13]!==i?(c=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=_,t[13]=i,t[14]=c):c=t[14];let d;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(Ye,{className:`size-3.5`,"aria-hidden":!0}),t[15]=d):d=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(u,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[d,h.create]})]})}if(b){let e;t[16]===s?e=t[17]:(e=l(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===_?r=t[20]:(r=()=>_(`/automations`),t[19]=_,t[20]=r);let i;return t[21]!==h||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(u,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:h.manage})}),t[21]=h,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:h.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:oe(h.coveredDescription,{name:b.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:g.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:x.map(yt)})]}),i]})}let C;t[24]===s?C=t[25]:(C=l(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=C);let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(Je,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=w):w=t[26];let T;t[27]===n?T=t[28]:(T=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=T);let E;t[29]===r?E=t[30]:(E=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=E);let D;t[31]!==T||t[32]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[w,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,E]})]}),t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==_||t[35]!==i?(O=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=_,t[35]=i,t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Ye,{className:`size-3.5`,"aria-hidden":!0}),t[37]=k):k=t[37];let A;t[38]!==h.create||t[39]!==O?(A=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(u,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:O,children:[k,h.create]})}),t[38]=h.create,t[39]=O,t[40]=A):A=t[40];let j;return t[41]!==A||t[42]!==C||t[43]!==D?(j=(0,$.jsxs)(`section`,{className:C,children:[D,A]}),t[41]=A,t[42]=C,t[43]=D,t[44]=j):j=t[44],j}function yt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function bt(){return He.list()}function xt(e){return e.language}function St(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(e){let t=(0,Z.c)(35),{noteId:n}=e,r=p(Dt),i;t[0]===r?i=t[1]:(i=d(r),t[0]=r,t[1]=i);let a=i.notes.discussionCapture,o,s;t[2]===n?(o=t[3],s=t[4]):(o=[`note-discussion-document`,n],s=()=>V(n),t[2]=n,t[3]=o,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={revalidateOnFocus:!1},t[5]=c):c=t[5];let{data:l,mutate:u}=S(o,s,c),f,m;if(t[6]===u?(f=t[7],m=t[8]):(f=()=>{let e=e=>{let t=e.detail;t&&u(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Et);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void u();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},m=[u],t[6]=u,t[7]=f,t[8]=m),(0,Q.useEffect)(f,m),!l)return null;let{discussion:h,transcript:g}=l,_=l.organization?.organization,v=[`stopping`,`sealing`,`organizing`].includes(h.status),y;t[9]!==a.actionItems||t[10]!==a.decisions||t[11]!==a.openQuestions||t[12]!==a.organization||t[13]!==a.risks||t[14]!==_?(y=_?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),a.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:_.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2`,children:[_.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.decisions}),(0,$.jsx)(St,{values:_.decisions})]}):null,_.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.actionItems}),(0,$.jsx)(St,{values:_.actionItems.map(Tt)})]}):null,_.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.risks}),(0,$.jsx)(St,{values:_.risks})]}):null,_.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.openQuestions}),(0,$.jsx)(St,{values:_.openQuestions})]}):null]})]}):null,t[9]=a.actionItems,t[10]=a.decisions,t[11]=a.openQuestions,t[12]=a.organization,t[13]=a.risks,t[14]=_,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(K,{className:`size-4 text-accent`,"aria-hidden":!0}),t[16]=b):b=t[16];let x=h.status===`recording`?a.draftTranscript:a.fullTranscript,C;t[17]===x?C=t[18]:(C=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[17]=x,t[18]=C);let w;t[19]===h.status?w=t[20]:(w=h.status===`needs_attention`?(0,$.jsx)(ae,{className:`size-3.5 text-danger`}):h.status===`completed`?(0,$.jsx)(R,{className:`size-3.5 text-success`}):null,t[19]=h.status,t[20]=w);let T=v?a.finalizing:h.status===`needs_attention`?h.failureMessage:null,E;t[21]!==w||t[22]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[w,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==C||t[25]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[C,E]}),t[24]=C,t[25]=E,t[26]=D):D=t[26];let O=g.text||a.waitingTranscript,k;t[27]===O?k=t[28]:(k=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:O}),t[27]=O,t[28]=k);let A;t[29]!==D||t[30]!==k?(A=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[D,k]}),t[29]=D,t[30]=k,t[31]=A):A=t[31];let j;return t[32]!==A||t[33]!==y?(j=(0,$.jsxs)(`div`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle`,children:[y,A]}),t[32]=A,t[33]=y,t[34]=j):j=t[34],j}function Tt(e){return e.title}function Et(e,t){return e.sequence-t.sequence}function Dt(e){return e.language}var Ot={edit:Ie,ai_edit:Ye,sync:I,restore:A};function kt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function At({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=d(p(e=>e.language)).notes,o=a,{data:s}=S(e?[`note-history`,e]:null,()=>Le(e)),[c,u]=(0,Q.useState)(!1),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),_=(0,Q.useCallback)(async t=>{u(!0),g(null);try{await me(e,t),m(null),i()}catch{g(a.restoreFailed)}finally{u(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),v=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[h?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:h}):null,s?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:s.map(e=>{let r=Ot[e.trigger]??Ie,i=t===e.timestamp,s=f===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:l(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:kt(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,v,o)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),_(e.timestamp)},disabled:c,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:c?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function jt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:o,onClose:s,noteThreads:c,openingChat:u,onOpenChat:f,onOpenNewChat:m}=e,h=d(p(Rt)).notes,g=a(),_=r?.aiDeep?.catalysis,v=_?.report??null,y;t[0]===n?y=t[1]:(y=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=y);let b;t[2]===n?b=t[3]:(b=()=>Ve(n),t[2]=n,t[3]=b);let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[4]=x):x=t[4];let{data:C,mutate:w,isLoading:T}=S(y,b,x),E;t[5]===n?E=t[6]:(E=async e=>{try{await fe(n,e)}catch{}},t[5]=n,t[6]=E);let D=E,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Ye,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=O):O=t[7];let k;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(re,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=k):k=t[8];let A;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(Te,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=A):A=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:h.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":h.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:k})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:h.catalysisSectionDescription}),C?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(()=>Ue(n),{revalidate:!1}),disabled:T,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:h.contextRebuild}),(0,$.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-[11px] font-medium`,C.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:C.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:C.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:h.contextStatusDetail.replace(`{{attachments}}`,String(C.attachments.length)).replace(`{{tokens}}`,String(C.tokenEstimate??0))}),C.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:C.attachments.slice(0,5).map(Lt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:o,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?h.processing:v?h.recatalyze:h.catalyzeAction}),v?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:v.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.targetUsers.slice(0,5).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.keyQuestions.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.mvpPath.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.risks.slice(0,3).map(Nt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:v.nextActions.slice(0,4).map(Mt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h.confidenceLabel.replace(`{{percent}}`,String(Math.round(v.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`helpful`),className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackHelpfulAria,children:(0,$.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`not_helpful`),className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,_?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":h.feedbackNotHelpfulAria,children:(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:h.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[A,h.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:h.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:f,disabled:u,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:u?h.openingChat:h.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:m,disabled:u,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:h.newThread})]})]}),c.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:c.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>g(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||h.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:h.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:h.noThreads})]})]})]})}function Mt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function Nt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function Pt(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function Ft(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function It(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Lt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Rt(e){return e.language}var zt=()=>i(()=>import(`./block-editor-BwkSl1F_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])),Bt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([42,1,3,39,5,43])),Vt=(0,Q.lazy)(()=>zt().then(e=>({default:e.BlockEditor}))),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.MarkdownEditor})));function Ut(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Wt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:k},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:se},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:L},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let u=c,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},onFocus:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},className:l(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Gt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,f=a===void 0?!0:a,m=s===void 0?!0:s,h=l===void 0?!1:l,g=p(Kt),_;t[0]===g?_=t[1]:(_=d(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==f?(y=(0,$.jsx)(qt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:c,autoFocus:h,onAutoFocusConsumed:u}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=f,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)($e,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Kt(e){return e.language}function qt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:u}){let f=p(e=>e.language),h=d(f).notes,g=d(f).automations.suggestions,_=a(),v=m(e=>e.resolved)===`dark`,{openImage:y}=Ze(),[b,x]=(0,Q.useState)(`wysiwyg`),[C,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(``),[M,N]=(0,Q.useState)(360),[F,I]=(0,Q.useState)(!1),[L,ee]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),[ne,V]=(0,Q.useState)(null),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(!1),G=(0,Q.useRef)(null),K=(0,Q.useRef)(null),ie=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=te(e=>e.setPageHeader),fe=te(e=>e.clearPageHeader),{data:q,mutate:J}=S(e?[`note-detail`,e]:null,()=>pe(e)),{data:me=[],mutate:he}=S(e?[`note-threads`,e]:null,()=>xe(e),{revalidateOnFocus:!1}),ge=E!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{H.current=!1,j(``),D(null),w(null),U.current=!1,ue.current=null},[e]),(0,Q.useEffect)(()=>{!q||H.current||(j(q.title??``),H.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!c||!q||ge||ue.current===e)return;let t=window.requestAnimationFrame(()=>{le.current?.focus(),u?.()});return ue.current=e,()=>window.cancelAnimationFrame(t)},[c,ge,q,e,u]);let ve=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Se=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":h.back,className:l(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,B,i),children:(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})}):null,[i,h.back,t,r]),Ce=(0,Q.useCallback)(t=>{j(t),e&&(ae.current=t,K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let t=ae.current;if(ae.current=null,t!==null){k(!0);try{await Me(e,{title:t}),await J(),n?.()}catch{}finally{k(!1)}}},600))},[e,J,n]),Y=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:l(`flex min-w-0 items-center gap-2`,B),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:A||ve||void 0,children:A||ve}),O?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:h.saving}):null]}),[h.saving,O,ve,A]),we=(0,Q.useCallback)(async(t=!1)=>{z(!0),V(null);try{let n=await je(e,{forceNew:t});await J(),await he(),_(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){V(`${h.chatOpenFailedTitle}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{z(!1)}},[J,he,_,e,h.chatOpenFailedMessage,h.chatOpenFailedTitle]),Ee=(0,Q.useCallback)(async()=>{ee(!0),V(null);try{await W(e),await J()}catch(e){V(`${h.catalysisFailed}: ${e instanceof Error?e.message:h.chatOpenFailedMessage}`)}finally{ee(!1)}},[J,e]),De=(0,Q.useCallback)(()=>{w(C===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!L&&Ee()},[C,L,Ee,q?.aiDeep?.catalysis?.report]),X=(0,Q.useCallback)(()=>{let t=E?.markdown??ie.current??q?.markdown??``,n=E?.title??A,r=be([n,t].filter(Boolean).join(`
3
-
4
- `));return{source:{type:`note`,id:e,title:n||h.titlePlaceholder},text:r,language:_e(r,f)}},[f,h.titlePlaceholder,q?.markdown,e,E,A]),Ne=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:l(`flex items-center gap-2`,B),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":h.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Oe,{input:X,labels:{read:h.readAloud,preparing:h.readAloudPreparing,pause:h.readAloudPause,resume:h.readAloudResume,retry:h.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:De,disabled:L,"aria-label":h.catalysisSectionTitle,className:l(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,C===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(Ye,{className:`size-3.5`,"aria-hidden":!0}),L?h.catalyzing:h.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>we(!1),disabled:R,className:l(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),R?h.openingChat:h.openChatButton]}),(0,$.jsx)(Wt,{mode:b,onModeChange:x,labels:{edit:h.modeEdit,source:h.modeSource,preview:h.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>w(C===`history`?null:`history`),"aria-label":h.history,className:l(`rounded-lg p-1.5 transition-colors`,C===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(P,{className:`size-4`,"aria-hidden":!0})})]}),[L,De,we,b,h.history,h.modeEdit,h.modePreview,h.modeSource,R,C,s,h.searchDialogTitle,h.readAloud,h.readAloudPause,h.readAloudPreparing,h.readAloudResume,h.readAloudRetry,X]);(0,Q.useLayoutEffect)(()=>(de({startExtra:Se,main:q?Y:null,end:q?Ne:null}),()=>{o&&fe()}),[o,fe,Ne,Y,Se,q,de]);let Pe=(0,Q.useCallback)(t=>{e&&(ie.current=t,G.current&&clearTimeout(G.current),G.current=setTimeout(async()=>{let t=ie.current;if(ie.current=null,t!==null){k(!0),V(null);try{await Me(e,{markdown:t}),await J(),n?.()}catch(e){V(`${h.saveFailed}: ${e instanceof Error?e.message:h.saveFailedHint}`)}finally{k(!1)}}},600))},[e,J,h.saveFailed,h.saveFailedHint,n]),Fe=(0,Q.useCallback)(t=>{ke(e,t.timestamp).then(e=>{e&&D(e)})},[e]),Ie=(0,Q.useCallback)(()=>{w(null),D(null)},[]),Le=(0,Q.useCallback)(()=>{w(null),D(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{G.current&&clearTimeout(G.current),K.current&&clearTimeout(K.current);let t=ie.current,n=ae.current;ie.current=null,ae.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Me(e,r)},[e]),q===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(q===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:h.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:h.back})]});let Re=ge?E.title??``:A,ze=ge?E.markdown??``:q.markdown??``,Be=new Date(q.createdAt).getTime(),Ve=Number.isFinite(Be)&&Date.now()-Be<3600*1e3?(0,$.jsx)(vt,{title:g.noteCreatedTitle,description:g.noteCreatedDescription,prompt:g.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ne?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ne}):null,(0,$.jsx)(Ae,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(Ae,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:oe,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:[(0,$.jsx)(wt,{noteId:e}),ge?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Re&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Re}),ze?(0,$.jsx)(ye,{noteId:e,content:ze,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[b===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:le,type:`text`,value:A,onChange:e=>Ce(e.target.value),onCompositionStart:()=>{U.current=!0},onCompositionEnd:()=>{U.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!U.current&&!t.isComposing&&(e.preventDefault(),(oe.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ut,{}),children:(0,$.jsx)(Vt,{initialContent:q.markdown??``,onChange:Pe,noteId:e},`wysiwyg-${e}`)})})]}),b===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:le,type:`text`,value:A,onChange:e=>Ce(e.target.value),placeholder:h.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ut,{}),children:(0,$.jsx)(Ht,{initialContent:q.markdown??``,onChange:Pe,isDark:v},`source-${e}`)})})]}),b===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&y(t.currentSrc||t.src,t.alt)},children:[A&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:A}),q.markdown?(0,$.jsx)(ye,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:h.emptyPreview})]})]})]})]}),(0,$.jsx)(`div`,{ref:se,className:l(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!F&&`transition-[width] duration-300 ease-in-out`),style:{width:C?M:0},children:(0,$.jsxs)(`div`,{ref:ce,className:`flex min-h-0 flex-1 flex-col`,style:{width:M},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),I(!0);let n=e.clientX,r=M,i=e.pointerId,a=0,o=M,s=M,c=()=>{a=0,s=o,C&&se.current?.style.setProperty(`width`,`${s}px`),ce.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}I(!1),N(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:l(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,F&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:C===`history`?(0,$.jsx)(At,{noteId:e,activeTimestamp:E?.timestamp??null,onSelect:Fe,onClose:Ie,onRestored:Le}):C===`breakdown`?(0,$.jsx)(jt,{noteId:e,note:q??null,catalyzing:L,onCatalyze:Ee,onClose:()=>w(null),noteThreads:me,openingChat:R,onOpenChat:()=>we(!1),onOpenNewChat:()=>we(!0)}):null})]})})]})}var Jt=3e4;function Yt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Xt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:o=!1,voiceDisabled:s=!1,onDiscussionCapture:c,discussionCaptureLabel:u=`Record discussion`}){let[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(0),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C=(0,Q.useRef)(null),w=(0,Q.useRef)([]),T=(0,Q.useRef)(0),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useCallback)(()=>{D.current&&=(clearInterval(D.current),null),O.current&&=(clearTimeout(O.current),null),C.current?.getTracks().forEach(e=>e.stop()),C.current=null,S.current=null,w.current=[],g(!1),v(0)},[]);(0,Q.useEffect)(()=>()=>k(),[k]);let A=(0,Q.useCallback)(async()=>{let e=S.current;if(!e||e.state!==`recording`)return;b(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-T.current)/1e3)),n=e.mimeType||Yt()||`audio/webm`,r=new Blob(w.current,{type:n});if(k(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{b(!1)}return}b(!1)},[k,i]),j=(0,Q.useCallback)(async()=>{if(!(!i||y||h)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Yt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);C.current=e,S.current=n,w.current=[],T.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&w.current.push(e.data)},n.start(),g(!0),v(0),D.current=setInterval(()=>{v(Math.round((Date.now()-T.current)/1e3))},250),O.current=setTimeout(()=>{A()},Jt)}catch{k()}},[k,i,h,A,y]),M=(0,Q.useCallback)(()=>{if(h){A();return}j()},[h,j,A]),N=(0,Q.useCallback)(async e=>{let t=d.trim();if(!(!t||p)){m(!0),f(``);try{await n(t,e)}catch{f(t)}finally{m(!1),x.current?.focus()}}},[d,p,n]),P=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),N()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),N({navigate:!1}))},[N]),F=p||y;return(0,$.jsxs)(`div`,{className:l(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,h&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:F||o||h,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,$.jsx)(Ce,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:M,disabled:F||s||p,className:l(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":h?`Stop recording`:`Voice`,"aria-pressed":h,children:h?(0,$.jsx)(ve,{className:`size-4 fill-current`}):(0,$.jsx)(K,{className:`size-4`})}),c&&!h?(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:F,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":u,title:u,children:(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0})}):null,h?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(_))}):(0,$.jsx)(`textarea`,{ref:x,value:d,onChange:e=>f(e.target.value),onKeyDown:P,placeholder:e,rows:1,disabled:F,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!d.trim()||F||h,onClick:e=>void N({navigate:!e.shiftKey}),"aria-label":t,className:l(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,d.trim()&&!F&&!h?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(Y,{className:`size-4`})})]})}var Zt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Qt=240,$t=320,en=520,tn=560;function nn(e){if(globalThis.localStorage===void 0)return $t;try{let t=globalThis.localStorage.getItem(e);if(!t)return $t;let n=Number(t);return Number.isFinite(n)?n:$t}catch{return $t}}function rn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var an={thought:Pe,todo:Ke,voice:K,media:Ce,bookmark:D,mixed:Pe,task:Ke};function on(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function sn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function cn(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function ln({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:c,listTitle:u,listDescription:m,emptyText:E,emptyDescription:O,listWidthStorageKey:k=`xopc.notes.listWidth`}){let A=d(p(e=>e.language)).notes,P=!!f(e=>e.token),[I,L]=(0,Q.useReducer)(C,Zt),[R,z]=(0,Q.useState)(!1),[re,V]=(0,Q.useState)(``),[H,W]=(0,Q.useState)(0),[G,ae]=(0,Q.useState)(()=>nn(k)),[oe,se]=(0,Q.useState)(!1),[le,ue]=(0,Q.useState)(!1),[fe,q]=(0,Q.useState)(!1),[J,pe]=(0,Q.useState)(null),[me,he]=(0,Q.useState)(null),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),[ve]=(0,Q.useState)(()=>Date.now()),ye=a(),be=(0,Q.useCallback)(e=>{let t=ge.current?.clientWidth??window.innerWidth,n=Math.max(Qt,t-tn);return Math.max(Qt,Math.min(Math.min(en,n),e))},[]),xe=(0,Q.useCallback)(e=>{let t=be(e);ae(t),rn(k,t)},[be,k]);(0,Q.useLayoutEffect)(()=>{ae(e=>be(e))},[be]);let{data:Se,mutate:Y,isLoading:we}=S((0,Q.useMemo)(()=>P?[`notes-list`,c,I.statusFilter,I.kindFilter,I.pinnedOnly]:null,[P,c,I.statusFilter,I.kindFilter,I.pinnedOnly]),()=>ie({status:I.statusFilter===`all`?void 0:I.statusFilter,kind:I.kindFilter===`all`?void 0:I.kindFilter,projectId:c,pinned:I.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),Te=we&&!Se,De=Se?.items??[],Oe=Se?.total??0,ke=re.trim(),{data:Ae,isLoading:je}=S(P&&R&&ke?[`notes-search`,c,ke]:null,()=>ie({search:ke,projectId:c,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=Ae?.items??[],Ne=e?De.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{W(0)},[ke]),(0,Q.useEffect)(()=>{H>=X.length&&W(Math.max(0,X.length-1))},[H,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Ie=te(e=>e.setPageHeader),Le=te(e=>e.clearPageHeader),Re=Oe>0?A.noteCount.replace(`{{count}}`,String(Oe)):null,Be=A.searchDialogTitle,Ve=A.searchClose,He=A.searchClear,Ue=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>z(!0),className:l(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,B),"aria-label":Be,children:[(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Be})]}),[Be]);(0,Q.useLayoutEffect)(()=>{if(n)return P?(Ie({startExtra:null,main:(0,$.jsxs)(`div`,{className:l(`flex min-w-0 items-center gap-2`,B),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:u??A.title}),Re?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Re}):null]}),end:Ue}),()=>Le()):(Le(),()=>Le())},[Le,P,Ue,u,n,A.title,Re,e,Ie]);let We=(0,Q.useMemo)(()=>({justNow:A.justNow,minutesAgo:A.minutesAgo,today:A.today,yesterday:A.yesterday,daysAgo:A.daysAgo}),[A.justNow,A.minutesAgo,A.today,A.yesterday,A.daysAgo]),Ge=(0,Q.useMemo)(()=>[{id:`recent`,label:A.viewRecent,description:A.viewRecentDescription,icon:de,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:A.filterInbox,description:A.viewInboxDescription,icon:F,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:A.pinned,description:A.viewPinnedDescription,icon:M,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:A.viewTasks,description:A.viewTasksDescription,icon:Ke,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:A.kindVoice,description:A.viewVoiceDescription,icon:K,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:A.kindMedia,description:A.viewMediaDescription,icon:Ce,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:A.kindBookmark,description:A.viewBookmarksDescription,icon:D,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:A.filterProcessed,description:A.viewProcessedDescription,icon:qe,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:A.filterArchived,description:A.viewArchiveDescription,icon:Fe,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[A.filterArchived,A.filterInbox,A.filterProcessed,A.kindBookmark,A.kindMedia,A.kindVoice,A.pinned,A.viewArchiveDescription,A.viewBookmarksDescription,A.viewInboxDescription,A.viewMediaDescription,A.viewPinnedDescription,A.viewProcessedDescription,A.viewRecent,A.viewRecentDescription,A.viewTasks,A.viewTasksDescription,A.viewVoiceDescription]),Je=Ge.find(e=>sn(I,e))??Ge[0],Ye=u??Je.label,Z=m??Je.description,Xe=(0,Q.useCallback)(async(e,n)=>{let r=c?await ee({markdown:e,kind:`thought`,projectId:c,channel:`web`}):await ze(e,`web`);await Y(),n?.navigate!==!1&&ye(cn(t,r.id))},[t,Y,ye,c]),Ze=(0,Q.useCallback)(async()=>{if(!fe){q(!0),pe(null);try{let e=await ee({markdown:``,kind:`thought`,projectId:c,channel:`web`});L({type:`patch`,patch:Zt}),await Y(),he(e.id),ye(cn(t,e.id))}catch(e){pe(`${A.createBlankFailed}: ${e instanceof Error?e.message:A.createBlankFailedHint}`)}finally{q(!1)}}},[t,fe,Y,A.createBlankFailed,A.createBlankFailedHint,ye,c]),Qe=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{pe(null),await ce(t,`web`),await Y()}catch(e){pe(`${A.imageUploadFailed}: ${e instanceof Error?e.message:A.imageUploadFailedHint}`)}},e.click()},[Y,A.imageUploadFailed,A.imageUploadFailedHint]),$e=(0,Q.useCallback)(async(e,t)=>{try{pe(null),await Ee(e,t,`web`),await Y()}catch(e){pe(`${A.voiceUploadFailed}: ${e instanceof Error?e.message:A.voiceUploadFailedHint}`)}},[Y,A.voiceUploadFailed,A.voiceUploadFailedHint]),et=(0,Q.useCallback)(async(e,t)=>{await Me(e,{pinned:t}),await Y()},[Y]),tt=(0,Q.useCallback)(async e=>{await Me(e,{status:`archived`}),await Y()},[Y]),nt=(0,Q.useCallback)(async e=>{await w(e),await Y()},[Y]),rt=(0,Q.useCallback)(e=>{ye(cn(t,e))},[t,ye]),it=(0,Q.useCallback)(e=>{ye(cn(t,e)),z(!1)},[t,ye]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),W(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),W(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[H]??X[0];t&&it(t.id)}}},[H,it,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=_e.current;t.setPointerCapture(e.pointerId),se(!0);let r=ge.current?.clientWidth??window.innerWidth,i=Math.max(Qt,r-tn),a=Math.min(en,i),o=e=>Math.max(Qt,Math.min(a,e)),s=e.clientX,c=o(G),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}se(!1),ge.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),ae(f),rn(k,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[k,G]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ze())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ze]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),xe(G-16)):e.key===`ArrowRight`?(e.preventDefault(),xe(G+16)):e.key===`Home`?(e.preventDefault(),xe(Qt)):e.key===`End`&&(e.preventDefault(),xe(en))},[xe,G]);return P?(0,$.jsxs)(`div`,{ref:ge,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${G}px`},children:[(0,$.jsxs)(`section`,{ref:_e,className:l(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!oe&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,le?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":le?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[J?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:J}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(o,{value:Je.id,onChange:e=>{let t=Ge.find(t=>t.id===e.target.value);t&&L({type:`patch`,patch:t.patch})},className:`-ml-1 block max-w-44 truncate rounded-lg border border-transparent bg-transparent px-1 py-0.5 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":A.libraryTitle,children:Ge.map(e=>(0,$.jsx)(s,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Ye}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Re??Z})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>ue(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":A.collapseNotesList,title:A.collapseNotesList,children:(0,$.jsx)(U,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ze,disabled:fe,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":A.createBlankNote,title:A.createBlankShortcut,children:(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>z(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":A.searchDialogTitle,children:(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:Te?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):De.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 px-6 py-16 text-center`,children:[(0,$.jsx)(Pe,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Ne?A.noteOutsideCurrentView:E??A.noNotes}),e&&!Ne?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:O??A.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ne?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:A.noteOutsideCurrentView}):null,De.map((t,n)=>{let r=n>0?st(De[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[st(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:l(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ot(t.createdAt,ve,We)}),(0,$.jsx)(pt,{note:t,selected:t.id===e,onPress:rt,onPin:et,onArchive:tt,onDelete:nt,timeLabels:We,labels:{pin:A.pin,unpin:A.unpin,archive:A.archive,delete:A.delete,imageNote:A.imageNote,noText:A.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Xt,{placeholder:A.quickCapturePlaceholder,sendLabel:A.send,onCapture:Xe,onImagePick:i?Qe:void 0,onVoiceCapture:i?$e:void 0,recordingLabel:A.recording,discussionCaptureLabel:A.discussionCapture.title,onDiscussionCapture:()=>N(c)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":A.resizeNotesList,"aria-valuemin":Qt,"aria-valuemax":en,"aria-valuenow":Math.round(G),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>xe($t),onKeyDown:ut,title:A.resizeNotesList,className:l(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,le?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:l(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,oe&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:l(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[le?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ue(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":A.expandNotesList,title:A.expandNotesList,children:(0,$.jsx)(U,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Gt,{noteId:e,onBack:()=>ye(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>z(!0),autoFocus:e===me,onAutoFocusConsumed:()=>he(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(Pe,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:A.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:A.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ze,disabled:fe,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),fe?A.creatingBlankNote:A.createBlankNote]})]})})]}),(0,$.jsx)(x,{open:R,onOpenChange:z,children:(0,$.jsxs)(v,{children:[(0,$.jsx)(h,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(y,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(b,{className:`text-sm font-semibold text-fg`,children:Be}),(0,$.jsx)(g,{className:`sr-only`,children:A.searchPlaceholder}),(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Ve,children:(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(T,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:re,onChange:e=>V(e.target.value),onKeyDown:ct,placeholder:A.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),re?(0,$.jsx)(`button`,{type:`button`,onClick:()=>V(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":He,children:(0,$.jsx)(j,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:ke?je&&!Ae?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(Pe,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:A.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:A.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:A.searchResultsCount.replace(`{{count}}`,String(Ae?.total??X.length))}),X.map((e,t)=>{let n=an[e.kind]||Pe,r=on(e,{imageNote:A.imageNote,noText:A.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),onMouseEnter:()=>W(t),className:l(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===H?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:at(e.updatedAt,ve,We)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(T,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:A.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:A.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(Pe,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:A.needToken})]})}export{Ze as n,ln as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,u as h}from"./popover-select-BzdnTy3h.js";import{t as g}from"./copy-Dv6d4Dvw.js";import{t as _}from"./external-link-DjqjBmc3.js";import{t as v}from"./cn-JdwAhgNB.js";import{t as y}from"./button-CSEbl4zT.js";import{t as b}from"./copy-to-clipboard-HOJ79TWv.js";import{t as x}from"./messages-3qRsLZuX.js";import{n as S,r as C,s as w}from"./locale-store-xULEcFVs.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./dist-BPoKqzeH.js";import{Aa as N,Ai as P,As as F,Cc as I,Ci as L,Da as ee,Di as R,Dl as z,Dn as te,Ds as B,Ei as V,El as H,Es as U,Fi as W,Go as ne,Gs as G,Gt as re,Hc as ie,I as ae,Ii as K,Jr as q,K as oe,Kc as se,Ko as ce,Ks as le,M as ue,Mc as de,Mi as fe,N as pe,Nc as me,Ni as he,Ns as ge,Pi as _e,Pn as ve,Ra as ye,Sc as be,Si as xe,Sl as Se,Tl as Ce,U as we,Us as Te,Ut as Ee,Va as De,Vc as Oe,Vs as ke,W as Ae,Wl as je,Xs as Me,Y as Ne,Ys as Pe,_a as Fe,_c as Ie,aa as Le,ba as Re,ca as ze,da as Be,es as Ve,fa as He,fs as Ue,ga as We,ha as Ge,ia as Ke,ji as qe,js as Je,ki as Ye,kl as Xe,la as Ze,ma as Qe,nl as $e,ns as et,oa as tt,ol as nt,os as rt,pa as it,qc as at,ql as ot,sa as st,sc as ct,si as lt,u as ut,ua as dt,ul as ft,va as pt,wl as mt,xa as ht,xl as gt,ya as _t,ys as vt,zc as yt}from"./index-CGbKTCST.js";import{t as bt}from"./notes-workbench-JRiq7QDW.js";import{n as xt,t as St}from"./use-autosave-7XfKULPI.js";import{t as Ct}from"./page-tabs-BaEQMYm_.js";import{t as wt}from"./directory-picker-path-field-AsFWmOjG.js";import{t as Tt}from"./date-picker-D4zCUQJL.js";import{i as Et,p as Dt,s as Ot}from"./skills-page.utils-vXSqHR7g.js";import{t as kt}from"./dependency-picker-DpQAxS2k.js";import{c as At,l as jt,n as Mt,o as Nt,r as Pt,t as Ft}from"./style-TIDOdKy0.js";var J=e(t(),1),It=n();function Lt(e){return w(C(`/api/projects/${encodeURIComponent(e)}/skills`))}function Rt(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function zt(e,t){let n=new FormData;return n.set(`file`,t),w(C(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Bt(e,t,n={}){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Vt(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Ht(e,t){return w(C(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var Y=r();function Ut({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!0),[c,d]=(0,J.useState)(!1),[f,m]=(0,J.useState)(null),[g,b]=(0,J.useState)(``),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[E,D]=(0,J.useState)(``),[P,I]=(0,J.useState)(1),[L,ee]=(0,J.useState)(null),[R,te]=(0,J.useState)(!1),[B,V]=(0,J.useState)(``),[U,W]=(0,J.useState)(``),ne=(0,J.useRef)(null),G=(0,J.useCallback)(async()=>{s(!0),b(``);try{let t=await Lt(e);r(t.items),a(t.skillsRoot)}catch(e){b(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,J.useEffect)(()=>{G()},[G]),(0,J.useEffect)(()=>{if(x!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{te(!0),V(``),Dt({q:E,page:P,pageSize:8,sort:`downloads`,signal:e.signal}).then(ee).catch(t=>{e.signal.aborted||V(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||te(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[x,P,E]);async function re(e,t){d(!0),m(t??null),b(``);try{await e(),S(null),W(``),await G()}catch(e){b(e instanceof Error?e.message:String(e))}finally{d(!1),m(null)}}async function ie(t){b(``);try{w((await Rt(e,t)).skill)}catch(e){b(e instanceof Error?e.message:String(e))}}async function ae(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){d(!0);try{await Ht(e,n.id),await G()}catch(e){b(e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(0,Y.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(y,{type:`button`,children:[(0,Y.jsx)(ke,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(z,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(h,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Y.jsx)(Wt,{icon:Ue,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>S(`marketplace`)}),(0,Y.jsx)(Wt,{icon:yt,title:t.source,hint:t.sourceHint,onClick:()=>S(`source`)}),(0,Y.jsx)(Wt,{icon:et,title:t.upload,hint:t.uploadHint,onClick:()=>ne.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:ne,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&re(()=>zt(e,n)),t.target.value=``}})]}),i?(0,Y.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),g?(0,Y.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:g}):null,o?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Y.jsx)(N,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,Y.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ot,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void ie(e.id),children:[(0,Y.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void ae(e),children:[(0,Y.jsx)(rt,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,Y.jsx)(M,{open:x!==null,onOpenChange:e=>{e||S(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(A,{className:v(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,x===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:x===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(ce,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:x===`marketplace`?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Y.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Y.jsx)(F,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:E,onChange:e=>{D(e.target.value),I(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),B?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:B}):null,R&&!L?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Y.jsx)(N,{className:`h-32 rounded-lg`},e))}):L?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:L.items.map(r=>{let i=r.providerId??L.provider,a=Et(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name),s=f===a;return(0,Y.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(Ot,{name:r.name,className:`size-10`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Y.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Y.jsx)($e,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(y,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void re(()=>Bt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):R?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),L&&L.meta.totalPages>1?(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(L.meta.page)).replace(`{{total}}`,String(L.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:R||P<=1,onClick:()=>I(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(H,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:R||P>=L.meta.totalPages,onClick:()=>I(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(Ce,{className:`size-4`})]})]})]}):null]}):(0,Y.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Y.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:U,onChange:e=>W(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Y.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(y,{type:`button`,disabled:c||!U.trim(),onClick:()=>void re(()=>Vt(e,U.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(M,{open:!!C,onOpenChange:e=>{e||w(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:C?.name}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(ce,{className:`size-4`})})})]}),(0,Y.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:C?.bodyMarkdown})]})]})})]})}function Wt(e){let t=(0,It.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Y.jsx)(d,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var Gt=[`backlog`,`ready`,`active`,`review`,`closed`];function Kt(e){return{backlog:e.filter(e=>e.phase===`backlog`),ready:e.filter(e=>e.phase===`ready`),active:e.filter(e=>e.phase===`active`),review:e.filter(e=>e.phase===`review`),closed:e.filter(e=>e.phase===`closed`)}}function qt(e,t){if(e.phase!==t){if(e.phase===`closed`&&t!==`closed`&&e.allowedCommands.includes(`reopen`))return`reopen_${t}`;if(t===`closed`&&e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(t!==`closed`&&e.allowedCommands.includes(`move`))return`move_${t}`}}function Jt(e){if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`mark_ready`))return`ready`;if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`request_review`))return`review`;if(e.phase===`review`&&e.allowedCommands.includes(`close`))return`complete`;if(e.allowedCommands.includes(`reopen`))return`reopen`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Yt(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Xt(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Yt(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Zt(e,t){let{incoming:n}=Yt(t),r=new Set(e.filter(e=>e.operationalState===`blocked`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function Qt(e,t){let{incoming:n,outgoing:r}=Yt(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var $t={backlog:`border-edge`,ready:`border-edge`,active:`border-accent ring-2 ring-accent/15`,review:`border-amber-400/80`,closed:`border-emerald-400/60`};function en(e){let t=(0,It.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=$t[i.phase],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,l;t[0]!==o||t[1]!==s||t[2]!==c?(l=v(`group w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(Pt,{type:`target`,position:jt.Left,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[4]=u):u=t[4];let d;t[5]===i.title?d=t[6]:(d=(0,Y.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=d);let f;t[7]===a?f=t[8]:(f=a?(0,Y.jsx)(de,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===n.phaseLabel?m=t[13]:(m=(0,Y.jsx)(`span`,{children:n.phaseLabel}),t[12]=n.phaseLabel,t[13]=m);let h;t[14]!==a||t[15]!==i.blockedBy?(h=a&&i.blockedBy.length>0?(0,Y.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=h):h=t[16];let g;t[17]!==h||t[18]!==m?(g=(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[m,h]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(Pt,{type:`source`,position:jt.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let y;return t[21]!==g||t[22]!==l||t[23]!==p?(y=(0,Y.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=y):y=t[24],y}var tn={taskNode:en};function nn(e){let t=(0,It.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),[m,h]=(0,J.useState)(),g=(0,J.useRef)(null),b;t[0]!==r||t[1]!==n?(b=Zt(n,r),t[0]=r,t[1]=n,t[2]=b):b=t[2];let x=b,S;t[3]!==x||t[4]!==u||t[5]!==c||t[6]!==n?(S=u?n.filter(e=>x.has(e.id)):c?n:n.filter(dn),t[3]=x,t[4]=u,t[5]=c,t[6]=n,t[7]=S):S=t[7];let C=S,w;t[8]===C?w=t[9]:(w=new Set(C.map(un)),t[8]=C,t[9]=w);let T=w,E;if(t[10]!==r||t[11]!==T){let e;t[13]===T?e=t[14]:(e=e=>T.has(e.dependencyTaskId)&&T.has(e.dependentTaskId),t[13]=T,t[14]=e),E=r.filter(e),t[10]=r,t[11]=T,t[12]=E}else E=t[12];let D=E,O;t[15]!==D||t[16]!==C?(O=Xt(C,D),t[15]=D,t[16]=C,t[17]=O):O=t[17];let k=O,A;t[18]!==f||t[19]!==D?(A=f?Qt(f,D):void 0,t[18]=f,t[19]=D,t[20]=A):A=t[20];let j=A,M;t[21]===f?M=t[22]:(M=e=>e.id===f,t[21]=f,t[22]=M);let N=C.find(M),P;t[23]===C?P=t[24]:(P=new Map(C.map(ln)),t[23]=C,t[24]=P);let F=P,I;if(t[25]!==a.phases||t[26]!==k||t[27]!==j||t[28]!==C){let e;t[30]!==a.phases||t[31]!==k||t[32]!==j?(e=e=>({id:e.id,type:`taskNode`,position:k.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(j&&!j.has(e.id))}}),t[30]=a.phases,t[31]=k,t[32]=j,t[33]=e):e=t[33],I=C.map(e),t[25]=a.phases,t[26]=k,t[27]=j,t[28]=C,t[29]=I}else I=t[29];let L=I,ee;if(t[34]!==j||t[35]!==F||t[36]!==D){let e;t[38]!==j||t[39]!==F?(e=e=>{let t=F.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(j&&(!j.has(e.dependencyTaskId)||!j.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:At.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=j,t[39]=F,t[40]=e):e=t[40],ee=D.map(e),t[34]=j,t[35]=F,t[36]=D,t[37]=ee}else ee=t[37];let R=ee,z,te;t[41]!==f||t[42]!==T?(z=()=>{f&&!T.has(f)&&p(void 0)},te=[f,T],t[41]=f,t[42]=T,t[43]=z,t[44]=te):(z=t[43],te=t[44]),(0,J.useEffect)(z,te);let B,V;t[45]!==R||t[46]!==m?(B=()=>{m&&!R.some(e=>e.id===m)&&h(void 0)},V=[R,m],t[45]=R,t[46]=m,t[47]=B,t[48]=V):(B=t[47],V=t[48]),(0,J.useEffect)(B,V);let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=H):H=t[49];let U;t[50]!==u||t[51]!==c||t[52]!==C.length?(U=[u,c,C.length],t[50]=u,t[51]=c,t[52]=C.length,t[53]=U):U=t[53],(0,J.useEffect)(H,U);let W;t[54]===f?W=t[55]:(W=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=W);let ne=W,G;t[56]!==r||t[57]!==o?(G=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(cn);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=G):G=t[58];let re=G,ie;t[59]!==r||t[60]!==o||t[61]!==m?(ie=()=>{if(!m)return;let e=r.find(e=>`${e.dependencyTaskId}:${e.dependentTaskId}`===m);e&&(h(void 0),o(e.dependentTaskId,r.filter(t=>t.dependentTaskId===e.dependentTaskId&&t.dependencyTaskId!==e.dependencyTaskId).map(sn)))},t[59]=r,t[60]=o,t[61]=m,t[62]=ie):ie=t[62];let ae=ie,K;t[63]===a.connectHint?K=t[64]:(K=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=K);let q=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(on),t[65]=oe):oe=t[65];let ce=u?a.allTasks:a.blockedChains,le;t[66]!==u||t[67]!==q||t[68]!==ce?(le=(0,Y.jsx)(y,{type:`button`,variant:q,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:ce}),t[66]=u,t[67]=q,t[68]=ce,t[69]=le):le=t[69];let ue;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>l(an),t[70]=ue):ue=t[70];let de=c?a.hideCompleted:a.showCompleted,fe;t[71]!==u||t[72]!==c||t[73]!==de?(fe=(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:ue,disabled:u,children:de}),t[71]=u,t[72]=c,t[73]=de,t[74]=fe):fe=t[74];let pe=N?(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:ne,children:[(0,Y.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,me;t[75]!==a.removeDependency||t[76]!==ae||t[77]!==m?(me=m?(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ae,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ae,t[77]=m,t[78]=me):me=t[78];let he;t[79]!==le||t[80]!==fe||t[81]!==pe||t[82]!==me?(he=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[le,fe,pe,me]}),t[79]=le,t[80]=fe,t[81]=pe,t[82]=me,t[83]=he):he=t[83];let ge;t[84]!==K||t[85]!==he?(ge=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[K,he]}),t[84]=K,t[85]=he,t[86]=ge):ge=t[86];let _e=C.length>0?(0,Y.jsxs)(`div`,{className:v(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,N&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Nt,{nodes:L,edges:R,nodeTypes:tn,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:re,onPaneClick:()=>{p(void 0),h(void 0)},onInit:e=>{g.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Ft,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Mt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),N?(0,Y.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[N.phase]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:N.title}),N.operationalState===`blocked`&&N.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(N.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:N.blockedBy.map(rn)})]}):null,(0,Y.jsxs)(s,{to:Ee(i,N.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Y.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ve;return t[87]!==ge||t[88]!==_e?(ve=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[ge,_e]}),t[87]=ge,t[88]=_e,t[89]=ve):ve=t[89],ve}function rn(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function an(e){return!e}function on(e){return!e}function sn(e){return e.dependencyTaskId}function cn(e){return e.dependencyTaskId}function ln(e){return[e.id,e]}function un(e){return e.id}function dn(e){return e.phase!==`closed`}function fn({policy:e,copy:t,onSave:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.mode),[s,c]=(0,J.useState)(Math.round(e.confidenceThreshold*100)),[l,u]=(0,J.useState)(!!e.quietHours),[d,p]=(0,J.useState)(e.quietHours?.startHour??22),[h,g]=(0,J.useState)(e.quietHours?.endHour??8),[_,v]=(0,J.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[b,x]=(0,J.useState)(e.allowedActions.includes(`create_project_task`)),[S,C]=(0,J.useState)(!1),[w,N]=(0,J.useState)();(0,J.useEffect)(()=>{o(e.mode),c(Math.round(e.confidenceThreshold*100)),u(!!e.quietHours),p(e.quietHours?.startHour??22),g(e.quietHours?.endHour??8),v(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),x(e.allowedActions.includes(`create_project_task`))},[e]);let P=async()=>{C(!0),N(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:l?{startHour:d,endHour:h,timezone:_}:null,allowedActions:b?[`create_project_task`]:[]}),i(!1)}catch(e){N(e instanceof Error?e.message:t.saveFailed)}finally{C(!1)}};return(0,Y.jsxs)(M,{open:r,onOpenChange:e=>{S||i(e)},children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,Y.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100vh-2rem))] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:t.title}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:S,children:(0,Y.jsx)(ce,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,Y.jsx)(f,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,Y.jsx)(m,{value:e,children:t},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,Y.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>c(Number(e.target.value)),className:`accent-accent`})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),t.quietHours]}),l?(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:d,onChange:e=>p(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,Y.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:h,onChange:e=>g(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,Y.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,Y.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,Y.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:b,onChange:e=>x(e.target.checked)}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,Y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[w?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:w}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,disabled:S,children:t.cancel})}),(0,Y.jsx)(y,{type:`button`,variant:`primary`,disabled:S||!_.trim()||d<0||d>23||h<0||h>23,onClick:()=>void P(),children:S?t.saving:t.save})]})]})]})]})]})}var pn={backlog:gt,ready:gt,active:Ie,review:Ve,closed:Se},mn={backlog:`text-fg-muted`,ready:`text-fg-muted`,active:`text-accent-fg`,review:`text-amber-700 dark:text-amber-300`,closed:`text-emerald-700 dark:text-emerald-300`};function hn(e){let t=(0,It.c)(64),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u;t[0]===n?u=t[1]:(u=Jt(n),t[0]=n,t[1]=u);let d=u,f;t[2]!==c||t[3]!==n.id?(f=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[2]=c,t[3]=n.id,t[4]=f):f=t[4];let p;t[5]===c?p=t[6]:(p=()=>c(``),t[5]=c,t[6]=p);let m;t[7]!==l||t[8]!==n.id?(m=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[7]=l,t[8]=n.id,t[9]=m):m=t[9];let h;t[10]!==r||t[11]!==n.id?(h=Ee(r,n.id),t[10]=r,t[11]=n.id,t[12]=h):h=t[12];let g;t[13]===n.title?g=t[14]:(g=(0,Y.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium leading-5 text-fg`,children:n.title}),t[13]=n.title,t[14]=g);let _;t[15]!==i||t[16]!==n.priority?(_=n.priority===`critical`||n.priority===`high`?(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,n.priority===`critical`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:i.priorityOptions[n.priority]}):null,t[15]=i,t[16]=n.priority,t[17]=_):_=t[17];let y;t[18]!==g||t[19]!==_?(y=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[18]=g,t[19]=_,t[20]=y):y=t[20];let b;t[21]===n.attention[0]?b=t[22]:(b=n.attention[0]?(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-3 text-xs leading-5 text-fg-muted`,children:n.attention[0].summary}):null,t[21]=n.attention[0],t[22]=b);let x;t[23]!==i||t[24]!==n.blockedBy||t[25]!==n.operationalState?(x=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-2 rounded-md bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(de,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(gn).join(`、`)})]}):null,t[23]=i,t[24]=n.blockedBy,t[25]=n.operationalState,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==n.operationalState?(S=n.operationalState===`idle`?null:(0,Y.jsx)(`span`,{className:`font-medium text-accent-fg`,children:i.operationalStates[n.operationalState]}),t[27]=i,t[28]=n.operationalState,t[29]=S):S=t[29];let C;t[30]!==i||t[31]!==n.latestVerification?(C=n.latestVerification?(0,Y.jsx)(`span`,{className:v(`font-medium`,n.latestVerification===`passed`?`text-emerald-700 dark:text-emerald-300`:n.latestVerification===`failed`?`text-red-700 dark:text-red-300`:`text-fg-subtle`),children:i.verification[n.latestVerification]}):null,t[30]=i,t[31]=n.latestVerification,t[32]=C):C=t[32];let w;t[33]!==i||t[34]!==n.acceptanceCriteriaCount?(w=n.acceptanceCriteriaCount>0?(0,Y.jsx)(`span`,{children:i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))}):null,t[33]=i,t[34]=n.acceptanceCriteriaCount,t[35]=w):w=t[35];let T;t[36]===n.dueAt?T=t[37]:(T=n.dueAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(Xe,{className:`size-3`,"aria-hidden":!0}),q(new Date(n.dueAt))]}):null,t[36]=n.dueAt,t[37]=T);let E;t[38]===n.nextCheckAt?E=t[39]:(E=n.nextCheckAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[(0,Y.jsx)(Xe,{className:`size-3`,"aria-hidden":!0}),q(new Date(n.nextCheckAt))]}):null,t[38]=n.nextCheckAt,t[39]=E);let D;t[40]!==S||t[41]!==C||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-subtle`,children:[S,C,w,T,E]}),t[40]=S,t[41]=C,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==x||t[47]!==D||t[48]!==h||t[49]!==y||t[50]!==b?(O=(0,Y.jsxs)(s,{to:h,className:`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[y,b,x,D]}),t[46]=x,t[47]=D,t[48]=h,t[49]=y,t[50]=b,t[51]=O):O=t[51];let k;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==d||t[56]!==n?(k=d?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-edge-subtle px-3 py-2`,children:[(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,d),className:`text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions[d]}),d!==`review`&&n.allowedCommands.includes(`request_review`)?(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,`review`),className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions.review}):null]}):null,t[52]=a,t[53]=i,t[54]=o,t[55]=d,t[56]=n,t[57]=k):k=t[57];let A;return t[58]!==O||t[59]!==k||t[60]!==f||t[61]!==p||t[62]!==m?(A=(0,Y.jsxs)(`article`,{draggable:!0,onDragStart:f,onDragEnd:p,onDragOver:_n,onDrop:m,className:`min-h-max min-w-0 shrink-0 overflow-hidden rounded-lg border border-edge-subtle bg-surface-panel transition-colors hover:border-edge hover:bg-surface-hover`,children:[O,k]}),t[58]=O,t[59]=k,t[60]=f,t[61]=p,t[62]=m,t[63]=A):A=t[63],A}function gn(e){return e.title}function _n(e){e.preventDefault(),e.stopPropagation()}function vn({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:c,onMonitoringChange:l,onCreate:u,actionBusyId:d,ref:p}){let[h,g]=(0,J.useState)(null),[_,b]=(0,J.useState)(null),[C,w]=(0,J.useState)(`board`),[E,N]=(0,J.useState)(!1),[P,F]=(0,J.useState)(()=>crypto.randomUUID()),[I,L]=(0,J.useState)(``),[ee,R]=(0,J.useState)(`normal`),[z,te]=(0,J.useState)(``),[B,V]=(0,J.useState)([]),[H,U]=(0,J.useState)(!1),[W,ne]=(0,J.useState)(null),G=oe({chat:x(S(e=>e.language)).chat}),re=Kt(e),ie=e.filter(e=>e.phase!==`closed`),ae=(e,t)=>void a(e,t),K=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let i=re[r.phase],s=i.findIndex(e=>e.id===r.id),c=s>=0?i[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=qt(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&b({taskId:r.id,phase:r.phase,beforeTaskId:c})},q=async e=>{e.preventDefault();let t=I.trim();if(!(!t||H)){U(!0),ne(null);try{let e=z?new Date(`${z}T23:59:59.999`).getTime():void 0;await u({requestId:P,objective:t,priority:ee,dependsOnTaskIds:B,attachments:G.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),L(``),R(`normal`),te(``),V([]),G.clearAttachments(),F(crypto.randomUUID()),N(!1)}catch(e){ne(e instanceof Error?e.message:i.createFailed)}finally{U(!1)}}},se=()=>{F(crypto.randomUUID()),L(``),R(`normal`),te(``),V([]),G.clearAttachments(),ne(null),N(!0)};return(0,J.useImperativeHandle)(p,()=>({openCreate:se})),(0,J.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[_]),(0,Y.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(fn,{policy:n,copy:i.monitoring,onSave:l}),(0,Y.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":C===`board`,onClick:()=>w(`board`),className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(be,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":C===`graph`,onClick:()=>w(`graph`),className:v(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,C===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(yt,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),C===`board`?(0,Y.jsx)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Gt.map(t=>{let n=pn[t],a=re[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||qt(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),K(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-muted/60 p-2.5`,children:[(0,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center justify-between gap-2 px-1`,children:[(0,Y.jsxs)(`div`,{className:v(`flex items-center gap-2`,mn[t]),children:[(0,Y.jsx)(n,{className:`size-4`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-subtle`,children:a.length})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.length?a.map(e=>(0,Y.jsx)(hn,{task:e,returnTo:r,copy:i,busy:d===e.id,onAction:ae,onDragStart:g,onDropBefore:e=>void K(t,e)},e.id)):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-5 text-center text-xs text-fg-subtle`,children:i.empty})})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(nn,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:c})}),(0,Y.jsx)(M,{open:E,onOpenChange:e=>{H||N(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void q(e),children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,Y.jsxs)(`div`,{className:v(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,G.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),H||G.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||G.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),G.setIsDragging(!1),H||G.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Y.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:I,onChange:e=>{L(e.target.value),ne(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:H}),(0,Y.jsx)(Ne,{attachments:G.attachments,topPadded:!1,onRemove:e=>{H||G.removeAttachment(e)}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:H,onClick:()=>G.fileInputRef.current?.click(),children:[(0,Y.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:G.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{G.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,Y.jsx)(f,{value:ee,onChange:e=>R(e.target.value),disabled:H,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(m,{value:e,children:i.priorityOptions[e]},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(Tt,{className:`min-h-10 bg-surface-base`,value:z,onChange:te,disabled:H,ariaLabel:i.dueDate})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,Y.jsx)(kt,{candidates:ie,selectedIds:B,disabled:H,onChange:V,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),W?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:W}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:H,children:i.cancel})}),(0,Y.jsx)(y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:H||!I.trim(),children:H?i.creating:i.create})]})]})]})]})}),_?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-50 flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:i.moved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=_;b(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||b(e)})},children:i.undo})]}):null]})}var yn=new Set([{id:`overview`,icon:I},{id:`tasks`,icon:nt},{id:`automations`,icon:ne},{id:`files`,icon:Oe},{id:`notes`,icon:at},{id:`skills`,icon:vt},{id:`sessions`,icon:ct},{id:`progress`,icon:me},{id:`settings`,icon:U}].map(e=>e.id)),bn=`xopc.projectFiles.panelWidthPx`,xn=320,Sn=220,Cn=560;function wn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function Tn(e){return Math.min(Cn,Math.max(Sn,Math.round(e)))}function En(){try{let e=window.localStorage.getItem(bn);if(e==null)return xn;let t=Number.parseInt(e,10);return Number.isFinite(t)?Tn(t):xn}catch{return xn}}function Dn(e){try{window.localStorage.setItem(bn,String(Tn(e)))}catch{}}function On(e){return!!(e&&yn.has(e))}function kn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function An(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):q(n)}function jn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function Mn(e){let t=(0,It.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Y.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Nn(e=!1){return v(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Pn(e){let t=(0,It.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=v(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,Y.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function Fn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function In(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Ln(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Rn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function zn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function Bn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Vn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Hn(e){let t=e.sourceChannel?.trim();if(t)return Un(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return Un(r||``)}function Un(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Wn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Gn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Kn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Kn(e.children,t,n)}:e)}function qn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=o(),[a,s]=(0,J.useState)(!1),[d,f]=(0,J.useState)([e]),[m,g]=(0,J.useState)(``),[_,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(!1),[E,N]=(0,J.useState)(`new`),[P,I]=(0,J.useState)(``),[L,ee]=(0,J.useState)(``),[R,te]=(0,J.useState)(!1),[B,V]=(0,J.useState)(null),[H,W]=(0,J.useState)(null),ne=(0,J.useCallback)(async()=>{b(!0),S(null);try{let t=await Qe({limit:100});f(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e]);(0,J.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{a&&ne()},[ne,a]);let G=(0,J.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Fn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>In(t)-In(e))},[e.id,d,m]),re=e=>t.statuses[e.status]??e.status,ae=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,K=e=>{N(e),I(``),ee(``),V(null),w(!0),s(!1)},q=(0,J.useCallback)(async(e={})=>{let t=L.trim(),n=P.trim()||(E===`directory`?Ln(t):``);if(n){te(!0),V(null),W(null);try{let r=await Le({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});w(!1),I(``),ee(``),f(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Rn(e);t?(W(t),w(!1)):V(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[E,P,i,L]),oe=(0,J.useCallback)(e=>{e.preventDefault(),q()},[q]),se=(0,J.useCallback)(()=>{q({createWorkspaceRoot:!0})},[q]),ce=(0,J.useCallback)(()=>{W(null),w(!0)},[]),le=e=>{ee(e),E===`directory`&&!P.trim()&&I(Ln(e))},ue=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:v(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Y.jsx)(c,{className:v(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ae(e)})]}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,jn(e.status)),children:re(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(u,{open:a,onOpenChange:s,children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,jn(e.status)),children:re(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:ae(e)})]}),(0,Y.jsx)(z,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Y.jsx)(l,{children:(0,Y.jsxs)(h,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(F,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:m,onChange:e=>g(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Y.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ue(e,!0),(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),x?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:x}):null,_&&G.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&G.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,G.map(e=>ue(e,!1))]}),(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>K(`new`),children:[(0,Y.jsx)(ke,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>K(`directory`),children:[(0,Y.jsx)(Oe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,Y.jsx)(U,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Y.jsx)(M,{open:C,onOpenChange:e=>!R&&w(e),children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:E===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm text-fg-muted`,children:E===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:oe,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[B?(0,Y.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:B}):null,(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Y.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:P,onChange:e=>I(e.target.value),placeholder:`xopc`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Y.jsx)(wt,{value:L,onChange:le,disabled:R,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:R,children:n.cancel})}),(0,Y.jsxs)(y,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:R||!(P.trim()||E===`directory`&&Ln(L)),children:[(0,Y.jsx)(ke,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(M,{open:!!H,onOpenChange:e=>{e||W(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:H?kn(n.workspaceMissingDescription,{workspace:H}):null})]}),H?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(Oe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:H})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ce,disabled:R,children:n.workspaceMissingBack}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:se,disabled:R,children:[(0,Y.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function X(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=o(),[c]=a(),l=S(e=>e.language),u=x(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,_=De(e=>e.setPageHeader),C=De(e=>e.clearPageHeader),[w,E]=(0,J.useState)(null),[z,B]=(0,J.useState)(null),[H,q]=(0,J.useState)([]),[oe,se]=(0,J.useState)(``),[de,be]=(0,J.useState)([]),[Se,Ce]=(0,J.useState)(!1),[Me,Ne]=(0,J.useState)(null),[Ie,Le]=(0,J.useState)([]),[Ve,Ue]=(0,J.useState)(0),[Xe,Qe]=(0,J.useState)(!1),[$e,et]=(0,J.useState)(!1),[gt,yt]=(0,J.useState)(!1),[Tt,Et]=(0,J.useState)([]),Dt=(0,J.useRef)(new Set),[Ot,kt]=(0,J.useState)(null),[At,jt]=(0,J.useState)(En),[Mt,Nt]=(0,J.useState)(!1),[Pt,Ft]=(0,J.useState)(!1),[It,Lt]=(0,J.useState)(``),[Rt,zt]=(0,J.useState)([]),[Bt,Vt]=(0,J.useState)(!1),[Ht,Wt]=(0,J.useState)(null),[Gt,Kt]=(0,J.useState)(!1),[qt,Jt]=(0,J.useState)(null),[Yt,Xt]=(0,J.useState)([]),[Zt,Qt]=(0,J.useState)(``),[$t,en]=(0,J.useState)(!0),[tn,nn]=(0,J.useState)(!1),[rn,an]=(0,J.useState)(!1),[on,sn]=(0,J.useState)(null),[cn,ln]=(0,J.useState)(!1),[un,dn]=(0,J.useState)(`fixed`),[fn,pn]=(0,J.useState)(``),[mn,hn]=(0,J.useState)(null),[gn,_n]=(0,J.useState)(!1),[yn,bn]=(0,J.useState)(!1),[xn,Sn]=(0,J.useState)(!1),[Cn,Fn]=(0,J.useState)(null),In=(0,J.useRef)(null),Ln=(0,J.useRef)(!1),[Un,X]=(0,J.useState)(null),[Jn,Yn]=(0,J.useState)({title:``,reason:``}),[Z,Xn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Zn=(0,J.useRef)(Z),Qn=`overview`,Q=n?`notes`:On(t)?t:Qn,$n=(0,J.useMemo)(()=>xe(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),er=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return $n===`/projects`?n:L(n,$n)},[$n,e]),tr=(0,J.useCallback)(t=>{e&&r(er(t))},[r,e,er]),nr=(0,J.useCallback)(()=>{if(Q===`tasks`&&In.current){In.current.openCreate();return}Ln.current=!0,tr(`tasks`)},[tr,Q]);(0,J.useEffect)(()=>{Q!==`tasks`||!Ln.current||(Ln.current=!1,In.current?.openCreate())},[Q]);let rr=(0,J.useCallback)(t=>{e&&r(er(t),{replace:!0})},[r,e,er]),ir=(0,J.useCallback)((e,t)=>{rr(e),r(t)},[r,rr]),ar=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||rr(e)},[rr]),or=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,J.useEffect)(()=>{!e||!t||On(t)||r(er(Qn),{replace:!0})},[Qn,r,e,er,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return en(!0),X(null),Promise.all([Ze(e),He(e),it(e),ve().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;E(e),B(n),q(r),Xt(i?.agents??[]),Qt(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Zn.current=a,Xn(a)}).catch(e=>{t||X(e instanceof Error?e.message:String(e))}).finally(()=>{t||en(!1)}),()=>{t=!0}},[e]);let $=(0,J.useCallback)(async()=>{e&&B(await He(e))},[e]);(0,J.useEffect)(()=>{let t,n=n=>{let r=ye.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void $(),120))};return window.addEventListener(`task-changed-v2`,n),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n)}},[e,$]);let sr=(0,J.useCallback)(async(e,t)=>{Fn(e.id),X(null);try{let n=await ae(e.id),r=t.startsWith(`move_`)?{type:`move`,phase:t.slice(5)}:t.startsWith(`reopen_`)?{type:`reopen`,phase:t.slice(7)}:t===`ready`?{type:`mark_ready`}:t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??`main`}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`review`?{type:`request_review`}:t===`complete`?{type:`close`,resolution:`done`}:t===`reopen`?{type:`reopen`,phase:`ready`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);return await ue(e.id,r,n.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Fn(null)}},[z,p.board.actionFailed,$]),cr=(0,J.useCallback)(async t=>{e&&(X(null),await pe({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await $())},[l,e,$]),lr=(0,J.useCallback)(async(e,t)=>{Fn(e),X(null);try{return await we(e,t,(await ae(e)).task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Fn(null)}},[p.board.actionFailed,$]),ur=(0,J.useCallback)(async(e,t,n)=>{Fn(e),X(null);try{let r=await ae(e);return r.task.phase!==t&&(r=await ue(e,r.task.phase===`closed`?{type:`reopen`,phase:t===`closed`?`ready`:t}:t===`closed`?{type:`close`,resolution:`done`}:{type:`move`,phase:t},r.task.version)),await we(e,n,r.task.version),await $(),!0}catch(e){return await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Fn(null)}},[p.board.actionFailed,$]),dr=(0,J.useCallback)(async(e,t)=>{Fn(e),X(null);try{await Ae(e,t,(await ae(e)).task.version),await $()}catch(e){await $().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed)}finally{Fn(null)}},[p.board.actionFailed,$]),fr=(0,J.useCallback)(async t=>{if(e){X(null);try{await ht(e,t),await $()}catch(e){throw X(e instanceof Error?e.message:p.board.actionFailed),e}}},[p.board.actionFailed,e,$]),pr=(0,J.useCallback)(async()=>{if(w){Ce(!0),X(null);try{be((await ut.list({projectId:w.id})).automations)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ce(!1)}}},[w]);(0,J.useEffect)(()=>{Q===`automations`&&pr()},[pr,Q]);let mr=(0,J.useCallback)(async()=>{if(w){Qe(!0),X(null);try{let e=await dt(w.id,{includeRelated:$e,limit:100});Le(e.items),Ue(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Qe(!1)}}},[w,$e]);(0,J.useEffect)(()=>{Q===`progress`&&mr()},[mr,Q]);let hr=(0,J.useCallback)(async e=>{Ne(`toggle:${e.id}`),X(null);try{e.enabled?await ut.pause(e.id):await ut.resume(e.id),await pr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ne(null)}},[pr]),gr=(0,J.useCallback)(async()=>{if(!w?.effectiveWorkspaceRoot?.trim()){Et([]),Dt.current.clear(),Jt(null);return}Kt(!0),Jt(null),Dt.current.clear();try{Et(Gn((await Be(w.id,``)).entries)),Dt.current.add(``)}catch(e){Et([]),Dt.current.clear(),Jt(e instanceof Error?e.message:String(e))}finally{Kt(!1)}},[w]),_r=(0,J.useCallback)(async e=>{if(!(!w?.effectiveWorkspaceRoot?.trim()||Dt.current.has(e))){Dt.current.add(e),Jt(null);try{let t=await Be(w.id,e);Et(n=>Kn(n,e,Gn(t.entries)))}catch(t){Dt.current.delete(e),Jt(t instanceof Error?t.message:String(t))}}},[w]);(0,J.useEffect)(()=>{Q===`files`&&gr()},[gr,Q]);let vr=It.trim();(0,J.useEffect)(()=>{if(Q!==`files`||!w||!Pt||!vr){zt([]),Vt(!1),Wt(null);return}let e=!1;Vt(!0),Wt(null),zt([]);let t=window.setTimeout(()=>{pt(w.id,vr,50).then(t=>{e||zt(t)}).catch(t=>{e||Wt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Vt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[vr,w,Pt,Q]);let yr=(0,J.useCallback)(async()=>{if(w){bn(!0),X(null);try{let e=await st(w.id);ir(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{bn(!1)}}},[ir,w]),br=(0,J.useCallback)(async()=>{if(!w)return;let[e,t]=await Promise.all([Ze(w.id),He(w.id)]);B(t),E(e)},[w]),xr=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!w||!Jn.title.trim())){Sn(!0),X(null);try{await tt(w.id,{title:Jn.title.trim(),reason:Jn.reason.trim()||void 0}),Yn({title:``,reason:``}),await br()}catch(e){X(e instanceof Error?e.message:String(e))}finally{Sn(!1)}}},[Jn.reason,Jn.title,w,br]),Sr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:$n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":$n===`/projects`?p.backToProjects:u.sidebar.back,children:(0,Y.jsx)(je,{className:`size-4`,"aria-hidden":!0})}),[$n,u.sidebar.back,p.backToProjects]),Cr=(0,J.useMemo)(()=>w?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(y,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:nr,children:[(0,Y.jsx)(ke,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,Y.jsxs)(y,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void yr(),disabled:yn,children:[(0,Y.jsx)(ct,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[nr,p.board.create,p.common.newChat,w,yr,yn]);(0,J.useLayoutEffect)(()=>(_({startExtra:Sr,main:w?(0,Y.jsx)(qn,{currentProject:w,pm:p,projectsText:h,wd:d}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:Cr}),()=>C()),[C,Cr,Sr,p,w,h,_,d]);function wr(e){E(t=>t?{...t,...e}:null),Qt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Tr(e=Zn.current){if(!(!w||!wn(e,w))){X(null),sn(null);try{let t=await Re(w.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});wr(t);let n=Zn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Zn.current=r,Xn(r)}catch(e){let t=Rn(e);throw t?sn(t):X(e instanceof Error?e.message:String(e)),e}}}function Er(e){e.preventDefault(),zr.flush()}function Dr(e,t=!1){let n={...Zn.current,...e};Zn.current=n,Xn(n),t&&zr.saveNow(n)}let Or=(0,J.useCallback)(()=>{if(!w)return;let e=w.workspaceRoot?.trim()??``;dn(e?`fixed`:`follow`),pn(e||w.effectiveWorkspaceRoot||``),ln(!0)},[w]);async function kr(e={}){if(!w)return;let t=un===`fixed`?fn.trim():``;if(!(un===`fixed`&&!t)){nn(!0),X(null),sn(null);try{let n=await Re(w.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});wr(n),Dr({workspaceRoot:n.workspaceRoot??``}),ln(!1),sn(null)}catch(e){let t=Rn(e);t?(sn(t),ln(!1)):X(e instanceof Error?e.message:String(e))}finally{nn(!1)}}}async function Ar(){if(!(!w||mn)){hn(`pin`),X(null);try{wr(w.pinnedAt?await _t(w.id):await Ge(w.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{hn(null)}}}async function jr(){if(!(!w||mn)){hn(`archive`),X(null);try{let e=w.status===`archived`?await We(w.id):await Ke(w.id);wr(e),Dr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{hn(null)}}}async function Mr(){if(w){_n(!0),X(null);try{await ze(w.id),an(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{_n(!1)}}}async function Nr(){if(!(!w||gt)){yt(!0),X(null);try{await Fe(w.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{yt(!1)}}}let Pr=(0,J.useCallback)(e=>{kt(e)},[]),Fr=(0,J.useCallback)((e,t)=>{t||kt(e)},[]),Ir=(0,J.useCallback)(async(e,t,n)=>{let r=w?.id;if(r)switch(e){case`preview`:t.isDirectory||kt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=R(t.path);if(Ye(V(e))!==`text`){let n=await fe(t.path,{projectId:r}),i=ee(e)??`application/octet-stream`;P(e,await n.arrayBuffer(),i)}else{let{content:n}=await he(t.path,{projectId:r});qe(e,n)}}catch(e){K(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await b(t.absolutePath??t.path)&&K(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{K(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[u.clipboard.copyFailed,u.workspace.pathCopied,w?.id]),Lr=(0,J.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Nt(!0);let r=e.clientX,i=At,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=Tn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Nt(!1),jt(c),Dn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[At]);(0,J.useEffect)(()=>{Q!==`files`&&kt(null)},[e,Q]);let Rr=!!(w&&wn(Z,w)),zr=St({value:w?Z:null,dirty:Rr,onSave:Tr,validate:e=>e.name.trim()?null:p.settings.nameRequired});if($t)return(0,Y.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!w)return(0,Y.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(s,{to:$n,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(je,{className:`size-4`,"aria-hidden":!0}),$n===`/projects`?p.backToProjects:u.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Un||p.notFound})]});let Br=H.slice(0,6),Vr=z?.blockers??[],Hr=z?.tasks.filter(e=>e.phase!==`closed`)??[],Ur=e=>p.statuses[e]??e,Wr=e=>kn(p.common.messages,{count:e}),Gr=oe.trim().toLowerCase(),Kr=Gr?H.filter(e=>{let t=An(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Wr(e.messageCount??0),a=Hn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Gr)}):H,qr=H.length>0&&Kr.length===0,Jr=Yt.find(e=>e.id===w.defaultAgentId)?.name||w.defaultAgentId||p.settings.globalDefaultAgent,Yr=Yt.find(e=>e.id===Z.defaultAgentId),Xr=w.workspaceRoot?.trim()||``,Zr=w.status===`archived`,Qr=!!w.pinnedAt,$r=!Xr,ei=Xr||Yr?.workspace||w.effectiveWorkspaceRoot||p.common.defaultWorkspace,ti=un===`fixed`?fn.trim()||p.settings.workspacePlaceholder:Yr?.workspace||w.effectiveWorkspaceRoot||p.common.defaultWorkspace,ni=(un===`fixed`?fn.trim():``)!==Xr&&(un===`follow`||!!fn.trim()),ri=[{id:`overview`,icon:I,label:p.tabs.overview},{id:`tasks`,icon:nt,label:p.tabs.tasks},{id:`automations`,icon:ne,label:p.tabs.automations},{id:`files`,icon:Oe,label:p.tabs.files},{id:`notes`,icon:at,label:p.tabs.notes},{id:`skills`,icon:vt,label:p.tabs.skills},{id:`sessions`,icon:ct,label:p.tabs.sessions},{id:`progress`,icon:me,label:p.tabs.progress}];async function ii(){if(!ei)return;let e=await b(ei);K(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function ai(){sn(null),ln(!0)}return(0,Y.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(Ct,{items:ri,activeTab:Q,onChange:tr,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(y,{id:`project-primary-tab-settings`,type:`button`,variant:Q===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":Q===`settings`?`page`:void 0,onClick:()=>tr(`settings`),children:[(0,Y.jsx)(U,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,Rr?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),Un?(0,Y.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Un}):null,(0,Y.jsxs)(`div`,{className:v(`mt-3 min-h-0 flex-1`,Q===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:Q===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[Q===`overview`?(0,Y.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:w.outcome||z?.digest.summary||w.description||w.brief||p.overview.directionFallback}),z?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:kn(p.overview.recommendedNext,{action:z.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,onClick:()=>void Nr(),disabled:gt,children:[(0,Y.jsx)(Je,{className:`size-4`,"aria-hidden":!0}),gt?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Hr.length?Hr.map(e=>(0,Y.jsxs)(s,{to:Ee(er(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]}),z?.recentResults.length?(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:z.recentResults.slice(0,5).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Y.jsxs)(s,{to:Ee(er(`overview`),e),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[n.status,` · `,n.verification.status]})]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,(0,Y.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:w.milestones.length?w.milestones.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noMilestones})})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:w.recentUpdates.length?w.recentUpdates.slice(0,3).map(e=>(0,Y.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:p.overview.noProjectUpdates})})]})]})]}),(0,Y.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),Vr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Vr.map(e=>{let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(mt,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Y.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Ur(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:ar(or(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Y.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:xr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Jn.title,onChange:e=>Yn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,Y.jsx)(y,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:xn||!Jn.title.trim(),"aria-label":xn?p.overview.addingBlocker:p.overview.addBlocker,title:xn?p.overview.addingBlocker:p.overview.addBlocker,children:(0,Y.jsx)(ke,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(ft,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>tr(`sessions`),children:p.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Br.length?Br.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:ar(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:An(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,Y.jsx)(vn,{ref:In,tasks:z?.tasks??[],dependencyEdges:z?.dependencyEdges??[],monitoring:z?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:er(`tasks`),copy:p.board,onAction:sr,onReorder:lr,onUndoMove:ur,onDependenciesChange:dr,onMonitoringChange:fr,onCreate:cr,actionBusyId:Cn}):null,Q===`automations`?(0,Y.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Y.jsxs)(`div`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ne,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.title})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.automations.hint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void pr(),disabled:Se,children:[(0,Y.jsx)(ge,{className:v(`size-4`,Se&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>ir(`automations`,`/automations?projectId=${encodeURIComponent(w.id)}&action=create`),children:[(0,Y.jsx)(ke,{className:`size-4`,"aria-hidden":!0}),p.automations.create]})]})]}),Se&&de.length===0?(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,"aria-busy":!0,children:[(0,Y.jsx)(N,{className:`h-24 rounded-lg`}),(0,Y.jsx)(N,{className:`h-24 rounded-lg`})]}):de.length?(0,Y.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:de.map(e=>(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>ir(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,Y.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?p.automations.enabled:p.automations.paused})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,onClick:()=>ir(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:p.common.open}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,disabled:Me===`toggle:${e.id}`,onClick:()=>void hr(e),children:[e.enabled?(0,Y.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}):(0,Y.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?p.automations.pause:p.automations.resume]})]})]},e.id))}):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-4 text-sm text-fg-muted`,children:p.automations.empty})]})}):null,Q===`notes`?(0,Y.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Y.jsx)(bt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(w.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:w.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${w.id}`})}):null,Q===`skills`?(0,Y.jsx)(Ut,{projectId:w.id,copy:p.skills}):null,Q===`files`?(0,Y.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:w.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:v(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Mt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${At}px`},children:[(0,Y.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,Y.jsx)(lt,{workspacePath:ei}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:v(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Pt&&`bg-surface-hover text-fg`),onClick:()=>Ft(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":Pt,children:(0,Y.jsx)(F,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(W,{className:`size-7 shrink-0 rounded-md p-0`,loading:Gt,label:u.cron.refresh,onClick:()=>void gr()})]})]}),Pt?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Y.jsx)(F,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:It,onChange:e=>Lt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Y.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{Lt(``),Ft(!1)},children:(0,Y.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,qt?(0,Y.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:qt}):null,vr?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Bt?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(N,{className:`h-11 w-full`}),(0,Y.jsx)(N,{className:`h-11 w-full`}),(0,Y.jsx)(N,{className:`h-11 w-full`})]}):Ht?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,Ht]}):Rt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Rt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:v(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Ot===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>kt(e.path),title:e.path,children:[(0,Y.jsx)(at,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Gt&&Tt.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,Y.jsx)(_e,{tree:Tt,selectedPath:Ot,onSelectFile:Pr,onSelectEntry:Fr,onExpandDir:e=>void _r(e),onAction:Ir,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,recommendedApps:u.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:v(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Mt&&`bg-surface-hover`),onPointerDown:Lr,children:(0,Y.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Ot?(0,Y.jsx)(re,{filePath:Ot,projectId:w.id,agentId:w.defaultAgentId||Zt||void 0,onClose:()=>kt(null)}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(Oe,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:p.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>tr(`settings`),children:p.files.openSettings})})]})})}):null,Q===`sessions`?(0,Y.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[H.length?(0,Y.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Y.jsx)(F,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:oe,onChange:e=>se(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),oe?(0,Y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":p.sessions.clearSearch,onClick:()=>se(``),children:(0,Y.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Kr.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Kr.map(e=>{let t=An(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Hn(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Wr(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:ar(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Y.jsx)(ct,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Y.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Y.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):qr?(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,Y.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:kn(p.progress.count,{count:Ve})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:$e,onChange:e=>et(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void mr(),disabled:Xe,children:[(0,Y.jsx)(ge,{className:v(`size-4`,Xe&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Xe&&Ie.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):Ie.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Ie.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Wn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===w.id);return(0,Y.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Bn(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:An(e.createdAt)})]}),r?(0,Y.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,zn(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Vn(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,Q===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:Er,onBlurCapture:zr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:v(`rounded-full px-2 py-0.5 text-xs font-medium`,jn(Z.status)),children:p.settings.statuses[Z.status]}),(0,Y.jsx)(xt,{status:zr.status,error:zr.error})]})]}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(Mn,{label:p.settings.name,children:(0,Y.jsx)(`input`,{className:Nn(),value:Z.name,onChange:e=>Dr({name:e.target.value})})}),(0,Y.jsx)(Mn,{label:p.settings.defaultAgent,children:(0,Y.jsxs)(f,{className:Nn(),value:Z.defaultAgentId,onChange:e=>Dr({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Yt.map(e=>(0,Y.jsx)(m,{value:e.id,children:te(e,u.agentsSettings)},e.id))]})}),(0,Y.jsx)(Mn,{label:p.settings.status,children:Zr?(0,Y.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,Y.jsxs)(f,{className:Nn(),value:Z.status===`archived`?`active`:Z.status,onChange:e=>Dr({status:e.target.value},!0),children:[(0,Y.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,Y.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,Y.jsx)(Mn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:Nn(!0),value:Z.description,onChange:e=>Dr({description:e.target.value})})})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,Y.jsx)(Mn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:Nn(!0),value:Z.brief,onChange:e=>Dr({brief:e.target.value})})}),(0,Y.jsx)(Mn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:Nn(!0),value:Z.instructions,onChange:e=>Dr({instructions:e.target.value})})})]})]}),(0,Y.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:$r?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:ei,children:ei}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ii(),children:[(0,Y.jsx)(g,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,Y.jsx)(lt,{workspacePath:ei}),(0,Y.jsxs)(y,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:Or,children:[(0,Y.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(Pn,{label:p.settings.defaultAgent,value:Jr}),(0,Y.jsx)(Pn,{label:p.settings.pinState,value:Qr?p.settings.pinned:p.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)(Pn,{label:p.settings.createdAt,value:An(w.createdAt)||p.common.never}),(0,Y.jsx)(Pn,{label:p.settings.updatedAt,value:An(w.updatedAt)||p.common.never})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Qr?p.settings.pinnedTitle:p.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:mn===`pin`,onClick:()=>void Ar(),children:[Qr?(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(le,{className:`size-4`,"aria-hidden":!0}),Qr?p.settings.unpinProject:p.settings.pinProject]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Zr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Zr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:Zr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:mn===`archive`,onClick:()=>void jr(),children:[Zr?(0,Y.jsx)(ge,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(ot,{className:`size-4`,"aria-hidden":!0}),Zr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>an(!0),children:[(0,Y.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(M,{open:rn,onOpenChange:e=>{gn||an(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Y.jsx)(mt,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:w?kn(p.settings.deleteConfirm,{name:w.name}):p.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:gn,children:p.common.cancel})}),(0,Y.jsxs)(y,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:gn||!w,onClick:()=>void Mr(),children:[(0,Y.jsx)(rt,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(M,{open:cn,onOpenChange:e=>{tn||ln(e)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:v(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,un===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:un===`fixed`,onChange:()=>dn(`fixed`),disabled:tn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:v(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,un===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:un===`follow`,onChange:()=>dn(`follow`),disabled:tn}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),un===`fixed`?(0,Y.jsx)(wt,{value:fn,onChange:pn,disabled:tn,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:Nn(),autoFocus:!0}):null,(0,Y.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:p.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:kn(p.settings.workspaceCurrent,{workspace:ti})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(O,{asChild:!0,children:(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:tn,children:p.common.cancel})}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:tn||!ni,onClick:()=>void kr(),children:[(0,Y.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(M,{open:!!on,onOpenChange:e=>{e||sn(null)},children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(j,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,Y.jsx)(D,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:on?kn(p.settings.workspaceMissingDescription,{workspace:on}):null})]}),on?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(Oe,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:on})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(y,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ai,disabled:tn,children:p.settings.workspaceMissingBack}),(0,Y.jsxs)(y,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void kr({createWorkspaceRoot:!0}),disabled:tn,children:[(0,Y.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{X as ProjectDetailPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as a,t as o}from"./working-directory-picker-modal-D-IgcHPp.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./cn-JdwAhgNB.js";import{t as d}from"./button-CSEbl4zT.js";import{t as ee}from"./messages-3qRsLZuX.js";import{n as f}from"./locale-store-xULEcFVs.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-BPoKqzeH.js";import{Aa as b,As as x,Gs as S,Ko as C,Ks as w,Ns as te,Uc as T,Ul as E,Va as D,Vs as O,Wc as ne,aa as k,ga as A,ha as j,ia as M,ma as N,ql as P,qr as F,ya as re}from"./index-CGbKTCST.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:F(n)}function ie(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function ae(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(b,{className:`h-40 rounded-xl`},t)}function oe(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=f(V),c,l,u,p,m,h,g,_;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,g=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),d;t[20]===o?d=t[21]:(d=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=d);let f;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,R.jsx)(E,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=f):f=t[22];let v;t[23]===d?v=t[24]:(v=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[d,f]}),t[23]=d,t[24]=v),_=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),h=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,p=`min-w-0 text-[11px] text-fg-subtle`,m=(0,R.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,u=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=u,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_}else c=t[9],l=t[10],u=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16];let v;t[25]!==l||t[26]!==u?(v=(0,R.jsx)(`p`,{className:l,children:u}),t[25]=l,t[26]=u,t[27]=v):v=t[27];let y;t[28]!==p||t[29]!==m||t[30]!==v?(y=(0,R.jsxs)(`div`,{className:p,children:[m,v]}),t[28]=p,t[29]=m,t[30]=v,t[31]=y):y=t[31];let b=n.pinnedAt?c.unpin:c.pin,x=n.pinnedAt?c.unpin:c.pin,C;t[32]===n.pinnedAt?C=t[33]:(C=n.pinnedAt?(0,R.jsx)(S,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=C);let T;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==x||t[38]!==C?(T=(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:x,children:C}),t[34]=r,t[35]=a,t[36]=b,t[37]=x,t[38]=C,t[39]=T):T=t[39];let D=n.status===`archived`?c.restore:c.archive,O=n.status===`archived`?c.restore:c.archive,k;t[40]===n.status?k=t[41]:(k=n.status===`archived`?(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=k);let A;t[42]!==r||t[43]!==o||t[44]!==D||t[45]!==O||t[46]!==k?(A=(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":D,title:O,children:k}),t[42]=r,t[43]=o,t[44]=D,t[45]=O,t[46]=k,t[47]=A):A=t[47];let j;t[48]!==T||t[49]!==A?(j=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,A]}),t[48]=T,t[49]=A,t[50]=j):j=t[50];let M;t[51]!==j||t[52]!==h||t[53]!==y?(M=(0,R.jsxs)(`div`,{className:h,children:[y,j]}),t[51]=j,t[52]=h,t[53]=y,t[54]=M):M=t[54];let N;return t[55]!==M||t[56]!==g||t[57]!==_?(N=(0,R.jsxs)(`article`,{className:g,children:[_,M]}),t[55]=M,t[56]=g,t[57]=_,t[58]=N):N=t[58],N}function V(e){return e.language}function H(){let e=ee(f(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=D(e=>e.setPageHeader),b=D(e=>e.clearPageHeader),[S,w]=(0,L.useState)([]),[te,E]=(0,L.useState)(!0),[P,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,se]=(0,L.useState)(`active`),[ce,U]=(0,L.useState)(null),[le,W]=(0,L.useState)(!1),[G,K]=(0,L.useState)(null),[q,ue]=(0,L.useState)(!1),[J,de]=(0,L.useState)(``),[Y,fe]=(0,L.useState)(``),[X,pe]=(0,L.useState)(``),Z=a({initialPath:X,onPicked:pe}),Q=(0,L.useCallback)(async()=>{E(!0),F(null);try{w(ie((await N({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){F(e instanceof Error?e.message:String(e))}finally{E(!1)}},[]);(0,L.useEffect)(()=>{Q()},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return S.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,S,I]),me=(0,L.useMemo)(()=>(0,R.jsxs)(d,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>W(!0),children:[(0,R.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,R.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:me}),()=>b()),[b,me,n.subtitle,n.title,i]);let he=(0,L.useCallback)(async e=>{e.preventDefault();let t=J.trim(),n=X.trim();if(!(!t||!n||q)){ue(!0),K(null);try{let e=await k({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});w(t=>[e,...t.filter(t=>t.id!==e.id)]),de(``),fe(``),pe(``),W(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){K(e instanceof Error?e.message:String(e))}finally{ue(!1)}}},[q,Y,J,X]),ge=(0,L.useCallback)(async(e,t)=>{U(e.id),F(null);try{let n;n=t===`pin`?e.pinnedAt?await re(e.id):await j(e.id):e.status===`archived`?await A(e.id):await M(e.id),w(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{U(null)}},[]),_e=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],ve=_e.find(e=>e.id===H)?.label??t.all,ye=n.resultCount.replace(`{{status}}`,ve).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,R.jsx)(y,{open:le,onOpenChange:e=>{W(e),e||K(null)},children:(0,R.jsxs)(g,{children:[(0,R.jsx)(p,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(_,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(v,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(m,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:he,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>de(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>fe(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Z.pick,disabled:q||Z.picking,children:[Z.picking?(0,R.jsx)(l,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(T,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:X?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:u(`mt-0.5 block truncate font-mono text-xs font-normal`,X?`text-fg-muted`:`text-fg-subtle`),title:X||void 0,children:X||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),G?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:G}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(h,{asChild:!0,children:(0,R.jsx)(d,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(d,{type:`submit`,variant:`primary`,disabled:q||!J.trim()||!X.trim(),children:q?t.home.creating:t.create})]})]})]})]})}),Z.hasNativePicker?null:(0,R.jsx)(o,{open:Z.modalOpen,onOpenChange:Z.setModalOpen,initialAbsolutePath:X||void 0,onConfirm:Z.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:ye}),(0,R.jsxs)(`div`,{className:u(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-9 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(x,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(s,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>se(e.target.value),children:_e.map(e=>(0,R.jsx)(c,{value:e.id,children:e.label},e.id))})]})]}),P?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:P}),(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,te?(0,R.jsx)(ae,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(oe,{project:e,busy:ce===e.id,onTogglePin:()=>void ge(e,`pin`),onToggleArchive:()=>void ge(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,R.jsx)(ne,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};