@xopcai/xopc 0.0.260 → 0.0.264

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 (165) hide show
  1. package/README.md +1 -0
  2. package/README.zh-CN.md +1 -0
  3. package/dist/browser-ext/icons/icon-128.png +0 -0
  4. package/dist/browser-ext/icons/icon-16.png +0 -0
  5. package/dist/browser-ext/icons/icon-32.png +0 -0
  6. package/dist/browser-ext/icons/icon-48.png +0 -0
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/extensions/telegram/xopc.extension.json +1 -1
  9. package/dist/gateway/static/root/apple-touch-icon.png +0 -0
  10. package/dist/gateway/static/root/assets/{activity-store-C3PGOKZ2.js → activity-store-BYBCpt7_.js} +1 -1
  11. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DQXGuDU1.js → agent-avatar-dicebear-D20aBHPJ.js} +1 -1
  12. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-B-adIdqU.js → agent-defaults-settings-panel-BZvMqNrU.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agents-tEnV2m4V.js → agents-6foBELwt.js} +1 -1
  14. package/dist/gateway/static/root/assets/{api-B9Ujaa2n.js → api-YbtjDbuG.js} +1 -1
  15. package/dist/gateway/static/root/assets/{app-management-settings-panel-DpPFwi9Y.js → app-management-settings-panel-4ps1RrDU.js} +1 -1
  16. package/dist/gateway/static/root/assets/{appearance-settings-CMZNnWrt.js → appearance-settings-C7nBHnkG.js} +1 -1
  17. package/dist/gateway/static/root/assets/{apps-page-CjUC3jZ3.js → apps-page-B_g-rL5b.js} +1 -1
  18. package/dist/gateway/static/root/assets/{archive-plugin-CDO9Z4tl.js → archive-plugin-DfKK1iJO.js} +1 -1
  19. package/dist/gateway/static/root/assets/{attachment-load-B0OLG7F4.js → attachment-load-BOU1pdnQ.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automations-page-DkRGPgbA.js → automations-page-BePzexAH.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automations-workspace-DToID01H.js → automations-workspace-7-m5pBEZ.js} +1 -1
  22. package/dist/gateway/static/root/assets/{binary-plugins-C9cQvqON.js → binary-plugins-Cly8XDyt.js} +1 -1
  23. package/dist/gateway/static/root/assets/{block-editor-CuhEms-L.js → block-editor-DzSu62js.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-automation-inputs-C5CkGZTi.js → browser-automation-inputs-8bHj7Fv2.js} +1 -1
  25. package/dist/gateway/static/root/assets/{browser-automations-page-D4ylF3c0.js → browser-automations-page-CzL7Aj2k.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-settings-page-BIYTKzLB.js → browser-settings-page-Dum3mTiz.js} +1 -1
  27. package/dist/gateway/static/root/assets/{capabilities-settings-panel-DLaPx1nq.js → capabilities-settings-panel-Ci6qVS-O.js} +1 -1
  28. package/dist/gateway/static/root/assets/{channels-settings-jIVF8Nin.js → channels-settings-BOGEZnSv.js} +1 -1
  29. package/dist/gateway/static/root/assets/{channels-status-swr-0RbeaCb4.js → channels-status-swr-BR8oQ_eP.js} +1 -1
  30. package/dist/gateway/static/root/assets/{chat-terminal-dock-BIdsO11x.js → chat-terminal-dock-BF9ZXa5Z.js} +1 -1
  31. package/dist/gateway/static/root/assets/{connectors-page-CIslIJFt.js → connectors-page-DBvEvupa.js} +1 -1
  32. package/dist/gateway/static/root/assets/{cron-expression-Dgkeyu7p.js → cron-expression-BszT_gjK.js} +1 -1
  33. package/dist/gateway/static/root/assets/{date-picker-De7tAQEZ.js → date-picker-D2MKBJ0G.js} +1 -1
  34. package/dist/gateway/static/root/assets/{dependency-picker-BzPt6TdE.js → dependency-picker-DqigBx-G.js} +1 -1
  35. package/dist/gateway/static/root/assets/{desktop-pet-BPOx0awZ.js → desktop-pet-CapspBGG.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-settings-CLo3YMLt.js → desktop-pet-settings-DMPk4CaK.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-debug-page-DDEyLbVr.js → extension-debug-page-CXLsDtrW.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-page-D1NUZpPd.js → extension-page-B2j87ROw.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-settings-page-BJhuMrU_.js → extension-settings-page-t1BApw-u.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-config-swr-DftrkBXi.js → gateway-config-swr-BFSesvAC.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-settings-v2JeDF9-.js → gateway-settings-BFAecoGy.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-startup-retry-BgI4nHyS.js → gateway-startup-retry-D1giYgI-.js} +1 -1
  43. package/dist/gateway/static/root/assets/{heartbeat-settings-1W8w4lhI.js → heartbeat-settings-CyD9zDcU.js} +1 -1
  44. package/dist/gateway/static/root/assets/{home-page-BSKKIfeQ.js → home-page-uItZMiBE.js} +1 -1
  45. package/dist/gateway/static/root/assets/{image-generation-api-SZomqErK.js → image-generation-api-BeB-OPqO.js} +1 -1
  46. package/dist/gateway/static/root/assets/{index-BKCWDzbV.css → index-CRJrO4GI.css} +1 -1
  47. package/dist/gateway/static/root/assets/{index-BXdV0Oia.js → index-DQtjs2x3.js} +47 -47
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-COT94SO3.js → keyboard-shortcuts-settings-Q_CM-ZCs.js} +1 -1
  49. package/dist/gateway/static/root/assets/{local-app-workbench-page-DUs-vc7c.js → local-app-workbench-page-DaiBWfOt.js} +1 -1
  50. package/dist/gateway/static/root/assets/{local-apps-page-C6rKhNyX.js → local-apps-page-BALMNCSp.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-CHtOF1kO.js → locale-store-RJHYFoq9.js} +1 -1
  52. package/dist/gateway/static/root/assets/{logs-page-D_qfxg72.js → logs-page-C-TS7oFg.js} +1 -1
  53. package/dist/gateway/static/root/assets/{management-settings-DSH7NnVw.js → management-settings-BajkJeYl.js} +1 -1
  54. package/dist/gateway/static/root/assets/{markdown-view-D-FLW0dt.js → markdown-view-BxoQJqHx.js} +1 -1
  55. package/dist/gateway/static/root/assets/{media-plugins-Cf6kUNl_.js → media-plugins-C_8Hl6KG.js} +1 -1
  56. package/dist/gateway/static/root/assets/messages-Cf1h5WXB.js +3 -0
  57. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-CILSkJVm.js → mobile-pairing-wizard-CsWIZrZW.js} +1 -1
  58. package/dist/gateway/static/root/assets/{note-detail-panel-p09JcANK.js → note-detail-panel-CCbPg_GP.js} +3 -3
  59. package/dist/gateway/static/root/assets/{notes-page-CFNvIB8t.js → notes-page-BdxxcUKa.js} +1 -1
  60. package/dist/gateway/static/root/assets/{page-tabs-BE7aDmYf.js → page-tabs-BMYQef5D.js} +1 -1
  61. package/dist/gateway/static/root/assets/{preview-open-alternatives-C9TdeSFT.js → preview-open-alternatives-CKZ-H5hJ.js} +1 -1
  62. package/dist/gateway/static/root/assets/{product-open-page-UiLKUjzS.js → product-open-page-zXJIptXs.js} +1 -1
  63. package/dist/gateway/static/root/assets/{project-detail-page-CM2vs8CY.js → project-detail-page-DRhhxhZB.js} +1 -1
  64. package/dist/gateway/static/root/assets/{projects-page-DA-zzY8B.js → projects-page-Wt7gF3Sx.js} +1 -1
  65. package/dist/gateway/static/root/assets/{registry-api-BbSVGn6X.js → registry-api-BSfFaxVN.js} +1 -1
  66. package/dist/gateway/static/root/assets/{remote-access-hub--sgDiADe.js → remote-access-hub-B6de5Zrb.js} +1 -1
  67. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DkshrVpk.js → runtime-tools-settings-panel-DcUB5h1f.js} +1 -1
  68. package/dist/gateway/static/root/assets/{schema-form-tLOl1ZAH.js → schema-form-CquWhe7r.js} +1 -1
  69. package/dist/gateway/static/root/assets/{sessions-page-C_TdKlUD.js → sessions-page-BNWO2EVF.js} +1 -1
  70. package/dist/gateway/static/root/assets/settings-advanced-gate-DK1yTYE4.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-form-section-Dxkw4v4H.js → settings-form-section-DwswAefc.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-page-Bqk8W4z_.js → settings-page-CoAVmjjs.js} +1 -1
  73. package/dist/gateway/static/root/assets/{setup-status-panel-DWd6faoE.js → setup-status-panel-C9EIcWtH.js} +1 -1
  74. package/dist/gateway/static/root/assets/{share-preview-page-j2tIceho.js → share-preview-page-DWwy_4zh.js} +1 -1
  75. package/dist/gateway/static/root/assets/{shares-settings-oDcCqSFK.js → shares-settings-CIUvq27-.js} +1 -1
  76. package/dist/gateway/static/root/assets/skill-reload-api-DfE3zFVw.js +1 -0
  77. package/dist/gateway/static/root/assets/{skills-page-CTmhlyZc.js → skills-page-CqsgVtVh.js} +1 -1
  78. package/dist/gateway/static/root/assets/{skills-page.utils-DOvugRyA.js → skills-page.utils-B-N73248.js} +1 -1
  79. package/dist/gateway/static/root/assets/{system-settings-panel-BnYP6VIv.js → system-settings-panel-BndjXuBZ.js} +1 -1
  80. package/dist/gateway/static/root/assets/{task-detail-page-A2JXlr_r.js → task-detail-page-CG6Ha9t7.js} +1 -1
  81. package/dist/gateway/static/root/assets/{theme-store-CyYxQYpT.js → theme-store-C5ssn64t.js} +1 -1
  82. package/dist/gateway/static/root/assets/{tunnel-api-BmDqq1-x.js → tunnel-api-BxZdcp3h.js} +1 -1
  83. package/dist/gateway/static/root/assets/{use-autosave-BzsVGQQM.js → use-autosave-mj9CUuz1.js} +1 -1
  84. package/dist/gateway/static/root/assets/{user-model-page-CkO83New.js → user-model-page-DKeHMXI4.js} +1 -1
  85. package/dist/gateway/static/root/assets/{voice-api-key-field-BjOEAtzw.js → voice-api-key-field-CzxVMYlr.js} +1 -1
  86. package/dist/gateway/static/root/assets/{voice-config-api-BS1ozT6b.js → voice-config-api-COA0V1cK.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-CrtXygYb.js → work-discovery-overlay-DMiPK8dp.js} +1 -1
  88. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Darl4tuN.js → workflow-run-setup-panel-C82OXCJK.js} +1 -1
  89. package/dist/gateway/static/root/assets/{workflows-page-BTdeeQSn.js → workflows-page-HLCUV3rQ.js} +1 -1
  90. package/dist/gateway/static/root/favicon-16x16.png +0 -0
  91. package/dist/gateway/static/root/favicon-32x32.png +0 -0
  92. package/dist/gateway/static/root/favicon.ico +0 -0
  93. package/dist/gateway/static/root/favicon.png +0 -0
  94. package/dist/gateway/static/root/favicon.svg +1 -1
  95. package/dist/gateway/static/root/index.html +16 -16
  96. package/dist/gateway/static/root/logo-dark.svg +1 -1
  97. package/dist/gateway/static/root/logo.svg +1 -1
  98. package/dist/gateway/static/root/pwa-192x192.png +0 -0
  99. package/dist/gateway/static/root/pwa-512x512.png +0 -0
  100. package/dist/package.js +1 -1
  101. package/dist/src/agent/agent-manager.js +4 -4
  102. package/dist/src/agent/background-review/run-background-review.js +1 -1
  103. package/dist/src/agent/embedded/model-runtime.js +1 -1
  104. package/dist/src/agent/embedded/run-for-session.js +1 -1
  105. package/dist/src/agent/image/prepare-image-for-model.d.ts +13 -0
  106. package/dist/src/agent/image/prepare-image-for-model.js +55 -0
  107. package/dist/src/agent/image/tool-model-config.js +1 -1
  108. package/dist/src/agent/inbound/attachment-pipeline.js +7 -5
  109. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  110. package/dist/src/agent/service.js +2 -2
  111. package/dist/src/agent/session/session-inspector.js +1 -1
  112. package/dist/src/agent/skills/hub-lock.js +1 -1
  113. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  114. package/dist/src/agent/tools/media-read-tool.js +3 -3
  115. package/dist/src/ai-assist/text-assist.js +1 -1
  116. package/dist/src/auth/credentials.js +2 -2
  117. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  118. package/dist/src/auth/profiles/store.js +1 -1
  119. package/dist/src/auth/sync-provider-auth.js +2 -2
  120. package/dist/src/automations/service/automation-service.js +21 -8
  121. package/dist/src/browser/providers/browser-ext-install.js +2 -2
  122. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  123. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  124. package/dist/src/cli/commands/models.js +1 -1
  125. package/dist/src/cli/commands/onboard.js +1 -1
  126. package/dist/src/config/index.js +4 -4
  127. package/dist/src/config/loader.js +2 -2
  128. package/dist/src/config/models-json.js +1 -1
  129. package/dist/src/endpoint-tools/policy.js +14 -5
  130. package/dist/src/extensions/lockfile.js +1 -1
  131. package/dist/src/gateway/agents-admin.js +1 -1
  132. package/dist/src/gateway/file-path-classifier.js +1 -1
  133. package/dist/src/gateway/heartbeat/service.js +1 -1
  134. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  135. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  136. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  137. package/dist/src/gateway/hono/routes/media.js +1 -1
  138. package/dist/src/gateway/hono/routes/models.js +1 -1
  139. package/dist/src/gateway/hono/routes/voice.js +18 -0
  140. package/dist/src/gateway/service/config-coordinator.js +1 -1
  141. package/dist/src/gateway/service.js +14 -7
  142. package/dist/src/heartbeat/index.js +1 -1
  143. package/dist/src/infra/update-restart.js +1 -1
  144. package/dist/src/media/store.js +11 -2
  145. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  146. package/dist/src/providers/index.js +2 -2
  147. package/dist/src/providers/model-registry.js +1 -1
  148. package/dist/src/providers/register-runtime-providers.js +1 -1
  149. package/dist/src/tui/tui-startup-resources.js +1 -1
  150. package/dist/src/tui/tui.js +1 -1
  151. package/dist/src/voice/realtime/agentEngine.js +71 -17
  152. package/dist/src/voice/realtime/conversation-context.d.ts +2 -0
  153. package/dist/src/voice/realtime/conversation-context.js +13 -4
  154. package/dist/src/voice/realtime/persona-context.d.ts +19 -0
  155. package/dist/src/voice/realtime/persona-context.js +126 -0
  156. package/dist/src/voice/realtime/runtime.d.ts +1 -0
  157. package/dist/src/voice/realtime/runtime.js +16 -0
  158. package/dist/src/voice/realtime/speakable-segmenter.d.ts +4 -1
  159. package/dist/src/voice/realtime/speakable-segmenter.js +11 -3
  160. package/dist/src/work-discovery/service.js +1 -1
  161. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  162. package/package.json +3 -2
  163. package/dist/gateway/static/root/assets/messages-CIDIpI4Y.js +0 -3
  164. package/dist/gateway/static/root/assets/settings-advanced-gate-Cpf80P_r.js +0 -1
  165. package/dist/gateway/static/root/assets/skill-reload-api-CwBaDY-N.js +0 -1
@@ -1 +1 @@
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,h as a,p as o,t as s}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CpzYSoz7.js";import{t as g}from"./check-DUBLcKHA.js";import{c as _,d as v,f as y,l as b,n as x,r as S,t as C,u as w}from"./popover-select-CKBYnT3c.js";import{t as T}from"./circle-check-C23XjkUj.js";import{t as E}from"./copy-Dv6d4Dvw.js";import{t as D}from"./download-Dk-ZjtO6.js";import{t as O}from"./external-link-DjqjBmc3.js";import{d as k,p as A}from"./markdown-view-D-FLW0dt.js";import{t as j}from"./loader-circle-CifKLtgG.js";import{t as M}from"./plus-Q2yW6OE7.js";import{t as N}from"./x-B_N4OPjy.js";import{t as P}from"./copy-to-clipboard-HOJ79TWv.js";import{t as F}from"./messages-CIDIpI4Y.js";import{a as I,d as L,n as R,r as z,s as ee}from"./locale-store-CHtOF1kO.js";import{t as B}from"./cn-JdwAhgNB.js";import{i as V}from"./vendor-swr-BIWyz7Rc.js";import{t as H}from"./button-B11EPpor.js";import{t as U}from"./skeleton-BwbyijEw.js";import{$n as W,Aa as te,As as ne,Au as G,Bi as K,Ca as re,Da as ie,Dl as q,Do as J,Ds as ae,Ec as oe,Eu as se,Fi as ce,Fn as le,Gr as ue,Hi as de,Hs as Y,Ii as fe,In as pe,Is as me,Js as he,Kn as ge,Li as _e,Ln as ve,Mc as ye,Mi as be,Ml as xe,Mu as Se,Nc as Ce,Nl as we,Nn as Te,Oc as Ee,Ol as De,Pa as Oe,Pc as ke,Pi as Ae,Qs as je,Ri as Me,Rs as Ne,Sn as Pe,Ta as Fe,Tl as Ie,Ts as Le,Uc as Re,Ui as ze,Un as Be,Vc as Ve,Vi as He,Vl as Ue,Vt as We,Yc as Ge,Ys as Ke,Zl as qe,_a as Je,_c as Ye,_l as Xe,_n as Ze,aa as Qe,an as $e,as as et,ba as tt,bo as nt,bu as rt,ca as it,ci as at,cl as ot,da as st,du as ct,ea as lt,en as ut,fa as dt,fc as ft,fu as pt,ga as mt,gn as ht,gs as gt,ha as _t,hc as vt,hl as yt,hn as bt,ia as xt,ji as St,jl as Ct,jr as wt,js as Tt,kc as Et,ks as Dt,ku as Ot,la as kt,lc as At,ls as jt,lu as Mt,ma as Nt,mn as Pt,mu as Ft,na as It,nc as Lt,nl as Rt,nr as zt,nu as Bt,oa as Vt,pa as Ht,pc as Ut,ps as Wt,ql as Gt,rn as Kt,ro as qt,sa as Jt,sc as Yt,sl as Xt,su as Zt,ta as Qt,tc as $t,ti as en,ua as tn,uc as nn,ui as rn,us as an,uu as on,va as sn,vl as cn,vn as ln,wa as un,wn as dn,ws as fn,yl as pn,yn as mn,zi as hn}from"./index-BXdV0Oia.js";import{i as gn,n as _n,r as vn,t as yn}from"./note-detail-panel-p09JcANK.js";import{n as bn,t as xn}from"./use-autosave-BzsVGQQM.js";import{t as Sn}from"./page-tabs-BE7aDmYf.js";import{t as Cn}from"./date-picker-De7tAQEZ.js";import{t as wn}from"./automations-workspace-DToID01H.js";import{i as Tn,p as En,s as Dn}from"./skills-page.utils-DOvugRyA.js";import{t as X}from"./dependency-picker-BzPt6TdE.js";import{c as On,l as kn,n as An,o as jn,r as Mn,t as Nn}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),$=r();function Pn(e){let t=(0,Q.c)(27),{value:n,onPick:r,disabled:i,placeholder:a,title:o,className:s,maxWidthClass:c,compact:l,"aria-label":u}=e,d=c===void 0?`max-w-[min(12rem,40vw)]`:c,f=l===void 0?!1:l,p,m;t[0]!==a||t[1]!==n?(m=n.trim(),p=m?Fe(m):a??``,t[0]=a,t[1]=n,t[2]=p,t[3]=m):(p=t[2],m=t[3]);let h=p,g=o??(m||void 0),_=u??o??h,v=f?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,y=!f&&d,b=i&&`cursor-not-allowed opacity-60`,x;t[4]!==s||t[5]!==v||t[6]!==y||t[7]!==b?(x=B(v,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,et.transition,et.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,y,b,s),t[4]=s,t[5]=v,t[6]=y,t[7]=b,t[8]=x):x=t[8];let S;t[9]!==i||t[10]!==r?(S=e=>{e.stopPropagation(),i||r()},t[9]=i,t[10]=r,t[11]=S):S=t[11];let C=f?`size-4`:`size-3.5`,w;t[12]===C?w=t[13]:(w=B(`shrink-0 text-fg-muted`,C),t[12]=C,t[13]=w);let T;t[14]===w?T=t[15]:(T=(0,$.jsx)(Ct,{className:w,"aria-hidden":!0}),t[14]=w,t[15]=T);let E;t[16]!==f||t[17]!==h?(E=f?null:(0,$.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:h}),t[16]=f,t[17]=h,t[18]=E):E=t[18];let D;return t[19]!==i||t[20]!==S||t[21]!==T||t[22]!==E||t[23]!==g||t[24]!==_||t[25]!==x?(D=(0,$.jsxs)(`button`,{type:`button`,disabled:i,title:g,"aria-label":_,className:x,onClick:S,children:[T,E]}),t[19]=i,t[20]=S,t[21]=T,t[22]=E,t[23]=g,t[24]=_,t[25]=x,t[26]=D):D=t[26],D}function Fn(e){let t=(0,Q.c)(38),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,inputClassName:s,autoFocus:c,trailing:l}=e,u;t[0]!==r||t[1]!==n?(u={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=un(u),f;t[3]===n?f=t[4]:(f=n.trim(),t[3]=n,t[4]=f);let p=f,m=p?`${p}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`,h;t[5]===s?h=t[6]:(h=B(`min-w-0 flex-1`,s),t[5]=s,t[6]=h);let g=i||d.picking,_;t[7]===r?_=t[8]:(_=e=>void r(e.target.value),t[7]=r,t[8]=_);let v=o??a.pathInputPlaceholder,y;t[9]!==c||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==v||t[14]!==n?(y=(0,$.jsx)(`input`,{type:`text`,className:h,value:n,disabled:g,onChange:_,placeholder:v,autoFocus:c,autoComplete:`off`,spellCheck:!1}),t[9]=c,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=n,t[15]=y):y=t[15];let b=i||d.picking,x;t[16]!==m||t[17]!==d.pick||t[18]!==b||t[19]!==n||t[20]!==a.selectWorkingDirectory?(x=(0,$.jsx)(Pn,{compact:!0,value:n,onPick:d.pick,disabled:b,title:m,"aria-label":a.selectWorkingDirectory}),t[16]=m,t[17]=d.pick,t[18]=b,t[19]=n,t[20]=a.selectWorkingDirectory,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==l?(S=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[x,l]}),t[22]=x,t[23]=l,t[24]=S):S=t[24];let C;t[25]!==S||t[26]!==y?(C=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[y,S]}),t[25]=S,t[26]=y,t[27]=C):C=t[27];let w;t[28]!==d.confirmPick||t[29]!==d.hasNativePicker||t[30]!==d.modalOpen||t[31]!==d.setModalOpen||t[32]!==p||t[33]!==a?(w=d.hasNativePicker?null:(0,$.jsx)(tt,{open:d.modalOpen,onOpenChange:d.setModalOpen,initialAbsolutePath:p||void 0,onConfirm:d.confirmPick,wd:a}),t[28]=d.confirmPick,t[29]=d.hasNativePicker,t[30]=d.modalOpen,t[31]=d.setModalOpen,t[32]=p,t[33]=a,t[34]=w):w=t[34];let T;return t[35]!==C||t[36]!==w?(T=(0,$.jsxs)($.Fragment,{children:[C,w]}),t[35]=C,t[36]=w,t[37]=T):T=t[37],T}function In(e){let t=(0,Q.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Z.useState)(!1),s;t[0]!==r||t[1]!==n?(s=zt(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=B(`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)(Xe,{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 l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=B(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(ge,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Ln(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 Rn(e){let t=(0,Q.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=W(),f=W(Bn),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=B(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=B(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(j,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(ye,{className:`size-3.5`}):(0,$.jsx)(oe,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(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:k}})}),t[23]=k,t[24]=A);let M;t[25]!==_||t[26]!==p||t[27]!==g?(M=Ln(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=M):M=t[28];let N;t[29]===M?N=t[30]:(N=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==A||t[32]!==N?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,N]}),t[31]=A,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==C||t[36]!==O?(F=(0,$.jsxs)(`div`,{className:C,onClick:zn,children:[O,P]}),t[34]=P,t[35]=C,t[36]=O,t[37]=F):F=t[37],F}function zn(e){return e.stopPropagation()}function Bn(e){return e.toggle}function Vn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Hn(e){let t=(0,Q.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=Vn(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Z.useState)(Yn),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=gn(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=B(`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`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(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]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(In,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(Rn,{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]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=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]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=B(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Ue,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(mn,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Jn,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>{a(n.id,!n.pinned).catch(Kn)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(Ee,{className:`size-4`}):(0,$.jsx)(Et,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(bt,{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:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==n.id||t[45]!==o?(F=()=>{o(n.id).catch(Gn)},t[44]=n.id,t[45]=o,t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(Se,{className:`size-4`}),t[47]=I):I=t[47];let L;t[48]!==c.archive||t[49]!==F?(L=(0,$.jsxs)(bt,{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:F,children:[I,c.archive]}),t[48]=c.archive,t[49]=F,t[50]=L):L=t[50];let R;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ln,{className:`my-1 h-px bg-edge-subtle`}),t[51]=R):R=t[51];let z;t[52]!==n.id||t[53]!==s?(z=()=>{s(n.id).catch(Wn)},t[52]=n.id,t[53]=s,t[54]=z):z=t[54];let ee;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Y,{className:`size-4`}),t[55]=ee):ee=t[55];let V;t[56]!==c.delete||t[57]!==z?(V=(0,$.jsxs)(bt,{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:z,children:[ee,c.delete]}),t[56]=c.delete,t[57]=z,t[58]=V):V=t[58];let H;t[59]!==P||t[60]!==L||t[61]!==V?(H=(0,$.jsx)(ht,{children:(0,$.jsxs)(Pt,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:qn,children:[P,L,R,V]})}),t[59]=P,t[60]=L,t[61]=V,t[62]=H):H=t[62];let U;t[63]!==A||t[64]!==H?(U=(0,$.jsxs)(Ze,{children:[A,H]}),t[63]=A,t[64]=H,t[65]=U):U=t[65];let W;t[66]!==C||t[67]!==O||t[68]!==U?(W=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,U]}),t[66]=C,t[67]=O,t[68]=U,t[69]=W):W=t[69];let te;t[70]===n.pinned?te=t[71]:(te=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)(Et,{className:`size-3`})}),t[70]=n.pinned,t[71]=te);let ne;t[72]===n.tags?ne=t[73]:(ne=n.tags?.slice(0,2).map(Un),t[72]=n.tags,t[73]=ne);let G;t[74]===g?G=t[75]:(G=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=G);let K;t[76]!==te||t[77]!==ne||t[78]!==G?(K=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[te,ne,G]}),t[76]=te,t[77]=ne,t[78]=G,t[79]=K):K=t[79];let re;return t[80]!==W||t[81]!==K||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(re=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,W,K]}),t[80]=W,t[81]=K,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=re):re=t[87],re}function Un(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 Wn(){}function Gn(){}function Kn(){}function qn(e){return e.stopPropagation()}function Jn(e){return e.stopPropagation()}function Yn(){return Date.now()}var Xn=3e4;function Zn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Qn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(0),[C,w]=(0,Z.useState)(!1),T=(0,Z.useRef)(null),E=(0,Z.useRef)(null),D=(0,Z.useRef)(null),O=(0,Z.useRef)([]),k=(0,Z.useRef)(0),A=(0,Z.useRef)(null),j=(0,Z.useRef)(null),N=(0,Z.useCallback)(()=>{A.current&&=(clearInterval(A.current),null),j.current&&=(clearTimeout(j.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,O.current=[],b(!1),S(0)},[]);(0,Z.useEffect)(()=>()=>N(),[N]);let P=(0,Z.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-k.current)/1e3)),n=e.mimeType||Zn()||`audio/webm`,r=new Blob(O.current,{type:n});if(N(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{w(!1)}return}w(!1)},[N,c]),F=(0,Z.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=Zn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,O.current=[],k.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&O.current.push(e.data)},n.start(),b(!0),S(0),A.current=setInterval(()=>{S(Math.round((Date.now()-k.current)/1e3))},250),j.current=setTimeout(()=>{P()},Xn)}catch{N(),l?.()}}},[N,c,l,y,P,C]),I=(0,Z.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),L=(0,Z.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),I())},[I]),R=_||C,z=!!(s||c||p);return(0,$.jsxs)(`div`,{className:B(`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`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":R,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void P(),disabled:C,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(je,{className:`size-4 fill-current`,"aria-hidden":!0})}):z?(0,$.jsxs)(Ze,{children:[(0,$.jsx)(mn,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:R,className:`shrink-0 rounded-lg p-2 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":n,title:n,children:(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ht,{children:(0,$.jsxs)(Pt,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(bt,{disabled:d,onSelect:s,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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(yt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(bt,{disabled:f,onSelect:()=>void F(),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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(Ve,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(bt,{onSelect:p,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`,children:[(0,$.jsx)(se,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:T,value:h,onChange:e=>g(e.target.value),onKeyDown:L,placeholder:e,"aria-label":e,rows:1,disabled:R,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto 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:!h.trim()||R||y,onClick:()=>void I(),"aria-label":t,title:t,className:B(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!R&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(ft,{className:`size-4`,"aria-hidden":!0})})]})}var $n={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},er=240,tr=320,nr=520,rr=560;function ir(e){if(globalThis.localStorage===void 0)return tr;try{let t=globalThis.localStorage.getItem(e);if(!t)return tr;let n=Number(t);return Number.isFinite(n)?n:tr}catch{return tr}}function ar(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var or={thought:Ke,todo:$t,voice:Ve,media:yt,bookmark:rt,mixed:Ke,task:$t};function sr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function cr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function lr(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function ur({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:l,emptyText:g,emptyDescription:_,listWidthStorageKey:v=`xopc.notes.listWidth`}){let y=R(e=>e.language),b=F(y).notes,C=!!ee(e=>e.token),[w,T]=(0,Z.useReducer)(re,$n),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(0),[P,I]=(0,Z.useState)(()=>ir(v)),[z,H]=(0,Z.useState)(!1),[U,W]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(!1),[G,K]=(0,Z.useState)(null),[ie,q]=(0,Z.useState)(null),J=(0,Z.useRef)(null),ae=(0,Z.useRef)(null),[oe]=(0,Z.useState)(()=>Date.now()),se=i(),ce=(0,Z.useCallback)(e=>{let t=J.current?.clientWidth??window.innerWidth,n=Math.max(er,t-rr);return Math.max(er,Math.min(Math.min(nr,n),e))},[]),ue=(0,Z.useCallback)(e=>{let t=ce(e);I(t),ar(v,t)},[ce,v]);(0,Z.useLayoutEffect)(()=>{I(e=>ce(e))},[ce]);let{data:de,mutate:Y,isLoading:fe}=V((0,Z.useMemo)(()=>C?[`notes-list`,o,w.statusFilter,w.kindFilter,w.pinnedOnly]:null,[C,o,w.statusFilter,w.kindFilter,w.pinnedOnly]),()=>Te({status:w.statusFilter===`all`?void 0:w.statusFilter,kind:w.kindFilter===`all`?void 0:w.kindFilter,projectId:o,pinned:w.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),me=fe&&!de,he=de?.items??[],ge=de?.total??0,_e=O.trim(),{data:ye,isLoading:be}=V(C&&E&&_e?[`notes-search`,o,_e]:null,()=>Te({search:_e,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),xe=ye?.items??[],Se=e?he.some(t=>t.id===e):!0;(0,Z.useEffect)(()=>{j(0)},[_e]),(0,Z.useEffect)(()=>{A>=xe.length&&j(Math.max(0,xe.length-1))},[A,xe.length]),(0,Z.useEffect)(()=>{let e=()=>{Y().catch(e=>{K(`${b.refreshFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,b.quickCaptureFailedHint,b.refreshFailed]);let Ce=qt(e=>e.setPageHeader),we=qt(e=>e.clearPageHeader),Ee=b.noteCount.replace(`{{count}}`,String(ge)),De=!r&&ge===0&&l?l:Ee,Ae=b.searchDialogTitle,je=b.searchClose,Me=b.searchClear,Ne=(0,Z.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>D(!0),className:B(`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`,nt),"aria-label":Ae,children:[(0,$.jsx)(Ut,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Ae})]}),[Ae]);(0,Z.useLayoutEffect)(()=>{if(n)return C?(Ce({startExtra:null,main:(0,$.jsxs)(`div`,{className:B(`flex min-w-0 items-center gap-2`,nt),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??b.title}),Ee?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Ee}):null]}),end:Ne}),()=>we()):(we(),()=>we())},[we,C,Ne,s,n,b.title,Ee,e,Ce]);let Fe=(0,Z.useMemo)(()=>({justNow:b.justNow,minutesAgo:b.minutesAgo,today:b.today,yesterday:b.yesterday,daysAgo:b.daysAgo,locale:L(y)}),[y,b.justNow,b.minutesAgo,b.today,b.yesterday,b.daysAgo]),Ie=(0,Z.useMemo)(()=>[{id:`recent`,label:b.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:b.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:b.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:b.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:b.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:b.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:b.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:b.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:b.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[b.filterArchived,b.filterInbox,b.filterProcessed,b.kindBookmark,b.kindMedia,b.kindVoice,b.pinned,b.viewRecent,b.viewTasks]),Le=Ie.find(e=>cr(w,e))??Ie[0],Re=s??Le.label,ze=(0,Z.useCallback)(async e=>{K(null);try{let n=o?await Pe({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await le(e,`web`);await Y(),se(lr(t,n.id))}catch(e){throw K(`${b.quickCaptureFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`),e}},[t,Y,b.quickCaptureFailed,b.quickCaptureFailedHint,se,o]),Ve=(0,Z.useCallback)(async()=>{if(!te){ne(!0),K(null);try{let e=await Pe({markdown:``,kind:`thought`,projectId:o,channel:`web`});T({type:`patch`,patch:$n}),await Y(),q(e.id),se(lr(t,e.id))}catch(e){K(`${b.createBlankFailed}: ${e instanceof Error?e.message:b.createBlankFailedHint}`)}finally{ne(!1)}}},[t,te,Y,b.createBlankFailed,b.createBlankFailedHint,se,o]),He=(0,Z.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{K(null),await pe(t,`web`),await Y()}catch(e){K(`${b.imageUploadFailed}: ${e instanceof Error?e.message:b.imageUploadFailedHint}`)}},e.click()},[Y,b.imageUploadFailed,b.imageUploadFailedHint]),Ue=(0,Z.useCallback)(async(e,t)=>{try{K(null),await ve(e,t,`web`),await Y()}catch(e){K(`${b.voiceUploadFailed}: ${e instanceof Error?e.message:b.voiceUploadFailedHint}`)}},[Y,b.voiceUploadFailed,b.voiceUploadFailedHint]),We=(0,Z.useCallback)(()=>{K(`${b.voiceCaptureFailed}: ${b.voiceCaptureFailedHint}`)},[b.voiceCaptureFailed,b.voiceCaptureFailedHint]),Ge=(0,Z.useCallback)(async(e,t)=>{K(null);try{await Be(e,{pinned:t}),await Y()}catch(e){K(`${b.actionFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)}},[Y,b.actionFailed,b.quickCaptureFailedHint]),qe=(0,Z.useCallback)(async e=>{K(null);try{await Be(e,{status:`archived`}),await Y()}catch(e){K(`${b.actionFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)}},[Y,b.actionFailed,b.quickCaptureFailedHint]),Je=(0,Z.useCallback)(async e=>{K(null);try{await dn(e),await Y()}catch(e){K(`${b.actionFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)}},[Y,b.actionFailed,b.quickCaptureFailedHint]),Ye=(0,Z.useCallback)(e=>{se(lr(t,e))},[t,se]),Xe=(0,Z.useCallback)(e=>{se(lr(t,e)),D(!1)},[t,se]),Ze=(0,Z.useCallback)(e=>{if(xe.length){if(e.key===`ArrowDown`)e.preventDefault(),j(e=>Math.min(xe.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),j(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=xe[A]??xe[0];t&&Xe(t.id)}}},[A,Xe,xe]),Qe=(0,Z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ae.current;t.setPointerCapture(e.pointerId),H(!0);let r=J.current?.clientWidth??window.innerWidth,i=Math.max(er,r-rr),a=Math.min(nr,i),o=e=>Math.max(er,Math.min(a,e)),s=e.clientX,c=o(P),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{}H(!1),J.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),I(f),ar(v,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)},[v,P]);(0,Z.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ve())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ve]);let $e=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ue(P-16)):e.key===`ArrowRight`?(e.preventDefault(),ue(P+16)):e.key===`Home`?(e.preventDefault(),ue(er)):e.key===`End`&&(e.preventDefault(),ue(nr))},[ue,P]);return C?(0,$.jsxs)(`div`,{ref:J,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${P}px`},children:[(0,$.jsxs)(`section`,{ref:ae,className:B(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!z&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`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":U?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[G?(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:G}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(x,{value:Le.id,onChange:e=>{let t=Ie.find(t=>t.id===e.target.value);t&&T({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 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":b.libraryTitle,children:Ie.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:Re}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:De})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!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":b.collapseNotesList,title:b.collapseNotesList,children:(0,$.jsx)(ke,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ve,disabled:te,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":b.createBlankNote,title:b.createBlankShortcut,children:(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(!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":b.searchDialogTitle,title:b.searchDialogTitle,children:(0,$.jsx)(Ut,{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:me?(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))}):he.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(Ke,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Se?b.noteOutsideCurrentView:g??b.noNotes}),e&&!Se?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:_??b.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Se?(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:b.noteOutsideCurrentView}):null,he.map((t,n)=>{let r=n>0?_n(he[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[_n(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:B(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:vn(t.createdAt,oe,Fe)}),(0,$.jsx)(Hn,{note:t,selected:t.id===e,onPress:Ye,onPin:Ge,onArchive:qe,onDelete:Je,timeLabels:Fe,labels:{pin:b.pin,unpin:b.unpin,archive:b.archive,delete:b.delete,actions:b.noteActions,imageNote:b.imageNote,noText:b.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Qn,{placeholder:b.quickCapturePlaceholder,submitLabel:b.quickCaptureSubmit,actionsLabel:b.quickCaptureActions,imageLabel:b.quickCaptureImage,voiceLabel:b.quickCaptureVoice,stopRecordingLabel:b.stopRecording,onCapture:ze,onImagePick:a?He:void 0,onVoiceCapture:a?Ue:void 0,onVoiceError:We,recordingLabel:b.recording,discussionCaptureLabel:b.discussionCapture.title,onDiscussionCapture:()=>Oe(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":b.resizeNotesList,"aria-valuemin":er,"aria-valuemax":nr,"aria-valuenow":Math.round(P),tabIndex:0,onPointerDown:Qe,onDoubleClick:()=>ue(tr),onKeyDown:$e,title:b.resizeNotesList,className:B(`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`,U?`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:B(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,z&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:B(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[U?(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!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":b.expandNotesList,title:b.expandNotesList,children:(0,$.jsx)(ke,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(yn,{noteId:e,onBack:()=>se(t),onSaved:()=>{Y().catch(e=>{K(`${b.refreshFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>D(!0),autoFocus:e===ie,onAutoFocusConsumed:()=>q(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)(Ke,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:b.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:b.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ve,disabled:te,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)(M,{className:`size-4`,"aria-hidden":!0}),te?b.creatingBlankNote:b.createBlankNote]})]})})]}),(0,$.jsx)(h,{open:E,onOpenChange:D,children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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)(m,{className:`text-sm font-semibold text-fg`,children:Ae}),(0,$.jsx)(u,{className:`sr-only`,children:b.searchPlaceholder}),(0,$.jsx)(d,{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":je,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ut,{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:O,onChange:e=>k(e.target.value),onKeyDown:Ze,placeholder:b.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`}),O?(0,$.jsx)(`button`,{type:`button`,onClick:()=>k(``),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":Me,children:(0,$.jsx)(N,{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:_e?be&&!ye?(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))}):xe.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)(Ke,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:b.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:b.searchResultsCount.replace(`{{count}}`,String(ye?.total??xe.length))}),xe.map((e,t)=>{let n=or[e.kind]||Ke,r=sr(e,{imageNote:b.imageNote,noText:b.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),onMouseEnter:()=>j(t),className:B(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===A?`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:gn(e.updatedAt,oe,Fe)})]}),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)(Ut,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:b.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(Ke,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:b.needToken})]})}function dr(e){return I(z(`/api/projects/${encodeURIComponent(e)}/skills`))}function fr(e,t){return I(z(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function pr(e,t){return I(z(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function mr(e,t){let n=new FormData;return n.set(`file`,t),I(z(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function hr(e,t,n={}){return I(z(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function gr(e,t){return I(z(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function _r(e,t){return I(z(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function vr({projectId:e,copy:t}){let[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)([]),[o,s]=(0,Z.useState)([]),[l,u]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(!0),[A,j]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(null),[ee,V]=(0,Z.useState)(null),[W,te]=(0,Z.useState)(``),[ne,G]=(0,Z.useState)(1),[K,re]=(0,Z.useState)(null),[ie,q]=(0,Z.useState)(!1),[J,ae]=(0,Z.useState)(``),[oe,se]=(0,Z.useState)(``),ce=(0,Z.useRef)(null),le=(0,Z.useCallback)(async()=>{k(!0),L(``);try{let t=await dr(e);r(t.items),a(t.inheritedItems),s(t.sources)}catch(e){L(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,Z.useEffect)(()=>{le()},[le]),(0,Z.useEffect)(()=>{let t=!1;return tn(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Z.useEffect)(()=>{if(!g){S(null);return}let e=l.find(e=>e.key===g),t=!1;return S(null),L(``),E(!0),$e(e?.agentId??e?.routing?.agentId,g,!0).then(e=>{t||S(e)}).catch(e=>{t||L(e instanceof Error?e.message:String(e))}).finally(()=>{t||E(!1)}),()=>{t=!0}},[g,l]),(0,Z.useEffect)(()=>{if(R!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{q(!0),ae(``),En({q:W,page:ne,pageSize:8,sort:`downloads`,signal:e.signal}).then(re).catch(t=>{e.signal.aborted||ae(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||q(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[R,ne,W]);async function ue(e,t){j(!0),F(t??null),L(``);try{await e(),z(null),se(``),await le()}catch(e){L(e instanceof Error?e.message:String(e))}finally{j(!1),F(null)}}async function de(t){L(``);try{V((await fr(e,t)).skill)}catch(e){L(e instanceof Error?e.message:String(e))}}async function Y(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){j(!0);try{await _r(e,n.directoryId),await le()}catch(e){L(e instanceof Error?e.message:String(e))}finally{j(!1)}}}async function fe(){j(!0),L(``);try{await pr(e,!0),await le()}catch(e){L(e instanceof Error?e.message:String(e))}finally{j(!1)}}let pe=o.find(e=>e.origin===`agents-workspace`),me=new Map(x?.skills.map(e=>[e.name,e]));return(0,$.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,$.jsxs)(v,{children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.jsxs)(H,{type:`button`,children:[(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t.add,(0,$.jsx)(pt,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,$.jsx)(w,{children:(0,$.jsxs)(b,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,$.jsx)(Sr,{icon:he,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>z(`marketplace`)}),(0,$.jsx)(Sr,{icon:Ie,title:t.source,hint:t.sourceHint,onClick:()=>z(`source`)}),(0,$.jsx)(Sr,{icon:Ne,title:t.upload,hint:t.uploadHint,onClick:()=>ce.current?.click()})]})})]}),(0,$.jsx)(`input`,{ref:ce,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&ue(()=>mr(e,n)),t.target.value=``}})]})}),I?(0,$.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:I}):null,pe?.state===`untrusted`?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Ge,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,$.jsxs)(H,{type:`button`,variant:`secondary`,disabled:A,onClick:()=>void fe(),children:[(0,$.jsx)(Yt,{className:`size-4`,"aria-hidden":!0}),A?t.trusting:t.trustAction]})]}):null,l.length?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:T?t.sessionLoading:g?x?.agentId:t.sessionViewAll})]}),(0,$.jsx)(C,{value:g,options:l.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:_})]}):null,O?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,$.jsx)(U,{className:`h-36 rounded-lg`},e))}):n.length?(0,$.jsx)(yr,{title:t.localTitle,items:n,copy:t,busy:A,availabilityByName:me,onPreview:de,onRemove:Y}):(0,$.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!O&&i.length?(0,$.jsx)(yr,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:A,availabilityByName:me,onPreview:de,onRemove:Y}):null,(0,$.jsx)(h,{open:R!==null,onOpenChange:e=>{e||z(null)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:B(`xopc-dialog-content 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`,R===`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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:R===`marketplace`?t.marketplace:t.source}),(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(N,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:R===`marketplace`?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,$.jsxs)(`div`,{className:`relative mt-3`,children:[(0,$.jsx)(Ut,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.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:W,onChange:e=>{te(e.target.value),G(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),J?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:J}):null,ie&&!K?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,$.jsx)(U,{className:`h-32 rounded-lg`},e))}):K?.items.length?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:K.items.map(r=>{let i=r.providerId??K.provider,a=Tn(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=P===a;return(0,$.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(Dn,{name:r.name,className:`size-10`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,$.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,$.jsx)(H,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:A||o,onClick:()=>void ue(()=>hr(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):ie?null:(0,$.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),K&&K.meta.totalPages>1?(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(K.meta.page)).replace(`{{total}}`,String(K.meta.totalPages))}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ie||ne<=1,onClick:()=>G(e=>Math.max(1,e-1)),children:[(0,$.jsx)(ct,{className:`size-4`}),t.marketplacePrevious]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ie||ne>=K.meta.totalPages,onClick:()=>G(e=>e+1),children:[t.marketplaceNext,(0,$.jsx)(on,{className:`size-4`})]})]})]}):null]}):(0,$.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,$.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:oe,onChange:e=>se(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`secondary`,children:t.close})}),(0,$.jsx)(H,{type:`button`,disabled:A||!oe.trim(),onClick:()=>void ue(()=>gr(e,oe.trim())),children:A?t.installing:t.install})]})]})})]})]})}),(0,$.jsx)(h,{open:!!ee,onOpenChange:e=>{e||V(null)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:ee?.name}),(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(N,{className:`size-4`})})})]}),(0,$.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:ee?.bodyMarkdown})]})]})})]})}function yr(e){let t=(0,Q.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,$.jsxs)(`article`,{className:B(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Se,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:br(a,e.origin)}),e.writable?null:(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,$.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,$.jsx)(`span`,{className:B(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:xr(a,t)}):null]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,$.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,$.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function br(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function xr(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function Sr(e){let t=(0,Q.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.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,$.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,$.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,$.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,$.jsx)(_,{asChild:!0,children:(0,$.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 Cr={active:0,review:1,ready:2,backlog:3,closed:4},wr={blocked:0,waiting:1,verifying:2,running:3,queued:4,idle:5},Tr={critical:0,high:1,normal:2,low:3};function Er(e,t=4){return e.filter(e=>e.phase!==`closed`).sort((e,t)=>{let n=Number(t.attention.length>0)-Number(e.attention.length>0);if(n!==0)return n;let r=wr[e.operationalState]-wr[t.operationalState];if(r!==0)return r;let i=Cr[e.phase]-Cr[t.phase];if(i!==0)return i;let a=Tr[e.priority]-Tr[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Dr=[`backlog`,`ready`,`active`,`review`,`closed`];function Or(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 kr(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 Ar(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 jr(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 Mr(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=jr(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 Nr(e,t){let{incoming:n}=jr(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 Pr(e,t){let{incoming:n,outgoing:r}=jr(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 Fr={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 Ir(e){let t=(0,Q.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Fr[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=B(`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,$.jsx)(Mn,{type:`target`,position:kn.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,$.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,$.jsx)(cn,{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,$.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,$.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,$.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,$.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,$.jsx)(Mn,{type:`source`,position:kn.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,$.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var Lr={taskNode:Ir};function Rr(e){let t=(0,Q.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(),[m,h]=(0,Z.useState)(),g=(0,Z.useRef)(null),_;t[0]!==r||t[1]!==n?(_=Nr(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Kr),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x;t[8]===b?x=t[9]:(x=new Set(b.map(Gr)),t[8]=b,t[9]=x);let S=x,C;if(t[10]!==r||t[11]!==S){let e;t[13]===S?e=t[14]:(e=e=>S.has(e.dependencyTaskId)&&S.has(e.dependentTaskId),t[13]=S,t[14]=e),C=r.filter(e),t[10]=r,t[11]=S,t[12]=C}else C=t[12];let w=C,T;t[15]!==w||t[16]!==b?(T=Mr(b,w),t[15]=w,t[16]=b,t[17]=T):T=t[17];let E=T,D;t[18]!==f||t[19]!==w?(D=f?Pr(f,w):void 0,t[18]=f,t[19]=w,t[20]=D):D=t[20];let k=D,A;t[21]===f?A=t[22]:(A=e=>e.id===f,t[21]=f,t[22]=A);let j=b.find(A),M;t[23]===b?M=t[24]:(M=new Map(b.map(Wr)),t[23]=b,t[24]=M);let N=M,P;if(t[25]!==a.phases||t[26]!==E||t[27]!==k||t[28]!==b){let e;t[30]!==a.phases||t[31]!==E||t[32]!==k?(e=e=>({id:e.id,type:`taskNode`,position:E.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(k&&!k.has(e.id))}}),t[30]=a.phases,t[31]=E,t[32]=k,t[33]=e):e=t[33],P=b.map(e),t[25]=a.phases,t[26]=E,t[27]=k,t[28]=b,t[29]=P}else P=t[29];let F=P,I;if(t[34]!==k||t[35]!==N||t[36]!==w){let e;t[38]!==k||t[39]!==N?(e=e=>{let t=N.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(k&&(!k.has(e.dependencyTaskId)||!k.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:On.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]=k,t[39]=N,t[40]=e):e=t[40],I=w.map(e),t[34]=k,t[35]=N,t[36]=w,t[37]=I}else I=t[37];let L=I,R,z;t[41]!==f||t[42]!==S?(R=()=>{f&&!S.has(f)&&p(void 0)},z=[f,S],t[41]=f,t[42]=S,t[43]=R,t[44]=z):(R=t[43],z=t[44]),(0,Z.useEffect)(R,z);let ee,V;t[45]!==L||t[46]!==m?(ee=()=>{m&&!L.some(e=>e.id===m)&&h(void 0)},V=[L,m],t[45]=L,t[46]=m,t[47]=ee,t[48]=V):(ee=t[47],V=t[48]),(0,Z.useEffect)(ee,V);let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=U):U=t[49];let W;t[50]!==u||t[51]!==c||t[52]!==b.length?(W=[u,c,b.length],t[50]=u,t[51]=c,t[52]=b.length,t[53]=W):W=t[53],(0,Z.useEffect)(U,W);let te;t[54]===f?te=t[55]:(te=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=te);let ne=te,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(Ur);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=G):G=t[58];let K=G,re;t[59]!==r||t[60]!==o||t[61]!==m?(re=()=>{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(Hr)))},t[59]=r,t[60]=o,t[61]=m,t[62]=re):re=t[62];let ie=re,q;t[63]===a.connectHint?q=t[64]:(q=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=q);let J=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(Vr),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==J||t[68]!==se?(ce=(0,$.jsx)(H,{type:`button`,variant:J,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=J,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Br),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let Y=j?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:ne,children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,fe;t[75]!==a.removeDependency||t[76]!==ie||t[77]!==m?(fe=m?(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ie,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ie,t[77]=m,t[78]=fe):fe=t[78];let pe;t[79]!==ce||t[80]!==de||t[81]!==Y||t[82]!==fe?(pe=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,de,Y,fe]}),t[79]=ce,t[80]=de,t[81]=Y,t[82]=fe,t[83]=pe):pe=t[83];let me;t[84]!==q||t[85]!==pe?(me=(0,$.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:[q,pe]}),t[84]=q,t[85]=pe,t[86]=me):me=t[86];let he=b.length>0?(0,$.jsxs)(`div`,{className:B(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,j&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,$.jsxs)(jn,{nodes:F,edges:L,nodeTypes:Lr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:K,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,$.jsx)(Nn,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(An,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),j?(0,$.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[j.phase]}),(0,$.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:j.title}),j.operationalState===`blocked`&&j.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(j.blockedBy.length))}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:j.blockedBy.map(zr)})]}):null,(0,$.jsxs)(s,{to:ae(i,j.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,$.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,$.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function zr(e){return(0,$.jsx)(`li`,{children:e.title},e.id)}function Br(e){return!e}function Vr(e){return!e}function Hr(e){return e.dependencyTaskId}function Ur(e){return e.dependencyTaskId}function Wr(e){return[e.id,e]}function Gr(e){return e.id}function Kr(e){return e.phase!==`closed`}function qr({policy:e,copy:t,onSave:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(e.mode),[s,g]=(0,Z.useState)(Math.round(e.confidenceThreshold*100)),[_,v]=(0,Z.useState)(!!e.quietHours),[y,b]=(0,Z.useState)(e.quietHours?.startHour??22),[C,w]=(0,Z.useState)(e.quietHours?.endHour??8),[T,E]=(0,Z.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[D,O]=(0,Z.useState)(e.allowedActions.includes(`create_project_task`)),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)();(0,Z.useEffect)(()=>{o(e.mode),g(Math.round(e.confidenceThreshold*100)),v(!!e.quietHours),b(e.quietHours?.startHour??22),w(e.quietHours?.endHour??8),E(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),O(e.allowedActions.includes(`create_project_task`))},[e]);let P=async()=>{A(!0),M(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:_?{startHour:y,endHour:C,timezone:T}:null,allowedActions:D?[`create_project_task`]:[]}),i(!1)}catch(e){M(e instanceof Error?e.message:t.saveFailed)}finally{A(!1)}};return(0,$.jsxs)(h,{open:r,onOpenChange:e=>{k||i(e)},children:[(0,$.jsx)(l,{asChild:!0,children:(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,$.jsx)(nn,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.title}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:k,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,$.jsx)(x,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,$.jsx)(S,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,$.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>g(Number(e.target.value)),className:`accent-accent`})]}),(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),t.quietHours]}),_?(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:y,onChange:e=>b(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:C,onChange:e=>w(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,$.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,$.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,$.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:D,onChange:e=>O(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[j?(0,$.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:j}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,disabled:k,children:t.cancel})}),(0,$.jsx)(H,{type:`button`,variant:`primary`,disabled:k||!T.trim()||y<0||y>23||C<0||C>23,onClick:()=>void P(),children:k?t.saving:t.save})]})]})]})]})]})}function Jr(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Yr={backlog:Zt,ready:Zt,active:Rt,review:me,closed:T},Xr={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function Zr(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Qr(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function $r(e){let t=(0,Q.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,E;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=Ar(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?T:Bt,_=n.priority!==`normal`,g=_||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,b=!0,t[20]!==c||t[21]!==n.id?(x=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=x):x=t[22],t[23]===c?S=t[24]:(S=()=>c(``),t[23]=c,t[24]=S),C=ti,t[25]!==l||t[26]!==n.id?(w=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=w):w=t[27],E=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(v=ae(r,n.id),t[28]=r,t[29]=n.id,t[30]=v):v=t[30],y=B(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=E):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],E=t[19]);let D=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,O;t[31]===D?O=t[32]:(O=B(`mt-0.5 size-4 shrink-0`,D),t[31]=D,t[32]=O);let k;t[33]!==d||t[34]!==O?(k=(0,$.jsx)(d,{className:O,"aria-hidden":!0}),t[33]=d,t[34]=O,t[35]=k):k=t[35];let A=f?`text-fg-subtle`:`text-fg`,j;t[36]===A?j=t[37]:(j=B(`min-w-0 break-words text-sm font-semibold leading-5`,A),t[36]=A,t[37]=j);let M;t[38]!==j||t[39]!==n.title?(M=(0,$.jsx)(`h3`,{className:j,children:n.title}),t[38]=j,t[39]=n.title,t[40]=M):M=t[40];let N;t[41]!==k||t[42]!==M?(N=(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[k,M]}),t[41]=k,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(P=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,$.jsx)(cn,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(ei).join(`、`)})]}):n.attention[0]?(0,$.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,$.jsx)(Mt,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=P):P=t[48];let F;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==_||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(F=g?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[_?(0,$.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,$.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Zr(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,$.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Qr(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,$.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,$.jsx)(Rt,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,$.jsxs)(`span`,{className:B(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,$.jsx)(Ft,{className:`size-3`,"aria-hidden":!0}),wt(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,$.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,$.jsx)(Ft,{className:`size-3`,"aria-hidden":!0}),wt(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=_,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=F):F=t[59];let I;t[60]!==u||t[61]!==v||t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==y?(I=(0,$.jsxs)(u,{to:v,className:y,children:[N,P,F]}),t[60]=u,t[61]=v,t[62]=N,t[63]=P,t[64]=F,t[65]=y,t[66]=I):I=t[66];let L;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(L=m?(0,$.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[h?(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[m],title:i.actions[m],children:(0,$.jsx)(Ot,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=L):L=t[73];let R;return t[74]!==I||t[75]!==L||t[76]!==b||t[77]!==x||t[78]!==S||t[79]!==C||t[80]!==w||t[81]!==E?(R=(0,$.jsxs)(`article`,{draggable:b,onDragStart:x,onDragEnd:S,onDragOver:C,onDrop:w,className:E,children:[I,L]}),t[74]=I,t[75]=L,t[76]=b,t[77]=x,t[78]=S,t[79]=C,t[80]=w,t[81]=E,t[82]=R):R=t[82],R}function ei(e){return e.title}function ti(e){e.preventDefault(),e.stopPropagation()}function ni({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:l,onMonitoringChange:g,onCreate:_,actionBusyId:v,ref:y}){let b=(0,Z.useRef)(null),C=(0,Z.useRef)(null),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(`board`),[M,N]=(0,Z.useState)(!1),[P,I]=(0,Z.useState)(()=>crypto.randomUUID()),[L,z]=(0,Z.useState)(``),[ee,V]=(0,Z.useState)(`normal`),[U,W]=(0,Z.useState)(``),[te,ne]=(0,Z.useState)([]),[G,K]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(null),q=ue({chat:F(R(e=>e.language)).chat}),J=Or(e),ae=e.filter(e=>e.phase!==`closed`),oe=(e,t)=>void a(e,t),se=async(t,n)=>{let r=e.find(e=>e.id===w);if(T(null),!r||r.id===n)return;let i=J[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=kr(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&k({taskId:r.id,phase:r.phase,beforeTaskId:c})},ce=async e=>{e.preventDefault();let t=L.trim();if(!(!t||G)){K(!0),ie(null);try{let e=U?new Date(`${U}T23:59:59.999`).getTime():void 0;await _({requestId:P,objective:t,priority:ee,dependsOnTaskIds:te,attachments:q.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),z(``),V(`normal`),W(``),ne([]),q.clearAttachments(),I(crypto.randomUUID()),N(!1)}catch(e){ie(e instanceof Error?e.message:i.createFailed)}finally{K(!1)}}},le=()=>{I(crypto.randomUUID()),z(``),V(`normal`),W(``),ne([]),q.clearAttachments(),ie(null),N(!0)};(0,Z.useImperativeHandle)(y,()=>({openCreate:le})),(0,Z.useEffect)(()=>{if(!O)return;let e=window.setTimeout(()=>k(null),6e3);return()=>window.clearTimeout(e)},[O]);let de=(0,Z.useCallback)(e=>{let t=C.current;!t||t.pointerId!==e.pointerId||(C.current=null,D(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),Y=(0,Z.useCallback)(e=>{if(e.button!==0||Jr(e.target))return;let t=b.current;t&&(C.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),fe=(0,Z.useCallback)(e=>{let t=C.current,n=b.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,D(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,$.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,$.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,$.jsx)(qr,{policy:n,copy:i.monitoring,onSave:g}),(0,$.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":A===`board`,onClick:()=>j(`board`),className:B(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,A===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,$.jsx)(Xt,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":A===`graph`,onClick:()=>j(`graph`),className:B(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,A===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,$.jsx)(Ie,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),A===`board`?(0,$.jsx)(`div`,{ref:b,className:B(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,E?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:Y,onPointerMove:fe,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{C.current?.pointerId===e.pointerId&&(C.current=null,D(!1))},children:(0,$.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Dr.map(t=>{let n=Yr[t],a=J[t];return(0,$.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===w);r&&(r.phase===t||kr(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),se(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,$.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,$.jsxs)(`div`,{className:B(`flex items-center gap-1.5 rounded-md px-2 py-1`,Xr[t]),children:[(0,$.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,$.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,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,$.jsx)($r,{task:e,returnTo:r,copy:i,busy:v===e.id,onAction:oe,onDragStart:T,onDropBefore:e=>void se(t,e)},e.id))})})]},t)})})}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,$.jsx)(Rr,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:l})}),(0,$.jsx)(h,{open:M,onOpenChange:e=>{G||N(e)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,$.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ce(e),children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,$.jsxs)(`div`,{className:B(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,q.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),G||q.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||q.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),q.setIsDragging(!1),G||q.processFiles(Array.from(e.dataTransfer.files))},children:[(0,$.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:L,onChange:e=>{z(e.target.value),ie(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:G}),(0,$.jsx)(en,{attachments:q.attachments,topPadded:!1,onRemove:e=>{G||q.removeAttachment(e)}}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:G,onClick:()=>q.fileInputRef.current?.click(),children:[(0,$.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,$.jsx)(`input`,{ref:q.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{q.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,$.jsx)(x,{value:ee,onChange:e=>V(e.target.value),disabled:G,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,$.jsx)(S,{value:e,children:i.priorityOptions[e]},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,$.jsx)(Cn,{className:`min-h-10 bg-surface-base`,value:U,onChange:W,disabled:G,ariaLabel:i.dueDate})]})]}),(0,$.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,$.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,$.jsx)(X,{candidates:ae,selectedIds:te,disabled:G,onChange:ne,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),re?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:re}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:G,children:i.cancel})}),(0,$.jsx)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G||!L.trim(),children:G?i.creating:i.create})]})]})]})]})}),O?(0,$.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,$.jsx)(`span`,{children:i.moved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=O;k(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||k(e)})},children:i.undo})]}):null]})}var ri=new Set([{id:`overview`,icon:ot},{id:`tasks`,icon:Gt},{id:`automations`,icon:Tt},{id:`files`,icon:q},{id:`notes`,icon:we},{id:`skills`,icon:Lt},{id:`sessions`,icon:Re},{id:`progress`,icon:pn},{id:`settings`,icon:At}].map(e=>e.id)),ii=`xopc.projectFiles.panelWidthPx`,ai=320,oi=220,si=560;function ci(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function li(e){return Math.min(si,Math.max(oi,Math.round(e)))}function ui(){try{let e=window.localStorage.getItem(ii);if(e==null)return ai;let t=Number.parseInt(e,10);return Number.isFinite(t)?li(t):ai}catch{return ai}}function di(e){try{window.localStorage.setItem(ii,String(li(e)))}catch{}}function fi(e){return!!(e&&ri.has(e))}function pi(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function mi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):wt(n)}function hi(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 gi(e){let t=(0,Q.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.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,$.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,$.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 _i(e=!1){return B(`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 vi(e){let t=(0,Q.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,$.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=B(`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,$.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,$.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 yi(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function bi(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function xi(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Si(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Ci(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 wi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Ti(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 Ei(e){let t=e.sourceChannel?.trim();if(t)return Di(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 Di(r||``)}function Di(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Oi(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 ki(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Ai(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Ai(e.children,t,n)}:e)}function ji({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Z.useState)(!1),[l,_]=(0,Z.useState)([e]),[x,S]=(0,Z.useState)(``),[C,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(`new`),[N,P]=(0,Z.useState)(``),[F,I]=(0,Z.useState)(``),[L,R]=(0,Z.useState)(!1),[z,ee]=(0,Z.useState)(null),[V,U]=(0,Z.useState)(null),W=(0,Z.useCallback)(async()=>{T(!0),D(null);try{let t=await st({limit:100});_(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){D(e instanceof Error?e.message:String(e))}finally{T(!1)}},[e]);(0,Z.useEffect)(()=>{_(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Z.useEffect)(()=>{o&&W()},[W,o]);let te=(0,Z.useMemo)(()=>{let t=x.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=yi(e);return t.every(e=>n.includes(e))}).sort((e,t)=>bi(t)-bi(e))},[e.id,l,x]),ne=e=>t.statuses[e.status]??e.status,G=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,K=e=>{j(e),P(``),I(``),ee(null),k(!0),s(!1)},re=(0,Z.useCallback)(async(e={})=>{let t=F.trim(),n=N.trim()||(A===`directory`?xi(t):``);if(n){R(!0),ee(null),U(null);try{let r=await Qt({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});k(!1),P(``),I(``),_(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Si(e);t?(U(t),k(!1)):ee(e instanceof Error?e.message:String(e))}finally{R(!1)}}},[A,N,a,F]),ie=(0,Z.useCallback)(e=>{e.preventDefault(),re()},[re]),J=(0,Z.useCallback)(()=>{re({createWorkspaceRoot:!0})},[re]),ae=(0,Z.useCallback)(()=>{U(null),k(!0)},[]),oe=e=>{I(e),A===`directory`&&!N.trim()&&P(xi(e))},se=(e,t)=>(0,$.jsxs)(`button`,{type:`button`,className:B(`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||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,$.jsx)(g,{className:B(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:G(e)})]}),(0,$.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,hi(e.status)),children:ne(e)})]},e.id);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{open:o,onOpenChange:s,children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.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,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,hi(e.status)),children:ne(e)})]}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:G(e)})]}),(0,$.jsx)(pt,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,$.jsx)(w,{children:(0,$.jsxs)(b,{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,$.jsxs)(`label`,{className:`relative block`,children:[(0,$.jsx)(Ut,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.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:x,onChange:e=>S(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,$.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),se(e,!0),(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),E?(0,$.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:E}):null,C&&te.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!C&&te.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,te.map(e=>se(e,!1))]}),(0,$.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,$.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,$.jsx)(M,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,$.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,$.jsx)(q,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,$.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),a(`/projects`)},children:[(0,$.jsx)(At,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,$.jsx)(h,{open:O,onOpenChange:e=>!L&&k(e),children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:A===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:A===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,$.jsxs)(`form`,{onSubmit:ie,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[z?(0,$.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:z}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,$.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:N,onChange:e=>P(e.target.value),placeholder:`xopc`})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,$.jsx)(Fn,{value:F,onChange:oe,disabled:L,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,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:L,children:n.cancel})}),(0,$.jsxs)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:L||!(N.trim()||A===`directory`&&xi(F)),children:[(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,$.jsx)(h,{open:!!V,onOpenChange:e=>{e||U(null)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?pi(n.workspaceMissingDescription,{workspace:V}):null})]}),V?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(q,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ae,disabled:L,children:n.workspaceMissingBack}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:J,disabled:L,children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Mi(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[l]=a(),g=R(e=>e.language),_=F(g),v=_.chat.workingDirectory,y=_.projectDetailPage,b=_.projectsPage,C=qt(e=>e.setPageHeader),w=qt(e=>e.clearPageHeader),[T,D]=(0,Z.useState)(null),[O,j]=(0,Z.useState)(null),[I,L]=(0,Z.useState)([]),[z,ee]=(0,Z.useState)(``),[V,W]=(0,Z.useState)([]),[re,oe]=(0,Z.useState)(0),[se,le]=(0,Z.useState)(!1),[ue,pe]=(0,Z.useState)(!1),[me,he]=(0,Z.useState)(!1),[ge,ve]=(0,Z.useState)([]),[ye,xe]=(0,Z.useState)(null),Ce=(0,Z.useRef)(new Set),[Te,Oe]=(0,Z.useState)(null),[ke,je]=(0,Z.useState)(null),[Ne,Pe]=(0,Z.useState)(null),[Fe,Be]=(0,Z.useState)(ui),[Ve,Ue]=(0,Z.useState)(!1),[Ge,Ke]=(0,Z.useState)(!1),[Xe,Ze]=(0,Z.useState)(``),[$e,et]=(0,Z.useState)([]),[tt,nt]=(0,Z.useState)(!1),[rt,st]=(0,Z.useState)(null),[ct,ft]=(0,Z.useState)(!1),[pt,ht]=(0,Z.useState)(null),[yt,bt]=(0,Z.useState)([]),[Ct,wt]=(0,Z.useState)(``),[Ot,Pt]=(0,Z.useState)(!0),[Ft,Rt]=(0,Z.useState)(!1),[zt,Bt]=(0,Z.useState)(!1),[Yt,Xt]=(0,Z.useState)(null),[Zt,Qt]=(0,Z.useState)(!1),[$t,en]=(0,Z.useState)(`fixed`),[nn,on]=(0,Z.useState)(``),[cn,ln]=(0,Z.useState)(null),[un,dn]=(0,Z.useState)(!1),[mn,gn]=(0,Z.useState)(!1),[_n,vn]=(0,Z.useState)(!1),[yn,Cn]=(0,Z.useState)(null),Tn=(0,Z.useRef)(null),En=(0,Z.useRef)(!1),[Dn,X]=(0,Z.useState)(null),[On,kn]=(0,Z.useState)({title:``,reason:``}),[An,jn]=(0,Z.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),Mn=(0,Z.useRef)(An),Nn=`overview`,Q=n?`notes`:fi(t)?t:Nn,Pn=(0,Z.useMemo)(()=>k(l.get(`returnTo`),`/projects`,[`/chat`]),[l]),In=(0,Z.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Pn===`/projects`?n:A(n,Pn)},[Pn,e]),Ln=(0,Z.useCallback)(t=>{e&&r(In(t))},[r,e,In]),Rn=(0,Z.useCallback)(()=>{if(Q===`tasks`&&Tn.current){Tn.current.openCreate();return}En.current=!0,Ln(`tasks`)},[Ln,Q]);(0,Z.useEffect)(()=>{Q!==`tasks`||!En.current||(En.current=!1,Tn.current?.openCreate())},[Q]);let zn=(0,Z.useCallback)(t=>{e&&r(In(t),{replace:!0})},[r,e,In]),Bn=(0,Z.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||zn(e)},[zn]),Vn=(0,Z.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,Z.useEffect)(()=>{!e||!t||fi(t)||r(In(Nn),{replace:!0})},[Nn,r,e,In,t]),(0,Z.useEffect)(()=>{if(!e)return;let t=!1;return Pt(!0),X(null),Promise.all([Qe(e),it(e),tn(e),Kt().catch(()=>null),kt(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;D(e),j(n),L(r),xe(a),bt(i?.agents??[]),wt(e.defaultAgentId??``);let o={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Mn.current=o,jn(o)}).catch(e=>{t||(xe(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Pt(!1)}),()=>{t=!0}},[e]);let Hn=(0,Z.useCallback)(async()=>{e&&j(await it(e))},[e]);(0,Z.useEffect)(()=>{let t,n=n=>{let r=Dt.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Hn(),120))},r=n=>{let r=ne.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Hn(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,Hn]);let Un=(0,Z.useCallback)(async(e,t)=>{Cn(e.id),X(null);try{let n=await gt(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??(await Wt(e.id)).agentId}}: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 jt(e.id,r,n.task.version),await Hn(),!0}catch(e){return await Hn().catch(()=>void 0),X(e instanceof Error?e.message:y.board.actionFailed),!1}finally{Cn(null)}},[O,y.board.actionFailed,Hn]),Wn=(0,Z.useCallback)(async t=>{e&&(X(null),await an({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:g,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 Hn())},[g,e,Hn]),Gn=(0,Z.useCallback)(async(e,t)=>{Cn(e),X(null);try{return await fn(e,t,(await gt(e)).task.version),await Hn(),!0}catch(e){return await Hn().catch(()=>void 0),X(e instanceof Error?e.message:y.board.actionFailed),!1}finally{Cn(null)}},[y.board.actionFailed,Hn]),Kn=(0,Z.useCallback)(async(e,t,n)=>{Cn(e),X(null);try{let r=await gt(e);return r.task.phase!==t&&(r=await jt(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 fn(e,n,r.task.version),await Hn(),!0}catch(e){return await Hn().catch(()=>void 0),X(e instanceof Error?e.message:y.board.actionFailed),!1}finally{Cn(null)}},[y.board.actionFailed,Hn]),qn=(0,Z.useCallback)(async(e,t)=>{Cn(e),X(null);try{await Le(e,t,(await gt(e)).task.version),await Hn()}catch(e){await Hn().catch(()=>void 0),X(e instanceof Error?e.message:y.board.actionFailed)}finally{Cn(null)}},[y.board.actionFailed,Hn]),Jn=(0,Z.useCallback)(async t=>{if(e){X(null);try{await sn(e,t),await Hn()}catch(e){throw X(e instanceof Error?e.message:y.board.actionFailed),e}}},[y.board.actionFailed,e,Hn]),Yn=(0,Z.useCallback)(async()=>{if(T){le(!0),X(null);try{let e=await Vt(T.id,{includeRelated:ue,limit:100});W(e.items),oe(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{le(!1)}}},[T,ue]);(0,Z.useEffect)(()=>{Q===`progress`&&Yn()},[Yn,Q]);let Xn=(0,Z.useCallback)(async()=>{if(!T?.effectiveWorkspaceRoot?.trim()){ve([]),Ce.current.clear(),ht(null);return}ft(!0),ht(null),Ce.current.clear();try{ve(ki((await Jt(T.id,``)).entries)),Ce.current.add(``)}catch(e){ve([]),Ce.current.clear(),ht(e instanceof Error?e.message:String(e))}finally{ft(!1)}},[T]),Zn=(0,Z.useCallback)(async e=>{if(!(!T?.effectiveWorkspaceRoot?.trim()||Ce.current.has(e))){Ce.current.add(e),ht(null);try{let t=await Jt(T.id,e);ve(n=>Ai(n,e,ki(t.entries)))}catch(t){Ce.current.delete(e),ht(t instanceof Error?t.message:String(t))}}},[T]),Qn=(0,Z.useCallback)(async e=>{if(!T?.effectiveWorkspaceRoot?.trim())return;let t=ki((await Jt(T.id,e)).entries);ve(e?n=>Ai(n,e,t):t),Ce.current.add(e)},[T]);(0,Z.useEffect)(()=>{Q===`files`&&Xn()},[Xn,Q]);let $n=Xe.trim();(0,Z.useEffect)(()=>{if(Q!==`files`||!T||!Ge||!$n){et([]),nt(!1),st(null);return}let e=!1;nt(!0),st(null),et([]);let t=window.setTimeout(()=>{_t(T.id,$n,50).then(t=>{e||et(t)}).catch(t=>{e||st(t instanceof Error?t.message:String(t))}).finally(()=>{e||nt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[$n,T,Ge,Q]);let er=(0,Z.useCallback)(async()=>{if(!T)return;let[e,t]=await Promise.all([Qe(T.id),it(T.id)]);j(t),D(e)},[T]),tr=(0,Z.useCallback)(async e=>{if(e.preventDefault(),!(!T||!On.title.trim())){gn(!0),X(null);try{await It(T.id,{title:On.title.trim(),reason:On.reason.trim()||void 0}),kn({title:``,reason:``}),vn(!1),await er()}catch(e){X(e instanceof Error?e.message:String(e))}finally{gn(!1)}}},[On.reason,On.title,T,er]),nr=(0,Z.useMemo)(()=>(0,$.jsx)(s,{to:Pn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Pn===`/projects`?y.backToProjects:_.sidebar.back,children:(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0})}),[Pn,_.sidebar.back,y.backToProjects]),rr=(0,Z.useMemo)(()=>T?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(T.id)}`,children:[(0,$.jsx)(Ie,{className:`size-4`,"aria-hidden":!0}),y.common.runWorkflow]})}),(0,$.jsxs)(H,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Rn,children:[(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),y.board.create]}),(0,$.jsx)(H,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:te(T.id),state:{forceNewChat:!0,agentId:T.defaultAgentId},onClick:Bn(`sessions`),children:[(0,$.jsx)(Re,{className:`size-4`,"aria-hidden":!0}),y.common.newChat]})})]}):null,[Rn,Bn,y.board.create,y.common.newChat,y.common.runWorkflow,T]);(0,Z.useLayoutEffect)(()=>(C({startExtra:nr,main:T?(0,$.jsx)(ji,{currentProject:T,pm:y,projectsText:b,wd:v}):(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:y.fallbackTitle}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:y.fallbackContext})]}),end:rr}),()=>w()),[w,rr,nr,y,T,b,C,v]);function ir(e){D(t=>t?{...t,...e}:null),wt(e.defaultAgentId??``),kt(e.id).then(xe).catch(()=>xe(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function ar(e=Mn.current){if(!(!T||!ci(e,T))){X(null),Xt(null);try{let t=await Je(T.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions});ir(t);let n=Mn.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,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Mn.current=r,jn(r)}catch(e){let t=Si(e);throw t?Xt(t):X(e instanceof Error?e.message:String(e)),e}}}function or(e){e.preventDefault(),wr.flush()}function sr(e,t=!1){let n={...Mn.current,...e};Mn.current=n,jn(n),t&&wr.saveNow(n)}let cr=(0,Z.useCallback)(()=>{if(!T)return;let e=T.workspaceRoot?.trim()??``;en(e?`fixed`:`follow`),on(e||T.effectiveWorkspaceRoot||``),Qt(!0)},[T]);async function lr(e={}){if(!T)return;let t=$t===`fixed`?nn.trim():``;if(!($t===`fixed`&&!t)){Rt(!0),X(null),Xt(null);try{let n=await Je(T.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});ir(n),sr({workspaceRoot:n.workspaceRoot??``}),Qt(!1),Xt(null)}catch(e){let t=Si(e);t?(Xt(t),Qt(!1)):X(e instanceof Error?e.message:String(e))}finally{Rt(!1)}}}async function dr(){if(!(!T||cn)){ln(`pin`),X(null);try{ir(T.pinnedAt?await mt(T.id):await dt(T.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function fr(){if(!(!T||cn)){ln(`archive`),X(null);try{let e=T.status===`archived`?await Ht(T.id):await lt(T.id);ir(e),sr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function pr(){if(T){dn(!0),X(null);try{await xt(T.id),Bt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function mr(){if(!(!T||me)){he(!0),X(null);try{await Nt(T.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{he(!1)}}}let hr=(0,Z.useCallback)(e=>{Oe(e)},[]),gr=(0,Z.useCallback)((e,t)=>{t||Oe(e)},[]),_r=(0,Z.useCallback)(async(e,t,n)=>{let r=T?.id;if(r)switch(e){case`preview`:t.isDirectory||Oe(t.path);break;case`download`:if(t.isDirectory)return;try{let e=be(t.path);if(Ae(St(e))!==`text`){let n=await Me(t.path,{projectId:r}),i=ie(e)??`application/octet-stream`;fe(e,await n.arrayBuffer(),i)}else{let{content:n}=await hn(t.path,{projectId:r});_e(e,n)}}catch(e){J(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await P(t.path)&&J(`success`,_.workspace.pathCopied,void 0,{duration:2500})}catch{J(`warning`,_.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await rn(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),_.workspace.openFileFailed);break;case`openWith`:await rn(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),_.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await rn(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),_.workspace.openFileFailed);break;case`revealInFolder`:await rn(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),_.workspace.revealFileFailed);break;case`trash`:je(t);break;case`delete`:t.isDirectory||Pe(t);break;default:break}},[_.clipboard.copyFailed,_.workspace.openFileFailed,_.workspace.pathCopied,_.workspace.revealFileFailed,T?.id]),yr=(0,Z.useCallback)(async()=>{let e=ke;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){J(`warning`,t?.error??_.workspace.trashFailed,void 0,{duration:4e3});return}Te===e.path&&Oe(null),je(null),await Xn(),J(`success`,_.workspace.trashSuccess,void 0,{duration:2500})},[_.workspace.trashFailed,_.workspace.trashSuccess,ke,Te,Xn]),br=(0,Z.useCallback)(async(e,t)=>{let n=T?.id;if(n)try{await Promise.all(e.map(e=>K(e,t,{projectId:n}))),await Qn(t).catch(()=>void 0),J(`success`,_.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await Qn(t).catch(()=>void 0),J(`warning`,`${_.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[_.workspace.uploadFailed,_.workspace.uploadSuccess,T?.id,Qn]),xr=(0,Z.useCallback)(async()=>{let e=Ne;if(e)try{await ce(e.fileId),Te===e.path&&Oe(null),Pe(null);let t=e.path.lastIndexOf(`/`);await Qn(t<0?``:e.path.slice(0,t)).catch(()=>void 0),J(`success`,_.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){J(`warning`,`${_.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[_.workspace.deleteFailed,_.workspace.deleteSuccess,Ne,Te,Qn]),Sr=(0,Z.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),Ue(!0);let r=e.clientX,i=Fe,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=li(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ue(!1),Be(c),di(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)},[Fe]);(0,Z.useEffect)(()=>{Q!==`files`&&Oe(null)},[e,Q]);let Cr=!!(T&&ci(An,T)),wr=xn({value:T?An:null,dirty:Cr,onSave:ar,validate:e=>e.name.trim()?null:y.settings.nameRequired});if(Ot)return(0,$.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:y.loading});if(!T)return(0,$.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,$.jsxs)(s,{to:Pn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),Pn===`/projects`?y.backToProjects:_.sidebar.back]}),(0,$.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Dn||y.notFound})]});let Tr=I.slice(0,3),Dr=O?.blockers??[],Or=Er(O?.tasks??[]),kr=O?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Ar=e=>y.statuses[e]??e,jr=e=>pi(y.common.messages,{count:e}),Mr=z.trim().toLowerCase(),Nr=Mr?I.filter(e=>{let t=mi(e.updatedAt),n=e.routing?.agentId||e.agentId||y.common.agent,r=e.name?.trim()||y.sessions.fallbackTitle,i=jr(e.messageCount??0),a=Ei(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Mr)}):I,Pr=I.length>0&&Nr.length===0,Fr=yt.find(e=>e.id===T.defaultAgentId)?.name||T.defaultAgentId||y.settings.globalDefaultAgent,Ir=yt.find(e=>e.id===An.defaultAgentId),Lr=T.workspaceRoot?.trim()||``,Rr=T.status===`archived`,zr=!!T.pinnedAt,Br=!Lr,Vr=Lr||Ir?.workspace||T.effectiveWorkspaceRoot||y.common.defaultWorkspace,Hr=$t===`fixed`?nn.trim()||y.settings.workspacePlaceholder:Ir?.workspace||T.effectiveWorkspaceRoot||y.common.defaultWorkspace,Ur=($t===`fixed`?nn.trim():``)!==Lr&&($t===`follow`||!!nn.trim()),Wr=[{id:`overview`,icon:ot,label:y.tabs.overview},{id:`tasks`,icon:Gt,label:y.tabs.tasks},{id:`automations`,icon:Tt,label:y.tabs.automations},{id:`files`,icon:q,label:y.tabs.files},{id:`notes`,icon:we,label:y.tabs.notes},{id:`skills`,icon:Lt,label:y.tabs.skills},{id:`sessions`,icon:Re,label:y.tabs.sessions},{id:`progress`,icon:pn,label:y.tabs.progress}];async function Gr(){if(!Vr)return;let e=await P(Vr);J(e?`success`:`warning`,e?_.workspace.pathCopied:_.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Kr(){Xt(null),Qt(!0)}return(0,$.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,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,$.jsx)(Sn,{items:Wr,activeTab:Q,onChange:Ln,ariaLabel:y.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,$.jsxs)(H,{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:()=>Ln(`settings`),children:[(0,$.jsx)(At,{className:`size-4`,"aria-hidden":!0}),y.tabs.settings,Cr?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":y.settings.unsavedChanges}):null]})]}),Dn?(0,$.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:Dn}):null,(0,$.jsxs)(`div`,{className:B(`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,$.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,$.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,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.directionTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:pi(y.overview.activitySummary,{moving:kr,attention:Dr.length})})]}),(0,$.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:T.outcome||T.description||T.brief||y.overview.directionFallback}),O?.digest.recommendedAction?(0,$.jsx)(`p`,{className:`mt-3 max-w-3xl rounded-lg bg-surface-hover px-3 py-2.5 text-sm font-medium leading-6 text-fg`,children:pi(y.overview.recommendedNext,{action:O.digest.recommendedAction})}):null]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void mr(),disabled:me,children:[(0,$.jsx)(vt,{className:`size-3.5`,"aria-hidden":!0}),me?y.overview.savingDigest:y.overview.saveDigest]})]})}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.nextActions}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>Ln(`tasks`),children:y.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:Or.length?Or.map(e=>(0,$.jsxs)(s,{to:ae(In(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsxs)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.attention.length?`bg-warning/10 text-warning`:`bg-surface-hover text-fg-muted`),children:[y.board.phases[e.phase],e.operationalState===`idle`?``:` · ${y.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.overview.noNextActions})})]})]}),O?.recentResults.length?(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.recentResults})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,$.jsxs)(s,{to:ae(In(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[y.overview.resultStatuses[n.status],` · `,y.board.verification[n.verification.status]]})]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,T.milestones.length||T.recentUpdates.length?(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[T.milestones.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.milestones})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:T.milestones.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:y.statuses[e.status]})]},e.id))})]}):null,T.recentUpdates.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.projectUpdates})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:T.recentUpdates.slice(0,3).map(e=>(0,$.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:y.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,$.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,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.attention}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":_n,onClick:()=>vn(e=>!e),children:[(0,$.jsx)(M,{className:B(`size-3.5 transition-transform`,_n&&`rotate-45`),"aria-hidden":!0}),y.overview.addBlocker]})]}),Dr.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Dr.map(e=>{let t=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Mt,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,$.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[y.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Ar(e.status)}`:``]})]});return e.href?(0,$.jsx)(s,{to:e.href,onClick:Bn(Vn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,$.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:y.overview.noBlockedTasks}),_n?(0,$.jsxs)(`form`,{onSubmit:tr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,$.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:On.title,onChange:e=>kn(t=>({...t,title:e.target.value})),placeholder:y.overview.blockerTitlePlaceholder}),(0,$.jsx)(H,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:mn||!On.title.trim(),"aria-label":mn?y.overview.addingBlocker:y.overview.addBlocker,title:mn?y.overview.addingBlocker:y.overview.addBlocker,children:(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(qe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:y.overview.recentSessions})]}),(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Ln(`sessions`),children:y.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Tr.length?Tr.map(e=>(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Bn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:mi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==T.defaultAgentId?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,$.jsx)(ni,{ref:Tn,tasks:O?.tasks??[],dependencyEdges:O?.dependencyEdges??[],monitoring:O?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:In(`tasks`),copy:y.board,onAction:Un,onReorder:Gn,onUndoMove:Kn,onDependenciesChange:qn,onMonitoringChange:Jn,onCreate:Wn,actionBusyId:yn}):null,Q===`automations`?(0,$.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,$.jsx)(wn,{projectId:T.id,embedded:!0,title:y.automations.title,subtitle:y.automations.hint})}):null,Q===`notes`?(0,$.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,$.jsx)(ur,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(T.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:T.id,listTitle:y.notes.title,listDescription:y.notes.hint,emptyText:y.notes.emptyTitle,emptyDescription:y.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${T.id}`})}):null,Q===`skills`?(0,$.jsx)(vr,{projectId:T.id,copy:y.skills}):null,Q===`files`?(0,$.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,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:T.effectiveWorkspaceRoot?(0,$.jsxs)(`div`,{"data-project-files-grid":!0,className:B(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Ve&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Fe}px`},children:[(0,$.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[ye?(0,$.jsx)(at,{resourceId:ye.fileId,displayName:ye.name}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:B(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ge&&`bg-surface-hover text-fg`),onClick:()=>Ke(!0),"aria-label":y.files.search,title:y.files.search,"aria-pressed":Ge,children:(0,$.jsx)(Ut,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(de,{className:`size-7 shrink-0 rounded-md p-0`,loading:ct,label:_.cron.refresh,onClick:()=>void Xn()})]})]}),Ge?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,$.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,$.jsx)(Ut,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`text`,role:`searchbox`,value:Xe,onChange:e=>Ze(e.target.value),placeholder:y.files.searchPlaceholder,"aria-label":y.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,$.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":y.files.clearSearch,title:y.files.clearSearch,onClick:()=>{Ze(``),Ke(!1)},children:(0,$.jsx)(N,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,pt?(0,$.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:pt}):null,$n?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:tt?(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,$.jsx)(U,{className:`h-11 w-full`}),(0,$.jsx)(U,{className:`h-11 w-full`}),(0,$.jsx)(U,{className:`h-11 w-full`})]}):rt?(0,$.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[_.workspace.loadError,`: `,rt]}):$e.length===0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:y.files.noSearchResults}):$e.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:B(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Te===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Oe(e.path),title:e.path,children:[(0,$.jsx)(we,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):ct&&ge.length===0?(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.files.loading}):(0,$.jsx)(He,{tree:ge,selectedPath:Te,onSelectFile:hr,onSelectEntry:gr,onExpandDir:e=>void Zn(e),onAction:_r,onUploadFiles:(e,t)=>void br(e,t),uploadDropHint:_.workspace.dropToUpload,actionLabels:{preview:_.workspace.preview,download:_.workspace.download,copyPath:_.workspace.copyPath,openDefault:_.workspace.openSystemApp,openDirectory:_.workspace.openInFileManager,openWith:_.workspace.openWith,revealInFolder:_.workspace.revealInFolder,trash:_.workspace.moveToTrash,delete:_.workspace.deleteFile,recommendedApps:_.workspace.recommendedApps,desktopUpdateRequired:_.workspace.desktopUpdateRequired},emptyHint:y.files.emptyDirectory})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":y.files.resizeHandle,className:B(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Ve&&`bg-surface-hover`),onPointerDown:Sr,children:(0,$.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Te?(0,$.jsx)(We,{filePath:Te,projectId:T.id,agentId:T.defaultAgentId||Ct||void 0,onClose:()=>Oe(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(q,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:y.files.previewEmptyTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y.files.previewEmptyDescription})]})})})]}):(0,$.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:y.files.needWorkspace}),(0,$.jsx)(`div`,{children:(0,$.jsx)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Ln(`settings`),children:y.files.openSettings})})]})})}):null,Q===`sessions`?(0,$.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[I.length?(0,$.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,$.jsx)(Ut,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:z,onChange:e=>ee(e.currentTarget.value),placeholder:y.sessions.searchPlaceholder,"aria-label":y.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`}),z?(0,$.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":y.sessions.clearSearch,onClick:()=>ee(``),children:(0,$.jsx)(N,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Nr.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Nr.map(e=>{let t=mi(e.updatedAt),n=e.routing?.agentId||e.agentId||y.common.agent,r=Ei(e),i=e.name?.trim()||y.sessions.fallbackTitle,a=jr(e.messageCount??0);return(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Bn(`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,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.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,$.jsx)(Re,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,$.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,$.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[y.sessions.agent,`: `,n]}),(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,$.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[y.sessions.updated,`: `,t]}):null]})]},e.key)})}):Pr?(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:y.sessions.noMatches})}):(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:y.sessions.emptyTitle}),(0,$.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:y.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,$.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,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.progress.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:pi(y.progress.count,{count:re})})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.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,$.jsx)(`input`,{type:`checkbox`,checked:ue,onChange:e=>pe(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),y.progress.includeRelated]}),(0,$.jsxs)(H,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Yn(),disabled:se,children:[(0,$.jsx)(Ye,{className:B(`size-4`,se&&`animate-spin`),"aria-hidden":!0}),y.common.refresh]})]})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:se&&V.length===0?(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:y.progress.loading}):V.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge`,children:V.map(e=>{let t=y.progress.types[e.type]??e.type,n=y.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Oi(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===T.id);return(0,$.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:y.progress.related}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,wi(e)]})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:mi(e.createdAt)})]}),r?(0,$.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[y.progress.actor,`: `,Ci(e)]}),(0,$.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[y.progress.source,`: `,Ti(e)]})]})]},e.id)})}):(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:y.progress.empty})})]}):null,Q===`settings`?(0,$.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:or,onBlurCapture:wr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,$.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.summaryTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:y.settings.summaryHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,$.jsx)(`span`,{className:B(`rounded-full px-2 py-0.5 text-xs font-medium`,hi(An.status)),children:y.settings.statuses[An.status]}),(0,$.jsx)(bn,{status:wr.status,error:wr.error})]})]}),(0,$.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.detailsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y.settings.detailsHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsx)(gi,{label:y.settings.name,children:(0,$.jsx)(`input`,{className:_i(),value:An.name,onChange:e=>sr({name:e.target.value})})}),(0,$.jsx)(gi,{label:y.settings.defaultAgent,children:(0,$.jsxs)(x,{className:_i(),value:An.defaultAgentId,onChange:e=>sr({defaultAgentId:e.target.value},!0),children:[(0,$.jsx)(S,{value:``,children:y.settings.globalDefaultAgent}),yt.map(e=>(0,$.jsx)(S,{value:e.id,children:ut(e,_.agentsSettings)},e.id))]})}),(0,$.jsx)(gi,{label:y.settings.status,children:Rr?(0,$.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:y.settings.statuses.archived}):(0,$.jsxs)(x,{className:_i(),value:An.status===`archived`?`active`:An.status,onChange:e=>sr({status:e.target.value},!0),children:[(0,$.jsx)(S,{value:`active`,children:y.settings.statuses.active}),(0,$.jsx)(S,{value:`paused`,children:y.settings.statuses.paused})]})}),(0,$.jsx)(gi,{label:y.settings.executionMode,hint:y.settings.executionModeHint,children:(0,$.jsxs)(x,{className:_i(),value:An.executionMode,onChange:e=>sr({executionMode:e.target.value},!0),children:[(0,$.jsx)(S,{value:`managed_worktree`,children:y.settings.executionModeWorktree}),(0,$.jsx)(S,{value:`local_checkout`,children:y.settings.executionModeLocal})]})}),(0,$.jsx)(gi,{label:y.settings.description,hint:y.settings.descriptionHint,children:(0,$.jsx)(`textarea`,{className:_i(!0),value:An.description,onChange:e=>sr({description:e.target.value})})})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.projectGuidanceTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y.settings.projectGuidanceHint})]}),(0,$.jsx)(gi,{label:y.settings.brief,hint:y.settings.briefHint,children:(0,$.jsx)(`textarea`,{className:_i(!0),value:An.brief,onChange:e=>sr({brief:e.target.value})})}),(0,$.jsx)(gi,{label:y.settings.instructions,hint:y.settings.instructionsHint,children:(0,$.jsx)(`textarea`,{className:_i(!0),value:An.instructions,onChange:e=>sr({instructions:e.target.value})})})]})]}),(0,$.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.workspaceRoot}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:y.settings.workspaceIndependentHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Br?y.settings.workspaceModeFollow:y.settings.workspaceModeFixed}),(0,$.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Vr,children:Vr}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Gr(),children:[(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0}),y.settings.copyWorkspacePath]}),ye?(0,$.jsx)(at,{resourceId:ye.fileId,displayName:ye.name}):null,(0,$.jsxs)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:cr,children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),y.settings.migrateWorkspace]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.currentProjectTitle}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(vi,{label:y.settings.defaultAgent,value:Fr}),(0,$.jsx)(vi,{label:y.settings.pinState,value:zr?y.settings.pinned:y.settings.notPinned}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(vi,{label:y.settings.createdAt,value:mi(T.createdAt)||y.common.never}),(0,$.jsx)(vi,{label:y.settings.updatedAt,value:mi(T.updatedAt)||y.common.never})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.managementTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:y.settings.managementHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:zr?y.settings.pinnedTitle:y.settings.pinTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:y.settings.pinHint})]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`pin`,onClick:()=>void dr(),children:[zr?(0,$.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Et,{className:`size-4`,"aria-hidden":!0}),zr?y.settings.unpinProject:y.settings.pinProject]})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Rr?y.settings.restoreTitle:y.settings.archiveTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Rr?y.settings.restoreHint:y.settings.archiveHint})]}),(0,$.jsxs)(H,{type:`button`,variant:Rr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`archive`,onClick:()=>void fr(),children:[Rr?(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),Rr?y.settings.restoreProject:y.settings.archiveProject]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:y.settings.dangerTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:y.settings.dangerHint})]}),(0,$.jsxs)(H,{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:()=>Bt(!0),children:[(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),y.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,$.jsx)(h,{open:zt,onOpenChange:e=>{un||Bt(e)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.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,$.jsx)(Mt,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:y.settings.deleteConfirmTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:T?pi(y.settings.deleteConfirm,{name:T.name}):y.settings.deleteConfirmFallback})]})]}),(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:un,children:y.common.cancel})}),(0,$.jsxs)(H,{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:un||!T,onClick:()=>void pr(),children:[(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),y.settings.deleteConfirmAction]})]})]})]})}),(0,$.jsx)(ze,{open:!!ke,title:_.workspace.trashConfirmTitle,description:_.workspace.trashConfirmDescription.replace(`{{name}}`,ke?.name??``),confirmLabel:_.workspace.moveToTrash,cancelLabel:_.workspace.cancel,destructive:!0,onConfirm:()=>void yr(),onCancel:()=>je(null)}),(0,$.jsx)(ze,{open:!!Ne,title:_.workspace.deleteConfirmTitle,description:_.workspace.deleteConfirmDescription.replace(`{{name}}`,Ne?.name??``),confirmLabel:_.workspace.deleteFile,cancelLabel:_.workspace.cancel,destructive:!0,onConfirm:()=>void xr(),onCancel:()=>Pe(null)}),(0,$.jsx)(h,{open:Zt,onOpenChange:e=>{Ft||Qt(e)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:y.settings.workspaceMigrationTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y.settings.workspaceMigrationDescription})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:y.settings.workspaceMode}),(0,$.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:B(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,$t===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:$t===`fixed`,onChange:()=>en(`fixed`),disabled:Ft}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:y.settings.workspaceModeFixed}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:y.settings.workspaceMigrationFixedHint})]})]}),(0,$.jsxs)(`label`,{className:B(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,$t===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:$t===`follow`,onChange:()=>en(`follow`),disabled:Ft}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:y.settings.workspaceModeFollow}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:y.settings.workspaceHint})]})]})]})]}),$t===`fixed`?(0,$.jsx)(Fn,{value:nn,onChange:on,disabled:Ft,wd:v,placeholder:y.settings.workspacePlaceholder,inputClassName:_i(),autoFocus:!0}):null,(0,$.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:y.settings.workspaceMigrationImpact}),(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:pi(y.settings.workspaceCurrent,{workspace:Hr})})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Ft,children:y.common.cancel})}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Ft||!Ur,onClick:()=>void lr(),children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),y.settings.workspaceMigrationConfirm]})]})]})]})}),(0,$.jsx)(h,{open:!!Yt,onOpenChange:e=>{e||Xt(null)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:y.settings.workspaceMissingTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Yt?pi(y.settings.workspaceMissingDescription,{workspace:Yt}):null})]}),Yt?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(q,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:Yt})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Kr,disabled:Ft,children:y.settings.workspaceMissingBack}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void lr({createWorkspaceRoot:!0}),disabled:Ft,children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),y.settings.workspaceMissingCreate]})]})]})]})})]})}export{Mi as ProjectDetailPage};
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,h as a,p as o,t as s}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CpzYSoz7.js";import{t as g}from"./check-DUBLcKHA.js";import{c as _,d as v,f as y,l as b,n as x,r as S,t as C,u as w}from"./popover-select-CKBYnT3c.js";import{t as T}from"./circle-check-C23XjkUj.js";import{t as E}from"./copy-Dv6d4Dvw.js";import{t as D}from"./download-Dk-ZjtO6.js";import{t as O}from"./external-link-DjqjBmc3.js";import{d as k,p as A}from"./markdown-view-BxoQJqHx.js";import{t as j}from"./loader-circle-CifKLtgG.js";import{t as M}from"./plus-Q2yW6OE7.js";import{t as N}from"./x-B_N4OPjy.js";import{t as P}from"./copy-to-clipboard-HOJ79TWv.js";import{t as F}from"./messages-Cf1h5WXB.js";import{a as I,d as L,n as R,r as z,s as ee}from"./locale-store-RJHYFoq9.js";import{t as B}from"./cn-JdwAhgNB.js";import{i as V}from"./vendor-swr-BIWyz7Rc.js";import{t as H}from"./button-B11EPpor.js";import{t as U}from"./skeleton-BwbyijEw.js";import{$n as W,Aa as te,As as ne,Au as G,Bi as K,Ca as re,Da as ie,Dl as q,Do as J,Ds as ae,Ec as oe,Eu as se,Fi as ce,Fn as le,Gr as ue,Hi as de,Hs as Y,Ii as fe,In as pe,Is as me,Js as he,Kn as ge,Li as _e,Ln as ve,Mc as ye,Mi as be,Ml as xe,Mu as Se,Nc as Ce,Nl as we,Nn as Te,Oc as Ee,Ol as De,Pa as Oe,Pc as ke,Pi as Ae,Qs as je,Ri as Me,Rs as Ne,Sn as Pe,Ta as Fe,Tl as Ie,Ts as Le,Uc as Re,Ui as ze,Un as Be,Vc as Ve,Vi as He,Vl as Ue,Vt as We,Yc as Ge,Ys as Ke,Zl as qe,_a as Je,_c as Ye,_l as Xe,_n as Ze,aa as Qe,an as $e,as as et,ba as tt,bo as nt,bu as rt,ca as it,ci as at,cl as ot,da as st,du as ct,ea as lt,en as ut,fa as dt,fc as ft,fu as pt,ga as mt,gn as ht,gs as gt,ha as _t,hc as vt,hl as yt,hn as bt,ia as xt,ji as St,jl as Ct,jr as wt,js as Tt,kc as Et,ks as Dt,ku as Ot,la as kt,lc as At,ls as jt,lu as Mt,ma as Nt,mn as Pt,mu as Ft,na as It,nc as Lt,nl as Rt,nr as zt,nu as Bt,oa as Vt,pa as Ht,pc as Ut,ps as Wt,ql as Gt,rn as Kt,ro as qt,sa as Jt,sc as Yt,sl as Xt,su as Zt,ta as Qt,tc as $t,ti as en,ua as tn,uc as nn,ui as rn,us as an,uu as on,va as sn,vl as cn,vn as ln,wa as un,wn as dn,ws as fn,yl as pn,yn as mn,zi as hn}from"./index-DQtjs2x3.js";import{i as gn,n as _n,r as vn,t as yn}from"./note-detail-panel-CCbPg_GP.js";import{n as bn,t as xn}from"./use-autosave-mj9CUuz1.js";import{t as Sn}from"./page-tabs-BMYQef5D.js";import{t as Cn}from"./date-picker-D2MKBJ0G.js";import{t as wn}from"./automations-workspace-7-m5pBEZ.js";import{i as Tn,p as En,s as Dn}from"./skills-page.utils-B-N73248.js";import{t as X}from"./dependency-picker-DqigBx-G.js";import{c as On,l as kn,n as An,o as jn,r as Mn,t as Nn}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),$=r();function Pn(e){let t=(0,Q.c)(27),{value:n,onPick:r,disabled:i,placeholder:a,title:o,className:s,maxWidthClass:c,compact:l,"aria-label":u}=e,d=c===void 0?`max-w-[min(12rem,40vw)]`:c,f=l===void 0?!1:l,p,m;t[0]!==a||t[1]!==n?(m=n.trim(),p=m?Fe(m):a??``,t[0]=a,t[1]=n,t[2]=p,t[3]=m):(p=t[2],m=t[3]);let h=p,g=o??(m||void 0),_=u??o??h,v=f?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,y=!f&&d,b=i&&`cursor-not-allowed opacity-60`,x;t[4]!==s||t[5]!==v||t[6]!==y||t[7]!==b?(x=B(v,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,et.transition,et.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,y,b,s),t[4]=s,t[5]=v,t[6]=y,t[7]=b,t[8]=x):x=t[8];let S;t[9]!==i||t[10]!==r?(S=e=>{e.stopPropagation(),i||r()},t[9]=i,t[10]=r,t[11]=S):S=t[11];let C=f?`size-4`:`size-3.5`,w;t[12]===C?w=t[13]:(w=B(`shrink-0 text-fg-muted`,C),t[12]=C,t[13]=w);let T;t[14]===w?T=t[15]:(T=(0,$.jsx)(Ct,{className:w,"aria-hidden":!0}),t[14]=w,t[15]=T);let E;t[16]!==f||t[17]!==h?(E=f?null:(0,$.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:h}),t[16]=f,t[17]=h,t[18]=E):E=t[18];let D;return t[19]!==i||t[20]!==S||t[21]!==T||t[22]!==E||t[23]!==g||t[24]!==_||t[25]!==x?(D=(0,$.jsxs)(`button`,{type:`button`,disabled:i,title:g,"aria-label":_,className:x,onClick:S,children:[T,E]}),t[19]=i,t[20]=S,t[21]=T,t[22]=E,t[23]=g,t[24]=_,t[25]=x,t[26]=D):D=t[26],D}function Fn(e){let t=(0,Q.c)(38),{value:n,onChange:r,disabled:i,wd:a,placeholder:o,inputClassName:s,autoFocus:c,trailing:l}=e,u;t[0]!==r||t[1]!==n?(u={initialPath:n,onPicked:r},t[0]=r,t[1]=n,t[2]=u):u=t[2];let d=un(u),f;t[3]===n?f=t[4]:(f=n.trim(),t[3]=n,t[4]=f);let p=f,m=p?`${p}\n${a.chooseFolder}`:`${o??a.notSet}\n${a.selectWorkingDirectory}`,h;t[5]===s?h=t[6]:(h=B(`min-w-0 flex-1`,s),t[5]=s,t[6]=h);let g=i||d.picking,_;t[7]===r?_=t[8]:(_=e=>void r(e.target.value),t[7]=r,t[8]=_);let v=o??a.pathInputPlaceholder,y;t[9]!==c||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==v||t[14]!==n?(y=(0,$.jsx)(`input`,{type:`text`,className:h,value:n,disabled:g,onChange:_,placeholder:v,autoFocus:c,autoComplete:`off`,spellCheck:!1}),t[9]=c,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=n,t[15]=y):y=t[15];let b=i||d.picking,x;t[16]!==m||t[17]!==d.pick||t[18]!==b||t[19]!==n||t[20]!==a.selectWorkingDirectory?(x=(0,$.jsx)(Pn,{compact:!0,value:n,onPick:d.pick,disabled:b,title:m,"aria-label":a.selectWorkingDirectory}),t[16]=m,t[17]=d.pick,t[18]=b,t[19]=n,t[20]=a.selectWorkingDirectory,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==l?(S=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[x,l]}),t[22]=x,t[23]=l,t[24]=S):S=t[24];let C;t[25]!==S||t[26]!==y?(C=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[y,S]}),t[25]=S,t[26]=y,t[27]=C):C=t[27];let w;t[28]!==d.confirmPick||t[29]!==d.hasNativePicker||t[30]!==d.modalOpen||t[31]!==d.setModalOpen||t[32]!==p||t[33]!==a?(w=d.hasNativePicker?null:(0,$.jsx)(tt,{open:d.modalOpen,onOpenChange:d.setModalOpen,initialAbsolutePath:p||void 0,onConfirm:d.confirmPick,wd:a}),t[28]=d.confirmPick,t[29]=d.hasNativePicker,t[30]=d.modalOpen,t[31]=d.setModalOpen,t[32]=p,t[33]=a,t[34]=w):w=t[34];let T;return t[35]!==C||t[36]!==w?(T=(0,$.jsxs)($.Fragment,{children:[C,w]}),t[35]=C,t[36]=w,t[37]=T):T=t[37],T}function In(e){let t=(0,Q.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Z.useState)(!1),s;t[0]!==r||t[1]!==n?(s=zt(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=B(`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)(Xe,{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 l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=B(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(ge,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Ln(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 Rn(e){let t=(0,Q.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=W(),f=W(Bn),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let b=y,x;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=x):x=t[9];let S=x,C;t[10]===a?C=t[11]:(C=B(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,T;t[12]===w?T=t[13]:(T=B(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=T);let E=m?`Pause`:`Play`,D;t[14]!==h||t[15]!==m?(D=h?(0,$.jsx)(j,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(ye,{className:`size-3.5`}):(0,$.jsx)(oe,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=D):D=t[16];let O;t[17]!==b||t[18]!==S||t[19]!==T||t[20]!==E||t[21]!==D?(O=(0,$.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:T,"aria-label":E,children:D}),t[17]=b,t[18]=S,t[19]=T,t[20]=E,t[21]=D,t[22]=O):O=t[22];let k=`${v}%`,A;t[23]===k?A=t[24]:(A=(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:k}})}),t[23]=k,t[24]=A);let M;t[25]!==_||t[26]!==p||t[27]!==g?(M=Ln(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,t[28]=M):M=t[28];let N;t[29]===M?N=t[30]:(N=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==A||t[32]!==N?(P=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[A,N]}),t[31]=A,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==C||t[36]!==O?(F=(0,$.jsxs)(`div`,{className:C,onClick:zn,children:[O,P]}),t[34]=P,t[35]=C,t[36]=O,t[37]=F):F=t[37],F}function zn(e){return e.stopPropagation()}function Bn(e){return e.toggle}function Vn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Hn(e){let t=(0,Q.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=Vn(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Z.useState)(Yn),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=gn(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=B(`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`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(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]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(In,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(Rn,{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]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=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]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=B(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(Ue,{className:`size-4`}),t[31]=k):k=t[31];let A;t[32]===c.actions?A=t[33]:(A=(0,$.jsx)(mn,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Jn,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=A);let j;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(j=()=>{a(n.id,!n.pinned).catch(Kn)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=j):j=t[37];let M;t[38]===n.pinned?M=t[39]:(M=n.pinned?(0,$.jsx)(Ee,{className:`size-4`}):(0,$.jsx)(Et,{className:`size-4`}),t[38]=n.pinned,t[39]=M);let N=n.pinned?c.unpin:c.pin,P;t[40]!==j||t[41]!==M||t[42]!==N?(P=(0,$.jsxs)(bt,{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:j,children:[M,N]}),t[40]=j,t[41]=M,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==n.id||t[45]!==o?(F=()=>{o(n.id).catch(Gn)},t[44]=n.id,t[45]=o,t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(Se,{className:`size-4`}),t[47]=I):I=t[47];let L;t[48]!==c.archive||t[49]!==F?(L=(0,$.jsxs)(bt,{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:F,children:[I,c.archive]}),t[48]=c.archive,t[49]=F,t[50]=L):L=t[50];let R;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ln,{className:`my-1 h-px bg-edge-subtle`}),t[51]=R):R=t[51];let z;t[52]!==n.id||t[53]!==s?(z=()=>{s(n.id).catch(Wn)},t[52]=n.id,t[53]=s,t[54]=z):z=t[54];let ee;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(Y,{className:`size-4`}),t[55]=ee):ee=t[55];let V;t[56]!==c.delete||t[57]!==z?(V=(0,$.jsxs)(bt,{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:z,children:[ee,c.delete]}),t[56]=c.delete,t[57]=z,t[58]=V):V=t[58];let H;t[59]!==P||t[60]!==L||t[61]!==V?(H=(0,$.jsx)(ht,{children:(0,$.jsxs)(Pt,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:qn,children:[P,L,R,V]})}),t[59]=P,t[60]=L,t[61]=V,t[62]=H):H=t[62];let U;t[63]!==A||t[64]!==H?(U=(0,$.jsxs)(Ze,{children:[A,H]}),t[63]=A,t[64]=H,t[65]=U):U=t[65];let W;t[66]!==C||t[67]!==O||t[68]!==U?(W=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,U]}),t[66]=C,t[67]=O,t[68]=U,t[69]=W):W=t[69];let te;t[70]===n.pinned?te=t[71]:(te=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)(Et,{className:`size-3`})}),t[70]=n.pinned,t[71]=te);let ne;t[72]===n.tags?ne=t[73]:(ne=n.tags?.slice(0,2).map(Un),t[72]=n.tags,t[73]=ne);let G;t[74]===g?G=t[75]:(G=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=G);let K;t[76]!==te||t[77]!==ne||t[78]!==G?(K=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[te,ne,G]}),t[76]=te,t[77]=ne,t[78]=G,t[79]=K):K=t[79];let re;return t[80]!==W||t[81]!==K||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(re=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,W,K]}),t[80]=W,t[81]=K,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=re):re=t[87],re}function Un(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 Wn(){}function Gn(){}function Kn(){}function qn(e){return e.stopPropagation()}function Jn(e){return e.stopPropagation()}function Yn(){return Date.now()}var Xn=3e4;function Zn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Qn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(0),[C,w]=(0,Z.useState)(!1),T=(0,Z.useRef)(null),E=(0,Z.useRef)(null),D=(0,Z.useRef)(null),O=(0,Z.useRef)([]),k=(0,Z.useRef)(0),A=(0,Z.useRef)(null),j=(0,Z.useRef)(null),N=(0,Z.useCallback)(()=>{A.current&&=(clearInterval(A.current),null),j.current&&=(clearTimeout(j.current),null),D.current?.getTracks().forEach(e=>e.stop()),D.current=null,E.current=null,O.current=[],b(!1),S(0)},[]);(0,Z.useEffect)(()=>()=>N(),[N]);let P=(0,Z.useCallback)(async()=>{let e=E.current;if(!e||e.state!==`recording`)return;w(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-k.current)/1e3)),n=e.mimeType||Zn()||`audio/webm`,r=new Blob(O.current,{type:n});if(N(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{w(!1)}return}w(!1)},[N,c]),F=(0,Z.useCallback)(async()=>{if(!(!c||C||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});D.current=e;let t=Zn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);E.current=n,O.current=[],k.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&O.current.push(e.data)},n.start(),b(!0),S(0),A.current=setInterval(()=>{S(Math.round((Date.now()-k.current)/1e3))},250),j.current=setTimeout(()=>{P()},Xn)}catch{N(),l?.()}}},[N,c,l,y,P,C]),I=(0,Z.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),T.current?.focus()}}},[h,_,o]),L=(0,Z.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),I())},[I]),R=_||C,z=!!(s||c||p);return(0,$.jsxs)(`div`,{className:B(`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`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":R,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void P(),disabled:C,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(je,{className:`size-4 fill-current`,"aria-hidden":!0})}):z?(0,$.jsxs)(Ze,{children:[(0,$.jsx)(mn,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:R,className:`shrink-0 rounded-lg p-2 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":n,title:n,children:(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(ht,{children:(0,$.jsxs)(Pt,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(bt,{disabled:d,onSelect:s,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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(yt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(bt,{disabled:f,onSelect:()=>void F(),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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(Ve,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(bt,{onSelect:p,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`,children:[(0,$.jsx)(se,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:T,value:h,onChange:e=>g(e.target.value),onKeyDown:L,placeholder:e,"aria-label":e,rows:1,disabled:R,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto 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:!h.trim()||R||y,onClick:()=>void I(),"aria-label":t,title:t,className:B(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!R&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(ft,{className:`size-4`,"aria-hidden":!0})})]})}var $n={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},er=240,tr=320,nr=520,rr=560;function ir(e){if(globalThis.localStorage===void 0)return tr;try{let t=globalThis.localStorage.getItem(e);if(!t)return tr;let n=Number(t);return Number.isFinite(n)?n:tr}catch{return tr}}function ar(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var or={thought:Ke,todo:$t,voice:Ve,media:yt,bookmark:rt,mixed:Ke,task:$t};function sr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function cr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function lr(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function ur({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:l,emptyText:g,emptyDescription:_,listWidthStorageKey:v=`xopc.notes.listWidth`}){let y=R(e=>e.language),b=F(y).notes,C=!!ee(e=>e.token),[w,T]=(0,Z.useReducer)(re,$n),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(0),[P,I]=(0,Z.useState)(()=>ir(v)),[z,H]=(0,Z.useState)(!1),[U,W]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(!1),[G,K]=(0,Z.useState)(null),[ie,q]=(0,Z.useState)(null),J=(0,Z.useRef)(null),ae=(0,Z.useRef)(null),[oe]=(0,Z.useState)(()=>Date.now()),se=i(),ce=(0,Z.useCallback)(e=>{let t=J.current?.clientWidth??window.innerWidth,n=Math.max(er,t-rr);return Math.max(er,Math.min(Math.min(nr,n),e))},[]),ue=(0,Z.useCallback)(e=>{let t=ce(e);I(t),ar(v,t)},[ce,v]);(0,Z.useLayoutEffect)(()=>{I(e=>ce(e))},[ce]);let{data:de,mutate:Y,isLoading:fe}=V((0,Z.useMemo)(()=>C?[`notes-list`,o,w.statusFilter,w.kindFilter,w.pinnedOnly]:null,[C,o,w.statusFilter,w.kindFilter,w.pinnedOnly]),()=>Te({status:w.statusFilter===`all`?void 0:w.statusFilter,kind:w.kindFilter===`all`?void 0:w.kindFilter,projectId:o,pinned:w.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),me=fe&&!de,he=de?.items??[],ge=de?.total??0,_e=O.trim(),{data:ye,isLoading:be}=V(C&&E&&_e?[`notes-search`,o,_e]:null,()=>Te({search:_e,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),xe=ye?.items??[],Se=e?he.some(t=>t.id===e):!0;(0,Z.useEffect)(()=>{j(0)},[_e]),(0,Z.useEffect)(()=>{A>=xe.length&&j(Math.max(0,xe.length-1))},[A,xe.length]),(0,Z.useEffect)(()=>{let e=()=>{Y().catch(e=>{K(`${b.refreshFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,b.quickCaptureFailedHint,b.refreshFailed]);let Ce=qt(e=>e.setPageHeader),we=qt(e=>e.clearPageHeader),Ee=b.noteCount.replace(`{{count}}`,String(ge)),De=!r&&ge===0&&l?l:Ee,Ae=b.searchDialogTitle,je=b.searchClose,Me=b.searchClear,Ne=(0,Z.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>D(!0),className:B(`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`,nt),"aria-label":Ae,children:[(0,$.jsx)(Ut,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Ae})]}),[Ae]);(0,Z.useLayoutEffect)(()=>{if(n)return C?(Ce({startExtra:null,main:(0,$.jsxs)(`div`,{className:B(`flex min-w-0 items-center gap-2`,nt),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??b.title}),Ee?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Ee}):null]}),end:Ne}),()=>we()):(we(),()=>we())},[we,C,Ne,s,n,b.title,Ee,e,Ce]);let Fe=(0,Z.useMemo)(()=>({justNow:b.justNow,minutesAgo:b.minutesAgo,today:b.today,yesterday:b.yesterday,daysAgo:b.daysAgo,locale:L(y)}),[y,b.justNow,b.minutesAgo,b.today,b.yesterday,b.daysAgo]),Ie=(0,Z.useMemo)(()=>[{id:`recent`,label:b.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:b.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:b.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:b.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:b.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:b.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:b.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:b.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:b.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[b.filterArchived,b.filterInbox,b.filterProcessed,b.kindBookmark,b.kindMedia,b.kindVoice,b.pinned,b.viewRecent,b.viewTasks]),Le=Ie.find(e=>cr(w,e))??Ie[0],Re=s??Le.label,ze=(0,Z.useCallback)(async e=>{K(null);try{let n=o?await Pe({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await le(e,`web`);await Y(),se(lr(t,n.id))}catch(e){throw K(`${b.quickCaptureFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`),e}},[t,Y,b.quickCaptureFailed,b.quickCaptureFailedHint,se,o]),Ve=(0,Z.useCallback)(async()=>{if(!te){ne(!0),K(null);try{let e=await Pe({markdown:``,kind:`thought`,projectId:o,channel:`web`});T({type:`patch`,patch:$n}),await Y(),q(e.id),se(lr(t,e.id))}catch(e){K(`${b.createBlankFailed}: ${e instanceof Error?e.message:b.createBlankFailedHint}`)}finally{ne(!1)}}},[t,te,Y,b.createBlankFailed,b.createBlankFailedHint,se,o]),He=(0,Z.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{K(null),await pe(t,`web`),await Y()}catch(e){K(`${b.imageUploadFailed}: ${e instanceof Error?e.message:b.imageUploadFailedHint}`)}},e.click()},[Y,b.imageUploadFailed,b.imageUploadFailedHint]),Ue=(0,Z.useCallback)(async(e,t)=>{try{K(null),await ve(e,t,`web`),await Y()}catch(e){K(`${b.voiceUploadFailed}: ${e instanceof Error?e.message:b.voiceUploadFailedHint}`)}},[Y,b.voiceUploadFailed,b.voiceUploadFailedHint]),We=(0,Z.useCallback)(()=>{K(`${b.voiceCaptureFailed}: ${b.voiceCaptureFailedHint}`)},[b.voiceCaptureFailed,b.voiceCaptureFailedHint]),Ge=(0,Z.useCallback)(async(e,t)=>{K(null);try{await Be(e,{pinned:t}),await Y()}catch(e){K(`${b.actionFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)}},[Y,b.actionFailed,b.quickCaptureFailedHint]),qe=(0,Z.useCallback)(async e=>{K(null);try{await Be(e,{status:`archived`}),await Y()}catch(e){K(`${b.actionFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)}},[Y,b.actionFailed,b.quickCaptureFailedHint]),Je=(0,Z.useCallback)(async e=>{K(null);try{await dn(e),await Y()}catch(e){K(`${b.actionFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)}},[Y,b.actionFailed,b.quickCaptureFailedHint]),Ye=(0,Z.useCallback)(e=>{se(lr(t,e))},[t,se]),Xe=(0,Z.useCallback)(e=>{se(lr(t,e)),D(!1)},[t,se]),Ze=(0,Z.useCallback)(e=>{if(xe.length){if(e.key===`ArrowDown`)e.preventDefault(),j(e=>Math.min(xe.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),j(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=xe[A]??xe[0];t&&Xe(t.id)}}},[A,Xe,xe]),Qe=(0,Z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ae.current;t.setPointerCapture(e.pointerId),H(!0);let r=J.current?.clientWidth??window.innerWidth,i=Math.max(er,r-rr),a=Math.min(nr,i),o=e=>Math.max(er,Math.min(a,e)),s=e.clientX,c=o(P),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{}H(!1),J.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),I(f),ar(v,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)},[v,P]);(0,Z.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ve())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ve]);let $e=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),ue(P-16)):e.key===`ArrowRight`?(e.preventDefault(),ue(P+16)):e.key===`Home`?(e.preventDefault(),ue(er)):e.key===`End`&&(e.preventDefault(),ue(nr))},[ue,P]);return C?(0,$.jsxs)(`div`,{ref:J,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${P}px`},children:[(0,$.jsxs)(`section`,{ref:ae,className:B(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!z&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`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":U?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[G?(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:G}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(x,{value:Le.id,onChange:e=>{let t=Ie.find(t=>t.id===e.target.value);t&&T({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 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":b.libraryTitle,children:Ie.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:Re}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:De})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!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":b.collapseNotesList,title:b.collapseNotesList,children:(0,$.jsx)(ke,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ve,disabled:te,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":b.createBlankNote,title:b.createBlankShortcut,children:(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(!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":b.searchDialogTitle,title:b.searchDialogTitle,children:(0,$.jsx)(Ut,{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:me?(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))}):he.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(Ke,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Se?b.noteOutsideCurrentView:g??b.noNotes}),e&&!Se?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:_??b.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Se?(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:b.noteOutsideCurrentView}):null,he.map((t,n)=>{let r=n>0?_n(he[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[_n(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:B(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:vn(t.createdAt,oe,Fe)}),(0,$.jsx)(Hn,{note:t,selected:t.id===e,onPress:Ye,onPin:Ge,onArchive:qe,onDelete:Je,timeLabels:Fe,labels:{pin:b.pin,unpin:b.unpin,archive:b.archive,delete:b.delete,actions:b.noteActions,imageNote:b.imageNote,noText:b.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Qn,{placeholder:b.quickCapturePlaceholder,submitLabel:b.quickCaptureSubmit,actionsLabel:b.quickCaptureActions,imageLabel:b.quickCaptureImage,voiceLabel:b.quickCaptureVoice,stopRecordingLabel:b.stopRecording,onCapture:ze,onImagePick:a?He:void 0,onVoiceCapture:a?Ue:void 0,onVoiceError:We,recordingLabel:b.recording,discussionCaptureLabel:b.discussionCapture.title,onDiscussionCapture:()=>Oe(o)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":b.resizeNotesList,"aria-valuemin":er,"aria-valuemax":nr,"aria-valuenow":Math.round(P),tabIndex:0,onPointerDown:Qe,onDoubleClick:()=>ue(tr),onKeyDown:$e,title:b.resizeNotesList,className:B(`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`,U?`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:B(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,z&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:B(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[U?(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!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":b.expandNotesList,title:b.expandNotesList,children:(0,$.jsx)(ke,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(yn,{noteId:e,onBack:()=>se(t),onSaved:()=>{Y().catch(e=>{K(`${b.refreshFailed}: ${e instanceof Error?e.message:b.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>D(!0),autoFocus:e===ie,onAutoFocusConsumed:()=>q(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)(Ke,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:b.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:b.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ve,disabled:te,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)(M,{className:`size-4`,"aria-hidden":!0}),te?b.creatingBlankNote:b.createBlankNote]})]})})]}),(0,$.jsx)(h,{open:E,onOpenChange:D,children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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)(m,{className:`text-sm font-semibold text-fg`,children:Ae}),(0,$.jsx)(u,{className:`sr-only`,children:b.searchPlaceholder}),(0,$.jsx)(d,{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":je,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ut,{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:O,onChange:e=>k(e.target.value),onKeyDown:Ze,placeholder:b.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`}),O?(0,$.jsx)(`button`,{type:`button`,onClick:()=>k(``),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":Me,children:(0,$.jsx)(N,{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:_e?be&&!ye?(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))}):xe.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)(Ke,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:b.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:b.searchResultsCount.replace(`{{count}}`,String(ye?.total??xe.length))}),xe.map((e,t)=>{let n=or[e.kind]||Ke,r=sr(e,{imageNote:b.imageNote,noText:b.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),onMouseEnter:()=>j(t),className:B(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===A?`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:gn(e.updatedAt,oe,Fe)})]}),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)(Ut,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:b.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:b.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(Ke,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:b.needToken})]})}function dr(e){return I(z(`/api/projects/${encodeURIComponent(e)}/skills`))}function fr(e,t){return I(z(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function pr(e,t){return I(z(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function mr(e,t){let n=new FormData;return n.set(`file`,t),I(z(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function hr(e,t,n={}){return I(z(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function gr(e,t){return I(z(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function _r(e,t){return I(z(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function vr({projectId:e,copy:t}){let[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)([]),[o,s]=(0,Z.useState)([]),[l,u]=(0,Z.useState)([]),[g,_]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(!0),[A,j]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(null),[ee,V]=(0,Z.useState)(null),[W,te]=(0,Z.useState)(``),[ne,G]=(0,Z.useState)(1),[K,re]=(0,Z.useState)(null),[ie,q]=(0,Z.useState)(!1),[J,ae]=(0,Z.useState)(``),[oe,se]=(0,Z.useState)(``),ce=(0,Z.useRef)(null),le=(0,Z.useCallback)(async()=>{k(!0),L(``);try{let t=await dr(e);r(t.items),a(t.inheritedItems),s(t.sources)}catch(e){L(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,Z.useEffect)(()=>{le()},[le]),(0,Z.useEffect)(()=>{let t=!1;return tn(e).then(e=>{t||u(e)}).catch(()=>{t||u([])}),()=>{t=!0}},[e]),(0,Z.useEffect)(()=>{if(!g){S(null);return}let e=l.find(e=>e.key===g),t=!1;return S(null),L(``),E(!0),$e(e?.agentId??e?.routing?.agentId,g,!0).then(e=>{t||S(e)}).catch(e=>{t||L(e instanceof Error?e.message:String(e))}).finally(()=>{t||E(!1)}),()=>{t=!0}},[g,l]),(0,Z.useEffect)(()=>{if(R!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{q(!0),ae(``),En({q:W,page:ne,pageSize:8,sort:`downloads`,signal:e.signal}).then(re).catch(t=>{e.signal.aborted||ae(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||q(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[R,ne,W]);async function ue(e,t){j(!0),F(t??null),L(``);try{await e(),z(null),se(``),await le()}catch(e){L(e instanceof Error?e.message:String(e))}finally{j(!1),F(null)}}async function de(t){L(``);try{V((await fr(e,t)).skill)}catch(e){L(e instanceof Error?e.message:String(e))}}async function Y(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){j(!0);try{await _r(e,n.directoryId),await le()}catch(e){L(e instanceof Error?e.message:String(e))}finally{j(!1)}}}async function fe(){j(!0),L(``);try{await pr(e,!0),await le()}catch(e){L(e instanceof Error?e.message:String(e))}finally{j(!1)}}let pe=o.find(e=>e.origin===`agents-workspace`),me=new Map(x?.skills.map(e=>[e.name,e]));return(0,$.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,$.jsxs)(v,{children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.jsxs)(H,{type:`button`,children:[(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t.add,(0,$.jsx)(pt,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,$.jsx)(w,{children:(0,$.jsxs)(b,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,$.jsx)(Sr,{icon:he,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>z(`marketplace`)}),(0,$.jsx)(Sr,{icon:Ie,title:t.source,hint:t.sourceHint,onClick:()=>z(`source`)}),(0,$.jsx)(Sr,{icon:Ne,title:t.upload,hint:t.uploadHint,onClick:()=>ce.current?.click()})]})})]}),(0,$.jsx)(`input`,{ref:ce,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&ue(()=>mr(e,n)),t.target.value=``}})]})}),I?(0,$.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:I}):null,pe?.state===`untrusted`?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Ge,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,$.jsxs)(H,{type:`button`,variant:`secondary`,disabled:A,onClick:()=>void fe(),children:[(0,$.jsx)(Yt,{className:`size-4`,"aria-hidden":!0}),A?t.trusting:t.trustAction]})]}):null,l.length?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:T?t.sessionLoading:g?x?.agentId:t.sessionViewAll})]}),(0,$.jsx)(C,{value:g,options:l.map(e=>({value:e.key,label:e.name?.trim()||`${t.sessionFallback} · ${e.key.slice(-12)}`})),placeholder:t.sessionViewAll,emptyLabel:t.sessionViewAll,triggerClassName:`w-[min(24rem,calc(100vw-3rem))]`,onChange:_})]}):null,O?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,$.jsx)(U,{className:`h-36 rounded-lg`},e))}):n.length?(0,$.jsx)(yr,{title:t.localTitle,items:n,copy:t,busy:A,availabilityByName:me,onPreview:de,onRemove:Y}):(0,$.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!O&&i.length?(0,$.jsx)(yr,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:A,availabilityByName:me,onPreview:de,onRemove:Y}):null,(0,$.jsx)(h,{open:R!==null,onOpenChange:e=>{e||z(null)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:B(`xopc-dialog-content 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`,R===`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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:R===`marketplace`?t.marketplace:t.source}),(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(N,{className:`size-4`})})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:R===`marketplace`?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,$.jsxs)(`div`,{className:`relative mt-3`,children:[(0,$.jsx)(Ut,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.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:W,onChange:e=>{te(e.target.value),G(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),J?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:J}):null,ie&&!K?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,$.jsx)(U,{className:`h-32 rounded-lg`},e))}):K?.items.length?(0,$.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:K.items.map(r=>{let i=r.providerId??K.provider,a=Tn(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=P===a;return(0,$.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(Dn,{name:r.name,className:`size-10`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,$.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,$.jsx)(H,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:A||o,onClick:()=>void ue(()=>hr(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):ie?null:(0,$.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),K&&K.meta.totalPages>1?(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(K.meta.page)).replace(`{{total}}`,String(K.meta.totalPages))}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ie||ne<=1,onClick:()=>G(e=>Math.max(1,e-1)),children:[(0,$.jsx)(ct,{className:`size-4`}),t.marketplacePrevious]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:ie||ne>=K.meta.totalPages,onClick:()=>G(e=>e+1),children:[t.marketplaceNext,(0,$.jsx)(on,{className:`size-4`})]})]})]}):null]}):(0,$.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,$.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:oe,onChange:e=>se(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`secondary`,children:t.close})}),(0,$.jsx)(H,{type:`button`,disabled:A||!oe.trim(),onClick:()=>void ue(()=>gr(e,oe.trim())),children:A?t.installing:t.install})]})]})})]})]})}),(0,$.jsx)(h,{open:!!ee,onOpenChange:e=>{e||V(null)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:ee?.name}),(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,$.jsx)(N,{className:`size-4`})})})]}),(0,$.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:ee?.bodyMarkdown})]})]})})]})}function yr(e){let t=(0,Q.c)(25),{title:n,hint:r,items:i,copy:a,busy:o,availabilityByName:s,onPreview:c,onRemove:l}=e,u;t[0]===n?u=t[1]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=u);let d;t[2]===r?d=t[3]:(d=r?(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=d);let f;t[4]!==u||t[5]!==d?(f=(0,$.jsxs)(`div`,{children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;if(t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==c||t[12]!==l){let e;t[14]!==s||t[15]!==o||t[16]!==a||t[17]!==c||t[18]!==l?(e=e=>{let t=e.effective?s.get(e.name):void 0;return(0,$.jsxs)(`article`,{className:B(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Se,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:br(a,e.origin)}),e.writable?null:(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,$.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-2 py-0.5 text-amber-800 dark:text-amber-200`,children:a.shadowed}),t?(0,$.jsx)(`span`,{className:B(`rounded-md px-2 py-0.5`,t.availableForCurrentAgent?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:xr(a,t)}):null]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,$.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),a.remove]}):null]})]},e.key)},t[14]=s,t[15]=o,t[16]=a,t[17]=c,t[18]=l,t[19]=e):e=t[19],p=i.map(e),t[7]=s,t[8]=o,t[9]=a,t[10]=i,t[11]=c,t[12]=l,t[13]=p}else p=t[13];let m;t[20]===p?m=t[21]:(m=(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:p}),t[20]=p,t[21]=m);let h;return t[22]!==f||t[23]!==m?(h=(0,$.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function br(e,t){switch(t){case`xopc-workspace`:return e.xopcSource;case`agents-workspace`:return e.agentsSource;case`xopc-global`:case`custom-global`:return e.globalXopcSource;case`agents-global`:return e.globalAgentsSource;case`bundled`:return e.bundledSource;case`extra`:return e.extraSource}}function xr(e,t){if(t.availableForCurrentAgent)return e.sessionAvailable;switch(t.unavailableReason){case`agent-denied`:return e.sessionUnavailableAgent;case`disabled`:return e.sessionUnavailableDisabled;case`requirements-unmet`:return e.sessionUnavailableRequirements;case`model-invocation-disabled`:return e.sessionUnavailableModel;case`tool-gated`:return e.sessionUnavailableTools;default:return e.sessionUnavailableAgent}}function Sr(e){let t=(0,Q.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,$.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,$.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,$.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,$.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,$.jsx)(_,{asChild:!0,children:(0,$.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 Cr={active:0,review:1,ready:2,backlog:3,closed:4},wr={blocked:0,waiting:1,verifying:2,running:3,queued:4,idle:5},Tr={critical:0,high:1,normal:2,low:3};function Er(e,t=4){return e.filter(e=>e.phase!==`closed`).sort((e,t)=>{let n=Number(t.attention.length>0)-Number(e.attention.length>0);if(n!==0)return n;let r=wr[e.operationalState]-wr[t.operationalState];if(r!==0)return r;let i=Cr[e.phase]-Cr[t.phase];if(i!==0)return i;let a=Tr[e.priority]-Tr[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Dr=[`backlog`,`ready`,`active`,`review`,`closed`];function Or(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 kr(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 Ar(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 jr(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 Mr(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=jr(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 Nr(e,t){let{incoming:n}=jr(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 Pr(e,t){let{incoming:n,outgoing:r}=jr(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 Fr={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 Ir(e){let t=(0,Q.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Fr[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=B(`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,$.jsx)(Mn,{type:`target`,position:kn.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,$.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,$.jsx)(cn,{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,$.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,$.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,$.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,$.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,$.jsx)(Mn,{type:`source`,position:kn.Right,className:`!size-3 !border-2 !border-surface-panel !bg-accent opacity-60 transition-opacity group-hover:opacity-100`}),t[20]=_):_=t[20];let v;return t[21]!==g||t[22]!==l||t[23]!==p?(v=(0,$.jsxs)(`div`,{className:l,children:[u,p,g,_]}),t[21]=g,t[22]=l,t[23]=p,t[24]=v):v=t[24],v}var Lr={taskNode:Ir};function Rr(e){let t=(0,Q.c)(90),{tasks:n,dependencyEdges:r,returnTo:i,copy:a,onDependenciesChange:o}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(),[m,h]=(0,Z.useState)(),g=(0,Z.useRef)(null),_;t[0]!==r||t[1]!==n?(_=Nr(n,r),t[0]=r,t[1]=n,t[2]=_):_=t[2];let v=_,y;t[3]!==v||t[4]!==u||t[5]!==c||t[6]!==n?(y=u?n.filter(e=>v.has(e.id)):c?n:n.filter(Kr),t[3]=v,t[4]=u,t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x;t[8]===b?x=t[9]:(x=new Set(b.map(Gr)),t[8]=b,t[9]=x);let S=x,C;if(t[10]!==r||t[11]!==S){let e;t[13]===S?e=t[14]:(e=e=>S.has(e.dependencyTaskId)&&S.has(e.dependentTaskId),t[13]=S,t[14]=e),C=r.filter(e),t[10]=r,t[11]=S,t[12]=C}else C=t[12];let w=C,T;t[15]!==w||t[16]!==b?(T=Mr(b,w),t[15]=w,t[16]=b,t[17]=T):T=t[17];let E=T,D;t[18]!==f||t[19]!==w?(D=f?Pr(f,w):void 0,t[18]=f,t[19]=w,t[20]=D):D=t[20];let k=D,A;t[21]===f?A=t[22]:(A=e=>e.id===f,t[21]=f,t[22]=A);let j=b.find(A),M;t[23]===b?M=t[24]:(M=new Map(b.map(Wr)),t[23]=b,t[24]=M);let N=M,P;if(t[25]!==a.phases||t[26]!==E||t[27]!==k||t[28]!==b){let e;t[30]!==a.phases||t[31]!==E||t[32]!==k?(e=e=>({id:e.id,type:`taskNode`,position:E.get(e.id)??{x:0,y:0},data:{task:e,phaseLabel:a.phases[e.phase],dimmed:!!(k&&!k.has(e.id))}}),t[30]=a.phases,t[31]=E,t[32]=k,t[33]=e):e=t[33],P=b.map(e),t[25]=a.phases,t[26]=E,t[27]=k,t[28]=b,t[29]=P}else P=t[29];let F=P,I;if(t[34]!==k||t[35]!==N||t[36]!==w){let e;t[38]!==k||t[39]!==N?(e=e=>{let t=N.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(k&&(!k.has(e.dependencyTaskId)||!k.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:On.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]=k,t[39]=N,t[40]=e):e=t[40],I=w.map(e),t[34]=k,t[35]=N,t[36]=w,t[37]=I}else I=t[37];let L=I,R,z;t[41]!==f||t[42]!==S?(R=()=>{f&&!S.has(f)&&p(void 0)},z=[f,S],t[41]=f,t[42]=S,t[43]=R,t[44]=z):(R=t[43],z=t[44]),(0,Z.useEffect)(R,z);let ee,V;t[45]!==L||t[46]!==m?(ee=()=>{m&&!L.some(e=>e.id===m)&&h(void 0)},V=[L,m],t[45]=L,t[46]=m,t[47]=ee,t[48]=V):(ee=t[47],V=t[48]),(0,Z.useEffect)(ee,V);let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=U):U=t[49];let W;t[50]!==u||t[51]!==c||t[52]!==b.length?(W=[u,c,b.length],t[50]=u,t[51]=c,t[52]=b.length,t[53]=W):W=t[53],(0,Z.useEffect)(U,W);let te;t[54]===f?te=t[55]:(te=()=>{f&&g.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[54]=f,t[55]=te);let ne=te,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(Ur);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=G):G=t[58];let K=G,re;t[59]!==r||t[60]!==o||t[61]!==m?(re=()=>{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(Hr)))},t[59]=r,t[60]=o,t[61]=m,t[62]=re):re=t[62];let ie=re,q;t[63]===a.connectHint?q=t[64]:(q=(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=q);let J=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(Vr),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==J||t[68]!==se?(ce=(0,$.jsx)(H,{type:`button`,variant:J,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=J,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Br),t[70]=le):le=t[70];let ue=c?a.hideCompleted:a.showCompleted,de;t[71]!==u||t[72]!==c||t[73]!==ue?(de=(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:ue}),t[71]=u,t[72]=c,t[73]=ue,t[74]=de):de=t[74];let Y=j?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:ne,children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,fe;t[75]!==a.removeDependency||t[76]!==ie||t[77]!==m?(fe=m?(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:ie,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=ie,t[77]=m,t[78]=fe):fe=t[78];let pe;t[79]!==ce||t[80]!==de||t[81]!==Y||t[82]!==fe?(pe=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,de,Y,fe]}),t[79]=ce,t[80]=de,t[81]=Y,t[82]=fe,t[83]=pe):pe=t[83];let me;t[84]!==q||t[85]!==pe?(me=(0,$.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:[q,pe]}),t[84]=q,t[85]=pe,t[86]=me):me=t[86];let he=b.length>0?(0,$.jsxs)(`div`,{className:B(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,j&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,$.jsxs)(jn,{nodes:F,edges:L,nodeTypes:Lr,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:K,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,$.jsx)(Nn,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(An,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),j?(0,$.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[j.phase]}),(0,$.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:j.title}),j.operationalState===`blocked`&&j.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(j.blockedBy.length))}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:j.blockedBy.map(zr)})]}):null,(0,$.jsxs)(s,{to:ae(i,j.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,$.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,$.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ge;return t[87]!==me||t[88]!==he?(ge=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[me,he]}),t[87]=me,t[88]=he,t[89]=ge):ge=t[89],ge}function zr(e){return(0,$.jsx)(`li`,{children:e.title},e.id)}function Br(e){return!e}function Vr(e){return!e}function Hr(e){return e.dependencyTaskId}function Ur(e){return e.dependencyTaskId}function Wr(e){return[e.id,e]}function Gr(e){return e.id}function Kr(e){return e.phase!==`closed`}function qr({policy:e,copy:t,onSave:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(e.mode),[s,g]=(0,Z.useState)(Math.round(e.confidenceThreshold*100)),[_,v]=(0,Z.useState)(!!e.quietHours),[y,b]=(0,Z.useState)(e.quietHours?.startHour??22),[C,w]=(0,Z.useState)(e.quietHours?.endHour??8),[T,E]=(0,Z.useState)(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[D,O]=(0,Z.useState)(e.allowedActions.includes(`create_project_task`)),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)();(0,Z.useEffect)(()=>{o(e.mode),g(Math.round(e.confidenceThreshold*100)),v(!!e.quietHours),b(e.quietHours?.startHour??22),w(e.quietHours?.endHour??8),E(e.quietHours?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),O(e.allowedActions.includes(`create_project_task`))},[e]);let P=async()=>{A(!0),M(void 0);try{await n({mode:a,confidenceThreshold:s/100,quietHours:_?{startHour:y,endHour:C,timezone:T}:null,allowedActions:D?[`create_project_task`]:[]}),i(!1)}catch(e){M(e instanceof Error?e.message:t.saveFailed)}finally{A(!1)}};return(0,$.jsxs)(h,{open:r,onOpenChange:e=>{k||i(e)},children:[(0,$.jsx)(l,{asChild:!0,children:(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-9 gap-2 px-2.5 text-xs`,children:[(0,$.jsx)(nn,{className:`size-3.5`,"aria-hidden":!0}),t.modes[e.mode]]})}),(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.title}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:k,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:t.mode}),(0,$.jsx)(x,{value:a,onChange:e=>o(e.target.value),children:Object.entries(t.modes).map(([e,t])=>(0,$.jsx)(S,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[t.confidence,` · `,s,`%`]}),(0,$.jsx)(`input`,{type:`range`,min:`50`,max:`100`,step:`5`,value:s,onChange:e=>g(Number(e.target.value)),className:`accent-accent`})]}),(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),t.quietHours]}),_?(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:y,onChange:e=>b(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(`input`,{type:`number`,min:`0`,max:`23`,value:C,onChange:e=>w(Number(e.target.value)),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]}),(0,$.jsxs)(`label`,{className:`col-span-2 grid gap-1 text-xs text-fg-muted`,children:[t.timezone,(0,$.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),className:`rounded-lg border border-edge bg-surface-base px-3 py-2 text-fg`})]})]}):null]}),(0,$.jsxs)(`label`,{className:`flex items-start gap-3 rounded-lg border border-edge p-3`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:D,onChange:e=>O(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:t.allowTaskCreation}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.allowTaskCreationDescription})]})]})]}),(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge px-5 py-3`,children:[j?(0,$.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:j}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,disabled:k,children:t.cancel})}),(0,$.jsx)(H,{type:`button`,variant:`primary`,disabled:k||!T.trim()||y<0||y>23||C<0||C>23,onClick:()=>void P(),children:k?t.saving:t.save})]})]})]})]})]})}function Jr(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Yr={backlog:Zt,ready:Zt,active:Rt,review:me,closed:T},Xr={backlog:`bg-surface-hover text-fg-muted`,ready:`bg-surface-panel text-fg-muted`,active:`bg-accent-soft text-accent-fg`,review:`bg-amber-500/10 text-amber-700 dark:text-amber-300`,closed:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`};function Zr(e){return e===`running`||e===`queued`?`border-accent/20 bg-accent-soft text-accent-fg`:e===`verifying`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`waiting`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`blocked`?`border-violet-500/20 bg-violet-500/10 text-violet-700 dark:text-violet-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function Qr(e){return e===`passed`?`border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`}function $r(e){let t=(0,Q.c)(83),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c,onDropBefore:l}=e,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,E;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=Ar(n),h=m!==`review`&&n.allowedCommands.includes(`request_review`)?`review`:void 0,f=n.phase===`closed`,p=!!(n.dueAt&&n.dueAt<Date.now()&&!f),d=f?T:Bt,_=n.priority!==`normal`,g=_||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,b=!0,t[20]!==c||t[21]!==n.id?(x=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=x):x=t[22],t[23]===c?S=t[24]:(S=()=>c(``),t[23]=c,t[24]=S),C=ti,t[25]!==l||t[26]!==n.id?(w=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=w):w=t[27],E=`group relative min-h-max min-w-0 shrink-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface transition-[border-color,box-shadow] hover:border-edge focus-within:border-accent/40`,u=s,t[28]!==r||t[29]!==n.id?(v=ae(r,n.id),t[28]=r,t[29]=n.id,t[30]=v):v=t[30],y=B(`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,h?`pr-19`:m&&`pr-11`),t[0]=c,t[1]=l,t[2]=r,t[3]=n,t[4]=u,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=E):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],E=t[19]);let D=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,O;t[31]===D?O=t[32]:(O=B(`mt-0.5 size-4 shrink-0`,D),t[31]=D,t[32]=O);let k;t[33]!==d||t[34]!==O?(k=(0,$.jsx)(d,{className:O,"aria-hidden":!0}),t[33]=d,t[34]=O,t[35]=k):k=t[35];let A=f?`text-fg-subtle`:`text-fg`,j;t[36]===A?j=t[37]:(j=B(`min-w-0 break-words text-sm font-semibold leading-5`,A),t[36]=A,t[37]=j);let M;t[38]!==j||t[39]!==n.title?(M=(0,$.jsx)(`h3`,{className:j,children:n.title}),t[38]=j,t[39]=n.title,t[40]=M):M=t[40];let N;t[41]!==k||t[42]!==M?(N=(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[k,M]}),t[41]=k,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(P=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 rounded-lg bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,$.jsx)(cn,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(ei).join(`、`)})]}):n.attention[0]?(0,$.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,$.jsx)(Mt,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`line-clamp-2`,children:n.attention[0].summary})]}):null,t[44]=i,t[45]=n.attention,t[46]=n.blockedBy,t[47]=n.operationalState,t[48]=P):P=t[48];let F;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==_||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(F=g?(0,$.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[_?(0,$.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,n.priority===`critical`?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:n.priority===`high`?`border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:i.priorityOptions[n.priority]}):null,n.operationalState===`idle`?null:(0,$.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Zr(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,$.jsx)(`span`,{className:B(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,Qr(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,$.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-edge-subtle bg-surface-hover px-2 text-fg-muted`,children:[(0,$.jsx)(Rt,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,$.jsxs)(`span`,{className:B(`inline-flex min-h-6 items-center gap-1 rounded-md border px-2`,p?`border-red-500/20 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge-subtle bg-surface-hover text-fg-muted`),children:[(0,$.jsx)(Ft,{className:`size-3`,"aria-hidden":!0}),wt(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,$.jsxs)(`span`,{className:`inline-flex min-h-6 items-center gap-1 rounded-md border border-accent/20 bg-accent-soft px-2 text-accent-fg`,children:[(0,$.jsx)(Ft,{className:`size-3`,"aria-hidden":!0}),wt(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=_,t[53]=n.acceptanceCriteriaCount,t[54]=n.dueAt,t[55]=n.latestVerification,t[56]=n.nextCheckAt,t[57]=n.operationalState,t[58]=n.priority,t[59]=F):F=t[59];let I;t[60]!==u||t[61]!==v||t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==y?(I=(0,$.jsxs)(u,{to:v,className:y,children:[N,P,F]}),t[60]=u,t[61]=v,t[62]=N,t[63]=P,t[64]=F,t[65]=y,t[66]=I):I=t[66];let L;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(L=m?(0,$.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,children:[h?(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,h),className:`inline-flex size-7 items-center justify-center rounded-md bg-surface-hover text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[h],title:i.actions[h],children:(0,$.jsx)(me,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,$.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,m),className:`inline-flex size-7 items-center justify-center rounded-md bg-accent-soft text-accent-fg hover:bg-accent-soft/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-wait disabled:opacity-50`,"aria-label":i.actions[m],title:i.actions[m],children:(0,$.jsx)(Ot,{className:`size-3.5`,"aria-hidden":!0})})]}):null,t[67]=a,t[68]=i,t[69]=o,t[70]=m,t[71]=h,t[72]=n,t[73]=L):L=t[73];let R;return t[74]!==I||t[75]!==L||t[76]!==b||t[77]!==x||t[78]!==S||t[79]!==C||t[80]!==w||t[81]!==E?(R=(0,$.jsxs)(`article`,{draggable:b,onDragStart:x,onDragEnd:S,onDragOver:C,onDrop:w,className:E,children:[I,L]}),t[74]=I,t[75]=L,t[76]=b,t[77]=x,t[78]=S,t[79]=C,t[80]=w,t[81]=E,t[82]=R):R=t[82],R}function ei(e){return e.title}function ti(e){e.preventDefault(),e.stopPropagation()}function ni({tasks:e,dependencyEdges:t,monitoring:n,returnTo:r,copy:i,onAction:a,onReorder:o,onUndoMove:s,onDependenciesChange:l,onMonitoringChange:g,onCreate:_,actionBusyId:v,ref:y}){let b=(0,Z.useRef)(null),C=(0,Z.useRef)(null),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(`board`),[M,N]=(0,Z.useState)(!1),[P,I]=(0,Z.useState)(()=>crypto.randomUUID()),[L,z]=(0,Z.useState)(``),[ee,V]=(0,Z.useState)(`normal`),[U,W]=(0,Z.useState)(``),[te,ne]=(0,Z.useState)([]),[G,K]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(null),q=ue({chat:F(R(e=>e.language)).chat}),J=Or(e),ae=e.filter(e=>e.phase!==`closed`),oe=(e,t)=>void a(e,t),se=async(t,n)=>{let r=e.find(e=>e.id===w);if(T(null),!r||r.id===n)return;let i=J[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=kr(r,t);r.phase!==t&&!l||l&&!await a(r,l)||await o(r.id,n)&&k({taskId:r.id,phase:r.phase,beforeTaskId:c})},ce=async e=>{e.preventDefault();let t=L.trim();if(!(!t||G)){K(!0),ie(null);try{let e=U?new Date(`${U}T23:59:59.999`).getTime():void 0;await _({requestId:P,objective:t,priority:ee,dependsOnTaskIds:te,attachments:q.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),z(``),V(`normal`),W(``),ne([]),q.clearAttachments(),I(crypto.randomUUID()),N(!1)}catch(e){ie(e instanceof Error?e.message:i.createFailed)}finally{K(!1)}}},le=()=>{I(crypto.randomUUID()),z(``),V(`normal`),W(``),ne([]),q.clearAttachments(),ie(null),N(!0)};(0,Z.useImperativeHandle)(y,()=>({openCreate:le})),(0,Z.useEffect)(()=>{if(!O)return;let e=window.setTimeout(()=>k(null),6e3);return()=>window.clearTimeout(e)},[O]);let de=(0,Z.useCallback)(e=>{let t=C.current;!t||t.pointerId!==e.pointerId||(C.current=null,D(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),Y=(0,Z.useCallback)(e=>{if(e.button!==0||Jr(e.target))return;let t=b.current;t&&(C.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),fe=(0,Z.useCallback)(e=>{let t=C.current,n=b.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,D(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,$.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,$.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.description})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,$.jsx)(qr,{policy:n,copy:i.monitoring,onSave:g}),(0,$.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":A===`board`,onClick:()=>j(`board`),className:B(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,A===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,$.jsx)(Xt,{className:`size-3.5`,"aria-hidden":!0}),i.views.board]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":A===`graph`,onClick:()=>j(`graph`),className:B(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,A===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,$.jsx)(Ie,{className:`size-3.5`,"aria-hidden":!0}),i.views.graph]})]})]})]}),A===`board`?(0,$.jsx)(`div`,{ref:b,className:B(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,E?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:Y,onPointerMove:fe,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{C.current?.pointerId===e.pointerId&&(C.current=null,D(!1))},children:(0,$.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Dr.map(t=>{let n=Yr[t],a=J[t];return(0,$.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===w);r&&(r.phase===t||kr(r,t))&&n.preventDefault()},onDrop:e=>{e.preventDefault(),se(t,null)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-muted/70 p-2.5`,children:[(0,$.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,$.jsxs)(`div`,{className:B(`flex items-center gap-1.5 rounded-md px-2 py-1`,Xr[t]),children:[(0,$.jsx)(n,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold`,children:i.phases[t]})]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,$.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,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,$.jsx)($r,{task:e,returnTo:r,copy:i,busy:v===e.id,onAction:oe,onDragStart:T,onDropBefore:e=>void se(t,e)},e.id))})})]},t)})})}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,$.jsx)(Rr,{tasks:e,dependencyEdges:t,returnTo:r,copy:{...i.graph,phases:i.phases},onDependenciesChange:l})}),(0,$.jsx)(h,{open:M,onOpenChange:e=>{G||N(e)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:i.createTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:i.createDescription})]}),(0,$.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ce(e),children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:i.objective}),(0,$.jsxs)(`div`,{className:B(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,q.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),G||q.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||q.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),q.setIsDragging(!1),G||q.processFiles(Array.from(e.dataTransfer.files))},children:[(0,$.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:L,onChange:e=>{z(e.target.value),ie(null)},placeholder:i.objectivePlaceholder,maxLength:12e3,disabled:G}),(0,$.jsx)(en,{attachments:q.attachments,topPadded:!1,onRemove:e=>{G||q.removeAttachment(e)}}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:G,onClick:()=>q.fileInputRef.current?.click(),children:[(0,$.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),i.addFiles]}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:i.attachmentsDescription}),(0,$.jsx)(`input`,{ref:q.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{q.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:i.priority}),(0,$.jsx)(x,{value:ee,onChange:e=>V(e.target.value),disabled:G,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,$.jsx)(S,{value:e,children:i.priorityOptions[e]},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[i.dueDate,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,$.jsx)(Cn,{className:`min-h-10 bg-surface-base`,value:U,onChange:W,disabled:G,ariaLabel:i.dueDate})]})]}),(0,$.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,$.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[i.dependencies,` `,(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:i.optional})]}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:i.dependenciesDescription}),(0,$.jsx)(X,{candidates:ae,selectedIds:te,disabled:G,onChange:ne,labels:{link:i.linkDependencies,linked:i.linkedDependencies,searchPlaceholder:i.dependencySearchPlaceholder,noMatches:i.noDependencyMatches,noCandidates:i.noDependencyCandidates,remove:i.removeDependency}})]}),re?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:re}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:G,children:i.cancel})}),(0,$.jsx)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G||!L.trim(),children:G?i.creating:i.create})]})]})]})]})}),O?(0,$.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,$.jsx)(`span`,{children:i.moved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=O;k(null),s(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||k(e)})},children:i.undo})]}):null]})}var ri=new Set([{id:`overview`,icon:ot},{id:`tasks`,icon:Gt},{id:`automations`,icon:Tt},{id:`files`,icon:q},{id:`notes`,icon:we},{id:`skills`,icon:Lt},{id:`sessions`,icon:Re},{id:`progress`,icon:pn},{id:`settings`,icon:At}].map(e=>e.id)),ii=`xopc.projectFiles.panelWidthPx`,ai=320,oi=220,si=560;function ci(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.executionMode!==t.executionMode||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function li(e){return Math.min(si,Math.max(oi,Math.round(e)))}function ui(){try{let e=window.localStorage.getItem(ii);if(e==null)return ai;let t=Number.parseInt(e,10);return Number.isFinite(t)?li(t):ai}catch{return ai}}function di(e){try{window.localStorage.setItem(ii,String(li(e)))}catch{}}function fi(e){return!!(e&&ri.has(e))}function pi(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function mi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):wt(n)}function hi(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 gi(e){let t=(0,Q.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.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,$.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,$.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 _i(e=!1){return B(`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 vi(e){let t=(0,Q.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,$.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=B(`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,$.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,$.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 yi(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function bi(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function xi(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function Si(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Ci(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 wi(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Ti(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 Ei(e){let t=e.sourceChannel?.trim();if(t)return Di(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 Di(r||``)}function Di(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Oi(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 ki(e){return e.map(e=>({fileId:e.fileId,name:e.name,path:e.path,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Ai(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Ai(e.children,t,n)}:e)}function ji({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Z.useState)(!1),[l,_]=(0,Z.useState)([e]),[x,S]=(0,Z.useState)(``),[C,T]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(`new`),[N,P]=(0,Z.useState)(``),[F,I]=(0,Z.useState)(``),[L,R]=(0,Z.useState)(!1),[z,ee]=(0,Z.useState)(null),[V,U]=(0,Z.useState)(null),W=(0,Z.useCallback)(async()=>{T(!0),D(null);try{let t=await st({limit:100});_(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){D(e instanceof Error?e.message:String(e))}finally{T(!1)}},[e]);(0,Z.useEffect)(()=>{_(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Z.useEffect)(()=>{o&&W()},[W,o]);let te=(0,Z.useMemo)(()=>{let t=x.trim().toLowerCase().split(/\s+/).filter(Boolean);return l.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=yi(e);return t.every(e=>n.includes(e))}).sort((e,t)=>bi(t)-bi(e))},[e.id,l,x]),ne=e=>t.statuses[e.status]??e.status,G=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,K=e=>{j(e),P(``),I(``),ee(null),k(!0),s(!1)},re=(0,Z.useCallback)(async(e={})=>{let t=F.trim(),n=N.trim()||(A===`directory`?xi(t):``);if(n){R(!0),ee(null),U(null);try{let r=await Qt({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});k(!1),P(``),I(``),_(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=Si(e);t?(U(t),k(!1)):ee(e instanceof Error?e.message:String(e))}finally{R(!1)}}},[A,N,a,F]),ie=(0,Z.useCallback)(e=>{e.preventDefault(),re()},[re]),J=(0,Z.useCallback)(()=>{re({createWorkspaceRoot:!0})},[re]),ae=(0,Z.useCallback)(()=>{U(null),k(!0)},[]),oe=e=>{I(e),A===`directory`&&!N.trim()&&P(xi(e))},se=(e,t)=>(0,$.jsxs)(`button`,{type:`button`,className:B(`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||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,$.jsx)(g,{className:B(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:G(e)})]}),(0,$.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,hi(e.status)),children:ne(e)})]},e.id);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{open:o,onOpenChange:s,children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.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,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,hi(e.status)),children:ne(e)})]}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:G(e)})]}),(0,$.jsx)(pt,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,$.jsx)(w,{children:(0,$.jsxs)(b,{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,$.jsxs)(`label`,{className:`relative block`,children:[(0,$.jsx)(Ut,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.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:x,onChange:e=>S(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,$.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),se(e,!0),(0,$.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),E?(0,$.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:E}):null,C&&te.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!C&&te.length===0?(0,$.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,te.map(e=>se(e,!1))]}),(0,$.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,$.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,$.jsx)(M,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,$.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,$.jsx)(q,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,$.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),a(`/projects`)},children:[(0,$.jsx)(At,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,$.jsx)(h,{open:O,onOpenChange:e=>!L&&k(e),children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:A===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:A===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,$.jsxs)(`form`,{onSubmit:ie,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[z?(0,$.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:z}):null,(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,$.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:N,onChange:e=>P(e.target.value),placeholder:`xopc`})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,$.jsx)(Fn,{value:F,onChange:oe,disabled:L,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,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:L,children:n.cancel})}),(0,$.jsxs)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:L||!(N.trim()||A===`directory`&&xi(F)),children:[(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,$.jsx)(h,{open:!!V,onOpenChange:e=>{e||U(null)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?pi(n.workspaceMissingDescription,{workspace:V}):null})]}),V?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(q,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:V})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ae,disabled:L,children:n.workspaceMissingBack}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:J,disabled:L,children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Mi(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[l]=a(),g=R(e=>e.language),_=F(g),v=_.chat.workingDirectory,y=_.projectDetailPage,b=_.projectsPage,C=qt(e=>e.setPageHeader),w=qt(e=>e.clearPageHeader),[T,D]=(0,Z.useState)(null),[O,j]=(0,Z.useState)(null),[I,L]=(0,Z.useState)([]),[z,ee]=(0,Z.useState)(``),[V,W]=(0,Z.useState)([]),[re,oe]=(0,Z.useState)(0),[se,le]=(0,Z.useState)(!1),[ue,pe]=(0,Z.useState)(!1),[me,he]=(0,Z.useState)(!1),[ge,ve]=(0,Z.useState)([]),[ye,xe]=(0,Z.useState)(null),Ce=(0,Z.useRef)(new Set),[Te,Oe]=(0,Z.useState)(null),[ke,je]=(0,Z.useState)(null),[Ne,Pe]=(0,Z.useState)(null),[Fe,Be]=(0,Z.useState)(ui),[Ve,Ue]=(0,Z.useState)(!1),[Ge,Ke]=(0,Z.useState)(!1),[Xe,Ze]=(0,Z.useState)(``),[$e,et]=(0,Z.useState)([]),[tt,nt]=(0,Z.useState)(!1),[rt,st]=(0,Z.useState)(null),[ct,ft]=(0,Z.useState)(!1),[pt,ht]=(0,Z.useState)(null),[yt,bt]=(0,Z.useState)([]),[Ct,wt]=(0,Z.useState)(``),[Ot,Pt]=(0,Z.useState)(!0),[Ft,Rt]=(0,Z.useState)(!1),[zt,Bt]=(0,Z.useState)(!1),[Yt,Xt]=(0,Z.useState)(null),[Zt,Qt]=(0,Z.useState)(!1),[$t,en]=(0,Z.useState)(`fixed`),[nn,on]=(0,Z.useState)(``),[cn,ln]=(0,Z.useState)(null),[un,dn]=(0,Z.useState)(!1),[mn,gn]=(0,Z.useState)(!1),[_n,vn]=(0,Z.useState)(!1),[yn,Cn]=(0,Z.useState)(null),Tn=(0,Z.useRef)(null),En=(0,Z.useRef)(!1),[Dn,X]=(0,Z.useState)(null),[On,kn]=(0,Z.useState)({title:``,reason:``}),[An,jn]=(0,Z.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),Mn=(0,Z.useRef)(An),Nn=`overview`,Q=n?`notes`:fi(t)?t:Nn,Pn=(0,Z.useMemo)(()=>k(l.get(`returnTo`),`/projects`,[`/chat`]),[l]),In=(0,Z.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Pn===`/projects`?n:A(n,Pn)},[Pn,e]),Ln=(0,Z.useCallback)(t=>{e&&r(In(t))},[r,e,In]),Rn=(0,Z.useCallback)(()=>{if(Q===`tasks`&&Tn.current){Tn.current.openCreate();return}En.current=!0,Ln(`tasks`)},[Ln,Q]);(0,Z.useEffect)(()=>{Q!==`tasks`||!En.current||(En.current=!1,Tn.current?.openCreate())},[Q]);let zn=(0,Z.useCallback)(t=>{e&&r(In(t),{replace:!0})},[r,e,In]),Bn=(0,Z.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||zn(e)},[zn]),Vn=(0,Z.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:Q,[Q]);(0,Z.useEffect)(()=>{!e||!t||fi(t)||r(In(Nn),{replace:!0})},[Nn,r,e,In,t]),(0,Z.useEffect)(()=>{if(!e)return;let t=!1;return Pt(!0),X(null),Promise.all([Qe(e),it(e),tn(e),Kt().catch(()=>null),kt(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;D(e),j(n),L(r),xe(a),bt(i?.agents??[]),wt(e.defaultAgentId??``);let o={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Mn.current=o,jn(o)}).catch(e=>{t||(xe(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Pt(!1)}),()=>{t=!0}},[e]);let Hn=(0,Z.useCallback)(async()=>{e&&j(await it(e))},[e]);(0,Z.useEffect)(()=>{let t,n=n=>{let r=Dt.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Hn(),120))},r=n=>{let r=ne.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Hn(),120))};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`task-deleted-v1`,r),()=>{window.clearTimeout(t),window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`task-deleted-v1`,r)}},[e,Hn]);let Un=(0,Z.useCallback)(async(e,t)=>{Cn(e.id),X(null);try{let n=await gt(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??(await Wt(e.id)).agentId}}: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 jt(e.id,r,n.task.version),await Hn(),!0}catch(e){return await Hn().catch(()=>void 0),X(e instanceof Error?e.message:y.board.actionFailed),!1}finally{Cn(null)}},[O,y.board.actionFailed,Hn]),Wn=(0,Z.useCallback)(async t=>{e&&(X(null),await an({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:g,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 Hn())},[g,e,Hn]),Gn=(0,Z.useCallback)(async(e,t)=>{Cn(e),X(null);try{return await fn(e,t,(await gt(e)).task.version),await Hn(),!0}catch(e){return await Hn().catch(()=>void 0),X(e instanceof Error?e.message:y.board.actionFailed),!1}finally{Cn(null)}},[y.board.actionFailed,Hn]),Kn=(0,Z.useCallback)(async(e,t,n)=>{Cn(e),X(null);try{let r=await gt(e);return r.task.phase!==t&&(r=await jt(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 fn(e,n,r.task.version),await Hn(),!0}catch(e){return await Hn().catch(()=>void 0),X(e instanceof Error?e.message:y.board.actionFailed),!1}finally{Cn(null)}},[y.board.actionFailed,Hn]),qn=(0,Z.useCallback)(async(e,t)=>{Cn(e),X(null);try{await Le(e,t,(await gt(e)).task.version),await Hn()}catch(e){await Hn().catch(()=>void 0),X(e instanceof Error?e.message:y.board.actionFailed)}finally{Cn(null)}},[y.board.actionFailed,Hn]),Jn=(0,Z.useCallback)(async t=>{if(e){X(null);try{await sn(e,t),await Hn()}catch(e){throw X(e instanceof Error?e.message:y.board.actionFailed),e}}},[y.board.actionFailed,e,Hn]),Yn=(0,Z.useCallback)(async()=>{if(T){le(!0),X(null);try{let e=await Vt(T.id,{includeRelated:ue,limit:100});W(e.items),oe(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{le(!1)}}},[T,ue]);(0,Z.useEffect)(()=>{Q===`progress`&&Yn()},[Yn,Q]);let Xn=(0,Z.useCallback)(async()=>{if(!T?.effectiveWorkspaceRoot?.trim()){ve([]),Ce.current.clear(),ht(null);return}ft(!0),ht(null),Ce.current.clear();try{ve(ki((await Jt(T.id,``)).entries)),Ce.current.add(``)}catch(e){ve([]),Ce.current.clear(),ht(e instanceof Error?e.message:String(e))}finally{ft(!1)}},[T]),Zn=(0,Z.useCallback)(async e=>{if(!(!T?.effectiveWorkspaceRoot?.trim()||Ce.current.has(e))){Ce.current.add(e),ht(null);try{let t=await Jt(T.id,e);ve(n=>Ai(n,e,ki(t.entries)))}catch(t){Ce.current.delete(e),ht(t instanceof Error?t.message:String(t))}}},[T]),Qn=(0,Z.useCallback)(async e=>{if(!T?.effectiveWorkspaceRoot?.trim())return;let t=ki((await Jt(T.id,e)).entries);ve(e?n=>Ai(n,e,t):t),Ce.current.add(e)},[T]);(0,Z.useEffect)(()=>{Q===`files`&&Xn()},[Xn,Q]);let $n=Xe.trim();(0,Z.useEffect)(()=>{if(Q!==`files`||!T||!Ge||!$n){et([]),nt(!1),st(null);return}let e=!1;nt(!0),st(null),et([]);let t=window.setTimeout(()=>{_t(T.id,$n,50).then(t=>{e||et(t)}).catch(t=>{e||st(t instanceof Error?t.message:String(t))}).finally(()=>{e||nt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[$n,T,Ge,Q]);let er=(0,Z.useCallback)(async()=>{if(!T)return;let[e,t]=await Promise.all([Qe(T.id),it(T.id)]);j(t),D(e)},[T]),tr=(0,Z.useCallback)(async e=>{if(e.preventDefault(),!(!T||!On.title.trim())){gn(!0),X(null);try{await It(T.id,{title:On.title.trim(),reason:On.reason.trim()||void 0}),kn({title:``,reason:``}),vn(!1),await er()}catch(e){X(e instanceof Error?e.message:String(e))}finally{gn(!1)}}},[On.reason,On.title,T,er]),nr=(0,Z.useMemo)(()=>(0,$.jsx)(s,{to:Pn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Pn===`/projects`?y.backToProjects:_.sidebar.back,children:(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0})}),[Pn,_.sidebar.back,y.backToProjects]),rr=(0,Z.useMemo)(()=>T?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(T.id)}`,children:[(0,$.jsx)(Ie,{className:`size-4`,"aria-hidden":!0}),y.common.runWorkflow]})}),(0,$.jsxs)(H,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Rn,children:[(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),y.board.create]}),(0,$.jsx)(H,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(s,{to:te(T.id),state:{forceNewChat:!0,agentId:T.defaultAgentId},onClick:Bn(`sessions`),children:[(0,$.jsx)(Re,{className:`size-4`,"aria-hidden":!0}),y.common.newChat]})})]}):null,[Rn,Bn,y.board.create,y.common.newChat,y.common.runWorkflow,T]);(0,Z.useLayoutEffect)(()=>(C({startExtra:nr,main:T?(0,$.jsx)(ji,{currentProject:T,pm:y,projectsText:b,wd:v}):(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:y.fallbackTitle}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:y.fallbackContext})]}),end:rr}),()=>w()),[w,rr,nr,y,T,b,C,v]);function ir(e){D(t=>t?{...t,...e}:null),wt(e.defaultAgentId??``),kt(e.id).then(xe).catch(()=>xe(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function ar(e=Mn.current){if(!(!T||!ci(e,T))){X(null),Xt(null);try{let t=await Je(T.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions});ir(t);let n=Mn.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,executionMode:n.executionMode===e.executionMode?t.executionMode:n.executionMode,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Mn.current=r,jn(r)}catch(e){let t=Si(e);throw t?Xt(t):X(e instanceof Error?e.message:String(e)),e}}}function or(e){e.preventDefault(),wr.flush()}function sr(e,t=!1){let n={...Mn.current,...e};Mn.current=n,jn(n),t&&wr.saveNow(n)}let cr=(0,Z.useCallback)(()=>{if(!T)return;let e=T.workspaceRoot?.trim()??``;en(e?`fixed`:`follow`),on(e||T.effectiveWorkspaceRoot||``),Qt(!0)},[T]);async function lr(e={}){if(!T)return;let t=$t===`fixed`?nn.trim():``;if(!($t===`fixed`&&!t)){Rt(!0),X(null),Xt(null);try{let n=await Je(T.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});ir(n),sr({workspaceRoot:n.workspaceRoot??``}),Qt(!1),Xt(null)}catch(e){let t=Si(e);t?(Xt(t),Qt(!1)):X(e instanceof Error?e.message:String(e))}finally{Rt(!1)}}}async function dr(){if(!(!T||cn)){ln(`pin`),X(null);try{ir(T.pinnedAt?await mt(T.id):await dt(T.id))}catch(e){X(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function fr(){if(!(!T||cn)){ln(`archive`),X(null);try{let e=T.status===`archived`?await Ht(T.id):await lt(T.id);ir(e),sr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{ln(null)}}}async function pr(){if(T){dn(!0),X(null);try{await xt(T.id),Bt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{dn(!1)}}}async function mr(){if(!(!T||me)){he(!0),X(null);try{await Nt(T.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{he(!1)}}}let hr=(0,Z.useCallback)(e=>{Oe(e)},[]),gr=(0,Z.useCallback)((e,t)=>{t||Oe(e)},[]),_r=(0,Z.useCallback)(async(e,t,n)=>{let r=T?.id;if(r)switch(e){case`preview`:t.isDirectory||Oe(t.path);break;case`download`:if(t.isDirectory)return;try{let e=be(t.path);if(Ae(St(e))!==`text`){let n=await Me(t.path,{projectId:r}),i=ie(e)??`application/octet-stream`;fe(e,await n.arrayBuffer(),i)}else{let{content:n}=await hn(t.path,{projectId:r});_e(e,n)}}catch(e){J(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await P(t.path)&&J(`success`,_.workspace.pathCopied,void 0,{duration:2500})}catch{J(`warning`,_.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await rn(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),_.workspace.openFileFailed);break;case`openWith`:await rn(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),_.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await rn(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),_.workspace.openFileFailed);break;case`revealInFolder`:await rn(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),_.workspace.revealFileFailed);break;case`trash`:je(t);break;case`delete`:t.isDirectory||Pe(t);break;default:break}},[_.clipboard.copyFailed,_.workspace.openFileFailed,_.workspace.pathCopied,_.workspace.revealFileFailed,T?.id]),yr=(0,Z.useCallback)(async()=>{let e=ke;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){J(`warning`,t?.error??_.workspace.trashFailed,void 0,{duration:4e3});return}Te===e.path&&Oe(null),je(null),await Xn(),J(`success`,_.workspace.trashSuccess,void 0,{duration:2500})},[_.workspace.trashFailed,_.workspace.trashSuccess,ke,Te,Xn]),br=(0,Z.useCallback)(async(e,t)=>{let n=T?.id;if(n)try{await Promise.all(e.map(e=>K(e,t,{projectId:n}))),await Qn(t).catch(()=>void 0),J(`success`,_.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await Qn(t).catch(()=>void 0),J(`warning`,`${_.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[_.workspace.uploadFailed,_.workspace.uploadSuccess,T?.id,Qn]),xr=(0,Z.useCallback)(async()=>{let e=Ne;if(e)try{await ce(e.fileId),Te===e.path&&Oe(null),Pe(null);let t=e.path.lastIndexOf(`/`);await Qn(t<0?``:e.path.slice(0,t)).catch(()=>void 0),J(`success`,_.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){J(`warning`,`${_.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[_.workspace.deleteFailed,_.workspace.deleteSuccess,Ne,Te,Qn]),Sr=(0,Z.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),Ue(!0);let r=e.clientX,i=Fe,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=li(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ue(!1),Be(c),di(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)},[Fe]);(0,Z.useEffect)(()=>{Q!==`files`&&Oe(null)},[e,Q]);let Cr=!!(T&&ci(An,T)),wr=xn({value:T?An:null,dirty:Cr,onSave:ar,validate:e=>e.name.trim()?null:y.settings.nameRequired});if(Ot)return(0,$.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:y.loading});if(!T)return(0,$.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,$.jsxs)(s,{to:Pn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),Pn===`/projects`?y.backToProjects:_.sidebar.back]}),(0,$.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Dn||y.notFound})]});let Tr=I.slice(0,3),Dr=O?.blockers??[],Or=Er(O?.tasks??[]),kr=O?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Ar=e=>y.statuses[e]??e,jr=e=>pi(y.common.messages,{count:e}),Mr=z.trim().toLowerCase(),Nr=Mr?I.filter(e=>{let t=mi(e.updatedAt),n=e.routing?.agentId||e.agentId||y.common.agent,r=e.name?.trim()||y.sessions.fallbackTitle,i=jr(e.messageCount??0),a=Ei(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Mr)}):I,Pr=I.length>0&&Nr.length===0,Fr=yt.find(e=>e.id===T.defaultAgentId)?.name||T.defaultAgentId||y.settings.globalDefaultAgent,Ir=yt.find(e=>e.id===An.defaultAgentId),Lr=T.workspaceRoot?.trim()||``,Rr=T.status===`archived`,zr=!!T.pinnedAt,Br=!Lr,Vr=Lr||Ir?.workspace||T.effectiveWorkspaceRoot||y.common.defaultWorkspace,Hr=$t===`fixed`?nn.trim()||y.settings.workspacePlaceholder:Ir?.workspace||T.effectiveWorkspaceRoot||y.common.defaultWorkspace,Ur=($t===`fixed`?nn.trim():``)!==Lr&&($t===`follow`||!!nn.trim()),Wr=[{id:`overview`,icon:ot,label:y.tabs.overview},{id:`tasks`,icon:Gt,label:y.tabs.tasks},{id:`automations`,icon:Tt,label:y.tabs.automations},{id:`files`,icon:q,label:y.tabs.files},{id:`notes`,icon:we,label:y.tabs.notes},{id:`skills`,icon:Lt,label:y.tabs.skills},{id:`sessions`,icon:Re,label:y.tabs.sessions},{id:`progress`,icon:pn,label:y.tabs.progress}];async function Gr(){if(!Vr)return;let e=await P(Vr);J(e?`success`:`warning`,e?_.workspace.pathCopied:_.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Kr(){Xt(null),Qt(!0)}return(0,$.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,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,$.jsx)(Sn,{items:Wr,activeTab:Q,onChange:Ln,ariaLabel:y.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,$.jsxs)(H,{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:()=>Ln(`settings`),children:[(0,$.jsx)(At,{className:`size-4`,"aria-hidden":!0}),y.tabs.settings,Cr?(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":y.settings.unsavedChanges}):null]})]}),Dn?(0,$.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:Dn}):null,(0,$.jsxs)(`div`,{className:B(`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,$.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,$.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,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.directionTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:pi(y.overview.activitySummary,{moving:kr,attention:Dr.length})})]}),(0,$.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:T.outcome||T.description||T.brief||y.overview.directionFallback}),O?.digest.recommendedAction?(0,$.jsx)(`p`,{className:`mt-3 max-w-3xl rounded-lg bg-surface-hover px-3 py-2.5 text-sm font-medium leading-6 text-fg`,children:pi(y.overview.recommendedNext,{action:O.digest.recommendedAction})}):null]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void mr(),disabled:me,children:[(0,$.jsx)(vt,{className:`size-3.5`,"aria-hidden":!0}),me?y.overview.savingDigest:y.overview.saveDigest]})]})}),(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.nextActions}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>Ln(`tasks`),children:y.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:Or.length?Or.map(e=>(0,$.jsxs)(s,{to:ae(In(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsxs)(`span`,{className:B(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.attention.length?`bg-warning/10 text-warning`:`bg-surface-hover text-fg-muted`),children:[y.board.phases[e.phase],e.operationalState===`idle`?``:` · ${y.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.overview.noNextActions})})]})]}),O?.recentResults.length?(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.recentResults})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,$.jsxs)(s,{to:ae(In(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,$.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[y.overview.resultStatuses[n.status],` · `,y.board.verification[n.verification.status]]})]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:n.summary})]},n.runId))})]}):null,T.milestones.length||T.recentUpdates.length?(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[T.milestones.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.milestones})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:T.milestones.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:y.statuses[e.status]})]},e.id))})]}):null,T.recentUpdates.length?(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.projectUpdates})}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:T.recentUpdates.slice(0,3).map(e=>(0,$.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:y.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,$.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,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.overview.attention}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":_n,onClick:()=>vn(e=>!e),children:[(0,$.jsx)(M,{className:B(`size-3.5 transition-transform`,_n&&`rotate-45`),"aria-hidden":!0}),y.overview.addBlocker]})]}),Dr.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Dr.map(e=>{let t=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Mt,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,$.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[y.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Ar(e.status)}`:``]})]});return e.href?(0,$.jsx)(s,{to:e.href,onClick:Bn(Vn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,$.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:y.overview.noBlockedTasks}),_n?(0,$.jsxs)(`form`,{onSubmit:tr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,$.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:On.title,onChange:e=>kn(t=>({...t,title:e.target.value})),placeholder:y.overview.blockerTitlePlaceholder}),(0,$.jsx)(H,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:mn||!On.title.trim(),"aria-label":mn?y.overview.addingBlocker:y.overview.addBlocker,title:mn?y.overview.addingBlocker:y.overview.addBlocker,children:(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(qe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:y.overview.recentSessions})]}),(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Ln(`sessions`),children:y.common.viewAll})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Tr.length?Tr.map(e=>(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Bn(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:mi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==T.defaultAgentId?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.overview.noSessions})})]})]})]}):null,Q===`tasks`?(0,$.jsx)(ni,{ref:Tn,tasks:O?.tasks??[],dependencyEdges:O?.dependencyEdges??[],monitoring:O?.monitoring??{projectId:e??``,mode:`observe`,allowedActions:[],confidenceThreshold:.75,scenarios:[],configured:!1},returnTo:In(`tasks`),copy:y.board,onAction:Un,onReorder:Gn,onUndoMove:Kn,onDependenciesChange:qn,onMonitoringChange:Jn,onCreate:Wn,actionBusyId:yn}):null,Q===`automations`?(0,$.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,$.jsx)(wn,{projectId:T.id,embedded:!0,title:y.automations.title,subtitle:y.automations.hint})}):null,Q===`notes`?(0,$.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,$.jsx)(ur,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(T.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:T.id,listTitle:y.notes.title,listDescription:y.notes.hint,emptyText:y.notes.emptyTitle,emptyDescription:y.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${T.id}`})}):null,Q===`skills`?(0,$.jsx)(vr,{projectId:T.id,copy:y.skills}):null,Q===`files`?(0,$.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,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:T.effectiveWorkspaceRoot?(0,$.jsxs)(`div`,{"data-project-files-grid":!0,className:B(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Ve&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Fe}px`},children:[(0,$.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[ye?(0,$.jsx)(at,{resourceId:ye.fileId,displayName:ye.name}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:B(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ge&&`bg-surface-hover text-fg`),onClick:()=>Ke(!0),"aria-label":y.files.search,title:y.files.search,"aria-pressed":Ge,children:(0,$.jsx)(Ut,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(de,{className:`size-7 shrink-0 rounded-md p-0`,loading:ct,label:_.cron.refresh,onClick:()=>void Xn()})]})]}),Ge?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,$.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,$.jsx)(Ut,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`text`,role:`searchbox`,value:Xe,onChange:e=>Ze(e.target.value),placeholder:y.files.searchPlaceholder,"aria-label":y.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,$.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":y.files.clearSearch,title:y.files.clearSearch,onClick:()=>{Ze(``),Ke(!1)},children:(0,$.jsx)(N,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,pt?(0,$.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:pt}):null,$n?(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:tt?(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,$.jsx)(U,{className:`h-11 w-full`}),(0,$.jsx)(U,{className:`h-11 w-full`}),(0,$.jsx)(U,{className:`h-11 w-full`})]}):rt?(0,$.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[_.workspace.loadError,`: `,rt]}):$e.length===0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:y.files.noSearchResults}):$e.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:B(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Te===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Oe(e.path),title:e.path,children:[(0,$.jsx)(we,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):ct&&ge.length===0?(0,$.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:y.files.loading}):(0,$.jsx)(He,{tree:ge,selectedPath:Te,onSelectFile:hr,onSelectEntry:gr,onExpandDir:e=>void Zn(e),onAction:_r,onUploadFiles:(e,t)=>void br(e,t),uploadDropHint:_.workspace.dropToUpload,actionLabels:{preview:_.workspace.preview,download:_.workspace.download,copyPath:_.workspace.copyPath,openDefault:_.workspace.openSystemApp,openDirectory:_.workspace.openInFileManager,openWith:_.workspace.openWith,revealInFolder:_.workspace.revealInFolder,trash:_.workspace.moveToTrash,delete:_.workspace.deleteFile,recommendedApps:_.workspace.recommendedApps,desktopUpdateRequired:_.workspace.desktopUpdateRequired},emptyHint:y.files.emptyDirectory})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":y.files.resizeHandle,className:B(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Ve&&`bg-surface-hover`),onPointerDown:Sr,children:(0,$.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Te?(0,$.jsx)(We,{filePath:Te,projectId:T.id,agentId:T.defaultAgentId||Ct||void 0,onClose:()=>Oe(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(q,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:y.files.previewEmptyTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y.files.previewEmptyDescription})]})})})]}):(0,$.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:y.files.needWorkspace}),(0,$.jsx)(`div`,{children:(0,$.jsx)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Ln(`settings`),children:y.files.openSettings})})]})})}):null,Q===`sessions`?(0,$.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[I.length?(0,$.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,$.jsx)(Ut,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:z,onChange:e=>ee(e.currentTarget.value),placeholder:y.sessions.searchPlaceholder,"aria-label":y.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`}),z?(0,$.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":y.sessions.clearSearch,onClick:()=>ee(``),children:(0,$.jsx)(N,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Nr.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Nr.map(e=>{let t=mi(e.updatedAt),n=e.routing?.agentId||e.agentId||y.common.agent,r=Ei(e),i=e.name?.trim()||y.sessions.fallbackTitle,a=jr(e.messageCount??0);return(0,$.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Bn(`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,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.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,$.jsx)(Re,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,$.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,$.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[y.sessions.agent,`: `,n]}),(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,$.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[y.sessions.updated,`: `,t]}):null]})]},e.key)})}):Pr?(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:y.sessions.noMatches})}):(0,$.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:y.sessions.emptyTitle}),(0,$.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:y.sessions.emptyDescription})]})})]}):null,Q===`progress`?(0,$.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,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.progress.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:pi(y.progress.count,{count:re})})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.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,$.jsx)(`input`,{type:`checkbox`,checked:ue,onChange:e=>pe(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),y.progress.includeRelated]}),(0,$.jsxs)(H,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Yn(),disabled:se,children:[(0,$.jsx)(Ye,{className:B(`size-4`,se&&`animate-spin`),"aria-hidden":!0}),y.common.refresh]})]})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:se&&V.length===0?(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:y.progress.loading}):V.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge`,children:V.map(e=>{let t=y.progress.types[e.type]??e.type,n=y.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Oi(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===T.id);return(0,$.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:y.progress.related}):null]}),(0,$.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,wi(e)]})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:mi(e.createdAt)})]}),r?(0,$.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[y.progress.actor,`: `,Ci(e)]}),(0,$.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[y.progress.source,`: `,Ti(e)]})]})]},e.id)})}):(0,$.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:y.progress.empty})})]}):null,Q===`settings`?(0,$.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:or,onBlurCapture:wr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,$.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.summaryTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:y.settings.summaryHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,$.jsx)(`span`,{className:B(`rounded-full px-2 py-0.5 text-xs font-medium`,hi(An.status)),children:y.settings.statuses[An.status]}),(0,$.jsx)(bn,{status:wr.status,error:wr.error})]})]}),(0,$.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.detailsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y.settings.detailsHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,$.jsx)(gi,{label:y.settings.name,children:(0,$.jsx)(`input`,{className:_i(),value:An.name,onChange:e=>sr({name:e.target.value})})}),(0,$.jsx)(gi,{label:y.settings.defaultAgent,children:(0,$.jsxs)(x,{className:_i(),value:An.defaultAgentId,onChange:e=>sr({defaultAgentId:e.target.value},!0),children:[(0,$.jsx)(S,{value:``,children:y.settings.globalDefaultAgent}),yt.map(e=>(0,$.jsx)(S,{value:e.id,children:ut(e,_.agentsSettings)},e.id))]})}),(0,$.jsx)(gi,{label:y.settings.status,children:Rr?(0,$.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:y.settings.statuses.archived}):(0,$.jsxs)(x,{className:_i(),value:An.status===`archived`?`active`:An.status,onChange:e=>sr({status:e.target.value},!0),children:[(0,$.jsx)(S,{value:`active`,children:y.settings.statuses.active}),(0,$.jsx)(S,{value:`paused`,children:y.settings.statuses.paused})]})}),(0,$.jsx)(gi,{label:y.settings.executionMode,hint:y.settings.executionModeHint,children:(0,$.jsxs)(x,{className:_i(),value:An.executionMode,onChange:e=>sr({executionMode:e.target.value},!0),children:[(0,$.jsx)(S,{value:`managed_worktree`,children:y.settings.executionModeWorktree}),(0,$.jsx)(S,{value:`local_checkout`,children:y.settings.executionModeLocal})]})}),(0,$.jsx)(gi,{label:y.settings.description,hint:y.settings.descriptionHint,children:(0,$.jsx)(`textarea`,{className:_i(!0),value:An.description,onChange:e=>sr({description:e.target.value})})})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.projectGuidanceTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y.settings.projectGuidanceHint})]}),(0,$.jsx)(gi,{label:y.settings.brief,hint:y.settings.briefHint,children:(0,$.jsx)(`textarea`,{className:_i(!0),value:An.brief,onChange:e=>sr({brief:e.target.value})})}),(0,$.jsx)(gi,{label:y.settings.instructions,hint:y.settings.instructionsHint,children:(0,$.jsx)(`textarea`,{className:_i(!0),value:An.instructions,onChange:e=>sr({instructions:e.target.value})})})]})]}),(0,$.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.workspaceRoot}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:y.settings.workspaceIndependentHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Br?y.settings.workspaceModeFollow:y.settings.workspaceModeFixed}),(0,$.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Vr,children:Vr}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Gr(),children:[(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0}),y.settings.copyWorkspacePath]}),ye?(0,$.jsx)(at,{resourceId:ye.fileId,displayName:ye.name}):null,(0,$.jsxs)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:cr,children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),y.settings.migrateWorkspace]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.currentProjectTitle}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(vi,{label:y.settings.defaultAgent,value:Fr}),(0,$.jsx)(vi,{label:y.settings.pinState,value:zr?y.settings.pinned:y.settings.notPinned}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(vi,{label:y.settings.createdAt,value:mi(T.createdAt)||y.common.never}),(0,$.jsx)(vi,{label:y.settings.updatedAt,value:mi(T.updatedAt)||y.common.never})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.settings.managementTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:y.settings.managementHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:zr?y.settings.pinnedTitle:y.settings.pinTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:y.settings.pinHint})]}),(0,$.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`pin`,onClick:()=>void dr(),children:[zr?(0,$.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Et,{className:`size-4`,"aria-hidden":!0}),zr?y.settings.unpinProject:y.settings.pinProject]})]}),(0,$.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Rr?y.settings.restoreTitle:y.settings.archiveTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Rr?y.settings.restoreHint:y.settings.archiveHint})]}),(0,$.jsxs)(H,{type:`button`,variant:Rr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:cn===`archive`,onClick:()=>void fr(),children:[Rr?(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),Rr?y.settings.restoreProject:y.settings.archiveProject]})]})]})]}),(0,$.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:y.settings.dangerTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:y.settings.dangerHint})]}),(0,$.jsxs)(H,{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:()=>Bt(!0),children:[(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),y.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,$.jsx)(h,{open:zt,onOpenChange:e=>{un||Bt(e)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.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,$.jsx)(Mt,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:y.settings.deleteConfirmTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:T?pi(y.settings.deleteConfirm,{name:T.name}):y.settings.deleteConfirmFallback})]})]}),(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:un,children:y.common.cancel})}),(0,$.jsxs)(H,{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:un||!T,onClick:()=>void pr(),children:[(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),y.settings.deleteConfirmAction]})]})]})]})}),(0,$.jsx)(ze,{open:!!ke,title:_.workspace.trashConfirmTitle,description:_.workspace.trashConfirmDescription.replace(`{{name}}`,ke?.name??``),confirmLabel:_.workspace.moveToTrash,cancelLabel:_.workspace.cancel,destructive:!0,onConfirm:()=>void yr(),onCancel:()=>je(null)}),(0,$.jsx)(ze,{open:!!Ne,title:_.workspace.deleteConfirmTitle,description:_.workspace.deleteConfirmDescription.replace(`{{name}}`,Ne?.name??``),confirmLabel:_.workspace.deleteFile,cancelLabel:_.workspace.cancel,destructive:!0,onConfirm:()=>void xr(),onCancel:()=>Pe(null)}),(0,$.jsx)(h,{open:Zt,onOpenChange:e=>{Ft||Qt(e)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:y.settings.workspaceMigrationTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y.settings.workspaceMigrationDescription})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg-muted`,children:y.settings.workspaceMode}),(0,$.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:B(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,$t===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:$t===`fixed`,onChange:()=>en(`fixed`),disabled:Ft}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:y.settings.workspaceModeFixed}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:y.settings.workspaceMigrationFixedHint})]})]}),(0,$.jsxs)(`label`,{className:B(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,$t===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,$.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:$t===`follow`,onChange:()=>en(`follow`),disabled:Ft}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:y.settings.workspaceModeFollow}),(0,$.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:y.settings.workspaceHint})]})]})]})]}),$t===`fixed`?(0,$.jsx)(Fn,{value:nn,onChange:on,disabled:Ft,wd:v,placeholder:y.settings.workspacePlaceholder,inputClassName:_i(),autoFocus:!0}):null,(0,$.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:y.settings.workspaceMigrationImpact}),(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:pi(y.settings.workspaceCurrent,{workspace:Hr})})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Ft,children:y.common.cancel})}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Ft||!Ur,onClick:()=>void lr(),children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),y.settings.workspaceMigrationConfirm]})]})]})]})}),(0,$.jsx)(h,{open:!!Yt,onOpenChange:e=>{e||Xt(null)},children:(0,$.jsxs)(f,{children:[(0,$.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(p,{className:`xopc-dialog-content 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,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(m,{className:`text-base font-semibold text-fg`,children:y.settings.workspaceMissingTitle}),(0,$.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Yt?pi(y.settings.workspaceMissingDescription,{workspace:Yt}):null})]}),Yt?(0,$.jsx)(`div`,{className:`px-5 py-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(q,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:Yt})]})}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Kr,disabled:Ft,children:y.settings.workspaceMissingBack}),(0,$.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void lr({createWorkspaceRoot:!0}),disabled:Ft,children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),y.settings.workspaceMissingCreate]})]})]})]})})]})}export{Mi as ProjectDetailPage};