@xopcai/xopc 0.0.299 → 0.0.302

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 (140) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-C-DSdak3.js → activity-store-DCi5rh4e.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BnrB5fWD.js → agent-avatar-dicebear-C0zP6W2B.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D0ITeUFb.js +1 -0
  6. package/dist/gateway/static/root/assets/{agents-DNxSNGao.js → agents-DcfWhk2S.js} +1 -1
  7. package/dist/gateway/static/root/assets/{api-DS4w0i5N.js → api-CAV9PN9i.js} +1 -1
  8. package/dist/gateway/static/root/assets/api-fPapljyb.js +1 -0
  9. package/dist/gateway/static/root/assets/app-management-settings-panel-U3yDRzKF.js +1 -0
  10. package/dist/gateway/static/root/assets/appearance-settings-ZFjV_opr.js +1 -0
  11. package/dist/gateway/static/root/assets/apps-page-FgMHY1Pr.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-CISHdvCz.js → archive-plugin-MaKWrpgC.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-c0q_Q6IQ.js → attachment-load-IfqbP2BN.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-BOiNdKcv.js → automations-page-CeI2NGSO.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-workspace-DxaiBwrD.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-BO1hALPX.js → binary-plugins-jvQ6FaBZ.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-BWzZ4hDH.js → block-editor-B7U3qlB3.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-automation-inputs-DvwCwLOp.js → browser-automation-inputs-BGT0xoTv.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-automations-page-B8LfUUco.js → browser-automations-page-DvLAwoiQ.js} +1 -1
  20. package/dist/gateway/static/root/assets/browser-settings-page-CHrfg3BX.js +3 -0
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-DpYDPk_o.js +8 -0
  22. package/dist/gateway/static/root/assets/{channels-settings-BBX7Gp4q.js → channels-settings-DMq-NBUQ.js} +1 -1
  23. package/dist/gateway/static/root/assets/{channels-status-swr-CgtFOwNh.js → channels-status-swr-C_icwbWj.js} +1 -1
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-CLYsf1w_.js → chat-terminal-dock-BtL71IOs.js} +1 -1
  25. package/dist/gateway/static/root/assets/computer-settings-page-Bu6ZJtmS.js +1 -0
  26. package/dist/gateway/static/root/assets/{connectors-page-BVUnp0UV.js → connectors-page-LsEiI9L5.js} +1 -1
  27. package/dist/gateway/static/root/assets/{cron-expression-DKSgHs4I.js → cron-expression-B25FHn4w.js} +1 -1
  28. package/dist/gateway/static/root/assets/{date-picker-DRTglPVS.js → date-picker-CzVHO7z9.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-_-7WsbTH.js → dependency-picker-BNugauiZ.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-CR7n2K67.js → desktop-pet-DTy_3-OY.js} +1 -1
  31. package/dist/gateway/static/root/assets/desktop-pet-settings-CXfnejTb.js +1 -0
  32. package/dist/gateway/static/root/assets/device-pairing-wizard-CxKwfncn.js +1 -0
  33. package/dist/gateway/static/root/assets/extension-debug-page-C3F7RiGW.js +1 -0
  34. package/dist/gateway/static/root/assets/{extension-page-EZC07dGv.js → extension-page-C0jhcCT_.js} +1 -1
  35. package/dist/gateway/static/root/assets/extension-settings-page-CNvJQkrr.js +1 -0
  36. package/dist/gateway/static/root/assets/figtree-latin-ext-wght-normal-DCwSJGxG.woff2 +0 -0
  37. package/dist/gateway/static/root/assets/figtree-latin-wght-normal-D_ZTVpCC.woff2 +0 -0
  38. package/dist/gateway/static/root/assets/{gateway-config-swr-B2xVR9gt.js → gateway-config-swr-D5AM8cyQ.js} +1 -1
  39. package/dist/gateway/static/root/assets/gateway-settings-CQTcIvlZ.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-startup-retry-c7s8h7px.js → gateway-startup-retry-CSJWdnFs.js} +1 -1
  41. package/dist/gateway/static/root/assets/{heartbeat-settings-BAMr_vYa.js → heartbeat-settings-Cd1VJsHe.js} +1 -1
  42. package/dist/gateway/static/root/assets/{home-page-DG19Sjrn.js → home-page-B_uyfCGq.js} +1 -1
  43. package/dist/gateway/static/root/assets/{image-generation-api-DUjbV88R.js → image-generation-api-BNh604hw.js} +1 -1
  44. package/dist/gateway/static/root/assets/{imports-page-BaQmVh_d.js → imports-page-DXNfRmk9.js} +1 -1
  45. package/dist/gateway/static/root/assets/index-BAqVpc1H.css +1 -0
  46. package/dist/gateway/static/root/assets/index-hlU8MUEz.js +79 -0
  47. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CgW5_XVP.js +1 -0
  48. package/dist/gateway/static/root/assets/{local-app-workbench-page-h48NEuKs.js → local-app-workbench-page-C4h3qDRL.js} +2 -2
  49. package/dist/gateway/static/root/assets/{local-apps-page-DFMrfoGF.js → local-apps-page-DyrFxW3G.js} +1 -1
  50. package/dist/gateway/static/root/assets/{locale-store-CwuCkjo7.js → locale-store-DLK05Y1a.js} +1 -1
  51. package/dist/gateway/static/root/assets/logs-page-Goy_QHfL.js +2 -0
  52. package/dist/gateway/static/root/assets/{management-settings-Dib_yIDQ.js → management-settings-DgQyGEpR.js} +1 -1
  53. package/dist/gateway/static/root/assets/{markdown-view-3YQc6QFV.js → markdown-view-B8maDRWh.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins-DlZXjN6z.js → media-plugins-5DakFba_.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-C9h8SImu.js +3 -0
  56. package/dist/gateway/static/root/assets/note-detail-panel-lcZby9NY.js +5 -0
  57. package/dist/gateway/static/root/assets/notes-page-CDGPPI-W.js +8 -0
  58. package/dist/gateway/static/root/assets/{page-tabs-BLzm5EXm.js → page-tabs-DzJpglJJ.js} +1 -1
  59. package/dist/gateway/static/root/assets/{preview-open-alternatives-B6QLKIZy.js → preview-open-alternatives-Dj6LJsuQ.js} +1 -1
  60. package/dist/gateway/static/root/assets/{proactive-page-W_uN2_ie.js → proactive-page-CwudBdrQ.js} +1 -1
  61. package/dist/gateway/static/root/assets/{product-open-page-DLm3cUhY.js → product-open-page-CujZXOea.js} +1 -1
  62. package/dist/gateway/static/root/assets/project-detail-page-CyAf_sK-.js +1 -0
  63. package/dist/gateway/static/root/assets/{projects-page-DT7zmH0f.js → projects-page-BW5m_HhZ.js} +1 -1
  64. package/dist/gateway/static/root/assets/{registry-api-Cxx1-pCg.js → registry-api-BMFL4vis.js} +1 -1
  65. package/dist/gateway/static/root/assets/remote-access-hub-B4JgwB0s.js +1 -0
  66. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DV554qyN.js +5 -0
  67. package/dist/gateway/static/root/assets/{schema-form-BTLg2fN1.js → schema-form-Bh2Er67B.js} +1 -1
  68. package/dist/gateway/static/root/assets/sessions-page-D5SmvlQ1.js +1 -0
  69. package/dist/gateway/static/root/assets/settings-advanced-gate-DDALROy_.js +1 -0
  70. package/dist/gateway/static/root/assets/settings-form-section-BsdM7P1d.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-page-BR9XJ0j9.js → settings-page-3yEAqoME.js} +1 -1
  72. package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +1 -0
  73. package/dist/gateway/static/root/assets/{setup-status-panel-BSo76NwE.js → setup-status-panel-BOHNZ-S3.js} +1 -1
  74. package/dist/gateway/static/root/assets/{share-preview-page-Dx2IpPEp.js → share-preview-page-wV056nz2.js} +1 -1
  75. package/dist/gateway/static/root/assets/shares-settings-io4NzfJL.js +1 -0
  76. package/dist/gateway/static/root/assets/skill-reload-api-CERFaxLj.js +1 -0
  77. package/dist/gateway/static/root/assets/{skills-page-CaX9EQtn.js → skills-page-CtwUqvsE.js} +1 -1
  78. package/dist/gateway/static/root/assets/{skills-page.utils-CxWdcFKs.js → skills-page.utils-dHBD7YqU.js} +1 -1
  79. package/dist/gateway/static/root/assets/{system-settings-panel-BkiXkDSq.js → system-settings-panel-lItR5Kah.js} +1 -1
  80. package/dist/gateway/static/root/assets/task-detail-page-CCKc67a-.js +1 -0
  81. package/dist/gateway/static/root/assets/{theme-store-Dt7ob2wD.js → theme-store-KfFEGMlp.js} +1 -1
  82. package/dist/gateway/static/root/assets/tunnel-api-DPyLgmWw.js +1 -0
  83. package/dist/gateway/static/root/assets/{use-autosave-BHxjmV8l.js → use-autosave-DO50_g_S.js} +1 -1
  84. package/dist/gateway/static/root/assets/user-model-page-CcnGgH1n.js +2 -0
  85. package/dist/gateway/static/root/assets/{voice-api-key-field-BCNM-BaQ.js → voice-api-key-field-k7tWLXzM.js} +1 -1
  86. package/dist/gateway/static/root/assets/{voice-config-api-De1DTzxK.js → voice-config-api-bZqN8-UF.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-tig5sF-Q.js → work-discovery-overlay-BHI6gO_u.js} +1 -1
  88. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-OcS30LVZ.js → workflow-run-setup-panel-jEMtNIG8.js} +1 -1
  89. package/dist/gateway/static/root/assets/workflows-page-CX4bcAD-.js +6 -0
  90. package/dist/gateway/static/root/index.html +10 -10
  91. package/dist/package.js +1 -1
  92. package/dist/src/agent/service/process-direct-one-shot.js +1 -0
  93. package/dist/src/config/schema.js +1 -1
  94. package/dist/src/gateway/automation-agent-session.js +9 -2
  95. package/dist/src/gateway/heartbeat/service.js +2 -2
  96. package/dist/src/gateway/service/config-coordinator.js +1 -1
  97. package/dist/src/gateway/service/run-gateway-agent.js +2 -3
  98. package/dist/src/heartbeat/index.js +1 -1
  99. package/dist/src/notifications/plain-text.d.ts +1 -0
  100. package/dist/src/notifications/plain-text.js +14 -0
  101. package/dist/src/notifications/planner.js +2 -1
  102. package/dist/src/storage/sqlite/session-repository.js +21 -1
  103. package/dist/src/storage/sqlite/transcript-repository.js +11 -2
  104. package/dist/src/workflows/service/workflow-session-bridge.js +5 -1
  105. package/package.json +5 -5
  106. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CaA7l5Xv.js +0 -1
  107. package/dist/gateway/static/root/assets/api-BhJmc8E-.js +0 -1
  108. package/dist/gateway/static/root/assets/app-management-settings-panel-Dfrcz-vZ.js +0 -1
  109. package/dist/gateway/static/root/assets/appearance-settings-BLB_xmtb.js +0 -1
  110. package/dist/gateway/static/root/assets/apps-page-Bg-7fqIS.js +0 -1
  111. package/dist/gateway/static/root/assets/automations-workspace-DDdsNbjH.js +0 -6
  112. package/dist/gateway/static/root/assets/browser-settings-page-BtZbX85K.js +0 -3
  113. package/dist/gateway/static/root/assets/capabilities-settings-panel-mNpAFqTf.js +0 -8
  114. package/dist/gateway/static/root/assets/computer-model-settings-DYWcZu2X.js +0 -1
  115. package/dist/gateway/static/root/assets/computer-settings-page-B4pC7mRs.js +0 -1
  116. package/dist/gateway/static/root/assets/desktop-pet-settings-Bu7g83kd.js +0 -1
  117. package/dist/gateway/static/root/assets/device-pairing-wizard-D5z7BvaO.js +0 -1
  118. package/dist/gateway/static/root/assets/extension-debug-page-BI8pvu2u.js +0 -1
  119. package/dist/gateway/static/root/assets/extension-settings-page-DLYC6gVA.js +0 -1
  120. package/dist/gateway/static/root/assets/gateway-settings-C17LDur8.js +0 -1
  121. package/dist/gateway/static/root/assets/index-B7JCOaCc.js +0 -81
  122. package/dist/gateway/static/root/assets/index-Bt6a_Yxc.css +0 -2
  123. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-DfNQK_hR.js +0 -1
  124. package/dist/gateway/static/root/assets/logs-page-CD9MfQDD.js +0 -2
  125. package/dist/gateway/static/root/assets/messages-D6CRVWtT.js +0 -3
  126. package/dist/gateway/static/root/assets/note-detail-panel-CS0W3ESn.js +0 -5
  127. package/dist/gateway/static/root/assets/notes-page-BNMVGN6Y.js +0 -8
  128. package/dist/gateway/static/root/assets/project-detail-page-Gfze4S0P.js +0 -1
  129. package/dist/gateway/static/root/assets/remote-access-hub-CXQkXSU2.js +0 -1
  130. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DHkNbhpP.js +0 -5
  131. package/dist/gateway/static/root/assets/sessions-page-CxTLRoxv.js +0 -1
  132. package/dist/gateway/static/root/assets/settings-advanced-gate-BgtDlDZh.js +0 -1
  133. package/dist/gateway/static/root/assets/settings-form-section-D9rWLTBX.js +0 -1
  134. package/dist/gateway/static/root/assets/settings-page-layout-CsUQKRq0.js +0 -1
  135. package/dist/gateway/static/root/assets/shares-settings-BMF0Bo06.js +0 -1
  136. package/dist/gateway/static/root/assets/skill-reload-api-DNBw3BJR.js +0 -1
  137. package/dist/gateway/static/root/assets/task-detail-page-UBuGZQkl.js +0 -1
  138. package/dist/gateway/static/root/assets/tunnel-api-CEXwG7vJ.js +0 -1
  139. package/dist/gateway/static/root/assets/user-model-page-Dvtr3CPj.js +0 -2
  140. package/dist/gateway/static/root/assets/workflows-page-AqlMn0Bx.js +0 -6
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{n as l}from"./locale-store-CwuCkjo7.js";import{t as u}from"./messages-D6CRVWtT.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{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-CGlRPNzi.js";import{t as b}from"./skeleton-BwbyijEw.js";import{$l as x,Ds as S,Hr as C,Is as w,Ls as T,Lu as E,Mu as D,Ns as O,Nu as k,So as A,Vo as j,Ws as M,Zc as ee,bc as N,bi as P,ci as F,cn as te,li as ne,ln as re,ma as ie,on as ae,pl as I,r as oe,sn as L,yi as se}from"./index-B7JCOaCc.js";import{t as ce}from"./api-BhJmc8E-.js";import{n as le}from"./tab-completion-input-D64VNmiA.js";var R=n(),z=r(),B={meeting_preparation:{Icon:E,en:`Next meeting`,zh:`下一场会议`},project_momentum:{Icon:x,en:`Project momentum`,zh:`项目进展`},communication_follow_up:{Icon:I,en:`Waiting on a reply`,zh:`沟通跟进`}},ue={needs_decision:{en:`Needs your decision`,zh:`需要你决定`},prepared:{en:`Ready for you`,zh:`已为你准备好`},changed:{en:`Something changed`,zh:`出现了新变化`},following:{en:`Following quietly`,zh:`正在安静跟进`}};function V(e){let t=(0,R.c)(56),{scene:n,zh:r}=e,i=B[n.kind],o=ue[n.status],s=n.card?`/assistant-work?item=${encodeURIComponent(n.card.id)}`:n.object?.route??n.manageRoute,c=n.status===`needs_decision`?r?`查看并决定`:`Review and decide`:n.status===`prepared`?r?`查看准备结果`:`Open prepared work`:n.status===`changed`?r?`查看变化`:`Review change`:n.object?r?`打开${n.kind===`project_momentum`?`项目`:`相关内容`}`:`Open context`:r?`查看安排`:`View arrangement`,l;t[0]===i.Icon?l=t[1]:(l=(0,z.jsx)(`span`,{className:`mt-0.5 rounded-xl bg-accent-soft p-2 text-accent`,children:(0,z.jsx)(i.Icon,{className:`size-4`,"aria-hidden":!0})}),t[0]=i.Icon,t[1]=l);let u=r?i.zh:i.en,d;t[2]===u?d=t[3]:(d=(0,z.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f=n.status===`following`?`text-xs text-fg-subtle`:`text-xs font-medium text-accent`,p=r?o.zh:o.en,m;t[4]!==f||t[5]!==p?(m=(0,z.jsx)(`span`,{className:f,children:p}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]!==d||t[8]!==m?(h=(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[d,m]}),t[7]=d,t[8]=m,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,z.jsx)(`h3`,{className:`mt-1 font-semibold text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==h||t[13]!==g?(_=(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==_?(v=(0,z.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-5 py-4`,children:[l,_]}),t[15]=l,t[16]=_,t[17]=v):v=t[17];let y=r?`现在`:`Now`,b;t[18]===y?b=t[19]:(b=(0,z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:y}),t[18]=y,t[19]=b);let x;t[20]===n.moment?x=t[21]:(x=(0,z.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:n.moment}),t[20]=n.moment,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,z.jsxs)(`div`,{children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=n.status===`following`?r?`跟进要求`:`What the assistant remembers`:r?`为什么值得关注`:`Why it matters`,w;t[25]===C?w=t[26]:(w=(0,z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:C}),t[25]=C,t[26]=w);let T=n.status===`following`?n.promise:n.relevance,E;t[27]===T?E=t[28]:(E=(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[27]=T,t[28]=E);let D;t[29]!==w||t[30]!==E?(D=(0,z.jsxs)(`div`,{children:[w,E]}),t[29]=w,t[30]=E,t[31]=D):D=t[31];let O=r?`助理已经做了什么`:`What your assistant did`,k;t[32]===O?k=t[33]:(k=(0,z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:O}),t[32]=O,t[33]=k);let A;t[34]===n.help?A=t[35]:(A=(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:n.help}),t[34]=n.help,t[35]=A);let j;t[36]!==k||t[37]!==A?(j=(0,z.jsxs)(`div`,{className:`rounded-xl bg-surface-hover px-4 py-3`,children:[k,A]}),t[36]=k,t[37]=A,t[38]=j):j=t[38];let M;t[39]!==c||t[40]!==s?(M=(0,z.jsx)(a,{className:`text-sm font-medium text-accent`,to:s,children:c}),t[39]=c,t[40]=s,t[41]=M):M=t[41];let ee=r?`调整助理跟进`:`Adjust arrangement`,N;t[42]!==n.manageRoute||t[43]!==ee?(N=(0,z.jsx)(a,{className:`text-xs text-fg-subtle hover:text-fg`,to:n.manageRoute,children:ee}),t[42]=n.manageRoute,t[43]=ee,t[44]=N):N=t[44];let P;t[45]!==M||t[46]!==N?(P=(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[M,N]}),t[45]=M,t[46]=N,t[47]=P):P=t[47];let F;t[48]!==S||t[49]!==D||t[50]!==j||t[51]!==P?(F=(0,z.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[S,D,j,P]}),t[48]=S,t[49]=D,t[50]=j,t[51]=P,t[52]=F):F=t[52];let te;return t[53]!==v||t[54]!==F?(te=(0,z.jsxs)(`article`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[v,F]}),t[53]=v,t[54]=F,t[55]=te):te=t[55],te}function de(e){let t=(0,R.c)(42),{compact:n}=e,r=n===void 0?!1:n,i=l(H)===`zh`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={refreshInterval:15e3},t[0]=o):o=t[0];let s=v(`/api/proactive/overview`,ce,o);if(s.isLoading){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(b,{className:`h-44 rounded-2xl`}),t[1]=e):e=t[1],e}if(s.error){let e=String(s.error),n;return t[2]===e?n=t[3]:(n=(0,z.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e}),t[2]=e,t[3]=n),n}let c;t[4]===s.data?.scenes?c=t[5]:(c=s.data?.scenes??[],t[4]=s.data?.scenes,t[5]=c);let u=c;if(!u.length){let e=r?`px-4 text-center`:`rounded-2xl border border-edge bg-surface-panel p-6`,n=r?`text-sm font-medium text-fg-muted`:`font-medium text-fg`,a=i?`今天没有需要你接手的变化`:`Nothing needs your attention today`,o;t[6]!==n||t[7]!==a?(o=(0,z.jsx)(`h2`,{className:n,children:a}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s=r?`mx-auto mt-2 max-w-lg text-xs leading-5 text-fg-subtle`:`mt-2 text-sm text-fg-muted`,c=i?`继续工作即可。需要持续关注的事,可以直接在项目或对话里交给助理。`:`Keep working. You can ask the assistant to follow something from its project or conversation.`,l;t[9]!==s||t[10]!==c?(l=(0,z.jsx)(`p`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11];let u;return t[12]!==l||t[13]!==e||t[14]!==o?(u=(0,z.jsxs)(`section`,{className:e,children:[o,l]}),t[12]=l,t[13]=e,t[14]=o,t[15]=u):u=t[15],u}let d;t[16]!==r||t[17]!==u?(d=r?u.slice(0,3):u,t[16]=r,t[17]=u,t[18]=d):d=t[18];let f=d,p=i?`正在发生的事`:`What is happening`,m;t[19]===p?m=t[20]:(m=(0,z.jsx)(`h2`,{id:`proactive-scenes-title`,className:`text-sm font-semibold text-fg`,children:p}),t[19]=p,t[20]=m);let h=i?`助理跟进`:`Assistant follow-ups`,g;t[21]===h?g=t[22]:(g=(0,z.jsx)(a,{className:`text-xs text-fg-subtle hover:text-accent`,to:`/assistant-work`,children:h}),t[21]=h,t[22]=g);let _;t[23]!==m||t[24]!==g?(_=(0,z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 px-1`,children:[m,g]}),t[23]=m,t[24]=g,t[25]=_):_=t[25];let y;if(t[26]!==f||t[27]!==i){let e;t[29]===i?e=t[30]:(e=e=>(0,z.jsx)(V,{scene:e,zh:i},e.id),t[29]=i,t[30]=e),y=f.map(e),t[26]=f,t[27]=i,t[28]=y}else y=t[28];let x;t[31]===y?x=t[32]:(x=(0,z.jsx)(`div`,{className:`space-y-3`,children:y}),t[31]=y,t[32]=x);let S;t[33]!==r||t[34]!==u.length||t[35]!==f.length||t[36]!==i?(S=r&&u.length>f.length&&(0,z.jsx)(a,{className:`mt-3 block text-sm text-accent`,to:`/assistant-work`,children:i?`还有 ${u.length-f.length} 个场景`:`${u.length-f.length} more scenes`}),t[33]=r,t[34]=u.length,t[35]=f.length,t[36]=i,t[37]=S):S=t[37];let C;return t[38]!==x||t[39]!==S||t[40]!==_?(C=(0,z.jsxs)(`section`,{"aria-labelledby":`proactive-scenes-title`,children:[_,x,S]}),t[38]=x,t[39]=S,t[40]=_,t[41]=C):C=t[41],C}function H(e){return e.language}var U=e(t(),1),fe=12e3;function W(e){let t=(0,R.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:l,attachmentBusy:u,attachmentsFull:d,voice:f,chat:p,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:_,onPaste:v,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,w=n===`inline`,T;t[0]!==s||t[1]!==a?(T=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=T):T=t[2];let E=T,D=f.voiceActive&&f.phase!==`error`,O;t[3]!==C||t[4]!==f.voiceActive?(O=e=>{if(f.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=f.voiceActive,t[5]=O):O=t[5];let k=w?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=c(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==w||t[9]!==l||t[10]!==o.dropFiles?(j=l?(0,z.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,w&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=w,t[9]=l,t[10]=o.dropFiles,t[11]=j):j=t[11];let M=!w&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,P;t[12]===M?P=t[13]:(P=c(M),t[12]=M,t[13]=P);let F=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,re;t[14]!==r||t[15]!==o.intentLabel||t[16]!==F?(re=(0,z.jsx)(`label`,{htmlFor:r,className:F,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=F,t[17]=re):re=t[17];let ie;t[18]!==u||t[19]!==p||t[20]!==f.audioLevel||t[21]!==f.cancelVoiceInput||t[22]!==f.confirmVoiceInput||t[23]!==f.elapsedLabel||t[24]!==f.error||t[25]!==f.finalTranscript||t[26]!==f.partialTranscript||t[27]!==f.phase||t[28]!==f.retryVoiceInput||t[29]!==f.settingsRequired||t[30]!==f.voiceActive?(ie=f.voiceActive?(0,z.jsx)(te,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:u,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=u,t[19]=p,t[20]=f.audioLevel,t[21]=f.cancelVoiceInput,t[22]=f.confirmVoiceInput,t[23]=f.elapsedLabel,t[24]=f.error,t[25]=f.finalTranscript,t[26]=f.partialTranscript,t[27]=f.phase,t[28]=f.retryVoiceInput,t[29]=f.settingsRequired,t[30]=f.voiceActive,t[31]=ie):ie=t[31];let ae=D&&`hidden`,I=w?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,oe;t[32]!==ae||t[33]!==I?(oe=c(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,ae,I),t[32]=ae,t[33]=I,t[34]=oe):oe=t[34];let L;t[35]===h?L=t[36]:(L=e=>h(e.target.value),t[35]=h,t[36]=L);let ce=!w,B;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==h||t[43]!==v||t[44]!==oe||t[45]!==L||t[46]!==ce?(B=(0,z.jsx)(le,{ref:i,id:r,className:oe,value:a,onChange:L,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:pe,placeholder:o.intentPlaceholder,maxLength:fe,autoFocus:ce}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=h,t[43]=v,t[44]=oe,t[45]=L,t[46]=ce,t[47]=B):B=t[47];let ue=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,V;t[48]!==s||t[49]!==_||t[50]!==ue?(V=(0,z.jsx)(se,{attachments:s,topPadded:!1,onRemove:_,className:ue}),t[48]=s,t[49]=_,t[50]=ue,t[51]=V):V=t[51];let de;t[52]!==w||t[53]!==a.length||t[54]!==o.shortcut?(de=w?null:(0,z.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,z.jsx)(`span`,{children:o.shortcut}),(0,z.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,fe.toLocaleString()]})]}),t[52]=w,t[53]=a.length,t[54]=o.shortcut,t[55]=de):de=t[55];let H;t[56]!==ie||t[57]!==B||t[58]!==V||t[59]!==de||t[60]!==P||t[61]!==re?(H=(0,z.jsxs)(`div`,{className:P,children:[re,ie,B,V,de]}),t[56]=ie,t[57]=B,t[58]=V,t[59]=de,t[60]=P,t[61]=re,t[62]=H):H=t[62];let U=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,W;t[63]===U?W=t[64]:(W=c(`flex shrink-0 items-center gap-2 border-t`,U),t[63]=U,t[64]=W);let G=!w&&`mr-auto`,me;t[65]===G?me=t[66]:(me=c(`flex items-center gap-1`,G),t[65]=G,t[66]=me);let he=u||d,ge;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,z.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[67]=ge):ge=t[67];let K;t[68]!==o.attachTitle||t[69]!==g||t[70]!==he?(K=(0,z.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:he,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:ge}),t[68]=o.attachTitle,t[69]=g,t[70]=he,t[71]=K):K=t[71];let q;t[72]!==u||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(q=f.voiceActive?null:(0,z.jsx)(ne,{disabled:u,chat:p,onStart:f.startVoiceInput}),t[72]=u,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=q):q=t[76];let J;t[77]!==me||t[78]!==K||t[79]!==q?(J=(0,z.jsxs)(`div`,{className:me,children:[K,q]}),t[77]=me,t[78]=K,t[79]=q,t[80]=J):J=t[80];let Y;t[81]!==m||t[82]!==w||t[83]!==o.shortcut?(Y=w?(0,z.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[81]=m,t[82]=w,t[83]=o.shortcut,t[84]=Y):Y=t[84];let _e=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,X=!E||u||f.voiceActive,Z=w?`size-3.5`:`size-4`,Q;t[85]===Z?Q=t[86]:(Q=(0,z.jsx)(N,{className:Z,"aria-hidden":!0}),t[85]=Z,t[86]=Q);let $;t[87]!==o.submit||t[88]!==_e||t[89]!==X||t[90]!==Q?($=(0,z.jsxs)(y,{type:`submit`,variant:`primary`,className:_e,disabled:X,children:[Q,o.submit]}),t[87]=o.submit,t[88]=_e,t[89]=X,t[90]=Q,t[91]=$):$=t[91];let ve;t[92]!==W||t[93]!==J||t[94]!==Y||t[95]!==$?(ve=(0,z.jsxs)(`div`,{className:W,children:[J,Y,$]}),t[92]=W,t[93]=J,t[94]=Y,t[95]=$,t[96]=ve):ve=t[96];let ye;return t[97]!==x||t[98]!==b||t[99]!==S||t[100]!==O||t[101]!==H||t[102]!==ve||t[103]!==A||t[104]!==j?(ye=(0,z.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[j,H,ve]}),t[97]=x,t[98]=b,t[99]=S,t[100]=O,t[101]=H,t[102]=ve,t[103]=A,t[104]=j,t[105]=ye):ye=t[105],ye}function pe(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function G(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function me(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(b,{className:`h-10 w-3/5 rounded-xl`}),(0,z.jsx)(b,{className:`h-5 w-4/5 rounded-lg`})]}),(0,z.jsx)(b,{className:`h-64 rounded-2xl`}),(0,z.jsx)(b,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function he(e){let t=(0,R.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${C(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,z.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,z.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,z.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,z.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,z.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.recommendation||t[20]!==i?(v=n.recommendation?(0,z.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,z.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=v):v=t[21];let b;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(b=n.primaryAction||n.secondaryActions.length>0?(0,z.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,z.jsx)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,z.jsx)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=b):b=t[27];let x;return t[28]!==f||t[29]!==_||t[30]!==v||t[31]!==b?(x=(0,z.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,_,v,b]}),t[28]=f,t[29]=_,t[30]=v,t[31]=b,t[32]=x):x=t[32],x}function ge(e){let t=(0,R.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,z.jsx)(E,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let a=i,o=!n.openAction,s;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(s=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,z.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:a}),t[6]=a,t[7]=c);let l;t[8]===n.title?l=t[9]:(l=(0,z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=l);let u;t[10]===n.summary?u=t[11]:(u=(0,z.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===n.statusLabel?f=t[16]:(f=n.statusLabel?(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=f);let p;t[17]===n.openAction?p=t[18]:(p=n.openAction?(0,z.jsx)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=p);let m;return t[19]!==o||t[20]!==s||t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p?(m=(0,z.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:o,onClick:s,children:[c,d,f,p]}),t[19]=o,t[20]=s,t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m):m=t[25],m}function K(){let e=l(e=>e.language),t=u(e),n=t.projectsPage,r=M(e),a=i(),c=A(e=>e.setPageHeader),b=A(e=>e.clearPageHeader),[x,C]=(0,U.useState)(null),[E,k]=(0,U.useState)(!0),[ee,N]=(0,U.useState)(null),[te,ne]=(0,U.useState)(!1),[I,se]=(0,U.useState)(``),[le,R]=(0,U.useState)(null),[B,ue]=(0,U.useState)(!1),V=F({chat:t.chat}),H=(0,U.useRef)(null),fe=j({disabled:B,chat:t.chat,onTranscript:e=>{se(t=>re(t,e)),window.setTimeout(()=>H.current?.focus(),0)}}),{phase:pe,voiceActive:K,startVoiceInput:q,cancelVoiceInput:J,confirmVoiceInput:Y,retryVoiceInput:_e}=fe,X=(0,U.useCallback)(async(t=!1)=>{t&&k(!0),N(null);try{let t=await O(e);C({...t,needsUser:t.needsUser.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`),background:t.background.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`)})}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,U.useEffect)(()=>{X(!0)},[X]),(0,U.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,X()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[X]);let Z=(0,U.useCallback)(async e=>{if(!(e.length===0||B)){ue(!0);try{await V.processFiles(e)}finally{ue(!1)}}},[B,V.processFiles]),Q=(0,U.useCallback)(async e=>{let t=P(e.clipboardData);t.length!==0&&(e.preventDefault(),await Z(t))},[Z]),$=(0,U.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,V.setIsDragging(!0))},[V.setIsDragging]),ve=(0,U.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&V.setIsDragging(!1)},[V.setIsDragging]),ye=(0,U.useCallback)(async e=>{e.preventDefault(),V.setIsDragging(!1),await Z(Array.from(e.dataTransfer.files))},[V.setIsDragging,Z]),be=(0,U.useCallback)(e=>{e.preventDefault();let t=V.wireAttachmentsPayload(),n=ie(I,t.length>0?oe(t):void 0,{projectScope:`none`});n&&(ne(!1),se(``),V.clearAttachments(),a(n))},[V.clearAttachments,V.wireAttachmentsPayload,I,a]),xe=V.attachments.length>=10,Se={attachTitle:xe?G(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${V.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Ce=v(`/api/proactive/overview`,ce,{refreshInterval:15e3}),we=!!Ce.data?.scenes.some(e=>e.status===`prepared`),Te=!!Ce.data?.scenes.some(e=>e.status===`changed`),Ee=!!Ce.data?.scenes.some(e=>e.status===`following`),De=!!Ce.data?.scenes.length,Oe=!!(x&&x.needsUser.length===0&&x.backgroundCount===0&&Ce.data&&!De),ke=Oe||te;(0,U.useEffect)(()=>{!ke&&K&&J()},[J,ke,K]),(0,U.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||B||(e.preventDefault(),pe===`recording`?Y():pe===`idle`?(H.current?.focus(),q()):pe===`error`&&_e())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||!K||(e.preventDefault(),J(),H.current?.focus())};return window.addEventListener(L,e),window.addEventListener(ae,t),()=>{window.removeEventListener(L,e),window.removeEventListener(ae,t)}},[B,J,ke,Y,_e,q,K,pe]);let Ae=(0,U.useCallback)(e=>{e||J(),ne(e)},[J]),je=(0,U.useMemo)(()=>Oe?null:(0,z.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>ne(!0),children:[(0,z.jsx)(o,{className:`size-4`,"aria-hidden":!0}),r.newWork]}),[r.newWork,Oe]),Me=(0,U.useCallback)((e,t)=>{if(e.type===`open`){a(e.href);return}if(e.type===`review_judgment`){a(`/assistant-work?item=${encodeURIComponent(e.itemId)}`);return}R(t),N(null),(async()=>{try{e.type===`connector_decision`?await w({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await T({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await S({kind:e.subjectKind,runId:e.runId}),await X()}catch(e){N(e instanceof Error?e.message:String(e))}finally{R(null)}})()},[X,a]);(0,U.useLayoutEffect)(()=>(c({startExtra:null,main:(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:je}),()=>b()),[b,je,c,n.title]);let Ne=(x?.needsUser.length??0)+(Ce.data?.scenes.filter(e=>e.status===`needs_decision`).length??0),Pe=x?.backgroundCount??0,Fe=Ne>0?G(n.home.attentionTitle,{count:Ne}):we?e===`zh`?`助理准备好了这些`:`Your assistant prepared these`:Te?e===`zh`?`有一些值得知道的变化`:`A few changes are worth knowing`:Pe>0?n.home.clearTitle:Ee?e===`zh`?`助理在跟进你交代的事`:`Your assistant is following through`:Ce.data?n.home.idleTitle:e===`zh`?`今天的工作`:`Your work today`,Ie=Ne>0?Pe>0?G(n.home.attentionIntroWithBackground,{count:Pe}):n.home.attentionIntro:we?e===`zh`?`成果已经整理好,可以直接查看或继续办理。`:`The results are ready to review or continue.`:Te?e===`zh`?`这里是可能影响你当前工作的最新变化。`:`These changes may affect your current work.`:Pe>0?G(n.home.clearIntro,{count:Pe}):Ee?e===`zh`?`助理记着这些事项,有实质进展时会带回来。`:`Your assistant remembers these items and will bring back useful progress.`:Ce.data?n.home.idleIntro:e===`zh`?`正在核对已交代的事项。`:`Checking your delegated work.`;return(0,z.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 py-8 sm:px-6 lg:px-8 lg:py-12`,children:[(0,z.jsx)(`input`,{ref:V.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Z(Array.from(t)),e.target.value=``}}),(0,z.jsx)(_,{open:te,onOpenChange:Ae,children:(0,z.jsxs)(m,{children:[(0,z.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,z.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,z.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(g,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,z.jsx)(f,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,z.jsx)(p,{asChild:!0,children:(0,z.jsx)(y,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,z.jsx)(s,{className:`size-4`,"aria-hidden":!0})})})]}),(0,z.jsx)(W,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:H,intent:I,labels:{...Se,submit:r.submit},attachments:V.attachments,isDragging:V.isDragging,attachmentBusy:B,attachmentsFull:xe,voice:fe,chat:t.chat,cancelAction:(0,z.jsx)(p,{asChild:!0,children:(0,z.jsx)(y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:se,onPickFiles:()=>V.fileInputRef.current?.click(),onRemoveAttachment:V.removeAttachment,onPaste:e=>void Q(e),onDragOver:$,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be})]})]})}),ee?(0,z.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,z.jsx)(`span`,{children:ee}),(0,z.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void X(),children:n.home.retry})]}):null,E?(0,z.jsx)(me,{}):x?(0,z.jsxs)(`div`,{className:Oe?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,z.jsxs)(`section`,{className:Oe?`w-full text-center`:`max-w-3xl`,children:[(0,z.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:Fe}),(0,z.jsx)(`p`,{className:Oe?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:Ie}),Oe?(0,z.jsx)(W,{variant:`inline`,inputId:`idle-conversation-intent`,inputRef:H,intent:I,labels:Se,attachments:V.attachments,isDragging:V.isDragging,attachmentBusy:B,attachmentsFull:xe,voice:fe,chat:t.chat,onIntentChange:se,onPickFiles:()=>V.fileInputRef.current?.click(),onRemoveAttachment:V.removeAttachment,onPaste:e=>void Q(e),onDragOver:$,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be}):null]}),x.needsUser.length>0?(0,z.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,z.jsx)(D,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,z.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,z.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:x.needsUser.map(t=>(0,z.jsx)(he,{item:t,busy:le===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Me},t.id))})]}):null,(0,z.jsx)(`section`,{className:Oe?`mt-6 sm:mt-8`:`mt-10`,children:(0,z.jsx)(de,{compact:!0})}),x.background.length>0?(0,z.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,z.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:G(n.home.backgroundCount,{count:x.backgroundCount})})]}),(0,z.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:x.background.map(e=>(0,z.jsx)(ge,{item:e,onAction:Me},e.id))})]}):null]}):null]})}export{K as HomePage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{n as l}from"./locale-store-DLK05Y1a.js";import{t as u}from"./messages-C9h8SImu.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{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-CGlRPNzi.js";import{t as b}from"./skeleton-BwbyijEw.js";import{$l as x,Ds as S,Hr as C,Is as w,Ls as T,Lu as E,Mu as D,Ns as O,Nu as k,So as A,Vo as j,Ws as M,Zc as ee,bc as N,bi as P,ci as F,cn as te,li as ne,ln as re,ma as ie,on as ae,pl as I,r as oe,sn as L,yi as se}from"./index-hlU8MUEz.js";import{t as ce}from"./api-fPapljyb.js";import{n as le}from"./tab-completion-input-D64VNmiA.js";var R=n(),z=r(),B={meeting_preparation:{Icon:E,en:`Next meeting`,zh:`下一场会议`},project_momentum:{Icon:x,en:`Project momentum`,zh:`项目进展`},communication_follow_up:{Icon:I,en:`Waiting on a reply`,zh:`沟通跟进`}},ue={needs_decision:{en:`Needs your decision`,zh:`需要你决定`},prepared:{en:`Ready for you`,zh:`已为你准备好`},changed:{en:`Something changed`,zh:`出现了新变化`},following:{en:`Following quietly`,zh:`正在安静跟进`}};function V(e){let t=(0,R.c)(56),{scene:n,zh:r}=e,i=B[n.kind],o=ue[n.status],s=n.card?`/assistant-work?item=${encodeURIComponent(n.card.id)}`:n.object?.route??n.manageRoute,c=n.status===`needs_decision`?r?`查看并决定`:`Review and decide`:n.status===`prepared`?r?`查看准备结果`:`Open prepared work`:n.status===`changed`?r?`查看变化`:`Review change`:n.object?r?`打开${n.kind===`project_momentum`?`项目`:`相关内容`}`:`Open context`:r?`查看安排`:`View arrangement`,l;t[0]===i.Icon?l=t[1]:(l=(0,z.jsx)(`span`,{className:`mt-0.5 rounded-xl bg-accent-soft p-2 text-accent`,children:(0,z.jsx)(i.Icon,{className:`size-4`,"aria-hidden":!0})}),t[0]=i.Icon,t[1]=l);let u=r?i.zh:i.en,d;t[2]===u?d=t[3]:(d=(0,z.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f=n.status===`following`?`text-xs text-fg-subtle`:`text-xs font-medium text-accent`,p=r?o.zh:o.en,m;t[4]!==f||t[5]!==p?(m=(0,z.jsx)(`span`,{className:f,children:p}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]!==d||t[8]!==m?(h=(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[d,m]}),t[7]=d,t[8]=m,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,z.jsx)(`h3`,{className:`mt-1 font-semibold text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==h||t[13]!==g?(_=(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==_?(v=(0,z.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-5 py-4`,children:[l,_]}),t[15]=l,t[16]=_,t[17]=v):v=t[17];let y=r?`现在`:`Now`,b;t[18]===y?b=t[19]:(b=(0,z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:y}),t[18]=y,t[19]=b);let x;t[20]===n.moment?x=t[21]:(x=(0,z.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:n.moment}),t[20]=n.moment,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,z.jsxs)(`div`,{children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=n.status===`following`?r?`跟进要求`:`What the assistant remembers`:r?`为什么值得关注`:`Why it matters`,w;t[25]===C?w=t[26]:(w=(0,z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:C}),t[25]=C,t[26]=w);let T=n.status===`following`?n.promise:n.relevance,E;t[27]===T?E=t[28]:(E=(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[27]=T,t[28]=E);let D;t[29]!==w||t[30]!==E?(D=(0,z.jsxs)(`div`,{children:[w,E]}),t[29]=w,t[30]=E,t[31]=D):D=t[31];let O=r?`助理已经做了什么`:`What your assistant did`,k;t[32]===O?k=t[33]:(k=(0,z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:O}),t[32]=O,t[33]=k);let A;t[34]===n.help?A=t[35]:(A=(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:n.help}),t[34]=n.help,t[35]=A);let j;t[36]!==k||t[37]!==A?(j=(0,z.jsxs)(`div`,{className:`rounded-xl bg-surface-hover px-4 py-3`,children:[k,A]}),t[36]=k,t[37]=A,t[38]=j):j=t[38];let M;t[39]!==c||t[40]!==s?(M=(0,z.jsx)(a,{className:`text-sm font-medium text-accent`,to:s,children:c}),t[39]=c,t[40]=s,t[41]=M):M=t[41];let ee=r?`调整助理跟进`:`Adjust arrangement`,N;t[42]!==n.manageRoute||t[43]!==ee?(N=(0,z.jsx)(a,{className:`text-xs text-fg-subtle hover:text-fg`,to:n.manageRoute,children:ee}),t[42]=n.manageRoute,t[43]=ee,t[44]=N):N=t[44];let P;t[45]!==M||t[46]!==N?(P=(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[M,N]}),t[45]=M,t[46]=N,t[47]=P):P=t[47];let F;t[48]!==S||t[49]!==D||t[50]!==j||t[51]!==P?(F=(0,z.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[S,D,j,P]}),t[48]=S,t[49]=D,t[50]=j,t[51]=P,t[52]=F):F=t[52];let te;return t[53]!==v||t[54]!==F?(te=(0,z.jsxs)(`article`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[v,F]}),t[53]=v,t[54]=F,t[55]=te):te=t[55],te}function de(e){let t=(0,R.c)(42),{compact:n}=e,r=n===void 0?!1:n,i=l(H)===`zh`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={refreshInterval:15e3},t[0]=o):o=t[0];let s=v(`/api/proactive/overview`,ce,o);if(s.isLoading){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(b,{className:`h-44 rounded-2xl`}),t[1]=e):e=t[1],e}if(s.error){let e=String(s.error),n;return t[2]===e?n=t[3]:(n=(0,z.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e}),t[2]=e,t[3]=n),n}let c;t[4]===s.data?.scenes?c=t[5]:(c=s.data?.scenes??[],t[4]=s.data?.scenes,t[5]=c);let u=c;if(!u.length){let e=r?`px-4 text-center`:`rounded-2xl border border-edge bg-surface-panel p-6`,n=r?`text-sm font-medium text-fg-muted`:`font-medium text-fg`,a=i?`今天没有需要你接手的变化`:`Nothing needs your attention today`,o;t[6]!==n||t[7]!==a?(o=(0,z.jsx)(`h2`,{className:n,children:a}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s=r?`mx-auto mt-2 max-w-lg text-xs leading-5 text-fg-subtle`:`mt-2 text-sm text-fg-muted`,c=i?`继续工作即可。需要持续关注的事,可以直接在项目或对话里交给助理。`:`Keep working. You can ask the assistant to follow something from its project or conversation.`,l;t[9]!==s||t[10]!==c?(l=(0,z.jsx)(`p`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11];let u;return t[12]!==l||t[13]!==e||t[14]!==o?(u=(0,z.jsxs)(`section`,{className:e,children:[o,l]}),t[12]=l,t[13]=e,t[14]=o,t[15]=u):u=t[15],u}let d;t[16]!==r||t[17]!==u?(d=r?u.slice(0,3):u,t[16]=r,t[17]=u,t[18]=d):d=t[18];let f=d,p=i?`正在发生的事`:`What is happening`,m;t[19]===p?m=t[20]:(m=(0,z.jsx)(`h2`,{id:`proactive-scenes-title`,className:`text-sm font-semibold text-fg`,children:p}),t[19]=p,t[20]=m);let h=i?`助理跟进`:`Assistant follow-ups`,g;t[21]===h?g=t[22]:(g=(0,z.jsx)(a,{className:`text-xs text-fg-subtle hover:text-accent`,to:`/assistant-work`,children:h}),t[21]=h,t[22]=g);let _;t[23]!==m||t[24]!==g?(_=(0,z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 px-1`,children:[m,g]}),t[23]=m,t[24]=g,t[25]=_):_=t[25];let y;if(t[26]!==f||t[27]!==i){let e;t[29]===i?e=t[30]:(e=e=>(0,z.jsx)(V,{scene:e,zh:i},e.id),t[29]=i,t[30]=e),y=f.map(e),t[26]=f,t[27]=i,t[28]=y}else y=t[28];let x;t[31]===y?x=t[32]:(x=(0,z.jsx)(`div`,{className:`space-y-3`,children:y}),t[31]=y,t[32]=x);let S;t[33]!==r||t[34]!==u.length||t[35]!==f.length||t[36]!==i?(S=r&&u.length>f.length&&(0,z.jsx)(a,{className:`mt-3 block text-sm text-accent`,to:`/assistant-work`,children:i?`还有 ${u.length-f.length} 个场景`:`${u.length-f.length} more scenes`}),t[33]=r,t[34]=u.length,t[35]=f.length,t[36]=i,t[37]=S):S=t[37];let C;return t[38]!==x||t[39]!==S||t[40]!==_?(C=(0,z.jsxs)(`section`,{"aria-labelledby":`proactive-scenes-title`,children:[_,x,S]}),t[38]=x,t[39]=S,t[40]=_,t[41]=C):C=t[41],C}function H(e){return e.language}var U=e(t(),1),fe=12e3;function W(e){let t=(0,R.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:l,attachmentBusy:u,attachmentsFull:d,voice:f,chat:p,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:_,onPaste:v,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,w=n===`inline`,T;t[0]!==s||t[1]!==a?(T=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=T):T=t[2];let E=T,D=f.voiceActive&&f.phase!==`error`,O;t[3]!==C||t[4]!==f.voiceActive?(O=e=>{if(f.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=f.voiceActive,t[5]=O):O=t[5];let k=w?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=c(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==w||t[9]!==l||t[10]!==o.dropFiles?(j=l?(0,z.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,w&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=w,t[9]=l,t[10]=o.dropFiles,t[11]=j):j=t[11];let M=!w&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,P;t[12]===M?P=t[13]:(P=c(M),t[12]=M,t[13]=P);let F=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,re;t[14]!==r||t[15]!==o.intentLabel||t[16]!==F?(re=(0,z.jsx)(`label`,{htmlFor:r,className:F,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=F,t[17]=re):re=t[17];let ie;t[18]!==u||t[19]!==p||t[20]!==f.audioLevel||t[21]!==f.cancelVoiceInput||t[22]!==f.confirmVoiceInput||t[23]!==f.elapsedLabel||t[24]!==f.error||t[25]!==f.finalTranscript||t[26]!==f.partialTranscript||t[27]!==f.phase||t[28]!==f.retryVoiceInput||t[29]!==f.settingsRequired||t[30]!==f.voiceActive?(ie=f.voiceActive?(0,z.jsx)(te,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:u,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=u,t[19]=p,t[20]=f.audioLevel,t[21]=f.cancelVoiceInput,t[22]=f.confirmVoiceInput,t[23]=f.elapsedLabel,t[24]=f.error,t[25]=f.finalTranscript,t[26]=f.partialTranscript,t[27]=f.phase,t[28]=f.retryVoiceInput,t[29]=f.settingsRequired,t[30]=f.voiceActive,t[31]=ie):ie=t[31];let ae=D&&`hidden`,I=w?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,oe;t[32]!==ae||t[33]!==I?(oe=c(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,ae,I),t[32]=ae,t[33]=I,t[34]=oe):oe=t[34];let L;t[35]===h?L=t[36]:(L=e=>h(e.target.value),t[35]=h,t[36]=L);let ce=!w,B;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==h||t[43]!==v||t[44]!==oe||t[45]!==L||t[46]!==ce?(B=(0,z.jsx)(le,{ref:i,id:r,className:oe,value:a,onChange:L,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:pe,placeholder:o.intentPlaceholder,maxLength:fe,autoFocus:ce}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=h,t[43]=v,t[44]=oe,t[45]=L,t[46]=ce,t[47]=B):B=t[47];let ue=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,V;t[48]!==s||t[49]!==_||t[50]!==ue?(V=(0,z.jsx)(se,{attachments:s,topPadded:!1,onRemove:_,className:ue}),t[48]=s,t[49]=_,t[50]=ue,t[51]=V):V=t[51];let de;t[52]!==w||t[53]!==a.length||t[54]!==o.shortcut?(de=w?null:(0,z.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,z.jsx)(`span`,{children:o.shortcut}),(0,z.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,fe.toLocaleString()]})]}),t[52]=w,t[53]=a.length,t[54]=o.shortcut,t[55]=de):de=t[55];let H;t[56]!==ie||t[57]!==B||t[58]!==V||t[59]!==de||t[60]!==P||t[61]!==re?(H=(0,z.jsxs)(`div`,{className:P,children:[re,ie,B,V,de]}),t[56]=ie,t[57]=B,t[58]=V,t[59]=de,t[60]=P,t[61]=re,t[62]=H):H=t[62];let U=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,W;t[63]===U?W=t[64]:(W=c(`flex shrink-0 items-center gap-2 border-t`,U),t[63]=U,t[64]=W);let G=!w&&`mr-auto`,me;t[65]===G?me=t[66]:(me=c(`flex items-center gap-1`,G),t[65]=G,t[66]=me);let he=u||d,ge;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,z.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[67]=ge):ge=t[67];let K;t[68]!==o.attachTitle||t[69]!==g||t[70]!==he?(K=(0,z.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:he,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:ge}),t[68]=o.attachTitle,t[69]=g,t[70]=he,t[71]=K):K=t[71];let q;t[72]!==u||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(q=f.voiceActive?null:(0,z.jsx)(ne,{disabled:u,chat:p,onStart:f.startVoiceInput}),t[72]=u,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=q):q=t[76];let J;t[77]!==me||t[78]!==K||t[79]!==q?(J=(0,z.jsxs)(`div`,{className:me,children:[K,q]}),t[77]=me,t[78]=K,t[79]=q,t[80]=J):J=t[80];let Y;t[81]!==m||t[82]!==w||t[83]!==o.shortcut?(Y=w?(0,z.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[81]=m,t[82]=w,t[83]=o.shortcut,t[84]=Y):Y=t[84];let _e=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,X=!E||u||f.voiceActive,Z=w?`size-3.5`:`size-4`,Q;t[85]===Z?Q=t[86]:(Q=(0,z.jsx)(N,{className:Z,"aria-hidden":!0}),t[85]=Z,t[86]=Q);let $;t[87]!==o.submit||t[88]!==_e||t[89]!==X||t[90]!==Q?($=(0,z.jsxs)(y,{type:`submit`,variant:`primary`,className:_e,disabled:X,children:[Q,o.submit]}),t[87]=o.submit,t[88]=_e,t[89]=X,t[90]=Q,t[91]=$):$=t[91];let ve;t[92]!==W||t[93]!==J||t[94]!==Y||t[95]!==$?(ve=(0,z.jsxs)(`div`,{className:W,children:[J,Y,$]}),t[92]=W,t[93]=J,t[94]=Y,t[95]=$,t[96]=ve):ve=t[96];let ye;return t[97]!==x||t[98]!==b||t[99]!==S||t[100]!==O||t[101]!==H||t[102]!==ve||t[103]!==A||t[104]!==j?(ye=(0,z.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[j,H,ve]}),t[97]=x,t[98]=b,t[99]=S,t[100]=O,t[101]=H,t[102]=ve,t[103]=A,t[104]=j,t[105]=ye):ye=t[105],ye}function pe(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function G(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function me(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(b,{className:`h-10 w-3/5 rounded-xl`}),(0,z.jsx)(b,{className:`h-5 w-4/5 rounded-lg`})]}),(0,z.jsx)(b,{className:`h-64 rounded-2xl`}),(0,z.jsx)(b,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function he(e){let t=(0,R.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${C(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,z.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,z.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,z.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,z.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,z.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.recommendation||t[20]!==i?(v=n.recommendation?(0,z.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,z.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=v):v=t[21];let b;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(b=n.primaryAction||n.secondaryActions.length>0?(0,z.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,z.jsx)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,z.jsx)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=b):b=t[27];let x;return t[28]!==f||t[29]!==_||t[30]!==v||t[31]!==b?(x=(0,z.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,_,v,b]}),t[28]=f,t[29]=_,t[30]=v,t[31]=b,t[32]=x):x=t[32],x}function ge(e){let t=(0,R.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,z.jsx)(E,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let a=i,o=!n.openAction,s;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(s=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,z.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:a}),t[6]=a,t[7]=c);let l;t[8]===n.title?l=t[9]:(l=(0,z.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=l);let u;t[10]===n.summary?u=t[11]:(u=(0,z.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===n.statusLabel?f=t[16]:(f=n.statusLabel?(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=f);let p;t[17]===n.openAction?p=t[18]:(p=n.openAction?(0,z.jsx)(k,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=p);let m;return t[19]!==o||t[20]!==s||t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p?(m=(0,z.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:o,onClick:s,children:[c,d,f,p]}),t[19]=o,t[20]=s,t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m):m=t[25],m}function K(){let e=l(e=>e.language),t=u(e),n=t.projectsPage,r=M(e),a=i(),c=A(e=>e.setPageHeader),b=A(e=>e.clearPageHeader),[x,C]=(0,U.useState)(null),[E,k]=(0,U.useState)(!0),[ee,N]=(0,U.useState)(null),[te,ne]=(0,U.useState)(!1),[I,se]=(0,U.useState)(``),[le,R]=(0,U.useState)(null),[B,ue]=(0,U.useState)(!1),V=F({chat:t.chat}),H=(0,U.useRef)(null),fe=j({disabled:B,chat:t.chat,onTranscript:e=>{se(t=>re(t,e)),window.setTimeout(()=>H.current?.focus(),0)}}),{phase:pe,voiceActive:K,startVoiceInput:q,cancelVoiceInput:J,confirmVoiceInput:Y,retryVoiceInput:_e}=fe,X=(0,U.useCallback)(async(t=!1)=>{t&&k(!0),N(null);try{let t=await O(e);C({...t,needsUser:t.needsUser.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`),background:t.background.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`)})}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,U.useEffect)(()=>{X(!0)},[X]),(0,U.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,X()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[X]);let Z=(0,U.useCallback)(async e=>{if(!(e.length===0||B)){ue(!0);try{await V.processFiles(e)}finally{ue(!1)}}},[B,V.processFiles]),Q=(0,U.useCallback)(async e=>{let t=P(e.clipboardData);t.length!==0&&(e.preventDefault(),await Z(t))},[Z]),$=(0,U.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,V.setIsDragging(!0))},[V.setIsDragging]),ve=(0,U.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&V.setIsDragging(!1)},[V.setIsDragging]),ye=(0,U.useCallback)(async e=>{e.preventDefault(),V.setIsDragging(!1),await Z(Array.from(e.dataTransfer.files))},[V.setIsDragging,Z]),be=(0,U.useCallback)(e=>{e.preventDefault();let t=V.wireAttachmentsPayload(),n=ie(I,t.length>0?oe(t):void 0,{projectScope:`none`});n&&(ne(!1),se(``),V.clearAttachments(),a(n))},[V.clearAttachments,V.wireAttachmentsPayload,I,a]),xe=V.attachments.length>=10,Se={attachTitle:xe?G(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${V.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Ce=v(`/api/proactive/overview`,ce,{refreshInterval:15e3}),we=!!Ce.data?.scenes.some(e=>e.status===`prepared`),Te=!!Ce.data?.scenes.some(e=>e.status===`changed`),Ee=!!Ce.data?.scenes.some(e=>e.status===`following`),De=!!Ce.data?.scenes.length,Oe=!!(x&&x.needsUser.length===0&&x.backgroundCount===0&&Ce.data&&!De),ke=Oe||te;(0,U.useEffect)(()=>{!ke&&K&&J()},[J,ke,K]),(0,U.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||B||(e.preventDefault(),pe===`recording`?Y():pe===`idle`?(H.current?.focus(),q()):pe===`error`&&_e())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||!K||(e.preventDefault(),J(),H.current?.focus())};return window.addEventListener(L,e),window.addEventListener(ae,t),()=>{window.removeEventListener(L,e),window.removeEventListener(ae,t)}},[B,J,ke,Y,_e,q,K,pe]);let Ae=(0,U.useCallback)(e=>{e||J(),ne(e)},[J]),je=(0,U.useMemo)(()=>Oe?null:(0,z.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>ne(!0),children:[(0,z.jsx)(o,{className:`size-4`,"aria-hidden":!0}),r.newWork]}),[r.newWork,Oe]),Me=(0,U.useCallback)((e,t)=>{if(e.type===`open`){a(e.href);return}if(e.type===`review_judgment`){a(`/assistant-work?item=${encodeURIComponent(e.itemId)}`);return}R(t),N(null),(async()=>{try{e.type===`connector_decision`?await w({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await T({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await S({kind:e.subjectKind,runId:e.runId}),await X()}catch(e){N(e instanceof Error?e.message:String(e))}finally{R(null)}})()},[X,a]);(0,U.useLayoutEffect)(()=>(c({startExtra:null,main:(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:je}),()=>b()),[b,je,c,n.title]);let Ne=(x?.needsUser.length??0)+(Ce.data?.scenes.filter(e=>e.status===`needs_decision`).length??0),Pe=x?.backgroundCount??0,Fe=Ne>0?G(n.home.attentionTitle,{count:Ne}):we?e===`zh`?`助理准备好了这些`:`Your assistant prepared these`:Te?e===`zh`?`有一些值得知道的变化`:`A few changes are worth knowing`:Pe>0?n.home.clearTitle:Ee?e===`zh`?`助理在跟进你交代的事`:`Your assistant is following through`:Ce.data?n.home.idleTitle:e===`zh`?`今天的工作`:`Your work today`,Ie=Ne>0?Pe>0?G(n.home.attentionIntroWithBackground,{count:Pe}):n.home.attentionIntro:we?e===`zh`?`成果已经整理好,可以直接查看或继续办理。`:`The results are ready to review or continue.`:Te?e===`zh`?`这里是可能影响你当前工作的最新变化。`:`These changes may affect your current work.`:Pe>0?G(n.home.clearIntro,{count:Pe}):Ee?e===`zh`?`助理记着这些事项,有实质进展时会带回来。`:`Your assistant remembers these items and will bring back useful progress.`:Ce.data?n.home.idleIntro:e===`zh`?`正在核对已交代的事项。`:`Checking your delegated work.`;return(0,z.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 py-8 sm:px-6 lg:px-8 lg:py-12`,children:[(0,z.jsx)(`input`,{ref:V.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Z(Array.from(t)),e.target.value=``}}),(0,z.jsx)(_,{open:te,onOpenChange:Ae,children:(0,z.jsxs)(m,{children:[(0,z.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,z.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,z.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(g,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,z.jsx)(f,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,z.jsx)(p,{asChild:!0,children:(0,z.jsx)(y,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,z.jsx)(s,{className:`size-4`,"aria-hidden":!0})})})]}),(0,z.jsx)(W,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:H,intent:I,labels:{...Se,submit:r.submit},attachments:V.attachments,isDragging:V.isDragging,attachmentBusy:B,attachmentsFull:xe,voice:fe,chat:t.chat,cancelAction:(0,z.jsx)(p,{asChild:!0,children:(0,z.jsx)(y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:se,onPickFiles:()=>V.fileInputRef.current?.click(),onRemoveAttachment:V.removeAttachment,onPaste:e=>void Q(e),onDragOver:$,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be})]})]})}),ee?(0,z.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,z.jsx)(`span`,{children:ee}),(0,z.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void X(),children:n.home.retry})]}):null,E?(0,z.jsx)(me,{}):x?(0,z.jsxs)(`div`,{className:Oe?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,z.jsxs)(`section`,{className:Oe?`w-full text-center`:`max-w-3xl`,children:[(0,z.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:Fe}),(0,z.jsx)(`p`,{className:Oe?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:Ie}),Oe?(0,z.jsx)(W,{variant:`inline`,inputId:`idle-conversation-intent`,inputRef:H,intent:I,labels:Se,attachments:V.attachments,isDragging:V.isDragging,attachmentBusy:B,attachmentsFull:xe,voice:fe,chat:t.chat,onIntentChange:se,onPickFiles:()=>V.fileInputRef.current?.click(),onRemoveAttachment:V.removeAttachment,onPaste:e=>void Q(e),onDragOver:$,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be}):null]}),x.needsUser.length>0?(0,z.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,z.jsx)(D,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,z.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,z.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:x.needsUser.map(t=>(0,z.jsx)(he,{item:t,busy:le===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Me},t.id))})]}):null,(0,z.jsx)(`section`,{className:Oe?`mt-6 sm:mt-8`:`mt-10`,children:(0,z.jsx)(de,{compact:!0})}),x.background.length>0?(0,z.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,z.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:G(n.home.backgroundCount,{count:x.backgroundCount})})]}),(0,z.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:x.background.map(e=>(0,z.jsx)(ge,{item:e,onAction:Me},e.id))})]}):null]}):null]})}export{K as HomePage};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./locale-store-CwuCkjo7.js";async function n(){let n=await e(t(`/api/image-generation/catalog`));if(!Array.isArray(n.payload?.providers))throw Error(`Invalid image provider catalog`);return n.payload.providers}async function r(){let n=await e(t(`/api/image-generation/custom-providers`));if(!Array.isArray(n.payload?.providers))throw Error(`Invalid custom image provider list`);return n.payload.providers}async function i(n,r){await e(t(`/api/image-generation/custom-providers/${encodeURIComponent(n)}`),{method:`PUT`,body:JSON.stringify(r)})}async function a(n){await e(t(`/api/image-generation/custom-providers/${encodeURIComponent(n)}`),{method:`DELETE`})}async function o(n,r){await e(t(`/api/image-generation/providers/${encodeURIComponent(n)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:r})})}async function s(n,r){let i=await e(t(`/api/image-generation/providers/${encodeURIComponent(n)}/test`),{method:`POST`,body:JSON.stringify({modelId:r})});if(!Array.isArray(i.payload?.images))throw Error(`Invalid image generation test response`);return{images:i.payload.images}}export{o as a,i,r as n,s as o,n as r,a as t};
1
+ import{a as e,r as t}from"./locale-store-DLK05Y1a.js";async function n(){let n=await e(t(`/api/image-generation/catalog`));if(!Array.isArray(n.payload?.providers))throw Error(`Invalid image provider catalog`);return n.payload.providers}async function r(){let n=await e(t(`/api/image-generation/custom-providers`));if(!Array.isArray(n.payload?.providers))throw Error(`Invalid custom image provider list`);return n.payload.providers}async function i(n,r){await e(t(`/api/image-generation/custom-providers/${encodeURIComponent(n)}`),{method:`PUT`,body:JSON.stringify(r)})}async function a(n){await e(t(`/api/image-generation/custom-providers/${encodeURIComponent(n)}`),{method:`DELETE`})}async function o(n,r){await e(t(`/api/image-generation/providers/${encodeURIComponent(n)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:r})})}async function s(n,r){let i=await e(t(`/api/image-generation/providers/${encodeURIComponent(n)}/test`),{method:`POST`,body:JSON.stringify({modelId:r})});if(!Array.isArray(i.payload?.images))throw Error(`Invalid image generation test response`);return{images:i.payload.images}}export{o as a,i,r as n,s as o,n as r,a as t};
@@ -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-Cq1tE_3b.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./x-B_N4OPjy.js";import{a as c,n as ee,r as l}from"./locale-store-CwuCkjo7.js";import{t as te}from"./messages-D6CRVWtT.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./button-CGlRPNzi.js";import{i as v,o as y}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as b,r as x}from"./settings-page-layout-CsUQKRq0.js";import{n as ne}from"./settings-loading-skeleton-CAmWMaOT.js";var S=e(t(),1);async function C(e,t,n){return(await c(l(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var w=n();function T(e){return e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`}function E(e,t,n,r){let i=new Set(t);if(!T(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&T(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var D=r();function O(e){let t=(0,w.c)(45),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:c,locked:l,error:b,onClose:x,onRefresh:C,onSubmit:O}=e,R=te(ee(re)).imports,[z,ae]=(0,S.useState)(``),oe;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>ae(``),t[0]=oe):oe=t[0];let se=i?.id,B;t[1]===se?B=t[2]:(B=[se],t[1]=se,t[2]=B),(0,S.useEffect)(oe,B);let V;t[3]===z?V=t[4]:(V=e=>`${e.name} ${e.description} ${e.displayPath}`.toLowerCase().includes(z.toLowerCase().trim()),t[3]=z,t[4]=V);let H=V,U=i?.candidates.filter(e=>a.has(e.id))??[],ce=R.selected.replace(`{skills}`,String(U.filter(L).length)).replace(`{context}`,String(U.filter(I).length)).replace(`{projects}`,String(U.filter(F).length)),W;t[5]!==i||t[6]!==o||t[7]!==a?(W=(e,t)=>{i&&o(E(i,a,e,t))},t[5]=i,t[6]=o,t[7]=a,t[8]=W):W=t[8];let le=W,ue=e=>{let t=i.candidates.filter(t=>t.kind===e&&!t.parentId);if(!t.length)return null;let n=t.filter(H);return(0,D.jsxs)(`section`,{className:`space-y-2`,"aria-label":R.kinds[e],children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsxs)(`h3`,{className:`text-sm font-medium text-fg`,children:[R.kinds[e],` · `,t.filter(e=>a.has(e.id)).length,`/`,t.length]}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(_,{variant:`ghost`,disabled:l||!n.some(T),onClick:()=>{let e=new Set(a);n.filter(T).forEach(t=>e.add(t.id)),o(e)},children:R.selectVisible}),(0,D.jsx)(_,{variant:`ghost`,disabled:l,onClick:()=>{let e=new Set(a);n.forEach(t=>e.delete(t.id)),o(e)},children:R.clearVisible})]})]}),n.map(e=>(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)},e.id))]})},G;t[9]===x?G=t[10]:(G=e=>{e||x()},t[9]=x,t[10]=G);let K;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,D.jsx)(u,{className:`fixed inset-0 bg-scrim ${y}`}),t[11]=K):K=t[11];let de;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,D.jsx)(s,{className:`h-4 w-4`}),t[12]=de):de=t[12];let fe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>ae(e.target.value),t[13]=fe):fe=t[13];let pe=b&&(0,D.jsxs)(`div`,{role:`alert`,className:`space-y-2 rounded-lg border border-edge p-3 text-sm text-fg`,children:[(0,D.jsx)(`p`,{children:b}),(0,D.jsx)(_,{variant:`secondary`,disabled:l,onClick:C,children:R.refresh})]}),q;t[14]!==b||t[15]!==i?(q=!i&&!b&&(0,D.jsx)(ne,{sections:2}),t[14]=b,t[15]=i,t[16]=q):q=t[16];let me=i&&(0,D.jsxs)(D.Fragment,{children:[!i.complete&&(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R.incomplete}),ue(`skill`),ue(`context`),(0,D.jsxs)(`section`,{"aria-label":R.kinds.project,className:`space-y-2`,children:[(0,D.jsxs)(`h3`,{className:`text-sm font-medium text-fg`,children:[R.kinds.project,` · `,U.filter(P).length,`/`,i.candidates.filter(N).length]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.projectHint}),i.candidates.filter(M).map(e=>{let t=i.candidates.filter(t=>t.parentId===e.id);return!H(e)&&!t.some(H)?null:(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)}),t.length?(0,D.jsxs)(`details`,{open:z.trim()?!0:void 0,className:`mt-2 text-sm text-fg-muted`,children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer`,children:[R.projectContents.replace(`{skills}`,String(t.filter(j).length)).replace(`{context}`,String(t.filter(A).length)),` · `,R.chosenCount.replace(`{count}`,String(t.filter(e=>a.has(e.id)).length))]}),(0,D.jsx)(`div`,{className:`mt-2 space-y-2 border-l border-edge pl-3`,children:t.filter(t=>H(e)||H(t)).map(e=>(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)},e.id))})]}):(0,D.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:R.directoryOnly})]},e.id)})]}),!i.candidates.length&&(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R.noContent}),!!i.notices.length&&(0,D.jsxs)(`details`,{className:`text-sm text-fg-muted`,children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer`,children:[R.scanNotices,` (`,i.notices.length,`)`]}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:i.notices.map(k)})]})]}),he;t[17]!==pe||t[18]!==q||t[19]!==me?(he=(0,D.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4 sm:p-5`,children:[pe,q,me]}),t[17]=pe,t[18]=q,t[19]=me,t[20]=he):he=t[20];let J;t[21]===ce?J=t[22]:(J=(0,D.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-fg-muted`,children:ce}),t[21]=ce,t[22]=J);let Y;t[23]!==c||t[24]!==R.runningHint?(Y=c&&(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.runningHint}),t[23]=c,t[24]=R.runningHint,t[25]=Y):Y=t[25];let X;t[26]!==c||t[27]!==l||t[28]!==R.retryHint?(X=l&&!c&&(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.retryHint}),t[26]=c,t[27]=l,t[28]=R.retryHint,t[29]=X):X=t[29];let ge=c?R.close:R.cancel,Z;t[30]!==x||t[31]!==ge?(Z=(0,D.jsx)(_,{variant:`ghost`,onClick:x,children:ge}),t[30]=x,t[31]=ge,t[32]=Z):Z=t[32];let _e=!i||!a.size||c,ve=c?R.importing:l?R.retry:R.importSelected,Q;t[33]!==O||t[34]!==_e||t[35]!==ve?(Q=(0,D.jsx)(_,{disabled:_e,onClick:O,children:ve}),t[33]=O,t[34]=_e,t[35]=ve,t[36]=Q):Q=t[36];let $;t[37]!==Z||t[38]!==Q?($=(0,D.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[Z,Q]}),t[37]=Z,t[38]=Q,t[39]=$):$=t[39];let ye;return t[40]!==J||t[41]!==Y||t[42]!==X||t[43]!==$?(ye=(0,D.jsxs)(`footer`,{className:`shrink-0 space-y-3 border-t border-edge p-4 sm:p-5`,children:[J,Y,X,$]}),t[40]=J,t[41]=Y,t[42]=X,t[43]=$,t[44]=ye):ye=t[44],(0,D.jsx)(g,{open:n,onOpenChange:G,children:(0,D.jsxs)(p,{children:[K,(0,D.jsxs)(m,{className:`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),760px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel outline-none ${v}`,children:[(0,D.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-4 sm:p-5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsx)(h,{className:`text-lg font-semibold text-fg`,children:R.chooseTitle.replace(`{source}`,r)}),(0,D.jsx)(f,{asChild:!0,children:(0,D.jsx)(_,{variant:`ghost`,"aria-label":R.close,className:`h-8 w-8 shrink-0 p-0`,children:de})})]}),(0,D.jsx)(d,{className:`text-sm text-fg-muted`,children:R.chooseHint}),(0,D.jsx)(`input`,{"aria-label":R.search,placeholder:R.search,value:z,onChange:fe,className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg`})]}),he,ye]})]})})}function k(e,t){return(0,D.jsx)(`li`,{className:`break-words`,children:e},t)}function A(e){return e.kind===`context`}function j(e){return e.kind===`skill`}function M(e){return e.kind===`project`}function N(e){return e.kind===`project`}function P(e){return e.kind===`project`}function F(e){return e.kind===`project`}function I(e){return e.kind===`context`}function L(e){return e.kind===`skill`}function re(e){return e.language}function ie(e){let t=(0,w.c)(54),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=ee(z),c;t[0]===s?c=t[1]:(c=te(s),t[0]=s,t[1]=c);let l=c.imports,[u,d]=(0,S.useState)(),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(!1),g;t[2]!==n||t[3]!==r.id||t[4]!==u?(g=async function(){if(h(R),!u)try{d(await C(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;p(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=u,t[5]=g):g=t[5];let v=g,y;t[6]!==a||t[7]!==r?(y=a||!T(r),t[6]=a,t[7]=r,t[8]=y):y=t[8];let b;t[9]===o?b=t[10]:(b=e=>o(e.target.checked),t[9]=o,t[10]=b);let x;t[11]!==i||t[12]!==y||t[13]!==b?(x=(0,D.jsx)(`input`,{type:`checkbox`,className:`mt-1 h-4 w-4 shrink-0 accent-accent`,checked:i,disabled:y,onChange:b}),t[11]=i,t[12]=y,t[13]=b,t[14]=x):x=t[14];let E;t[15]===r.name?E=t[16]:(E=(0,D.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=E);let O;t[17]===r.displayPath?O=t[18]:(O=(0,D.jsx)(`span`,{className:`block break-all text-xs text-fg-muted`,children:r.displayPath}),t[17]=r.displayPath,t[18]=O);let k;t[19]!==E||t[20]!==O?(k=(0,D.jsxs)(`span`,{className:`min-w-0`,children:[E,O]}),t[19]=E,t[20]=O,t[21]=k):k=t[21];let A;t[22]!==x||t[23]!==k?(A=(0,D.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3`,children:[x,k]}),t[22]=x,t[23]=k,t[24]=A):A=t[24];let j;t[25]!==r.kind||t[26]!==r.name||t[27]!==r.status||t[28]!==l||t[29]!==v?(j=r.kind!==`project`&&r.status!==`blocked`&&(0,D.jsx)(_,{variant:`ghost`,"aria-label":`${l.preview}: ${r.name}`,onClick:()=>void v(),children:l.preview}),t[25]=r.kind,t[26]=r.name,t[27]=r.status,t[28]=l,t[29]=v,t[30]=j):j=t[30];let M;t[31]!==A||t[32]!==j?(M=(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[A,j]}),t[31]=A,t[32]=j,t[33]=M):M=t[33];let N;t[34]===r.description?N=t[35]:(N=r.description&&(0,D.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[34]=r.description,t[35]=N);let P;t[36]!==r.kind||t[37]!==r.status||t[38]!==r.targetName||t[39]!==l?(P=r.status!==`ready`&&(0,D.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[r.kind===`project`&&r.status===`existing`?l.existingProject:l.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[36]=r.kind,t[37]=r.status,t[38]=r.targetName,t[39]=l,t[40]=P):P=t[40];let F;t[41]===r.reason?F=t[42]:(F=r.reason&&(0,D.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[41]=r.reason,t[42]=F);let I;t[43]!==u||t[44]!==f||t[45]!==m||t[46]!==l?(I=m&&(0,D.jsx)(`div`,{className:`ml-7 rounded-lg border border-edge p-3`,children:f?(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:f}):u?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:u.text}),u.truncated&&(0,D.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l.previewTruncated})]}):(0,D.jsx)(ne,{sections:1})}),t[43]=u,t[44]=f,t[45]=m,t[46]=l,t[47]=I):I=t[47];let L;return t[48]!==M||t[49]!==N||t[50]!==P||t[51]!==F||t[52]!==I?(L=(0,D.jsxs)(`div`,{className:`min-w-0 space-y-1 rounded-lg p-1`,children:[M,N,P,F,I]}),t[48]=M,t[49]=N,t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53],L}function R(e){return!e}function z(e){return e.language}function ae(){let e=te(ee(e=>e.language)).imports,[t,n]=(0,S.useState)(),[r,s]=(0,S.useState)(),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(),[f,p]=(0,S.useState)(new Set),[m,h]=(0,S.useState)(!1),[g,v]=(0,S.useState)(),[y,w]=(0,S.useState)(),[T,E]=(0,S.useState)(``),[k,A]=(0,S.useState)(``),[j,M]=(0,S.useState)(0),N=(0,S.useRef)(null),P=(0,S.useRef)(!1);(0,S.useEffect)(()=>{let e=new AbortController;return E(``),C(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||E(t instanceof Error?t.message:String(t))}),()=>{e.abort(),N.current?.abort()}},[j]);let F=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,S.useEffect)(()=>{if(!F)return;let e=new AbortController,t,n=async()=>{for(let t of F.split(`,`))try{let n=await C(`/runs/${t}`,void 0,e.signal);e.signal.aborted||I(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[F]);function I(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&v(t=>t?.requestId===e.id?void 0:t)}async function L(e){N.current?.abort();let t=new AbortController;N.current=t,s(e),l(!0),d(void 0),p(new Set),A(``),w(void 0),v(void 0);try{let n=await C(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(d(n),p(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||A(e instanceof Error?e.message:String(e))}}async function re(){if(!u||!f.size||P.current)return;P.current=!0,h(!0),A(``),E(``);let e=g??{inventoryId:u.id,candidateIds:[...f],requestId:crypto.randomUUID(),retryOf:y};v(e);try{I(await C(`/runs`,e)),l(!1)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),E(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&v(void 0)}finally{P.current=!1,h(!1)}}async function ie(e){s(e.source),l(!0),d(void 0),p(new Set),A(``),v(void 0),w(e.id),N.current?.abort();let t=new AbortController;N.current=t;try{let n=await C(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),d({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),p(r)}catch(e){t.signal.aborted||A(e instanceof Error?e.message:String(e))}}let R=t?.filter(e=>e.detected||e.lastImport);return(0,D.jsxs)(x,{children:[(0,D.jsx)(b,{title:e.title,subtitle:e.subtitle}),T&&(0,D.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-edge p-4 text-sm text-fg`,children:[(0,D.jsx)(`p`,{children:T}),!t&&(0,D.jsx)(_,{variant:`ghost`,onClick:()=>M(e=>e+1),children:e.retry})]}),!t&&!T&&(0,D.jsx)(ne,{sections:1}),t&&(0,D.jsxs)(`section`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),R?.length?(0,D.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge`,children:R.map(t=>(0,D.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,D.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,D.jsx)(o,{className:`h-5 w-5`})}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,D.jsx)(_,{variant:`secondary`,disabled:m||!t.detected||!!g&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{E(``),g&&r===t.id?l(!0):L(t.id)},children:m&&r===t.id?e.importing:g&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,D.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,D.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,D.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,D.jsxs)(`details`,{children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,D.jsxs)(`li`,{className:`break-words`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,D.jsx)(_,{variant:`ghost`,disabled:m||!!g,onClick:()=>void ie(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,D.jsxs)(`div`,{className:`rounded-2xl border border-edge p-6 text-sm text-fg-muted`,children:[(0,D.jsx)(`p`,{children:e.empty}),(0,D.jsx)(_,{variant:`ghost`,className:`mt-3`,onClick:()=>M(e=>e+1),children:e.refresh})]}),(0,D.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),R?.some(e=>e.lastImport)&&(0,D.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,D.jsx)(i,{className:`text-accent`,to:`/skills`,children:e.openSkills}),(0,D.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,D.jsx)(i,{className:`text-accent`,to:`/connectors`,children:e.connections})]})]}),(0,D.jsx)(O,{open:c,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:u,selected:f,onSelected:p,busy:m,locked:m||!!g,error:k,onClose:()=>{N.current?.abort(),l(!1)},onRefresh:()=>{r&&L(r)},onSubmit:()=>void re()})]})}export{ae as ImportsPage};
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-Cq1tE_3b.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./x-B_N4OPjy.js";import{a as c,n as ee,r as l}from"./locale-store-DLK05Y1a.js";import{t as te}from"./messages-C9h8SImu.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./button-CGlRPNzi.js";import{i as v,o as y}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as b,r as x}from"./settings-page-layout-X1x-2Cp9.js";import{n as ne}from"./settings-loading-skeleton-CAmWMaOT.js";var S=e(t(),1);async function C(e,t,n){return(await c(l(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var w=n();function T(e){return e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`}function E(e,t,n,r){let i=new Set(t);if(!T(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&T(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var D=r();function O(e){let t=(0,w.c)(45),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:c,locked:l,error:b,onClose:x,onRefresh:C,onSubmit:O}=e,R=te(ee(re)).imports,[z,ae]=(0,S.useState)(``),oe;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>ae(``),t[0]=oe):oe=t[0];let se=i?.id,B;t[1]===se?B=t[2]:(B=[se],t[1]=se,t[2]=B),(0,S.useEffect)(oe,B);let V;t[3]===z?V=t[4]:(V=e=>`${e.name} ${e.description} ${e.displayPath}`.toLowerCase().includes(z.toLowerCase().trim()),t[3]=z,t[4]=V);let H=V,U=i?.candidates.filter(e=>a.has(e.id))??[],ce=R.selected.replace(`{skills}`,String(U.filter(L).length)).replace(`{context}`,String(U.filter(I).length)).replace(`{projects}`,String(U.filter(F).length)),W;t[5]!==i||t[6]!==o||t[7]!==a?(W=(e,t)=>{i&&o(E(i,a,e,t))},t[5]=i,t[6]=o,t[7]=a,t[8]=W):W=t[8];let le=W,ue=e=>{let t=i.candidates.filter(t=>t.kind===e&&!t.parentId);if(!t.length)return null;let n=t.filter(H);return(0,D.jsxs)(`section`,{className:`space-y-2`,"aria-label":R.kinds[e],children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsxs)(`h3`,{className:`text-sm font-medium text-fg`,children:[R.kinds[e],` · `,t.filter(e=>a.has(e.id)).length,`/`,t.length]}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(_,{variant:`ghost`,disabled:l||!n.some(T),onClick:()=>{let e=new Set(a);n.filter(T).forEach(t=>e.add(t.id)),o(e)},children:R.selectVisible}),(0,D.jsx)(_,{variant:`ghost`,disabled:l,onClick:()=>{let e=new Set(a);n.forEach(t=>e.delete(t.id)),o(e)},children:R.clearVisible})]})]}),n.map(e=>(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)},e.id))]})},G;t[9]===x?G=t[10]:(G=e=>{e||x()},t[9]=x,t[10]=G);let K;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,D.jsx)(u,{className:`fixed inset-0 bg-scrim ${y}`}),t[11]=K):K=t[11];let de;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,D.jsx)(s,{className:`h-4 w-4`}),t[12]=de):de=t[12];let fe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>ae(e.target.value),t[13]=fe):fe=t[13];let pe=b&&(0,D.jsxs)(`div`,{role:`alert`,className:`space-y-2 rounded-lg border border-edge p-3 text-sm text-fg`,children:[(0,D.jsx)(`p`,{children:b}),(0,D.jsx)(_,{variant:`secondary`,disabled:l,onClick:C,children:R.refresh})]}),q;t[14]!==b||t[15]!==i?(q=!i&&!b&&(0,D.jsx)(ne,{sections:2}),t[14]=b,t[15]=i,t[16]=q):q=t[16];let me=i&&(0,D.jsxs)(D.Fragment,{children:[!i.complete&&(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R.incomplete}),ue(`skill`),ue(`context`),(0,D.jsxs)(`section`,{"aria-label":R.kinds.project,className:`space-y-2`,children:[(0,D.jsxs)(`h3`,{className:`text-sm font-medium text-fg`,children:[R.kinds.project,` · `,U.filter(P).length,`/`,i.candidates.filter(N).length]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.projectHint}),i.candidates.filter(M).map(e=>{let t=i.candidates.filter(t=>t.parentId===e.id);return!H(e)&&!t.some(H)?null:(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)}),t.length?(0,D.jsxs)(`details`,{open:z.trim()?!0:void 0,className:`mt-2 text-sm text-fg-muted`,children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer`,children:[R.projectContents.replace(`{skills}`,String(t.filter(j).length)).replace(`{context}`,String(t.filter(A).length)),` · `,R.chosenCount.replace(`{count}`,String(t.filter(e=>a.has(e.id)).length))]}),(0,D.jsx)(`div`,{className:`mt-2 space-y-2 border-l border-edge pl-3`,children:t.filter(t=>H(e)||H(t)).map(e=>(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)},e.id))})]}):(0,D.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:R.directoryOnly})]},e.id)})]}),!i.candidates.length&&(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R.noContent}),!!i.notices.length&&(0,D.jsxs)(`details`,{className:`text-sm text-fg-muted`,children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer`,children:[R.scanNotices,` (`,i.notices.length,`)`]}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:i.notices.map(k)})]})]}),he;t[17]!==pe||t[18]!==q||t[19]!==me?(he=(0,D.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4 sm:p-5`,children:[pe,q,me]}),t[17]=pe,t[18]=q,t[19]=me,t[20]=he):he=t[20];let J;t[21]===ce?J=t[22]:(J=(0,D.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-fg-muted`,children:ce}),t[21]=ce,t[22]=J);let Y;t[23]!==c||t[24]!==R.runningHint?(Y=c&&(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.runningHint}),t[23]=c,t[24]=R.runningHint,t[25]=Y):Y=t[25];let X;t[26]!==c||t[27]!==l||t[28]!==R.retryHint?(X=l&&!c&&(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.retryHint}),t[26]=c,t[27]=l,t[28]=R.retryHint,t[29]=X):X=t[29];let ge=c?R.close:R.cancel,Z;t[30]!==x||t[31]!==ge?(Z=(0,D.jsx)(_,{variant:`ghost`,onClick:x,children:ge}),t[30]=x,t[31]=ge,t[32]=Z):Z=t[32];let _e=!i||!a.size||c,ve=c?R.importing:l?R.retry:R.importSelected,Q;t[33]!==O||t[34]!==_e||t[35]!==ve?(Q=(0,D.jsx)(_,{disabled:_e,onClick:O,children:ve}),t[33]=O,t[34]=_e,t[35]=ve,t[36]=Q):Q=t[36];let $;t[37]!==Z||t[38]!==Q?($=(0,D.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[Z,Q]}),t[37]=Z,t[38]=Q,t[39]=$):$=t[39];let ye;return t[40]!==J||t[41]!==Y||t[42]!==X||t[43]!==$?(ye=(0,D.jsxs)(`footer`,{className:`shrink-0 space-y-3 border-t border-edge p-4 sm:p-5`,children:[J,Y,X,$]}),t[40]=J,t[41]=Y,t[42]=X,t[43]=$,t[44]=ye):ye=t[44],(0,D.jsx)(g,{open:n,onOpenChange:G,children:(0,D.jsxs)(p,{children:[K,(0,D.jsxs)(m,{className:`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),760px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel outline-none ${v}`,children:[(0,D.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-4 sm:p-5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsx)(h,{className:`text-lg font-semibold text-fg`,children:R.chooseTitle.replace(`{source}`,r)}),(0,D.jsx)(f,{asChild:!0,children:(0,D.jsx)(_,{variant:`ghost`,"aria-label":R.close,className:`h-8 w-8 shrink-0 p-0`,children:de})})]}),(0,D.jsx)(d,{className:`text-sm text-fg-muted`,children:R.chooseHint}),(0,D.jsx)(`input`,{"aria-label":R.search,placeholder:R.search,value:z,onChange:fe,className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg`})]}),he,ye]})]})})}function k(e,t){return(0,D.jsx)(`li`,{className:`break-words`,children:e},t)}function A(e){return e.kind===`context`}function j(e){return e.kind===`skill`}function M(e){return e.kind===`project`}function N(e){return e.kind===`project`}function P(e){return e.kind===`project`}function F(e){return e.kind===`project`}function I(e){return e.kind===`context`}function L(e){return e.kind===`skill`}function re(e){return e.language}function ie(e){let t=(0,w.c)(54),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=ee(z),c;t[0]===s?c=t[1]:(c=te(s),t[0]=s,t[1]=c);let l=c.imports,[u,d]=(0,S.useState)(),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(!1),g;t[2]!==n||t[3]!==r.id||t[4]!==u?(g=async function(){if(h(R),!u)try{d(await C(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;p(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=u,t[5]=g):g=t[5];let v=g,y;t[6]!==a||t[7]!==r?(y=a||!T(r),t[6]=a,t[7]=r,t[8]=y):y=t[8];let b;t[9]===o?b=t[10]:(b=e=>o(e.target.checked),t[9]=o,t[10]=b);let x;t[11]!==i||t[12]!==y||t[13]!==b?(x=(0,D.jsx)(`input`,{type:`checkbox`,className:`mt-1 h-4 w-4 shrink-0 accent-accent`,checked:i,disabled:y,onChange:b}),t[11]=i,t[12]=y,t[13]=b,t[14]=x):x=t[14];let E;t[15]===r.name?E=t[16]:(E=(0,D.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=E);let O;t[17]===r.displayPath?O=t[18]:(O=(0,D.jsx)(`span`,{className:`block break-all text-xs text-fg-muted`,children:r.displayPath}),t[17]=r.displayPath,t[18]=O);let k;t[19]!==E||t[20]!==O?(k=(0,D.jsxs)(`span`,{className:`min-w-0`,children:[E,O]}),t[19]=E,t[20]=O,t[21]=k):k=t[21];let A;t[22]!==x||t[23]!==k?(A=(0,D.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3`,children:[x,k]}),t[22]=x,t[23]=k,t[24]=A):A=t[24];let j;t[25]!==r.kind||t[26]!==r.name||t[27]!==r.status||t[28]!==l||t[29]!==v?(j=r.kind!==`project`&&r.status!==`blocked`&&(0,D.jsx)(_,{variant:`ghost`,"aria-label":`${l.preview}: ${r.name}`,onClick:()=>void v(),children:l.preview}),t[25]=r.kind,t[26]=r.name,t[27]=r.status,t[28]=l,t[29]=v,t[30]=j):j=t[30];let M;t[31]!==A||t[32]!==j?(M=(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[A,j]}),t[31]=A,t[32]=j,t[33]=M):M=t[33];let N;t[34]===r.description?N=t[35]:(N=r.description&&(0,D.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[34]=r.description,t[35]=N);let P;t[36]!==r.kind||t[37]!==r.status||t[38]!==r.targetName||t[39]!==l?(P=r.status!==`ready`&&(0,D.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[r.kind===`project`&&r.status===`existing`?l.existingProject:l.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[36]=r.kind,t[37]=r.status,t[38]=r.targetName,t[39]=l,t[40]=P):P=t[40];let F;t[41]===r.reason?F=t[42]:(F=r.reason&&(0,D.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[41]=r.reason,t[42]=F);let I;t[43]!==u||t[44]!==f||t[45]!==m||t[46]!==l?(I=m&&(0,D.jsx)(`div`,{className:`ml-7 rounded-lg border border-edge p-3`,children:f?(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:f}):u?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:u.text}),u.truncated&&(0,D.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l.previewTruncated})]}):(0,D.jsx)(ne,{sections:1})}),t[43]=u,t[44]=f,t[45]=m,t[46]=l,t[47]=I):I=t[47];let L;return t[48]!==M||t[49]!==N||t[50]!==P||t[51]!==F||t[52]!==I?(L=(0,D.jsxs)(`div`,{className:`min-w-0 space-y-1 rounded-lg p-1`,children:[M,N,P,F,I]}),t[48]=M,t[49]=N,t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53],L}function R(e){return!e}function z(e){return e.language}function ae(){let e=te(ee(e=>e.language)).imports,[t,n]=(0,S.useState)(),[r,s]=(0,S.useState)(),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(),[f,p]=(0,S.useState)(new Set),[m,h]=(0,S.useState)(!1),[g,v]=(0,S.useState)(),[y,w]=(0,S.useState)(),[T,E]=(0,S.useState)(``),[k,A]=(0,S.useState)(``),[j,M]=(0,S.useState)(0),N=(0,S.useRef)(null),P=(0,S.useRef)(!1);(0,S.useEffect)(()=>{let e=new AbortController;return E(``),C(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||E(t instanceof Error?t.message:String(t))}),()=>{e.abort(),N.current?.abort()}},[j]);let F=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,S.useEffect)(()=>{if(!F)return;let e=new AbortController,t,n=async()=>{for(let t of F.split(`,`))try{let n=await C(`/runs/${t}`,void 0,e.signal);e.signal.aborted||I(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[F]);function I(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&v(t=>t?.requestId===e.id?void 0:t)}async function L(e){N.current?.abort();let t=new AbortController;N.current=t,s(e),l(!0),d(void 0),p(new Set),A(``),w(void 0),v(void 0);try{let n=await C(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(d(n),p(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||A(e instanceof Error?e.message:String(e))}}async function re(){if(!u||!f.size||P.current)return;P.current=!0,h(!0),A(``),E(``);let e=g??{inventoryId:u.id,candidateIds:[...f],requestId:crypto.randomUUID(),retryOf:y};v(e);try{I(await C(`/runs`,e)),l(!1)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),E(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&v(void 0)}finally{P.current=!1,h(!1)}}async function ie(e){s(e.source),l(!0),d(void 0),p(new Set),A(``),v(void 0),w(e.id),N.current?.abort();let t=new AbortController;N.current=t;try{let n=await C(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),d({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),p(r)}catch(e){t.signal.aborted||A(e instanceof Error?e.message:String(e))}}let R=t?.filter(e=>e.detected||e.lastImport);return(0,D.jsxs)(x,{children:[(0,D.jsx)(b,{title:e.title,subtitle:e.subtitle}),T&&(0,D.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,D.jsx)(`p`,{children:T}),!t&&(0,D.jsx)(_,{variant:`ghost`,onClick:()=>M(e=>e+1),children:e.retry})]}),!t&&!T&&(0,D.jsx)(ne,{sections:1}),t&&(0,D.jsxs)(`section`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),R?.length?(0,D.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:R.map(t=>(0,D.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,D.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,D.jsx)(o,{className:`h-5 w-5`})}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,D.jsx)(_,{variant:`secondary`,disabled:m||!t.detected||!!g&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{E(``),g&&r===t.id?l(!0):L(t.id)},children:m&&r===t.id?e.importing:g&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,D.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,D.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,D.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,D.jsxs)(`details`,{children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,D.jsxs)(`li`,{className:`break-words`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,D.jsx)(_,{variant:`ghost`,disabled:m||!!g,onClick:()=>void ie(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,D.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,D.jsx)(`p`,{children:e.empty}),(0,D.jsx)(_,{variant:`ghost`,className:`mt-3`,onClick:()=>M(e=>e+1),children:e.refresh})]}),(0,D.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),R?.some(e=>e.lastImport)&&(0,D.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,D.jsx)(i,{className:`text-accent`,to:`/skills`,children:e.openSkills}),(0,D.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,D.jsx)(i,{className:`text-accent`,to:`/connectors`,children:e.connections})]})]}),(0,D.jsx)(O,{open:c,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:u,selected:f,onSelected:p,busy:m,locked:m||!!g,error:k,onClose:()=>{N.current?.abort(),l(!1)},onRefresh:()=>{r&&L(r)},onSubmit:()=>void re()})]})}export{ae as ImportsPage};