@xopcai/xopc 0.0.316 → 0.0.317

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 (153) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-XIyH14Sn.js → agent-avatar-dicebear-BmmO4j0u.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DJl_o7Xf.js → agent-defaults-settings-panel-2NGwyCKB.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-CGFhxPFv.js → agents-Cb4lfXqA.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-Dy056n2_.js → api-Fu9gSeAI.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-Dp7Fcj2Z.js → app-management-settings-panel-BhIQOlam.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-CSUffLjx.js → appearance-settings-DwW3wrBX.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-DtIcKfJG.js → apps-page-ByLoHKiD.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-D3SdndlF.js → archive-plugin-DzQeKhMy.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-BgxXYRkd.js → attachment-load-CNWbDfHi.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-krhofMgL.js → automations-page-CZcaFAco.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-CGTrgDlW.js +7 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-w6lazTqo.js → binary-plugins-D5-gEs50.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-CxHqPODE.js → block-editor-DngH5soo.js} +3 -3
  16. package/dist/gateway/static/root/assets/{browser-automation-inputs-hNdEgfGG.js → browser-automation-inputs-DeGdfGUg.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-automations-page-BYsGJ_xs.js → browser-automations-page-D_vsV9Og.js} +1 -1
  18. package/dist/gateway/static/root/assets/browser-settings-page-DCpyjtI7.js +3 -0
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-C3clEWb3.js +8 -0
  20. package/dist/gateway/static/root/assets/channels-settings-Dibm8FJG.js +1 -0
  21. package/dist/gateway/static/root/assets/{chat-terminal-dock-medSiQoQ.js → chat-terminal-dock-DyoR9vy9.js} +1 -1
  22. package/dist/gateway/static/root/assets/{computer-settings-page-DJxO0CfY.js → computer-settings-page-Dp1d7MGE.js} +1 -1
  23. package/dist/gateway/static/root/assets/{connector-service-page-WaoUqr8a.js → connector-service-page--SapHT59.js} +1 -1
  24. package/dist/gateway/static/root/assets/connectors-page-CV2K0GsR.js +2 -0
  25. package/dist/gateway/static/root/assets/{date-picker-DalDr0E6.js → date-picker-BpJiursq.js} +1 -1
  26. package/dist/gateway/static/root/assets/{dependency-picker-ONChq2Yr.js → dependency-picker-BKLcvu4-.js} +1 -1
  27. package/dist/gateway/static/root/assets/{desktop-pet-b1a37SVn.js → desktop-pet-DNBeDygk.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-settings-CwqZxGv4.js → desktop-pet-settings-C1wzPZky.js} +1 -1
  29. package/dist/gateway/static/root/assets/device-pairing-wizard-tCgXlVNO.js +1 -0
  30. package/dist/gateway/static/root/assets/{extension-debug-page-CGthPGca.js → extension-debug-page-BoG796xN.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-CExNJs0G.js → extension-page-DatEJD_W.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-settings-page-DBfxzKR8.js → extension-settings-page-cs0pcgqa.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-config-swr-DFjsI4QK.js → gateway-config-swr-CYa7aVok.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-settings-BlpheZrf.js → gateway-settings-DSxwMkLj.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-startup-retry-oRRqSoe9.js → gateway-startup-retry-FZix2Im1.js} +1 -1
  36. package/dist/gateway/static/root/assets/home-page-3cToq8Ic.js +1 -0
  37. package/dist/gateway/static/root/assets/{image-generation-api-CyDy_Sxu.js → image-generation-api-IDhumota.js} +1 -1
  38. package/dist/gateway/static/root/assets/{imports-page-Dnp2hmFL.js → imports-page-BZ-0tsFU.js} +1 -1
  39. package/dist/gateway/static/root/assets/index-Ca4fdHsK.css +1 -0
  40. package/dist/gateway/static/root/assets/index-DqxyVarz.js +89 -0
  41. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-1DUcGrYh.js → keyboard-shortcuts-settings-CyXLl8PE.js} +1 -1
  42. package/dist/gateway/static/root/assets/{local-app-workbench-page-BW2-80Og.js → local-app-workbench-page-ZjNFRbSU.js} +2 -2
  43. package/dist/gateway/static/root/assets/{local-apps-page-C7_2zyV_.js → local-apps-page-BmcNQOEx.js} +1 -1
  44. package/dist/gateway/static/root/assets/{locale-store-D6VmRI5e.js → locale-store-BrnrrtSS.js} +1 -1
  45. package/dist/gateway/static/root/assets/{logs-page-Cbr7bPM6.js → logs-page-DoaBVsR2.js} +2 -2
  46. package/dist/gateway/static/root/assets/{management-settings-G7GcFx2_.js → management-settings-BkCC5j8K.js} +1 -1
  47. package/dist/gateway/static/root/assets/{markdown-view-B5MfZeKH.js → markdown-view-DUfjxG4s.js} +1 -1
  48. package/dist/gateway/static/root/assets/{media-plugins-IbcEpV96.js → media-plugins-DFNzifXX.js} +1 -1
  49. package/dist/gateway/static/root/assets/messages-BoEi2k2p.js +3 -0
  50. package/dist/gateway/static/root/assets/note-detail-panel-CLxgY3Xq.js +5 -0
  51. package/dist/gateway/static/root/assets/notes-page-CgQEb3ks.js +8 -0
  52. package/dist/gateway/static/root/assets/{page-context-capture-button-B5rZ_F0R.js → page-context-capture-button-Beu5hjB5.js} +1 -1
  53. package/dist/gateway/static/root/assets/{page-tabs-B84Yghg5.js → page-tabs-DWppfGs6.js} +1 -1
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-CaEtDmZO.js → preview-open-alternatives-CjBsxcGv.js} +1 -1
  55. package/dist/gateway/static/root/assets/{product-open-page-BK9z5b-v.js → product-open-page-BYoaBpad.js} +1 -1
  56. package/dist/gateway/static/root/assets/project-detail-page-BtiNnPuJ.js +1 -0
  57. package/dist/gateway/static/root/assets/{projects-page-BOp6swwM.js → projects-page-_Qc8812P.js} +1 -1
  58. package/dist/gateway/static/root/assets/{registry-api-sOL6E5LU.js → registry-api-DgKqRZl1.js} +1 -1
  59. package/dist/gateway/static/root/assets/{remote-access-hub-yb8l4ppq.js → remote-access-hub-CpI6OjSj.js} +1 -1
  60. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BAvzw1T0.js → runtime-tools-settings-panel-Dykdq60b.js} +1 -1
  61. package/dist/gateway/static/root/assets/scenes-page-hP1OhIG6.js +2 -0
  62. package/dist/gateway/static/root/assets/{schema-form-Dytkw9RZ.js → schema-form-BPeMGXnp.js} +1 -1
  63. package/dist/gateway/static/root/assets/sessions-page-Dmncs4GP.js +1 -0
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-CV2LhIvd.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-DBJlmKQV.js → settings-form-section-OfLwze5k.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-C9GbP-ZG.js → settings-page-D-koQ_0e.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-layout-OvBOGen7.js → settings-page-layout-r1Q31sB_.js} +1 -1
  68. package/dist/gateway/static/root/assets/{setup-status-panel-BCMym4xj.js → setup-status-panel-MiIbmzZu.js} +1 -1
  69. package/dist/gateway/static/root/assets/{share-preview-page-D-sx26yN.js → share-preview-page-BkSzw3wN.js} +1 -1
  70. package/dist/gateway/static/root/assets/{shares-settings-EdNGhsuF.js → shares-settings-BT9NIsiS.js} +1 -1
  71. package/dist/gateway/static/root/assets/skill-reload-api-BgxB-kmG.js +1 -0
  72. package/dist/gateway/static/root/assets/{skills-page-Cgrfnet5.js → skills-page-CfL2BT9s.js} +1 -1
  73. package/dist/gateway/static/root/assets/{skills-page.utils-COPGVfmB.js → skills-page.utils-BKdQtHAI.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-B9tptggE.js → system-settings-panel-Del-7fwn.js} +1 -1
  75. package/dist/gateway/static/root/assets/task-detail-page-q8NLbitF.js +1 -0
  76. package/dist/gateway/static/root/assets/{tunnel-api-qb33IFGP.js → tunnel-api-DK9ICDPw.js} +1 -1
  77. package/dist/gateway/static/root/assets/{use-autosave-DfhqCGRX.js → use-autosave-BLZSp59v.js} +1 -1
  78. package/dist/gateway/static/root/assets/user-model-page-DPfaWuJs.js +2 -0
  79. package/dist/gateway/static/root/assets/{voice-api-key-field-taBVzvtI.js → voice-api-key-field-Lzm2ik7J.js} +1 -1
  80. package/dist/gateway/static/root/assets/{voice-config-api-B4yjd1Kb.js → voice-config-api-F6NsgxNd.js} +1 -1
  81. package/dist/gateway/static/root/assets/work-discovery-overlay-CkC8ANVw.js +1 -0
  82. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CP58uTNh.js → workflow-run-setup-panel-DoevvbCd.js} +2 -2
  83. package/dist/gateway/static/root/assets/workflows-page-CZxaaUK8.js +6 -0
  84. package/dist/gateway/static/root/index.html +8 -8
  85. package/dist/package.js +1 -1
  86. package/dist/src/agent/agent-manager.js +4 -4
  87. package/dist/src/agent/background-review/run-background-review.js +1 -1
  88. package/dist/src/agent/embedded/model-runtime.js +1 -1
  89. package/dist/src/agent/embedded/run-for-session.js +1 -1
  90. package/dist/src/agent/image/tool-model-config.js +1 -1
  91. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  92. package/dist/src/agent/service.js +2 -2
  93. package/dist/src/agent/session/session-inspector.js +1 -1
  94. package/dist/src/agent/skills/hub-lock.js +1 -1
  95. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  96. package/dist/src/ai-assist/text-assist.js +1 -1
  97. package/dist/src/auth/credentials.js +2 -2
  98. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  99. package/dist/src/auth/profiles/store.js +1 -1
  100. package/dist/src/auth/sync-provider-auth.js +2 -2
  101. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  102. package/dist/src/chat-commands/agent-edit.js +1 -1
  103. package/dist/src/cli/commands/agent.js +1 -1
  104. package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
  105. package/dist/src/cli/commands/models.js +1 -1
  106. package/dist/src/computer/runtime.js +1 -1
  107. package/dist/src/config/index.js +4 -4
  108. package/dist/src/config/loader.js +2 -2
  109. package/dist/src/config/models-json.js +2 -2
  110. package/dist/src/config/schema.js +1 -1
  111. package/dist/src/extensions/lockfile.js +1 -1
  112. package/dist/src/gateway/agents-admin.js +1 -1
  113. package/dist/src/gateway/file-path-classifier.js +1 -1
  114. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  115. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  116. package/dist/src/gateway/hono/routes/models.js +1 -1
  117. package/dist/src/gateway/service/config-coordinator.js +1 -1
  118. package/dist/src/gateway/service.js +11 -11
  119. package/dist/src/notes/service.js +1 -1
  120. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  121. package/dist/src/providers/index.js +2 -2
  122. package/dist/src/providers/model-catalog-persistence.js +1 -1
  123. package/dist/src/providers/model-registry.js +1 -1
  124. package/dist/src/providers/register-runtime-providers.js +1 -1
  125. package/dist/src/tui/backends/embedded-backend.js +1 -1
  126. package/dist/src/tui/tui-commands.js +1 -1
  127. package/dist/src/tui/tui-startup-resources.js +1 -1
  128. package/dist/src/tui/tui.js +2 -2
  129. package/dist/src/voice/tts/audio.js +1 -1
  130. package/dist/src/work-discovery/service.js +2 -2
  131. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  132. package/package.json +2 -2
  133. package/dist/gateway/static/root/assets/automations-workspace-EbpneB06.js +0 -7
  134. package/dist/gateway/static/root/assets/browser-settings-page-CP_c5q0V.js +0 -3
  135. package/dist/gateway/static/root/assets/capabilities-settings-panel-ljW3s3vv.js +0 -8
  136. package/dist/gateway/static/root/assets/channels-settings-CR9SRgFp.js +0 -1
  137. package/dist/gateway/static/root/assets/connectors-page-KIi15pQl.js +0 -2
  138. package/dist/gateway/static/root/assets/device-pairing-wizard-C_MNpS30.js +0 -1
  139. package/dist/gateway/static/root/assets/home-page-BvdT-uaI.js +0 -1
  140. package/dist/gateway/static/root/assets/index-BYKatjhB.css +0 -1
  141. package/dist/gateway/static/root/assets/index-DhCnwCI9.js +0 -89
  142. package/dist/gateway/static/root/assets/messages-BCqLsIZK.js +0 -3
  143. package/dist/gateway/static/root/assets/note-detail-panel-C4DiKkDf.js +0 -5
  144. package/dist/gateway/static/root/assets/notes-page-DgHQmpVq.js +0 -8
  145. package/dist/gateway/static/root/assets/project-detail-page-Qj8Xb9qS.js +0 -1
  146. package/dist/gateway/static/root/assets/scenes-page-CiAgb7hf.js +0 -2
  147. package/dist/gateway/static/root/assets/sessions-page-43hcOW84.js +0 -1
  148. package/dist/gateway/static/root/assets/settings-advanced-gate-C414vr2V.js +0 -1
  149. package/dist/gateway/static/root/assets/skill-reload-api-DYYM1qVn.js +0 -1
  150. package/dist/gateway/static/root/assets/task-detail-page-BrsM6Xmm.js +0 -1
  151. package/dist/gateway/static/root/assets/user-model-page-Sg94U7zz.js +0 -2
  152. package/dist/gateway/static/root/assets/work-discovery-overlay-DWGTB3Uk.js +0 -1
  153. package/dist/gateway/static/root/assets/workflows-page-Clka1xiQ.js +0 -6
@@ -0,0 +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{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./check-DUBLcKHA.js";import{d as l,f as u,l as d,n as f,p,r as m,t as h,u as g}from"./popover-select-B-GDnZO9.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./copy-Dv6d4Dvw.js";import{t as y}from"./download-Dk-ZjtO6.js";import{f as b,m as x,t as S}from"./markdown-view-DUfjxG4s.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./x-B_N4OPjy.js";import{t as T}from"./cn-JdwAhgNB.js";import{a as E,c as D,f as O,n as k,r as A}from"./locale-store-BrnrrtSS.js";import{t as j}from"./messages-BoEi2k2p.js";import{a as M,i as N,n as P,o as F,r as I,s as L,t as R}from"./dist-BGTk37IG.js";import{i as z,t as B}from"./tasks-CDR_RVbQ.js";import{t as ee}from"./copy-to-clipboard-HOJ79TWv.js";import{i as V}from"./vendor-swr-BIWyz7Rc.js";import{t as H}from"./button-CS04eWY9.js";import{t as U}from"./skeleton-BwbyijEw.js";import{$c as te,$i as W,$n as ne,$s as re,$u as G,Ba as K,Bc as q,Bo as ie,Cc as ae,Cn as oe,Co as se,Dc as ce,Di as le,Ec as J,Fa as ue,Fn as de,Ga as fe,Gu as Y,Ha as pe,Hc as me,Hn as he,Hu as ge,Ia as _e,In as ve,Ja as ye,Jl as be,Jo as xe,Ka as Se,Kl as Ce,La as we,Lc as Te,Ll as Ee,Ln as De,Mc as Oe,Ml as ke,Pc as Ae,Pn as je,Ps as Me,Pu as Ne,Qa as Pe,Qi as Fe,Rc as Ie,Rl as Le,Rn as Re,Rs as ze,Tl as Be,Tu as Ve,Ua as He,Us as Ue,Uu as We,Va as Ge,Vs as Ke,Wa as qe,Wn as Je,Wu as Ye,Xa as Xe,Xi as Ze,Xl as Qe,Xs as $e,Ya as et,Yi as tt,Yl as nt,Yr as rt,Ys as it,Yt as at,Za as ot,Zc as st,_u as ct,aa as lt,au as ut,ba as dt,bc as ft,bn as pt,br as mt,ca as ht,cd as gt,cu as _t,da as vt,ea as yt,el as bt,fa as xt,fr as St,gl as Ct,ha as wt,ia as Tt,id as Et,il as Dt,iu as Ot,ki as kt,ku as At,lc as jt,lr as Mt,lu as Nt,na as Pt,nc as Ft,nr as It,nu as Lt,oa as Rt,ol as zt,pa as Bt,pc as Vt,qa as Ht,qu as Ut,ra as Wt,rl as Gt,rr as Kt,sa as qt,sc as Jt,sd as Yt,si as Xt,ta as Zt,tr as Qt,ud as $t,uu as en,va as tn,vi as nn,vl as rn,wl as an,xa as on,xo as sn,yc as cn,yi as ln,yr as un,yu as dn,za as fn,zn as pn,zs as mn,zu as hn}from"./index-DqxyVarz.js";import{i as gn,n as _n,r as vn,t as yn}from"./note-detail-panel-CLxgY3Xq.js";import{t as bn}from"./page-tabs-DWppfGs6.js";import{n as xn,t as Sn}from"./use-autosave-BLZSp59v.js";import{t as Cn}from"./page-context-capture-button-Beu5hjB5.js";import{t as wn}from"./date-picker-BpJiursq.js";import{t as Tn}from"./automations-workspace-CGTrgDlW.js";import{i as En,p as Dn,s as On}from"./skills-page.utils-BKdQtHAI.js";import{t as kn}from"./dependency-picker-BKLcvu4-.js";import{c as An,l as X,n as jn,o as Mn,r as Nn,t as Pn}from"./style-TIDOdKy0.js";var Z=e(t(),1),Fn=n(),Q=r();function In(e){let t=(0,Fn.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?Bt(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=T(v,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,Me.transition,Me.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=T(`shrink-0 text-fg-muted`,C),t[12]=C,t[13]=w);let E;t[14]===w?E=t[15]:(E=(0,Q.jsx)(_t,{className:w,"aria-hidden":!0}),t[14]=w,t[15]=E);let D;t[16]!==f||t[17]!==h?(D=f?null:(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:h}),t[16]=f,t[17]=h,t[18]=D):D=t[18];let O;return t[19]!==i||t[20]!==S||t[21]!==E||t[22]!==D||t[23]!==g||t[24]!==_||t[25]!==x?(O=(0,Q.jsxs)(`button`,{type:`button`,disabled:i,title:g,"aria-label":_,className:x,onClick:S,children:[E,D]}),t[19]=i,t[20]=S,t[21]=E,t[22]=D,t[23]=g,t[24]=_,t[25]=x,t[26]=O):O=t[26],O}function Ln(e){let t=(0,Fn.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=xt(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=T(`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,Q.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,Q.jsx)(In,{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,Q.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,Q.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,Q.jsx)(ht,{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 E;return t[35]!==C||t[36]!==w?(E=(0,Q.jsxs)(Q.Fragment,{children:[C,w]}),t[35]=C,t[36]=w,t[37]=E):E=t[37],E}function $(e){let t=(0,Fn.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Z.useState)(!1),s;t[0]!==r||t[1]!==n?(s=mt(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=T(`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,Q.jsx)(be,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,Q.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=T(`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,Q.jsx)(St,{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 Rn(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 zn(e){let t=(0,Fn.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=un(),f=un(Vn),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=T(`flex items-center gap-2`,a),t[10]=a,t[11]=C);let w=m?`bg-accent text-on-accent`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===w?E=t[13]:(E=T(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,w),t[12]=w,t[13]=E);let D=m?`Pause`:`Play`,O;t[14]!==h||t[15]!==m?(O=h?(0,Q.jsx)(Be,{className:`size-3.5 animate-spin`}):m?(0,Q.jsx)(Gt,{className:`size-3.5`}):(0,Q.jsx)(st,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,t[16]=O):O=t[16];let k;t[17]!==b||t[18]!==S||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,Q.jsx)(`button`,{type:`button`,onClick:b,onKeyDown:S,className:E,"aria-label":D,children:O}),t[17]=b,t[18]=S,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let A=`${v}%`,j;t[23]===A?j=t[24]:(j=(0,Q.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:A}})}),t[23]=A,t[24]=j);let M;t[25]!==_||t[26]!==p||t[27]!==g?(M=Rn(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,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:M}),t[29]=M,t[30]=N);let P;t[31]!==j||t[32]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,N]}),t[31]=j,t[32]=N,t[33]=P):P=t[33];let F;return t[34]!==P||t[35]!==C||t[36]!==k?(F=(0,Q.jsxs)(`div`,{className:C,onClick:Bn,children:[k,P]}),t[34]=P,t[35]=C,t[36]=k,t[37]=F):F=t[37],F}function Bn(e){return e.stopPropagation()}function Vn(e){return e.toggle}function Hn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Un(e){let t=(0,Fn.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=Hn(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)(Xn),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=T(`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,Q.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,Q.jsx)($,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,Q.jsx)(zn,{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,Q.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let E=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,D;t[23]===E?D=t[24]:(D=T(`truncate text-sm leading-5`,E),t[23]=E,t[24]=D);let O;t[25]!==f||t[26]!==D?(O=(0,Q.jsx)(`p`,{className:D,children:f}),t[25]=f,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==w||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,O]}),t[28]=w,t[29]=O,t[30]=k):k=t[30];let A;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(dn,{className:`size-4`}),t[31]=A):A=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,Q.jsx)(pn,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:Yn,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:A})}),t[32]=c.actions,t[33]=j);let M;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(M=()=>{a(n.id,!n.pinned).catch(qn)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=M):M=t[37];let N;t[38]===n.pinned?N=t[39]:(N=n.pinned?(0,Q.jsx)(te,{className:`size-4`}):(0,Q.jsx)(bt,{className:`size-4`}),t[38]=n.pinned,t[39]=N);let P=n.pinned?c.unpin:c.pin,F;t[40]!==M||t[41]!==N||t[42]!==P?(F=(0,Q.jsxs)(de,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:M,children:[N,P]}),t[40]=M,t[41]=N,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>{o(n.id).catch(Kn)},t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)($t,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,Q.jsxs)(de,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(Re,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>{s(n.id).catch(Gn)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let ee;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(Vt,{className:`size-4`}),t[55]=ee):ee=t[55];let V;t[56]!==c.delete||t[57]!==B?(V=(0,Q.jsxs)(de,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:B,children:[ee,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==F||t[60]!==R||t[61]!==V?(H=(0,Q.jsx)(ve,{children:(0,Q.jsxs)(je,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:Jn,children:[F,R,z,V]})}),t[59]=F,t[60]=R,t[61]=V,t[62]=H):H=t[62];let U;t[63]!==j||t[64]!==H?(U=(0,Q.jsxs)(De,{children:[j,H]}),t[63]=j,t[64]=H,t[65]=U):U=t[65];let W;t[66]!==C||t[67]!==k||t[68]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,k,U]}),t[66]=C,t[67]=k,t[68]=U,t[69]=W):W=t[69];let ne;t[70]===n.pinned?ne=t[71]:(ne=n.pinned&&(0,Q.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,Q.jsx)(bt,{className:`size-3`})}),t[70]=n.pinned,t[71]=ne);let re;t[72]===n.tags?re=t[73]:(re=n.tags?.slice(0,2).map(Wn),t[72]=n.tags,t[73]=re);let G;t[74]===g?G=t[75]:(G=(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=G);let K;t[76]!==ne||t[77]!==re||t[78]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ne,re,G]}),t[76]=ne,t[77]=re,t[78]=G,t[79]=K):K=t[79];let q;return t[80]!==W||t[81]!==K||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(q=(0,Q.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]=q):q=t[87],q}function Wn(e){return(0,Q.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 Gn(){}function Kn(){}function qn(){}function Jn(e){return e.stopPropagation()}function Yn(e){return e.stopPropagation()}function Xn(){return Date.now()}var Zn=3e4;function Qn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function $n({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),[w,E]=(0,Z.useState)(!1),D=(0,Z.useRef)(null),O=(0,Z.useRef)(null),k=(0,Z.useRef)(null),A=(0,Z.useRef)([]),j=(0,Z.useRef)(0),M=(0,Z.useRef)(null),N=(0,Z.useRef)(null),P=(0,Z.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),k.current?.getTracks().forEach(e=>e.stop()),k.current=null,O.current=null,A.current=[],b(!1),S(0)},[]);(0,Z.useEffect)(()=>()=>P(),[P]);let F=(0,Z.useCallback)(async()=>{let e=O.current;if(!e||e.state!==`recording`)return;E(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||Qn()||`audio/webm`,r=new Blob(A.current,{type:n});if(P(),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{E(!1)}return}E(!1)},[P,c]),I=(0,Z.useCallback)(async()=>{if(!(!c||w||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});k.current=e;let t=Qn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);O.current=n,A.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&A.current.push(e.data)},n.start(),b(!0),S(0),M.current=setInterval(()=>{S(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{F()},Zn)}catch{P(),l?.()}}},[P,c,l,y,F,w]),L=(0,Z.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),D.current?.focus()}}},[h,_,o]),R=(0,Z.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},[L]),z=_||w,B=!!(s||c||p);return(0,Q.jsxs)(`div`,{className:T(`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":z,children:[y?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:w,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,Q.jsx)(ae,{className:`size-4 fill-current`,"aria-hidden":!0})}):B?(0,Q.jsxs)(De,{children:[(0,Q.jsx)(pn,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,disabled:z,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,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(ve,{children:(0,Q.jsxs)(je,{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,Q.jsxs)(de,{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,Q.jsx)(Ce,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,Q.jsxs)(de,{disabled:f,onSelect:()=>void I(),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,Q.jsx)(Ct,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,Q.jsxs)(de,{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,Q.jsx)(Et,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,Q.jsx)(`textarea`,{ref:D,value:h,onChange:e=>g(e.target.value),onKeyDown:R,placeholder:e,"aria-label":e,rows:1,disabled:z,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,Q.jsx)(`button`,{type:`button`,disabled:!h.trim()||z||y,onClick:()=>void L(),"aria-label":t,title:t,className:T(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!z&&!y?`bg-accent text-on-accent hover:bg-accent-hover`:`text-fg-disabled`),children:(0,Q.jsx)(Te,{className:`size-4`,"aria-hidden":!0})})]})}var er={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},tr=240,nr=320,rr=520,ir=560;function ar(e){if(globalThis.localStorage===void 0)return nr;try{let t=globalThis.localStorage.getItem(e);if(!t)return nr;let n=Number(t);return Number.isFinite(n)?n:nr}catch{return nr}}function or(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var sr={thought:ft,todo:J,voice:Ct,media:Ce,bookmark:G,mixed:ft,task:J};function cr(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function lr(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function ur(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function dr({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:a=!0,projectId:o,listTitle:s,listDescription:c,emptyText:l,emptyDescription:u,listWidthStorageKey:d=`xopc.notes.listWidth`}){let p=k(e=>e.language),h=j(p).notes,g=!!D(e=>e.conversationId),[_,v]=(0,Z.useReducer)(vt,er),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(``),[E,A]=(0,Z.useState)(0),[z,B]=(0,Z.useState)(()=>ar(d)),[ee,H]=(0,Z.useState)(!1),[U,te]=(0,Z.useState)(!1),[W,re]=(0,Z.useState)(!1),[G,K]=(0,Z.useState)(null),[q,ae]=(0,Z.useState)(null),oe=(0,Z.useRef)(null),ce=(0,Z.useRef)(null),[le]=(0,Z.useState)(()=>Date.now()),J=i(),ue=(0,Z.useCallback)(e=>{let t=oe.current?.clientWidth??window.innerWidth,n=Math.max(tr,t-ir);return Math.max(tr,Math.min(Math.min(rr,n),e))},[]),de=(0,Z.useCallback)(e=>{let t=ue(e);B(t),or(d,t)},[ue,d]);(0,Z.useLayoutEffect)(()=>{B(e=>ue(e))},[ue]);let{data:fe,mutate:Y,isLoading:pe}=V((0,Z.useMemo)(()=>g?[`notes-list`,o,_.statusFilter,_.kindFilter,_.pinnedOnly]:null,[g,o,_.statusFilter,_.kindFilter,_.pinnedOnly]),()=>ne({status:_.statusFilter===`all`?void 0:_.statusFilter,kind:_.kindFilter===`all`?void 0:_.kindFilter,projectId:o,pinned:_.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),me=pe&&!fe,ge=fe?.items??[],_e=fe?.total??0,ve=x.trim(),{data:ye,isLoading:be}=V(g&&y&&ve?[`notes-search`,o,ve]:null,()=>ne({search:ve,projectId:o,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),xe=ye?.items??[],Se=e?ge.some(t=>t.id===e):!0;(0,Z.useEffect)(()=>{A(0)},[ve]),(0,Z.useEffect)(()=>{E>=xe.length&&A(Math.max(0,xe.length-1))},[E,xe.length]),(0,Z.useEffect)(()=>{let e=()=>{Y().catch(e=>{K(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y,h.quickCaptureFailedHint,h.refreshFailed]);let Ce=se(e=>e.setPageHeader),we=se(e=>e.clearPageHeader),Te=h.noteCount.replace(`{{count}}`,String(_e)),Ee=!r&&_e===0&&c?c:Te,De=h.searchDialogTitle,Oe=h.searchClose,ke=h.searchClear,Ae=(0,Z.useMemo)(()=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),className:T(`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`,ie),"aria-label":De,children:[(0,Q.jsx)(Ie,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:De})]}),[De]);(0,Z.useLayoutEffect)(()=>{if(n)return g?(Ce({startExtra:null,main:(0,Q.jsxs)(`div`,{className:T(`flex min-w-0 items-center gap-2`,ie),children:[(0,Q.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:s??h.title}),Te?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Te}):null]}),end:Ae}),()=>we()):(we(),()=>we())},[we,g,Ae,s,n,h.title,Te,e,Ce]);let je=(0,Z.useMemo)(()=>({justNow:h.justNow,minutesAgo:h.minutesAgo,today:h.today,yesterday:h.yesterday,daysAgo:h.daysAgo,locale:O(p)}),[p,h.justNow,h.minutesAgo,h.today,h.yesterday,h.daysAgo]),Me=(0,Z.useMemo)(()=>[{id:`recent`,label:h.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:h.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:h.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:h.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:h.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:h.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:h.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:h.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:h.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[h.filterArchived,h.filterInbox,h.filterProcessed,h.kindBookmark,h.kindMedia,h.kindVoice,h.pinned,h.viewRecent,h.viewTasks]),Ne=Me.find(e=>lr(_,e))??Me[0],Pe=s??Ne.label,Fe=(0,Z.useCallback)(async e=>{K(null);try{let n=o?await he({markdown:e,kind:`thought`,projectId:o,channel:`web`}):await Qt(e,`web`);await Y(),J(ur(t,n.id))}catch(e){throw K(`${h.quickCaptureFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`),e}},[t,Y,h.quickCaptureFailed,h.quickCaptureFailedHint,J,o]),Le=(0,Z.useCallback)(async()=>{if(!W){re(!0),K(null);try{let e=await he({markdown:``,kind:`thought`,projectId:o,channel:`web`});v({type:`patch`,patch:er}),await Y(),ae(e.id),J(ur(t,e.id))}catch(e){K(`${h.createBlankFailed}: ${e instanceof Error?e.message:h.createBlankFailedHint}`)}finally{re(!1)}}},[t,W,Y,h.createBlankFailed,h.createBlankFailedHint,J,o]),Re=(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 It(t,`web`),await Y()}catch(e){K(`${h.imageUploadFailed}: ${e instanceof Error?e.message:h.imageUploadFailedHint}`)}},e.click()},[Y,h.imageUploadFailed,h.imageUploadFailedHint]),ze=(0,Z.useCallback)(async(e,t)=>{try{K(null),await Kt(e,t,`web`),await Y()}catch(e){K(`${h.voiceUploadFailed}: ${e instanceof Error?e.message:h.voiceUploadFailedHint}`)}},[Y,h.voiceUploadFailed,h.voiceUploadFailedHint]),Be=(0,Z.useCallback)(()=>{K(`${h.voiceCaptureFailed}: ${h.voiceCaptureFailedHint}`)},[h.voiceCaptureFailed,h.voiceCaptureFailedHint]),Ve=(0,Z.useCallback)(async(e,t)=>{K(null);try{await Mt(e,{pinned:t}),await Y()}catch(e){K(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),He=(0,Z.useCallback)(async e=>{K(null);try{await Mt(e,{status:`archived`}),await Y()}catch(e){K(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),Ue=(0,Z.useCallback)(async e=>{K(null);try{await Je(e),await Y()}catch(e){K(`${h.actionFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)}},[Y,h.actionFailed,h.quickCaptureFailedHint]),We=(0,Z.useCallback)(e=>{J(ur(t,e))},[t,J]),Ge=(0,Z.useCallback)(e=>{J(ur(t,e)),b(!1)},[t,J]),Ke=(0,Z.useCallback)(e=>{if(xe.length){if(e.key===`ArrowDown`)e.preventDefault(),A(e=>Math.min(xe.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),A(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=xe[E]??xe[0];t&&Ge(t.id)}}},[E,Ge,xe]),qe=(0,Z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ce.current;t.setPointerCapture(e.pointerId),H(!0);let r=oe.current?.clientWidth??window.innerWidth,i=Math.max(tr,r-ir),a=Math.min(rr,i),o=e=>Math.max(tr,Math.min(a,e)),s=e.clientX,c=o(z),l=e.pointerId,u=0,f=c,p=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let m=()=>{u=0,p=f,n&&(n.style.width=`${p}px`)},h=e=>{f=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(m))},g=()=>{u!==0&&(window.cancelAnimationFrame(u),m());try{t.releasePointerCapture(l)}catch{}H(!1),oe.current?.style.setProperty(`--notes-list-width`,`${p}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),B(p),or(d,p),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerup`,g),window.removeEventListener(`pointercancel`,g)};window.addEventListener(`pointermove`,h),window.addEventListener(`pointerup`,g),window.addEventListener(`pointercancel`,g)},[d,z]);(0,Z.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Le())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Le]);let Ye=(0,Z.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),de(z-16)):e.key===`ArrowRight`?(e.preventDefault(),de(z+16)):e.key===`Home`?(e.preventDefault(),de(tr)):e.key===`End`&&(e.preventDefault(),de(rr))},[de,z]);return g?(0,Q.jsxs)(`div`,{ref:oe,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${z}px`},children:[(0,Q.jsxs)(`section`,{ref:ce,className:T(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-rail`,!ee&&`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,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[G?(0,Q.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,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,Q.jsx)(f,{value:Ne.id,onChange:e=>{let t=Me.find(t=>t.id===e.target.value);t&&v({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":h.libraryTitle,children:Me.map(e=>(0,Q.jsx)(m,{value:e.id,children:e.label},e.id))}):(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Pe}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Ee})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>te(!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":h.collapseNotesList,title:h.collapseNotesList,children:(0,Q.jsx)(zt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:Le,disabled:W,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":h.createBlankNote,title:h.createBlankShortcut,children:(0,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>b(!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":h.searchDialogTitle,title:h.searchDialogTitle,children:(0,Q.jsx)(Ie,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:me?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,Q.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):ge.length===0?(0,Q.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,Q.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,Q.jsx)(ft,{className:`size-6`,"aria-hidden":!0})}),(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Se?h.noteOutsideCurrentView:l??h.noNotes}),e&&!Se?null:(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:u??h.noNotesDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Se?(0,Q.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:h.noteOutsideCurrentView}):null,ge.map((t,n)=>{let r=n>0?_n(ge[n-1].createdAt):null;return(0,Q.jsxs)(`div`,{children:[_n(t.createdAt)!==r&&(0,Q.jsx)(`div`,{className:T(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:vn(t.createdAt,le,je)}),(0,Q.jsx)(Un,{note:t,selected:t.id===e,onPress:We,onPin:Ve,onArchive:He,onDelete:Ue,timeLabels:je,labels:{pin:h.pin,unpin:h.unpin,archive:h.archive,delete:h.delete,actions:h.noteActions,imageNote:h.imageNote,noText:h.noText}})]},t.id)})]})}),(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,Q.jsx)($n,{placeholder:h.quickCapturePlaceholder,submitLabel:h.quickCaptureSubmit,actionsLabel:h.quickCaptureActions,imageLabel:h.quickCaptureImage,voiceLabel:h.quickCaptureVoice,stopRecordingLabel:h.stopRecording,onCapture:Fe,onImagePick:a?Re:void 0,onVoiceCapture:a?ze:void 0,onVoiceError:Be,recordingLabel:h.recording,discussionCaptureLabel:h.discussionCapture.title,onDiscussionCapture:()=>sn(o)})})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h.resizeNotesList,"aria-valuemin":tr,"aria-valuemax":rr,"aria-valuenow":Math.round(z),tabIndex:0,onPointerDown:qe,onDoubleClick:()=>de(nr),onKeyDown:Ye,title:h.resizeNotesList,className:T(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-transparent hover:bg-surface-hover/60 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,Q.jsx)(`span`,{"aria-hidden":!0,className:T(`h-full w-px bg-transparent transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,ee&&`bg-accent scale-x-[2]`)})}),(0,Q.jsxs)(`section`,{className:T(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[U?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>te(!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":h.expandNotesList,title:h.expandNotesList,children:(0,Q.jsx)(zt,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,Q.jsx)(yn,{noteId:e,onBack:()=>J(t),onSaved:()=>{Y().catch(e=>{K(`${h.refreshFailed}: ${e instanceof Error?e.message:h.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>b(!0),autoFocus:e===q,onAutoFocusConsumed:()=>ae(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(ft,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:h.emptyEditorTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h.emptyEditorDescription}),(0,Q.jsxs)(`button`,{type:`button`,onClick:Le,disabled:W,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent 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,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0}),W?h.creatingBlankNote:h.createBlankNote]})]})})]}),(0,Q.jsx)(R,{open:y,onOpenChange:b,children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(L,{className:`text-sm font-semibold text-fg`,children:De}),(0,Q.jsx)(N,{className:`sr-only`,children:h.searchPlaceholder}),(0,Q.jsx)(P,{asChild:!0,children:(0,Q.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":Oe,children:(0,Q.jsx)(w,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsxs)(`div`,{className:`p-4`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Ie,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:x,onChange:e=>S(e.target.value),onKeyDown:Ke,placeholder:h.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`}),x?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>S(``),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":ke,children:(0,Q.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:ve?be&&!ye?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,Q.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):xe.length===0?(0,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(ft,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchNoResults}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchNoResultsDescription})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:h.searchResultsCount.replace(`{{count}}`,String(ye?.total??xe.length))}),xe.map((e,t)=>{let n=sr[e.kind]||ft,r=cr(e,{imageNote:h.imageNote,noText:h.noText});return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>Ge(e.id),onMouseEnter:()=>A(t),className:T(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===E?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,Q.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:gn(e.updatedAt,le,je)})]}),e.title?(0,Q.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,Q.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,Q.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,Q.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,Q.jsx)(Ie,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:h.searchEmptyTitle}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:h.searchEmptyDescription})]})})]})]})]})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,Q.jsx)(ft,{className:`size-10 text-fg-muted`}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.needToken})]})}function fr(e){return E(A(`/api/projects/${encodeURIComponent(e)}/skills`))}function pr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function mr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/workspace-trust`),{method:`PATCH`,body:JSON.stringify({trusted:t})})}function hr(e,t){let n=new FormData;return n.set(`file`,t),E(A(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function gr(e,t,n={}){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function _r(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function vr(e,t){return E(A(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}function yr({projectId:e,copy:t}){let[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)([]),[o,s]=(0,Z.useState)([]),[c,d]=(0,Z.useState)([]),[f,m]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(!1),[S,E]=(0,Z.useState)(!0),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(null),[j,N]=(0,Z.useState)(``),[z,B]=(0,Z.useState)(null),[ee,V]=(0,Z.useState)(null),[te,W]=(0,Z.useState)(``),[ne,re]=(0,Z.useState)(1),[G,K]=(0,Z.useState)(null),[q,ie]=(0,Z.useState)(!1),[ae,oe]=(0,Z.useState)(``),[se,ce]=(0,Z.useState)(``),le=(0,Z.useRef)(null),J=(0,Z.useCallback)(async()=>{E(!0),N(``);try{let t=await fr(e);r(t.items),a(t.inheritedItems),s(t.sources)}catch(e){N(e instanceof Error?e.message:String(e))}finally{E(!1)}},[e]);(0,Z.useEffect)(()=>{J()},[J]),(0,Z.useEffect)(()=>{let t=!1;return fe(e).then(e=>{t||d(e)}).catch(()=>{t||d([])}),()=>{t=!0}},[e]),(0,Z.useEffect)(()=>{if(!f){v(null);return}let e=c.find(e=>e.key===f),t=!1;return v(null),N(``),x(!0),ln(e?.agentId??e?.routing?.agentId,f,!0).then(e=>{t||v(e)}).catch(e=>{t||N(e instanceof Error?e.message:String(e))}).finally(()=>{t||x(!1)}),()=>{t=!0}},[f,c]),(0,Z.useEffect)(()=>{if(z!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{ie(!0),oe(``),Dn({q:te,page:ne,pageSize:8,sort:`downloads`,signal:e.signal}).then(K).catch(t=>{e.signal.aborted||oe(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||ie(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[z,ne,te]);async function ue(e,t){O(!0),A(t??null),N(``);try{await e(),B(null),ce(``),await J()}catch(e){N(e instanceof Error?e.message:String(e))}finally{O(!1),A(null)}}async function de(t){N(``);try{V((await pr(e,t)).skill)}catch(e){N(e instanceof Error?e.message:String(e))}}async function pe(n){if(n.removable&&window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){O(!0);try{await vr(e,n.directoryId),await J()}catch(e){N(e instanceof Error?e.message:String(e))}finally{O(!1)}}}async function me(){O(!0),N(``);try{await mr(e,!0),await J()}catch(e){N(e instanceof Error?e.message:String(e))}finally{O(!1)}}let he=o.find(e=>e.origin===`agents-workspace`),ge=new Map(_?.skills.map(e=>[e.name,e]));return(0,Q.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Q.jsxs)(u,{children:[(0,Q.jsx)(p,{asChild:!0,children:(0,Q.jsxs)(H,{type:`button`,children:[(0,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Q.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Q.jsx)(l,{children:(0,Q.jsxs)(g,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Q.jsx)(Cr,{icon:cn,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>B(`marketplace`)}),(0,Q.jsx)(Cr,{icon:Lt,title:t.source,hint:t.sourceHint,onClick:()=>B(`source`)}),(0,Q.jsx)(Cr,{icon:jt,title:t.upload,hint:t.uploadHint,onClick:()=>le.current?.click()})]})})]}),(0,Q.jsx)(`input`,{ref:le,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&ue(()=>hr(e,n)),t.target.value=``}})]})}),j?(0,Q.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:j}):null,he?.state===`untrusted`?(0,Q.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,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.jsx)(an,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.trustTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustHint})]})]}),(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,disabled:D,onClick:()=>void me(),children:[(0,Q.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}),D?t.trusting:t.trustAction]})]}):null,c.length?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.sessionViewLabel}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:b?t.sessionLoading:f?_?.agentId:t.sessionViewAll})]}),(0,Q.jsx)(h,{value:f,options:c.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:m})]}):null,S?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Q.jsx)(U,{className:`h-36 rounded-lg`},e))}):n.length?(0,Q.jsx)(br,{title:t.localTitle,items:n,copy:t,busy:D,availabilityByName:ge,onPreview:de,onRemove:pe}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),!S&&i.length?(0,Q.jsx)(br,{title:t.inheritedTitle,hint:t.inheritedHint,items:i,copy:t,busy:D,availabilityByName:ge,onPreview:de,onRemove:pe}):null,(0,Q.jsx)(R,{open:z!==null,onOpenChange:e=>{e||B(null)},children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{className:T(`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-overlay shadow-xl`,z===`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,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:z===`marketplace`?t.marketplace:t.source}),(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(w,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:z===`marketplace`?(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Q.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Q.jsx)(Ie,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.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:te,onChange:e=>{W(e.target.value),re(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),ae?(0,Q.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:ae}):null,q&&!G?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Q.jsx)(U,{className:`h-32 rounded-lg`},e))}):G?.items.length?(0,Q.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:G.items.map(r=>{let i=r.providerId??G.provider,a=En(r,i),o=n.some(e=>e.origin===`xopc-workspace`&&(e.directoryId===r.id||e.directoryId===a||e.name===r.name)),s=k===a;return(0,Q.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(On,{name:r.name,className:`size-10`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Q.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Q.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Q.jsx)(H,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:D||o,onClick:()=>void ue(()=>gr(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):q?null:(0,Q.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),G&&G.meta.totalPages>1?(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(G.meta.page)).replace(`{{total}}`,String(G.meta.totalPages))}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ne<=1,onClick:()=>re(e=>Math.max(1,e-1)),children:[(0,Q.jsx)(Ye,{className:`size-4`}),t.marketplacePrevious]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:q||ne>=G.meta.totalPages,onClick:()=>re(e=>e+1),children:[t.marketplaceNext,(0,Q.jsx)(We,{className:`size-4`})]})]})]}):null]}):(0,Q.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Q.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:se,onChange:e=>ce(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,children:t.close})}),(0,Q.jsx)(H,{type:`button`,disabled:D||!se.trim(),onClick:()=>void ue(()=>_r(e,se.trim())),children:D?t.installing:t.install})]})]})})]})]})}),(0,Q.jsx)(R,{open:!!ee,onOpenChange:e=>{e||V(null)},children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{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-overlay shadow-xl`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:ee?.name}),(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Q.jsx)(w,{className:`size-4`})})})]}),(0,Q.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 br(e){let t=(0,Fn.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,Q.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,Q.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,Q.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,Q.jsxs)(`article`,{className:T(`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,!e.effective&&`opacity-70`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($t,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Q.jsx)(`h4`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.directoryId}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:xr(a,e.origin)}),e.writable?null:(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/70 px-2 py-0.5`,children:a.sourceReadOnly}),e.effective?null:(0,Q.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,Q.jsx)(`span`,{className:T(`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:Sr(a,t)}):null]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void c(e.key),children:[(0,Q.jsx)(ct,{className:`size-3.5`,"aria-hidden":!0}),a.view]}),e.removable?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:o,onClick:()=>void l(e),children:[(0,Q.jsx)(Vt,{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,Q.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,Q.jsxs)(`section`,{className:`grid gap-3`,children:[f,m]}),t[22]=f,t[23]=m,t[24]=h):h=t[24],h}function xr(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 Sr(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 Cr(e){let t=(0,Fn.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.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,Q.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,Q.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,Q.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,Q.jsx)(d,{asChild:!0,children:(0,Q.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}function wr(e){return{name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,executionMode:e.executionMode,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``}}function Tr(e,t,n){let r=wr(t),i=wr(n),a=Object.keys(r).filter(t=>e[t]===r[t]);return{...e,...Object.fromEntries(a.map(e=>[e,i[e]]))}}var Er={active:0,review:1,ready:2,backlog:3,closed:4},Dr={blocked:0,waiting:1,verifying:2,running:3,queued:4,idle:5},Or={critical:0,high:1,normal:2,low:3};function kr(e,t=4){return e.filter(e=>e.phase!==`closed`&&!(e.operationalState===`waiting`&&e.attention.length===0)).sort((e,t)=>{let n=Number(t.attention.length>0)-Number(e.attention.length>0);if(n!==0)return n;let r=Dr[e.operationalState]-Dr[t.operationalState];if(r!==0)return r;let i=Er[e.phase]-Er[t.phase];if(i!==0)return i;let a=Or[e.priority]-Or[t.priority];return a===0?t.updatedAt-e.updatedAt:a}).slice(0,t)}var Ar=[`backlog`,`ready`,`active`,`review`,`closed`];function jr(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 Mr(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 Nr(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 Pr(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 Fr(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Pr(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 Ir(e,t){let{incoming:n}=Pr(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 Lr(e,t){let{incoming:n,outgoing:r}=Pr(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 Rr={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 zr(e){let t=(0,Fn.c)(25),{data:n,selected:r}=e,i=n.task,a=i.operationalState===`waiting`||i.operationalState===`blocked`,o=Rr[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=T(`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,Q.jsx)(Nn,{type:`target`,position:X.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,Q.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,Q.jsx)(nt,{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,Q.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,Q.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,Q.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,Q.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,Q.jsx)(Nn,{type:`source`,position:X.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,Q.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 Br={taskNode:zr};function Vr(e){let t=(0,Fn.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?(_=Ir(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(Yr),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(Jr)),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,E;t[15]!==w||t[16]!==b?(E=Fr(b,w),t[15]=w,t[16]=b,t[17]=E):E=t[17];let D=E,O;t[18]!==f||t[19]!==w?(O=f?Lr(f,w):void 0,t[18]=f,t[19]=w,t[20]=O):O=t[20];let k=O,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(qr)),t[23]=b,t[24]=M);let N=M,P;if(t[25]!==a.phases||t[26]!==D||t[27]!==k||t[28]!==b){let e;t[30]!==a.phases||t[31]!==D||t[32]!==k?(e=e=>({id:e.id,type:`taskNode`,position:D.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]=D,t[32]=k,t[33]=e):e=t[33],P=b.map(e),t[25]=a.phases,t[26]=D,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:An.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 B,ee;t[45]!==L||t[46]!==m?(B=()=>{m&&!L.some(e=>e.id===m)&&h(void 0)},ee=[L,m],t[45]=L,t[46]=m,t[47]=B,t[48]=ee):(B=t[47],ee=t[48]),(0,Z.useEffect)(B,ee);let V;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{let e=window.requestAnimationFrame(()=>{g.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[49]=V):V=t[49];let U;t[50]!==u||t[51]!==c||t[52]!==b.length?(U=[u,c,b.length],t[50]=u,t[51]=c,t[52]=b.length,t[53]=U):U=t[53],(0,Z.useEffect)(V,U);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 W=te,ne;t[56]!==r||t[57]!==o?(ne=e=>{if(!e.source||!e.target||e.source===e.target)return;let t=r.filter(t=>t.dependentTaskId===e.target).map(Kr);t.includes(e.source)||o(e.target,[...t,e.source])},t[56]=r,t[57]=o,t[58]=ne):ne=t[58];let G=ne,K;t[59]!==r||t[60]!==o||t[61]!==m?(K=()=>{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(Gr)))},t[59]=r,t[60]=o,t[61]=m,t[62]=K):K=t[62];let q=K,ie;t[63]===a.connectHint?ie=t[64]:(ie=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.connectHint}),t[63]=a.connectHint,t[64]=ie);let ae=u?`secondary`:`ghost`,oe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>d(Wr),t[65]=oe):oe=t[65];let se=u?a.allTasks:a.blockedChains,ce;t[66]!==u||t[67]!==ae||t[68]!==se?(ce=(0,Q.jsx)(H,{type:`button`,variant:ae,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:oe,children:se}),t[66]=u,t[67]=ae,t[68]=se,t[69]=ce):ce=t[69];let le;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>l(Ur),t[70]=le):le=t[70];let J=c?a.hideCompleted:a.showCompleted,ue;t[71]!==u||t[72]!==c||t[73]!==J?(ue=(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":c,onClick:le,disabled:u,children:J}),t[71]=u,t[72]=c,t[73]=J,t[74]=ue):ue=t[74];let de=j?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:W,children:[(0,Q.jsx)(Nt,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,fe;t[75]!==a.removeDependency||t[76]!==q||t[77]!==m?(fe=m?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs text-danger`,onClick:q,children:a.removeDependency}):null,t[75]=a.removeDependency,t[76]=q,t[77]=m,t[78]=fe):fe=t[78];let Y;t[79]!==ce||t[80]!==ue||t[81]!==de||t[82]!==fe?(Y=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ce,ue,de,fe]}),t[79]=ce,t[80]=ue,t[81]=de,t[82]=fe,t[83]=Y):Y=t[83];let pe;t[84]!==ie||t[85]!==Y?(pe=(0,Q.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:[ie,Y]}),t[84]=ie,t[85]=Y,t[86]=pe):pe=t[86];let me=b.length>0?(0,Q.jsxs)(`div`,{className:T(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,j&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Q.jsxs)(Mn,{nodes:F,edges:L,nodeTypes:Br,nodesDraggable:!1,nodesConnectable:!0,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onEdgeClick:(e,t)=>h(t.id),onConnect:G,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,Q.jsx)(Pn,{color:`var(--color-edge)`,gap:22,size:1}),(0,Q.jsx)(jn,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),j?(0,Q.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.phases[j.phase]}),(0,Q.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:j.title}),j.operationalState===`blocked`&&j.blockedBy.length>0?(0,Q.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(j.blockedBy.length))}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:j.blockedBy.map(Hr)})]}):null,(0,Q.jsxs)(s,{to:re(i,j.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Q.jsx)(ct,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Q.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),he;return t[87]!==pe||t[88]!==me?(he=(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[pe,me]}),t[87]=pe,t[88]=me,t[89]=he):he=t[89],he}function Hr(e){return(0,Q.jsx)(`li`,{children:e.title},e.id)}function Ur(e){return!e}function Wr(e){return!e}function Gr(e){return e.dependencyTaskId}function Kr(e){return e.dependencyTaskId}function qr(e){return[e.id,e]}function Jr(e){return e.id}function Yr(e){return e.phase!==`closed`}function Xr(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var Zr={backlog:hn,ready:hn,active:ke,review:Jt,closed:_},Qr={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 $r(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 ei(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 ti(e){let t=(0,Fn.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,D;t[0]!==c||t[1]!==l||t[2]!==r||t[3]!==n?(m=Nr(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?_:Ne,v=n.priority!==`normal`,g=v||n.operationalState!==`idle`||!!n.latestVerification||n.acceptanceCriteriaCount>0||!!n.dueAt||!!n.nextCheckAt,x=!0,t[20]!==c||t[21]!==n.id?(S=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[20]=c,t[21]=n.id,t[22]=S):S=t[22],t[23]===c?C=t[24]:(C=()=>c(``),t[23]=c,t[24]=C),w=ri,t[25]!==l||t[26]!==n.id?(E=e=>{e.preventDefault(),e.stopPropagation(),l(n.id)},t[25]=l,t[26]=n.id,t[27]=E):E=t[27],D=`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?(y=re(r,n.id),t[28]=r,t[29]=n.id,t[30]=y):y=t[30],b=T(`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]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=E,t[19]=D):(u=t[4],d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],E=t[18],D=t[19]);let O=f?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`,k;t[31]===O?k=t[32]:(k=T(`mt-0.5 size-4 shrink-0`,O),t[31]=O,t[32]=k);let A;t[33]!==d||t[34]!==k?(A=(0,Q.jsx)(d,{className:k,"aria-hidden":!0}),t[33]=d,t[34]=k,t[35]=A):A=t[35];let j=f?`text-fg-subtle`:`text-fg`,M;t[36]===j?M=t[37]:(M=T(`min-w-0 break-words text-sm font-semibold leading-5`,j),t[36]=j,t[37]=M);let N;t[38]!==M||t[39]!==n.title?(N=(0,Q.jsx)(`h3`,{className:M,children:n.title}),t[38]=M,t[39]=n.title,t[40]=N):N=t[40];let P;t[41]!==A||t[42]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[A,N]}),t[41]=A,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==i||t[45]!==n.attention||t[46]!==n.blockedBy||t[47]!==n.operationalState?(F=n.operationalState===`blocked`&&n.blockedBy.length>0?(0,Q.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,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Q.jsx)(nt,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(ni).join(`、`)})]}):n.attention[0]?(0,Q.jsxs)(`p`,{className:`ml-6.5 mt-2.5 flex items-start gap-1.5 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(ge,{className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Q.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]=F):F=t[48];let I;t[49]!==i||t[50]!==p||t[51]!==g||t[52]!==v||t[53]!==n.acceptanceCriteriaCount||t[54]!==n.dueAt||t[55]!==n.latestVerification||t[56]!==n.nextCheckAt||t[57]!==n.operationalState||t[58]!==n.priority?(I=g?(0,Q.jsxs)(`div`,{className:`ml-6.5 mt-2.5 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[v?(0,Q.jsx)(`span`,{className:T(`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,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,$r(n.operationalState)),children:i.operationalStates[n.operationalState]}),n.latestVerification?(0,Q.jsx)(`span`,{className:T(`inline-flex min-h-6 items-center rounded-md border px-2 font-medium`,ei(n.latestVerification)),children:i.verification[n.latestVerification]}):null,n.acceptanceCriteriaCount>0?(0,Q.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,Q.jsx)(ke,{className:`size-3`,"aria-hidden":!0}),i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))]}):null,n.dueAt?(0,Q.jsxs)(`span`,{className:T(`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,Q.jsx)(Ut,{className:`size-3`,"aria-hidden":!0}),rt(new Date(n.dueAt))]}):null,n.nextCheckAt?(0,Q.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,Q.jsx)(Ut,{className:`size-3`,"aria-hidden":!0}),rt(new Date(n.nextCheckAt))]}):null]}):null,t[49]=i,t[50]=p,t[51]=g,t[52]=v,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]=I):I=t[59];let L;t[60]!==u||t[61]!==y||t[62]!==P||t[63]!==F||t[64]!==I||t[65]!==b?(L=(0,Q.jsxs)(u,{to:y,className:b,children:[P,F,I]}),t[60]=u,t[61]=y,t[62]=P,t[63]=F,t[64]=I,t[65]=b,t[66]=L):L=t[66];let R;t[67]!==a||t[68]!==i||t[69]!==o||t[70]!==m||t[71]!==h||t[72]!==n?(R=m?(0,Q.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,Q.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,Q.jsx)(Jt,{className:`size-3.5`,"aria-hidden":!0})}):null,(0,Q.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,Q.jsx)(Yt,{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]=R):R=t[73];let z;return t[74]!==L||t[75]!==R||t[76]!==x||t[77]!==S||t[78]!==C||t[79]!==w||t[80]!==E||t[81]!==D?(z=(0,Q.jsxs)(`article`,{draggable:x,onDragStart:S,onDragEnd:C,onDragOver:w,onDrop:E,className:D,children:[L,R]}),t[74]=L,t[75]=R,t[76]=x,t[77]=S,t[78]=C,t[79]=w,t[80]=E,t[81]=D,t[82]=z):z=t[82],z}function ni(e){return e.title}function ri(e){e.preventDefault(),e.stopPropagation()}function ii({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onReorder:a,onUndoMove:o,onDependenciesChange:s,onCreate:c,actionBusyId:l,ref:u}){let d=(0,Z.useRef)(null),p=(0,Z.useRef)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(`board`),[C,w]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(()=>crypto.randomUUID()),[O,A]=(0,Z.useState)(``),[z,B]=(0,Z.useState)(`normal`),[ee,V]=(0,Z.useState)(``),[U,te]=(0,Z.useState)([]),[W,ne]=(0,Z.useState)(!1),[re,G]=(0,Z.useState)(null),K=k(e=>e.language),q=Xt({chat:j(K).chat}),ie=jr(e),ae=e.filter(e=>e.phase!==`closed`),oe=(e,t)=>void i(e,t),se=async(t,n)=>{let r=e.find(e=>e.id===h);if(g(null),!r||r.id===n)return;let o=ie[r.phase],s=o.findIndex(e=>e.id===r.id),c=s>=0?o[s+1]?.id??null:null;if(r.phase===t&&c===n)return;let l=Mr(r,t);r.phase!==t&&!l||l&&!await i(r,l)||await a(r.id,n)&&b({taskId:r.id,phase:r.phase,beforeTaskId:c})},ce=async e=>{e.preventDefault();let t=O.trim();if(!(!t||W)){ne(!0),G(null);try{let e=ee?new Date(`${ee}T23:59:59.999`).getTime():void 0;await c({requestId:E,objective:t,priority:z,dependsOnTaskIds:U,attachments:q.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),A(``),B(`normal`),V(``),te([]),q.clearAttachments(),D(crypto.randomUUID()),w(!1)}catch(e){G(e instanceof Error?e.message:r.createFailed)}finally{ne(!1)}}},le=()=>{D(crypto.randomUUID()),A(``),B(`normal`),V(``),te([]),q.clearAttachments(),G(null),w(!0)};(0,Z.useImperativeHandle)(u,()=>({openCreate:le})),(0,Z.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>b(null),6e3);return()=>window.clearTimeout(e)},[y]);let J=(0,Z.useCallback)(e=>{let t=p.current;!t||t.pointerId!==e.pointerId||(p.current=null,v(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),ue=(0,Z.useCallback)(e=>{if(e.button!==0||Xr(e.target))return;let t=d.current;t&&(p.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[]),de=(0,Z.useCallback)(e=>{let t=p.current,n=d.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,v(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,Q.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,Q.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,Q.jsxs)(`div`,{className:`flex rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`board`,onClick:()=>S(`board`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":x===`graph`,onClick:()=>S(`graph`),className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,x===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(Lt,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})})]}),x===`board`?(0,Q.jsx)(`div`,{ref:d,className:T(`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,_?`cursor-grabbing select-none`:`cursor-grab`),onPointerDown:ue,onPointerMove:de,onPointerUp:J,onPointerCancel:J,onLostPointerCapture:e=>{p.current?.pointerId===e.pointerId&&(p.current=null,v(!1))},children:(0,Q.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Ar.map(t=>{let i=Zr[t],a=ie[t];return(0,Q.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===h);r&&(r.phase===t||Mr(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-inset/70 p-2.5`,children:[(0,Q.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center gap-2 px-0.5`,children:[(0,Q.jsxs)(`div`,{className:T(`flex items-center gap-1.5 rounded-md px-2 py-1`,Qr[t]),children:[(0,Q.jsx)(i,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.phases[t]})]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.length})]}),(0,Q.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,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Q.jsx)(ti,{task:e,returnTo:n,copy:r,busy:l===e.id,onAction:oe,onDragStart:g,onDropBefore:e=>void se(t,e)},e.id))})})]},t)})})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Vr,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,phases:r.phases},onDependenciesChange:s})}),(0,Q.jsx)(R,{open:C,onOpenChange:e=>{W||w(e)},children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,Q.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void ce(e),children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,Q.jsxs)(`div`,{className:T(`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(),W||q.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||q.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),q.setIsDragging(!1),W||q.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Q.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:O,onChange:e=>{A(e.target.value),G(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:W}),(0,Q.jsx)(nn,{attachments:q.attachments,topPadded:!1,onRemove:e=>{W||q.removeAttachment(e)}}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:W,onClick:()=>q.fileInputRef.current?.click(),children:[(0,Q.jsx)(Dt,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,Q.jsx)(`input`,{ref:q.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{q.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,Q.jsx)(f,{value:z,onChange:e=>B(e.target.value),disabled:W,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Q.jsx)(m,{value:e,children:r.priorityOptions[e]},e))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(wn,{className:`min-h-10 bg-surface-base`,value:ee,onChange:V,disabled:W,ariaLabel:r.dueDate})]})]}),(0,Q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,Q.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,Q.jsx)(kn,{candidates:ae,selectedIds:U,disabled:W,onChange:te,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),re?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:re}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:W,children:r.cancel})}),(0,Q.jsx)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:W||!O.trim(),children:W?r.creating:K===`zh`?`保存待安排任务`:`Save for later`})]})]})]})]})}),y?(0,Q.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,Q.jsx)(`span`,{children:r.moved}),(0,Q.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:()=>{let e=y;b(null),o(e.taskId,e.phase,e.beforeTaskId).then(t=>{t||b(e)})},children:r.undo})]}):null]})}var ai=new Set([{id:`overview`,icon:Le},{id:`tasks`,icon:Ve},{id:`automations`,icon:Ft},{id:`files`,icon:Ot},{id:`notes`,icon:en},{id:`skills`,icon:ce},{id:`sessions`,icon:rn},{id:`progress`,icon:Qe},{id:`settings`,icon:Ae}].map(e=>e.id)),oi=`xopc.projectFiles.panelWidthPx`,si=320,ci=220,li=560;function ui(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 di(e){return Math.min(li,Math.max(ci,Math.round(e)))}function fi(){try{let e=window.localStorage.getItem(oi);if(e==null)return si;let t=Number.parseInt(e,10);return Number.isFinite(t)?di(t):si}catch{return si}}function pi(e){try{window.localStorage.setItem(oi,String(di(e)))}catch{}}function mi(e){return!!(e&&ai.has(e))}function hi(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function gi(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):rt(n)}function _i(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-inset text-fg-subtle`:`bg-surface-hover text-fg-muted`}function vi(e){let t=(0,Fn.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.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,Q.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,Q.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 yi(e=!1){return T(`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 bi(e){let t=(0,Fn.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Q.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=T(`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,Q.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,Q.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 xi(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function Si(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Ci(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function wi(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Ti(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.conversationId?t.conversationId:t.kind}function Ei(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Di(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 Oi(e){let t=e.sourceChannel?.trim();return t?ki(t):``}function ki(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Ai(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 ji(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 Mi(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Mi(e.children,t,n)}:e)}function Ni({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,s]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)([e]),[m,h]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(!1),[w,E]=(0,Z.useState)(`new`),[D,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(``),[j,z]=(0,Z.useState)(!1),[B,ee]=(0,Z.useState)(!0),[V,U]=(0,Z.useState)(null),[te,W]=(0,Z.useState)(null),ne=(0,Z.useCallback)(async()=>{v(!0),b(null);try{let t=await Se({limit:100});f(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e]);(0,Z.useEffect)(()=>{f(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,Z.useEffect)(()=>{o&&ne()},[ne,o]);let re=(0,Z.useMemo)(()=>{let t=m.trim().toLowerCase().split(/\s+/).filter(Boolean);return d.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=xi(e);return t.every(e=>n.includes(e))}).sort((e,t)=>Si(t)-Si(e))},[e.id,d,m]),G=e=>t.statuses[e.status]??e.status,K=e=>e.description||e.brief||t.common.defaultWorkspace,q=e=>{E(e),O(``),A(``),U(null),S(!0),s(!1)},ie=(0,Z.useCallback)(async(e={})=>{let t=k.trim(),n=D.trim()||(w===`directory`?Ci(t):``);if(n){z(!0),U(null),W(null);try{let r=await _e({autoUnderstand:B,name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});S(!1),O(``),A(``),ee(!0),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:r.id}})),f(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=wi(e);t?(W(t),S(!1)):U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[w,D,a,k,B]),ae=(0,Z.useCallback)(e=>{e.preventDefault(),ie()},[ie]),oe=(0,Z.useCallback)(()=>{ie({createWorkspaceRoot:!0})},[ie]),se=(0,Z.useCallback)(()=>{W(null),S(!0)},[]),ce=e=>{A(e),w===`directory`&&!D.trim()&&O(Ci(e))},le=(e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:T(`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,Q.jsx)(c,{className:T(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:K(e)})]}),(0,Q.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,_i(e.status)),children:G(e)})]},e.id);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(u,{open:o,onOpenChange:s,children:[(0,Q.jsx)(p,{asChild:!0,children:(0,Q.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,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:T(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,_i(e.status)),children:G(e)})]}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:K(e)})]}),(0,Q.jsx)(Y,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Q.jsx)(l,{children:(0,Q.jsxs)(g,{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,Q.jsxs)(`label`,{className:`relative block`,children:[(0,Q.jsx)(Ie,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:m,onChange:e=>h(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Q.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),le(e,!0),(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),y?(0,Q.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:y}):null,_&&re.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!_&&re.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,re.map(e=>le(e,!1))]}),(0,Q.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Q.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:()=>q(`new`),children:[(0,Q.jsx)(C,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Q.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:()=>q(`directory`),children:[(0,Q.jsx)(Ot,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Q.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,Q.jsx)(Ae,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Q.jsx)(R,{open:x,onOpenChange:e=>!j&&S(e),children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:w===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Q.jsx)(N,{className:`mt-1 text-sm text-fg-muted`,children:w===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Q.jsxs)(`form`,{onSubmit:ae,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[V?(0,Q.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:V}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Q.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:D,onChange:e=>O(e.target.value),placeholder:`xopc`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Q.jsx)(Ln,{value:k,onChange:ce,disabled:j,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,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]}),(0,Q.jsx)(dt,{checked:B,onChange:ee,disabled:j})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:j,children:n.cancel})}),(0,Q.jsxs)(H,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:j||!(D.trim()||w===`directory`&&Ci(k)),children:[(0,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Q.jsx)(R,{open:!!te,onOpenChange:e=>{e||W(null)},children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Q.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:te?hi(n.workspaceMissingDescription,{workspace:te}):null})]}),te?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(Ot,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:te})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:se,disabled:j,children:n.workspaceMissingBack}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:oe,disabled:j,children:[(0,Q.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Pi(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),[c]=a(),l=k(e=>e.language),u=j(l),d=u.chat.workingDirectory,p=u.projectDetailPage,h=u.projectsPage,g=se(e=>e.setPageHeader),_=se(e=>e.clearPageHeader),[y,E]=(0,Z.useState)(null),D=(0,Z.useRef)(y);(0,Z.useLayoutEffect)(()=>{D.current=y},[y]);let[O,A]=(0,Z.useState)(null),[V,ne]=(0,Z.useState)([]),[G,ie]=(0,Z.useState)(``),[ae,J]=(0,Z.useState)([]),[de,Y]=(0,Z.useState)(0),[he,_e]=(0,Z.useState)(!1),[ve,be]=(0,Z.useState)(!1),[Se,Ce]=(0,Z.useState)(!1),[Te,Ee]=(0,Z.useState)([]),[De,Oe]=(0,Z.useState)(null),ke=(0,Z.useRef)(new Set),[je,Me]=(0,Z.useState)(null),[Ne,Re]=(0,Z.useState)(null),[Be,We]=(0,Z.useState)(null),[Je,Ye]=(0,Z.useState)(fi),[nt,rt]=(0,Z.useState)(!1),[st,ct]=(0,Z.useState)(!1),[dt,ft]=(0,Z.useState)(``),[mt,ht]=(0,Z.useState)([]),[_t,vt]=(0,Z.useState)(!1),[xt,St]=(0,Z.useState)(null),[Ct,Et]=(0,Z.useState)(!1),[Dt,jt]=(0,Z.useState)(null),[Mt,Nt]=(0,Z.useState)([]),[It,zt]=(0,Z.useState)(``),[Bt,Ut]=(0,Z.useState)(!0),[Gt,Kt]=(0,Z.useState)(!1),[Jt,Yt]=(0,Z.useState)(!1),[Xt,Qt]=(0,Z.useState)(null),[nn,an]=(0,Z.useState)(!1),[sn,cn]=(0,Z.useState)(`fixed`),[ln,un]=(0,Z.useState)(``),[dn,pn]=(0,Z.useState)(null),[hn,gn]=(0,Z.useState)(!1),[_n,vn]=(0,Z.useState)(!1),[yn,wn]=(0,Z.useState)(!1),[En,Dn]=(0,Z.useState)(null),On=(0,Z.useRef)(null),kn=(0,Z.useRef)(!1),[An,X]=(0,Z.useState)(null),[jn,Mn]=(0,Z.useState)({title:``,reason:``}),[Nn,Pn]=(0,Z.useState)({name:``,description:``,status:`active`,defaultAgentId:``,executionMode:`local_checkout`,workspaceRoot:``,brief:``,instructions:``}),Fn=(0,Z.useRef)(Nn),In=`overview`,$=n?`notes`:mi(t)?t:In,Rn=(0,Z.useMemo)(()=>b(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),zn=(0,Z.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Rn===`/projects`?n:x(n,Rn)},[Rn,e]),Bn=(0,Z.useCallback)(t=>{e&&r(zn(t))},[r,e,zn]),Vn=(0,Z.useCallback)(()=>{if($===`tasks`&&On.current){On.current.openCreate();return}kn.current=!0,Bn(`tasks`)},[Bn,$]);(0,Z.useEffect)(()=>{$!==`tasks`||!kn.current||(kn.current=!1,On.current?.openCreate())},[$]);let Hn=(0,Z.useCallback)(t=>{e&&r(zn(t),{replace:!0})},[r,e,zn]),Un=(0,Z.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Hn(e)},[Hn]),Wn=(0,Z.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,Z.useEffect)(()=>{!e||!t||mi(t)||r(zn(In),{replace:!0})},[In,r,e,zn,t]),(0,Z.useEffect)(()=>{if(!e)return;let t=!1;return Ut(!0),X(null),Promise.all([K(e),He(e),fe(e),pt().catch(()=>null),qe(e).catch(()=>null)]).then(([e,n,r,i,a])=>{if(t)return;E(e),A(n),ne(r),Oe(a),Nt(i?.agents??[]),zt(e.defaultAgentId??``);let o=wr(e);Fn.current=o,Pn(o)}).catch(e=>{t||(Oe(null),X(e instanceof Error?e.message:String(e)))}).finally(()=>{t||Ut(!1)}),()=>{t=!0}},[e]);let Gn=(0,Z.useCallback)(async()=>{e&&A(await He(e))},[e]);(0,Z.useEffect)(()=>{if(Bt)return;let t=!0,n=0,r=r=>{let i=r.detail?.id;if(!e||i&&i!==e)return;let a=++n;Promise.all([K(e),He(e)]).then(([e,r])=>{if(!t||n!==a)return;let i=D.current;if(!(i?.id===e.id&&i.version>e.version)){if(i?.id===e.id){let t=Tr(Fn.current,i,e);Fn.current=t,Pn(t)}D.current=e,E(e),A(r)}}).catch(e=>{!t||n!==a||e instanceof Error&&`status`in e&&e.status===404&&(E(null),A(null),X(e.message))})};return window.addEventListener(`project-resource-changed`,r),r(new Event(`project-resource-changed`)),()=>{t=!1,window.removeEventListener(`project-resource-changed`,r)}},[e,Bt]),(0,Z.useEffect)(()=>{let t,n=n=>{let r=B.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),120))},r=n=>{let r=z.safeParse(n.detail);!r.success||r.data.projectId!==e||(window.clearTimeout(t),t=window.setTimeout(()=>void Gn(),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,Gn]);let Kn=(0,Z.useCallback)(async(e,t)=>{Dn(e.id),X(null);try{let n=await Ue(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 Ke(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 ze(e.id,r,n.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Dn(null)}},[O,p.board.actionFailed,Gn]),qn=(0,Z.useCallback)(async t=>{e&&(X(null),await mn({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:l,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await Gn())},[l,e,Gn]),Jn=(0,Z.useCallback)(async(e,t)=>{Dn(e),X(null);try{return await it(e,t,(await Ue(e)).task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Dn(null)}},[p.board.actionFailed,Gn]),Yn=(0,Z.useCallback)(async(e,t,n)=>{Dn(e),X(null);try{let r=await Ue(e);return r.task.phase!==t&&(r=await ze(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 it(e,n,r.task.version),await Gn(),!0}catch(e){return await Gn().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed),!1}finally{Dn(null)}},[p.board.actionFailed,Gn]),Xn=(0,Z.useCallback)(async(e,t)=>{Dn(e),X(null);try{await $e(e,t,(await Ue(e)).task.version),await Gn()}catch(e){await Gn().catch(()=>void 0),X(e instanceof Error?e.message:p.board.actionFailed)}finally{Dn(null)}},[p.board.actionFailed,Gn]),Zn=(0,Z.useCallback)(async()=>{if(y){_e(!0),X(null);try{let e=await Ge(y.id,{includeRelated:ve,limit:100});J(e.items),Y(e.total)}catch(e){X(e instanceof Error?e.message:String(e))}finally{_e(!1)}}},[y,ve]);(0,Z.useEffect)(()=>{$===`progress`&&Zn()},[Zn,$]);let Qn=(0,Z.useCallback)(async()=>{if(!y?.effectiveWorkspaceRoot?.trim()){Ee([]),ke.current.clear(),jt(null);return}Et(!0),jt(null),ke.current.clear();try{Ee(ji((await pe(y.id,``)).entries)),ke.current.add(``)}catch(e){Ee([]),ke.current.clear(),jt(e instanceof Error?e.message:String(e))}finally{Et(!1)}},[y]),$n=(0,Z.useCallback)(async e=>{if(!(!y?.effectiveWorkspaceRoot?.trim()||ke.current.has(e))){ke.current.add(e),jt(null);try{let t=await pe(y.id,e);Ee(n=>Mi(n,e,ji(t.entries)))}catch(t){ke.current.delete(e),jt(t instanceof Error?t.message:String(t))}}},[y]),er=(0,Z.useCallback)(async e=>{if(!y?.effectiveWorkspaceRoot?.trim())return;let t=ji((await pe(y.id,e)).entries);Ee(e?n=>Mi(n,e,t):t),ke.current.add(e)},[y]);(0,Z.useEffect)(()=>{$===`files`&&Qn()},[Qn,$]);let tr=dt.trim();(0,Z.useEffect)(()=>{if($!==`files`||!y||!st||!tr){ht([]),vt(!1),St(null);return}let e=!1;vt(!0),St(null),ht([]);let t=window.setTimeout(()=>{Xe(y.id,tr,50).then(t=>{e||ht(t)}).catch(t=>{e||St(t instanceof Error?t.message:String(t))}).finally(()=>{e||vt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[tr,y,st,$]);let nr=(0,Z.useCallback)(async()=>{if(!y)return;let[e,t]=await Promise.all([K(y.id),He(y.id)]);A(t),E(e)},[y]),rr=(0,Z.useCallback)(async e=>{if(e.preventDefault(),!(!y||!jn.title.trim())){vn(!0),X(null);try{await we(y.id,{title:jn.title.trim(),reason:jn.reason.trim()||void 0}),Mn({title:``,reason:``}),wn(!1),await nr()}catch(e){X(e instanceof Error?e.message:String(e))}finally{vn(!1)}}},[jn.reason,jn.title,y,nr]),ir=(0,Z.useMemo)(()=>(0,Q.jsx)(s,{to:Rn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Rn===`/projects`?p.backToProjects:u.sidebar.back,children:(0,Q.jsx)(gt,{className:`size-4`,"aria-hidden":!0})}),[Rn,u.sidebar.back,p.backToProjects]),ar=(0,Z.useMemo)(()=>y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Cn,{resource:{kind:`project`,id:y.id,revision:String(y.version)},disabled:Gt||ui(Nn,y)}),(0,Q.jsx)(H,{asChild:!0,variant:`secondary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:`/workflows?tab=library&projectId=${encodeURIComponent(y.id)}`,children:[(0,Q.jsx)(Lt,{className:`size-4`,"aria-hidden":!0}),p.common.runWorkflow]})}),(0,Q.jsxs)(H,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Vn,children:[(0,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.board.create]}),(0,Q.jsx)(H,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,Q.jsxs)(s,{to:tn(y.id),state:{forceNewChat:!0,agentId:y.defaultAgentId},onClick:Un(`sessions`),children:[(0,Q.jsx)(rn,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})})]}):null,[Vn,Un,p.board.create,p.common.newChat,p.common.runWorkflow,y,Gt,Nn]);(0,Z.useLayoutEffect)(()=>(g({startExtra:ir,main:y?(0,Q.jsx)(Ni,{currentProject:y,pm:p,projectsText:h,wd:d}):(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:ar}),()=>_()),[_,ar,ir,p,y,h,g,d]);function or(e){E(t=>t?{...t,...e}:null),zt(e.defaultAgentId??``),qe(e.id).then(Oe).catch(()=>Oe(null)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function sr(e=Fn.current){if(!(!y||!ui(e,y))){X(null),Qt(null);try{let t=await Pe(y.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,executionMode:e.executionMode,brief:e.brief,instructions:e.instructions},y.version);or(t);let n=Fn.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};Fn.current=r,Pn(r)}catch(e){let t=wi(e);throw t?Qt(t):X(e instanceof Error?e.message:String(e)),e}}}function cr(e){e.preventDefault(),Or.flush()}function lr(e,t=!1){let n={...Fn.current,...e};Fn.current=n,Pn(n),t&&Or.saveNow(n)}let ur=(0,Z.useCallback)(()=>{if(!y)return;let e=y.workspaceRoot?.trim()??``;cn(e?`fixed`:`follow`),un(e||y.effectiveWorkspaceRoot||``),an(!0)},[y]);async function fr(e={}){if(!y)return;let t=sn===`fixed`?ln.trim():``;if(!(sn===`fixed`&&!t)){Kt(!0),X(null),Qt(null);try{let n=await Pe(y.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}},y.version);or(n),lr({workspaceRoot:n.workspaceRoot??``}),an(!1),Qt(null)}catch(e){let t=wi(e);t?(Qt(t),an(!1)):X(e instanceof Error?e.message:String(e))}finally{Kt(!1)}}}async function pr(){if(!(!y||dn)){pn(`pin`),X(null);try{or(y.pinnedAt?await ot(y.id,y.version):await Ht(y.id,y.version))}catch(e){X(e instanceof Error?e.message:String(e))}finally{pn(null)}}}async function mr(){if(!(!y||dn)){pn(`archive`),X(null);try{let e=y.status===`archived`?await ye(y.id,y.version):await ue(y.id,y.version);or(e),lr({status:e.status})}catch(e){X(e instanceof Error?e.message:String(e))}finally{pn(null)}}}async function hr(){if(y){gn(!0),X(null);try{await fn(y.id,y.version),Yt(!1),r(`/projects`)}catch(e){X(e instanceof Error?e.message:String(e))}finally{gn(!1)}}}async function gr(){if(!(!y||Se)){Ce(!0),X(null);try{await et(y.id)}catch(e){X(e instanceof Error?e.message:String(e))}finally{Ce(!1)}}}let _r=(0,Z.useCallback)(e=>{Me(e)},[]),vr=(0,Z.useCallback)((e,t)=>{t||Me(e)},[]),br=(0,Z.useCallback)(async(e,t,n)=>{let r=y?.id;if(r)switch(e){case`preview`:t.isDirectory||Me(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Ze(t.path);if(Fe(tt(e))!==`text`){let n=await Pt(t.path,{projectId:r}),i=wt(e)??`application/octet-stream`;yt(e,await n.arrayBuffer(),i)}else{let{content:n}=await Wt(t.path,{projectId:r});Zt(e,n)}}catch(e){xe(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await ee(t.path)&&xe(`success`,u.workspace.pathCopied,void 0,{duration:2500})}catch{xe(`warning`,u.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:await kt(()=>window.electronAPI?.shell?.openFileResource?.(t.fileId),u.workspace.openFileFailed);break;case`openWith`:await kt(()=>window.electronAPI?.shell?.chooseAppAndOpenFileResource?.(t.fileId),u.workspace.openFileFailed);break;case`openWithApp`:if(!n)return;await kt(()=>window.electronAPI?.shell?.openFileResourceWithApp?.(t.fileId,n),u.workspace.openFileFailed);break;case`revealInFolder`:await kt(()=>window.electronAPI?.shell?.showFileResourceInFolder?.(t.fileId),u.workspace.revealFileFailed);break;case`trash`:Re(t);break;case`delete`:t.isDirectory||We(t);break;default:break}},[u.clipboard.copyFailed,u.workspace.openFileFailed,u.workspace.pathCopied,u.workspace.revealFileFailed,y?.id]),xr=(0,Z.useCallback)(async()=>{let e=Ne;if(!e)return;let t=await window.electronAPI?.shell?.trashFileResource?.(e.fileId);if(!t?.ok){xe(`warning`,t?.error??u.workspace.trashFailed,void 0,{duration:4e3});return}je===e.path&&Me(null),Re(null),await Qn(),xe(`success`,u.workspace.trashSuccess,void 0,{duration:2500})},[u.workspace.trashFailed,u.workspace.trashSuccess,Ne,je,Qn]),Sr=(0,Z.useCallback)(async(e,t)=>{let n=y?.id;if(n)try{await Promise.all(e.map(e=>Tt(e,t,{projectId:n}))),await er(t).catch(()=>void 0),xe(`success`,u.workspace.uploadSuccess.replace(`{{count}}`,String(e.length)),void 0,{duration:2500})}catch(e){await er(t).catch(()=>void 0),xe(`warning`,`${u.workspace.uploadFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[u.workspace.uploadFailed,u.workspace.uploadSuccess,y?.id,er]),Cr=(0,Z.useCallback)(async()=>{let e=Be;if(e)try{await W(e.fileId),je===e.path&&Me(null),We(null);let t=e.path.lastIndexOf(`/`);await er(t<0?``:e.path.slice(0,t)).catch(()=>void 0),xe(`success`,u.workspace.deleteSuccess,void 0,{duration:2500})}catch(e){xe(`warning`,`${u.workspace.deleteFailed}: ${e instanceof Error?e.message:String(e)}`,void 0,{duration:4e3})}},[u.workspace.deleteFailed,u.workspace.deleteSuccess,Be,je,er]),Er=(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),rt(!0);let r=e.clientX,i=Je,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=di(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}rt(!1),Ye(c),pi(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)},[Je]);(0,Z.useEffect)(()=>{$!==`files`&&Me(null)},[e,$]);let Dr=!!(y&&ui(Nn,y)),Or=Sn({value:y?Nn:null,dirty:Dr,onSave:sr,validate:e=>e.name.trim()?null:p.settings.nameRequired});if(Bt)return(0,Q.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!y)return(0,Q.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Q.jsxs)(s,{to:Rn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Q.jsx)(gt,{className:`size-4`,"aria-hidden":!0}),Rn===`/projects`?p.backToProjects:u.sidebar.back]}),(0,Q.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:An||p.notFound})]});let Ar=V.slice(0,3),jr=O?.blockers??[],Mr=kr(O?.tasks??[]),Nr=O?.tasks.filter(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.operationalState)).length??0,Pr=e=>p.statuses[e]??e,Fr=e=>hi(p.common.messages,{count:e}),Ir=G.trim().toLowerCase(),Lr=Ir?V.filter(e=>{let t=gi(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=Fr(e.messageCount??0),a=Oi(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Ir)}):V,Rr=V.length>0&&Lr.length===0,zr=Mt.find(e=>e.id===y.defaultAgentId)?.name||y.defaultAgentId||p.settings.globalDefaultAgent,Br=Mt.find(e=>e.id===Nn.defaultAgentId),Vr=y.workspaceRoot?.trim()||``,Hr=y.status===`archived`,Ur=!!y.pinnedAt,Wr=!Vr,Gr=Vr||Br?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,Kr=sn===`fixed`?ln.trim()||p.settings.workspacePlaceholder:Br?.workspace||y.effectiveWorkspaceRoot||p.common.defaultWorkspace,qr=(sn===`fixed`?ln.trim():``)!==Vr&&(sn===`follow`||!!ln.trim()),Jr=[{id:`overview`,icon:Le,label:p.tabs.overview},{id:`tasks`,icon:Ve,label:p.tabs.tasks},{id:`automations`,icon:Ft,label:p.tabs.automations},{id:`files`,icon:Ot,label:p.tabs.files},{id:`notes`,icon:en,label:p.tabs.notes},{id:`skills`,icon:ce,label:p.tabs.skills},{id:`sessions`,icon:rn,label:p.tabs.sessions},{id:`progress`,icon:Qe,label:p.tabs.progress}];async function Yr(){if(!Gr)return;let e=await ee(Gr);xe(e?`success`:`warning`,e?u.workspace.pathCopied:u.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Xr(){Qt(null),an(!0)}return(0,Q.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,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Q.jsx)(bn,{items:Jr,activeTab:$,onChange:Bn,ariaLabel:p.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Q.jsxs)(H,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Bn(`settings`),children:[(0,Q.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),p.tabs.settings,Dr?(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":p.settings.unsavedChanges}):null]})]}),An?(0,Q.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:An}):null,(0,Q.jsxs)(`div`,{className:T(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,Q.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,Q.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,Q.jsx)(on,{projectId:y.id},y.id),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`p-5`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:hi(p.overview.activitySummary,{moving:Nr,attention:jr.length})})]}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-3xl text-base font-medium leading-7 text-fg`,children:y.outcome||y.description||y.brief||p.overview.directionFallback}),O?.digest.recommendedAction?(0,Q.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:hi(p.overview.recommendedNext,{action:O.digest.recommendedAction})}):null]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,onClick:()=>void gr(),disabled:Se,children:[(0,Q.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),Se?p.overview.savingDigest:p.overview.saveDigest]})]})}),(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3.5`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions}),(0,Q.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-muted transition-colors hover:text-fg`,onClick:()=>Bn(`tasks`),children:p.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle border-t border-edge-subtle`,children:Mr.length?Mr.map(e=>(0,Q.jsxs)(s,{to:re(zn(`overview`),e.id),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsxs)(`span`,{className:T(`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:[p.board.phases[e.phase],e.operationalState===`idle`?``:` · ${p.board.operationalStates[e.operationalState]}`]})]}),e.attention[0]?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]})]}),O?.recentResults.length?(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.recentResults})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:O.recentResults.slice(0,3).map(({taskId:e,taskTitle:t,receipt:n})=>(0,Q.jsxs)(s,{to:re(zn(`overview`),e),className:`block px-5 py-3 transition-colors hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[p.overview.resultStatuses[n.status],` · `,p.board.verification[n.verification.status]]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-3 text-sm leading-5 text-fg-muted`,children:(0,Q.jsx)(S,{content:n.summary,compact:!0})})]},n.runId))})]}):null,y.milestones.length||y.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[y.milestones.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.milestones})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:y.milestones.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 py-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:p.statuses[e.status]})]},e.id))})]}):null,y.recentUpdates.length?(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle px-5 py-3.5`,children:(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.projectUpdates})}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:y.recentUpdates.slice(0,3).map(e=>(0,Q.jsxs)(`div`,{className:`px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.overview.healthLabels[e.health]})]},e.id))})]}):null]}):null]}),(0,Q.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,Q.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-surface-panel p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 rounded-lg px-2 text-xs`,"aria-expanded":yn,onClick:()=>wn(e=>!e),children:[(0,Q.jsx)(C,{className:T(`size-3.5 transition-transform`,yn&&`rotate-45`),"aria-hidden":!0}),p.overview.addBlocker]})]}),jr.length?(0,Q.jsx)(`div`,{className:`mt-3 grid gap-3`,children:jr.map(e=>{let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(ge,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Q.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Pr(e.status)}`:``]})]});return e.href?(0,Q.jsx)(s,{to:e.href,onClick:Un(Wn(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Q.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedTasks}),yn?(0,Q.jsxs)(`form`,{onSubmit:rr,className:`mt-4 flex gap-2 border-t border-edge-subtle pt-4`,children:[(0,Q.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:jn.title,onChange:e=>Mn(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,Q.jsx)(H,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:_n||!jn.title.trim(),"aria-label":_n?p.overview.addingBlocker:p.overview.addBlocker,title:_n?p.overview.addingBlocker:p.overview.addBlocker,children:(0,Q.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]}):null]}),(0,Q.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(At,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Bn(`sessions`),children:p.common.viewAll})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:Ar.length?Ar.map(e=>(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:gi(e.updatedAt)})]}),(e.routing?.agentId||e.agentId)&&(e.routing?.agentId||e.agentId)!==y.defaultAgentId?(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.routing?.agentId||e.agentId}):null]},e.key)):(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,Q.jsx)(ii,{ref:On,tasks:O?.tasks??[],dependencyEdges:O?.dependencyEdges??[],returnTo:zn(`tasks`),copy:p.board,onAction:Kn,onReorder:Jn,onUndoMove:Yn,onDependenciesChange:Xn,onCreate:qn,actionBusyId:En}):null,$===`automations`?(0,Q.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,Q.jsx)(Tn,{projectId:y.id,embedded:!0,title:p.automations.title,subtitle:p.automations.hint})}):null,$===`notes`?(0,Q.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,Q.jsx)(dr,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(y.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:y.id,listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${y.id}`})}):null,$===`skills`?(0,Q.jsx)(yr,{projectId:y.id,copy:p.skills}):null,$===`files`?(0,Q.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,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl bg-surface-panel`,children:y.effectiveWorkspaceRoot?(0,Q.jsxs)(`div`,{"data-project-files-grid":!0,className:T(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_8px_minmax(0,1fr)]`,nt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Je}px`},children:[(0,Q.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge bg-surface-panel lg:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 items-center gap-1 bg-surface-hover/30 px-3 text-sm`,children:[De?(0,Q.jsx)(le,{resourceId:De.fileId,displayName:De.name}):null,(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,className:T(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,st&&`bg-surface-hover text-fg`),onClick:()=>ct(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":st,children:(0,Q.jsx)(Ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(Rt,{className:`size-7 shrink-0 rounded-md p-0`,loading:Ct,label:u.cron.refresh,onClick:()=>void Qn()})]})]}),st?(0,Q.jsx)(`div`,{className:`shrink-0 bg-surface-hover/20 px-3 py-2`,children:(0,Q.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md bg-surface-base px-2 focus-within:ring-2 focus-within:ring-accent/30`,children:[(0,Q.jsx)(Ie,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`text`,role:`searchbox`,value:dt,onChange:e=>ft(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Q.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{ft(``),ct(!1)},children:(0,Q.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Dt?(0,Q.jsx)(`div`,{className:`bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Dt}):null,tr?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:_t?(0,Q.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Q.jsx)(U,{className:`h-11 w-full`}),(0,Q.jsx)(U,{className:`h-11 w-full`}),(0,Q.jsx)(U,{className:`h-11 w-full`})]}):xt?(0,Q.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[u.workspace.loadError,`: `,xt]}):mt.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):mt.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:T(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,je===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Me(e.path),title:e.path,children:[(0,Q.jsx)(en,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Ct&&Te.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,Q.jsx)(lt,{tree:Te,selectedPath:je,onSelectFile:_r,onSelectEntry:vr,onExpandDir:e=>void $n(e),onAction:br,onUploadFiles:(e,t)=>void Sr(e,t),uploadDropHint:u.workspace.dropToUpload,actionLabels:{preview:u.workspace.preview,download:u.workspace.download,copyPath:u.workspace.copyPath,openDefault:u.workspace.openSystemApp,openDirectory:u.workspace.openInFileManager,openWith:u.workspace.openWith,revealInFolder:u.workspace.revealInFolder,trash:u.workspace.moveToTrash,delete:u.workspace.deleteFile,recommendedApps:u.workspace.recommendedApps,desktopUpdateRequired:u.workspace.desktopUpdateRequired},emptyHint:p.files.emptyDirectory})]}),(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:T(`group hidden cursor-col-resize touch-none items-stretch justify-center bg-transparent transition-colors hover:bg-surface-hover/60 lg:flex`,nt&&`bg-surface-hover/70`),onPointerDown:Er,children:(0,Q.jsx)(`div`,{className:T(`my-3 w-px rounded-full bg-transparent transition-colors`,`group-hover:bg-edge-strong/55`,nt&&`bg-accent/60`)})}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:je?(0,Q.jsx)(at,{filePath:je,projectId:y.id,agentId:y.defaultAgentId||It||void 0,onClose:()=>Me(null)}):(0,Q.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Q.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Q.jsx)(Ot,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,Q.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:p.files.needWorkspace}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Bn(`settings`),children:p.files.openSettings})})]})})}):null,$===`sessions`?(0,Q.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[V.length?(0,Q.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,Q.jsx)(Ie,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:G,onChange:e=>ie(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),G?(0,Q.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":p.sessions.clearSearch,onClick:()=>ie(``),children:(0,Q.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Lr.length?(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Lr.map(e=>{let t=gi(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=Oi(e),i=e.name?.trim()||p.sessions.fallbackTitle,a=Fr(e.messageCount??0);return(0,Q.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Un(`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,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Q.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,Q.jsx)(rn,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Q.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,Q.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Q.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):Rr?(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,Q.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,Q.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.progress.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:hi(p.progress.count,{count:de})})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:ve,onChange:e=>be(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.progress.includeRelated]}),(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Zn(),disabled:he,children:[(0,Q.jsx)(me,{className:T(`size-4`,he&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:he&&ae.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.loading}):ae.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:ae.map(e=>{let t=p.progress.types[e.type]??e.type,n=p.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Ai(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===y.id);return(0,Q.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.progress.related}):null]}),(0,Q.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,Ei(e)]})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:gi(e.createdAt)})]}),r?(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.progress.actor,`: `,Ti(e)]}),(0,Q.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.progress.source,`: `,Di(e)]})]})]},e.id)})}):(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.progress.empty})})]}):null,$===`settings`?(0,Q.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:cr,onBlurCapture:Or.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Q.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.summaryTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.settings.summaryHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Q.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-xs font-medium`,_i(Nn.status)),children:p.settings.statuses[Nn.status]}),(0,Q.jsx)(xn,{status:Or.status,error:Or.error})]})]}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.detailsHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Q.jsx)(vi,{label:p.settings.name,children:(0,Q.jsx)(`input`,{className:yi(),value:Nn.name,onChange:e=>lr({name:e.target.value})})}),(0,Q.jsx)(vi,{label:p.settings.defaultAgent,children:(0,Q.jsxs)(f,{className:yi(),value:Nn.defaultAgentId,onChange:e=>lr({defaultAgentId:e.target.value},!0),children:[(0,Q.jsx)(m,{value:``,children:p.settings.globalDefaultAgent}),Mt.map(e=>(0,Q.jsx)(m,{value:e.id,children:oe(e,u.agentsSettings)},e.id))]})}),(0,Q.jsx)(vi,{label:p.settings.status,children:Hr?(0,Q.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-inset px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,Q.jsxs)(f,{className:yi(),value:Nn.status===`archived`?`active`:Nn.status,onChange:e=>lr({status:e.target.value},!0),children:[(0,Q.jsx)(m,{value:`active`,children:p.settings.statuses.active}),(0,Q.jsx)(m,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,Q.jsx)(vi,{label:p.settings.executionMode,hint:p.settings.executionModeHint,children:(0,Q.jsxs)(f,{className:yi(),value:Nn.executionMode,onChange:e=>lr({executionMode:e.target.value},!0),children:[(0,Q.jsx)(m,{value:`managed_worktree`,children:p.settings.executionModeWorktree}),(0,Q.jsx)(m,{value:`local_checkout`,children:p.settings.executionModeLocal})]})}),(0,Q.jsx)(vi,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,Q.jsx)(`textarea`,{className:yi(!0),value:Nn.description,onChange:e=>lr({description:e.target.value})})})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.projectGuidanceTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.projectGuidanceHint})]}),(0,Q.jsx)(vi,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,Q.jsx)(`textarea`,{className:yi(!0),value:Nn.brief,onChange:e=>lr({brief:e.target.value})})}),(0,Q.jsx)(vi,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,Q.jsx)(`textarea`,{className:yi(!0),value:Nn.instructions,onChange:e=>lr({instructions:e.target.value})})})]})]}),(0,Q.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.workspaceRoot}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceIndependentHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsx)(`span`,{className:`w-fit rounded-md bg-surface-inset px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Wr?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed}),(0,Q.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Gr,children:Gr}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Yr(),children:[(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),De?(0,Q.jsx)(le,{resourceId:De.fileId,displayName:De.name}):null,(0,Q.jsxs)(H,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:ur,children:[(0,Q.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.currentProjectTitle}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(bi,{label:p.settings.defaultAgent,value:zr}),(0,Q.jsx)(bi,{label:p.settings.pinState,value:Ur?p.settings.pinned:p.settings.notPinned}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Q.jsx)(bi,{label:p.settings.createdAt,value:gi(y.createdAt)||p.common.never}),(0,Q.jsx)(bi,{label:p.settings.updatedAt,value:gi(y.updatedAt)||p.common.never})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.managementHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?p.settings.pinnedTitle:p.settings.pinTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:dn===`pin`,onClick:()=>void pr(),children:[Ur?(0,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(bt,{className:`size-4`,"aria-hidden":!0}),Ur?p.settings.unpinProject:p.settings.pinProject]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Hr?p.settings.restoreTitle:p.settings.archiveTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Hr?p.settings.restoreHint:p.settings.archiveHint})]}),(0,Q.jsxs)(H,{type:`button`,variant:Hr?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:dn===`archive`,onClick:()=>void mr(),children:[Hr?(0,Q.jsx)(me,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)($t,{className:`size-4`,"aria-hidden":!0}),Hr?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,Q.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,Q.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:()=>Yt(!0),children:[(0,Q.jsx)(Vt,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Q.jsx)(R,{open:Jt,onOpenChange:e=>{hn||Yt(e)},children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{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-overlay p-5 shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.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,Q.jsx)(ge,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,Q.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:y?hi(p.settings.deleteConfirm,{name:y.name}):p.settings.deleteConfirmFallback})]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:hn,children:p.common.cancel})}),(0,Q.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:hn||!y,onClick:()=>void hr(),children:[(0,Q.jsx)(Vt,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,Q.jsx)(qt,{open:!!Ne,title:u.workspace.trashConfirmTitle,description:u.workspace.trashConfirmDescription.replace(`{{name}}`,Ne?.name??``),confirmLabel:u.workspace.moveToTrash,cancelLabel:u.workspace.cancel,destructive:!0,onConfirm:()=>void xr(),onCancel:()=>Re(null)}),(0,Q.jsx)(qt,{open:!!Be,title:u.workspace.deleteConfirmTitle,description:u.workspace.deleteConfirmDescription.replace(`{{name}}`,Be?.name??``),confirmLabel:u.workspace.deleteFile,cancelLabel:u.workspace.cancel,destructive:!0,onConfirm:()=>void Cr(),onCancel:()=>We(null)}),(0,Q.jsx)(R,{open:nn,onOpenChange:e=>{Gt||an(e)},children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,Q.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,Q.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,sn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:sn===`fixed`,onChange:()=>cn(`fixed`),disabled:Gt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,Q.jsxs)(`label`,{className:T(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,sn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Q.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:sn===`follow`,onChange:()=>cn(`follow`),disabled:Gt}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,Q.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),sn===`fixed`?(0,Q.jsx)(Ln,{value:ln,onChange:un,disabled:Gt,wd:d,placeholder:p.settings.workspacePlaceholder,inputClassName:yi(),autoFocus:!0}):null,(0,Q.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:p.settings.workspaceMigrationImpact}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-subtle`,children:hi(p.settings.workspaceCurrent,{workspace:Kr})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Gt,children:p.common.cancel})}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Gt||!qr,onClick:()=>void fr(),children:[(0,Q.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Q.jsx)(R,{open:!!Xt,onOpenChange:e=>{e||Qt(null)},children:(0,Q.jsxs)(F,{children:[(0,Q.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(I,{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-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,Q.jsx)(N,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Xt?hi(p.settings.workspaceMissingDescription,{workspace:Xt}):null})]}),Xt?(0,Q.jsx)(`div`,{className:`px-5 py-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(Ot,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:Xt})]})}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Xr,disabled:Gt,children:p.settings.workspaceMissingBack}),(0,Q.jsxs)(H,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void fr({createWorkspaceRoot:!0}),disabled:Gt,children:[(0,Q.jsx)(ut,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})})]})}export{Pi as ProjectDetailPage};
@@ -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{t as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as a,r as o}from"./popover-select-B-GDnZO9.js";import{t as s}from"./plus-Q2yW6OE7.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./cn-JdwAhgNB.js";import{n as u}from"./locale-store-D6VmRI5e.js";import{t as ee}from"./messages-BCqLsIZK.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{t as v}from"./button-CS04eWY9.js";import{t as y}from"./skeleton-BwbyijEw.js";import{$c as b,Co as x,Fa as S,Hc as C,Hr as w,Ia as T,Ja as E,Ka as D,Rc as O,Tl as k,Za as A,ba as j,ca as M,el as N,fa as te,ou as ne,qa as re,sd as P,su as ie,ud as F}from"./index-DhCnwCI9.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:w(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(y,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=u(V),c,l,d,f,p,m,h,g;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,h=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(ie,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),u;t[20]===o?u=t[21]:(u=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=u);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,R.jsx)(P,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=_):_=t[22];let v;t[23]===u?v=t[24]:(v=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,_]}),t[23]=u,t[24]=v),g=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),m=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-xs text-fg-muted`,p=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,d=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=d,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g}else c=t[9],l=t[10],d=t[11],f=t[12],p=t[13],m=t[14],h=t[15],g=t[16];let _;t[25]!==l||t[26]!==d?(_=(0,R.jsx)(`p`,{className:l,children:d}),t[25]=l,t[26]=d,t[27]=_):_=t[27];let y;t[28]!==f||t[29]!==p||t[30]!==_?(y=(0,R.jsxs)(`div`,{className:f,children:[p,_]}),t[28]=f,t[29]=p,t[30]=_,t[31]=y):y=t[31];let x=n.pinnedAt?c.unpin:c.pin,S=n.pinnedAt?c.unpin:c.pin,w;t[32]===n.pinnedAt?w=t[33]:(w=n.pinnedAt?(0,R.jsx)(b,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=w);let T;t[34]!==r||t[35]!==a||t[36]!==x||t[37]!==S||t[38]!==w?(T=(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":x,title:S,children:w}),t[34]=r,t[35]=a,t[36]=x,t[37]=S,t[38]=w,t[39]=T):T=t[39];let E=n.status===`archived`?c.restore:c.archive,D=n.status===`archived`?c.restore:c.archive,O;t[40]===n.status?O=t[41]:(O=n.status===`archived`?(0,R.jsx)(C,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=O);let k;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==D||t[46]!==O?(k=(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:D,children:O}),t[42]=r,t[43]=o,t[44]=E,t[45]=D,t[46]=O,t[47]=k):k=t[47];let A;t[48]!==T||t[49]!==k?(A=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,k]}),t[48]=T,t[49]=k,t[50]=A):A=t[50];let j;t[51]!==A||t[52]!==m||t[53]!==y?(j=(0,R.jsxs)(`div`,{className:m,children:[y,A]}),t[51]=A,t[52]=m,t[53]=y,t[54]=j):j=t[54];let M;return t[55]!==j||t[56]!==h||t[57]!==g?(M=(0,R.jsxs)(`article`,{className:h,children:[g,j]}),t[55]=j,t[56]=h,t[57]=g,t[58]=M):M=t[58],M}function V(e){return e.language}function H(){let e=ee(u(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=x(e=>e.setPageHeader),y=x(e=>e.clearPageHeader),[b,C]=(0,L.useState)([]),[w,N]=(0,L.useState)(!0),[P,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,U]=(0,L.useState)(!1),[fe,W]=(0,L.useState)(null),[G,pe]=(0,L.useState)(!1),[K,me]=(0,L.useState)(!0),[q,he]=(0,L.useState)(``),[J,ge]=(0,L.useState)(``),[Y,_e]=(0,L.useState)(``),X=te({initialPath:Y,onPicked:_e}),Z=(0,L.useRef)(0),Q=(0,L.useCallback)(async(e=!1)=>{let t=++Z.current;e||(N(!0),F(null));try{let e=await D({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&C(ae(e.items))}catch(n){!e&&t===Z.current&&F(n instanceof Error?n.message:String(n))}finally{t===Z.current&&N(!1)}},[]);(0,L.useEffect)(()=>(Q(),()=>{Z.current++}),[Q]),(0,L.useEffect)(()=>{let e=()=>{Q(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return b.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,b,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(v,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ve}),()=>y()),[y,ve,n.title,i]);let ye=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Y.trim();if(!(!t||!n||G)){pe(!0),W(null);try{let e=await T({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});C(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!0),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[G,J,q,Y,K]),be=(0,L.useCallback)(async(e,t)=>{ue(e.id),F(null);try{let n;n=t===`pin`?e.pinnedAt?await A(e.id,e.version):await re(e.id,e.version):e.status===`archived`?await E(e.id,e.version):await S(e.id,e.version),C(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),xe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],Se=xe.find(e=>e.id===H)?.label??t.all,Ce=n.resultCount.replace(`{{status}}`,Se).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-6xl flex-1 flex-col gap-5 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,R.jsx)(_,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(m,{children:[(0,R.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(g,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(f,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ye,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:X.pick,disabled:G||X.picking,children:[X.picking?(0,R.jsx)(k,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(ne,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Y?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:l(`mt-0.5 block truncate font-mono text-xs font-normal`,Y?`text-fg-muted`:`text-fg-subtle`),title:Y||void 0,children:Y||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,R.jsx)(j,{checked:K,onChange:me,disabled:G}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(p,{asChild:!0,children:(0,R.jsx)(v,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(v,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(M,{open:X.modalOpen,onOpenChange:X.setModalOpen,initialAbsolutePath:Y||void 0,onConfirm:X.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Ce}),(0,R.jsxs)(`div`,{className:l(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(O,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(c,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(O,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:xe.map(e=>(0,R.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),P?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:P}),(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,w?(0,R.jsx)(oe,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void be(e,`pin`),onToggleArchive:()=>void be(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(ie,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as a,r as o}from"./popover-select-B-GDnZO9.js";import{t as s}from"./plus-Q2yW6OE7.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./cn-JdwAhgNB.js";import{n as u}from"./locale-store-BrnrrtSS.js";import{t as ee}from"./messages-BoEi2k2p.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{t as v}from"./button-CS04eWY9.js";import{t as y}from"./skeleton-BwbyijEw.js";import{$c as b,Co as x,Fa as S,Hc as C,Ia as w,Ja as T,Jr as E,Ka as D,Rc as O,Tl as k,Za as A,ba as j,ca as M,el as N,fa as te,ou as ne,qa as re,sd as P,su as ie,ud as F}from"./index-DqxyVarz.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:E(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(y,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=u(V),c,l,d,f,p,m,h,g;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,h=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(ie,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),u;t[20]===o?u=t[21]:(u=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=u);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,R.jsx)(P,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=_):_=t[22];let v;t[23]===u?v=t[24]:(v=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,_]}),t[23]=u,t[24]=v),g=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[v,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),m=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-xs text-fg-muted`,p=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),l=`mt-1`,d=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=l,t[11]=d,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g}else c=t[9],l=t[10],d=t[11],f=t[12],p=t[13],m=t[14],h=t[15],g=t[16];let _;t[25]!==l||t[26]!==d?(_=(0,R.jsx)(`p`,{className:l,children:d}),t[25]=l,t[26]=d,t[27]=_):_=t[27];let y;t[28]!==f||t[29]!==p||t[30]!==_?(y=(0,R.jsxs)(`div`,{className:f,children:[p,_]}),t[28]=f,t[29]=p,t[30]=_,t[31]=y):y=t[31];let x=n.pinnedAt?c.unpin:c.pin,S=n.pinnedAt?c.unpin:c.pin,w;t[32]===n.pinnedAt?w=t[33]:(w=n.pinnedAt?(0,R.jsx)(b,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=w);let T;t[34]!==r||t[35]!==a||t[36]!==x||t[37]!==S||t[38]!==w?(T=(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":x,title:S,children:w}),t[34]=r,t[35]=a,t[36]=x,t[37]=S,t[38]=w,t[39]=T):T=t[39];let E=n.status===`archived`?c.restore:c.archive,D=n.status===`archived`?c.restore:c.archive,O;t[40]===n.status?O=t[41]:(O=n.status===`archived`?(0,R.jsx)(C,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=O);let k;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==D||t[46]!==O?(k=(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:D,children:O}),t[42]=r,t[43]=o,t[44]=E,t[45]=D,t[46]=O,t[47]=k):k=t[47];let A;t[48]!==T||t[49]!==k?(A=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,k]}),t[48]=T,t[49]=k,t[50]=A):A=t[50];let j;t[51]!==A||t[52]!==m||t[53]!==y?(j=(0,R.jsxs)(`div`,{className:m,children:[y,A]}),t[51]=A,t[52]=m,t[53]=y,t[54]=j):j=t[54];let M;return t[55]!==j||t[56]!==h||t[57]!==g?(M=(0,R.jsxs)(`article`,{className:h,children:[g,j]}),t[55]=j,t[56]=h,t[57]=g,t[58]=M):M=t[58],M}function V(e){return e.language}function H(){let e=ee(u(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=x(e=>e.setPageHeader),y=x(e=>e.clearPageHeader),[b,C]=(0,L.useState)([]),[E,N]=(0,L.useState)(!0),[P,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,U]=(0,L.useState)(!1),[fe,W]=(0,L.useState)(null),[G,pe]=(0,L.useState)(!1),[K,me]=(0,L.useState)(!0),[q,he]=(0,L.useState)(``),[J,ge]=(0,L.useState)(``),[Y,_e]=(0,L.useState)(``),X=te({initialPath:Y,onPicked:_e}),Z=(0,L.useRef)(0),Q=(0,L.useCallback)(async(e=!1)=>{let t=++Z.current;e||(N(!0),F(null));try{let e=await D({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&C(ae(e.items))}catch(n){!e&&t===Z.current&&F(n instanceof Error?n.message:String(n))}finally{t===Z.current&&N(!1)}},[]);(0,L.useEffect)(()=>(Q(),()=>{Z.current++}),[Q]),(0,L.useEffect)(()=>{let e=()=>{Q(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return b.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,b,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(v,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(s,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ve}),()=>y()),[y,ve,n.title,i]);let ye=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Y.trim();if(!(!t||!n||G)){pe(!0),W(null);try{let e=await w({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});C(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!0),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[G,J,q,Y,K]),be=(0,L.useCallback)(async(e,t)=>{ue(e.id),F(null);try{let n;n=t===`pin`?e.pinnedAt?await A(e.id,e.version):await re(e.id,e.version):e.status===`archived`?await T(e.id,e.version):await S(e.id,e.version),C(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),xe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],Se=xe.find(e=>e.id===H)?.label??t.all,Ce=n.resultCount.replace(`{{status}}`,Se).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-6xl flex-1 flex-col gap-5 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,R.jsx)(_,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(m,{children:[(0,R.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(g,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(f,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ye,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:X.pick,disabled:G||X.picking,children:[X.picking?(0,R.jsx)(k,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(ne,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Y?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:l(`mt-0.5 block truncate font-mono text-xs font-normal`,Y?`text-fg-muted`:`text-fg-subtle`),title:Y||void 0,children:Y||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,R.jsx)(j,{checked:K,onChange:me,disabled:G}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(p,{asChild:!0,children:(0,R.jsx)(v,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(v,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(M,{open:X.modalOpen,onOpenChange:X.setModalOpen,initialAbsolutePath:Y||void 0,onConfirm:X.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Ce}),(0,R.jsxs)(`div`,{className:l(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(O,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(c,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(O,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:xe.map(e=>(0,R.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),P?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:P}),(0,R.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,E?(0,R.jsx)(oe,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void be(e,`pin`),onToggleArchive:()=>void be(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(ie,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-swr-BIWyz7Rc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{r as t}from"./locale-store-D6VmRI5e.js";import{t as n}from"./gateway-startup-retry-oRRqSoe9.js";async function r(){let e=await n(t(`/api/models`));if(!e.ok)throw Error(`Models: HTTP ${e.status}`);return(await e.json()).payload?.models??[]}var i=null,a=0,o=null,s=6e4,c=`gateway-configured-models`;async function l(){i=null,a=0;let{mutate:t}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await t(c)}async function u(e=!1){if(!e&&i&&Date.now()<a)return i;if(e){let e=await r();return i=e,a=Date.now()+s,e}return o||(o=r().then(e=>(i=e,a=Date.now()+s,e)).finally(()=>{o=null}),o)}export{u as n,l as r,c as t};
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{r as t}from"./locale-store-BrnrrtSS.js";import{t as n}from"./gateway-startup-retry-FZix2Im1.js";async function r(){let e=await n(t(`/api/models`));if(!e.ok)throw Error(`Models: HTTP ${e.status}`);return(await e.json()).payload?.models??[]}var i=null,a=0,o=null,s=6e4,c=`gateway-configured-models`;async function l(){i=null,a=0;let{mutate:t}=await e(async()=>{let{mutate:e}=await import(`./vendor-swr-BIWyz7Rc.js`).then(e=>e.r);return{mutate:e}},__vite__mapDeps([0,1,2]));await t(c)}async function u(e=!1){if(!e&&i&&Date.now()<a)return i;if(e){let e=await r();return i=e,a=Date.now()+s,e}return o||(o=r().then(e=>(i=e,a=Date.now()+s,e)).finally(()=>{o=null}),o)}export{u as n,l as r,c as t};